Subject: kern/24904: Samsung drive is not seen by -current kernel
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mlelstv@serpens.de>
List: netbsd-bugs
Date: 03/24/2004 23:32:36
>Number:         24904
>Category:       kern
>Synopsis:       Samsung drive is not seen by -current kernel
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 24 22:33:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Michael van Elst
>Release:        NetBSD-1.6ZK
>Organization:
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."
>Environment:
NetBSD 1.6ZK (PUSSYFOOT) #62: Sun Mar 21 23:53:24 MET 2004
        src@pussyfoot:/home/src/sys/arch/i386/compile/PUSSYFOOT
>Description:

NetBSD-current doesn't see a SP1614N drive on viaide.

NetBSD-1.6.2 has no problems with it after adding a larger delay to wdc.c
as reported before:
--- sys/dev/ic/wdc.c       2003/09/24 11:16:43     1.114.4.3
+++ sys/dev/ic/wdc.c       2004/03/24 22:22:50
@@ -237,7 +237,7 @@
        DELAY(1000);
        bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr,
            WDCTL_IDS);
-       delay(1000);
+       delay(2000);
        (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);


NetBSD-1.6ZK says:

pcib0: VIA Technologies VT8235 (Apollo KT400) PCI-ISA Bridge (rev. 0x00)
viaide0 at pci0 dev 17 function 1
viaide0: VIA Technologies VT8235 ATA133 controller
viaide0: bus-master DMA support present
viaide0: primary channel configured to compatibility mode
viaide0: primary channel interrupting at irq 14
atabus0 at viaide0 channel 0
viaide0: secondary channel configured to compatibility mode
viaide0: secondary channel interrupting at irq 15
atabus1 at viaide0 channel 1
[...]
atapibus0 at atabus1: 2 targets
cd0 at atapibus0 drive 0: <TOSHIBA ODD-DVD SD-M1802, , 1030> cdrom removable
cd0: 32-bit data port
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
cd0(viaide0:1:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA data transfers)
boot device: <unknown>
root device:


NetBSD-1.6.2 says:

pcib0 at pci0 dev 17 function 0
pcib0: VIA Technologies VT8235 (Apollo KT400) PCI-ISA Bridge (rev. 0x00)
pciide0 at pci0 dev 17 function 1: VIA Technologies VT8235 ATA133 controller
pciide0: bus-master DMA support present
pciide0: primary channel configured to compatibility mode
wd0 at pciide0 channel 0 drive 0: <SAMSUNG SP1614N>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 149 GB, 16383 cyl, 16 head, 63 sec, 512 bytes/sect x 312581808 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
pciide0: primary channel interrupting at irq 14
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA data transfers)
pciide0: secondary channel configured to compatibility mode
atapibus0 at pciide0 channel 1: 2 targets
cd0 at atapibus0 drive 0: <TOSHIBA ODD-DVD SD-M1802, , 1030> type 5 cdrom removable
cd0: 32-bit data port
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
pciide0: secondary channel interrupting at irq 15
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA data transfers)


>How-To-Repeat:
Boot NetBSD 1.6ZK on an EPIA-M motherboard with a Samsung SP1614N drive
attached.

>Fix:

--- wdc.c       2004/01/07 22:03:56     1.171
+++ wdc.c       2004/03/24 22:32:12
@@ -590,6 +590,9 @@
        delay(10);      /* 400ns delay */
        bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr,
            WDCTL_RST | WDCTL_IDS | WDCTL_4BIT); 
+       DELAY(1000);
+       bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr,
+           WDCTL_IDS | WDCTL_4BIT); 
        DELAY(2000);
        (void) bus_space_read_1(chp->cmd_iot, chp->cmd_iohs[wd_error], 0);
        bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr, WDCTL_4BIT);

>Release-Note:
>Audit-Trail:
>Unformatted: