Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 1 | #include <console/console.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 2 | #include <ip_checksum.h> |
| 3 | #include <boot/linuxbios_tables.h> |
| 4 | #include "linuxbios_table.h" |
| 5 | #include <string.h> |
| 6 | #include <version.h> |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 7 | #include <device/device.h> |
| 8 | #include <stdlib.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 9 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 10 | struct lb_header *lb_table_init(unsigned long addr) |
| 11 | { |
| 12 | struct lb_header *header; |
| 13 | |
| 14 | /* 16 byte align the address */ |
| 15 | addr += 15; |
| 16 | addr &= ~15; |
| 17 | |
| 18 | header = (void *)addr; |
| 19 | header->signature[0] = 'L'; |
| 20 | header->signature[1] = 'B'; |
| 21 | header->signature[2] = 'I'; |
| 22 | header->signature[3] = 'O'; |
| 23 | header->header_bytes = sizeof(*header); |
| 24 | header->header_checksum = 0; |
| 25 | header->table_bytes = 0; |
| 26 | header->table_checksum = 0; |
| 27 | header->table_entries = 0; |
| 28 | return header; |
| 29 | } |
| 30 | |
| 31 | struct lb_record *lb_first_record(struct lb_header *header) |
| 32 | { |
| 33 | struct lb_record *rec; |
| 34 | rec = (void *)(((char *)header) + sizeof(*header)); |
| 35 | return rec; |
| 36 | } |
| 37 | |
| 38 | struct lb_record *lb_last_record(struct lb_header *header) |
| 39 | { |
| 40 | struct lb_record *rec; |
| 41 | rec = (void *)(((char *)header) + sizeof(*header) + header->table_bytes); |
| 42 | return rec; |
| 43 | } |
| 44 | |
| 45 | struct lb_record *lb_next_record(struct lb_record *rec) |
| 46 | { |
| 47 | rec = (void *)(((char *)rec) + rec->size); |
| 48 | return rec; |
| 49 | } |
| 50 | |
| 51 | struct lb_record *lb_new_record(struct lb_header *header) |
| 52 | { |
| 53 | struct lb_record *rec; |
| 54 | rec = lb_last_record(header); |
| 55 | if (header->table_entries) { |
| 56 | header->table_bytes += rec->size; |
| 57 | } |
| 58 | rec = lb_last_record(header); |
| 59 | header->table_entries++; |
| 60 | rec->tag = LB_TAG_UNUSED; |
| 61 | rec->size = sizeof(*rec); |
| 62 | return rec; |
| 63 | } |
| 64 | |
| 65 | |
| 66 | struct lb_memory *lb_memory(struct lb_header *header) |
| 67 | { |
| 68 | struct lb_record *rec; |
| 69 | struct lb_memory *mem; |
| 70 | rec = lb_new_record(header); |
| 71 | mem = (struct lb_memory *)rec; |
| 72 | mem->tag = LB_TAG_MEMORY; |
| 73 | mem->size = sizeof(*mem); |
| 74 | return mem; |
| 75 | } |
| 76 | |
| 77 | struct lb_mainboard *lb_mainboard(struct lb_header *header) |
| 78 | { |
| 79 | struct lb_record *rec; |
| 80 | struct lb_mainboard *mainboard; |
| 81 | rec = lb_new_record(header); |
| 82 | mainboard = (struct lb_mainboard *)rec; |
| 83 | mainboard->tag = LB_TAG_MAINBOARD; |
| 84 | |
| 85 | mainboard->size = (sizeof(*mainboard) + |
| 86 | strlen(mainboard_vendor) + 1 + |
| 87 | strlen(mainboard_part_number) + 1 + |
| 88 | 3) & ~3; |
| 89 | |
| 90 | mainboard->vendor_idx = 0; |
| 91 | mainboard->part_number_idx = strlen(mainboard_vendor) + 1; |
| 92 | |
| 93 | memcpy(mainboard->strings + mainboard->vendor_idx, |
| 94 | mainboard_vendor, strlen(mainboard_vendor) + 1); |
| 95 | memcpy(mainboard->strings + mainboard->part_number_idx, |
| 96 | mainboard_part_number, strlen(mainboard_part_number) + 1); |
| 97 | |
| 98 | return mainboard; |
| 99 | } |
| 100 | |
Stefan Reinauer | 4bd0de0 | 2005-12-03 22:39:23 +0000 | [diff] [blame] | 101 | struct cmos_checksum *lb_cmos_checksum(struct lb_header *header) |
| 102 | { |
| 103 | struct lb_record *rec; |
| 104 | struct cmos_checksum *cmos_checksum; |
| 105 | rec = lb_new_record(header); |
| 106 | cmos_checksum = (struct cmos_checksum *)rec; |
| 107 | cmos_checksum->tag = LB_TAG_OPTION_CHECKSUM; |
| 108 | |
| 109 | cmos_checksum->size = (sizeof(*cmos_checksum)); |
| 110 | |
| 111 | cmos_checksum->range_start = LB_CKS_RANGE_START * 8; |
| 112 | cmos_checksum->range_end = ( LB_CKS_RANGE_END * 8 ) + 7; |
| 113 | cmos_checksum->location = LB_CKS_LOC * 8; |
| 114 | cmos_checksum->type = CHECKSUM_PCBIOS; |
| 115 | |
| 116 | return cmos_checksum; |
| 117 | } |
| 118 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 119 | void lb_strings(struct lb_header *header) |
| 120 | { |
| 121 | static const struct { |
| 122 | uint32_t tag; |
| 123 | const uint8_t *string; |
| 124 | } strings[] = { |
| 125 | { LB_TAG_VERSION, linuxbios_version, }, |
| 126 | { LB_TAG_EXTRA_VERSION, linuxbios_extra_version, }, |
| 127 | { LB_TAG_BUILD, linuxbios_build, }, |
| 128 | { LB_TAG_COMPILE_TIME, linuxbios_compile_time, }, |
| 129 | { LB_TAG_COMPILE_BY, linuxbios_compile_by, }, |
| 130 | { LB_TAG_COMPILE_HOST, linuxbios_compile_host, }, |
| 131 | { LB_TAG_COMPILE_DOMAIN, linuxbios_compile_domain, }, |
| 132 | { LB_TAG_COMPILER, linuxbios_compiler, }, |
| 133 | { LB_TAG_LINKER, linuxbios_linker, }, |
| 134 | { LB_TAG_ASSEMBLER, linuxbios_assembler, }, |
| 135 | }; |
Eric Biederman | 5268557 | 2003-05-19 19:16:21 +0000 | [diff] [blame] | 136 | unsigned int i; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 137 | for(i = 0; i < sizeof(strings)/sizeof(strings[0]); i++) { |
| 138 | struct lb_string *rec; |
| 139 | size_t len; |
| 140 | rec = (struct lb_string *)lb_new_record(header); |
| 141 | len = strlen(strings[i].string); |
| 142 | rec->tag = strings[i].tag; |
| 143 | rec->size = (sizeof(*rec) + len + 1 + 3) & ~3; |
| 144 | memcpy(rec->string, strings[i].string, len+1); |
| 145 | } |
| 146 | |
| 147 | } |
| 148 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 149 | void lb_memory_range(struct lb_memory *mem, |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 150 | uint32_t type, uint64_t start, uint64_t size) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 151 | { |
| 152 | int entries; |
| 153 | entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]); |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 154 | mem->map[entries].start = pack_lb64(start); |
| 155 | mem->map[entries].size = pack_lb64(size); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 156 | mem->map[entries].type = type; |
| 157 | mem->size += sizeof(mem->map[0]); |
| 158 | } |
| 159 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 160 | static void lb_reserve_table_memory(struct lb_header *head) |
| 161 | { |
| 162 | struct lb_record *last_rec; |
| 163 | struct lb_memory *mem; |
| 164 | uint64_t start; |
| 165 | uint64_t end; |
| 166 | int i, entries; |
| 167 | |
| 168 | last_rec = lb_last_record(head); |
| 169 | mem = get_lb_mem(); |
| 170 | start = (unsigned long)head; |
| 171 | end = (unsigned long)last_rec; |
| 172 | entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]); |
| 173 | /* Resize the right two memory areas so this table is in |
| 174 | * a reserved area of memory. Everything has been carefully |
| 175 | * setup so that is all we need to do. |
| 176 | */ |
| 177 | for(i = 0; i < entries; i++ ) { |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 178 | uint64_t map_start = unpack_lb64(mem->map[i].start); |
| 179 | uint64_t map_end = map_start + unpack_lb64(mem->map[i].size); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 180 | /* Does this area need to be expanded? */ |
| 181 | if (map_end == start) { |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 182 | mem->map[i].size = pack_lb64(end - map_start); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 183 | } |
| 184 | /* Does this area need to be contracted? */ |
| 185 | else if (map_start == start) { |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 186 | mem->map[i].start = pack_lb64(end); |
| 187 | mem->map[i].size = pack_lb64(map_end - end); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 192 | unsigned long lb_table_fini(struct lb_header *head) |
| 193 | { |
| 194 | struct lb_record *rec, *first_rec; |
| 195 | rec = lb_last_record(head); |
| 196 | if (head->table_entries) { |
| 197 | head->table_bytes += rec->size; |
| 198 | } |
| 199 | lb_reserve_table_memory(head); |
| 200 | first_rec = lb_first_record(head); |
| 201 | head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes); |
| 202 | head->header_checksum = 0; |
| 203 | head->header_checksum = compute_ip_checksum(head, sizeof(*head)); |
| 204 | printk_debug("Wrote linuxbios table at: %p - %p checksum %lx\n", |
| 205 | head, rec, head->table_checksum); |
| 206 | return (unsigned long)rec; |
| 207 | } |
| 208 | |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 209 | static void lb_cleanup_memory_ranges(struct lb_memory *mem) |
| 210 | { |
| 211 | int entries; |
| 212 | int i, j; |
| 213 | entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]); |
| 214 | |
| 215 | /* Sort the lb memory ranges */ |
| 216 | for(i = 0; i < entries; i++) { |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 217 | uint64_t entry_start = unpack_lb64(mem->map[i].start); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 218 | for(j = i; j < entries; j++) { |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 219 | uint64_t temp_start = unpack_lb64(mem->map[j].start); |
| 220 | if (temp_start < entry_start) { |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 221 | struct lb_memory_range tmp; |
| 222 | tmp = mem->map[i]; |
| 223 | mem->map[i] = mem->map[j]; |
| 224 | mem->map[j] = tmp; |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | /* Merge adjacent entries */ |
| 230 | for(i = 0; (i + 1) < entries; i++) { |
| 231 | uint64_t start, end, nstart, nend; |
| 232 | if (mem->map[i].type != mem->map[i + 1].type) { |
| 233 | continue; |
| 234 | } |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 235 | start = unpack_lb64(mem->map[i].start); |
| 236 | end = start + unpack_lb64(mem->map[i].size); |
| 237 | nstart = unpack_lb64(mem->map[i + 1].start); |
| 238 | nend = nstart + unpack_lb64(mem->map[i + 1].size); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 239 | if ((start <= nstart) && (end > nstart)) { |
| 240 | if (start > nstart) { |
| 241 | start = nstart; |
| 242 | } |
| 243 | if (end < nend) { |
| 244 | end = nend; |
| 245 | } |
| 246 | /* Record the new region size */ |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 247 | mem->map[i].start = pack_lb64(start); |
| 248 | mem->map[i].size = pack_lb64(end - start); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 249 | |
| 250 | /* Delete the entry I have merged with */ |
| 251 | memmove(&mem->map[i + 1], &mem->map[i + 2], |
| 252 | ((entries - i - 2) * sizeof(mem->map[0]))); |
| 253 | mem->size -= sizeof(mem->map[0]); |
| 254 | entries -= 1; |
| 255 | /* See if I can merge with the next entry as well */ |
| 256 | i -= 1; |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | static void lb_remove_memory_range(struct lb_memory *mem, |
| 262 | uint64_t start, uint64_t size) |
| 263 | { |
| 264 | uint64_t end; |
| 265 | int entries; |
| 266 | int i; |
| 267 | |
| 268 | end = start + size; |
| 269 | entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]); |
| 270 | |
| 271 | /* Remove a reserved area from the memory map */ |
| 272 | for(i = 0; i < entries; i++) { |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 273 | uint64_t map_start = unpack_lb64(mem->map[i].start); |
| 274 | uint64_t map_end = map_start + unpack_lb64(mem->map[i].size); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 275 | if ((start <= map_start) && (end >= map_end)) { |
| 276 | /* Remove the completely covered range */ |
| 277 | memmove(&mem->map[i], &mem->map[i + 1], |
| 278 | ((entries - i - 1) * sizeof(mem->map[0]))); |
| 279 | mem->size -= sizeof(mem->map[0]); |
| 280 | entries -= 1; |
| 281 | /* Since the index will disappear revisit what will appear here */ |
| 282 | i -= 1; |
| 283 | } |
| 284 | else if ((start > map_start) && (end < map_end)) { |
| 285 | /* Split the memory range */ |
| 286 | memmove(&mem->map[i + 1], &mem->map[i], |
| 287 | ((entries - i) * sizeof(mem->map[0]))); |
| 288 | mem->size += sizeof(mem->map[0]); |
| 289 | entries += 1; |
| 290 | /* Update the first map entry */ |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 291 | mem->map[i].size = pack_lb64(start - map_start); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 292 | /* Update the second map entry */ |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 293 | mem->map[i + 1].start = pack_lb64(end); |
| 294 | mem->map[i + 1].size = pack_lb64(map_end - end); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 295 | /* Don't bother with this map entry again */ |
| 296 | i += 1; |
| 297 | } |
| 298 | else if ((start <= map_start) && (end > map_start)) { |
| 299 | /* Shrink the start of the memory range */ |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 300 | mem->map[i].start = pack_lb64(end); |
| 301 | mem->map[i].size = pack_lb64(map_end - end); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 302 | } |
| 303 | else if ((start < map_end) && (start > map_start)) { |
| 304 | /* Shrink the end of the memory range */ |
Eric Biederman | ec01aa9 | 2004-12-10 20:50:43 +0000 | [diff] [blame] | 305 | mem->map[i].size = pack_lb64(start - map_start); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 306 | } |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | static void lb_add_memory_range(struct lb_memory *mem, |
| 311 | uint32_t type, uint64_t start, uint64_t size) |
| 312 | { |
| 313 | lb_remove_memory_range(mem, start, size); |
| 314 | lb_memory_range(mem, type, start, size); |
| 315 | lb_cleanup_memory_ranges(mem); |
| 316 | } |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 317 | |
| 318 | /* Routines to extract part so the linuxBIOS table or |
| 319 | * information from the linuxBIOS table after we have written it. |
| 320 | * Currently get_lb_mem relies on a global we can change the |
| 321 | * implementaiton. |
| 322 | */ |
| 323 | static struct lb_memory *mem_ranges = 0; |
| 324 | struct lb_memory *get_lb_mem(void) |
| 325 | { |
| 326 | return mem_ranges; |
| 327 | } |
| 328 | |
Eric Biederman | f8a2ddd | 2004-10-30 08:05:41 +0000 | [diff] [blame] | 329 | static void build_lb_mem_range(void *gp, struct device *dev, struct resource *res) |
| 330 | { |
| 331 | struct lb_memory *mem = gp; |
| 332 | lb_memory_range(mem, LB_MEM_RAM, res->base, res->size); |
| 333 | } |
| 334 | |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 335 | static struct lb_memory *build_lb_mem(struct lb_header *head) |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 336 | { |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 337 | struct lb_memory *mem; |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 338 | |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 339 | /* Record where the lb memory ranges will live */ |
| 340 | mem = lb_memory(head); |
| 341 | mem_ranges = mem; |
| 342 | |
| 343 | /* Build the raw table of memory */ |
Eric Biederman | f8a2ddd | 2004-10-30 08:05:41 +0000 | [diff] [blame] | 344 | search_global_resources( |
| 345 | IORESOURCE_MEM | IORESOURCE_CACHEABLE, IORESOURCE_MEM | IORESOURCE_CACHEABLE, |
| 346 | build_lb_mem_range, mem); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 347 | lb_cleanup_memory_ranges(mem); |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 348 | return mem; |
| 349 | } |
| 350 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 351 | unsigned long write_linuxbios_table( |
Stefan Reinauer | 4f1cb23 | 2006-07-19 15:32:49 +0000 | [diff] [blame] | 352 | unsigned long low_table_start, unsigned long low_table_end, |
| 353 | unsigned long rom_table_start, unsigned long rom_table_end) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 354 | { |
| 355 | unsigned long table_size; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 356 | struct lb_header *head; |
| 357 | struct lb_memory *mem; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 358 | |
Stefan Reinauer | 4f1cb23 | 2006-07-19 15:32:49 +0000 | [diff] [blame] | 359 | if(low_table_end > (0x1000 - sizeof(struct lb_header))) { /* after 4K */ |
| 360 | /* We need to put lbtable on to [0xf0000,0x100000) */ |
| 361 | head = lb_table_init(rom_table_end); |
| 362 | rom_table_end = (unsigned long)head; |
| 363 | } else { |
| 364 | head = lb_table_init(low_table_end); |
| 365 | low_table_end = (unsigned long)head; |
| 366 | } |
| 367 | |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 368 | if (HAVE_OPTION_TABLE == 1) { |
| 369 | struct lb_record *rec_dest, *rec_src; |
| 370 | /* Write the option config table... */ |
| 371 | rec_dest = lb_new_record(head); |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 372 | rec_src = (struct lb_record *)(void *)&option_table; |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 373 | memcpy(rec_dest, rec_src, rec_src->size); |
Stefan Reinauer | 4bd0de0 | 2005-12-03 22:39:23 +0000 | [diff] [blame] | 374 | /* Create cmos checksum entry in linuxbios table */ |
| 375 | lb_cmos_checksum(head); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 376 | } |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 377 | /* Record where RAM is located */ |
| 378 | mem = build_lb_mem(head); |
| 379 | |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 380 | /* Record the mptable and the the lb_table (This will be adjusted later) */ |
| 381 | lb_add_memory_range(mem, LB_MEM_TABLE, |
Stefan Reinauer | 4f1cb23 | 2006-07-19 15:32:49 +0000 | [diff] [blame] | 382 | low_table_start, low_table_end - low_table_start); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 383 | |
Stefan Reinauer | 4f1cb23 | 2006-07-19 15:32:49 +0000 | [diff] [blame] | 384 | /* Record the pirq table, acpi tables, and maybe the mptable */ |
Roman Kononov | 57e700f | 2007-02-01 00:44:27 +0000 | [diff] [blame^] | 385 | table_size=rom_table_end-rom_table_start; |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 386 | lb_add_memory_range(mem, LB_MEM_TABLE, |
Roman Kononov | 57e700f | 2007-02-01 00:44:27 +0000 | [diff] [blame^] | 387 | rom_table_start, table_size<0x10000?0x10000:table_size); |
Eric Biederman | 6e53f50 | 2004-10-27 08:53:57 +0000 | [diff] [blame] | 388 | |
| 389 | /* Note: |
| 390 | * I assume that there is always memory at immediately after |
| 391 | * the low_table_end. This means that after I setup the linuxbios table. |
| 392 | * I can trivially fixup the reserved memory ranges to hold the correct |
| 393 | * size of the linuxbios table. |
| 394 | */ |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 395 | |
| 396 | /* Record our motheboard */ |
| 397 | lb_mainboard(head); |
| 398 | /* Record our various random string information */ |
| 399 | lb_strings(head); |
| 400 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 401 | /* Remember where my valid memory ranges are */ |
Stefan Reinauer | 4f1cb23 | 2006-07-19 15:32:49 +0000 | [diff] [blame] | 402 | return lb_table_fini(head); |
| 403 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 404 | } |