libpayload: Add SKU ID coreboot table support

This patch adds support to read the SKU ID entry from the coreboot table
that was recently added in coreboot.

Change-Id: I1c3b375da6119a4f8e8e7e25a11644becb90f927
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/22743
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Julius Werner 2017-12-05 13:49:21 -08:00
parent 96ed92d49d
commit f38a10f8d2
3 changed files with 12 additions and 0 deletions

View File

@ -239,6 +239,7 @@ struct cb_x86_rom_mtrr {
#define CB_TAG_BOARD_ID 0x0025 #define CB_TAG_BOARD_ID 0x0025
#define CB_TAG_RAM_CODE 0x0028 #define CB_TAG_RAM_CODE 0x0028
#define CB_TAG_SKU_ID 0x002d
struct cb_strapping_id { struct cb_strapping_id {
uint32_t tag; uint32_t tag;
uint32_t size; uint32_t size;

View File

@ -112,6 +112,7 @@ struct sysinfo_t {
#define UNDEFINED_STRAPPING_ID (~0) #define UNDEFINED_STRAPPING_ID (~0)
u32 board_id; u32 board_id;
u32 ram_code; u32 ram_code;
u32 sku_id;
void *wifi_calibration; void *wifi_calibration;
uint64_t ramoops_buffer; uint64_t ramoops_buffer;

View File

@ -157,6 +157,12 @@ static void cb_parse_ram_code(unsigned char *ptr, struct sysinfo_t *info)
info->ram_code = ram_code->id_code; info->ram_code = ram_code->id_code;
} }
static void cb_parse_sku_id(unsigned char *ptr, struct sysinfo_t *info)
{
struct cb_strapping_id *const sku_id = (struct cb_strapping_id *)ptr;
info->sku_id = sku_id->id_code;
}
#if IS_ENABLED(CONFIG_LP_NVRAM) #if IS_ENABLED(CONFIG_LP_NVRAM)
static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info) static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
{ {
@ -280,6 +286,7 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
/* Initialize IDs as undefined in case they don't show up in table. */ /* Initialize IDs as undefined in case they don't show up in table. */
info->board_id = UNDEFINED_STRAPPING_ID; info->board_id = UNDEFINED_STRAPPING_ID;
info->ram_code = UNDEFINED_STRAPPING_ID; info->ram_code = UNDEFINED_STRAPPING_ID;
info->sku_id = UNDEFINED_STRAPPING_ID;
/* Now, walk the tables. */ /* Now, walk the tables. */
ptr += header->header_bytes; ptr += header->header_bytes;
@ -380,6 +387,9 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
case CB_TAG_RAM_CODE: case CB_TAG_RAM_CODE:
cb_parse_ram_code(ptr, info); cb_parse_ram_code(ptr, info);
break; break;
case CB_TAG_SKU_ID:
cb_parse_sku_id(ptr, info);
break;
case CB_TAG_WIFI_CALIBRATION: case CB_TAG_WIFI_CALIBRATION:
cb_parse_wifi_calibration(ptr, info); cb_parse_wifi_calibration(ptr, info);
break; break;