From skywizard@tomoyo.MyBSD.org.my  Thu Dec 11 13:37:59 2003
Return-Path: <skywizard@tomoyo.MyBSD.org.my>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id ACDAB16A4CE; Thu, 11 Dec 2003 13:37:59 -0800 (PST)
Received: from tomoyo.MyBSD.org.my (duke.void.net.my [202.157.183.130])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 0764043D09; Thu, 11 Dec 2003 13:37:58 -0800 (PST)
	(envelope-from skywizard@tomoyo.MyBSD.org.my)
Received: by tomoyo.MyBSD.org.my (Postfix, from userid 1033)
	id 234D46CC8E; Fri, 12 Dec 2003 05:38:38 +0800 (MYT)
Message-Id: <20031211213838.234D46CC8E@tomoyo.MyBSD.org.my>
Date: Fri, 12 Dec 2003 05:38:38 +0800 (MYT)
From: Ariff Abdullah <skywizard@MyBSD.org.my>
Reply-To: Ariff Abdullah <skywizard@MyBSD.org.my>
To: FreeBSD-gnats-submit@freebsd.org
Cc: sos@FreeBSD.org
Subject: ATA failed to mount data track of CD-EXTRA multisession cd
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         60163
>Category:       kern
>Synopsis:       ATA failed to mount data track of CD-EXTRA multisession cd
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sos
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 11 13:40:06 PST 2003
>Closed-Date:    Mon Sep 06 11:41:27 GMT 2004
>Last-Modified:  Mon Sep 06 11:41:27 GMT 2004
>Originator:     Ariff Abdullah
>Release:        FreeBSD 4.6.2-RELEASE i386
>Organization:
MyBSD
>Environment:
System: FreeBSD 4.x / 5.1


>Description:
	Mounting multisession cd will fail with 'invalid argument'.
	This only occur if the very first track of the cd is NOT
	a data track, because the atapi-cd driver rely only on the
	first track to decide which block_size to use. However the cd
	can be mounted successfully through atapi-cam subsystem, or
	using older FreeBSD release (2.2.x).
>How-To-Repeat:
	Insert multisession cd (perhaps audio + data, where audio is
	in first session and at the beginning of the track)

	# mount_cd9660 /dev/acd0c /cdrom
	mount_cd9660: /dev/acd0c: Invalid argument
	# mount_cd9660 -s the_exact_sector /dev/acd0c /cdrom
	mount_cd9660: /dev/acd0c: Invalid argument
>Fix:
	1) enable atapicam support and mount the cd
	using /dev/cd0c (only a workaround).

	2) Apply this patch (perhaps fix)

--- sys/dev/ata/atapi-cd.c.orig Thu Dec 11 02:20:33 2003
+++ sys/dev/ata/atapi-cd.c      Thu Dec 11 02:26:14 2003
@@ -1277,7 +1277,13 @@
     }
     cdp->toc.hdr.len = ntohs(cdp->toc.hdr.len);
 
-    cdp->block_size = (cdp->toc.tab[0].control & 4) ? 2048 : 2352;
+    cdp->block_size = 2352;
+    for (track = 0; track < ntracks; track++) {
+       if (cdp->toc.tab[track].control & 4) {
+           cdp->block_size = 2048;
+           break;
+       }
+    }
     acd_set_ioparm(cdp);
     bzero(ccb, sizeof(ccb));
     ccb[0] = ATAPI_READ_CAPACITY;
>Release-Note:
>Audit-Trail:

From: chi@bd.mbn.or.jp (Chiharu Shibata)
To: freebsd-gnats-submit@FreeBSD.org
Cc: skywizard@MyBSD.org.my
Subject: Re: kern/60163: ATA failed to mount data track of CD-EXTRA multisession
	 cd
Date: Mon,  2 Feb 2004 07:40:40 +0900 (JST)

 This is Chiharu Shibata.
 At Thu Dec 11 13:40:06 PST 2003, you wrote:
 
 >Fix
 -snip-
 >        2) Apply this patch (perhaps fix)
 >    
 >    --- sys/dev/ata/atapi-cd.c.orig Thu Dec 11 02:20:33 2003
 >    +++ sys/dev/ata/atapi-cd.c      Thu Dec 11 02:26:14 2003
 >    @@ -1277,7 +1277,13 @@
 >         }
 >         cdp->toc.hdr.len = ntohs(cdp->toc.hdr.len);
 >     
 >    -    cdp->block_size = (cdp->toc.tab[0].control & 4) ? 2048 : 2352;
 >    +    cdp->block_size = 2352;
 >    +    for (track = 0; track < ntracks; track++) {
 >    +       if (cdp->toc.tab[track].control & 4) {
 >    +           cdp->block_size = 2048;
 >    +           break;
 >    +       }
 >    +    }
 >         acd_set_ioparm(cdp);
 >         bzero(ccb, sizeof(ccb));
 >         ccb[0] = ATAPI_READ_CAPACITY;
 
 I have already analized this problem, and reached the same conclusion.
 Please commit this patch.
 
 In detail, refer the following URL, please.
 (Both written in Japanese, sorry).
 [FreeBSD-tech-jp 3417] ATAPI CD-ROM patches
         <http://home.jp.freebsd.org/cgi-bin/showmail/FreeBSD-tech-jp/3417>
 [FreeBSD-users-jp 74432] ATAPI CD-ROM quirks
         <http://home.jp.freebsd.org/cgi-bin/showmail/FreeBSD-users-jp/74432>
 -- 
 Chiharu Shibata    chi@bd.mbn.or.jp    <http://www32.ocn.ne.jp/~chi/>
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: kris 
Responsible-Changed-When: Sun Feb 8 20:53:02 PST 2004 
Responsible-Changed-Why:  
Assign to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=60163 
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Mon Sep 6 11:40:13 GMT 2004 
State-Changed-Why:  
I do not agree with the patch. 
Anyhow you should open individual tracks via the /dev/acdXtY devices, that way you will get the right blocksize. 

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