新路程------hi3516a的reboot过程

   最近做watchdog,发现系统没有reboot成功,于是追一下正常的reboot是怎么做的

void hi3516a_restart(char mode, const char *cmd)
{
	__raw_writel(~0, IO_ADDRESS(SYS_CTRL_BASE) + REG_SC_SYSRES);
}
/*****************************************************************************/
extern struct sys_timer hi3516a_sys_timer;


MACHINE_START(HI3516A, "hi3516a")
	.atag_offset	= 0x100,
	.map_io		= hi3516a_map_io,
	.init_early	= hi3516a_init_early,
	.init_irq	= hi3516a_gic_init_irq,
	.handle_irq	= gic_handle_irq,
	.timer		= &hi3516a_sys_timer,
	.init_machine	= hi3516a_init,
	.reserve	= hi3516a_reserve,
	.restart	= hi3516a_restart,
MACHINE_END

然后是


arch/arm/setup.c 
void __init setup_arch(char **cmdline_p)
{
	struct machine_desc *mdesc;


	setup_processor();
	mdesc = setup_machine_fdt(__atags_pointer);
	if (!mdesc)
		mdesc = setup_machine_tags(machine_arch_type);
	machine_desc = mdesc;
	machine_name = mdesc->name;


#ifdef CONFIG_ZONE_DMA
	if (mdesc->dma_zone_size) {
		extern unsigned long arm_dma_zone_size;
		arm_dma_zone_size = mdesc->dma_zone_size;
	}
#endif
	if (mdesc->restart_mode)
		reboot_setup(&mdesc->restart_mode);


	init_mm.start_code = (unsigned long) _text;
	init_mm.end_code   = (unsigned long) _etext;
	init_mm.end_data   = (unsigned long) _edata;
	init_mm.brk	   = (unsigned long) _end;


	/* populate cmd_line too for later use, preserving boot_command_line */
	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
	*cmdline_p = cmd_line;


	parse_early_param();


	sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
	sanity_check_meminfo();
	arm_memblock_init(&meminfo, mdesc);


	paging_init(mdesc);
	request_standard_resources(mdesc);


	if (mdesc->restart)
		arm_pm_restart = mdesc->restart;   //here


	unflatten_device_tree();


#ifdef CONFIG_SMP
	if (is_smp())
		smp_init_cpus();
#endif
	reserve_crashkernel();


	tcm_init();


#ifdef CONFIG_MULTI_IRQ_HANDLER
	handle_arch_irq = mdesc->handle_irq;
#endif


#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
	conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
	conswitchp = &dummy_con;
#endif
#endif


	if (mdesc->init_early)
		mdesc->init_early();
}



最后是

arch/arm/kernel/process.c

void machine_restart(char *cmd)
{
printk("matt-process.c\n");
	machine_shutdown();


	/* Flush the console to make sure all the relevant messages make it
	 * out to the console drivers */
	arm_machine_flush_console();


	arm_pm_restart(reboot_mode, cmd);  //this


	/* 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");
	local_irq_disable();
	while (1);
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值