summaryrefslogtreecommitdiff
path: root/src/arch/x86/boot/acpi.c
diff options
context:
space:
mode:
authorVladimir Serbinenko <phcoder@gmail.com>2014-10-05 11:10:35 +0200
committerVladimir Serbinenko <phcoder@gmail.com>2014-10-11 04:08:15 +0200
commit334fd8e28b6f572dc8a82c7969696c6072709583 (patch)
tree8dc340c8d7c117fc3cdcfd92dc5c8f731886141e /src/arch/x86/boot/acpi.c
parentbf3e2dfaafb4b523a893a43aab4e0da661c94e5a (diff)
bd82x6x, ibexpeak, lynxpoint: Declare NVSA before its use.
Windows chokes if it's not the case. Change-Id: I3df15228ed00c3124b8d42fc01d7d63ff3fe07ba Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/7017 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@gmail.com>
Diffstat (limited to 'src/arch/x86/boot/acpi.c')
-rw-r--r--src/arch/x86/boot/acpi.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index 3a30d31b71..c4f5fca404 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -707,8 +707,25 @@ unsigned long write_acpi_tables(unsigned long start)
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
+ if (dsdt->length >= sizeof(acpi_header_t)) {
+ current += sizeof(acpi_header_t);
+
+ acpigen_set_current((char *) current);
+ for (dev = all_devices; dev; dev = dev->next)
+ if (dev->ops && dev->ops->acpi_inject_dsdt_generator) {
+ dev->ops->acpi_inject_dsdt_generator();
+ }
+ current = (unsigned long) acpigen_get_current();
+ memcpy((char *)current,
+ (char *)&AmlCode + sizeof(acpi_header_t),
+ dsdt->length - sizeof(acpi_header_t));
+ current += dsdt->length - sizeof(acpi_header_t);
+
+ /* (Re)calculate length and checksum. */
+ dsdt->length = current - (unsigned long)dsdt;
+ dsdt->checksum = 0;
+ dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
+ }
ALIGN_CURRENT;