Subject: Re: thanks and SCSI CD-ROM question
To: Erik E. Fair <fair@clock.org>
From: Matt <fredette@MIT.EDU>
List: port-sun3
Date: 04/20/1999 13:40:14
> > that CD-ROM device should be recognized at boot time as "cd0" not "sd2";
> > the only reason I can think that it's not is that the SCSI cd driver isn't
> > compiled into the kernel.

I should have looked more closely at the probe results; the problem
turned out to be that this CD-ROM drive really does report itself as a
direct-fixed device - not too smart.  So I started looking at how I
could work around this, and found the scsi_quirk_inquiry_pattern array
in dev/scsipi/scsiconf.c.  After looking at sdsipiconf.h, I made the
following patch against my stock 1.3.2 dev/scsipi/scsiconf.c:

[snip]
*** scsiconf.c.orig     Tue May  5 04:21:55 1998
--- scsiconf.c  Tue Apr 20 12:25:11 1999
***************
*** 439,444 ****
--- 439,447 ----
         "MICROP  ", "1588-15MBSUN0669", ""},     SDEV_AUTOSAVE},
        {{T_OPTICAL, T_REMOV,
         "EPSON   ", "OMD-5010        ", "3.08"}, SDEV_NOLUNS},
+       /* reports itself as direct/fixed */
+       {{T_DIRECT, T_FIXED,
+        "TOSHIBA ", "CD-ROM XM-3401TA", "0283"}, ADEV_CDROM|SDEV_NOLUNS},
  
        {{T_DIRECT, T_FIXED,
         "DEC     ", "RZ55     (C) DEC", ""},     SDEV_AUTOSAVE},
***************
*** 647,652 ****
--- 650,661 ----
  
        if ((sc_link->quirks & SDEV_NOLUNS) == 0)
                scsi->moreluns |= (1 << target);
+       if (sc_link->quirks & ADEV_CDROM) {
+               sc_link->quirks ^= ADEV_CDROM;
+               inqbuf.dev_qual2 |= SID_REMOVABLE;
+               sa.sa_inqbuf.type = inqbuf.device = ((inqbuf.device & (~SID_TYPE)) | T_CDROM);
+               sa.sa_inqbuf.removable = T_REMOV;
+       }
  
        /*
         * note what BASIC type of device it is
[snip]

And now the drive attaches correctly:

cd0 at scsibus0 targ 6 lun 0: <TOSHIBA, CD-ROM XM-3401TA, 0283> SCSI2 5/cdrom removable

This isn't sun3-specific (so sorry if the patch is inappropriate for
the list), but is it worth submitting this somewhere?  Any comments on
the workaround?

BTW, once I recompiled xmcd to also tolerate the drive's wierdness, it
worked perfectly.

Matt

--
Matt Fredette
fredette@bbnplanet.com, fredette@mit.edu, fredette@theory.lcs.mit.edu
http://mit.edu/fredette/www
"The first time the Rolling Stones played, three people came."