vc/amd/fsp/picasso: replace #pragma pack(1) with __packed attribute

Forgetting to add the #pragma pack() at the end of the header file can
lead to hard to debug breakage, so get rid of the #pragma pack usage and
add a __packed to the structs that need to be packed which has less
possibly unwanted side effects.

Since commit d44221f9c8 coreboot always
includes commonlib/compiler.h which provides __packed.

TEST=Timeless build results in identical binary.

Change-Id: Icc53168f4fbc3a63a859f686b18e7023d225f8d2
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43433
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Felix Held 2020-07-13 23:37:06 +02:00 committed by Patrick Georgi
parent de3fe84ca9
commit 692dde599f
2 changed files with 4 additions and 14 deletions

View File

@ -9,12 +9,9 @@
#include <FspUpd.h> #include <FspUpd.h>
#pragma pack(1)
/** Fsp M Configuration /** Fsp M Configuration
**/ **/
typedef struct { typedef struct __packed {
/** Offset 0x0040**/ uint32_t pci_express_base_addr; /** Offset 0x0040**/ uint32_t pci_express_base_addr;
/** Offset 0x0044**/ uint32_t serial_port_base; /** Offset 0x0044**/ uint32_t serial_port_base;
/** Offset 0x0048**/ uint32_t serial_port_use_mmio; /** Offset 0x0048**/ uint32_t serial_port_use_mmio;
@ -71,12 +68,10 @@ typedef struct {
/** Fsp M UPD Configuration /** Fsp M UPD Configuration
**/ **/
typedef struct { typedef struct __packed {
/** Offset 0x0000**/ FSP_UPD_HEADER FspUpdHeader; /** Offset 0x0000**/ FSP_UPD_HEADER FspUpdHeader;
/** Offset 0x0020**/ FSPM_ARCH_UPD FspmArchUpd; /** Offset 0x0020**/ FSPM_ARCH_UPD FspmArchUpd;
/** Offset 0x0040**/ FSP_M_CONFIG FspmConfig; /** Offset 0x0040**/ FSP_M_CONFIG FspmConfig;
} FSPM_UPD; } FSPM_UPD;
#pragma pack()
#endif #endif

View File

@ -9,10 +9,7 @@
#include <FspUpd.h> #include <FspUpd.h>
#pragma pack(1) typedef struct __packed {
typedef struct {
/** Offset 0x0020**/ uint32_t emmc0_mode; /** Offset 0x0020**/ uint32_t emmc0_mode;
/** Offset 0x0024**/ uint8_t unused0[12]; /** Offset 0x0024**/ uint8_t unused0[12];
/** Offset 0x0030**/ uint8_t dxio_descriptor0[16]; /** Offset 0x0030**/ uint8_t dxio_descriptor0[16];
@ -51,11 +48,9 @@ typedef struct {
/** Fsp S UPD Configuration /** Fsp S UPD Configuration
**/ **/
typedef struct { typedef struct __packed {
/** Offset 0x0000**/ FSP_UPD_HEADER FspUpdHeader; /** Offset 0x0000**/ FSP_UPD_HEADER FspUpdHeader;
/** Offset 0x0020**/ FSP_S_CONFIG FspsConfig; /** Offset 0x0020**/ FSP_S_CONFIG FspsConfig;
} FSPS_UPD; } FSPS_UPD;
#pragma pack()
#endif #endif