summaryrefslogtreecommitdiff
path: root/fuzz
Commit message (Collapse)AuthorAgeFilesLines
* Reland "Use third_party boringssl for AES"Yi Chou2023-04-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of commit 6fa9cc0c7484be908010a6acdd6547d686234e34 Original change's description: > Use third_party boringssl for AES > > The original boringssl copy is not maintainable in the long term. > We should build it from the upstream version. > > BUG=b:248508087, b:273639386 > TEST=make runhosttests -j > TEST=make buildall -j > BRANCH=none > > Signed-off-by: Yi Chou <yich@google.com> > Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> BUG=b:248508087, b:273639386 TEST=make runhosttests -j TEST=make buildall -j BRANCH=none Force-Relevant-Builds: all Change-Id: I2bf9e2157eec030ec3526939846a5706b1954afd Signed-off-by: Yi Chou <yich@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4464659 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Revert "Reland "Use third_party boringssl for AES""Jonathon Murphy2023-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0164feeebaad4abc7deb510c57ca0707dd2babb1. Reason for revert: Breaks postsubmit b/279174496 Original change's description: > Reland "Use third_party boringssl for AES" > > This is a reland of commit 6fa9cc0c7484be908010a6acdd6547d686234e34 > > Original change's description: > > Use third_party boringssl for AES > > > > The original boringssl copy is not maintainable in the long term. > > We should build it from the upstream version. > > > > BUG=b:248508087, b:273639386 > > TEST=make runhosttests -j > > TEST=make buildall -j > > BRANCH=none > > > > Signed-off-by: Yi Chou <yich@google.com> > > Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 > > Reviewed-by: Tom Hughes <tomhughes@chromium.org> > > BUG=b:248508087, b:273639386 > TEST=make runhosttests -j > TEST=make buildall -j > BRANCH=none > > Signed-off-by: Yi Chou <yich@google.com> > Cq-Depend: chromium:4439330 > Change-Id: Ic22faafacaf331a1376d094a37c6efe271326d0b > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4439569 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> Bug: b:248508087, b:273639386 Change-Id: I5cfb826bff10df55bbadf76c6cc2062bc761a6d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4456117 Commit-Queue: Jonathon Murphy <jpmurphy@google.com> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Auto-Submit: Jonathon Murphy <jpmurphy@google.com> Reviewed-by: Jonathon Murphy <jpmurphy@google.com> Tested-by: Jonathon Murphy <jpmurphy@google.com> Owners-Override: Jonathon Murphy <jpmurphy@google.com>
* Reland "Use third_party boringssl for AES"Yi Chou2023-04-211-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of commit 6fa9cc0c7484be908010a6acdd6547d686234e34 Original change's description: > Use third_party boringssl for AES > > The original boringssl copy is not maintainable in the long term. > We should build it from the upstream version. > > BUG=b:248508087, b:273639386 > TEST=make runhosttests -j > TEST=make buildall -j > BRANCH=none > > Signed-off-by: Yi Chou <yich@google.com> > Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> BUG=b:248508087, b:273639386 TEST=make runhosttests -j TEST=make buildall -j BRANCH=none Signed-off-by: Yi Chou <yich@google.com> Cq-Depend: chromium:4439330 Change-Id: Ic22faafacaf331a1376d094a37c6efe271326d0b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4439569 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Revert "Use third_party boringssl for AES"Yi Chou2023-04-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6fa9cc0c7484be908010a6acdd6547d686234e34. Reason for revert: break the build of chromeos-base/chromeos-fpmcu-unittests. Original change's description: > Use third_party boringssl for AES > > The original boringssl copy is not maintainable in the long term. > We should build it from the upstream version. > > BUG=b:248508087, b:273639386 > TEST=make runhosttests -j > TEST=make buildall -j > BRANCH=none > > Signed-off-by: Yi Chou <yich@google.com> > Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> Bug: b:248508087, b:273639386 Change-Id: Ie6acdab0be298625229b69eb9ac3ff5fd196387c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4439430 Commit-Queue: Yi Chou <yich@google.com> Owners-Override: Yi Chou <yich@google.com> Reviewed-by: Howard Yang <hcyang@google.com> Tested-by: Yi Chou <yich@google.com>
* Use third_party boringssl for AESYi Chou2023-04-181-2/+1
| | | | | | | | | | | | | | | The original boringssl copy is not maintainable in the long term. We should build it from the upstream version. BUG=b:248508087, b:273639386 TEST=make runhosttests -j TEST=make buildall -j BRANCH=none Signed-off-by: Yi Chou <yich@google.com> Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fp_sensor_mock: Rename fp_sensor_mockBobby Casey2023-04-061-1/+1
| | | | | | | | | | | | | | | | | Rename fp_sensor_mock files to fpsensor_mock to be consistent with other file names. This helps avoid issues with scripts using pattern matched filenames, such as util/migrated_files.sh. BRANCH=none BUG=none TEST=compare_build.sh -b fp => MATCH TEST=make BOARD=bloonchipper tests TEST=make BOARD=dartmonkey tests Change-Id: I6f7e213cbf72a59cfd5994c66dc7b93ea44c6505 Signed-off-by: Bobby Casey <bobbycasey@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4334695 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* brask,coachz,constitution,kuldax,redrix: add board_get_pchg_count()ben chen2023-02-151-1/+5
| | | | | | | | | | | | | | | | | | implement board_get_pchg_count() to determined pchg_count at runtime. BUG=b:267700817 BRANCH=None TEST=make BOARD PASS TEST=make run-pchg_fuzz PASS Cq-Depend:chromium:4218552 Cq-Depend:chromium:4248459 Change-Id: Ic14a841132c732f30887b4e3ef8e7f7a8c8728ae Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4248823 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Derek Huang <derekhuang@google.com>
* TCPM: Separate Discovery into its own moduleDiana Z2023-02-071-0/+2
| | | | | | | | | | | | | | | | | | | | Discovery can be a separate feature from DFP mode entry, as any data role can run discovery in PD 3.0. Additionally, boards may want to enable discovery separate from full EC mode entry so put this feature behind a new CONFIG indicating its scope. BRANCH=None BUG=b:266714542 LOW_COVERAGE_REASON=only moving functions to a new file, b/267964449 filed to track expanding the testing of these functions later TEST=./twister -T ./zephyr/test, run on both nipperkin (ECOS) and skyrim (zephyr) to confirm cable and device identities are being reported correctly Change-Id: I84a08eaf4775ed427112d62777ff38f8a914a750 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4211268 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Gate DP module support on a CONFIGDiana Z2023-02-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Add a CONFIG option to gate DP mode support within the embedded controller. By default, turn the DP module off if the AP is controlling the VDMs for mode entry. For modules which do not implement the DP config option, the header now defines stubs for DP specific functions to use. This obsoletes some of the stub functions from older unit tests. BRANCH=None BUG=b:266714542 TEST=on skyrim, compile with DP disabled and observe 3162 bytes saved, run zmake compare-builds -a and util/compare_build.sh -b all, ./twister -T ./zephyr/test passes (note: ECOS compare builds needed all assert statements removed to pass, as they grab the line number, zephyr compare builds passed before HC mode entry was revamped) Change-Id: I9619eb5d34e418f1972c4bf16d4cf9c8d551eac5 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4201454 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* fuzz: Sort header filesJeremy Bettis2022-11-224-7/+8
| | | | | | | | | | | | | | | | | | | | | | Sort all includes in fuzz with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j$(nproc) buildall_only runtests TEST=zmake compare-builds Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I9c9170f9ffa1b56e692ba74205250b1be234c70e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4047098 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Tristan Honscheid <honscheid@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* test/usb_pd_fuzz: Fix the done_cond race conditionsYi Chou2022-11-081-0/+11
| | | | | | | | | | | | | | | | We should lock the mutex before using the condition variable, and init/destroy them correctly. BRANCH=none BUG=b:258086787 TEST=make -j buildfuzztests && \ ./build/host/usb_pd_fuzz/usb_pd_fuzz.exe > /dev/null Signed-off-by: Yi Chou <yich@google.com> Change-Id: I0c5a601d1496ea6b70341c6849230a440d836d82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4011647 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* test: usb_mux: Split struct usb_mux in testsTomasz Michalec2022-09-131-3/+9
| | | | | | | | | | | | | | | | Update tests to use new struct usb_mux_chain. BUG=b:236274003 TEST=make buildall BRANCH=None Cq-Depend: chromium:3748785 Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I2d01d35d1155a6cdec558bedf06b09e0b00aa642 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3780413 Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-1213-13/+13
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* tree-wide: const-ify argv for console commandsCaveh Jalali2022-09-013-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This updates the API for console commands from "int cmd(int argc, char **argv)" to "int cmd(int argc, const char **argv)" which is more accurate and in line with common convention. BRANCH=none BUG=b:244387210 TEST="make buildall" passes TEST="zmake build -a" passes TEST="util/compare_build.sh -b all" passes TEST="./twister -v -T zephyr/test" passes Cq-Depend: chrome-internal:4960125 Cq-Depend: chrome-internal:4959932 Change-Id: I57de9f35b85b8f3c7119df36aefb2abf25d2625f Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3863941 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* util: remove unused includesYuval Peress2022-08-051-0/+1
| | | | | | | | | | | | | | | | Remove these includes as they're not needed in this header. Instead, the includes should go where they're actually being used. BRANCH=none BUG=b:240574048 TEST=make buildall -j TEST=zmake build -a Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I64b10af3216654b2a20caa1cabd267661a0bca39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3791980 Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Tristan Honscheid <honscheid@google.com>
* tree: Remove HIDE_EC_STDLIBTom Hughes2022-07-193-3/+0
| | | | | | | | | | | | | | HIDE_EC_STDLIB is no longer needed now that the stdlib code has been separated out from the EC code. BRANCH=none BUG=b:234181908 TEST=make runfuzztests Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Id47327c5061239b97b2e2f82791719f01b4e9ad8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3750109 Reviewed-by: Keith Short <keithshort@chromium.org>
* tree: Remove non-standard "%ph" printf formatTom Hughes2022-07-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The non-standard "%ph" format is replaced with snprintf_hex_buffer and then using "%s" to print the resulting buffer. Using standard format specifiers makes it easier to switch between the "builtin" EC standard library and the C standard library provided by the toolchain (or Zephyr). BRANCH=none BUG=b:238433667, b:234181908 TEST=Enable CONFIG_CMD_RAND in nocturne_fp/board.h On icetower v0.1 with servo_micro and J-Trace: Before change: > rand rand 8ab8b15090ca5ae83bdad671c906d51a5f2b98a359a4106054ee6b54a4087190 After change: > rand rand 2a8645235a31936a28b8d1b9c4948f46d39662e7fcb10a185ddb14c6a998e2eb Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I3bff928d32579440d7cdb27a75899e45159accfb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3759123 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* fuzz/fuzz_config.h: Format with clang-formatJack Rosenthal2022-07-011-6/+6
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I3883c53b1905ab400f386cc2950e4a8e5d4859dd Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730192 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* fuzz/span.h: Format with clang-formatJack Rosenthal2022-07-011-32/+60
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I4838e507f8714cab66d3433306a18fd835cc93b2 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730195 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* fuzz/usb_pd_fuzz.c: Format with clang-formatJack Rosenthal2022-06-301-36/+61
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I874ce723b01c447c44c71ff5dbe6f80ccf851ddd Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730196 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* fuzz/pchg_fuzz.c: Format with clang-formatJack Rosenthal2022-06-291-6/+5
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Iaf95eadbb1d8ed2b18166ef3be1a6f765c4bd4f9 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730194 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* fuzz/host_command_fuzz.c: Format with clang-formatJack Rosenthal2022-06-281-4/+4
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I0ec90481e49630d114f20efd0ccf1e73c03dd83c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730193 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* tree: Files should end with single newlineTom Hughes2022-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes additional files not included in https://crrev.com/c/3229797 by running the following: for f in $(find . -name '*.mk'); do printf '%s\n' "$(cat ${f})" > ${f}; done for f in $(find . -name '*.S'); do printf '%s\n' "$(cat ${f})" > ${f} done BRANCH=none BUG=b:172020503, b:234181908 TEST=./util/compare_build.sh -b all -j 120 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ib4e4d0e74bf3b00a0b2c81505fef65e2c1b7401f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3705766 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* fuzz: Stop mixing decl + initializationManoj Gupta2022-02-281-4/+3
| | | | | | | | | | | | | | | | | | | Initialization with dec is supported only in C99 mode which EC code is apparently not. Fixes error with newer clang: 'mixing declarations and code is incompatible with standards before C99' BUG=b:221860687 TEST=emerge chromeos-ec BRANCH=none Change-Id: Iefe0f1445389de9dfab60dfbaf805d4de1b4165b Signed-off-by: Manoj Gupta <manojgupta@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3495868 Tested-by: Manoj Gupta <manojgupta@chromium.org> Auto-Submit: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* tree: Files should end with single newlineTom Hughes2021-10-182-2/+0
| | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes all files by running the following: for f in $(find . -name '*.[ch]'); do printf '%s\n' "$(cat ${f})" > ${f}; done BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia3ece5b64b549d21ca11708791368002bb6e9b0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229797 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-311-1/+1
| | | | | | | | | | | | | | | As a followup to CL:3104290, give the TCPCI TRANSMIT and RX_BUF_FRAME_TYPE types more consistent names. Most of them can be used for receiving, not just transmitting. Fix lint errors thus revealed. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I399ec479eacc18622fc4d3f55f8bdabf4560fcff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3125995 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPM: Rename enum tcpm_transmit_typeAbe Levkoy2021-08-181-2/+3
| | | | | | | | | | | | | | | Rename tcpm_transmit_type to tcpm_sop_type to reflect that it can be used for Rx as well. Describe it in comments. This prepares to consolidate enum pd_msg_type into this enum. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ife97d4ad51c48f2e832b94e007954919e236a309 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104290 Reviewed-by: Keith Short <keithshort@chromium.org>
* pchg_fuzz: Ignore too large inputDaisuke Nojiri2021-06-231-3/+5
| | | | | | | | | | | | | | | | | | This patch makes test_fuzz_one_input return immediately if the input data is larger than the buffer size (of the harness). This patch also makes the test include the message header size to compute the input buffer size so that it can properly process MAX_MESSAGES messages. BUG=b:191868799, b:190841496 BRANCH=None TEST=make run-pchg_fuzz Change-Id: Ifb51e989fe62bfce79da713b3f612c080c9c19de Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2983717 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* PCHG: Acquire lock before wait/signal pthread conditionDaisuke Nojiri2021-06-181-0/+8
| | | | | | | | | | | | | | | | This patch makes test_fuzz_one_input acquire a lock before waiting on done_cond and makes irq_task acquire a lock before signaling done_cond. Otherwise, undefined behavior would result. BUG=b:190841496, chromium:1221266 BRANCH=trogdor TEST=make run-pchg_fuzz TEST=pchg_fuzz.exe -seed=1 -runs=1000000 -dict=fuzz/pchg_fuzz.corpus Change-Id: Ic5572bae7c8764d44a7872869c5f8e9b4503280b Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2971867 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* PCHG: Fuzz PCHG and ctn730 driverDaisuke Nojiri2021-06-175-1/+167
| | | | | | | | | | | | | | | | This patch adds a fuzz test for PCHG and ctn730 driver. With the given corpus, the test currently reaches all the normal mode states. BUG=b:190841496 BRANCH=trogdor TEST=make run-pchg_fuzz TEST=pchg_fuzz.exe -seed=1 -runs=1000000 -dict=fuzz/pchg_fuzz.corpus Change-Id: I6eedbbbdbf3396dfa2b98ca302e16d142ea251d5 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2956076
* Revert "fpsensor: Support building firmware that works for both sensors"Tom Hughes2021-04-071-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ac08c9d1dbc9f587df3ee6b15d58c0203f7e356e. Reason for revert: Breaks public build Original change's description: > fpsensor: Support building firmware that works for both sensors > > This is a refactoring to allow building FPMCU firmware that works for > one FPC sensor and one ELAN sensor. > > 1. When both drivers implement our common functions, e.g. fp_sensor_init(), > rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). > 2. There are a few functions implemented not in FPC driver but in FPC > private library, e.g. fp_sensor_finger_status(). I kept this as-is for > FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() > 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c > because the sensor type GPIO always says FPC. > > BRANCH=none > BUG=b:175158241 > TEST=make run-fpsensor; make run-fpsensor_status; > make run-fpsensor_crypto > TEST=make -j BOARD=dartmonkey > TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; > make -j BOARD=bloonchipper > Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) > TEST=run device tests with http://crrev/c/2750547 and > http://crrev/i/3654297 on Dragonclaw, all pass > > Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 > Signed-off-by: Yicheng Li <yichengli@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> > Commit-Queue: Tom Hughes <tomhughes@chromium.org> Bug: b:175158241, b:184616069 Change-Id: I2a02a6eefc316e7e13aa188f1ae16672dce2babd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809521 Auto-Submit: Tom Hughes <tomhughes@chromium.org> Tested-by: Tom Hughes <tomhughes@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: caveh jalali <caveh@chromium.org>
* fpsensor: Support building firmware that works for both sensorsYicheng Li2021-04-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a refactoring to allow building FPMCU firmware that works for one FPC sensor and one ELAN sensor. 1. When both drivers implement our common functions, e.g. fp_sensor_init(), rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). 2. There are a few functions implemented not in FPC driver but in FPC private library, e.g. fp_sensor_finger_status(). I kept this as-is for FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c because the sensor type GPIO always says FPC. BRANCH=none BUG=b:175158241 TEST=make run-fpsensor; make run-fpsensor_status; make run-fpsensor_crypto TEST=make -j BOARD=dartmonkey TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; make -j BOARD=bloonchipper Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) TEST=run device tests with http://crrev/c/2750547 and http://crrev/i/3654297 on Dragonclaw, all pass Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
* TCPMv1/v2: Move SOP' enabling to tcpm_set_vconnEric Herrmann2021-03-041-0/+8
| | | | | | | | | | | | | | | | | Currently SOP' enabling is done as part of the TCPCI driver when vconn is set - however if we aren't using VCONN from the TCPC, we need to enable SOP' separately. So, instead of enabling it in the TCPCI driver, enable it in the general TCPM set VCONN function. BUG=b:181692098,b:181691263,b:173459141 TEST=Make sure cable discovery works TEST=make buildall BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: Iecc06760f2b8af588c427b9565c6aa31ee719edf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2733574 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* config: Make VCONN Swap delay a documented optionAbe Levkoy2021-01-221-2/+2
| | | | | | | | | | | | | | | | | | | | | Replace PD_VCONN_SWAP_DELAY with CONFIG_USBC_VCONN_SWAP_DELAY_US. This is the approximate result of the following command, run from platform/ec: find . -type f -\( -name '*.c' -o -name '*.h' -\) | \ xargs sed -iE 's/PD_VCONN_SWAP_DELAY/CONFIG_USBC_VCONN_SWAP_DELAY/g' Fix some latent formatting errors in usb_pd_protocol.c, because they were preventing pre-upload hooks from passing. BUG=b:144165680 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Icaf3b309c08fdcd162e960cf5dc88185016b5d2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628131 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* TCPMv2: Update source-out configsDiana Z2020-12-241-0/+2
| | | | | | | | | | | | | | | | | | | | Now that the DPM will be handling source-out decisions for TCPMv2, remove references to its old configuration options from TCPMv2 boards in order to avoid any confusion as to what code is running now. Also remove the charge manager notifications of sink attach/detach since the policy is being centralized into the DPM. Note that the previous configuration options only ever allocated one 3.0 A port, and so the default number of 3.0 A ports has been set to 1. BRANCH=None BUG=b:168862110,b:141690755 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie452e3da32b04226503539daa67b6b9f4a58aa58 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597431 Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpm: Move tcpm.h into an include directorySimon Glass2020-12-221-1/+1
| | | | | | | | | | | | | | | | | | This header file is used from quite a few files, relying on the EC build system to find includes in the driver/tcpm directory. For Zephyr we don't want to add that as an include. It makes more sense for header files to be in an include directory, so move it and fix up the users. BUG=b:175434113 BRANCH=none TEST=build Zephyr and ECOS on volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I5851914b1a7d3fdc1ba911c0fbe9046afbaf6f5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597985 Reviewed-by: Keith Short <keithshort@chromium.org>
* task_set_event: remove the wait argumentDawid Niedzwiecki2020-12-142-7/+6
| | | | | | | | | | | | | | | | | | | | There is an option in the task_set_event function which force the calling task to wait for an event. However, the option is never used thus remove it. This also will help in the Zephyr migration process. BUG=b:172360521 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* Fix use of int const in size of array.Luis Lozano2020-11-231-1/+1
| | | | | | | | | | | | | | | Compiler complains about this use of a GNU extension now. Replace by a #define. BUG=chromium:1151317 BRANCH=None TEST=to be done Change-Id: Ib7fdd038f761bb4b27e9eeca5de9e3d0ec5f0f79 Signed-off-by: Luis Lozano <llozano@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2553749 Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
* tcpm: Change the get_chip_info() to prevent race conditionsWai-Hong Tam2020-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original get_chip_info() returns a point of point to the chip_info. This way helps to cache the chip_info to a static variable and the function just returns the pointer to the static variable. This static variable has a race condition on the PS8805 chip. The PS8805 chip returns a different PID when the firmware is corrupted, i.e. 0x8803 instead of 0x8805. The !live case fixes the PID, by modifying the static variable directly. When another task calls the same function for the live case, the static variable is modified and has a race condition. This change fixes the issue by changing the get_chip_info() parameter to a point of the chip_info. The caller has to allocate a buffer in the stack and pass the address to the function. For the !live case, the function copies the cache value from the static variable to the buffer. So the static variable doesn't have a race condition. BRANCH=None BUG=b:159588335 TEST=Used ectool to check the PD chip PID 0x8805 (was 0x8803). localhost ~ # ectool pdchipinfo 1 vendor_id: 0x1da0 product_id: 0x8805 device_id: 0x1 fw_version: 0x0 min_req_fw_version: 0x0 Change-Id: Ic24615af77ea58016d286480572d2a282c4fa09a Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2264477 Reviewed-by: Julius Werner <jwerner@chromium.org>
* test: Pass commandline arguments to run_testTom Hughes2020-05-302-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | run_test is called by the "runtest" console command. Console commands can take arguments, so pass along the arguments to run_test to allow parameters to be passed to run_test. The following command was used for automatic replacement: git grep --name-only 'void run_test(void)' |\ xargs sed -i 's#void run_test(void)#void run_test(int argc, char **argv)##' BRANCH=none BUG=b:155897971 TEST=make buildall -j TEST=Build and flash flash_write_protect test > runtest 1 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ib20b955d5ec6b98f525c94c24aadefd7a6a320a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2209418 Reviewed-by: Yicheng Li <yichengli@chromium.org> Commit-Queue: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org>
* TCPMv2: Only include PD3.0 functionality when CONFIG_USB_PD_REV30Sam Hurst2020-05-218-5/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | The TCPMv2 stack defaults to PD2.0 functionality. Defining CONFIG_USB_PD_REV30 enables PD3.0 functionality. BUG=b:155879504 BRANCH=none TEST=make -j buildall Manual tests: passed FAFT_PD running on kohaku Before patch: *** 18624 bytes in flash and 29216 bytes in RAM on kohaku RO **** *** 18544 bytes in flash and 29216 bytes in RAM on kohaku RW **** After patch: *** 23320 bytes in flash and 30336 bytes in RAM on kohaku RO **** *** 23228 bytes in flash and 30336 bytes in RAM on kohaku RW **** Flash savings of 4696 bytest Ram savings of 1120 Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I082cf62617a91b487d2d3567afd5e340bd52258c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2184547 Reviewed-by: Jett Rink <jettrink@chromium.org>
* tcpc: change name of get_vbus_level to check_vbus_levelDenis Brockus2020-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | this is to add near future functionality to allow not only the current PRESENT range check but to add Save0V range checking as well, for platforms that allow for this. This just lays the framework and is functionally equivalent. BUG=none BRANCH=none TEST=verify basic USB functionality Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I1eb3411bc3aa9b792c9b97799e1721e5cb229f64 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2199036 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Configure fuzz test for alternate modesDiana Z2020-04-163-6/+22
| | | | | | | | | | | | | | | | | Configures TCPMv2 fuzz test to build the alternate mode code, and sets up a usb mux mock for that code to call. Also removes a duplicate function definition which is no longer necessary with the alternate mode common code building. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I4acd72a4a70ed445d4e49b99dbf3e08fe541d063 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2137257 Reviewed-by: Jett Rink <jettrink@chromium.org>
* usb_pd: Move cable communication functions to common fileAyushee2020-03-271-0/+5
| | | | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=Verified on TCPMV1 and TCPMv2, able to get correct cable characteristics. Change-Id: I812b21c87661952bf4e86acaa194d4b136371594 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051628 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* cleanup: drop the _TYPEC part of USB device configJett Rink2020-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The three USB device configurations describe more than just the Type-C layer, so remove the _TYPEC part within the define. This is also in preparation to change how the usbc build.mk includes files. This was performed with the following commands: $ git grep --name-only CONFIG_USB_TYPEC_DRP_ACC_TRYSRC | xargs perl -i -ple 's/CONFIG_USB_TYPEC_DRP_ACC_TRYSRC/CONFIG_USB_DRP_ACC_TRYSRC/g' $ git grep --name-only CONFIG_USB_TYPEC_CTVPD | xargs perl -i -ple 's/CONFIG_USB_TYPEC_CTVPD/CONFIG_USB_CTVPD/g' $ git grep --name-only CONFIG_USB_TYPEC_VPD | xargs perl -i -ple 's/CONFIG_USB_TYPEC_VPD/CONFIG_USB_VPD/g' BRANCH=none BUG=none TEST=builds Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I4deab784b7c3479cffd3dee7fb3ea3c8a9d6081c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2121193 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* remove cr50 related filesNamyoon Woo2020-03-091-70/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BUG=b:149350081 BRANCH=none TEST=build all, and emerged ec related packages for host and octopus. $ make buildall -j $ cros_workon --host list chromeos-base/chromeos-cr50-dev chromeos-base/chromeos-ec chromeos-base/chromeos-ec-headers chromeos-base/ec-devutils chromeos-base/ec-utils chromeos-base/ec-utils-test dev-util/hdctools $ sudo emerge chromeos-cr50-dev -j $ sudo emerge chromeos-ec -j $ sudo emerge chromeos-ec-headers -j $ sudo emerge ec-devutils -j $ sudo emerge ec-utils -j $ sudo emerge ec-utils-test -j $ sudo emerge hdctools -j $ cros_workon-octopus list chromeos-base/chromeos-ec chromeos-base/chromeos-ec-headers chromeos-base/ec-devutils chromeos-base/ec-utils chromeos-base/ec-utils-test dev-util/hdctools $ sudo emerge-octopus chromeos-ec -j $ sudo emerge-octopus chromeos-ec-headers -j $ sudo emerge-octopus ec-devutils -j $ sudo emerge-octopus ec-utils -j $ sudo emerge-octopus ec-utils-test -j $ sudo emerge-octopus hdctools -j Signed-off-by: Namyoon Woo <namyoon@chromium.org> Change-Id: If751b26b0635b0021c077338e96eaa8e8dcf17a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2080631 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* TCPMV1/2: Make the PD Config Flags more consistentSam Hurst2020-02-221-1/+2
| | | | | | | | | | | | | | | | | | | | The current use of the PD Config Flags are a bit confusing and has been changed to the following: The CONFIG_USB_POWER_DELIVERY flag is used to enable and disable the TCPMv1 and TCPMv2 stacks. And when CONFIG_USB_POWER_DELIVERY is enabled, one of the following must be enabled: CONFIG_USB_PD_TCPMV1 - legacy power delivery state machine CONFIG_USB_PD_TCPMV2 - current power delivery state machine BUG=b:149993808 BRANCH=none TEST=make -j buildall Change-Id: Ie3f8615a75b15b4f1c703f57f3db9e152a471238 Signed-off-by: Sam Hurst <shurst@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2068519 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usbc: remove tri-state polarityDenis Brockus2020-02-151-1/+5
| | | | | | | | | | | | | | | | | | TCPCIr2 had an issue with setting CC coming out of DRP that if the polarity was not retained that the connection dropped back to OPEN. Unfortunately this change broke many of the other TCPCI implementations. I am working on a different method of dealing with coming out of DRP and this is no longer needed. BUG=none BRANCH=none TEST=verify USB-C is working Change-Id: Ifa8f26d417df2f5d5f41a23fbf7e6f9129031e94 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2056968 Reviewed-by: Jett Rink <jettrink@chromium.org>
* fuzz: remove cr50 or TPM2 library related tests from fuzz and testNamyoon Woo2020-02-1211-1288/+1
| | | | | | | | | | | | | | | | | | This patch removes cr50 or TPM2 related test cases from fuzz and test directory, so that buildall or chromeos-ec package won't check them. Those test cases are already moved to cr50_stab branch. BUG=b:149243259 BRANCH=none TEST=ran 'make buildall -j' and 'sudo 'FEATURES=test' 'PKGDIR=/build/eve/test-packages' \ -- /mnt/host/source/chromite/bin/parallel_emerge \ '--sysroot=/build/eve' '--jobs=10' chromeos-ec Change-Id: Ie6f7c8622fe3e488758a814dc99ddf4587ffd973 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2047935 Reviewed-by: Allen Webb <allenwebb@google.com>
* TCPMv1/v2: Move dfp_consume_identity() to common fileVijay Hiremath2020-02-041-4/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I5b0bbd553cbe4fc76478b1c89b0f3f391f074a27 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032158 Reviewed-by: Keith Short <keithshort@chromium.org>