diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-07-22 14:27:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-07-22 14:27:47 +0000 |
commit | 58bbd3eb627989a728fc032f9b1bb22025f780b7 (patch) | |
tree | d9332fb1e78af42417943cdcc3f0038def877301 /sys/dev/ic | |
parent | c6b25e4849e930766e9a0ae294485443d41407cc (diff) |
Reset the keyboard controller on resume, and also alert the children
(pckbd and pms) to do their part
started by mlarkin, cleaned up by me
ok miod
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/pckbc.c | 22 | ||||
-rw-r--r-- | sys/dev/ic/pckbcvar.h | 3 |
2 files changed, 23 insertions, 2 deletions
diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index 8ec830ff8e1..710ff9138e0 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc.c,v 1.22 2010/07/21 20:10:17 miod Exp $ */ +/* $OpenBSD: pckbc.c,v 1.23 2010/07/22 14:27:44 deraadt Exp $ */ /* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */ /* @@ -759,6 +759,26 @@ pckbc_cleanup(self) } /* + * Reset the keyboard controller in a violent fashion; normally done + * after suspend/resume when we do not trust the machine. + */ +void +pckbc_reset(struct pckbc_softc *sc) +{ + struct pckbc_internal *t = sc->id; + bus_space_tag_t iot = t->t_iot; + bus_space_handle_t ioh_d = t->t_ioh_d, ioh_c = t->t_ioh_c; + + pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0); + /* KBC selftest */ + if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0) + return; + pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0); + (void)pckbc_put8042cmd(t); + pckbcintr_internal(t->t_sc->id, t->t_sc); +} + +/* * Pass command to device during normal operation. * to be called at spltty() */ diff --git a/sys/dev/ic/pckbcvar.h b/sys/dev/ic/pckbcvar.h index ec8cf9bff4d..0cf106b5980 100644 --- a/sys/dev/ic/pckbcvar.h +++ b/sys/dev/ic/pckbcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbcvar.h,v 1.8 2010/07/21 20:10:17 miod Exp $ */ +/* $OpenBSD: pckbcvar.h,v 1.9 2010/07/22 14:27:44 deraadt Exp $ */ /* $NetBSD: pckbcvar.h,v 1.4 2000/06/09 04:58:35 soda Exp $ */ /* @@ -109,6 +109,7 @@ void pckbc_attach(struct pckbc_softc *, int); int pckbc_cnattach(bus_space_tag_t, bus_addr_t, bus_size_t, pckbc_slot_t, int); int pckbc_is_console(bus_space_tag_t, bus_addr_t); +void pckbc_reset(struct pckbc_softc *); int pckbcintr(void *); /* |