On 07/07/16 16:44, Andrew Donnellan wrote:
We can match the vendor, device ID *and* class code - unfortunately
there isn't a macro for this, which makes it a little bit less
aesthetically pleasing, but I'm pretty sure this works.
Something like the below, which works fine:
/*
* Matches a given PCI vendor ID and device ID, but only for class 12
* (processing accelerators). Useful for bi-modal cards, such as the
* Mellanox ConnectX-4, which keep the same vendor/device ID
* post-mode-switch.
*/
#define PCI_DEVICE_ACCEL(vend, dev) \
.vendor = (vend), .device = (dev), \
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
.class = 0x120000, .class_mask = 0xff0000
static const struct pci_device_id cxl_pci_tbl[] = {
/* FPGA devices */
{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x0477), },
{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x044b), },
{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x04cf), },
{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x0601), },
/* Mellanox ConnectX-4 */
{ PCI_DEVICE_ACCEL(PCI_VENDOR_ID_MELLANOX, 0x1013), },
{ }
};
MODULE_DEVICE_TABLE(pci, cxl_pci_tbl);
--
Andrew Donnellan OzLabs, ADL Canberra
[email protected] IBM Australia Limited
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev