Module Name:    xsrc
Committed By:   mrg
Date:           Fri Jul 25 01:39:32 UTC 2014

Modified Files:
        xsrc/external/mit/libpciaccess/dist/src: netbsd_pci.c

Log Message:
implement the kernel_has_driver() method.  this has the benefit of
stopping the "vesa" driver from loading on hardware that has been
claimed by a kernel driver and thus shouldn't be using "vesa".


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
    xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c
diff -u xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.13 xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.14
--- xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.13	Mon Mar 17 02:42:09 2014
+++ xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c	Fri Jul 25 01:39:32 2014
@@ -841,6 +841,29 @@ pci_device_netbsd_unmap_legacy(struct pc
 	return pci_device_netbsd_unmap_range(dev, &map);
 }
 
+static int
+pci_device_netbsd_has_kernel_driver(struct pci_device *dev)
+{
+#ifdef PCI_IOC_DRVNAME
+	/*
+	 * NetBSD PCI_IOC_DRVNAME appears at the same time as pci_drvname(3)
+	 */
+	char drvname[16];
+
+	if (dev->bus >= nbuses)
+		return 0;
+
+	/*
+	 * vga(4) should be considered "not bound".
+	 */
+	if (pci_drvname(buses[dev->bus].fd, dev->dev, dev->func,
+			drvname, sizeof drvname) == 0 &&
+	    strncmp(drvname, "vga", 3) != 0)
+		return 1;
+#endif
+	return 0;
+}
+
 static const struct pci_system_methods netbsd_pci_methods = {
 	.destroy = pci_system_netbsd_destroy,
 	.destroy_device = NULL,
@@ -865,6 +888,7 @@ static const struct pci_system_methods n
 	.write8 = pci_device_netbsd_write8,
 	.map_legacy = pci_device_netbsd_map_legacy,
 	.unmap_legacy = pci_device_netbsd_unmap_legacy,
+	.has_kernel_driver = pci_device_netbsd_has_kernel_driver,
 };
 
 int

Reply via email to