chromiumos/platform/u-boot-vboot-integration.git
2 years agoRemove dead file 17/10617/1 factory-1235.B factory-1284.B factory-1412.B factory-1987.B factory-2268.16.B factory-2305.B factory-2338.B factory-2368.B factory-2394.B factory-2460.B factory-2475.B factory-2569.B factory-2717.B factory-2723.14.B factory-2846.B factory-2848.B factory-2914.B factory-2985.B factory-2993.B factory-3004.B firmware-butterfly-2788.B firmware-kiev-2.112.B firmware-link-2348.B firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B firmware-stout-2817.B firmware-uboot_v2-1299.B master release-R17-1412.B release-R18-1660.B release-R19-2046.B release-R20-2268.B release-R21-2465.B release-R22-2723.B release-R23-2913.B release-R25-3428.B stabilize stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize-daisy stabilize-link stabilize-link-2913.278 stabilize2 toolchain-3428.65.B
Che-Liang Chiou [Tue, 25 Oct 2011 02:40:58 +0000 (10:40 +0800)]
Remove dead file

BUG=chromium-os:20453
TEST=none

Change-Id: I53bed2f1e8386e5ae999a59deb198b90c3d1d1b5
Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoMerge "Reorganize directory structure"
Che-Liang Chiou [Tue, 25 Oct 2011 02:09:40 +0000 (19:09 -0700)]
Merge "Reorganize directory structure"

2 years agoReorganize directory structure 00/10400/3
Che-Liang Chiou [Tue, 25 Oct 2011 02:07:28 +0000 (10:07 +0800)]
Reorganize directory structure

Move files around without modifications:

  board/${SOC}/chromeos         -> soc/${SOC}/lib
  board/${SOC}/vbexport         -> soc/${SOC}/lib
  common/cmd_vbexport_test.c    -> tests/test_vbexport.c
  common/cmd_vboot_test.c       -> tests/test_vboot.c
  common/cmd_vboot_twostop.c    -> lib/main.c
  include/chromeos              -> include
  lib/chromeos                  -> lib
  lib/vbexport                  -> lib
  lib/vbexport/boot_device.h    -> include

SOC is a U-Boot build system variable among ARCH, CPU and BOARD.

BUG=chromium-os:20453
TEST=none

Change-Id: Ie227bd14838875c3cb33c5eb4bdcc89823c7166a
Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoAdd .gitignore 14/10614/1
Che-Liang Chiou [Tue, 25 Oct 2011 02:00:30 +0000 (10:00 +0800)]
Add .gitignore

BUG=chromium-os:20453
TEST=none

Change-Id: I23563ebc815300907e6e8059662258c864a0ade4
Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoBACKPORT: Remove the workaround for F0000-100000 in x86's setup_arch_unused_memory 12/10612/1
Che-Liang Chiou [Tue, 25 Oct 2011 01:55:10 +0000 (09:55 +0800)]
BACKPORT: Remove the workaround for F0000-100000 in x86's setup_arch_unused_memory

This region is now marked properly in the e820 table, so it doesn't need to be
explicitly preserved by u-boot any more.

BUG=None
TEST=Built and booted on Stumpy. Verified that the i915 DRM driver was able to
find the vbios tables, or at least didn't complain that it couldn't.

Change-Id: I793a991a176fb91e8841e37e5199d8e58c1566aa
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/10334
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoBACKPORT: Don't use ARM's hard coded RO value for EC status on x86. 11/10611/1
Che-Liang Chiou [Tue, 25 Oct 2011 01:49:56 +0000 (09:49 +0800)]
BACKPORT: Don't use ARM's hard coded RO value for EC status on x86.

But let coreboot pre-fill that field instead.

BUG=chrome-os-partner:6212
TEST=boot coreboot+u-boot on Lumpy, see EC firmware reported as RW in
     crossystem.

Change-Id: I2ca0a03dd8e02a40863fcbe1809d31c7ca98130c
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/10266
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2 years agoDisable tab_check in PRESUBMIT.cfg 71/10471/2
Che-Liang Chiou [Fri, 21 Oct 2011 03:26:05 +0000 (11:26 +0800)]
Disable tab_check in PRESUBMIT.cfg

This repo is derived from u-boot.git and so follows Linux kernel coding
style.  I think we should not change the coding style from tabs to
spaces, at least in the short term.  So disable tab_check for now.

However, since this repo is derived in the way that the source files
are all written by us, I do not disable cros_license_check.

BUG=chromium-os:20453
TEST=submit a patch with tab characters

Change-Id: Ie310b8895ff442272b39a19b2af80b6c502f88fb
Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoVboot: Exclude kcrashmem from vboot's memory wipe release-R16-1193.B
Katie Roberts-Hoffman [Wed, 28 Sep 2011 00:29:21 +0000 (17:29 -0700)]
Vboot: Exclude kcrashmem from vboot's memory wipe

Exclude kcrashmem from vboot unused memory wipe to allow for recovery of
kernel crash dumps. If the kcrashmem size changes, then the corresponding
fdt must be updated.

BUG=chrome-os-partner:5168
TEST=Manually observed kcrash preserved

Signed-off-by: Katie Roberts-Hoffman <katierh@chromium.org>
Change-Id: Iecb2bd7f7df958125ed3cb3bf0b789602e314e7c
Reviewed-on: http://gerrit.chromium.org/gerrit/8942
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Katie Roberts-Hoffman <katierh@chromium.org>
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
2 years agoCHROMIUM: Clean up cros gpio code
Sean Paul [Mon, 17 Oct 2011 17:50:25 +0000 (13:50 -0400)]
CHROMIUM: Clean up cros gpio code

This CL simplifies how cros gpios are handled by moving the required logic out
of cros_gpio.c and into the application logic. This means that cros_gpio.c
assumes that none of the gpios are required, and just returns an error when
fetch is called. It's up to the caller of fetch to determine whether or not they
should ignore the error or act upon it.

BUG=chromium-os:21700
TEST=Tested on asymptote, ensured gpio access worked as expected.

Change-Id: Ief3f1915026bfe981d345b9cc4709fef19edc7bf
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/10174
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoCHROMIUM: ARM: tegra: Add default values for power and lid switch gpios
Sean Paul [Thu, 13 Oct 2011 20:05:04 +0000 (16:05 -0400)]
CHROMIUM: ARM: tegra: Add default values for power and lid switch gpios

Add default values for the power and lid switches such that a dts file can
exclude them and not suffer from immediate shutoffs and spam on boot.

Also remove the lid switch from seaboard dts file since it is not relevant on
that platform.

BUG=chrome-os-partner:6027,chromium-os:17062
TEST=Tested on asymptote and seaboard

Change-Id: I0bec112af345f7bef4cfbdc7cb44c0017cfecad3
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/10037

2 years agoExtend the vboot_test memwipe to test the new memory wipe API
Gabe Black [Fri, 14 Oct 2011 01:14:27 +0000 (18:14 -0700)]
Extend the vboot_test memwipe to test the new memory wipe API

BUG=None
TEST=Ran vboot_test memwipe on Stumpy and saw it pass.

Change-Id: Ibac1d9ae10804b87b31127af2f60cb6d3dd565c7
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/10068
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agoImplement wipe_unused_memory for x86
Gabe Black [Thu, 13 Oct 2011 04:01:22 +0000 (21:01 -0700)]
Implement wipe_unused_memory for x86

The implementation adds the e820 regions marked as RAM, removes the ones that
aren't, manually removes an area that is incorrectly left out of the e820 map,
and then uses the the protect_u_boot_memory function to protect the generic
u-boot memory regions.

BUG=chrome-os-partner:6194
BUG=chrome-os-partner:6195
TEST=Boot on Stumpy. Manually check the wipe areas reported during boot.

Change-Id: Icaf7b9167282f9ab418d98491aa0493f020e287d
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/10007
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoSplit wipe_unused_memory into arch specific and generic functions
Gabe Black [Wed, 12 Oct 2011 22:32:36 +0000 (15:32 -0700)]
Split wipe_unused_memory into arch specific and generic functions

This new organization will allow x86 to do things differently, and also avoid
duplicating code.

BUG=chrome-os-partner:6194
BUG=chrome-os-partner:6195
TEST=Built and booted on Stumpy and Kaen.

Change-Id: Ifb47d08c2df9116a10f6090b15614828e3cba9e1
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/10005
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMake u-boot load the recovery key in developer mode
Gabe Black [Thu, 13 Oct 2011 05:41:43 +0000 (22:41 -0700)]
Make u-boot load the recovery key in developer mode

The recovery key is needed to display recovery reason information when the tab
key is pressed. If it's not loaded, the data in the in-memory copy of the GBB
can be anything, and vboot may take a very long time to process a malformed
key. This workaround, provided by clchiou, ensures that the recovery key is
loaded when in developer mode so that when the tab key is pressed vboot doesn't
get stuck.

BUG=chrome-os-partner:6266
TEST=Booted into dev mode and pressed tab. Saw the recovery info and that the
system didn't hang and could continue to boot once Ctrl+D was pressed.

Change-Id: I2b85933d38d879a33d3ae369a8249a86af3e9caf
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/10008
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years ago[PATCH1/2] mrc cache: Add MRC cache FMAP entry support.
Vadim Bendebury [Wed, 12 Oct 2011 20:36:23 +0000 (13:36 -0700)]
[PATCH1/2] mrc cache: Add MRC cache FMAP entry support.

Add code to retrieve the location of the MRC cache from the FMAP
device tree definition.

fdt_decode.c should be refactored (fmap_offset could be determined
just once and used throughout without passing it as a parameter), will
leave this for another day.

BUG=chrome-os-partner:5808
TEST=manual
  . see test description in the second patch commit message.

Change-Id: Ic4003d685609beb61d1dea324bd804a2838e471c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/9961
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoRefactor the memory wipe infrastructure to better support x86
Gabe Black [Fri, 7 Oct 2011 13:42:56 +0000 (06:42 -0700)]
Refactor the memory wipe infrastructure to better support x86

The memory wipe infrastructure in u-boot makes some assumptions about how
memory is arranged that make it not quite fit with x86. Specifically, it
assumes that there is a single region of memory, and with certain exceptions
that's what should be wiped. In x86, specifically in the e820 map, there are
multiple regions of RAM, possibly multiple regions to exclued from that that
may completely, partially, or not overlap with the others, and then u-boot
related regions.

This is addressed by making the memory wipe infrastructure a little more
generic. Now, areas can be added and subtracted arbitrarily, and will
accumulate in the order they're encountered. In the x86 use case, we can add
the e820 regions marked as RAM, subtract the areas marked as anything else, and
subtract the u-boot related regions.

Rather than tracking the actual regions of the address space, this
implementation tracks the boundaries between the regions using a linked list.
The code itself is short and relatively simple, and I tried to ensure that it
was as clear as possible to make any memory (or other) bugs easier to see and
fix.

BUG=chrome-os-partner:6195
BUG=chrome-os-partner:6194
TEST=Built and booted on kaen using the A-A cable. Ran vboot_test memwipe, and
a modified version that took advantage of the new API.

Change-Id: I122fbf499ef473350afa27b612cb0e565366b1ad
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/9715
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoCHROMIUM: add scsi_write to SCSI driver.
Hung-Te Lin [Thu, 6 Oct 2011 05:19:18 +0000 (13:19 +0800)]
CHROMIUM: add scsi_write to SCSI driver.

Verified boot requires writing to GPT attributes (success / tries), so we need
to implement *_write.

"scsi write" command is also added to console for testing.

BUG=chrome-os-partner:6258
TEST=(1) Modified GPT to trigger VBOOT updating GPT, and verified
         GPT changed successfully (by firmware) after reboot
     (2) ext2load usb 1:1 10000000 /part2.bin  # load kernel partition dump
         scsi write 10000000 5000 5000  # write into kernel partition in #2

Change-Id: I8027b6075cdabf8df81ea1ba620ca0dcd3d33232
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/8841
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agoRevert "Add support for a bios-base device tree/flashmap setting"
Gabe Black [Wed, 5 Oct 2011 10:32:43 +0000 (03:32 -0700)]
Revert "Add support for a bios-base device tree/flashmap setting"

This reverts commit 8e93aec313c2807704b14fbd21123a9ffc86a087.

The bios-base setting has been deprecated.

BUG=None
TEST=Built and booted on Stumpy.

Change-Id: I792761ac44763b06bf1d3abb4db8e9e1a3f113c5
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/8823
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agoTrack whether u-boot was warm or cold booted, and implement is_processor_reset
Gabe Black [Wed, 28 Sep 2011 00:44:24 +0000 (17:44 -0700)]
Track whether u-boot was warm or cold booted, and implement is_processor_reset

Code which determined whether u-boot on x86 was warm or cold booted (really if
it started at the beginning of the text segment or at the ELF entry point) was
partially implemented, and the result was simply dropped when leaving the
assembly part of initialization. This change completes the implementation,
plumbs the result through to the global data structure, and implements
is_processor_reset to check the value there.

BUG=chrome-os-partner:5252
TEST=Built and did a twostop boot on Alex. The firmware was resigned using the
command below so that the RW firmware would be used. When is_processor_reset
was hardcoded to return true all the time, u-boot would go into recovery mode.
Now it boots successfully.

/resign_firmwarefd.sh  image.bin /tmp/image_new.bin
../../tests/devkeys/firmware_data_key.vbprivk
../../tests/devkeys/firmware.keyblock
../../tests/devkeys/firmware_data_key.vbprivk
../../tests/devkeys/firmware.keyblock
../../tests/devkeys/kernel_subkey.vbpubk 1 0

Change-Id: I22b8ed3c3b472807832f1f7e7724f27a218cf4cf
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/8396
Commit-Ready: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoRefactor hw timer code to accommodate execution tracing.
Vadim Bendebury [Fri, 23 Sep 2011 19:25:43 +0000 (12:25 -0700)]
Refactor hw timer code to accommodate execution tracing.

This CL separates the HW timestamp acquisition into an inline
function and provides interface to set the base time (to be
retrieved from coreboot table).

BUG=chromium-os:20733
TEST=manual
 . build the new firmaware image
 . bring up a stumpy with the new image to ChromeOS
 . examine crossystem reported timer values.

Observe that the values start with zero and increase
monotonously.

Change-Id: I4ede0a55112e061e9d3790f01c8ca41a8539364b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/8215
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agoUse the vdat firmware index when setting up the ACPI crossystem data table
Gabe Black [Fri, 23 Sep 2011 04:47:15 +0000 (21:47 -0700)]
Use the vdat firmware index when setting up the ACPI crossystem data table

Instead of using a hardcoded value, set this field of the table used by the
crossystem ACPI driver to whatever is stored in VDAT.

BUG=chrome-os-partner:5944
BUG=chrome-os-partner:5961
BUG=chrome-os-partner:5962
TEST=Booted on Alex. Verified that corrupting firmware A made crossystem change
mainfw_act to B instead of A.

Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: I01b26508fede3d15e78b584b638e1393c5b03501
Reviewed-on: http://gerrit.chromium.org/gerrit/8189
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Ready: Gabe Black <gabeblack@chromium.org>

2 years agoUpdate VbExBeep() signature to match changed API.
Bill Richardson [Fri, 23 Sep 2011 20:28:33 +0000 (13:28 -0700)]
Update VbExBeep() signature to match changed API.

Signed-off-by: Bill Richardson <wfrichar@google.com>
BUG=none
TEST=none

Change-Id: I636eee76069d9f6ae0679135b87f0006d59c2723
Reviewed-on: http://gerrit.chromium.org/gerrit/8242
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agoSet up basic vboot data for use by crossystem
Gabe Black [Mon, 19 Sep 2011 20:54:46 +0000 (13:54 -0700)]
Set up basic vboot data for use by crossystem

This change sets up basic vboot data for use by crossystem. The pieces of
information and what they're set to are below. I assumed that the constants
defined in the coreboot version of this code describe all of the available
settings for each option.

Boot reason: BOOT_REASON_OTHER
The choices here are BOOT_REASON_OTHER and BOOT_REASON_S3DIAG. I don't know
what BOOT_REASON_S3DIAG is for or how to detect which to use. I believe S3
resume happens without going through u-boot, so hardcoding this to
BOOT_REASON_OTHER seems reasonable for now at least.

Active main firmware: ACTIVE_MAINFW_RW_A
The choices are ACTIVE_MAINFW_RECOVERY, ACTIVE_MAINFW_RW_A and
ACTIVE_MAINFW_RW_B. This information isn't stored in the crossystem_data_t
structure. For now it's hard coded to ACTIVE_MAINFW_RW_A which is going to
frequently be wrong. I suspect we also need to add a value which indicates that
the read only firmware was used by itself.

Active EC firmware: cdata->active_ec_firmware
A direct match with data already gathered by u-boot/vboot.

CHSW: Translation from booleans to bitfields.
The cdata boot_write_protect_switch, boot_recovery_switch, and
boot_developer_switch boolean fields are translated into the
CHSW_FIRMWARE_WP_DIS, CHSW_RECOVERY_X86 and CHSW_DEVELOPER_SWITCH bitfields.
The CHSW_RECOVER_EC bitfield is ignored since there's no obviously
corresponding field in crossystem_data_t.

HWID: cdata->hardware_id
A direct match with data already gathered by u-boot/vboot.

FWID: cdata->firmware_id
A direct match with data already gathered by u-boot/vboot.

FRID: cdata->readonly_firmware_id
A direct match with data already gathered by u-boot/vboot.

Active main firmware type: cdata->firmware_type
A direct match with data already gathered by u-boot/vboot.

Recovery reason: RECOVERY_REASON_NONE
The choices are RECOVERY_REASON_NONE and RECOVERY_REASON_ME. Since u-boot has
no information about the ME, this is hardcoded to RECOVERY_REASON_NONE.

FMAP base address: cdata->fmap_offset
An assumed direct match with data already gathered by u-boot/vboot. There is a
little ambiguity as far as what this is the offset of and from.

BUG=chrome-os-partner:5944
BUG=chrome-os-partner:5961
BUG=chrome-os-partner:5962
TEST=Booted successfully on both stumpy and alex. Used crossystem to verify
that information like the firmware ID was extracted successfully. The GPIOs,
which are not sent with this mechanism, seem to work sometimes but not always.

Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: If7ea2a6470d8edf7122f87f289c19d4464775e8c
Reviewed-on: http://gerrit.chromium.org/gerrit/7977
Commit-Ready: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agofdt_support: Use uintptr_t for 32/64-bit compatibility
Simon Glass [Fri, 19 Aug 2011 22:20:19 +0000 (16:20 -0600)]
fdt_support: Use uintptr_t for 32/64-bit compatibility

This fixes problems in these files when building on 64-bit machines.

BUG=chromium-os:19353
TEST=build for Seaboard

Change-Id: Ib013db127505b326436ab4f650ce72e40963e208
Reviewed-on: http://gerrit.chromium.org/gerrit/7644
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agofdt: Move Chrome OS memory areas to fdt
Simon Glass [Mon, 22 Aug 2011 14:15:25 +0000 (08:15 -0600)]
fdt: Move Chrome OS memory areas to fdt

This moves the last remaining hard-coded CONFIG to the fdt.

BUG=chromium-os:17062
TEST=build for Seaboard

Change-Id: Ic152ce12a0f87211e4cc98eef15601f0703137b1
Reviewed-on: http://gerrit.chromium.org/gerrit/7642
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
2 years agoCHROMIUMOS: small code clean ups in boot_kernel/fdt_decode
Simon Glass [Tue, 13 Sep 2011 23:34:41 +0000 (16:34 -0700)]
CHROMIUMOS: small code clean ups in boot_kernel/fdt_decode

This just changes to standard 'blob' naming, and fixes a code style error.

BUG=chromium-os:19353
TEST=build and boot on Seaboard

Change-Id: Ib79d526ef612a181091ef15a5dd427ea73c53330
Reviewed-on: http://gerrit.chromium.org/gerrit/7681
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoAdd support for a bios-base device tree/flashmap setting
Gabe Black [Sat, 3 Sep 2011 03:54:01 +0000 (20:54 -0700)]
Add support for a bios-base device tree/flashmap setting

This setting specifies where the bios image described by the "flash" section
starts in the ROM. When the device tree is consumed by u-boot, this value is
added to the given offset of accesses to the flash so that it ends up in the
right place in the ROM. The binary fmap will reflect that address directly so
that tools like flashrom can use it without modification. By not modifying the
locations of the sections in the "flash" node of the device tree directly, we
can continue to share definitions between boards that have the same layout for
the BIOS image itself but who may be offset differently in the ROM. If not
present, a default value of 0 is used. Unmodified device trees will continue
to behave like they always have.

The name bios-base isn't perfect since on ARM there is no bios. Another
alternative firmware-base is also flawed because there are multiple firmwares
in the ROM on x86. Yet another option, flashmap-base, doesn't quite work either
because flashmap already has a very similarly named field which describes where
the image described by the flashmap appears in the physical address space.
Because bios-base fits the best on x86 and x86 is currently the only place it's
used, that's the name I went with.

BUG=chrome-os-partner:5844
TEST=Used this and other changes to compensate for the image offset and vboot
on stumpy. Vbooted on x86-alex. Built with vboot_test and vbexport_test built
in to verify that they still compile.

Change-Id: Ie727fc2db27f7d0db8ebf7ed2b98bc97052b4923
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/7239
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agofmap: Add compiler.h header
Simon Glass [Mon, 22 Aug 2011 00:39:19 +0000 (18:39 -0600)]
fmap: Add compiler.h header

fmap.h uses uint32_t so it should include compiler.h to get this type.

Change-Id: I07c9664eb19b7f0ec445217c49793e7cb67a20db
Reviewed-on: http://gerrit.chromium.org/gerrit/7638
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agotegra: Rename is_tegra2_processor_reset
Simon Glass [Thu, 1 Sep 2011 21:21:09 +0000 (14:21 -0700)]
tegra: Rename is_tegra2_processor_reset

Change tegra2 to tegra to make it more generic.

BUG=chromium-os:19004
TEST=build and boot on Seaboard

Change-Id: Iad6de3bb6cc6031167862054b78a57f66dea9cd5
Reviewed-on: http://gerrit.chromium.org/gerrit/7127
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agotegra: Rename tegra2.h to tegra.h
Simon Glass [Wed, 31 Aug 2011 17:39:43 +0000 (10:39 -0700)]
tegra: Rename tegra2.h to tegra.h

We want to move to the idea of drivers and boards using generic tegra
include files, and have these include files deal with the tegra2/3
differences. This will make it easier to share code between tegra2/3.

BUG=chromium-os:19004
TEST=build and boot on Seaboard

Change-Id: I9c4eec30707e41678fb307982a34fe383694ba16
Reviewed-on: http://gerrit.chromium.org/gerrit/7000
Reviewed-by: Yen Lin <yelin@nvidia.com>
Reviewed-by: Tom Warren <twarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoAdd SATA interface for vbexport.
Vadim Bendebury [Sat, 3 Sep 2011 00:31:33 +0000 (17:31 -0700)]
Add SATA interface for vbexport.

Copy device_ide.c into device_scsi.c, editing as appropriate
along the way. Ensure that the new file is included if
CONFIG_AHCI_SCSI is defined fro the platform.

BUG=chromium-os:19837
TEST=manual

 . program updated image (including AHCI fixes and configuration
   changes) on an Alex.
 . restart the machine and enter `vboot_twostop' at u-boot prompt.

Observe it boot up all the way to ChromeOs login screen.

Change-Id: I146591c53f61722cc33f7261a1921aa07e861ee3
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/7234
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoFix refactoring problems introduced earlier.
Vadim Bendebury [Wed, 31 Aug 2011 20:09:54 +0000 (13:09 -0700)]
Fix refactoring problems introduced earlier.

It was noticed that the system fails to come up while running the
latest u-boot from the 2011.06 branch. Further investigation has
discovered that the problem is due to the fact that the
initialization of the verified boot wrapper was not handled
properly and that the IDE index reported by the IDE discovery
routine was wrong.

BUG=chromium-os:19599
TEST=manual

 . build and install the new firmware image on an Alex with a
   valid ChromeOS image
 . restart the machine
 . enter vboot_two at u-boot prompt

 observe the machine to bring up the ChromeOs login screen.

Change-Id: Icc78d682d5c81d6f08d31896c32c8cd48d0a4f2d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/7030
Reviewed-by: Gabe Black (Do Not Use) <gabeblack@google.com>
2 years agoStart vboot timer at zero.
Vadim Bendebury [Mon, 29 Aug 2011 23:05:42 +0000 (16:05 -0700)]
Start vboot timer at zero.

vboot API expects the firmware to provide some abstract
timestamps, which are included in the vdat area and allow the
crossystem utility to display boot timing.

This change modifies the timestamps such that the first timestamp
reading always returns zero, and the rest return incremental time
after the first reading was taken.

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

 . program the new firmware image on an Alex
 . bring up ChromeOS
 . run crossystem

 Observe the first timestamp value set to zero and the rest of
 the stamps continuously incrementing.

Change-Id: Iac4858f50dbc7576250b85630ed8e0b0cbe0b6b5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/6869
Tested-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/6920
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoPass correct VDAT address to the vboot wrapper.
Vadim Bendebury [Sun, 28 Aug 2011 01:15:18 +0000 (18:15 -0700)]
Pass correct VDAT address to the vboot wrapper.

On X86 systems where VDAT address is passed to the kernel through
ACPI the u-boot must retrieve the address from the coreboot table
and make it available to the vboot wrapper.

This change accomplishes just that utilizing the coreboot changes
which include the vdat area address and size into the coreboot
table.

Another modification is removing conditional compilation for
including fields in the sysinfo table. The thing is that the code
is not conditionally compiled anyways, so keeping an extra
pointer in a table even if not needed is not a problem.

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

 . program the new firmware on an Alex
 . bring up ChromeOS
 . try running crossystem

It was reporting errors before (when displaying data retrieved
from VDAT). It displays sensible values now.

Change-Id: Ib4090049092f7963a1b1705409d2beea8a9abfac
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/6868
Tested-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/6919
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoCHROMIUMOS: Refactor boot_device to support multiple devices nicely
Simon Glass [Wed, 17 Aug 2011 22:24:55 +0000 (15:24 -0700)]
CHROMIUMOS: Refactor boot_device to support multiple devices nicely

Now that we have MMC, USB and IDE, with some enabled for only some platforms,
the code has become ugly. This refactors the code to separate out each device
into its own file, with a generic start/scan interface.

This also fixes the problem with indexing of devices, where it could not cope
with MMC and IDE active at the same time.

BUG=chromium-os:19518
TEST=build on Seaboard; vbexport_test diskinfo
See that all boot devices are found with SD and USB inserted

Change-Id: I4844f7b33885ec01e922686a17c90afdf0a55a9d
Reviewed-on: http://gerrit.chromium.org/gerrit/6254
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/6918
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoCHROMIUM: guard boot_kernel fdt codes with #ifdef
Che-Liang Chiou [Tue, 23 Aug 2011 02:59:46 +0000 (10:59 +0800)]
CHROMIUM: guard boot_kernel fdt codes with #ifdef

boot_kernel sets up pointer to crossystem data for embedding into kernel
device tree unconditionally regarding CONFIG_OF_UPDATE_FDT_BEFORE_BOOT.

This patch guards boot_kernel codes that are specific to kernel device
tree with the config flag.

Note: x86 boards might use a mechanism other than device tree to deliver
crossystem data to kernel.

BUG=none
TEST=emerge-{tegra2_aebl,x86-alex} chromeos-u-boot

Change-Id: Ifd04af1681d72c918c838ba3713ddecaca0ff18a
Reviewed-on: http://gerrit.chromium.org/gerrit/6466
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoCHROMIUMOS: Add vbexport_init() to set up library
Simon Glass [Tue, 23 Aug 2011 18:38:11 +0000 (11:38 -0700)]
CHROMIUMOS: Add vbexport_init() to set up library

We need to register available boot devices. It seems reasonable that this
library should be initialized before use.

BUG=chromium-os:19518
TEST=build on Seaboard; vbexport_test diskinfo
See that all boot devices are found with SD and USB inserted

Change-Id: I17a535dc85b5aaee669ea67b439632bafb19c806
Reviewed-on: http://gerrit.chromium.org/gerrit/6501
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoChoose the right boot function for x86
Stefan Reinauer [Mon, 22 Aug 2011 19:23:15 +0000 (12:23 -0700)]
Choose the right boot function for x86

BUG=chrome-os-partner:4552
TEST=vboot_twostop does not fail with an error after loading the kernel.

Change-Id: I16016239716c8030ea63c7da6bd99a2f03b0e40d
Reviewed-on: http://gerrit.chromium.org/gerrit/5549
Tested-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2 years agoCHROMIUM: decode GPIO configs through <&gpio ...>
Che-Liang Chiou [Thu, 11 Aug 2011 09:58:58 +0000 (17:58 +0800)]
CHROMIUM: decode GPIO configs through <&gpio ...>

cros_gpio module used a ad-hoc format of GPIO config, and it should
use <&gpio ...> instead. This patch changes the format of GPIO config.

Note: In between calls to gpio_direction_input() (in fdt_setup_gpio())
and calls to gpio_get_value(), you have to insert a small delay if the
input source is connected to the GPIO through a sufficiently large
series resister (say, 200K ohm) so that the RC time constant for
charging the gate capacitance on the input is non-trivial.

As a matter of fact, I tested on Kaen and Aebl, and found only write
protect GPIO needs this delay, and the delay time is less than 10 us.
And we may safely hide this delay by decoupling the initialization and
reading of GPIOs.

BUG=none
TEST=Run "vboot_test gpio" on Kaen and Aebl, and check GPIO readings
TEST=Run "crossystem" on Kaen and Aebl after boot, and check GPIO readings

Change-Id: Ib4d93c2ce156eb09ffc24a3882f83490d25c1e91
Reviewed-on: http://gerrit.chromium.org/gerrit/5726
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoOnly include mmc.h when mmc is enabled.
Stefan Reinauer [Fri, 19 Aug 2011 22:08:06 +0000 (15:08 -0700)]
Only include mmc.h when mmc is enabled.

From http://gerrit.chromium.org/gerrit/#change,6253

BUG=none
TEST=none

Change-Id: I3145aa84a8426506d8dc44d094da4884f079b3b4
Reviewed-on: http://gerrit.chromium.org/gerrit/6355
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoLook for an IDE boot device on non-MMC systems.
Stefan Reinauer [Thu, 18 Aug 2011 18:41:05 +0000 (11:41 -0700)]
Look for an IDE boot device on non-MMC systems.

This is a rewrite of http://gerrit.chromium.org/gerrit/#change,5547
which tries to integrate more transparently into vbexport's code
and at the same time removes some (false) assumptions about always
booting from MMC.

BUG=none
TEST=none

Change-Id: I18f3b91f307b16622de9ced97ab00454c29941fe
Reviewed-on: http://gerrit.chromium.org/gerrit/6232
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stefan Reinauer <reinauer@google.com>
2 years agoRevert "Make the FMAP configuration decoding function board specific."
Gabe Black [Thu, 11 Aug 2011 11:37:06 +0000 (04:37 -0700)]
Revert "Make the FMAP configuration decoding function board specific."

This reverts commit 23cefdce356de66442d858abf12c72afc8d33cac.

Since we changed our minds about loading FMAP information from CBFS, we can go
back to using the same mechanism on ARM and x86.

BUG=chrome-os-partner:5432
TEST=Built and booted on x86-alex and verified that the FMAP information showed
up in debugging output from vboot_twostop.

Change-Id: Id41c82ca24dbfa301559e24104b5e226ec9b7e03
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/5864
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoCHROMIUMOS: tidy msleep cast
Simon Glass [Wed, 17 Aug 2011 22:25:39 +0000 (15:25 -0700)]
CHROMIUMOS: tidy msleep cast

BUG=chromium-os:19353
TEST=build for Seaboard

Change-Id: Iba1da73cdd5a8e3972240e939a40ee4a32e83786
Reviewed-on: http://gerrit.chromium.org/gerrit/6252
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoNew function VbExDecompress(), changed VbExDisplayImage().
Bill Richardson [Tue, 16 Aug 2011 21:52:56 +0000 (14:52 -0700)]
New function VbExDecompress(), changed VbExDisplayImage().

The vboot_api.h interface has changed, so we need to adapt. VbExDecompress()
now allows the vboot library access to native decompression routines. The
signature of VbExDisplayImage() has changed, so we now only need to support
uncompressed native-format bitmaps.

BUG=chromium-os:19134
TEST=manual

I tested by modifying the U-Boot build so I could get into the U-Boot prompt
and run "vbexport_test display". The GBB screens rendered correctly.

Change-Id: Iec605dee0af46e7d9eecc89b826e260f8a5930a4
Reviewed-on: http://gerrit.chromium.org/gerrit/6131
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2 years agoEnable OF_CONTROL for Alex.
Vadim Bendebury [Tue, 9 Aug 2011 16:43:40 +0000 (09:43 -0700)]
Enable OF_CONTROL for Alex.

This change makes the Alex u-boot use configuration settings
coming from the device tree supplied by coreboot through the
coreboot table.

The device tree now includes the necessary console configuration
information.

Code is added to retrieve the device tree pointer from the
coreboot table, the appropriate coreboot structures and tag
values are being duplicated in
arch/i386/include/asm/ic/coreboot/tables.h. The pointer to the
FDT is added to the global data structure, it is initialized as
soon as it is retrieved from the coreboot table.

For some reason placing the global data structure anywhere but in
the .data segment causes the system to crash. This phenomenon
will be investigated shortly, this commit is an intermediate step
to get the device tree handover used by other coreboot/u-boot
contributors.

Core retrieving the device tree from CBFS is not needed anymore
and gets removed.

BUG=chrome-os-partner:5248
TEST=manual
 . build the new image and program it on Alex
 . restart the target, observe the console output

The target boots all the way to u-boot prompt.

Change-Id: I087cf70362ede0873be37fa5a98aa66a0b979d8f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/6132
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agoCHROMIUM: remove earlier prototype codes
Che-Liang Chiou [Fri, 12 Aug 2011 10:01:43 +0000 (18:01 +0800)]
CHROMIUM: remove earlier prototype codes

The removed codes are belong to an earlier prototype of integrating
vboot wrapper API, which is not compiled/used anymore. Besieds, the
prototype has a known vulnerability of buffer overflow when reading
key blocks. So there is no many referential value for keeping the
prototype codes in the codebase. And keeping the prototype also adds
costs to new patches, which have to changes two implementations. All
in all, I think it is time we retire this prototype.

This patch also fixes coreboot build failure due to the removal.

BUG=chromium-os:16542
TEST=emerge-{x86-alex,tegra2_aebl} chromeos-u-boot

Change-Id: Ib6be9457f2dbc2daa3213c3d9c80bcdc56c520c4
Reviewed-on: http://gerrit.chromium.org/gerrit/5874
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: Assign the frame buffer address as FDT one instead of u-boot one.
Tom Wai-Hong Tam [Fri, 12 Aug 2011 10:27:31 +0000 (18:27 +0800)]
CHROMIUM: Assign the frame buffer address as FDT one instead of u-boot one.

The framebuffer address should be specified in the device tree and not u-boot
assigned. This FDT value should be the same as the one defined in Linux kernel;
otherwise, it causes screen flicker. The FDT value overrides the framebuffer
allocated at the top of memory by board_init_f().

If the framebuffer address is not defined in the FDT, falls back to use the
address allocated by board_init_f().

BUG=chrome-os-partner:5338
TEST=build without error and boot Chrome OS on Aebl, see the screen not
corrupted and splash screen showed.

Change-Id: Ia6a996d127d74d6084900814d2c934fb95518e23
Reviewed-on: http://gerrit.chromium.org/gerrit/5877
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoMakes the VbExGetTimer vboot callback function board specific
Gabe Black [Mon, 8 Aug 2011 23:51:04 +0000 (16:51 -0700)]
Makes the VbExGetTimer vboot callback function board specific

The timer_get_us function which is called by the existing implementation of
VbExGetTimer isn't trivial to implement on x86. The vboot source says that the
TSC is an appropriate time source to return from this function. This change
makes the VbExGetTimer function per board so that it can use rdtsc instead of
timer_get_us.

BUG=chrome-os-partner:4552
TEST=Built and booted on x86-alex, and built on tegra2_kaen.

Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: I335d5ae98949cd05c42dc3f30c52931bdf63a623
Reviewed-on: http://gerrit.chromium.org/gerrit/5544
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoCHROMIUM: Add bootstage markers to twostop boot
Simon Glass [Thu, 11 Aug 2011 00:07:45 +0000 (17:07 -0700)]
CHROMIUM: Add bootstage markers to twostop boot

This lets us see the time used by twostop which is outside vboot itself.

BUG=chromium-os:17805
TEST=build and boot on Aebl, see new output:
Timer summary in microseconds:
       Mark    Elapsed  Stage
...
    647,449      4,792  do_vboot_twostop
    649,768      2,319  twostop_init
    661,083     11,315  twostop_select_and_set_main_firmware
    886,859    225,776  twostop_main_firmware
  1,324,964    438,105  select_and_load_kernel_exit

Change-Id: I85408bf2860a77fae54fcb78ece07314b8929d25
Reviewed-on: http://gerrit.chromium.org/gerrit/5775
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoCHROMIUM: port test codes to current codebase
Che-Liang Chiou [Thu, 11 Aug 2011 11:16:20 +0000 (19:16 +0800)]
CHROMIUM: port test codes to current codebase

The test codes were not compiled because it depended on a prototype
codebase which is not used/compiled now.

This patch removes the dependency to the prototype codebase and let the
test codes be enabled when VBOOT_DEBUG is defined.

Because the test codes test GBB loader and we use a static buffer for
holding GBB data, this patch also moves the location of GBB buffer to
chromeos.h, which is globally accessible.

BUG=chromium-os:16542
TEST=run "vboot_test all" and see all tests pass on Kaen
TEST=run "vbexpot_test all" and see all tests pass on Kaen

Change-Id: I24c7e51cd254f31b4b28fd0becdbc77fb4ede2f8
Reviewed-on: http://gerrit.chromium.org/gerrit/5729
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoFix checking if information about vboot's nv storage was in the cb tables
Gabe Black [Sun, 7 Aug 2011 04:20:15 +0000 (21:20 -0700)]
Fix checking if information about vboot's nv storage was in the cb tables

u-boot was not checking for information about vboot's non-volatile storage
correctly. If the information taken from the coreboot table was non-zero (when
there was something there), u-boot would fail, which is essentially the
opposite of correct. This change sets sentry values in the structure filled
from coreboot's tables and then checks for those to determine if there's any
information about nonvolatile storage.

BUG=chrome-os-partner:4552
TEST=Built and ran vboot_twostop. Verified that attempts to access nonvolatile
storage no longer fail.

Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: I254c5808637dcd668c0529bbcfa3ba22924165b7
Reviewed-on: http://gerrit.chromium.org/gerrit/5542
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoIntroduce generic TPM support in u-boot.
Vadim Bendebury [Fri, 5 Aug 2011 16:17:51 +0000 (09:17 -0700)]
Introduce generic TPM support in u-boot.

This code is used on x86 platforms to control a standard LPC
based TPM device. The actual driver implementation is based on
the article "Writing a TPM Device Driver" published on
http://ptgmedia.pearsoncmg.com and the submission by Stefan
Berger on Qemu-devel mailing list.

One substantial difference is that in the simplest configuration
(the case of the Alex device under coreboot/u-boot control) the
other than 0 TPM localities do not get mapped by some devices
(for instance, by Infineon slb9635), so this driver provides
access to locality 0 only.

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

Booted an Alex with this code, tried accessing TPM. Access
routines do not fail, even though it is not yet possible to write
data into a TPM location and read it back. This could be related
to the fact that the CLI command does not intialize the TPM
properly.

boot > tpm
generic_lpc_tpm.c:155 found TPM SLB9635 TT 1.2 by Infineon
boot > tpm r 0x1008 10

boot > tpm w 0x1008 1 2 3 4

boot > tpm r 0x1008 4

Change-Id: Id8d23e9bb24ba2bcd999135c99e7612f9010f384
Reviewed-on: http://gerrit.chromium.org/gerrit/5492
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
2 years agoAdd GPIO parsing on coreboot+uboot combo
Stefan Reinauer [Thu, 4 Aug 2011 02:40:36 +0000 (19:40 -0700)]
Add GPIO parsing on coreboot+uboot combo

BUG=chrome-os-partner:3912
TEST=run vboot_twostop and see cros_gpio output

Change-Id: Ic926765afa5b7d56ed475dc4c9e39a0dc99bcdf0
Reviewed-on: http://gerrit.chromium.org/gerrit/5292
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
2 years agoImplement missing functions for vboot:
Stefan Reinauer [Fri, 5 Aug 2011 00:13:12 +0000 (17:13 -0700)]
Implement missing functions for vboot:

 * video_clear()
   Clear the video framebuffer.

 * cold_reboot()
   Do a hard reset through the chipset's reset control register. This
   register is available on all x86 systems (at least those built in
   the last 10ys)

 * power_off()
   Power down the machine by using the power management sleep control
   of the chipset. This will currently only work on Intel chipsets.
   However, adapting it to new chipsets is fairly simple. You will
   have to find the IO address of the power management register block
   in your southbridge, and look up the appropriate SLP_TYP_S5 value
   from your southbridge's data sheet.

BUG=chrome-os-partner:3912
TEST=Run vboot_twostage and see vboot first clear the screen and later cold boot.
     Run poweroff and coldboot command in uboot console.

Change-Id: I59f49a41e8807b2ec3ebb3d083d2a06ced9553a0
Reviewed-on: http://gerrit.chromium.org/gerrit/5361
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
2 years agoDecouple x86 u-boot from fdt related functions.
Vadim Bendebury [Thu, 4 Aug 2011 20:00:14 +0000 (13:00 -0700)]
Decouple x86 u-boot from fdt related functions.

The x86 u-boot does not enable the CONFIG_OF_CONTROL flag yet,
and as such should not compile in the FDT related functions. This
change takes care of this arrangement and also removes the
remaining common code using fdt unconditionally.

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

 . build u-boot for Kaen, verify that the system still comes up
   as expected.

 . build coreboot image for Alex, verify that the system still
   can be started manually.

Change-Id: I5416f9fd0a6cc9f86aef9051b1f7b6d9b252964e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/5362

2 years agoMake the FMAP configuration decoding function board specific.
Gabe Black [Wed, 3 Aug 2011 06:31:44 +0000 (23:31 -0700)]
Make the FMAP configuration decoding function board specific.

This change makes the FMAP configuration decoding function board specific so
that it can, for instance, use CBFS to store the FMAP on x86. The ARM
implementation uses fdt_decode_twostop_fmap in its implementation and should
behave the same. The new more generic interace is called decode_twostop_fmap.

BUG=chrome-os-partner:5248
TEST=Built, installed and booted on Kaen, built and installed on Alex, ran
vboot_twostop and saw new "unimplemented" message.

Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: I07f6f8f7c8a62c5998ec4919d4609a7ac84783da
Reviewed-on: http://gerrit.chromium.org/gerrit/5233
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoRemove the device tree from one of the vboot support APIs.
Gabe Black [Wed, 3 Aug 2011 06:00:03 +0000 (23:00 -0700)]
Remove the device tree from one of the vboot support APIs.

This change removes the device tree from one of the vboot support APIs so
that they fit better with coreboot u-boot. Specifically this is
cros_gpio_fetch which is for getting GPIO values. Coreboot will read these and
provide the values through its coreboot tables. The device tree pointer is
global data so it doesn't need to be passed around as a parameter to be
accessible.

This change also removes the device tree from other interfaces in
cmd_vboot_twostop.c so the structure of the code is more consistent. This way
people can expect the device tree to always be the one pointed at by the
global data and not sometimes one and sometimes the other, even though as
written those will be equivalent. This change also takes the opportunity to
mark the local functions in that file static, which is most of them.

BUG=chrome-os-partner:4552
TEST=Built for x86-alex and tegra2_kaen. Installed and booted to chromeos
login on Kaen.

Change-Id: I084e774d97025d9ec71abe09c92fab8a7827892f
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/5232
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoMake the chromeos FMAP data structures more generic and in their own files.
Gabe Black [Wed, 3 Aug 2011 04:45:02 +0000 (21:45 -0700)]
Make the chromeos FMAP data structures more generic and in their own files.

This change separates out the FMAP data structures from the FDT decode
functions and renames them to more neutral names. These structures don't
intrinsically have to be loaded from the FDT, and their new names and location
remove the implied dependency.

BUG=chrome-os-partner:5248
TEST=Built for x86-alex and tegra2_kaen. Installed on Kaen and booted to
chromeos login.

Change-Id: I5680a3f3aaa52efe44c2060d0b6db9ad47a547ec
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/5231
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoCHROMIUM: make include of vboot_api.h unconditional
Sonny Rao [Wed, 3 Aug 2011 05:57:16 +0000 (22:57 -0700)]
CHROMIUM: make include of vboot_api.h unconditional

This fixes a build breakage in lib/vbexport/display.c when
VBOOT_DEBUG isn't defined.

BUG=none
TEST=compile without VBOOT_DEBUG=1 defined

Change-Id: Icdafd2783190b39bbd031565d14b4b20bdefe446
Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/5202

2 years agoCHROMIUM: move VbExHashFirmwareBody() to lib/vbexport/
Che-Liang Chiou [Wed, 3 Aug 2011 06:57:09 +0000 (14:57 +0800)]
CHROMIUM: move VbExHashFirmwareBody() to lib/vbexport/

This patch only moves code around.

BUG=chromium-os:16542
TEST=build okay

Change-Id: Idc908fd2e652c114ae8029c120386fb44e63b4f9
Reviewed-on: http://gerrit.chromium.org/gerrit/5204
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
2 years agoCHROMIUM: avoid using printf %s on long strings
Che-Liang Chiou [Fri, 29 Jul 2011 07:44:16 +0000 (15:44 +0800)]
CHROMIUM: avoid using printf %s on long strings

The U-Boot printf() implementation has an output buffer limitation on
output, and so cannot be used for very long output. Instead, puts() has
no such limitation.

BUG=chromium-os:18351
TEST=run on Aebl

Change-Id: I3f3e3b81968f5169a2fe1f581924fa19c3dc1a43
Reviewed-on: http://gerrit.chromium.org/gerrit/4990
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoPrevent the LP0 vector from being wiped out.
Vadim Bendebury [Wed, 3 Aug 2011 01:15:01 +0000 (18:15 -0700)]
Prevent the LP0 vector from being wiped out.

It was observed that the sleep recovery fails when Kaen is in dev
mode. Further investigation has shown that the LP0 vector space
is set to all zeros when the system is in dev mode, which clearly
prevents it from resuming operations properly. Then it turned out
that the recently introduced memory u-boot wipeout fails to
exclude the LP0 vector space, so it gets erased.

For some reason u-boot does this in two different places in the
code, so the fix adds exclusion of the LP0 vector space in those
spaces.

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

Build a new u-boot image, install it on a kaen. Then bring up the
kaen in normal and developer mode, login, close the lid and open
it back a few times.

Before the fix the machine would hang every single attempt at
closing the lid when in dev mode, after the fix it enters and
exits sleep state seamlessly in both dev and normal modes.

Change-Id: I9ec31495bca41abed68de8559560f0b1fcdd4969
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/5193
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoImplement vbnv support.
Vadim Bendebury [Mon, 1 Aug 2011 17:38:12 +0000 (10:38 -0700)]
Implement vbnv support.

Using the tables defined by coreboot retrieve and cache
information of where the VBNV area is kept in the CMOS.

Populate VBNV access functions to actually read and write this
area.

BUG=chrome-os-partner:4552
TEST=manual
  . built and booted u-boot on an Alex.
  . compiled u-boot for kaen.
  . verified using some extra code that vbnv area is reported as
    16 bytes at offset 52 (0x34).

Change-Id: Icf6a54e12b7458af9f9c213b4afe30437565706b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/5079
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agoCHROMIUM: make sure update_cmdline does not buffer overflow
Che-Liang Chiou [Thu, 28 Jul 2011 09:37:59 +0000 (17:37 +0800)]
CHROMIUM: make sure update_cmdline does not buffer overflow

Although we should not pass any command-line that causes update_cmdline
to buffer overflow, it is good to check and avoid this.

BUG=chromium-os:18139
TEST=unit tests on user space

Change-Id: Ifc481068c30aa5c141d6e3d36f3affd5e3d95ffb
Reviewed-on: http://gerrit.chromium.org/gerrit/4914
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2 years agoCHROMIUM: return boot mode information
Che-Liang Chiou [Wed, 27 Jul 2011 15:14:22 +0000 (23:14 +0800)]
CHROMIUM: return boot mode information

We are implementing the feature that U-Boot can defer loading drivers
until they are needed. For that, U-Boot has to know which boot mode
(normal developer, or recovery) it is.

BUG=chromium-os:17060
TEST=make

Change-Id: Id843be9da07f6b9e8766225963c94e1c21863ffe
Reviewed-on: http://gerrit.chromium.org/gerrit/4812
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHRIMIUM: aebl: kaen: seaboard: implement machine power off
Che-Liang Chiou [Thu, 28 Jul 2011 12:32:26 +0000 (20:32 +0800)]
CHRIMIUM: aebl: kaen: seaboard: implement machine power off

This patch is derived from kernel's seaboard power management driver and
tps6586x regulator driver.

BUG=chrome-os-partner:4738
TEST=press power button or close lid in dev and rec mode

Change-Id: I285856b52dcaba6ba3c29cacf47a8c592fbe3256
Reviewed-on: http://gerrit.chromium.org/gerrit/4922
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: eliminate confusing comma separator
Che-Liang Chiou [Thu, 28 Jul 2011 06:54:04 +0000 (14:54 +0800)]
CHROMIUM: eliminate confusing comma separator

BUG=none
TEST=none

Change-Id: I3b83f2df71df0227aa71dba8300e641944eb4c8b
Reviewed-on: http://gerrit.chromium.org/gerrit/4909
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Micah Catlin <micahc@chromium.org>
2 years agoImplement shared display support.
Vadim Bendebury [Wed, 27 Jul 2011 23:38:15 +0000 (16:38 -0700)]
Implement shared display support.

This change fills up the stubs in lib/vbexport/display.c to
provide support on both ARM (where LCD driver is used) and
X86 (where the CFB driver is used) platforms.

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

On X86 (alex with a Dediprog programmer connected to it), run the
following commands:

 . emerge-x86-alex vboot_reference-firmware  chromeos-u-boot chromeos-coreboot
   dd if=/build/x86-alex/coreboot/coreboot.rom of=/tmp/coreboot seek=3584 bs=1K
   sudo flashrom -p dediprog -w /tmp/coreboot

 . Reboot the machine, observe it come up to boot> prompt, start
   ChromeOS (using the `boot' cli command).

On ARM (tegra2_kaen)
 . emerge-tegra2_kaen vboot_reference-firmware chromeos-u-boot chromeos-bootimage

 . program the resulting image into Kaen, restart it, observe the
   machine come up.

 . install the new OS image on the machine, restart it, observe
   the machine come up.

 . request recovery reboot using crossystem, restart the machine,
   observe it come up in recovery request mode.

  This test case actually failed: the system did show the
  recovery request screen, but then proceeded to boot from the
  plugged in USB stick (it was supposed to wait for the stick to
  be removed/reinserted)

Change-Id: I75310de3f93464645cc9e61237f65d7d19b71873
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/4886
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 years agoCHROMIUM: remove using sprintf to convert a known constant to string
Che-Liang Chiou [Thu, 28 Jul 2011 07:36:31 +0000 (15:36 +0800)]
CHROMIUM: remove using sprintf to convert a known constant to string

BUG=none
TEST=emerge-{ARM board, x86 board} chromeos-u-boot

Change-Id: Ib6c267d6624cebf2b83cb1996ae8135b9cb0e436
Reviewed-on: http://gerrit.chromium.org/gerrit/4911
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoCHROMIUM: Measure the accurate write time on disk and firmware.
Tom Wai-Hong Tam [Wed, 27 Jul 2011 01:53:27 +0000 (09:53 +0800)]
CHROMIUM: Measure the accurate write time on disk and firmware.

The previous measurement includes one read, which is not correct.

BUG=chromium-os:18126
TEST=build and run on Aebl:
Tegra2 # vboot_test fwrw 1000
SF: Detected W25Q32 with page size 256, total 4 MiB
test_fwrw: fw_read, length: 0x1000, time: 3974
test_fwrw: fw_write, length: 0x1000, time: 58777
Read and write firmware test SUCCESS.

Tegra2 # vbexport_test diskrw 8
Requested clock rate 52000000 not honored (got 48000000)
test_diskrw: disk_read, lba_count: 8, time: 3616
test_diskrw: disk_write, lba_count: 8, time: 16370
Read and write disk test SUCCESS.

Change-Id: I165adfc894b6bb667dc2492cc5d840512ffddbc0
Reviewed-on: http://gerrit.chromium.org/gerrit/4787
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoGet rid of the CONFIG_CHROMEOS_KERNEL_* config options
Gabe Black [Thu, 28 Jul 2011 01:08:45 +0000 (18:08 -0700)]
Get rid of the CONFIG_CHROMEOS_KERNEL_* config options

These were incompletely renamed to CHROMEOS_KERNEL_* this change cleans up the
remaining use of the old name and gets rid of the old option from the coreboot
configuration.

BUG=chrome-os-partner:4552
TEST=Built for coreboot, aebl, and kaen.

Change-Id: I267932ab1d2f4a148357e7c95f15a104422ba687
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4889
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoOnly compile in a call to lcd_clear if the LCD driver is configured in.
Gabe Black [Wed, 27 Jul 2011 08:41:41 +0000 (01:41 -0700)]
Only compile in a call to lcd_clear if the LCD driver is configured in.

BUG=chrome-os-partner:4552
TEST=Build for coreboot

Change-Id: Ie7153f3e415e5605457713efca64953d78fb23a6
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4849
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoAdd a missing include into main_entry.c
Gabe Black [Wed, 27 Jul 2011 08:34:41 +0000 (01:34 -0700)]
Add a missing include into main_entry.c

main_entry.c uses the TPM_SUCCESS constant but wasn't including the file that
defines it. This was breaking the build for u-boot/coreboot.

BUG=chrome-os-partner:4552
TEST=Built for coreboot.

Change-Id: I684c4272fcc67403eaf70e2b063dbe3db2b6eb88
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4848
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoCompile out the second copy of wipe_unused_memory if CONFIG_OF_CONTROL isn't on
Gabe Black [Wed, 27 Jul 2011 08:55:13 +0000 (01:55 -0700)]
Compile out the second copy of wipe_unused_memory if CONFIG_OF_CONTROL isn't on

This fix is already being applied to the first copy of wipe_unused_memory.

BUG=chrome-os-partner:4552
TEST=Built for coreboot

Change-Id: I07c1c8d9cc09689e426399aecd2a022ac2e88ccf
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4844
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoConditionally implement vboot function wipe_unused_memory
Gabe Black [Sat, 23 Jul 2011 07:32:17 +0000 (00:32 -0700)]
Conditionally implement vboot function wipe_unused_memory

The wipe_unused_memory function in bootstub_entry.c in the vboot library which
depends on being able to call fdt_decode_memory which only compiled in with
CONFIG_OF_CONTROL. That setting breaks booting u-boot with coreboot right now.

This change conditionally compiles in the existing implementation if the
right support is available and compiles in a warning message if it isn't.

BUG=chrome-os-partner:4552
TEST=Built on x86.

Change-Id: I6404eb12b25c19eb21eb65ad16a5031a5e3d0ad7
Reviewed-on: http://gerrit.chromium.org/gerrit/4843
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoUse a default value for CACHE_LINE_SIZE if no value was set
Gabe Black [Wed, 27 Jul 2011 07:18:26 +0000 (00:18 -0700)]
Use a default value for CACHE_LINE_SIZE if no value was set

This was fixed earlier, but a new instance has popped up.

BUG=chrome-os-partner:4552
TEST=Built u-boot for x86/coreboot.

Change-Id: I6db91149c5f45e1f69cd785bda7d7fd36b530181
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4841
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoConditionally implement vbexport functions
Gabe Black [Thu, 21 Jul 2011 09:21:03 +0000 (02:21 -0700)]
Conditionally implement vbexport functions

There are a few functions in display.c in the vbexport library which depend
on being able to call functions provided by the LCD driver. If that support
isn't turned on then compilation will fail. It can't always be turned on
because it's not always the right driver to use.

This change conditionally compiles in the existing implementation if the
right support is available and compiles in a warning message and a failing
return code if it isn't.

BUG=chrome-os-partner:4552
TEST=Built on x86.

Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: I70695f06bb1b55063d035307e0420f8fc58b1efa
Reviewed-on: http://gerrit.chromium.org/gerrit/4768
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoCHROMIUM: cherry-pick gbb partial loading optimization
Che-Liang Chiou [Tue, 26 Jul 2011 14:29:41 +0000 (22:29 +0800)]
CHROMIUM: cherry-pick gbb partial loading optimization

This patch is cherry-picked from commit 1d01c6b. You may gain 142ms in
boot time.

BUG=chromium-os:16542
TEST=boot normal/developer/recovery on Aebl

Change-Id: I983e2dec32205dd586a2d7f267409eaafefb267f
Reviewed-on: http://gerrit.chromium.org/gerrit/4806
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoAdd stub implementations for the vbexport functions that access NV storage
Gabe Black [Mon, 25 Jul 2011 23:32:28 +0000 (16:32 -0700)]
Add stub implementations for the vbexport functions that access NV storage

These are now board specific functions which need x86 specific
implementations.

BUG=chrome-os-partner:4552
TEST=Built and booted u-boot on an Alex.

Change-Id: I0d3365559df19128fc2b900c4e0b3380b4fbe51c
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4772
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoCHROMIUM: reorganize config headers
Che-Liang Chiou [Tue, 26 Jul 2011 08:55:33 +0000 (16:55 +0800)]
CHROMIUM: reorganize config headers

The headers are merged and split into the board-independent header
chromeos.h and a board-dependent header, e.g., chromeos_tegra2_twostop.h.

The board-independent header defines/enables all features that a
verified boot firmware must have, and is included by a board-dependent
header.

Moreover, the CONFIG_CHROMEOS_* flags are reduced into a single flag
CONFIG_CHROMEOS.

BUG=none
TEST=make chromeos_tegra2_twostop_config && make

Change-Id: I2ec9092ed898c640175095e86cfcb100efbefb3a
Reviewed-on: http://gerrit.chromium.org/gerrit/4731
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: add cros_vboot/cros_legacy to kernel command line
Che-Liang Chiou [Mon, 25 Jul 2011 06:39:35 +0000 (14:39 +0800)]
CHROMIUM: add cros_vboot/cros_legacy to kernel command line

Some scripts, like those in factory process, detect whether Chrome OS is
booted from a verified boot or a legacy boot by overloading crossystem.
If crossystem returns a valid hardware id, the scripts believe that
Chrome OS is booted from a verified boot.

Although this trick works, it does not sound right. This patch adds
"cros_vboot" and "cros_legacy" to kernel command line of verified boot
firmware and legacy firmware so that the scripts can grep the value, or
the crossystem may do the grep.

This patch also fixes unsafe use of strncpy.

BUG=chromium-os:15700,chromium-os:18139
TEST=verified boot and grep cros_vboot /proc/cmdline
TEST=boot from legacy and grep cros_legacy /proc/cmdline

Change-Id: Id5182c2f4e05fc566a17b1e50f9157f96c50f866
Reviewed-on: http://gerrit.chromium.org/gerrit/4645
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: factor out gbb loader functions
Che-Liang Chiou [Tue, 26 Jul 2011 14:10:16 +0000 (22:10 +0800)]
CHROMIUM: factor out gbb loader functions

This patch also eliminates duplications of decoding fmap from the
device tree.

BUG=chromium-os:16542
TEST=make chromeos_seaboard_vboot_config && make

Change-Id: I0af75335be10823b8644c94f6fc9aac0304a2633
Reviewed-on: http://gerrit.chromium.org/gerrit/4745
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoCHROMIUM: initialize TPM in readwrite firmware
Che-Liang Chiou [Tue, 26 Jul 2011 10:20:19 +0000 (18:20 +0800)]
CHROMIUM: initialize TPM in readwrite firmware

VbSelectAndLoadKernel() does not initialize TPM, and because the
function does not distinguish its caller (VbSelectFirmware() initializes
TPM and so if the caller is read-only firmware, the function should not
try to initialize TPM again), it seems unlikely that we can add TPM
initialization codes in the function. So the readwrite firmware itself
has to call VbExTpmInit() to initialize TPM.

BUG=chromium-os:17951
TEST=resign with make_dev_firmware and boot on Aebl
TEST=check hwid is "ARM AEBL TEST 5789 DEV"

Change-Id: If99e09111c2152e909089a8a30a53702573ab3e1
Reviewed-on: http://gerrit.chromium.org/gerrit/4741
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: reserve board-specific section for crossystem data
Che-Liang Chiou [Mon, 25 Jul 2011 08:10:31 +0000 (16:10 +0800)]
CHROMIUM: reserve board-specific section for crossystem data

So far there seems to be no real board-specific data that crossystem
requires (the LBA/offset/size of non-volatile context used on ARM boards
are constants, and could be removed from crossystem data blob).

Nevertheless, I think it should be good to reserve a section for
board-specific data.

BUG=chromium-os:17876
TEST=make

Change-Id: I249fb6bb1ac1740df9f9596e1e1a61ab08c45659
Reviewed-on: http://gerrit.chromium.org/gerrit/4648
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: remove dependency to deprecated code
Che-Liang Chiou [Tue, 26 Jul 2011 10:58:03 +0000 (18:58 +0800)]
CHROMIUM: remove dependency to deprecated code

(commit 5a4a67 does not remove all deprecated stuff)

BUG=none
TEST=make

Change-Id: I458af1218c5afba53f56b0c75bcb0ac1b41caa68
Reviewed-on: http://gerrit.chromium.org/gerrit/4743
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoMake vbexport only use the fdt for LCD info if that's configured
Gabe Black [Fri, 22 Jul 2011 00:31:39 +0000 (17:31 -0700)]
Make vbexport only use the fdt for LCD info if that's configured

BUG=chrome-os-partner:4552
TEST=Built and booted u-boot on an Alex.

Change-Id: I03eb29f70742b4dd3056b0e50c8d54f125bff225
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4717
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoCHROMIUM: Remove use of LOAD_KERNEL_INVALID from u-boot.
Doug Anderson [Tue, 26 Jul 2011 22:26:10 +0000 (15:26 -0700)]
CHROMIUM: Remove use of LOAD_KERNEL_INVALID from u-boot.

The LOAD_KERNEL_INVALID constant was a VBOOT internal constant
that has been removed.

BUG=None
TEST=compiled

Change-Id: Id9158ce66c4dbb70eb0a2f8ad59ce2edc3877dd4
Reviewed-on: http://gerrit.chromium.org/gerrit/4764
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
2 years agoassert: Rely on the compilers dead code removal
Anton Staaf [Mon, 25 Jul 2011 18:46:42 +0000 (11:46 -0700)]
assert: Rely on the compilers dead code removal

By always emitting the assert code we ensure that constructs passed
to assert will be checked by the compiler.  This also ensures that
functions that are only used in asserts aren't flagged as unused
when DEBUG is not defined.

BUG=chromium-os:17999
TEST=Build firmware and boot to ChromiumOS on Aebl, Kaen and Seaboard

Change-Id: Id5f5742622d7041c2cfb7f867742701a087f3e59
Reviewed-on: http://gerrit.chromium.org/gerrit/4666
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
2 years agoMake crossystem_data.c include fdt_support.h explicitly
Gabe Black [Thu, 21 Jul 2011 08:15:16 +0000 (01:15 -0700)]
Make crossystem_data.c include fdt_support.h explicitly

crossystem_data.c needs definitions provided by fdt_support.h, but it doesn't
include it explicitly. This change fixes that.

BUG=chrome-os-partner:4993
TEST=Built and booted u-boot on an Alex.

Change-Id: Ica640b9b6a3454cf8174636eca23c45f0c659e61
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4713
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoCHROMIUM: Redirect VBDEBUG to VbExDebug if VBOOT_DEBUG on.
Tom Wai-Hong Tam [Tue, 26 Jul 2011 03:21:53 +0000 (11:21 +0800)]
CHROMIUM: Redirect VBDEBUG to VbExDebug if VBOOT_DEBUG on.

Make all debug print go to VbExDebug such that it is easy for performance
measurment.

BUG=chromium-os:18126
TEST=build without error

Change-Id: I30d59bd371dc3b122b3c1014107f2238cc01dc3c
Reviewed-on: http://gerrit.chromium.org/gerrit/4725
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoCHROMIUM: Fix warning when cros-debug is off.
Tom Wai-Hong Tam [Tue, 26 Jul 2011 03:09:09 +0000 (11:09 +0800)]
CHROMIUM: Fix warning when cros-debug is off.

The warning is unused variable.

BUG=none
TEST=build without error:
USE="-cros-debug" emerge-tegra2_aebl chromeos-u-boot

Change-Id: I7315ca9d802826bee132525668d7e1f686ed4786
Reviewed-on: http://gerrit.chromium.org/gerrit/4723
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoCHROMIUM: Test firmware and disk R/W with user-input length.
Tom Wai-Hong Tam [Mon, 25 Jul 2011 08:10:55 +0000 (16:10 +0800)]
CHROMIUM: Test firmware and disk R/W with user-input length.

Also add timing metrics. It is useful for benchmark the firmware and
disk R/W performance.

BUG=chromium-os:18126
TEST=build and run on Aebl:
Tegra2 # vboot_test fwrw 80000
test_fwrw: fw_read, length: 0x80000, time: 507045
test_fwrw: fw_write, length: 0x80000, time: 8620418
Read and write firmware test SUCCESS.

Tegra2 # vbexport_test diskrw 1024
test_diskrw: disk_read, lba_count: 1024, time: 31019
test_diskrw: disk_write, lba_count: 1024, time: 94955
Read and write disk test SUCCESS.

Change-Id: I8e92994dd8ca2938ec6d2b8321286f54ab5868a5
Reviewed-on: http://gerrit.chromium.org/gerrit/4652
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoCHROMIUM: rename is_cold_boot to is_processor_reset
Che-Liang Chiou [Mon, 25 Jul 2011 04:18:13 +0000 (12:18 +0800)]
CHROMIUM: rename is_cold_boot to is_processor_reset

The predicate function is_cold_boot() is in fact telling you whether we
are booting from a processor reset.

BUG=chrome-os-partner:5100
TEST=build cleanly

Change-Id: I70f56448dd1b327426cf759854c35e20e0b4cfcf
Reviewed-on: http://gerrit.chromium.org/gerrit/4644
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: remove should-be-removed file
Che-Liang Chiou [Tue, 26 Jul 2011 07:59:08 +0000 (15:59 +0800)]
CHROMIUM: remove should-be-removed file

I made a mistake in rebase and did not delete a file that should be
removed in the previous patch. The file in question is lib/vboot/boot_kernel.c

BUG=chromium-os:16542
TEST=make

Change-Id: Ia91aa92762cc3cd5c410c9a335d6e5e25c3035fe
Reviewed-on: http://gerrit.chromium.org/gerrit/4728
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: reunify boot_kernel
Che-Liang Chiou [Fri, 22 Jul 2011 12:39:45 +0000 (20:39 +0800)]
CHROMIUM: reunify boot_kernel

During the code migration to the redesigned vboot_reference API, the
boot_kernel (formerly named load_kernel_helper) was divided and its
private functions were taken out to keep U-Boot compilable

$ git log --oneline -3 -- lib/chromeos/load_kernel_helper.c
6cdb577 CHROMIUM: remove codes based on deprecated API of vboot_reference
29c5f74 CHROMIUM: Separate cmdline update part from load_kernel_helper library.
f853479 CHROMIUM: Separate the pre-boot FDT update part from load_kernel_helper library.

The commit 29c5f74 and f853479 took out the private functions for
updating kernel command line and embedding crossystem data into a device
tree. The functions are the guts of boot_kernel and serve no purpose
other than helping boot kernel.

In fact, if you diff load_kernel_helper and boot_kernel, you will find
they are virtually identical, except that functions based on deprecated
APIs of vboot_reference are removed in boot_kernel.

As the code migration has been completed, it is time for the private
functions to reunite with the boot_kernel.

BUG=chromium-os:16542
TEST=boot on Aebl

Change-Id: I6512d7a5197c41df7a2e9cc5d90c40be87b468b0
Reviewed-on: http://gerrit.chromium.org/gerrit/4573
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoCHROMIUM: honor /chromeos-config/twostop-optional flag of device tree
Che-Liang Chiou [Mon, 25 Jul 2011 09:38:05 +0000 (17:38 +0800)]
CHROMIUM: honor /chromeos-config/twostop-optional flag of device tree

BUG=none
TEST=Boot and see "twostop-optional" on output
TEST=Remove "twostop-optional" from flashrom-ro.dtsi and set preambles
     flags to 0, then boot and see "not twostop-optional" on output

Change-Id: I53a151107e2bdf1a32f4aeace6f302b66cee3228
Reviewed-on: http://gerrit.chromium.org/gerrit/4651
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoUpdate the chromeos board files for x86.
Gabe Black [Thu, 21 Jul 2011 01:21:57 +0000 (18:21 -0700)]
Update the chromeos board files for x86.

This change replaces the existing stub files in chromeos with new stub files
which are consistent with what's currently required.

BUG=chrome-os-partner:4552
TEST=Built and booted u-boot on an Alex.

Change-Id: Ic0f7b0f411d797a6aab011a1a5f5991f0554c55c
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4700
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoMake a few files assume a reasonable default if CACHE_LINE_SIZE isn't set.
Gabe Black [Wed, 20 Jul 2011 23:04:45 +0000 (16:04 -0700)]
Make a few files assume a reasonable default if CACHE_LINE_SIZE isn't set.

This change modifies a few files to set a reasonable default,
__BIGGEST_ALIGNMENT__, if CACHE_LINE_SIZE isn't set. There's precedence for
doing this in a few other places in u-boot, and it's helpful if CACHE_LINE_SIZE
isn't easy to determine.

BUG=chrome-os-partner:4552
TEST=Built and booted on Alex and Seaboard.

Change-Id: Id1fc373a35dd93f28c2c2f5c4bdaff707ff700e9
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/4699
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Gabe Black <gabeblack@chromium.org>
2 years agoCHROMIUM: unroll the outer for-loop of VbExDiskGetInfo()
Che-Liang Chiou [Wed, 20 Jul 2011 12:44:06 +0000 (20:44 +0800)]
CHROMIUM: unroll the outer for-loop of VbExDiskGetInfo()

VbExDiskGetInfo() was implemented with nested loops, where the outer
loop iterates iterators, and the inner loop runs through block devices
via the iterator.

It was quite complicated and the outer loop only iterates twice. So we
believe it will make the code more readable if we unroll the outer
for-loop.

Besides unrolling the loop, we fix a logic error that disk_flags should
be tested 'is subset of' rather than 'has non-empty intersection with'
flags.

BUG=chromium-os:16542
TEST=vbexport_test diskinfo

Change-Id: Ic4a7d516d91ba7214b9b67eebbecf02f80b11786
Signed-off-by: Tammo Spalink <tammo@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/4472
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 years agoCHROMIUM: remove CONFIG_HARDWARE_TPM
Che-Liang Chiou [Mon, 25 Jul 2011 07:20:30 +0000 (15:20 +0800)]
CHROMIUM: remove CONFIG_HARDWARE_TPM

The CONFIG_HARDWARE_TPM flag was used to disable software emulation of
TPM functionality, for testing purpose or for boards that have a buggy
or even do not have a hardware TPM. However, it turns out that it is
easier to mock out TPM entirely in vboot_reference than implement a full
software-emulated TPM in U-Boot. So we believe remove this flag and
implement a mock in vboot_reference.

BUG=none
TEST=boot on Aebl

Change-Id: Id6d2975f04f0f5e4203d45e23f36fce2ad7114f3
Reviewed-on: http://gerrit.chromium.org/gerrit/4647
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>