1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

spi: Allow cached ID bytes to be cleared

This does two things:
1. Removes the static variables from various ID functions and moves
   them to a single struct.
2. Adds a function to clear the struct.

The idea of the original caching mechanism introduced years ago was
simply to speed up probe_flash() by not issuing the same read ID
commands dozens or hundreds of times for a single chip.

That implementation assumed that we would only call probe_flash()
once. However, there are cases when we want to call probe_flash()
multiple times, for example, if using an external programmer and
using different voltages (for probing the chip).

This patch is extremely similar to the original works of:
 `commit 57b7524b1448189d3630d6c4735e60dbbdf14d51`.
 Author: David Hendricks <dhendrix@chromium.org>
&&
 `commit 7f7c711ee1a41649607f81f1533e5135fc1361fc`.
 Author: David Hendricks <dhendrix@chromium.org>

BUG=b:15656443
BRANCH=none
TEST=none

Change-Id: I879cb08dbe66db9ab0c3b8a7f93b04fe1c5980f4
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41399
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Edward O'Callaghan
2020-05-14 15:19:42 +10:00
committed by Edward O'Callaghan
parent a2dc4f7faf
commit 3b12945835
2 changed files with 56 additions and 34 deletions

2
spi.h
View File

@ -192,4 +192,6 @@
#define SPI_FLASHROM_BUG -5
#define SPI_PROGRAMMER_ERROR -6
void clear_spi_id_cache(void);
#endif /* !__SPI_H__ */