[coreboot-gerrit] New patch to review for coreboot: c63b78c libpayload: Add RAM code to sysinfo_t

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Mar 19 12:24:29 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8755

-gerrit

commit c63b78cb4e585750632f6df6a4376089ed3e9ea2
Author: David Hendricks <dhendrix at chromium.org>
Date:   Thu Nov 20 13:59:45 2014 -0800

    libpayload: Add RAM code to sysinfo_t
    
    This adds CB_TAG_RAM_CODE and an entry to sysinfo_t.
    
    BUG=chrome-os-partner:31728
    BRANCH=none
    TEST=Built and booted on pinky w/ depthcharge patch and saw that
    /proc/device-tree/firmware/coreboot/ram-code contains correct
    value
    
    Change-Id: I35ee1bcdc77bc6d4d24c1e804aefdbbfaa3875a4
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: ca6d044f2e719ded1d78a5ab3d923e06c3b88d6b
    Original-Signed-off-by: David Hendricks <dhendrix at chromium.org>
    Original-Change-Id: I69ee1fc7bc09c9d1c387efe2d171c57e62cfaf3f
    Original-Reviewed-on: https://chromium-review.googlesource.com/231132
    Original-Reviewed-by: Julius Werner <jwerner at chromium.org>
---
 payloads/libpayload/include/coreboot_tables.h |  7 +++++++
 payloads/libpayload/include/sysinfo.h         |  1 +
 payloads/libpayload/libc/coreboot.c           | 15 +++++++++++++--
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index e9c159d..a3a0a05 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -239,6 +239,13 @@ struct cb_macs {
 	struct mac_address mac_addrs[0];
 };
 
+#define CB_TAG_RAM_CODE		0x0028
+struct cb_ram_code {
+	uint32_t tag;
+	uint32_t size;
+	uint32_t ram_code;
+};
+
 #define CB_TAG_CMOS_OPTION_TABLE 0x00c8
 struct cb_cmos_option_table {
 	u32 tag;
diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h
index d428dc4..fa4a098 100644
--- a/payloads/libpayload/include/sysinfo.h
+++ b/payloads/libpayload/include/sysinfo.h
@@ -114,6 +114,7 @@ struct sysinfo_t {
 	void	*mrc_cache;
 	void	*acpi_gnvs;
 	u32     board_id;
+	u32	ram_code;
 	void	*wifi_calibration;
 	uint64_t ramoops_buffer;
 	uint32_t ramoops_buffer_size;
diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c
index 489adf4..1f1cf32 100644
--- a/payloads/libpayload/libc/coreboot.c
+++ b/payloads/libpayload/libc/coreboot.c
@@ -154,6 +154,12 @@ static void cb_parse_board_id(unsigned char *ptr, struct sysinfo_t *info)
 	info->board_id = cbbid->board_id;
 }
 
+static void cb_parse_ram_code(unsigned char *ptr, struct sysinfo_t *info)
+{
+	struct cb_ram_code *const ram_code = (struct cb_ram_code *)ptr;
+	info->ram_code = ram_code->ram_code;
+}
+
 #ifdef CONFIG_LP_NVRAM
 static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
 {
@@ -228,10 +234,12 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 	info->header = header;
 
 	/*
-	 * Valid board IDs are small numbers, preset this to an invalid value
-	 * for the case when firmware does not supply the board ID.
+	 * Board straps represented by numerical values are small numbers.
+	 * Preset them to an invalid value in case the firmware does not
+	 * supply the info.
 	 */
 	info->board_id = ~0;
+	info->ram_code = ~0;
 
 	/* Now, walk the tables. */
 	ptr += header->header_bytes;
@@ -329,6 +337,9 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 		case CB_TAG_BOARD_ID:
 			cb_parse_board_id(ptr, info);
 			break;
+		case CB_TAG_RAM_CODE:
+			cb_parse_ram_code(ptr, info);
+			break;
 		case CB_TAG_WIFI_CALIBRATION:
 			cb_parse_wifi_calibration(ptr, info);
 			break;



More information about the coreboot-gerrit mailing list