码迷,mamicode.com
首页 > 系统相关 > 详细

machine_desc

时间:2017-12-24 22:56:09      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:sof   声明   基本   array   展开   自己的   meminfo   ber   signed   

每一个machine,都要定义一个自己的machine_desc结构,该结构定义了该machine的一些最基本的特性。

struct machine_desc {
    unsigned int        nr;        /* architecture number    */
    const char        *name;        /* architecture name    */
    unsigned long        boot_params;    /* tagged list        */
    const char        **dt_compat;    /* array of device tree
                         * ‘compatible‘ strings    */

    unsigned int        nr_irqs;    /* number of IRQs */

    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            (*reserve)(void);/* reserve mem blocks    */
    void            (*map_io)(void);/* IO mapping function    */
    void            (*init_early)(void);
    void            (*init_irq)(void);
    struct sys_timer    *timer;        /* system tick timer    */
    void            (*init_machine)(void);
};

在arch/arm/include/asm/mach/arch.h中有下面的宏,用于声明处理器相关的machine_desc结构体,并将该结构体放入vmlinux.lds中指定的段中。

#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-s3c64xx/mach-smdk6410.c中使用上述宏声明machine_desc结构体,

MACHINE_START(SMDK6410, "SMDK6410")
    /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
    //.phys_io    = S3C_PA_UART & 0xfff00000,
    //.io_pg_offst    = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
    .boot_params    = S3C64XX_PA_SDRAM + 0x100,

    .init_irq    = s3c6410_init_irq,
    .map_io        = smdk6410_map_io,
    .init_machine    = smdk6410_machine_init,
    .timer        = &s3c24xx_timer,
MACHINE_END

上面的宏展开得到:

static const struct machine_desc __mach_desc_SMDK6410 __used    __attribute__((__section__(".arch.info.init"))) = {

    .nr        = MACH_TYPE_SMDK6410,
    .name        = "SMDK6410",
    .boot_params    = S3C64XX_PA_SDRAM + 0x100, //0x5000_0100
    .init_irq    = s3c6410_init_irq,
    .map_io        = smdk6410_map_io,
    .init_machine    = smdk6410_machine_init,
    .timer        = &s3c24xx_timer,
}

 

machine_desc

标签:sof   声明   基本   array   展开   自己的   meminfo   ber   signed   

原文地址:http://www.cnblogs.com/yangjiguang/p/8099235.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!