Attention is currently required from: Lance Zhao, Tim Wawrzynczak. Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63414 )
Change subject: lib/hardwaremain.c: Move creating ACPI structs to bootstate hooks ......................................................................
lib/hardwaremain.c: Move creating ACPI structs to bootstate hooks
Change-Id: I613b927b9a193fc076ffb1b2a40c617965ce2645 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/acpi/gnvs.c M src/include/acpi/acpi_gnvs.h M src/lib/hardwaremain.c M src/vendorcode/google/chromeos/chromeos.h M src/vendorcode/google/chromeos/gnvs.c 5 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/14/63414/1
diff --git a/src/acpi/gnvs.c b/src/acpi/gnvs.c index 6de345f..ad20c92 100644 --- a/src/acpi/gnvs.c +++ b/src/acpi/gnvs.c @@ -2,6 +2,7 @@
#include <acpi/acpi_gnvs.h> #include <acpi/acpigen.h> +#include <bootstate.h> #include <cbmem.h> #include <console/console.h> #include <soc/nvs.h> @@ -11,8 +12,11 @@ static struct global_nvs *gnvs; static void *dnvs;
-void acpi_create_gnvs(void) +static void acpi_create_gnvs(void *unused) { + if (!CONFIG(ACPI_SOC_NVS)) + return; + const size_t gnvs_size = ALIGN_UP(sizeof(struct global_nvs), sizeof(uint64_t)); const size_t dnvs_size = ALIGN_UP(size_of_dnvs(), sizeof(uint64_t));
@@ -34,6 +38,8 @@ gnvs->cbmc = (uintptr_t)cbmem_find(CBMEM_ID_CONSOLE); }
+BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_EXIT, acpi_create_gnvs, NULL); + void *acpi_get_gnvs(void) { if (gnvs) diff --git a/src/include/acpi/acpi_gnvs.h b/src/include/acpi/acpi_gnvs.h index ef98b66..ef6ec29 100644 --- a/src/include/acpi/acpi_gnvs.h +++ b/src/include/acpi/acpi_gnvs.h @@ -7,7 +7,6 @@
struct global_nvs;
-void acpi_create_gnvs(void); size_t size_of_dnvs(void);
#if CONFIG(ACPI_SOC_NVS) diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c index 84f3e9b..1f5bd09 100644 --- a/src/lib/hardwaremain.c +++ b/src/lib/hardwaremain.c @@ -460,13 +460,6 @@ timestamp_add_now(TS_RAMSTAGE_START); post_code(POST_ENTRY_HARDWAREMAIN);
- /* Initialise GNVS early. */ - if (CONFIG(ACPI_SOC_NVS)) - acpi_create_gnvs(); - - if (CONFIG(CHROMEOS_NVS)) - chromeos_init_chromeos_acpi(); - /* Schedule the static boot state entries. */ boot_state_schedule_static_entries();
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index abdd6c2..f3b8b07 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -26,7 +26,6 @@ void chromeos_set_me_hash(u32*, int); void chromeos_set_ramoops(void *ram_oops, size_t size); void chromeos_set_ecfw_rw(void); -void chromeos_init_chromeos_acpi(void);
/** * get_dsm_calibration_from_key - Gets value related to DSM calibration from VPD diff --git a/src/vendorcode/google/chromeos/gnvs.c b/src/vendorcode/google/chromeos/gnvs.c index 7821786..733aa65 100644 --- a/src/vendorcode/google/chromeos/gnvs.c +++ b/src/vendorcode/google/chromeos/gnvs.c @@ -2,6 +2,7 @@
#include <acpi/acpi.h> #include <acpi/acpigen.h> +#include <bootstate.h> #include <types.h> #include <string.h> #include <stdlib.h> @@ -31,7 +32,7 @@ return region_device_sz(&vpd); }
-void chromeos_init_chromeos_acpi(void) +void chromeos_init_chromeos_acpi(void *unused) { size_t vpd_size; uintptr_t vpd_base = 0; @@ -63,6 +64,8 @@ chromeos_acpi->vbt2 = ACTIVE_ECFW_RW; }
+BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_EXIT, chromeos_init_chromeos_acpi, NULL); + void chromeos_set_me_hash(u32 *hash, int len) { if ((len*sizeof(u32)) > sizeof(chromeos_acpi->mehh))