aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* mec1308: remove MEC1308 EC programmerVictor Ding2021-09-221-5/+0
| | | | | | | | | | | | | | | | | Best efforts were made to upstream older Chromebook support for good intentions for folks interested. However, we no longer have the hardware available to test and maintain the code as the hardware is now end of life. Therefore the code state has sadly fallen into a unknown state. BUG=none BRANCH=none TEST=builds and ninja test passes Signed-off-by: Victor Ding <victording@google.com> Change-Id: I535b6380846734c999474519e9e60a73eb6a2ec4 Reviewed-on: https://review.coreboot.org/c/flashrom/+/56476 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* ene_lpc: remove ENE LPC programmerVictor Ding2021-09-221-5/+0
| | | | | | | | | | | | | | | | | Best efforts were made to upstream older Chromebook support for good intentions for folks interested. However, we no longer have the hardware available to test and maintain the code as the hardware is now end of life. Therefore the code state has sadly fallen into a unknown state. BUG=none BRANCH=none TEST=builds and ninja test passes Signed-off-by: Victor Ding <victording@google.com> Change-Id: I3f40db22c42c04ce029c4defd837e05ebb550c9b Reviewed-on: https://review.coreboot.org/c/flashrom/+/56475 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* CONFIG_DEFAULT_PROGRAMMER_NAME: Use programmer name instead of enumThomas Heijligen2021-06-101-3/+11
| | | | | | | | | | | | | | CONFIG_DEFAULT_PROGRAMER_NAME replaces CONFIG_DEFAULT_PROGRAMMER. It uses the name of the programmer for identification. make CONFIG_DEFAULT_PROGRAMER_NAME=dummy and meson -Ddefault_programmer_name=dummy will extend to CONFIG_DEFAULT_PROGRAMER_NAME=&programmer_dummy in the code. Change-Id: I976447787c6f6bfbdc0145d80d61e1ddcf97ac33 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55123 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* programmer_table: move array content to an own fileThomas Heijligen2021-06-091-0/+1
| | | | | | | | Change-Id: I8e6d704e845ee4152c8676dd19dff0934fff007b Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/52944 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: Add unit test to run init/shutdown for mec1308.c, ene_lpc.cAnastasia Klimchuk2021-06-051-0/+1
| | | | | | | | | | | | | | | | This patch includes mocks for io operations in hwaccess_x86_io.h because those are needed to test lifecycle of mec1308.c and ene_lpc.c BUG=b:181803212 TEST=builds and ninja test Change-Id: I3af612defe1af3850dfc1626a208d873e3a3eddc Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/51487 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson.build: Fix cmocka to be optional at configure-timeEdward O'Callaghan2021-05-181-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | While building with meson, however without libcmocka available, attempts are made to fetch a copy to build via the wrap mechanism. However in hermetic build enviroments this causes hard failure as the dependency declaration of cmocka is not optional. Fix this to ensure flashrom can build hermetically in images without libcmocka available. BUG=none BRANCH=none TEST=` $ mkdir build && cd build/ $ meson --wrap-mode=nodownload --wrap-mode=nofallback ../ $ ninja test # validate configs, builds and no tests are run. -- $ sudo apt install libcmocka-dev $ mkdir build && cd build/ $ meson --wrap-mode=nodownload --wrap-mode=nofallback ../ $ ninja test # validate configs, builds and tests are run. ` Change-Id: Ib59f4dacc14be9b02334ca59b348c19e22963367 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54368 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* meson: remove rayer_spi dependency on libpciDaniel Campello2021-04-141-1/+1
| | | | | | | | | | | | | This change removes the build dependency on libpci for config_rayer_spi it also makes sure that dependency on raw_access is maintained. Signed-off-by: Daniel Campello <campello@chromium.org> Change-Id: If7206a69d031c9bba9475a9e6769f6ef35701379 Reviewed-on: https://review.coreboot.org/c/flashrom/+/51929 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
* Makefile,meson.build: Fix dependency issues with raiden_debug_spiEdward O'Callaghan2021-04-011-1/+1
| | | | | | | | | | | | | | | | | | The Raiden debug external spi programmer need only depend on libusb and is unrelated to libpci. Correct meson and gnu make builds where meson had configuration in the incorrect section and gnu make artifactually disabled the build on Windows/MinGW which doesn't have libpci. BUG=none TEST=still continues to build. Change-Id: I2d6a8c33a2228abf006a9b278bcb7133765c7074 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/51930 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
* Enable dynamic memory allocation checks for cmocka unit testsAnastasia Klimchuk2021-04-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit enables the feature and makes changes to existing files and tests. I am writing more new tests with this. Commit includes tests/flashrom.c because after enabling memory checks the test started to fail (it used to leak memory indeed). If you are wondering how to verify it works (because at the moment all tests [still] pass so it’s not obvious that anything has changed), then for example: 1) Remove free’s in flashbuses_to_text_test_success test, and it will fail with message similar to this (line numbers from your local source) [ ERROR ] --- Blocks allocated... ../flashrom.c:1239: note: block 0x55f42304b640 allocated here ../flashrom.c:1239: note: block 0x55f42304b5c0 allocated here ../flashrom.c:1239: note: block 0x55f42304b3d0 allocated here ../flashrom.c:1239: note: block 0x55f42304b700 allocated here ../flashrom.c:1239: note: block 0x55f42304b780 allocated here ../flashrom.c:1239: note: block 0x55f42304bb00 allocated here ../flashrom.c:1239: note: block 0x55f42304b810 allocated here ERROR: flashbuses_to_text_test_success leaked 7 block(s) 2) Add char *temp = malloc just before return from strcat_realloc [ ERROR ] --- Blocks allocated... ../helpers.c:88: note: block 0x55a51307b6c0 allocated here ../helpers.c:88: note: block 0x55a51307b9e0 allocated here ERROR: strcat_realloc_test_success leaked 2 block(s) BUG=b:181803212 TEST=builds and ninja test nm builddir/tests/flashrom_unit_tests.p/.._flashrom.c.o nm builddir/tests/flashrom_unit_tests.p/flashrom.c.o nm builddir/flashrom.p/flashrom.c.o Change-Id: I0c6b6b8dc17aaee28640e3fca3d1fc9f7feabf5f Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/51243 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* meson: Generalise libflashrom product to link as static or dynDaniel Campello2021-03-191-1/+1
| | | | | | | | | | | Allow the user to specify if they would like a static archive or a DSO produced for libflashrom by way of the flag e.g. `-Ddefault_library=static`. Signed-off-by: Daniel Campello <campello@chromium.org> Change-Id: I77e5c298163979a0222270b3ac5d03542e5618f7 Reviewed-on: https://review.coreboot.org/c/flashrom/+/51616 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>