[PATCH:libpciaccess] Implement the kernel_has_driver() method for NetBSD.

Thomas Klausner wiz at NetBSD.org
Sat Aug 30 13:46:36 PDT 2014


On Sat, Aug 30, 2014 at 09:37:47PM +0200, Matthieu Herrb wrote:
> B0;309;0cOn Sat, Jul 26, 2014 at 10:10:28PM +0200, Thomas Klausner wrote:
> > From: Matthew Green <mrg at NetBSD.org>
> > 
> > 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".
> > 
> > Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
> 
> sorry for beeing that late. 

No worries.

> Reviewed-by: Matthieu Herrb <matthieu at herrb.eu>

Thank you, pushed!
 Thomas

> > ---
> >  src/netbsd_pci.c | 24 ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
> > 
> > diff --git a/src/netbsd_pci.c b/src/netbsd_pci.c
> > index e6dae4c..52591b0 100644
> > --- a/src/netbsd_pci.c
> > +++ b/src/netbsd_pci.c
> > @@ -843,6 +843,29 @@ pci_device_netbsd_unmap_legacy(struct pci_device *dev, void *addr,
> >  	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,
> > @@ -867,6 +890,7 @@ static const struct pci_system_methods netbsd_pci_methods = {
> >  	.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
> > -- 
> > 1.9.4
> > 
> > _______________________________________________
> > xorg-devel at lists.x.org: X.Org development
> > Archives: http://lists.x.org/archives/xorg-devel
> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 
> -- 
> Matthieu Herrb


More information about the xorg-devel mailing list