linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cannot mount multi-session DVD with ide-cd, must use ide-scsi
@ 2004-12-17  1:20 Rashkae
  2004-12-17  8:13 ` Andrew Morton
  0 siblings, 1 reply; 11+ messages in thread
From: Rashkae @ 2004-12-17  1:20 UTC (permalink / raw)
  To: linux-kernel

I can confirm that Linux Kerenl 2.6.9 still cannot mount a
multi-session DVD if the last session starts at > 2.2 GB.  The
only information on this problem I can find is here:

http://marc.theaimsgroup.com/?l=linux-kernel&m=108827602322464&w=2

Is there a patch anywhere to address this?  it would be great if
I didn't have to use ide-scsi anymore, which imposes it's own set
of added difficulties.

Please CC replies.  Thanks much.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17  1:20 Cannot mount multi-session DVD with ide-cd, must use ide-scsi Rashkae
@ 2004-12-17  8:13 ` Andrew Morton
  2004-12-17 12:08   ` Jens Axboe
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2004-12-17  8:13 UTC (permalink / raw)
  To: Rashkae; +Cc: linux-kernel, Jens Axboe

Rashkae <rashkae@tigershaunt.com> wrote:
>
> I can confirm that Linux Kerenl 2.6.9 still cannot mount a
>  multi-session DVD if the last session starts at > 2.2 GB.  The
>  only information on this problem I can find is here:
> 
>  http://marc.theaimsgroup.com/?l=linux-kernel&m=108827602322464&w=2
> 
>  Is there a patch anywhere to address this?

Please test this.  Jens, could you please check this one?



From: Kronos <kronos@kronoz.cjb.net>

cdrom_read_toc (ide-cd.c) always reads the TOC using MSF format.  If the
last session of the disk starts beyond block 1152000 (LBA) there's an
overflow in the MSF format and kernel complains:

Unable to identify CD-ROM format.

I reported this bug a while ago (see bug #1930 on bugzilla) and Andy
Polyakov tracked it down.

I tried fixing it by myself setting msf_flag (cdrom_read_tocentry) to 0 and
removing the MSF to LBA conversions in cdrom_read_toc.  It works but I
don't have a complete understanding of the code in ide-cd...

This is the quick & dirty patch (against 2.6.9, apply with offset to
2.6.10-rc3):

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/ide/ide-cd.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff -puN drivers/ide/ide-cd.c~ide-cd-unable-to-read-multisession-dvds drivers/ide/ide-cd.c
--- 25/drivers/ide/ide-cd.c~ide-cd-unable-to-read-multisession-dvds	2004-12-11 22:14:16.629388296 -0800
+++ 25-akpm/drivers/ide/ide-cd.c	2004-12-11 22:14:16.635387384 -0800
@@ -2353,7 +2353,7 @@ static int cdrom_read_toc(ide_drive_t *d
 	/* Read the multisession information. */
 	if (toc->hdr.first_track != CDROM_LEADOUT) {
 		/* Read the multisession information. */
-		stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp,
+		stat = cdrom_read_tocentry(drive, 0, 0, 1, (char *)&ms_tmp,
 					   sizeof(ms_tmp), sense);
 		if (stat) return stat;
 	} else {
@@ -2368,9 +2368,11 @@ static int cdrom_read_toc(ide_drive_t *d
 		msf_from_bcd (&ms_tmp.ent.addr.msf);
 #endif  /* not STANDARD_ATAPI */
 
-	toc->last_session_lba = msf_to_lba (ms_tmp.ent.addr.msf.minute,
-					    ms_tmp.ent.addr.msf.second,
-					    ms_tmp.ent.addr.msf.frame);
+	toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba);
+	printk("ide-cd: last_session_lba: %d\n", toc->last_session_lba);
+//	toc->last_session_lba = msf_to_lba (ms_tmp.ent.addr.msf.minute,
+//					    ms_tmp.ent.addr.msf.second,
+//					    ms_tmp.ent.addr.msf.frame);
 
 	toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track);
 
_


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17  8:13 ` Andrew Morton
@ 2004-12-17 12:08   ` Jens Axboe
  2004-12-17 18:33     ` Kronos
  0 siblings, 1 reply; 11+ messages in thread
From: Jens Axboe @ 2004-12-17 12:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Rashkae, linux-kernel

On Fri, Dec 17 2004, Andrew Morton wrote:
> Rashkae <rashkae@tigershaunt.com> wrote:
> >
> > I can confirm that Linux Kerenl 2.6.9 still cannot mount a
> >  multi-session DVD if the last session starts at > 2.2 GB.  The
> >  only information on this problem I can find is here:
> > 
> >  http://marc.theaimsgroup.com/?l=linux-kernel&m=108827602322464&w=2
> > 
> >  Is there a patch anywhere to address this?
> 
> Please test this.  Jens, could you please check this one?

It looks fine for the case where the tocentry read suceeds, but you
should change the fallback assignment to be lba based as well I think.

> diff -puN drivers/ide/ide-cd.c~ide-cd-unable-to-read-multisession-dvds drivers/ide/ide-cd.c
> --- 25/drivers/ide/ide-cd.c~ide-cd-unable-to-read-multisession-dvds	2004-12-11 22:14:16.629388296 -0800
> +++ 25-akpm/drivers/ide/ide-cd.c	2004-12-11 22:14:16.635387384 -0800
> @@ -2353,7 +2353,7 @@ static int cdrom_read_toc(ide_drive_t *d
>  	/* Read the multisession information. */
>  	if (toc->hdr.first_track != CDROM_LEADOUT) {
>  		/* Read the multisession information. */
> -		stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp,
> +		stat = cdrom_read_tocentry(drive, 0, 0, 1, (char *)&ms_tmp,
>  					   sizeof(ms_tmp), sense);
>  		if (stat) return stat;
>  	} else {

it's the bottom part of that else.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17 12:08   ` Jens Axboe
@ 2004-12-17 18:33     ` Kronos
  2004-12-17 18:57       ` Doug Maxey
  2004-12-17 19:27       ` Jens Axboe
  0 siblings, 2 replies; 11+ messages in thread
From: Kronos @ 2004-12-17 18:33 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Andrew Morton, linux-kernel, Rashkae

Jens Axboe <axboe@suse.de> ha scritto:
> On Fri, Dec 17 2004, Andrew Morton wrote:
>> Rashkae <rashkae@tigershaunt.com> wrote:
>> >
>> > I can confirm that Linux Kerenl 2.6.9 still cannot mount a
>> >  multi-session DVD if the last session starts at > 2.2 GB.  The
>> >  only information on this problem I can find is here:
>> > 
>> >  http://marc.theaimsgroup.com/?l=linux-kernel&m=108827602322464&w=2
>> > 
>> >  Is there a patch anywhere to address this?
>> 
>> Please test this.  Jens, could you please check this one?
> 
> It looks fine for the case where the tocentry read suceeds, but you
> should change the fallback assignment to be lba based as well I think.

Ok, changed that part. I also changed the part inside the #if
!STANDARD_ATAPI to re-read using MSF, just to be sure to not break
anything. Maybe those two weird units (Vertos 300 and NEC 260) return
the LBA value in a sane way and the whole #if block can be removed? 

---
Read the multi-session TOC in LBA format in order to avoid an overflow
in MSF format when the last session starts beyond block 1152000 (LBA).

Signed-off-by: Luca Tettamanti <kronos@kronoz.cjb.net>

--- a/drivers/ide/ide-cd.c	2004-12-10 23:06:18.000000000 +0100
+++ b/drivers/ide/ide-cd.c	2004-12-17 19:30:56.000000000 +0100
@@ -2356,25 +2356,31 @@
 	/* Read the multisession information. */
 	if (toc->hdr.first_track != CDROM_LEADOUT) {
 		/* Read the multisession information. */
-		stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp,
+		stat = cdrom_read_tocentry(drive, 0, 0, 1, (char *)&ms_tmp,
 					   sizeof(ms_tmp), sense);
 		if (stat) return stat;
+	
+		toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba);
 	} else {
-		ms_tmp.ent.addr.msf.minute = 0;
-		ms_tmp.ent.addr.msf.second = 2;
-		ms_tmp.ent.addr.msf.frame  = 0;
 		ms_tmp.hdr.first_track = ms_tmp.hdr.last_track = CDROM_LEADOUT;
+		toc->last_session_lba = msf_to_lba(0, 2, 0); /* 0m 2s 0f */
 	}
 
 #if ! STANDARD_ATAPI
-	if (CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd)
+	if (CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd) {
+		/* Re-read multisession information using MSF format */
+		stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp,
+					   sizeof(ms_tmp), sense);
+		if (stat)
+			return stat;
+
 		msf_from_bcd (&ms_tmp.ent.addr.msf);
+		toc->last_session_lba = msf_to_lba(ms_tmp.ent.addr.msf.minute,
+					  	   ms_tmp.ent.addr.msf.second,
+						   ms_tmp.ent.addr.msf.frame);
+	}
 #endif  /* not STANDARD_ATAPI */
 
-	toc->last_session_lba = msf_to_lba (ms_tmp.ent.addr.msf.minute,
-					    ms_tmp.ent.addr.msf.second,
-					    ms_tmp.ent.addr.msf.frame);
-
 	toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track);
 
 	/* Now try to get the total cdrom capacity. */



Luca
-- 
Home: http://kronoz.cjb.net
The trouble with computers is that they do what you tell them, 
not what you want.
D. Cohen

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17 18:33     ` Kronos
@ 2004-12-17 18:57       ` Doug Maxey
  2004-12-17 19:28         ` Jens Axboe
  2004-12-17 19:27       ` Jens Axboe
  1 sibling, 1 reply; 11+ messages in thread
From: Doug Maxey @ 2004-12-17 18:57 UTC (permalink / raw)
  To: kronos; +Cc: Jens Axboe, Andrew Morton, linux-kernel, Rashkae


On Fri, 17 Dec 2004 19:33:03 +0100, Kronos wrote:
...
> 		if (stat) return stat;
>+	
>+		toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba);

Should that be le32_to_cpu?

> 	} else {
>

++doug


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17 18:33     ` Kronos
  2004-12-17 18:57       ` Doug Maxey
@ 2004-12-17 19:27       ` Jens Axboe
  2004-12-18 17:10         ` Rashkae
  2004-12-18 20:20         ` Rashkae
  1 sibling, 2 replies; 11+ messages in thread
From: Jens Axboe @ 2004-12-17 19:27 UTC (permalink / raw)
  To: Kronos; +Cc: Andrew Morton, linux-kernel, Rashkae

On Fri, Dec 17 2004, Kronos wrote:
> Jens Axboe <axboe@suse.de> ha scritto:
> > On Fri, Dec 17 2004, Andrew Morton wrote:
> >> Rashkae <rashkae@tigershaunt.com> wrote:
> >> >
> >> > I can confirm that Linux Kerenl 2.6.9 still cannot mount a
> >> >  multi-session DVD if the last session starts at > 2.2 GB.  The
> >> >  only information on this problem I can find is here:
> >> > 
> >> >  http://marc.theaimsgroup.com/?l=linux-kernel&m=108827602322464&w=2
> >> > 
> >> >  Is there a patch anywhere to address this?
> >> 
> >> Please test this.  Jens, could you please check this one?
> > 
> > It looks fine for the case where the tocentry read suceeds, but you
> > should change the fallback assignment to be lba based as well I think.
> 
> Ok, changed that part. I also changed the part inside the #if
> !STANDARD_ATAPI to re-read using MSF, just to be sure to not break
> anything. Maybe those two weird units (Vertos 300 and NEC 260) return
> the LBA value in a sane way and the whole #if block can be removed? 

Much better, Andrew will you pick this up?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17 18:57       ` Doug Maxey
@ 2004-12-17 19:28         ` Jens Axboe
  2004-12-17 20:53           ` Doug Maxey
  0 siblings, 1 reply; 11+ messages in thread
From: Jens Axboe @ 2004-12-17 19:28 UTC (permalink / raw)
  To: Doug Maxey; +Cc: kronos, Andrew Morton, linux-kernel, Rashkae

On Fri, Dec 17 2004, Doug Maxey wrote:
> 
> On Fri, 17 Dec 2004 19:33:03 +0100, Kronos wrote:
> ...
> > 		if (stat) return stat;
> >+	
> >+		toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba);
> 
> Should that be le32_to_cpu?

Why? It's read data and that is always big-endian.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17 19:28         ` Jens Axboe
@ 2004-12-17 20:53           ` Doug Maxey
  0 siblings, 0 replies; 11+ messages in thread
From: Doug Maxey @ 2004-12-17 20:53 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Doug Maxey, kronos, Andrew Morton, linux-kernel, Rashkae


On Fri, 17 Dec 2004 20:28:13 +0100, Jens Axboe wrote:
>On Fri, Dec 17 2004, Doug Maxey wrote:
>> 
>> On Fri, 17 Dec 2004 19:33:03 +0100, Kronos wrote:
>> ...
>> > 		if (stat) return stat;
>> >+	
>> >+		toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba);
>> 
>> Should that be le32_to_cpu?
>
>Why? It's read data and that is always big-endian.

after paying closer attention, this is data from the *media*.  yup, 
that is the correct conversion. :-/

++doug


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17 19:27       ` Jens Axboe
@ 2004-12-18 17:10         ` Rashkae
  2004-12-18 17:36           ` Randy.Dunlap
  2004-12-18 20:20         ` Rashkae
  1 sibling, 1 reply; 11+ messages in thread
From: Rashkae @ 2004-12-18 17:10 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Kronos, Andrew Morton, linux-kernel

On Fri, Dec 17, 2004 at 08:27:38PM +0100, Jens Axboe wrote:
> 
> Much better, Andrew will you pick this up?

For someone who's too stoopid to figure out what you just
did/fixed, can someone point me to patch I can.. err, patch?

I thank you all for the help.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-18 17:10         ` Rashkae
@ 2004-12-18 17:36           ` Randy.Dunlap
  0 siblings, 0 replies; 11+ messages in thread
From: Randy.Dunlap @ 2004-12-18 17:36 UTC (permalink / raw)
  To: Rashkae; +Cc: Jens Axboe, Kronos, Andrew Morton, linux-kernel

Rashkae wrote:
> On Fri, Dec 17, 2004 at 08:27:38PM +0100, Jens Axboe wrote:
> 
>>Much better, Andrew will you pick this up?
> 
> 
> For someone who's too stoopid to figure out what you just
> did/fixed, can someone point me to patch I can.. err, patch?
> 
> I thank you all for the help.

The patch from Kronos is here:
http://marc.theaimsgroup.com/?l=linux-kernel&m=110330852622064&w=2

You probably want to click on [Download message RAW]
to save it.

-- 
~Randy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot mount multi-session DVD with ide-cd, must use ide-scsi
  2004-12-17 19:27       ` Jens Axboe
  2004-12-18 17:10         ` Rashkae
@ 2004-12-18 20:20         ` Rashkae
  1 sibling, 0 replies; 11+ messages in thread
From: Rashkae @ 2004-12-18 20:20 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Kronos, Andrew Morton, linux-kernel

On Fri, Dec 17, 2004 at 08:27:38PM +0100, Jens Axboe wrote:

> > Ok, changed that part. I also changed the part inside the #if
> > !STANDARD_ATAPI to re-read using MSF, just to be sure to not break
> > anything. Maybe those two weird units (Vertos 300 and NEC 260) return
> > the LBA value in a sane way and the whole #if block can be removed? 
> 
> Much better, Andrew will you pick this up?

Working well for me so far, at least, as far as the problem I
whined about goes :)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-12-18 20:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-17  1:20 Cannot mount multi-session DVD with ide-cd, must use ide-scsi Rashkae
2004-12-17  8:13 ` Andrew Morton
2004-12-17 12:08   ` Jens Axboe
2004-12-17 18:33     ` Kronos
2004-12-17 18:57       ` Doug Maxey
2004-12-17 19:28         ` Jens Axboe
2004-12-17 20:53           ` Doug Maxey
2004-12-17 19:27       ` Jens Axboe
2004-12-18 17:10         ` Rashkae
2004-12-18 17:36           ` Randy.Dunlap
2004-12-18 20:20         ` Rashkae

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).