Subject: playing audio CDs
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 09/25/1999 13:04:21
I just got myself a CD drive, specifically because I want to play audio
CDs.  It's

cd0 at scsibus0 targ 4 lun 0: <SONY, CD-ROM CDU-541, 2.6a> SCSI2 5/cdrom removable

And CDIOREADTOCHEADER and CDIOREADTOCENTRYS work.  (Incidentally, why
is that not ...ENTRIES?)

But when I used CDIOCPLAYMSF, I saw

# ./play
Playing 1..14, 0/2/0..73/39/51
cd0(esp0:4:0): esp0: timed out [ecb 0xf02918fc (flags 0x3, dleft 42, stat 0)], <state 4, nexus 0xf02918fc, phase(l 3, c 3, p 3), resid 26, msg(q 0,o 40) >
cd0(esp0:4:0): esp0: timed out [ecb 0xf02918fc (flags 0x43, dleft 42, stat 0)], <state 4, nexus 0xf02918fc, phase(l 3, c 3, p 3), resid 26, msg(q 20,o 40) > AGAIN
esp0: SCSI bus reset
sd0(esp0:0:0): max sync rate 4.03Mb/s
# 

I recall seeing this starting way back approximately when the
scsi/atapi -> scsipi merge happened; I dealt with it then by just not
upgrading the kernel on the machine I then listened to CDs on.  But
whatever was wrong doesn't seem to have been fixed.

I got similar errors out of CDIOCPLAYTRACKS.

Turning on all four of the SDEV_DBx bits, I get voluminous debugging
output on the console.  Fortunately, the machine I'm doing this on has
serial console, so I could capture it. :)  Full output is available if
anyone is interested; the most interesting thing I see in it is that
the command that seems to be timing out is a mode select:
15,10,00,00,1c,00.  Noting that SMS_PF is set, I searched the source
for SMS_PF.  This pointed the finger at cd_scsibus_set_mode.  Tracing
the control flow in the other direction, I found they met in
cd_scsibus_set_pa_immed.  Dummying out that function (making it simply
"return(0);") makes CDIOCPLAYMSF start working for me.

Problem with the drive?  Problem with the software?  Did perhaps this
set_pa_immed stuff show up about when the scsi/atapi merge happened?
Recommendations from anyone?  I've now seen this with two different
drives on two different machines, so it's probably not anything
seriously idiosyncratic (though I do think both affected drives are
from Sony).

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B