ACPI: Add common acpi_fill_gnvs()
Change-Id: I515e830808a95eee3ce72b16fd26da6ec79dac85
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48718
Reviewed-by: Lance Zhao
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c
index ee30391..6f64d10 100644
--- a/src/acpi/acpi.c
+++ b/src/acpi/acpi.c
@@ -1472,6 +1472,9 @@
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 c8478ee..27b4b8e 100644
--- a/src/acpi/gnvs.c
+++ b/src/acpi/gnvs.c
@@ -77,3 +77,12 @@
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 e266a2d..3b9e977 100644
--- a/src/include/acpi/acpi.h
+++ b/src/include/acpi/acpi.h
@@ -961,6 +961,8 @@
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 e0a29a4..7108722 100644
--- a/src/soc/amd/picasso/acpi.c
+++ b/src/soc/amd/picasso/acpi.c
@@ -405,11 +405,6 @@
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 edbebad..03acf86 100644
--- a/src/soc/amd/stoneyridge/acpi.c
+++ b/src/soc/amd/stoneyridge/acpi.c
@@ -173,11 +173,6 @@
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 aeb3775..16e4ea4 100644
--- a/src/soc/intel/baytrail/southcluster.c
+++ b/src/soc/intel/baytrail/southcluster.c
@@ -19,7 +19,6 @@
#include <soc/iomap.h>
#include <soc/irq.h>
#include <soc/lpc.h>
-#include <soc/nvs.h>
#include <soc/pci_devs.h>
#include <soc/pm.h>
#include <soc/ramstage.h>
@@ -485,13 +484,6 @@
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 caeae39..1849d7d 100644
--- a/src/soc/intel/braswell/acpi.c
+++ b/src/soc/intel/braswell/acpi.c
@@ -366,13 +366,6 @@
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 03a6872..1fac25e 100644
--- a/src/soc/intel/broadwell/pch/lpc.c
+++ b/src/soc/intel/broadwell/pch/lpc.c
@@ -611,13 +611,6 @@
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 1a18cfc..1c31cd1 100644
--- a/src/soc/intel/common/block/acpi/acpi.c
+++ b/src/soc/intel/common/block/acpi/acpi.c
@@ -238,13 +238,6 @@
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 8ef2faa..794dae9 100644
--- a/src/soc/intel/denverton_ns/acpi.c
+++ b/src/soc/intel/denverton_ns/acpi.c
@@ -243,12 +243,6 @@
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 2406dc5..07d7601 100644
--- a/src/soc/intel/skylake/acpi.c
+++ b/src/soc/intel/skylake/acpi.c
@@ -524,11 +524,6 @@
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 bb1ab6b..bcdc75b 100644
--- a/src/southbridge/intel/bd82x6x/lpc.c
+++ b/src/southbridge/intel/bd82x6x/lpc.c
@@ -660,13 +660,6 @@
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 5438b00..f07497c 100644
--- a/src/southbridge/intel/i82801gx/lpc.c
+++ b/src/southbridge/intel/i82801gx/lpc.c
@@ -491,12 +491,6 @@
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 cefc30c..fbe4af7 100644
--- a/src/southbridge/intel/i82801ix/lpc.c
+++ b/src/southbridge/intel/i82801ix/lpc.c
@@ -465,11 +465,6 @@
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 86478fa..6c1c318 100644
--- a/src/southbridge/intel/i82801jx/lpc.c
+++ b/src/southbridge/intel/i82801jx/lpc.c
@@ -483,11 +483,6 @@
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 3f59a19..4db22f0 100644
--- a/src/southbridge/intel/ibexpeak/lpc.c
+++ b/src/southbridge/intel/ibexpeak/lpc.c
@@ -555,13 +555,6 @@
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 05593b1..a17dfa4 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -703,13 +703,6 @@
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();
}