aboutsummaryrefslogtreecommitdiffstats
path: root/pcidev.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2021-11-13 13:14:06 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2022-02-24 23:30:51 +0000
commit634707a42d0a4670e5177638986232c4e992d403 (patch)
treec8c0fdb6c2dc7a2a2505259b06831ec2f8432ee1 /pcidev.c
parent2740a52dbd5bf4f32daee76c0c36649b8b547725 (diff)
downloadflashrom-634707a42d0a4670e5177638986232c4e992d403.tar.gz
flashrom-634707a42d0a4670e5177638986232c4e992d403.tar.bz2
flashrom-634707a42d0a4670e5177638986232c4e992d403.zip
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 BUG=b:220950271 TEST=```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> Reviewed-on: https://review.coreboot.org/c/flashrom/+/59275 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'pcidev.c')
-rw-r--r--pcidev.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pcidev.c b/pcidev.c
index bd558ed2..f3238518 100644
--- a/pcidev.c
+++ b/pcidev.c
@@ -148,6 +148,15 @@ uintptr_t pcidev_readbar(struct pci_dev *dev, int bar)
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))
+ return temp;
+ return NULL;
+}
+
static int pcidev_shutdown(void *data)
{
if (pacc == NULL) {