First round of ACPI fixes..

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>

Index: src/mainboard/technexion/tim5690/acpi_tables.c
===================================================================
--- src/mainboard/technexion/tim5690/acpi_tables.c	(revision 5299)
+++ src/mainboard/technexion/tim5690/acpi_tables.c	(working copy)
@@ -57,13 +57,13 @@
 }
 #endif
 
-extern const acpi_header_t AmlCode;
+extern unsigned char AmlCode[];
 
 #if CONFIG_ACPI_SSDTX_NUM >= 1
-extern const acpi_header_t AmlCode_ssdt2;
-extern const acpi_header_t AmlCode_ssdt3;
-extern const acpi_header_t AmlCode_ssdt4;
-extern const acpi_header_t AmlCode_ssdt5;
+extern unsigned char AmlCode_ssdt2[];
+extern unsigned char AmlCode_ssdt3[];
+extern unsigned char AmlCode_ssdt4[];
+extern unsigned char AmlCode_ssdt5[];
 #endif
 
 #define IO_APIC_ADDR	0xfec00000UL
@@ -219,25 +219,25 @@
 		ssdtx = (acpi_header_t *) current;
 		switch (sysconf.hcid[i]) {
 		case 1:	/* 8132 */
-			p = &AmlCode_ssdt2;
+			p = AmlCode_ssdt2;
 			break;
 		case 2:	/* 8151 */
-			p = &AmlCode_ssdt3;
+			p = AmlCode_ssdt3;
 			break;
 		case 3:	/* 8131 */
-			p = &AmlCode_ssdt4;
+			p = AmlCode_ssdt4;
 			break;
 		default:
 			/* HTX no io apic */
-			p = &AmlCode_ssdt5;
+			p = AmlCode_ssdt5;
 			break;
 		}
-		current += ((acpi_header_t *) p)->length;
-		memcpy((void *)ssdtx, (void *)p, ((acpi_header_t *) p)->length);
+		memcpy((void *)ssdtx, (void *)p, sizeof(acpi_header_t));
+		current += ssdtx->length;
+		memcpy((void *)ssdtx, (void *)p, ssdtx->length);
 		update_ssdtx((void *)ssdtx, i);
 		ssdtx->checksum = 0;
-		ssdtx->checksum =
-		    acpi_checksum((u8 *)ssdtx, ssdtx->length);
+		ssdtx->checksum = acpi_checksum((u8 *)ssdtx, ssdtx->length);
 		acpi_add_table(rsdp, ssdtx);
 	}
 #endif
@@ -251,9 +251,11 @@
 	/* DSDT */
 	printk(BIOS_DEBUG, "ACPI:    * DSDT\n");
 	dsdt = (acpi_header_t *) current;
-	memcpy((void *)dsdt, &AmlCode, AmlCode.length);
 	current += dsdt->length;
+	memcpy((void *)dsdt, (void *)AmlCode, sizeof(acpi_header_t))
 	printk(BIOS_DEBUG, "ACPI:    * DSDT @ %p Length %x\n", dsdt, dsdt->length);
+	memcpy((void *)dsdt, (void *)AmlCode, dsdt->length)
+
 	/* FADT */
 	printk(BIOS_DEBUG, "ACPI:    * FADT\n");
 	fadt = (acpi_fadt_t *) current;
Index: src/mainboard/intel/d945gclf/acpi_tables.c
===================================================================
--- src/mainboard/intel/d945gclf/acpi_tables.c	(revision 5299)
+++ src/mainboard/intel/d945gclf/acpi_tables.c	(working copy)
@@ -31,7 +31,7 @@
 
 #define OLD_ACPI 0
 
-extern const acpi_header_t AmlCode;
+extern unsigned char AmlCode[];
 #if CONFIG_HAVE_ACPI_SLIC
 unsigned long acpi_create_slic(unsigned long current);
 #endif
@@ -273,8 +273,9 @@
 	acpi_create_facs(facs);
 
 	dsdt = (acpi_header_t *) current;
-	current += AmlCode.length;
-	memcpy((void *) dsdt, &AmlCode, AmlCode.length);
+	memcpy((void *) dsdt, AmlCode, sizeof(acpi_header_t));
+	current += dsdt->length;
+	memcpy((void *) dsdt, AmlCode, dsdt->length);
 
 #if OLD_ACPI
 	for (i=0; i < dsdt->length; i++) {
Index: src/mainboard/intel/eagleheights/acpi_tables.c
===================================================================
--- src/mainboard/intel/eagleheights/acpi_tables.c	(revision 5299)
+++ src/mainboard/intel/eagleheights/acpi_tables.c	(working copy)
@@ -28,7 +28,7 @@
 #include <device/pci_ids.h>
 #include "ioapic.h"
 
-extern const acpi_header_t AmlCode;
+extern unsigned char AmlCode[];
 
 unsigned long acpi_fill_mcfg(unsigned long current)
 {
@@ -206,12 +206,12 @@
 	acpi_create_facs(facs);
 
 	dsdt = (acpi_header_t *) current;
-	current += AmlCode.length;
-	ALIGN_CURRENT;
-	memcpy((void *) dsdt, &AmlCode, AmlCode.length);
-
+	memcpy((void *) dsdt, (void *) AmlCode, sizeof(acpi_header_t));
 	printk(BIOS_DEBUG, "ACPI:     * DSDT @ %p Length %x\n", dsdt,
 		     dsdt->length);
+	memcpy((void *) dsdt, (void *) AmlCode, dsdt->length);
+	current += dsdt->length;
+	ALIGN_CURRENT;
 
 	printk(BIOS_DEBUG, "ACPI:     * FADT\n");
 	fadt = (acpi_fadt_t *) current;
Index: src/mainboard/asus/a8v-e_se/acpi_tables.c
===================================================================
--- src/mainboard/asus/a8v-e_se/acpi_tables.c	(revision 5299)
+++ src/mainboard/asus/a8v-e_se/acpi_tables.c	(working copy)
@@ -31,7 +31,7 @@
 #include <../../../southbridge/via/vt8237r/vt8237r.h>
 #include <../../../southbridge/via/k8t890/k8t890.h>
 
-extern const acpi_header_t AmlCode;
+extern unsigned char AmlCode[];
 
 unsigned long acpi_fill_mcfg(unsigned long current)
 {
@@ -118,8 +118,9 @@
 	acpi_create_facs(facs);
 
 	dsdt = (acpi_header_t *) current;
-	current += AmlCode.length;
-	memcpy((void *) dsdt, &AmlCode, AmlCode.length);
+	memcpy((void *) dsdt, (void *) AmlCode, sizeof(acpi_header_t));
+	current += dsdt->length;
+	memcpy((void *) dsdt, (void *) AmlCode, dsdt->length);
 	dsdt->checksum = 0;	/* Don't trust iasl to get this right. */
 	dsdt->checksum = acpi_checksum(dsdt, dsdt->length);
 	printk(BIOS_DEBUG, "ACPI:     * DSDT @ %p Length %x\n", dsdt,
Index: src/mainboard/asus/m2v-mx_se/acpi_tables.c
===================================================================
--- src/mainboard/asus/m2v-mx_se/acpi_tables.c	(revision 5299)
+++ src/mainboard/asus/m2v-mx_se/acpi_tables.c	(working copy)
@@ -33,7 +33,7 @@
 #include <../../../northbridge/amd/amdk8/amdk8_acpi.h>
 #include <cpu/amd/model_fxx_powernow.h>
 
-extern const acpi_header_t AmlCode;
+extern unsigned char AmlCode[];
 
 unsigned long acpi_fill_mcfg(unsigned long current)
 {
@@ -133,8 +133,9 @@
 	acpi_create_facs(facs);
 
 	dsdt = (acpi_header_t *) current;
-	current += AmlCode.length;
-	memcpy((void *) dsdt, &AmlCode, AmlCode.length);
+	memcpy((void *) dsdt, (void *) AmlCode, sizeof(acpi_header_t));
+	current += dsdt->length;
+	memcpy((void *) dsdt, (void *) AmlCode, dsdt->length);
 	dsdt->checksum = 0;	/* Don't trust iasl to get this right. */
 	dsdt->checksum = acpi_checksum(dsdt, dsdt->length);
 	printk(BIOS_DEBUG, "ACPI:     * DSDT @ %p Length %x\n", dsdt,
Index: src/northbridge/amd/amdfam10/amdfam10_acpi.c
===================================================================
--- src/northbridge/amd/amdfam10/amdfam10_acpi.c	(revision 5299)
+++ src/northbridge/amd/amdfam10/amdfam10_acpi.c	(working copy)
@@ -305,11 +305,11 @@
 	}
 }
 
-extern const acpi_header_t AmlCode_sspr5;
-extern const acpi_header_t AmlCode_sspr4;
-extern const acpi_header_t AmlCode_sspr3;
-extern const acpi_header_t AmlCode_sspr2;
-extern const acpi_header_t AmlCode_sspr1;
+extern unsigned char AmlCode_sspr5[];
+extern unsigned char AmlCode_sspr4[];
+extern unsigned char AmlCode_sspr3[];
+extern unsigned char AmlCode_sspr2[];
+extern unsigned char AmlCode_sspr1[];
 
 /* fixme: find one good way for different p_state_num */
 unsigned long acpi_add_ssdt_pstates(acpi_rsdp_t *rsdp, unsigned long current)
@@ -321,13 +321,13 @@
 
 	if(!sysconf.p_state_num) return current;
 
-	acpi_header_t *AmlCode_sspr;
+	unsigned char *AmlCode_sspr;
 	switch(sysconf.p_state_num) {
-		case 1: AmlCode_sspr = &AmlCode_sspr1; break;
-		case 2: AmlCode_sspr = &AmlCode_sspr2; break;
-		case 3: AmlCode_sspr = &AmlCode_sspr3; break;
-		case 4: AmlCode_sspr = &AmlCode_sspr4; break;
-		default: AmlCode_sspr = &AmlCode_sspr5; break;
+		case 1: AmlCode_sspr = AmlCode_sspr1; break;
+		case 2: AmlCode_sspr = AmlCode_sspr2; break;
+		case 3: AmlCode_sspr = AmlCode_sspr3; break;
+		case 4: AmlCode_sspr = AmlCode_sspr4; break;
+		default: AmlCode_sspr = AmlCode_sspr5; break;
 	}
 
 	for(cpu = all_devices; cpu; cpu = cpu->next) {
@@ -342,8 +342,9 @@
 
 		current	  = ( current + 0x0f) & -0x10;
 		ssdt = (acpi_header_t *)current;
-		current += AmlCode_sspr->length;
-		memcpy((void *)ssdt, AmlCode_sspr, AmlCode_sspr->length);
+		memcpy((void *)ssdt, (void *)AmlCode_sspr, sizeof(acpi_header_t));
+		current += ssdt->length;
+		memcpy((void *)ssdt, (void *)AmlCode_sspr, ssdt->length);
 		update_sspr((void*)ssdt,cpu->path.apic.node_id, cpu_index);
 		/* recalculate checksum */
 		ssdt->checksum = 0;
