Vadim Bendebury (vbendeb@chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11125
-gerrit
commit 763d04eda4c518e8181460c86f3907e49a8d4659 Author: Vadim Bendebury vbendeb@chromium.org Date: Thu Aug 6 14:11:40 2015 -0700
Clean up coreboot and libpayload tag definitions
The coreboot table tags used to differentiate between different optional components of the coreboot table are defined all over the place in the include file. This makes it difficult to avoid accidental duplication.
Defining them in one place will make code maintenance much easier. There were a few conflicts in the table which have now been resolved. This change will require simultaneous rebuild of coreboot and libpayload.
No actual testing has been done with this patch.
Change-Id: Ia8457213456ad53d26d4b3fb24a27459f8ffff75 Signed-off-by: Vadim Bendebury vbendeb@chromium.org --- payloads/libpayload/include/coreboot_tables.h | 143 +++++++++++++++++--------- src/include/boot/coreboot_tables.h | 143 +++++++++++++++++--------- 2 files changed, 188 insertions(+), 98 deletions(-)
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h index 24cbf45..4593f78 100644 --- a/payloads/libpayload/include/coreboot_tables.h +++ b/payloads/libpayload/include/coreboot_tables.h @@ -37,6 +37,59 @@ struct cbuint64 { u32 lo; u32 hi; }; +/* + * Various coreboot table structure tags. Keep them all here, sorted by value. + * Make sure they are in sync with values defined in + * src/include/boot/coreboot_tables.h. + */ +#define CB_TAG_UNUSED 0x0000 +#define CB_TAG_MEMORY 0x0001 +#define CB_TAG_HWRPB 0x0002 +#define CB_TAG_MAINBOARD 0x0003 +#define CB_TAG_VERSION 0x0004 +#define CB_TAG_EXTRA_VERSION 0x0005 +#define CB_TAG_BUILD 0x0006 +#define CB_TAG_COMPILE_TIME 0x0007 +#define CB_TAG_COMPILE_BY 0x0008 +#define CB_TAG_COMPILE_HOST 0x0009 +#define CB_TAG_COMPILE_DOMAIN 0x000a +#define CB_TAG_COMPILER 0x000b +#define CB_TAG_LINKER 0x000c +#define CB_TAG_ASSEMBLER 0x000d +#define CB_TAG_CONSOLE_SERIAL8250 0x000e +#define CB_TAG_SERIAL 0x000f +#define CB_TAG_CONSOLE 0x0010 +#define CB_TAG_FORWARD 0x0011 +#define CB_TAG_FRAMEBUFFER 0x0012 +#define CB_TAG_GPIO 0x0013 +#define CB_TAG_CONSOLE_SERIAL8250MEM 0x0014 +#define CB_TAG_VDAT 0x0015 +#define CB_TAG_TIMESTAMPS 0x0016 +#define CB_TAG_CBMEM_CONSOLE 0x0017 +#define CB_TAG_MRC_CACHE 0x0018 +#define CB_TAG_VBNV 0x0019 +#define CB_TAG_VERSION_TIMESTAMP 0x001a +#define CB_TAG_X86_ROM_MTRR 0x001b +#define CB_TAG_RAM_OOPS 0x001c +#define CB_TAG_ACPI_GNVS 0x001e +#define CB_TAG_BOARD_ID 0x001f +#define CB_TAG_MAC_ADDRS 0x0020 +#define CB_TAG_WIFI_CALIBRATION 0x0021 +#define CB_TAG_RAM_CODE 0x0022 +#define CB_TAG_SPI_FLASH 0x0023 +#define CB_TAG_BOOT_MEDIA_PARAMS 0x0024 +#define CB_TAG_SERIALNO 0x0025 +#define CB_TAG_MTC 0x0026 +#define CB_TAG_CONSOLE_EHCI 0x0027 +#define CB_TAG_CONSOLE_VGA 0x0028 +#define CB_TAG_CONSOLE_BTEXT 0x0029 +#define CB_TAG_CONSOLE_LOGBUF 0x003a +#define CB_TAG_CONSOLE_SROM 0x002b +#define CB_TAG_CMOS_OPTION_TABLE 200 +#define CB_TAG_OPTION 201 +#define CB_TAG_OPTION_ENUM 202 +#define CB_TAG_OPTION_DEFAULTS 203 +#define CB_TAG_OPTION_CHECKSUM 204
struct cb_header { u8 signature[4]; @@ -52,8 +105,7 @@ struct cb_record { u32 size; };
-#define CB_TAG_UNUSED 0x0000 -#define CB_TAG_MEMORY 0x0001 +/* CB_TAG_MEMORY */
struct cb_memory_range { struct cbuint64 start; @@ -75,7 +127,7 @@ struct cb_memory { struct cb_memory_range map[0]; };
-#define CB_TAG_HWRPB 0x0002 +/* CB_TAG_HWRPB */
struct cb_hwrpb { u32 tag; @@ -83,7 +135,7 @@ struct cb_hwrpb { u64 hwrpb; };
-#define CB_TAG_MAINBOARD 0x0003 +/* CB_TAG_MAINBOARD */
struct cb_mainboard { u32 tag; @@ -93,16 +145,16 @@ struct cb_mainboard { u8 strings[0]; };
-#define CB_TAG_VERSION 0x0004 -#define CB_TAG_EXTRA_VERSION 0x0005 -#define CB_TAG_BUILD 0x0006 -#define CB_TAG_COMPILE_TIME 0x0007 -#define CB_TAG_COMPILE_BY 0x0008 -#define CB_TAG_COMPILE_HOST 0x0009 -#define CB_TAG_COMPILE_DOMAIN 0x000a -#define CB_TAG_COMPILER 0x000b -#define CB_TAG_LINKER 0x000c -#define CB_TAG_ASSEMBLER 0x000d +/* CB_TAG_VERSION */ +/* CB_TAG_EXTRA_VERSION */ +/* CB_TAG_BUILD */ +/* CB_TAG_COMPILE_TIME */ +/* CB_TAG_COMPILE_BY */ +/* CB_TAG_COMPILE_HOST */ +/* CB_TAG_COMPILE_DOMAIN */ +/* CB_TAG_COMPILER */ +/* CB_TAG_LINKER */ +/* CB_TAG_ASSEMBLER */
struct cb_string { u32 tag; @@ -110,7 +162,7 @@ struct cb_string { u8 string[0]; };
-#define CB_TAG_SERIAL 0x000f +/* CB_TAG_SERIAL */
struct cb_serial { u32 tag; @@ -123,7 +175,7 @@ struct cb_serial { u32 regwidth; };
-#define CB_TAG_CONSOLE 0x00010 +/* CB_TAG_CONSOLE */
struct cb_console { u32 tag; @@ -131,14 +183,7 @@ struct cb_console { u16 type; };
-#define CB_TAG_CONSOLE_SERIAL8250 0 -#define CB_TAG_CONSOLE_VGA 1 // OBSOLETE -#define CB_TAG_CONSOLE_BTEXT 2 // OBSOLETE -#define CB_TAG_CONSOLE_LOGBUF 3 // OBSOLETE -#define CB_TAG_CONSOLE_SROM 4 // OBSOLETE -#define CB_TAG_CONSOLE_EHCI 5 - -#define CB_TAG_FORWARD 0x00011 +/* CB_TAG_FORWARD */
struct cb_forward { u32 tag; @@ -146,7 +191,7 @@ struct cb_forward { u64 forward; };
-#define CB_TAG_FRAMEBUFFER 0x0012 +/* CB_TAG_FRAMEBUFFER */ struct cb_framebuffer { u32 tag; u32 size; @@ -166,7 +211,7 @@ struct cb_framebuffer { u8 reserved_mask_size; };
-#define CB_TAG_GPIO 0x0013 +/* CB_TAG_GPIO */ #define CB_GPIO_ACTIVE_LOW 0 #define CB_GPIO_ACTIVE_HIGH 1 #define CB_GPIO_MAX_NAME_LENGTH 16 @@ -185,12 +230,12 @@ struct cb_gpios { struct cb_gpio gpios[0]; };
-#define CB_TAG_VDAT 0x0015 -#define CB_TAG_VBNV 0x0019 -#define CB_TAG_VBOOT_HANDOFF 0x0020 -#define CB_TAG_DMA 0x0022 -#define CB_TAG_RAM_OOPS 0x0023 -#define CB_TAG_MTC 0x002b +/* CB_TAG_VDAT */ +/* CB_TAG_VBNV */ +/* CB_TAG_VBOOT_HANDOFF */ +/* CB_TAG_DMA */ +/* CB_TAG_RAM_OOPS */ +/* CB_TAG_MTC */ struct lb_range { uint32_t tag; uint32_t size; @@ -198,18 +243,18 @@ struct lb_range { uint32_t range_size; };
-#define CB_TAG_TIMESTAMPS 0x0016 -#define CB_TAG_CBMEM_CONSOLE 0x0017 -#define CB_TAG_MRC_CACHE 0x0018 -#define CB_TAG_ACPI_GNVS 0x0024 -#define CB_TAG_WIFI_CALIBRATION 0x0027 +/* CB_TAG_TIMESTAMPS */ +/* CB_TAG_CBMEM_CONSOLE */ +/* CB_TAG_MRC_CACHE */ +/* CB_TAG_ACPI_GNVS */ +/* CB_TAG_WIFI_CALIBRATION */ struct cb_cbmem_tab { uint32_t tag; uint32_t size; uint64_t cbmem_tab; };
-#define CB_TAG_BOARD_ID 0x0025 +/* CB_TAG_BOARD_ID */ struct cb_board_id { uint32_t tag; uint32_t size; @@ -217,7 +262,7 @@ struct cb_board_id { uint32_t board_id; };
-#define CB_TAG_X86_ROM_MTRR 0x0021 +/* CB_TAG_X86_ROM_MTRR */ struct cb_x86_rom_mtrr { uint32_t tag; uint32_t size; @@ -228,7 +273,7 @@ struct cb_x86_rom_mtrr { uint32_t index; };
-#define CB_TAG_MAC_ADDRS 0x0026 +/* CB_TAG_MAC_ADDRS */ struct mac_address { uint8_t mac_addr[6]; uint8_t pad[2]; /* Pad it to 8 bytes to keep it simple. */ @@ -241,14 +286,14 @@ struct cb_macs { struct mac_address mac_addrs[0]; };
-#define CB_TAG_RAM_CODE 0x0028 +/* CB_TAG_RAM_CODE */ struct cb_ram_code { uint32_t tag; uint32_t size; uint32_t ram_code; };
-#define CB_TAG_SPI_FLASH 0x0029 +/* CB_TAG_SPI_FLASH */ struct cb_spi_flash { uint32_t tag; uint32_t size; @@ -257,7 +302,7 @@ struct cb_spi_flash { uint32_t erase_cmd; };
-#define CB_TAG_BOOT_MEDIA_PARAMS 0x0030 +/* CB_TAG_BOOT_MEDIA_PARAMS */ struct cb_boot_media_params { uint32_t tag; uint32_t size; @@ -268,17 +313,17 @@ struct cb_boot_media_params { uint64_t boot_media_size; };
-#define CB_TAG_SERIALNO 0x002a +/* CB_TAG_SERIALNO */ #define CB_MAX_SERIALNO_LENGTH 32
-#define CB_TAG_CMOS_OPTION_TABLE 0x00c8 +/* CB_TAG_CMOS_OPTION_TABLE */ struct cb_cmos_option_table { u32 tag; u32 size; u32 header_length; };
-#define CB_TAG_OPTION 0x00c9 +/* CB_TAG_OPTION */ #define CB_CMOS_MAX_NAME_LENGTH 32 struct cb_cmos_entries { u32 tag; @@ -291,7 +336,7 @@ struct cb_cmos_entries { };
-#define CB_TAG_OPTION_ENUM 0x00ca +/* CB_TAG_OPTION_ENUM */ #define CB_CMOS_MAX_TEXT_LENGTH 32 struct cb_cmos_enums { u32 tag; @@ -301,7 +346,7 @@ struct cb_cmos_enums { u8 text[CB_CMOS_MAX_TEXT_LENGTH]; };
-#define CB_TAG_OPTION_DEFAULTS 0x00cb +/* CB_TAG_OPTION_DEFAULTS */ #define CB_CMOS_IMAGE_BUFFER_SIZE 128 struct cb_cmos_defaults { u32 tag; @@ -311,7 +356,7 @@ struct cb_cmos_defaults { u8 default_set[CB_CMOS_IMAGE_BUFFER_SIZE]; };
-#define CB_TAG_OPTION_CHECKSUM 0x00cc +/* CB_TAG_OPTION_CHECKSUM */ #define CB_CHECKSUM_NONE 0 #define CB_CHECKSUM_PCBIOS 1 struct cb_cmos_checksum { diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h index 3dddde5..e9b531a 100644 --- a/src/include/boot/coreboot_tables.h +++ b/src/include/boot/coreboot_tables.h @@ -64,6 +64,60 @@ static inline struct lb_uint64 pack_lb64(uint64_t value) return result; }
+/* + * Various coreboot table structure tags. Keep them all here, sorted by value. + * Make sure they are in sync with values defined in + * payloads/libpayload/include/coreboot_tables.h. + */ +#define LB_TAG_UNUSED 0x0000 +#define LB_TAG_MEMORY 0x0001 +#define LB_TAG_HWRPB 0x0002 +#define LB_TAG_MAINBOARD 0x0003 +#define LB_TAG_VERSION 0x0004 +#define LB_TAG_EXTRA_VERSION 0x0005 +#define LB_TAG_BUILD 0x0006 +#define LB_TAG_COMPILE_TIME 0x0007 +#define LB_TAG_COMPILE_BY 0x0008 +#define LB_TAG_COMPILE_HOST 0x0009 +#define LB_TAG_COMPILE_DOMAIN 0x000a +#define LB_TAG_COMPILER 0x000b +#define LB_TAG_LINKER 0x000c +#define LB_TAG_ASSEMBLER 0x000d +#define LB_TAG_CONSOLE_SERIAL8250 0x000e +#define LB_TAG_SERIAL 0x000f +#define LB_TAG_CONSOLE 0x0010 +#define LB_TAG_FORWARD 0x0011 +#define LB_TAG_FRAMEBUFFER 0x0012 +#define LB_TAG_GPIO 0x0013 +#define LB_TAG_CONSOLE_SERIAL8250MEM 0x0014 +#define LB_TAG_VDAT 0x0015 +#define LB_TAG_TIMESTAMPS 0x0016 +#define LB_TAG_CBMEM_CONSOLE 0x0017 +#define LB_TAG_MRC_CACHE 0x0018 +#define LB_TAG_VBNV 0x0019 +#define LB_TAG_VERSION_TIMESTAMP 0x001a +#define LB_TAG_X86_ROM_MTRR 0x001b +#define LB_TAG_RAM_OOPS 0x001c +#define LB_TAG_ACPI_GNVS 0x001e +#define LB_TAG_BOARD_ID 0x001f +#define LB_TAG_MAC_ADDRS 0x0020 +#define LB_TAG_WIFI_CALIBRATION 0x0021 +#define LB_TAG_RAM_CODE 0x0022 +#define LB_TAG_SPI_FLASH 0x0023 +#define LB_TAG_BOOT_MEDIA_PARAMS 0x0024 +#define LB_TAG_SERIALNO 0x0025 +#define LB_TAG_MTC 0x0026 +#define LB_TAG_CONSOLE_EHCI 0x0027 +#define LB_TAG_CONSOLE_VGA 0x0028 +#define LB_TAG_CONSOLE_BTEXT 0x0029 +#define LB_TAG_CONSOLE_LOGBUF 0x003a +#define LB_TAG_CONSOLE_SROM 0x002b +#define LB_TAG_CMOS_OPTION_TABLE 200 +#define LB_TAG_OPTION 201 +#define LB_TAG_OPTION_ENUM 202 +#define LB_TAG_OPTION_DEFAULTS 203 +#define LB_TAG_OPTION_CHECKSUM 204 + struct lb_header { uint8_t signature[4]; /* LBIO */ @@ -85,9 +139,8 @@ struct lb_record { uint32_t size; /* size of record (in bytes) */ };
-#define LB_TAG_UNUSED 0x0000
-#define LB_TAG_MEMORY 0x0001 +/* LB_TAG_MEMORY */
struct lb_memory_range { struct lb_uint64 start; @@ -108,14 +161,14 @@ struct lb_memory { struct lb_memory_range map[0]; };
-#define LB_TAG_HWRPB 0x0002 +/* LB_TAG_HWRPB */ struct lb_hwrpb { uint32_t tag; uint32_t size; uint64_t hwrpb; };
-#define LB_TAG_MAINBOARD 0x0003 +/* LB_TAG_MAINBOARD */ struct lb_mainboard { uint32_t tag; uint32_t size; @@ -124,23 +177,23 @@ struct lb_mainboard { uint8_t strings[0]; };
-#define LB_TAG_VERSION 0x0004 -#define LB_TAG_EXTRA_VERSION 0x0005 -#define LB_TAG_BUILD 0x0006 -#define LB_TAG_COMPILE_TIME 0x0007 -#define LB_TAG_COMPILE_BY 0x0008 -#define LB_TAG_COMPILE_HOST 0x0009 -#define LB_TAG_COMPILE_DOMAIN 0x000a -#define LB_TAG_COMPILER 0x000b -#define LB_TAG_LINKER 0x000c -#define LB_TAG_ASSEMBLER 0x000d +/* LB_TAG_VERSION */ +/* LB_TAG_EXTRA_VERSION */ +/* LB_TAG_BUILD */ +/* LB_TAG_COMPILE_TIME */ +/* LB_TAG_COMPILE_BY */ +/* LB_TAG_COMPILE_HOST */ +/* LB_TAG_COMPILE_DOMAIN */ +/* LB_TAG_COMPILER */ +/* LB_TAG_LINKER */ +/* LB_TAG_ASSEMBLER */ struct lb_string { uint32_t tag; uint32_t size; uint8_t string[0]; };
-#define LB_TAG_VERSION_TIMESTAMP 0x0026 +/* LB_TAG_VERSION_TIMESTAMP */ struct lb_timestamp { uint32_t tag; uint32_t size; @@ -150,7 +203,7 @@ struct lb_timestamp {
/* 0xe is taken by v3 */
-#define LB_TAG_SERIAL 0x000f +/* LB_TAG_SERIAL */ struct lb_serial { uint32_t tag; uint32_t size; @@ -162,29 +215,21 @@ struct lb_serial { uint32_t regwidth; };
-#define LB_TAG_CONSOLE 0x0010 +/* LB_TAG_CONSOLE */ struct lb_console { uint32_t tag; uint32_t size; uint16_t type; };
-#define LB_TAG_CONSOLE_SERIAL8250 0 -#define LB_TAG_CONSOLE_VGA 1 // OBSOLETE -#define LB_TAG_CONSOLE_BTEXT 2 // OBSOLETE -#define LB_TAG_CONSOLE_LOGBUF 3 // OBSOLETE -#define LB_TAG_CONSOLE_SROM 4 // OBSOLETE -#define LB_TAG_CONSOLE_EHCI 5 -#define LB_TAG_CONSOLE_SERIAL8250MEM 6 - -#define LB_TAG_FORWARD 0x0011 +/* LB_TAG_FORWARD */ struct lb_forward { uint32_t tag; uint32_t size; uint64_t forward; };
-#define LB_TAG_FRAMEBUFFER 0x0012 +/* LB_TAG_FRAMEBUFFER */ struct lb_framebuffer { uint32_t tag; uint32_t size; @@ -204,7 +249,7 @@ struct lb_framebuffer { uint8_t reserved_mask_size; };
-#define LB_TAG_GPIO 0x0013 +/* LB_TAG_GPIO */
struct lb_gpio { uint32_t port; @@ -224,12 +269,12 @@ struct lb_gpios { struct lb_gpio gpios[0]; };
-#define LB_TAG_VDAT 0x0015 -#define LB_TAG_VBNV 0x0019 +/* LB_TAG_VDAT */ +/* LB_TAG_VBNV */ #define LB_TAB_VBOOT_HANDOFF 0x0020 #define LB_TAB_DMA 0x0022 -#define LB_TAG_RAM_OOPS 0x0023 -#define LB_TAG_MTC 0x002b +/* LB_TAG_RAM_OOPS */ +/* LB_TAG_MTC */ struct lb_range { uint32_t tag; uint32_t size; @@ -240,11 +285,11 @@ struct lb_range {
void lb_ramoops(struct lb_header *header);
-#define LB_TAG_TIMESTAMPS 0x0016 -#define LB_TAG_CBMEM_CONSOLE 0x0017 -#define LB_TAG_MRC_CACHE 0x0018 -#define LB_TAG_ACPI_GNVS 0x0024 -#define LB_TAG_WIFI_CALIBRATION 0x0027 +/* LB_TAG_TIMESTAMPS */ +/* LB_TAG_CBMEM_CONSOLE */ +/* LB_TAG_MRC_CACHE */ +/* LB_TAG_ACPI_GNVS */ +/* LB_TAG_WIFI_CALIBRATION */ struct lb_cbmem_ref { uint32_t tag; uint32_t size; @@ -252,7 +297,7 @@ struct lb_cbmem_ref { uint64_t cbmem_addr; };
-#define LB_TAG_X86_ROM_MTRR 0x0021 +/* LB_TAG_X86_ROM_MTRR */ struct lb_x86_rom_mtrr { uint32_t tag; uint32_t size; @@ -260,7 +305,7 @@ struct lb_x86_rom_mtrr { uint32_t index; };
-#define LB_TAG_BOARD_ID 0x0025 +/* LB_TAG_BOARD_ID */ struct lb_board_id { uint32_t tag; uint32_t size; @@ -268,7 +313,7 @@ struct lb_board_id { uint32_t board_id; };
-#define LB_TAG_MAC_ADDRS 0x0026 +/* LB_TAG_MAC_ADDRS */ struct mac_address { uint8_t mac_addr[6]; uint8_t pad[2]; /* Pad it to 8 bytes to keep it simple. */ @@ -281,14 +326,14 @@ struct lb_macs { struct mac_address mac_addrs[0]; };
-#define LB_TAG_RAM_CODE 0x0028 +/* LB_TAG_RAM_CODE */ struct lb_ram_code { uint32_t tag; uint32_t size; uint32_t ram_code; };
-#define LB_TAG_SPI_FLASH 0x0029 +/* LB_TAG_SPI_FLASH */ struct lb_spi_flash { uint32_t tag; uint32_t size; @@ -297,7 +342,7 @@ struct lb_spi_flash { uint32_t erase_cmd; };
-#define LB_TAG_BOOT_MEDIA_PARAMS 0x0030 +/* LB_TAG_BOOT_MEDIA_PARAMS */ struct lb_boot_media_params { uint32_t tag; uint32_t size; @@ -308,11 +353,11 @@ struct lb_boot_media_params { uint64_t boot_media_size; };
-#define LB_TAG_SERIALNO 0x002a +/* LB_TAG_SERIALNO */ #define MAX_SERIALNO_LENGTH 32
/* The following structures are for the cmos definitions table */ -#define LB_TAG_CMOS_OPTION_TABLE 200 +/* LB_TAG_CMOS_OPTION_TABLE */ /* cmos header record */ struct cmos_option_table { uint32_t tag; /* CMOS definitions table type */ @@ -327,7 +372,7 @@ struct cmos_option_table { starts at the beginning of the byte and the length is fills complete bytes. */ -#define LB_TAG_OPTION 201 +/* LB_TAG_OPTION */ struct cmos_entries { uint32_t tag; /* entry type */ uint32_t size; /* length of this record */ @@ -345,7 +390,7 @@ struct cmos_entries { This record is variable length. The text field may be shorter than CMOS_MAX_TEXT_LENGTH. */ -#define LB_TAG_OPTION_ENUM 202 +/* LB_TAG_OPTION_ENUM */ struct cmos_enums { uint32_t tag; /* enumeration type */ uint32_t size; /* length of this record */ @@ -359,7 +404,7 @@ struct cmos_enums { /* cmos defaults record This record contains default settings for the cmos ram. */ -#define LB_TAG_OPTION_DEFAULTS 203 +/* LB_TAG_OPTION_DEFAULTS */ struct cmos_defaults { uint32_t tag; /* default type */ uint32_t size; /* length of this record */ @@ -369,7 +414,7 @@ struct cmos_defaults { uint8_t default_set[CMOS_IMAGE_BUFFER_SIZE]; /* default settings */ };
-#define LB_TAG_OPTION_CHECKSUM 204 +/* LB_TAG_OPTION_CHECKSUM */ struct cmos_checksum { uint32_t tag; uint32_t size;