Subject: Re: CDROM detection (again)
To: Ken Hornstein <kenh@cmf.nrl.navy.mil>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: current-users
Date: 11/13/1998 12:12:54
On Nov 12, Ken Hornstein wrote
> Okay, I figured out the problem (at least, for me).
>
> There is a section of code in wdc:wdcprobe() right in the beginning:
>
> /*
> * Sanity check to see if the wdc channel responds at all.
> */
>
> bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
> WDSD_IBM);
> delay(1);
> st0 = bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_status);
> bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
> WDSD_IBM | 0x10);
> delay(1);
> st1 = bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_status);
>
> WDCDEBUG_PRINT(("%s:%d: before reset, st0=0x%x, st1=0x%x\n",
> chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe", chp->channel,
> st0, st1), DEBUG_PROBE);
>
> if (st0 == 0xff)
> ret_value &= ~0x01;
> if (st1 == 0xff)
> ret_value &= ~0x02;
> if (ret_value == 0)
> return 0;
>
> #ifdef'ing this code out made my CD-ROM drive start working. Jonathan,
> can you see if this works for you?
I doubt. Jonathan's problem is that his drive doesn't respond to the
IDENTIFY command.
>
> Manuel, do you have any ideas? I will agree that my CD-ROM drive is
> cranky, and I'm willing to quirk this code ... but should it even be
> there? I think that other OS's IDE drivers don't do this.
At last freebsd does this.
For ISA controllers, when there's no drive a inb on one of the registers will
return 0xff. If we strictly follow the specs, this means "disk busy,
don't try to access any other register", and we have to wait 31s before
deciding there's nothing here. For a i386 GENERIC or INSTALL kernel on a
machine without IDE devices this will take 1mn for each boot.
What will a new user think about this ? "Linux can boot on
my machine in a few seconds, NetBSD takes more than a minute, NetBSD
sucks" (linux ask the bios for the available drives).
Now, for "standard" IDE devices, the status register content will always have
some sense, even when the device is busy (doing otherwise would require
more logic than needed, I think).
Maybe this hack should only be used for ISA and ISAPnP controllers ?
If someone puts a pcmcia controller, it's likely there will be a drive
attached to it, so the 31s delay is not a problem here.
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--