machine_desc

Publisher:breakthrough2Latest update time:2024-11-05 Source: cnblogs Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Each machine must define its own machine_desc structure, which defines some of the most basic characteristics of the 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);

};


In arch/arm/include/asm/mach/arch.h, there is the following macro, which is used to declare the processor-related machine_desc structure and put the structure into the segment specified in 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

};


Use the above macro to declare the machine_desc structure in arch/arm/mach-s3c64xx/mach-smdk6410.c.


MACHINE_START(SMDK6410, "SMDK6410")

/* Maintainer: Ben Dooks */

//.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


The above macro expands to:


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,

}


MACH_TYPE_SMDK6410 is defined in the arch/arm/tools/mach-types file


# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number


1621: smdk6410 MACH_SMDK6410 SMDK6410 1626


Reference address:machine_desc

Previous article:Analysis of u-boot.bin generation process
Next article:Related functions of sources\sources.cmn\Makefile.def under wince

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号