summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-05-04 21:51:12 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-05-04 21:51:12 +0000
commita87e87e39151e8faed5ddc66b2b1fca488f1ae1f (patch)
treeb502f74bcc9eeaa14a5a6a4542fdbc757d4d2079
parentdf22bccbe4dda082a723358f43579297259d8caa (diff)
wrap the wptr round when we hit the end of the fifo.
-rw-r--r--sys/dev/pci/if_tht.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c
index d8bc8a9cc89..a9128d61104 100644
--- a/sys/dev/pci/if_tht.c
+++ b/sys/dev/pci/if_tht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tht.c,v 1.87 2007/04/30 00:02:12 deraadt Exp $ */
+/* $OpenBSD: if_tht.c,v 1.88 2007/05/04 21:51:11 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -1454,6 +1454,7 @@ tht_fifo_write(struct tht_softc *sc, struct tht_fifo *tf,
bcopy(desc, fifo + tf->tf_wptr, buflen);
tf->tf_wptr += buflen;
+ tf->tf_wptr %= tf->tf_len;
DPRINTF(THT_D_FIFO, "%s: fifo wr wptr: %d rptr: %d ready: %d\n",
DEVNAME(sc), tf->tf_wptr, tf->tf_rptr, tf->tf_ready);