diff options
Diffstat (limited to 'src/mainboard/via/epia-m700/acpi_tables.c')
-rw-r--r-- | src/mainboard/via/epia-m700/acpi_tables.c | 117 |
1 files changed, 59 insertions, 58 deletions
diff --git a/src/mainboard/via/epia-m700/acpi_tables.c b/src/mainboard/via/epia-m700/acpi_tables.c index cb85be2805..54480cdff5 100644 --- a/src/mainboard/via/epia-m700/acpi_tables.c +++ b/src/mainboard/via/epia-m700/acpi_tables.c @@ -3,7 +3,7 @@ * * LinuxBIOS ACPI Table support * written by Stefan Reinauer <stepan@openbios.org> - * ACPI FADT, FACS, and DSDT table support added by + * ACPI FADT, FACS, and DSDT table support added by * Nick Barker <nick.barker9@btinternet.com>, and those portions * (C) Copyright 2004 Nick Barker * (C) Copyright 2005 Stefan Reinauer @@ -24,8 +24,8 @@ */ /* - * most parts of this file copied from src\mainboard\asus\a8v-e_se\acpi_tables.c, - * acpi_is_wakeup() is from Rudolf's S3 patch and SSDT was added + * Most parts of this file copied from asus\a8v-e_se\acpi_tables.c, + * acpi_is_wakeup() is from Rudolf's S3 patch and SSDT was added. */ #include <console/console.h> @@ -38,20 +38,24 @@ extern unsigned char AmlCode_dsdt[]; extern unsigned char AmlCode_ssdt[]; +extern u32 wake_vec; +extern u8 acpi_sleep_type; + /* -These four macro copied from #include <arch/smp/mpspec.h>, I have to do this since "default HAVE_MP_TABLE = 0" in option.lb, -and also since mainboard/via/*.* have no Mptable.c(so that I can not set HAVE_MP_TABLE = 1) as many other mainboard. -So I have to copy these four to here. acpi_fill_madt() need this. -*/ + * These four macros are copied from <arch/smp/mpspec.h>, I have to do this + * since the "default HAVE_MP_TABLE = 0" in Options.lb, and also since + * mainboard/via/... have no mptable.c (so that I can not set + * HAVE_MP_TABLE = 1) as many other mainboards. + * So I have to copy these four to here. acpi_fill_madt() needs this. + */ #define MP_IRQ_POLARITY_HIGH 0x1 #define MP_IRQ_POLARITY_LOW 0x3 #define MP_IRQ_TRIGGER_EDGE 0x4 #define MP_IRQ_TRIGGER_LEVEL 0xc - unsigned long acpi_fill_mcfg(unsigned long current) { - /* NO MCFG in VX855, no pci-e*/ + /* NO MCFG in VX855, no PCI-E. */ return current; } @@ -60,34 +64,35 @@ unsigned long acpi_create_madt_lapics(unsigned long current) device_t cpu; int cpu_index = 0; - for(cpu = all_devices; cpu; cpu = cpu->next) { + for (cpu = all_devices; cpu; cpu = cpu->next) { if ((cpu->path.type != DEVICE_PATH_APIC) || - (cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER)) { + (cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER)) { continue; } - if (!cpu->enabled) { + if (!cpu->enabled) continue; - } - current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, cpu_index, cpu->path.apic.apic_id); + current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, + cpu_index, cpu->path.apic.apic_id); cpu_index++; } return current; } -unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags, u8 lint) +unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags, + u8 lint) { device_t cpu; int cpu_index = 0; - for(cpu = all_devices; cpu; cpu = cpu->next) { + for (cpu = all_devices; cpu; cpu = cpu->next) { if ((cpu->path.type != DEVICE_PATH_APIC) || - (cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER)) { + (cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER)) { continue; } - if (!cpu->enabled) { + if (!cpu->enabled) continue; - } - current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current, cpu_index, flags, lint); + current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *) + current, cpu_index, flags, lint); cpu_index++; } return current; @@ -102,11 +107,11 @@ unsigned long acpi_fill_madt(unsigned long current) /* Write SB IOAPIC. */ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, - VX800SB_APIC_ID, VX800SB_APIC_BASE, 0); + VX800SB_APIC_ID, VX800SB_APIC_BASE, 0); /* IRQ0 -> APIC IRQ2. */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 0, 2, 0x0); + current, 0, 0, 2, 0x0); /* IRQ9 ACPI active low. */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) @@ -114,20 +119,20 @@ unsigned long acpi_fill_madt(unsigned long current) /* Create all subtables for processors. */ current = acpi_create_madt_lapic_nmis(current, - MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1); + MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1); return current; } -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; +unsigned long acpi_fill_slit(unsigned long current) +{ + /* Not implemented. */ + return current; } - + unsigned long acpi_fill_srat(unsigned long current) { - /* No NUMA, no SRAT */ + /* No NUMA, no SRAT. */ } #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) @@ -144,30 +149,27 @@ unsigned long write_acpi_tables(unsigned long start) acpi_madt_t *madt; acpi_fadt_t *fadt; acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; - - /* Align ACPI tables to 16byte */ - start = ( start + 0x0f ) & -0x10; + acpi_header_t *dsdt, *ssdt; + + /* Align ACPI tables to 16 byte. */ + start = (start + 0x0f) & -0x10; current = start; - + printk_info("ACPI: Writing ACPI tables at %lx...\n", start); - /* We need at least an RSDP and an RSDT Table */ + /* We need at least an RSDP and an RSDT table. */ rsdp = (acpi_rsdp_t *) current; current += sizeof(acpi_rsdp_t); rsdt = (acpi_rsdt_t *) current; current += sizeof(acpi_rsdt_t); - /* clear all table memory */ + /* Clear all table memory. */ memset((void *)start, 0, current - start); - + acpi_write_rsdp(rsdp, rsdt); acpi_write_rsdt(rsdt); - - /* - * We explicitly add these tables later on: - */ + + /* We explicitly add these tables later on: */ printk_debug("ACPI: * FACS\n"); current = ALIGN(current, 64); facs = (acpi_facs_t *) current; @@ -176,18 +178,19 @@ unsigned long write_acpi_tables(unsigned long start) printk_debug("ACPI: * DSDT\n"); dsdt = (acpi_header_t *) current; - current += ((acpi_header_t *)AmlCode_dsdt)->length; - memcpy((void *)dsdt,(void *)AmlCode_dsdt, ((acpi_header_t *)AmlCode_dsdt)->length); - dsdt->checksum = 0; /* don't trust intel iasl compiler to get this right. */ + current += ((acpi_header_t *) AmlCode_dsdt)->length; + memcpy((void *)dsdt, (void *)AmlCode_dsdt, + ((acpi_header_t *) AmlCode_dsdt)->length); + dsdt->checksum = 0; /* Don't trust iasl to get this right. */ dsdt->checksum = acpi_checksum(dsdt, dsdt->length); printk_debug("ACPI: * DSDT @ %08x Length %x\n", dsdt, dsdt->length); - + printk_debug("ACPI: * FADT\n"); fadt = (acpi_fadt_t *) current; current += sizeof(acpi_fadt_t); - acpi_create_fadt(fadt,facs,dsdt); - acpi_add_table(rsdt,fadt); + acpi_create_fadt(fadt, facs, dsdt); + acpi_add_table(rsdt, fadt); /* If we want to use HPET timers Linux wants it in MADT. */ printk_debug("ACPI: * MADT\n"); @@ -195,33 +198,31 @@ unsigned long write_acpi_tables(unsigned long start) acpi_create_madt(madt); current += madt->header.length; acpi_add_table(rsdt, madt); - - /* NO MCFG in VX855, no pci-e*/ + + /* NO MCFG in VX855, no PCI-E. */ printk_debug("ACPI: * HPET\n"); hpet = (acpi_mcfg_t *) current; acpi_create_hpet(hpet); current += hpet->header.length; acpi_add_table(rsdt, hpet); -/* + +#if 0 printk_debug("ACPI: * SSDT\n"); ssdt = (acpi_header_t *) current; current += ((acpi_header_t *)AmlCode_ssdt)->length; memcpy((void *)ssdt,(void *)AmlCode_ssdt, ((acpi_header_t *)AmlCode_ssdt)->length); - ssdt->checksum = 0; // don't trust intel iasl compiler to get this right + ssdt->checksum = 0; /* Don't trust iasl to get this right. */ ssdt->checksum = acpi_checksum(ssdt, ssdt->length); acpi_add_table(rsdt, ssdt); printk_debug("ACPI: * SSDT @ %08x Length %x\n", ssdt, ssdt->length); -*/ +#endif printk_info("ACPI: done.\n"); return current; } -extern u32 wake_vec; -extern u8 acpi_sleep_type; - -int acpi_is_wakeup(void) { +int acpi_is_wakeup(void) +{ return (acpi_sleep_type == 3); } - |