| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch optimizes read_tpm_nvmem() by replacing NvGetIndexData()
and NvGetIndexInfo() with NvReadIndexDta() and NvReadIndexInfo()
respectively.
This will reduce NvFindHandle() calls from three to one.
BUG=b:148489182
BRANCH=cr50, cr50-mp
TEST=The function execution time reduces from 1.2 msec to 550 usec.
Cq-Depend:chromium:2038108
Change-Id: I6659480d8b60578f3d0b9dc3f62a677ae8489a57
Signed-off-by: Namyoon Woo <namyoon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2037920
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There seems to be some odd interaction between ccache version 3.7.6
and the set of command line options passed to gcc by the EC makefile,
as a result the generated dependency files are wrong, the target file
name is missing the path.
The -MT command line option makes sure that the correct target file
name is generated. Had to make similar changes in
../../third_party/{cryptoc,tpm2} Makefiles.
No need to change extra/usb_updater/Makefile as it puts .o files in
the same directory where .c files are.
BRANCH=all
BUG=b:148943341
TEST=verified that relevant object files are rebuilt when an .h file
is touched.
Also, with companion changes in cryptoc and tpm2 trees verified
that all generated my 'make buildall' .d files have proper target
values (including path), apart froom files in extra/usb_udater,
which place .o files in the same directory with .c files.
Change-Id: I22dfad94c112582230a2b6b60289e029a382d822
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2039988
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
(cherry picked from commit f42be6e2a1eefaee06ed7593373fbe6dedb3dd6c)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2044511
Reviewed-by: Andrey Pronin <apronin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We want to ensure that the entire buffer we may be sending back to the
host from the EC does not contain any data from previous host command
responses. Clear the data in common code so all chips do not have to
implement this functionality.
BRANCH=none
BUG=b:144878983,chromium:1026994
TEST=new unit test shows cleared data
Change-Id: I93ad4d36923ba1bf171f740e94830640d3fde3b0
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1930931
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tracked PD header spec. version for each port partner type.
BUG=chromium:1023025
BRANCH=none
TEST=make -j buildall
Manual Testing:
Connected PD2.0 source charger and made sure we talked PD2.0
Connected PD3.0 source charger and made sure we talked PD3.0
Connected apple 2019 PD2.0 dock with charger and made sure we
downgraded from PD3.0 to PD2.0
Change-Id: I3b49d9630acf6c19101ac71334445890c78c4077
Signed-off-by: Sam Hurst <shurst@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1907430
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If there is no USB-C interrupt activity for 2^31 microseconds, then
there are more than ALERT_STORM_MAX_COUNT events within 2^31
microsecond (instead of ALERT_STORM_INTERVAL), then the interrupt
storm would incorrectly detect a storm and disable the port due
to incorrect math regarding 32-bit overflow.
BRANCH=octopus and all branches with original storm detection
(CL:1650484)
BUG=b:144369187
TEST=unit test in CL
Change-Id: I90b888ac092f81d151538d6018771fb32f8e9c39
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1925668
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the port is in a state where it is looking for a connection,
to save power, we should put the TCPC in its low power mode and
enable auto toggling. Low power mode can happen when DRP auto
toggling, acting as a SNK only, or acting as a SRC only.
BUG=chromium:1022217
BRANCH=none
TEST=make -j buildall
manual tests:
1: (S0) Nothing plugged in, port is drp and low power mode
2: (S5/S3/S0ix) Port is SNK only, and low power with nothing plugged in
3: (S3/S0ix) If TypeC sink was previously plugged in, port remains powered
4: (S5/S3/S0ix) TypeC source is recognized
5: (S3->S0) TypeC sink plugged in, port is powered when S0 is reached
Low power exit test:
Using this command from the AP console:
ectool i2cread 8 2 0x16 0x0d
Transfer failed with status=0x1 # This means the TCPC was asleep.
On the EC console:
2019-11-21 09:50:24 [315.235538 TCPC p1 init ready]
2019-11-21 09:50:24 [315.236048 TCPC p1 Exit Low Power Mode]
2019-11-21 09:50:24 [315.242837 TCPC p1 init ready]
2019-11-21 09:50:24 [315.243229 C1: DRPAutoToggle]
2019-11-21 09:50:24 [315.246471 C1: Unattached.SNK]
2019-11-21 09:50:24 [315.252504 C1: DRPAutoToggle]
2019-11-21 09:50:24 [315.362878 C1: LowPowerMode]
2019-11-21 09:50:24 [315.363314 TCPC p1 Enter Low Power Mode]
Change-Id: I7e853d05e0ece1f6b3031f17a18fcbf0d9a15a51
Signed-off-by: Sam Hurst <shurst@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904974
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
HMAC DRBG is used for U2F key generation, and as such is subject
for ACVP tests. Expose DRBG Init, Generate and Seed commands for
automated testing with externally provided test vectors.
BUG=b:138578319
BRANCH=cr50
TEST=make CRYPTO_TEST=1 BOARD=cr50 -j && test/tpm_test/tpmtest.py
Change-Id: I50a6750864d3cd9a304a9b8a8524ef29cec04410
Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1912662
Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
NIST 800-90B Entropy assesment tests requires 1M of 8-bit samples for
statistical tests. While it's possible to use TPM2_GetRandom command
to get entropy on cr50 (there is no software postprocessing), this
command is not available when compiled with CRYPTO_TEST=1 due to lack
of space in firmware. Adding vendor command which is available with
CRYPTO_TEST=1 to get raw entropy from TRNG. Added support script
to save entropy in file for further analysis. Since downloading
entropy takes a long time, new option'-t' added to tpmtest.py
which only invokes download of TRNG samples
BUG=b:138577834
BRANCH=cr50
TEST=make BOARD=cr50 CRYPTO_TEST=1 && test/tpm_test/tpmtest.py -t
To run NIST tests: nist_entropy.sh
Change-Id: I237a4581332a6e2c0332fe6ecf40731ab0be3355
Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1919640
Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
make of ftdi_spi_tpm fails:
../../include/config.h:4878:25: fatal error: fuzz_config.h:
No such file or directory
#include "fuzz_config.h"
It seems issue happened after moving fuzzing tests into a fuzz subfolder
in https://chromium-review.googlesource.com/1180179
Added include search path to correct issue.
BRANCH=none
BUG=none
TEST=in test/tpm_test/ make successfully builds ftdi_spi_tpm
Change-Id: I0c212ba7f84babd5db0c02d553345769de301d00
Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1913325
Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change refactors the motion_sense_fifo to uniformly prefix
all the functions to avoid collisions. It also adds several unit
tests and fixes a few bugs with the fifo logic.
BUG=b:137758297
BRANCH=kukui
TEST=buildall
TEST=run CTS on arcada, kohaku, and kukui
TEST=boot kohaku (verify tablet mode works as expected)
Change-Id: I6e8492ae5fa474d0aa870088ab56f76b220a73e3
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1835221
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Certain SKUs of certain boards have less number of USB PD ports than
configured in CONFIG_USB_PD_PORT_MAX_COUNT. Hence define an overrideable
board specific helper to return the number of USB PD ports. This helps
to avoid initiating a PD firmware update in SKUs where there are less
number of USB PD ports. Also update charge manager to ensure that absent/
invalid PD ports are skipped during port initialization and management.
BUG=b:140816510, b:143196487
BRANCH=octopus
TEST=make -j buildall; Boot to ChromeOS in bobba(2A + 2C config) and
garg(2A + 1C + 1HDMI config).
Change-Id: Ie345cef470ad878ec443ddf4797e5d17cfe1f61e
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879338
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
| |
BRANCH=none
BUG=b:141563840
TEST=make -j buildall
Change-Id: Iaff605f5d93ccce26aec4d9e33be78017c7b9231
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1906194
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current PD3.0 EMarker cable probe functionality is unstable.
Remove and add back as a feature after the PD3.0 code base is stable.
BRANCH=none
BUG=b:144093713
TEST=make -j buildall
Used total phase to verify that the cable was not probed.
Change-Id: I2906a16c96faff9d8107ef19286acdbe60869180
Signed-off-by: Sam Hurst <shurst@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904157
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Code on Tot assumes that port count was the port to
discharge instead of port parameter
BRANCH=none
BUG=none
TEST=verified with unit test (in this CL)
Change-Id: I17658a0c555f9cea56fa4ec1652e0faf62e3d6cc
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1896125
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All of the flags in all layer needs comments of what the flags means
and a potential usage. all TC_FLAGS_*, PR_FLAGS_* and PRL_FLAGS_*
BRANCH=none
BUG=b:141563840
TEST=make -j buildall
Signed-off-by: Sam Hurst <shurst@google.com>
Change-Id: I520daa841a61e36a8a6b394e0f96b198b16ad561
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904148
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Tested-by: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Certain SKUs of certain boards have lesser number of USB PD ports than
defined by CONFIG_USB_PD_PORT_COUNT. Hence rename
CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNT.
BUG=b:140816510, b:143196487
BRANCH=octopus
TEST=make -j buildall; Boot to ChromeOS
Change-Id: I7c33b27150730a1a3b5813b7b4a72fd24ab73c6a
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879337
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that the test time is deterministic (CL:1860474), we do
not need to ensure that a task is woken up because it always
will be now.
BRANCH=none
BUG=none
TEST=ran usb_prl 100 times without issue.
Change-Id: I88d0f705a05f192934b87704483ee2a83eb052ad
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879514
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This CL enables the fpsensor task and adds the following
remaining fingerprint host commands to the fuzzer:
* EC_CMD_FP_PASSTHRU
* EC_CMD_FP_INFO
* EC_CMD_FP_FRAME
* EC_CMD_FP_STATS
* EC_CMD_FP_TEMPLATE
BRANCH=none
BUG=b:116065496
TEST=make buildall -j
TEST=make run-host_command_fuzz
TEST=# Pull in TEST_COVERAGE fix
git fetch "https://chromium.googlesource.com/chromiumos/platform/ec" \
refs/changes/86/1725186/1 && git cherry-pick FETCH_HEAD
make host-host_command_fuzz TEST_COVERAGE=1
timeout 5m ./build/host/host_command_fuzz/host_command_fuzz.exe
llvm-profdata merge -sparse default.profraw -o default.profdata
llvm-cov show build/host/host_command_fuzz/host_command_fuzz.exe \
--instr-profile=default.profdata --format=html --output-dir=cov
# Inspect cov/.../common/fpsensor/fpsensor_state.c.html to verify
Change-Id: Icad9493ba41cd4daa61a30246d01afd1dbe16c56
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1682945
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Sean Abraham <seanabraham@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
BRANCH=none
BUG=b:116065496
TEST=make buildall -j
Change-Id: Ia723d98354ca027f41f1b3c00d6a2dac500edbf8
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715633
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Sean Abraham <seanabraham@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was some leftover constants and a #include we are no longer
using due to using a monotonic counter, clean it up.
BUG=chromium:1013701
BRANCH=none
TEST=buildall
Change-Id: Ieeb130aef9ee89d65459f52c8f34753c30c3c388
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879335
Reviewed-by: Edward Hill <ecgh@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The PD header specifies the power role for SOP packets and cable plug for
SOP' and SOP" packets. Refactor code to make this more obvious.
BRANCH=none
BUG=none
TEST=builds and new stack runs on hatch
Change-Id: I6cdb1561082d2142214ac65703ff42586b16d70b
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865986
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use first class enums types instead of int for power and data
role.
BRANCH=none
BUG=none
TEST=builds and new stack works with single charger on C1 hatch
Change-Id: Ied4562e6a148803140cf277bd229b6c3ed801470
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865985
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need to let board specific code run any time we change the data role
on our USB-C connection.
When looking at all of the calls to tc_set_data_role, I realized that we
don't really reset any data role until we start a new contract with
SNK/SRC ready. We will do need to call into the code that disables the
MUX lines when we detach.
To do this, I created a super state for SNK/SRC unattached.
BRANCH=none
BUG=none
TEST=builds. No board has an OTG signal using the new stack yet
Change-Id: I017d20b2e1973b31ebf2b8925a7f8c5488a8ee24
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1864427
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the need for stubs of charge_manager_set_ceil() by adding a few
missing IS_ENABLED(CONFIG_CHARGE_MANAGER) checks.
BUG=none
BRANCH=none
TEST=buildall
Change-Id: Ia70434b05107747eb773ae30ee1de5b4bd8cbcea
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869401
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
FIPS ACVP tests require that on an empty input, the result is the
hash of the empty string. In the current implementation, an empty
result is returned. Change the implementation so it matches FIPS
expectations.
Also added two test cases in hash crypto test to check the corner
case of the empty input.
BUG=None
BRANCH=cr50
TEST=test/tpm_test/tpmtest.py
Change-Id: I9f5c3f71e4b10cbce2ea204eeb52e57ef26ad0e7
Signed-off-by: Gurleen Grewal <gurleengrewal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866444
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Tested-by: Gurleen Grewal <gurleengrewal@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Initialize the local struct so that the test is not flaky. Also
extract helper function and add more asserts to make the logic more
explicit to readers.
BUG=none
BRANCH=nocturne
TEST=make -j buildall
Change-Id: I84ccd097b64c3ff304f4af228121b2cb989e6ab7
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865956
Reviewed-by: Craig Hesling <hesling@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=none
BRANCH=none
TEST=make buildall -j
Change-Id: I55453ddf1d1da0fdee902a33e14357716fb12c4a
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1859826
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just a simple rename. run_state() seems more readable to me,
and "run" is used in many of the related functions and comments.
exe_state used to be called sm_run_state_machine before the great
refactoring of CL:1733744.
BRANCH=none
BUG=none
TEST=build
Change-Id: I5fe9e5b98042d7a5b9b9e9bde48ebecbda420458
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1848970
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When testing "Host Port VBUS Removed" at the end of
test_vpd_host_src_detection_vbus(), we go to TC_UNATTACHED_SNK but
then quickly move to TC_ATTACH_WAIT_SNK.
Reduce the task_wait_event() timeout in wait_for_state_change() to
make checking this transition more reliable.
BRANCH=none
BUG=none
TEST=usb_typec_ctvpd test still passes
Change-Id: I11a927fabbcff4a7adc50f5495fab796129b04ab
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1857215
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of relying on the host's clock, we need to monotonically
increase a timestamp. This gives tests predictability.
BRANCH=none
BUG=chromium:1013701
TEST=ran usb_prl over 100 times without failure
Change-Id: Id4a1e9a8cbd9dd44509747916c9073444d71af5c
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1860474
Tested-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The usb_prl test continues to be flaky.
Disable it until it can be fixed.
BUG=chromium:1013701
BRANCH=none
TEST=make -j runhosttests
Change-Id: Iebdc3a1c812a8864951522d7134fe8098271c86f
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1856826
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change waits in USBC tests to 1 MSEC. When we wait and don't care, wait
for much longer.
We also need to ensure that the lower priority task actually ran when we
are trying to cycle the state machine. If the entire process is starved
then we have to do some manual checking.
Added more prints statements to help debug failing tests.
BRANCH=none
BUG=none
TEST=repeat all tests 100 times without failure
Change-Id: I12e0f0fa5247a24c87a4ff457e2be684991f0cad
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1837995
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On enrollment success, generate new positive_match_salt and send it as part
of the encrypted blob. Also enable positive match secret to be read.
The positive_match_salt is used to derive positive_match_secret and
is different from the encryption salt for encrypting the templates.
The positive_match_salt needs to be sent to biod and stored with templates
because it needs to be re-uploaded to FPMCU the next time the user logs in.
The positive match secret needs to be sent to biod so that it knows what to
compare against at a match.
BRANCH=nocturne
BUG=chromium:927095
TEST=make -j buildall
TEST=tested enrollment, matching and multifinger on DUT nocturne
Change-Id: I3e44a972ee17c5a93bddd52340f8f2249836463a
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1828058
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A recently discovered bug would cause variable update failure in case
the tuple section of the NVMEM is close to capacity and the new
variable is larger in size.
The new test verifies both that tuple storage can be filled to
capacity, does not overflow, and a variable could be updated to a
larger size when tuple storage is almost full.
BRANCH=cr50, cr50-mp
BUG=b:141774726
TEST='make run-nvmem' succeeds if crrev.com/1829292 is applied, and
fails if not.
Change-Id: I2030a921a888bd185540d9d3cb7b50e737497834
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834284
Reviewed-by: Andrey Pronin <apronin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add EC command to read positive_match_secret on match success.
If the attempt to read is 5 seconds after the match, the read is not
allowed (the readable bit for positive match secret is cleared).
Test that the command can read the data correctly and can
read for each finger only once. Test that attempt to read secret
after deadline will be rejected.
BRANCH=nocturne
BUG=chromium:927095
TEST=make buildall
TEST=tested enrollment, matching and multifinger on DUT nocturne
TEST=tested that if biod requests to download template and secret
for a finger that's not currently matched, reading secret will fail.
Change-Id: Idc734c6392d271e2aaee1cddf7c2c5b81b727b4a
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1679372
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ensure that two Rp values are interpreted as a debug accessory. Added
unit test for meaningful combinations.
BRANCH=none
BUG=none
TEST=passes unit test.
Change-Id: Ia454382f20f9377edc944dc01be133e062c218b0
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1845811
Reviewed-by: Edward Hill <ecgh@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement derivation of positive match secret for a template. This
derivation will be used when biod sends a command to ask for
positive match secret and the secret readable bit is set. Also add
unit tests for this derivation.
BRANCH=nocturne
BUG=chromium:927095
TEST=make -j buildall
TEST=tested enrollment, matching and multifinger on DUT nocturne
Change-Id: Ife477a98573284f69c5fb07e814d9a3d09f92127
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1639440
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow limited PPC chips to default to EC_ERROR_UNIMPLEMENTED
for functions in the driver that are not needed.
BUG=b:138599218
BRANCH=none
TEST=make buildall -j
Change-Id: I5242ef285eb277c06d516ab09f7a74f76d7d34b2
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1829405
Reviewed-by: Edward Hill <ecgh@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The semantics of %l changed during the enabling of compile-time
printf format checking. Old firmware branches will treat something
like %lx as a 64-bit value, but new code on master will enforce at
compile-time that a long (32-bits on our ECs) is passed in as the
argument. This creates a dangerous and difficult to notice situation
if the following code is cherry-picked from master into an old
firmware branch:
printf("%lx %s", myval32, mystr);
On master, this behaves correctly. On the old firmware branch, this
would swallow myval32 and mystr for %lx, and then %s would grab a
random stack pointer and print a string from it.
Deprecating %l is our mechanism for keeping such a printf from
creeping into master in the future. Obviously we can't protect against
someone that checks in code that's never tested, but anyone who tests
a printf with %l in it will notice their printf comes out with ERROR
instead of what they want.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=None
Change-Id: I0267430363af7954c2ec5d2c45222759fe0ec2c1
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834604
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change removes uses of %l from the EC side of the EC codebase.
This is done because the semantics of %l within printf have changed,
and there are concerns that new calls to printf will be cherry-picked
into old firmware branches without the printf changes. So, in
preparation for disallowing %l in master, remove occurrences of %l.
This change was done by manually fixing up anything found under the EC
directory with the following regex: %[0-9*.-]*l[^l]
Remember that anything on the host machine is fine as-is, since the host
printf never changed.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=None
Change-Id: I2a97433ddab5bfb8a6031ca4ff1d3905289444e2
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834603
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a couple basic tests for %pT values.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=none
Change-Id: I8cb56017b883b6257e1432bd64eae3ae943edf8b
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1828067
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When printing size_t sized integers, utilize the standard %z
modifier so that the specifier format is correct. This will enable us
to turn on compile-time printf format verification.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=none
Cq-Depend:chrome-internal:1860160
Change-Id: I2c95df5c0d87677cb9fcbde33ab8846708a774a1
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819651
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to pass the right printf format specifiers for certain types
that are compiled both in 32-bit EC and 64-bit host environments,
standard macros PRIx64 and PRId64 must be introduced. These specify
the correct printf format specifier in the given compilation environment
for printing a 64-bit value.
On the host, inttypes.h already exists. Add an inttypes.h for the EC
codebase so that these macros can be used where they're needed.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=none
Change-Id: I76e3bdc88aef7da6e5234d5b86b595f7138ea9a1
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819642
Reviewed-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to turn on compile-time printf format checking,
non-standard specifiers like %b (binary) must be removed. Convert
that into %pb, which takes a pointer to a structure containing the
value to print, and how many bits to print. Use the convenience
macro BINARY_VALUE() to package these values up into a struct whose
pointer is passed to printf().
Technically this is slightly more limited functionality than we used
to support given all the possible flags, field width, and precision.
However every existing instance in our codebase was using %0NNb, where
NN is some number. If more variants are needed, the parameters structure
can be expanded in the future.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=None
Change-Id: I8ef995dcf97af688fbca98ab6ff59b84092b69e3
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733100
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to make printf more standard, use %ph. Pass a pointer to
a struct describing the buffer, including its size. Add a convenience
macro so that conversion between the old style and new style is purely
mechanical. The old style of %h cannot be converted directly to %ph as-is
because the C standard doesn't allow flags, precision, or field width on
%p.
Ultimately the goal is to enable compile-time printf format checking.
This gets us one step closer to that.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=None
Cq-Depend:chrome-internal:1559798,chrome-internal:1560598
Change-Id: I9c0ca124a048314c9b62d64bd55b36be55034e0e
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730605
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to avoid landmines later with future extensions to %p,
disallow %p by itself. The danger is that we'll have something
like: printf("%pFOO", myptr), and then later will add a %pF
extension, but miss this printf (maybe the string is split, maybe
it's just missed).
Missing a conversion during extension is worse than just seeing a
print like <ptr_val>OO, since %pF likely reaches through the
pointer and interprets its contents according to whatever F means.
Convert existing uses of %p to %pP, so they're explicitly printing
a pointer value, giving us flexibility to extend in the future.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=None
Cq-Depend:chrome-internal:1560879
Change-Id: I36a4bee8d41cb9a6139171f8de0d8f2f19468132
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730604
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function's execution time depends only on the buffer length but not on
the specific bytes in the buffer.
BRANCH=nocturne
BUG=chromium:927095
TEST=make -j buildall
TEST=timed the execution of bytes_are_trivial() on a long array with
the following contents:
Array 1: 0x01, 0x00, 0x00, 0x00, ..., 0x00, 0x00 (first byte nontrivial)
Array 2: 0x00, 0x00, 0x00, 0x00, ..., 0x00, 0x02 (last byte nontrivial)
Array 3: 0x00, 0x00, ... , 0x00, 0x03, 0x00, ..., (middle byte nontrivial)
Array 4: 0x00, 0x00 , ... (trivial)
(These 4 arrays have the same length.)
Verified that execution on these arrays take similar amount of time,
proportional to the length of the array, specifically:
For 256k bytes, takes 21~40 microseconds
For 128k bytes, takes 10~17 microseconds
For 64k bytes, takes 5~9 microseconds
For 32k bytes, takes 2~5 microseconds
Because the host timer inaccuracy and potential process scheduling
variations, the execution time for arrays 1-4 are sometimes not exactly
the same. To avoid test flakiness, this timing test is not written to
unit tests. But it should prove that bytes_are_trivial() is a constant
time algorithm.
Change-Id: I131748e1a4ee3a3e19a105dba5dc443bb2371d30
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1787870
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This can be used to replace hkdf_expand_one_step in more general cases
of HKDF. Also add unit tests for this.
BRANCH=nocturne
BUG=none
TEST=make -j buildall
Change-Id: Ie116b13ee33d171298eccabb8a37b59e702d0218
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719871
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 36b47ab3c06e477f5e95d6d9e84a5220248784e6.
With this CL the lid angle calculation on hatch devices reports 500
which is what's used for can't caluclate a meaninfgul value.
BUG=b:141840539
BRANCH=None
TEST=On helios tested with this CL and saw that lid angle calculations
returned 500 for lid angle. Then reverted the CL and verifed that lid
angle calculations were correct. Used 'accelinfo on 10000' to check
the EC reported lid angle.
Change-Id: Id4e36219792d00357d2885e9944c58fe0e15c5ca
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834705
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Yuval Peress <peress@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Commit-Queue: Scott Collyer <scollyer@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Right now we have several different versions of #! in
our python scripts. Unify them all and specify that we
are using python2.
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
BUG=none
BRANCH=none
TEST=make buildall
Change-Id: Iab33a3f5d4b827451a55542bcee8837b00da7867
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1817948
Commit-Queue: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|