pcidev: Move pci_card_find() from internal to canonical place

Also rename to `pcidev_card_find()` in fitting with pcidev.c helpers.

Tested: ```sudo ./flashrom -p internal -r /tmp/bios
<snip>
Found Programmer flash chip "Opaque flash chip" (16384 kB, Programmer-specific) mapped at physical address 0x0000000000000000.
Reading flash... done.
```

Change-Id: I026bfbecba114411728d4ad1ed8969b469fa7d2d
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/59279
Original-Reviewed-by: Thomas Heijligen <src@posteo.de>
Original-Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72309
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/pcidev.c b/pcidev.c
index 3515871..02b39b3 100644
--- a/pcidev.c
+++ b/pcidev.c
@@ -160,6 +160,25 @@
 	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 = NULL;
+	struct pci_filter filter;
+
+	pci_filter_init(NULL, &filter);
+	filter.vendor = vendor;
+	filter.device = device;
+
+	while ((temp = pcidev_scandev(&filter, 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_find_vendorclass(uint16_t vendor, uint16_t devclass)
 {
 	struct pci_dev *temp = NULL;