I'm still worried about someone changing the alignment of the rdsp and
breaking the high tables code.

This patch moves rsdp table generation into acpi_tables and cleans up
a couple of unused variables.

Signed-off-by: Myles Watson <[email protected]>

Thanks,
Myles
Index: cbv2/src/arch/i386/boot/tables.c
===================================================================
--- cbv2.orig/src/arch/i386/boot/tables.c
+++ cbv2/src/arch/i386/boot/tables.c
@@ -63,20 +63,15 @@ struct lb_memory *write_tables(void)
 {
 	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,16 +106,12 @@ struct lb_memory *write_tables(void)
 	/* 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);
-		high_table_end = write_acpi_tables(high_table_end);
+		rom_table_end = ALIGN(rom_table_end, 16);
+		high_table_end = write_acpi_tables(high_table_end, rom_table_end);
 		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 = write_acpi_tables(rom_table_end, 0);
 		rom_table_end = ALIGN(rom_table_end, 1024);
 	}
 #endif
@@ -164,7 +155,11 @@ struct lb_memory *write_tables(void)
 	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,
Index: cbv2/src/arch/i386/boot/coreboot_table.c
===================================================================
--- cbv2.orig/src/arch/i386/boot/coreboot_table.c
+++ cbv2/src/arch/i386/boot/coreboot_table.c
@@ -429,9 +429,8 @@ unsigned long write_coreboot_table( 
 			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);
Index: cbv2/src/arch/i386/include/arch/acpi.h
===================================================================
--- cbv2.orig/src/arch/i386/include/arch/acpi.h
+++ cbv2/src/arch/i386/include/arch/acpi.h
@@ -325,7 +325,7 @@ typedef struct acpi_facs {
 } __attribute__ ((packed)) acpi_facs_t;
 
 /* These are implemented by the target port */
-unsigned long write_acpi_tables(unsigned long addr);
+unsigned long write_acpi_tables(unsigned long addr, unsigned long rsdp2);
 unsigned long acpi_fill_madt(unsigned long current);
 unsigned long acpi_fill_mcfg(unsigned long current);
 unsigned long acpi_fill_srat(unsigned long current);
@@ -392,7 +392,7 @@ do {                                    
 
 #else // HAVE_ACPI_TABLES
 
-#define write_acpi_tables(start) (start)
+#define write_acpi_tables(start, rsdp2) (start + rsdp2)
 
 #endif
 
Index: cbv2/src/mainboard/amd/dbm690t/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/amd/dbm690t/acpi_tables.c
+++ cbv2/src/mainboard/amd/dbm690t/acpi_tables.c
@@ -129,7 +129,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -159,6 +159,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *)start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/*
Index: cbv2/src/mainboard/amd/pistachio/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/amd/pistachio/acpi_tables.c
+++ cbv2/src/mainboard/amd/pistachio/acpi_tables.c
@@ -129,7 +129,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -159,6 +159,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *)start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/*
@@ -253,7 +255,6 @@ unsigned long write_acpi_tables(unsigned
 	dsdt = (acpi_header_t *) current;
 	memcpy((void *)dsdt, (void *)AmlCode,
 	       ((acpi_header_t *) AmlCode)->length);
-
 	current += dsdt->length;
 	printk_debug("ACPI:    * DSDT @ %p Length %x\n", dsdt, dsdt->length);
 	/* FADT */
Index: cbv2/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
+++ cbv2/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
@@ -184,7 +184,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -220,8 +220,10 @@ unsigned long write_acpi_tables(unsigned
 
 	/* clear all table memory */
 	memset((void *)start, 0, current - start);
-	
+
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/*
Index: cbv2/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
+++ cbv2/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
@@ -188,7 +188,7 @@ void update_ssdtx(void *ssdtx, int i)
 
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -224,6 +224,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *)start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/*
Index: cbv2/src/mainboard/asus/a8v-e_se/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ cbv2/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -80,7 +80,7 @@ unsigned long acpi_fill_madt(unsigned lo
 	return current;
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -109,6 +109,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *) start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/* We explicitly add these tables later on: */
Index: cbv2/src/mainboard/asus/m2v-mx_se/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ cbv2/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -89,7 +89,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -120,6 +120,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *) start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/* We explicitly add these tables later on: */
Index: cbv2/src/mainboard/intel/xe7501devkit/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/intel/xe7501devkit/acpi_tables.c
+++ cbv2/src/mainboard/intel/xe7501devkit/acpi_tables.c
@@ -94,7 +94,7 @@ unsigned long acpi_fill_madt(unsigned lo
 }
 
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -115,8 +115,10 @@ unsigned long write_acpi_tables(unsigned
 
 	/* clear all table memory */
 	memset((void *)start, 0, current - start);
-	
+
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 	
 	/*
Index: cbv2/src/mainboard/iwill/dk8_htx/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/iwill/dk8_htx/acpi_tables.c
+++ cbv2/src/mainboard/iwill/dk8_htx/acpi_tables.c
@@ -187,7 +187,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -223,8 +223,10 @@ unsigned long write_acpi_tables(unsigned
 
 	/* clear all table memory */
 	memset((void *)start, 0, current - start);
-	
+
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/*
Index: cbv2/src/mainboard/kontron/986lcd-m/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/kontron/986lcd-m/acpi_tables.c
+++ cbv2/src/mainboard/kontron/986lcd-m/acpi_tables.c
@@ -204,7 +204,7 @@ unsigned long acpi_fill_srat(unsigned lo
 
 
 #define ALIGN_CURRENT current = ((current + 0x0f) & -0x10)
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	int i;
@@ -237,6 +237,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *) start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/*
Index: cbv2/src/mainboard/technexion/tim8690/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/technexion/tim8690/acpi_tables.c
+++ cbv2/src/mainboard/technexion/tim8690/acpi_tables.c
@@ -129,7 +129,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -159,6 +159,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *)start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/*
Index: cbv2/src/mainboard/tyan/s2891/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/tyan/s2891/acpi_tables.c
+++ cbv2/src/mainboard/tyan/s2891/acpi_tables.c
@@ -81,7 +81,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -113,6 +113,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *) start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	current = ALIGN(current, 64);
Index: cbv2/src/mainboard/tyan/s2892/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/tyan/s2892/acpi_tables.c
+++ cbv2/src/mainboard/tyan/s2892/acpi_tables.c
@@ -81,7 +81,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -113,6 +113,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *) start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	current = ALIGN(current, 64);
Index: cbv2/src/mainboard/tyan/s2895/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/tyan/s2895/acpi_tables.c
+++ cbv2/src/mainboard/tyan/s2895/acpi_tables.c
@@ -92,7 +92,7 @@ unsigned long acpi_fill_ssdt_generator(u
 	return (unsigned long) (acpigen_get_current());
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -124,6 +124,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *) start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	current = ALIGN(current, 64);
Index: cbv2/src/mainboard/via/epia-m/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/via/epia-m/acpi_tables.c
+++ cbv2/src/mainboard/via/epia-m/acpi_tables.c
@@ -37,7 +37,7 @@ unsigned long acpi_fill_srat(unsigned lo
 	return current;
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -62,8 +62,10 @@ unsigned long write_acpi_tables(unsigned
 
 	/* clear all table memory */
 	memset((void *)start, 0, current - start);
-	
+
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 	
 	/*
Index: cbv2/src/mainboard/via/vt8454c/acpi_tables.c
===================================================================
--- cbv2.orig/src/mainboard/via/vt8454c/acpi_tables.c
+++ cbv2/src/mainboard/via/vt8454c/acpi_tables.c
@@ -119,7 +119,7 @@ unsigned long acpi_fill_srat(unsigned lo
 	return current;
 }
 
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long write_acpi_tables(unsigned long start, unsigned long rsdp2)
 {
 	unsigned long current;
 	acpi_rsdp_t *rsdp;
@@ -147,6 +147,8 @@ unsigned long write_acpi_tables(unsigned
 	memset((void *) start, 0, current - start);
 
 	acpi_write_rsdp(rsdp, rsdt);
+	if (rsdp2)
+		acpi_write_rsdp(ALIGN(rsdp2,16), rsdt);
 	acpi_write_rsdt(rsdt);
 
 	/*
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to