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同步: 可以取出变动的密码: 导 ...
随机推荐
- CheckedComboBoxEditExtension
public static class CheckedComboBoxEditExtension { public static void BindData(this CheckedComboBoxE ...
- gulp#4.0 Did you forget to signal async completion?
异常截图 解决方案: https://stackoverflow.com/questions/36897877/gulp-error-the-following-tasks-did-not-compl ...
- Redis(五):几个常用概念
1.Redis 默认有16384 solts(槽),每个槽可以存储多个hash值. 2.Redis 默认不需要密码: 2.1 注释去掉,设置自己的密码 3.设置密码后需要通过 3.1 -h 主机ip ...
- jQuery 隐藏与显示 input 默认值
分享下jQuery如何隐藏和显示 input 默认值的例子. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN ...
- [na]802.1x协议无线认证协议&dot1x有线认证实验
以前搞无线时候,会涉及到无线client接入方式的认证协议. 认证方式+加密方式+有线的dot1x. 注:以前都是doc粘贴到博客的,加上没写博客的习惯,因此会比较乱. EAP(扩展认证协议)是什么? ...
- [na]windows2008-AD域的安装
AD域的安装 初始化设置,改计算机名字dcserver,改静态ip,改dns指向自己. dcpromo,执行后自动装了dns 安装完后检查 1.本地用户没了 2,dns指向自己 3,dns记录是否齐全 ...
- (一)jQuery EasyUI 的EasyLoader载入原理
1.第一次看了官网的demo.引用的是EasyLoader.js文件,而不是引用jquery.easyui.min.js文件,我就有疑问了,百度一下. jQuery EasyUI是一款基于JQuery ...
- cocos2d-x Schedule详解
原理介绍 Cocos2d-x调度器为游戏提供定时事件和定时调用服务.所有Node对象都知道如何调度和取消调度事件,使用调度器有几个好处: 每当Node不再可见或已从场景中移除时,调度器会停止. Coc ...
- iOS-本地的推送
// // ViewController.m // 05-本地的推送 // // Created by hongqiangli on 2017/6/12. // #import "Vi ...
- java 多线程1:进程与线程概述
进程和线程 谈到多线程,就得先讲进程和线程的概念. 进程 进程可以理解为受操作系统管理的基本运行单元.360浏览器是一个进程.WPS也是一个进程,正在操作系统中运行的".exe"都 ...