Subject: mitsumi cd-rom problems solved
To: None <port-i386@NetBSD.ORG>
From: Onno van der Linden <onno@simplex.nl>
List: port-i386
Date: 07/04/1995 21:10:20
 After getting a "I saw that too" from Hellmuth Michaelis about my troubles
with the mitsumi CD-ROM driver I had a look at the FreeBSD-current driver.
The fix is simple: if a Double Speed (FX001D) drive is detected use the
double speed read opcode for read commands. My FX001D gets into trouble
on larger (> 1 Meg) files using the single speed read opcode.

Onno van der Linden         (onno@simplex.nl)

*** /usr/src/sys/dev/isa/mcdreg.h.orig	Tue Mar 28 23:43:48 1995
--- /usr/src/sys/dev/isa/mcdreg.h	Tue Jul  4 20:46:21 1995
***************
*** 130,134 ****
  #define	MCD_CMDSETVOLUME	0xae	/* sets mcd_volume */
  #define	MCD_CMDREAD1		0xb0	/* read n sectors */
! #define	MCD_CMDREAD2		0xc0	/* read from-to */
  #define	MCD_CMDGETDRIVEMODE	0xc2	/* get drive mode */
  #define	MCD_CMDREAD3		0xc3	/* ? */
--- 130,135 ----
  #define	MCD_CMDSETVOLUME	0xae	/* sets mcd_volume */
  #define	MCD_CMDREAD1		0xb0	/* read n sectors */
! #define	MCD_CMDREADSINGLESPEED	0xc0	/* read from-to single speed */
! #define	MCD_CMDREADDOUBLESPEED	0xc1	/* read from-to double speed */
  #define	MCD_CMDGETDRIVEMODE	0xc2	/* get drive mode */
  #define	MCD_CMDREAD3		0xc3	/* ? */
*** mcd.c.orig	Mon Jun 26 15:47:30 1995
--- mcd.c	Tue Jul  4 20:51:35 1995
***************
*** 115,118 ****
--- 115,119 ----
  
  	char	*type;
+ 	u_char	readcmd;
  	int	flags;
  #define	MCDF_LOCKED	0x01
***************
*** 744,747 ****
--- 745,749 ----
  	 * Note:  Which models support interrupts?  >=LU005S?
  	 */
+ 	sc->readcmd = MCD_CMDREADSINGLESPEED;
  	switch (mbx.res.data.continfo.code) {
  	case 'M':
***************
*** 758,761 ****
--- 760,764 ----
  	case 'D':
  		sc->type = "FX001D";
+ 		sc->readcmd = MCD_CMDREADDOUBLESPEED;
  		break;
  	default:
***************
*** 1036,1040 ****
  
  		/* Send the read command. */
! 		outb(iobase + MCD_COMMAND, MCD_CMDREAD2);
  		outb(iobase + MCD_COMMAND, msf[0]);
  		outb(iobase + MCD_COMMAND, msf[1]);
--- 1039,1043 ----
  
  		/* Send the read command. */
! 		outb(iobase + MCD_COMMAND, sc->readcmd);
  		outb(iobase + MCD_COMMAND, msf[0]);
  		outb(iobase + MCD_COMMAND, msf[1]);
***************
*** 1509,1513 ****
  		return error;
  
! 	mbx.cmd.opcode = MCD_CMDREAD2;
  	mbx.cmd.length = sizeof(mbx.cmd.data.play);
  	mbx.cmd.data.play.start_msf[0] = sc->toc[a].toc.absolute_pos[0];
--- 1512,1516 ----
  		return error;
  
! 	mbx.cmd.opcode = MCD_CMDREADSINGLESPEED;
  	mbx.cmd.length = sizeof(mbx.cmd.data.play);
  	mbx.cmd.data.play.start_msf[0] = sc->toc[a].toc.absolute_pos[0];
***************
*** 1543,1547 ****
  		return error;
  
! 	mbx.cmd.opcode = MCD_CMDREAD2;
  	mbx.cmd.length = sizeof(mbx.cmd.data.play);
  	mbx.cmd.data.play.start_msf[0] = bin2bcd(p->start_m);
--- 1546,1550 ----
  		return error;
  
! 	mbx.cmd.opcode = MCD_CMDREADSINGLESPEED;
  	mbx.cmd.length = sizeof(mbx.cmd.data.play);
  	mbx.cmd.data.play.start_msf[0] = bin2bcd(p->start_m);
***************
*** 1575,1579 ****
  		return error;
  
! 	mbx.cmd.opcode = MCD_CMDREAD2;
  	mbx.cmd.length = sizeof(mbx.cmd.data.play);
  	hsg2msf(p->blk, mbx.cmd.data.play.start_msf);
--- 1578,1582 ----
  		return error;
  
! 	mbx.cmd.opcode = MCD_CMDREADSINGLESPEED;
  	mbx.cmd.length = sizeof(mbx.cmd.data.play);
  	hsg2msf(p->blk, mbx.cmd.data.play.start_msf);