summaryrefslogtreecommitdiff
path: root/extra
Commit message (Collapse)AuthorAgeFilesLines
* stack_analyzer_unittest: Unit test of analyze disassembly for Andes instructionstabilize-10985.Btim2018-08-201-2/+100
| | | | | | | | | | | | | | | | | | | | | | | | | Write a rough disassembly with Andes instruction in stack_analyzer_unittest.py which rough disassembly is analyzed by stack_analyzer.py to get some results. If these results are the same with expect results, the unit test will pass. In the rough disassembly, the file format is added in the second line, because the stack analyzer will be looking for the word of 'arm' or 'nds' in the line, and then get the corresponding Analyzer class. BUG=b:111746842 BRANCH=none TEST=./extra/stack_analyzer/run_tests.sh Change-Id: I3acbfb199f762a4e89ea95f6254628871a5beb5d Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1174331 Commit-Ready: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Tested-by: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* stack_analyzer: EC stack analyzer for Andes instruction architecturetim2018-08-201-38/+194
| | | | | | | | | | | | | | | | | | | | | Add the related stack instructions analysis for Andes architecture to calculate stack frame sizes of functions and find the maximum calling path with maximum stack usage in stack analyzer tool. The second line in each disassembly will present this core architecture, so we can be looking for the word of 'arm' or 'nds' in the line and then get the corresponding Analyzer class. BUG=b:111746842 BRANCH=none TEST=make BOARD=${BOARD} SECTION=RO or RW analyzestack Change-Id: I8414920ddee97ce913519ef878f770e6e3118ef7 Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1174332 Commit-Ready: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Tested-by: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* usb_updater2: pretty print touchpad_infoWei-Han Chen2018-08-151-2/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | e.g. on whiskers, the command will behave like: > usb_updater2 -d 18d1:5030 --tp_info < ... < status: 0x00 < vendor: 0x0483 < fw_address: 0x80000000 < fw_size: 0x00020000 < allowed_fw_hash: < 20 0f eb 01 98 34 cf 86 8b 4e 94 1f 51 41 e7 64 < e1 0c 4f ac 88 bd 97 1c 79 ae c5 74 e3 0b 14 6d < id: 0x3936 < fw_version: 0x0011 < fw_fw_checksum: 0xb49f BRANCH=none BUG=b:70482333 TEST=manually on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: Iffe6720eec33cc57498cdab15ac2e132fdd76808 Reviewed-on: https://chromium-review.googlesource.com/1175506 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* sweetberry: format README, clarify detailsMengqi Guo2018-08-111-92/+138
| | | | | | | | | | | | | | Changing powerlog.README.md(orginally board.README) format to md. Adding details, making clarifications. BRANCH=None BUG=b:111318462 TEST=None Change-Id: Ic617d3da9518708560501be2786031dbd432ffe4 Signed-off-by: Mengqi Guo <mqg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1171503 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* Sweetberry: rename board.README to powerlog.README.mdMengqi Guo2018-08-101-0/+0
| | | | | | | | | | | | | | This CL only changes the file name. Next CL changes the file content. Separating into 2 CLs for easier diff. BRANCH=None BUG=b:111318462 TEST=None Change-Id: I8f8044e97b718270eb477dc29ba7e9e2c419db8c Signed-off-by: Mengqi Guo <mqg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1171599 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* cr50_rma_open: update for new open requirementsMary Ruthven2018-08-021-13/+71
| | | | | | | | | | | | | | | | | | | | Cr50 can only be opened from the AP and the device has to be in dev mode before open can be run. Update cr50_rma_open to require dev mode and run ccd open from the AP. 0.3.9 will have ccd in the prod image. Update the script, so it can enable testlab mode on prod images. BUG=none BRANCH=none TEST=run rma open process with 0.4.9 Change-Id: If14851a274233b471f8de86c9ed2a2b4808d131b Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1157182 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* stats_manager: more informative nan summary outputRuben Rodriguez Buchillon2018-08-012-1/+39
| | | | | | | | | | | | | | | | | Now for the formatted output string, if any value a domain is NaN, the domains gets tagged with a * and a help text gets added at the end of the summary to highlight this issue. CQ-DEPEND=CL:1140025 BRANCH=None BUG=chromium:806146, chromium:760267 TEST=unit tests added & pass Change-Id: I30791053bb1645065fa2bfd8305cc840a4a88031 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140032 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: accept_nan supportRuben Rodriguez Buchillon2018-08-012-16/+45
| | | | | | | | | | | | | | | | | | This CL introduces a flag to StatsManager that allows for 'NaN' values to be recorded inside StatsManager. The motivation here is that if a sample fails to record it might be more desirable to record a 'NaN' than to just skip the sample, to keep timelines correct, and to not hide errors in the test-run. Also adds necessary tests for that behavior. BRANCH=None BUG=chromium:806146, chromium:760267 TEST=unit tests still pass Change-Id: If17b7f52ba4a05e9e007c73bfa5d667fe36b74b3 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140031 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: add title banner pretty-printingRuben Rodriguez Buchillon2018-08-012-6/+33
| | | | | | | | | | | | | | If a title is supplied it now gets printed centralized on top of the summary when calling SummaryToString. BRANCH=None BUG=chromium:760267 TEST=unit tests are passing Change-Id: I7c59896ebac82d2ee7b632fd18350b9b4fff2c24 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140030 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: Avoid losing dataRuben Rodriguez Buchillon2018-08-012-5/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of multiple StatsManager, we might get data clobbered. That's particularly bad on long-running tests. This CL introduces two methods to make sure output files are unique in a directory. (1) on init, the user can supply a StatsManagerID (smid) that will be prepended to all output files. E.g. if the smid is 'ec' the summary will be stored at ec_summary.txt (2) should that fail because multiple StatsManagers are using the same smid supplied (or none were supplied) a simple file rotation is done where an integer suffix keeps getting incremented until the filename is unique. E.g. if summary.txt already exists, then summary1.txt will be created. This is not threadsafe at all so the user still have to use some caution to avoid clobbering their own data. BRANCH=None BUG=chromium:760267 TEST=unit tests still all pass Change-Id: I6cc083259362ee20e0242b94ac7cbb1228a06a7a Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140029 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: StatsManager returns file save locationsRuben Rodriguez Buchillon2018-08-012-19/+48
| | | | | | | | | | | | | | | | | Some test code currently duplicates knowledge by telling StatsManager where to save a file and then having to figure out where it stored the files again. This CL has StatsManager return the save locations to simplfy code. This potentially allows for informative logging on where information was stored. BRANCH=None BUG=chromium:760267 TEST=unit tests still pass Change-Id: I54b5873a4a3ddade9a73da0792c1947445759ad4 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140028 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: replace prefixes with flags in StatsManagerRuben Rodriguez Buchillon2018-07-313-51/+79
| | | | | | | | | | | | | | | | | | | | | | | | | StatsManager right now uses a '__' prefix to indicate that sample_msecs should be the first key in the summary. Additionally, there is a NOSHOW_PREFIX to potentially hide rails in the summary. This CL replaces that approach with constructor arguments to feed into the StatsManager what rails to hide, and the order to print a summary. This results in cleaner code, and less information leakage across classes as hiding & sorting becomes an implementation detail. It also adds two new unit tests to StatsManagerTest to verify this behavior works as intended. As a nit this CL also replaces AddValue with AddSample as Sample is more descriptive for the use-cases. BRANCH=None BUG=chromium:760267 TEST=manual testing, same output as before, and unittests still pass Change-Id: I52ca0d85c4600691fce8d4c74fd2a81fc4aa440f Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140027 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: remove expliting printing from stats_managerRuben Rodriguez Buchillon2018-07-313-62/+64
| | | | | | | | | | | | | | | | | | StatsManager is a library shared across some modules. It shouldn't print anything itself, but rather use logging & return a formatted summary that can be printed. Also take this opportunity to replace majority of explicit print calls in powerlog with logger module. BRANCH=None BUG=chromium:760267 TEST=manual testing, output as expected still for powerlog Change-Id: I0ed2ccaa45bbd1261119a1446110beadb075c1a2 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140026 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* stats_manager: prepare StatsManager to be a utility used in hdctoolsRuben Rodriguez Buchillon2018-07-274-34/+207
| | | | | | | | | | | | | | | | | | This is the first CL in a series of CLs to start using StatsManager in servo/hdctools (package depends on ec-devutils, as in this package). This CL: - beefs up StatsManager to handle unavailable units more gracefully - adds a few more tests to stats_manager_unittest.py - adds some minor unit testing for powerlog's file retrieval logic BRANCH=None BUG=chromium:760267 TEST=manual testing, unit tests still pass, powerlog still works Change-Id: Ifcdfcc482008484fbc21326c6f087ebf466c3e74 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1140025 Reviewed-by: Mengqi Guo <mqg@chromium.org>
* Revert "ec-devutils: update pyusb to 1.0.2"Nick Sanders2018-07-265-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7d26ae49bffcf269df82df7d0fee00e8c3341166. pyusb 1.0.2 fails under load and locks up the usb endpoint. BUG=b:111658037, chromium:865482 TEST=while RES=$(dut-control ec_uart_en spi1_buf_en ); do echo ${RES}; done CQ-DEPEND=CL:1149509 Original change's description: > ec-devutils: update pyusb to 1.0.2 > > Pyusb interface has changed yet again. Patch calls to get_string > and usb.core.find. Modify ordering of detetch kernel driver > and avoid rereferencing endpoints. > > BRANCH=None > BUG=b:110907544 > TEST=emerge ec-devutils, run powerlog, usb_console, servo_updater > > CQ-DEPEND=CL:1119632 > > Signed-off-by: Nick Sanders <nsanders@chromium.org> > > Change-Id: I33df474ce3bb57d2e11c9f384ac013b51d210843 > Reviewed-on: https://chromium-review.googlesource.com/1125354 > Commit-Ready: Nick Sanders <nsanders@chromium.org> > Tested-by: Nick Sanders <nsanders@chromium.org> > Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Bug: b:110907544 Change-Id: I04f015b4924e7fee76ab0f1734267e8e2d14faaa Reviewed-on: https://chromium-review.googlesource.com/1150963 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* ec-devutils: update pyusb to 1.0.2Nick Sanders2018-07-065-13/+24
| | | | | | | | | | | | | | | | | | | | Pyusb interface has changed yet again. Patch calls to get_string and usb.core.find. Modify ordering of detetch kernel driver and avoid rereferencing endpoints. BRANCH=None BUG=b:110907544 TEST=emerge ec-devutils, run powerlog, usb_console, servo_updater CQ-DEPEND=CL:1119632 Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: I33df474ce3bb57d2e11c9f384ac013b51d210843 Reviewed-on: https://chromium-review.googlesource.com/1125354 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* kevin/gru: remove board almost completelyJett Rink2018-06-211-5/+5
| | | | | | | | | | | | | | | | Kevin/Gru are running out of space and we already have another ARM board on ToT for development. Remove maintenance burden of keeping them around. BRANCH=none BUG=chromium:851512 TEST=build_packages --board=kevin works with dependent CLs. CQ-DEPEND=CL:1102565,CL:*640973,CL:*640974 Change-Id: Ie7c65c7799acc9f4d266e40b29b37240fec345c6 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1100011 Reviewed-by: Ilja H. Friedel <ihf@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* gsctool: support for enabling/disabling TPM.Namyoon Woo2018-06-211-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces '-m' or '--tpm_mode' flag, which either enables or disables TPM. (chroot) gsctool -m enable open_device 18d1:5014 found interface 3 endpoint 4, chunk_len 64 READY ------- (chroot) gsctool --tpm_mode disable open_device 18d1:5014 found interface 3 endpoint 4, chunk_len 64 READY ------- BUG=b:77543596 BRANCH=gsctool TEST=manually Signed-off-by: Namyoon Woo <namyoon@google.com> Change-Id: I2feb8c51d4343a49f2f5d43291c304e3ad140057 Reviewed-on: https://chromium-review.googlesource.com/1106295 Commit-Ready: Namyoon Woo <namyoon@chromium.org> Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* Script to convert board file to servod config .py file.Ravi Chandra Sadineni2018-06-191-0/+85
| | | | | | | | | | | | | Script to convert .board file (input to powerlog.py) into .py file which can be used to generate .xml configuration file for servod. BUG=none BRANCH=none TEST= convert a .board file to .py file and verify it works. Change-Id: Ia67d1552c048895efee10d7a92830cfa25a51984 Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1105479 Reviewed-by: Puthikorn Voravootivat <puthik@google.com>
* gsctool: --password does not take an argBrian Norris2018-06-151-1/+1
| | | | | | | | | | | | | It takes the password on a stdin prompt. BRANCH=none BUG=none TEST=build; `gsctool --help` Change-Id: Ic16cb288507028bde4983d07bb6ab8b541f4a55b Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1103014 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* cr50_rma_open: add support for new challenge formatMary Ruthven2018-06-141-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | We started printing the challenge as generated challenge: ABHNDKD4Q7P6KHTKPN9E7...full challenge instead of ABHND KD4Q7 P6KHT KPN9E 7FSQX P249S PCP64 LVA8S W4XCH 7PZX6 FVWN5 QTUSK U3KBJ HH7RQ SEE5T JX78X add support for extracting the challenge from both formats. BUG=none BRANCH=none TEST=try to open tot image, 0.4.7 image, and 0.3.4 image Change-Id: I99a81f1f78284b21777242d27edaa474a0f12367 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1088130 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* gsctool: fix '-F disable' error handlingMary Ruthven2018-06-111-2/+7
| | | | | | | | | | | | | | | | | | The FACTORY_DISABLE vendor command could return VENDOR_RC_INTERNAL_ERROR in which case the EC error code is included in the response payload. Print both errors if rv is nonzero and the response size is 1. BUG=none BRANCH=none TEST=run 'gsctool -a -F disable' and make sure the vc and ec errors are printed correctly. Change-Id: Idc75d6d809865f1f3b685ca775ffbef9f6a1d860 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1096103 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* rma_reset: print authcode even after key mismatchMary Ruthven2018-06-081-1/+7
| | | | | | | | | | | | | | | | | | | | | The point of rma_reset is to test cr50 authcode stuff. We want to make sure that cr50 doesn't accept test key authcodes when it is using prod keys. To test this we need to know the authcode that would be generated with test keys. When there is a unsupported keyid print the authcode so we can use that authcode to verify prod key cr50 wont accept test key authcodes. BUG=none BRANCH=none TEST=run rma_reset with a prod key challenge and make sure rma_reset still prints the authcode. Change-Id: Id1b0025ff7ab165d26be2b4e1503df7dee1d5ec7 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1091972 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* gsctool: add -B to override version sniffing.Marius Schilder2018-06-072-30/+40
| | | | | | | | | | | | | | | | | Not all boards that use gsctool use the cr50 versioning scheme. Add override option to detangle the version sniffing logic. Signed-off-by: mschilder@google.com BRANCH=none BUG=none TEST=cr53; gsctool w/o -B does not update to valid RW_A; with -B it does. Change-Id: I004fe85135ebb34fef500a3765cd026b44f2a164 Reviewed-on: https://chromium-review.googlesource.com/1090229 Commit-Ready: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* gsctool: add support for wp vendor commandMary Ruthven2018-06-071-4/+47
| | | | | | | | | | | | | | | Add gsctool support for getting the full wp setting from cr50. BUG=b:77543904 BRANCH=cr50 TEST=change wp and verify gsctool shows the correct setting Change-Id: I192b9f23651076cc30e3156223cc3fd0f43b0621 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1060642 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>
* gsctool: add factory mode commandMary Ruthven2018-05-311-13/+53
| | | | | | | | | | | | | | | | | | | | | We added a cr50 vendor command to control factory mode. This change adds gsctool support for using the command. gsctool -F [enable|disable] can be used to set factory mode. You can't use it to get the factory mode setting, because factory mode is indistinguishable from other forms of ccd. The regular ccd info can be used instead gsctool -I. BUG=b:77543904 BRANCH=cr50 TEST=none Change-Id: I715e296c323be20bab0b54a2f94a380b61f74cd2 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1069370 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: refactor rma mode into factory modeMary Ruthven2018-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We're doing a bit of refactoring to break out factory mode into its own file. Now factory reset and rma reset will be two methods of entering factory mode. Factory mode can be disabled with the disable_factory vendor command. Factory mode means all ccd capabilities are set to Always and WP is permanently disabled. When factory mode is disabled, all capabilities are reset to Default and WP is reset to follow battery presence. This adds 56 bytes. BUG=none BRANCH=cr50 TEST=verify rma reset will enable factory mode. Change-Id: I21c6f7b4341e3a18e213e438bbd17c67739b85fa Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1069789 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rma_reset: add p256 ECC optionVadim Bendebury2018-05-281-38/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds RMA shared secret generation support using the p256 curve. It is not a simple shoe in replacement for the x25519 because of a different key representations. This new code uses openssl library for all calculations. A new option is being added to indicate that p256 is supposed to be used, the new server Key ID value is used for p256, which allows to pick the correct curve when parsing the previously generated challenge. BRANCH=none BUG=b:73296606 TEST=verified that the same secret value is generated on the client and server side when using either x25519 or p256 curves. ./rma_reset -t ./rma_reset -c <challenge generated by the previous command> ./rma_reset -t -p ./rma_reset -c <challenge generated by the previous command> Change-Id: I9b21b5ae389480d92f0f663fbb846b0f27b15de1 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1073757 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rma_reset: prepare for expanding for p256 supportVadim Bendebury2018-05-261-60/+83
| | | | | | | | | | | | | | | | | | This is mostly a clean up and refactoring change, which will make it easier to extend rma_reset to supporting more EC curves. BRANCH=none BUG=b:73296606 TEST=verified that the same secret value is generated on the client and server side by running ./rma_reset -t ./rma_reset -c <challenge generated by the previous command> Change-Id: I15c010a4a62306bfaa56b97936318854b28a4945 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1073756 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rma_reset: allow building with debug optionsVadim Bendebury2018-05-261-2/+5
| | | | | | | | | | | | | | | When invoking make with DEBUG=1 add '-g -O0' to the compiler invocation to facilitate debugging with gdb. BRANCH=none BUG=b:73296606 TEST=verified that building with DEBUG=1 adds '-g -O0' to the compiler invocation. Change-Id: Idd80bd481091b91683200c78fe49dc7e9783a730 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1073755 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* servo_updater: add reboot flagNick Sanders2018-05-211-0/+4
| | | | | | | | | | | | | | This allows a reboot request regardless of whether update is required. BRANCH=servo BUG=b:69016505 TEST=servo reboots Change-Id: I2e8651e6ffa95c622aa0a8122d705d9ac8fbdd82 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1066988 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* servo_updater: allow local buildsNick Sanders2018-05-211-1/+1
| | | | | | | | | | | | | Updater regex allows local build versions as well. BRANCH=None BUG=b:69016431 TEST=update servo v4 Change-Id: I203aefff998ef5c69434187830c27431dbcc7dee Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1066989 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* servo_updater: support old and new updaterNick Sanders2018-05-112-5/+65
| | | | | | | | | | | | | | | | | | | Add support for usb_updater2 in servo_updater. This allows update back and forth between servo-9040.B releases and builds from master, although they have different updater enpoint interfaces. Also add '-n' no force reboot to usb_updater2 as force reboot is incompatible with servo_updater's flow. BRANCH=None BUG=b:69016431 TEST=update servo v4 Change-Id: I18809590c2e7e1cfcf60c4c97e956dfc22d85856 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1056157 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* usb_updater2: match by serial numberNick Sanders2018-05-101-8/+70
| | | | | | | | | | | | | | | Add a serial number match to allow update of servo or other usb devices, where mutliple devices may be attached to one system. BRANCH=None BUG=chromium:718688 TEST=usb_updater2 -d 18d1:501b --serial=[C1706311869|fail] Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: Id6ec944139e685948433af703555fd185e91a9d4 Reviewed-on: https://chromium-review.googlesource.com/1050971 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* powerlog: allow port & addr in the .board fileRuben Rodriguez Buchillon2018-05-101-2/+6
| | | | | | | | | | | | | | | | | Allow board & addr in the board file instead of channel, to make board file creation and configuration simpler. This is part of the efforts in the BUG to make sweetberry under chrome os simpler to use. In that case, we allow now (with crrev.com/c/1051215) to generate .board files using explicit pin and bank numbers (j2,j3,j4). BRANCH=None BUG=chromium:806148 TEST=manual test, works fine. Change-Id: I6fd3bb1a4a5ffffee08b81625ecb190adceeb2e7 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1051212 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* cr50_rma_open: add support for testlab modeMary Ruthven2018-05-041-0/+87
| | | | | | | | | | | | | | | | | | Devices going into the testlab should have testlab mode enabled if possible. Add support for enabling testlab mode on prepvt images. BUG=none BRANCH=none TEST=make sure script complains when testlab mode isn't enabled on prepvt image and passes ok when testlab mode isn't enabled on prod images. Run testlab enable to make sure it works. Change-Id: I623cac192fed31241d08a9d25e46e705cbbeb908 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1040357 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* sweetberry: Make resetting USB interface more forgivingPuthikorn Voravootivat2018-05-031-9/+9
| | | | | | | | | | | | | | | | Currently, sweetberry ocassionally throws Exception when resetting the USB interface. This CL mitigates that by - Use linearly back off algorithm with 10ms delay increment before next reset attempt to avoid flooding the sweetberry hardware with reset requests. - Increase retry amount from 10 to 100 BUG=chromium:834252 TEST=No "Exception: ('Power', 'Failed to reset')" seen Change-Id: Iaf039cb82760205d1747fd630387852b7cfd8f83 Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1038788
* cr50_rma_open: add support for checking prepvt and prod versionsMary Ruthven2018-05-021-4/+11
| | | | | | | | | | | | | | | | | | | RMA support through the cr50 console is only a part images starting with 0.4.5. Check that the prepvt version is greater than or equal to 0.4.5. Versions 0.4.4 are greater than the prod version 0.3.3, but you can't use it to do RMA open through the console. It can only be done through the AP. BUG=none BRANCH=none TEST=none Change-Id: I7e08cc5dbc9f910686ea5917be755170c0587ee4 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1040356 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* gsctool: add verbose mode command line optionVadim Bendebury2018-05-021-1/+7
| | | | | | | | | | | | | | | The new command line option is not used yet, it allows to set a flag which would allow control verbose debug output in the future. BRANCH=none BUG=none TEST=verified that -V command line option shows up in --help output and is accepted. Change-Id: Ie7becdb9c6964f7bb75e9917a02594d50c3c2693 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1036742 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* gsctool: add version command line optionVadim Bendebury2018-05-023-4/+26
| | | | | | | | | | | | | | | | | Use the same script the rest of the EC codebase uses to generate the version string. BRANCH=none BUG=none TEST=built the new image and tried: $ ./extra/usb_updater/gsctool -v Version: v1.1.8258+6097a64f0, built on 2018-05-01 17:04:14 by ... Change-Id: I63d2411872bbd38188f66f51b7ca8508fc74fa8f Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1036741 Reviewed-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* sweetberry: fix stats_manager and refactorMengqi Guo2018-04-274-41/+149
| | | | | | | | | | | | | | | | | | | | | | This CL updates stats_manager to match the new functionalities in powerlog.py and refactors powerlog.py to more easily find config files and print timestamps in seconds since epoch. The unit test for stats_manager is also updated accordingly. BUG=b:72973433 BRANCH=None TEST=powerlog -b nami_rev0_loc.board -c nami_rev0_loc.scenario \ --print_stats --save_stats /tmp --save_stats_json /tmp \ --save_raw_data /tmp --mW and looking at the printed data python -m unittest stats_manager_unittest CQ-DEPEND=CL:1003522 Change-Id: Ic6e4aadfcd3ad245572788094ee3d3a30106044c Signed-off-by: Mengqi Guo <mqg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1002546 Reviewed-by: Todd Broch <tbroch@chromium.org>
* cr50_rma_open: add servod supportMary Ruthven2018-04-241-3/+50
| | | | | | | | | | | | | | | | | Add support for finding the cr50 uart given a servo port or being given a servo console using -d. If servod is using ccd to run, we need to do ccd_reset after the authcode reboot. Add support for that as well. BUG=none BRANCH=none TEST=none Change-Id: I972ce60a2e67cc68b604d550579fb2e99db8ac08 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1025267 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* cr50_rma_open: check write protect tooMary Ruthven2018-04-191-36/+100
| | | | | | | | | | | | | | | | | | Cr50 RMA Open will disable write protect. Make sure it is disabled. If it isn't, manually disable write protect after rma_auth. If cr50 reboots or loses write protect, cr50_rma_open can now be used to force disable it again with cr50_rma_open -w. BUG=none BRANCH=none TEST=none Change-Id: I096cff51ae20b8a4cfbfa92892a011ff48f4cc49 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1016023 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* gsctool: add support for CCD infoVadim Bendebury2018-04-101-10/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new option allows to retrieve CCD information from the device. It is reported similar to the way it is reported on the Cr50 console with a few deviations: - current capability setting is spelled out (instead of stating that it is at default); - default capability setting is reported only if it is different from the current value. - a bitmap of enabled capabilities is added in the end for ease of verifying CCD state during factory process. BRANCH=cr50, cr50-mp BUG=b:72718383 TEST=ran the command on a Coral device: $ gsctool -a -I State: Locked Password: None Flags: 000000 Capabilities, current and default: UartGscRxAPTx Y Always UartGscTxAPRx Y Always UartGscRxECTx Y Always UartGscTxECRx - IfOpened FlashAP - IfOpened FlashEC - IfOpened OverrideWP - IfOpened RebootECAP - IfOpened GscFullConsole - IfOpened UnlockNoReboot Y Always UnlockNoShortPP Y Always OpenNoTPMWipe - IfOpened OpenNoLongPP - IfOpened BatteryBypassPP Y Always UpdateNoTPMWipe Y Always I2C - IfOpened FlashRead Y Always CCD caps bitmap: 0x16607 - then took the device through 'ccd open' sequence and tried again, observed that all capabilities were set to 'Y' and caps bitmap was set to 0x1ffff. - then on the Cr50 console modified UnlockNoShortPP capability to be set 'UnlessLocked', ran the command again, observed the default value (Always) reported. - locked the CCD on Cr50 console, ran the command one more time: $ gsctool -a -I State: Locked Password: None Flags: 000000 Capabilities, current and default: UartGscRxAPTx Y Always UartGscTxAPRx Y Always UartGscRxECTx Y Always UartGscTxECRx - IfOpened FlashAP - IfOpened FlashEC - IfOpened OverrideWP - IfOpened RebootECAP - IfOpened GscFullConsole - IfOpened UnlockNoReboot Y Always UnlockNoShortPP - UnlessLocked (Always) OpenNoTPMWipe - IfOpened OpenNoLongPP - IfOpened BatteryBypassPP Y Always UpdateNoTPMWipe Y Always I2C - IfOpened FlashRead Y Always CCD caps bitmap: 0x16207 Change-Id: I0fd5e6bd9402ae518e3f2a3ed82589f8696dfd44 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/999826 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* extra: add cr50 rma open utilityMary Ruthven2018-04-051-0/+376
| | | | | | | | | | | | | | | | | | | | | | | The testlab will be running rma open on a bunch of devices. This change adds a script for them to use. The script handles things like finding the cr50 console and converting the rma_auth output into a full challenge url. The user can click on the url and generate the authcode. They can input the generated authcode back into the script. The script will check 'ccd' output to make sure rma open succeeds. BUG=none BRANCH=none TEST=on a reef and bob running 3.4, run the entire cr50_rma_open process. Verify RMA open succeeds Change-Id: I2c9aef565351b65848f29083cd1e2c1f6e77e2a4 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/994417 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* gsctool: always use BOARD set to cr50Vadim Bendebury2018-04-021-2/+2
| | | | | | | | | | | | | | | | | | | There is no point in allowing the environment to override board name when building gsctool, it requires BOARD to be set to cr50 to build properly. And usb_updater2 does not really care about the board at all. BRANCH=none BUG=none TEST='make -C extra/usb_updater now succeeds even if BOARD is set in the environment. Change-Id: I1ed16b8049f4d5936bb29585bb65718ed865d6b5 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/972365 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Nick Vaccaro <nvaccaro@chromium.org>
* sweetberry: add current and voltage loggingNick Sanders2018-03-284-27/+112
| | | | | | | | | | | | | | | | | | | | | This adds a config to specify whether sweetberry should measure power, current, voltage per powerlog entry. The json format is slightly revised to allow data type per channel. powerlog and sweetberry fw are updated to handle the new functionality. BUG=b:72973433 BRANCH=None TEST=./powerlog.py -b marlin.board -c marlin_a.scenario -s .5 Signed-off-by: Nick Sanders <nsanders@chromium.org> Change-Id: I231fc6600495146fad30583872bf14c660d5a50b Reviewed-on: https://chromium-review.googlesource.com/905427 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Mengqi Guo <mqg@chromium.org>
* rma_reset: fix ignored return value errorMary Ruthven2018-03-221-1/+6
| | | | | | | | | | | | | | | | | | The fread return value was ignored in rma_reset.c. This caused clang compilation to fail. This change checks the return value. BUG=b:76105747 BRANCH=none TEST=clang compilation no longer fails Change-Id: I710b367008b2e17a94c875ea3eae92bcc75546b0 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/976555 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* rma_reset: update Makefile to use different compiliersMary Ruthven2018-03-221-5/+6
| | | | | | | | | | | | | BUG=b:76105747 BRANCH=none TEST=compile for bob and reef. make sure it runs on both Change-Id: I30004c9794c9619698889fecbf8746778ebbb48c Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/976554 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* stack_analyzer: Add new syntax for function pointer arraysNicolas Boichat2018-03-193-14/+187
| | | | | | | | | | | | | | Makes it far simpler to support hooks, console commands, host commands. BRANCH=poppy,fizz BUG=chromium:648840 TEST=Add new array annotation, run stack_analyzer Change-Id: I8ed074ba5534661ed59f4f713bb4ba194e712f4e Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/966042 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>