diff options
author | Rudolf Marek <r.marek@assembler.cz> | 2009-02-01 18:35:15 +0000 |
---|---|---|
committer | Rudolf Marek <r.marek@assembler.cz> | 2009-02-01 18:35:15 +0000 |
commit | 293b5f52253ec0e5edb38e9f7113afc7e8f8ba6e (patch) | |
tree | d0ab38cd89f3ceace9ee3de1cddd6bb5d9acea1a /src/arch/i386/boot/acpi.c | |
parent | 1c49bc9744c2e9044ddd1c8d20a1728f57eda85c (diff) | |
download | coreboot-293b5f52253ec0e5edb38e9f7113afc7e8f8ba6e.tar.xz |
Following patch adds dynamic ACPI AML code generator which can be used to
generate run-time ACPI ASL code.
Moreover it demonstrates its use on Asus M2V-MX SE where the SSDT table is
generated by new function k8acpi_write_vars (technically similar to
update_ssdt). But lot of nicer.
x
Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3925 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/arch/i386/boot/acpi.c')
-rw-r--r-- | src/arch/i386/boot/acpi.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/arch/i386/boot/acpi.c b/src/arch/i386/boot/acpi.c index 4c21231467..40fdf3d368 100644 --- a/src/arch/i386/boot/acpi.c +++ b/src/arch/i386/boot/acpi.c @@ -24,6 +24,7 @@ #include <console/console.h> #include <string.h> #include <arch/acpi.h> +#include <arch/acpigen.h> #include <device/pci.h> u8 acpi_checksum(u8 *table, u32 length) @@ -181,6 +182,34 @@ void acpi_create_mcfg(acpi_mcfg_t *mcfg) header->checksum = acpi_checksum((void *)mcfg, header->length); } +/* this can be overriden by platform ACPI setup code, + if it calls acpi_create_ssdt_generator */ +unsigned long __attribute__((weak)) acpi_fill_ssdt_generator(unsigned long current, + char *oem_table_id) { + return current; +} + +void acpi_create_ssdt_generator(acpi_header_t *ssdt, char *oem_table_id) +{ + unsigned long current=(unsigned long)ssdt+sizeof(acpi_header_t); + memset((void *)ssdt, 0, sizeof(acpi_header_t)); + memcpy(&ssdt->signature, SSDT_NAME, 4); + ssdt->revision = 2; + memcpy(&ssdt->oem_id, OEM_ID, 6); + memcpy(&ssdt->oem_table_id, oem_table_id, 8); + ssdt->oem_revision = 42; + memcpy(&ssdt->asl_compiler_id, "GENAML", 4); + ssdt->asl_compiler_revision = 42; + ssdt->length = sizeof(acpi_header_t); + + acpigen_set_current((unsigned char *) current); + current = acpi_fill_ssdt_generator(current, oem_table_id); + + /* recalculate length */ + ssdt->length = current - (unsigned long)ssdt; + ssdt->checksum = acpi_checksum((void *)ssdt, ssdt->length); +} + int acpi_create_srat_lapic(acpi_srat_lapic_t *lapic, u8 node, u8 apic) { lapic->type=0; |