switch-l4t-atf/drivers/io
Roberto Vargas e19e40af97 io: block: fix block_read/write may read/write overlap buffer
The block operations were trying to optimize the number of memory
copies, and it tried to use directly the buffer supplied by the user
to them. This was a mistake because it created too many corner cases:

	1- It was possible to generate unaligned
	   operations to unaligned buffers. Drivers that were using
	   DMA transfer failed in that case.

	2- It was possible to generate read operations
	   with sizes that weren't a multiple of the block size. Some
	   low level drivers assumed that condition and they calculated
	   the number of blocks dividing the number of bytes by the
	   size of the block, without considering the remaining bytes.

	3- The block_* operations didn't control the
	   number of bytes actually copied to memory, because the
	   low level drivers were writing directly to the user buffer.

This patch rewrite block_read and block_write to use always the device
buffer, which the platform ensures that has the correct aligment and
the correct size.

Change-Id: I5e479bb7bc137e6ec205a8573eb250acd5f40420
Signed-off-by: Qixiang Xu <qixiang.xu@arm.com>
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-12-13 09:13:37 +00:00
..
io_block.c io: block: fix block_read/write may read/write overlap buffer 2017-12-13 09:13:37 +00:00
io_dummy.c io_dummy: correct sparse warnings 2017-06-23 09:38:15 +02:00
io_fip.c Use SPDX license identifiers 2017-05-03 09:39:28 +01:00
io_memmap.c Use SPDX license identifiers 2017-05-03 09:39:28 +01:00
io_semihosting.c Use SPDX license identifiers 2017-05-03 09:39:28 +01:00
io_storage.c io_storage: use unsigned int for index 2017-06-23 09:38:13 +02:00