Subject: Re: accessing IDE hard drive via pcmcia card
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Steven M. Bellovin <smb@research.att.com>
List: netbsd-users
Date: 05/19/2004 15:39:30
In message <20040519192738.GB1820@antioche.eu.org>, Manuel Bouyer writes:
>On Wed, May 19, 2004 at 03:01:59PM -0400, Steven M. Bellovin wrote:
>> In message <20040518212818.GA8866@antioche.eu.org>, Manuel Bouyer writes:
>> >On Tue, May 18, 2004 at 11:58:54AM -0400, Steven M. Bellovin wrote:
>> >> a test 2.0 kernel with a delay/retry loop in the initialization; that
>> >> got a bit further than the stock kernel, but still no joy:
>> >>
>> >> wdc2 at pcmcia1 function 0
>> >> atabus2 at wdc2 channel 0
>> >> wdc2:0: before reset, st0=0x80 (10), 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=0x2
>> >
>> >At this point it thinks there's only a slave device, no master.
>> >My guess is that the 0x1 is cleared from ret_value in __wdcwait_reset().
>> >
>>
>> There is only one device on that controller; I have no idea why it
>> thinks it's a slave instead of a master. (I also didn't think that
>> that was a problem.) But from this line:
>>
>> wdc2:0: before reset, st0=0x80 (10), st1=0x0 (0)
>>
>> it looks like the first drive queried -- I assume the master -- never
>> cleared BSY. I can increase the delay value and/or the loop counter,
>> but I have a feeling that that won't help. What I will try when I get
>> home is to change the order of the two tests.
>
>How long do you wait ?
>Per the specs, a reset can take up to 31s.
>
I'll update that and try again...
>>
>> But from the output from the -current kernel, I don't think your guess
>> is correct. I was seeing this:
>>
>> wdc2:0 drive 0 wd_cyl_lo: got 0x80 != 0x02
>> wdc2:0 drive 0 wd_cyl_lo: got 0x80 != 0x01
>> wdc2:0 drive 0 wd_sector: got 0x80 != 0x01
>> wdc2:0 drive 0 wd_sector: got 0x80 != 0x02
>> wdc2:0 drive 0 wd_cyl_lo(2): got 0x80 != 0x01
>> wdc2:0 drive 1 wd_cyl_lo: got 0x80 != 0x02
>> wdc2:0 drive 1 wd_cyl_lo: got 0x80 != 0x01
>> wdc2:0 drive 1 wd_sector: got 0x80 != 0x01
>> wdc2:0 drive 1 wd_sector: got 0x80 != 0x02
>> wdc2:0 drive 1 wd_cyl_lo(2): got 0x80 != 0x01
>>
>> which means that the code in wdcprobe1 would have reset 0x1.
>
>Both 0x1 and 0x2, the test is failing for both drives.
>
I didn't have your logging and my timeout in the same driver. But with
my timeout, I got rid of the 0x80 for one drive, though not the other.
--Steve Bellovin, http://www.research.att.com/~smb