This patch uses the VENDOR_CC_RMA_CHALLENGE_RESPONSE vendor command to
request the Cr50 generate the RMA authentication challenge and to have
the Cr50 verify the authentication code received from the server.
The new command line option is -r/--rma_auth. Presently it works only
when Cr50 is accessed over the TPM interface (as opposed to USB), i.e.
command line options -s or -t are also present, and the utility is
running on the Chrome OS device.
CQ-DEPEND=CL:690992
BRANCH=none
BUG=b:37952913
TEST=on a Bob device ran the command with correct and incorrect
authentication codes, observed expected behavior (reported
success or error):
localhost ~ # /var/tmp/usb_updater -t -r
Challenge:
B9FPX D93GM JTJE7 ZNR74 E2GZF 94E8B TXBFX UJ4WZ
3ZQ98 XZ42D D4MVT RA2WG UDMKP A8FMH GXJQG BAKAS
Now enter response: 7996N3NW
RMA unlock succeeded.
localhost ~ # /var/tmp/usb_updater -t -r
error 4 <<=== this is the time throttle error
localhost ~ # /var/tmp/usb_updater -t -r
Challenge:
B9BLC F7B3D 7WY8V DKGQF 6CFP8 UCZRU UCZRW YKUG7
ZGNVC F4ZEH X75LE BANWE UDMKP A8FMH GXJQG BAKAS
Now enter response: 7996N3NW <<==== this is an incorrect code
rma unlock failed, code 6
localhost ~ #
Change-Id: Ifbf1a349e3d2655cea6c33f928d9cf58a6408531
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/690443
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Enable necessary flags for the Cr50 to start supporting RMA
authentication. This also requires that the RMA server public key
definition is split between the actual and test. Even though they are
the same at this time, the actual public key would be defined in the
new future and it would be different from the test key.
BRANCH=cr50
BUG=b:65253310
TEST=make buildall -j passes. More tests were conducted on the full
patchset.
Change-Id: I5a3f9d8c71374d78192e3f0a2752391b842da962
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/691554
Reviewed-by: Randall Spangler <rspangler@chromium.org>
With upcoming RMA authentication extensions the size of the vendor
command responses is going to increase. Let's allow 500 bytes per
response (the expected maximum is 80 bytes plus TPM header).
BRANCH=cr50
BUG=b:37952913
TEST=verified that gsctool (aka usb_updater) still allows to retrieve
Cr59 information and update Cr50 image.
Change-Id: Ic61b6b89ffe20e534029bd12fea4140882a9afc8
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/690442
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
The Board ID is stored in Cr50 in reversed byte order, make sure it is
used in the challenge calculation in the same form.
BRANCH=none
BUG=b:37952913
TEST=verified that the proper byte order is used when challenge source
is created.
Change-Id: I6c6b46431005ce9438a4be9aa43aafed30a645aa
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/693615
Reviewed-by: Michael Tang <ntang@chromium.org>
Adding a flag to print power numbers in milliwatts instead of
microwatts, to be the same as servo ina board. This will make it
easier for power team to keep track of power numbers in the
future.
BRANCH=None
BUG=b:35578707
TEST=./powerlog.py -b xxx.board -c xxx.scenario --mW
python -m unittest -v stats_manager_unittest
Change-Id: I397da26561324227682404e62ee025384e7624eb
Signed-off-by: Mengqi Guo <mqg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/688743
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org>
This CL provides the tool to calculate statistics for sweetberry
readings and present them in a clear & easy to read format. It
also provides the flag to store raw data and statistics
summary, should the need arise.
There are also some code cleanup for powerlog.py.
BRANCH=None
BUG=b:35578707
TEST=./powerlog.py -b xxx.board -c xxx.scenario --print_stats \
--save_stats --save_raw_data
python -m unittest -v stats_manager_unittest
Change-Id: I4aa732756fe6512f37acfcb59b11d950101887d7
Signed-off-by: Mengqi Guo <mqg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/667241
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Usage: rma_reset --key_id <arg> --board_id <arg> --device_id <arg>
--hw_id <arg> | --auth_code <arg>
These value are used for generating the challenge response and all are
mandatory.
-k,--key_id Index of the server private key
-b,--board_id BoardID type field
-d,--device_id Device-unique identifier
-w,--hw_id Hardware id
The -t parameter, not listed, will use the default values to generate
the challenge response
This value is the authorization code and any other parameters are ignored
-a,--auth_code Reset authorization code
BUG=b:37952913
BRANCH=none
TEST=make buildall
Signed-off-by: Sam Hurst <shurst@chromium.org>
Change-Id: Idc916b123928328a3425fa4eee22afc2ec179fc1
Reviewed-on: https://chromium-review.googlesource.com/665388
Commit-Ready: Sam Hurst <shurst@google.com>
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Michael Tang <ntang@chromium.org>
This prevents the files from showing in 'git status' output.
BRANCH=none
BUG=none
TEST=verify that the running the following does not show any generated
files:
make -C extra/rma_reset; git status
Change-Id: Ib3ff7772cf4a66e4a0d23ed859c30ac05c2e507d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/691016
Reviewed-by: Michael Tang <ntang@chromium.org>
It is necessary to be able to access Cr50 using usb_updater without
stopping trunksd services. This patch adds another option for
usb_updater to communicate with Cr50, using the trunks_send command.
A new command line option '-t' is added to allow to choose the new
interface.
When communicating over trunks_send the same processing is used as
when communicating over /dev/tpm0, just instead of talking to the
hardware device, popen() function is used to run trunks_send --raw
command and to gain access to its console output.
BRANCH=none
BUG=none
TEST=ran various commands using the new '-t' option:
# ./usb_updater -t /opt/google/cr50/firmware/cr50.bin.prod
read 524288(0x80000) bytes from /opt/google/cr50/firmware/cr50.bin.prod
start
target running protocol version 6
keyids: RO 0xaa66150f, RW 0xb93d6539
offsets: backup RO at 0x40000, backup RW at 0x4000
sending 0x32288 bytes to 0x4000
-------
update complete
reboot requested
image updated
[reboot...]
# ./usb_updater -t -f
start
target running protocol version 6
keyids: RO 0xaa66150f, RW 0xb93d6539
offsets: backup RO at 0x40000, backup RW at 0x4000
Current versions:
RO 0.0.10
RW 0.0.23
Change-Id: I9c7481c30c2f6908e0d1ac4f204654d2fd1b3b2e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/634629
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Make the size of extra stack needed by exceptions configurable.
It can be set in the annotation file.
BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
make BOARD=elm SECTION=RW \
ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \
analyzestack
Change-Id: Idf2a59650dd20257a0291f89d788c0c83b91a7c9
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/649454
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
There are lots of invalid paths have common segments.
In this patch, each vertex of an invalid path can be a function set.
Examples can be found in extra/stack_analyzer/example_annotation.yaml
BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
make BOARD=elm SECTION=RW \
ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \
analyzestack
Change-Id: Ib10d68edd04725af4d803f54f7e208e55d574c7d
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/649453
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Invalid paths (with arbitrary length) can be annotated and removed.
Report set of possible function cycles.
Sort the callsite outputs by filename and line number.
BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \
--objdump=arm-none-eabi-objdump \
--addr2line=arm-none-eabi-addr2line \
--export_taskinfo=./build/elm/util/export_taskinfo.so \
--section=RW \
--annotation=./extra/stack_analyzer/example_annotation.yaml \
./build/elm/RW/ec.RW.elf
make BOARD=elm SECTION=RW \
ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \
analyzestack
Change-Id: I9d443df6439b55d5b92a7624bdd93cb6e18494e2
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/640393
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Elan has shipped other AVL IC in Chromebook recently.
And it will support hammer project "charger"
Original code use constant definition for FW page count.
Unfortunatlly new IC's page count is different.
I add a code to judge IC first,
and then get the correct page count before FW updating
Signed-off-by: KT Liao <kt.liao@emc.com.tw>
BRANCH=none
BUG=None
TEST=Execute fw updating in hammer system
Change-Id: Ibdd9f7c0b61118950d8e751b7bbaaefeaaa3fb27
Reviewed-on: https://chromium-review.googlesource.com/620451
Commit-Ready: Chun-ta Lin <itspeter@chromium.org>
Tested-by: KT Liao <kt.liao@emc.com.tw>
Reviewed-by: Chun-ta Lin <itspeter@chromium.org>
convert_servo_ina.py can convert power log config
files from hdctools/servo/data into sweetberry configs
BRANCH=None
BUG=b:35578707
TEST=compare kevin_r0_loc.py output with kevin.board
Change-Id: Iadc57fe4eb1f5b220c6bffe3a3fe8a10b0d6b5a2
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/634486
--power provides a single sample from the INA
--powerlog [n] provides n samples
--check_version returns the tigertail's firmware version
--bus selects which bus to probe power on [vbus|cc1|cc2]
BRANCH=None
BUG=b:35849284
TEST=check power readings, version.
Change-Id: I728d954b6649fe0401093bf3beb7ec89f27822a6
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/634566
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Necessary for pairing support. Cleaner implementation to be moved
to hammerd.
BRANCH=none
BUG=b:38487027
TEST=Flash hammer. On host, reboot hammer to RO:
usb_updater2 -r; sleep 0.5; usb_updater2 -s
usb_updater2 -e (adds entropy)
EC console: check that rollbackinfo shows secret is updated
Change-Id: I7b354c7bb1b6d4260939dc33fe6cb4ab4ecd50e0
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/513809
Reviewed-by: Chun-ta Lin <itspeter@chromium.org>
powerlog.py can now take -A serialA -B serialB to collect data
from both left and right sweetberries simultaneously.
Also, the Spower class has been modified to allow API usage
rather than console only usage.
BRANCH=None
BUG=chromium:608039
TEST=log from both sweetberries on marlin
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Change-Id: Iaeaddad223f35f0e5cad1549b85fa3f7e4d5e1c7
Reviewed-on: https://chromium-review.googlesource.com/422496
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Dummy RMA reset application that's used by the RMA Server
Side implementer. Currently everything is hard coded in the app.
This application will be replaced when the actual app is ready.
BUG=b:37952913
BRANCH=none
TEST=make buildall -j
./rma_test
Board Id:
Z Z C R
Device Id:
T H X 01 01 03 08 fe
Server Key Id:
10
Server Private Key:
47 3b a5 db c4 bb d6 77
20 bd d8 bd c8 7a bb 07
03 79 ba 7b 52 8c ec b3
4d aa 69 f5 65 b4 31 ad
Server Public Key:
03 ae 2d 2c 06 23 e0 73
0d d3 b7 92 ac 54 c5 fd
7e 9c f0 a8 eb 7e 2a b5
db f4 79 5f 8a 0f 28 3f
Challenge:
CC5QQ LALUS BUPJC TWSYN PAPPN AUEVZ HEMUD GD5DK
DSM5C VH4SZ LJAZL GDUYM U4JPK FJUCA 2AEAS GCH8W
Authorization Code:
P5PSCTS6
Challenge String:
https://www.google.com/chromeos/partner/console/cr50reset/request?challenge=CC5QQLALUSBUPJCTWSYNPAPPNAUEVZHEMUDGD5DKDSM5CVH4SZLJAZLGDUYMU4JPKFJUCA2AEASGCH8W&hwid=HWIDTEST2082
Enter Authorization Code: abcd
Code is invalid
Enter Authorization Code: P5PSCTS6
Code Accepted
Change-Id: Id4141861b53745cf7bb67a885fa01dd6f4b4cd04
Signed-off-by: Sam Hurst <shurst@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/622283
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Michael Tang <ntang@chromium.org>
Get stack analyzer supported to read annotation file and do basic
annotation on the callgraph.
The basic annotation includes:
1. Add missing calls to the callgraph
2. Ignore functions on the callgraph
BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \
--objdump=arm-none-eabi-objdump \
--addr2line=arm-none-eabi-addr2line \
--export_taskinfo=./build/elm/util/export_taskinfo.so \
--section=RW \
--annotation=./extra/stack_analyzer/example_annotation.yaml \
./build/elm/RW/ec.RW.elf
make BOARD=elm SECTION=RW \
ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \
analyzestack
Change-Id: I4cc7c34f422655708a7312db3f6b4416e1af917f
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/614825
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Handle the case of comparing with different kinds of objects.
BUG=none
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
Change-Id: I01056cd39e14d75442d4029b6c64d9843c49cf2a
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/616367
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Add a shared library to export task information.
Modified the stack analyzer to get information from the shared library.
Show allocated stack sizes of tasks in the stack analyzer.
To get the all task information (including the allocated stack size),
A shared library is added and compiled with the board to export all
configurations of the tasklist.
BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \
--objdump=arm-none-eabi-objdump \
--addr2line=arm-none-eabi-addr2line \
--export_taskinfo=./build/elm/util/export_taskinfo.so \
--section=RW \
./build/elm/RW/ec.RW.elf
make BOARD=${BOARD} SECTION=${SECTION} analyzestack
Change-Id: I72f01424142bb0a99c6776a55735557308e2cab6
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/611693
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Add a static analysis tool for firmware stack usage.
Add an new Makefile rule to analyze the stack usages of firmwares.
Details about the tool can be found in extra/stack_analyzer/README.md.
BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
make BOARD=elm && make BOARD=elm build/elm/RW/ec.RW.taskinfo && \
extra/stack_analyzer/stack_analyzer.py \
--objdump=arm-none-eabi-objdump \
--addr2line=arm-none-eabi-addr2line \
./build/elm/RW/ec.RW.elf ./build/elm/RW/ec.RW.taskinfo
make BOARD=${BOARD} SECTION=${SECTION} analyzestack
Change-Id: Ifb1b5f5ad6be8f8b125b14d6ee03e25cb385895b
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/576411
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
board.h and config-chip.h should only be called from config.h, otherwise
some #define may not be set properly.
BUG=chromium:746471
BRANCH=none
TEST=Found a bug while compiling OTP changes (c/580289/)
(https://luci-milo.appspot.com/buildbot/chromiumos.tryserver/
no_vmtest_pre_cq/81548)
The size of the serial number string is set in config.h when
CONFIG_USB_SERIALNO is needed.
Compile with ec-utils with cr50_onboard USE flag set.
Change-Id: I5a2306bd0dc1dea29265226f2986829b768cfb61
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/581887
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
When usb_udpater reads board ID information from a binary blob, in
case the ID field can be represented as a 4 character ASCII string the
updater transposes the characters, resulting in a reversed string
printed.
Fix the transposition to verify that the result is printed properly.
BRANCH=none
BUG=b:63597142
TEST=ran the following commands:
$ make BOARD=cr50
$ CR50_BOARD_ID='TEST:ff00:ff00' H1_DEVIDS='0x0169c181 0x04656742' \
./util/signer/bs
$ ./extra/usb_updater/usb_updater -b build/cr50/ec.bin
read 524288(0x80000) bytes from build/cr50/ec.bin
RO_A:4919.0.0 RW_A:0.0.21[TEST:0000ff00:0000ff00] RO_B:-1.-1.-1 ...
Change-Id: I852cf9505d6b8b9e7133ca1008be1b22081a9d88
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/567681
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
This patch adds code to interpret the contents of the Cr50 image's RW
headers board ID fields.
Board ID fields are added to the RW and RW_B version strings, as a
three field colon separated value.
The actual board ID is likely to be a 4 symbol ASCII string, if it
is, the 4 ASCII characters are displayed. If it is not - the 8
character hex value is printed. The rest of the fields are displayed
as 8 characters hex values.
BRANCH=none
BUG=b:62294740
TEST=tried the new option on various Cr50 images:
$ ./extra/usb_updater/usb_updater -b build/cr50/ec.bin
read 524288(0x80000) bytes from build/cr50/ec.bin
RO_A:4919.0.0 RW_A:0.0.21[00000000:00000000:00000000] ...
$ ./extra/usb_updater/usb_updater -b cr50.bin.dev
read 524288(0x80000) bytes from cr50.bin.dev
RO_A:0.0.10 RW_A:0.0.21[XXXR:00000004:00000001]...
Change-Id: I5a92a600d24e4a7d6d615f256b5979414e883d77
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/562919
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Implement the necessary bits for updating the trackpad firmware over
I2C, primarily following the protocol from open source driver.
BRANCH=none
BUG=b:35587174
TEST=Manually update firmware and confirmed reported FW version changed.
Change-Id: Ice5098269803f524de0b6a853f5a98f28382a7fb
Reviewed-on: https://chromium-review.googlesource.com/532765
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Chun-ta Lin <itspeter@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
When specifying board ID to program, it is convenient to be able to
specify the ID as a string, as reported by the RLZ stored in the VPD.
With this patch the first component of the board_id command line
option is considered a string if it is no longer than 4 bytes.
BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=ran the following commands (interleaved with erasing INFO1 on the
target):
localhost ~ # usb_updater -s -i
Board ID space: ffffffff:ffffffff:ffffffff
localhost ~ # usb_updater -s -i ABCD
localhost ~ # usb_updater -s -i
Board ID space: 41424344:bebdbcbb:0000ff00
localhost ~ # usb_updater -s -i
Board ID space: ffffffff:ffffffff:ffffffff
localhost ~ # usb_updater -s -i 0x41424344:0x1234
localhost ~ # usb_updater -s -i
Board ID space: 41424344:bebdbcbb:00001234
localhost ~ # usb_updater -s -i
Board ID space: ffffffff:ffffffff:ffffffff
localhost ~ # usb_updater -s -i ABCD:0x1234
localhost ~ # usb_updater -s -i
Board ID space: 41424344:bebdbcbb:00001234
Change-Id: Ied8b240d60ea50f6fc8633f919ce4bc81ac17727
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/528440
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This patch enhances the Cr50 usb_updater to allow to get and set Board
ID value saved in the Cr50's INFO1 space using the earlier introduced
dedicated vendor commands.
Getting or Setting the board ID does not require establishing a
connection with the Cr50, the new option is --board_id/-i. When
specified without a parameter, the new option will cause the Board ID
to be read. When specified with a parameter, the board ID value will
be set. The parameter includes one or two values in a single string,
the values separated by a colon.
The first value is a 4 byte board ID, and the second value is the
flags field. The default flags field is set to 0xff00.
BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=verified that it is possible to get and set the board ID value
using usb_updater, both over USB and TPM.
verified that it is not possible to set a new board ID value is
the INFO1 space has been already programmed.
verified that it is not possible to set a board ID value which
would not allow the currently running image to start (even
though there is no run time check yet).
Change-Id: Ief175d8b2ef3177db13fa86f831914088d9447b0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/525096
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
There are only two usb_updater actions which require establishing a
connection with the Cr50: transferring the firmware image during
update and reporting the version of the running image (because the
version is reported when the connection is established).
This patch refactors usb_updater code to establish the connection only
when necessary.
BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=verified that 'usb_updater -c' succeeds both issued over USB and
TPM
Change-Id: I6a0c82eb440c092263d4802f124f458f148a8ab5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/525095
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
So far vendor command processing has been a second class citizen in
the Cr50 usb_updater: return codes were mostly ignored even when using
TPM, when using USB there was no way to communicate return codes at
all.
This patch refactors the source code to use a single function to
process vendor commands over both USB and TPM, adding proper passing
of the result codes back to the caller in both cases, retrieving the
return code from the response header when using TPM and from the first
byte of the response payload when using USB.
BRANCH=cr50
BUG=b:35587387,b:35587053
TEST=verified that it is possible to update rw13, rw18 and rw20 both
over TPM and USB, which indicates that vendor commands are
properly handled.
Change-Id: I837e17b29d3b025fbca5b1ef49463cfb1729fe6c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/525094
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
The newly generated file is now showing up in 'git status' output,
let's hide it.
BRANCH=none
BUG=none
TEST='git status' output is now clean even after running 'make -C
extra/usb_updater'.
Change-Id: I6f7e93b303cfff89ec8ae7b3a74286a743e9c27e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/517677
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
All extension and vendor commands' payloads need to be passed to the
processing functions the same way, whether they arrive over /dev/tpm0
or over USB. The upgrade PDUs sent over USB need to include two
additional fields which are stripped off by the reassembly layer on
the Cr50.
This patch makes sure that none of other than EXTENSION_FW_UPGRADE
commands sent over /dev/tpm0 by usb_updater have the extra
encapsulation.
BRANCH=cr50
BUG=b:62106898
TEST=verified that updates work the same way over TPM and USB (which
includes sending the 'turn_update_on' commands. Before this patch
the turn_update_on command sent by usb_updater over TPM was not
processed properly (the timeout value was wrong).
Change-Id: I3f4ab7330037f6eb1ce8bac7c63faa5d7c309c94
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/517416
Reviewed-by: Andrey Pronin <apronin@chromium.org>
This is copied chip/g version as of commit 0e5497db6, plus the following
uncommited usb_update patch (CL:458469):
a0176a1cc usb_updater: Flush all data from endpoint before trying to update
On top of that, a good number of common-code specific modifications are
added: new extra commands, new first_response_pdu format, use of FMAP.
BRANCH=none
BUG=b:35587170
TEST=usb_updater binary identical before and after this change.
TEST=make BOARD=hammer -j && \
( cd extra/usb_updater && make && \
time sudo ./usb_updater2 ../../build/hammer/ec.bin )
TEST=cd extra/usb_updater; make
# Jump to RW
sudo ./usb_updater2 -j
sleep 0.5
# Update RO, then reboot
sudo ./usb_updater2 ../../build/hammer/ec.bin
sleep 0.5
# Update RW (first tell RO to not jump to RW)
sudo ./usb_updater2 -s
sudo ./usb_updater2 ../../build/hammer/ec.bin
TEST=cd extra/usb_updater; make
# Tell RW to jump back to RO
sudo ./usb_updater2 -w
sleep 0.5
# Update RW, then reboot
sudo ./usb_updater2 -s
sudo ./usb_updater2 ../../build/hammer/ec.bin
TEST=usb_updater2 can update hammer, and read its version, rollback
version and key version.
Change-Id: I09da894d83e2b4d6c2e46cab301522c27fa0160c
Reviewed-on: https://chromium-review.googlesource.com/458468
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
The usb_updater code comparing versions to decide which one is newer
filters out values in excess of 1000 to not consider dev build
versions to be newer than the released versions.
In fact this logic is flawed: with node locked RO it is possible to
build dev (self signed) version, which can run on the device, and this
version should take over the released version, if it is currently
present on the device.
If the RO is not node locked, the dev RW version will not verify, so
it is safe to download it to the chip, it would be ignored.
BRANCH=cr50
BUG=none
TEST=with this patch applied it is possible to update self signed
versions running on H1 (the updater considers them newer than
0.0.18 and sends the chip the vendor command to enable the
downloaded image after download completes).
Change-Id: Ibb5761e4bb24fcc7dee5cc10b2f26af7a8e9aa2e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/492087
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
If Cr50 does not have support for invalidating the RW header and
restoring it, then upstart should still post a reset. This changes
usb_updater to post a restart during upstart if the RW minor version is
less than 19.
BUG=none
BRANCH=cr50
TEST=manual
Copy new usb_updater onto the DUT. run 'sync'
Build two cr50 debug images one with 0.0.19 and one with 0.1.12
verify update process works
test_that $DUT_IP -b $BOARD firmware_Cr50Update
--args="old_release_image=$PATH_TO_PROD_13
release_image=$PATH_TO_PROD_18 dev_image=$DBG_IMAGE_19"
Build a firmware image with
https://review.coreboot.org/#/c/18946/3
test_that $DUT_IP -b $BOARD firmware_Cr50Update
--args="old_release_image=$PATH_TO_PROD_18
release_image=$DBG_IMAGE_19 dev_image=$DBG_IMAGE_1_12"
Change-Id: I811977de26999b1d26bd2d4126b88b1c55a93931
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/470326
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
show_fw_ver runs send_done on both usb and tpm transfers. This changes
usb_update, so it will only run send_done on usb transfers
BUG=none
BRANCH=cr50
TEST=copy to dut. stop trunksd. Run 'usb_updater -f -s && usb_updater -f
&& usb_updater -f'
Change-Id: I3a09c003ae41a4651c9961092552d7807656a68a
Reviewed-on: https://chromium-review.googlesource.com/470169
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This change adds a send_done call at the end of show_fw_ver. With this
change Cr50 will set the state to rx_idle after every usb_update -f
call.
Cr50 cannot process any vendor commands unless the updater state is
idle. After a vendor command is sent cr50 wont set the state to idle
unless it receives a send_done call. It will also reset the state if it
sees that it has been more than 5 seconds since the last transfer.
In the current state you cannot use usb_updater -f back to back because
usb_updater doesn't call send_done through the -f path. If you wait 5
seconds between calls, then it will work. If the call fails and you keep
retrying waiting less than 5 seconds between calls, then it will fail
forever. The last transfer time will get reset with each call and Cr50
will never reach the timeout to reset the usb_update state to idle.
BUG=none
BRANCH=cr50
TEST=run 'sudo ./usb_updater -f && sudo ./usb_updater -f'. Verify both
calls succeed.
Change-Id: I5daca8e03ece840288abb61e02a528a9af0ada30
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/465491
Reviewed-by: Aaron Durbin <adurbin@chromium.org>