From efb546dfeb5dfe13ad4d4d0e8db577be9b4069b8 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Sat, 8 Nov 2014 17:34:27 -0800 Subject: ramoops: Add support for passing ramoops region through cb tables. CQ-DEPEND=CL:228856 BUG=chrome-os-partner:33676 BRANCH=None TEST=ramoops buffer verified on ryu. Original-Change-Id: I29584f89ded0c22c4f255a40951a179b54761053 Original-Signed-off-by: Furquan Shaikh Original-Reviewed-on: https://chromium-review.googlesource.com/228744 Original-Reviewed-by: Aaron Durbin Original-Commit-Queue: Furquan Shaikh Original-Tested-by: Furquan Shaikh (cherry picked from commit e8b2c8b75c51160df177edc14c90e5bd3836e931) Signed-off-by: Aaron Durbin Change-Id: I5fdeb59056945a602584584edce9c782151ca8ea Reviewed-on: http://review.coreboot.org/9442 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/vendorcode/google/chromeos/Kconfig | 5 +++++ src/vendorcode/google/chromeos/ramoops.c | 33 +++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) (limited to 'src/vendorcode/google/chromeos') diff --git a/src/vendorcode/google/chromeos/Kconfig b/src/vendorcode/google/chromeos/Kconfig index a0ab55d596..29252a66b3 100644 --- a/src/vendorcode/google/chromeos/Kconfig +++ b/src/vendorcode/google/chromeos/Kconfig @@ -76,6 +76,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 diff --git a/src/vendorcode/google/chromeos/ramoops.c b/src/vendorcode/google/chromeos/ramoops.c index f7177e5397..07649c975c 100644 --- a/src/vendorcode/google/chromeos/ramoops.c +++ b/src/vendorcode/google/chromeos/ramoops.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -99,4 +100,34 @@ void chromeos_ram_oops_init(chromeos_acpi_t *chromeos) reserve_ram_oops_dynamic(chromeos); } -#endif /* CONFIG_HAVE_ACPI_TABLES */ +#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_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; +} -- cgit v1.2.3