Commit Graph

74 Commits

Author SHA1 Message Date
Daisuke Nojiri
8912169231 Disable EC jump after RW image starts
TEST=Built and booted Peppy. Ran flashrom from user space and
verified the EC firmware was updated after reboot.

CQ-DEPEND=CL:172651, CL:172652, CL:178324
BRANCH=none
BUG=chromium:325286
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: Ia73da70dbf3abb5ced48666e86715c8d24a431a0
Reviewed-on: https://chromium-review.googlesource.com/172635
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@google.com>
Commit-Queue: Daisuke Nojiri <dnojiri@google.com>
2013-12-06 02:13:49 +00:00
Simon Glass
527ba810ef Implementation of Region API
At present reading data from storage in Vboot is a little fragmented. For
the firmware image, we expect the boot loader to handle this. For the disk
we have a block-level API. For the GBB (which also sits in the firmware
image) we expect the entire thing to be read before Vboot is called.

Add the concept of a region, and an API to read from a region. At present,
and most pressing, is reading from a GBB region. In the future this could
be extended to other parts of the firmware or even the disk.

Move all access to the GBB into this API so that the boot loader can provide
either a GBB region in one large contiguous chunk, or a function to deal with
read requests from vboot.

The call to VbExRegionRead() is behind a flag since not all boot loaders
support it yet.

The main change for boot loaders which don't support this new API is that
vboot will do more behind the scenes. For example, it will allocate memory
for chunks of data that it reads from the GBB, rather than just accessing it
directly. This approach is considerably simpler than trying to pass char **
everywhere and have vboot decide whether something needs to be allocated or
not.

The tests are updated, mainly to include setting up a GBB structure
accessible from VbCommonParams, which is now required by the firmware and
kernel functions. In normal operation this is set up at the start of
VbLoadFIrmware() and VbSelectAndLoadKernel() but for tests which call
children of these functions directly, the GBB structure must be set up
manually by the test.

BUG=chrome-os-partner:21115
BRANCH=none
TEST=manual
FEATURES=test sudo -E  emerge vboot_reference

Change-Id: If2b8bbe467fdbd643239d8d9b5d7aa98df4d286f
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/63336
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/167361
2013-08-30 16:47:03 +00:00
Yoshiki Iguchi
8fa13ad6f7 Revert "Implementation of Region API"
This reverts commit 1d3c804b6b.

This patch breaks cbuildbot on internal paladins bots.

Change-Id: Icf7f9d9bbb56b092035888eaa3e249ffd23fac16
(cherry picked from commit 3a60335ebb1530e5fd9d5da3bc6214949bc59caf)
Reviewed-on: https://chromium-review.googlesource.com/167451
Reviewed-by: Yoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Yoshiki Iguchi <yoshiki@chromium.org>
Tested-by: Yoshiki Iguchi <yoshiki@chromium.org>
2013-08-29 05:36:12 +00:00
Simon Glass
1d3c804b6b Implementation of Region API
At present reading data from storage in Vboot is a little fragmented. For
the firmware image, we expect the boot loader to handle this. For the disk
we have a block-level API. For the GBB (which also sits in the firmware
image) we expect the entire thing to be read before Vboot is called.

Add the concept of a region, and an API to read from a region. At present,
and most pressing, is reading from a GBB region. In the future this could
be extended to other parts of the firmware or even the disk.

Move all access to the GBB into this API so that the boot loader can provide
either a GBB region in one large contiguous chunk, or a function to deal with
read requests from vboot.

The call to VbExRegionRead() is behind a flag since not all boot loaders
support it yet.

The main change for boot loaders which don't support this new API is that
vboot will do more behind the scenes. For example, it will allocate memory
for chunks of data that it reads from the GBB, rather than just accessing it
directly. This approach is considerably simpler than trying to pass char **
everywhere and have vboot decide whether something needs to be allocated or
not.

The tests are updated, mainly to include setting up a GBB structure
accessible from VbCommonParams, which is now required by the firmware and
kernel functions. In normal operation this is set up at the start of
VbLoadFIrmware() and VbSelectAndLoadKernel() but for tests which call
children of these functions directly, the GBB structure must be set up
manually by the test.

BUG=chrome-os-partner:21115
BRANCH=none
TEST=manual
FEATURES=test sudo -E  emerge vboot_reference

Change-Id: I2c19e9dc2ed602d0642bbf4f7d27f79fe9fad873
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/63336
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-08-28 18:30:35 +00:00
Simon Glass
981cb2acdc Enable vboot for sandbox and improve debugging/format strings
Some functions of vboot are disabled for sandbox because sandbox could not
support them. This has changed, so remove the sandbox #ifdefs in the code.

Some printf() strings cause warnings on sandbox - mostly that uin64_t is
not 'long long' on a 64-bit machine. The existing format strings in U-Boot
do not seem to take account of this, so add casts to remove the warnings.

Also add a few more debug strings to make it easier to see what is happening
in the vboot flow.

BUG=chrome-os-partner:21115
BRANCH=pit
TEST=manual
crosfw -b sandbox -V

See there are no warnings.

Change-Id: I86f90a693e4bd23fcacf6d48297dd32229348dd4
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65621
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-08-24 09:37:48 -07:00
Vadim Bendebury
7aa250f2db Fix incorrect format strings
In many cases format strings in vboot_reference do not match their
parameters, which causes all kind of ugly results when examining debug
output.

Enforce proper format verification.

CQ-DEPEND=CL:65396
BRANCH=pit
BUG=none
TEST=manual
   . compiled cleanly in vboot_reference, observed debug printouts
     making sense.

Change-Id: I58d5ba1f9097ef9922fbaeb7a9946aadf5eb8617
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65394
2013-08-10 20:26:39 -07:00
Shawn Nematbakhsh
964144bf2f rollback_index: Add recovery parameter to RollbackKernelLock.
RollbackKernelLock previously checked a global to determine recovery
mode state. Since we have two copies of vboot_reference in firmware
(in coreboot and depthcharge), this creates a problem with
synchronization. Remove the global entirely and instead pass the
recovery state to RollbackKernelLock.

BUG=chrome-os-partner:20913.
TEST=Manual. Boot factory install shim in recovery mode and verify TPM
clear operations succeed. Boot in dev mode and verify "Lock physical
presence" print on UART.
BRANCH=FalcoPeppy.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I4e751d4a9ca60cd57c5c662ce86eba595fb22ba2
Reviewed-on: https://gerrit.chromium.org/gerrit/62874
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-22 23:14:11 -07:00
Vadim Bendebury
48b26dff12 Correct debug message typo
BRANCH=none
BUG=none
TEST=manual
   . observe proper function name reported in the debug output

Change-Id: I03f87f0f5816db73a105687cd1a67f21c891f677
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/59642
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-06-24 13:08:11 -07:00
Randall Spangler
f2a1dc0a54 Add GBB flags for disabling software sync and defaulting to legacy boot
1) GBB flag to skip EC software sync, so EC will be untouched.  Needed
for EC development.

2) GBB flag to default to booting legacy at end of dev screen timeout.
Very handy for booting Ubuntu (or other OS).

Also added unit tests for the new flags.

BUG=chrome-os-partner:20111
BRANCH=none
TEST=make runtests

Change-Id: I9da87d87014881a1b1393b0b4a5acb921d080066
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58270
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-06-12 09:22:32 -07:00
Randall Spangler
19c996909d EC software sync no longer checks for shutdown requested
This means that in normal mode the system will boot all the way to the
OS before shutting down.

In developer or recovery modes, the BIOS screens will still check for
shutdown requested and shut down if so.  This is necessary in
developer mode for security reasons, and because there's no guarantee
that a dev OS will still pay attention to the lid switch.

BUG=chrome-os-partner:17521
BRANCH=spring
TEST=make runtests; unit tests pass

Change-Id: I0698b659ad0febcf73043f1e8c5b98681c1bc5ba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58109
2013-06-12 09:22:32 -07:00
Bill Richardson
0c3ba249ab Massive refactoring of external header files.
This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.

BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023

  sudo FEATURES=test emerge vboot_reference
  FEATURES=test emerge-$BOARD \
                vboot_reference \
                chromeos-cryptohome \
                chromeos-installer \
                chromeos-u-boot \
                peach-u-boot \
                depthcharge

Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-02 14:12:52 -07:00
Aaron Durbin
612797edfa fwlib: fix errors with -Wmissing-prototypes
When the fwlib is built with -Wmissing-prototypes and -Werror
there build breakages that occur. Fix these errors by either
including the header file with the correct declaration or provide
the declaration at the top of the c files for global symbols that
are used by tests.

BUG=chrome-os-partner:17695
BRANCH=None
TEST=built fwlib library with -Wmissing-prototypes and -Werror. Also
     'make runtests' still passes.

Change-Id: I992516ee2545509054887173bc65234905381e06
Signed-off-by: Aaron Durbin
Reviewed-on: https://gerrit.chromium.org/gerrit/44042
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-02-26 08:46:20 -08:00
Randall Spangler
886a9047f0 Software sync checks for shutdown-requested in all code paths
Previously,
1) AP-RO, EC-RO -> checked
2) AP-RW, EC-RO transition to EC-RW -> checked
3) AP-RW, EC-RW already -> NOT checked

Now, (3) calls VbExIsShutdownRequested() as well.

This fix is needed to avoid inconsistent behavior of software sync
after we ship a RW update.

Whether we *should* actually shut down or not based on how/why we
booted is a separate issue to be addressed by the U-boot
implementation of VbExIsShutdownRequested() in a separate CL.

BUG=chromium-os:38645
BRANCH=all
TEST=make runtests

Manual testing also possible - force AP-RW firmware, then reboot with
lid closed.  Previously, the first boot would shut down because of
(2), but subsequent reboots of the AP only wouldn't because of (3).

Change-Id: I226202f48d793b88a30ffa62731de878f8c22315
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43044
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-02-12 10:35:12 -08:00
Randall Spangler
7f43669630 Add more vboot_api_kernel tests
BUG=chromium-os:38139
BRANCH=none
TEST=make runtests && FEATURES=test emerge-daisy vboot_reference

Change-Id: Ib280b80ba707f8a2141d728f78ae296774b1301a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42669
2013-02-06 17:38:05 -08:00
Randall Spangler
5ca4ea087a EC software sync uses precomputed hash if available
This removes the need to load the EC code at all when the precomputed
hash matches.

BUG=chrome-os-partner:17606
BRANCH=spring
TEST=wouldn't that be nice

Change-Id: If4438b9db8b1449b8fd4d90ef3acb3bbec5e09a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42567
2013-02-06 17:38:03 -08:00
Randall Spangler
29accd980a Reformat to kernel style
No code changes, just reformatting.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: I0adb8044ff79a1653a5093ba24934d87b142c9b7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42565
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-02-04 16:54:12 -08:00
Bill Richardson
640b1c4207 Add more recovery_reason codes
There are several places where the same recovery_reason was used to report
slightly different points of failure. Let's create some new codes instead.

Remember that recovery mode is handled by RO firmware, so if an updated RW
firmware uses one of the new error codes, pressing TAB at the recovery
screen will say "We have no idea what this means". That's not a bug. This CL
deprecates the original codes, so the fact that the RO firmware doesn't
recognize it just means it's a new code reported by a new RW BIOS.

BUG=chromium-os:36562
TEST=manual
BRANCH=parrot

Run

  make && make runtests

It should pass. You can test some of the error cases on actual hardware by
using

  crossystem recovery_reason=86
  reboot

and pressing TAB at the recovery screen. For that example you should see the
message

  recovery_reason: 0x56 TPM lock error in rewritable firmare

Change-Id: I123c781e6c6f6fe0284c4fd49f5f5a855eece7df
Reviewed-on: https://gerrit.chromium.org/gerrit/38652
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-11-26 12:04:42 -08:00
Shawn Nematbakhsh
ba7fd8dff8 vboot_reference: Fix keyboard input lag at confirm screen.
Changing languages is terribly slow at the confirm screen, when
switching from dev to normal. Reduce sleep time to improve user
experience.

BUG=chrome-os-partner:15726
TEST=boot in dev, hit space, hit arrows rapidly to change language,
observe no lag.
BRANCH=butterfly, stout

Change-Id: I0943debc31d78dcfce87e7f7d4537ae47f5f8cfd
Reviewed-on: https://gerrit.chromium.org/gerrit/36956
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Shawn Nematbakhsh <shawnn@google.com>
Tested-by: Shawn Nematbakhsh <shawnn@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-30 18:23:50 -07:00
Hung-Te Lin
00311b8644 vboot_api_kernel: Print warning in Ctrl-U when dev_boot_usb is not enabled.
Ctrl-U used to simply beep without messages for why it does not work (due to NV
data dev_boot_usb). Since the system is already in Developer mode, it should be
fine to provide some debug information otherwise we can spent time trying to
figure out why the firmware doesn't work.

BRANCH=all
BUG=chrome-os-partner:14474
TEST=flash image to Link, enter DEV and press Ctrl-U; gets beep and warning messages.

Change-Id: Iab20ecdb2e1c4e267b7257a7bd241006241ddf70
Reviewed-on: https://gerrit.chromium.org/gerrit/34406
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-10-03 07:33:41 -07:00
Hung-Te Lin
cb85206ebf vboot_api_kernel: Print warning in TONORM when GBB flags force DEV.
We use gbb-flag-force-dev-switch-on in default firmware images to make
things easier for factory and some devs.

But when we request normal mode there should be some sort of warning/error
telling the user that this is not available, otherwise we can spent time trying
to figure out why the firmware doesn't work.

BRANCH=all
BUG=chrome-os-partner:14474
TEST=flash image to Link, set GBB flags to 0x39, boot to DEV screen
     and press SPACE (TONORM); gets beep and warning messages.

Change-Id: Id48c12693c7575001fae7fad92a868cb5465e83d
Reviewed-on: https://gerrit.chromium.org/gerrit/34172
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2012-09-27 19:08:01 -07:00
Stefan Reinauer
a2326ee152 Add CTRL-L in dev screen to support a "legacy boot option"
This option is disabled per default and can be enabled with
crossystem dev_boot_legacy=1
or by setting the GBB flag
GBB_FLAG_FORCE_DEV_BOOT_LEGACY      0x00000080

BUG=chrome-os-partner:6108
TEST=crossystem dev_boot_legacy=1
     boot to dev mode screen, press CTRL-L, see SeaBIOS start
     (other CLs needed)
BRANCH=link
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>

Change-Id: I593d2be7cff5ca07b8d08012c4514a172bd75a38
Reviewed-on: https://gerrit.chromium.org/gerrit/31265
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
2012-09-20 17:32:22 -07:00
Gabe Black
172360ec5d Replace %L with %ll in format strings.
%L is, in some standard libraries like U-Boot's, a synonym for %ll which is
for long long integers, required by the C99 standard to be at least 64 bits.
For practical purposes that basically means %ll should be used with 64 bit
values. Since %L seems to be non-standard and, at least in U-Boot's case, %ll
is recognized in the same way, %ll seems preferable.

BUG=chrome-os-partner:8339
TEST=Booted ChromeOS using depthcharge and U-Boot. Booted with
depthcharge/libpayload which does not support %L and saw a number where %L had
been printed.
BRANCH=None

Change-Id: Id51fb5c9295e0dd65b42a5c0738eb34c8210a2b2
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/32660
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-09-09 20:52:21 -07:00
Simon Glass
74fa20748d Check keyboard more often in recovery mode
Currently we check the keyboard each 250ms. This makes for a pretty choppy
experience when changing languages. Change to check every 20ms, without
changing the disk check interval (which remains 1s).

BUG=chrome-os-partner:13717
BRANCH=snow
TEST=manual
Boot into recovery
Try changing language on snow with left/right arrow and see that it updates
instantly.

Change-Id: I2ae411bc36fdb2badac11595b099bca43f116669
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32463
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-09-07 01:00:03 -07:00
Randall Spangler
0b4c028891 Esc at DEV screen no longer triggers TONORM
BUG=chrome-os-partner:13765
BRANCH=all
TEST=manual

1. boot in dev mode.  see DEV screen
2. press space -> TONORM
3. press esc -> DEV
4. press esc -> (still at DEV)

Change-Id: I9ed2fd2ff2380b058f1aa677ccd516d9fd5679d2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32454
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2012-09-06 17:32:33 -07:00
Randall Spangler
5eb7cdba0e Fix handling of enter and space in developer screens.
At DEV screen:
- Space triggers TONORM
- Enter is ignored unless new GBB flag is set

At TONORM screen:
- Enter always means YES
- Space is ignored

So, if you hold the space key at the dev screen, you'll go to tonorm
and stay there until you press Enter or Esc.  If you hold the Enter
key at the dev screen, nothing will happen.

Add a GBB flag to allow Enter to trigger the TONORM screen; this will
be used by FAFT testing.

BRANCH=all
BUG=chrome-os-partner:12699
TEST=manual

1. press enter at dev screen.  nothing happens.
2. press space at dev screen.  tonorm.
3. press space at tonorm.  nothing happens.
4. press enter at tonorm.  turns off dev mode.

Change-Id: I9f3128d5114e1486911cc4d76d0ccd5649de1680
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/30456
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-08-16 17:40:51 -07:00
Vadim Bendebury
b321dbb6bc Get kernel size/load address from vboot headers
Presently kernel load address and buffer size are programmed in the
u-boot device tree. There is no reason for this: the address and size
are part of the vboot encapsulation headers. Duplicating this
information hardcoded in the device tree does not bring any benefit
and is in fact harmful, as it is easy to get out of sync.

A better way of doing things is to derive kernel load address and size
from the appropriate vboot header. ARM people object to this, as they
want the very same kernel blob operate on devices with DRAM mapped to
different address ranges.

The suggested solution is to exclude the kernel memory section from
the device tree on the platforms where the load address could be
safely taken from the vboot header. In this case u-boot will pass
address of zero to vboot, which will know to derive the address/size
from the appropriate header. vboot then rewrites fields of the u-boot
supplied structure with actual address and size of the kernel blob.

There is no sanity check yet, as it is presumed that there is enough
memory to load any kernel and u-boot does not use the space above
0x100000 for at least 16 megabytes (the kernel partition size). On x86
platform the check could be verify that the top of the kernel space is
well below the stack.

BUG=chrome-os-partner:11994
TEST=manual
  . with the appropriate u-boot change run a Link target through a
    FAFT cycle, observe it succeed.

Change-Id: I3c2c2cefb1e31d16ac497a01894bf32638479ed7
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/29038
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-08-14 14:04:20 -07:00
Hung-Te Lin
9ea8e0d390 firmware: Add TONORM_CONFIRM screen.
We need to alert user his change has been accepted for 5 seconds.

BUG=chrome-os-partner:11078
TEST=emerge-daisy vboot_reference-firmware vboot_reference chromeos-u-boot chromeos-boogimage

Change-Id: I6a3b13e7543479fbd6543d759093ecf501fb1d04
Reviewed-on: https://gerrit.chromium.org/gerrit/29982
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2012-08-13 17:25:13 -07:00
Bill Richardson
f217520215 vboot: add flag to indicate that the EC is slow to program
Some EC's are slow to program their firmware. This could happen at any boot
as part of software sync. This adds the VB_INIT_FLAG_EC_SLOW_UPDATE input
flag to VbInit(), so that vboot knows to display the EC-is-being-programmed
screen when that flag is set.

BUG=chrome-os-partner:12255
TEST=none

This isn't activated yet by anything, so there's nothing to test.

Change-Id: Id4d12e463fcdee017b7c52b53a2facefc33b745f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/29370
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-08-07 09:08:50 -07:00
Bill Richardson
2934475dbc TONORM screen should display at Dev screen, not Recovery screen.
We're still working out the correct behavior for the keyboard-based
dev-mode. Before this, we rebooted into recovery mode before asking if you
wanted to return to normal mode, so if you said "no, stay in dev-mode" you'd
still be at the recovery screen.

But now the confirmation for returning to normal mode happens at the
dev-mode screen, so you never get to the recovery screen (unless normal mode
won't boot, in which case you get there automatically).

BUG=chrome-os-partner:11707
TEST=manual

First, clear the GBB flags so that you can actually test the virtual dev
switch:

  /usr/share/vboot/bin/set_gbb_flags.sh 0
  reboot

It should come up in normal mode.

Activate keyboard-based dev-mode as before:
- three-finger salute
- Ctrl-D at the recovery screen
- Press ENTER when asked

Now, at the DEV screen, try to leave:
- Press SPACE. It should ask if you want to go to normal mode.
- Press ESC (no). You should be back at the DEV screen again.
- Press ENTER. It should ask if you want to go to normal mode.
- Press ESC (no). You should be back at the DEV screen again.
- Press SPACE. It should ask if you want to go to normal mode.
- Press ENTER (yes). It should reboot into normal mode.

Change-Id: I99af6e7b97fb61f943bd14c8c7166571b5ccf106
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28872
2012-08-02 15:36:42 -07:00
Randall Spangler
7c3a486d6d Flush keyboard at start of screens which take keyboard input
BUG=chrome-os-partner:11887
TEST=manual

Boot with dev mode on.  Boots normally.

Boot with dev mode on, hammering on ENTER key as soon as you release power.
Dev mode screen is shown.
Keep hammering.  Dev screen will stay up as long as you do this.
Wait >2 sec.
Press ENTER.  System reboots to TONORM screen.

Change-Id: I18e35b23c18a65637a84d3d1964b291e0cb5e8c5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28995
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-08-01 18:01:52 -07:00
Randall Spangler
6c9f097380 Revert "Enter key at DEV screen no longer transition to TONORM screen"
This reverts commit 2b45044edf

We will instead flush the keyboard buffer at the start of screens which accept keyboard input.

Change-Id: I1f5a480c6c1eeb7432b557dd4d984c1450ac973e
Reviewed-on: https://gerrit.chromium.org/gerrit/28952
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-08-01 12:22:49 -07:00
Randall Spangler
2b45044edf Enter key at DEV screen no longer transition to TONORM screen
And space at TONORM screen no longer confirms disabling dev mode

Added Ctrl+Refresh as an alias for tonorm screen request.  U-boot will
need to be enhanced to support that.  Until then, many FAFT tests will
break.

BUG=chrome-os-partner:11887
TEST=manual

1. Boot to DEV screen
2. Press Enter.  Nothing happens.
3. Press Space.  Goes to TONORM screen.
4. Press Space.  Nothing happens.
5. Press Enter.  Reboots with dev mode disabled.

Change-Id: I7f61c4001c668ac916f50f931a79a107752c83b5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28851
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-31 16:07:33 -07:00
Randall Spangler
0c32130a57 Shut down after EC software sync if lid is closed
So if the EC reboots when the lid is closed (for example, it wakes
from hibernate because the AC adapter was inserted), it won't leave
the AP powered on.

BUG=chrome-os-partner:11087
TEST=manual

   Reboot EC with lid closed ('reboot hard').
   Should finish software sync and shut down.
   Reboot EC with lid open. Boots.
   Hibernate EC and wake with lid open. Boots.
   Hibernate EC and wake with power button press. Boots.
   Reboot into recovery mode. Boots. Press power button; shuts down.
   Reboot into recovery mode. Boots. Close lid; shuts down.

CQ-DEPEND=*22578

Change-Id: I09d5331222aa10b73518f9f574ec5a32d8e6ac23
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28525
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-26 16:50:10 -07:00
Randall Spangler
584e0d2070 Add more specific recovery reasons for EC software sync.
Software sync will, of course, work perfectly, so these will never be needed.

BUG=none
TEST=none (hey, it all works perfectly)

Change-Id: I0014dfb99507c5eb00de73b77edb7538b598658f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28495
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-26 16:25:35 -07:00
Randall Spangler
09d0c2e487 Handle reboots required to protect/unprotect RW firmware
Necessary for updating snow EC

BUG=chrome-os-partner:11087
TEST=force an EC update by loading a slightly old EC and then a new BIOS

Change-Id: Id00257f8a67c08077a5b396cf120a056a7601671
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28436
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-25 18:07:20 -07:00
Randall Spangler
241de33bab EC software sync now updates RW firmware if necessary.
BUG=chrome-os-partner:11087
TEST=manual

1. Update EC to a new version
2. Rebuild EC code and chromeos-bootimage
3. Update BIOS (AP) RW firmware
4. Reboot.  EC should get updated to the version in the BIOS iamge.

CQ-DEPEND=28414

Change-Id: I227d9bf7cc1f4984d6eb13b5372bcf4181ad0df5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28415
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-25 18:07:20 -07:00
Bill Richardson
1a72ad60d7 Call VbExEcGetExpectedRW() with the correct parameters.
vboot is passing in an index but the function expects an enum.

BUG=chrome-os-partner:11765
TEST=manual

Build with serial enabled, watch what happens. Before, it does this:

  ec.c: VbExEcGetExpectedRW: Unrecognized EC firmware requested.
  VbEcSoftwareSync() - VbExEcGetExpectedRW() returned 65536
  VbSetRecoveryRequest(34)

After this change, it should get a little further:

  ec.c: VbExEcGetExpectedRW: EC-RW image offset 0 size 0.
  ec.c: VbExEcGetExpectedRW: EC image has bogus size.
  VbEcSoftwareSync() - VbExEcGetExpectedRW() returned 65536
  VbSetRecoveryRequest(34)

Sigh.

Change-Id: Ideb5f9d70bc5f3f202a8e04a6ec718e1d674d526
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28341
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-24 18:55:36 -07:00
Randall Spangler
029ae65756 VbExEcGetExpectedRW() should take a const **
Since vboot is expected not to modify the contents of the returned pointer.

BUG=chrome-os-partner:11148
TEST=if it builds, it worked

This change MUST be submitted at the same time as u-boot
https://gerrit.chromium.org/gerrit/28146.

Change-Id: Ieeee8f456a7fbd9fe6b108a29e208058310b471b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28145
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-23 16:12:53 -07:00
Randall Spangler
d4faa060cc Partial EC software sync implementation
Doesn't check the EC hash, but does jump to the correct image, for now
assuming the hash is good.

BUG=chrome-os-partner:11087
TEST=manual

- Power+refresh.  System boots.  EC is in RO (verify via 'ectool version')
- Create a BIOS signed *without* RO-normal.
- Power+refresh.  System boots.  EC ends up in A.
- ectool eventgetb.  Event 0x2000 IS present, indicating EC has rebooted
- ectool eventclearb -1
- Power button to shut down, then power button to power back on.
- ectool eventgetb.  Event 0x2000 is NOT present.
- crossystem recovery_request=123 && reboot.  System reboots to recovery mode
  and EC is in read-only (verify via EC console 'sysinfo')
- Power off and on.  System boots.  EC ends up in A again.

Change-Id: I39682d1bf7215c62a4b20613d029e78194b98826
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27574
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-16 18:23:28 -07:00
Bill Richardson
592567e956 Remove VbExTrustEC() from vboot, so it can go into BIOS.
The VbExTrustEC function should be implemented in the BIOS, not the vboot
library. Also, weak references don't seem to work with our linker, so we'll
have to just require it always.

BUG=chrome-os-partner:9953
TEST=none

This must go in with a simultaneous change to U-Boot. The only test is
whether or not everything continues to compile.

Change-Id: I8a5ccb167eec3bcacbe892cf0bdcfe550a1f57d6
Reviewed-on: https://gerrit.chromium.org/gerrit/25557
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-06-18 15:21:30 -07:00
Randall Spangler
acd6f4688a Add GBB flags to enable dev mode by default
And enable dev_boot_usb by default.
And disable rollback checks.

The first flag is necessary for factory to build with keyboard
controlled dev mode.  The other flags are really handy for development
on systems where you've defeated firmware WP and are installing custom
firmware.

BUG=chromium-os:31844
TEST=make && make runtests

Signed-off-by: Randall Spangler <rspangler@chromium.org>

Change-Id: I9d837fee676cb0186ea98f13005ad60a9ab86393
Reviewed-on: https://gerrit.chromium.org/gerrit/25265
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Randall Spangler <rspangler@chromium.org>
2012-06-14 18:57:52 -07:00
Bill Richardson
ec8df1628c Support virtual dev-switch (keyboard-based dev-mode)
BUG=chrome-os-partner:9706
TEST=manual

Currently, Link is the only platform that enables this feature.

To enter dev-mode:

  Boot into recovery mode using the magic key chord. At the Insert screen,
  press Ctrl-D. You'll be asked if you want to enter developer mode. If you
  then press ENTER, it will reboot with dev-mode enabled. If you press SPACE
  or ESC, it will return to the Insert screen.

  If you enter recovery mode through any other means, or if dev-mode is
  already enabled, pressing Ctrl-D at the Insert screen will have no effect.

To return to normal mode:

  Reboot. At the Dev screen, press ENTER or SPACE. It will reboot to
  recovery mode and ask you if you want to return to normal mode. If you
  press ESC or power off, you'll still be in dev-mode. Press ENTER or SPACE,
  and it will reboot into normal mode (of course, if you've messed up your
  images while in dev-mode, you'll just come right back to recovery mode
  again).

  You can also request a direct return to normal mode by running

    crossystem disable_dev_request=1

  and rebooting.

Change-Id: I435905855a6c39932ee466cc046bdc4c4c860f98
Reviewed-on: https://gerrit.chromium.org/gerrit/24160
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-06-08 22:24:05 -07:00
Tom Wai-Hong Tam
2ddd5f6451 Add Ctrl-Enter as an additional key to trigger dev USB boot.
Due to the limitation of servo that is unable to send U keys, dev USB boot
(triggered by Ctrl-U) is unable to be tested on FAFT. To solve it, firmware
should add an addition key combination to workaround it. Ctrl-Enter is the
one we picked.

BUG=chrome-os-partner:6759
TEST=compile the firmware and update it to Lumpy; during the dev screen,
press Ctrl-Enter to trigger USB boot.

Change-Id: I8215a241c3c07dc2f5e194c324459f106d007f47
Reviewed-on: https://gerrit.chromium.org/gerrit/15749
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-02-14 22:25:53 -08:00
Bill Richardson
cbfc6dbd23 Oops. Must still distinguish "no disks" from "no valid disks".
The fix for chrome-os-partner:7715 introduced a new bug. This fixes that.

BUG=chrome-os-partner:7775
TEST=manual

Boot into recovery mode.
Insert invalid USB.

You should see the YUCK screen.

Change-Id: I868287eecd34bb0c48127bee04f573b418f5945c
Reviewed-on: https://gerrit.chromium.org/gerrit/14963
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2012-01-27 10:54:19 -08:00
Bill Richardson
bf020a0d4d Make VbTryLoadKernel() go to recovery when no valid disks are found
Previously, it was going to recovery only when no disks existed. That didn't
catch the case where disks exist but none of them are usable.

BUG=chrome-os-partner:7715
TEST=manual

I've added a test specifically for this, so just

  make
  make runtests

should verify it.

To test on actual hardware, find a disk or USB drive that has something
other than 512 bytes per LBA, and try it. It won't be bootable, but using it
shouldn't hang the system or cause weird behavior.

Once in recovery, press TAB, and you should see the reason code
VBNV_RECOVERY_RW_NO_DISK

Change-Id: I475ddd01e13fa806025a2107c260c030d098a17e
Reviewed-on: https://gerrit.chromium.org/gerrit/14816
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-01-25 15:12:09 -08:00
Bill Richardson
5fd35971de Be aggressive in saving locale to nvram.
On x86 platforms, the power button and lid switch events have to be handled
by coreboot SMM code, because it needs to interact with the southbridge
and/or EC, and U-Boot doesn't have a way to do that. Once the kernel takes
over, it sends an SMI to that code which tells it to start delivering ACPI
events instead of whatever pre-ACPI handling it has been doing.

U-Boot doesn't have any code to handle either case, and adding it would
either be a major undertaking (adding ACPI support to U-Boot!), or would
require creating yet another special-purpose interface just for our U-Boot
(yuck).

It's much simpler to just make vboot_reference be more aggressive about
writing to the nvram for this one case where it matters.

OTOH, ARM will need U-Boot to handle the lid switch and power button via
GPIOs since it uses only U-Boot and has no SMI handler. This change isn't
necessary for ARM, but shouldn't hurt either.

BUG=chrome-os-partner:7689
TEST=manual

1. Boot to dev-mode screen or recovery screen.
2. Press arrow keys to change locale.
3. Power off (press power button or yank A/C & battery)
4. Power on again.

The BIOS screen locale should still be set to your last choice before
powering off.

Change-Id: I9008811c3be71de47ff1c6899e81955cf0560a52
Reviewed-on: https://gerrit.chromium.org/gerrit/14721
Tested-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-01-24 15:04:46 -08:00
Vincent Palatin
25381875e1 Acknowledge Ctrl+U faster
When the user hits Ctrl+U on the dev screen, we used to change the
screen only after we enumerate the USB devices, load the kernel from USB
mass storage and boot it (about 4 seconds on the current firmware).
Let's blank the screen earlier to show we got the key press.

BUG=chrome-os-partner:7563
TEST=on a Stumpy in developer, hit Ctrl+U on the dev screen with an
invalid key, then a valid key. Check which screen are displayed and how
long it takes to get a new display after the key strokes.

Change-Id: Ifc73b56055bcd50360d71c1cb6dee052d0fdf9aa
Reviewed-on: https://gerrit.chromium.org/gerrit/14395
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-01-18 13:15:45 -08:00
Bill Richardson
82e69b9f74 Clean up return codes for better interaction with U-Boot.
BUG=none
TEST=none

Change-Id: I432de92e00444b58c20faadf8671ccc1c0056e28
Reviewed-on: https://gerrit.chromium.org/gerrit/14181
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-01-17 09:09:39 -08:00
Bill Richardson
759d5c4ccd ONLY pressing the recovery button okays booting from USB
BUG=chrome-os-partner:1113
TEST=manual

With the dev-switch OFF, insert a bootable USB drive, reboot while holding
down recovery button. It should boot from the USB without prompting for
removal.

With the dev-switch OFF and the same bootable USB drive inserted, run

  crossystem recovery_request=2
  reboot

The BIOS screen should prompt you to remove the USB drive, then to insert it
before it will boot from the USB.

Prior to this fix, using recovery_request=2 would NOT require removal, while
other non-zero values would. NO values of recovery_request should be able to
override the removal request. Only physically pressing the button should
allow booting immediately from recovery mode with the dev-switch OFF.

Change-Id: I6d63ecb761c4b26820091cc7a97ca540b362c22e
Reviewed-on: https://gerrit.chromium.org/gerrit/12143
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-11-28 12:26:20 -08:00
Bill Richardson
591f07822b Pressing the recovery button okays booting from USB
BUG=chrome-os-partner:1113
TEST=manual

With the dev-switch OFF, insert a bootable USB drive, reboot while holding
down recovery button. It should boot from the USB without prompting for
removal.

With the dev-switch OFF and the same bootable USB drive inserted, run

  crossystem recovery_request=1
  reboot

The BIOS screen should prompt you to remove the USB drive, then to insert it
before it will boot from the USB.

Change-Id: Ie2fe4302443e14b1f85f409b54aa43a94d6c5477
Reviewed-on: https://gerrit.chromium.org/gerrit/11788
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-16 16:00:42 -08:00