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