From john@pacer.nlc.net.au  Wed Dec 15 17:37:30 1999
Return-Path: <john@pacer.nlc.net.au>
Received: from nhj.nlc.net.au (nhj.nlc.net.au [203.24.133.1])
	by hub.freebsd.org (Postfix) with SMTP id 0F5341568B
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 15 Dec 1999 17:37:23 -0800 (PST)
	(envelope-from john@pacer.nlc.net.au)
Received: (qmail 19971 invoked from network); 16 Dec 1999 12:37:14 +1100
Received: from pacer.nlc.net.au (203.24.133.16)
  by nhj.nlc.net.au with SMTP; 16 Dec 1999 12:37:14 +1100
Received: (qmail 1271 invoked by uid 1000); 16 Dec 1999 01:37:11 -0000
Message-Id: <19991216013711.1270.qmail@pacer.nlc.net.au>
Date: 16 Dec 1999 01:37:11 -0000
From: john@nlc.net.au
Sender: john@pacer.nlc.net.au
Reply-To: john@nlc.net.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: ATA driver bug for CD drives that don't report speed
X-Send-Pr-Version: 3.2

>Number:         15512
>Category:       kern
>Synopsis:       ATA driver bug for CD drives that don't report speed
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    sos
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 15 17:40:03 PST 1999
>Closed-Date:    Mon Feb 28 11:35:11 PST 2000
>Last-Modified:  Mon Feb 28 11:36:13 PST 2000
>Originator:     John Saunders
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
NORTHLINK COMMUNICATIONS
>Environment:

ATA driver, which is now the default, and a CD or DVD drive that
returns 0 for it's speed.

>Description:

The ATA driver doesn't correctly print the device name in the
boot messages. It prints a line starting with a comma followed
by some other information. The standard boot messages all print
the device name first on each line so that it is clear to which
device the message belongs.

>How-To-Repeat:

Boot -CURRENT with a CD-ROM device that doesn't report its speed.

>Fix:

Apply the following patch...

--- atapi-cd.c.orig	Tue Dec 14 21:25:26 1999
+++ atapi-cd.c	Thu Dec 16 11:27:23 1999
@@ -260,9 +260,10 @@
 	   cdp->atp->controller->lun,
 	   (cdp->atp->unit == ATA_MASTER) ? "master" : "slave ");
 
+    printf("acd%d:", cdp->lun);
+    comma = 0;
     if (cdp->cap.cur_read_speed) {
-	printf("acd%d: ", cdp->lun);
-	printf("read %dKB/s", cdp->cap.cur_read_speed * 1000 / 1024);
+	printf(" read %dKB/s", cdp->cap.cur_read_speed * 1000 / 1024);
 	if (cdp->cap.max_read_speed) 
 	    printf(" (%dKB/s)", cdp->cap.max_read_speed * 1000 / 1024);
 	if ((cdp->cap.cur_write_speed) &&
@@ -272,11 +273,13 @@
 	    if (cdp->cap.max_write_speed)
 		printf(" (%dKB/s)", cdp->cap.max_write_speed * 1000 / 1024);
 	}
+ 	comma = 1;
     }
-    if (cdp->cap.buf_size)
-	printf(", %dKB buffer", cdp->cap.buf_size);
-    printf(", %s\n", ata_mode2str(cdp->atp->controller->mode[
-				  (cdp->atp->unit == ATA_MASTER) ? 0 : 1]));
+    if (cdp->cap.buf_size) {
+	printf("%s %dKB buffer", comma ? "," : "", cdp->cap.buf_size); comma = 1;
+    }
+    printf("%s %s\n", comma ? "," : "", ata_mode2str(cdp->atp->controller->mode[
+				  (cdp->atp->unit == ATA_MASTER) ? 0 : 1])); comma = 1;
 
     printf("acd%d: supported read types:", cdp->lun);
     comma = 0;


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sos  
Responsible-Changed-By: cpiazza 
Responsible-Changed-When: Wed Dec 15 18:33:00 PST 1999 
Responsible-Changed-Why:  
Over to maintainer 
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Mon Feb 28 11:35:11 PST 2000 
State-Changed-Why:  
fixed in 4.0. 
>Unformatted:
