xref: /dflybsd-src/sys/bus/pci/ignore_pci.c (revision 2267fd784e8a7d1ca13e6d3541caa91f36c9e9fb)
14d28e78fSSepherosa Ziehau /*-
24d28e78fSSepherosa Ziehau  * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
34d28e78fSSepherosa Ziehau  * Copyright (c) 2000 BSDi
44d28e78fSSepherosa Ziehau  * All rights reserved.
54d28e78fSSepherosa Ziehau  *
64d28e78fSSepherosa Ziehau  * Redistribution and use in source and binary forms, with or without
74d28e78fSSepherosa Ziehau  * modification, are permitted provided that the following conditions
84d28e78fSSepherosa Ziehau  * are met:
94d28e78fSSepherosa Ziehau  * 1. Redistributions of source code must retain the above copyright
104d28e78fSSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer.
114d28e78fSSepherosa Ziehau  * 2. Redistributions in binary form must reproduce the above copyright
124d28e78fSSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer in the
134d28e78fSSepherosa Ziehau  *    documentation and/or other materials provided with the distribution.
144d28e78fSSepherosa Ziehau  *
154d28e78fSSepherosa Ziehau  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
164d28e78fSSepherosa Ziehau  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
174d28e78fSSepherosa Ziehau  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
184d28e78fSSepherosa Ziehau  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
194d28e78fSSepherosa Ziehau  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
204d28e78fSSepherosa Ziehau  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
214d28e78fSSepherosa Ziehau  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
224d28e78fSSepherosa Ziehau  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
234d28e78fSSepherosa Ziehau  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
244d28e78fSSepherosa Ziehau  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
254d28e78fSSepherosa Ziehau  * SUCH DAMAGE.
2683c1faaaSSascha Wildner  *
2783c1faaaSSascha Wildner  * $FreeBSD: src/sys/dev/pci/ignore_pci.c,v 1.4.28.1 2009/04/15 03:14:26 kensmith Exp $
284d28e78fSSepherosa Ziehau  */
294d28e78fSSepherosa Ziehau 
304d28e78fSSepherosa Ziehau /*
314d28e78fSSepherosa Ziehau  * 'Ignore' driver - eats devices that show up errnoeously on PCI
324d28e78fSSepherosa Ziehau  * but shouldn't ever be listed or handled by a driver.
334d28e78fSSepherosa Ziehau  */
344d28e78fSSepherosa Ziehau 
354d28e78fSSepherosa Ziehau #include <sys/param.h>
364d28e78fSSepherosa Ziehau #include <sys/kernel.h>
374d28e78fSSepherosa Ziehau #include <sys/module.h>
384d28e78fSSepherosa Ziehau #include <sys/bus.h>
394d28e78fSSepherosa Ziehau 
404d28e78fSSepherosa Ziehau #include <bus/pci/pcivar.h>
414d28e78fSSepherosa Ziehau 
424d28e78fSSepherosa Ziehau static int	ignore_pci_probe(device_t dev);
434d28e78fSSepherosa Ziehau 
444d28e78fSSepherosa Ziehau static device_method_t ignore_pci_methods[] = {
454d28e78fSSepherosa Ziehau     /* Device interface */
464d28e78fSSepherosa Ziehau     DEVMETHOD(device_probe,		ignore_pci_probe),
474d28e78fSSepherosa Ziehau     DEVMETHOD(device_attach,		bus_generic_attach),
48*d3c9c58eSSascha Wildner     DEVMETHOD_END
494d28e78fSSepherosa Ziehau };
504d28e78fSSepherosa Ziehau 
514d28e78fSSepherosa Ziehau static driver_t ignore_pci_driver = {
524d28e78fSSepherosa Ziehau     "ignore_pci",
534d28e78fSSepherosa Ziehau     ignore_pci_methods,
544d28e78fSSepherosa Ziehau     0,
554d28e78fSSepherosa Ziehau };
564d28e78fSSepherosa Ziehau 
574d28e78fSSepherosa Ziehau static devclass_t ignore_pci_devclass;
584d28e78fSSepherosa Ziehau 
59aa2b9d05SSascha Wildner DRIVER_MODULE(ignore_pci, pci, ignore_pci_driver, ignore_pci_devclass, NULL, NULL);
604d28e78fSSepherosa Ziehau 
614d28e78fSSepherosa Ziehau static int
ignore_pci_probe(device_t dev)624d28e78fSSepherosa Ziehau ignore_pci_probe(device_t dev)
634d28e78fSSepherosa Ziehau {
644d28e78fSSepherosa Ziehau     switch (pci_get_devid(dev)) {
654d28e78fSSepherosa Ziehau     case 0x10001042ul:	/* SMC 37C665 */
664d28e78fSSepherosa Ziehau 	device_set_desc(dev, "ignored");
674d28e78fSSepherosa Ziehau 	device_quiet(dev);
684d28e78fSSepherosa Ziehau 	return(-10000);
694d28e78fSSepherosa Ziehau     }
704d28e78fSSepherosa Ziehau     return(ENXIO);
714d28e78fSSepherosa Ziehau }
72