summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-01-30 06:44:40 +0000
committerache <ache@FreeBSD.org>1995-01-30 06:44:40 +0000
commita552f67c14a22ae4ade7d287b183df953d852965 (patch)
treeeb1e64242206d8f097734c1e45809eb3d907dc5a
parent6d392fd2e2cf082c7e3fe34f2854c68a0c3606de (diff)
downloadFreeBSD-src-a552f67c14a22ae4ade7d287b183df953d852965.zip
FreeBSD-src-a552f67c14a22ae4ade7d287b183df953d852965.tar.gz
Use double speed read for FX001D, now this drive
becomes two times faster than in old variant. Get rid of false "media changed" errors during large disk transfers
-rw-r--r--sys/dev/mcd/mcd.c24
-rw-r--r--sys/dev/mcd/mcdreg.h6
-rw-r--r--sys/i386/isa/mcd.c24
-rw-r--r--sys/i386/isa/mcdreg.h6
4 files changed, 42 insertions, 18 deletions
diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c
index de5b9c6..e5423b2 100644
--- a/sys/dev/mcd/mcd.c
+++ b/sys/dev/mcd/mcd.c
@@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: mcd.c,v 1.34 1994/12/21 15:17:59 ache Exp $
+ * $Id: mcd.c,v 1.35 1994/12/24 13:24:00 ache Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -126,6 +126,7 @@ struct mcd_data {
char *name;
short config;
short flags;
+ u_char read_command;
short status;
int blksize;
u_long disksize;
@@ -680,6 +681,7 @@ mcd_probe(struct isa_device *dev)
outb(port+MCD_CTRL, M_PICKLE);
mcd_data[unit].flags |= MCDNEWMODEL;
}
+ mcd_data[unit].read_command = MCD_CMDSINGLESPEEDREAD;
switch (stbytes[1]) {
case 'M':
if (mcd_data[unit].flags & MCDNEWMODEL) {
@@ -697,6 +699,7 @@ mcd_probe(struct isa_device *dev)
case 'D':
mcd_data[unit].type = MCD_TYPE_FX001D;
mcd_data[unit].name = "Mitsumi FX001D";
+ mcd_data[unit].read_command = MCD_CMDDOUBLESPEEDREAD;
break;
default:
mcd_data[unit].type = MCD_TYPE_UNKNOWN;
@@ -752,7 +755,7 @@ mcd_getstat(int unit,int sflg)
if (sflg)
outb(port+mcd_command, MCD_CMDGETSTAT);
i = mcd_getreply(unit,DELAY_GETREPLY);
- if (i<0) return -1;
+ if (i<0 || (i & MCD_ST_CMDCHECK)) return -1;
cd->status = i;
@@ -917,6 +920,7 @@ loop:
case MCD_S_BEGIN1:
/* get status */
+retry_status:
outb(com_port, MCD_CMDGETSTAT);
mbx->count = RDELAY_WAITSTAT;
timeout((timeout_func_t)mcd_doread,
@@ -931,6 +935,8 @@ loop:
return;
}
cd->status = inb(port+mcd_status) & 0xFF;
+ if (cd->status & MCD_ST_CMDCHECK)
+ goto retry_status;
if (mcd_setflags(unit,cd) < 0)
goto changed;
MCD_TRACE("got WAITSTAT delay=%d\n",
@@ -940,7 +946,7 @@ loop:
printf("mcd%d: audio is active\n",unit);
goto readerr;
}
-
+retry_mode:
/* to check for raw/cooked mode */
if (cd->flags & MCDREADRAW) {
rm = MCD_MD_RAW;
@@ -979,6 +985,10 @@ loop:
return;
}
cd->status = inb(port+mcd_status) & 0xFF;
+ if (cd->status & MCD_ST_CMDCHECK) {
+ cd->curr_mode = MCD_MD_UNKNOWN;
+ goto retry_mode;
+ }
if (mcd_setflags(unit,cd) < 0)
goto changed;
cd->curr_mode = mbx->mode;
@@ -998,10 +1008,10 @@ nextblock:
/* build parameter block */
hsg2msf(blknum,rbuf.start_msf);
-
+retry_read:
/* send the read command */
disable_intr();
- mcd_put(com_port,MCD_CMDREAD2);
+ mcd_put(com_port,cd->read_command);
mcd_put(com_port,rbuf.start_msf[0]);
mcd_put(com_port,rbuf.start_msf[1]);
mcd_put(com_port,rbuf.start_msf[2]);
@@ -1062,6 +1072,8 @@ nextblock:
}
if (!(k & MFL_STATUS_NOT_AVAIL)) {
cd->status = inb(port+mcd_status) & 0xFF;
+ if (cd->status & MCD_ST_CMDCHECK)
+ goto retry_read;
if (mcd_setflags(unit,cd) < 0)
goto changed;
}
@@ -1448,7 +1460,7 @@ mcd_play(int unit, struct mcd_read2 *pb)
for(retry=0; retry<MCD_RETRYS; retry++) {
disable_intr();
- outb(com_port, MCD_CMDREAD2);
+ outb(com_port, MCD_CMDSINGLESPEEDREAD);
outb(com_port, pb->start_msf[0]);
outb(com_port, pb->start_msf[1]);
outb(com_port, pb->start_msf[2]);
diff --git a/sys/dev/mcd/mcdreg.h b/sys/dev/mcd/mcdreg.h
index 88ae7e3..f8d8598 100644
--- a/sys/dev/mcd/mcdreg.h
+++ b/sys/dev/mcd/mcdreg.h
@@ -41,7 +41,7 @@
* the manufacturer or anyone else might provide better documentation,
* so this file (and the driver) will then have a better quality.
*
- * $Id: mcdreg.h,v 1.5 1994/11/12 13:26:13 ache Exp $
+ * $Id: mcdreg.h,v 1.6 1994/12/24 13:24:02 ache Exp $
*/
#ifndef MCD_H
@@ -135,9 +135,9 @@ typedef unsigned char bcd_t;
#define MCD_READUPC 0xA2 /* Get UPC info */
#define MCD_CMDSETVOLUME 0xAE /* sets mcd_volume */
#define MCD_CMDREAD1 0xB0 /* read n sectors */
-#define MCD_CMDREAD2 0xC0 /* read from-to */
+#define MCD_CMDSINGLESPEEDREAD 0xC0 /* read from-to */
#define MCD_CMDSTARTAUDIOMSF 0xC1 /* read audio data */
-#define MCD_CMDREADFAST 0xC1 /* Read lots of data from the drive */
+#define MCD_CMDDOUBLESPEEDREAD 0xC1 /* Read lots of data from the drive */
#define MCD_CMDGETDRIVEMODE 0xC2 /* Get the drive mode */
#define MCD_CMDREAD 0xC3 /* Read data from the drive */
#define MCD_CMDSETINTERLEAVE 0xC8 /* Adjust the interleave */
diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c
index de5b9c6..e5423b2 100644
--- a/sys/i386/isa/mcd.c
+++ b/sys/i386/isa/mcd.c
@@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: mcd.c,v 1.34 1994/12/21 15:17:59 ache Exp $
+ * $Id: mcd.c,v 1.35 1994/12/24 13:24:00 ache Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -126,6 +126,7 @@ struct mcd_data {
char *name;
short config;
short flags;
+ u_char read_command;
short status;
int blksize;
u_long disksize;
@@ -680,6 +681,7 @@ mcd_probe(struct isa_device *dev)
outb(port+MCD_CTRL, M_PICKLE);
mcd_data[unit].flags |= MCDNEWMODEL;
}
+ mcd_data[unit].read_command = MCD_CMDSINGLESPEEDREAD;
switch (stbytes[1]) {
case 'M':
if (mcd_data[unit].flags & MCDNEWMODEL) {
@@ -697,6 +699,7 @@ mcd_probe(struct isa_device *dev)
case 'D':
mcd_data[unit].type = MCD_TYPE_FX001D;
mcd_data[unit].name = "Mitsumi FX001D";
+ mcd_data[unit].read_command = MCD_CMDDOUBLESPEEDREAD;
break;
default:
mcd_data[unit].type = MCD_TYPE_UNKNOWN;
@@ -752,7 +755,7 @@ mcd_getstat(int unit,int sflg)
if (sflg)
outb(port+mcd_command, MCD_CMDGETSTAT);
i = mcd_getreply(unit,DELAY_GETREPLY);
- if (i<0) return -1;
+ if (i<0 || (i & MCD_ST_CMDCHECK)) return -1;
cd->status = i;
@@ -917,6 +920,7 @@ loop:
case MCD_S_BEGIN1:
/* get status */
+retry_status:
outb(com_port, MCD_CMDGETSTAT);
mbx->count = RDELAY_WAITSTAT;
timeout((timeout_func_t)mcd_doread,
@@ -931,6 +935,8 @@ loop:
return;
}
cd->status = inb(port+mcd_status) & 0xFF;
+ if (cd->status & MCD_ST_CMDCHECK)
+ goto retry_status;
if (mcd_setflags(unit,cd) < 0)
goto changed;
MCD_TRACE("got WAITSTAT delay=%d\n",
@@ -940,7 +946,7 @@ loop:
printf("mcd%d: audio is active\n",unit);
goto readerr;
}
-
+retry_mode:
/* to check for raw/cooked mode */
if (cd->flags & MCDREADRAW) {
rm = MCD_MD_RAW;
@@ -979,6 +985,10 @@ loop:
return;
}
cd->status = inb(port+mcd_status) & 0xFF;
+ if (cd->status & MCD_ST_CMDCHECK) {
+ cd->curr_mode = MCD_MD_UNKNOWN;
+ goto retry_mode;
+ }
if (mcd_setflags(unit,cd) < 0)
goto changed;
cd->curr_mode = mbx->mode;
@@ -998,10 +1008,10 @@ nextblock:
/* build parameter block */
hsg2msf(blknum,rbuf.start_msf);
-
+retry_read:
/* send the read command */
disable_intr();
- mcd_put(com_port,MCD_CMDREAD2);
+ mcd_put(com_port,cd->read_command);
mcd_put(com_port,rbuf.start_msf[0]);
mcd_put(com_port,rbuf.start_msf[1]);
mcd_put(com_port,rbuf.start_msf[2]);
@@ -1062,6 +1072,8 @@ nextblock:
}
if (!(k & MFL_STATUS_NOT_AVAIL)) {
cd->status = inb(port+mcd_status) & 0xFF;
+ if (cd->status & MCD_ST_CMDCHECK)
+ goto retry_read;
if (mcd_setflags(unit,cd) < 0)
goto changed;
}
@@ -1448,7 +1460,7 @@ mcd_play(int unit, struct mcd_read2 *pb)
for(retry=0; retry<MCD_RETRYS; retry++) {
disable_intr();
- outb(com_port, MCD_CMDREAD2);
+ outb(com_port, MCD_CMDSINGLESPEEDREAD);
outb(com_port, pb->start_msf[0]);
outb(com_port, pb->start_msf[1]);
outb(com_port, pb->start_msf[2]);
diff --git a/sys/i386/isa/mcdreg.h b/sys/i386/isa/mcdreg.h
index 88ae7e3..f8d8598 100644
--- a/sys/i386/isa/mcdreg.h
+++ b/sys/i386/isa/mcdreg.h
@@ -41,7 +41,7 @@
* the manufacturer or anyone else might provide better documentation,
* so this file (and the driver) will then have a better quality.
*
- * $Id: mcdreg.h,v 1.5 1994/11/12 13:26:13 ache Exp $
+ * $Id: mcdreg.h,v 1.6 1994/12/24 13:24:02 ache Exp $
*/
#ifndef MCD_H
@@ -135,9 +135,9 @@ typedef unsigned char bcd_t;
#define MCD_READUPC 0xA2 /* Get UPC info */
#define MCD_CMDSETVOLUME 0xAE /* sets mcd_volume */
#define MCD_CMDREAD1 0xB0 /* read n sectors */
-#define MCD_CMDREAD2 0xC0 /* read from-to */
+#define MCD_CMDSINGLESPEEDREAD 0xC0 /* read from-to */
#define MCD_CMDSTARTAUDIOMSF 0xC1 /* read audio data */
-#define MCD_CMDREADFAST 0xC1 /* Read lots of data from the drive */
+#define MCD_CMDDOUBLESPEEDREAD 0xC1 /* Read lots of data from the drive */
#define MCD_CMDGETDRIVEMODE 0xC2 /* Get the drive mode */
#define MCD_CMDREAD 0xC3 /* Read data from the drive */
#define MCD_CMDSETINTERLEAVE 0xC8 /* Adjust the interleave */
OpenPOWER on IntegriCloud