Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Issue 6897014: Do not call EC programmer shutdown functions explicitly. (Closed)

Created:
9 years, 8 months ago by dhendrix
Modified:
9 years, 5 months ago
CC:
Louis
Base URL:
svn://coreboot.org/flashrom/trunk
Visibility:
Public.

Description

Do 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+66 lines, -64 lines) Patch
M flashrom.c View 1 2 3 4 5 6 7 8 3 chunks +11 lines, -0 lines 0 comments Download
M internal.c View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -9 lines 0 comments Download
M it85spi.c View 1 2 3 4 5 6 7 8 9 4 chunks +9 lines, -8 lines 0 comments Download
M mec1308.c View 1 2 3 4 5 6 7 8 9 3 chunks +19 lines, -17 lines 0 comments Download
M programmer.h View 1 2 3 4 5 6 7 8 3 chunks +0 lines, -3 lines 0 comments Download
M wpce775x.c View 1 2 3 4 5 6 7 8 9 3 chunks +27 lines, -27 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
dhendrix
9 years, 8 months ago (2011-04-22 01:21:37 UTC) #1
Louis
Good job!!! I love your idea that put SPI-programmer-specified shutdown functions into shutdown callback mechanism. ...
9 years, 8 months ago (2011-04-26 10:06:06 UTC) #2
dhendrix
http://codereview.chromium.org/6897014/diff/6002/flashrom.c File flashrom.c (right): http://codereview.chromium.org/6897014/diff/6002/flashrom.c#newcode579 flashrom.c:579: int flashrom_shutdown(void) On 2011/04/26 10:06:06, Louis wrote: > We ...
9 years, 8 months ago (2011-04-27 02:08:06 UTC) #3
Louis
Please see my comment inline. Actually we can do it more simply and match our ...
9 years, 8 months ago (2011-04-27 02:25:33 UTC) #4
dhendrix
Thanks for the feedback! I've made the changes, done further testing, and updated the CL ...
9 years, 8 months ago (2011-04-27 20:07:29 UTC) #5
Stefan Reinauer
http://codereview.chromium.org/6897014/diff/13001/internal.c File internal.c (right): http://codereview.chromium.org/6897014/diff/13001/internal.c#newcode374 internal.c:374: #if 0 delete this? http://codereview.chromium.org/6897014/diff/13001/mec1308.c File mec1308.c (right): http://codereview.chromium.org/6897014/diff/13001/mec1308.c#newcode45 ...
9 years, 8 months ago (2011-04-27 20:34:05 UTC) #6
dhendrix
Thanks for the style comments, Stefan. I also applied your suggested fixes to it85spi.c. http://codereview.chromium.org/6897014/diff/13001/internal.c ...
9 years, 8 months ago (2011-04-27 21:15:05 UTC) #7
Stefan Reinauer
LGTM
9 years, 8 months ago (2011-04-27 21:21:04 UTC) #8
dhendrix
9 years, 8 months ago (2011-04-27 21:32:48 UTC) #9
On 2011/04/27 21:21:04, Stefan Reinauer wrote:
> LGTM

I think I addressed Louis' comments, so I'll go ahead and push this CL so that
he can push the reverse MMIO patch.

Powered by Google App Engine
This is Rietveld 408576698