From jpc@drum.msfc.nasa.gov  Fri Apr 25 13:12:10 2003
Return-Path: <jpc@drum.msfc.nasa.gov>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A11A137B401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Apr 2003 13:12:10 -0700 (PDT)
Received: from drum.msfc.nasa.gov (DRUM.MSFC.NASA.GOV [128.158.173.26])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2CC7843FBD
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Apr 2003 13:12:10 -0700 (PDT)
	(envelope-from jpc@drum.msfc.nasa.gov)
Received: by drum.msfc.nasa.gov (Postfix, from userid 134)
	id 98725846; Fri, 25 Apr 2003 15:12:09 -0500 (CDT)
Message-Id: <20030425201209.98725846@drum.msfc.nasa.gov>
Date: Fri, 25 Apr 2003 15:12:09 -0500 (CDT)
From: J.Porter Clark <jpc@drum.msfc.nasa.gov>
Reply-To: J.Porter Clark <jpc@drum.msfc.nasa.gov>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: CD-burning problems with Plextor PX-W1210A drive
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         51421
>Category:       i386
>Synopsis:       CD-burning problems with Plextor PX-W1210A drive
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    thomas
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 25 13:20:02 PDT 2003
>Closed-Date:    Wed May 14 09:16:59 PDT 2003
>Last-Modified:  Wed May 14 09:16:59 PDT 2003
>Originator:     J. Porter Clark
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
NASA
>Environment:
System: FreeBSD drum.msfc.nasa.gov 4.8-STABLE FreeBSD 4.8-STABLE #0: Fri Apr 25 13:37:07 CDT 2003 jpc@drum.msfc.nasa.gov:/usr/obj/usr/src/sys/JPC i386

>Description:

I'm having problems burning CDs.  I'm using a Plextor drive:

  acd0: CD-RW <PLEXTOR CD-R PX-W1210A> at ata0-master PIO4

This is on a Tyan K7 motherboard with 2 AMD CPUs.  The main disk
drives are SCSI.  I'm using a recent (as in 2 days old, maybe)
FreeBSD 4.8-STABLE.  It is an SMP kernel.

If I use burncd, everything works okay until I try -d (DAO) mode.

  # burncd -v -s 1 -d -f /dev/acd0c audio track01.wav.raw
  adding type 0x00 file track01.wav.raw size 4961 KB 2160 blocks
  next writeable LBA 0
  CUE sheet:
  01 00 00 01 00 00 02 00
  01 01 01 00 00 00 04 00
  01 aa 01 01 00 00 20 3c
  addr = 150 size = 5080320 blocks = 2160
  writing from file track01.wav.raw size 4961 KB

  only wrote -1 of 37632 bytes err=5

This is accompanied by a syslog message:

  /kernel: acd0: WRITE_BIG - ILLEGAL REQUEST asc=0x24 ascq=0x00 error=0x04

If I try using -t with the above command line, it seems to do what
it is supposed to do, but eventually I get a kernel panic (divide
by zero in kernel mode).  I won't go into that one unless someone
is interested, but see below for another fun panic.

If I use atapicam/cdrecord instead, everything works, even DAO mode.
But there is one horrible side effect: If I boot the system with
nothing in the CD drive, it panics!

  ...usual stuff...
  SMP: AP CPU#1 Launched!
  acd0: MODE_SENSE_BIG command timeout - resetting
  ata0: resetting devices ..

  Fatal trap 12: page fault while in kernel mode
  mp_lock = 01000002; cpuid = 1; lapic.id = 00000000
  fault virtual address	= 0x0
  fault code		= supervisor read, page not present
  instruction pointer	= 0x8:0x0150373
  stack pointer		= 0x10:0xff80ff3c
  frame pointer		= 0x10:0xff80ff44
  code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
  processor eflags	= interrupt enabled, resume, IOPL = 0
  current process	= Idle
  interrupt mask	=  <- SMP: XXX
  kernel: type 12 trap, code = 0
  Stopped at	reinit_bus+0xb: movl	0(%ebx),%eax

The backtrace is:

  reinit_bus(0,2,c1dd6000,ff80ff74,c013deab) at reinit_bus+0xb
  atapi_cam_reinit_bus(c1dd600) at atapi_cam_reinit_bus+0x13
  ata_reinit(c1dd6000,c1ed6000,c014aec4,ff80ffac,c0192015) at ata_reinit_0x2d3
  atapi_timeout(c1ed3000,40000000,10,1,0) at atapi_timeout+0xeb
  softclock(0,18,10,10,0) at softclock+0xd1
  doreti_swi() at doreti_swi+0xf

The above was copied off the screen longhand, so it might have some
small errors.

For now, I'm using atapicam and cdrecord to do DAO recording,
although I have to be careful to leave a CD in the drive.  Can be
any CD, even a blank or audio one.  I get the same panic if I leave
the CD door open.

>How-To-Repeat:
	See above, but it may be hardware-specific.
>Fix:
	I wish I knew.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->thomas 
Responsible-Changed-By: sos 
Responsible-Changed-When: Mon May 5 06:02:28 PDT 2003 
Responsible-Changed-Why:  
I know that there are problems with some new drives and DAO 
mode, it is on my TODO list. 
For the ATAPICAM problem I transfer this to thomas. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=51421 

From: Thomas Quinot <thomas@FreeBSD.ORG>
To: "J.Porter Clark" <jpc@drum.msfc.nasa.gov>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: i386/51421: CD-burning problems with Plextor PX-W1210A drive
Date: Mon, 12 May 2003 18:40:35 +0200

 Le 2003-04-25, J.Porter Clark crivait :
 
 > If I use atapicam/cdrecord instead, everything works, even DAO mode.
 > But there is one horrible side effect: If I boot the system with
 > nothing in the CD drive, it panics!
 
 Thanks for the trap message and backtrace, they are most useful indeed.
 Please try the patch below.
 
 Thanks,
 Thomas.
 
 Index: atapi-cam.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/dev/ata/atapi-cam.c,v
 retrieving revision 1.10.2.2
 diff -u -r1.10.2.2 atapi-cam.c
 --- atapi-cam.c	3 Mar 2003 19:11:38 -0000	1.10.2.2
 +++ atapi-cam.c	12 May 2003 16:39:09 -0000
 @@ -168,7 +168,14 @@
  void
  atapi_cam_reinit_bus(struct ata_channel *ata_ch) {
      struct atapi_xpt_softc *scp = get_softc(ata_ch);
 -    reinit_bus(scp, RESET);
 +
 +    /*
 +     * scp might be null if the bus is being reinitialised during
 +     * the boot-up sequence, before the ATAPI bus is registered.
 +     */
 +
 +    if (scp != NULL)
 +	reinit_bus(scp, RESET);
  }
  
  static void
 
 -- 
     Thomas.Quinot@Cuivre.FR.EU.ORG

From: Thomas Quinot <thomas@FreeBSD.ORG>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: i386/51421: CD-burning problems with Plextor PX-W1210A drive
Date: Wed, 14 May 2003 10:30:00 +0200

 ----- Forwarded message from "J. Porter Clark" <jpc@drum.msfc.nasa.gov> -----
 
 Date: Tue, 13 May 2003 13:25:53 -0500
 From: "J. Porter Clark" <jpc@drum.msfc.nasa.gov>
 To: Thomas Quinot <thomas@FreeBSD.ORG>
 Subject: Re: i386/51421: CD-burning problems with Plextor PX-W1210A drive
 In-Reply-To: <20030512164035.GA77779@melusine.cuivre.fr.eu.org>
 
 On Mon, May 12, 2003 at 06:40:35PM +0200, Thomas Quinot wrote:
 > 
 > Le 2003-04-25, J.Porter Clark ?crivait :
 > 
 > > If I use atapicam/cdrecord instead, everything works, even DAO mode.
 > > But there is one horrible side effect: If I boot the system with
 > > nothing in the CD drive, it panics!
 > 
 > Thanks for the trap message and backtrace, they are most useful indeed.
 > Please try the patch below.
 
 Hooray!  It works!  Many thanks!
 
 If I boot without a CD in the drive, there is no panic.
 
 I did see a new message on the console.  It looks like a benign
 warning.  It is the last line of the following:
 
   cd0 at ata0 bus 0 target 0 lun 0
   cd0: <PLEXTOR CD-R   PX-W1210A 1.08> Removable CD-ROM SCSI-0 device 
   cd0: 16.000MB/s transfers
   cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed
 
 -- 
 J. Porter Clark            jpc@drum.msfc.nasa.gov
 NASA/MSFC Computers and Data Systems Group (ED13)
 
 ----- End forwarded message -----
 
 -- 
     Thomas.Quinot@Cuivre.FR.EU.ORG

From: Thomas Quinot <thomas@FreeBSD.ORG>
To: "J. Porter Clark" <jpc@drum.msfc.nasa.gov>
Cc: bug-followup@freebsd.org
Subject: Re: i386/51421: CD-burning problems with Plextor PX-W1210A drive
Date: Wed, 14 May 2003 16:33:10 +0200

 [ Please be sure to always Cc: bug-followup@freebsd.org when
   following up on a PR, so as to ensure that the exchange is
   appropriately tracked and receives due attention. ]
 
 Le 2003-05-13, J. Porter Clark crivait :
 
 > Hooray!  It works!  Many thanks!
 > If I boot without a CD in the drive, there is no panic.
 
 OK, this change is now part of FreeBSD 5 and will be
 present in the upcoming 5.1-RELEASE. It should be merged into
 the FreeBSD 4 branch in one week (unless a problem with it
 shows up in the meantime).
 
 >   cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed
 
 This looks perfectly legitimate if there is no disc in the drive.
 
 Thank you for your help with improving FreeBSD!
 
 Thomas.
 
 -- 
     Thomas.Quinot@Cuivre.FR.EU.ORG

From: Thomas Quinot <thomas@FreeBSD.ORG>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: i386/51421 patch committed
Date: Wed, 14 May 2003 16:35:57 +0200

   Revision  Changes    Path
   1.16      +8 -1      src/sys/dev/ata/atapi-cam.c
 
 -- 
     Thomas.Quinot@Cuivre.FR.EU.ORG
State-Changed-From-To: open->closed 
State-Changed-By: thomas 
State-Changed-When: Wed May 14 09:15:34 PDT 2003 
State-Changed-Why:  
Patch committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=51421 
>Unformatted:
