]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/powerpc/mpc85xx/nexus.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / powerpc / mpc85xx / nexus.c
1 /*-
2  * Copyright 1998 Massachusetts Institute of Technology
3  *
4  * Permission to use, copy, modify, and distribute this software and
5  * its documentation for any purpose and without fee is hereby
6  * granted, provided that both the above copyright notice and this
7  * permission notice appear in all copies, that both the above
8  * copyright notice and this permission notice appear in all
9  * supporting documentation, and that the name of M.I.T. not be used
10  * in advertising or publicity pertaining to distribution of the
11  * software without specific, written prior permission.  M.I.T. makes
12  * no representations about the suitability of this software for any
13  * purpose.  It is provided "as is" without express or implied
14  * warranty.
15  *
16  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20  * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 /*-
30  * Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>.  All rights reserved.
31  *
32  * Redistribution and use in source and binary forms, with or without
33  * modification, are permitted provided that the following conditions
34  * are met:
35  * 1. Redistributions of source code must retain the above copyright
36  *    notice, this list of conditions and the following disclaimer.
37  * 2. Redistributions in binary form must reproduce the above copyright
38  *    notice, this list of conditions and the following disclaimer in the
39  *    documentation and/or other materials provided with the distribution.
40  *
41  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
42  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51  * SUCH DAMAGE.
52  *
53  *      from: FreeBSD: src/sys/i386/i386/nexus.c,v 1.43 2001/02/09
54  */
55
56 #include <sys/cdefs.h>
57 __FBSDID("$FreeBSD$");
58
59 #include <sys/param.h>
60 #include <sys/systm.h>
61 #include <sys/module.h>
62 #include <sys/bus.h>
63 #include <sys/cons.h>
64 #include <sys/kernel.h>
65 #include <sys/malloc.h>
66 #include <sys/rman.h>
67
68 /*
69  * Device interface
70  */
71 static int      nexus_probe(device_t);
72 static int      nexus_attach(device_t);
73 static int      nexus_activate_resource(device_t, device_t, int, int,
74     struct resource *);
75 static int      nexus_deactivate_resource(device_t, device_t, int, int,
76     struct resource *);
77
78 static device_method_t nexus_methods[] = {
79         /* Device interface */
80         DEVMETHOD(device_probe,         nexus_probe),
81         DEVMETHOD(device_attach,        nexus_attach),
82         DEVMETHOD(device_detach,        bus_generic_detach),
83         DEVMETHOD(device_shutdown,      bus_generic_shutdown),
84         DEVMETHOD(device_suspend,       bus_generic_suspend),
85         DEVMETHOD(device_resume,        bus_generic_resume),
86
87         /* Bus interface. Resource management is business of the children... */
88         DEVMETHOD(bus_add_child,        bus_generic_add_child),
89         DEVMETHOD(bus_probe_nomatch,    NULL),
90         DEVMETHOD(bus_read_ivar,        NULL),
91         DEVMETHOD(bus_write_ivar,       NULL),
92         DEVMETHOD(bus_setup_intr,       NULL),
93         DEVMETHOD(bus_teardown_intr,    NULL),
94         DEVMETHOD(bus_alloc_resource,   NULL),
95         DEVMETHOD(bus_activate_resource,        nexus_activate_resource),
96         DEVMETHOD(bus_deactivate_resource,      nexus_deactivate_resource),
97         DEVMETHOD(bus_release_resource, NULL),
98
99         DEVMETHOD_END
100 };
101
102 static driver_t nexus_driver = {
103         "nexus",
104         nexus_methods
105 };
106
107 static devclass_t nexus_devclass;
108
109 DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
110
111 static int
112 nexus_probe(device_t dev)
113 {
114
115         if (!bootverbose)
116                 device_quiet(dev);
117         return (BUS_PROBE_DEFAULT);
118 }
119
120 static int
121 nexus_attach(device_t dev)
122 {
123
124         bus_generic_probe(dev);
125         bus_generic_attach(dev);
126         return (0);
127 }
128
129 static int
130 nexus_activate_resource(device_t bus, device_t child, int type, int rid,
131     struct resource *res)
132 {
133
134         /* Not much to be done yet... */
135         return (rman_activate_resource(res));
136 }
137
138 static int
139 nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
140     struct resource *res)
141 {
142
143         /* Not much to be done yet... */
144         return (rman_deactivate_resource(res));
145 }