diff options
Diffstat (limited to 'src/acpi')
-rw-r--r-- | src/acpi/chromeos-gnvs.c | 11 | ||||
-rw-r--r-- | src/acpi/gnvs.c | 22 |
2 files changed, 27 insertions, 6 deletions
diff --git a/src/acpi/chromeos-gnvs.c b/src/acpi/chromeos-gnvs.c index 4bcf892745..bdd7d69cc5 100644 --- a/src/acpi/chromeos-gnvs.c +++ b/src/acpi/chromeos-gnvs.c @@ -4,9 +4,18 @@ #include <ec/google/chromeec/ec.h> #include <vendorcode/google/chromeos/gnvs.h> +/* Remove once implemented on platform code. */ +__weak void *gnvs_chromeos_ptr(struct global_nvs *gnvs) +{ + return NULL; +} + void gnvs_assign_chromeos(void) { - chromeos_acpi_t *gnvs_chromeos = gnvs_chromeos_ptr(); + chromeos_acpi_t *gnvs_chromeos = gnvs_chromeos_ptr(acpi_get_gnvs()); + if (!gnvs_chromeos) + return; + chromeos_init_chromeos_acpi(gnvs_chromeos); /* EC can override to ECFW_RW. */ 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(); } |