summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* tpm: reset command_ready bit when entering idle stateVadim Bendebury2019-09-211-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | TPM could enter idle state even when current command has not yet been fully processed (for instance if the AP releases locality at an arbitrary moment). The status register command_ready bit needs to be unconditionally reset when TPM enters idle state. BRANCH=cr50, cr50-mp BUG=none TEST=verified reliable behavior during lengthy concurrent runs of processes accessing TPM. The same type of testing was causing occasional TPM lockups before this fix. Change-Id: I6e1dc334713c666e4ef566d41bd0cbff841f1179 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1643828 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 5188d521f467f1933e925a4e45db770b8a75edaa) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1646885 (cherry picked from commit bc36efa60982482dc5b97e3188626658bb7a9ce1) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705719 (cherry picked from commit 9e6eb51353d53e3fe3b01b5b285aa3ba81b55bba)
* g: improve trng error handlingVadim Bendebury2019-09-212-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to be able to track TRNG stalls happening in the field. This patch adds a log message to report detected TRNG stalls. The code detecting the stall is being modified to monitor a different status bit as per chip designer recommendation. A console command allowing to test TRNG is being added, compiled in only if TEST_TRNG is defined. BRANCH=cr50, cr50-mp BUG=b:27646393 TEST=compiled the test command in, ran the command rand 10000000 several times, observed reasonable stats and no stall reports. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1601470 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 7a2778ea9c85a385193b46c4258996d53e5ea960) Change-Id: I5a7b2ad46af7e556f3dccf4960ce126fef610d0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644297 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 4153c2e4a8f8ea215d00d82d2bdf9e2628449b71) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705718 (cherry picked from commit 2ec08c662aa1aa27accf1ba9973b38ad8f7e25f3)
* nvmem: make page header checksums different between prod and devVadim Bendebury2019-09-213-16/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When moving an H1 between prod and dev Cr50 images, it is important to quickly determine that the NVMEM contents are not retrievable. The first object verified by the initialization routine is the page header, but since SHA value is used for integrity verification, it does not change despite the fact that the mode (and encryption keys as a result) changed. Using encrypted header value for integrity verification guarantees that when transition between prod and dev modes happen the initialization function discovers it right away and reinitializes NVMEM instead of trying to interpret corrupted objects. The host/dcrypto stub used for unit tests and fuzzing needs to be modified to ensure that page headers read from uninitialized flash do not look valid (where encrypted value of 0xffffffff is 0xffffffff). BRANCH=cr50, cr50-mp BUG=b:129710256 TEST=make buildall -j successd, as well as migration of a Chrome OS device from legacy to new nvmem layout. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1615423 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 58e31f4788e369028f960e2fd39b435f1a1c4687) Change-Id: I4b9be92ccaa66d9ec44dadc17d619676b32ee70c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644296 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 56d73d6885deab1c5b6c9b0c15028b947f7e7545) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705717 (cherry picked from commit ac2f6e97f0658b8869197c2817c687d914d5de55)
* nvmem: do not run when crypto is disabledVadim Bendebury2019-09-215-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | There is no point in trying any nvmem operations when encryption/decryption services are not available. Test changes necessary to make sure test app compiles and runs successfully. BRANCH=cr50, cr50-mp BUG=b:132800220 TEST=The device does not crash any more after tpm is disabled. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1615424 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 60021c7225b3d247113b4c60e056d0cc01ad50ad) Change-Id: I6f3c4f4b23afb57cbbb5f55427a3c8947924a210 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644295 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 517d3054c2fa5a06e6a1cc6266676f1f055797a2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705716 (cherry picked from commit fd837a11fdfdb4d7224c08c510daf23073737c5c)
* flash_log: add vendor command, timestamp base accessorVadim Bendebury2019-09-212-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | The new vendor command allows to get and increase the flash log timestamp base. BRANCH=cr50, cr50-mp BUG=b:132287488 TEST=verified in the next patch in the series. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1610720 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org> (cherry picked from commit 57aa1891be676b51fb43045a664f476d676948f1) Change-Id: Ia496516699748c4711379d6707f548c443576115 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644294 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 48b9d509edb8389d4a54d48b4f8f2a7c1757f7c0) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705715 (cherry picked from commit 626d59388fbdc021714b71528c8116615cfe7fea)
* flash_log: add api for setting base timestampVadim Bendebury2019-09-213-7/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Cr50 environment does not have a wall clock, which makes it impossible to associate flash log entries with real time. This patch provides an API which allows to set a base time value and then use it plus current Cr50 uptime to generate more sensible flash log timestamps. Care is taken to ensure that attempts to set timestamp base such that it would cause a log timestamps rollback do not succeed. A unit test is being added to verify this behavior. BRANCH=none BUG=b:132287488 TEST='make buildall -j' (which runs the new tests) succeeds. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1610719 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 54a4479e64bb8caed335a38402af2bd46538777d) Change-Id: Ie66dc54f642c0af7eb06dfdcb7f89ff3202d1269 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644293 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 908d5b0b73bbfc91f1a753338647fd46c0d97553) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705714 (cherry picked from commit d3b67ca8c15dd97343fee9b1b02e9e9543aca337)
* host: Add dcrypto definitions that can be used by fuzzing targets. (take two)Allen Webb2019-09-2111-16/+199
| | | | | | | | | | | | | | | | | | | | | | | | | These definitions provide the necessary dcrypto functionality for fuzzing pinweaver. They can be built out as needed to support further fuzzing. BRANCH=none BUG=chromium:876582 TEST=make -j buildfuzztests && ./build/host/cr50_fuzz/cr50_fuzz.exe (with the cr50_fuzz CL) Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1180573 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 5c5555a49d89154f14efa0c68c99938ef1313b73) Change-Id: Ic32df9e2b01a6faf0559bdf6dbd5db020ffd71d7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644292 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit c9fac3dc4b582a94c626b8344fe4cce69e70e0d2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705713 (cherry picked from commit 4c958e5f63ef5edfb1cd5fd1fe52d5b0f0e06c81)
* cr50: add buffer_units_mask member into struct queue (take two)Namyoon Woo2019-09-212-9/+11
| | | | | | | | | | | | | | | | | | | | | | | "q->buffer_units - 1" is performed many times to wrap head and/or tail. It should be calculated once. BUG=None BRANCH=cr50 TEST=None Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1572444 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 8e8dd8a8e4a0556b67f2ceed6b0fe1547989d924) Change-Id: Ieb7dbbeb292eed2c83f5c5d06122d85ed94a65cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644291 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 77fd02501cffcc9c0880892415b53d389b274b79) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705712 (cherry picked from commit 88efafc7618c6575d12351469437cd2ef7cd2fe2)
* pinweaver: fix memory leak introduced when moving to new nevmem (take two)Vadim Bendebury2019-09-211-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Not all code paths were covered which results in leaking memory allocated for temporary storage of pinweaver variables. With this patch there memory is returned to the heap in all cases. BRANCH=cr50, cr50-mp BUG=b:69907320 TEST=multiple successive reboots of the Chromebook do not cause Cr50 resets due to memory allocation failures any more. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1588876 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit 02f4e2d04df57464a9a3f7b72c3ad9aca2c372e6) Change-Id: Ia392fb78ef3bf17a7a074a773bdf2a9d2bd4c70a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644290 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 872e2ed6535ee124a7478b36fed0ff13345cb688) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705711 (cherry picked from commit 6b2ea2792032621c16f3bafe9ec3204043b6e66b)
* nvmem: protect flash accesses with a mutex (take two)Vadim Bendebury2019-09-213-13/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Multiple tasks could be trying to modify NVMEM concurrently. To avoid data corruption add a mutex which guarantees that only one thread of execution has access to the flash storing NVMEM objects. Various paths accessing flash contents are now protected by the same mutex. Mutex control functions are put in wrappers, which makes it easier to add debugging code when needed. BRANCH=cr50, cr50-mp BUG=b:69907320, b:130828517 TEST=attempts to take a device through RMA open do not fail any more. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1584586 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 6e97f4aab723afd67946c4fab2ecd59c1579deaf) Change-Id: I4de6ff5e79a8a76a0a1dba06eb391780481515a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644289 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 173e8e605f33d834216906931fd90d4831afede0) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705710 (cherry picked from commit 96c18ae93052afcd6d59a2858797a0260a39005f)
* nvmem: populate default tpm objects after wipeout (take two)Vadim Bendebury2019-09-212-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TPM memory wipe code is removing all TPM objects from the flash, including the reserved objects, which are supposed to be always present. The assumption was that the Cr50 would be reset after the wipe out and the initialization code would populated the reserved objects with default values. But in fact Cr50 reset is not guaranteed after TPM wipeout, so it is better to call the init function explicitly to make sure that all reserved objects are in the flash at all times. BRANCH=cr50, cr50-mp BUG=b:69907320 TEST='dump' command ran on the Cr50 console after RMA open shows all reserved objects present. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1584658 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit f4f26f19d1ce3d3f4904ddf8bb69185665f73c5b) Change-Id: I02aad476db96ef5d845b25e9f04889a4ba10ce5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644288 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit cbe1fc80845937e1ad5450ae227ffd2d54de55c5) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705709 (cherry picked from commit e018980f483086dc74d4a3fe65187ab9e8ab428c)
* nvmem: add test of recovery from interrupted saves (take two)Vadim Bendebury2019-09-213-1/+21
| | | | | | | | | | | | | | | | | | | | | | | Add a test which introduces corrupted objects in the flash and verifies that the initialization function is able to recover. BRANCH=cr50, cr50-mp BUG=b:69907320, b:129710256 TEST='make run-nvmem' succeeds Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1590044 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 15bd8639ef6df248b4474808bd21d80b0c19bac4) Change-Id: I9ad93134ee3284d4db5f556197722d90c1d24027 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644287 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 283794fbc0235ae4f0d9fefc8d5eff55c4d82996) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705708 (cherry picked from commit 4c65410c1732168ad7f0edee27a9c06344eadf5f)
* nvmem: fix delimiter creation during setvar() (take two)Vadim Bendebury2019-09-213-22/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The (key, value) objects should not be treated differently from TPM objects when initializing NVMEM from some inconsistent state. Saving of a modified (key, value) object should include the 'incomplete delimiter' phase when the new value has been already saved, but the old value has not yet been eliminated. Added tests verifying various failure modes. BRANCH=cr50, cr50-mp BUG=b:69907320, b:129710256 TEST='make run-nvmem' succeeds Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1590043 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 13089909211c5289c46d22a3cb7fb9b06efcd917) Change-Id: Iaaca3fc1786ea74adae8b918fc69d95481d622bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644286 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 21b0c907a9c90eb5dae787a95ce9a633d0011f7c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705707 (cherry picked from commit bed74f99eb720b5799624541bf88a22d4b79c3f3)
* nvmem: add logging and restart on app_cipher failures (take two)Vadim Bendebury2019-09-212-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | Just in case there is a failure when encrypting or decrypting NVMEM objects, add code which detects problems, reports them in the flash log and reboots. BRANCH=cr50, cr50-mp BUG=b:69907320, b:129710256 TEST=none Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1590042 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 262ded1e01a374537e56160811bdad5763b311a5) Change-Id: I554f0526ae315e95f5f30f8374da35651d452d68 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644285 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit af5afacd5aea2c08449fe909fb8acd47ec4b1989) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705706 (cherry picked from commit e9942fa069bb846d09a9afb2588701a6d7204b6d)
* factory_mode: refactor factory_enable_failed (take two)Mary Ruthven2019-09-211-17/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor factory_enable_failed, so cr50 always resets if a reset is requested. This change also renames factory_enable_failed to be more specific. It renames ccd_hook_active to wait_for_factory_ccd_change so it's obvious what the variable is doing. It's waiting for the ccd_config change after we enable factory mode. Enabling factory mode can fail in a lot of ways, but by the time we called factory_enable_failed, the failure is specifically about saving the config. This change renames the function, so the failure is a bit more specific. If a reset is required, always reset the system even if saving the factory config failed. ccd_reset_factory_failed is triggered if the ccd changed hook isn't triggered quickly enough or if cr50 fails to save the ccd config. Cr50 has already wiped the TPM and has most likely saved some if not all of the factory mode state. Cr50 should still reset even if the config isn't saved to be safe. enable_ccd_factory_mode isn't used in the process to enable factory mode during init, so this change won't cause a cr50 reboot loop from cr50 trying and failing to enable factory mode during init. This only affects the RMA and factory mode enable vendor commands. BUG=b:129956462 BRANCH=cr50 TEST=Use rma and factory mode vendor commands to enable factory mode. Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1572450 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> (cherry picked from commit 1aa9ec883ab4cb00e28611e6ad0441858ca18879) Change-Id: I3385415f18be11130c252f8436a16e5a28a82dca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644284 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit da9739c65806c1d5ebbb1d98478c275cf03c636f) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705705 (cherry picked from commit 8b43512a4acda1ceda96bec504992f1dcccdfef0)
* ccd: make ccd open error more meaningful (take two)Mary Ruthven2019-09-211-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now if 'ccd open' from the console fails, it pretty much always fails with "nopwd". This error is pretty meaningless, because you can't even set the password until you open ccd. This change suggests removing the battery or sending the open command from the AP in dev mode if ccd open fails. This error should help people remember their device needs to be in dev mode and open needs to be sent from the AP. BUG=b:73170050 BRANCH=cr50 TEST=try 'ccd open' from the console. Verify the error message is changed. Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1572156 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org> (cherry picked from commit 6d209022032e02125cc33f10d3218a0cc7f8ae68) Change-Id: I149c1579d2ce527a048119cfc02ab9d1f4fb9a8d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644283 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 449be3d7bdd206893ed9d31ffef9c6b0de4545d1) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705704 (cherry picked from commit 7ce9c533d1d93197cb15449641f89ff2728ae099)
* cr50: default to SPI PLT_RST if there's a pullup on DIOA9 (take two)Mary Ruthven2019-09-211-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PLT_RST_L SYS_RST_L detection is critical to booting, so we need to have a way to make that decision for SPI boards even if there isn't a matching config in the board properties table. We keep adding SPI PLT_RST configs. Everytime we do we have to immediately add a new config to the strap table, because SPI straps aren't able to default to PLT_RST_L. This change adds support for defaulting to PLT_RST_L if there is a pullup on DIOA9. With this new logic there will be 8 supported configs that default to SPI PLT_RST_L and 4 that default to SPI SYS_RST_L. BUG=b:129866334 BRANCH=cr50, cr50-guc TEST=remove atlas config from the table. Make sure it still defaults to SPI PLT_RST even though the config isn't found. Remove the bob config from the table. Make sure it defaults to SPI SYS_RST_L. Remove the reef config from the table. Make sure it defaults to I2C PLT_RST_L. Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1574659 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Namyoon Woo <namyoon@chromium.org> (cherry picked from commit 5adde977fbd35596b707cee5174ac825b42c4179) Change-Id: I2fe45ac17d0c8e6197dc5896d0ebcecda94c79e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644282 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 94d60aba20522c959eec2ed00479f9970d034f0c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705703 (cherry picked from commit 1423c50591e40886ddd6639953adaf6c5afce71d)
* g: clean up UART channel names (take two)Vadim Bendebury2019-09-211-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | For some reasons functions dealing with the Cr50 console are using the 'uart_ec' prefx. This patch renames them to match the actual use. BRANCH=cr50, cr50mp BUG=none TEST=make buildall -j still succeeds. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1551690 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Namyoon Woo <namyoon@chromium.org> (cherry picked from commit 0edf521353afda4e3975352489d62a03df1927e8) Change-Id: Ia933d353f370d168371cf570f16b33c4fa200c83 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644281 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 0b5bb7e43259a734e62b26a7a981045da05ad33e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705702 (cherry picked from commit ed9cebbb74f77cded5bfaf5a0dff5484bcb879b9)
* ec/common: Introduce IS_ENABLED to check config options (take two)Raul E Rangel2019-09-211-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is copied from coreboot with added support for empty defines. We should favor using this macro instead of using #ifdef. The macro will evaluate to 0 if the option is not defined. This allows all the code to be compiled and then the optimizer will remove the sections of code that won't ever run. This way we don't end up with #ifdef sections with invalid syntax because no one ever tests that specific permutation. e.g., if (IS_ENABLED(CONFIG_USBC_SS_MUX)) { ... } There are currently spots where #ifdefs are nested 3 levels deep. This makes it very hard to follow the code. BUG=none TEST=Added some code that uses the macro and verified it executes when the config value is defined, and doesn't when it's not. Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1553573 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 46e28e28c2973db09dd9a7a2c14db3cd2609905a) Change-Id: I1d1919877fad78eba5839aa34735399cd3e413e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644280 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit a1cc6b5f970b36812064d14bbf9965e8d74823f5) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705701 (cherry picked from commit 8ba013de09490387f476739af1bd518fe78c6f72)
* cr50: use board_wipe_tpm to clear the tpm (take two)Mary Ruthven2019-09-216-52/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were clearing the tpm in two different ways. There was one implementation in factory_mode.c and one in wp.c. This change merges the two, so there's only one board_wipe_tpm. While modifying the wipe tpm code from factory_mode.c I noticed the factory_enable_failed stuff is maybe a bit more complicated than necessary. I opened a bug for cleaning that up(b/129956462). It wont be addressed in this change. BUG=none BRANCH=none TEST=Run the processes that wipe the tpm open ccd. enable factory mode from vendor command. run rma open process Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1535156 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 678bb4526ef19ef9458910d0231722b0de4c5ddf) Change-Id: If8b168df04185d6ec99946375ab6463620db5a1c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644279 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit f23f06425683b5727b25d61b62f685c8835f8a15) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705700 (cherry picked from commit 3d0fba3562f1de6271735517572db9399fcaa8a2)
* nvmem: test modifications to support the new scheme (take two)Vadim Bendebury2019-09-219-603/+1718
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch includes changes to support testing of the new nvmem implementation. Making fizz compatible required duplicating a lot of functionality available in the test/ directory (fuzz/nvmem_tpm2_mock.c is very similar to test/nvmem_tpm2_mock.c), but I could not find an easy way to avoid it. BRANCH=cr50, cr50-mp BUG=b:69907320, b:129710256 CQ-DEPEND=CL:1496607 TEST=with the rest of the patches applied 'make buildall -j' succeeds, which confirms both test and fuzz success. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1450278 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 1d6c7bb9773f76aa70ce65822fa001ff72892cd2) Change-Id: Ic839cc6d740359aea0baf8df334df6e2085c1507 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644278 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 33d7f4549261fcbeab1d792048c8ced984842736) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705699 (cherry picked from commit a3c0ccdcd878fcbfdedd22997ea41c0128d6d3ee)
* cr50: complete support of the new NVMEM structure (take two)Vadim Bendebury2019-09-2116-1148/+1387
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch eliminates unnecessary legacy nvmem.c and nvmem_vars.c code and brings the code base to the state where the new NVMEM layout is fully functional. BRANCH=cr50, cr50-mp BUG=b:69907320, b:129710256 CQ-DEPEND=CL:1450278 TEST=the following tests pass: - test cases in ./test/nvmem.c - TCG suite (passes on par with the existing Cr50 code with the reduced code footprint TPM2 library) - Chrome OS device migrates from legacy to new implementation with user account maintained. - Chrome OS user account is maintained over AP and H1 reboots and deep sleep cycles. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1496607 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 171578b67f40355528cbb5f34b78e8e8ed83e335) Change-Id: I92900a8a9ed53cba3e6976caf60fd1a793e8ff0f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644277 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 7483d43520fa68654617d3da02dd67e9a15b7efd) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705698 (cherry picked from commit 3ec55a4f3b2be3d1e080ee13cb95c83efb683188)
* common: flash and nvmem fixes for compatibility with the host board. (take two)Allen Webb2019-09-213-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | This CL 1) Forces alignment of __host_flash so it can be used with nvcounter 2) Disables a compile time check for the host board that failes because the host board uses a variable to emulate flash memory. 3) Disables nvmem_vars console commands that are specific to a unit test for fuzzing targets. BRANCH=none BUG=chromium:876582 TEST=make -j buildfuzztests (with cr50_fuzz CL) Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1183533 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 8961872603f6d7b66ef97d444711e83d6a55e2f4) Change-Id: I1a34f50919a4ab394c60f37fc78c64ca0047fb3c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644276 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit c4d2423f3527fb2605e212935dda8d7c94ef8a49) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705697 (cherry picked from commit e586bb72f4c7c4ef12c75ca80549e8e1edbd3d3d)
* cr50: Update to VENDOR_CC_GET_PWR_BTN (take two)Keith Short2019-09-211-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the VENDOR_CC_GET_PWR_BTN behavior to report the live state of the power button. On Wilco devices, the AP needs to poll for both a power button press and release prior to booting an untrusted OS. The falling edge of the power button is still latched, so the first call to VENDOR_CC_GET_PWR_BTN command will return a button state of 1 if this call is made within 10 seconds. Once the latched state is clear, VENDOR_CC_GET_PWR_BTN returns the live state of the power button. BUG=b:128431787 BRANCH=cr50 TEST=Added test code into vboot recovery screen to poll VENDOR_CC_GET_PWR_BTN command for a power button press and a power button release. Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1534337 Reviewed-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Matt Delco <delco@google.com> (cherry picked from commit 63bf8f8ba87b23378391b147f1b3e9fdcf3d8dc5) Change-Id: I09050707b2c7a699bfd4512dacdb5b65ac5cbcf8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644275 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit a952a460f2e2e3ddb7efb30824bb9cbf6c46d3e2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705696 (cherry picked from commit 2345fbba68129dfdf36dc7c27ed7de3edaf30aca)
* cr50: convert functions into static (take two)Namyoon Woo2019-09-216-18/+6
| | | | | | | | | | | | | | | | | | | | BUG=b:112778363 BRANCH=cr50 TEST=ran test_that suite:faft_cr50_prepvt on coral. Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1410482 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit b97918b72f1d30120f4598a58f7066d72fbd3e9c) Change-Id: I826bea47a04db2729a1c1da4bef3401c9b84d6b9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644274 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit d017bd81510b895cbe0d343605366aa1fff6c330) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705695 (cherry picked from commit 540be92784431c2799d71b4fbbb1c055e623b74b)
* cr50: make is_sys_rst_asserted static (take two)Mary Ruthven2019-09-212-2/+1
| | | | | | | | | | | | | | | | | | | | | | BUG=none BRANCH=cr50 TEST=make buildall -j Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1542799 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 907ccfb38f9d3d08a9888a0b44c0c3a28f1dc381) Change-Id: Ia4f99c410a40966d134f34819444812399f6cb08 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644273 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 9a6e9cf99a24972f270fbe32b2d5b77d9acdcafa) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705694 (cherry picked from commit 71515ce58b73d4684617c9aca45df0b8365ed07c)
* cr50: make sys_rst_l_out pseudo open drain (take two)Mary Ruthven2019-09-213-29/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing SYS_RST_L implementation enables the output on SYS_RST_L before setting the level to 0, which results in cr50 briefly driving SYS_RST_L high when SYS_RST_L is asserted. This patch switches SYS_RST_L to a pseudo open drain mode, which eliminates the pulse. The internal pull up on SYS_RST_L is not being removed, so the H1 will still pull this line up when SYS_RST_L output is set to 1. Removing the pull up will require careful analysis of existing designs, and if safe will be done in a different patch. BUG=b:117676461 BRANCH=cr50 TEST=assert/deassert sys_rst_l and check that 'sysrst' shows the correct state. Verify this works on cheza which only pulls SYS_RST_L up to 1.8V even though VDDIOM is 3.3V. Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1282020 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 9d09e1f04007c3fef98d35e5514fcaa2fea237ce) Change-Id: I6a6d5a7bbc51a8fdd6dbd5a07bbfdc06a3cbaf09 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644272 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 499f1c5eb22011bbf26bf9e2a6f3891a13f0e972) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705373 (cherry picked from commit e7a38365f3e22fc417789206c60d521c533b2566)
* gpio: add config option for using gpio_get_flags (take two)Mary Ruthven2019-09-213-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | Separate gpio_get_flags from the CONFIG_CMD_GPIO_EXTENDED, so we can enable getting the gpio flags without enabling the ability to set them. BUG=none BRANCH=cr50 TEST=none Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1542798 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit c0814644b003412ac81b83068028749fe8a0ae76) Change-Id: I58d77b750bd5e33bfb509f37d985b389cc042abe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644271 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 5494ac3a0cf4338d7adba13d00fd3ac9d4a3d26f) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705372 (cherry picked from commit b7b6b575a73991cf59ea76e3856f111579cd8503)
* cr50: New NVMEM flash storage implementation (take two)Vadim Bendebury2019-09-214-0/+3148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is a proposed implementation of the new TPM NVMEM flash layer. There is a big comment block in common/new_nvmem.c describing the approach taken, changes to the API and outstanding issues. This implementation follows the design document attached to b:69907320. With all required changes to the rest of the code this new flash storage scheme consumes 7816(!) bytes of code storage. One of the more important aspects of this implementation is that the (key, value) pair objects are stored in the flash only, they are not duplicated in the SRAM cache. The advantage of this is that there could be more space dedicated to these objects. Soft limit is set to 1K as opposed to 272 bytes available with the legacy scheme. The major disadvantage is the need for the user not to forget to release the (key, value) pair retrieved from NVMEM, as it occupies space on the heap. BRANCH=cr50, cr50-mp BUG=b:69907320, b:129710256 TEST=with the rest of the patches applied the following tests pass: - test cases in ./test (completely reworked for the new scheme) - TCG suite (passes on par with the existing Cr50 code with the reduced code footprint TPM2 library) - Chrome OS device migrates from legacy to new implementation with user account maintained. - Chrome OS user account is maintained over AP and H1 reboots and deep sleep cycles. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1450277 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 574e131187492b0e5ba1af06d9a6baee22a2302e) Change-Id: I9354bae86dc92a87adf52653ef8a955d0bbb2e1e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644270 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit bdd0396dd2615cb4fe9164e6215b0db7e7f61423) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705371 (cherry picked from commit c926c7fc0b25b2e48b869ba4d52ed45a18584f03)
* cr50: make ccd_mode_l pseudo open drain (take two)Mary Ruthven2019-09-212-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | gpio.c has support for making pins open drain. This implementation will prevent the signals from being driven high. Use the gpio.c support instead of the hack we were using before. BUG=none BRANCH=cr50 TEST=the EC can assert CCD_MODE_L when cr50 has it deasserted. Verify this on a ARM and x86 device in the lab. Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1282019 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit fd2a6277b4b2262efda3d22e46ec9a48bc7339b2) Change-Id: Ia19cbcbfc3cd06683734a3d656551c2916544234 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644269 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit e6b02a57c54b63a61e29e7f01265d49c26f73e0c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705370 (cherry picked from commit 5b4449feb275b56ab1688cc8fa07387edcfa1bc5)
* factory_mode: change how reset_required is saved (take two)Mary Ruthven2019-09-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Logically OR reset_required with the saved reset_required state when enabling factory mode, so there is no way to cancel a reset once it's requested. BUG=none BRANCH=cr50 TEST=enable factory mode. Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1548273 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 23a89eccf3143790b89867fd32ad8331e53d49c0) Change-Id: Ia21e15ca6c1f3db7ee67ff342078ce128583eeb8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644268 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 2d07e400b599a2a930a249429f7ef4dd0f195a37) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705369 (cherry picked from commit 0a7ce890fca4f698786d81ed4f1af0b217430f47)
* cr50: add command to override BATT_PRES_L (take two)Mary Ruthven2019-09-214-14/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use BATT_PRES_L to determine if factory mode can be enabled. We need to be able to control this for cr50 testing. Add a command that can be used to override battery presence. This change also adds a ccd capability to control access to this command. If this capability is enabled, someone can easily use console commands and AP commands to enable factory mode, so it should be controlled separately from WP and GscFullConsole. BUG=b:126197850 BRANCH=cr50 TEST=override battery presence using bpforce. Make sure the state lasts through reboot, deep sleep, and power-on reset. When bp is forced disabled you can do ccd open without physical presence and you can enable factory mode. Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1505213 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> (cherry picked from commit 351f46632d5f0a051f298742fb68c7b7c9e3f8d4) Change-Id: I65bb63a700414b965d265f0f4cca8a2c3cbe0454 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644267 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 1e078a4e419dda4bcda660ce65b164db3d3e9334) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705368 (cherry picked from commit 84b6edb53d4e18ff9dcf522cac05c6c454d7adb6)
* cr50: add command for forcing servo disconnect (take two)Mary Ruthven2019-09-214-4/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Early proto boards may not have the servo detection setup correctly. This change adds a method to work around this issue, so people can use the consoles even if cr50 thinks servo is connected. BUG=b:119690767 BRANCH=cr50 TEST=Use 'ccdblock ignore_servo enable' on cheza EVT verify ec uart becomes read write. Make sure uart becomes read only after 'ccdblock ignore_servo disable'. Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1341162 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 01f95b49e6dc69c2485c671b71d2075eb9e34f66) Change-Id: I096b4a9de23dad6d78f487d4b2093cc7b4d9a453 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644046 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit f3859df40042da3114950177679879f6f922a81a) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705367 (cherry picked from commit 8f6efb4320928ea9f93a7476eed1eb46c87bbc9d)
* cr50: add vendor command for retrieving flash elog (take two)Vadim Bendebury2019-09-216-120/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to be able to retrieve flash log contents using the vendor command channel. The input parameter of the command is the timestamp of the last retrieved log event, or zero of the AP wants to start over. The response is the next entry after the one requested by the AP, or an empty message if there are no newer log messages. BRANCH=cr50, cr50-mp BUG=b:63760920 TEST=with the upcoming gsctools changes observed the ability to retrieve flash log messages. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1525146 Reviewed-by: Namyoon Woo <namyoon@chromium.org> (cherry picked from commit 705595bb681f362a5e34fb377d21fa8bfa605f9d) Change-Id: I18bd6ec60930c0b05b71322352b0fd343d0bcdc7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644045 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit bf5efbd2b40e9eb27aaf8a1e1524afeca0ee75b8) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705366 (cherry picked from commit e48557edd01266038422748190ba59551c18b012)
* cr50: move to use flash event log (take two)Vadim Bendebury2019-09-213-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With upcoming Cr50 changes which might trigger occasional reboots, it is better to keep the Cr50 log in the newly introduced flash log space as opposed to the circular log in SRAM. There is no need to log TPM resent events, as this is not something worth tracking in a flash log. Enabling flash log facility adds 624 bytes to the prod Cr50 image and 1420 bytes to the DBG Cr50 image. BRANCH=cr50, cr50-mp BUG=b:63760920 TEST=with modified code observed saving of FE_TPM_I2C_ERROR event. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1525145 Reviewed-by: Namyoon Woo <namyoon@chromium.org> (cherry picked from commit e0d934828ef95a702a2a491a9219a1a55cc997cc) Change-Id: If42d5f0bcba9302326dace4ad538f78c0f064303 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644044 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 64f4de8eb14f044a897b7caccc3bbc57ec7c9d57) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705365 (cherry picked from commit 493ca0a29450213de9c93f1c16b10a05b7a75497)
* g: add flash elog support function (take two)Vadim Bendebury2019-09-212-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Cr50 flash layout does not use space in the top of RO_B section, this is a good location for the flash log, as it can not be easily used for the code or RO data of the main Cr50 application. BRANCH=cr50, cr50-mp BUG=b:63760920 TEST=with the rest of the stack of patches applied was able to add and retrieve flash log messages on Cr50. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1525144 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 5ea675bcecddf7fc9e94d718e22523216157e9d5) Change-Id: I0ab6b3b53c0854b368dcdecccd6d1a407ad8e983 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644043 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 1af519a59ae93af6980a2ce2a4971986aa3e17ec) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705364 (cherry picked from commit 3ec8ae525b85f0634377d35f99cab3dd552c084c)
* common: add flash event log facility (take two)Vadim Bendebury2019-09-219-0/+909
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds implementation and test for a generic logger saving log entries in the flash. The entries payload are limited to 64 bytes in size, each entry starts with a header, which includes - 8 bit type type to allow to interpret the payload - 6 bit size field (two top bits of the byte are left for user flags, not yet used) - 32 bit timestamp to allow to identify newer log entries (presently this is just a monotonically increasing number) - 8 bit crc field protecting the entire entry The entries are padded to make sure that they are ending on the flash write boundary. The location of the log is defined by the platform using it. There is a provision for allowing the platform to register a callback which is needed to be called to allow write access to the log (as is the case on H1). While the device is running, the log is growing until the allotted flash space is 90% full. If there is an attempt save another entry after that the log is compacted, namely the last 25% worth of flash space is preserved, the log space is erased and the saved contents written back. On restarts the log is compacted if its size exceeds 75% of the allotted flash space. An API is provided to add entries to the log and to retrieve an entry newer than a certain timestamp value. Thus starting with timestamp zero will result in reading the very first log entry. To read the next entry, the read function needs to be called with the timestamp value of the current entry. This allows to browse the entire log, one entry at a time. A CLI command compiled in when CONFIG_CMD_FLASH_LOG is defined, allows to add log and retrieve log entries. BUG=b:63760920 BRANCH=cr50, cr50-mp TEST=the included test case can be invoked by make run-flash_log and it passes. More tests are done when the rest of the patch stack is added. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1525143 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 53b44b301d2d5000c7b73b04276b4ffa6d2e8efa) Change-Id: Ibd56a337e8e5e2224e8c79e15881e4961607bd1a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644042 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 1fa315df837b3abd983845c6aa9fdcc5094ac644) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705363 (cherry picked from commit 3f1dae709d6dfe820a04700f961d779cc21c0ead)
* cr50: add board_forcing_wp to get force wp state (take two)Mary Ruthven2019-09-211-5/+12
| | | | | | | | | | | | | | | | | | | | | | | A lot of places check if cr50 is forcing the wp state. Add a function for that. BUG=none BRANCH=cr50 TEST=none Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1539008 Reviewed-by: Namyoon Woo <namyoon@chromium.org> (cherry picked from commit 05e9ae7330cfa6144cbc29c30065a58f667fd48e) Change-Id: Idf7b6c979e7e0fb80b426535153b2ee2f7ebbdb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644041 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 27abcae6269ae219f00b1fb5c459f37950aedc4c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705362 (cherry picked from commit 019bee7a25d4f0cf2d61d8265942313c9f0dfb04)
* common: replace 1 << digits, with BIT(digits) (take two)Gwendal Grignou2019-09-21164-1618/+1619
| | | | | | | | | | | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit bb266fc26fc05d4ab22de6ad7bce5b477c9f9140) Change-Id: I9ed9834f8b4b5f1d046d0e9a6f8b83372281d732 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644040 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 98806c7521e4ff6e407f652a93312995552268fe) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705361 (cherry picked from commit b28f163b67c8b8e4877021ee276cc0a99370a1a1)
* reduce set of test run during buildall (take two)Vadim Bendebury2019-09-212-23/+1
| | | | | | | | | | | | | | | | Leave only tests relevant to Cr50. BRANCH=cr50-mp BUG=none TEST='make -j buildall' still succeeds. Change-Id: If94c3dc2b891f46126b797cb7391d3b269c47368 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1595226 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644039 (cherry picked from commit a2d5a6f999fc2ddc5b01d81d8049f1c4d68a1f01) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705360 (cherry picked from commit 7c4f4c27d98e5541ce5ebd72a6510966e10d9d3a)
* common: Include compile_time_macros.h when needed (take two)Gwendal Grignou2019-09-2110-149/+657
| | | | | | | | | | | | | | | | | | | | | | Include compile_time_macros.h to files that will use BIT macro. BUG=None BRANCH=None TEST=unit tests. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1525156 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 0bfc511527cf2aebfa163c63a1d028419ca0b0c3) Change-Id: I997f770c2bc96847ac4da35ca382b781e7f4e934 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644038 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit de8eab9334f07711d9b563f9631fc4d5e9caa3fb) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705359 (cherry picked from commit c625fa0184c46eb977300077ce3ff9a1a4e67c09)
* common: Add BIT macro (take two)Gwendal Grignou2019-09-212-38/+44
| | | | | | | | | | | | | | | | | | | | | | | | | As requested for integration in kernel mfd subsystem, use BIT(...) instead of (1 << ... ). Add the macros, apply just to ec_commands.h for now. BUG=None BRANCH=None TEST=Compile Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518658 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 8c6e95303832f7d445b415f1a1c0b0e34487ab2f) Change-Id: I0324bab48ff7865b59dc867fff60456a83c2d860 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644037 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit bc2ab61f514a8281c1ac98a034a331a071863380) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705358 (cherry picked from commit 715be24daf09fb3063a881fe4277eda2d1b5ef5f)
* test: store persistence files in RAM (take two)Vincent Palatin2019-09-211-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On VM-based builders, the nvmem unittest was sometimes missing the 10-second deadline, likely being stuck in slow I/Os. Try to move the persistent storage files used for flash 'emulation' on host from the build directory to a RAM-backed filesystem in /dev/shm in order to mitigate this bottleneck. Store the new backing files in a path like: /dev/shm/EC_persist__mnt_host_source_src_platform_ec_build_host_nvmem_nvmem.exe_flash in order to keep the properties of the old system: subsequent runs of the same build will use the same persistent storage but 2 different trees won't mix up. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chromium:715011 TEST=make runtests TEST=run the following command with and without this change: 'for i in 0 1 2 3 4 5 6 7 8 9 ; do time make run-nvmem ; done' and see the average test time around 500 ms without the change and around 320 ms with it on an idle and beefy workstation. Reviewed-on: https://chromium-review.googlesource.com/893380 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 924d21d904b9f2c640ee5b0ccabcf78200456a0f) Change-Id: Icb5311d46ed415eee57ea191ff91dfac00917385 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644036 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 6a79a464a7dbf9d96a220829ed4235236ab464c2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705357 (cherry picked from commit 2204f4db8cb5ac2d237e0437b6a7e87040af4a33)
* g: add board_id_is_blank (take two)Mary Ruthven2019-09-213-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | Add board_id_is_blank for checking that all fields of a board id are 0xffffffff. BUG=none BRANCH=cr50 TEST=none Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1531321 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit ca3f517b0b27e2be1e3d21cecd9958e2e5263512) Change-Id: I1fce3bae4080499abb80be8d1e59ca12134bfe66 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644035 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 8b628115b6e0cdbb15f1e145a7fba6308bd238b9) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705356 (cherry picked from commit 9917c1e62b53a3dca669da3e38139f7c0a5bb4fa)
* cr50: prepare to release 0.3.18Vadim Bendebury2019-09-212-2/+2
| | | | | | | | | | | | | | | | | BRANCH=none BUG=b:133187513 TEST=none Change-Id: Ifcddb73577e6510ddc33c97cdf83af1ddcf2a616 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1621073 Reviewed-by: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit 35048bb784c24f8f4d88e6664cdd4453677f8cb9) Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1625548 (cherry picked from commit 724f23ff20a7105c759d0e07bc1bc66245d83684) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644523 (cherry picked from commit 8052858d9e74aeef29f56b944449bc88197e2f1c)
* cr50: Generate new G2F seed.Louis Collard2019-09-212-1/+8
| | | | | | | | | | | | | | | | | | | | | BUG=b:132310780 TEST=flash to soraka, check new seed is generated, repeated when: - no flash space left to write an additional var - previous seed does not exist revert to old build and check old seed is gone BRANCH=none Change-Id: I7ada1a00becae41bda8ef56b0d4dcc5f9b59fd71 Signed-off-by: Louis Collard <louiscollard@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1610389 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit f2431315c39d344fa6c99042a6b6cc9d68b7db93) Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1625547 (cherry picked from commit bb025b97429bb1f2d1096c29feae10bc3c9995dc) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644522 (cherry picked from commit 4eb87915436d2e44d974eed6ebfc51e2578c7a4f)
* cr50: Change G2F cert CN to "CrOS"Louis Collard2019-09-213-9/+23
| | | | | | | | | | | | | | | | | | | | BUG=b:132310780 TEST=flash to soraka, retrieve G2F cert, check CN retrieve anonymous U2F cert, check CN unchanged BRANCH=none Change-Id: Id409ac5d534f2ee9e16376d690f58b184f5ac1a6 Signed-off-by: Louis Collard <louiscollard@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1614581 Reviewed-by: Andrey Pronin <apronin@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Commit-Queue: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> (cherry picked from commit 6072cc9c03a27c657e5899708233092bacfe1cd0) Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1625546 (cherry picked from commit 52792a24b30ee2456b926d7e92f0fc5780192485) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644521 (cherry picked from commit 8aa5e930e0a8c3abdd5c908950f35dbf0e1b7044)
* ccd: delay sleep while opening ccdMary Ruthven2019-09-213-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | Cr50 may enter deep sleep while wiping the TPM. This change adds a sleep delay before opening ccd. BUG=b:130646257 BRANCH=cr50 TEST=manual dut-control cold_reset:on run ccd open make sure ccd is open even after entering deep sleep Change-Id: Id44b608702b664621bd2441f62a03ba6428135cf Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1585606 Reviewed-by: Namyoon Woo <namyoon@chromium.org> (cherry picked from commit 0f25f85e44362e7feb15ce59974f0423abab0b5f) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1595415 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 892d0d99658beb67e17ac07208d16789cf313952) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644520 (cherry picked from commit 68fd3780d72b2f1fb9d30d8de4dfec57d14be37f)
* chip/g: prevent USB read queue overflowNamyoon Woo2019-09-213-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CR50 should check whether USB RX queue has enough space for host data. If not, it schedules to retry it in another deferred call. BUG=b:130908211 BRANCH=cr50 TEST=manually ran "echo 'help' > /dev/ttyUSB0" more than 30 times. Without this CL, it used to break cr50 console input, and it worked as if it is 'read-only'. After applying this CL, cr50 console input works normal even after excessive input stream. Change-Id: Ieace84b51c31800b52d2c4a9334e6ffe7888e592 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1576326 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit 8c50dc29cb6f7cdb077fe9ba49425404ae98207b) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1595414 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 33ce7dbbbb5199d360b4cdbdcc58e2b6b2755405) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644519 (cherry picked from commit 78a51bf17d4654e8a857ac410da667a38c6478d3)
* cr50: Support legacy U2F key handlesLouis Collard2019-09-212-5/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new U2F functions make use of a new key derivation scheme. This adds a flag clients can specify that allows the new functions to also sign requests using a legacy key handle. This will allow continued support of legacy key handles in Chrome OS whilst allowing the legacy code to be removed from cr50. BUG=b:112603199, b:123161715 TEST=with new cr50 and u2fd patched to send new param: - register legacy key handle with Google - restart u2fd with user keys and no fallback - check login fails - restart u2fd with user keys and fallback - check login succeeds Signed-off-by: Louis Collard <louiscollard@chromium.org> Change-Id: Ib3164e9c0856d51b958fa8db181153b5b2227850 Reviewed-on: https://chromium-review.googlesource.com/1580622 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 04c85f7968a45f3f25504b8169d2a3751e588785) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1595413 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit 68c56ff675fe76ee4ee71cd80de1fa51011afd1e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644518 (cherry picked from commit 5de75db12d64173cf2a896428197ceb45e90059c)