From 2974e2cd287003a21d73b04ea6d11ede423db464 Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Mon, 12 Jun 2023 09:09:15 +0100 Subject: fwu_metadata: make sure structures are packed The fwu metadata in the metadata partitions should/are packed to guarantee that the info is correct in all platforms. Also the size of them are used to calculate the crc32 and that is important to get it right. Signed-off-by: Rui Miguel Silva Reviewed-by: Ilias Apalodimas --- include/fwu_mdata.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h index 8fda4f4ac22..56189e2f40a 100644 --- a/include/fwu_mdata.h +++ b/include/fwu_mdata.h @@ -6,6 +6,7 @@ #if !defined _FWU_MDATA_H_ #define _FWU_MDATA_H_ +#include #include /** @@ -22,7 +23,7 @@ struct fwu_image_bank_info { efi_guid_t image_uuid; uint32_t accepted; uint32_t reserved; -}; +} __packed; /** * struct fwu_image_entry - information for a particular type of image @@ -38,7 +39,7 @@ struct fwu_image_entry { efi_guid_t image_type_uuid; efi_guid_t location_uuid; struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS]; -}; +} __packed; /** * struct fwu_mdata - FWU metadata structure for multi-bank updates @@ -62,6 +63,6 @@ struct fwu_mdata { uint32_t previous_active_index; struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK]; -}; +} __packed; #endif /* _FWU_MDATA_H_ */ -- cgit v1.3.1 From dc3abd8006c5fe715449302f9aaf79db190454fc Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Mon, 12 Jun 2023 09:09:16 +0100 Subject: nvmxip: move header to include Move header to include to allow external code to get the internal bdev structures to access block device operations. as at it, just add the UCLASS_NVMXIP string so we get the correct output in partitions listing. Signed-off-by: Rui Miguel Silva --- drivers/mtd/nvmxip/nvmxip.h | 32 -------------------------------- include/nvmxip.h | 32 ++++++++++++++++++++++++++++++++ test/dm/nvmxip.c | 2 +- 3 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 drivers/mtd/nvmxip/nvmxip.h create mode 100644 include/nvmxip.h (limited to 'include') diff --git a/drivers/mtd/nvmxip/nvmxip.h b/drivers/mtd/nvmxip/nvmxip.h deleted file mode 100644 index f4ef37725d2..00000000000 --- a/drivers/mtd/nvmxip/nvmxip.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright 2023 Arm Limited and/or its affiliates - * - * Authors: - * Abdellatif El Khlifi - */ - -#ifndef __DRIVER_NVMXIP_H__ -#define __DRIVER_NVMXIP_H__ - -#include - -#define NVMXIP_BLKDRV_NAME "nvmxip-blk" -#define NVMXIP_BLKDEV_NAME_SZ 20 - -/** - * struct nvmxip_plat - the NVMXIP driver plat - * - * @phys_base: NVM XIP device base address - * @lba_shift: block size shift count - * @lba: number of blocks - * - * The NVMXIP information read from the DT. - */ -struct nvmxip_plat { - phys_addr_t phys_base; - u32 lba_shift; - lbaint_t lba; -}; - -#endif /* __DRIVER_NVMXIP_H__ */ diff --git a/include/nvmxip.h b/include/nvmxip.h new file mode 100644 index 00000000000..f4ef37725d2 --- /dev/null +++ b/include/nvmxip.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2023 Arm Limited and/or its affiliates + * + * Authors: + * Abdellatif El Khlifi + */ + +#ifndef __DRIVER_NVMXIP_H__ +#define __DRIVER_NVMXIP_H__ + +#include + +#define NVMXIP_BLKDRV_NAME "nvmxip-blk" +#define NVMXIP_BLKDEV_NAME_SZ 20 + +/** + * struct nvmxip_plat - the NVMXIP driver plat + * + * @phys_base: NVM XIP device base address + * @lba_shift: block size shift count + * @lba: number of blocks + * + * The NVMXIP information read from the DT. + */ +struct nvmxip_plat { + phys_addr_t phys_base; + u32 lba_shift; + lbaint_t lba; +}; + +#endif /* __DRIVER_NVMXIP_H__ */ diff --git a/test/dm/nvmxip.c b/test/dm/nvmxip.c index e934748eb5d..89bf481f616 100644 --- a/test/dm/nvmxip.c +++ b/test/dm/nvmxip.c @@ -17,7 +17,7 @@ #include #include #include -#include "../../drivers/mtd/nvmxip/nvmxip.h" +#include /* NVMXIP devices described in the device tree */ #define SANDBOX_NVMXIP_DEVICES 2 -- cgit v1.3.1