kernel: Use DEVMETHOD_END in the drivers.
[dragonfly.git] / sys / bus / isa / pnpeat.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  * $FreeBSD: src/sys/i386/i386/nexus.c,v 1.26.2.10 2003/02/22 13:16:45 imp Exp $
30  */
31
32 /*
33  * This code implements a `root nexus' for Intel Architecture
34  * machines.  The function of the root nexus is to serve as an
35  * attachment point for both processors and buses, and to manage
36  * resources which are common to all of them.  In particular,
37  * this code implements the core resource managers for interrupt
38  * requests, DMA requests (which rightfully should be a part of the
39  * ISA code but it's easier to do it here for now), I/O port addresses,
40  * and I/O memory address space.
41  */
42
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/bus.h>
46 #include <sys/kernel.h>
47 #include <sys/malloc.h>
48 #include <sys/module.h>
49 #include <sys/rman.h>
50
51 #include <bus/isa/isavar.h>
52 #include <bus/isa/isa.h>
53
54 /*
55  * Placeholder which claims PnP 'devices' which describe system
56  * resources.
57  */
58 static struct isa_pnp_id sysresource_ids[] = {
59         { 0x010cd041 /* PNP0c01 */, "System Memory" },
60         { 0x020cd041 /* PNP0c02 */, "System Resource" },
61         { 0 }
62 };
63
64 static int
65 sysresource_probe(device_t dev)
66 {
67         int     result;
68
69         if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, sysresource_ids)) >= 0) {
70                 device_quiet(dev);
71         }
72         return (result);
73 }
74
75 static int
76 sysresource_attach(device_t dev)
77 {
78         return (0);
79 }
80
81 static device_method_t sysresource_methods[] = {
82         /* Device interface */
83         DEVMETHOD(device_probe,         sysresource_probe),
84         DEVMETHOD(device_attach,        sysresource_attach),
85         DEVMETHOD(device_detach,        bus_generic_detach),
86         DEVMETHOD(device_shutdown,      bus_generic_shutdown),
87         DEVMETHOD(device_suspend,       bus_generic_suspend),
88         DEVMETHOD(device_resume,        bus_generic_resume),
89         DEVMETHOD_END
90 };
91
92 static driver_t sysresource_driver = {
93         "sysresource",
94         sysresource_methods,
95         1,              /* no softc */
96 };
97
98 static devclass_t sysresource_devclass;
99
100 DRIVER_MODULE(sysresource, isa, sysresource_driver, sysresource_devclass, NULL, NULL);