summaryrefslogtreecommitdiff
path: root/src/mainboard/amd/solo
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@openbios.org>2005-01-19 14:12:02 +0000
committerStefan Reinauer <stepan@openbios.org>2005-01-19 14:12:02 +0000
commitdd1a959cb2e8eab9a350d2f35eb4a78258732115 (patch)
treed47ff41ff4a626e7d0a38bc91ef28c34c4b6166d /src/mainboard/amd/solo
parent777224c7cffe90e4c439cb4b0b111b1a60f82f69 (diff)
downloadcoreboot-dd1a959cb2e8eab9a350d2f35eb4a78258732115.tar.xz
more universal acpi code
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1887 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/mainboard/amd/solo')
-rw-r--r--src/mainboard/amd/solo/Config.lb2
-rw-r--r--src/mainboard/amd/solo/Options.lb1
-rw-r--r--src/mainboard/amd/solo/acpi_tables.c101
3 files changed, 103 insertions, 1 deletions
diff --git a/src/mainboard/amd/solo/Config.lb b/src/mainboard/amd/solo/Config.lb
index b0ddba75de..7ce6031cbe 100644
--- a/src/mainboard/amd/solo/Config.lb
+++ b/src/mainboard/amd/solo/Config.lb
@@ -41,7 +41,7 @@ arch i386 end
driver mainboard.o
if HAVE_MP_TABLE object mptable.o end
if HAVE_PIRQ_TABLE object irq_tables.o end
-#object reset.o
+if HAVE_ACPI_TABLES object acpi_tables.o end
##
## Romcc output
diff --git a/src/mainboard/amd/solo/Options.lb b/src/mainboard/amd/solo/Options.lb
index 905fea2df5..6051cb0a2d 100644
--- a/src/mainboard/amd/solo/Options.lb
+++ b/src/mainboard/amd/solo/Options.lb
@@ -1,4 +1,5 @@
uses HAVE_MP_TABLE
+uses HAVE_ACPI_TABLES
uses HAVE_PIRQ_TABLE
uses USE_FALLBACK_IMAGE
uses HAVE_FALLBACK_BOOT
diff --git a/src/mainboard/amd/solo/acpi_tables.c b/src/mainboard/amd/solo/acpi_tables.c
new file mode 100644
index 0000000000..9c2aeadd2d
--- /dev/null
+++ b/src/mainboard/amd/solo/acpi_tables.c
@@ -0,0 +1,101 @@
+/*
+ * LinuxBIOS ACPI support for AMD Solo
+ * written by Stefan Reinauer <stepan@openbios.org>
+ * (C) 2005 Stefan Reinauer
+ */
+
+#include <console/console.h>
+#include <string.h>
+#include <arch/acpi.h>
+#include <device/pci.h>
+
+
+unsigned long acpi_dump_apics(unsigned long current)
+{
+#define IO_APIC_ADDR 0xfec00000UL
+ /* create all subtables for 1p */
+ current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, 0, 0);
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, 2,
+ IO_APIC_ADDR);
+ current += acpi_create_madt_irqoverride( (acpi_madt_irqoverride_t *)
+ current, 0, 0, 2, 1 /* active high */);
+ current += acpi_create_madt_irqoverride( (acpi_madt_irqoverride_t *)
+ current, 0, 9, 9, 0xf /* active low, level triggered */);
+ current += acpi_create_madt_lapic_nmi( (acpi_madt_lapic_nmi_t *)
+ current, 0, 5, 1);
+ return current;
+}
+
+unsigned long write_acpi_tables(unsigned long start)
+{
+ unsigned long current;
+ acpi_rsdp_t *rsdp;
+ acpi_rsdt_t *rsdt;
+ acpi_hpet_t *hpet;
+ acpi_madt_t *madt;
+ acpi_fadt_t *fadt;
+ acpi_facs_t *facs;
+ acpi_header_t *dsdt;
+
+ /* Align ACPI tables to 16byte */
+ 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 */
+ rsdp = (acpi_rsdp_t *) current;
+ current += sizeof(acpi_rsdp_t);
+ rsdt = (acpi_rsdt_t *) current;
+ current += sizeof(acpi_rsdt_t);
+
+ /* 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:
+ */
+ printk_debug("ACPI: * HPET\n");
+
+ hpet = (acpi_hpet_t *) current;
+ current += sizeof(acpi_hpet_t);
+ acpi_create_hpet(hpet);
+ acpi_add_table(rsdt,hpet);
+
+ /* If we want to use HPET Timers Linux wants an MADT */
+ printk_debug("ACPI: * MADT\n");
+
+ madt = (acpi_madt_t *) current;
+ acpi_create_madt(madt);
+ current+=madt->header.length;
+ acpi_add_table(rsdt,madt);
+
+#ifdef HAVE_ACPI_FADT
+ printk_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);
+ dsdt->checksum = 0; // don't trust intel iasl compiler 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);
+#endif
+
+ printk_info("ACPI: done.\n");
+ return current;
+}
+