From 3b809cb830617058a8a9ee7362417b276fae1345 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Wed, 19 Jan 2005 14:13:02 +0000 Subject: universal acpi fixes. git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1888 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/mainboard/via/epia-m/Config.lb | 1 + src/mainboard/via/epia-m/acpi_tables.c | 75 ++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/mainboard/via/epia-m/acpi_tables.c (limited to 'src/mainboard') diff --git a/src/mainboard/via/epia-m/Config.lb b/src/mainboard/via/epia-m/Config.lb index 03277abaaf..1785850a27 100644 --- a/src/mainboard/via/epia-m/Config.lb +++ b/src/mainboard/via/epia-m/Config.lb @@ -49,6 +49,7 @@ if HAVE_PIRQ_TABLE object irq_tables.o end if HAVE_ACPI_TABLES object fadt.o object dsdt.o + object acpi_tables.o end ## diff --git a/src/mainboard/via/epia-m/acpi_tables.c b/src/mainboard/via/epia-m/acpi_tables.c new file mode 100644 index 0000000000..180b46bf34 --- /dev/null +++ b/src/mainboard/via/epia-m/acpi_tables.c @@ -0,0 +1,75 @@ +/* + * LinuxBIOS ACPI Table support + * written by Stefan Reinauer + * ACPI FADT, FACS, and DSDT table support added by + * Nick Barker , and those portions + * (C) Copyright 2004 Nick Barker + * (C) Copyright 2005 Stefan Reinauer + */ + +#include +#include +#include + +extern unsigned char AmlCode[]; + +unsigned long acpi_dump_apics(unsigned long current) +{ + /* Nothing to do */ +} + +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: * 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); + + printk_info("ACPI: done.\n"); + return current; +} + -- cgit v1.2.3