summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* flashchips: Add AT25DF011Hanno Heinrichs2023-06-162-0/+40
| | | | | | | | | | | | | Tested read/write/erase/probe operations with a ch341a_spi programmer. Datasheet is available at https://www.mouser.de/datasheet/2/590/DS-AT25DF011_032-1098683.pdf Signed-off-by: Hanno Heinrichs <hanno.heinrichs@rwth-aachen.de> Change-Id: I5a2141f1380e864c843d6a3008fdb02dc1b75131 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/51048 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* doc: Add intro to the home pageAnastasia Klimchuk2023-06-112-0/+26
| | | | | | | | | | The intro text is converted from wiki home page. Change-Id: I2bf0d8a3b2e16c9bb7e6fbde5931ff816aede14a Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75723 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* flashchips: Mark S25FL128L as tested for probe, read, write, eraseAnastasia Klimchuk2023-06-111-1/+1
| | | | | | | | | | | As reported on the mailing list: https://mail.coreboot.org/hyperkitty/list/flashrom@flashrom.org/thread/3CC54GMEBXYVOXBJ7J5NZ5R4SQ42ZOXC/ Change-Id: I0700d3e4f684db096fea63eb9bc5add44e246758 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75604 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
* flashchips: Add support for IS25WP016Alex Mikhalev2023-06-082-0/+43
| | | | | | | | | | | | | | Tested reading, writing and erasing using `linux_spi` programmer on Raspberry Pi CM4. Datasheet: https://web.archive.org/web/20221129211027/https://www.issi.com/WW/pdf/25LP-WP016D.pdf Change-Id: I2b8caea229ffda72f1b04183c31715faccb64ad5 Signed-off-by: Alex Mikhalev <alex@corvus-robotics.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/70140 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* flashchips: Add support for Boya BY25D80APiotr Halama2023-06-082-0/+39
| | | | | | | | | | Read tested on Raspberry Pico with pico-serprog Change-Id: I586f3455d925132bbda3fccdad00f0b1e22c2ea7 Signed-off-by: Piotr Halama <skrzynka@halamix2.pl> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73513 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* flashchips.c: Add write protect support for W25Q16.VKhoa Hoang2023-06-051-2/+12
| | | | | | | | | | | | | | | | Enable WRSR2 feature flag and define reg_bits and decode_range for W25Q16.V to enable write protect support. Based on W25Q16DV, Revision: 1, Release: Nov 18 2014 datasheet TEST=flashrom --wp-{enable,disable,range,list,status} Change-Id: I6c0b35f82b47a1169bccfd08222e9e3b3be30d75 Signed-off-by: Khoa Hoang <admin@khoahoang.com> Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67713 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
* doc/classic_cli_manpage: Mark progress feature as experimentalAnastasia Klimchuk2023-05-311-1/+1
| | | | | | | | | | | | | | | The feature will have patches coming soon and not completely ideal yet. At the moment, read and verify operations can show progress, erase and write are not completely ready yet. Change-Id: I9cacc60cb357c29f6625126d22a67a56de560887 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75439 Reviewed-by: Alexander Goncharov <chat@joursoir.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
* doc/contact: Fix the nesting level of FAQ itemAnastasia Klimchuk2023-05-291-1/+1
| | | | | | | | | Change-Id: Idff89710c065cbe4fe3f2946d92ca7446f3e3663 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75437 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* hwaccess_x86_io: Improve IO permission error messagesMiklós Márton2023-05-291-2/+14
| | | | | | | | | | | | | | | | | | | | - Display the BSD hints only when compiled for a specific BSD - On Linux check the user's uid to see if flashrom run with root privileges - Add a note about the dmesg check if the flashrom run as root and have no IO privilege TEST=Run flashrom with internal programmed on a Secure boot enabled machine. You should not get the privilege level error, but rather a suggestion about the security policies. Change-Id: I6a6f60a5f0ac8f2b51c74661f7dad30571819680 Signed-off-by: Miklós Márton <martonmiklosqdev@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/62878 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* MAINTAINERS: Add Stefan Reinauer for docker containerStefan Reinauer2023-05-281-0/+5
| | | | | | | | | Change-Id: I771c6f67e0ed9beee50e8b142c34d24e96614c32 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75458 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* git-hooks: echo back the commit message on failureMiklós Márton2023-05-261-0/+2
| | | | | | | | | | | | | | | | When using nano as a git commit message editor the contents of the commit message could get lost if the git commit hook fails due to the lack of Signed-off-by line. To prevent this unpleasant effect for new contributors the commit hook was modified to echo back the commit message to allow the user to copy-paste it to the message of the next commit attempt. Change-Id: I13289f81b3fa92640aecc43eae28c1643cd7c247 Signed-off-by: Miklós Márton <martonmiklosqdev@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/62879 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* README: Extract instructions for meson and make into separate docsAnastasia Klimchuk2023-05-234-178/+216
| | | | | | | | | | | | | | | | | This patch extracts building/installing/packaging documentation for meson and make into two separate doc files, and then links these files from README. Re-structure README so that it gives only a brief overview of build instructions and links to full instructions for meson and make. Ticket: https://ticket.coreboot.org/issues/489 Change-Id: I2d5900538d54c43efcc8c5b7010df5d867f3b190 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75125 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* util: Add docker to automate creation of documentationStefan Reinauer2023-05-234-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | Build with: docker build --force-rm -t "doc.flashrom.org" \ "$PWD/util/docker/flashrom.org/" Generate HTML files: mkdir -p "$PWD/doc/_build/" docker run -it --rm \ --user "$(id -u):$(id -g)" \ -v "$PWD/:/data-in/:ro" \ -v "$PWD/doc/_build/:/data-out/" \ doc.flashrom.org Live web server: docker run -it --rm \ --net=host -v "$PWD/:/data-in/:ro" \ doc.flashrom.org livehtml Change-Id: I889fa5f98e2fd6ef896ba4bb30aa5d985ff82622 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75344 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: Anastasia Klimchuk <aklm@chromium.org>
* programmer: Use correct type for flashbaseEdward O'Callaghan2023-05-232-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flashbase is a machine-sized integer representation of address space and so use the appropriate type that is correctly sized to encode such data. The flashbase is assigned to 'base' in 'map_flash()' and the type correctly changed to uintptr_t in commit 4e32ec19b124a7 therefore makes for a consistent type usage whenever stored. While `sizeof(unsigned long)` and `sizeof(uintptr_t)` are both `8` under most circumstances on a 64bit platform and thus have enough bits to represent all addresses on the platform, the C standard does not guarantee this. Only `uintptr_t` and `void *` has a guaranteed isomorphism as `uintptr_t` is defined by the platforms toolchain support whereas the conversion from `void *` to an integer is implementation defined and that the memory address value may contain additional bits describing the validation data or provenance of the address. Therefore a integer is insufficient to contain all the necessary information for that specific platform so this may not always work out for all platforms and toolchain combinations. Spotted-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Change-Id: Ib9057e438731b9cccde0e24d5c8f758c3af1d47f Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75328 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
* erasure_layout: Simplify include pathsAnastasia Klimchuk2023-05-221-3/+3
| | | | | | | | | | | | Header files can be found without explicitly specifying include directory on the file path. Change-Id: I6ef34273d088d8fb4559fe3d801d1247ad9b3fa2 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75322 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Aarya <aarya.chaumal@gmail.com>
* chipset_enable.c: Drop `_LARGEFILE64_SOURCE`Angel Pons2023-05-221-2/+0
| | | | | | | | | | | | | This file does not access any large files, so there's no need to define this feature test macro. Change-Id: I866cfa2f996eeea5846e5d9189647ad7a4a4e3e4 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75271 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Alexander Goncharov <chat@joursoir.net>
* meson.build: enable jlink_spi by defaultThomas Heijligen2023-05-191-1/+0
| | | | | | | | | | | | Most systems are shipping libjaylink, so try to build the programmer by default. Change-Id: I80f204de1bb26f459a38177f54a167db72003dbd Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75171 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson.build: enable serial programmer on WindowsThomas Heijligen2023-05-191-1/+1
| | | | | | | | | Change-Id: Ie60a25a9305374f9ed84a38f2650d517ec094387 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75170 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson_options.txt: Unquote trueThomas Heijligen2023-05-191-1/+1
| | | | | | | | | | | | | | | Meson 1.1.0 deprecates the translation from 'true' to true and 'false' to false in the boolean typed option. Remove the quotes to keep compatible with newer meson versions. https://mesonbuild.com/Release-notes-for-1-1-0.html#coercing-values-in-the-option-function-is-deprecated Change-Id: Ib3a46112678098ff3b2e92c44cf4539089216106 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75149 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* MAINTAINERS: Add README.rst to sphinx docsAnastasia Klimchuk2023-05-171-0/+1
| | | | | | | | Change-Id: Ie4050f0a6f2da87d2f83edd4f7483b9314d6c7f7 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75300 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* doc: Add info about Discord channelAnastasia Klimchuk2023-05-171-14/+26
| | | | | | | | | | | | | | The patch adds information about Discord #flashrom channel. Because there are now two different real-time channels, the page is re-structured to have "Real time chats" section and information about Discord and IRC inside "Real time chats". Change-Id: Ide57b8d04bd805cf42e402a79653e0b051a477da Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75192 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Thomas Heijligen <src@posteo.de>
* meson: Set minimum required version for libjaylinkAnastasia Klimchuk2023-05-161-1/+1
| | | | | | | | | | | | commit 592c1c3e5fd9ae42a261966c82ddd83f777ce2b6 requires `jaylink_jtag_set_tms()`. This function has been introduced at libjaylink version 0.3.0. Check the version before compiling. Change-Id: I31b37256fc2c3c12b43eeda60e6cb2718f1fef02 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75193 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* ni845x_spi: Fix signed - unsigned comparisonsMiklós Márton2023-05-151-4/+4
| | | | | | | | Change-Id: I48ef927aa28433fb0e3b3a1f3fb2e797095e53bd Signed-off-by: Miklós Márton <martonmiklosqdev@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56637 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* flashrom.c: Enable erase path optimisationAarya Chaumal2023-05-141-1/+1
| | | | | | | | | | | Set the use_legacy_erase_path flag to false to enable erase path optimisation by default. Change-Id: Ie13e43b18b20dbb956b569e554953a19eb32ea22 Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74872 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* doc: Add doc how to add docsAnastasia Klimchuk2023-05-142-0/+36
| | | | | | | | | Change-Id: I356a286ad2f3334392efadda366b0ca0f8042752 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74225 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Alexander Goncharov <chat@joursoir.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* jlink_spi: add cs=tms option to jlink_spi programmerJiajie Chen2023-05-142-15/+43
| | | | | | | | | | | | | | | | | | | | | Currently, the code assumes the nCS pin of spi nor flash is connected to either nRESET(pin 15) or nTRST(pin 3). But it is incompatible with the pinout from official JFlash SPI, whereas the nCS pin is wired to TMS(pin 7). This commit adds cs=tms option to share the same pinout as JFlash SPI. It works by toggling TMS in assert_cs and deassert_cs, and sets TMS to zero in jlink_spi_send_command. The default option is set to cs=reset for backward compatibility. Tested on macOS 13.3.1 with JLink and Winbond W25Q128 Change-Id: I0cb467fcc2c403a25f260462de0cd020e7022bb1 Signed-off-by: Jiajie Chen <c@jia.je> Reviewed-on: https://review.coreboot.org/c/flashrom/+/75011 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Alexander Goncharov <chat@joursoir.net>
* doc: Convert README to sphinxAnastasia Klimchuk2023-05-103-211/+221
| | | | | | | | | | | | | | | This patch also includes small changes to README file that were agreed earlier: changing all links to https re-ordering of sections as Build instructions, Installations, Packaging, Contact Change-Id: I6e0debc0e15a9c4866f6d16fb010cd3f13171ff3 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74216 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* Makefile: Build man-page only when sphinx is availableThomas Heijligen2023-05-102-7/+20
| | | | | | | | | | | | | | | | | Currently, it's not possible to compile the upstream branch using the `make' command without sphinx beeing installed. Check if sphinx-build is installed and only then build or install the man-page. The problem was noticed from commit f4f2f3dd19784efa26fd5619b7a44b4cdf14b04c move manpage to sphinx. Change-Id: If1b81d9bc25ecac19d493b44b00a7c42d0643fe6 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74519 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/chip_wp.c: Allow for logging during testEdward O'Callaghan2023-05-091-0/+8
| | | | | | | | | | | | | | Hook logging callback so unit-tests print what they are doing. This make debug far easier for a failing test. BUG=none TEST=ninja test. Change-Id: I7ab0ff0915a76eea9857fc876493615c06193a37 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74932 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* flashrom: Use WP-based unlocking on opaque mastersNikolai Artemiev2023-05-094-42/+3
| | | | | | | | | | | | | | | | | | | | | | | | Flashrom only tries to use WP-based unlocking if it detects that WP operations are supported. However WP support was detected in a way that ignored WP operations provided by opaque masters. This stopped flashrom from automatically unlocking with some opaque masters, particularly linux_mtd. This commit also deletes part of a test that required the chip unlock function to be called before read/write/erase operations because WP unlocking is now used instead of chip unlocking. BUG=b:280111380 BRANCH=none TEST=Checked flashrom automatically unlocked flash on strongbad (MTD) Change-Id: I1774ad64d82ae47cd085df6045e17e283855c01f Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74930 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
* makefile: remove gitconfig targetPeter Marheine2023-05-081-3/+0
| | | | | | | | | | | | | | There's basically no benefit to running `make` over directly running the script that configures hooks, and implementing similar support in Meson is difficult. Remove the Makefile target to achieve feature parity between the build systems. Ticket: https://ticket.coreboot.org/issues/486 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I278408bd515c5a5599b5c45c597cc66485a87082 Reviewed-on: https://review.coreboot.org/c/flashrom/+/74924 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* meson make: use VERSION fileThomas Heijligen2023-05-076-334/+24
| | | | | | | | | | | | | | | | | | | | To create a distribution package with meson you run `meson dist -C <your_build_dir>` This will collect all git tracked files and pack them into an archive. There is no way to collect version information for that. So now the base version stands in the VERSION file. To relase a flashrom version you change that file and tag the changing commit. When building from git the git version is embedded in the flashrom binary. E.g.: flashrom 1.4.0-devel (git:v1.2-1172-g7f186838) on Linux 6.1.3 (x86_64) Change-Id: Idc17eadb397b3c579bddfbf9ae6bf1b171f5dfb7 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/72657 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* erasure_layout.c: Fix incorrect return value in erase_writeAarya Chaumal2023-05-061-1/+4
| | | | | | | | | | | | On failure of erasefn in erase_write it didn't set the error value in ret which caused send success status as return value. Change-Id: Ia3bd5fd250dcd0a03f0281c478b9bacb71872f31 Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74882 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* Makefile: Use printf instead of echo -nThomas Heijligen2023-05-061-1/+1
| | | | | | | | | | | On MacOS `echo -n` is not working. Change-Id: I96bb6c60e74133bbc86d5069cb076ee43f4bca83 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74522 Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* MAINTAINERS: Add Anastasia Klimchuk for sphinx docsAnastasia Klimchuk2023-04-291-0/+1
| | | | | | | | Change-Id: Ia05bde6bd2fecb5af8a9b8868fd15faaad50d899 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74227 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* MAINTAINERS: Add Thomas Heijligen for sphinx docsAnastasia Klimchuk2023-04-291-0/+5
| | | | | | | | Change-Id: Ic97df0f118c8a10762df54467051eabb63e309a7 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74226 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* doc: Add contact pageThomas Heijligen2023-04-272-0/+144
| | | | | | | | | | | This is just a copy of https://www.flashrom.org/Contact. Change-Id: Ibfba6a59c5a945b4238d16e07a07584f94159568 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73822 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* doc: Convert build documentation to sphinxThomas Heijligen2023-04-275-148/+271
| | | | | | | | | | | | | | | | | | | | These build instructions are mostly based on `Documentation/building.md` and the wiki. There are some `.. todo::` sections still present in the documentation. They will be completed later. For some of the todos content needs to be written, some others require custom sphinx-plugins to be implemented. The `.. todo::` sections are only visible in the source, not in the rendered html. Change-Id: I96771e98b313a6d26dd2be940ff37998d4124324 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73359 Reviewed-by: Alexander Goncharov <chat@joursoir.net> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson_cross: Introduce meson cross file for DJGPP/DOSThomas Heijligen2023-04-271-0/+29
| | | | | | | | | | | | With `meson setup --cross-file meson_cross/i586_djgpp_dos.txt builddir` you can build flashrom as DOS executable. Change-Id: Iabda73942c1e64cd46604c78533982374f78e1a4 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73439 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson.build: Add 'dos' as option for pci_based programmerThomas Heijligen2023-04-271-1/+1
| | | | | | | | | Change-Id: If4907a3fd1852ef60d06ef1625ad8a106d89a126 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73156 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* printf: Use inttype.h macros for format stringsThomas Heijligen2023-04-2722-238/+239
| | | | | | | | | | | | | | DJGPP for compiling DOS has other sizes for the normal int types and therefore throwing errors when using %i %d or %x with uint32_t. Fix these warnings by using the macros created for it and provided in inttypes.h. Change-Id: Ia75b6df981ce60c891161fe553c7ceab8570178d Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73040 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* cli_classic: include a fallback inplementation of getoptThomas Heijligen2023-04-274-6/+319
| | | | | | | | | | | | Some systems, DJGPP/DOS for now, may not provide getopt and their gnu extensions. So provide a fallback implementation. The code is based on musl libc. Change-Id: I6ebbde075014e3b45b0f9e04b34b72aa969e1197 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73102 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: Emulate multithreading environment for unit testsAnastasia Klimchuk2023-04-272-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The main purpose of this patch is to run unit tests on BSD family of OSes. The root cause is `fileno` syscall which is a macro that can be expanded to either a function call (for multi-threaded environment) or to inline code (for single-threaded environment). Said inline code accesses private field of file descriptor, and this construction is impossible to mock in unit tests. Multi- threaded environment has `fileno` as a function, which can be mocked in unit tests. On other OSes the patch just creates a thread which is doing nothing. We avoid adding pre-processor conditionals since the cost is small. Tested on FreeBSD 13.1-RELEASE-p6 GENERIC amd64 NetBSD 9.2 (GENERIC) amd64 OpenBSD 7.2 GENERIC#7 amd64 DragonFly v6.4.0-RELEASE x86_64 Ubuntu 22.04.1 x86_64 Change-Id: I3d65c125183e60037ad07b9d54b8fffdece5a4e8 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74157 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* chipset_enable: Mark Intel H97 as test_state DEPThomas Heijligen2023-04-241-1/+1
| | | | | | | | | | | | | | | An user reported on the mailing list [0] a successfull update of an MSI MS-7850 mainboard with an Intel H97 chipset. All ME-enable chipsets are marked as DEP instead of OK, so follow this rule. [0] https://mail.coreboot.org/hyperkitty/list/flashrom@flashrom.org/message/MYU5ZPLDRYWWNEFWN3RSOVX3VA5HPH42 Change-Id: Iebf83b5b226d961bd5a6b5f53693dbc5f8884898 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73581 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* flashrom: rewrite flashbuses_to_text()Alexander Goncharov2023-04-244-23/+54
| | | | | | | | | | | | | | | | | | | | | | The previous implementation had no error handling, as a result the flashrom could crash if the computer ran out of memory. The new version returns NULL in such cases. Also, rewrite lots of `if` conditions to one cycle, store a name of buses and `enum chipbustype` in an array by using a custom struct. The caller always expected a non-null value, so change its behavior to handle a possible null value or use the `?` symbol. As far as `free()` can handle null pointers, do nothing with such callers. TEST=ninja test Change-Id: I59b9044c99b4ba6c00d8c97f1e91af09d70dce2c Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/408 Reviewed-on: https://review.coreboot.org/c/flashrom/+/73039 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* tests: Fix mode_t argument conversion for va_argAnastasia Klimchuk2023-04-241-9/+9
| | | | | | | | | | | | | | | | | | | | Patch fixes the error: error: second argument to 'va_arg' is of promotable type 'mode_t' (aka 'unsigned short'); this va_arg has undefined behavior because arguments will be promoted to 'int' [-Werror,-Wvarargs] Discovered and tested on: FreeBSD clang version 13.0.0 gcc 8.3.0 "cc 8.3 [DragonFly] Release/2019-02-22" Also tested on: gcc 11.3.0 "cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0" Change-Id: I95b7c8dafdf4e7664c48a952acd7f8eaedb59ba7 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74202 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* usb_device.c: remove LIBUSB() wrapper around call that may failNikolai Artemiev2023-04-231-2/+2
| | | | | | | | | | | | | | | | | | | | The libusb_detach_kernel_driver() call may return LIBUSB_ERROR_NOT_FOUND, which should not be treated as an error. Wrapping the call in LIBUSB() caused the error code to be transformed by LIBUSB_ERROR(), so LIBUSB_ERROR_NOT_FOUND was not recognized at the call site and was treated as a real error. BUG=b:278635575 TEST=flashrom -p raiden_debug_spi:target=AP BRANCH=none Change-Id: I38e4642bcbddaf3f37821093f6b919806134ed7b Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74537 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* meson.build: Use library() to build libflashromThomas Heijligen2023-04-201-3/+12
| | | | | | | | | | | | | | Use library() instead of both_libraries() to build libflashrom. The built-in option `default-library` can be used to decide which kind of libraries should be built. Make `both` the default and throw an error in the case someone tries to build the classic_cli with a shared library. Change-Id: I27f10fdf1227795a9a3b4e050a2d708b58f10ee7 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73101 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* layout.c: Ensure filename is always consistent in layout structureEdward O'Callaghan2023-04-131-8/+11
| | | | | | | | | | | | Ensure construction and extraction filenames are symmetrical consistently within the layout structure. Change-Id: I9a0c3130c0e7d88a8a69fd29362c338e20d2bae8 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/72943 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* buspirate: Add option for setting the aux pinSean Anderson2023-04-132-2/+28
| | | | | | | | | | | | | This adds a parameter to drive the aux pin low (or high if you explicitly want the previous behavior). Some boards need to have a reset pin driven low before the firmware can be safely flashed. With the Bus Pirate, this is most easily done with the auxiliary pin. Change-Id: Ieeecfdf1afc06dadda9b8f99547cd74854ca6775 Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/43608 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>