Subject: Re: accessing IDE hard drive via pcmcia card
To: None <netbsd-users@NetBSD.org>
From: Steven M. Bellovin <smb@research.att.com>
List: netbsd-users
Date: 05/19/2004 20:58:05
In message <20040519192738.GB1820@antioche.eu.org>, Manuel Bouyer writes:
>
>How long do you wait ?
>Per the specs, a reset can take up to 31s.
>
That was the answer. I fiddled with my code a bit to allow for a
longer wait; the drive is now recognized. I'm going to play with
things a bit more and then send in a PR with the fix.
For the record, here's a successful discovery of the device. In the
'before reset' message at line 3, the number in parentheses is
the number of passes through the delay loop; each pass has a
delay(1000000) call, which should (per delay(9)) be about 1 second (but
seemed longer). OTOH, the wdcwait timeout might be the rest of the time;
I didn't look at that section of code.
wdc2 at pcmcia1 function 0
atabus2 at wdc2 channel 0
wdc2:0: before reset, st0=0x50 (3), st1=0x0 (0)
wdc2:0:0: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
wdc2:0:1: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
wdc2:0: wdcwait_reset() end, st0=0x50 st1=0x0
wdc2:0: after reset, ret_value=0x3
wdc2:0:0: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
wdc2:0:1: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
wdc2:0: wait DRDY st0 0x50 st1 0x0
__wdcwait: timeout (time=11), status d0 error d0 (mask 0x0 bits 0x0)
__wdcwait: timeout (time=11), status d0 error d0 (mask 0x0 bits 0x0)
__wdcwait: timeout (time=11), status d0 error d0 (mask 0x0 bits 0x0)
__wdcwait: timeout (time=11), status d0 error d0 (mask 0x0 bits 0x0)
atabusattach: ch_drive_flags 0x1 0x0
wd1 at atabus2 drive 0: <HTS548040M9AT00>
wd1: drive supports 16-sector PIO transfers, LBA addressing
wd1: 38154 MB, 77520 cyl, 16 head, 63 sec, 512 bytes/sect x 78140160 sectors
wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
Thank you, Manuel and Charles.
--Steve Bellovin, http://www.research.att.com/~smb