summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-02-10 20:05:50 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2021-02-17 22:58:10 +0000
commitfca179775708686d05dc732ad33099963ff4a75e (patch)
tree309884c2276e1b5add19094533e572acc00b6772
parent49889007891de8830428c3092cc6b0977ca165eb (diff)
vc/google/chromeos: Allocate RAMOOPS late
The allocation is for the OS. Just need to take care in the firmware that ChromeOS GNVS is allocated first. Change-Id: I16db41b31751d7b4a8a70e638602f3f537fe392e Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50609 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/vendorcode/google/chromeos/chromeos.h8
-rw-r--r--src/vendorcode/google/chromeos/gnvs.c2
-rw-r--r--src/vendorcode/google/chromeos/ramoops.c29
3 files changed, 11 insertions, 28 deletions
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h
index 35e2dde740..233078baea 100644
--- a/src/vendorcode/google/chromeos/chromeos.h
+++ b/src/vendorcode/google/chromeos/chromeos.h
@@ -27,14 +27,6 @@ static inline void reboot_from_watchdog(void) { return; }
*/
void mainboard_prepare_cr50_reset(void);
-#include "gnvs.h"
-
-#if CONFIG(CHROMEOS_RAMOOPS)
-void chromeos_ram_oops_init(chromeos_acpi_t *chromeos);
-#else /* !CONFIG_CHROMEOS_RAMOOPS */
-static inline void chromeos_ram_oops_init(chromeos_acpi_t *chromeos) {}
-#endif /* CONFIG_CHROMEOS_RAMOOPS */
-
void cbmem_add_vpd_calibration_data(void);
void chromeos_set_me_hash(u32*, int);
diff --git a/src/vendorcode/google/chromeos/gnvs.c b/src/vendorcode/google/chromeos/gnvs.c
index f0e8e5b913..62d19d6d51 100644
--- a/src/vendorcode/google/chromeos/gnvs.c
+++ b/src/vendorcode/google/chromeos/gnvs.c
@@ -38,8 +38,6 @@ void chromeos_init_chromeos_acpi(chromeos_acpi_t *init)
/* Copy saved ME hash into NVS */
memcpy(chromeos_acpi->mehh, me_hash_saved, sizeof(chromeos_acpi->mehh));
- chromeos_ram_oops_init(chromeos_acpi);
-
vpd_size = chromeos_vpd_region("RO_VPD", &vpd_base);
if (vpd_size && vpd_base) {
chromeos_acpi->vpd_ro_base = vpd_base;
diff --git a/src/vendorcode/google/chromeos/ramoops.c b/src/vendorcode/google/chromeos/ramoops.c
index ae72133d11..77e079f2b1 100644
--- a/src/vendorcode/google/chromeos/ramoops.c
+++ b/src/vendorcode/google/chromeos/ramoops.c
@@ -9,11 +9,11 @@
#include <cbmem.h>
#include <device/device.h>
#include "chromeos.h"
+#include "gnvs.h"
-#if CONFIG(HAVE_ACPI_TABLES)
-
-static void set_ramoops(chromeos_acpi_t *chromeos, void *ram_oops, size_t size)
+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;
@@ -24,33 +24,26 @@ static void set_ramoops(chromeos_acpi_t *chromeos, void *ram_oops, size_t size)
chromeos->ramoops_len = size;
}
-void chromeos_ram_oops_init(chromeos_acpi_t *chromeos)
-{
- const size_t size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE;
- void *ram_oops;
-
- ram_oops = cbmem_add(CBMEM_ID_RAM_OOPS, size);
-
- set_ramoops(chromeos, ram_oops, size);
-}
-
-#else
-
static void ramoops_alloc(void *arg)
{
const size_t size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE;
+ void *ram_oops;
if (size == 0)
return;
- if (cbmem_add(CBMEM_ID_RAM_OOPS, size) == NULL)
+ ram_oops = cbmem_add(CBMEM_ID_RAM_OOPS, size);
+ if (ram_oops == NULL) {
printk(BIOS_ERR, "Could not allocate RAMOOPS buffer\n");
+ return;
+ }
+
+ if (CONFIG(HAVE_ACPI_TABLES))
+ set_ramoops(ram_oops, size);
}
BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY, ramoops_alloc, NULL);
-#endif
-
void lb_ramoops(struct lb_header *header)
{
void *buffer = cbmem_find(CBMEM_ID_RAM_OOPS);