summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-12-05 13:43:56 -0800
committerJulius Werner <jwerner@chromium.org>2017-12-07 01:18:30 +0000
commit2e029ac6a67a3d4ceb6e4825217e60f062ab7e65 (patch)
tree243b96a39ae17c3f71d43e71c96c53ed3a8f6a2c /payloads/libpayload
parente2f17f782f6a9236259f2c25ac30d35dc24d45bb (diff)
downloadcoreboot-2e029ac6a67a3d4ceb6e4825217e60f062ab7e65.tar.xz
libpayload: Minor board ID / RAM code cleanups
This patch mirrors recent cleanups in coreboot regarding the strapping ID entries in the coreboot table. Change-Id: Ia5c3728daf2cb317f8e2bc72c6f1714d6cb4d080 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/22742 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/include/coreboot_tables.h14
-rw-r--r--payloads/libpayload/include/sysinfo.h3
-rw-r--r--payloads/libpayload/libc/coreboot.c18
3 files changed, 14 insertions, 21 deletions
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index 842f206747..5bc56d0f6e 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -225,14 +225,6 @@ 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;
@@ -244,11 +236,13 @@ struct cb_x86_rom_mtrr {
uint32_t index;
};
+
+#define CB_TAG_BOARD_ID 0x0025
#define CB_TAG_RAM_CODE 0x0028
-struct cb_ram_code {
+struct cb_strapping_id {
uint32_t tag;
uint32_t size;
- uint32_t ram_code;
+ uint32_t id_code;
};
#define CB_TAG_SPI_FLASH 0x0029
diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h
index 2e5a837b70..b46d4b1311 100644
--- a/payloads/libpayload/include/sysinfo.h
+++ b/payloads/libpayload/include/sysinfo.h
@@ -108,8 +108,11 @@ struct sysinfo_t {
void *cbmem_cons;
void *mrc_cache;
void *acpi_gnvs;
+
+#define UNDEFINED_STRAPPING_ID (~0)
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 10b801c5ed..1efde9a332 100644
--- a/payloads/libpayload/libc/coreboot.c
+++ b/payloads/libpayload/libc/coreboot.c
@@ -147,14 +147,14 @@ static void cb_parse_acpi_gnvs(unsigned char *ptr, struct sysinfo_t *info)
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;
+ struct cb_strapping_id *const cbbid = (struct cb_strapping_id *)ptr;
+ info->board_id = cbbid->id_code;
}
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;
+ struct cb_strapping_id *const ram_code = (struct cb_strapping_id *)ptr;
+ info->ram_code = ram_code->id_code;
}
#if IS_ENABLED(CONFIG_LP_NVRAM)
@@ -277,13 +277,9 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
info->header = header;
- /*
- * 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;
+ /* Initialize IDs as undefined in case they don't show up in table. */
+ info->board_id = UNDEFINED_STRAPPING_ID;
+ info->ram_code = UNDEFINED_STRAPPING_ID;
/* Now, walk the tables. */
ptr += header->header_bytes;