am335x reboot 命令分析
本文记录am335x运行reboot命令时,内核中运行过程。
Tony Liu, 2016-6-8, Shenzhen
参考链接:
http://blog.csdn.net/wavemcu/article/details/8544333
kernel/sys.c
void kernel_restart(char *cmd)
{
kernel_restart_prepare(cmd); ---------------+
if (!cmd) |
printk(KERN_EMERG "Restarting system.\n"); |
else |
printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd); |
kmsg_dump(KMSG_DUMP_RESTART); |
machine_restart(cmd); ----------------+ |
} | |
EXPORT_SYMBOL_GPL(kernel_restart); | |
| |
void kernel_restart_prepare(char *cmd) <--------------|---+
{ |
blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);|
system_state = SYSTEM_RESTART; |
usermodehelper_disable(); |
device_shutdown(); |
syscore_shutdown(); |
} |
|
void machine_restart(char *cmd) <------------------+
{
machine_shutdown(); ------------+
|
arm_pm_restart(reboot_mode, cmd); --------------+
| |
/* Give a grace period for failure to restart of 1s */ | |
mdelay(1000); | |
| |
/* Whoops - the platform was unable to reboot. Tell the user! */ | |
printk("Reboot failed -- System halted\n"); | |
while (1); | |
} | |
| |
void machine_shutdown(void) <------------+ |
{ |
#ifdef CONFIG_SMP |
smp_send_stop(); |
#endif |
} |
|
void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart; <-+
EXPORT_SYMBOL_GPL(arm_pm_restart);
void arm_machine_restart(char mode, const char *cmd)
{
/* Flush the console to make sure all the relevant messages make it
* out to the console drivers */
arm_machine_flush_console();
/* Disable interrupts first */
local_irq_disable();
local_fiq_disable();
/* Call the architecture specific reboot code. */
arch_reset(mode, cmd); ------+
} |
|
|
arch/arm/mach-omap2/prcm.c |
void (*arch_reset)(char, const char *) = omap_prcm_arch_reset; |
|
static void omap_prcm_arch_reset(char mode, const char *cmd) <------+
{
s16 prcm_offs = 0;
unsigned int val;
if (cpu_is_omap24xx()) {
omap2xxx_clk_prepare_for_reboot();
prcm_offs = WKUP_MOD;
} else if (cpu_is_am33xx()) {
prcm_offs = AM33XX_PRM_DEVICE_MOD;
//这里设置的是冷启动的方式
omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_COLD_SW_MASK,
prcm_offs, AM33XX_PRM_RSTCTRL_OFFSET);
//热启动方式如下
//omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_WARM_SW_MASK,
// prcm_offs, AM33XX_PRM_RSTCTRL_OFFSET);
} else if (cpu_is_omap34xx()) {
prcm_offs = OMAP3430_GR_MOD;
omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
} else if (cpu_is_omap44xx()) {
omap4_prminst_global_warm_sw_reset(); /* never returns */
} else {
WARN_ON(1);
}
/*
* As per Errata i520, in some cases, user will not be able to
* access DDR memory after warm-reset.
* This situation occurs while the warm-reset happens during a read
* access to DDR memory. In that particular condition, DDR memory
* does not respond to a corrupted read command due to the warm
* reset occurrence but SDRC is waiting for read completion.
* SDRC is not sensitive to the warm reset, but the interconnect is
* reset on the fly, thus causing a misalignment between SDRC logic,
* interconnect logic and DDR memory state.
* WORKAROUND:
* Steps to perform before a Warm reset is trigged:
* 1. enable self-refresh on idle request
* 2. put SDRC in idle
* 3. wait until SDRC goes to idle
* 4. generate SW reset (Global SW reset)
*
* Steps to be performed after warm reset occurs (in bootloader):
* if HW warm reset is the source, apply below steps before any
* accesses to SDRAM:
* 1. Reset SMS and SDRC and wait till reset is complete
* 2. Re-initialize SMS, SDRC and memory
*
* NOTE: Above work around is required only if arch reset is implemented
* using Global SW reset(GLOBAL_SW_RST). DPLL3 reset does not need
* the WA since it resets SDRC as well as part of cold reset.
*/
/* XXX should be moved to some OMAP2/3 specific code */
omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
OMAP2_RM_RSTCTRL);
omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
val = omap2_prm_read_mod_reg(prcm_offs, AM33XX_PRM_RSTTIME_OFFSET);
printk(KERN_ALERT "<<Tony>> reset time value 2: %x\n", val);
}
am335x reboot 命令分析的更多相关文章
- 基于linux与busybox的reboot命令流程分析
http://www.xuebuyuan.com/736763.html 基于Linux与Busybox的Reboot命令流程分析 ********************************** ...
- Linux命令学习总结:reboot命令
命令简介: 该命令用来重启Linux系统.相当于Windows系统中的restart命令. 命令语法: /sbin/reboot [-n] [-w] [-d] [-f] [-i] 或 reboot [ ...
- 【摘】linux之shutdown、halt和reboot命令详解
在重新启动Linux系统的同时把内存中的信息写入硬盘,应使用()命令实现 #shutdown -r now #halt #reboot #init3 正确答案:A 在linux命令中reboot是 ...
- 理解Linux中的shutdown、poweroff、halt和reboot命令
原文 http://os.51cto.com/art/201706/541525.htm 在本篇中,我们会向你解释 shutdown.poweroff.halt 以及 reboot 命令.我们会 ...
- MySQL中使用SHOW PROFILE命令分析性能的用法整理(配合explain效果更好,可以作为优化周期性检查)
这篇文章主要介绍了MySQL中使用show profile命令分析性能的用法整理,show profiles是数据库性能优化的常用命令,需要的朋友可以参考下 show profile是由Jerem ...
- AIX系统谨慎使用reboot命令
在客户一次停机维护中,发现了这个问题. 环境是ORACLE 10G RAC for AIX6,使用了HACMP管理共享磁盘. 在停机维护时间段内需要重启主机,当关闭了数据库和CLUSTER后,节点1使 ...
- nohup 、&、 2>&1 命令分析
nohup的意思是不间断的运行,&的意思是后台运行,2>&1的意思是标准输出和错误输出都重定向到同一个文件. 简单地说nohup运行时即使关掉控制台,它该运行还是运行. http ...
- 利用shell命令分析服务器日志
在没有专业日志分析系统的情况下,我们有时需要对日志进行简单的分析,下面列出一些常用的shell命令分析日志的方法,一定要收藏 1.查看有多少个ip访问 awk '{print $1}' log_f ...
- linux日常常用命令分析
日志处理: 测试网络路由: xargs使用方法: tcpdump命令分析: dd 写入磁盘测试 cpu个数: 查看网卡流量 查看端口联通情况,临时加端口 ntpdate同步: 可以取出变动的密码: 导 ...
随机推荐
- Linux内核“问题门” - 学习问题、经验集锦
陈宪章说:“学贵有疑,小疑则小进,大疑则大进.疑者,觉悟之机也,一番觉悟一番长进.” 培根说:“多问的人将多得.” 还在学校的时候导师在激情讲演之后对着会议室里形态各异但均静默不语的我们痛心疾首的说: ...
- Axure多人协作
这几天搞<材料採购系统>需求.我们组须要分模块画模型图,可是假设每一个人各自画各自的,最后整合,这样就太麻烦了.小左说Axure能够实现多人协作,于是我就研究了一下.我们组已经在用了.以下 ...
- OpenGL核心之SSAO技术解说(一)
笔者介绍:姜雪伟,IT公司技术合伙人.IT高级讲师,CSDN社区专家,特邀编辑,畅销书作者,国家专利发明人;已出版书籍:<手把手教你架构3D游戏引擎>电子工业出版社和<Unity3D ...
- kafka linux 启动脚本 sample
#!/bin/sh # # chkconfig: 345 99 01 # description: Kafka # # File : Kafka # # Description: Starts and ...
- django中数据库的相关操作
一.使用环境 python2.7,django>1.7 二.数据库进行配置 在setting文件中进行修改 1.找到DATABASES DATABASES = { 'default': { 'E ...
- 分享九:php易混淆的语法
一:php后期静态绑定 从php5.3开始,php增加了一个叫后期绑定的功能,用于在继承范围内引用静态调用的类 该功能从语言内部角度考虑北命名为“后期静态绑定”:“后期绑定”意思说:static::不 ...
- Spring Bean的生命周期详解(转)
Spring作为当前Java最流行.最强大的轻量级框架,受到了程序员的热烈欢迎.准确的了解Spring Bean的生命周期是非常必要的.我们通常使用ApplicationContext作为Spring ...
- 详解设计模式在Spring中的应用---转载
Spring作为业界的经典框架,无论是在架构设计方面,还是在代码编写方面,都堪称行内典范.好了,话不多说,开始今天的内容. spring中常用的设计模式达到九种,我们一一举例: 第一种:简单工厂 又叫 ...
- Memory Analyzer tool(MAT)分析内存泄漏---理解Retained Heap、Shallow Heap、GC Root
Shallow Heap Size 指对象自身所占用的内存大小,不包含其引用的对象所占的内存大小. 1.数组类型 数组元素对象所占内存的大小总和. 2.非数组类型 对象与它所有的成员变量大小的总和.当 ...
- VS2012插件推荐
其实Metro的感觉有了,但是这两种配色都不太喜欢..白色太扎眼,黑色太瞎眼……有木有灰色的啊喂(有没有其他主题?看后面↓) 黑色主题绝对是熬夜码农必备……但是十分不适合在白天使用. 下面来分享几个好 ...