mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 14:11:15 +02:00
Every SPI host controller implemented its own way to read flash chips
This was partly due to a design problem in the abstraction layer. There should be exactly two different functions for reading SPI chips: - memory mapped reads - SPI command reads. Each of them should be contained in a separate function, optionally taking parameters where needed. This patch solves the problems mentioned above, shortens the code and makes the code logic a lot more obvious. Since open-coding the min() function leads to errors, include it in this patch as well. Corresponding to flashrom svn r589. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
@ -177,12 +177,12 @@ int wbsio_spi_read(struct flashchip *flash, uint8_t *buf)
|
||||
{
|
||||
int size = flash->total_size * 1024;
|
||||
|
||||
if (flash->total_size > 1024) {
|
||||
if (size > 1024 * 1024) {
|
||||
fprintf(stderr, "%s: Winbond saved on 4 register bits so max chip size is 1024 KB!\n", __func__);
|
||||
return 1;
|
||||
}
|
||||
|
||||
memcpy(buf, (const char *)flash->virtual_memory, size);
|
||||
read_memmapped(flash, buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user