machine_desc
每一个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 :; /* never has lp0 */
unsigned int reserve_lp1 :; /* never has lp1 */
unsigned int reserve_lp2 :; /* never has lp2 */
unsigned int soft_reboot :; /* 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,
}
MACH_TYPE_SMDK6410在 arch/arm/tools/mach-types文件中定义
# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
1621:smdk6410 MACH_SMDK6410 SMDK6410 1626
参考:linux3.1.0内核中/include/generated下mach-types.h的产生
machine_desc的更多相关文章
- machine_desc结构体【转】
转自:http://blog.csdn.net/myarrow/article/details/8609564 1. 简介 内核提供了一个重要的结构体struct machine_desc ,这个结构 ...
- Linux内核启动过程概述
版权声明:本文原创,转载需声明作者ID和原文链接地址. Hi!大家好,我是CrazyCatJack.今天给大家带来的是Linux内核启动过程概述.希望能够帮助大家更好的理解Linux内核的启动,并且创 ...
- 第4天--linux内核学习
驱动使用方式1.编译到内核中 * make uImage进入到系统后mknod /dev/led c 500 0 创建设备节点 2.编译为模块 M make module进入到系统后 mknod /d ...
- Linux and the Device Tree
来之\kernel\Documentation\devicetree\usage-model.txt Linux and the Device Tree ----------------------- ...
- Linux 内核高-低端内存设置代码跟踪(ARM构架)
对于ARM中内核如何在启动的时候设置高低端内存的分界线(也是逻辑地址与虚拟地址分界线(虚拟地址)减去那个固定的偏移),这里我稍微引导下(内核分析使用Linux-3.0): 首先定位设置内核虚拟地址起始 ...
- Device Tree(三):代码分析【转】
转自:http://www.wowotech.net/linux_kenrel/dt-code-analysis.html Device Tree(三):代码分析 作者:linuxer 发布于:201 ...
- ARM Linux启动代码分析
前言 在学习.分析之前首先要弄明白一个问题:为什么要分析启动代码? 因为启动代码绝大部分都是用汇编语言写的,对于没学过或者不熟悉汇编语言的同学确实有一定难度,但是如果你想真正深入地学习Linux,那么 ...
- 【转载】关于Embedded Linux启动的经典问题
转载自:http://linux.chinaunix.net/techdoc/install/2009/04/13/1107608.shtml 发信人: armlinux (armlinux), 信区 ...
- Linux内核启动
Linux内核启动过程概述 Linux的启动代码真的挺大,从汇编到C,从Makefile到LDS文件,需要理解的东西很多.毕竟Linux内核是由很多人,花费了巨大的时间和精力写出来的.而且直到现在,这 ...
随机推荐
- Kestrel服务器
Kestrel服务器 什么是Kestrel服务器 Kestrel是开源的(GitHub提供的源代码),事件驱动的异步I / O服务器,用于在任何平台上托管ASP.NET应用程序.这是一个监听服务器和一 ...
- aix OPATH ISSUE
issue 1: OPatch cannot find a valid oraInst.loc file to locate Central Inventory (OPatch failed with ...
- (转)nginx域名访问的白名单配置梳理
nginx域名访问的白名单配置梳理 原文:http://www.cnblogs.com/kevingrace/p/6086652.html 在日常运维工作中,会碰到这样的需求:设置网站访问只对某些ip ...
- Eclipse Debug时出现Source not found错误
今天在Debug Java代码时报出了Source not found这个错误,如下图所示,经过查询资料得知这是由于缺少Hadoop源程序代码所导致的错误. 在此我建议了两种方法,可以先采用方法一,这 ...
- 基于spring-boot和docker-java实现对docker容器的动态管理和监控[附完整源码下载]
(我是个封面) docker简介 Docker 是一个开源的应用容器引擎,和传统的虚拟机技术相比,Docker 容器性能开销极低,因此也广受开发者喜爱.随着基于docker的开发者越来越多,doc ...
- Windows1
① 对Windows的设置一般在, 所有设置, 控制面板(control), 管理方式打开此电脑和此电脑上的选项 ② 关闭对账号安全的检验, 在控制面板中, 找到系统和安全, 再找到更改用户账号控制设 ...
- 《移动Web前端高效开发实战》笔记1——静态布局在移动端上的自适应
1.整体缩放 整体缩放可以用在营销活动页,营销活动可能因为设计美观需求必须使用背景图片而非背景色,因此需要考虑背景图适应屏幕大小.开发者可以用320像素的宽度作为基础宽度(高度可以固定),然后通过计算 ...
- myeclipes出现{Could not create the view: An unexpected except
今天编写代码的时候突然出现了web工程不能部署的情况,后面了解到主要是因为那个myeclipse非正常关闭或者突然断电的情况,我的是属于第一种的,下面整理一下这个解决方法 1.关闭myeclipse ...
- HDU 3001 Travelling (状压DP,3进制)
题意: 给出n<=10个点,有m条边的无向图.问:可以从任意点出发,至多经过同一个点2次,遍历所有点的最小费用? 思路: 本题就是要卡你的内存,由于至多可经过同一个点2次,所以只能用3进制来表示 ...
- UVA 246 10-20-30 10-20-30游戏 模拟+STL双端队列deque
Input Each input set consists of a sequence of 52 integers separated by spaces and/or ends of line. ...