From gdonl@tsc.tdk.com Tue Nov 30 19:28:40 1999
Return-Path: <gdonl@tsc.tdk.com>
Received: from gatekeeper.tsc.tdk.com (gatekeeper.tsc.tdk.com [207.113.159.21])
	by hub.freebsd.org (Postfix) with ESMTP id 891C614E06
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 30 Nov 1999 19:28:40 -0800 (PST)
	(envelope-from gdonl@tsc.tdk.com)
Received: from imap.gv.tsc.tdk.com (imap.gv.tsc.tdk.com [192.168.240.198])
	by gatekeeper.tsc.tdk.com (8.8.8/8.8.8) with ESMTP id TAA08268
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 30 Nov 1999 19:28:40 -0800 (PST)
	(envelope-from gdonl@tsc.tdk.com)
Received: (from gdonl@localhost)
	by imap.gv.tsc.tdk.com (8.9.3/8.9.3) id TAA00751;
	Tue, 30 Nov 1999 19:26:29 -0800 (PST)
	(envelope-from Don.Lewis@tsc.tdk.com)
Message-Id: <199912010326.TAA00751@imap.gv.tsc.tdk.com>
Date: Tue, 30 Nov 1999 19:26:29 -0800 (PST)
From: Don Lewis <Don.Lewis@tsc.tdk.com>
Sender: gdonl@tsc.tdk.com
Reply-To: gdonl@tsc.tdk.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: CD changer autodetection doesn't work, causing SCSI timeout [PATCH]
X-Send-Pr-Version: 3.2

>Number:         15198
>Category:       kern
>Synopsis:       CD changer autodetection doesn't work, causing SCSI timeout [PATCH]
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    ken
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 30 19:30:01 PST 1999
>Closed-Date:    Tue Dec 7 21:13:46 PST 1999
>Last-Modified:  Tue Dec  7 21:14:57 PST 1999
>Originator:     Don Lewis <truckman@FreeBSD.org>
>Release:        FreeBSD 3.3-STABLE i386
>Organization:
TDK Semiconductor
>Environment:

FreeBSD 3.3-STABLE of the 19991129 vintage with a PIONEER CD-ROM DRM-6324X
LUN-based CD-ROM changer connected via an aic SCSI controller.

>Description:

A SCSI bus timeout occurs when the driver attempts to access the
second slot in the CD changer (cd2).  If the cdX devices are listed
in /etc/fstab, the machine totally wedges.  If no attempt is made
to mount the cdX devices, the machine is otherwise usable.

Copyright (c) 1992-1999 FreeBSD Inc.
Copyright (c) 1982, 1986, 1989, 1991, 1993
	The Regents of the University of California. All rights reserved.
FreeBSD 3.3-STABLE #3: Sun Nov 28 08:45:20 PST 1999
    gdonl@gvpc85.gv.tsc.tdk.com:/usr/src/sys/compile/TSC_INTERNAL
Timecounter "i8254"  frequency 1193182 Hz
Timecounter "TSC"  frequency 265910120 Hz
CPU: Pentium II (265.91-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x633  Stepping = 3
  Features=0x80f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,MMX>
real memory  = 67108864 (65536K bytes)
avail memory = 62078976 (60624K bytes)
Preloaded elf kernel "kernel" at 0xc030a000.
Preloaded userconfig_script "/boot/kernel.conf" at 0xc030a09c.
Pentium Pro MTRR support enabled
Probing for devices on PCI bus 0:
chip0: <Intel 82440FX (Natoma) PCI and memory controller> rev 0x02 on pci0.0.0
chip1: <Intel 82371SB PCI to ISA bridge> rev 0x01 on pci0.7.0
ide_pci0: <Intel PIIX3 Bus-master IDE controller> rev 0x00 on pci0.7.1
vga0: <Matrox MGA 2164W graphics accelerator> rev 0x00 int a irq 10 on pci0.11.0
xl0: <3Com 3c905-TX Fast Etherlink XL> rev 0x00 int a irq 9 on pci0.15.0
xl0: Ethernet address: 00:60:08:31:f9:87
xl0: autoneg complete, link status good (half-duplex, 10Mbps)
ahc0: <Adaptec 2940 Ultra SCSI adapter> rev 0x00 int a irq 10 on pci0.19.0
ahc0: aic7880 Wide Channel A, SCSI Id=7, 16/255 SCBs
Probing for devices on the ISA bus:
sc0 on isa
sc0: VGA color <16 virtual consoles, flags=0x0>
atkbdc0 at 0x60-0x6f on motherboard
atkbd0 irq 1 on isa
psm0 not found
sio0 at 0x3f8-0x3ff irq 4 flags 0x10 on isa
sio0: type 16550A
sio1: configured irq 3 not in bitmap of probed irqs 0
sio1 not found at 0x2f8
fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa
fdc0: FIFO enabled, 8 bytes threshold
fd0: 1.44MB 3.5in
wdc0 not found at 0x1f0
wdc1 not found at 0x170
ppc0 at 0x378 irq 7 on isa
ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
lpt0: <generic printer> on ppbus 0
lpt0: Interrupt-driven port
ppi0: <generic parallel i/o> on ppbus 0
plip0: <PLIP network interface> on ppbus 0
aic0 at 0x340-0x35f irq 11 on isa
aic0: aic6360, disconnection
vga0 at 0x3c0-0x3df maddr 0xa0000 msize 131072 on isa
npx0 on motherboard
npx0: INT 16 interface
Waiting 2 seconds for SCSI devices to settle
sa0 at aic0 bus 0 target 5 lun 0
sa0: <HP C1557A UL01> Removable Sequential Access SCSI-2 device 
sa0: 5.000MB/s transfers (5.000MHz, offset 8)
pass4 at aic0 bus 0 target 5 lun 1
pass4: <HP C1557A UL01> Removable Changer SCSI-2 device 
pass4: 5.000MB/s transfers (5.000MHz, offset 8)
da0 at ahc0 bus 0 target 0 lun 0
da0: <SEAGATE ST34371N 0484> Fixed Direct Access SCSI-2 device 
da0: 20.000MB/s transfers (20.000MHz, offset 15), Tagged Queueing Enabled
da0: 4148MB (8496884 512 byte sectors: 255H 63S/T 528C)
changing root device to da0s1a
cd0 at ahc0 bus 0 target 5 lun 0
cd0: <NEC CD-ROM DRIVE:462 1.14> Removable CD-ROM SCSI-2 device 
cd0: 10.000MB/s transfers (10.000MHz, offset 15)
cd0: Attempt to query device size failed: NOT READY, Medium not present
WARNING: / was not properly dismounted
da1 at ahc0 bus 0 target 1 lun 0
da1: <WDIGTL WDE2170-1807A3 1.80> Fixed Direct Access SCSI-2 device 
da1: 40.000MB/s transfers (20.000MHz, offset 8, 16bit)
da1: 2047MB (4194057 512 byte sectors: 255H 63S/T 261C)
cd1 at aic0 bus 0 target 6 lun 0
cd1: <PIONEER CD-ROM DRM-6324X 1.03> Removable CD-ROM SCSI-2 device 
cd1: 5.000MB/s transfers (5.000MHz, offset 8)
cd1: cd present [12205 x 2048 byte records]
(cd2:aic0:0:6:1): ccb 0xc0871800 - timed out, phase 84
cd2 at aic0 bus 0 target 6 lun 1
cd2: <PIONEER CD-ROM DRM-6324X 1.03> Removable CD-ROM SCSI-2 device 
cd2: 5.000MB/s transfers (5.000MHz, offset 8)
cd2: cd present [36007 x 2048 byte records]
cd3 at aic0 bus 0 target 6 lun 2
cd3: <PIONEER CD-ROM DRM-6324X 1.03> Removable CD-ROM SCSI-2 device 
cd3: 5.000MB/s transfers (5.000MHz, offset 8)
cd3: cd present [211343 x 2048 byte records]
cd4 at aic0 bus 0 target 6 lun 3
cd4: <PIONEER CD-ROM DRM-6324X 1.03> Removable CD-ROM SCSI-2 device 
cd4: 5.000MB/s transfers (5.000MHz, offset 8)
cd4: Attempt to query device size failed: NOT READY, Medium not present
cd5 at aic0 bus 0 target 6 lun 4
cd5: <PIONEER CD-ROM DRM-6324X 1.03> Removable CD-ROM SCSI-2 device 
cd5: 5.000MB/s transfers (5.000MHz, offset 8)
cd5: Attempt to query device size failed: NOT READY, Medium not present
cd6 at aic0 bus 0 target 6 lun 5
cd6: <PIONEER CD-ROM DRM-6324X 1.03> Removable CD-ROM SCSI-2 device 
cd6: 5.000MB/s transfers (5.000MHz, offset 8)
cd6: Attempt to query device size failed: NOT READY, Medium not present
cd9660: RockRidge Extension

>How-To-Repeat:

	

>Fix:
	
Adding a quirk entry to the driver fixes the problem, even though the
comments say this shouldn't be necessary.

--- sys/cam/scsi/scsi_cd.c.orig	Sun Aug 29 09:21:45 1999
+++ sys/cam/scsi/scsi_cd.c	Tue Nov 30 06:40:16 1999
@@ -164,6 +164,10 @@
 		  "*"}, /* quirks */ CD_Q_CHANGER
 	},
 	{
+		{ T_CDROM, SIP_MEDIA_REMOVABLE, "PIONEER", "CD-ROM DRM-6324X",
+		  "*"}, /* quirks */ CD_Q_CHANGER
+	},
+	{
 		{ T_CDROM, SIP_MEDIA_REMOVABLE, "CHINON", "CD-ROM CDS-535","*"},
 		/* quirks */ CD_Q_BCD_TRACKS
 	}

>Release-Note:
>Audit-Trail:

From: "Kenneth D. Merry" <ken@kdm.org>
To: gdonl@tsc.tdk.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/15198: CD changer autodetection doesn't work, causing SCSI timeout [PATCH]
Date: Tue, 30 Nov 1999 22:37:50 -0700 (MST)

 Don Lewis wrote...
 > 
 > >Number:         15198
 > >Category:       kern
 > >Synopsis:       CD changer autodetection doesn't work, causing SCSI timeout [PATCH]
 
 [ ... ]
 
 > FreeBSD 3.3-STABLE of the 19991129 vintage with a PIONEER CD-ROM DRM-6324X
 > LUN-based CD-ROM changer connected via an aic SCSI controller.
 > 
 > >Description:
 > 
 > A SCSI bus timeout occurs when the driver attempts to access the
 > second slot in the CD changer (cd2).  If the cdX devices are listed
 > in /etc/fstab, the machine totally wedges.  If no attempt is made
 > to mount the cdX devices, the machine is otherwise usable.
 
 [ ... ]
 
 > cd1 at aic0 bus 0 target 6 lun 0
 > cd1: <PIONEER CD-ROM DRM-6324X 1.03> Removable CD-ROM SCSI-2 device 
 > cd1: 5.000MB/s transfers (5.000MHz, offset 8)
 > cd1: cd present [12205 x 2048 byte records]
 > (cd2:aic0:0:6:1): ccb 0xc0871800 - timed out, phase 84
 > cd2 at aic0 bus 0 target 6 lun 1
 > cd2: <PIONEER CD-ROM DRM-6324X 1.03> Removable CD-ROM SCSI-2 device 
 > cd2: 5.000MB/s transfers (5.000MHz, offset 8)
 > cd2: cd present [36007 x 2048 byte records]
 [ ... ]
 
 > >Fix:
 > 	
 > Adding a quirk entry to the driver fixes the problem, even though the
 > comments say this shouldn't be necessary.
 
 Indeed, I'm certainly surprised that adding a quirk fixed the problem.  I
 suppose this device must take a long time to respond to a read capacity.
 
 With most changers, it's no big deal if the changer gets switched into the
 changer scheduling code with lun 1 instead of lun 0.  You usually don't see
 any sort of trouble.
 
 With the patch, do the lockups still happen when you boot the machine?  I
 wouldn't expect the patch to have much effect on that, since all LUNs of
 the changer will be run through the changer scheduling mechanism once the
 second lun is detected...  Unless the CDs are being mounted as they are
 found.
 
 In any case, the lockup shouldn't happen, although finding the lockup might
 be rather difficult.  Can you break into the debugger when the lockup
 happens and get a stack trace?
 
 Ken
 -- 
 Kenneth Merry
 ken@kdm.org
 
State-Changed-From-To: open->analyzed 
State-Changed-By: ken 
State-Changed-When: Wed Dec 1 23:12:25 PST 1999 
State-Changed-Why:  
We've got a solution, and some ideas on why this is happening. 


Responsible-Changed-From-To: freebsd-bugs->ken 
Responsible-Changed-By: ken 
Responsible-Changed-When: Wed Dec 1 23:12:25 PST 1999 
Responsible-Changed-Why:  
My driver, I'll handle it. 
State-Changed-From-To: analyzed->closed 
State-Changed-By: ken 
State-Changed-When: Tue Dec 7 21:13:46 PST 1999 
State-Changed-Why:  
Patch applied in revision 1.29 scsi_cd.c in -current and revision 1.14.2.8 
of scsi_cd.c in RELENG_3.  Let me know if you have problems after you update 
to the new version. 
>Unformatted:
