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>
This commit is contained in:
Kyösti Mälkki 2021-02-10 20:05:50 +02:00
parent 4988900789
commit fca1797757
3 changed files with 11 additions and 28 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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)
static void ramoops_alloc(void *arg)
{
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;
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);