Skip to contentSkip to conversation

Cannot mount multi-session DVD with ide-cd, must use ide-scsi

DISCUSSION Rashkae 6 participants 11 messages Dec 17, 2004 – Dec 18, 2004

lore
Share & tools
lore

Rashkae

author
#0 lore raw

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.

#1 lore raw
Quoted 8 lines · Rashkae

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 <[email protected]>

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):

---

 25-akpm/drivers/ide/ide-cd.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c~ide-cd-unable-to-read-multisession-dvds +6 -4
diff -puN drivers/ide/ide-cd.c~ide-cd-unable-to-read-multisession-dvds drivers/ide/ide-cd.c
@@ -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);
 

_

#2 lore raw
Quoted 11 lines · Andrew Morton
Quoted 8 lines · Rashkae

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.

drivers/ide/ide-cd.c static int cdrom_read_toc(ide_drive_t *d · line 2359

Quoted 12 lines

diff -puN drivers/ide/ide-cd.c~ide-cd-unable-to-read-multisession-dvds drivers/ide/ide-cd.c

drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c~ide-cd-unable-to-read-multisession-dvds +1 -1
@@ -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.

Signature · 1 line
Jens Axboe
#3 lore raw

Jens Axboe <[email protected]> ha scritto:

Quoted 7 lines · Andrew Morton
Quoted 6 lines
Quoted 5 lines · Rashkae

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:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

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).

drivers/ide/ide-cd.c +15 -9
@@ -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

Signature · 4 lines
Home: http://kronoz.cjb.net
The trouble with computers is that they do what you tell them, 
not what you want.
D. Cohen
#4 lore raw

On Fri, 17 Dec 2004 19:33:03 +0100, Kronos wrote:
...

drivers/ide/ide-cd.c line 2363

Quoted 3 lines
		if (stat) return stat;
drivers/ide/ide-cd.c +2 -0
+	
+		toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba);

Should that be le32_to_cpu?

Quoted 2 lines
	} else {

++doug

#7 lore raw
In reply to Kronos
Quoted 14 lines · Kronos

Jens Axboe <[email protected]> ha scritto:

Quoted 13 lines · Andrew Morton
Quoted 11 lines
Quoted 8 lines · Rashkae

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?

Quoted 7 lines
Quoted 2 lines

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?

Signature · 1 line
Jens Axboe
#5 lore raw
In reply to Doug Maxey
Quoted 8 lines · Doug Maxey

On Fri, 17 Dec 2004 19:33:03 +0100, Kronos wrote:
...

drivers/ide/ide-cd.c line 2363

Quoted 3 lines
		if (stat) return stat;
drivers/ide/ide-cd.c +2 -0
+	
+		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.

Signature · 1 line
Jens Axboe
#6 lore raw
Quoted 11 lines · Jens Axboe
Quoted 8 lines · Doug Maxey

On Fri, 17 Dec 2004 19:33:03 +0100, Kronos wrote:
...

drivers/ide/ide-cd.c line 2363

Quoted 3 lines
		if (stat) return stat;
drivers/ide/ide-cd.c +2 -0
+	
+		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

author
#8 lore raw
In reply to Jens Axboe
Quoted 2 lines · Jens Axboe

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.

#9 lore raw
Quoted 9 lines · Rashkae
Quoted 1 line · Jens Axboe

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.

Signature · 1 line
~Randy
author
#10 lore raw
In reply to Jens Axboe
Quoted 6 lines · Jens Axboe
Quoted 4 lines

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 :)