xref: /netbsd/sys/dev/marvell/pchb.c (revision 6550d01e)
1 /*	$NetBSD: pchb.c,v 1.1 2010/04/28 13:51:56 kiyohara Exp $	*/
2 /*
3  * Copyright (c) 2008 KIYOHARA Takashi
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include <sys/cdefs.h>
29 __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.1 2010/04/28 13:51:56 kiyohara Exp $");
30 
31 #include "opt_pci.h"
32 #include "pci.h"
33 
34 #include <sys/param.h>
35 #include <sys/device.h>
36 #include <sys/errno.h>
37 
38 #include <dev/pci/pcireg.h>
39 #include <dev/pci/pcivar.h>
40 
41 #include <dev/marvell/marvellreg.h>
42 #include <dev/marvell/marvellvar.h>
43 
44 
45 static int pchb_match(device_t, struct cfdata *, void *);
46 static void pchb_attach(device_t, device_t, void *);
47 
48 CFATTACH_DECL_NEW(pchb, sizeof(struct device),
49     pchb_match, pchb_attach, NULL, NULL);
50 
51 
52 /* ARGSUSED */
53 static int
54 pchb_match(device_t parent, struct cfdata *match, void *aux)
55 {
56 	struct pci_attach_args *pa = aux;
57 
58 	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_MARVELL)
59 		switch (PCI_PRODUCT(pa->pa_id)) {
60 		case MARVELL_ORION_1_88F1181:
61 		case MARVELL_ORION_1_88F5082:
62 		case MARVELL_ORION_1_88F5181:
63 		case MARVELL_ORION_1_88F5182:
64 		case MARVELL_ORION_2_88F5281:
65 		case MARVELL_ORION_1_88W8660:
66 			return 1;
67 		}
68 
69 	return 0;
70 }
71 
72 /* ARGSUSED */
73 static void
74 pchb_attach(device_t parent, device_t self, void *aux)
75 {
76 
77 	aprint_normal("\n");
78 	aprint_naive("\n");
79 }
80