blob: 950665dfcc68142c3fa8cb7b34770a19577ada7f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/include/asm/setup.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Structure passed to kernel to tell it about the
11 * hardware it's running on. See Documentation/arm/Setup
12 * for more info.
13 */
14#ifndef __ASMARM_SETUP_H
15#define __ASMARM_SETUP_H
16
Jaswinder Singh Rajput4af3bf62009-01-31 10:41:59 +053017#include <linux/types.h>
Adrian Bunk7d1362c2006-12-06 20:40:38 -080018
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#define COMMAND_LINE_SIZE 1024
20
21/* The list ends with an ATAG_NONE node. */
22#define ATAG_NONE 0x00000000
23
24struct tag_header {
Adrian Bunk7d1362c2006-12-06 20:40:38 -080025 __u32 size;
26 __u32 tag;
Linus Torvalds1da177e2005-04-16 15:20:36 -070027};
28
29/* The list must start with an ATAG_CORE node */
30#define ATAG_CORE 0x54410001
31
32struct tag_core {
Adrian Bunk7d1362c2006-12-06 20:40:38 -080033 __u32 flags; /* bit 0 = read-only */
34 __u32 pagesize;
35 __u32 rootdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036};
37
38/* it is allowed to have multiple ATAG_MEM nodes */
39#define ATAG_MEM 0x54410002
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040/* it is allowed to have multiple ATAG_MEM_RESERVED nodes */
41/* these indicate places where hotpluggable memory is present */
42/* which are not active during boot */
43#define ATAG_MEM_RESERVED 0x5441000A
44/* it is allowed to have multiple ATAG_MEM_LOW_POWER nodes */
45/* these indicate memory which can be put in a low power state */
46#define ATAG_MEM_LOW_POWER 0x5441000B
47/* these indicate memory which can be reclaimed from OSBL memory after bootup */
48#define ATAG_MEM_OSBL 0x5441000C
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50struct tag_mem32 {
Adrian Bunk7d1362c2006-12-06 20:40:38 -080051 __u32 size;
52 __u32 start; /* physical start address */
Linus Torvalds1da177e2005-04-16 15:20:36 -070053};
54
55/* VGA text type displays */
56#define ATAG_VIDEOTEXT 0x54410003
57
58struct tag_videotext {
Adrian Bunk7d1362c2006-12-06 20:40:38 -080059 __u8 x;
60 __u8 y;
61 __u16 video_page;
62 __u8 video_mode;
63 __u8 video_cols;
64 __u16 video_ega_bx;
65 __u8 video_lines;
66 __u8 video_isvga;
67 __u16 video_points;
Linus Torvalds1da177e2005-04-16 15:20:36 -070068};
69
70/* describes how the ramdisk will be used in kernel */
71#define ATAG_RAMDISK 0x54410004
72
73struct tag_ramdisk {
Adrian Bunk7d1362c2006-12-06 20:40:38 -080074 __u32 flags; /* bit 0 = load, bit 1 = prompt */
75 __u32 size; /* decompressed ramdisk size in _kilo_ bytes */
76 __u32 start; /* starting block of floppy-based RAM disk image */
Linus Torvalds1da177e2005-04-16 15:20:36 -070077};
78
79/* describes where the compressed ramdisk image lives (virtual address) */
80/*
81 * this one accidentally used virtual addresses - as such,
82 * it's deprecated.
83 */
84#define ATAG_INITRD 0x54410005
85
86/* describes where the compressed ramdisk image lives (physical address) */
87#define ATAG_INITRD2 0x54420005
88
89struct tag_initrd {
Adrian Bunk7d1362c2006-12-06 20:40:38 -080090 __u32 start; /* physical start address */
91 __u32 size; /* size of compressed ramdisk image in bytes */
Linus Torvalds1da177e2005-04-16 15:20:36 -070092};
93
94/* board serial number. "64 bits should be enough for everybody" */
95#define ATAG_SERIAL 0x54410006
96
97struct tag_serialnr {
Adrian Bunk7d1362c2006-12-06 20:40:38 -080098 __u32 low;
99 __u32 high;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100};
101
102/* board revision */
103#define ATAG_REVISION 0x54410007
104
105struct tag_revision {
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800106 __u32 rev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107};
108
109/* initial values for vesafb-type framebuffers. see struct screen_info
110 * in include/linux/tty.h
111 */
112#define ATAG_VIDEOLFB 0x54410008
113
114struct tag_videolfb {
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800115 __u16 lfb_width;
116 __u16 lfb_height;
117 __u16 lfb_depth;
118 __u16 lfb_linelength;
119 __u32 lfb_base;
120 __u32 lfb_size;
121 __u8 red_size;
122 __u8 red_pos;
123 __u8 green_size;
124 __u8 green_pos;
125 __u8 blue_size;
126 __u8 blue_pos;
127 __u8 rsvd_size;
128 __u8 rsvd_pos;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129};
130
131/* command line: \0 terminated string */
132#define ATAG_CMDLINE 0x54410009
133
134struct tag_cmdline {
135 char cmdline[1]; /* this is the minimum size */
136};
137
138/* acorn RiscPC specific information */
139#define ATAG_ACORN 0x41000101
140
141struct tag_acorn {
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800142 __u32 memc_control_reg;
143 __u32 vram_pages;
144 __u8 sounddefault;
145 __u8 adfsdrives;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146};
147
148/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
149#define ATAG_MEMCLK 0x41000402
150
151struct tag_memclk {
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800152 __u32 fmemclk;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153};
154
155struct tag {
156 struct tag_header hdr;
157 union {
158 struct tag_core core;
159 struct tag_mem32 mem;
160 struct tag_videotext videotext;
161 struct tag_ramdisk ramdisk;
162 struct tag_initrd initrd;
163 struct tag_serialnr serialnr;
164 struct tag_revision revision;
165 struct tag_videolfb videolfb;
166 struct tag_cmdline cmdline;
167
168 /*
169 * Acorn specific
170 */
171 struct tag_acorn acorn;
172
173 /*
174 * DC21285 specific
175 */
176 struct tag_memclk memclk;
177 } u;
178};
179
180struct tagtable {
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800181 __u32 tag;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 int (*parse)(const struct tag *);
183};
184
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185#define tag_member_present(tag,member) \
186 ((unsigned long)(&((struct tag *)0L)->member + 1) \
187 <= (tag)->hdr.size * 4)
188
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800189#define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
191
192#define for_each_tag(t,base) \
193 for (t = base; t->hdr.size; t = tag_next(t))
194
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800195#ifdef __KERNEL__
196
David Rientjesb91d8a12007-05-11 16:18:55 -0700197#define __tag __used __attribute__((__section__(".taglist.init")))
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800198#define __tagtable(tag, fn) \
199static struct tagtable __tagtable_##fn __tag = { tag, fn }
200
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201/*
202 * Memory map description
203 */
Russell King82e69232011-01-21 11:04:45 +0000204#define NR_BANKS 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205
Russell King456335e2006-09-27 10:00:54 +0100206struct membank {
Will Deaconf60892d2011-02-15 12:44:10 +0100207 phys_addr_t start;
Russell King456335e2006-09-27 10:00:54 +0100208 unsigned long size;
Russell Kingbe370302010-05-07 17:40:33 +0100209 unsigned int highmem;
Russell King456335e2006-09-27 10:00:54 +0100210};
211
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212struct meminfo {
213 int nr_banks;
Russell King456335e2006-09-27 10:00:54 +0100214 struct membank bank[NR_BANKS];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215};
216
Nicolas Pitre4b5f32c2008-10-06 13:24:40 -0400217extern struct meminfo meminfo;
218
Russell Kingbe370302010-05-07 17:40:33 +0100219#define for_each_bank(iter,mi) \
220 for (iter = 0; iter < (mi)->nr_banks; iter++)
Russell Kingd2a38ef2008-10-01 16:56:15 +0100221
222#define bank_pfn_start(bank) __phys_to_pfn((bank)->start)
223#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size)
224#define bank_pfn_size(bank) ((bank)->size >> PAGE_SHIFT)
225#define bank_phys_start(bank) (bank)->start
226#define bank_phys_end(bank) ((bank)->start + (bank)->size)
227#define bank_phys_size(bank) (bank)->size
228
Grant Likely9eb8f672011-04-28 14:27:20 -0600229extern int arm_add_memory(phys_addr_t start, unsigned long size);
Grant Likely93c02ab2011-04-28 14:27:21 -0600230extern void early_print(const char *str, ...);
231extern void dump_machine_table(void);
Grant Likely9eb8f672011-04-28 14:27:20 -0600232
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700233/*
234 * Early command line parameters.
235 */
236struct early_params {
237 const char *arg;
238 void (*fn)(char **p);
239};
240
241#define __early_param(name,fn) \
242static struct early_params __early_##fn __used \
243__attribute__((__section__(".early_param.init"))) = { name, fn }
244
Adrian Bunk7d1362c2006-12-06 20:40:38 -0800245#endif /* __KERNEL__ */
246
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247#endif