Subject: Re: CD drive not found
To: Lennart Augustsson <augustss@augustsson.net>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: port-i386
Date: 05/11/2000 11:12:27
--/9DWx/yDrRhgMJTb
Content-Type: text/plain; charset=us-ascii

On Wed, May 10, 2000 at 11:44:10PM +0200, Lennart Augustsson wrote:
> NetBSD 1.4Y (SB-FW) #1: Tue May  9 20:27:30 PDT 2000
>     augustss@sandburst.lcs.mit.edu:/usr/src/sys/arch/i386/compile/SB-FW
> cpu0: family 6 model 8 step 3
> cpu0: Intel Pentium III (E) (686-class)
> total memory = 64064 KB
> avail memory = 56536 KB
> using 826 buffers containing 3304 KB of memory
> BIOS32 rev. 0 found at 0xfd8a0
> mainbus0 (root)
> pci0 at mainbus0 bus 0: configuration mode 1
> pci0: i/o space, memory space enabled
> pchb0 at pci0 dev 0 function 0
> pchb0: Intel 82810 Memory Controller Hub (rev. 0x03)
> vga0 at pci0 dev 1 function 0: Intel 82810 Graphics Controller (rev. 0x03)
> wsdisplay0 at vga0: console (80x25, vt100 emulation)
> ppb0 at pci0 dev 30 function 0: Intel 82801AA Hub-to-PCI Bridge (rev. 0x02)
> pci1 at ppb0 bus 1
> pci1: i/o space, memory space enabled
> rtk0 at pci1 dev 11 function 0: RealTek 8139 10/100BaseTX
> rtk0: interrupting at irq 5
> rtk0: Ethernet address 00:50:ba:d8:1d:ca
> ukphy0 at rtk0 phy 7: Generic IEEE 802.3u media interface
> ukphy0: OUI 0x000000, model 0x0000, rev. 0
> ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
> tlp0 at pci1 dev 13 function 0: Lite-On 82C169 Ethernet, pass 2.0
> tlp0: interrupting at irq 9
> tlp0: Ethernet address 00:a0:cc:62:85:82
> ukphy1 at tlp0 phy 1: Generic IEEE 802.3u media interface
> ukphy1: BCM5201 10/100 media interface (OUI 0x001018, model 0x0021), rev. 2
> ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
> Conexant Systems product 0x2013 (miscellaneous communications, revision 0x01) at pci1 dev 14 function 0 not configured
> pcib0 at pci0 dev 31 function 0
> pcib0: Intel 82801AA LPC Interface Bridge (rev. 0x02)
> pciide0 at pci0 dev 31 function 1: Intel 82801AA IDE Controller (ICH)
> pciide0: bus-master DMA support present
> pciide0: primary channel wired to compatibility mode
> pciide0:0: before reset, st0=0x50, st1=0x0
> pciide0:0:0: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
> pciide0:0:1: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
> pciide0:0: wdcwait_reset() end, st0=0x50, st1=0x0
> pciide0:0: after reset, ret_value=0x3
> pciide0:0:0: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
> pciide0:0:1: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
> wdcwait: timeout (time=10001), status 0 error 0 (mask 0x48 bits 0x40)
> wdc_ata_get_parms: wdc_c.flags=0xb1
> wdcwait: timeout (time=10001), status 0 error 0 (mask 0x48 bits 0x40)
> wdc_ata_get_parms: wdc_c.flags=0xb1
> pciide0:0:1: IDENTIFY failed (1)
> wdcattach: ch_drive_flags 0x1 0x0
> wd0 at pciide0 channel 0 drive 0: <SAMSUNG SV1533D>
> wd0: drive supports 16-sector pio transfers, lba addressing
> wd0: 14598 MB, 16383 cyl, 16 head, 63 sec, 512 bytes/sect x 29897280 sectors
> wd0: 32-bit data port
> wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 4
> pciide0:0:0: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
> pciide0:0:1: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
> pciide0:0: wdcwait_reset() end, st0=0x50, st1=0x0
> pciide0: primary channel interrupting at irq 14
> wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)
> pciide0: secondary channel wired to compatibility mode
> pciide0:1: before reset, st0=0x50, st1=0x7f
> pciide0:1:0: after reset, sc=0x3 sn=0x1 cl=0x14 ch=0xeb

Here's the problem. sc should be 0x1 after a reset, not 0x3. I don't know if
the problem is at the drive or controller level, or a bad interaction between
the two. The attached patch relax this condition when probing for drives;
false match should be detected later anyway.

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--

--/9DWx/yDrRhgMJTb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: wdc.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wdc.c,v
retrieving revision 1.88
diff -u -r1.88 wdc.c
--- wdc.c	2000/04/05 06:27:36	1.88
+++ wdc.c	2000/05/11 09:11:59
@@ -255,11 +255,10 @@
 		    chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
 	    	    chp->channel, drive, sc, sn, cl, ch), DEBUG_PROBE);
 		/*
-		 * sc is supposted to be 0x1 for ATAPI but at last one drive
-		 * set it to 0x0 - or maybe it's the controller.
+		 * sc is supposted to be 0x1 for ATAPI but in some cases we
+		 * get wrong values here, so ignore it.
 		 */
-		if ((sc == 0x00 || sc == 0x01) && sn == 0x01 &&
-		    cl == 0x14 && ch == 0xeb) {
+		if (sn == 0x01 && cl == 0x14 && ch == 0xeb) {
 			chp->ch_drive[drive].drive_flags |= DRIVE_ATAPI;
 		} else {
 			chp->ch_drive[drive].drive_flags |= DRIVE_ATA;

--/9DWx/yDrRhgMJTb--