Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 Documentation/arm/Setup |
| 12 | * for more info. |
| 13 | */ |
| 14 | #ifndef __ASMARM_SETUP_H |
| 15 | #define __ASMARM_SETUP_H |
| 16 | |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 17 | #include <asm/types.h> |
| 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #define COMMAND_LINE_SIZE 1024 |
| 20 | |
| 21 | /* The list ends with an ATAG_NONE node. */ |
| 22 | #define ATAG_NONE 0x00000000 |
| 23 | |
| 24 | struct tag_header { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 25 | __u32 size; |
| 26 | __u32 tag; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | /* The list must start with an ATAG_CORE node */ |
| 30 | #define ATAG_CORE 0x54410001 |
| 31 | |
| 32 | struct tag_core { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 33 | __u32 flags; /* bit 0 = read-only */ |
| 34 | __u32 pagesize; |
| 35 | __u32 rootdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | /* it is allowed to have multiple ATAG_MEM nodes */ |
| 39 | #define ATAG_MEM 0x54410002 |
| 40 | |
| 41 | struct tag_mem32 { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 42 | __u32 size; |
| 43 | __u32 start; /* physical start address */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | /* VGA text type displays */ |
| 47 | #define ATAG_VIDEOTEXT 0x54410003 |
| 48 | |
| 49 | struct tag_videotext { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 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; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | /* describes how the ramdisk will be used in kernel */ |
| 62 | #define ATAG_RAMDISK 0x54410004 |
| 63 | |
| 64 | struct tag_ramdisk { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 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 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | /* describes where the compressed ramdisk image lives (virtual address) */ |
| 71 | /* |
| 72 | * this one accidentally used virtual addresses - as such, |
| 73 | * it's deprecated. |
| 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 { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 81 | __u32 start; /* physical start address */ |
| 82 | __u32 size; /* size of compressed ramdisk image in bytes */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | /* board serial number. "64 bits should be enough for everybody" */ |
| 86 | #define ATAG_SERIAL 0x54410006 |
| 87 | |
| 88 | struct tag_serialnr { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 89 | __u32 low; |
| 90 | __u32 high; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | /* board revision */ |
| 94 | #define ATAG_REVISION 0x54410007 |
| 95 | |
| 96 | struct tag_revision { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 97 | __u32 rev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 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; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | /* command line: \0 terminated string */ |
| 123 | #define ATAG_CMDLINE 0x54410009 |
| 124 | |
| 125 | struct tag_cmdline { |
| 126 | char cmdline[1]; /* this is the minimum size */ |
| 127 | }; |
| 128 | |
| 129 | /* acorn RiscPC specific information */ |
| 130 | #define ATAG_ACORN 0x41000101 |
| 131 | |
| 132 | struct tag_acorn { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 133 | __u32 memc_control_reg; |
| 134 | __u32 vram_pages; |
| 135 | __u8 sounddefault; |
| 136 | __u8 adfsdrives; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | }; |
| 138 | |
| 139 | /* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */ |
| 140 | #define ATAG_MEMCLK 0x41000402 |
| 141 | |
| 142 | struct tag_memclk { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 143 | __u32 fmemclk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | }; |
| 145 | |
| 146 | struct tag { |
| 147 | struct tag_header hdr; |
| 148 | union { |
| 149 | struct tag_core core; |
| 150 | struct tag_mem32 mem; |
| 151 | struct tag_videotext videotext; |
| 152 | struct tag_ramdisk ramdisk; |
| 153 | struct tag_initrd initrd; |
| 154 | struct tag_serialnr serialnr; |
| 155 | struct tag_revision revision; |
| 156 | struct tag_videolfb videolfb; |
| 157 | struct tag_cmdline cmdline; |
| 158 | |
| 159 | /* |
| 160 | * Acorn specific |
| 161 | */ |
| 162 | struct tag_acorn acorn; |
| 163 | |
| 164 | /* |
| 165 | * DC21285 specific |
| 166 | */ |
| 167 | struct tag_memclk memclk; |
| 168 | } u; |
| 169 | }; |
| 170 | |
| 171 | struct tagtable { |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 172 | __u32 tag; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | int (*parse)(const struct tag *); |
| 174 | }; |
| 175 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | #define tag_member_present(tag,member) \ |
| 177 | ((unsigned long)(&((struct tag *)0L)->member + 1) \ |
| 178 | <= (tag)->hdr.size * 4) |
| 179 | |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 180 | #define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) |
| 182 | |
| 183 | #define for_each_tag(t,base) \ |
| 184 | for (t = base; t->hdr.size; t = tag_next(t)) |
| 185 | |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 186 | #ifdef __KERNEL__ |
| 187 | |
David Rientjes | b91d8a1 | 2007-05-11 16:18:55 -0700 | [diff] [blame] | 188 | #define __tag __used __attribute__((__section__(".taglist.init"))) |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 189 | #define __tagtable(tag, fn) \ |
| 190 | static struct tagtable __tagtable_##fn __tag = { tag, fn } |
| 191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | /* |
| 193 | * Memory map description |
| 194 | */ |
| 195 | #ifdef CONFIG_ARCH_LH7A40X |
| 196 | # define NR_BANKS 16 |
| 197 | #else |
| 198 | # define NR_BANKS 8 |
| 199 | #endif |
| 200 | |
Russell King | 456335e | 2006-09-27 10:00:54 +0100 | [diff] [blame] | 201 | struct membank { |
| 202 | unsigned long start; |
| 203 | unsigned long size; |
| 204 | int node; |
| 205 | }; |
| 206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | struct meminfo { |
| 208 | int nr_banks; |
Russell King | 456335e | 2006-09-27 10:00:54 +0100 | [diff] [blame] | 209 | struct membank bank[NR_BANKS]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | }; |
| 211 | |
Nicolas Pitre | 4b5f32c | 2008-10-06 13:24:40 -0400 | [diff] [blame] | 212 | extern struct meminfo meminfo; |
| 213 | |
Russell King | d2a38ef | 2008-10-01 16:56:15 +0100 | [diff] [blame] | 214 | #define for_each_nodebank(iter,mi,no) \ |
Nicolas Pitre | 4b5f32c | 2008-10-06 13:24:40 -0400 | [diff] [blame] | 215 | for (iter = 0; iter < (mi)->nr_banks; iter++) \ |
| 216 | if ((mi)->bank[iter].node == no) |
Russell King | d2a38ef | 2008-10-01 16:56:15 +0100 | [diff] [blame] | 217 | |
| 218 | #define bank_pfn_start(bank) __phys_to_pfn((bank)->start) |
| 219 | #define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size) |
| 220 | #define bank_pfn_size(bank) ((bank)->size >> PAGE_SHIFT) |
| 221 | #define bank_phys_start(bank) (bank)->start |
| 222 | #define bank_phys_end(bank) ((bank)->start + (bank)->size) |
| 223 | #define bank_phys_size(bank) (bank)->size |
| 224 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | /* |
| 226 | * Early command line parameters. |
| 227 | */ |
| 228 | struct early_params { |
| 229 | const char *arg; |
| 230 | void (*fn)(char **p); |
| 231 | }; |
| 232 | |
| 233 | #define __early_param(name,fn) \ |
David Rientjes | b91d8a1 | 2007-05-11 16:18:55 -0700 | [diff] [blame] | 234 | static struct early_params __early_##fn __used \ |
Ben Dooks | bfe6815 | 2005-09-20 16:25:12 +0100 | [diff] [blame] | 235 | __attribute__((__section__(".early_param.init"))) = { name, fn } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
Adrian Bunk | 7d1362c | 2006-12-06 20:40:38 -0800 | [diff] [blame] | 237 | #endif /* __KERNEL__ */ |
| 238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | #endif |