summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-05-18 20:10:13 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-05-18 20:10:13 +0000
commitcf3b3ac3f586a01740892c6f2450a388e962b325 (patch)
tree0befed65b83b52cfb5fefc6f03435f67fd67fc3b /sys/dev
parentc96827da73fed6da8721f0c27eafdb8e6ca76da5 (diff)
the block size must be multiple of the pci burst size (overwise
dma pointers can overrun)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/envy.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/dev/pci/envy.c b/sys/dev/pci/envy.c
index 42d333b7246..88a9ed8a6b9 100644
--- a/sys/dev/pci/envy.c
+++ b/sys/dev/pci/envy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: envy.c,v 1.27 2009/05/08 17:52:18 ratchov Exp $ */
+/* $OpenBSD: envy.c,v 1.28 2009/05/18 20:10:12 ratchov Exp $ */
/*
* Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
*
@@ -1214,18 +1214,14 @@ envy_round_blocksize(void *self, int blksz)
* until it's fixed, roll our own rounding
*/
- pmult = (sc->isht ? sc->card->noch / 2 : ENVY_PCHANS / 2);
+ pmult = (sc->isht ? sc->card->noch : ENVY_PCHANS);
if (pmult == 0)
pmult = 1;
- rmult = (sc->isht ? sc->card->nich / 2 : ENVY_RCHANS / 2);
+ rmult = (sc->isht ? sc->card->nich : ENVY_RCHANS);
if (rmult == 0)
rmult = 1;
mul = pmult * rmult;
- if ((mul & 1) != 0)
- mul <<= 1;
- if ((mul & 3) != 0)
- mul <<= 1;
- if ((mul & 7) != 0)
+ while ((mul & 0x1f) != 0)
mul <<= 1;
blksz -= blksz % mul;
if (blksz == 0)
@@ -1247,7 +1243,7 @@ envy_trigger_output(void *self, void *start, void *end, int blksz,
size_t bufsz;
int st;
- bufsz = end - start;
+ bufsz = (char *)end - (char *)start;
#ifdef ENVY_DEBUG
if (blksz % (sc->isht ? sc->card->noch * 4 : ENVY_PFRAME_SIZE) != 0) {
printf("%s: %d: bad output blksz\n", DEVNAME(sc), blksz);
@@ -1283,7 +1279,7 @@ envy_trigger_input(void *self, void *start, void *end, int blksz,
size_t bufsz;
int st;
- bufsz = end - start;
+ bufsz = (char *)end - (char *)start;
#ifdef ENVY_DEBUG
if (blksz % (sc->isht ? sc->card->nich * 4 : ENVY_RFRAME_SIZE) != 0) {
printf("%s: %d: bad input blksz\n", DEVNAME(sc), blksz);