[Skiboot] [PATCH 1/4] core/pci: Use cached vendor/device IDs in quirks
Gavin Shan
gwshan at linux.vnet.ibm.com
Fri Apr 7 10:16:17 AEST 2017
The PCI device vendor/device IDs have been cached to pd->vdid, no
need to pass them in pci_handle_quirk(). This also introduces two
macros to extract vendor/device fields and they are useful afterwards.
No logical changes introduced.
Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
core/pci-quirk.c | 9 +++------
core/pci.c | 2 +-
include/pci-quirk.h | 5 +----
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++;
}
diff --git a/core/pci.c b/core/pci.c
index a8b4b69..a93239b 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1450,7 +1450,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 dc418a9..296fb8d 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -72,6 +72,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 {
--
2.7.4
More information about the Skiboot
mailing list