浅析armlinux-setup_arch()->setup_machine(machine_arch_type)函数2
文章来源:http://gliethttp.cublog.cn
建议首先参考《浅析armlinux2_4_19启动程式[head-armv.s文档]》[http://gliethttp.cublog.cn]
//1.arch/arm/kernel/Setup.c->setup_machine()
//include/asm-arm/Mach-types.h->#define machine_arch_type __machine_arch_type
//setup_machine(machine_arch_type)
//而__machine_arch_type在head-armv.s被赋值
//__machine_arch_type=r1=由bootloader直接传入[u-boot1.1.5]=251
static struct machine_desc * __init setup_machine(unsigned int nr)
{extern struct machine_desc __arch_info_begin, __arch_info_end;
struct machine_desc *list;
//++++++++++++++
//processor_id=0x41129200;赋值于arch/arm/kernel/head-armv.s文档[gliethttp]
//__proc_info_begin和__proc_info_end在编译链接脚本arch/arm/vmlinux-armv.lds.in中定义
//...
//__arch_info_begin = .;
//*(.arch.info)
//__arch_info_end = .;
//...
//--------------
//++++++++++++++
//arch/arm/mach-at91rm9200/Core.c
//位于.arch.info段
//MACHINE_START(AT91RM9200, "ATMEL AT91RM9200")//.nr = MACH_TYPE_##_type=MACH_TYPE_AT91RM9200=251
//和上面从u-boot传到r1中的相同[gliethttp]
//MAINTAINER("SAN People / ATMEL")
//BOOT_MEM(AT91_SDRAM_BASE, AT91C_BASE_SYS, AT91C_VA_BASE_SYS)
//BOOT_PARAMS(AT91_SDRAM_BASE + 0x100)//tag list存放的物理地址0x20000100[gliethttp]
//FIXUP(at91rm9200_fixup)
//MAPIO(at91rm9200_map_io)
//INITIRQ(at91rm9200_init_irq)
//MACHINE_END[gliethttp]
//--------------
for (list = &__arch_info_begin; list &__arch_info_end; list++)
if (list->nr == nr)//匹配没问题
break;
//没有匹配上,打印提示,halt系统
if (list >= &__arch_info_end) {
printk("Architecture configuration botched (nr %d), unable "
"to continue.\n", nr);
while (1);
}
printk("Machine: %s\n", list->name);
return list;//返回匹配的machine_desc结构指针
}
阅读(507) | 评论(0) | 转发(0) |