We define IO_APIC_ADDR in <arch/ioapic.h>, let's use it.
[coreboot.git] / src / mainboard / via / vt8454c / acpi_tables.c
index 24f7dd42a85002c4a28034ae43a594123976ff89..434bf8799d4deeff2bbcfb2a5df4ec25f8fdb331 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of the coreboot project.
- * 
+ *
  * Copyright (C) 2007-2009 coresystems GmbH
  *
  * This program is free software; you can redistribute it and/or
 #include <string.h>
 #include <console/console.h>
 #include <arch/acpi.h>
+#include <arch/ioapic.h>
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include "dmi.h"
 
-extern unsigned char AmlCode[];
+extern const unsigned char AmlCode[];
 
 unsigned long acpi_fill_mcfg(unsigned long current)
 {
@@ -52,7 +53,7 @@ unsigned long acpi_fill_mcfg(unsigned long current)
 }
 
 
-void acpi_create_via_hpet(acpi_hpet_t * hpet)
+static void acpi_create_via_hpet(acpi_hpet_t * hpet)
 {
 #define HPET_ADDR  0xfe800000ULL
        acpi_header_t *header = &(hpet->header);
@@ -85,10 +86,6 @@ void acpi_create_via_hpet(acpi_hpet_t * hpet)
            acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
 }
 
-
-
-#define IO_APIC_ADDR   0xfec00000UL
-
 unsigned long acpi_fill_madt(unsigned long current)
 {
        /* Local Apic */
@@ -135,7 +132,7 @@ unsigned long write_acpi_tables(unsigned long start)
        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;
@@ -153,7 +150,7 @@ unsigned long write_acpi_tables(unsigned long start)
         * We explicitly add these tables later on:
         */
 
-       printk_debug("ACPI:    * HPET\n");
+       printk(BIOS_DEBUG, "ACPI:    * HPET\n");
 
        hpet = (acpi_hpet_t *) current;
        current += sizeof(acpi_hpet_t);
@@ -161,35 +158,36 @@ unsigned long write_acpi_tables(unsigned long start)
        acpi_add_table(rsdp, hpet);
 
        /* If we want to use HPET Timers Linux wants an 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(rsdp, madt);
 
-       printk_debug("ACPI:    * MCFG\n");
+       printk(BIOS_DEBUG, "ACPI:    * MCFG\n");
        mcfg = (acpi_mcfg_t *) current;
        acpi_create_mcfg(mcfg);
        current += mcfg->header.length;
        acpi_add_table(rsdp, mcfg);
 
-       printk_debug("ACPI:     * FACS\n");
+       printk(BIOS_DEBUG, "ACPI:     * FACS\n");
        facs = (acpi_facs_t *) current;
        current += sizeof(acpi_facs_t);
        acpi_create_facs(facs);
 
        dsdt = (acpi_header_t *) current;
-       current += ((acpi_header_t *) AmlCode)->length;
-       memcpy((void *) dsdt, (void *) AmlCode,
-              ((acpi_header_t *) AmlCode)->length);
-#if DONT_TRUST_IASL
+       dsdt = (acpi_header_t *)current;
+       memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
+       current += dsdt->length;
+       memcpy(dsdt, &AmlCode, dsdt->length);
+#ifdef DONT_TRUST_IASL
        dsdt->checksum = 0;     // don't trust intel iasl compiler to get this right
        dsdt->checksum = acpi_checksum(dsdt, dsdt->length);
 #endif
-       printk_debug("ACPI:     * DSDT @ %p Length %x\n", dsdt,
+       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);
@@ -197,9 +195,9 @@ unsigned long write_acpi_tables(unsigned long start)
        acpi_create_fadt(fadt, facs, dsdt);
        acpi_add_table(rsdp, fadt);
 
-       printk_debug("ACPI:     * DMI (Linux workaround)\n");
+       printk(BIOS_DEBUG, "ACPI:     * DMI (Linux workaround)\n");
        memcpy((void *)0xfff80, dmi_table, DMI_TABLE_SIZE);
 
-       printk_info("ACPI: done.\n");
+       printk(BIOS_INFO, "ACPI: done.\n");
        return current;
 }