Subject: port-i386/1506: My WD340 IDE drive fails when on a second controller; + hack to disable LBA makes it work.
To: None <gnats-bugs@gnats.netbsd.org>
From: Douglas Thomas Crosher <dtc@scrooge.ee.swin.oz.au>
List: netbsd-bugs
Date: 09/26/1995 02:50:40
>Number: 1506
>Category: port-i386
>Synopsis: My WD340 IDE drive fails when on a second controller. + hack to disable LBA makes it work.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 25 13:05:02 1995
>Last-Modified:
>Originator: Douglas Crosher
>Organization:
Swinburne University of Technology
>Release: NetBSD-current 24/9/1995
>Environment:
System: NetBSD dtc-pc 1.0A NetBSD 1.0A (DTC) #6: Tue Sep 26 00:50:49 EST 1995 dtc@dtc-pc:/usr/src/sys/arch/i386/compile/DTC i386
>Description:
My WD340 IDE drive fails to work when attached to a second IDE
controller - it cannot even read the MBR.
>How-To-Repeat:
Using the configuration below, I boot to single user mode, then try to
read a disklabel from the WD drive on the second controller - this
fails.
I have enabled WDDEBUG with a few patches and the output is included
below. Note: that in wd.c the number of retries was reduced to 1 so I
could record it all; more retries didn't help.
-=-=-=-=-=-=-
Configuration
--------------
1. BIOS
It may be significant that my BIOS has no support for the second
controller. Does NetBSD depend on the BIOS performing some
initialisations?
2. Disk Configuration
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
wd0 at wdc0 drive 0: 696MB, 1416 cyl, 16 head, 63 sec, 512 bytes/sec <QUANTUM LIGHTNING 730A>
wd0: using 8-sector 16-bit pio transfers, lba addressing
wd1 at wdc0 drive 1: 234MB, 723 cyl, 13 head, 51 sec, 512 bytes/sec <QUANTUM LP240A GM240A01X>
wd1: using 8-sector 16-bit pio transfers, chs addressing
wdc1 at isa0 port 0x170-0x177 irq 15
wd2 at wdc1 drive 0: 325MB, 1010 cyl, 12 head, 55 sec, 512 bytes/sec <WDC AC2340F>
wd2: using 16-sector 16-bit pio transfers, lba addressing
-=-=-=-=-=-=-=-
WDDEBUG output for the failure
------------------------------
The Kernel wd driver debug messages for:
disklabel -r /dev/rwd0d
wdc1: warning: busy-wait took 1700us
I1 I1
wd2: wdcstart read 512@0; map sector 0 cylin 0 head 64 addr f8e10000 sts d0
I1 wd2: wdcintr: status 0 error 0
wd2: wdcstart read 512@0; map sector 0 cylin 0 head 64 addr f8e10000 sts d1
I1 wd2: wdcintr: status 0 error 0
wd2d: hard error reading fsbn 0 (wd2 bn 0; cn 0 tn 0 sn 0)
I1
wd2: wdcstart read 512@0; map sector 0 cylin 0 head 64 addr f8e10000 sts d0
I1 wd2: wdcintr: status 0 error 0
wd2: wdcstart read 512@0; map sector 0 cylin 0 head 64 addr f8e10000 sts d1
I1 wd2: wdcintr: status 0 error 0
wd2d: hard error reading fsbn 0 (wd2 bn 0; cn 0 tn 0 sn 0)
wd2: dos partition I/O error
wd2: wdcstart read 512@0; map sector 0 cylin 0 head 64 addr f926c574 sts d1
I1 wd2: wdcintr: status 0 error 0
wd2: wdcstart read 512@0; map sector 0 cylin 0 head 64 addr f926c574 sts d1
I1 wd2: wdcintr: status 0 error 0
wd2d: hard error reading fsbn 0 (wd2 bn 0; cn 0 tn 0 sn 0)
wd2: wdcstart read 8192@0; map sector 0 cylin 0 head 64 addr f926ca94 sts d1
I1 wd2: wdcintr: status 0 error 0
wd2: wdcstart read 8192@0; map sector 0 cylin 0 head 64 addr f926ca94 sts d1
I1 wd2: wdcintr: status 0 error 0
wd2d: hard error reading fsbn 0 of 0-15 (wd2 bn 0; cn 0 tn 0 sn 0)
-=-=-=-=-=-
>Fix:
I found that by disabling the LBA feature that it all worked. The
output is included below. It seems that an LBA read from the WD340
drive will not work. The WD340 drive will work in LBA mode under
NetBSD if it is attached as a second drive on controller 1 - perhaps
the BIOS initialises something in this case?
The disklabel -r command works with a patched wd.c to disable LBA
mode. The Kernel wd driver debug messages for:
disklabel -r /dev/rwd0d
wdc1: warning: busy-wait took 1700us
I1 wd(2,0) C1010H12S55
I1 I1
wd2: wdcstart read 512@0; map sector 1 cylin 0 head 0 addr f8d18000 sts d0
I1
wd2: wdcstart read 512@34; map sector 2 cylin 0 head 1 addr f8d18000 sts d0
I1 wd(2,0) C1010H8S33
I1 I1
wd2: wdcstart read 512@0; map sector 1 cylin 0 head 0 addr f8d18000 sts d0
I1
wd2: wdcstart read 512@34; map sector 2 cylin 0 head 1 addr f8d18000 sts d0
I1 wd(2,0) C0H8S33
I1 I1
wd2: wdcstart read 512@0; map sector 1 cylin 0 head 0 addr f926c574 sts d0
I1
wd2: wdcstart read 8192@33; map sector 1 cylin 0 head 1 addr f926ca94 sts d0
I1
Note: this has worked without error.
-=-=-=-=-=-
Patch - Hack
------------
The hack to disable LBA mode:
***************
*** 1277,1280 ****
--- 1278,1282 ----
*p = ntohs(*p);
}
+ wd->sc_params.wdp_capabilities &= ~WD_CAP_LBA;
}
-=-=-=-=-=-
>Audit-Trail:
>Unformatted: