xref: /openbsd/sys/dev/pci/pci_quirks.c (revision d01f20c4)
1*d01f20c4Smiod /*	$OpenBSD: pci_quirks.c,v 1.7 2015/07/20 18:05:04 miod Exp $	*/
2a3f5c57bSmickey /*	$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 
406661564bSmickey #include <dev/pci/pcireg.h>
416661564bSmickey #include <dev/pci/pcivar.h>
426661564bSmickey #include <dev/pci/pcidevs.h>
436661564bSmickey 
446661564bSmickey static const struct pci_quirkdata pci_quirks[] = {
456661564bSmickey 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371FB_ISA,
46*d01f20c4Smiod 	    PCI_QUIRK_MULTIFUNCTION },
47*d01f20c4Smiod 	{ PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_PD6729,
48*d01f20c4Smiod 	    PCI_QUIRK_MONOFUNCTION }
496661564bSmickey };
506661564bSmickey 
516661564bSmickey const struct pci_quirkdata *
pci_lookup_quirkdata(pci_vendor_id_t vendor,pci_product_id_t product)52b672c29dSbrad pci_lookup_quirkdata(pci_vendor_id_t vendor, pci_product_id_t product)
536661564bSmickey {
546661564bSmickey 	int i;
556661564bSmickey 
566661564bSmickey 	for (i = 0; i < (sizeof pci_quirks / sizeof pci_quirks[0]); i++)
576661564bSmickey 		if (vendor == pci_quirks[i].vendor &&
586661564bSmickey 		    product == pci_quirks[i].product)
596661564bSmickey 			return (&pci_quirks[i]);
606661564bSmickey 	return (NULL);
616661564bSmickey }
62