machine_desc结构体【转】

简介:

转自:http://blog.csdn.net/myarrow/article/details/8609564

1. 简介

  内核提供了一个重要的结构体struct machine_desc ,这个结构体在内核移植中起到相当重要的作用,内核通过machine_desc结构体来控制系统体系架构相关部分的初始化。

       machine_desc结构体通过MACHINE_START宏来初始化,在代码中, 通过在start_kernel->setup_arch中调用setup_machine_fdt来获取。

 

2. machine_desc结构体

         machine_desc结构体定义如下:

 

[cpp]  view plain copy
 
  1. /* 在文件:arch/arm/include/asm/mach/arch.h */  
  2. struct machine_desc {  
  3.     unsigned int        nr;     /* architecture number  */  
  4.     const char      *name;      /* architecture name    */  
  5.     unsigned long       boot_params;    /* tagged list      */  
  6.     const char      **dt_compat;    /* array of device tree 
  7.                          * 'compatible' strings */  
  8.   
  9.     unsigned int        nr_irqs;    /* number of IRQs */  
  10.   
  11.     unsigned int        video_start;    /* start of video RAM   */  
  12.     unsigned int        video_end;  /* end of video RAM */  
  13.   
  14.     unsigned int        reserve_lp0 :1; /* never has lp0    */  
  15.     unsigned int        reserve_lp1 :1; /* never has lp1    */  
  16.     unsigned int        reserve_lp2 :1; /* never has lp2    */  
  17.     unsigned int        soft_reboot :1; /* soft reboot      */  
  18.     void            (*fixup)(struct machine_desc *,  
  19.                      struct tag *, char **,  
  20.                      struct meminfo *);  
  21.     void            (*reserve)(void);/* reserve mem blocks  */  
  22.     void            (*map_io)(void);/* IO mapping function  */  
  23.     void            (*init_early)(void);  
  24.     void            (*init_irq)(void);  
  25.     struct sys_timer    *timer;     /* system tick timer    */  
  26.     void            (*init_machine)(void);  
  27. #ifdef CONFIG_MULTI_IRQ_HANDLER  
  28.     void            (*handle_irq)(struct pt_regs *);  
  29. #endif  
  30. };  

 

 3. machine_desc初始化

machine_desc初始化例子如下:

[cpp]  view plain copy
 
  1. MACHINE_START(MA, "myboard")  
  2.     .boot_params    = PLAT_PHYS_OFFSET + 0x800,  
  3.     .fixup      = ma_fixup,  
  4.     .reserve             = &ma_reserve,  //内存在交给Linux管理之前,进行预留  
  5.     .map_io     = ma_map_io,  
  6.     .init_irq   = ma_init_irq,  
  7.     .timer      = &ma_timer,  
  8.     .init_machine   = machine_ma_board_init,  
  9. MACHINE_END  

MACHINE_START和MACHINE_END宏定义如下:

[cpp]  view plain copy
 
  1. /* 
  2.  * Set of macros to define architecture features.  This is built into 
  3.  * a table by the linker. 
  4.  */  
  5. #define MACHINE_START(_type,_name)          \  
  6. static const struct machine_desc __mach_desc_##_type    \  
  7.  __used                         \  
  8.  __attribute__((__section__(".arch.info.init"))) = {    \  
  9.     .nr     = MACH_TYPE_##_type,        \  
  10.     .name       = _name,  
  11.   
  12. #define MACHINE_END             \  
  13. };  
















本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/sky-heaven/p/4837252.html,如需转载请自行联系原作者
相关文章
|
5月前
|
SQL HIVE
数仓学习-----named_struct和collect_set函数
数仓学习-----named_struct和collect_set函数
container_of(ptr,type,member)宏
详细解释了container_of(ptr,type,member)宏的用途
error:‘struct vm_fault‘ has no member named ‘virtual_address‘
error:‘struct vm_fault‘ has no member named ‘virtual_address‘
156 0
error:‘struct vm_fault‘ has no member named ‘virtual_address‘
MGA (Managed Global Area) Reference Note (Doc ID 2638904.1)
MGA (Managed Global Area) Reference Note (Doc ID 2638904.1)
310 0
SAP RETAIL WA03 基于分配表创建PO报错 - No work list could be selected –
SAP RETAIL WA03 基于分配表创建PO报错 - No work list could be selected –
SAP RETAIL WA03 基于分配表创建PO报错 - No work list could be selected –
SAP RETAIL WA01 创建分配表报错 - Plant 0000000039 Confirmation date not maintained.-(一)
SAP RETAIL WA01 创建分配表报错 - Plant 0000000039 Confirmation date not maintained.-(一)
SAP RETAIL WA01 创建分配表报错 - Plant 0000000039 Confirmation date not maintained.-(一)
SAP RETAIL WA01 创建分配表报错 - Plant 0000000039 Confirmation date not maintained.-(二)
SAP RETAIL WA01 创建分配表报错 - Plant 0000000039 Confirmation date not maintained.-(二·1)
SAP RETAIL WA01 创建分配表报错 - Plant 0000000039 Confirmation date not maintained.-(二)
How to find where settype DB table COMM_PRMAT is accessed without debugging
How to find where settype DB table COMM_PRMAT is accessed without debugging
How to find where settype DB table COMM_PRMAT is accessed without debugging
如何利用BAPI SD_SALESDOCUMENT_CHANGE修改Sales Order的字段
假设我想修改S/4HANA里Sales Order抬头的Service Date字段SERV_DATE: 首先从数据库表VBKD里查找到SERV_DATE修改之前的值为2020年1月1日