diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2020-06-17 13:45:16 +0300 |
---|---|---|
committer | Hung-Te Lin <hungte@chromium.org> | 2020-12-25 02:29:14 +0000 |
commit | e0183d6540b8e8a8281f4317b881dfbc57f12bc4 (patch) | |
tree | c3399bb67dc9489c105f1757a3ffc7dfeca27bd4 /src/acpi/gnvs.c | |
parent | 61bc2191c3d3a66f33688ee498985a588fc8ec82 (diff) | |
download | coreboot-e0183d6540b8e8a8281f4317b881dfbc57f12bc4.tar.xz |
ACPI: Allocate GNVS early in ramstage
We need this to happen prior to SMM module loader. If
there is some debugging output it's better they do not
appear in the middle of CPU bringup.
Change-Id: I45b4b5c0c5bf8bee258a465d1e364bfe98190e44
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48697
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/acpi/gnvs.c')
-rw-r--r-- | src/acpi/gnvs.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/acpi/gnvs.c b/src/acpi/gnvs.c index fbc84b36fd..c0a58f3ba7 100644 --- a/src/acpi/gnvs.c +++ b/src/acpi/gnvs.c @@ -24,11 +24,22 @@ void *acpi_get_gnvs(void) static void gnvs_assign_cbmc(void) { - uint32_t *gnvs_cbmc = gnvs_cbmc_ptr(); + uint32_t *gnvs_cbmc = gnvs_cbmc_ptr(gnvs); if (gnvs_cbmc) *gnvs_cbmc = (uintptr_t)cbmem_find(CBMEM_ID_CONSOLE); } +/* Platforms that implement GNVS will need to implement these. */ +__weak size_t gnvs_size_of_array(void) +{ + return 0; +} + +__weak uint32_t *gnvs_cbmc_ptr(struct global_nvs *gnvs_) +{ + return NULL; +} + void *gnvs_get_or_create(void) { size_t gnvs_size; @@ -41,10 +52,12 @@ void *gnvs_get_or_create(void) return gnvs; gnvs_size = gnvs_size_of_array(); + if (!gnvs_size) + return NULL; gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, gnvs_size); if (!gnvs) - return gnvs; + return NULL; memset(gnvs, 0, gnvs_size); @@ -59,11 +72,10 @@ void *gnvs_get_or_create(void) void acpi_inject_nvsa(void) { - uintptr_t gnvs_address = (uintptr_t)acpi_get_gnvs(); - if (!gnvs_address) + if (!gnvs) return; acpigen_write_scope("\\"); - acpigen_write_name_dword("NVSA", gnvs_address); + acpigen_write_name_dword("NVSA", (uintptr_t)gnvs); acpigen_pop_len(); } |