summaryrefslogtreecommitdiff
path: root/common/ec_comm.c
Commit message (Collapse)AuthorAgeFilesLines
* ec-comm: make EC_PACKET_MODE_EN a wake source in all statesMary Ruthven2021-04-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable EC_PACKET_MODE_EN wake on high in ec_comm_init_ instead of board_configure_deep_sleep_wakepins, so cr50 will wake from regular sleep and deep sleep when EC_PACKET_MODE_EN is asserted. BUG=b:183611249 TEST=manual # Verify EC-EFS after wake from deep sleep # shutdown AP wait for cr50 to enter deep sleep ec > reboot ap-off # wait for cr50 to enter deep sleep. # Verify cr50 wakes up from deep sleep and verifies EC hash. ec > reboot ap-off # Verify EC-EFS after wake from sleep # keep AP off. Set the idle action to sleep cr50 > idle s # Disable TPM_RST_L wake to prevent that from constantly waking # cr50. cr50 > rw 0x40060284 read 0x40060284 = 0x00860008 cr50 > rw 0x40060284 0x00860000 # Verify cr50 wakes up from sleep and verifies EC hash. ec > reboot ap-off Change-Id: I7fc31154becaafaa536fc1ee6775a7723e49a469 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799447 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* cr50: fix the comment on DIOB3 (EC_PACKET_MODE)stabilize-13654.B-cr50_stabNamyoon Woo2020-12-071-2/+2
| | | | | | | | | | | | | | | DIOB3 (EC_PACKET_MODE) is used to indicate the start or the end of EC PACKET mode, but not as a UART TX. This patch corrects the incorrect comment regarding that. BUG=none TEST=none Signed-off-by: Namyoon Woo <namyoon@chromium.org> Change-Id: Ic13d34910005c8bc79a3f00e8d32113f267d6752 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575291 Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Mary Ruthven <mruthven@chromium.org>
* Fix in the console output message of EC-CR50 comm initializationNamyoon Woo2020-06-091-1/+1
| | | | | | | | | | | | BUG=none TEST=buildall Signed-off-by: Namyoon Woo <namyoon@google.com> Change-Id: Ie71e668e2966979a94035dcde750b1e31a7ba3f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2238540 Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
* remove CR50_SQAMary Ruthven2020-06-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | SQA images won't be built anymore. This change removes the SQA support. It deletes all SQA ifdefs and replaces CR50_RELAXED with CR50_DEV. BUG=b:158011401 TEST=manual build regular image and check eraselfashinfo and rollback aren't included. build image with CR50_SQA=1 and check it's no different than the regular image. build DBG image and make sure it still starts open, it has the eraseflashinfo and rollback commands, and it can flash old cr50 images. Change-Id: I5e94c88b1903cfcf0eee0081fc871e55fc8586c7 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227149 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* make cr50 agnostic about EC-EFS2Namyoon Woo2020-05-141-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes cr50 respond EC-EFS2 related TPM commands no matter it has the board property, BOARD_EC_CR50_COMM_SUPPORT or not. board_has_ec_cr50_comm_support() calls remain for configuring GPIO_EC_PACKET_MODE_EN only. BUG=b:155214584 TEST=checked gsctool running on Coral. [before] $ gsctool --getbootmode finding_device 18d1:5014 Found device. found interface 3 endpoint 4, chunk_len 64 READY ------- Error 8 in Getting boot mode [after] $ gsctool --getbootmode finding_device 18d1:5014 Found device. found interface 3 endpoint 4, chunk_len 64 READY ------- Boot mode = 0x00: NORMAL Also checked 'ec_comm' uart command. [before] > ec_comm No EC-CR50 comm support Invalid argument Usage: ec_comm [corrupt] [after] > ec_comm uart : 0xff packet mode : DISABLED phase : 0 preamble_count : 0 bytes_received : 0 bytes_expected : 0 response : 0x0000 ec_hash : UNLOADED <-- It is marked as unloaded, secdata_error_code : 0x00001203 <-- because of NVMEM error. boot_mode : NORMAL <-- Still, boot_mode is normal. Signed-off-by: Namyoon Woo <namyoon@google.com> Change-Id: I08dc9abd8f194c83484b5be9b0a5e8844b2fd221 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2185872 Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
* Modify ec_comm command to corrupt NVMEM copy of kernel secdataNamyoon Woo2020-03-311-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'ec_comm corrupt' used to corrupt a copy of EC-RW hash in ec_efs.c for test purpose. This patch makes it corrupt the copy stored in the TPM NVMEM cache first, and then read it into the cache in ec_efs.c. 'corrupt' option is available for regular image as well onl if CCD is opened. 'reload' option is obsolete. BUG=b:150650877 TEST=checked the behavior in the sequence below: 0. program regular image cr50> ec_comm corrupt CCD is not opened Access Denied Usage: ec_comm [corrupt] 1. open ccd. 2. Checked the original hash code. cr50> ec_comm ... ec_hash_sec_data : /* original hash code, Hm. */ 3. Corrupt the hash code. cr50> ec_comm corrupt ... ec_hash_sec_data : /* corrupted hash code, Hc. */ 4. Reboot EC. ec> reboot ap-off 5. Check the boot mode is NO_BOOT mode. chroot$ gsctool --getbootmode ... Boot mode = 0x01: NO_BOOT 6. Turn on AP by tapping the power button. Check AP rewrites the secdata, and Cr50 reloads it. cr50> ec_comm ... ec_hash_sec_data : /* original hash code, Hm. */ Signed-off-by: Namyoon Woo <namyoon@google.com> Change-Id: Id34239911da204e1eacd285fa601a9b5db03c4ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2119130 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org> Tested-by: Namyoon Woo <namyoon@chromium.org>
* change the init proiorities of ec_efs_init() and ec_comm_init()release-R82-12974.B-cr50_stabNamyoon Woo2020-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reprioritizes ec_comm_init() and ec_efs_init() so that they won't be executed prior to board_init(), which executes nvmem_init(). BUG=b:151187315 BRANCH=cr50 TEST=let cr50 reboot a few times, and checked the console message and the ec_comm command output that Kernel secdata was reloaded without error. Swapped cr50 image from normal to dev, vice versa, and repeated the rebooting. [Reset cause: hard] [0.003799 Inits done] strap pin readings: a1:2 a9:3 a6:0 a12:0 [0.005893 Valid strap: 0xe properties: 0xa00041] [0.007991 init_jittery_clock_locking_optional: run level high, ... [0.045539 init took 29953] [0.051185 tpm_rst_asserted] [0.052074 EC-COMM: Initializtion] Console is enabled; type HELP for help. ... > ec_comm ... response : 0xec00 ec_hash : LOADED secdata_error_code : 0x00000000 > Change-Id: Ia695896986374ac9d23ac111fe0086ec6a13923e Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2093102 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* add corrupt and reload options to 'ec_comm' console cmdNamyoon Woo2020-03-111-2/+27
| | | | | | | | | | | | | | | | | | | | Two new options for 'ec_comm' are for test usage only. - ec_comm corrupt: it corrupts the ECRW hash in ec_comm module. Hash corruption will cause EC-FW verification failure. It can be useful to check how AP firmware performs software sync on this failure. - ec_comm reload: it forces Cr50 to reload ECRW hash from tpm nvmem. This is to restore the EC EFS2 status in Cr50 from corrupted status. BUG=b:150650877 BRANCH=cr50 TEST=manually ran 'ec_comm corrupt' or 'ec_comm reload' with dev image. Checked cr50 normal image refuses those command lines. Signed-off-by: Namyoon Woo <namyoon@chromium.org> Change-Id: Ib4aa9532132e1ee786e623bd658a68987e4681dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2094781 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* minor cleanup on EC-EFS2 implementationNamyoon Woo2020-03-111-1/+0
| | | | | | | | | | | | | | usart.h doesn't need to be included in ec_comm.c. This patch also fixes nit output format in cprints. BUG=none BRANCH=cr50 TEST=make run-ec_comm Signed-off-by: Namyoon Woo <namyoon@chromium.org> Change-Id: Icadf0d860cee8d3cf882cdb4571aaa2bc325adf9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2094751 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* move ec_comm implementation to common directoryNamyoon Woo2020-03-101-0/+348
This patch moves ec_comm.c and ec_efs.c from board/cr50 to common/, so that they can be shared with other board configuration (like host). This is to build unittest for those files. BUG=none BRANCH=cr50 TEST=make buildall -j Signed-off-by: Namyoon Woo <namyoon@chromium.org> Change-Id: I67ac313054ebe4604848a176f0a42e3483957e74 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2094076 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>