ramoops: Add support for passing ramoops buffer address and size through cb

tables.

CQ-DEPEND=CL:228856
BUG=chrome-os-partner:33676
BRANCH=None
TEST=ramoops buffer verified on ryu.

Change-Id: I29584f89ded0c22c4f255a40951a179b54761053
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/228744
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
Furquan Shaikh 2014-11-08 17:34:27 -08:00 committed by chrome-internal-fetch
commit e8b2c8b75c
4 changed files with 46 additions and 0 deletions

View file

@ -68,6 +68,11 @@ config CHROMEOS_RAMOOPS_DYNAMIC
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 n
depends on CHROMEOS_RAMOOPS && !HAVE_ACPI_TABLES
config CHROMEOS_RAMOOPS_RAM_START
hex "Physical address of preserved RAM"
default 0x00f00000

View file

@ -20,6 +20,7 @@
#include <stddef.h>
#include <stdint.h>
#include <boot/coreboot_tables.h>
#include <bootstate.h>
#include <console/console.h>
#include <cbmem.h>
@ -99,4 +100,37 @@ void chromeos_ram_oops_init(chromeos_acpi_t *chromeos)
reserve_ram_oops_dynamic(chromeos);
}
#elif IS_ENABLED(CONFIG_CHROMEOS_RAMOOPS_NON_ACPI)
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)
printk(BIOS_ERR, "Could not allocate RAMOOPS buffer\n");
}
BOOT_STATE_INIT_ENTRIES(bscb_ramoops) = {
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);
if (buffer == NULL)
return;
struct lb_range *ramoops;
ramoops = (struct lb_range *)lb_new_record(header);
ramoops->tag = LB_TAG_RAM_OOPS;
ramoops->size = sizeof(*ramoops);
ramoops->range_start = (uintptr_t)buffer;
ramoops->range_size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE;
}