Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/59279 )
Change subject: pcidev.c: Move pci_card_find() from internal to canonical place ......................................................................
pcidev.c: Move pci_card_find() from internal to canonical place
BUG=none TEST=builds
Change-Id: I026bfbecba114411728d4ad1ed8969b469fa7d2d Signed-off-by: Edward O'Callaghan quasisec@google.com --- M board_enable.c M internal.c M pcidev.c M programmer.h 4 files changed, 24 insertions(+), 24 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/79/59279/1
diff --git a/board_enable.c b/board_enable.c index d668cd8..b86cfe6 100644 --- a/board_enable.c +++ b/board_enable.c @@ -2635,14 +2635,14 @@ if (board->phase != phase) continue;
- if (!pci_card_find(board->first_vendor, board->first_device, + if (!pcidev_card_find(board->first_vendor, board->first_device, board->first_card_vendor, board->first_card_device)) continue;
if (board->second_vendor) { if (board->second_card_vendor) { - if (!pci_card_find(board->second_vendor, + if (!pcidev_card_find(board->second_vendor, board->second_device, board->second_card_vendor, board->second_card_device)) diff --git a/internal.c b/internal.c index 84ada73..0fc150b 100644 --- a/internal.c +++ b/internal.c @@ -40,26 +40,6 @@ return pcidev_scandev(&filter); }
-struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device, - uint16_t card_vendor, uint16_t card_device) -{ - struct pci_dev *temp; - struct pci_filter filter; - - pci_filter_init(NULL, &filter); - filter.vendor = vendor; - filter.device = device; - - temp = pcidev_scandev(&filter); - if (temp) { - if ((card_vendor == pci_read_word(temp, PCI_SUBSYSTEM_VENDOR_ID)) - && (card_device == pci_read_word(temp, PCI_SUBSYSTEM_ID))) - return temp; - } - - return NULL; -} - #if defined(__i386__) || defined(__x86_64__) void probe_superio(void) { diff --git a/pcidev.c b/pcidev.c index 2c1f6d7..9ecd042 100644 --- a/pcidev.c +++ b/pcidev.c @@ -184,6 +184,26 @@ return NULL; }
+struct pci_dev *pcidev_card_find(uint16_t vendor, uint16_t device, + uint16_t card_vendor, uint16_t card_device) +{ + struct pci_dev *temp; + struct pci_filter filter; + + pci_filter_init(NULL, &filter); + filter.vendor = vendor; + filter.device = device; + + temp = pcidev_scandev(&filter); + if (temp) { + if ((card_vendor == pci_read_word(temp, PCI_SUBSYSTEM_VENDOR_ID)) + && (card_device == pci_read_word(temp, PCI_SUBSYSTEM_ID))) + return temp; + } + + return NULL; +} + struct pci_dev *pcidev_getdev(struct pci_dev *dev) { #if !defined(OLD_PCI_GET_DEV) diff --git a/programmer.h b/programmer.h index 87a8c22..35306ed 100644 --- a/programmer.h +++ b/programmer.h @@ -127,6 +127,8 @@ struct pci_dev *pcidev_scandev(struct pci_filter *filter); struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass); struct pci_dev *pcidev_getdev(struct pci_dev *dev); +struct pci_dev *pcidev_card_find(uint16_t vendor, uint16_t device, + uint16_t card_vendor, uint16_t card_device); /* rpci_write_* are reversible writes. The original PCI config space register * contents will be restored on shutdown. * To clone the pci_dev instances internally, the `pacc` global @@ -271,8 +273,6 @@ #endif #if NEED_PCI == 1 struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device); -struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device, - uint16_t card_vendor, uint16_t card_device); #endif int rget_io_perms(void); #if CONFIG_INTERNAL == 1