Subject: Re: kern/22869: Slave IDE drive not detected
To: Charles M. Hannum <abuse@spamalicious.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 09/22/2003 23:33:24
On Mon, Sep 22, 2003 at 09:08:50PM +0000, Charles M. Hannum wrote:
>
> Well, I tried the following change, and it helped a bit. It prevents
> trying to further probe the ghost on the laptop's primary bus. It
> also avoids waiting for BSY to clear on the bogus drive 1 with my CF
> cards. However, the real IDENTIFY command never manages to complete
> on the CF cards now. I'll look into this some more later.
>
>
>[...]
> [...]
> @@ -362,13 +345,28 @@
> */
> if (cl == 0x14 && ch == 0xeb) {
> chp->ch_drive[drive].drive_flags |= DRIVE_ATAPI;
> - } else {
> + continue;
> + }
> + bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_command,
> + WDCC_IDENTIFY);
You need to wait for DRDY|DSC before issuing the command here
> + delay(10); /* 400ns delay */
> + if (bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_status) & (WDCS_BSY | WDCS_DRQ)) {
> chp->ch_drive[drive].drive_flags |= DRIVE_ATA;
> if (chp->wdc == NULL ||
> (chp->wdc->cap & WDC_CAPABILITY_PREATA) != 0)
> chp->ch_drive[drive].drive_flags |= DRIVE_OLD;
> }
> }
> +
> + bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr,
> + WDCTL_RST | WDCTL_IDS);
> + delay(1000);
> + bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr, WDCTL_IDS);
> + delay(1000);
> + (void) bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_error);
> + bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr, WDCTL_4BIT);
> + delay(10);
> +
You also probably need a wdcreset_wait() here.
Also, for your CF card, you may be hitting the problem handled by
WDC_CAPABILITY_NO_EXTRA_RESETS.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 24 ans d'experience feront toujours la difference
--