Nico Huber has uploaded this change for review.

View Change

Cleanup ichspi opcode settings on shutdown

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.

Change-Id: Ifd7f2693103ea4608c5e412fd856ebd5c6e33e19
Signed-off-by: Nico Huber <nico.huber@secunet.com>
---
M ichspi.c
1 file changed, 14 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/28/25128/1
diff --git a/ichspi.c b/ichspi.c
index 12f4584..ceb9b6e 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -711,6 +711,12 @@
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 @@
}
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 @@
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));

To view, visit change 25128. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd7f2693103ea4608c5e412fd856ebd5c6e33e19
Gerrit-Change-Number: 25128
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>