From 2ab4a96668df843da480727ff03974a027db28b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Tue, 30 Jun 2020 11:41:47 +0300 Subject: ACPI: Add common acpi_fill_gnvs() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I515e830808a95eee3ce72b16fd26da6ec79dac85 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/48718 Reviewed-by: Lance Zhao Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/acpi/acpi.c | 3 +++ src/acpi/gnvs.c | 9 +++++++++ src/include/acpi/acpi.h | 2 ++ src/soc/amd/picasso/acpi.c | 5 ----- src/soc/amd/stoneyridge/acpi.c | 5 ----- src/soc/intel/baytrail/southcluster.c | 8 -------- src/soc/intel/braswell/acpi.c | 7 ------- src/soc/intel/broadwell/pch/lpc.c | 7 ------- src/soc/intel/common/block/acpi/acpi.c | 7 ------- src/soc/intel/denverton_ns/acpi.c | 6 ------ src/soc/intel/skylake/acpi.c | 5 ----- src/southbridge/intel/bd82x6x/lpc.c | 7 ------- src/southbridge/intel/i82801gx/lpc.c | 6 ------ src/southbridge/intel/i82801ix/lpc.c | 5 ----- src/southbridge/intel/i82801jx/lpc.c | 5 ----- src/southbridge/intel/ibexpeak/lpc.c | 7 ------- src/southbridge/intel/lynxpoint/lpc.c | 7 ------- 17 files changed, 14 insertions(+), 87 deletions(-) (limited to 'src') diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index ee30391923..6f64d108f9 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -1472,6 +1472,9 @@ unsigned long write_acpi_tables(unsigned long start) current += sizeof(acpi_header_t); acpigen_set_current((char *) current); + + acpi_fill_gnvs(); + for (dev = all_devices; dev; dev = dev->next) if (dev->ops && dev->ops->acpi_inject_dsdt) dev->ops->acpi_inject_dsdt(dev); diff --git a/src/acpi/gnvs.c b/src/acpi/gnvs.c index c8478eed89..27b4b8e82d 100644 --- a/src/acpi/gnvs.c +++ b/src/acpi/gnvs.c @@ -77,3 +77,12 @@ void acpi_inject_nvsa(void) acpigen_write_name_dword("NVSA", (uintptr_t)gnvs); acpigen_pop_len(); } + +void acpi_fill_gnvs(void) +{ + if (!gnvs) + return; + + soc_fill_gnvs(gnvs); + mainboard_fill_gnvs(gnvs); +} diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h index e266a2d668..3b9e9776e9 100644 --- a/src/include/acpi/acpi.h +++ b/src/include/acpi/acpi.h @@ -961,6 +961,8 @@ void arch_fill_fadt(acpi_fadt_t *fadt); void soc_fill_fadt(acpi_fadt_t *fadt); void mainboard_fill_fadt(acpi_fadt_t *fadt); +void acpi_fill_gnvs(void); + void update_ssdt(void *ssdt); void update_ssdtx(void *ssdtx, int i); diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c index e0a29a4635..71087225f7 100644 --- a/src/soc/amd/picasso/acpi.c +++ b/src/soc/amd/picasso/acpi.c @@ -405,11 +405,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); acpi_inject_nvsa(); } diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c index edbebadab0..03acf86959 100644 --- a/src/soc/amd/stoneyridge/acpi.c +++ b/src/soc/amd/stoneyridge/acpi.c @@ -173,11 +173,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); acpi_inject_nvsa(); } diff --git a/src/soc/intel/baytrail/southcluster.c b/src/soc/intel/baytrail/southcluster.c index aeb3775f23..16e4ea472f 100644 --- a/src/soc/intel/baytrail/southcluster.c +++ b/src/soc/intel/baytrail/southcluster.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -485,13 +484,6 @@ void southcluster_enable_dev(struct device *dev) static void southcluster_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); - acpi_inject_nvsa(); } diff --git a/src/soc/intel/braswell/acpi.c b/src/soc/intel/braswell/acpi.c index caeae39512..1849d7ddd7 100644 --- a/src/soc/intel/braswell/acpi.c +++ b/src/soc/intel/braswell/acpi.c @@ -366,13 +366,6 @@ unsigned long southcluster_write_acpi_tables(const struct device *device, unsign void southcluster_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); - acpi_inject_nvsa(); } diff --git a/src/soc/intel/broadwell/pch/lpc.c b/src/soc/intel/broadwell/pch/lpc.c index 03a6872112..1fac25e886 100644 --- a/src/soc/intel/broadwell/pch/lpc.c +++ b/src/soc/intel/broadwell/pch/lpc.c @@ -611,13 +611,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs) static void southcluster_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); - acpi_inject_nvsa(); } diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c index 1a18cfc23e..1c31cd196d 100644 --- a/src/soc/intel/common/block/acpi/acpi.c +++ b/src/soc/intel/common/block/acpi/acpi.c @@ -238,13 +238,6 @@ static int acpi_fill_wake(uint32_t *pm1, uint32_t **gpe0) void southbridge_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); - acpi_inject_nvsa(); } diff --git a/src/soc/intel/denverton_ns/acpi.c b/src/soc/intel/denverton_ns/acpi.c index 8ef2faa7c0..794dae90d4 100644 --- a/src/soc/intel/denverton_ns/acpi.c +++ b/src/soc/intel/denverton_ns/acpi.c @@ -243,12 +243,6 @@ unsigned long southcluster_write_acpi_tables(const struct device *device, void southcluster_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); acpi_inject_nvsa(); } diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c index 2406dc5ca5..07d7601d7b 100644 --- a/src/soc/intel/skylake/acpi.c +++ b/src/soc/intel/skylake/acpi.c @@ -524,11 +524,6 @@ unsigned long southbridge_write_acpi_tables(const struct device *device, void southbridge_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); acpi_inject_nvsa(); } diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c index bb1ab6bb0d..bcdc75b083 100644 --- a/src/southbridge/intel/bd82x6x/lpc.c +++ b/src/southbridge/intel/bd82x6x/lpc.c @@ -660,13 +660,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *dev) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); - acpi_inject_nvsa(); } diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c index 5438b00e6b..f07497c0bc 100644 --- a/src/southbridge/intel/i82801gx/lpc.c +++ b/src/southbridge/intel/i82801gx/lpc.c @@ -491,12 +491,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *dev) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); acpi_inject_nvsa(); } diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c index cefc30cb5e..fbe4af741d 100644 --- a/src/southbridge/intel/i82801ix/lpc.c +++ b/src/southbridge/intel/i82801ix/lpc.c @@ -465,11 +465,6 @@ void *gnvs_chromeos_ptr(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *dev) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - mainboard_fill_gnvs(gnvs); acpi_inject_nvsa(); } diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c index 86478fab19..6c1c318237 100644 --- a/src/southbridge/intel/i82801jx/lpc.c +++ b/src/southbridge/intel/i82801jx/lpc.c @@ -483,11 +483,6 @@ size_t gnvs_size_of_array(void) void southbridge_inject_dsdt(const struct device *dev) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - mainboard_fill_gnvs(gnvs); acpi_inject_nvsa(); } diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index 3f59a19f40..4db22f04f7 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -555,13 +555,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *dev) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); - acpi_inject_nvsa(); } diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index 05593b16bc..a17dfa4d56 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -703,13 +703,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *dev) { - struct global_nvs *gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - soc_fill_gnvs(gnvs); - mainboard_fill_gnvs(gnvs); - acpi_inject_nvsa(); } -- cgit v1.2.3