aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add llvm-cov option and run target for code coverageEvan Benn2022-12-111-2/+12
| | | | | | | | | | | | | | | | | Code coverage can be requested with -Dllvm_cov and run with ninja llvm-cov-tests or llvm-cov-cli. BUG=b:187647884 BRANCH=None TEST=meson test; ninja llvm-cov-tests TEST=ran test_build.sh with coverage enabled TEST=jenkins ran test_build.sh with coverage disabled Change-Id: Id6c73bff46e7b88d425956a80def97082b201f56 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69268 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* meson.build: Rename conf object to config_manfileFelix Singer2022-12-061-5/+4
| | | | | | | | | | | | The config data in the conf object is specific to the man file. Thus, rename it accordingly and also move the declaration to the place where it is used. Change-Id: Icf24b9c47d4c7553f1ec045a9dfd3685b1376445 Signed-off-by: Felix Singer <felixsinger@posteo.net> Reviewed-on: https://review.coreboot.org/c/flashrom/+/70209 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* tests: add basic lifecycle test for ch341a_spiAlexander Goncharov2022-11-291-0/+1
| | | | | | | | | | | | | | | | | | | | TEST=the following scenarios run tests successfully 1) ch341a_spi is enabled result: all tests run and pass, including ch341a 2) ch341a_spi is disabled result: ch341a_spi test is skipped, the rest of tests run and pass 3) libusb isn't presented in the system result: tests for usb programmers are skipped, the rest of tests run normally Change-Id: If28fbe09ad685082152aa3a7e8d5a150169aee9e Signed-off-by: Alexander Goncharov <chat@joursoir.net> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67664 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* meson: Move programmer test sources into programmer definitionFelix Singer2022-11-111-0/+10
| | | | | | | | | | | | | | | | | Move the definition of the programmer test source files into the dictionary defining the programmers itself. This way there is a better overview about which of the available programmers have tests and which don't. Also, to keep the tests working, iterate over all programmers and add their test source files to the list of sources that should be built. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I307faaf8a9f7ae3c54bd96e7d871a3abb8aadea3 Reviewed-on: https://review.coreboot.org/c/flashrom/+/68162 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* dirtyjtag: Add DirtyJTAG programmerJean THOMAS2022-10-151-0/+6
| | | | | | | | | | | | | | | | Add a new programmer driver for the DirtyJTAG project (a USB-JTAG firmware for STM32 MCUs). Successfully tested with DirtyJTAG 1.4 running on an Olimex STM32-H103 development board and a SST25VF020B SPI flash chip. Change-Id: Ic43e9a014ed7d04e429e73b30c9dcfdde1a78913 Signed-off-by: Jean THOMAS <virgule@jeanthomas.me> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67878 Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* meson.build: Fix indentation of mstarddc_spi definitionFelix Singer2022-10-111-1/+1
| | | | | | | | | Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I064b50f87760fd7ad40b3629b3fa68552c8ddb46 Reviewed-on: https://review.coreboot.org/c/flashrom/+/68163 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* meson: Refactor the programmer selectionThomas Heijligen2022-09-121-301/+416
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements a positive selection choice of which programmers should be built. - Each programmer is represented through an entry in the programmer dictionary - The entry contains: - A list of systems and CPU families where the programmer can run on - A list of required dependencies - A list of sources needed to build the programmer - A list of compiler flags - A flag to determin if the programmer should be build on 'auto' - If an entry is not given it is set to the default value - If a programmer gets selected, an 'active' flag is added to the entry on runtime - All programmers with an 'active' flag will be included in the build - One or more programmers can be selected through '-Dprogrammer=<>' - 'auto' enables all programmers which are available, deps are found and have the 'default' flag - 'all' enables all programmers which are available and deps are found - 'group_***' enables all programmers which are available, deps are found and the programmer belongs to the selected group - '_programmer_name_' forces the programmer to be built or the build will fail. Change-Id: Ib44b26e3748fc71f116184082b4aed0bb208b4c1 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/63724 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson: Overhaul the print_wiki optionThomas Heijligen2022-09-121-4/+10
| | | | | | | | | | | | | | - 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-121-13/+15
| | | | | | | | | | | | | | 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>
* Revert "cmocka: Drop as meson subproject"Nico Huber2022-09-081-2/+6
| | | | | | | | | | | | | | | | | | 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>
* print.c: Move list of known boards to known_boards.cEdward O'Callaghan2022-08-291-0/+1
| | | | | | | | | | | | | This free's up namespace pollution and a layer of ifdef. BUG=b:242246291 TEST=builds Change-Id: Id098343b9b79fd9b01c7dc48e64756ad350f9d83 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66720 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* parallel.c: Consoldiate parallel master registration logicEdward O'Callaghan2022-08-251-0/+1
| | | | | | | | | | | | | | | | This is analogous to spi.c and opaque.c however parallel logic was previously never consoldiated. This free's up flashrom.c from namespace pollution. BUG=b:242246291 TEST=builds with both make and meson. Change-Id: Ie08e2e6c51ccef5281386bf7e3df439b91573974 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66651 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* flashrom.c: Move read_buf_from_file() to helpers_fileio.cEdward O'Callaghan2022-08-251-0/+1
| | | | | | | | | | | | | | | | | | Constructing a buffer from a read file is auxiliary functionality to the core flashrom algorithms. Move aside to decrease the overall complexity of flashrom.c BUG=b:242246291 TEST=builds Change-Id: Ia6e1eeb876722899defb5b75346d1f22c70bfbd1 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66645 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Evan Benn <evanbenn@google.com> Reviewed-by: Sam McNally <sammc@google.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Thomas Heijligen <src@posteo.de>
* meson: Build the ich_descriptors_tool as featureThomas Heijligen2022-08-231-1/+3
| | | | | | | | | | | | | | Provide the meson option `-Dich_descriptors_tool=auto/enable/disabled` to determin if the ich_descriptors_tool should be build or not. On `auto` or `enabled` it will be, on `disabled` it will not be build. This is usefull for environments where the ich_descriptors_tool is not needed. Change-Id: Ief65a914019f72536d563eda36bd7f2f5330bea8 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66704 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* cmocka: Drop as meson subprojectThomas Heijligen2022-08-171-6/+2
| | | | | | | | | | | | | | | | | Depend exclusive on the cmocka package provided by the build environment. Cmocka is widely available in Linux distributions and BSD systems. Besides that, it is suboptimal to fetch own dependencies in the build process. Most packaging systems even forbid fetching additional assets at build time. Change-Id: I751c85d5f72e47356113cf55dfbaec73cbd8028c Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66696 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* meson: fix various meson build warnings and formattingNikolai Artemiev2022-07-281-5/+6
| | | | | | | | | | | | | | | | | | | | | | - Make run_command() calls check for failures to fix warnings about ignoring errors, see https://github.com/mesonbuild/meson/issues/9300. - Remove `include_directories('../subprojects')` from tests/meson.build. It isn't necessary and caused build warnings due to referencing files outside the tests/ directory. - Fix indent level and formatting in a few places. BUG=none BRANCH=none TEST=meson; ninja; ninja test Change-Id: I17ae0c51d68ed004772a237641f08345f4893200 Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66060 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* Rename lspcon_i2c_spi to parade_lspconThomas Heijligen2022-07-171-4/+4
| | | | | | | | | | | | | | | | | | | | | The chip targeted by the `lspcon_i2c_spi` programmer is a Parade PS175. Rename the programmer to match the chips vendor / family instead of the generic LSPCON protocol. Remove the `_i2c_spi` ending in preparation to become an opaque master. The chip is visible on an Acer Chromebox CXI4. https://www.paradetech.com/products/ps175/ https://www.acer.com/ac/en/US/content/series/acerchromeboxcxi4 TEST: `make CONFIG_PARADE_LSPCON=yes` and `meson build -Dconfig_parade_lspcon=true` produces flashrom binaries with the parade_lspcon programmer included. Change-Id: I9148be6d9162c1722ff739929ca5e181b628dd57 Signed-off-by: Thomas Heijligen <src@posteo.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/65547 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* it85spi: EOL supportEdward O'Callaghan2022-07-041-1/+0
| | | | | | | | | | | | | | | | | | | | | This code was originally introduced by ITE for now exceedingly old Chromebooks. The code has had very little attention to maintain it, unlikely tested for a long time and now seems to be just a technical burden to the flashrom project. If someone is later interested it could be resurrected for reference from git history. However, it needs quite a bit of work to bring it back into maintainable order. BUG=b:156143896,b:170689483 TEST=tree builds under meson+make and unit tests pass. Change-Id: I5e8cafd73db837941c518f0e2d72d8192274fd79 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/65378 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: Use regular cmocka wraps for hwaccess functionsAnastasia Klimchuk2022-06-211-1/+0
| | | | | | | | | | | | | | | | | | | | | hwaccess functions used to be static inline functions and needed a special treatment so that they could be mocked for unit tests. This has changed, see include/hwaccess_x86_io.h now the functions are not static inline anymore, and it is possible to use regular cmocka wraps. Fixes https://ticket.coreboot.org/issues/385 BUG=b:181803212 TEST=ninja test Change-Id: Iafce071ea7ad5bcfdebbba968699d5743705f8e0 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/64881 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Joursoir <chat@joursoir.net> Reviewed-by: Thomas Heijligen <src@posteo.de>
* meson: use files() for srcs listThomas Heijligen2022-05-311-61/+64
| | | | | | | | | | | | | | | Meson looks up if the file xyz.c exists when calling file('xyz.c'). Furthermore it keeps track of the directory of the file. This is handy when using multiple directories. Change-Id: I346b5468b4203f1521ec73a90f93ff3b13ebf43c Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/64384 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* meson: link flashrom binary against static libflashromThomas Heijligen2022-05-121-20/+7
| | | | | | | | | | | | | TEST: meson build && ninja -C build Read chip successfully with ch341a_spi programmer Change-Id: Ic522610f59e00299ebfa1bd29482ff92120ec52b Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/64030 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson: relocate config_print_wiki & config_default_programmer_*Thomas Heijligen2022-05-121-13/+13
| | | | | | | | | | | | Change-Id: I9538b0aee31b294844d4f4ca0396334a81dfb498 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/64029 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: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* meson: use built-in options for install pathsThomas Heijligen2022-05-121-7/+2
| | | | | | | | | | | | The install functions of meson can take a relative path and join the prefix automatically. Change-Id: I9cb9faf4bdbcfd66098478cc3a260eb3b664a2e6 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/64028 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* meson: add option to disable testsThomas Heijligen2022-05-121-24/+29
| | | | | | | | | | | | | | | During development it can be useful to disable unit testing. By default tests are built if cmocka is found. To force enable tests run `meson build -Dtests=enable`. To disable tests run `meson build -Dtests=disabled`. Change-Id: I384c904c577b265dfe36bf46bf07c641bc29de9b Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/63832 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* meson: use `platform/` as subdir()Thomas Heijligen2022-05-121-11/+2
| | | | | | | | | | | | | | | | Move build instructions for files inside the `platform/` directory to `platform/meson.build`. This contains instructions to build `memaccess.c`, the right endian implementation and selecting the right legacy command line option for the endian. The `platform/` directory should contain code that abstracts the underlying platform but is not involved in flashrom logic. Change-Id: I88044a3f903f316138483dd872a6d95f8686ae69 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/63826 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* meson: relocate add_project_arguments() for IS_WINDOWSThomas Heijligen2022-05-121-6/+5
| | | | | | | | | | | Change-Id: I6afb65fabf858449f2706bf250588225a94c1871 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/63827 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* meson: relocate source file listThomas Heijligen2022-05-121-34/+34
| | | | | | | | | | | | Change-Id: I921be8a8a99b93d23c1dbd4ea54672ba9998558d Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/64026 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: Felix Singer <felixsinger@posteo.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* meson: Treat warnings as errorsAnastasia Klimchuk2022-04-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makefile treats warnings as errors, so enable the same option for meson. Makefile has an option to disable "warnings as errors" option from command line. The same can be achieved with meson, see scenario 2 below. TEST=I verified the following scenarious 1) check that warnings treated as errors by enforcing higher warning level `meson setup --warnlevel=3 --wipe` `ninja test` shows tons of errors because warning level 3 is pedantic, build fails 2) disable "warning as errors" option from command line `meson configure -Dwerror=false` `ninja test` Now all warnings are non-blocking for build, so tests pass 3) back home `meson configure -Dwerror=true` `meson setup --warnlevel=2 --wipe` `ninja test` No warnings and tests pass 4) defaults: create new directory and run meson will all default options No warnings, all tests pass. Change-Id: I06c72abf1c861f9b35736e02ef7f4a4fb6909b97 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/63852 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* meson: Add optimisation level s and disable debug in meson buildAnastasia Klimchuk2022-04-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | Makefile has optimisation level set explicitly. This patch sets the same level s into meson build. Also disable debug by default to correspond to make builds. These two options (optimisation and debug) are linked together in meson build, so they need to be set together to be properly recognised for builds. Alternative approach would be to use buildtype option (and do not set optimisation and debug). However, none of the standard buildtypes gives a combination that we need: optimisation level s and debug disabled. TEST=ninja test shows no warnings and tests pass Change-Id: I4ca96a866529cac320e66516ef280d5100ceefab Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/63606 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* Add -W options from Makefile into meson warning_flagsAnastasia Klimchuk2022-04-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | Makefile options were more restrictive and produced more warnings. This patch adds missing warning options into meson build. Makefile also has -Wall and -Wextra specified explicitly, however this is covered by warning_level=2 which is already set in meson.build. warning_level info: https://github.com/mesonbuild/meson/issues/3275 There are few warning options that are present in meson, but not in Makefile. These are left as is. TEST=ninja test shows no warnings and tests pass Change-Id: Id401bfd642dc3c13d85bd9a2dba56ada38714c25 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58561 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* Introduce an `include` directory for header filesThomas Heijligen2022-04-291-3/+7
| | | | | | | | | | | | Move all header files to the new `include` directory. Adapt include directives and build systems to the new directory. Change-Id: Iaddd6bbfa0624b166d422f665877f096983bf4cf Signed-off-by: Felix Singer <felix.singer@secunet.com> Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58622 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* NEED_PCI: remove macroThomas Heijligen2022-04-131-1/+0
| | | | | | | | | | The NEED_PCI macro is only used to guard prototypes. This is not needed. Change-Id: I6895b795bc96b3e251700bff4b0054407aac789a Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/62834 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* hwaccess: add endianness converting deserialization functionsThomas Heijligen2022-04-131-0/+2
| | | | | | | | | | | | | | | Add functions like `uint32_t read_le32(const void *base, size_t offset);` Read a 32 bit unsigned from a base with an offset. Having prototypes and a macro generated implementation makes it easier to read, understand and spot errors in one of them. Change-Id: Idde177acf8bc5f94cd046b6539dc31532c98e452 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/31016 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
* Endian conversion: move to platform.h and platform/endian*.cThomas Heijligen2022-04-121-2/+2
| | | | | | | | | | | Starting to move the platform dependent code to platform/ and provide the abstraction through the platform.h header. Change-Id: I35640282d451960f2a329ae24339ec05dbae6d30 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/62899 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* hwaccess: replace macros by C codeThomas Heijligen2022-04-121-7/+9
| | | | | | | | | | | | | | Split the code for endian conversion into separate files for big and little endian. The buildsystem selects the correct file for the used endianness. Replace the swab macros with `static inline` c functions. Define macros for returning the same or swapped value. Call those macros in the endian specific files. Change-Id: I86d38d816b37c283279c485fac8027f8fb94364a Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/62898 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* hwaccess_x86_io: clean header conceptThomas Heijligen2022-03-141-18/+0
| | | | | | | | | | | | | Move all function implementations into the .c file TEST: `[g]make [WARNERROR=no]` on Linux, FreeBSD, NetBSD, OpenBSD, DragonflyBSD, OpenIndiana, Debian-GNU/Hurd Change-Id: I1400704e9ac5fed00c096796536108d5bfb875e3 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/61276 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* flashchips,writeprotect_ranges: add range decoding functionNikolai Artemiev2022-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow chips to specify functions that map status register bits to protection ranges. These are used to enumerate available ranges and determine the protection state of chips. The patch also adds a range decoding function for the example chips. Many other chips can also be handled by it, though some will require different functions (e.g. MX25L6406 and related chips). Another approach that has been tried in cros flashrom is maintaining tables of range data, but it quickly becomes error prone and hard to validate. Using a function to interpret the ranges allows compact encoding with most chips and is flexible enough to allow chips with less predictable ranges to be handled as well. BUG=b:195381327,b:153800563 BRANCH=none TEST=dumped range tables, checked against datasheets Change-Id: Id163ed80938a946a502ed116e48e8236e36eb203 Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58480 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: Anastasia Klimchuk <aklm@chromium.org>
* meson.build: Don't depend on getrevision.shSamuel R. Messner2022-02-251-2/+2
| | | | | | | | | | | | | | | | `getrevision.sh` isn't included in exported source code (including GitHub's auto-generated tarballs and ZIPs). Per issue #95, the build shouldn't depend on getrevision.sh for this reason. Previously, however, Flashrom would not build from exported source using Meson due to it requiring `getrevision.sh`. This patch has Meson use the intended `getversion.sh` instead. Signed-off-by: Samuel R. Messner <powpowd@gmail.com> Change-Id: Id8601155b35f0299200c27d0278606127410ff16 Reviewed-on: https://review.coreboot.org/c/flashrom/+/62061 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* Add mediatek_i2c_spi interfaceNeill Corlett2022-02-011-0/+5
| | | | | | | | | | | | | | | Add a spi_master interface supporting MediaTek MST9U ISP mode. Autodetect the bus type via I2C_FUNC_I2C, and use the appropriate read/write commands, in case the MST9U is attached to smbus. TEST=Successfully programmed SPI on test hardware. Change-Id: I24adb14e7b4f7160e1c3ff941774064d5a81e820 Signed-off-by: Neill Corlett <corlett@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/61288 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* meson: sync programmer dependencies from MakefilePeter Marheine2022-01-251-44/+65
| | | | | | | | | | | | | | | | | | | | | | The Makefile recently gained finer-grained programmer dependency lists allowing it to track which enabled programmers assume various things about the system, like availability of libraries or the CPU architecture. This change implements the same changes in the Meson configuration file. This fixes a number of programmers to correctly build on non-x86 systems, because they were previously misclassified as dependent on x86 architectural features but actually only used PCI. BUG=none TEST=meson build succeeds on both x86 and ARM Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: Iae93111fd48865f3fe8dd0eb637349b9a0c4affc Reviewed-on: https://review.coreboot.org/c/flashrom/+/61287 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
* Makefile: replace RAW_ACCESS with RAW_MEM_ACCESS X86_MSR X86_PORT_IOThomas Heijligen2022-01-201-1/+0
| | | | | | | | | | | | Let programmer only depend on the kind of hardware access method they really need. Libpci no longer depends on all hardware access types since each programmer handles this individually. Change-Id: I5bdafaa3c5023ad6c4a695493eeddf11bc148085 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/60325 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* hwaccess: move mmio functions into hwaccess_physmapThomas Heijligen2022-01-201-1/+0
| | | | | | | | | | | The mmio_le/be_read/writex functions are used for raw memory access. Bundle them with the physmap functions. Change-Id: I313062b078e89630c703038866ac93c651f0f49a Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/61160 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* physmap: rename to hwaccess_physmap, create own headerThomas Heijligen2021-12-221-1/+1
| | | | | | | | | | Line up physmap with the other hwaccess related code. Change-Id: Ieba6f4e94cfc3e668fcb8b3c978de5908aed2592 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/60113 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* hwaccess physmap: move x86 msr related code into own filesThomas Heijligen2021-12-221-0/+1
| | | | | | | | | | | | Allow x86 msr related code to be compiled independent from memory mapping functionality. This enables for a better selection of needed hardware access types. Change-Id: Idc9ce9df3ea1e291ad469de59467646b294119c4 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/60111 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* hwaccess: move x86 port I/O related code into own filesThomas Heijligen2021-12-221-0/+2
| | | | | | | | | | | | Allow port I/O related code to be compiled independent from memory mapping functionality. This enables for a better selection of needed hardware access types. Change-Id: I372b4a409f036da766c42bc406b596bc41b0f75a Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/60110 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* Makefile: meson.build: remove unused CONFIG_I2C_SUPPORTThomas Heijligen2021-10-261-1/+0
| | | | | | | | | | | | CONFIG_I2C_SUPPORT has no mention in the source code. No need to pass it to the compiler. Change-Id: I2e19335e1b8d39f44dda14edc0a496dda6bc8c9c Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58495 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* buildsystem: evaluate the USE_IOPL, USE_DEV_IO, USE_IOPERM macrosThomas Heijligen2021-10-151-0/+18
| | | | | | | | | | | Determine which macro has to be set for the target system. Do this in the buildsystem instead of using preprocessor macros. Change-Id: Ic41ea025e35feb93f07ce7a94c0d15e6e84f38b9 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58278 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* buildsystem: handle the IS_WINDOWS macroThomas Heijligen2021-10-151-0/+6
| | | | | | | | | | On Windows target systems set the IS_WINDOWS=1 macro by the buildsystem. Change-Id: I334708f2dec08ec9ca6ad4161fbd7fe22ac023a6 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58277 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* buildsystem: Determine the endianness only in the buildsystemThomas Heijligen2021-10-151-0/+7
| | | | | | | | | | | | | Let the buildsystem (make / meson) handle the endianness determination and set the __FLASHROM_LITTLE_ENDIAN__ or __FLASHROM_BIG_ENDIAN__ macro as cflag. Change-Id: I37093528ae55e712cc30a0267a8ceac332750e7d Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58273 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* custom_baud: move Linux specific code into own fileThomas Heijligen2021-09-281-1/+5
| | | | | | | | | | | Handle system specific code in an own file like i2c_helper_linux.c. The build system decides when to build it. Change-Id: I0744e769dcc6000483e7256105903a87e927ee77 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/57990 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>