Chinaunix首页 | 论坛 | 博客
  • 博客访问: 465507
  • 博文数量: 150
  • 博客积分: 2706
  • 博客等级: 少校
  • 技术积分: 1200
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-09 11:41
文章分类

全部博文(150)

文章存档

2012年(7)

2011年(6)

2010年(68)

2009年(69)

我的朋友

分类:

2010-07-15 12:06:38

/*
 * Set of macros to define architecture features.  This is built into
 * a table by the linker.
 */
#define MACHINE_START(_type,_name) \
static const struct machine_desc __mach_desc_##_type \
 __used \
 __attribute__((__section__(".arch.info.init"))) = { \
.nr = MACH_TYPE_##_type, \
.name = _name,

#define MACHINE_END \
};

[arch/arm/mach-mx35/mx35_3stack.c]
/*
 * The following uses standard kernel macros define in arch.h in order to
 * initialize __mach_desc_MX35_3DS data structure.
 */
/* *INDENT-OFF* */
MACHINE_START(MX35_3DS, "Freescale MX35 3-Stack Board")
/* Maintainer: Freescale Semiconductor, Inc. */
.phys_io = AIPS1_BASE_ADDR,
.io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
.boot_params = PHYS_OFFSET + 0x100,
.fixup = fixup_mxc_board,
.map_io = mxc_map_io,
.init_irq = mxc_init_irq,
.init_machine = mxc_board_init,
.timer = &mxc_timer,
MACHINE_END




通过[include/linux/autoconf.h]
#define CONFIG_MACH_MX35_3DS 1
确定
#ifdef CONFIG_MACH_MX35_3DS
# ifdef machine_arch_type
#  undef machine_arch_type
#  define machine_arch_type __machine_arch_type
# else
#  define machine_arch_type MACH_TYPE_MX35_3DS
# endif
# define machine_is_mx35_3ds() (machine_arch_type == MACH_TYPE_MX35_3DS)
#else
# define machine_is_mx35_3ds() (0)
#endif


查找machine type流程:
setup_arch(&command_line);
|
setup_machine(machine_arch_type);  //machine_arch_type 在autoconf.h定义
|
lookup_machine_type   //[arch/arm/kernel/setup.c]
|
/*
 * This provides a C-API version of the above function.
 */
ENTRY(lookup_machine_type)
stmfd sp!, {r4 - r6, lr}
mov r1, r0
bl __lookup_machine_type
mov r0, r5
ldmfd sp!, {r4 - r6, pc}
//[arch/arm/kernel/head-common.S]

阅读(782) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~