From 692dde599f35719d3e9e9a43800b9deea50c002a Mon Sep 17 00:00:00 2001 From: Felix Held Date: Mon, 13 Jul 2020 23:37:06 +0200 Subject: [PATCH] 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 d44221f9c8f3686e040ff9481829315068b321a3 coreboot always includes commonlib/compiler.h which provides __packed. TEST=Timeless build results in identical binary. Change-Id: Icc53168f4fbc3a63a859f686b18e7023d225f8d2 Signed-off-by: Felix Held Reviewed-on: https://review.coreboot.org/c/coreboot/+/43433 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Angel Pons --- src/vendorcode/amd/fsp/picasso/FspmUpd.h | 9 ++------- src/vendorcode/amd/fsp/picasso/FspsUpd.h | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/vendorcode/amd/fsp/picasso/FspmUpd.h b/src/vendorcode/amd/fsp/picasso/FspmUpd.h index 276b2fcd46..3be69c3360 100644 --- a/src/vendorcode/amd/fsp/picasso/FspmUpd.h +++ b/src/vendorcode/amd/fsp/picasso/FspmUpd.h @@ -9,12 +9,9 @@ #include -#pragma pack(1) - - /** Fsp M Configuration **/ -typedef struct { +typedef struct __packed { /** Offset 0x0040**/ uint32_t pci_express_base_addr; /** Offset 0x0044**/ uint32_t serial_port_base; /** Offset 0x0048**/ uint32_t serial_port_use_mmio; @@ -71,12 +68,10 @@ typedef struct { /** Fsp M UPD Configuration **/ -typedef struct { +typedef struct __packed { /** Offset 0x0000**/ FSP_UPD_HEADER FspUpdHeader; /** Offset 0x0020**/ FSPM_ARCH_UPD FspmArchUpd; /** Offset 0x0040**/ FSP_M_CONFIG FspmConfig; } FSPM_UPD; -#pragma pack() - #endif diff --git a/src/vendorcode/amd/fsp/picasso/FspsUpd.h b/src/vendorcode/amd/fsp/picasso/FspsUpd.h index 2dcc617a9e..5a408316ff 100644 --- a/src/vendorcode/amd/fsp/picasso/FspsUpd.h +++ b/src/vendorcode/amd/fsp/picasso/FspsUpd.h @@ -9,10 +9,7 @@ #include -#pragma pack(1) - - -typedef struct { +typedef struct __packed { /** Offset 0x0020**/ uint32_t emmc0_mode; /** Offset 0x0024**/ uint8_t unused0[12]; /** Offset 0x0030**/ uint8_t dxio_descriptor0[16]; @@ -51,11 +48,9 @@ typedef struct { /** Fsp S UPD Configuration **/ -typedef struct { +typedef struct __packed { /** Offset 0x0000**/ FSP_UPD_HEADER FspUpdHeader; /** Offset 0x0020**/ FSP_S_CONFIG FspsConfig; } FSPS_UPD; -#pragma pack() - #endif