xref: /openbmc/u-boot/arch/arm/include/asm/setup.h (revision 713cb680)
1 /*
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 linux/Documentation/arm/Setup
12  *  for more info.
13  *
14  * NOTE:
15  *  This file contains two ways to pass information from the boot
16  *  loader to the kernel. The old struct param_struct is deprecated,
17  *  but it will be kept in the kernel for 5 years from now
18  *  (2001). This will allow boot loaders to convert to the new struct
19  *  tag way.
20  */
21 #ifndef __ASMARM_SETUP_H
22 #define __ASMARM_SETUP_H
23 
24 /*
25  * Usage:
26  *  - do not go blindly adding fields, add them at the end
27  *  - when adding fields, don't rely on the address until
28  *    a patch from me has been released
29  *  - unused fields should be zero (for future expansion)
30  *  - this structure is relatively short-lived - only
31  *    guaranteed to contain useful data in setup_arch()
32  */
33 #define COMMAND_LINE_SIZE 1024
34 
35 /* This is the old deprecated way to pass parameters to the kernel */
36 struct param_struct {
37     union {
38 	struct {
39 	    unsigned long page_size;		/*  0 */
40 	    unsigned long nr_pages;		/*  4 */
41 	    unsigned long ramdisk_size;		/*  8 */
42 	    unsigned long flags;		/* 12 */
43 #define FLAG_READONLY	1
44 #define FLAG_RDLOAD	4
45 #define FLAG_RDPROMPT	8
46 	    unsigned long rootdev;		/* 16 */
47 	    unsigned long video_num_cols;	/* 20 */
48 	    unsigned long video_num_rows;	/* 24 */
49 	    unsigned long video_x;		/* 28 */
50 	    unsigned long video_y;		/* 32 */
51 	    unsigned long memc_control_reg;	/* 36 */
52 	    unsigned char sounddefault;		/* 40 */
53 	    unsigned char adfsdrives;		/* 41 */
54 	    unsigned char bytes_per_char_h;	/* 42 */
55 	    unsigned char bytes_per_char_v;	/* 43 */
56 	    unsigned long pages_in_bank[4];	/* 44 */
57 	    unsigned long pages_in_vram;	/* 60 */
58 	    unsigned long initrd_start;		/* 64 */
59 	    unsigned long initrd_size;		/* 68 */
60 	    unsigned long rd_start;		/* 72 */
61 	    unsigned long system_rev;		/* 76 */
62 	    unsigned long system_serial_low;	/* 80 */
63 	    unsigned long system_serial_high;	/* 84 */
64 	    unsigned long mem_fclk_21285;       /* 88 */
65 	} s;
66 	char unused[256];
67     } u1;
68     union {
69 	char paths[8][128];
70 	struct {
71 	    unsigned long magic;
72 	    char n[1024 - sizeof(unsigned long)];
73 	} s;
74     } u2;
75     char commandline[COMMAND_LINE_SIZE];
76 };
77 
78 
79 /*
80  * The new way of passing information: a list of tagged entries
81  */
82 
83 /* The list ends with an ATAG_NONE node. */
84 #define ATAG_NONE	0x00000000
85 
86 struct tag_header {
87 	u32 size;
88 	u32 tag;
89 };
90 
91 /* The list must start with an ATAG_CORE node */
92 #define ATAG_CORE	0x54410001
93 
94 struct tag_core {
95 	u32 flags;		/* bit 0 = read-only */
96 	u32 pagesize;
97 	u32 rootdev;
98 };
99 
100 /* it is allowed to have multiple ATAG_MEM nodes */
101 #define ATAG_MEM	0x54410002
102 
103 struct tag_mem32 {
104 	u32	size;
105 	u32	start;	/* physical start address */
106 };
107 
108 /* VGA text type displays */
109 #define ATAG_VIDEOTEXT	0x54410003
110 
111 struct tag_videotext {
112 	u8		x;
113 	u8		y;
114 	u16		video_page;
115 	u8		video_mode;
116 	u8		video_cols;
117 	u16		video_ega_bx;
118 	u8		video_lines;
119 	u8		video_isvga;
120 	u16		video_points;
121 };
122 
123 /* describes how the ramdisk will be used in kernel */
124 #define ATAG_RAMDISK	0x54410004
125 
126 struct tag_ramdisk {
127 	u32 flags;	/* bit 0 = load, bit 1 = prompt */
128 	u32 size;	/* decompressed ramdisk size in _kilo_ bytes */
129 	u32 start;	/* starting block of floppy-based RAM disk image */
130 };
131 
132 /* describes where the compressed ramdisk image lives (virtual address) */
133 /*
134  * this one accidentally used virtual addresses - as such,
135  * its depreciated.
136  */
137 #define ATAG_INITRD	0x54410005
138 
139 /* describes where the compressed ramdisk image lives (physical address) */
140 #define ATAG_INITRD2	0x54420005
141 
142 struct tag_initrd {
143 	u32 start;	/* physical start address */
144 	u32 size;	/* size of compressed ramdisk image in bytes */
145 };
146 
147 /* board serial number. "64 bits should be enough for everybody" */
148 #define ATAG_SERIAL	0x54410006
149 
150 struct tag_serialnr {
151 	u32 low;
152 	u32 high;
153 };
154 
155 /* board revision */
156 #define ATAG_REVISION	0x54410007
157 
158 struct tag_revision {
159 	u32 rev;
160 };
161 
162 /* initial values for vesafb-type framebuffers. see struct screen_info
163  * in include/linux/tty.h
164  */
165 #define ATAG_VIDEOLFB	0x54410008
166 
167 struct tag_videolfb {
168 	u16		lfb_width;
169 	u16		lfb_height;
170 	u16		lfb_depth;
171 	u16		lfb_linelength;
172 	u32		lfb_base;
173 	u32		lfb_size;
174 	u8		red_size;
175 	u8		red_pos;
176 	u8		green_size;
177 	u8		green_pos;
178 	u8		blue_size;
179 	u8		blue_pos;
180 	u8		rsvd_size;
181 	u8		rsvd_pos;
182 };
183 
184 /* command line: \0 terminated string */
185 #define ATAG_CMDLINE	0x54410009
186 
187 struct tag_cmdline {
188 	char	cmdline[1];	/* this is the minimum size */
189 };
190 
191 /* acorn RiscPC specific information */
192 #define ATAG_ACORN	0x41000101
193 
194 struct tag_acorn {
195 	u32 memc_control_reg;
196 	u32 vram_pages;
197 	u8 sounddefault;
198 	u8 adfsdrives;
199 };
200 
201 /* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
202 #define ATAG_MEMCLK	0x41000402
203 
204 struct tag_memclk {
205 	u32 fmemclk;
206 };
207 
208 struct tag {
209 	struct tag_header hdr;
210 	union {
211 		struct tag_core		core;
212 		struct tag_mem32	mem;
213 		struct tag_videotext	videotext;
214 		struct tag_ramdisk	ramdisk;
215 		struct tag_initrd	initrd;
216 		struct tag_serialnr	serialnr;
217 		struct tag_revision	revision;
218 		struct tag_videolfb	videolfb;
219 		struct tag_cmdline	cmdline;
220 
221 		/*
222 		 * Acorn specific
223 		 */
224 		struct tag_acorn	acorn;
225 
226 		/*
227 		 * DC21285 specific
228 		 */
229 		struct tag_memclk	memclk;
230 	} u;
231 };
232 
233 struct tagtable {
234 	u32 tag;
235 	int (*parse)(const struct tag *);
236 };
237 
238 #define __tag __attribute__((unused, __section__(".taglist")))
239 #define __tagtable(tag, fn) \
240 static struct tagtable __tagtable_##fn __tag = { tag, fn }
241 
242 #define tag_member_present(tag,member)				\
243 	((unsigned long)(&((struct tag *)0L)->member + 1)	\
244 		<= (tag)->hdr.size * 4)
245 
246 #define tag_next(t)	((struct tag *)((u32 *)(t) + (t)->hdr.size))
247 #define tag_size(type)	((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
248 
249 #define for_each_tag(t,base)		\
250 	for (t = base; t->hdr.size; t = tag_next(t))
251 
252 /*
253  * Memory map description
254  */
255 #define NR_BANKS 8
256 
257 struct meminfo {
258 	int nr_banks;
259 	unsigned long end;
260 	struct {
261 		unsigned long start;
262 		unsigned long size;
263 		int           node;
264 	} bank[NR_BANKS];
265 };
266 
267 extern struct meminfo meminfo;
268 
269 #endif
270 
271 /*
272  * Board specified tags
273  */
274 void setup_board_tags(struct tag **in_params);
275