Second try, with the patch actually attached this time.
Hi everyone,Lately we've been looking into reverse PCI and MMIO writes, along with the shutdown callback mechanism.The main usage case for Flashrom makes this a pretty simple matter, since most users only worry about a single programmer being used. However, when external devices are used which depend on internal programmer settings, things can get messy.Consider the case of a laptop with an x86 southbridge and an EC -- To communicate with the EC thru the LPC/FWH interface, some register settings in the southbridge might need to be changed. The code flow should be:1. Set up SB, use rpci_* and rmmio_* to register reverse PCI and MMIO callbacks wherever necessary.2. Set up EC.3. Run code.4. Call EC shutdown routine.5. Reverse SB PCI/MMIO writes.However, the current code calls the programmer shutdown routine in step 4 after doing all shutdown callbacks in step 5. This causes southbridge registers to be reverted before the EC's shutdown routine is called, potentially making the EC unreachable.The attached patch addresses this by using programmer shutdown functions the same as any other shutdown callback. The internal_shutdown function is registered early in the internal_init() function so that newly discovered external programmers (ie SuperIO/EC LPC -> SPI bridges) can be discovered and have their shutdown callbacks added in the correct order.If this seems useful, we should make necessary changes to other programmers as well before committing this patch.Signed-off-by: David Hendricks <dhendrix@google.com>
--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.