Commit Graph

12 Commits

Author SHA1 Message Date
Randall Spangler
a185b8d8f6 Report mainfw_act based on VbSharedData
Don't use FDT to report it on ARM.

This fixes ARM reporting the wrong thing for RO-normal.

BUG=none
TEST=none

Change-Id: Id3a1bd2a1d2502e1d9493ab362be5a58fa88d70e
Reviewed-on: http://gerrit.chromium.org/gerrit/4213
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-15 19:27:15 -07:00
Olof Johansson
7994d07d56 crossystem: arm: use proper gpio references
BUG=none
TEST=make sure developer switch and recovery switch runtime reading works as expected (manually)

Change-Id: I3b17ac66f88b2b789bebe4e7d271666f8c63a8b0
Reviewed-on: http://gerrit.chromium.org/gerrit/4127
Reviewed-by: Olof Johansson <olofj@chromium.org>
Tested-by: Olof Johansson <olofj@chromium.org>
2011-07-14 21:50:42 -07:00
Olof Johansson
3a6e2f10b2 arm: convert to new device tree usage
This also includes reading the nonvolatile storage from disk instead of
through the device-tree, since it's not updated there.

BUG=none
TEST=read and write a few crossystem variables

Change-Id: I6836a6eb0c92a0560dd393e694690a694bdb77a6
Reviewed-on: http://gerrit.chromium.org/gerrit/4078
Tested-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2011-07-14 01:13:27 -07:00
Rong Chang
d70241f37d Introduce arm fdt support in crossystem utility
This CL builds upon recent changes in u-boot and kernel. (see issue
ids: 15744, 16665)

 - Remove /sys/kernel/debug/chromeos_arm share memory mechanism
 - Load properties from /proc/device-tree/crossystem/*
 - Write NVCXT to /dev/mmcblk0:lba[0]

BUG=chromium-os:17300
TEST=manual

Run crossystem on device console. Check current values of gpio
switches. All other values are exported from FDT directly.

Change-Id: Ib8db4a4aeb6dc36308ad8882403cb2f5978a5c70
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/3676
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-07-11 21:38:29 -07:00
Hung-Te Lin
fbb52dfa9c crossystem: fix VbSharedDataHeader size
The content in VbSharedMem should be VbSharedData instead of FMAP.

BUG=chromium-os:17168
TEST=crossystem # seeing correct value
     (the test need a u-boot with fix included)

Change-Id: I3d7d1eb2b35c9475c2047e9479cee69464da20b1
Reviewed-on: http://gerrit.chromium.org/gerrit/3436
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-06-30 03:52:51 -07:00
Randall Spangler
1c1a883bc7 Fix ARM build for vboot_reference crossystem lib
BUG=none
TEST=none

Change-Id: I655cd69a0e1d2a3ad6ce9f326cbd989fc8ecb43d
Reviewed-on: http://gerrit.chromium.org/gerrit/3270
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-06-27 15:51:38 -07:00
Doug Anderson
cbc86f786c Fixed compiler warning in v-boot reference.
The error was:
  arch/arm/lib/crossystem_arch.c: In function ‘VbReadSharedMemory’:
  arch/arm/lib/crossystem_arch.c:134: error: format ‘%d’ expects type ‘int’, but argument 5 has type ‘long unsigned int’

BUG=none
TEST=(outside choot): cd src/platform/vboot_reference; make

Change-Id: I5e1f69abd125fe06cf6ae04a7946568bdbcef83e
Reviewed-on: http://gerrit.chromium.org/gerrit/1547
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2011-05-25 13:21:11 -07:00
Che-Liang Chiou
78b05174b7 crossystem: arm: fix incorrect mainfw_act output
BUG=chromium-os:15626
TEST=manual

when not recovery boot
$ [ $(crossystem mainfw_act) = "A" ] || [ $(crossystem mainfw_act) = "B" ]

when recovery boot
$ [ $(crossystem mainfw_act) = "recovery" ]

Change-Id: I3917106b61e2979d8cb07f01fd0cec044ae725cb
Reviewed-on: http://gerrit.chromium.org/gerrit/1345
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2011-05-22 20:24:17 -07:00
Vadim Bendebury
a3ec5c40f8 Ensure ARM crossystem gpio readings match u-boot.
U-boot and crossystem interpret the same switch state differently
for 'recovery mode' and 'write protect', This change adds the
ability to invert certan GPIO readings such that crossystem and
u-boot return the same values.

BUG=chromium-os:15393
TEST=manual

Running crossystem on the target with developer u-boot image:

- observe that recoverysw_cur reading matches recoverysw_boot and
  wpsw_cur reading matches_wpsw_boot.

- try rebooting with recovery or developer mode buttons pressed,
  observe the change in reported values of devsw_boot and
  recoverysw_boot.

- observe reported values of devsw_cur and recoverysw_cur
  following pressing of the buttons.

Change-Id: I628f59b60008719bbff1722d23154ce934af6c36
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/1193
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-05-19 13:39:40 -07:00
Vadim Bendebury
c3574086a8 Introduce arm support in crossystem.
This CL builds upon earlier firmware and kernel changes (see CLs
related to the same bug, chromium-os:12522).

ARM firmware now simulates both Nvram storage and VDAT buffer, the
structures the x86 version uses extensively to communicate back and
forth between firmware/kernel/userland.

So, to make crossystem work on arm, all what's needed is to provide
architecture specific interface to Nvram and VDAT simulation, and
architecture specific processing for variables which are accessed on
ARM platforms in a different way.

The few discrepancies and platform specifics which had to be addressed
for ARM specifically are as follows:

- the Nvram contents are cached in the shared memory and available for
  reading as part of /sys/kernel/debug/chromeos_arm. When writing
  Nvram, the same file needs to be written, but only the 16 bytes
  (representing the Nvram contents) are aacepted.

- the VDAT buffer also comes from the shared memory (as part of the
  same sysfs file)

- when crossystem starts, it needs to read in this shared memory
  contents, a` weak' function VbArchInit() is being added such that it
  is provided on ARM platforms only, on x86 an empty stub is called.

- current developer/recovery request/ro firmware switch states are
  retrieved through GPIO drivers. The GPIO numbers are defined in the
  file, the GPIO driver is supposed to be configured before
  crsossystem can operate.

- the BINF values are supplied through an array within shared memory,
  it would be easy to refactor both x86 and ARM use the same code to
  process BINF values, but with this submission the code is duplicated
  to minimize x86 impact.

- the following crossystem variables do not have ARM equivalents,
  thier values are reported as '(error)':

   recoverysw_ec_boot
   savedmem_base
   savedmem_size

BUG=chromium-os:12522
TEST=manual:

. bring up a kaen system
. execute the following script to enable the appropriate GPIOSs:

 for gpio in 56 59 168; do echo $gpio > /sys/class/gpio/export; done

. run `crossystem' and observe reasonable output values

. to verify that it reads GPIOs properly, try

  echo $(./crossystem recoverysw_cur)

  with the miniservo 'GOOG_REC' button pressed and released, observe
  different readings (note that the state of the button is reversed,
  the released button is reported as '1')

. to verify the write capabilities, note that the nvram contents can
  be accessed using the following shell commands

     echo 3 > /proc/sys/vm/drop_caches
     2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && \
       od -t x1 /tmp/blk | head -1

 (the first command cause the device cache dropped, and the second
 command accesses the device contents.

   vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
   localhost var # echo $(./crossystem fwb_tries)
   10
   localhost var # echo 3 > /proc/sys/vm/drop_caches
   localhost var # 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && od -t x1 /tmp/blk | head -1
   0000000 60 0a 00 be 00 00 00 00 00 00 00 02 00 00 00 a2
   localhost var # ./crossystem fwb_tries=9
   localhost var # echo $(./crossystem fwb_tries)
   9
   localhost var # echo 3 > /proc/sys/vm/drop_caches
   localhost var # 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && od -t x1 /tmp/blk | head -1
   0000000 60 09 00 be 00 00 00 00 00 00 00 02 00 00 00 8a
   localhost var #
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Change-Id: Ie4c6ff44441d98a42b1057953208fdb90c08f46d
Reviewed-on: http://gerrit.chromium.org/gerrit/113
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
2011-05-05 14:42:09 -07:00
Randall Spangler
824906b9db Add crossystem arch (reports x86 or arm, depending on platform)
Change-Id: I857ead5b108d42195145cdbc5cdafa817f3416b4

R=reinauer@chromium.org
BUG=chrome-os-partner:3023
TEST=crossystem arch

(reports 'x86' on x86 platform, 'arm' on ARM platform)

Review URL: http://codereview.chromium.org/6813054
2011-04-08 13:34:44 -07:00
Randall Spangler
eb59195473 Refactor crossystem to move x86-specific implementation to its own file.
This should be ready for the ARM team to pick up and work on.  I added
a placeholder ARM implementation file, though it's not hooked up in
the Makefile yet.

As soon as you implement the VbNvStorage APIs, all the related
crossystem commands will start working.  Ditto for VbSharedData.

The params which x86 gets from ACPI you'll need to get from u-boot
somehow, probably via your own kernel driver.

R=robotboy@chromium.org
BUG=chromium-os:12522
TEST=emerge-x86-alex vboot_reference, make sure it still works on x86

Review URL: http://codereview.chromium.org/6780008

Change-Id: I628ee56508421b937ed50db7cb9b8385408d2f5e
2011-04-07 10:02:00 -07:00