Recode the datain_pio loop. This improves performance substantially (almost

2x) with my spc@pcmcia.
This commit is contained in:
mycroft 2004-08-11 14:22:34 +00:00
parent 1a682ebd64
commit 0ef13a458b
1 changed files with 13 additions and 31 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb89352.c,v 1.29 2004/08/09 14:07:57 mycroft Exp $ */ /* $NetBSD: mb89352.c,v 1.30 2004/08/11 14:22:34 mycroft Exp $ */
/* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */ /* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */
/*- /*-
@ -70,7 +70,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.29 2004/08/09 14:07:57 mycroft Exp $"); __KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.30 2004/08/11 14:22:34 mycroft Exp $");
#ifdef DDB #ifdef DDB
#define integrate #define integrate
@ -1614,39 +1614,21 @@ spc_datain_pio(sc, p, n)
* b) reset has occurred or busfree is detected. * b) reset has occurred or busfree is detected.
*/ */
while (n > 0) { while (n > 0) {
int xfer; sstat = bus_space_read_1(iot, ioh, SSTS);
if ((sstat & SSTS_DREG_FULL) != 0) {
/* Wait for fifo half full or phase mismatch */ n -= DINAMOUNT;
for (;;) { in += DINAMOUNT;
/* XXX needs timeout */ bus_space_read_multi_1(iot, ioh, DREG, p, DINAMOUNT);
intstat = bus_space_read_1(iot, ioh, INTS); p += DINAMOUNT;
sstat = bus_space_read_1(iot, ioh, SSTS); } else if ((sstat & SSTS_DREG_EMPTY) == 0) {
if (intstat != 0 ||
(sstat & SSTS_DREG_EMPTY) == 0)
break;
}
#ifdef NEED_DREQ_ON_HARDWARE_XFER
if (intstat != 0)
goto phasechange;
#endif
if (sstat & SSTS_DREG_FULL) {
xfer = DINAMOUNT;
n -= xfer;
in += xfer;
bus_space_read_multi_1(iot, ioh, DREG, p, xfer);
p += xfer;
}
while (n > 0 &&
(bus_space_read_1(iot, ioh, SSTS) & SSTS_DREG_EMPTY) == 0) {
n--; n--;
in++; in++;
*p++ = bus_space_read_1(iot, ioh, DREG); *p++ = bus_space_read_1(iot, ioh, DREG);
} else {
intstat = bus_space_read_1(iot, ioh, INTS);
if (intstat != 0)
goto phasechange;
} }
if (intstat != 0)
goto phasechange;
} }
/* /*