xref: /netbsd-src/sys/arch/mips/ralink/ralink_pci.c (revision 31ad70f27765a17cac6b2f873d3df4e71a1475a2)
1*31ad70f2Smatt /* $NetBSD: ralink_pci.c,v 1.1 2014/04/29 17:21:24 matt Exp $ */
2*31ad70f2Smatt /*-
3*31ad70f2Smatt  * Copyright (c) 2014 The NetBSD Foundation, Inc.
4*31ad70f2Smatt  * All rights reserved.
5*31ad70f2Smatt  *
6*31ad70f2Smatt  * This code is derived from software contributed to The NetBSD Foundation
7*31ad70f2Smatt  * by Matt Thomas of 3am Software Foundry.
8*31ad70f2Smatt  *
9*31ad70f2Smatt  * Redistribution and use in source and binary forms, with or without
10*31ad70f2Smatt  * modification, are permitted provided that the following conditions
11*31ad70f2Smatt  * are met:
12*31ad70f2Smatt  * 1. Redistributions of source code must retain the above copyright
13*31ad70f2Smatt  *    notice, this list of conditions and the following disclaimer.
14*31ad70f2Smatt  * 2. Redistributions in binary form must reproduce the above copyright
15*31ad70f2Smatt  *    notice, this list of conditions and the following disclaimer in the
16*31ad70f2Smatt  *    documentation and/or other materials provided with the distribution.
17*31ad70f2Smatt  *
18*31ad70f2Smatt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19*31ad70f2Smatt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20*31ad70f2Smatt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21*31ad70f2Smatt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22*31ad70f2Smatt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*31ad70f2Smatt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*31ad70f2Smatt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*31ad70f2Smatt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*31ad70f2Smatt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*31ad70f2Smatt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*31ad70f2Smatt  * POSSIBILITY OF SUCH DAMAGE.
29*31ad70f2Smatt  */
30*31ad70f2Smatt 
31*31ad70f2Smatt #include "opt_pci.h"
32*31ad70f2Smatt 
33*31ad70f2Smatt #include <sys/cdefs.h>
34*31ad70f2Smatt 
35*31ad70f2Smatt __KERNEL_RCSID(1, "$NetBSD: ralink_pci.c,v 1.1 2014/04/29 17:21:24 matt Exp $");
36*31ad70f2Smatt 
37*31ad70f2Smatt #include <sys/param.h>
38*31ad70f2Smatt 
39*31ad70f2Smatt #include <sys/bus.h>
40*31ad70f2Smatt #include <sys/device.h>
41*31ad70f2Smatt 
42*31ad70f2Smatt #include <dev/pci/pcireg.h>
43*31ad70f2Smatt #include <dev/pci/pcivar.h>
44*31ad70f2Smatt 
45*31ad70f2Smatt struct ralink_pci_softc {
46*31ad70f2Smatt 	device_t sc_dev;
47*31ad70f2Smatt };
48*31ad70f2Smatt 
49*31ad70f2Smatt static int ralink_pci_match(device_t, cfdata_t, void *);
50*31ad70f2Smatt static void ralink_pci_attach(device_t, device_t, void *);
51*31ad70f2Smatt 
52*31ad70f2Smatt CFATTACH_DECL_NEW(ralink_pci, sizeof(struct ralink_pci_softc),
53*31ad70f2Smatt     ralink_pci_match, ralink_pci_attach, NULL, NULL);
54*31ad70f2Smatt 
55*31ad70f2Smatt static int
ralink_pci_match(device_t parent,cfdata_t cf,void * aux)56*31ad70f2Smatt ralink_pci_match(device_t parent, cfdata_t cf, void *aux)
57*31ad70f2Smatt {
58*31ad70f2Smatt 	return 1;
59*31ad70f2Smatt }
60*31ad70f2Smatt 
61*31ad70f2Smatt static void
ralink_pci_attach(device_t parent,device_t self,void * aux)62*31ad70f2Smatt ralink_pci_attach(device_t parent, device_t self, void *aux)
63*31ad70f2Smatt {
64*31ad70f2Smatt 	struct ralink_pci_softc * const sc = device_private(self);
65*31ad70f2Smatt 
66*31ad70f2Smatt 	sc->sc_dev = self;
67*31ad70f2Smatt 
68*31ad70f2Smatt 	aprint_naive(": Ralink PCIe Controller\n");
69*31ad70f2Smatt 	aprint_normal(": Ralink PCIe Controller\n");
70*31ad70f2Smatt }
71*31ad70f2Smatt 
72