From eyal@esoha-dsl1.cisco.com  Sat Dec  9 15:59:12 2000
Return-Path: <eyal@esoha-dsl1.cisco.com>
Received: from esoha-dsl1.cisco.com (sj-isp-nat-pool-2.cisco.com [204.69.198.2])
	by hub.freebsd.org (Postfix) with ESMTP id 6AE7537B400
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  9 Dec 2000 15:59:11 -0800 (PST)
Received: (from eyal@localhost)
	by esoha-dsl1.cisco.com (8.11.1/8.11.1) id eB9NxAr00449;
	Sat, 9 Dec 2000 15:59:10 -0800 (PST)
	(envelope-from eyal)
Message-Id: <200012092359.eB9NxAr00449@esoha-dsl1.cisco.com>
Date: Sat, 9 Dec 2000 15:59:10 -0800 (PST)
From: Eyal Soha <eyal@esoha-dsl1.cisco.com>
Reply-To: esoha@cisco.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: CD-RW driver fails unless CD in drive at boot up
X-Send-Pr-Version: 3.2

>Number:         23409
>Category:       kern
>Synopsis:       CD-RW driver fails unless CD in drive at boot up
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 09 16:00:01 PST 2000
>Closed-Date:    Wed May 30 03:54:52 PDT 2001
>Last-Modified:  Wed May 30 03:56:30 PDT 2001
>Originator:     Eyal Soha
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Cisco Systems
>Environment:

PC running 4.2-STABLE with a Smart and Friendly CD-RW.  Code cvsup'd
Novemeber 2000.

>Description:

When booting, the CD-RW drive is not recognized unless there is a CD
in the drive.  Here's the tail end of dmesg after booting without a CD
loaded in the drive:

ad4: 8809MB <QUANTUM FIREBALLP KA9.1> [17898/16/63] at ata2-master UDMA66
ad5: 14594MB <ST315320A> [29651/16/63] at ata2-slave UDMA66
ad7: 3098MB <IBM-DAQA-33240> [6296/16/63] at ata3-slave WDMA2
ata3-master: timeout waiting for command=ef s=00 e=00
ata3-master: <SAF CD-RW2224/2.06> CDROM device - NO DRIVER!
Mounting root from ufs:/dev/ad5s1a

Here's the tail end of dmesg after booting with a CD loaded in the drive:

ad4: 8809MB <QUANTUM FIREBALLP KA9.1> [17898/16/63] at ata2-master UDMA66
ad5: 14594MB <ST315320A> [29651/16/63] at ata2-slave UDMA66
ad7: 3098MB <IBM-DAQA-33240> [6296/16/63] at ata3-slave WDMA2
ata3-master: timeout waiting for command=ef s=00 e=00
acd0: CD-RW <SAF CD-RW2224> at ata3-master using BIOSPIO
Mounting root from ufs:/dev/ad5s1a

In the failure case, the drive is not mountable and unusable.  In the
case where the drive is recognized at boot up, the drive can be
mounted if any CD is inserted and the drive works exactly as expected.
I suspect that the timeout is normal, probably because the command is
not recognized by the CD-RW.

>How-To-Repeat:

Make sure CD-RW has no CD in it.  Reboot the system.

>Fix:

Boot the system while a CD is in the CD-RW drive.  After bootup is complete, that CD may be removed or replaced by any CD.

>Release-Note:
>Audit-Trail:

From: Eyal Soha <esoha@cisco.com>
To: freebsd-gnats-submit@FreeBSD.org, esoha@cisco.com
Cc:  
Subject: Re: kern/23409: CD-RW driver fails unless CD in drive at boot up
Date: Sun, 10 Dec 2000 17:53:21 -0800

 The error is in sys/dev/ata/atapi-cd.c, line 122:
 
     /* get drive capabilities, some drives needs this repeated */
     for (count = 0 ; count < 5 ; count++) {
 	if (!(error = acd_mode_sense(cdp, ATAPI_CDROM_CAP_PAGE,
 				     (caddr_t)&cdp->cap, sizeof(cdp->cap))))
 	    break;
     }
 
 For debugging purposes, I changed 5 to 0xffffff.
 
 When I have a CD installed in the drive or the CD-RW tray is open, I
 usually need only two or three retries.  When the CD-RW drive is
 closed and there is no CD in it, I need between 6400 and 6500 retries.
 The number of retries required fluctuates and drops significantly if I
 put a delay before the for() loop.  The drive is likely not ready by
 the time the ATAPI_CDROM_CAP_PAGE command is being issued.
 
 When the bug isn't being exhibited, the error returned by
 acd_mode_sense is 0x5.  (After getting error 0x5 once or twice, the
 drive responds properly.)
 
 When in the bug case (closed and empty CD-RW drive), the error
 returned on the first call to acd_mode_sense() is 0x5.  Subsequent
 calls all return 0x10 (between 0x400 and 0x440 times) until the final
 call which returns 0.
 
 -- 
 Eyal Soha <esoha@cisco.com>                    Work: (408) 527-9276
 Software Engineer                              Page: (800) 365-4578
 Cisco Systems <http://www.cisco.com>   Epage: esoha@epage.cisco.com
 
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Wed May 30 03:54:52 PDT 2001 
State-Changed-Why:  
This drive is buggy, but the atapi CDROM drive should 
cope with this now. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=23409 
>Unformatted:
