pcidev: Avoid internal programmer relying on pacc global

Make progress towards the goal of removing pacc from global
state as noted in the FIXME of programmer.h

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

Change-Id: Id83bfd41f785f907e52a65a6689e8c7016fc1b77
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/59275
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72300
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 1ec6455..a20d24b 100644
--- a/pcidev.c
+++ b/pcidev.c
@@ -148,6 +148,18 @@
 	return (uintptr_t)addr;
 }
 
+struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start)
+{
+	struct pci_dev *temp;
+	for (temp = start ? start->next : pacc->devices; temp; temp = temp->next) {
+		if (pci_filter_match(filter, temp)) {
+			pci_fill_info(temp, PCI_FILL_IDENT);
+			return temp;
+		}
+	}
+	return NULL;
+}
+
 static int pcidev_shutdown(void *data)
 {
 	if (pacc == NULL) {