Am Freitag, den 05.11.2010, 20:54 +0100 schrieb Carl-Daniel Hailfinger:
Undo all PCI config space writes on shutdown. This means all chipset enables etc. will be undone on shutdown. Any writes which are one-shot should use the permanent ppci_write_* variants.
Great idea, I'm all for restoring PCI config on exiting flashrom and have flash writes disabled after the program quits. I also understand the motivation of the PCI function redirection to the auto-undo variant, but I'm not quite sure that this is a good idea: It helps keeping this patch short and simple, but it redefines what certain functions do that many developers already know (as libpci is in wide use).
There might also be some writes that don't need to be undone or even shouldn't be undone (e.g. think of "write 1 to clear" bits or other magic actions triggered just by accessing PCI registers). While I hope that flashrom doesn't need to touch any such register, the PCI writes should be individually checked for whether it makes sense to undo them. This review of all writes can then be documented by changing them to rpci_write_foo calls.
I don't know whether it works, but you might want to add a "deprecated" attribute to the pci_write_foo calls unless PCI_NO_REDIRECT is defined, so you get a compiler warning (==error in flashrom) if you don't explicitly specify "permanent" or "reversed".
Extend the number of available register_shutdown slots to 32.
Did you count that this is enough?
Regards, Michael Karcher