From owner-freebsd-hackers Sat Jun 1 08:59:51 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA14998 for hackers-outgoing; Sat, 1 Jun 1996 08:59:51 -0700 (PDT) Received: from central.picker.com (central.picker.com [144.54.31.2]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id IAA14987 for ; Sat, 1 Jun 1996 08:59:48 -0700 (PDT) Received: from ct.picker.com by central.picker.com with smtp (Smail3.1.28.1 #3) id m0uPsyP-0004rlC; Sat, 1 Jun 96 11:52 EDT Received: from elmer.picker.com ([144.54.52.5]) by ct.picker.com (4.1/SMI-4.1) id AA06059; Sat, 1 Jun 96 11:52:05 EDT Received: by elmer.picker.com (SMI-8.6/SMI-SVR4) id LAA24442; Sat, 1 Jun 1996 11:52:54 -0400 From: rhh@ct.picker.com (Randall Hopper) Message-Id: <199606011552.LAA24442@elmer.picker.com> Subject: ATAPI IDE-CDROM Detection Fix To: freebsd-hackers@freebsd.org Date: Sat, 1 Jun 1996 11:52:53 -0400 (EDT) Reply-To: rhh@ct.picker.com Organization: Picker International, CT Division X-Mailer: ELM [version 2.4 PL24 PGP3 *ALPHA*] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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