xref: /openbmc/u-boot/arch/nds32/include/asm/setup.h (revision de8106c1)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  linux/arch/nds32/include/asm/setup.h
4  *
5  *  Copyright (C) 1997-1999 Russell King
6  *  Copyright (C) 2008 Andes Technology Corporation
7  *	Copyright (C) 2013 Ken Kuo (ken_kuo@andestech.com)
8  *
9  *  Structure passed to kernel to tell it about the
10  *  hardware it's running on.  See Documentation/arm/Setup
11  *  for more info.
12  */
13 #ifndef __ASMNDS32_SETUP_H
14 #define __ASMNDS32_SETUP_H
15 
16 #define COMMAND_LINE_SIZE 256
17 
18 /* The list ends with an ATAG_NONE node. */
19 #define ATAG_NONE	0x00000000
20 
21 struct tag_header {
22 	u32 size;
23 	u32 tag;
24 };
25 
26 /* The list must start with an ATAG_CORE node */
27 #define ATAG_CORE	0x54410001
28 
29 struct tag_core {
30 	u32 flags;		/* bit 0 = read-only */
31 	u32 pagesize;
32 	u32 rootdev;
33 };
34 
35 /* it is allowed to have multiple ATAG_MEM nodes */
36 #define ATAG_MEM	0x54410002
37 
38 struct tag_mem32 {
39 	u32	size;
40 	u32	start;	/* physical start address */
41 };
42 
43 /* VGA text type displays */
44 #define ATAG_VIDEOTEXT	0x54410003
45 
46 struct tag_videotext {
47 	u8		x;
48 	u8		y;
49 	u16		video_page;
50 	u8		video_mode;
51 	u8		video_cols;
52 	u16		video_ega_bx;
53 	u8		video_lines;
54 	u8		video_isvga;
55 	u16		video_points;
56 };
57 
58 /* describes how the ramdisk will be used in kernel */
59 #define ATAG_RAMDISK	0x54410004
60 
61 struct tag_ramdisk {
62 	u32 flags;	/* bit 0 = load, bit 1 = prompt */
63 	u32 size;	/* decompressed ramdisk size in _kilo_ bytes */
64 	u32 start;	/* starting block of floppy-based RAM disk image */
65 };
66 
67 /*
68  * this one accidentally used virtual addresses - as such,
69  * it's deprecated.
70  * describes where the compressed ramdisk image lives (virtual address)
71  */
72 #define ATAG_INITRD		0x54410005
73 
74 /* describes where the compressed ramdisk image lives (physical address) */
75 #define ATAG_INITRD2	0x54420005
76 
77 struct tag_initrd {
78 	u32 start;	/* physical start address */
79 	u32 size;	/* size of compressed ramdisk image in bytes */
80 };
81 
82 /* board serial number. "64 bits should be enough for everybody" */
83 #define ATAG_SERIAL		0x54410006
84 
85 struct tag_serialnr {
86 	u32 low;
87 	u32 high;
88 };
89 
90 /* board revision */
91 #define ATAG_REVISION	0x54410007
92 
93 struct tag_revision {
94 	u32 rev;
95 };
96 
97 /* initial values for vesafb-type framebuffers. see struct screen_info
98  * in include/linux/tty.h
99  */
100 #define ATAG_VIDEOLFB	0x54410008
101 
102 struct tag_videolfb {
103 	u16		lfb_width;
104 	u16		lfb_height;
105 	u16		lfb_depth;
106 	u16		lfb_linelength;
107 	u32		lfb_base;
108 	u32		lfb_size;
109 	u8		red_size;
110 	u8		red_pos;
111 	u8		green_size;
112 	u8		green_pos;
113 	u8		blue_size;
114 	u8		blue_pos;
115 	u8		rsvd_size;
116 	u8		rsvd_pos;
117 };
118 
119 /* command line: \0 terminated string */
120 #define ATAG_CMDLINE	0x54410009
121 
122 struct tag_cmdline {
123 	char	cmdline[COMMAND_LINE_SIZE];
124 };
125 
126 struct tag {
127 	struct tag_header hdr;
128 	union {
129 		struct tag_core		core;
130 		struct tag_mem32	mem;
131 		struct tag_videotext	videotext;
132 		struct tag_ramdisk	ramdisk;
133 		struct tag_initrd	initrd;
134 		struct tag_serialnr	serialnr;
135 		struct tag_revision	revision;
136 		struct tag_videolfb	videolfb;
137 		struct tag_cmdline	cmdline;
138 	} u;
139 };
140 
141 struct tagtable {
142 	u32 tag;
143 	int (*parse)(const struct tag *);
144 };
145 
146 #define tag_member_present(tag, member)				\
147 	((unsigned long)(&((struct tag *)0L)->member + 1)	\
148 		<= (tag)->hdr.size * 4)
149 
150 #define tag_next(t)	((struct tag *)((u32 *)(t) + (t)->hdr.size))
151 #define tag_size(type)	((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
152 
153 #define for_each_tag(t, base) \
154 	for (t = base; t->hdr.size; t = tag_next(t))
155 
156 #ifdef __KERNEL__
157 
158 #define __tag __used __attribute__((__section__(".taglist")))
159 #define __tagtable(tag, fn) \
160 static struct tagtable __tagtable_##fn __tag = { tag, fn }
161 
162 /*
163  * Memory map description
164  */
165 #define NR_BANKS 8
166 
167 struct meminfo {
168 	int nr_banks;
169 	struct {
170 		unsigned long start;
171 		unsigned long size;
172 		int           node;
173 	} bank[NR_BANKS];
174 };
175 
176 /*
177  * Early command line parameters.
178  */
179 struct early_params {
180 	const char *arg;
181 	void (*fn)(char **p);
182 };
183 
184 #define __early_param(name, fn)					\
185 static struct early_params __early_##fn __used	\
186 __attribute__((__section__("__early_param"))) = { name, fn }
187 
188 #endif
189 #endif
190