summaryrefslogtreecommitdiff
path: root/src/mainboard/amd
diff options
context:
space:
mode:
authorMyles Watson <mylesgw@gmail.com>2010-03-24 22:02:53 +0000
committerMyles Watson <mylesgw@gmail.com>2010-03-24 22:02:53 +0000
commit565a281f3696bf6252fe3153f4b680db85fe7906 (patch)
treef9ae61466b69b7a06bbe9938e97af2e82dbb5337 /src/mainboard/amd
parentd1149d7ef13ba63baac89dfe687bdd01e93f79ca (diff)
downloadcoreboot-565a281f3696bf6252fe3153f4b680db85fe7906.tar.xz
Get rid of type-punned pointer errors.
Defining AmlCode differently in different source files is a bit ugly... Creating a void * to do the casting is not exactly beautiful either... Signed-off-by: Myles Watson <mylesgw@gmail.com> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5286 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/mainboard/amd')
-rw-r--r--src/mainboard/amd/dbm690t/acpi_tables.c32
-rw-r--r--src/mainboard/amd/mahogany/acpi_tables.c28
-rw-r--r--src/mainboard/amd/mahogany_fam10/acpi_tables.c33
-rw-r--r--src/mainboard/amd/pistachio/acpi_tables.c21
-rw-r--r--src/mainboard/amd/serengeti_cheetah/acpi_tables.c21
-rw-r--r--src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c45
6 files changed, 86 insertions, 94 deletions
diff --git a/src/mainboard/amd/dbm690t/acpi_tables.c b/src/mainboard/amd/dbm690t/acpi_tables.c
index b77a3bd507..18d3ec2afc 100644
--- a/src/mainboard/amd/dbm690t/acpi_tables.c
+++ b/src/mainboard/amd/dbm690t/acpi_tables.c
@@ -57,13 +57,13 @@ static void dump_mem(u32 start, u32 end)
}
#endif
-extern u8 AmlCode[];
+extern const acpi_header_t AmlCode;
#if CONFIG_ACPI_SSDTX_NUM >= 1
-extern u8 AmlCode_ssdt2[];
-extern u8 AmlCode_ssdt3[];
-extern u8 AmlCode_ssdt4[];
-extern u8 AmlCode_ssdt5[];
+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;
#endif
#define IO_APIC_ADDR 0xfec00000UL
@@ -219,25 +219,24 @@ unsigned long write_acpi_tables(unsigned long start)
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);
+ current += p->length;
+ memcpy((void *)ssdtx, p, p->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
@@ -250,10 +249,9 @@ unsigned long write_acpi_tables(unsigned long start)
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
- dsdt = (acpi_header_t *) current;
- memcpy((void *)dsdt, (void *)AmlCode,
- ((acpi_header_t *) AmlCode)->length);
- current += dsdt->length;
+ dsdt = (acpi_header_t *)current;
+ current += AmlCode.length;
+ memcpy((void *)dsdt, &AmlCode, AmlCode.length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
diff --git a/src/mainboard/amd/mahogany/acpi_tables.c b/src/mainboard/amd/mahogany/acpi_tables.c
index 41bf454810..248c0f888e 100644
--- a/src/mainboard/amd/mahogany/acpi_tables.c
+++ b/src/mainboard/amd/mahogany/acpi_tables.c
@@ -57,13 +57,13 @@ static void dump_mem(u32 start, u32 end)
}
#endif
-extern u8 AmlCode[];
+extern const acpi_header_t AmlCode;
#if CONFIG_ACPI_SSDTX_NUM >= 1
-extern u8 AmlCode_ssdt2[];
-extern u8 AmlCode_ssdt3[];
-extern u8 AmlCode_ssdt4[];
-extern u8 AmlCode_ssdt5[];
+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;
#endif
#define IO_APIC_ADDR 0xfec00000UL
@@ -219,25 +219,24 @@ unsigned long write_acpi_tables(unsigned long start)
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);
+ current += p->length;
+ memcpy((void *)ssdtx, p, p->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,8 +250,7 @@ unsigned long write_acpi_tables(unsigned long start)
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
- memcpy((void *)dsdt, (void *)AmlCode,
- ((acpi_header_t *) AmlCode)->length);
+ memcpy((void *)dsdt, &AmlCode, AmlCode.length);
current += dsdt->length;
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
diff --git a/src/mainboard/amd/mahogany_fam10/acpi_tables.c b/src/mainboard/amd/mahogany_fam10/acpi_tables.c
index 3a39165473..878141da54 100644
--- a/src/mainboard/amd/mahogany_fam10/acpi_tables.c
+++ b/src/mainboard/amd/mahogany_fam10/acpi_tables.c
@@ -46,14 +46,14 @@ static void dump_mem(u32 start, u32 end)
}
#endif
-extern u8 AmlCode[];
-extern u8 AmlCode_ssdt[];
+extern const acpi_header_t AmlCode;
+extern const acpi_header_t AmlCode_ssdt;
#if CONFIG_ACPI_SSDTX_NUM >= 1
-extern u8 AmlCode_ssdt2[];
-extern u8 AmlCode_ssdt3[];
-extern u8 AmlCode_ssdt4[];
-extern u8 AmlCode_ssdt5[];
+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;
#endif
#define IO_APIC_ADDR 0xfec00000UL
@@ -130,7 +130,7 @@ unsigned long write_acpi_tables(unsigned long start)
acpi_header_t *dsdt;
acpi_header_t *ssdt;
acpi_header_t *ssdtx;
- u8 *p;
+ acpi_header_t const *p;
int i;
@@ -192,8 +192,8 @@ unsigned long write_acpi_tables(unsigned long start)
current = ( current + 0x0f) & -0x10;
printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
ssdt = (acpi_header_t *)current;
- current += ((acpi_header_t *)AmlCode_ssdt)->length;
- memcpy((void *)ssdt, (void *)AmlCode_ssdt, ((acpi_header_t *)AmlCode_ssdt)->length);
+ current += AmlCode_ssdt.length;
+ memcpy((void *)ssdt, &AmlCode_ssdt, AmlCode_ssdt.length);
//Here you need to set value in pci1234, sblk and sbdn in get_bus_conf.c
update_ssdt((void*)ssdt);
/* recalculate checksum */
@@ -223,20 +223,20 @@ unsigned long write_acpi_tables(unsigned long start)
ssdtx = (acpi_header_t *)current;
switch(sysconf.hcid[i]) {
case 1:
- p = AmlCode_ssdt2;
+ p = &AmlCode_ssdt2;
break;
case 2:
- 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;
}
current += ((acpi_header_t *)p)->length;
- memcpy((void *)ssdtx, (void *)p, ((acpi_header_t *)p)->length);
+ memcpy((void *)ssdtx, p, p->length);
update_ssdtx((void *)ssdtx, i);
ssdtx->checksum = 0;
ssdtx->checksum = acpi_checksum((unsigned char *)ssdtx,ssdtx->length);
@@ -248,9 +248,8 @@ unsigned long write_acpi_tables(unsigned long start)
current = ( current + 0x07) & -0x08;
printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
dsdt = (acpi_header_t *)current; // it will used by fadt
- current += ((acpi_header_t *)AmlCode)->length;
- memcpy((void *)dsdt,(void *)AmlCode, \
- ((acpi_header_t *)AmlCode)->length);
+ current += AmlCode.length;
+ memcpy((void *)dsdt, &AmlCode, AmlCode.length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
/* FACS */ // it needs 64 bit alignment
diff --git a/src/mainboard/amd/pistachio/acpi_tables.c b/src/mainboard/amd/pistachio/acpi_tables.c
index f37c89b739..dbd4f8f940 100644
--- a/src/mainboard/amd/pistachio/acpi_tables.c
+++ b/src/mainboard/amd/pistachio/acpi_tables.c
@@ -57,13 +57,13 @@ static void dump_mem(u32 start, u32 end)
}
#endif
-extern u8 AmlCode[];
+extern const acpi_header_t AmlCode;
#if CONFIG_ACPI_SSDTX_NUM >= 1
-extern u8 AmlCode_ssdt2[];
-extern u8 AmlCode_ssdt3[];
-extern u8 AmlCode_ssdt4[];
-extern u8 AmlCode_ssdt5[];
+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;
#endif
#define IO_APIC_ADDR 0xfec00000UL
@@ -219,17 +219,17 @@ unsigned long write_acpi_tables(unsigned long start)
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;
@@ -251,8 +251,7 @@ unsigned long write_acpi_tables(unsigned long start)
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
- memcpy((void *)dsdt, (void *)AmlCode,
- ((acpi_header_t *) AmlCode)->length);
+ memcpy((void *)dsdt, &AmlCode, AmlCode.length);
current += dsdt->length;
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
diff --git a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
index 15db99bed6..81e8a82936 100644
--- a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
+++ b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
@@ -38,11 +38,11 @@ static void dump_mem(unsigned start, unsigned end)
}
#endif
-extern unsigned char AmlCode[];
+extern const acpi_header_t AmlCode;
#if CONFIG_ACPI_SSDTX_NUM >= 1
-extern unsigned char AmlCode_ssdt2[];
-extern unsigned char AmlCode_ssdt3[];
-extern unsigned char AmlCode_ssdt4[];
+extern const acpi_header_t AmlCode_ssdt2;
+extern const acpi_header_t AmlCode_ssdt3;
+extern const acpi_header_t AmlCode_ssdt4;
#endif
#define IO_APIC_ADDR 0xfec00000UL
@@ -198,7 +198,7 @@ unsigned long write_acpi_tables(unsigned long start)
acpi_header_t *dsdt;
acpi_header_t *ssdt;
acpi_header_t *ssdtx;
- unsigned char *p;
+ acpi_header_t const *p;
int i;
@@ -279,13 +279,13 @@ unsigned long write_acpi_tables(unsigned long start)
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:
continue;
@@ -308,9 +308,8 @@ unsigned long write_acpi_tables(unsigned long start)
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *)current;
- current += ((acpi_header_t *)AmlCode)->length;
- memcpy((void *)dsdt,(void *)AmlCode, \
- ((acpi_header_t *)AmlCode)->length);
+ current += AmlCode.length;
+ memcpy((void *)dsdt, &AmlCode, AmlCode.length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
/* FDAT */
diff --git a/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c b/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
index d3a274eca6..b5139a7292 100644
--- a/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
+++ b/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
@@ -46,14 +46,14 @@ static void dump_mem(u32 start, u32 end)
}
#endif
-extern u8 AmlCode[];
-extern u8 AmlCode_ssdt[];
+extern const acpi_header_t AmlCode;
+extern const acpi_header_t AmlCode_ssdt;
#if CONFIG_ACPI_SSDTX_NUM >= 1
-extern u8 AmlCode_ssdt2[];
-extern u8 AmlCode_ssdt3[];
-extern u8 AmlCode_ssdt4[];
-extern u8 AmlCode_ssdt5[];
+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;
#endif
#define IO_APIC_ADDR 0xfec00000UL
@@ -202,7 +202,7 @@ unsigned long write_acpi_tables(unsigned long start)
acpi_header_t *dsdt;
acpi_header_t *ssdt;
acpi_header_t *ssdtx;
- u8 *p;
+ acpi_header_t const *p;
int i;
@@ -264,8 +264,8 @@ unsigned long write_acpi_tables(unsigned long start)
current = ( current + 0x0f) & -0x10;
printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
ssdt = (acpi_header_t *)current;
- current += ((acpi_header_t *)AmlCode_ssdt)->length;
- memcpy((void *)ssdt, (void *)AmlCode_ssdt, ((acpi_header_t *)AmlCode_ssdt)->length);
+ current += AmlCode_ssdt.length;
+ memcpy((void *)ssdt, &AmlCode_ssdt, AmlCode_ssdt.length);
//Here you need to set value in pci1234, sblk and sbdn in get_bus_conf.c
update_ssdt((void*)ssdt);
/* recalculate checksum */
@@ -295,24 +295,24 @@ unsigned long write_acpi_tables(unsigned long start)
ssdtx = (acpi_header_t *)current;
switch(sysconf.hcid[i]) {
case 1:
- p = AmlCode_ssdt2;
+ p = &AmlCode_ssdt2;
break;
case 2:
- p = AmlCode_ssdt3;
+ p = &AmlCode_ssdt3;
break;
case 3: //8131
- p = AmlCode_ssdt4;
- break;
- default:
+ p = &AmlCode_ssdt4;
+ break;
+ default:
//HTX no io apic
- p = AmlCode_ssdt5;
+ p = &AmlCode_ssdt5;
}
- current += ((acpi_header_t *)p)->length;
- memcpy((void *)ssdtx, (void *)p, ((acpi_header_t *)p)->length);
+ current += p->length;
+ memcpy((void *)ssdtx, p, p->length);
update_ssdtx((void *)ssdtx, i);
ssdtx->checksum = 0;
- ssdtx->checksum = acpi_checksum((unsigned char *)ssdtx,ssdtx->length);
- acpi_add_table(rsdp,ssdtx);
+ ssdtx->checksum = acpi_checksum((u8 *)ssdtx, ssdtx->length);
+ acpi_add_table(rsdp, ssdtx);
}
#endif
@@ -320,10 +320,9 @@ unsigned long write_acpi_tables(unsigned long start)
current = ( current + 0x07) & -0x08;
printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
dsdt = (acpi_header_t *)current; // it will used by fadt
- current += ((acpi_header_t *)AmlCode)->length;
- memcpy((void *)dsdt,(void *)AmlCode, \
- ((acpi_header_t *)AmlCode)->length);
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
+ current += AmlCode.length;
+ memcpy((void *)dsdt, &AmlCode, AmlCode.length);
+ printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FACS */ // it needs 64 bit alignment
current = ( current + 0x07) & -0x08;