From 6051e8334eb46651f069138bdcd5c7285c0b4026 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Tue, 29 Jul 2014 17:51:29 -0700 Subject: 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 Original-Commit-Id: 723e4a600a5d3a03e960169b04f8322f6dd2486b Original-Change-Id: I7847bd9fe2d000a29c7ae95144f4868d926fb198 Original-Signed-off-by: Vadim Bendebury Original-Reviewed-on: https://chromium-review.googlesource.com/210430 Original-Reviewed-by: Julius Werner Reviewed-on: http://review.coreboot.org/8730 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- payloads/libpayload/arch/x86/coreboot.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'payloads/libpayload/arch/x86/coreboot.c') diff --git a/payloads/libpayload/arch/x86/coreboot.c b/payloads/libpayload/arch/x86/coreboot.c index a4635576a3..43fde9f660 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; -- cgit v1.2.3