Fix/drop some obsolete comments,
[coreboot.git] / src / mainboard / via / epia-m700 / acpi_tables.c
index 709af4b65e16424ce8a278dda8d95f884820559b..16c0b46b43c1de72d8453fe7e4e06aafc775431a 100644 (file)
 #include <arch/acpi.h>
 #include <device/device.h>
 #include <device/pci_ids.h>
-#include <../../../northbridge/via/vx800/vx800.h>
+#include "northbridge/via/vx800/vx800.h"
 
-extern unsigned char AmlCode_dsdt[];
-extern unsigned char AmlCode_ssdt[];
+extern const unsigned char AmlCode_dsdt[];
+extern const unsigned char AmlCode_ssdt[];
 
 extern u32 wake_vec;
-extern u8 acpi_sleep_type;
 
 /*
  * These four macros are copied from <arch/smp/mpspec.h>, I have to do this
- * since the "default CONFIG_HAVE_MP_TABLE = 0" in Options.lb, and also since
+ * since the "CONFIG_GENERATE_MP_TABLE = 0", and also since
  * mainboard/via/... have no mptable.c (so that I can not set
- * CONFIG_HAVE_MP_TABLE = 1) as many other mainboards.
+ * "CONFIG_GENERATE_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
@@ -59,25 +58,6 @@ unsigned long acpi_fill_mcfg(unsigned long current)
        return current;
 }
 
-unsigned long acpi_create_madt_lapics(unsigned long current)
-{
-       device_t cpu;
-       int cpu_index = 0;
-
-       for (cpu = all_devices; cpu; cpu = cpu->next) {
-               if ((cpu->path.type != DEVICE_PATH_APIC) ||
-                   (cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER)) {
-                       continue;
-               }
-               if (!cpu->enabled)
-                       continue;
-               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)
 {
@@ -100,8 +80,6 @@ unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags,
 
 unsigned long acpi_fill_madt(unsigned long current)
 {
-       unsigned int gsi_base = 0x18;
-
        /* Create all subtables for processors. */
        current = acpi_create_madt_lapics(current);
 
@@ -133,6 +111,7 @@ unsigned long acpi_fill_slit(unsigned long current)
 unsigned long acpi_fill_srat(unsigned long current)
 {
        /* No NUMA, no SRAT. */
+       return current;
 }
 
 #define ALIGN(x,a)              __ALIGN_MASK(x,(typeof(x))(a)-1)
@@ -142,20 +121,21 @@ unsigned long write_acpi_tables(unsigned long start)
 {
        unsigned long current;
        acpi_rsdp_t *rsdp;
-       acpi_srat_t *srat;
        acpi_rsdt_t *rsdt;
-       acpi_mcfg_t *mcfg;
        acpi_hpet_t *hpet;
        acpi_madt_t *madt;
        acpi_fadt_t *fadt;
        acpi_facs_t *facs;
-       acpi_header_t *dsdt, *ssdt;
+       acpi_header_t *dsdt;
+#if 0
+       acpi_header_t *ssdt;
+#endif
 
        /* Align ACPI tables to 16 byte. */
        start = (start + 0x0f) & -0x10;
        current = start;
 
-       printk_info("ACPI: Writing ACPI tables at %lx...\n", start);
+       printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
 
        /* We need at least an RSDP and an RSDT table. */
        rsdp = (acpi_rsdp_t *) current;
@@ -166,63 +146,60 @@ unsigned long write_acpi_tables(unsigned long start)
        /* Clear all table memory. */
        memset((void *)start, 0, current - start);
 
-       acpi_write_rsdp(rsdp, rsdt);
+       acpi_write_rsdp(rsdp, rsdt, NULL);
        acpi_write_rsdt(rsdt);
 
        /* We explicitly add these tables later on: */
-       printk_debug("ACPI:     * FACS\n");
+       printk(BIOS_DEBUG, "ACPI:     * FACS\n");
        current = ALIGN(current, 64);
        facs = (acpi_facs_t *) current;
        current += sizeof(acpi_facs_t);
        acpi_create_facs(facs);
 
-       printk_debug("ACPI:     * DSDT\n");
+       printk(BIOS_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);
+       memcpy(dsdt, &AmlCode_dsdt, sizeof(acpi_header_t));
+       current += dsdt->length;
+       memcpy(dsdt, &AmlCode_dsdt, 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);
+       dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length);
+       printk(BIOS_DEBUG, "ACPI:     * DSDT @ %p Length %x\n", dsdt, dsdt->length);
 
-       printk_debug("ACPI:     * FADT\n");
+       printk(BIOS_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_add_table(rsdp, fadt);
 
        /* If we want to use HPET timers Linux wants it in MADT. */
-       printk_debug("ACPI:    * MADT\n");
+       printk(BIOS_DEBUG, "ACPI:    * MADT\n");
        madt = (acpi_madt_t *) current;
        acpi_create_madt(madt);
        current += madt->header.length;
-       acpi_add_table(rsdt, madt);
+       acpi_add_table(rsdp, madt);
 
        /* NO MCFG in VX855, no PCI-E. */
 
-       printk_debug("ACPI:    * HPET\n");
-       hpet = (acpi_mcfg_t *) current;
+       printk(BIOS_DEBUG, "ACPI:    * HPET\n");
+       hpet = (acpi_hpet_t *) current;
        acpi_create_hpet(hpet);
        current += hpet->header.length;
-       acpi_add_table(rsdt, hpet);
+       acpi_add_table(rsdp, hpet);
 
 #if 0
-       printk_debug("ACPI:     * SSDT\n");
+       printk(BIOS_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);
+       memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
+       current += ssdt->length;
+       memcpy(ssdt, &AmlCode_ssdt, ssdt->length);
        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);
+       ssdt->checksum = acpi_checksum((u8*)ssdt, ssdt->length);
+       acpi_add_table(rsdp, ssdt);
+       printk(BIOS_DEBUG, "ACPI:     * SSDT @ %08x Length %x\n", ssdt, ssdt->length);
 #endif
 
-       printk_info("ACPI: done.\n");
+       printk(BIOS_INFO, "ACPI: done.\n");
        return current;
 }
 
-int acpi_is_wakeup(void)
-{
-       return (acpi_sleep_type == 3);
-}