aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add tests to erase a chipAnastasia Klimchuk2021-08-194-0/+237
| | | | | | | | | | | | | | | | | | | | Two tests cover the code which performs do_erase operation. First one works with fake chip and dummy programmer. Fake chip has all operations defined, and a buffer to emulate chip memory. Second one uses the chip which is closer to the real one, because read/write/unlock/erase operations are real. The tests takes the advantage of dummyflasher's capability of emulating a W25Q128.V chip. BUG=b:181803212 TEST=builds and ninja test Change-Id: I6f74bfe4e02244d24d6c837cc3d551251e7b4898 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56501 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* tests: Use real spi_send_command for all tests except spi25.cAnastasia Klimchuk2021-08-191-13/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | At the moment one test (spi25.c) uses wrap of spi_send_command, and all other existing tests don't care about this function (don't call it at all). However in the next patch a new test in introduced, which needs a real spi_send_command. Following the approach "don't mock unless it is strictly necessary", all tests that don't care go into real function bucket. A declaration for __real_spi_send_command is needed for visibility, this way wrap function can redirect to real function for all other tests except spi25.c. Additionally, wrap function moves below mock_chip, so that mock_chip is visible inside wrap. BUG=b:181803212 TEST=builds and ninja test Change-Id: I22945cce3d0f36adaa8032167a3ef4e54eccb611 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56753 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* tests: add init_shutdown test for realtek_mst_i2c_spiPeter Marheine2021-08-195-0/+100
| | | | | | | | | | | | | | | | This can catch regressions like the earlier one in this programmer that caused initialization to always fail. Requires support for mocking POSIX file I/O functions because the programmer does ioctls on the opened file. TEST=ninja test Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I5a5c617d1ec35d2a3bbe622e5add82a65eb396f0 Reviewed-on: https://review.coreboot.org/c/flashrom/+/56911 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* opaque_master: Move shutdown function above opaque_master structAnastasia Klimchuk2021-08-172-25/+25
| | | | | | | | | | | | | | | | | | This patch prepares opaque masters to use new API which allows to register shutdown function in opaque_master struct. See also later patch in this chain, where opaque masters are converted to new API. BUG=b:185191942 TEST=builds and ninja test Comparing flashrom binary before and after the patch, make clean && make CONFIG_EVERYTHING=yes VERSION=none binary is the same Change-Id: I5000cfceeba859a76177a17c1cb7d1c1e9fc03fe Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56824 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* opaque_master: Add shutdown function in opaque_master structAnastasia Klimchuk2021-08-172-0/+8
| | | | | | | | | | | | | | | | | | With this, register_opaque_master can take care of register_shutdown as well, and every opaque master only needs to call register_opaque_master instead of calling both register_opaque_master and register_shutdown. Next patches in the chain convert opaque masters to use new API. BUG=b:185191942 TEST=builds and ninja test from CB:56413 Change-Id: I34183e6bafc787eec54ee4a26b73a40803f3ce99 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56823 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* linux_mtd: Free param right after its last usageAnastasia Klimchuk2021-08-171-4/+6
| | | | | | | | | | | | | | | | | Param is only used in the first half of init function, and it is local, so there is no need to keep it until the end. This makes handling error paths in the second half of init function shorter, because those paths can just return 1 instead of going to a label. BUG=b:185191942 TEST=builds and ninja test from CB:56413 Change-Id: I126a8d06297ef4d42bc93a73f7067ccc1352d1e9 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56822 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* nicintel_eeprom: Check UNPROG_DEVICE in 82580 shutdownAnastasia Klimchuk2021-08-171-14/+24
| | | | | | | | | | | | | | | | | | | | | | | | | Previously shutdown function was registered conditionally for 82580, only if the device was not UNPROG_DEVICE. This patch moves the check for UNPROG_DEVICE into shutdown function itself, so that shutdown function can be always registered for 82580. This also fixes a memory leak in nicintel_ee_shutdown_82580. No changes for i210 device init/shutdown, only for 82580. And very importantly this unlocks API change which plans to move register_shutdown inside register_opaque_master, similar to what's done in CB:56103 BUG=b:185191942 TEST=builds Change-Id: I5c729a3a63d0106e65525a6a77b2f9104c96847f Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56821 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* nicintel_eeprom: Delete extra parentheses from if conditionAnastasia Klimchuk2021-08-171-1/+1
| | | | | | | | | | | | BUG=185191942 TEST=builds Change-Id: I068bd227668a79f14e38e703a5a49db18d5de8c7 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56820 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* spi_master: Move shutdown function above spi_master structAnastasia Klimchuk2021-08-1714-188/+184
| | | | | | | | | | | | | | | | | | | This patch prepares spi masters to use new API which allows to register shutdown function in spi_master struct. See also later patch in this chain, where spi masters are converted to new API. BUG=b:185191942 TEST=builds and ninja test Comparing flashrom binary before and after the patch, make clean && make CONFIG_EVERYTHING=yes VERSION=none binary is the same Change-Id: I50716686552b4ddcc6089d5afadb19ef59d9f9b4 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56101 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* spi_master: Add shutdown function in spi_master structAnastasia Klimchuk2021-08-172-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | With this, register_spi_master can take care of register_shutdown as well, and every spi master only needs to call register_spi_master instead of calling both register_spi_master and register_shutdown. Testing: In dummyflasher, comment out free(data) in shutdown. Test fails with error: ../dummyflasher.c:949: note: block 0x55e0727a6e40 allocated here ERROR: dummy_init_and_shutdown_test_success leaked 1 block(s) Means, shutdown function is invoked for drivers with "old" API (so, transitioning from old to new API is not breaking anything). Next patches in the chain converts spi masters to use new API. BUG=b:185191942 TEST=builds and ninja test Change-Id: I2dc80dceca2f8204bcd0dad1f51753d7e79f1af5 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55932 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* realtek_mst_i2c_spi: don't always fail initPeter Marheine2021-08-101-1/+1
| | | | | | | | | | | | | | | | | | In some earlier refactoring the init function for this programmer was broken such that it never succeeds, since the return value was never set to a value other than a generic failure. Fix it to return success unless there is a problem. TEST=flashrom -p realtek_mst_i2c_spi:bus=n --flash-size now works when n is a bus that has a connected MST. Change-Id: I0596014fc9b76b4d11de230f9f5c414c1321dff1 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56799 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: Add init-shutdown test for nicrealtekAnastasia Klimchuk2021-08-095-0/+34
| | | | | | | | | | | | | | | | | | This patch adds a test and mocks for two pci functions that nicreltek is using. Main reason for this is to have at least one test for par master (currently there are none), in preparation for a change like CB:56103 but for par masters. BUG=b:181803212 TEST=ninja test Change-Id: Iaed14fe1d83c8eb45ec185ebd3f1c97cb81941f4 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56470 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* programmer_table: Remove space between address operator and variableAnastasia Klimchuk2021-08-091-2/+2
| | | | | | | | | | | | | | | BUG=none TEST=builds Change-Id: Iba29b1bc3d77b8c17c51fc0552c129e6965fa308 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56469 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* ft2232_spi: Add FTDI search by description.Harry Johnson2021-07-291-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds to the search-by-serial functionality with search-by-description (product string). This is useful when e.g. one has multiple FTDIs in a system and wants the serial numbers to reflect the system-level serial number, and the description to reflect the subcomponent names. Tested manually by running with both serial and description searches, on a machine with multiple FTDIs plugged in. Ensured that when two devices with the same vid/pid/serial number are plugged in, description can be used to differentiate. Verifed no-description, no-serial, one FTDI plugged in base case works. Original version of this code used the original single "arg" char*, but on further thought, this wasn't worth the readability and functionality losses. The new version with arg2 gets rid of several lines of code, the gotos, and adds the ability to filter by both description and serial simultaneously. Change-Id: Ib4be23247995710900175f5f16e38db577ef08fa Signed-off-by: Harry Johnson <johnsonh@waymo.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56164 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* spi_master: Add default write_aai function to masters that have noneAnastasia Klimchuk2021-07-232-0/+2
| | | | | | | | | | | | | | | | | | | | | write_aai is required to register a spi master, if it is not set in spi_master struct then register_spi_master returns ERROR_FLASHROM_BUG. Masters in this patch did not have it set in the struct, and register_spi_master always returned an error for them. However return value of register_spi_master was ignored, so this was hard to notice. Next patch in the chain checks return value of register_spi_master. BUG=b:185191942 TEST=builds and ninja test Change-Id: I712e74e11244e1f0ab8d8e245fcd5207ce211219 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56102 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* tests: Add unit tests for layout sanity checksAnastasia Klimchuk2021-07-223-0/+111
| | | | | | | | | | | | | | | Three more tests in this patch where layout does / does not pass sanity checks. BUG=b:193584590 TEST=ninja test Change-Id: Ia21585d60443b2741f3868d7887476090e35f79b Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56440 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* tests: Trim excessive new lines from layout test outputAnastasia Klimchuk2021-07-221-18/+18
| | | | | | | | | | | | | | | | | | This patch is making layout test output more compact, spanning less vertical lines while logging the same information. No changes made to the test functionality. BUG=b:193584590 TEST=ninja test Change-Id: I36a39505f8db508672cde5a848684a3a22f5ccc4 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56439 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Replace freenode referencesAngel Pons2021-07-213-31/+16
| | | | | | | | | | | | The flashrom project no longer uses freenode. To avoid having outdated man pages in the future, the contact methods are now listed in the wiki. Change-Id: I75e8f43c50dc4c3feede0250334a877cdaac8103 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56031 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* print_wiki.c: Update mailing list referenceAngel Pons2021-07-211-1/+1
| | | | | | | | | Change-Id: I5c67b5b3be2f306132d8565539bbf10477222026 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56030 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* tests: Add layout tests for overlapping regionsAnastasia Klimchuk2021-07-194-0/+116
| | | | | | | | | | | | | | | | | | There are no tests for layout, it would be great to add some. Also partially inspired by commit 06a89d713951a2e08ef8fb698a7688357baa83d1 and commit c9039fc27916c03e21ba91365d01e6bc49503053 BUG=b:193584590 TEST=ninja test Change-Id: I7aa8dc0c9bc5a22fe5deea757eea1a151b969cea Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56324 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: Wrap strdup to help cmocka recognise memory allocationAnastasia Klimchuk2021-07-193-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | This is a known issue in cmocka (see https://github.com/clibs/cmocka/issues/17) where cmocka does not recognise memory allocation happening inside strdup, and then later throws an error when the memory is freed. If the issue is fixed at some point, this workaround can be removed. Given that cmocka already overrides malloc, calloc, realloc, free, adding strdup there seems fine. Existing tests now can (and have to) free the memory they allocated by strdup, and this is in the same patch. BUG=b:193584590 TEST=ninja test Change-Id: I56aef6b342752d80995c36ab075b12198fc101d9 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56323 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* dediprog: Init-shutdown test for dediprogAnastasia Klimchuk2021-07-195-3/+111
| | | | | | | | | | | | | | | | | This patch adds mocks for libusb functions. To avoid dependency on libusb.h, libusb symbols for context and device handle are redefined. Real libusb functions are never called in tests anyway, cmocka wraps work with this without complaints. BUG=b:181803212 TEST=builds and ninja test Change-Id: I38508dfb6d7c24d42522f22fcae0c5e410c5f7ea Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55934 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* flashrom.c: Reorder read_by_layout() to avoid forward declEdward O'Callaghan2021-07-161-27/+26
| | | | | | | | | | | | | | Help make groking flashrom.c fractionaly easier. BUG=none BRANCH=none TEST=builds Change-Id: Ifd6c152e3a1d84b59a876997e543127387f24d40 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56297 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* flashrom.c: Reorder check_block_eraser() to avoid forward declEdward O'Callaghan2021-07-161-27/+25
| | | | | | | | | | | | | | Help make groking flashrom.c fractionaly easier. BUG=none BRANCH=none TEST=builds Change-Id: I0906a6e581ce5135b58f6acc6339908dfa770a59 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56296 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* flashrom.c: Make extract_param() static localEdward O'Callaghan2021-07-162-2/+1
| | | | | | | | | | | | | | | The function is only ever used within flashrom.c. BUG=none BRANCH=none TEST=builds Change-Id: I81f1cdb9df98c151201390edeb69c74defe7881f Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56295 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* flashchips: Add MX25L12873FNico Huber2021-07-142-2/+2
| | | | | | | | | | | Just add the name to the existing entry, as usual it is supposed to be compatible. Change-Id: I59c8067f15b5ceac5a2e2f8fe93431a465f17e23 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56054 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Makefile: Use dependency lists to generate NEED_<library> varsNico Huber2021-07-121-26/+4
| | | | | | | | Change-Id: I30e6430a7e833a7f74eb973fb55bf1947ae2d87b Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55881 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Makefile: Enable bitbang_spi based on its dependency listNico Huber2021-07-121-17/+8
| | | | | | | | Change-Id: I2a22667cfe14e4c5816b3bce13de632941690d17 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55880 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Makefile: Disable libusb/libpci programmers via dependency listsNico Huber2021-07-121-28/+13
| | | | | | | | Change-Id: Ic2e56059a5cd7bd9f3d74d27866ded97e86d6ef1 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55879 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Makefile: Deflate per-architecture handling of unsupported programmersNico Huber2021-07-121-132/+9
| | | | | | | | Change-Id: Ia54d9e7a2602af6e8725851d01758985b36c8461 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55878 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Makefile: Deflate handling of Linux-only programmersNico Huber2021-07-121-35/+6
| | | | | | | | | | Also one case that doesn't work on Android. Change-Id: I17381172f8df213bbddccedec2ef288326e49ecf Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55877 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Makefile: Deflate handling of unsupported programmers for libpayloadNico Huber2021-07-121-70/+6
| | | | | | | | Change-Id: I78ab1e3217aa6362b4c3525763e15140aa4c204f Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55876 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Makefile: Deflate handling of unsupported programmers for MinGWNico Huber2021-07-121-102/+7
| | | | | | | | Change-Id: I20c17471f7b059e91b215fca833b767a003a9888 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55875 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Makefile: Deflate handling of unsupported programmers for DJGPPNico Huber2021-07-121-78/+6
| | | | | | | | Change-Id: I86988aa7ef1d2d4189be3d25b9aea4e7ddaec9af Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55874 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Makefile: Add macro to disable unsupported programmersNico Huber2021-07-121-0/+7
| | | | | | | | | | | | | | `mark_unsupported` disables all programmers passed as arguments and adds them to the UNSUPPORTED_FEATURES list. It's conveniently used with our dependency lists, e.g. $(call mark_unsupported,$(NEEDS_LIBUSB1) $(NEEDS_LIBFTDI)) Change-Id: I6c9b66dfa89ec3d71675576d03fcebfdea30ce7b Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55873 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Makefile: Gather lists of dependencies by feature/libNico Huber2021-07-121-0/+49
| | | | | | | | | | | For each feature or library that we treat as dependency, list which programmers depend on it. Change-Id: I6929181f18213e1434cbbc7ba2d2b0b04bd46a6a Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55872 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Makefile: Move $(NEED_LIBFTDI) block to similar onesNico Huber2021-07-121-10/+10
| | | | | | | | Change-Id: I27eae3803a114f332a6f0713cf9bc90163030e1b Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55871 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Makefile: Move NI845X_SPI default to the other defaultsNico Huber2021-07-121-3/+3
| | | | | | | | Change-Id: I0317eb1190eae366a142d9410bee4110edc06e3d Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55870 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* Revert "Mark ENE_LPC and MEC1308 as NEED_LIBPCI"Nico Huber2021-07-121-4/+0
| | | | | | | | | | | | | | | | This reverts commit cf1e8f7b904ddf639b29b2e1bb0ad681c1aad76d. It's an indirect, spurious dependency. Why clutter the build system with it? Instead, the functions these programmers actually depend on should be factored into a compilation unit that doesn't need PCI. No matter this change, compilation with `CONFIG_INTERNAL=no` is broken because of these programmers right now. Change-Id: I134eb7d74b44f92dfdea3c764f39bc3673739fa0 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55869 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* tests.c: Move opening brace on new line for function bodyAnastasia Klimchuk2021-07-081-6/+12
| | | | | | | | | | | | BUG=b:181803212 TEST=builds and ninja test Change-Id: Ia1b00bb68ec2426161bfc183d93d2c0719a949ec Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55974 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* flashrom.8: Add Anastasia to authors listEdward O'Callaghan2021-07-081-0/+2
| | | | | | | | | | Change-Id: Ib1ede56e2446833f7dc9acacdb0f26ed822bc7a4 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56028 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
* layout: Turn overlap debug message into warningNico Huber2021-07-061-2/+2
| | | | | | | | | | | | | Let's assume this function is only called when overlapping, included regions are fatal. Change-Id: Ie969e0538d302ccd58d3fec3921265ed3621eaa5 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55999 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* layout: Fix overlap-check routineNico Huber2021-07-061-1/+1
| | | | | | | | | | | | | | Fixes a regression introduced by commit 06a89d713 (layout: Introduce layout_next()). A negation was dropped by accident which resulted in comparisons with later, not-included regions instead of included ones. Change-Id: I18168b9bd9a7d0fe2ba04fb091d1600f65d6dd5b Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55997 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* ich_descriptors: Normalize chipset detectionNico Huber2021-06-301-11/+7
| | | | | | | | | | | | | | | | Normalize the fallback paths: * Always end with the newest, assumed compatible chipset. * Perform tighter checks when it's about warnings only. * If two chipsets seem compatible, always return the same (this is currently the case for 8/9 series and 300/400 series which we can't distinguish). Change-Id: Ic5a5fee870202173b3a9813b03ec261e8ee45155 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55651 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* ich_descriptors: Don't base chipset detection on `freq_read`Nico Huber2021-06-301-5/+3
| | | | | | | | | | | | | Only warn if the `freq_read` setting looks odd but don't override our previous guess. The `freq_read` check was taken from `ifdtool` but seems less reliable than our own detection scheme. Change-Id: I658d76ec2567d1d660a18d0b0ae71c744e603e8f Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55650 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
* ich_descriptors: Revise detection for chipsets w/ ICCRIBANico Huber2021-06-302-22/+26
| | | | | | | | | | | | | | | Detection based on ICCRIBA and FMSBA became a little messy lately. However, there's a new static difference: Since 300 series (Cannon Point), there is an MDTBA field in FLUMAP1 that has always been 0 (reserved) before. Taking this into account, we can relax the checks on ICCRIBA. Change-Id: I587ad1abe390843d4a9e74431b6fc4b63f8ba512 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55647 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
* dediprog: Separate shutdown from failed init cleanupAnastasia Klimchuk2021-06-301-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Shutdown function was covering two different jobs here: 1) the actual shutdown which is run at the end of the driver's lifecycle and 2) cleanup in cases when initialisation failed. Now, shutdown is only doing its main job (#1), and the driver itself is doing cleanup when init fails (#2). The good thing is that now resources are released/closed immediately in cases when init fails (vs shutdown function which was run at some point later), and the driver leaves clean space after itself if init fails. And very importantly this unlocks API change which plans to move register_shutdown inside register master API, see https://review.coreboot.org/c/flashrom/+/51761 BUG=b:185191942 TEST=builds Change-Id: I3273da907614a042d50090338c337dfd64695354 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55887 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
* buspirate_spi: Use non-zero return value from buspirate_sendrecvAnastasia Klimchuk2021-06-301-15/+5
| | | | | | | | | | | | | | | | | | Return values for buspirate_sendrecv come from serialport_write and serialport_read, and those return 1s for any error. No need to explicity assign ret = 1, because it is already 1 for error. Follow up on commit 751afa88a7f22487069665c5d206ae490f158231 where this idea was suggested. BUG=b:185191942 TEST=builds Change-Id: I31fd70f607dc965d5cac1cd0116faa447dbc177a Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55818 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* util: Name udev-rules file accordinglyFelix Singer2021-06-281-0/+0
| | | | | | | | | | | Rename `z60_flashrom.rules` to `flashrom_udev.rules`. Change-Id: I1e7918d3121d89d3c388745e433a3a413eac0e21 Signed-off-by: Felix Singer <felixsinger@posteo.net> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55866 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Makefile: Turn x86-arch comments into `if`Nico Huber2021-06-271-2/+4
| | | | | | | | | | | Actually check what the comments suggest. Supposed to fix non-x86 on NetBSD and OpenBSD. Change-Id: I440919c12e54ca4371e21bc8d1b5ab64692fb4b8 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/52486 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>