xref: /openbsd/sys/dev/pci/pci_quirks.c (revision a3f5c57b)
1*a3f5c57bSmickey /*	$OpenBSD: pci_quirks.c,v 1.2 2000/03/28 03:43:54 mickey Exp $	*/
2*a3f5c57bSmickey /*	$NetBSD: pci_quirks.c,v 1.1 1998/05/31 06:03:44 cgd Exp $	*/
36661564bSmickey 
46661564bSmickey /*
56661564bSmickey  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
66661564bSmickey  *
76661564bSmickey  * Redistribution and use in source and binary forms, with or without
86661564bSmickey  * modification, are permitted provided that the following conditions
96661564bSmickey  * are met:
106661564bSmickey  * 1. Redistributions of source code must retain the above copyright
116661564bSmickey  *    notice, this list of conditions and the following disclaimer.
126661564bSmickey  * 2. Redistributions in binary form must reproduce the above copyright
136661564bSmickey  *    notice, this list of conditions and the following disclaimer in the
146661564bSmickey  *    documentation and/or other materials provided with the distribution.
156661564bSmickey  * 3. All advertising materials mentioning features or use of this software
166661564bSmickey  *    must display the following acknowledgement:
176661564bSmickey  *      This product includes software developed by Christopher G. Demetriou
186661564bSmickey  *	for the NetBSD Project.
196661564bSmickey  * 4. The name of the author may not be used to endorse or promote products
206661564bSmickey  *    derived from this software without specific prior written permission
216661564bSmickey  *
226661564bSmickey  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
236661564bSmickey  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
246661564bSmickey  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
256661564bSmickey  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
266661564bSmickey  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
276661564bSmickey  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
286661564bSmickey  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
296661564bSmickey  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
306661564bSmickey  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
316661564bSmickey  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
326661564bSmickey  */
336661564bSmickey 
346661564bSmickey /*
356661564bSmickey  * PCI Quirk data table and lookup function.
366661564bSmickey  */
376661564bSmickey 
386661564bSmickey #include <sys/param.h>
396661564bSmickey #include <sys/device.h>
406661564bSmickey 
416661564bSmickey #include <dev/pci/pcireg.h>
426661564bSmickey #include <dev/pci/pcivar.h>
436661564bSmickey #include <dev/pci/pcidevs.h>
446661564bSmickey 
456661564bSmickey static const struct pci_quirkdata pci_quirks[] = {
466661564bSmickey 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371FB_ISA,
476661564bSmickey 	    PCI_QUIRK_MULTIFUNCTION },
486661564bSmickey };
496661564bSmickey 
506661564bSmickey const struct pci_quirkdata *
516661564bSmickey pci_lookup_quirkdata(vendor, product)
526661564bSmickey 	pci_vendor_id_t vendor;
536661564bSmickey 	pci_product_id_t product;
546661564bSmickey {
556661564bSmickey 	int i;
566661564bSmickey 
576661564bSmickey 	for (i = 0; i < (sizeof pci_quirks / sizeof pci_quirks[0]); i++)
586661564bSmickey 		if (vendor == pci_quirks[i].vendor &&
596661564bSmickey 		    product == pci_quirks[i].product)
606661564bSmickey 			return (&pci_quirks[i]);
616661564bSmickey 	return (NULL);
626661564bSmickey }
63