From 895ae8726dea182c8512fc6154bd0f9a6a06657b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 7 Oct 2019 00:37:45 +0200 Subject: cbfs: do not pack struct cbfs_cachenode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the __packed attribute sandbox_defconfig cannot be compiled with GCC 9.2.1: fs/cbfs/cbfs.c: In function ‘file_cbfs_fill_cache’: fs/cbfs/cbfs.c:164:16: error: taking address of packed member of ‘struct cbfs_cachenode’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 164 | cache_tail = &new_node->next; | ^~~~~~~~~~~~~~~ struct cbfs_cachenode is only an internal structure. So let's rearrange the fields such that the structure is naturally packed and remove the __packed attribute. Signed-off-by: Heinrich Schuchardt Reviewed-by: Bin Meng Reviewed-by: Simon Glass --- include/cbfs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/cbfs.h b/include/cbfs.h index 6d4c4d4b06..f3bc8ca24a 100644 --- a/include/cbfs.h +++ b/include/cbfs.h @@ -72,13 +72,13 @@ struct cbfs_fileheader { struct cbfs_cachenode { struct cbfs_cachenode *next; - u32 type; void *data; - u32 data_length; char *name; + u32 type; + u32 data_length; u32 name_length; u32 attributes_offset; -} __packed; +}; extern enum cbfs_result file_cbfs_result; -- cgit From e1500a6ce29a8424cc0c0a2fa82e694419941dd1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 20 Oct 2019 21:31:45 -0600 Subject: spl: Correct priority selection for image loaders At present the name of the image comes first in the linker-list symbol used. This means that the name of the function sets the sort order, which is not the intention. Update it to put the boot-device type first, then the priority. This produces the expected behaviour. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- include/spl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/spl.h b/include/spl.h index b5387ef273..08ffddac29 100644 --- a/include/spl.h +++ b/include/spl.h @@ -332,14 +332,14 @@ struct spl_image_loader { */ #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT #define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \ - SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \ + SPL_LOAD_IMAGE(_boot_device ## _priority ## _method) = { \ .name = _name, \ .boot_device = _boot_device, \ .load_image = _method, \ } #else #define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \ - SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \ + SPL_LOAD_IMAGE(_boot_device ## _priority ## _method) = { \ .boot_device = _boot_device, \ .load_image = _method, \ } -- cgit From c53b318e1bad2e0d5c2b846fadfc79ec77bfc5f7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 20 Oct 2019 21:31:47 -0600 Subject: spi: Add support for memory-mapped flash On x86 platforms the SPI flash can be mapped into memory so that the contents can be read with normal memory accesses. Add a new SPI method to find the location of the SPI flash in memory. This differs from the existing device-tree "memory-map" mechanism in that the location can be discovered at run-time. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- include/spi.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include') diff --git a/include/spi.h b/include/spi.h index 3f79168df3..6fbb4336ce 100644 --- a/include/spi.h +++ b/include/spi.h @@ -462,6 +462,19 @@ struct dm_spi_ops { * is invalid, other -ve value on error */ int (*cs_info)(struct udevice *bus, uint cs, struct spi_cs_info *info); + + /** + * get_mmap() - Get memory-mapped SPI + * + * @dev: The SPI flash slave device + * @map_basep: Returns base memory address for mapped SPI + * @map_sizep: Returns size of mapped SPI + * @offsetp: Returns start offset of SPI flash where the map works + * correctly (offsets before this are not visible) + * @return 0 if OK, -EFAULT if memory mapping is not available + */ + int (*get_mmap)(struct udevice *dev, ulong *map_basep, + uint *map_sizep, uint *offsetp); }; struct dm_spi_emul_ops { @@ -650,6 +663,20 @@ void dm_spi_release_bus(struct udevice *dev); int dm_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags); +/** + * spi_get_mmap() - Get memory-mapped SPI + * + * @dev: SPI slave device to check + * @map_basep: Returns base memory address for mapped SPI + * @map_sizep: Returns size of mapped SPI + * @offsetp: Returns start offset of SPI flash where the map works + * correctly (offsets before this are not visible) + * @return 0 if OK, -ENOSYS if no operation, -EFAULT if memory mapping is not + * available + */ +int dm_spi_get_mmap(struct udevice *dev, ulong *map_basep, uint *map_sizep, + uint *offsetp); + /* Access the operations for a SPI device */ #define spi_get_ops(dev) ((struct dm_spi_ops *)(dev)->driver->ops) #define spi_emul_get_ops(dev) ((struct dm_spi_emul_ops *)(dev)->driver->ops) -- cgit