[pci] Add pci_find_next_capability()
authorLadi Prosek <lprosek@redhat.com>
Mon, 11 Apr 2016 09:26:56 +0000 (11:26 +0200)
committerMichael Brown <mcb30@ipxe.org>
Fri, 15 Apr 2016 16:27:35 +0000 (17:27 +0100)
commit237949491860bf1ca6f704e586bf723b7d8001e7
treeda2727dc1b3d8b559190053112584bc2a949c297
parent5e5450c2d04e6f976ea4cef5db50e136d4a06282
[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 <lprosek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/bus/pciextra.c
src/include/ipxe/pci.h