summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2009-03-17 14:39:25 +0000
committerStefan Reinauer <stefan.reinauer@coreboot.org>2009-03-17 14:39:25 +0000
commit2d853bb58740d575c1bbcc1d29e92654069b11d9 (patch)
treea7f21b4c1e82faf30a6dc68569d4f26aa079bca9
parent0472f3d82624dcb19f25746172c6d59532e2463c (diff)
downloadflashrom-2d853bb58740d575c1bbcc1d29e92654069b11d9.tar.gz
flashrom-2d853bb58740d575c1bbcc1d29e92654069b11d9.tar.bz2
flashrom-2d853bb58740d575c1bbcc1d29e92654069b11d9.zip
This patch adds "high coreboot table support" to coreboot version 2
Some bootloaders seem to overwrite memory starting at 0x600, thus destroying the coreboot table integrity, rendering the table useless. By moving the table to the high tables area (if it's activated), this problem is fixed. In order to move the table, a 40 bytes mini coreboot table with a single sub table is placed at 0x500/0x530 that points to the real coreboot table. This is comparable to the ACPI RSDT or the MP floating table. This patch also adds "table forward" support to flashrom and nvramtool. Corresponding to flashrom svn r421 and coreboot v2 svn r4012. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Peter Stuge <peter@stuge.se>
-rw-r--r--cbtable.c30
-rw-r--r--coreboot_tables.h7
2 files changed, 29 insertions, 8 deletions
diff --git a/cbtable.c b/cbtable.c
index 2a3f2a75f..4aa260bc0 100644
--- a/cbtable.c
+++ b/cbtable.c
@@ -4,7 +4,7 @@
* Copyright (C) 2002 Steven James <pyro@linuxlabs.com>
* Copyright (C) 2002 Linux Networx
* (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
- * Copyright (C) 2006-2007 coresystems GmbH
+ * Copyright (C) 2006-2009 coresystems GmbH
* (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
*
* This program is free software; you can redistribute it and/or modify
@@ -124,7 +124,7 @@ static struct lb_header *find_lb_table(void *base, unsigned long start,
head->table_checksum);
continue;
}
- fprintf(stdout, "Found coreboot table at 0x%08lx.\n", addr);
+ printf_debug("Found coreboot table at 0x%08lx.\n", addr);
return head;
};
@@ -181,9 +181,10 @@ static void search_lb_records(struct lb_record *rec, struct lb_record *last,
}
}
+#define BYTES_TO_MAP (1024*1024)
int coreboot_init(void)
{
- uint8_t *low_1MB;
+ uint8_t *table_area;
unsigned long addr, start;
struct lb_header *lb_table;
struct lb_record *rec, *last;
@@ -196,18 +197,31 @@ int coreboot_init(void)
#else
start = 0x0;
#endif
- low_1MB = physmap("low megabyte", start, 1024*1024);
+ table_area = physmap("low megabyte", start, BYTES_TO_MAP);
- lb_table = find_lb_table(low_1MB, 0x00000, 0x1000);
+ lb_table = find_lb_table(table_area, 0x00000, 0x1000);
if (!lb_table)
- lb_table = find_lb_table(low_1MB, 0xf0000, 1024*1024);
+ lb_table = find_lb_table(table_area, 0xf0000, BYTES_TO_MAP);
+ if (lb_table) {
+ struct lb_forward *forward = (struct lb_forward *)
+ (((char *)lb_table) + lb_table->header_bytes);
+ if (forward->tag == LB_TAG_FORWARD) {
+ start = forward->forward;
+ start &= ~(getpagesize()-1);
+ physunmap(table_area, BYTES_TO_MAP);
+ table_area = physmap("high tables", start, BYTES_TO_MAP);
+ lb_table = find_lb_table(table_area, 0x00000, 0x1000);
+ }
+ }
+
if (!lb_table) {
printf("No coreboot table found.\n");
return -1;
}
- addr = ((char *)lb_table) - ((char *)low_1MB) + start;
- printf_debug("coreboot table found at %p.\n", lb_table + start);
+ addr = ((char *)lb_table) - ((char *)table_area) + start;
+ fprintf(stdout, "coreboot table found at 0x%lx.\n",
+ (unsigned long)lb_table - (unsigned long)table_area + start);
rec = (struct lb_record *)(((char *)lb_table) + lb_table->header_bytes);
last = (struct lb_record *)(((char *)rec) + lb_table->table_bytes);
printf_debug("coreboot header(%d) checksum: %04x table(%d) checksum: %04x entries: %d\n",
diff --git a/coreboot_tables.h b/coreboot_tables.h
index c4c2d4d17..2eaff0876 100644
--- a/coreboot_tables.h
+++ b/coreboot_tables.h
@@ -135,6 +135,13 @@ struct lb_string {
uint8_t string[0];
};
+#define LB_TAG_FORWARD 0x0011
+struct lb_forward {
+ uint32_t tag;
+ uint32_t size;
+ uint64_t forward;
+};
+
/* The following structures are for the cmos definitions table */
#define LB_TAG_CMOS_OPTION_TABLE 200
/* cmos header record */