1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 06:01:16 +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:
Carl-Daniel Hailfinger
2009-06-13 12:04:03 +00:00
parent 8b2f46b878
commit 38a059d6ef
7 changed files with 42 additions and 63 deletions

View File

@ -200,6 +200,11 @@ int read_memmapped(struct flashchip *flash, uint8_t *buf)
return 0;
}
int min(int a, int b)
{
return (a < b) ? a : b;
}
char *strcat_realloc(char *dest, const char *src)
{
dest = realloc(dest, strlen(dest) + strlen(src) + 1);