diff --git a/src/include/acpi/acpi_gnvs.h b/src/include/acpi/acpi_gnvs.h index b5f65cad58..9a97c25b09 100644 --- a/src/include/acpi/acpi_gnvs.h +++ b/src/include/acpi/acpi_gnvs.h @@ -26,13 +26,10 @@ struct device; void southbridge_inject_dsdt(const struct device *device); /* - * This function populates the gnvs structure in acpi table. + * These functions populate the gnvs structure in acpi table. * Defined as weak in common acpi as gnvs structure definition is * chipset specific. */ - -void acpi_create_gnvs(struct global_nvs *gnvs); - void soc_fill_gnvs(struct global_nvs *gnvs); void mainboard_fill_gnvs(struct global_nvs *gnvs); diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c index 743b32ca4f..e0a29a4635 100644 --- a/src/soc/amd/picasso/acpi.c +++ b/src/soc/amd/picasso/acpi.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -394,7 +393,7 @@ unsigned long southbridge_write_acpi_tables(const struct device *device, return acpi_write_hpet(device, current, rsdp); } -void acpi_create_gnvs(struct global_nvs *gnvs) +void soc_fill_gnvs(struct global_nvs *gnvs) { /* Set unknown wake source */ gnvs->pm1i = ~0ULL; @@ -406,18 +405,12 @@ void acpi_create_gnvs(struct global_nvs *gnvs) 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", (uintptr_t)gnvs); - acpigen_pop_len(); - } + soc_fill_gnvs(gnvs); + acpi_inject_nvsa(); } static int acpigen_soc_gpio_op(const char *op, unsigned int gpio_num) diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c index dd8f29f15f..edbebadab0 100644 --- a/src/soc/amd/stoneyridge/acpi.c +++ b/src/soc/amd/stoneyridge/acpi.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -162,7 +161,7 @@ unsigned long southbridge_write_acpi_tables(const struct device *device, return acpi_write_hpet(device, current, rsdp); } -void acpi_create_gnvs(struct global_nvs *gnvs) +void soc_fill_gnvs(struct global_nvs *gnvs) { /* Set unknown wake source */ gnvs->pm1i = ~0ULL; @@ -174,18 +173,12 @@ void acpi_create_gnvs(struct global_nvs *gnvs) 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", (uintptr_t)gnvs); - acpigen_pop_len(); - } + soc_fill_gnvs(gnvs); + acpi_inject_nvsa(); } static void acpigen_soc_get_gpio_in_local5(uintptr_t addr)