diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-03-31 13:55:52 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-04-06 06:49:59 +0000 |
commit | 8aedb34501450920a663342429e409562431e1c2 (patch) | |
tree | aa5c0c834eede37a0ded59dd2fd3347457ce77af /src/mainboard | |
parent | 5b5b8afdf10cd06fec45e43bc5896e8a1da46fc0 (diff) |
mb/prodrive/hermes: Properly pack EEPROM structures
To pack a struct, the `__packed` attribute must come after the `struct`
keyword. Moreover, unions cannot be packed (structs inside unions can,
though). Correct uses of `__packed` so that EEPROM structs get packed.
Change-Id: I39d2c9ebc370605d5623b134189aa95a074ec7c3
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51980
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: <wouter.eckhardt@prodrive-technologies.com>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h index e6e5f39d0e..58ecb0880a 100644 --- a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h +++ b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h @@ -2,8 +2,8 @@ #include <soc/ramstage.h> -__packed union eeprom_dimm_layout { - struct { +union eeprom_dimm_layout { + struct __packed { char name[50]; char manufacturer[50]; uint8_t ranks; @@ -16,10 +16,13 @@ __packed union eeprom_dimm_layout { uint8_t raw[0x80]; }; -__packed struct eeprom_board_layout { +_Static_assert(sizeof(union eeprom_dimm_layout) == 0x80, + "union eeprom_dimm_layout has invalid size!"); + +struct __packed eeprom_board_layout { uint32_t signature; union { - struct { + struct __packed { char cpu_name[50]; uint8_t cpu_count; uint32_t cpu_max_non_turbo_frequency; @@ -30,10 +33,13 @@ __packed struct eeprom_board_layout { }; }; -__packed struct eeprom_board_settings { +_Static_assert(sizeof(struct eeprom_board_layout) == (617 + sizeof(uint32_t)), + "struct eeprom_board_layout has invalid size!"); + +struct __packed eeprom_board_settings { uint32_t signature; union { - struct { + struct __packed { uint8_t secureboot; uint8_t primary_video; uint8_t deep_sx_enabled; @@ -48,13 +54,16 @@ __packed struct eeprom_board_settings { }; }; -__packed struct eeprom_bmc_settings { +_Static_assert(sizeof(struct eeprom_board_settings) == (9 + sizeof(uint32_t)), + "struct eeprom_board_settings has invalid size!"); + +struct __packed eeprom_bmc_settings { uint8_t pcie_mux; uint8_t hsi; }; /* The EEPROM on address 0x57 has the following vendor defined layout: */ -__packed struct eeprom_layout { +struct __packed eeprom_layout { union { uint8_t RawFSPMUPD[0x600]; FSPM_UPD mupd; |