curopcodes in ichspi.c reflects the state of the related chipset registers. Those are reset on shutdown but curopcodes is left initialized. This prevented further runs with the same libflashrom instance.
Signed-off-by: Nico Huber nico.huber@secunet.com --- ichspi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/ichspi.c b/ichspi.c index fadfe62..060c5e1 100644 --- a/ichspi.c +++ b/ichspi.c @@ -711,6 +711,12 @@ static int ich_init_opcodes(void) return 0; } } +static int ich_shutdown_opcodes(void *const _opcodes) +{ + OPCODES **const opcodes = (OPCODES **const)_opcodes; + *opcodes = NULL; + return 0; +}
static int ich7_run_opcode(OPCODE op, uint32_t offset, uint8_t datalength, uint8_t * data, int maxdata) @@ -1811,6 +1817,10 @@ int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb, } break; } + /* FIXME: This has to be called only in the last related programmer + shutdown. Since we shutdown all programmers at once, it's + ok for now. */ + register_shutdown(ich_shutdown_opcodes, &curopcodes);
old = pci_read_byte(dev, 0xdc); msg_pdbg("SPI Read Configuration: "); @@ -1852,6 +1862,10 @@ int via_init_spi(struct pci_dev *dev, uint32_t mmio_base) internal_buses_supported = BUS_LPC | BUS_FWH; ich_generation = CHIPSET_ICH7; register_spi_programmer(&spi_programmer_via); + /* FIXME: This has to be called only in the last related programmer + shutdown. Since we shutdown all programmers at once, it's + ok for now. */ + register_shutdown(ich_shutdown_opcodes, &curopcodes);
msg_pdbg("0x00: 0x%04x (SPIS)\n", mmio_readw(ich_spibar + 0)); msg_pdbg("0x02: 0x%04x (SPIC)\n", mmio_readw(ich_spibar + 2));