Commit Graph

59 Commits

Author SHA1 Message Date
David Hendricks
aaa325727a crossystem: rename Vb*NvStorage_mkbp to Vb*NvStorage_mosys
This is just a cosmetic tweak to make it a bit clearer that
mosys is the underlying interface for these particular vbnv
read/write functions.

BUG=none
BRANCH=none
TEST=it still compiles

Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: Ide172bfecf608a30489d25026268aedfc421ce4d
Reviewed-on: https://chromium-review.googlesource.com/222062
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-10-09 20:43:50 +00:00
David Hendricks
1137139a2e crossystem: handle "flash" media in Vb*NvStorage()
This handles VBNV data stored in SPI flash which happens to be
the exact same way we handle VBNV data stored in the EC.

BUG=chrome-os-partner:31529
BRANCH=none
TEST=with CL:221349 applied, crossystem on storm no longer
spews tons of errors

Change-Id: I021d9f430acfac34dff44a927361a5a0e5ae2ff8
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/222061
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-10-09 20:43:45 +00:00
Duncan Laurie
631c661be0 Add broadwell PCI ID for platform family lookup table
Currently broadwell systems are returning (error) for this lookup.

BUG=chrome-os-partner:28234
BRANCH=none
TEST=test crossystem output:
> crossystem platform_family
Broadwell

Change-Id: I204dd47e62683d5e81e16ddb9c3ea96034fb22a5
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/214862
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-08-29 16:59:03 +00:00
Duncan Laurie
b52d7b7acb crossystem: Add PCH-LP GPIO type
Rather than continuing to report different variants of PCH GPIO the same
way use the common name of PCH-LP.

BUG=chrome-os-partner:28234
BRANCH=None
TEST=boot on samus and ensure there are no (error) reported

Change-Id: I9321e7bd85b2b3b3ebadc22ac32be6759e85f822
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210393
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-07-30 05:31:41 +00:00
Gaurav Shah
841126fec6 vboot_reference: Provide crossystem interface stubs for mips
BUG=chromium:358418
TEST=emerge-mipsel-o32-generic vboot_reference now builds.
BRANCH=none

Change-Id: Ia1414dfdef00c5b22ed0971fad814ef761b32b86
Reviewed-on: https://chromium-review.googlesource.com/193050
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Gaurav Shah <gauravsh@chromium.org>
2014-04-04 04:58:21 +00:00
Gabe Black
435be98731 tegra124: Add the tegra124 compatibility string to crossystem.
Teach crossystem the tegra124 compatibility string so that it can identify the
platform for tegra124 based systems.

I called the platform Tegra5 to fit in with what seems to be the naming scheme
for the other Tegra SOCs.

BUG=chrome-os-partner:25355
TEST=Built and ran on nyan and saw the "platform_family" setting return Tegra5
instead of (error).
BRANCH=None

Change-Id: I1044f958ecdac37ad285fdc3d53e7bc36ca69315
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://chromium-review.googlesource.com/184051
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
2014-01-29 11:07:31 +00:00
Aaron Durbin
1aa59b0ea5 crossystem: handle BayTrail gpios
BayTrail systems have 3 banks of gpios. Therefore,
the Linux kernel exposes these 3 banks as 3 gpiochip
entries. The kernel driver expects the 3 banks to be
exposed with specific UIDs associated with a specific
banks. ChromeOS firmware maps gpios within a given
bank using the bank's MMIO offset. In summary:

Bank Type | UID | Offset
----------+-----+-------
 SCORE    |  1  | 0x0000
 NCORE    |  2  | 0x1000
 SUS      |  3  | 0x2000

BUG=chrome-os-partner:24408
BUG=chrome-os-partner:24324
BRANCH=None
TEST=Built. 'crossystem wpsw_cur' works correctly.

Change-Id: I251f86285ce9733f7ca90ed1ebef536f4fe5c07c
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179513
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-12-11 19:50:39 +00:00
Aaron Durbin
31912b61a7 crossystem: add GpioChipset sturcture for x86
Up until recently the x86 systems had a single contiguous
set of gpio numbers exported through /sys/class/gpio
as /sys/class/gpiochip<X> values. BayTrail systems have
3 sets of gpio numbers. Therefore, there needs to be a
translation/look-up function based on chipset. The existing
chipsets have a 1:1 mapping, but this patch lays the ground-
work for chipset-specific translation.

BUG=chrome-os-partner:24324
BUG=chrome-os-partner:24440
BUG=chrome-os-partner:24408
BRANCH=None
TEST=Built. Ran on Rambi.

Change-Id: I32bcd975aea421f86a0220ee30332f48fe727656
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179512
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-12-11 19:50:35 +00:00
Aaron Durbin
a7e2c76519 crossystem: make BayTrail a valid platform_family
BayTrail is a valid chromeos platform. Therefore, allow
it to be returned for 'platform_family'.

BUG=chrome-os-partner:24324
BUG=chrome-os-partner:24440
BRANCH=None
TEST=Built. 'crossystem platform_family' reports 'BayTrail'.

Change-Id: I8d0b835f5f40e7f34adb4f91bd974c428bbaf6da
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179511
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-12-11 19:50:31 +00:00
J. Richard Barnette
a3d70a3d2b Make crossystem.h more polite and more useful.
This adds a VB_MAX_STRING_PROPERTY for callers that don't
want to guess at how big to make their buffers.

Additionally, it changes the size parameter to VbGetPropertyString()
from int to size_t.

BUG=None
TEST=compile the code
BRANCH=none

Change-Id: I22809d48e13b535593cb22a56444e2dcb27791a5
Reviewed-on: https://chromium-review.googlesource.com/175039
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
2013-10-31 21:56:58 +00:00
Simon Glass
3401fdcd41 Correct some minor compiler warnings
A few places in the code through up warnings when building with strict
compiler flags. Correct these.

BUG=chrome-os-partner:21115
BRANCH=pit
TEST=manual
Build with:

FEATURES=test emerge-peach_pit vboot_reference

and see that iot now succeeds. Warnings include:

host/arch/arm/lib/crossystem_arch.c: In function 'ReadFdtValue':
host/arch/arm/lib/crossystem_arch.c:93:8: error: ignoring return value of 'fread', declared with attribute warn_unused_result [-Werror=unused-result]

Change-Id: I765723636e5f8979b794925c7b610081b2849026
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66174
2013-08-25 16:57:28 -07:00
Simon Glass
47779880b2 Improve kernel tests to pass valgrind
At present the kernel tests produce valgrind errors since the GPT data is
sometimes accessed before it is read. This is unnecessary, so update the
code to avoid this.

BUG=chrome-os-partner:21115
BRANCH=pit
TEST=manual
valgrind --leak-check=full  ./build/tests/vboot_kernel_tests

See that we no longer get valgrind errors.

Change-Id: I9e9660e38a62a735cf01a37c2d81ddb5ab8b1528
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66173
2013-08-25 16:57:27 -07:00
Vadim Bendebury
114d54a9e2 Add 5420 to the set of recognizable platforms
It is used on peach_pit.

BRANCH=none
BUG=none
TEST=manual
   . on peach-pit:

  localhost ~ # echo $(crossystem arch)
  arm
  localhost ~ #

Change-Id: Ia9a4ea2291d6b672fca1c9e1305961eedc4f60cf
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/59339
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-06-20 13:55:12 -07:00
Duncan Laurie
7e3f8601ba crossystem: Add device IDs for haswell
0x8086,0x0a04 is Haswell ULT
0x8086,0x0c04 is Haswell Mobile

BUG=chrome-os-partner:19263
BRANCH=none
TEST=manual test on slippy hardware:

$ crossystem platform_family
Haswell

Change-Id: Ia885d0c8f0be2fb626257ca513f581df50259173
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56075
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-05-23 10:02:24 -07:00
Duncan Laurie
ad3ff7c738 crossystem: Add LynxPoint to list of valid x86 chipset types
Haswell CPUs are paired with the LynxPoint chipset and this
needs to be a valid controller name for crossystem.

BUG=chrome-os-partner:19263
BRANCH=none
TEST=manual

This was tested on a wtm2 system to ensure that a GPIO
defined in chromeos ACPI that is exported by the kernel at
/sys/devices/platform/chromeos_acpi/GPIO.# is used by crossystem
and the GPIO is exported in /sys/class/gpio and read.

$ cat /sys/devices/platform/chromeos_acpi/GPIO.1/GPIO.2
34
$ cat /sys/class/gpio/gpio196/value
1
$ crossystem wpsw_cur
1

Change-Id: I04064109e99270d7d26b27182b17fffbf47b025b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50224
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-05-06 17:48:25 -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
Randall Spangler
61a2eb389d Fix architecture definitions.
We should use only arm, x86, and x86_64; currently we also use i386 to
mean x86, and amd64 to mean x86_64.

BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-link vboot_reference chromeos-u-boot chromeos-installer
FEATURES=test emerge-daisy vboot_reference chromeos-u-boot chromeos-installer
FEATURES=test emerge-x86-alex vboot_reference chromeos-installer
make && make runtests (both inside and outside chroot)

Change-Id: I4fb64fafa9c48a76ded862e074776cab9ea54ab3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41838
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-01-23 13:23:05 -08:00
Randall Spangler
09a8447862 crossystem devsw_cur returns devsw_boot if virtual dev switch
devsw_cur is really a meaningless concept on systems with virtual dev
switches; it exists primarily to support factory test of physical
developer switches.  However, some plugins use this instead of the
preferred devsw_boot, and it's easier to modify crossystem than the
plugins at this point in time.

BUG=chrome-os-partner:12928
BRANCH=none (affects all current products, but is an OS-level change, not FW)
TEST=manual

- On link, 'crossystem devsw_cur devsw_boot' with dev switch on -> '1 1'
- On link, 'crossystem devsw_cur devsw_boot' with dev switch off -> '0 0'
- On lumpy or earlier, 'crossystem devsw_cur' should return current dev
  switch position; check this by toggling the physical switch without
  rebooting and see that the reported value follows the switch value.

Change-Id: Ie7416e5cb03c133572c32af677b55ed18884dfb8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34531
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2012-10-04 09:31:00 -07:00
Che-Liang Chiou
210c5ef2d9 crossystem should not grumble about older firmware
Older firmware does not provide nonvolatile-context-storage FDT
property, and crossystem complains about it.

This is harmless; so just make it quiet.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

BRANCH=none
BUG=chrome-os-partner:14475
TEST=manual, see blow

Run crossystem and make sure its output does not contain
  "Unable to open FDT property nonvolatile-context-storage"
messages.

Check crossystem still works by comparing its output w/ and w/o this
change.

Change-Id: I0b8f40775833457a75d801f185344e931ac08847
Reviewed-on: https://gerrit.chromium.org/gerrit/33896
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-09-24 16:29:03 -07:00
Che-Liang Chiou
770c1b772c crossystem should switch on VbNvContext storage type
We may have multiple storage types (disk or mkbp) of VbNvContext.
crossystem should switch the type and choose the corresponding device
driver.

After patching U-Boot, you may check storage type:
  [ "mkbp" = "$(cat /proc/device-tree/firmware/chromeos/nonvolatile-context-storage)" ]

And cross-verify crossystem with mosys:

  $ mosys nvram vboot read
  70000000000000000000000000000020
  $ crossystem recovery_request
  0

  $ crossystem recovery_request=123
  $ mosys nvram vboot read
  70007b0000000000000000000000005d

  $ mosys nvram vboot write 70000000000000000000000000000020
  $ crossystem recovery_request
  0

More importantly, crossystem should also work with older version of
firmware, which does not pass down this information.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

BRANCH=none
BUG=chrome-os-partner:13766
TEST=Check storage type on a Snow device:
     [ "mkbp" = "$(cat /proc/device-tree/firmware/chromeos/nonvolatile-context-storage)" ]
     Make sure that FAFT is still happy:
     ./run_remote_tests.sh --remote $ADDR --board daisy 'firmware_TryFwB/control$'
     ./run_remote_tests.sh --remote $ADDR --board daisy 'firmware_TryFwB/control.dev$'
     More importantly, check crossystem worked well even when ChromeOS
     is booted from an older version of firmware.

Change-Id: I3989a8c181efe03cd9f06127743763e0ad97e281
Reviewed-on: https://gerrit.chromium.org/gerrit/32470
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
2012-09-18 15:05:03 -07:00
Gabe Black
3afe5566cc Make crossystem look for the write protect switch in the chromeos_arm device
The value of the ChromeOS write protect switch is now provided through the new
chromeos_arm platform device which avoids the mismatch between U-Boot and
kernel GPIO numbering.

BUG=chrome-os-partner:11297
TEST=gmerge-ed onto a snow and verified that crossystem got the right value of
the write protect switch.
BRANCH=snow

Change-Id: I466370e4f6bf2d14c067518a9d620e9e60142a0b
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/30534
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-08-16 09:48:45 -07:00
Randall Spangler
da8d32dc8d Crossystem should return at-boot switch positions from VbSharedData
This is more reliable than reading them through FDT/ACPI, since it reflects
the positions as shown to verified boot code.

Notes:
1. This affects ALL platforms with virtual dev switches (x86 AND arm)
2. The fix should have no effect on older platforms, but I haven't tested those.

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

1. boot in normal mode.

devsw_boot             = 0                              # Developer switch position at boot
recovery_reason        = 0                              # Recovery mode reason for current boot
recoverysw_boot        = 0                              # Recovery switch position at boot
wpsw_boot              = 1                              # Firmware write protect hardware switch position at boot

2. boot in developer mode.

localhost ~ # crossystem
devsw_boot             = 1                              # Developer switch position at boot
recovery_reason        = 0                              # Recovery mode reason for current boot
recoverysw_boot        = 0                              # Recovery switch position at boot
wpsw_boot              = 1                              # Firmware write protect hardware switch position at boot

3. boot in developer-recovery mode using keyboard combo.

devsw_boot             = 1                              # Developer switch position at boot
recovery_reason        = 2                              # Recovery mode reason for current boot
recoverysw_boot        = 1                              # Recovery switch position at boot
wpsw_boot              = 1                              # Firmware write protect hardware switch position at boot

4. disable WP and reboot.  wpsw_boot should be 0.

Change-Id: If4156b5e14c6923c5b331c7e5feaabbffe1dad37
Reviewed-on: https://gerrit.chromium.org/gerrit/29199
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2012-08-06 13:15:43 -07:00
Che-Liang Chiou
ffb9233a90 crossystem: Let kernel worry about active_low stuff
As kernel has adjusted the value of /sys/class/gpio/gpio${PORT}/ with
active_low stuff before returning it to user, crossystem should not do
another adjustment.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

BUG=chrome-os-partner:11297
TEST=On Snow, run crossystem and see wpsw_boot equals to wpsw_cur.
     Then invert /sys/class/gpio/gpio${PORT}/active_low value, and
     see wpsw_boot does not equal to wpsw_cur.

Change-Id: I09fec89788bc4393775d5cf9763b8cebeb645ad4
Reviewed-on: https://gerrit.chromium.org/gerrit/27252
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-12 09:46:52 -07:00
Che-Liang Chiou
7ec9f71717 crossystem: Return error when trying to read GPIO port zero
For the record, zero is a valid GPIO port number.  Unfortunately
firmware uses port zero to denote that a GPIO port is not exist.
So crossystem should not attempt to read GPIO port zero, but
return error instead.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

BUG=chrome-os-partner:11296
TEST=On Snow, run crossystem and see devsw_cur and recoverysw_cur
     are "(error)"

Change-Id: I70b15824f613df1e46bf152515ad4e9362c9f066
Reviewed-on: https://gerrit.chromium.org/gerrit/27251
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
2012-07-12 02:09:45 -07:00
Che-Liang Chiou
edea097d55 Revert "Read virtual switch current values correctly"
This reverts commit 7ec59576f6.

We would like to keep dev_cur and recovery_cur output "(error)" so that
factory process knows that firmware uses virtual switches.

I think this is strange, but this is how factory process works for now.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

BUG=chromium-os:10007
TEST=none

Change-Id: I370a3e9f5a8847916445348abb81f7c4bbf3d27f
Reviewed-on: https://gerrit.chromium.org/gerrit/26909
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2012-07-09 02:04:18 -07:00
Rong Chang
a5ef4f98fc Exporting GPIO if the sysfs node does not exist
This change exports gpio number if it can not be accessed. Ignore
the active_low checking for compatibility.

Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:11029
TEST=manual
  Run crossystem and check WP pin status

Change-Id: I0885ab21c6c6d614945e4fda49a373e8619772a9
Reviewed-on: https://gerrit.chromium.org/gerrit/26563
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-07-03 07:21:34 -07:00
Che-Liang Chiou
7ec59576f6 Read virtual switch current values correctly
As dev switch and recovery switch may be virtual, crossystem has to
distinguish virtual switches from physical ones.

Since to a virtual switch, its current value should always equal to its
boot value, return a boot value when asked for a current value.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

BUG=chrome-os-partner:10007
TEST=crossystem devsw_cur|recoverysw_cur show correct value on Snow

Change-Id: Ia73147ecd5528a3cc5276aff02a632ce4f52ea8b
Reviewed-on: https://gerrit.chromium.org/gerrit/26568
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-07-02 23:10:04 -07:00
Tom Wai-Hong Tam
d808a43d35 crossystem: Add the ddr_type field on crossystem for querying DDR RAM type
Samsung want to know what memory type on the device. So this CL adds a
new field ddr_type to crossystem utility in order to query this info.

It is only available on ARM platform so far.

BUG=chrome-os-partner:10857
TEST=Built and boot on Snow successfuly. On userspace, query the field via:
localhost ~ # crossystem ddr_type
ddr3

Change-Id: I01d1dec412fe4052e1ea6cfe2e53830da97a710b
Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26411
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-07-02 06:19:39 -07:00
Olof Johansson
58def7454d add EXYNOS{4,5} to platform_name tables on arm
BUG=chrome-os-partner:10872
TEST=run crossystem on snow, check output

Change-Id: I413cbd86833fc8abff9afbf12a85abe53b586af4
Reviewed-on: https://gerrit.chromium.org/gerrit/26090
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Olof Johansson <olofj@chromium.org>
Tested-by: Olof Johansson <olofj@chromium.org>
2012-06-26 11:51:27 -07:00
Bill Richardson
f47291926a Require -Wall -Werror for everything.
BUG=none
TEST=none

Change-Id: Ib9781238274285f73d00d8fca4ecda28fc2c6678
Reviewed-on: https://gerrit.chromium.org/gerrit/21748
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2012-05-03 17:38:57 -07:00
Vadim Bendebury
fcec9e7c4b crossystem: introduce a new main firmware type, 'netboot'
We need to be able to tell when a ChromeOS machine was brought up
using netboot. This condition will be communicated from firmware using
the BINF.3 ACPI object (upcoming u-boot change).

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

  . boot a ChromeOS machine using the updated firmware and examine the
    main firmware type reported by crossystem:

  localhost ~ # echo $(/var/crossystem mainfw_type)
  netboot

Change-Id: I35b10f41eb1f928a122c384d0179c9027f263acd
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/20707
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-04-20 15:40:36 -07:00
Vadim Bendebury
27f8838fb4 Modify crossystem to recognize Panther Point GPIO controller
There is a filter in crossystem which makes sure that it accepts GPIO
information only from a subset of GPIO controllers. Panther Point
needs to be included in the list.

BUG=chrome-os-partner:8615
TEST=manual
 . run the new crossystem on a Link
 . modify write protect and and recovery (as it comes from servo-2)
   pins' status
 . observe the appropriate crossystem values change

Change-Id: I3ac269a9ea520f2c44ee090fe71ec8ad808692ba
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/18936
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-03-23 00:10:47 -07:00
Bernie Thompson
885a9774ef Add a failure check to ReadFdtBlock in ReadFdtPlatformFamily
This adds in logic to check that ReadFdtBlock within ReadFdtPlatformFamily
succeeded, returning NULL on failure.

BUG=None
TEST=Manual, run crossystem on an ARM system without a valid compatible FDT
entry and ensure (error) is returned for platform_family.

Change-Id: I6351292ff73e4bc08b028f85e72ccfe62159194a
Reviewed-on: https://gerrit.chromium.org/gerrit/14321
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
2012-01-19 09:57:27 -08:00
Bernie Thompson
bd00c622e4 Allow crossystem ReadFdtBlock() to use a direct path starting with '/'
This extends the ReadFdtBlock function for ARM to allow for a direct path
to a FDT entry by starting the property with a '/'. This allows the
ReadFdtPlatformFamily function to use a direct path instead of stepping back
through folders, and will enable future crossystem entries to do the same.

BUG=chromium-os:24669
TEST=Manual

Change-Id: Ibddb881815947259c2532d7f5474eda5fdc9f803
Reviewed-on: https://gerrit.chromium.org/gerrit/14305
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
2012-01-18 09:44:23 -08:00
Bernie Thompson
0b5789fee9 Add in a platform_family value to crossystem
This implements a platform_family value within the crossystem utility,
as the platform (particularly for ARM) is not easily accessable elsewhere at
runtime.

For the ARM side this contains a table which is used to determine the platform
family based on the /proc/device-tree/compatible entry. Similarly on x86 the
table is used to check against PCI entries. Additional entries can be made
as new platform families emerge.

BUG=chromium-os:24669
TEST=Manual, verified that crossystem runs properly and returns a valid
platform_family value on various platforms (mario, alex, z600, x220, etc).

Change-Id: Id0e973902d27ead471c1243bcc6c3292acc8479d
Reviewed-on: https://gerrit.chromium.org/gerrit/13520
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Olof Johansson <olofj@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Tested-by: Olof Johansson <olofj@chromium.org>
2012-01-09 15:44:31 -08:00
Sonny Rao
5fffeee412 Fix crossystem on amd64 boards
Since x86 and amd64 boards use the same firmware and are otherwise identical
use the same implementation for crossystem on both

BUG=chromium-os:21386
TEST=emerge-x86-generic ; test crossystem works on Samsung Series 5
TEST=emerge-amd64-generic ; test crossystem works on Samsung Series 5
TEST=run unit tests on build machine with:
RUNTESTS=1 make

Change-Id: Ica516cca7ead6cb9cdfae0894bd532669ba3ba88
Reviewed-on: https://gerrit.chromium.org/gerrit/12059
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>
2011-11-23 14:55:11 -08:00
Hung-Te Lin
6a6f85d6bb vboot_reference: fix CMOS writing for x86 platforms
VbCmosWrite should seek to correct offset before starting to write;
also fixed file handle leakage.

BUG=chromium-os:23000
TEST=crossystem recovery_request=1; echo $? # show: 0
     crossystem recovery_request # show: 1
     reboot # see recovery screen

Change-Id: I33bca8af2b351ba9b364309838df699a31bb543a
Reviewed-on: https://gerrit.chromium.org/gerrit/11756
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2011-11-16 06:47:02 -08:00
Gabe Black
29efa17737 Wrap CMOS read/write functions so they automatically pacify the nvram driver.
A legacy checksum in CMOS is not maintained by coreboot and may be invalid. If
the Linux kernel driver sees that the checksum is wrong, it will return EIO
when read from or written to. That makes crossystem return an error since it
can't read the CMOS, and it also prevents it from changing some settings.

One way to fix the problem would be to remove the checksum check in the kernel
driver. This would change the semantics of the driver so that either x86 was
inconsistent with the other architectures, or change the semantics of those
other architectures as well.

Another option would be to fix the checksum during manufacturing since nothing
should be changing those particular bytes of CMOS. The problem with this
approach is that something might corrupt the CMOS after manufacturing, and
we'd have the same problem again.

Yet another solution would be to make the firmware, most likely coreboot,
actually keep the checksum up to date. This seems like an awful waste of boot
time, the bytes protected by the checksum aren't actually used by anything,
and the bytes of the CMOS that are used are protected by vboot using its own
checksum.

The solution implemented here is to make crossystem recognize when the driver
has determined that the checksum is invalid and make it call an ioctl that
gets the driver to fix the checksum. Wrapper functions for fread, fwrite,
fgetc, and fputc are implemented which first attempt to read or write, on
failure check for the EIO error code, and if they find it to call the
appropriate ioctl and attempt the access again. This way, we won't take any
extra time to talk to the CMOS when everything is working properly, and when
there's a problem it gets fixed up transparently. One problem with this
approach is that using the /dev/nvram device file will still fail until
crossystem is run at least once and given a chance to fix the checksum.

BUG=chrome-os-partner:6718
TEST=For version 1, verified that crossystem reported an error on Sameer's
Lumpy. Used strace to verify that crossystem received an EIO error when trying
to read or write /dev/nvram. Built a new image with this change and booted it
using a USB stick. Ran crossystem and verified that crossystem no longer
reported an error. Rebooted into the original image and verified that
crossystem worked there as well, indicating that the persistent problem in the
CMOS had been corrected.

For version 2, the same as version 1 except that I used a custom version of
u-boot to purposefully corrupt the CMOS rather than using Sameer's Lumpy.

Change-Id: I929535bd2a7d666e41a707b6b24c3f0b0df1147f
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/11373
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-11 12:15:06 -08:00
Bill Richardson
1a4d03dc90 Determine GPIO base from /sys/class/gpio/gpiochip<N>
... instead of using hard-coded 192 constant.

BUG=chromium-os:19876
TEST=manual

If crossystem still reports correct values for devsw_cur recoverysw_cur (and
maybe wpsw_cur, although that's a separate bug), then it works.

Change-Id: Id8d4fb389bfd78f40da9ef08aa372071d77cbec1
Reviewed-on: http://gerrit.chromium.org/gerrit/7014
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-08-31 12:51:05 -07:00
Bill Richardson
d8560737d5 Allow CougarPoint as a valid GPIO controller.
BUG=chrome-os-partner:4879
TEST=manual (just try it)

NOTE: You must use a BIOS that exports the correct ACPI tables.

Change-Id: I027680a203f3a566edf9ed82fb1fe1a9fa4c4f0f
Reviewed-on: http://gerrit.chromium.org/gerrit/4957
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2011-07-28 14:46:57 -07:00
Nick Sanders
36dccdbad1 Add check to validate VbSharedData magic
TEST=run crossystem
BUG=chrome-os-partner:4691

Change-Id: If590d185446dfa7cb628b5014f3a9a9c7b7a901d
Reviewed-on: http://gerrit.chromium.org/gerrit/3355
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
2011-07-20 23:37:59 -07:00
Che-Liang Chiou
04b7978c46 CHROMIUM: fix incorrect crossystem recovery_reason
U-Boot should not parse the raw contents of VbNvStorage, and so cannot
read the recovery reason from the VbNvStorage. On the other hand, it is
easy for crossystem to read the recovery reason from the VbNvStorage
itself.

After this change is merged, U-Boot will stop providing the (incorrect)
recovery reason in the device tree.

BUG=chromium-os:17876,chromium-os:17852
TEST=press recovery button and see crossystem reports recovery_reason=2

Change-Id: I236667f0b4f2e25da193cf6b6f7db3871d1e093f
Reviewed-on: http://gerrit.chromium.org/gerrit/4396
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-07-20 16:58:49 -07:00
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
Randall Spangler
32a6526d25 Verified boot wrapper - add stub implementations for host
This is part 2 of the wrapper API refactor.  It adds stub
implementations for the host, and changes the host-side utilities to
use them.  Firmware implementation is unchanged in this CL (other than
a few updates to macros).

BUG=chromium_os:16997
TEST=make && make runtests

Change-Id: I63989bd11de1f2239ddae256beaccd31bfb5acef
Reviewed-on: http://gerrit.chromium.org/gerrit/3256
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-06-27 13:30:41 -07:00
Randall Spangler
7adcc60e6f Vboot wrapper API - crossystem and header files
Header file changes for wrapper API implementation

Crossystem support for reading recovery reason from VbSharedData, and
explicit support for version 1 VbSharedData structs.

BUG=chromium-os:16970
TEST=make && make runtests; run crossystem on Alex and make sure it still reports recovery_reason in recovery mode.

Change-Id: I15195b899583e425d3c9e8df09842d764528e2cb
Reviewed-on: http://gerrit.chromium.org/gerrit/3203
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-06-27 09:24:28 -07:00