ATAPI IDE CDROM kernel logs (Linux 2.2.13)

Chris Rankin (rankinc@zip.com.au)
Sat, 11 Dec 1999 23:27:01 +1100 (EST)


Hi,
I am occasionally seeing some rather odd errors while loading audio
CD-ROMs. The following is output from my kernel log:

Dec 11 20:52:59 WellHouse kernel: hdc: packet command error: status=0x51 { DriveReady SeekComplete Error }
Dec 11 20:52:59 WellHouse kernel: hdc: packet command error: error=0x30
Dec 11 20:52:59 WellHouse kernel: ATAPI device hdc:
Dec 11 20:52:59 WellHouse kernel: Error: Medium error -- (Sense key=0x03)
Dec 11 20:52:59 WellHouse kernel: Unable to recover table of contents -- (asc=0x57, ascq=0x00)
Dec 11 20:52:59 WellHouse kernel: The failed "Test Unit Ready" packet command was:
Dec 11 20:52:59 WellHouse kernel: "00 00 00 00 00 00 00 00 00 00 00 00 "
Dec 11 20:52:59 WellHouse kernel: hdc: packet command error: status=0x51 { DriveReady SeekComplete Error }
Dec 11 20:52:59 WellHouse kernel: hdc: packet command error: error=0x30
Dec 11 20:52:59 WellHouse kernel: ATAPI device hdc:
Dec 11 20:52:59 WellHouse kernel: Error: Medium error -- (Sense key=0x03)
Dec 11 20:52:59 WellHouse kernel: Unable to recover table of contents -- (asc=0x57, ascq=0x00)
Dec 11 20:52:59 WellHouse kernel: The failed "Test Unit Ready" packet command was:
Dec 11 20:52:59 WellHouse kernel: "00 00 00 00 00 00 00 00 00 00 00 00 "
Dec 11 20:52:59 WellHouse kernel: hdc: packet command error: status=0x51 { DriveReady SeekComplete Error }
Dec 11 20:52:59 WellHouse kernel: hdc: packet command error: error=0x30
Dec 11 20:52:59 WellHouse kernel: ATAPI device hdc:
Dec 11 20:52:59 WellHouse kernel: Error: Medium error -- (Sense key=0x03)
Dec 11 20:52:59 WellHouse kernel: Unable to recover table of contents -- (asc=0x57, ascq=0x00)
Dec 11 20:52:59 WellHouse kernel: The failed "Test Unit Ready" packet command was:
Dec 11 20:52:59 WellHouse kernel: "00 00 00 00 00 00 00 00 00 00 00 00 "

This is happening when I am loading a new disk into the drive while
running xmcd-2.4. I have looked through the xmcd code and it looks
fairly innocent. This is the DEBUG output from xmcd while the kernel
errors are being written:

Open: /dev/cdrom

IOCTL: CDROM_DRIVE_STATUS arg=0x7fffffff ret=2
CDROM_DRIVE_STATUS return=0x2

IOCTL: CDROM_DRIVE_STATUS arg=0x7fffffff ret=3
CDROM_DRIVE_STATUS return=0x3

IOCTL: CDROM_DRIVE_STATUS arg=0x7fffffff ret=3
CDROM_DRIVE_STATUS return=0x3
Disc not ready.

Close: /dev/cdrom
Open of /dev/cdrom failed

Open: /dev/cdrom

IOCTL: CDROM_DRIVE_STATUS arg=0x7fffffff ret=3
CDROM_DRIVE_STATUS return=0x3

IOCTL: CDROM_DRIVE_STATUS arg=0x7fffffff ret=3
CDROM_DRIVE_STATUS return=0x3

IOCTL: CDROM_DRIVE_STATUS arg=0x7fffffff ret=3
CDROM_DRIVE_STATUS return=0x3
Disc not ready.

Close: /dev/cdrom

And here is the corresponding code (slioc_send() is basically a wrapper
around ioctl() which returns 0 if the ioctl returns -1, and 1 otherwise):

--- extract from slioc_disc_present()
#ifdef linux
/* Use new method to get drive status */
if (slioc_send(CDROM_DRIVE_STATUS, (void *) CDSL_CURRENT, 0,
app_data.debug, &ret)) {
DBGPRN(errfp, "CDROM_DRIVE_STATUS return=0x%x\n", ret);

switch (ret) {
case CDS_DISC_OK:
return TRUE;
case CDS_NO_DISC:
case CDS_TRAY_OPEN:
case CDS_DRIVE_NOT_READY:
return FALSE;
case CDS_NO_INFO:
break;
default:
return FALSE;
}
}
/* CDROM_DRIVE_STATUS failed: try the old way */
#endif

--- and slioc_disc_present() is called from:

/* Linux hack: The CD-ROM driver allows the open to succeed
* even if there is no CD loaded. We test for the existence of
* a disc with slioc_disc_present().
*/
for (i = 0; i < 3; i++) {
if ((ret = slioc_disc_present(FALSE)) == TRUE)
break;
}
if (ret == FALSE) {
DBGPRN(errfp, "%s\n\nClose: %s\n",
"Disc not ready.", s->curdev);
slioc_close();
return FALSE;
}

So all xmcd seems to be doing is polling the CDROM with the
CDROM_DRIVE_STATUS ioctl, waiting for me to put a disk in. The CD in
question has a video track at the end of it, which might also be
significant; I don't recall seeing this error before buying audio CDs
with "bonus" video / data tracks.

According to /proc, my cdrom is:

$ cat /proc/ide/hdc/model
TOSHIBA CD-ROM XM-6002B

$ cat /proc/ide/hdc/driver
ide-cdrom version 4.54

# cat /proc/ide/hdc/settings
name value min max mode
---- ----- --- --- ----
breada_readahead 4 0 127 rw
dsc_overlap 0 0 1 rw
file_readahead 124 0 2097151 rw
io_32bit 0 0 3 rw
keepsettings 0 0 1 rw
max_kb_per_request 64 1 127 rw
nice1 1 0 1 rw
pio_mode write-only 0 255 w
slow 0 0 1 rw
unmaskirq 0 0 1 rw
using_dma 0 0 1 rw

One final observation (although with too few statistics for me to be
sure of its significance) - the kernel errors seem to be produced when
I close the drive's tray by pushing the button on the front, rather
than by issuing a software request. When I use the ioctl, I tend to
see this error in /var/log/kernel, but the disc is successfully
recognised:

Dec 11 21:47:23 WellHouse kernel: hdc: irq timeout: status=0xd0 { Busy }
Dec 11 21:47:23 WellHouse kernel: hdc: ATAPI reset complete

I hope I've included enough information here for someone to have an
idea what and where the problem might be,

Cheers,
Chris.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/