本文记录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 命令分析的更多相关文章

  1. 基于linux与busybox的reboot命令流程分析

    http://www.xuebuyuan.com/736763.html 基于Linux与Busybox的Reboot命令流程分析 ********************************** ...

  2. Linux命令学习总结:reboot命令

    命令简介: 该命令用来重启Linux系统.相当于Windows系统中的restart命令. 命令语法: /sbin/reboot [-n] [-w] [-d] [-f] [-i] 或 reboot [ ...

  3. 【摘】linux之shutdown、halt和reboot命令详解

    在重新启动Linux系统的同时把内存中的信息写入硬盘,应使用()命令实现 #shutdown -r now #halt #reboot #init3 正确答案:A   在linux命令中reboot是 ...

  4. 理解Linux中的shutdown、poweroff、halt和reboot命令

    原文  http://os.51cto.com/art/201706/541525.htm   在本篇中,我们会向你解释 shutdown.poweroff.halt 以及 reboot 命令.我们会 ...

  5. MySQL中使用SHOW PROFILE命令分析性能的用法整理(配合explain效果更好,可以作为优化周期性检查)

    这篇文章主要介绍了MySQL中使用show profile命令分析性能的用法整理,show profiles是数据库性能优化的常用命令,需要的朋友可以参考下   show profile是由Jerem ...

  6. AIX系统谨慎使用reboot命令

    在客户一次停机维护中,发现了这个问题. 环境是ORACLE 10G RAC for AIX6,使用了HACMP管理共享磁盘. 在停机维护时间段内需要重启主机,当关闭了数据库和CLUSTER后,节点1使 ...

  7. nohup 、&、 2>&1 命令分析

    nohup的意思是不间断的运行,&的意思是后台运行,2>&1的意思是标准输出和错误输出都重定向到同一个文件. 简单地说nohup运行时即使关掉控制台,它该运行还是运行. http ...

  8. 利用shell命令分析服务器日志

      在没有专业日志分析系统的情况下,我们有时需要对日志进行简单的分析,下面列出一些常用的shell命令分析日志的方法,一定要收藏 1.查看有多少个ip访问 awk '{print $1}' log_f ...

  9. linux日常常用命令分析

    日志处理: 测试网络路由: xargs使用方法: tcpdump命令分析: dd 写入磁盘测试 cpu个数: 查看网卡流量 查看端口联通情况,临时加端口 ntpdate同步: 可以取出变动的密码: 导 ...

随机推荐

  1. GDI+ 怎样将图片绘制成圆形的图片

    大概意思就是不生成新的图片,而是将图片转换为圆形图片. 实现代码例如以下: private Image CutEllipse(Image img, Rectangle rec, Size size) ...

  2. Effective C++:条款33:避免遮掩继承而来的名称

    (一) 以下这段代码: int x; void someFunc() { double x; //local variable std::cin>>x; //read a new valu ...

  3. windows下配置nginx+php环境(转)

    刚看到nginx这个词,我很好奇它的读法(engine x),我的直译是“引擎x”,一般引“擎代”表了性能,而“x”大多出现是表示“xtras(额外的效果)”,那么整个词的意思就是类似“极致效果”,“ ...

  4. Android利用Fiddler进行网络数据抓包【怎么跟踪微信请求】

    主要介绍Android及IPhone手机上如何利用Fiddler进行网络数据抓包,比如我们想抓某个应用(微博.微信.墨迹天气)的网络通信请求就可以利用这个方法. Mac 下请使用 Charles 代替 ...

  5. jquery定时器的简单代码

    当收到消息的时候能够及时的刷新,显示收到消息的条数,下面与大分享下使用简单的代码实现jquery定时器 简单的代码实现jquery定时器. 今天,项目遇到一个消息的模块,在导航条最上面.想实现,当收到 ...

  6. linux进程 kipmi0

    top 发现负载很低,没有连接的时候,一个进程经常跳到最前面,用户是root, 命令是 kipmi0 ,  后来查询了一下,很可能 是外部设备要使用到的 IPMI , 智能型平台管理接口(Intell ...

  7. [phpcms v9]自定义表单添加验证码验证功能

    修改  \phpcms\templates\default\formguide\show.html 中添加验证码显示 <input type="text" id=" ...

  8. TreeView 高速单击时不运行AfterCheck时间

    解决方法1: 在AfterCheck事件中,通过System.Threading.Thread.Sleep()来控制函数的运行的最短时间.保证函数运行时间必须大于某个值 解决方法2: 编写列TreeV ...

  9. 查看JSTL的doc解决问题

    感觉JSTL这些东西的API远比java的api难找多了,不过终究是有办法的,google:jstl documentation,进入http://docs.oracle.com/javaee/5/j ...

  10. java多线程13 : 死锁

    前言 死锁单独写一篇文章是因为这是一个很严重的.必须要引起重视的问题.这不是夸大死锁的风险,尽管锁被持有的时间通常很短,但是作为商业产品的应用程序每天可能要执行数十亿次获取锁->释放锁的操作,只 ...