@@ -185,6 +185,21 @@ pci_find_class(u16 classid)
return -1;
}
+int pci_find_capability(int bdf, u8 capid)
+{
+ int ptr, cap;
+
+ ptr = PCI_CAPABILITY_LIST;
+ do {
+ cap = pci_config_readb(bdf, ptr);
+ if (pci_config_readb(bdf, cap) == capid)
+ return cap;
+ ptr = cap + PCI_CAP_LIST_NEXT;
+ } while (cap);
+
+ return -1;
+}
+
int *PCIpaths;
// Build the PCI path designations.
@@ -46,6 +46,7 @@ void pci_config_maskw(u16 bdf, u32 addr, u16 off, u16 on);
int pci_find_vga(void);
int pci_find_device(u16 vendid, u16 devid);
int pci_find_class(u16 classid);
+int pci_find_capability(int bdf, u8 capid);
#define PP_ROOT (1<<17)
#define PP_PCIBRIDGE (1<<18)