DescriptionDo not call EC programmer shutdown functions explicitly.
Use shutdown callbacks instead.
This CL is intended to help with the ordering problem with reverse MMIO writes. With this approach, the EC shutdown function is treated the same as other shutdown callbacks.
EC code will only register a shutdown callback if initialization is successful. The internal programmer shutdown routine will not call EC shutdown functions explicitly. This has the nice side-effect of cleaning up unneded calls to EC shutdown routines since the EC init routines will add shutdown callbacks as needed.
R=yjlou@chromium.org,reinauer@chromium.org
BUG=chromium-os:9586
TEST=tested manually by reading EC ROM on alex, mario, and zgb
The following verbose output is from before and after applying this patch and the reverse MMIO patch.
ZGB before:
done.SUCCESS
it85xx_shutdown():347
it85xx_exit_scratch_rom():219 was called ...
wpce775x_shutdown(): firmware not changed
wpce775x_shutdown: in_flash_update_mode: 1
ZGB after:
done.SUCCESS
wpce775x_shutdown(): firmware not changed
wpce775x_shutdown: in_flash_update_mode: 1
Restoring MMIO space at 0x777d6410
Mario before:
Reading flash... done.SUCCESS
it85xx_shutdown():347
it85xx_exit_scratch_rom():219 was called ...
it85xx_exit_scratch_rom():248 * SUCCESS.
powerd start/running, process 11020
Mario after:
Reading flash... done.SUCCESS
it85xx_shutdown():351
it85xx_exit_scratch_rom():221 was called ...
it85xx_exit_scratch_rom():250 * SUCCESS.
powerd start/running, process 11187
Restoring MMIO space at 0x7789e410
Alex before:
SUCCESS
it85xx_shutdown():347
it85xx_exit_scratch_rom():219 was called ...
mec1308_exit_passthru_mode: result: 0xaa (exited passthru mode)
Alex after:
SUCCESS
mec1308_exit_passthru_mode: result: 0xaa (exited passthru mode)
Restoring MMIO space at 0x7775d410
I also tested by explicitly setting and examining the BBS register using iotools before and after a flashrom trial, e.g.:
localhost chronos # RCBA_ADDR=$((($(iotools pci_read32 0x00 0x1f 0x00 0xf0) >> 14) << 14))
localhost chronos # GCS_ADDR=$((${RCBA_ADDR} + 0x3410))
localhost chronos # iotools mmio_read32 ${GCS_ADDR}
0x00400460
localhost chronos # ./flashrom -p internal:bus=lpc -r /tmp/foo.bin
flashrom v0.9.3 git@gitrw.chromium.org/flashrom : 2f88b7a : Apr 27 2011 04:21:03 UTC on Linux 2.6.32.26+drm33.12 (i686), built with libpci 3.1.4, GCC 4.4.3, little endian
sh: dmidecode: not found
dmidecode execution unsucessfull - continuing without DMI info
Reading flash... SUCCESS
localhost chronos # iotools mmio_read32 ${GCS_ADDR}
0x00400460
In this case, the register value gets set to 0x00400c60 by flashrom, reads the EC ROM, and then sets the register value back to 0x00400460.
Patch Set 1 #Patch Set 2 : rename programmer_shutdown() to shutdown() #Patch Set 3 : cleanup of some dead code #Patch Set 4 : further cleanup #Patch Set 5 : minor clean-up #Patch Set 6 : remove unneeded return statement #Patch Set 7 : rename shutdown() to flashrom_shutdown() to avoid conflict with shutdown(2) #
Total comments: 16
Patch Set 8 : flashrom_shutdown() --> programmer_shutdown(), move EC register_shutdown() calls #Patch Set 9 : call shutdown function for internal programmer explicitly #
Total comments: 10
Patch Set 10 : Fix code as per Stefan's comments #
Messages
Total messages: 9 (0 generated)
|