X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Farch%2Fi386%2Fboot%2Fcoreboot_table.c;h=8baaab4f600190fa74e8ec8242b7a590e113bf91;hb=c02b4fc9db3c3c1e263027382697b566127f66bb;hp=afe70d6ff62f26c112c4b2e1930f3b6f7603536a;hpb=8f848137755934d1ec91fb188500881796694d28;p=coreboot.git diff --git a/src/arch/i386/boot/coreboot_table.c b/src/arch/i386/boot/coreboot_table.c index afe70d6ff..8baaab4f6 100644 --- a/src/arch/i386/boot/coreboot_table.c +++ b/src/arch/i386/boot/coreboot_table.c @@ -24,7 +24,7 @@ #include #include #include -#include "coreboot_table.h" +#include #include #include #include @@ -65,11 +65,13 @@ static struct lb_record *lb_last_record(struct lb_header *header) return rec; } +#if 0 static struct lb_record *lb_next_record(struct lb_record *rec) { rec = (void *)(((char *)rec) + rec->size); return rec; } +#endif static struct lb_record *lb_new_record(struct lb_header *header) { @@ -146,7 +148,20 @@ static void lb_console(struct lb_header *header) #endif } -struct lb_mainboard *lb_mainboard(struct lb_header *header) +static void lb_framebuffer(struct lb_header *header) +{ +#if defined(CONFIG_BOOTSPLASH) && CONFIG_BOOTSPLASH && CONFIG_COREBOOT_KEEP_FRAMEBUFFER + void fill_lb_framebuffer(struct lb_framebuffer *framebuffer); + + struct lb_framebuffer *framebuffer; + framebuffer = (struct lb_framebuffer *)lb_new_record(header); + framebuffer->tag = LB_TAG_FRAMEBUFFER; + framebuffer->size = sizeof(*framebuffer); + fill_lb_framebuffer(framebuffer); +#endif +} + +static struct lb_mainboard *lb_mainboard(struct lb_header *header) { struct lb_record *rec; struct lb_mainboard *mainboard; @@ -170,6 +185,7 @@ struct lb_mainboard *lb_mainboard(struct lb_header *header) return mainboard; } +#if (CONFIG_HAVE_OPTION_TABLE == 1) static struct cmos_checksum *lb_cmos_checksum(struct lb_header *header) { struct lb_record *rec; @@ -187,6 +203,7 @@ static struct cmos_checksum *lb_cmos_checksum(struct lb_header *header) return cmos_checksum; } +#endif static void lb_strings(struct lb_header *header) { @@ -218,6 +235,7 @@ static void lb_strings(struct lb_header *header) } +#if CONFIG_WRITE_HIGH_TABLES == 1 static struct lb_forward *lb_forward(struct lb_header *header, struct lb_header *next_header) { struct lb_record *rec; @@ -229,6 +247,7 @@ static struct lb_forward *lb_forward(struct lb_header *header, struct lb_header forward->forward = (uint64_t)(unsigned long)next_header; return forward; } +#endif void lb_memory_range(struct lb_memory *mem, uint32_t type, uint64_t start, uint64_t size) @@ -288,7 +307,7 @@ static unsigned long lb_table_fini(struct lb_header *head, int fixup) head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes); head->header_checksum = 0; head->header_checksum = compute_ip_checksum(head, sizeof(*head)); - printk_debug("Wrote coreboot table at: %p - %p checksum %x\n", + printk(BIOS_DEBUG, "Wrote coreboot table at: %p - %p checksum %x\n", head, rec, head->table_checksum); return (unsigned long)rec; } @@ -403,6 +422,36 @@ void lb_add_memory_range(struct lb_memory *mem, lb_cleanup_memory_ranges(mem); } +static void lb_dump_memory_ranges(struct lb_memory *mem) +{ + int entries; + int i; + entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]); + + printk(BIOS_DEBUG, "coreboot memory table:\n"); + for(i = 0; i < entries; i++) { + uint64_t entry_start = unpack_lb64(mem->map[i].start); + uint64_t entry_size = unpack_lb64(mem->map[i].size); + const char *entry_type; + + switch (mem->map[i].type) { + case LB_MEM_RAM: entry_type="RAM"; break; + case LB_MEM_RESERVED: entry_type="RESERVED"; break; + case LB_MEM_ACPI: entry_type="ACPI"; break; + case LB_MEM_NVS: entry_type="NVS"; break; + case LB_MEM_UNUSABLE: entry_type="UNUSABLE"; break; + case LB_MEM_VENDOR_RSVD: entry_type="VENDOR RESERVED"; break; + case LB_MEM_TABLE: entry_type="CONFIGURATION TABLES"; break; + default: entry_type="UNKNOWN!"; break; + } + + printk(BIOS_DEBUG, "%2d. %016llx-%016llx: %s\n", + i, entry_start, entry_start+entry_size-1, entry_type); + + } +} + + /* Routines to extract part so the coreboot table or * information from the coreboot table after we have written it. * Currently get_lb_mem relies on a global we can change the @@ -448,19 +497,19 @@ unsigned long write_coreboot_table( struct lb_memory *mem; #if CONFIG_WRITE_HIGH_TABLES == 1 - printk_debug("Writing high table forward entry at 0x%08lx\n", + printk(BIOS_DEBUG, "Writing high table forward entry at 0x%08lx\n", low_table_end); head = lb_table_init(low_table_end); lb_forward(head, (struct lb_header*)rom_table_end); low_table_end = (unsigned long) lb_table_fini(head, 0); - printk_debug("New low_table_end: 0x%08lx\n", low_table_end); - printk_debug("Now going to write high coreboot table at 0x%08lx\n", + printk(BIOS_DEBUG, "New low_table_end: 0x%08lx\n", low_table_end); + printk(BIOS_DEBUG, "Now going to write high coreboot table at 0x%08lx\n", rom_table_end); head = lb_table_init(rom_table_end); rom_table_end = (unsigned long)head; - printk_debug("rom_table_end = 0x%08lx\n", rom_table_end); + printk(BIOS_DEBUG, "rom_table_end = 0x%08lx\n", rom_table_end); #else if(low_table_end > (0x1000 - sizeof(struct lb_header))) { /* after 4K */ /* We need to put lbtable on to [0xf0000,0x100000) */ @@ -472,23 +521,22 @@ unsigned long write_coreboot_table( } #endif - printk_debug("Adjust low_table_end from 0x%08lx to ", low_table_end); + printk(BIOS_DEBUG, "Adjust low_table_end from 0x%08lx to ", low_table_end); low_table_end += 0xfff; // 4K aligned low_table_end &= ~0xfff; - printk_debug("0x%08lx \n", low_table_end); + printk(BIOS_DEBUG, "0x%08lx \n", low_table_end); /* The Linux kernel assumes this region is reserved */ - printk_debug("Adjust rom_table_end from 0x%08lx to ", rom_table_end); + printk(BIOS_DEBUG, "Adjust rom_table_end from 0x%08lx to ", rom_table_end); rom_table_end += 0xffff; // 64K align rom_table_end &= ~0xffff; - printk_debug("0x%08lx \n", rom_table_end); + printk(BIOS_DEBUG, "0x%08lx \n", rom_table_end); #if (CONFIG_HAVE_OPTION_TABLE == 1) { - struct lb_record *rec_dest; + struct lb_record *rec_dest = lb_new_record(head); /* Copy the option config table, it's already a lb_record... */ - rec_dest = lb_new_record(head); - memcpy(rec_dest, &option_table, sizeof(option_table)); + memcpy(rec_dest, &option_table, option_table.size); /* Create cmos checksum entry in coreboot table */ lb_cmos_checksum(head); } @@ -505,7 +553,7 @@ unsigned long write_coreboot_table( rom_table_start, rom_table_end-rom_table_start); #if CONFIG_WRITE_HIGH_TABLES == 1 - printk_debug("Adding high table area\n"); + printk(BIOS_DEBUG, "Adding high table area\n"); // should this be LB_MEM_ACPI? lb_add_memory_range(mem, LB_MEM_TABLE, high_tables_base, high_tables_size); @@ -515,6 +563,8 @@ unsigned long write_coreboot_table( add_mainboard_resources(mem); #endif + lb_dump_memory_ranges(mem); + /* Note: * I assume that there is always memory at immediately after * the low_table_end. This means that after I setup the coreboot table. @@ -530,6 +580,8 @@ unsigned long write_coreboot_table( lb_console(head); /* Record our various random string information */ lb_strings(head); + /* Record our framebuffer */ + lb_framebuffer(head); /* Remember where my valid memory ranges are */ return lb_table_fini(head, 1);