public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] part_dos: allocate cacheline aligned buffers
@ 2012-04-24  7:53 Thierry Reding
  2012-04-24  7:53 ` [U-Boot] [PATCH 2/2] mmc: tegra: invalidate complete cachelines Thierry Reding
  2012-04-24 18:31 ` [U-Boot] [PATCH 1/2] part_dos: allocate cacheline aligned buffers Simon Glass
  0 siblings, 2 replies; 21+ messages in thread
From: Thierry Reding @ 2012-04-24  7:53 UTC (permalink / raw)
  To: u-boot

Some hardware requires the data buffers to be cacheline-aligned to make
sure DMA operations can be properly executed.

This patch uses the ALLOC_CACHE_ALIGN_BUFFER macro to allocate buffers
with proper alignment. The same was already done for EFI partitions in
commit f75dd58 "part_efi: dcache: allocate cacheline aligned buffers".

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
---
This fixes boot failures on Avionic Design Plutux and Medcom boards.

 disk/part_dos.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index b5bcb37..c028aaf 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -87,7 +87,7 @@ static int test_block_type(unsigned char *buffer)
 
 int test_part_dos (block_dev_desc_t *dev_desc)
 {
-	unsigned char buffer[dev_desc->blksz];
+	ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
 
 	if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *) buffer) != 1) ||
 	    (buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
@@ -102,7 +102,7 @@ int test_part_dos (block_dev_desc_t *dev_desc)
 static void print_partition_extended (block_dev_desc_t *dev_desc, int ext_part_sector, int relative,
 							   int part_num)
 {
-	unsigned char buffer[dev_desc->blksz];
+	ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
 	dos_partition_t *pt;
 	int i;
 
@@ -166,7 +166,7 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
 				 int relative, int part_num,
 				 int which_part, disk_partition_t *info)
 {
-	unsigned char buffer[dev_desc->blksz];
+	ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
 	dos_partition_t *pt;
 	int i;
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-11-05 23:07 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-24  7:53 [U-Boot] [PATCH 1/2] part_dos: allocate cacheline aligned buffers Thierry Reding
2012-04-24  7:53 ` [U-Boot] [PATCH 2/2] mmc: tegra: invalidate complete cachelines Thierry Reding
2012-04-25 22:54   ` Mike Frysinger
2012-04-26  6:18     ` Thierry Reding
2012-04-26 10:16       ` Simon Glass
2012-04-26 10:34         ` Thierry Reding
2012-04-27  5:29           ` Mike Frysinger
2012-04-27  5:50             ` Simon Glass
2012-11-02 20:22             ` Stephen Warren
2012-11-02 20:25               ` Simon Glass
2012-11-02 20:38                 ` Marek Vasut
2012-11-02 20:58                   ` Stephen Warren
2012-11-02 21:28                     ` Marek Vasut
2012-11-02 21:31                       ` Stephen Warren
2012-11-02 22:10                         ` Marek Vasut
2012-11-05 19:50                           ` Stephen Warren
2012-11-05 22:59                             ` Marek Vasut
2012-11-05 23:07                             ` Simon Glass
2012-11-02 20:55                 ` Stephen Warren
2012-04-24 18:31 ` [U-Boot] [PATCH 1/2] part_dos: allocate cacheline aligned buffers Simon Glass
2012-04-24 18:45   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox