1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 15:33:42 +02:00

Try RES even if RDID fails

The existing check in probe_spi_res() was right for SPI controllers
which support all commands, but may not exist. For controllers which
support only a subset of commands, it will fail in unexpected ways. Even
if a command is supported by the controller, it may be unavailable if
the controller is locked down.

The new logic checks if RDID could be issued and its return values
made sense (not 0xff 0xff 0xff). In that case, RES probing is not
performed. Otherwise, we try RES. There is one drawback: If RDID
returned unexpected values, we don't issue a RES probe. However, in that
case we should try to match RDID anyway.

Corresponding to flashrom svn r348 and coreboot v2 svn r3774.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: FENG yu ning <fengyuning1984@gmail.com>
This commit is contained in:
Carl-Daniel Hailfinger 2008-11-27 22:48:48 +00:00
parent ebaffb6e51
commit 92a54ca030

12
spi.c
View File

@ -160,13 +160,11 @@ int probe_spi_res(struct flashchip *flash)
unsigned char readarr[3]; unsigned char readarr[3];
uint32_t model_id; uint32_t model_id;
if (spi_rdid(readarr, 3)) /* Check if RDID was successful and did not return 0xff 0xff 0xff.
/* We couldn't issue RDID, it's pointless to try RES. */ * In that case, RES is pointless.
return 0; */
if (!spi_rdid(readarr, 3) && ((readarr[0] != 0xff) ||
/* Check if RDID returns 0xff 0xff 0xff, then we use RES. */ (readarr[1] != 0xff) || (readarr[2] != 0xff)))
if ((readarr[0] != 0xff) || (readarr[1] != 0xff) ||
(readarr[2] != 0xff))
return 0; return 0;
if (spi_res(readarr)) if (spi_res(readarr))