MACHINE_START宏

在Mach-s3c2410.c文件中,有如下的宏定义:

 

MACHINE_START( SMDK2410, "SMDK2410" ) /* @TODO: request a new identifier and switch to SMDK2410 */
 /* Maintainer: Jonas Dietsche */
 . phys_io = S3C2410_PA_UART,
 . io_pg_offst = ( ( ( u32) S3C24XX_VA_UART) > > 18) & 0xfffc,
 . boot_params = S3C2410_SDRAM_PA + 0x100,
 . map_io = smdk2410_map_io,
 . init_irq = s3c24xx_init_irq,
 . init_machine = smdk_machine_init,
 . timer = & s3c24xx_timer,
MACHINE_END

 
MACHINE_START定义在include/asm-arm/mach/arch.h中

# define MACHINE_START( _type, _name) /
static const struct machine_desc __mach_desc_# # _type /
 __attribute_used__ /
 __attribute__( ( __section__( ".arch.info.init" ) ) ) = { /
 . nr = MACH_TYPE_# # _type, /
 . name = _name,
# define MACHINE_END /
} ;

 
将前面定义的MACHINE_START展开后得到,

static const struct machine_desc __mach_desc_SMDK2410
 __attribute_used__
 __attribute__( ( __section__( ".arch.info.init" ) ) ) = {
 . nr = MACH_TYPE_SMDK2410, /* architecture number */
 . name = "SMDK2410" , /* architecture name */
 /* Maintainer: Jonas Dietsche */
 . phys_io = S3C2410_PA_UART, /* start of physical io */
 . io_pg_offst = ( ( ( u32) S3C24XX_VA_UART) > > 18) & 0xfffc,
 . boot_params = S3C2410_SDRAM_PA + 0x100, /* tagged list */
 . map_io = smdk2410_map_io, /* IO mapping function */
 . init_irq = s3c24xx_init_irq,
 . init_machine = smdk_machine_init,
 . timer = & s3c24xx_timer,
}

 
MACH_TYPE_SMDK2410定义在arch/include/asm-arm/mach-types.h内,值为193.
/* arch/include/asm-arm/mach-types.h */
#define MACH_TYPE_SMDK2410             193
这个值是机器的类型值,编译时由arch/arm/tool/mach-types里面定义的数据生成的。
/* arch/arm/tool/mach-types */
smdk2410  ARCH_SMDK2410  SMDK2410  193

由上发现,MACHINE_START主要是定义了"struct machine_desc"的类型,放在 section(".arch.info.init"),是初始化数据,Kernel 起来之后将被丢弃。

各个成员函数在不同时期被调用:
1. .init_machine 在 arch/arm/kernel/setup.c 中被 customize_machine 调用,放在 arch_initcall() 段里面,会自动按顺序被调用。
2. init_irq在start_kernel() --> init_IRQ() --> init_arch_irq() 被调用
3. map_io 在 setup_arch() --> paging_init() --> devicemaps_init()被调用
其他主要都在 setup_arch() 中用到。

 

 

====================================================================

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值