Subject: kern/25453: wd(4) fails to attach
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <toshii@netbsd.org>
List: netbsd-bugs
Date: 05/04/2004 12:45:01
>Number:         25453
>Category:       kern
>Synopsis:       wd(4) fails to attach
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 04 03:46:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     toshii@netbsd.org
>Release:        NetBSD 2.0E
>Organization:
	
>Environment:
System: NetBSD primula.my.domain 2.0E NetBSD 2.0E (PRIMULA) #11: Mon May 3 18:15:46 JST 2004 toshii@primula.my.domain:/usr/src/current/sys/arch/amd64/compile/PRIMULA amd64
Architecture: x86_64
Machine: amd64

siside1 at pci0 dev 5 function 0
siside1: Silicon Integrated Systems 180/96X SATA controller (rev. 0x01)
siside1: bus-master DMA support present
siside1: primary channel wired to native-PCI mode
siside1: using ioapic0 pin 17 (irq 11) for native-PCI interrupt
atabus2 at siside1 channel 0
siside1: secondary channel wired to native-PCI mode
atabus3 at siside1 channel 1

(the following is hand edited to remove inlined debug messages.)
wd0 at atabus2 drive 0: <HDS722525VLSA80>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 232 GB, 484521 cyl, 16 head, 63 sec, 512 bytes/sect x 488397168 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd0(siside1:0:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA data
 transfers)
>Description:
	An HGST 250GB SATA drive connected to onboard SiS964 doesn't
	get recognised.  If some debug printfs are enabled like the
	following patch, the disk appears and works fine.

Index: ata.c
===================================================================
RCS file: /export/kiku/NetBSD/NetBSD-CVS/src/sys/dev/ata/ata.c,v
retrieving revision 1.28
diff -u -p -r1.28 ata.c
--- ata.c       2004/04/13 19:51:06     1.28
+++ ata.c       2004/05/04 03:40:37
@@ -392,11 +392,14 @@ ata_get_params(struct ata_drive_datas *d
        wdc_c.flags = AT_READ | flags;
        wdc_c.data = tb;
        wdc_c.bcount = DEV_BSIZE;
+wdcdebug_mask |= 0x8;
        if (wdc_exec_command(drvp, &wdc_c) != WDC_COMPLETE) {
                WDCDEBUG_PRINT(("ata_get_parms: wdc_exec_command failed\n"),
                    DEBUG_FUNCS|DEBUG_PROBE);
+wdcdebug_mask &= ~0x8;
                return CMD_AGAIN;
        }
+wdcdebug_mask &= ~0x8;
        if (wdc_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) {
                WDCDEBUG_PRINT(("ata_get_parms: wdc_c.flags=0x%x\n",
                    wdc_c.flags), DEBUG_FUNCS|DEBUG_PROBE);

	If I enable the next debug printf instead, I get:

	audio1 at auich0: full duplex, independent
	IPsec: Initialized Security Association Processing.
	ata_get_parms: wdc_c.flags=0x139
	ata_get_parms: wdc_c.flags=0x139
	boot device: <unknown>
	root device: reboot
	syncing disks... done

>How-To-Repeat:
	Try to boot with the machine configuration described above.

>Fix:
	No idea.

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