Deleted Added
full compact
pmtimer.c (82971) pmtimer.c (105730)
1/*-
2 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/i386/isa/pmtimer.c 82971 2001-09-04 16:02:06Z iwasaki $
26 * $FreeBSD: head/sys/i386/isa/pmtimer.c 105730 2002-10-22 17:30:52Z jhb $
27 */
28
29/*
30 * Timer device driver for power management events.
31 * The code for suspend/resume is derived from APM device driver.
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/bus.h>
37#include <sys/kernel.h>
38#include <sys/syslog.h>
39#include <machine/clock.h>
40
41#include <isa/isavar.h>
42
27 */
28
29/*
30 * Timer device driver for power management events.
31 * The code for suspend/resume is derived from APM device driver.
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/bus.h>
37#include <sys/kernel.h>
38#include <sys/syslog.h>
39#include <machine/clock.h>
40
41#include <isa/isavar.h>
42
43static devclass_t pmtimer_devclass;
44
43/* reject any PnP devices for now */
44static struct isa_pnp_id pmtimer_ids[] = {
45 {0}
46};
47
45/* reject any PnP devices for now */
46static struct isa_pnp_id pmtimer_ids[] = {
47 {0}
48};
49
50static void
51pmtimer_identify(driver_t *driver, device_t parent)
52{
53 device_t child;
54
55 /*
56 * Only add a child if one doesn't exist already.
57 */
58 child = devclass_get_device(pmtimer_devclass, 0);
59 if (child == NULL) {
60 child = BUS_ADD_CHILD(parent, 0, "pmtimer", 0);
61 if (child == NULL)
62 panic("pmtimer_identify");
63 }
64}
65
48static int
49pmtimer_probe(device_t dev)
50{
51
52 if (ISA_PNP_PROBE(device_get_parent(dev), dev, pmtimer_ids) == ENXIO) {
53 return (ENXIO);
54 }
55

--- 60 unchanged lines hidden (view full) ---

116 second %= 60;
117 log(LOG_NOTICE, "wakeup from sleeping state (slept %02d:%02d:%02d)\n",
118 hour, minute, second);
119 return (0);
120}
121
122static device_method_t pmtimer_methods[] = {
123 /* Device interface */
66static int
67pmtimer_probe(device_t dev)
68{
69
70 if (ISA_PNP_PROBE(device_get_parent(dev), dev, pmtimer_ids) == ENXIO) {
71 return (ENXIO);
72 }
73

--- 60 unchanged lines hidden (view full) ---

134 second %= 60;
135 log(LOG_NOTICE, "wakeup from sleeping state (slept %02d:%02d:%02d)\n",
136 hour, minute, second);
137 return (0);
138}
139
140static device_method_t pmtimer_methods[] = {
141 /* Device interface */
142 DEVMETHOD(device_identify, pmtimer_identify),
124 DEVMETHOD(device_probe, pmtimer_probe),
125 DEVMETHOD(device_attach, bus_generic_attach),
126 DEVMETHOD(device_suspend, pmtimer_suspend),
127 DEVMETHOD(device_resume, pmtimer_resume),
128 { 0, 0 }
129};
130
131static driver_t pmtimer_driver = {
132 "pmtimer",
133 pmtimer_methods,
134 1, /* no softc */
135};
136
143 DEVMETHOD(device_probe, pmtimer_probe),
144 DEVMETHOD(device_attach, bus_generic_attach),
145 DEVMETHOD(device_suspend, pmtimer_suspend),
146 DEVMETHOD(device_resume, pmtimer_resume),
147 { 0, 0 }
148};
149
150static driver_t pmtimer_driver = {
151 "pmtimer",
152 pmtimer_methods,
153 1, /* no softc */
154};
155
137static devclass_t pmtimer_devclass;
138
139DRIVER_MODULE(pmtimer, isa, pmtimer_driver, pmtimer_devclass, 0, 0);
156DRIVER_MODULE(pmtimer, isa, pmtimer_driver, pmtimer_devclass, 0, 0);