vc/google/chromeos: Always use CHROMEOS_RAMOOPS_DYNAMIC

Always allocate RAMOOPS from CBMEM and drop the related
static variable CHROMEOS_RAMOOPS_RAM_START.

Change-Id: Icfcf2991cb78cc6e9becba14cac77a04d8ada56a
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50608
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kyösti Mälkki
2021-02-10 19:31:26 +02:00
parent 11c6b8b531
commit fce36e448d
17 changed files with 3 additions and 111 deletions

View File

@ -29,21 +29,6 @@ config CHROMEOS_RAMOOPS
bool "Reserve space for Chrome OS ramoops"
default y
config CHROMEOS_RAMOOPS_DYNAMIC
bool "Allocate RAM oops buffer in cbmem"
default n
depends on CHROMEOS_RAMOOPS && HAVE_ACPI_TABLES
config CHROMEOS_RAMOOPS_NON_ACPI
bool "Allocate RAM oops buffer in cbmem passed through cb tables to payload"
default y if !HAVE_ACPI_TABLES
depends on CHROMEOS_RAMOOPS && !HAVE_ACPI_TABLES
config CHROMEOS_RAMOOPS_RAM_START
hex "Physical address of preserved RAM"
default 0x00f00000
depends on CHROMEOS_RAMOOPS && !CHROMEOS_RAMOOPS_DYNAMIC
config CHROMEOS_RAMOOPS_RAM_SIZE
hex "Size of preserved RAM"
default 0x00100000

View File

@ -27,10 +27,7 @@ static inline void reboot_from_watchdog(void) { return; }
*/
void mainboard_prepare_cr50_reset(void);
struct romstage_handoff;
#include "gnvs.h"
struct device;
#if CONFIG(CHROMEOS_RAMOOPS)
void chromeos_ram_oops_init(chromeos_acpi_t *chromeos);
@ -38,8 +35,6 @@ void chromeos_ram_oops_init(chromeos_acpi_t *chromeos);
static inline void chromeos_ram_oops_init(chromeos_acpi_t *chromeos) {}
#endif /* CONFIG_CHROMEOS_RAMOOPS */
void chromeos_reserve_ram_oops(struct device *dev, int idx);
void cbmem_add_vpd_calibration_data(void);
void chromeos_set_me_hash(u32*, int);
@ -66,6 +61,7 @@ void chromeos_acpi_gpio_generate(const struct cros_gpio *gpios, size_t num);
*/
void mainboard_chromeos_acpi_generate(void);
#if CONFIG(CHROMEOS)
struct device;
void chromeos_dsdt_generator(const struct device *dev);
#else
#define chromeos_dsdt_generator NULL

View File

@ -24,66 +24,17 @@ static void set_ramoops(chromeos_acpi_t *chromeos, void *ram_oops, size_t size)
chromeos->ramoops_len = size;
}
static void reserve_ram_oops_dynamic(chromeos_acpi_t *chromeos)
void chromeos_ram_oops_init(chromeos_acpi_t *chromeos)
{
const size_t size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE;
void *ram_oops;
if (!CONFIG(CHROMEOS_RAMOOPS_DYNAMIC))
return;
ram_oops = cbmem_add(CBMEM_ID_RAM_OOPS, size);
set_ramoops(chromeos, ram_oops, size);
}
#if CONFIG(CHROMEOS_RAMOOPS_DYNAMIC)
static inline void set_global_chromeos_pointer(chromeos_acpi_t *chromeos) {}
#else /* !CONFIG_CHROMEOS_RAMOOPS_DYNAMIC */
static const unsigned long ramoops_base = CONFIG_CHROMEOS_RAMOOPS_RAM_START;
static const unsigned long ramoops_size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE;
/*
* Save pointer to chromeos structure in memory. This is needed because the
* memory reservation is not done when chromeos_init() is called. However,
* the pointer to the chromeos_acpi_t structure is needed to update the
* fields with the rserved base and size.
*/
static chromeos_acpi_t *g_chromeos;
static void set_global_chromeos_pointer(chromeos_acpi_t *chromeos)
{
g_chromeos = chromeos;
}
static void update_gnvs(void *arg)
{
chromeos_acpi_t **chromeos = arg;
set_ramoops(*chromeos, (void *)ramoops_base, ramoops_size);
}
static BOOT_STATE_CALLBACK(bscb_ramoops, update_gnvs, &g_chromeos);
void chromeos_reserve_ram_oops(struct device *dev, int idx)
{
const unsigned long base = ramoops_base >> 10;
const unsigned long size = ramoops_size >> 10;
reserved_ram_resource(dev, idx, base, size);
boot_state_sched_on_exit(&bscb_ramoops, BS_WRITE_TABLES);
}
#endif /* CONFIG_CHROMEOS_RAMOOPS_DYNAMIC */
void chromeos_ram_oops_init(chromeos_acpi_t *chromeos)
{
set_global_chromeos_pointer(chromeos);
reserve_ram_oops_dynamic(chromeos);
}
#elif CONFIG(CHROMEOS_RAMOOPS_NON_ACPI)
#else
static void ramoops_alloc(void *arg)
{