summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcsapuntz <csapuntz@openbsd.org>2001-04-12 07:46:46 +0000
committercsapuntz <csapuntz@openbsd.org>2001-04-12 07:46:46 +0000
commit4301ba8df98256fadf2ba42875516323a51a6668 (patch)
treef00911b303a164a411ccb98954a5d7146e156623
parentprint phy model at startup (diff)
downloadwireguard-openbsd-4301ba8df98256fadf2ba42875516323a51a6668.tar.xz
wireguard-openbsd-4301ba8df98256fadf2ba42875516323a51a6668.zip
The old code was broken and always allocated for a 16-bit DMA channel,
which has different alignment restrictions than the 8-bit DMA channel. Fix from NetBSD.
-rw-r--r--sys/dev/isa/sbdsp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c
index 01ad1c2a3ef..02b09401981 100644
--- a/sys/dev/isa/sbdsp.c
+++ b/sys/dev/isa/sbdsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbdsp.c,v 1.15 2001/02/03 05:22:24 mickey Exp $ */
+/* $OpenBSD: sbdsp.c,v 1.16 2001/04/12 07:46:46 csapuntz Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -2196,8 +2196,15 @@ sb_malloc(addr, size, pool, flags)
int flags;
{
struct sbdsp_softc *sc = addr;
+ int drq;
- return isa_malloc(sc->sc_isa, 4, size, pool, flags);
+ /* 8-bit has more restrictive alignment */
+ if (sc->sc_drq8 != -1)
+ drq = sc->sc_drq8;
+ else
+ drq = sc->sc_drq16;
+
+ return isa_malloc(sc->sc_isa, drq, size, pool, flags);
}
void