Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42494 )
Change subject: [WIP] ACPI: Refactor GNVS generation ......................................................................
[WIP] ACPI: Refactor GNVS generation
Change-Id: I45a2d9cb7f07609a1ff03fd70f17c3f2d4f013b9 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/soc/amd/picasso/acpi.c M src/soc/amd/stoneyridge/acpi.c M src/soc/intel/baytrail/southcluster.c M src/soc/intel/braswell/acpi.c M src/soc/intel/broadwell/lpc.c M src/soc/intel/common/block/acpi/acpi.c M src/soc/intel/denverton_ns/acpi.c M src/soc/intel/skylake/acpi.c M src/soc/intel/xeon_sp/cpx/acpi.c M src/soc/intel/xeon_sp/skx/acpi.c M src/southbridge/intel/bd82x6x/lpc.c M src/southbridge/intel/i82801gx/lpc.c M src/southbridge/intel/i82801ix/lpc.c M src/southbridge/intel/i82801jx/lpc.c M src/southbridge/intel/ibexpeak/lpc.c M src/southbridge/intel/lynxpoint/lpc.c 16 files changed, 97 insertions(+), 216 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/42494/1
diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c index dae0105..2d5ffff 100644 --- a/src/soc/amd/picasso/acpi.c +++ b/src/soc/amd/picasso/acpi.c @@ -12,7 +12,7 @@ #include <arch/ioapic.h> #include <arch/smp/mpspec.h> #include <cpu/x86/smm.h> -#include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <device/device.h> #include <device/pci.h> #include <amdblocks/acpimmio.h> @@ -244,30 +244,20 @@ return acpi_write_hpet(device, current, rsdp); }
-static void acpi_create_gnvs(struct global_nvs_t *gnvs) +void southbridge_inject_dsdt(const struct device *device) { + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return; + /* Set unknown wake source */ gnvs->pm1i = ~0ULL; gnvs->gpei = ~0ULL;
/* CPU core count */ gnvs->pcnt = dev_count_cpu(); -}
-void southbridge_inject_dsdt(const struct device *device) -{ - struct global_nvs_t *gnvs; - - gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (uintptr_t)gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); }
static void acpigen_soc_get_gpio_in_local5(uintptr_t addr) diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c index b79ed0e..381459e 100644 --- a/src/soc/amd/stoneyridge/acpi.c +++ b/src/soc/amd/stoneyridge/acpi.c @@ -11,7 +11,7 @@ #include <device/pci_ops.h> #include <arch/ioapic.h> #include <cpu/x86/smm.h> -#include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <device/device.h> #include <device/pci.h> #include <amdblocks/acpimmio.h> @@ -219,30 +219,20 @@ return acpi_write_hpet(device, current, rsdp); }
-static void acpi_create_gnvs(struct global_nvs_t *gnvs) +void southbridge_inject_dsdt(const struct device *device) { + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return; + /* Set unknown wake source */ gnvs->pm1i = ~0ULL; gnvs->gpei = ~0ULL;
/* CPU core count */ gnvs->pcnt = dev_count_cpu(); -}
-void southbridge_inject_dsdt(const struct device *device) -{ - struct global_nvs_t *gnvs; - - gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (uintptr_t)gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); }
static void acpigen_soc_get_gpio_in_local5(uintptr_t addr) diff --git a/src/soc/intel/baytrail/southcluster.c b/src/soc/intel/baytrail/southcluster.c index a2d2488..fe91759 100644 --- a/src/soc/intel/baytrail/southcluster.c +++ b/src/soc/intel/baytrail/southcluster.c @@ -6,7 +6,7 @@ #include <device/pci_ops.h> #include <acpi/acpi.h> #include <bootstate.h> -#include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <console/console.h> #include <cpu/x86/smm.h> #include <device/device.h> @@ -482,21 +482,13 @@
static void southcluster_inject_dsdt(const struct device *device) { - global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); }
- static struct device_operations device_ops = { .read_resources = sc_read_resources, .set_resources = pci_dev_set_resources, diff --git a/src/soc/intel/braswell/acpi.c b/src/soc/intel/braswell/acpi.c index d16e404..c393601 100644 --- a/src/soc/intel/braswell/acpi.c +++ b/src/soc/intel/braswell/acpi.c @@ -4,7 +4,7 @@ #include <acpi/acpigen.h> #include <device/mmio.h> #include <arch/smp/mpspec.h> -#include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <console/console.h> #include <cpu/intel/turbo.h> #include <cpu/x86/msr.h> @@ -476,24 +476,19 @@
void southcluster_inject_dsdt(const struct device *device) { - global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); + acpi_create_gnvs(gnvs);
- if (gnvs) { - acpi_create_gnvs(gnvs); + /* Fill in the Wi-Fi Region ID */ + if (CONFIG(HAVE_REGULATORY_DOMAIN)) + gnvs->cid1 = wifi_regulatory_domain(); + else + gnvs->cid1 = WRDD_DEFAULT_REGULATORY_DOMAIN;
- /* Fill in the Wi-Fi Region ID */ - if (CONFIG(HAVE_REGULATORY_DOMAIN)) - gnvs->cid1 = wifi_regulatory_domain(); - else - gnvs->cid1 = WRDD_DEFAULT_REGULATORY_DOMAIN; - - /* Add it to DSDT */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); }
__weak void acpi_create_serialio_ssdt(acpi_header_t *ssdt) diff --git a/src/soc/intel/broadwell/lpc.c b/src/soc/intel/broadwell/lpc.c index aabc23d..7ee9ef2 100644 --- a/src/soc/intel/broadwell/lpc.c +++ b/src/soc/intel/broadwell/lpc.c @@ -12,7 +12,7 @@ #include <arch/ioapic.h> #include <acpi/acpi.h> #include <cpu/x86/smm.h> -#include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <reg_script.h> #include <string.h> #include <soc/gpio.h> @@ -565,18 +565,12 @@
static void southcluster_inject_dsdt(const struct device *device) { - global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + acpi_create_gnvs(gnvs); + acpi_inject_nvsa(); }
static unsigned long broadwell_write_acpi_tables(const struct device *device, diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c index c9a56ce..576ec75 100644 --- a/src/soc/intel/common/block/acpi/acpi.c +++ b/src/soc/intel/common/block/acpi/acpi.c @@ -228,18 +228,12 @@
void southbridge_inject_dsdt(const struct device *device) { - struct global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (uintptr_t) gnvs); - acpigen_pop_len(); - } + acpi_create_gnvs(gnvs); + acpi_inject_nvsa(); }
static int calculate_power(int tdp, int p1_ratio, int ratio) diff --git a/src/soc/intel/denverton_ns/acpi.c b/src/soc/intel/denverton_ns/acpi.c index f14ac58..3e45c5d 100644 --- a/src/soc/intel/denverton_ns/acpi.c +++ b/src/soc/intel/denverton_ns/acpi.c @@ -8,6 +8,7 @@ #include <device/pci.h> #include <device/pci_ops.h> #include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <console/console.h> #include <intelblocks/acpi.h> #include <soc/acpi.h> @@ -275,18 +276,12 @@
void southcluster_inject_dsdt(const struct device *device) { - global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32)gnvs); - acpigen_pop_len(); - } + acpi_create_gnvs(gnvs); + acpi_inject_nvsa(); }
__weak void acpi_create_serialio_ssdt(acpi_header_t *ssdt) {} diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c index a5125f6..9a8200f 100644 --- a/src/soc/intel/skylake/acpi.c +++ b/src/soc/intel/skylake/acpi.c @@ -6,6 +6,7 @@ #include <arch/ioapic.h> #include <arch/smp/mpspec.h> #include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <console/console.h> #include <cpu/x86/smm.h> #include <cpu/x86/msr.h> @@ -626,18 +627,12 @@
void southbridge_inject_dsdt(const struct device *device) { - global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + acpi_create_gnvs(gnvs); + acpi_inject_nvsa(); }
/* Save wake source information for calculating ACPI _SWS values */ diff --git a/src/soc/intel/xeon_sp/cpx/acpi.c b/src/soc/intel/xeon_sp/cpx/acpi.c index ba5128e..7c01a01 100644 --- a/src/soc/intel/xeon_sp/cpx/acpi.c +++ b/src/soc/intel/xeon_sp/cpx/acpi.c @@ -4,7 +4,7 @@ #include <arch/ioapic.h> #include <arch/smp/mpspec.h> #include <assert.h> -#include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <cf9_reset.h> #include <console/console.h> #include <cpu/x86/smm.h> @@ -108,19 +108,12 @@
void southbridge_inject_dsdt(const struct device *device) { - global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT. */ - printk(BIOS_SPEW, "%s injecting NVSA with 0x%x\n", __FILE__, (uint32_t)gnvs); - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (uint32_t)gnvs); - acpigen_pop_len(); - } + acpi_create_gnvs(gnvs); + acpi_inject_nvsa();
/* Add IIOStack ACPI Resource Templates */ uncore_inject_dsdt(); diff --git a/src/soc/intel/xeon_sp/skx/acpi.c b/src/soc/intel/xeon_sp/skx/acpi.c index 072bb6a..5db880e 100644 --- a/src/soc/intel/xeon_sp/skx/acpi.c +++ b/src/soc/intel/xeon_sp/skx/acpi.c @@ -6,6 +6,7 @@ #include <intelblocks/acpi.h> #include <device/pci.h> #include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <cpu/x86/smm.h> #include <soc/acpi.h> #include <soc/cpu.h> @@ -953,19 +954,12 @@
void southbridge_inject_dsdt(const struct device *device) { - global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - /* Add it to DSDT. */ - printk(BIOS_SPEW, "%s injecting NVSA with 0x%x\n", __FILE__, (uint32_t)gnvs); - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (uint32_t)gnvs); - acpigen_pop_len(); - } + acpi_create_gnvs(gnvs); + acpi_inject_nvsa();
// Add IIOStack ACPI Resource Templates uncore_inject_dsdt(); diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c index 806dc5f..1caddd5 100644 --- a/src/southbridge/intel/bd82x6x/lpc.c +++ b/src/southbridge/intel/bd82x6x/lpc.c @@ -14,7 +14,6 @@ #include <acpi/acpi.h> #include <acpi/acpigen.h> #include <cpu/x86/smm.h> -#include <cbmem.h> #include <acpi/acpi_gnvs.h> #include <string.h> #include "chip.h" @@ -651,22 +650,14 @@ static void southbridge_inject_dsdt(const struct device *dev) { global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- if (gnvs) { + gnvs->apic = 1; + gnvs->mpen = 1; /* Enable Multi Processing */ + gnvs->pcnt = dev_count_cpu();
- acpi_create_gnvs(gnvs); - - gnvs->apic = 1; - gnvs->mpen = 1; /* Enable Multi Processing */ - gnvs->pcnt = dev_count_cpu(); - - - - /* Add it to DSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); }
void acpi_fill_fadt(acpi_fadt_t *fadt) diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c index 2cb66da..88709bb 100644 --- a/src/southbridge/intel/i82801gx/lpc.c +++ b/src/southbridge/intel/i82801gx/lpc.c @@ -16,7 +16,6 @@ #include <acpi/acpi_gnvs.h> #include <acpi/acpigen.h> #include <arch/smp/mpspec.h> -#include <cbmem.h> #include <string.h> #include <southbridge/intel/common/acpi_pirq_gen.h> #include <southbridge/intel/common/pmbase.h> @@ -615,20 +614,11 @@ static void southbridge_inject_dsdt(const struct device *dev) { global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- if (gnvs) { - - gnvs->apic = 1; - gnvs->mpen = 1; /* Enable Multi Processing */ - - acpi_create_gnvs(gnvs); - - - /* Add it to SSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + gnvs->apic = 1; + gnvs->mpen = 1; /* Enable Multi Processing */ }
static const char *lpc_acpi_name(const struct device *dev) diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c index 62c47c9..cc49fb4 100644 --- a/src/southbridge/intel/i82801ix/lpc.c +++ b/src/southbridge/intel/i82801ix/lpc.c @@ -12,10 +12,9 @@ #include <device/pci_ops.h> #include <arch/ioapic.h> #include <acpi/acpi.h> +#include <acpi/acpi_gnvs.h> #include <cpu/x86/smm.h> #include <acpi/acpigen.h> -#include <cbmem.h> -#include <acpi/acpi_gnvs.h> #include <string.h> #include "chip.h" #include "i82801ix.h" @@ -458,20 +457,9 @@
static void southbridge_inject_dsdt(const struct device *dev) { - global_nvs_t *gnvs = acpi_get_gnvs(); - - if (gnvs) { - acpi_create_gnvs(gnvs); - - - /* Add it to SSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (uintptr_t)gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); }
- static const char *lpc_acpi_name(const struct device *dev) { return "LPCB"; diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c index 5f31fca..659500b 100644 --- a/src/southbridge/intel/i82801jx/lpc.c +++ b/src/southbridge/intel/i82801jx/lpc.c @@ -15,7 +15,6 @@ #include <cpu/x86/smm.h> #include <acpi/acpigen.h> #include <arch/smp/mpspec.h> -#include <cbmem.h> #include <acpi/acpi_gnvs.h> #include <string.h> #include "chip.h" @@ -618,16 +617,11 @@ static void southbridge_inject_dsdt(const struct device *dev) { global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- if (gnvs) { - acpi_create_gnvs(gnvs); - - - /* Add it to SSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + acpi_create_gnvs(gnvs); + acpi_inject_nvsa(); }
static const char *lpc_acpi_name(const struct device *dev) diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index ae075ce..14135a6 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -15,7 +15,6 @@ #include <acpi/acpi.h> #include <elog.h> #include <acpi/acpigen.h> -#include <cbmem.h> #include <acpi/acpi_gnvs.h> #include <string.h> #include <cpu/x86/smm.h> @@ -556,21 +555,16 @@ static void southbridge_inject_dsdt(const struct device *dev) { global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- if (gnvs) { + acpi_create_gnvs(gnvs);
- acpi_create_gnvs(gnvs); + gnvs->apic = 1; + gnvs->mpen = 1; /* Enable Multi Processing */ + gnvs->pcnt = dev_count_cpu();
- gnvs->apic = 1; - gnvs->mpen = 1; /* Enable Multi Processing */ - gnvs->pcnt = dev_count_cpu(); - - - /* Add it to SSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); }
void acpi_fill_fadt(acpi_fadt_t *fadt) diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index 735956a..f4ab30a 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -12,7 +12,7 @@ #include <arch/ioapic.h> #include <acpi/acpi.h> #include <cpu/x86/smm.h> -#include <cbmem.h> +#include <acpi/acpi_gnvs.h> #include <string.h> #include "chip.h" #include "nvs.h" @@ -669,8 +669,6 @@
static void pch_lpc_read_resources(struct device *dev) { - global_nvs_t *gnvs; - /* Get the normal PCI resources of this device. */ pci_dev_read_resources(dev);
@@ -679,7 +677,6 @@
/* Add IO resources. */ pch_lpc_add_io_resources(dev); - }
static void pch_lpc_enable(struct device *dev) @@ -693,22 +690,17 @@
static void southbridge_inject_dsdt(const struct device *dev) { - global_nvs_t *gnvs; + global_nvs_t *gnvs = acpi_get_gnvs(); + if (!gnvs) + return;
- gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); + acpi_create_gnvs(gnvs);
- if (gnvs) { - acpi_create_gnvs(gnvs); + gnvs->apic = 1; + gnvs->mpen = 1; /* Enable Multi Processing */ + gnvs->pcnt = dev_count_cpu();
- gnvs->apic = 1; - gnvs->mpen = 1; /* Enable Multi Processing */ - gnvs->pcnt = dev_count_cpu(); - - /* Add it to DSDT. */ - acpigen_write_scope("\"); - acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); }
void acpi_fill_fadt(acpi_fadt_t *fadt)
Hello build bot (Jenkins), David Guckian, Vanessa Eusebio, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42494
to look at the new patch set (#2).
Change subject: ACPI: Replace uses of CBMEM_ID_ACPI_GNVS ......................................................................
ACPI: Replace uses of CBMEM_ID_ACPI_GNVS
Change-Id: I45a2d9cb7f07609a1ff03fd70f17c3f2d4f013b9 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/soc/intel/baytrail/southcluster.c M src/soc/intel/braswell/acpi.c M src/soc/intel/broadwell/lpc.c M src/soc/intel/common/block/acpi/acpi.c M src/soc/intel/denverton_ns/acpi.c M src/soc/intel/skylake/acpi.c M src/soc/intel/xeon_sp/cpx/acpi.c M src/soc/intel/xeon_sp/skx/acpi.c 8 files changed, 40 insertions(+), 93 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/42494/2
Kyösti Mälkki has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/42494 )
Change subject: ACPI: Replace uses of CBMEM_ID_ACPI_GNVS ......................................................................
Abandoned