1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

linux_spi: Reduce maximum read chunksize

It turned out that older kernels use a single buffer of `bufsiz` bytes
for combined input and output data. So we have to account for the read
command + max 4 address bytes.

Change-Id: Ide50db38af1004fde09a70b15938e77f5e1285ac
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Tested-by: Julian von Mendel <git@jinvent.de>
Reviewed-on: https://review.coreboot.org/25149
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julian von Mendel <git@jinvent.de>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
This commit is contained in:
Nico Huber 2018-03-08 16:14:15 +01:00 committed by Nico Huber
parent a3ab6c6c3a
commit 22418428ed

View File

@ -221,8 +221,9 @@ static int linux_spi_send_command(struct flashctx *flash, unsigned int writecnt,
static int linux_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) static int linux_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len)
{ {
/* Read buffer is fully utilized for data. */ /* Older kernels use a single buffer for combined input and output
return spi_read_chunked(flash, buf, start, len, max_kernel_buf_size); data. So account for longest possible command + address, too. */
return spi_read_chunked(flash, buf, start, len, max_kernel_buf_size - 5);
} }
static int linux_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len) static int linux_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len)