summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2021-12-03 17:15:10 +0100
committerFelix Held <felix-coreboot@felixheld.de>2022-01-10 23:49:04 +0000
commit17c9cfe2125736e49d335efcc624b53d213444ef (patch)
tree937ba32fbe6ae6a64864fb051cd5788cf6fbae7d
parentcab1285c03a5bcf7e4365cf07bca065e53403aa1 (diff)
src/mainboard/emulation/qemu-i440fx: Fix struct packing
On x86_64 the struct isn't packed, causing the fw_cfg parser to return invalid memory entries (possible others as well) through fw_cfg. Fix that by packing all structs. Change-Id: Id1bab99f06be99674efe219dda443fb7d44be560 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/59872 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r--src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h b/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h
index e972f54261..817d1a58f5 100644
--- a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h
+++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h
@@ -69,18 +69,18 @@ typedef struct FWCfgFile {
uint16_t select; /* write this to 0x510 to read it */
uint16_t reserved;
char name[FW_CFG_MAX_FILE_PATH];
-} FWCfgFile;
+} __packed FWCfgFile;
typedef struct FWCfgFiles {
uint32_t count;
FWCfgFile f[];
-} FWCfgFiles;
+} __packed FWCfgFiles;
typedef struct FwCfgE820Entry {
uint64_t address;
uint64_t length;
uint32_t type;
-} FwCfgE820Entry __attribute((__aligned__(4)));
+} __packed FwCfgE820Entry __attribute((__aligned__(4)));
#define SMBIOS_FIELD_ENTRY 0
@@ -91,7 +91,7 @@ typedef struct FwCfgSmbios {
uint8_t headertype;
uint8_t tabletype;
uint16_t fieldoffset;
-} FwCfgSmbios;
+} __packed FwCfgSmbios;
/* FW_CFG_ID bits */
#define FW_CFG_VERSION 0x01
@@ -113,6 +113,6 @@ typedef struct FwCfgDmaAccess {
uint32_t control;
uint32_t length;
uint64_t address;
-} FwCfgDmaAccess;
+} __packed FwCfgDmaAccess;
#endif /* FW_CFG_IF_H */