summaryrefslogtreecommitdiff
path: root/src/vendorcode/google
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-02-12 18:43:36 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-04-30 06:46:07 +0000
commit8a1fcf475401f32208c48376205a443a3acbf5c1 (patch)
tree53f94d48a2d0fd877171ad69209255592207875f /src/vendorcode/google
parent715cdc370c6dcfd47f247de9ff8ccd24f0a2fa03 (diff)
vc/google/chromeos: Refactor GNVS init
Move the support code for filling ChromeOS GNVS from acpi/chromeos-gnvs.c to vc/google/chromeos/gnvs.c. Change-Id: I7e92206561812eb3dc69739df49b6c3a93853858 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50612 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Lance Zhao Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/vendorcode/google')
-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
4 files changed, 33 insertions, 19 deletions
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);