diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-01-27 10:13:33 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-01-29 10:21:25 +0000 |
commit | 62d6f1f9430151448b4e51c249e345f63bba4f97 (patch) | |
tree | 2696ef04133d7c851715fdd166f0ce6bb1742c9b /src | |
parent | 0a54685b295a8dc9180e011a6e1067d178636427 (diff) |
ACPI: Do minor improvements on GNVS
Reorder the support functions to make a bit more sense,
allocations happen first. Add related comments about the
bootstate these are to be called from.
Change-Id: Ie6d66f6e4c30519dee4520f6e9dec3c8c678ab57
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50003
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/acpi/gnvs.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/acpi/gnvs.c b/src/acpi/gnvs.c index 4da830a5ad..63740d037f 100644 --- a/src/acpi/gnvs.c +++ b/src/acpi/gnvs.c @@ -12,27 +12,12 @@ static struct global_nvs *gnvs; -void *acpi_get_gnvs(void) -{ - if (gnvs) - return gnvs; - - gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); - if (gnvs) - return gnvs; - - printk(BIOS_ERR, "Unable to locate Global NVS\n"); - return NULL; -} - -__weak void soc_fill_gnvs(struct global_nvs *gnvs_) { } -__weak void mainboard_fill_gnvs(struct global_nvs *gnvs_) { } - void acpi_create_gnvs(void) { size_t gnvs_size; - if (cbmem_find(CBMEM_ID_ACPI_GNVS)) + gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); + if (gnvs) return; /* Match with OpRegion declared in global_nvs.asl. */ @@ -57,11 +42,29 @@ void acpi_create_gnvs(void) gnvs_assign_chromeos((u8 *)gnvs + GNVS_CHROMEOS_ACPI_OFFSET); } +void *acpi_get_gnvs(void) +{ + if (gnvs) + return gnvs; + + gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); + if (gnvs) + return gnvs; + + printk(BIOS_ERR, "Unable to locate Global NVS\n"); + return NULL; +} + void *acpi_get_device_nvs(void) { return (u8 *)gnvs + GNVS_DEVICE_NVS_OFFSET; } +/* Implemented under platform. */ +__weak void soc_fill_gnvs(struct global_nvs *gnvs_) { } +__weak void mainboard_fill_gnvs(struct global_nvs *gnvs_) { } + +/* Called from write_acpi_tables() only on normal boot path. */ void acpi_fill_gnvs(void) { if (!gnvs) |