免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1044 | 回复: 0

machine start [复制链接]

论坛徽章:
0
发表于 2011-02-06 19:01 |显示全部楼层

MACHINE_START(VR1000, "Thorcom-VR1000")

 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */

 .phys_ram = S3C2410_SDRAM_PA,

 .phys_io = S3C2410_PA_UART,

 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,

 .boot_params = S3C2410_SDRAM_PA + 0x100,

 .map_io  = vr1000_map_io,

 .init_irq = s3c24xx_init_irq,

 .timer  = &s3c24xx_timer,

MACHINE_END

 

这两个是宏定义 原型为

#define MACHINE_START(_type,_name)  \

const struct machine_desc __mach_desc_##_type \

 __attribute__((__section__(".arch.info.init"))) = { \

 .nr  = MACH_TYPE_##_type, \

 .name  = _name,

#define MACHINE_END    \

};

struct machine_desc 的原型为:

 

struct machine_desc {

 /*

  * Note! The first five elements are used

  * by assembler code in head-armv.S

  */

 unsigned int  nr;  /* architecture number */

 unsigned int  phys_ram; /* start of physical ram */

 unsigned int  phys_io; /* start of physical io */

 unsigned int  io_pg_offst; /* byte offset for io 

       * page tabe entry */

 const char  *name;  /* architecture name */

 unsigned long  boot_params; /* tagged list  */

 unsigned int  video_start; /* start of video RAM */

 unsigned int  video_end; /* end of video RAM */

 unsigned int  reserve_lp0 :1; /* never has lp0 */

 unsigned int  reserve_lp1 :1; /* never has lp1 */

 unsigned int  reserve_lp2 :1; /* never has lp2 */

 unsigned int  soft_reboot :1; /* soft reboot  */

 void   (*fixup)(struct machine_desc *,

      struct tag *, char **,

      struct meminfo *);

 void   (*map_io)(void);/* IO mapping function */

 void   (*init_irq)(void);

 struct sys_timer *timer;  /* system tick timer */

 void   (*init_machine)(void);

};

 

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_irqstart_kernel() --> init_IRQ() --> init_arch_irq() 被调用

3. map_io 在 setup_arch() --> paging_init() --> devicemaps_init()被调用

其他主要都在 setup_arch() 中用到。

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP