summaryrefslogtreecommitdiff
path: root/src/mainboard/amd/serengeti_cheetah
diff options
context:
space:
mode:
authorMyles Watson <mylesgw@gmail.com>2010-03-26 18:31:12 +0000
committerMyles Watson <mylesgw@gmail.com>2010-03-26 18:31:12 +0000
commit9417cc05fcd485fe699f88a73356c59c1c5181e0 (patch)
treefc09a21bacfdc093c6b49b4c62074a0dd8f6fad0 /src/mainboard/amd/serengeti_cheetah
parent723c2702116af499389a9a73ff8df35fee37ee64 (diff)
Remove dead code and make white space more consistent for acpi_tables.c
Signed-off-by: Myles Watson <mylesgw@gmail.com> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5303 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/mainboard/amd/serengeti_cheetah')
-rw-r--r--src/mainboard/amd/serengeti_cheetah/acpi_tables.c327
1 files changed, 161 insertions, 166 deletions
diff --git a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
index 81e8a82936..87382c4e32 100644
--- a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
+++ b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
@@ -23,19 +23,19 @@
#define DUMP_ACPI_TABLES 0
#if DUMP_ACPI_TABLES == 1
-static void dump_mem(unsigned start, unsigned end)
+static void dump_mem(u32 start, u32 end)
{
-
- unsigned i;
- print_debug("dump_mem:");
- for(i=start;i<end;i++) {
- if((i & 0xf)==0) {
- printk(BIOS_DEBUG, "\n%08x:", i);
- }
- printk(BIOS_DEBUG, " %02x", (unsigned char)*((unsigned char *)i));
- }
- print_debug("\n");
- }
+
+ u32 i;
+ print_debug("dump_mem:");
+ for(i=start;i<end;i++) {
+ if((i & 0xf)==0) {
+ printk(BIOS_DEBUG, "\n%08x:", i);
+ }
+ printk(BIOS_DEBUG, " %02x", (unsigned char)*((unsigned char *)i));
+ }
+ print_debug("\n");
+}
#endif
extern const acpi_header_t AmlCode;
@@ -55,102 +55,98 @@ unsigned long acpi_fill_mcfg(unsigned long current)
unsigned long acpi_fill_madt(unsigned long current)
{
- unsigned int gsi_base=0x18;
+ u32 gsi_base=0x18;
- struct mb_sysconf_t *m;
+ struct mb_sysconf_t *m;
+
+ m = sysconf.mb;
- m = sysconf.mb;
-
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
-
+
/* Write 8111 IOAPIC */
current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8111,
IO_APIC_ADDR, 0);
- /* Write all 8131 IOAPICs */
- {
- device_t dev;
- struct resource *res;
- dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN((sysconf.hcdn[0]&0xff), 1));
- if (dev) {
- res = find_resource(dev, PCI_BASE_ADDRESS_0);
- if (res) {
- current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132_1,
- res->base, gsi_base );
+ /* Write all 8131 IOAPICs */
+ {
+ device_t dev;
+ struct resource *res;
+ dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN((sysconf.hcdn[0]&0xff), 1));
+ if (dev) {
+ res = find_resource(dev, PCI_BASE_ADDRESS_0);
+ if (res) {
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132_1,
+ res->base, gsi_base );
gsi_base+=7;
- }
- }
- dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN((sysconf.hcdn[0] & 0xff)+1, 1));
- if (dev) {
- res = find_resource(dev, PCI_BASE_ADDRESS_0);
- if (res) {
- current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132_2,
- res->base, gsi_base );
- gsi_base+=7;
- }
- }
-
- int i;
- int j = 0;
-
- for(i=1; i< sysconf.hc_possible_num; i++) {
- unsigned d;
- if(!(sysconf.pci1234[i] & 0x1) ) continue;
- // 8131 need to use +4
-
- switch (sysconf.hcid[i]) {
- case 1:
+ }
+ }
+ dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN((sysconf.hcdn[0] & 0xff)+1, 1));
+ if (dev) {
+ res = find_resource(dev, PCI_BASE_ADDRESS_0);
+ if (res) {
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132_2,
+ res->base, gsi_base );
+ gsi_base+=7;
+ }
+ }
+
+ int i;
+ int j = 0;
+
+ for(i=1; i< sysconf.hc_possible_num; i++) {
+ u32 d = 0;
+ if(!(sysconf.pci1234[i] & 0x1) ) continue;
+ // 8131 need to use +4
+ switch (sysconf.hcid[i]) {
+ case 1:
d = 7;
break;
case 3:
d = 4;
break;
}
- switch (sysconf.hcid[i]) {
- case 1:
+ switch (sysconf.hcid[i]) {
+ case 1:
case 3:
- dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j], 1));
- if (dev) {
- res = find_resource(dev, PCI_BASE_ADDRESS_0);
- if (res) {
- current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132a[j][0],
- res->base, gsi_base );
- gsi_base+=d;
- }
- }
- dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j]+1, 1));
- if (dev) {
- res = find_resource(dev, PCI_BASE_ADDRESS_0);
- if (res) {
- current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132a[j][1],
- res->base, gsi_base );
- gsi_base+=d;
-
- }
- }
- break;
- }
-
- j++;
- }
-
- }
+ dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j], 1));
+ if (dev) {
+ res = find_resource(dev, PCI_BASE_ADDRESS_0);
+ if (res) {
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132a[j][0],
+ res->base, gsi_base );
+ gsi_base+=d;
+ }
+ }
+ dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j]+1, 1));
+ if (dev) {
+ res = find_resource(dev, PCI_BASE_ADDRESS_0);
+ if (res) {
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132a[j][1],
+ res->base, gsi_base );
+ gsi_base+=d;
+
+ }
+ }
+ break;
+ }
+ j++;
+ }
+ }
current += acpi_create_madt_irqoverride( (acpi_madt_irqoverride_t *)
current, 0, 0, 2, 5 );
/* 0: mean bus 0--->ISA */
/* 0: PIC 0 */
- /* 2: APIC 2 */
+ /* 2: APIC 2 */
/* 5 mean: 0101 --> Edige-triggered, Active high*/
- /* create all subtables for processors */
- current = acpi_create_madt_lapic_nmis(current, 5, 1);
+ /* create all subtables for processors */
+ current = acpi_create_madt_lapic_nmis(current, 5, 1);
/* 1: LINT1 connect to NMI */
-
return current;
}
@@ -158,24 +154,24 @@ extern void get_bus_conf(void);
static void update_ssdtx(void *ssdtx, int i)
{
- uint8_t *PCI;
- uint8_t *HCIN;
- uint8_t *UID;
+ u8 *PCI;
+ u8 *HCIN;
+ u8 *UID;
- PCI = ssdtx + 0x32;
- HCIN = ssdtx + 0x39;
- UID = ssdtx + 0x40;
+ PCI = ssdtx + 0x32;
+ HCIN = ssdtx + 0x39;
+ UID = ssdtx + 0x40;
- if(i<7) {
- *PCI = (uint8_t) ('4' + i - 1);
- }
- else {
- *PCI = (uint8_t) ('A' + i - 1 - 6);
- }
- *HCIN = (uint8_t) i;
- *UID = (uint8_t) (i+3);
+ if(i<7) {
+ *PCI = (u8) ('4' + i - 1);
+ }
+ else {
+ *PCI = (u8) ('A' + i - 1 - 6);
+ }
+ *HCIN = (u8) i;
+ *UID = (u8) (i+3);
- /* FIXME: need to update the GSI id in the ssdtx too */
+ /* FIXME: need to update the GSI id in the ssdtx too */
}
@@ -204,10 +200,10 @@ unsigned long write_acpi_tables(unsigned long start)
get_bus_conf(); //it will get sblk, pci1234, hcdn, and sbdn
- /* Align ACPI tables to 16byte */
- start = ( start + 0x0f ) & -0x10;
+ /* Align ACPI tables to 16 bytes */
+ start = ( start + 0x0f) & -0x10;
current = start;
-
+
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
@@ -218,43 +214,42 @@ unsigned long write_acpi_tables(unsigned long start)
/* clear all table memory */
memset((void *)start, 0, current - start);
-
+
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/*
* We explicitly add these tables later on:
*/
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
+ printk(BIOS_DEBUG, "ACPI: * HPET at %lx\n", current);
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
- acpi_add_table(rsdp,hpet);
+ acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
+ printk(BIOS_DEBUG, "ACPI: * MADT at %lx\n", current);
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current+=madt->header.length;
- acpi_add_table(rsdp,madt);
-
+ acpi_add_table(rsdp, madt);
/* SRAT */
- printk(BIOS_DEBUG, "ACPI: * SRAT\n");
- srat = (acpi_srat_t *) current;
- acpi_create_srat(srat);
- current+=srat->header.length;
- acpi_add_table(rsdp,srat);
+ printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current);
+ srat = (acpi_srat_t *) current;
+ acpi_create_srat(srat);
+ current+=srat->header.length;
+ acpi_add_table(rsdp, srat);
/* SLIT */
- printk(BIOS_DEBUG, "ACPI: * SLIT\n");
- slit = (acpi_slit_t *) current;
- acpi_create_slit(slit);
- current+=slit->header.length;
- acpi_add_table(rsdp,slit);
+ printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current);
+ slit = (acpi_slit_t *) current;
+ acpi_create_slit(slit);
+ current+=slit->header.length;
+ acpi_add_table(rsdp, slit);
/* SSDT */
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
+ printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, "DYNADATA");
@@ -263,40 +258,40 @@ unsigned long write_acpi_tables(unsigned long start)
#if CONFIG_ACPI_SSDTX_NUM >= 1
- //same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table
-
- for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink
- if((sysconf.pci1234[i] & 1) != 1 ) continue;
- uint8_t c;
- if(i<7) {
- c = (uint8_t) ('4' + i - 1);
- }
- else {
- c = (uint8_t) ('A' + i - 1 - 6);
- }
- printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); //pci0 and pci1 are in dsdt
- current = ( current + 0x07) & -0x08;
- ssdtx = (acpi_header_t *)current;
- switch(sysconf.hcid[i]) {
- case 1: //8132
- p = &AmlCode_ssdt2;
- break;
- case 2: //8151
- p = &AmlCode_ssdt3;
- break;
+ //same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table
+
+ for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink
+ if((sysconf.pci1234[i] & 1) != 1 ) continue;
+ u8 c;
+ if(i<7) {
+ c = (u8) ('4' + i - 1);
+ }
+ else {
+ c = (u8) ('A' + i - 1 - 6);
+ }
+ current = ( current + 0x07) & -0x08;
+ printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); //pci0 and pci1 are in dsdt
+ ssdtx = (acpi_header_t *)current;
+ switch(sysconf.hcid[i]) {
+ case 1: //8132
+ p = &AmlCode_ssdt2;
+ break;
+ case 2: //8151
+ p = &AmlCode_ssdt3;
+ break;
case 3: //8131
- p = &AmlCode_ssdt4;
- break;
- default:
- continue;
- }
- current += ((acpi_header_t *)p)->length;
- memcpy((void *)ssdtx, (void *)p, ((acpi_header_t *)p)->length);
- update_ssdtx((void *)ssdtx, i);
- ssdtx->checksum = 0;
- ssdtx->checksum = acpi_checksum((unsigned char *)ssdtx,ssdtx->length);
- acpi_add_table(rsdp,ssdtx);
- }
+ p = &AmlCode_ssdt4;
+ break;
+ default:
+ continue;
+ }
+ current += p->length;
+ memcpy((void *)ssdtx, (void *)p, ((acpi_header_t *)p)->length);
+ update_ssdtx((void *)ssdtx, i);
+ ssdtx->checksum = 0;
+ ssdtx->checksum = acpi_checksum((u8 *)ssdtx, ssdtx->length);
+ acpi_add_table(rsdp, ssdtx);
+ }
#endif
/* FACS */
@@ -306,41 +301,41 @@ unsigned long write_acpi_tables(unsigned long start)
acpi_create_facs(facs);
/* DSDT */
- printk(BIOS_DEBUG, "ACPI: * DSDT\n");
+ printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
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);
+ printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FDAT */
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
+ printk(BIOS_DEBUG, "ACPI: * FADT at %lx\n", current);
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
- acpi_create_fadt(fadt,facs,dsdt);
- acpi_add_table(rsdp,fadt);
+ acpi_create_fadt(fadt, facs, dsdt);
+ acpi_add_table(rsdp, fadt);
#if DUMP_ACPI_TABLES == 1
printk(BIOS_DEBUG, "rsdp\n");
dump_mem(rsdp, ((void *)rsdp) + sizeof(acpi_rsdp_t));
- printk(BIOS_DEBUG, "rsdt\n");
- dump_mem(rsdt, ((void *)rsdt) + sizeof(acpi_rsdt_t));
+ printk(BIOS_DEBUG, "rsdt\n");
+ dump_mem(rsdt, ((void *)rsdt) + sizeof(acpi_rsdt_t));
- printk(BIOS_DEBUG, "madt\n");
- dump_mem(madt, ((void *)madt) + madt->header.length);
+ printk(BIOS_DEBUG, "madt\n");
+ dump_mem(madt, ((void *)madt) + madt->header.length);
- printk(BIOS_DEBUG, "srat\n");
- dump_mem(srat, ((void *)srat) + srat->header.length);
+ printk(BIOS_DEBUG, "srat\n");
+ dump_mem(srat, ((void *)srat) + srat->header.length);
- printk(BIOS_DEBUG, "slit\n");
- dump_mem(slit, ((void *)slit) + slit->header.length);
+ printk(BIOS_DEBUG, "slit\n");
+ dump_mem(slit, ((void *)slit) + slit->header.length);
- printk(BIOS_DEBUG, "ssdt\n");
- dump_mem(ssdt, ((void *)ssdt) + ssdt->length);
+ printk(BIOS_DEBUG, "ssdt\n");
+ dump_mem(ssdt, ((void *)ssdt) + ssdt->length);
- printk(BIOS_DEBUG, "fadt\n");
- dump_mem(fadt, ((void *)fadt) + fadt->header.length);
+ printk(BIOS_DEBUG, "fadt\n");
+ dump_mem(fadt, ((void *)fadt) + fadt->header.length);
#endif
printk(BIOS_INFO, "ACPI: done.\n");