[coreboot-gerrit] Patch set updated for coreboot: 017a7b0 libpayload: Add board id parsing

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Fri Mar 20 11:18:30 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/8730

-gerrit

commit 017a7b0c598cbc134d9c4991c136db6d4fa9478b
Author: Vadim Bendebury <vbendeb at chromium.org>
Date:   Tue Jul 29 17:51:29 2014 -0700

    libpayload: Add board id parsing
    
    Make board ID value supplied in the coreboot table available to the
    bootloader on all three architectures.
    
    BUG=chrome-os-partner:30489
    TEST=none yet
    
    Change-Id: I6c2d39e94212b55650929d7d99896581d23f789d
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: 723e4a600a5d3a03e960169b04f8322f6dd2486b
    Original-Change-Id: I7847bd9fe2d000a29c7ae95144f4868d926fb198
    Original-Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/210430
    Original-Reviewed-by: Julius Werner <jwerner at chromium.org>
---
 payloads/libpayload/arch/arm/coreboot.c       | 15 +++++++++++++++
 payloads/libpayload/arch/arm64/coreboot.c     | 15 +++++++++++++++
 payloads/libpayload/arch/x86/coreboot.c       | 15 +++++++++++++++
 payloads/libpayload/include/coreboot_tables.h |  8 ++++++++
 payloads/libpayload/include/sysinfo.h         |  1 +
 5 files changed, 54 insertions(+)

diff --git a/payloads/libpayload/arch/arm/coreboot.c b/payloads/libpayload/arch/arm/coreboot.c
index c7f371e..a1c3675 100644
--- a/payloads/libpayload/arch/arm/coreboot.c
+++ b/payloads/libpayload/arch/arm/coreboot.c
@@ -143,6 +143,12 @@ static void cb_parse_mrc_cache(unsigned char *ptr, struct sysinfo_t *info)
 	info->mrc_cache = phys_to_virt(cbmem->cbmem_tab);
 }
 
+static void cb_parse_board_id(unsigned char *ptr, struct sysinfo_t *info)
+{
+	struct cb_board_id *const cbbid = (struct cb_board_id *)ptr;
+	info->board_id = cbbid->board_id;
+}
+
 #ifdef CONFIG_LP_NVRAM
 static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
 {
@@ -196,6 +202,12 @@ static int cb_parse_header(void *addr, 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.
+	 */
+	info->board_id = ~0;
+
 	/* Now, walk the tables. */
 	ptr += header->header_bytes;
 
@@ -288,6 +300,9 @@ static int cb_parse_header(void *addr, struct sysinfo_t *info)
 		case CB_TAG_MRC_CACHE:
 			cb_parse_mrc_cache(ptr, info);
 			break;
+		case CB_TAG_BOARD_ID:
+			cb_parse_board_id(ptr, info);
+			break;
 		}
 
 		ptr += rec->size;
diff --git a/payloads/libpayload/arch/arm64/coreboot.c b/payloads/libpayload/arch/arm64/coreboot.c
index 6c671c8..6d7c955 100644
--- a/payloads/libpayload/arch/arm64/coreboot.c
+++ b/payloads/libpayload/arch/arm64/coreboot.c
@@ -143,6 +143,12 @@ static void cb_parse_mrc_cache(unsigned char *ptr, struct sysinfo_t *info)
 	info->mrc_cache = phys_to_virt(cbmem->cbmem_tab);
 }
 
+static void cb_parse_board_id(unsigned char *ptr, struct sysinfo_t *info)
+{
+	struct cb_board_id *const cbbid = (struct cb_board_id *)ptr;
+	info->board_id = cbbid->board_id;
+}
+
 #ifdef CONFIG_LP_NVRAM
 static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
 {
@@ -196,6 +202,12 @@ static int cb_parse_header(void *addr, 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.
+	 */
+	info->board_id = ~0;
+
 	/* Now, walk the tables. */
 	ptr += header->header_bytes;
 
@@ -288,6 +300,9 @@ static int cb_parse_header(void *addr, struct sysinfo_t *info)
 		case CB_TAG_MRC_CACHE:
 			cb_parse_mrc_cache(ptr, info);
 			break;
+		case CB_TAG_BOARD_ID:
+			cb_parse_board_id(ptr, info);
+			break;
 		}
 
 		ptr += rec->size;
diff --git a/payloads/libpayload/arch/x86/coreboot.c b/payloads/libpayload/arch/x86/coreboot.c
index a463557..43fde9f 100644
--- a/payloads/libpayload/arch/x86/coreboot.c
+++ b/payloads/libpayload/arch/x86/coreboot.c
@@ -141,6 +141,12 @@ static void cb_parse_acpi_gnvs(unsigned char *ptr, struct sysinfo_t *info)
 	info->acpi_gnvs = phys_to_virt(cbmem->cbmem_tab);
 }
 
+static void cb_parse_board_id(unsigned char *ptr, struct sysinfo_t *info)
+{
+	struct cb_board_id *const cbbid = (struct cb_board_id *)ptr;
+	info->board_id = cbbid->board_id;
+}
+
 #ifdef CONFIG_LP_NVRAM
 static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
 {
@@ -206,6 +212,12 @@ static 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.
+	 */
+	info->board_id = ~0;
+
 	/* Now, walk the tables. */
 	ptr += header->header_bytes;
 
@@ -300,6 +312,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 		case CB_TAG_X86_ROM_MTRR:
 			cb_parse_x86_rom_var_mtrr(ptr, info);
 			break;
+		case CB_TAG_BOARD_ID:
+			cb_parse_board_id(ptr, info);
+			break;
 		}
 
 		ptr += rec->size;
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index e20249d..53b5890 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -205,6 +205,14 @@ struct cb_cbmem_tab {
 	uint64_t cbmem_tab;
 };
 
+#define CB_TAG_BOARD_ID		0x0025
+struct cb_board_id {
+	uint32_t tag;
+	uint32_t size;
+	/* Board ID as retrieved from the board revision GPIOs. */
+	uint32_t board_id;
+};
+
 #define CB_TAG_X86_ROM_MTRR	0x0021
 struct cb_x86_rom_mtrr {
 	uint32_t tag;
diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h
index 92b8dca..afcf3d8 100644
--- a/payloads/libpayload/include/sysinfo.h
+++ b/payloads/libpayload/include/sysinfo.h
@@ -108,6 +108,7 @@ struct sysinfo_t {
 	void	*cbmem_cons;
 	void	*mrc_cache;
 	void	*acpi_gnvs;
+	u32	board_id;
 };
 
 extern struct sysinfo_t lib_sysinfo;



More information about the coreboot-gerrit mailing list