diff options
-rw-r--r-- | core/pci-quirk.c | 9 | ||||
-rw-r--r-- | core/pci.c | 2 | ||||
-rw-r--r-- | include/pci-quirk.h | 5 | ||||
-rw-r--r-- | include/pci.h | 2 |
4 files changed, 7 insertions, 11 deletions
diff --git a/core/pci-quirk.c b/core/pci-quirk.c index 383d92c..0153bdb 100644 --- a/core/pci-quirk.c +++ b/core/pci-quirk.c @@ -70,17 +70,14 @@ static const struct pci_quirk quirk_table[] = { {NULL} }; -void pci_handle_quirk(struct phb *phb, - struct pci_device *pd, - uint16_t vendor_id, - uint16_t device_id) +void pci_handle_quirk(struct phb *phb, struct pci_device *pd) { const struct pci_quirk *quirks = quirk_table; while (quirks->vendor_id) { - if (vendor_id == quirks->vendor_id && + if (quirks->vendor_id == PCI_VENDOR_ID(pd->vdid) && (quirks->device_id == PCI_ANY_ID || - device_id == quirks->device_id)) + quirks->device_id == PCI_DEVICE_ID(pd->vdid))) quirks->fixup(phb, pd); quirks++; } @@ -1467,7 +1467,7 @@ static void pci_add_one_device_node(struct phb *phb, if (intpin) dt_add_property_cells(np, "interrupts", intpin); - pci_handle_quirk(phb, pd, vdid & 0xffff, vdid >> 16); + pci_handle_quirk(phb, pd); /* XXX FIXME: Add a few missing ones such as * diff --git a/include/pci-quirk.h b/include/pci-quirk.h index c766973..1883248 100644 --- a/include/pci-quirk.h +++ b/include/pci-quirk.h @@ -27,9 +27,6 @@ struct pci_quirk { uint16_t device_id; }; -void pci_handle_quirk(struct phb *phb, - struct pci_device *pd, - uint16_t vendor_id, - uint16_t device_id); +void pci_handle_quirk(struct phb *phb, struct pci_device *pd); #endif /* __PCI_QUIRK_H */ diff --git a/include/pci.h b/include/pci.h index 0aea56c..f216594 100644 --- a/include/pci.h +++ b/include/pci.h @@ -73,6 +73,8 @@ struct pci_device { uint32_t vdid; uint32_t sub_vdid; +#define PCI_VENDOR_ID(x) ((x) & 0xFFFF) +#define PCI_DEVICE_ID(x) ((x) >> 8) uint32_t class; uint64_t cap_list; struct { |