Subject: kern/23808: satalink 3114 SATA doesn't work.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <chris@netbsd.org>
List: netbsd-bugs
Date: 12/21/2003 01:14:51
>Number:         23808
>Category:       kern
>Synopsis:       SATAlink 3114 drive doesn't work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 21 01:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Chris Gilbert
>Release:        NetBSD 1.6ZG
>Organization:

>Environment:
	-current of today (2003-12-21) Running on a:
	Abit IC7-Max3
	Hyper threading is enabled, and a SMP kernel is being used.



>Description:
	When booting using the 3114 driver for the SATAlink, the kernel fails to recognise
	WD Raptor disks (disks work fine with the ICH5R interface):
	
satalink0 at pci 3 dev 3 function 0
satalink0: Silicon Image SATALink 3114 (rev. 0x02)
satalink0: 33Mhz PCI bus
satalink0: bus-master DMA support present
satalink0: using ioapic0 pin 19 (irq 10) for native-PCI interrupt
atabus0 at satalink0 channel 0
atabus1 at satalink0 channel 1
atabus2 at satalink0 channel 2
atabus3 at satalink0 channel 3

snip

satalink0: port 2: device present, speed: 1.5Gb/s
satalink0: port 3: device present, speed: 1.5Gb/s
wd0 at atabus2 drive 0: <WDC WD360GD-75GHA0>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 34332MB, 69754 cyl, 16 head, 63 sec, 512 bytes/sec x 70312500
sectors
wd0: 32-bit data port
wd0: drive supports PIO mode4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
wd0(satalink0:2:0): using PIO mode4, Ultra-DMA mode 6 (Ultra/133) (using
DMA data transfers)
wd1 at atabus3 drive 0: <WDC WD360GD-75GHA0>
wd1: drive supports 16-sector PIO transfers, LBA48 addressing
wd1: 34332MB, 69754 cyl, 16 head, 63 sec, 512 bytes/sec x 70312500
sectors
wd1: 32-bit data port
wd1: drive supports PIO mode4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
wd1(satalink0:3:0): using PIO mode4, Ultra-DMA mode 6 (Ultra/133) (using
DMA data transfers)

snip

satalink0:2:0: recal error (4)
wd0d: error reading fsbn 0 (wd0 bn 0; cn 0 tn 0 sn 0), retrying
wd0: (aborted command)

snip retrys:
satalink0:2:0: recal error (4)
wd0d: error reading fsbn 0 (wd0 bn 0; cn 0 tn 0 sn 0)wd0: (aborted
command)

wd0: dos partion I/O error

Using a patch supplied by thorpej@
Index: ata_wdc.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ata/ata_wdc.c,v
retrieving revision 1.47
diff -c -r1.47 ata_wdc.c
*** ata_wdc.c	14 Dec 2003 05:35:34 -0000	1.47
--- ata_wdc.c	20 Dec 2003 23:03:26 -0000
***************
*** 235,248 ****
  		errstring = "wait";
  		if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags))
  			goto ctrltimeout;
! 		wdccommandshort(chp, xfer->drive, WDCC_RECAL);
! 		/* Wait for at last 400ns for status bit to be valid */
! 		DELAY(1);
! 		errstring = "recal";
! 		if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags))
! 			goto ctrltimeout;
! 		if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
! 			goto ctrlerror;
  		/* Don't try to set modes if controller can't be adjusted */
  		if ((chp->wdc->cap & WDC_CAPABILITY_MODE) == 0)
  			goto geometry;
--- 235,251 ----
  		errstring = "wait";
  		if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags))
  			goto ctrltimeout;
! 		if (drvp->drive_flags & DRIVE_OLD) {
! 			wdccommandshort(chp, xfer->drive, WDCC_RECAL);
! 			/* Wait for at last 400ns for status bit to be valid */
! 			DELAY(1);
! 			errstring = "recal";
! 			if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY,
! 				    wait_flags))
! 				goto ctrltimeout;
! 			if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
! 				goto ctrlerror;
! 		}
  		/* Don't try to set modes if controller can't be adjusted */
  		if ((chp->wdc->cap & WDC_CAPABILITY_MODE) == 0)
  			goto geometry;

This changes the log messages to:
wd1: transfer error, downgrading to Ultra-DMA mode 2
wd1(satalink0:3:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA data transfers)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1: transfer error, downgrading to Ultra-DMA mode 1
wd1(satalink0:3:0): using PIO mode 4, Ultra-DMA mode 1 (using DMA data transfers)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1: transfer error, downgrading to DMA mode 2
wd1(satalink0:3:0): using PIO mode 4, DMA mode 2 (using DMA data transfers)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1: transfer error, downgrading to PIO mode 4
wd1(satalink0:3:0): using PIO mode 4
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0)wd1: (id not found)

wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: (id not found)
wd1d: error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0)wd1: (id not found)

wd1: dos partition I/O error

>How-To-Repeat:
	Install WD Raptor disks on a SATAlink 3114 chip.
>Fix:
	I think the disks work when wdc debugging/tracing is enabled, however that kind of tracing is rather verbose, and painful, and hard to see if it gives an indication of what's going wrong.
>Release-Note:
>Audit-Trail:
>Unformatted: