From gnb@itga.com.au Sun Mar 14 23:51:58 1999
Return-Path: <gnb@itga.com.au>
Received: from fw.bby.com.au (ns.bby.com.au [192.83.119.129])
	by hub.freebsd.org (Postfix) with ESMTP id 86D3115081
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Mar 1999 23:51:55 -0800 (PST)
	(envelope-from gnb@itga.com.au)
Received: (from daemon@localhost) by fw.bby.com.au (8.8.8/8.6.9) id SAA25565 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Mar 1999 18:51:37 +1100 (EST)
Received: from lightning.itga.com.au(192.168.71.20)
 via SMTP by fw.bby.com.au, id smtpd025563; Mon Mar 15 07:51:28 1999
Received: from hellcat.itga.com.au (hellcat.itga.com.au [192.168.71.163])
	by lightning.itga.com.au (8.9.1a/8.9.1) with ESMTP id SAA02934;
	Mon, 15 Mar 1999 18:51:28 +1100 (EST)
Received: (from gnb@localhost)
	by hellcat.itga.com.au (8.9.2/8.9.1) id SAA00662;
	Mon, 15 Mar 1999 18:51:28 +1100 (EST)
	(envelope-from gnb@itga.com.au)
Message-Id: <199903150751.SAA00662@hellcat.itga.com.au>
Date: Mon, 15 Mar 1999 18:51:28 +1100 (EST)
From: Gregory Bond <gnb@itga.com.au>
Reply-To: gnb@itga.com.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: patch: atapi-cd with HP8100 CD-RW
X-Send-Pr-Version: 3.2

>Number:         10597
>Category:       kern
>Synopsis:       Patch to make HP 8100 CD-RW work with acd driver
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    sos-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 15 00:00:02 PST 1999
>Closed-Date:    Wed May 12 01:34:31 PDT 1999
>Last-Modified:  Wed May 12 01:36:18 PDT 1999
>Originator:     Gregory Bond
>Release:        FreeBSD 3.1-STABLE i386
>Organization:
ITG Australia Limited
>Environment:

>Description:

It seems the HP 8100 CD-RW drive does not work with the standard
acd driver in 3.x for write mode.  When opening for writing, the
acdopen() routine does an ATAPI REZERO_UNIT command that the HP
8100 rejects with an "illegal request" error.  The HP 7200 aparently
accepts the REZERO as that drive reportedly does work with the
stock acd driver.  The dmesg output for the probe and acdopen()
(with atapi.c DEBUG enabled) are as follows:

[wdc/acd probes]
wdc0 at 0x1f0-0x1f7 irq 14 on isa
wdc0: unit 0 (wd0): <QUANTUM FIREBALL EX4.3A>, DMA, 32-bit, multi-block-16
wd0: 4104MB (8405775 sectors), 8895 cyls, 15 heads, 63 S/T, 512 B/S
wdc0: unit 1 (wd1): <QUANTUM FIREBALL EX6.4A>, DMA, 32-bit, multi-block-16
wd1: 6149MB (12594960 sectors), 13328 cyls, 15 heads, 63 S/T, 512 B/S
wdc1 at 0x170-0x177 irq 15 on isa
atapi1.0 at 0x170: attach called
wdc1: unit 0 (atapi): <CD-532E-A/2.0C>, removable, accel, ovlap, dma, iordis
atapi10: info c0-85-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-
0-0-0-0-0-0-0-0-3-0-0-1-0-0-32-2e-30-43-0-0-0-0-43-44-2d-35-33-32-45-2d-41-0-0-0
-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-2f-0-0-0-2-0-
2-2-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-7-0-7-4-3-0-78-0-78-0-b4-0-78-0-0-0-0-0-5e
-1-0-0-0-0
atapi1.0: req im 5a-0-2a-0-0-0-0-0-1c-0-0-0-0-0-0-0 len=28
atapi1.0: start
atapi1.0: send cmd MODE_SENSE 5a-0-2a-0-0-0-0-0-1c-0-0-0-0-0-0-0
atapi1.0: intr ireason=0x2, len=28, status=58<ready,opdone,drq>, error=0
atapi1.0: intr ireason=0x3, len=28, status=50<ready,opdone>, error=0
acd0: drive speed 5512KB/sec, 128KB cache
acd0: supported read types: CD-R, CD-RW, CD-DA, packet track
acd0: Audio: play, 16 volume levels
acd0: Mechanism: ejectable tray
acd0: Medium: no/blank disc inside, unlocked
atapi10: cap 0-1a-70-0-0-0-0-0-2a-12-7-0-71-73-29-3-d-16-10-0-80-0-d-16-0-0-0-0
atapi1.1 at 0x170: attach called
wdc1: unit 1 (atapi): <Hewlett-Packard CD-Writer Plus 8100/1.0g>, removable, acc
el, dma, iordis
atapi11: info c0-85-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-59-4d-57-33-37-35-43-37-
36-4c-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-31-2e-30-67-0-0-0-0-48-65-77-6c-65-74-74-2
d-50-61-63-6b-61-72-64-20-43-44-2d-57-72-69-74-65-72-20-50-6c-75-73-20-38-31-30-
30-0-0-0-0-0-0-0-0-0-0-f-0-0-0-3-0-2-2-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-7-0-3-2
-1-0-96-0-96-0-b4-0-b4-0-0-0-0-0-0-0-0-0-0-0
atapi1.1: req im 5a-0-2a-0-0-0-0-0-1c-0-0-0-0-0-0-0 len=28
atapi1.1: start
atapi1.1: send cmd MODE_SENSE 5a-0-2a-0-0-0-0-0-1c-0-0-0-0-0-0-0
atapi1.1: intr ireason=0x2, len=28, status=58<ready,opdone,drq>, error=0
atapi1.1: intr ireason=0x3, len=28, status=50<ready,opdone>, error=0
acd1: drive speed 4134KB/sec, 1024KB cache
acd1: supported read types: CD-R, CD-RW, CD-DA, packet track
acd1: supported write types: CD-R, CD-RW, test write
acd1: Audio: play, 256 volume levels
acd1: Mechanism: ejectable tray
acd1: Medium: CD-RW 120mm data disc loaded, unlocked
atapi11: cap 0-1c-21-0-0-0-0-0-2a-14-7-7-71-63-29-23-8a-10-0-1-0-4-8a-10-0-0-2-c
2

[ then, when attempting to open for write:]

atapi1.1: start
atapi1.1: send cmd PREVENT_ALLOW 1e-0-0-0-1-0-0-0-0-0-0-0-0-0-0-0
atapi1.1: intr ireason=0x3, len=0, status=50<ready,opdone>, error=0
atapi1.1: req w 1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0 len=0
atapi1.1: start
atapi1.1: send cmd REZERO_UNIT 1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
atapi1.1: intr ireason=0x3, len=0, status=51<ready,opdone,check>, error=54<abort
>
atapi1:1: illegal request
acd1: rezero failed



>How-To-Repeat:

With an HP8100 connected, try to burn a CD-R/CD-RW disk.  When opening the
device for write, it elicits the following error in dmesg:
	acd1: rezero failed

>Fix:
	
The following patch works for me, but I am no ATAPI wizard so I have no 
idea if there are unforseen Bad Things that happen if the rezero isn't 
successful.

*** ./sys/i386/isa/atapi-cd.c.dist      Mon Jan  4 10:13:22 1999
--- ./sys/i386/isa/atapi-cd.c   Mon Mar 15 16:51:44 1999
***************
*** 399,405 ****
              /* read/write */
              if (acd_rezero_unit(cdp)) {
                  printf("acd%d: rezero failed\n", lun);
!                 return EIO;
              }
          } else {
              /* read only */
--- 399,405 ----
              /* read/write */
              if (acd_rezero_unit(cdp)) {
                  printf("acd%d: rezero failed\n", lun);
!                 /* return EIO; */
              }
          } else {
              /* read only */


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Wed May 12 01:34:31 PDT 1999 
State-Changed-Why:  
Both 3.2-RELEASE and 4.0-current has this fixed, although not 
as this patch. 


Responsible-Changed-From-To: freebsd-bugs->sos-bugs 
Responsible-Changed-By: sos 
Responsible-Changed-When: Wed May 12 01:34:31 PDT 1999 
Responsible-Changed-Why:  
I'm the ATAPI guy. 
>Unformatted:
