Date: Fri, 25 Jan 2019 20:13:28 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r343451 - in head/sys/compat/linuxkpi/common: include/linux src Message-ID: <201901252013.x0PKDSGx097907@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Jan 25 20:13:28 2019 New Revision: 343451 URL: https://svnweb.freebsd.org/changeset/base/343451 Log: Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Jan 25 20:10:57 2019 (r343450) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Jan 25 20:13:28 2019 (r343451) @@ -71,7 +71,7 @@ struct pci_device_id { #define PCI_BASE_CLASS_BRIDGE 0x06 #define PCI_CLASS_BRIDGE_ISA 0x0601 -#define PCI_ANY_ID (-1) +#define PCI_ANY_ID -1U #define PCI_VENDOR_ID_APPLE 0x106b #define PCI_VENDOR_ID_ASUSTEK 0x1043 #define PCI_VENDOR_ID_ATI 0x1002 Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Fri Jan 25 20:10:57 2019 (r343450) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Fri Jan 25 20:13:28 2019 (r343451) @@ -82,14 +82,21 @@ linux_pci_find(device_t dev, const struct pci_device_i struct pci_driver *pdrv; uint16_t vendor; uint16_t device; + uint16_t subvendor; + uint16_t subdevice; vendor = pci_get_vendor(dev); device = pci_get_device(dev); + subvendor = pci_get_subvendor(dev); + subdevice = pci_get_subdevice(dev); spin_lock(&pci_lock); list_for_each_entry(pdrv, &pci_drivers, links) { for (id = pdrv->id_table; id->vendor != 0; id++) { - if (vendor == id->vendor && device == id->device) { + if (vendor == id->vendor && + (PCI_ANY_ID == id->device || device == id->device) && + (PCI_ANY_ID == id->subvendor || subvendor == id->subvendor) && + (PCI_ANY_ID == id->subdevice || subdevice == id->subdevice)) { *idp = id; spin_unlock(&pci_lock); return (pdrv); @@ -145,8 +152,8 @@ linux_pci_attach(device_t dev) pdev->dev.bsddev = dev; INIT_LIST_HEAD(&pdev->dev.irqents); pdev->devfn = PCI_DEVFN(pci_get_slot(dev), pci_get_function(dev)); - pdev->device = id->device; - pdev->vendor = id->vendor; + pdev->device = dinfo->cfg.device; + pdev->vendor = dinfo->cfg.vendor; pdev->subsystem_vendor = dinfo->cfg.subvendor; pdev->subsystem_device = dinfo->cfg.subdevice; pdev->class = pci_get_class(dev);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901252013.x0PKDSGx097907>