diff options
| author | Thomas Heijligen <thomas.heijligen@secunet.com> | 2023-02-27 16:02:28 +0100 | 
|---|---|---|
| committer | Thomas Heijligen <src@posteo.de> | 2023-03-10 15:54:52 +0000 | 
| commit | 0e4d4eac78fbf437ba8e9b1c9d27600d2190023b (patch) | |
| tree | a8aa31f8bf662347840503ee507cfa21c5f77ebe | |
| parent | c433910718cf5d5664aab87773ae473061e6b87b (diff) | |
| download | flashrom-0e4d4eac78fbf437ba8e9b1c9d27600d2190023b.tar.gz flashrom-0e4d4eac78fbf437ba8e9b1c9d27600d2190023b.tar.bz2 flashrom-0e4d4eac78fbf437ba8e9b1c9d27600d2190023b.zip  | |
libpci: drop support for pciutils < 2.2.0
This version was released in september 2005 and had a breaking api
change. Drop it so that we don't need to maintain the old codepath any
longer. Beside that, we have already a second codepath which is using
the new `pci_get_dev` variant exclusively.
Change-Id: If943db350b561a005d8292a53d9255223db3d571
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/73293
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | Makefile.d/pci_old_get_dev_test.c | 17 | ||||
| -rw-r--r-- | include/platform/pci.h | 26 | ||||
| -rw-r--r-- | meson.build | 3 | ||||
| -rw-r--r-- | pcidev.c | 8 | 
5 files changed, 16 insertions, 40 deletions
@@ -251,7 +251,6 @@ HAS_LIBJAYLINK      := $(call find_dependency, libjaylink)  HAS_LIBUSB1         := $(call find_dependency, libusb-1.0)  HAS_LIBPCI          := $(call find_dependency, libpci) -HAS_PCI_OLD_GET_DEV := $(call c_compile_test, Makefile.d/pci_old_get_dev_test.c, $(CONFIG_LIBPCI_CFLAGS))  HAS_FT232H          := $(call c_compile_test, Makefile.d/ft232h_test.c, $(CONFIG_LIBFTDI1_CFLAGS))  HAS_UTSNAME         := $(call c_compile_test, Makefile.d/utsname_test.c)  HAS_CLOCK_GETTIME   := $(call c_compile_test, Makefile.d/clock_gettime_test.c) @@ -981,7 +980,6 @@ config:  	@if [ $(ENDIAN) = unknown ]; then echo Aborting.; exit 1; fi  	@echo Dependency libpci found: $(HAS_LIBPCI) $(CONFIG_LIBPCI_VERSION)  	@if [ $(HAS_LIBPCI) = yes ]; then			\ -		echo "  Checking for old \"pci_get_dev()\": $(HAS_PCI_OLD_GET_DEV)";\  		echo "  CFLAGS: $(CONFIG_LIBPCI_CFLAGS)";	\  		echo "  LDFLAGS: $(CONFIG_LIBPCI_LDFLAGS)";	\  	fi diff --git a/Makefile.d/pci_old_get_dev_test.c b/Makefile.d/pci_old_get_dev_test.c deleted file mode 100644 index 32236515..00000000 --- a/Makefile.d/pci_old_get_dev_test.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Avoid a failing test due to libpci header symbol shadowing breakage */ -#define index shadow_workaround_index -#if !defined __NetBSD__ -#include <pci/pci.h> -#else -#include <pciutils/pci.h> -#endif -struct pci_access *pacc; -struct pci_dev *dev = {0}; -int main(int argc, char **argv) -{ -	(void) argc; -	(void) argv; -	pacc = pci_alloc(); -	dev = pci_get_dev(pacc, dev->bus, dev->dev, 1); -	return 0; -} diff --git a/include/platform/pci.h b/include/platform/pci.h index a0324f88..4ac108f2 100644 --- a/include/platform/pci.h +++ b/include/platform/pci.h @@ -1,19 +1,23 @@  /* - * This is a wrapper for libpci. - * ... + * This file is part of the flashrom project. + * + * Copyright (C) 2022 secunet Security Networks AG + * (written by Thomas Heijligen <thomas.heijligen@secunet.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details.   */ -  #ifndef __PLATFORM_PCI_H__  #define __PLATFORM_PCI_H__ -/* - * An old libpci version seems to use the variable name "index" which triggers - * shadowing warnings on systems which have the index() function in a default - * #include or as builtin. - */ -#define index shadow_workaround_index -  /* Some NetBSDs are using an other include path for pci.h   * e.g. NetBSD 9.0 on sparc64 pciutils-3.7.0nb2.   * Other NetBSD platforms and versions uses the default path under pci/pci.h @@ -24,6 +28,4 @@  #include <pci/pci.h>  #endif -#undef index -  #endif /* __PLATFORM_PCI_H__ */ diff --git a/meson.build b/meson.build index 2ecb5faf..5c38749f 100644 --- a/meson.build +++ b/meson.build @@ -126,7 +126,8 @@ group_jlink  = get_option('programmer').contains('group_jlink')  group_internal = get_option('programmer').contains('group_internal')  group_external = get_option('programmer').contains('group_external') -libpci     = dependency('libpci', required : group_pci, static : (host_machine.system() == 'openbsd' ? true : false)) # On openbsd a static version of libpci is needed to get also -libz +libpci     = dependency('libpci', required : group_pci, version : '>=2.2.0', +  static : (host_machine.system() == 'openbsd' ? true : false)) # On openbsd a static version of libpci is needed to get also -libz  libusb1    = dependency('libusb-1.0', required : group_usb)  libftdi1   = dependency('libftdi1', required : group_ftdi)  libjaylink = dependency('libjaylink', required : group_jlink) @@ -192,15 +192,7 @@ struct pci_dev *pcidev_find(uint16_t vendor, uint16_t device)  struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func)  { -#if !defined(OLD_PCI_GET_DEV)  	struct pci_dev *const new = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, func); -#else -	/* pciutils/libpci before version 2.2 is too old to support -	 * PCI domains. Such old machines usually don't have domains -	 * besides domain 0, so this is not a problem. -	 */ -	struct pci_dev *const new = pci_get_dev(pacc, dev->bus, dev->dev, func); -#endif  	if (new)  		pci_fill_info(new, PCI_FILL_IDENT);  	return new;  | 
