summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/acpi/Makefile.inc1
-rw-r--r--src/acpi/chromeos-gnvs.c38
-rw-r--r--src/acpi/gnvs.c6
-rw-r--r--src/include/acpi/acpi_gnvs.h1
-rw-r--r--src/vendorcode/google/chromeos/chromeos.h1
-rw-r--r--src/vendorcode/google/chromeos/gnvs.c33
-rw-r--r--src/vendorcode/google/chromeos/gnvs.h1
-rw-r--r--src/vendorcode/google/chromeos/ramoops.c17
8 files changed, 37 insertions, 61 deletions
diff --git a/src/acpi/Makefile.inc b/src/acpi/Makefile.inc
index 3c3bd9ed12..efa7e3bb4f 100644
--- a/src/acpi/Makefile.inc
+++ b/src/acpi/Makefile.inc
@@ -10,7 +10,6 @@ ramstage-$(CONFIG_PCI) += acpigen_pci.c
ramstage-y += acpigen_ps2_keybd.c
ramstage-y += acpigen_usb.c
ramstage-y += device.c
-ramstage-$(CONFIG_CHROMEOS_NVS) += chromeos-gnvs.c
ramstage-$(CONFIG_ACPI_SOC_NVS) += gnvs.c
ramstage-y += pld.c
ramstage-y += sata.c
diff --git a/src/acpi/chromeos-gnvs.c b/src/acpi/chromeos-gnvs.c
deleted file mode 100644
index 060d56d44b..0000000000
--- a/src/acpi/chromeos-gnvs.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <acpi/acpi_gnvs.h>
-#include <ec/google/chromeec/ec.h>
-#include <smbios.h>
-#include <vendorcode/google/chromeos/gnvs.h>
-
-void gnvs_assign_chromeos(void *gnvs_section)
-{
- chromeos_acpi_t *gnvs_chromeos = gnvs_section;
-
- chromeos_init_chromeos_acpi(gnvs_chromeos);
-
- /* EC can override to ECFW_RW. */
- gnvs_chromeos->vbt2 = ACTIVE_ECFW_RO;
-
- if (CONFIG(EC_GOOGLE_CHROMEEC) && !google_ec_running_ro())
- gnvs_chromeos->vbt2 = ACTIVE_ECFW_RW;
-}
-
-void gnvs_set_ecfw_rw(void)
-{
- chromeos_acpi_t *gnvs_chromeos = chromeos_get_chromeos_acpi();
- if (!gnvs_chromeos)
- return;
-
- gnvs_chromeos->vbt2 = ACTIVE_ECFW_RW;
-}
-
-void smbios_type0_bios_version(uintptr_t address)
-{
- chromeos_acpi_t *gnvs_chromeos = chromeos_get_chromeos_acpi();
- if (!gnvs_chromeos)
- return;
-
- /* Location of smbios_type0.bios_version() string filled with spaces. */
- gnvs_chromeos->vbt10 = address;
-}
diff --git a/src/acpi/gnvs.c b/src/acpi/gnvs.c
index 3decebbcb0..fc1a70db06 100644
--- a/src/acpi/gnvs.c
+++ b/src/acpi/gnvs.c
@@ -38,8 +38,10 @@ void acpi_create_gnvs(void)
if (CONFIG(CONSOLE_CBMEM))
gnvs->cbmc = (uintptr_t)cbmem_find(CBMEM_ID_CONSOLE);
- if (CONFIG(CHROMEOS_NVS))
- gnvs_assign_chromeos((u8 *)gnvs + GNVS_CHROMEOS_ACPI_OFFSET);
+ if (CONFIG(CHROMEOS_NVS)) {
+ chromeos_acpi_t *init = (void *)((u8 *)gnvs + GNVS_CHROMEOS_ACPI_OFFSET);
+ chromeos_init_chromeos_acpi(init);
+ }
}
void *acpi_get_gnvs(void)
diff --git a/src/include/acpi/acpi_gnvs.h b/src/include/acpi/acpi_gnvs.h
index 86d68a4d31..f24f5ef5ce 100644
--- a/src/include/acpi/acpi_gnvs.h
+++ b/src/include/acpi/acpi_gnvs.h
@@ -17,7 +17,6 @@ static inline void *acpi_get_gnvs(void) { return NULL; }
static inline int acpi_reset_gnvs_for_wake(struct global_nvs **gnvs) { return -1; }
#endif
-void gnvs_assign_chromeos(void *gnvs_section);
void gnvs_set_ecfw_rw(void);
/*
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h
index 233078baea..2b7be90912 100644
--- a/src/vendorcode/google/chromeos/chromeos.h
+++ b/src/vendorcode/google/chromeos/chromeos.h
@@ -29,6 +29,7 @@ void mainboard_prepare_cr50_reset(void);
void cbmem_add_vpd_calibration_data(void);
void chromeos_set_me_hash(u32*, int);
+void chromeos_set_ramoops(void *ram_oops, size_t size);
/**
* 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 024dbe3bfa..6e0e9f82db 100644
--- a/src/vendorcode/google/chromeos/gnvs.c
+++ b/src/vendorcode/google/chromeos/gnvs.c
@@ -1,14 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <acpi/acpi_gnvs.h>
#include <types.h>
#include <string.h>
#include <stdlib.h>
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
+#include <ec/google/chromeec/ec.h>
#include <fmap.h>
#include <security/vboot/vbnv.h>
#include <security/vboot/vboot_common.h>
+#include <smbios.h>
#include "chromeos.h"
#include "gnvs.h"
@@ -45,6 +48,12 @@ void chromeos_init_chromeos_acpi(chromeos_acpi_t *init)
chromeos_acpi->vpd_rw_base = vpd_base;
chromeos_acpi->vpd_rw_size = vpd_size;
}
+
+ /* EC can override to ECFW_RW. */
+ chromeos_acpi->vbt2 = ACTIVE_ECFW_RO;
+
+ if (CONFIG(EC_GOOGLE_CHROMEEC) && !google_ec_running_ro())
+ chromeos_acpi->vbt2 = ACTIVE_ECFW_RW;
}
void chromeos_set_me_hash(u32 *hash, int len)
@@ -57,7 +66,27 @@ void chromeos_set_me_hash(u32 *hash, int len)
memcpy(chromeos_acpi->mehh, hash, len*sizeof(u32));
}
-chromeos_acpi_t *chromeos_get_chromeos_acpi(void)
+void chromeos_set_ramoops(void *ram_oops, size_t size)
+{
+ if (!chromeos_acpi)
+ return;
+
+ printk(BIOS_DEBUG, "Ramoops buffer: 0x%zx@%p.\n", size, ram_oops);
+ chromeos_acpi->ramoops_base = (uintptr_t)ram_oops;
+ chromeos_acpi->ramoops_len = size;
+}
+
+void gnvs_set_ecfw_rw(void)
+{
+ if (!chromeos_acpi)
+ return;
+ chromeos_acpi->vbt2 = ACTIVE_ECFW_RW;
+}
+
+void smbios_type0_bios_version(uintptr_t address)
{
- return chromeos_acpi;
+ if (!chromeos_acpi)
+ return;
+ /* Location of smbios_type0.bios_version() string filled with spaces. */
+ chromeos_acpi->vbt10 = address;
}
diff --git a/src/vendorcode/google/chromeos/gnvs.h b/src/vendorcode/google/chromeos/gnvs.h
index 3f47a33f9a..8f8e259e8a 100644
--- a/src/vendorcode/google/chromeos/gnvs.h
+++ b/src/vendorcode/google/chromeos/gnvs.h
@@ -42,6 +42,5 @@ typedef struct {
} __packed chromeos_acpi_t;
void chromeos_init_chromeos_acpi(chromeos_acpi_t *init);
-chromeos_acpi_t *chromeos_get_chromeos_acpi(void);
#endif
diff --git a/src/vendorcode/google/chromeos/ramoops.c b/src/vendorcode/google/chromeos/ramoops.c
index 3b658b70e5..1e3d7f009f 100644
--- a/src/vendorcode/google/chromeos/ramoops.c
+++ b/src/vendorcode/google/chromeos/ramoops.c
@@ -7,22 +7,7 @@
#include <bootstate.h>
#include <console/console.h>
#include <cbmem.h>
-#include <device/device.h>
#include "chromeos.h"
-#include "gnvs.h"
-
-static void set_ramoops(void *ram_oops, size_t size)
-{
- chromeos_acpi_t *chromeos = chromeos_get_chromeos_acpi();
- if (chromeos == NULL) {
- printk(BIOS_DEBUG, "chromeos gnvs is NULL. ramoops not set.\n");
- return;
- }
-
- printk(BIOS_DEBUG, "Ramoops buffer: 0x%zx@%p.\n", size, ram_oops);
- chromeos->ramoops_base = (uintptr_t)ram_oops;
- chromeos->ramoops_len = size;
-}
static void ramoops_alloc(void *arg)
{
@@ -39,7 +24,7 @@ static void ramoops_alloc(void *arg)
}
if (CONFIG(CHROMEOS_NVS))
- set_ramoops(ram_oops, size);
+ chromeos_set_ramoops(ram_oops, size);
}
BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY, ramoops_alloc, NULL);