summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2001-12-06 09:30:31 +0000
committermickey <mickey@openbsd.org>2001-12-06 09:30:31 +0000
commitf387b089599783242d0b5b253281cae8dd240145 (patch)
tree95d98d9d344ea7fa8871b1e8c35c47021d64a1cc
parentUse TCSAFLUSH not TCSANOW. I was only using TCSANOW during debugging... (diff)
downloadwireguard-openbsd-f387b089599783242d0b5b253281cae8dd240145.tar.xz
wireguard-openbsd-f387b089599783242d0b5b253281cae8dd240145.zip
clear all inrterrupts separately and before enabling any.
this prevents stray interrupts and sometimes hangs, caused by looping on stray unmapped interrupt.
-rw-r--r--sys/dev/ic/twe.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c
index a9db2c78648..bc4665bf8a6 100644
--- a/sys/dev/ic/twe.c
+++ b/sys/dev/ic/twe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: twe.c,v 1.14 2001/11/05 17:25:58 art Exp $ */
+/* $OpenBSD: twe.c,v 1.15 2001/12/06 09:30:31 mickey Exp $ */
/*
* Copyright (c) 2000, 2001 Michael Shalayeff. All rights reserved.
@@ -397,9 +397,21 @@ twe_attach(sc)
config_found(&sc->sc_dev, &sc->sc_link, scsiprint);
+ TWE_DPRINTF(TWE_D_CMD, ("stat=%b ",
+ bus_space_read_4(sc->iot, sc->ioh, TWE_STATUS), TWE_STAT_BITS));
+ /*
+ * ack all before enable, cannot be done in one
+ * operation as it seems clear is not processed
+ * if enable is specified.
+ */
+ bus_space_write_4(sc->iot, sc->ioh, TWE_CONTROL,
+ TWE_CTRL_CHOSTI | TWE_CTRL_CATTNI | TWE_CTRL_CERR);
+ TWE_DPRINTF(TWE_D_CMD, ("stat=%b ",
+ bus_space_read_4(sc->iot, sc->ioh, TWE_STATUS), TWE_STAT_BITS));
/* enable interrupts */
- bus_space_write_4(sc->iot, sc->ioh, TWE_CONTROL, TWE_CTRL_EINT |
- /*TWE_CTRL_HOSTI |*/ TWE_CTRL_CATTNI | TWE_CTRL_ERDYI);
+ bus_space_write_4(sc->iot, sc->ioh, TWE_CONTROL,
+ TWE_CTRL_EINT | TWE_CTRL_ERDYI |
+ /*TWE_CTRL_HOSTI |*/ TWE_CTRL_MCMDI);
return 0;
}