summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-06-10 05:09:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-06-10 05:09:38 +0000
commite3cdb120b6a5bb64b1a1096e4064c11a961d0486 (patch)
tree1726735bb0bd36c53ab423fa2c44140099915e85 /sys/dev
parent7e020ec3d332b9a58b812efcc654f7ded5ae728f (diff)
correct SIMPLEQ bugs, ack interrupt. 8 packets have crypted, but kernel
memory got corrupted.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/ubsec.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c
index 879aad97798..5bb90de78a2 100644
--- a/sys/dev/pci/ubsec.c
+++ b/sys/dev/pci/ubsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsec.c,v 1.5 2000/06/10 03:54:23 jason Exp $ */
+/* $OpenBSD: ubsec.c,v 1.6 2000/06/10 05:09:37 deraadt Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
@@ -190,7 +190,12 @@ ubsec_intr(arg)
stat = READ_REG(sc, BS_STAT);
+ stat &= (BS_STAT_MCR1_DONE | BS_STAT_MCR2_DONE | BS_STAT_DMAERR);
+ if (stat == 0)
+ return (0);
+
if (stat & BS_STAT_MCR1_DONE) {
+ q = SIMPLEQ_FIRST(&sc->sc_qchip);
SIMPLEQ_REMOVE_HEAD(&sc->sc_qchip, q, q_next);
if (q) {
/* XXX must generate macbuf ... */
@@ -198,21 +203,29 @@ ubsec_intr(arg)
}
}
+#if 0
+ if (stat & BS_STAT_MCR2_DONE) {
+ ...
+ }
+#endif
+
if (stat & BS_STAT_DMAERR) {
printf("%s: dmaerr\n", sc->sc_dv.dv_xname);
}
/* if MCR is non-full, put a new command in it */
if ((stat & BS_STAT_MCR1_FULL) == 0) {
- SIMPLEQ_REMOVE_HEAD(&sc->sc_queue, q, q_next);
- --sc->sc_nqueue;
- if (q) {
+ if (!SIMPLEQ_EMPTY(&sc->sc_queue)) {
+ q = SIMPLEQ_FIRST(&sc->sc_queue);
+ SIMPLEQ_REMOVE_HEAD(&sc->sc_queue, q, q_next);
+ --sc->sc_nqueue;
SIMPLEQ_INSERT_TAIL(&sc->sc_qchip, q, q_next);
WRITE_REG(sc, BS_MCR1, (u_int32_t)vtophys(&q->q_mcr));
}
}
- return (stat ? 1 : 0);
+ WRITE_REG(sc, BS_STAT, stat);
+ return (1);
}
int
@@ -437,8 +450,7 @@ ubsec_process(crp)
coffset = macoffset - encoffset;
if (coffset < 0)
coffset = -coffset;
- }
- else {
+ } else {
dskip = sskip = macoffset + encoffset;
coffset = 0;
}