aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* meson: Overhaul the print_wiki optionThomas Heijligen2022-09-122-5/+11
| | | | | | | | | | | | | | - Rename `print_wiki` to `classic_cli_print_wiki` - Make it a meson feature type - `classic_cli` must be enabled to enable `classic_cli_print_wiki` - `classic_cli_print_wiki` is disabled by default Change-Id: Ic6c959b8b64ec2756b4535bd1b3320860f836aa5 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66703 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson: Build the classic cli / flashrom cli executable as featureThomas Heijligen2022-09-122-13/+16
| | | | | | | | | | | | | | Provide the meson option `-Dclassic_cli=auto/enabled/disabled` to determine if the classic cli flashrom executable should be built. This is needed to support targets, like libpayload, which can only build libflashrom. Change-Id: If39981ad0b3281edd6fc7e220362d2938dddf814 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66705 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* test_build.sh: Enforce tests to be enabledFelix Singer2022-09-081-1/+1
| | | | | | | | | | | Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I00c23a17926ed112522b083f8594596d051cf9f8 Reviewed-on: https://review.coreboot.org/c/flashrom/+/67243 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Revert "cmocka: Drop as meson subproject"Nico Huber2022-09-083-3/+17
| | | | | | | | | | | | | | | | | | This reverts commit 99eca0899b931b21b7c44ed1753c5f01b35798af. The environment provided by our Jenkins builder doesn't have cmocka. It's not exactly known why it worked as a subproject. However, if it allows us to enforce tests in the CI, we should revert now and drop the subproject again once the environment is updated. Change-Id: Iafdab92eb8ab96d02fb2c29524d785bdc7a54034 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67345 Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* dmi.c: Retype variable `anchored` with boolFelix Singer2022-09-081-3/+4
| | | | | | | | | | | | Use the bool type instead of an integer for the variable `anchored`, since this represents its purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I5bedaf47cdd2fd5d152f69b6b02aab69fd1285c6 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66903 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* dummyflasher.c: Retype appropriate variables and attributes with boolFelix Singer2022-09-081-11/+12
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate variables and attributes, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I712b1ef7e1ad74d3e004dcf36c82898c88072c63 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66901 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* it87spi.c: Retype attribute `fast_spi` with boolFelix Singer2022-09-081-3/+4
| | | | | | | | | | | | Use the bool type instead of an integer for the attribute `fast_spi`, since this represents its purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: Id28c2c9043dda7a400b8c4e9ca218cb445e97d24 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66900 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* ich_descriptors.c: Retype variable `has_forbidden_opcode` with boolFelix Singer2022-09-081-3/+4
| | | | | | | | | | | | Use the bool type instead of an integer for the variable `has_forbidden_opcode`, since this represents its purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I6214956e377547b894fc76237832b6f7b2db41dd Reviewed-on: https://review.coreboot.org/c/flashrom/+/66899 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* fmap.c: Retype appropriate variables with boolFelix Singer2022-09-081-5/+8
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate variables, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I323d40cabe9c580057d870e742b3b55942c78321 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66896 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* ft2232_spi.c: Retype variable `clock_5x` with boolFelix Singer2022-09-081-2/+3
| | | | | | | | | | | | Use the bool type instead of an integer for the variable `clock_5x`, since this represents its purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: Ie3005f9dcb2dcfe63261c52a36d865d175a0a75c Reviewed-on: https://review.coreboot.org/c/flashrom/+/66895 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* spi25.c: Retype appropriate variables with boolFelix Singer2022-09-081-5/+5
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate variables, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: Icd7e6478848c6f72817da16a5350d450bcc0bb5d Reviewed-on: https://review.coreboot.org/c/flashrom/+/66890 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* tree: Retype variable `laptop_ok` with boolFelix Singer2022-09-084-7/+8
| | | | | | | | | | | | Use the bool type instead of an integer for the variable `laptop_ok`, since this represents its purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I5d9fc3516bc2d29f11b056e35b3e5e324ce93423 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66891 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* ichspi.c: Retype appropriate variables with boolFelix Singer2022-09-081-10/+11
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate variables, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: If7eeacc44921f52aa593ab1302f17a5c5190f830 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66892 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* tree: Retype variable `programmer_may_write` with boolFelix Singer2022-09-085-6/+9
| | | | | | | | | | | | Use the bool type instead of an integer for the variable `programmer_may_write`, since this represents its purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I69958527ae018a92f1c42734a7990d0c532dee0c Reviewed-on: https://review.coreboot.org/c/flashrom/+/66885 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* flashrom.c: Retype appropriate variables with boolFelix Singer2022-09-081-5/+6
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate variables, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I6629f391284c8f1266e4ba66c9976f3df43955d4 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66883 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* linux_mtd.c: Retype appropriate attributes with boolFelix Singer2022-09-081-4/+5
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate attributes, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I8be4e08e714047d155dcc032cc3d8dabb422b27f Reviewed-on: https://review.coreboot.org/c/flashrom/+/66881 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* 82802ab.c: Retype appropriate variables with boolFelix Singer2022-09-081-6/+8
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate variables, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I5dfd9ed4856c37dd70706b2dd71fbb9a8acbdf4c Reviewed-on: https://review.coreboot.org/c/flashrom/+/66879 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* serprog.c: Retype variable `have_device` with boolFelix Singer2022-09-081-3/+4
| | | | | | | | | | | | Use the bool type instead of an integer for the variable `have_device`, since this represents its purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: Ia12f1503ae3f7be20a065f22b4ab84c4140cd23e Reviewed-on: https://review.coreboot.org/c/flashrom/+/66878 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* raiden_debug_spi.c: Retype variable `found` with boolFelix Singer2022-09-081-3/+4
| | | | | | | | | | | | Use the bool type instead of an integer for the variable `found`, since this represents its purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I18c69e678017a9c0655a31c0487fd1fb0d85ecf2 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66877 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* pony_spi.c: Retype appropriate variables with boolFelix Singer2022-09-081-28/+29
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate variables and attributes, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: Iecd98c391a74794647caeeb2715707ccd681463c Reviewed-on: https://review.coreboot.org/c/flashrom/+/66875 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* mstarddc_spi.c: Retype appropriate variables with boolFelix Singer2022-09-081-5/+6
| | | | | | | | | | | | Use the bool type instead of an integer for appropriate variables, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I3a72a0877b47f67f8984c28cbf5b5d429ec1534e Reviewed-on: https://review.coreboot.org/c/flashrom/+/66874 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* internal.c: Retype appropriate variables with boolFelix Singer2022-09-082-14/+16
| | | | | | | | | | | | | Use the bool type instead of an integer for the variables `force_laptop`, `not_a_laptop`, `force_boardenable` and `force_boardmismatch` since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I159d789112d7a778744b59b45133df3928b8445e Reviewed-on: https://review.coreboot.org/c/flashrom/+/66870 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* buspirate_spi.c: Retype appropriate variables with boolFelix Singer2022-09-081-7/+8
| | | | | | | | | | | | Use the bool type instead of integer for appropriate variables, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I245616168796f2c7fe99388688b0f606bd3405bf Reviewed-on: https://review.coreboot.org/c/flashrom/+/66868 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* usb_device.c: release the usb interface on shutdownThomas Heijligen2022-09-071-1/+4
| | | | | | | | | | | | | | | Following the libusb documentaion: `You should release all claimed interfaces before closing a device handle.` https://libusb.sourceforge.io/api-1.0/group__libusb__dev.html libusb_release_interface() Change-Id: If916574314cd86fad3429065a11707da0a809e0d Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67072 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* ch341a_spi: detach/attach kernel driver explicitlyThomas Heijligen2022-09-071-5/+6
| | | | | | | | | | | | | | | Use `libusb_detach_kernel_driver` and `libusb_attach_kernel_driver` instead of `libusb_auto_detach_kernel_driver` to be compatible with older libusb versions without changing the behavior. TEST=Build with libusb >= 1.0.9 Read spi flash with ch341a programmer on linux Change-Id: Ia649722e64cc97c6b689dd3b764e5c9145959f92 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67071 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* tests: Add wrappers for libusb_(attach|detach)_kernel_driverThomas Heijligen2022-09-073-0/+16
| | | | | | | | | Change-Id: Ia463824a209db65e82ccfbf320368b2ce82eb36f Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67079 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* chipset_enable.c: plumb programmer_cfg into sb600 and ich initEdward O'Callaghan2022-09-071-5/+5
| | | | | | | | | Change-Id: Ic25014cbb983bda6e949bc62e30f2cca51f57a4c Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66674 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* tree: plumb programmer_cfg into chipset_flash_enable()Edward O'Callaghan2022-09-073-4/+4
| | | | | | | | | Change-Id: I963c674d212ce791ee155020fa97bcf26cefca0c Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66673 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* ichspi.c: Allow passing programmer_cfg directlyEdward O'Callaghan2022-09-073-10/+10
| | | | | | | | | | | | | | Modify the type signature of the programmer entry-point xxx_init() functions to allow for the consumption of the programmer parameterisation string data. Also plumb programmer_cfg though get_params. Change-Id: I480589bb50b47fdf5af259d068f49fedfce88ea5 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66661 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* chipset_enable.c: Change doit() and enable_flash_\S() signaturesEdward O'Callaghan2022-09-072-112/+112
| | | | | | | | | | | | | | | Ran; ``` $ sed -Ei 's/int enable_flash_(\S+)\(/int enable_flash_\1(const char *prog_param, /g' chipset_enable.c $ sed -Ei 's/return enable_flash_(\S+)\(/return enable_flash_\1(cfg, /g' chipset_enable.c ``` and dealt with special cases manually. Change-Id: I62c5d49a83ed4afb86ac3f0fae56defa1338ab4f Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66672 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* tree: Fix drivers to pass programmer_cfg to pcidev_init()Edward O'Callaghan2022-09-0719-20/+22
| | | | | | | | | | | | Allow for programmer_cfg plumbing in pcidev.c The pci drivers impacted are plumbed here as well. Change-Id: Ie0c9d1c0866d44f64d037c596f2e30547fcfd58f Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66671 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* usb_device.c: Allow for programmer_cfg plumbingEdward O'Callaghan2022-09-073-17/+18
| | | | | | | | | | | | The only driver impacted is raiden_debug_spi.c and so plumb state directly. Change-Id: I85ff3117de8743b0a548dad98875cc41f48cac93 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66670 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* tree: Port programmers to pass programmer_cfg to extractorsEdward O'Callaghan2022-09-0730-85/+87
| | | | | | | | | | | | | | | | | | | | | Ran; ``` $ find -name '*.c' -exec sed -i 's/extract_programmer_param_str(NULL/extract_programmer_param_str(cfg/g' '{}' \; ``` Manually fix i2c_helper_linux.c and other cases after. Treat cases of; - pcidev.c , and - usb_device.c as exceptional to be dealt with in later patches. Change-Id: If7b7987e803d35582dda219652a6fc3ed5729b47 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66656 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* raiden_debug_spi.c: plumb programmer_cfg though get_paramsEdward O'Callaghan2022-09-071-4/+4
| | | | | | | | | | | | | Modify the type signature of the programmer get_param helper functions to allow for the consumption of the programmer parameterisation string data. Change-Id: I20041a9aead513de71c2c384842046f64c1614b6 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66667 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* dummyflasher.c: plumb programmer_cfg though get_paramsEdward O'Callaghan2022-09-071-2/+3
| | | | | | | | | | | | | Modify the type signature of the programmer get_param helper functions to allow for the consumption of the programmer parameterisation string data. Change-Id: Ic5b35a7324b1c5a8ca9b8b16ee0b95036737ef47 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66663 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* sb600spi.c: Allow passing programmer_cfg directlyEdward O'Callaghan2022-09-073-7/+8
| | | | | | | | | | | | | | Modify the type signature of the programmer entry-point xxx_init() functions to allow for the consumption of the programmer parameterisation string data. Also plumb programmer_cfg though handle_imc and handle_speed. Change-Id: I82f9ee75df90c582ef345c00a5487c687f28cdd5 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66660 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* it87spi.c: Allow passing programmer_cfg directlyEdward O'Callaghan2022-09-073-5/+5
| | | | | | | | | | | | | Modify the type signature of the programmer entry-point xxx_init() functions to allow for the consumption of the programmer parameterisation string data. Change-Id: I598b1811c9734f41eee205d5a2b51ad8ac79e3ab Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66662 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* tree: Allow passing programmer_cfg directly to programmerEdward O'Callaghan2022-09-0740-51/+53
| | | | | | | | | | | | | | | | | | | | | Modify the type signature of each programmer entry-point xxx_init() functions to allow for the consumption of the programmer parameterisation string data. ``` $ find -name '*.c' -exec sed -i 's/_init(void)/_init(const char *prog_param)/g' '{}' \; $ find -name '*.c' -exec sed -i 's/get_params(/get_params(const char *prog_param, /g' '{}' \; $ find -name '*.c' -exec sed -i 's/const char \*prog_param)/const struct programmer_cfg *cfg)/g' '{}' \; $ find -name '*.c' -exec sed -i 's/const char \*prog_param,/const struct programmer_cfg *cfg,/g' '{}' \; ``` and manually fix up any remaining parts. Change-Id: I8bab51a635b9d3a43e1619a7a32b334f4ce2cdd2 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66655 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* tree: Change signature of extract_programmer_param_str()Edward O'Callaghan2022-09-0732-83/+88
| | | | | | | | | | | | | | | | | Results can be reproduced with the following invocation; ``` $ find -name '*.c' -exec sed -i 's/extract_programmer_param_str(/extract_programmer_param_str(NULL, /g' '{}' \; ``` This allows for a pointer to the actual programmer parameters to be passed instead of a global. Change-Id: I781a328fa280e0a9601050dd99a75af72c39c899 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66654 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* tests: Add tests to cover unhandled programmer params pathsAnastasia Klimchuk2022-09-043-0/+64
| | | | | | | | | | | | | | | Unhandled programmer params are considered as an error for initialisation procedure, adding tests to run those scenarios. BUG=b:181803212 TEST=ninja test Change-Id: Ia64f6362f46a029e168bfdb3bdb903328fd1f9c7 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67199 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/lifecycle: Run shutdown for init error pathsAnastasia Klimchuk2022-09-041-0/+11
| | | | | | | | | | | | | | | | | | | | | `run_init_error_path` tests the scenario when init function of a programmer fails. Init can fail at different phases and depending on a specific test scenario it could be before or after shutdown function has been registered. If shutdown function has already been registered, it needs to run because it cleans up the resources allocated during init. This patch prevents memory leaks. BUG=b:181803212 TEST=ninja test Change-Id: I604edff18e35b7c044b73d3a8adfa8c800eddfd2 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67198 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests/parade_lspcon.c: Add emulation for ioctl, read, write operationsAnastasia Klimchuk2022-09-041-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, parade lspcon unit test had no custom emulation and was running basic lifecycle with default mocks (default mocks do nothing and return success). I have discovered that it does not work in all environments. Specifically, in functions `parade_lspcon_wait_command_done` and `parade_lspcon_wait_rom_free` there is a local variable `uint8_t val` which is declared and not explicitly initialised. It can get different initial values depending on the environment/toolchain (for example gcc vs clang). Later during the code execution, this variable is used as a holder for writing/reading data from register(s). For unit test, reading and writing data from registers is emulated. With default mocks, initial value of variable was propagated further as if it was "read" from a register. So the unit test could pass or fail depending on the initial value of local variable, which in turn depends on environment and toolchain. If initial value was 0 the test reliably passed (this is the case with upstream build environment, locally I have gcc 11.3.0 on x86_64). If it was 1 the test reliably failed (this is the case of chromium flashrom tree, this is clang 15.0 under chroot, tested on x86_64 and arm boards). If it was any other value then it could be anything. This patch adds custom mocks for ioctl/read/write operations and emulates a successful scenario of running a lifecycle. Local variable is initialised by reading from the register, same as it happens in the real (non-test) run for this programmer. BUG=b:242816982 TEST=ninja test Change-Id: I98f52507a0ddbbfbeb390038d14192cacc2be683 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67161 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* layout.c: Cast argument of isspace() to unsigned charThomas Heijligen2022-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | These functions [isspace, etc] check whether c [(the argument)], which must have the value of an unsigned char or EOF, falls into a certain character class according to the current locale. Cast the argument from `char` to `unsigned char` to guarantee that we don't pass illegal negative values. Some implementations actually provide a warning to get heads up[1]. [1] https://man.netbsd.org/ctype.3#CAVEATS TEST=Builds on Cygwin (Windows 10, amd64, gcc 11.3.0) Change-Id: Ia48d5a19b0964bc28e5360edf06bdf287dad5945 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66548 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* util/shell.nix: Explicitly install gnumake and GCC packagesFelix Singer2022-08-311-0/+2
| | | | | | | | | | | | | Even if both packages are provided by stdenv, add the packages gnumake and GCC to buildInputs so that the list of (build-) dependencies is complete. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I683eb0459404738a501a57d4301a90a6e3b46f93 Reviewed-on: https://review.coreboot.org/c/flashrom/+/67087 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Thomas Heijligen <src@posteo.de>
* nicintel_eeprom: pack eebar into programmer's dataAlexander Goncharov2022-08-301-19/+22
| | | | | | | | | | | | | | | | | | | | Move global variable into a struct and store within the opaque_master data field for the life-time of the driver. This is one of the steps on the way to move opaque_master data memory management behind the initialisation API. TOPIC=register_master_api TEST=builds Change-Id: Ia53416b2c5c5b6a737b13cf93ce39870f048473d Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66693 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* nicintel_eeprom: decouple function signatures from global stateAlexander Goncharov2022-08-301-47/+50
| | | | | | | | | | | | | | | | | | Pass eebar as a parameter to helper functions. This is one of the steps on the way to move opaque_master data memory management behind the initialisation API. TOPIC=register_master_api TEST=builds Change-Id: I6873f0e63c58bb6f8960dba6adbd59c6ef1d776f Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66692 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* nicintel_eeprom: pack pci device struct into programmer's dataAlexander Goncharov2022-08-301-4/+7
| | | | | | | | | | | | | | | | | | | Move global variable into a struct and store within the opaque_master data field for the life-time of the driver. This is one of the steps on the way to move opaque_master data memory management behind the initialisation API. TOPIC=register_master_api TEST=builds Change-Id: I69271bc77a6d7211e692c0b48d1853b95ffa80e9 Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66691 Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* nicintel_eeprom: unify the code path of opaque master registrationAlexander Goncharov2022-08-301-17/+11
| | | | | | | | | | | | | | TOPIC=register_master_api TEST=builds Change-Id: I9f5f181fe4497ac95e89df8588522a40ba8be024 Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66158 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* nicintel_eeprom: refactor i210 variable into reentrant patternAlexander Goncharov2022-08-301-5/+18
| | | | | | | | | | | | | | | | | | | | | Move global Intel I210 specific variable into a struct and store within the opaque_master data filed for the life-time of the driver. This is one of the steps on the way to move opaque_master data memory management behind the initialisation API. TOPIC=register_master_api TEST=builds Change-Id: Ifda0d8666399ea165bac6378c57720b5560806f1 Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66690 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* nicintel_eeprom: turn 82580 state variable into a structAlexander Goncharov2022-08-301-11/+19
| | | | | | | | | | | | | | | | | | Intel 82580 has more than just the "eec" variable. Others will be added to the structure in the next commits. TOPIC=register_master_api TEST=builds Change-Id: I66d42c6648088da7097674314dd00f34ef97119c Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66689 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>