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