diff options
author | mav <mav@FreeBSD.org> | 2009-05-01 21:43:04 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2009-05-01 21:43:04 +0000 |
commit | 3bbbb5aaddc89f0f2a14b65eeb66a1968b78970f (patch) | |
tree | bbbc74a5606b0a5701f4dc2e0cb8fb246eac0a42 /sys | |
parent | 74c9f27fa60d29a4edf4ba38ebda6492fa0edb7b (diff) | |
download | FreeBSD-src-3bbbb5aaddc89f0f2a14b65eeb66a1968b78970f.zip FreeBSD-src-3bbbb5aaddc89f0f2a14b65eeb66a1968b78970f.tar.gz |
Add resume methods to i8254 and atrtc devices.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/isa/clock.c | 21 | ||||
-rw-r--r-- | sys/isa/atrtc.c | 10 |
2 files changed, 28 insertions, 3 deletions
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 91598d5..4d365c9 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -376,6 +376,17 @@ set_i8254_freq(u_int freq, int intr_freq) mtx_unlock_spin(&clock_lock); } +static void +i8254_restore(void) +{ + + mtx_lock_spin(&clock_lock); + outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); + outb(TIMER_CNTR0, i8254_real_max_count & 0xff); + outb(TIMER_CNTR0, i8254_real_max_count >> 8); + mtx_unlock_spin(&clock_lock); +} + /* This is separate from startrtclock() so that it can be called early. */ void i8254_init(void) @@ -558,6 +569,14 @@ attimer_attach(device_t dev) return(0); } +static int +attimer_resume(device_t dev) +{ + + i8254_restore(); + return(0); +} + static device_method_t attimer_methods[] = { /* Device interface */ DEVMETHOD(device_probe, attimer_probe), @@ -565,7 +584,7 @@ static device_method_t attimer_methods[] = { DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_resume, attimer_resume), { 0, 0 } }; diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 87d03a5..990c1ee 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -190,6 +190,13 @@ atrtc_attach(device_t dev) return(0); } +static int +atrtc_resume(device_t dev) +{ + + atrtc_restore(); + return(0); +} static int atrtc_settime(device_t dev __unused, struct timespec *ts) @@ -264,8 +271,7 @@ static device_method_t atrtc_methods[] = { DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */ - DEVMETHOD(device_resume, bus_generic_resume), - /* XXX restart statclock? */ + DEVMETHOD(device_resume, atrtc_resume), /* clock interface */ DEVMETHOD(clock_gettime, atrtc_gettime), |