Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 1996 11:52:53 -0400 (EDT)
From:      rhh@ct.picker.com (Randall Hopper)
To:        freebsd-hackers@freebsd.org
Subject:   ATAPI IDE-CDROM Detection Fix
Message-ID:  <199606011552.LAA24442@elmer.picker.com>

next in thread | raw e-mail | index | archive | help
     Finally got some time to play around with this.  After trying all the
tips in mail archives without success I worked with the kernel a bit.  I
found that if caused the wd driver to ignore the "controller busy" that was
detected at the top of atapi.c:atapi_probe (atapi_wait), my CD-ROM was
detected fine and worked well, except that the first access to the drive
typically failed (e.g. mount).

     Thinking the IDE hard disk attach code (wd.c:wdattach) might be
leaving the controller in an invalid state for ATAPI probing, I put in a
hack to wdattach so it wouldn't probe for hard disks on wdc1 where I have
my IDE CD-ROM, but just skip straight to the atapi_attach on that
controller.  With that change, everything works great.  I'm not sure if
there's a fix for the underlying bug involved here in current.  Does anyone
know?

     But anyway, if you're running stock 2.1.0R and are having troubles
getting your IDE CD-ROM detected, and it's hanging off an IDE controller
(wdc1) by itself, try this fix to /usr/src/sys/i386/isa/wd.c and see if it
helps:

#ifdef OLDSTUFF_IN_ORIGINAL_FILE
                if (wdgetctlr(du) == 0) {
#else
                /*  RHH - Don't try to find hard disks on wdc1  */
                if ((dvp->id_unit == 0) && (wdgetctlr(du) == 0)) {
#endif

which causes the hard disk probe to only be done for hard disks hanging off
your first IDE controller (wdc0).  If your CD is instead on wdc0, try
replacing (dvp->id_unit == 0) with (0) to never probe for hard disks, only
ATAPI.  (Another nice benefit of this hack is that you get rid of a really
long delay while the kernel times out probing for hard disks that don't
exist).

     With the hack above, I can play audio CDs with "cdplay wcd0" and mount
ISO9660 CDs with "mount -r -t cd9660 /dev/wcd0c /cd".  The only strange
thing I notice is that it sounds like one of the hard disks in my machine
is doing an unusual amount of track seeking when the CD is accessed -- no
bad effects that I've noticed though.

     By the way, my configuration is FreeBSD 2.1.0R, P55TP4XE motherboard
with dual-IDE, 2 hard drives on wdc0, and a Sony CDU-55E IDE CDROM on wdc1.

Randall Hopper
rhh@ct.picker.com







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606011552.LAA24442>