[coreboot] [v2] r4311 - trunk/coreboot-v2/src/arch/i386/boot

svn at coreboot.org svn at coreboot.org
Tue May 26 21:39:15 CEST 2009


Author: oxygene
Date: 2009-05-26 21:39:14 +0200 (Tue, 26 May 2009)
New Revision: 4311

Modified:
   trunk/coreboot-v2/src/arch/i386/boot/coreboot_table.c
   trunk/coreboot-v2/src/arch/i386/boot/tables.c
Log:
Clean up acpi table writing code, and don't rely
on a given alignment for the RSDP and RSDT - look
it up instead.

Signed-off-by: Patrick Georgi <patrick.georgi at coresystems.de>
Acked-by: Myles Watson <mylesgw at gmail.com>


Modified: trunk/coreboot-v2/src/arch/i386/boot/coreboot_table.c
===================================================================
--- trunk/coreboot-v2/src/arch/i386/boot/coreboot_table.c	2009-05-26 18:01:53 UTC (rev 4310)
+++ trunk/coreboot-v2/src/arch/i386/boot/coreboot_table.c	2009-05-26 19:39:14 UTC (rev 4311)
@@ -429,9 +429,8 @@
 			low_table_end);
 	head = lb_table_init(low_table_end);
 	lb_forward(head, (struct lb_header*)rom_table_end);
-	lb_table_fini(head, 0);
 
-	low_table_end = (unsigned long)head;
+	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",
 			rom_table_end);

Modified: trunk/coreboot-v2/src/arch/i386/boot/tables.c
===================================================================
--- trunk/coreboot-v2/src/arch/i386/boot/tables.c	2009-05-26 18:01:53 UTC (rev 4310)
+++ trunk/coreboot-v2/src/arch/i386/boot/tables.c	2009-05-26 19:39:14 UTC (rev 4311)
@@ -63,20 +63,15 @@
 {
 	unsigned long low_table_start, low_table_end;
 	unsigned long rom_table_start, rom_table_end;
-#if HAVE_MP_TABLE == 1
-	unsigned long new_low_table_end;
-#endif
 
 	/* Even if high tables are configured, some tables are copied both to
 	 * the low and the high area, so payloads and OSes don't need to know
 	 * about the high tables.
 	 */
-	unsigned long high_rsdp;
-	unsigned long high_table_start=0, high_table_end=0;
+	unsigned long high_table_end=0;
 
 	if (high_tables_base) {
 		printk_debug("High Tables Base is %llx.\n", high_tables_base);
-		high_table_start = high_tables_base;
 		high_table_end = high_tables_base;
 	} else {
 		printk_err("ERROR: High Tables Base is not set.\n");
@@ -111,14 +106,22 @@
 	/* Write ACPI tables to F segment and high tables area */
 #if HAVE_ACPI_TABLES == 1
 	if (high_tables_base) {
-		unsigned long rsdt_location;
-		high_rsdp = ALIGN(high_table_end, 16);
+		unsigned long acpi_start = high_table_end;
+		rom_table_end = ALIGN(rom_table_end, 16);
 		high_table_end = write_acpi_tables(high_table_end);
+		while (acpi_start < high_table_end) {
+			if (memcmp(((acpi_rsdp_t *)acpi_start)->signature, RSDP_SIG, 8) == 0) {
+				break;
+			}
+			acpi_start++;
+		}
+		if (acpi_start != high_table_end) {
+			acpi_write_rsdp((acpi_rsdp_t *)rom_table_end, ((acpi_rsdp_t *)acpi_start)->rsdt_address);
+		} else {
+			printk_err("ERROR: Didn't find RSDP in high table.\n");
+		}
 		high_table_end = ALIGN(high_table_end, 1024);
-		rsdt_location = (unsigned long)(((acpi_rsdp_t*)high_rsdp)->rsdt_address);
-		printk_debug("high mem RSDP at %x, RSDT at %x\n", high_rsdp, rsdt_location);
-		acpi_write_rsdp((acpi_rsdp_t *)rom_table_end, (acpi_rsdt_t *)rsdt_location);
-		rom_table_end = ALIGN(ALIGN(rom_table_end, 16) + sizeof(acpi_rsdp_t), 16);
+		rom_table_end = ALIGN(rom_table_end + sizeof(acpi_rsdp_t), 16);
 	} else {
 		rom_table_end = write_acpi_tables(rom_table_end);
 		rom_table_end = ALIGN(rom_table_end, 1024);
@@ -164,7 +167,11 @@
 	if (high_tables_base) {
 		/* Also put a forwarder entry into 0-4K */
 		write_coreboot_table(low_table_start, low_table_end,
-				high_table_start, high_table_end);
+				high_tables_base, high_table_end);
+		if (high_table_end > high_tables_base + high_tables_size)
+			printk_err("%s: High tables didn't fit in %llx (%llx)\n",
+				   __func__, high_tables_size, high_table_end -
+				   high_tables_base);
 	} else {
 		/* The coreboot table must be in 0-4K or 960K-1M */
 		write_coreboot_table(low_table_start, low_table_end,





More information about the coreboot mailing list