[coreboot-gerrit] New patch to review for coreboot: 82b3204 ramoops: Add support for passing ramoops region through cb tables.

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Wed Apr 8 22:58:02 CEST 2015


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9442

-gerrit

commit 82b3204a5997ee4bb8f90c2310214c8c5f9ef1ab
Author: Furquan Shaikh <furquan at google.com>
Date:   Sat Nov 8 17:34:27 2014 -0800

    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 <furquan at google.com>
    Original-Reviewed-on: https://chromium-review.googlesource.com/228744
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
    Original-Commit-Queue: Furquan Shaikh <furquan at chromium.org>
    Original-Tested-by: Furquan Shaikh <furquan at chromium.org>
    
    (cherry picked from commit e8b2c8b75c51160df177edc14c90e5bd3836e931)
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
    
    Change-Id: I5fdeb59056945a602584584edce9c782151ca8ea
---
 src/include/boot/coreboot_tables.h       |  3 +++
 src/lib/coreboot_table.c                 |  4 ++++
 src/vendorcode/google/chromeos/Kconfig   |  5 +++++
 src/vendorcode/google/chromeos/ramoops.c | 36 +++++++++++++++++++++++++++++++-
 4 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h
index d9df787..7bc3ddb 100644
--- a/src/include/boot/coreboot_tables.h
+++ b/src/include/boot/coreboot_tables.h
@@ -227,6 +227,7 @@ struct lb_gpios {
 #define LB_TAG_VBNV		0x0019
 #define LB_TAB_VBOOT_HANDOFF	0x0020
 #define LB_TAB_DMA		0x0022
+#define LB_TAG_RAM_OOPS		0x0023
 struct lb_range {
 	uint32_t tag;
 	uint32_t size;
@@ -235,6 +236,8 @@ struct lb_range {
 	uint32_t range_size;
 };
 
+void lb_ramoops(struct lb_header *header);
+
 #define LB_TAG_TIMESTAMPS	0x0016
 #define LB_TAG_CBMEM_CONSOLE	0x0017
 #define LB_TAG_MRC_CACHE	0x0018
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index a514bb9..8785d04 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -546,6 +546,10 @@ unsigned long write_coreboot_table(
 	/* Add board-specific table entries, if any. */
 	lb_board(head);
 
+#if IS_ENABLED(CONFIG_CHROMEOS_RAMOOPS)
+	lb_ramoops(head);
+#endif
+
 	/* Remember where my valid memory ranges are */
 	return lb_table_fini(head);
 }
diff --git a/src/vendorcode/google/chromeos/Kconfig b/src/vendorcode/google/chromeos/Kconfig
index a0ab55d..29252a6 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 f7177e5..566770d 100644
--- a/src/vendorcode/google/chromeos/ramoops.c
+++ b/src/vendorcode/google/chromeos/ramoops.c
@@ -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);
 }
 
-#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_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;
+}



More information about the coreboot-gerrit mailing list