二、dts文件首地址解析在进行DTS文件解析之前先要从bootm启动命令中获取dtb文件所在的地址。而这一步的开始是从arch/powerpc/kernel/head_32.s文件开始中的。
1、arch/powerpc/kernel/head_32.s
* This is where the main kernel code starts.
*/
start_here:
/* ptr to current */
lis
r2,init_task@h
ori
r2,r2,init_task@l
/* Set up for using our exception vectors */
/* ptr to phys current thread */
tophys(r4,r2)
addi
r4,r4,THREAD
/* init task's THREAD */
CLR_TOP32(r4)
mtspr
SPRN_SPRG_THREAD,r4
li
r3,0
mtspr
SPRN_SPRG_RTAS,r3
/* 0 => not in RTAS */
/* stack */
lis
r1,init_thread_union@ha
addi
r1,r1,init_thread_union@l
li
r0,0
stwu
r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
/*
* Do early platform-specific initialization,
* and set up the MMU.
*/
mr
r3,r31
mr
r4,r30
bl
machine_init //在这个函数中
bl
__save_cpu_setup
bl
MMU_init
notrace void __init machine_init(unsigned long dt_ptr)
{
lockdep_init();
/* Enable early debugging if any specified (see udbg.h) */
udbg_early_init();
/* Do some early initialization based on the flat device tree */
early_init_devtree(__va(dt_ptr));
probe_machine();
setup_kdump_trampoline();
#ifdef CONFIG_6xx
if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
cpu_has_feature(CPU_FTR_CAN_NAP))
ppc_md.power_save = ppc6xx_idle;
#endif
#ifdef CONFIG_E500
if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
cpu_has_feature(CPU_FTR_CAN_NAP))
ppc_md.power_save = e500_idle;
#endif
if (ppc_md.progress)
ppc_md.progress("id mach(): done", 0x200);
}
void __init early_init_devtree(void *params)
{
phys_addr_t limit;
DBG(" -> early_init_devtree(%p)\n", params);
/* Setup flat device-tree pointer */
initial_boot_params = params;
#ifdef CONFIG_PPC_RTAS
/* Some machines might need RTAS info for debugging, grab it now. */
/**
* unflattens the device-tree passed by the firmware, creating the
* tree of struct device_node. It also fills the "name" and "type"
* pointers of the nodes so the normal device-tree walking functions
* can be used (this used to be done by finish_device_tree)
*/
void __init unflatten_device_tree(void)
{