Vladimir Serbinenko (phcoder@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7017
-gerrit
commit 22ce30feedc034c73ec2198a957c5870d65f4a53 Author: Vladimir Serbinenko phcoder@gmail.com Date: Sun Oct 5 11:10:35 2014 +0200
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 --- src/arch/x86/boot/acpi.c | 23 +++++++++++++++++++++-- src/include/device/device.h | 1 + src/southbridge/intel/bd82x6x/lpc.c | 8 +++----- src/southbridge/intel/ibexpeak/lpc.c | 6 ++---- src/southbridge/intel/lynxpoint/lpc.c | 8 +++----- 5 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c index 3a30d31..6c74268 100644 --- a/src/arch/x86/boot/acpi.c +++ b/src/arch/x86/boot/acpi.c @@ -707,8 +707,27 @@ 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); + +#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + 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(); +#endif + memcpy((char *)current, (char *)&AmlCode + sizeof(acpi_header_t), dsdt->length - sizeof(acpi_header_t)); + current += dsdt->length - sizeof(acpi_header_t); + +#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + /* (Re)calculate length and checksum. */ + dsdt->length = current - (unsigned long)dsdt; + dsdt->checksum = 0; + dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length); +#endif + }
ALIGN_CURRENT;
diff --git a/src/include/device/device.h b/src/include/device/device.h index 256afd4..7ae49f5 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -61,6 +61,7 @@ struct device_operations { unsigned long (*write_acpi_tables)(unsigned long start, struct acpi_rsdp *rsdp); unsigned long (*acpi_fill_ssdt_generator)(unsigned long current, const char *oem_table_id); + void (*acpi_inject_dsdt_generator)(void); #endif const struct pci_operations *ops_pci; const struct smbus_bus_operations *ops_smbus_bus; diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c index a1c7c2a..6218874 100644 --- a/src/southbridge/intel/bd82x6x/lpc.c +++ b/src/southbridge/intel/bd82x6x/lpc.c @@ -671,7 +671,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device) } }
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id) +static void southbridge_inject_dsdt(void) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs)); void *opregion; @@ -690,13 +690,11 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe /* And tell SMI about it */ smm_setup_structures(gnvs, NULL, NULL);
- /* Add it to SSDT. */ + /* Add it to DSDT. */ scopelen = acpigen_write_scope("\"); scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); acpigen_patch_len(scopelen - 1); } - - return (unsigned long) (acpigen_get_current()); }
static struct pci_operations pci_ops = { @@ -708,7 +706,7 @@ static struct device_operations device_ops = { .set_resources = pci_dev_set_resources, .enable_resources = pch_lpc_enable_resources, .write_acpi_tables = acpi_write_hpet, - .acpi_fill_ssdt_generator = southbridge_fill_ssdt, + .acpi_inject_dsdt_generator = southbridge_inject_dsdt, .init = lpc_init, .enable = pch_lpc_enable, .scan_bus = scan_static_bus, diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index 1d893e9..81f3141 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -664,7 +664,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device) } }
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id) +static void southbridge_inject_dsdt(void) { global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs)); void *opregion; @@ -688,8 +688,6 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); acpigen_patch_len(scopelen - 1); } - - return (unsigned long) (acpigen_get_current()); }
static struct pci_operations pci_ops = { @@ -700,7 +698,7 @@ static struct device_operations device_ops = { .read_resources = pch_lpc_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pch_lpc_enable_resources, - .acpi_fill_ssdt_generator = southbridge_fill_ssdt, + .acpi_inject_dsdt_generator = southbridge_inject_dsdt, .write_acpi_tables = acpi_write_hpet, .init = lpc_init, .enable = pch_lpc_enable, diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index 451aeab..9e860d0 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -743,7 +743,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device) } }
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id) +static void southbridge_inject_dsdt(void) { global_nvs_t *gnvs;
@@ -761,13 +761,11 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe /* And tell SMI about it */ smm_setup_structures(gnvs, NULL, NULL);
- /* Add it to SSDT. */ + /* Add it to DSDT. */ scopelen = acpigen_write_scope("\"); scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); acpigen_patch_len(scopelen - 1); } - - return (unsigned long) (acpigen_get_current()); }
#define ALIGN_CURRENT current = (ALIGN(current, 16)) @@ -815,7 +813,7 @@ static struct device_operations device_ops = { .read_resources = pch_lpc_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, - .acpi_fill_ssdt_generator = southbridge_fill_ssdt, + .acpi_inject_dsdt_generator = southbridge_inject_dsdt, .write_acpi_tables = southbridge_write_acpi_tables, .init = lpc_init, .enable = pch_lpc_enable,