本文记录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. Linux时间子系统(四) timekeeping

    一.前言 timekeeping模块是一个提供时间服务的基础模块.Linux内核提供各种time line,real time clock,monotonic clock.monotonic raw ...

  2. Python lstrip() 方法

    描述 Python lstrip() 方法用于删除字符串头部指定的字符,默认字符为所有空字符,包括空格.换行(\n).制表符(\t)等. 语法 lstrip() 方法语法: S.lstrip([cha ...

  3. oracle启动、关闭

    windows上启动关闭 http://www.cnblogs.com/victor_chou/archive/2009/07/09/1519594.html

  4. Linux中Nginx安装与配置详解 test(待整理 补全)

    http://www.linuxidc.com/Linux/2016-08/134110.htm http://www.cnblogs.com/freeweb/p/5425554.html http: ...

  5. Python之反射练习

    # 什么是反射?可以用字符串的方式去访问对象的属性 class Test(): _name = "sss" def fun(self): return "Hellowor ...

  6. 关于 二维码 与 NFC 之间的出身贫贱说

    关于 二维码 与 NFC 之间的出身贫贱说 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 ...

  7. Altera FPGA管脚弱上拉电阻详细设置方法

    Altera FPGA管脚弱上拉电阻的软件设置方法 在使用 Altera 的 FPGA 时候, 由于系统需求, 需要在管脚的内部加上上拉电阻. Quartus II 软件中在 Assignment E ...

  8. [sh]函数+条件表达式

    了解了下shell的函数和case语句: 函数格式: function(){ } 例子: function rsyncstart() { if [ "${status1}X" == ...

  9. 【Android】5.6 弹出菜单(PopUp Menus)

    分类:C#.Android.VS2015: 创建日期:2016-02-07 一.简介 功能描述:用户单击按钮弹出菜单.当用户选择一个菜单项,会触发MenuItemClick事件并让弹出的菜单消失:如果 ...

  10. SDUT 1941-Friday the Thirteenth(水)

    Friday the Thirteenth Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描写叙述  Is Friday the 13 ...