From 9f441dfc702b5c99ad466b9ada4e462a1b350bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sun, 28 Jun 2020 12:29:13 +0300 Subject: ACPI: Replace uses of CBMEM_ID_ACPI_GNVS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I45a2d9cb7f07609a1ff03fd70f17c3f2d4f013b9 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/48705 Reviewed-by: Arthur Heymans Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/soc/intel/baytrail/southcluster.c | 16 +++++----------- src/soc/intel/braswell/acpi.c | 16 +++++----------- src/soc/intel/broadwell/pch/lpc.c | 25 +++++++++---------------- src/soc/intel/common/block/acpi/acpi.c | 16 +++++----------- src/soc/intel/denverton_ns/acpi.c | 16 +++++----------- src/soc/intel/skylake/acpi.c | 16 +++++----------- src/southbridge/intel/lynxpoint/lpc.c | 22 ++++++++-------------- 7 files changed, 42 insertions(+), 85 deletions(-) (limited to 'src') diff --git a/src/soc/intel/baytrail/southcluster.c b/src/soc/intel/baytrail/southcluster.c index d8305c612d..428002b669 100644 --- a/src/soc/intel/baytrail/southcluster.c +++ b/src/soc/intel/baytrail/southcluster.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -486,18 +485,13 @@ void southcluster_enable_dev(struct device *dev) static void southcluster_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs; - - gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); + struct global_nvs *gnvs = acpi_get_gnvs(); + if (!gnvs) + return; - if (gnvs) { - acpi_create_gnvs(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 = { diff --git a/src/soc/intel/braswell/acpi.c b/src/soc/intel/braswell/acpi.c index 615022270f..922f485d7d 100644 --- a/src/soc/intel/braswell/acpi.c +++ b/src/soc/intel/braswell/acpi.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -367,18 +366,13 @@ unsigned long southcluster_write_acpi_tables(const struct device *device, unsign void southcluster_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs; + struct global_nvs *gnvs = acpi_get_gnvs(); + if (!gnvs) + return; - gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); + acpi_create_gnvs(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(); } __weak void acpi_create_serialio_ssdt(acpi_header_t *ssdt) diff --git a/src/soc/intel/broadwell/pch/lpc.c b/src/soc/intel/broadwell/pch/lpc.c index 8feae0f0a1..60c65cbaaa 100644 --- a/src/soc/intel/broadwell/pch/lpc.c +++ b/src/soc/intel/broadwell/pch/lpc.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -603,24 +602,18 @@ static void pch_lpc_read_resources(struct device *dev) static void southcluster_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs; - - gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); + struct global_nvs *gnvs = acpi_get_gnvs(); + if (!gnvs) + return; - /* Set unknown wake source */ - gnvs->pm1i = -1; + /* Set unknown wake source */ + gnvs->pm1i = -1; - /* CPU core count */ - gnvs->pcnt = dev_count_cpu(); + /* CPU core count */ + gnvs->pcnt = dev_count_cpu(); - /* 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 fc4352834a..e1766ea06d 100644 --- a/src/soc/intel/common/block/acpi/acpi.c +++ b/src/soc/intel/common/block/acpi/acpi.c @@ -241,18 +241,12 @@ __weak void acpi_create_gnvs(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs; - - gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - - if (gnvs) { - acpi_create_gnvs(gnvs); + struct global_nvs *gnvs = acpi_get_gnvs(); + if (!gnvs) + return; - /* 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(); } int common_calculate_power_ratio(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 005dbae093..cc967af904 100644 --- a/src/soc/intel/denverton_ns/acpi.c +++ b/src/soc/intel/denverton_ns/acpi.c @@ -243,18 +243,12 @@ unsigned long southcluster_write_acpi_tables(const struct device *device, void southcluster_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs; + struct global_nvs *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 0f3136e4c4..6e41ea81ff 100644 --- a/src/soc/intel/skylake/acpi.c +++ b/src/soc/intel/skylake/acpi.c @@ -524,18 +524,12 @@ unsigned long southbridge_write_acpi_tables(const struct device *device, void southbridge_inject_dsdt(const struct device *device) { - struct global_nvs *gnvs; + struct global_nvs *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) (uintptr_t)gnvs); - acpigen_pop_len(); - } + acpi_create_gnvs(gnvs); + acpi_inject_nvsa(); } /* Save wake source information for calculating ACPI _SWS values */ diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index ae718c16a5..49c7f7ed3c 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include "chip.h" #include "iobp.h" @@ -697,22 +696,17 @@ void *gnvs_chromeos_ptr(struct global_nvs *gnvs) void southbridge_inject_dsdt(const struct device *dev) { - struct global_nvs *gnvs; - - gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); + struct global_nvs *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 DSDT. */ - acpigen_write_scope("\\"); - acpigen_write_name_dword("NVSA", (u32)gnvs); - acpigen_pop_len(); - } + acpi_inject_nvsa(); } static const char *lpc_acpi_name(const struct device *dev) -- cgit v1.2.3