From 237949491860bf1ca6f704e586bf723b7d8001e7 Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Mon, 11 Apr 2016 11:26:56 +0200 Subject: [pci] Add pci_find_next_capability() PCI devices may support more capabilities of the same type (for example PCI_CAP_ID_VNDR) and there was no way to discover all of them. This commit adds a new API pci_find_next_capability which provides this functionality. It would typically be used like so: for (pos = pci_find_capability(pci, PCI_CAP_ID_VNDR); pos > 0; pos = pci_find_next_capability(pci, pos, PCI_CAP_ID_VNDR)) { ... } Signed-off-by: Ladi Prosek Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael Brown --- src/include/ipxe/pci.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/include') diff --git a/src/include/ipxe/pci.h b/src/include/ipxe/pci.h index 89d9d8040..0c6bc7ed6 100644 --- a/src/include/ipxe/pci.h +++ b/src/include/ipxe/pci.h @@ -286,6 +286,8 @@ extern int pci_find_driver ( struct pci_device *pci ); extern int pci_probe ( struct pci_device *pci ); extern void pci_remove ( struct pci_device *pci ); extern int pci_find_capability ( struct pci_device *pci, int capability ); +extern int pci_find_next_capability ( struct pci_device *pci, + int pos, int capability ); extern unsigned long pci_bar_size ( struct pci_device *pci, unsigned int reg ); /** -- cgit v1.2.3-55-g7522