Subject: odd behavior with Sony PCGA-CD51 cd-rom
To: None <port-i386@netbsd.org>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: port-i386
Date: 12/08/1999 22:23:45
I just picked up the Sony PCGA-CD51 CD drive for my Vaio; it's shows up as a
pcmcia wdc controller with an atapibus-connected cd drive attached;
the CD is powered off of the PCMCIA connection rather than requiring a
separate power source or battery.
I fixed one blatant bug in wdc_pcmcia.c which caused it fail to hot
swap (insert worked fine, but left thing slightly borked so that eject
didn't quite clean up; a subsequent insert didn't work, and the
subsequent eject panic'ed).
I'm faced with the following odd behaviors; anyone got any advice on
the right way to tackle this in the existing wdc codebase?
1) Since the controller's powered down when all devices on the
controller are closed, you can't open the drive using the
front-of-case button.
2) Mounts of the block device while the unit's deactivated fail
with an I/O error:
# mount -t cd9660 /dev/cd0a /mnt
mount_cd9660: /dec/cd0a on /mnt: Input/output error
#
If I instead do a
# sleep 500 < /dev/rcd0d &
to keep the device open, the drive spins up ok, and the mount can
succeed.
I suspect that a solution to (1) and (2) would be to add a quirk to
the driver entry for this device saying "don't bother powering it off
on close".
3) If i eject the card while the device is open (e.g., from the
sleep), the system wedges; a traceback from DDB shows it hung waiting
for the controller attempting to send a command to the CD telling it
that it can allow the CD to be ejected.
I suspect the problem here is twofold:
- sc->sc_dying is a misnomer (it really means "hardware is gone").
- sc->sc_dying isn't set soon enough in sys/dev/ic/wdc.c
(it's not set until *after* the subdevices are detached)
- sc->sc_dying isn't checked in enough places..
Unfortunately, my familiarity with the whole scsi/atapi subsystem
isn't quite up to diving right in and fixing it.
Anyone got a few free clues?
- Bill