Recode the datain_pio loop. This improves performance substantially (almost
2x) with my spc@pcmcia.
This commit is contained in:
parent
1a682ebd64
commit
0ef13a458b
|
@ -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,40 +1614,22 @@ 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;
|
|
||||||
|
|
||||||
/* Wait for fifo half full or phase mismatch */
|
|
||||||
for (;;) {
|
|
||||||
/* XXX needs timeout */
|
|
||||||
intstat = bus_space_read_1(iot, ioh, INTS);
|
|
||||||
sstat = bus_space_read_1(iot, ioh, SSTS);
|
sstat = bus_space_read_1(iot, ioh, SSTS);
|
||||||
if (intstat != 0 ||
|
if ((sstat & SSTS_DREG_FULL) != 0) {
|
||||||
(sstat & SSTS_DREG_EMPTY) == 0)
|
n -= DINAMOUNT;
|
||||||
break;
|
in += DINAMOUNT;
|
||||||
}
|
bus_space_read_multi_1(iot, ioh, DREG, p, DINAMOUNT);
|
||||||
|
p += DINAMOUNT;
|
||||||
#ifdef NEED_DREQ_ON_HARDWARE_XFER
|
} else if ((sstat & SSTS_DREG_EMPTY) == 0) {
|
||||||
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)
|
if (intstat != 0)
|
||||||
goto phasechange;
|
goto phasechange;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some SCSI-devices are rude enough to transfer more data than what
|
* Some SCSI-devices are rude enough to transfer more data than what
|
||||||
|
|
Loading…
Reference in New Issue