patch-2.3.1 linux/drivers/block/ide-cd.c

Next file: linux/drivers/block/ide-disk.c
Previous file: linux/drivers/block/ht6560b.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.0/linux/drivers/block/ide-cd.c linux/drivers/block/ide-cd.c
@@ -258,13 +258,14 @@
 #include <linux/interrupt.h>
 #include <linux/errno.h>
 #include <linux/cdrom.h>
+#include <linux/ide.h>
+
 #include <asm/irq.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
 #include <asm/uaccess.h>
 #include <asm/unaligned.h>
 
-#include "ide.h"
 #include "ide-cd.h"
 
 /****************************************************************************
@@ -670,7 +671,8 @@
 
 	OUT_BYTE (xferlen & 0xff, IDE_LCYL_REG);
 	OUT_BYTE (xferlen >> 8  , IDE_HCYL_REG);
-	OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
+	if (IDE_CONTROL_REG)
+		OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
  
 	if (info->dma)
 		(void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
@@ -2940,7 +2942,19 @@
         else 	
         	printk (" drive");
 
-	printk (", %dkB Cache\n", ntohs(buf.cap.buffer_size));
+	printk (", %dkB Cache", ntohs(buf.cap.buffer_size));
+
+	if (drive->using_dma) {
+		if ((drive->id->field_valid & 4) &&
+		    (drive->id->dma_ultra & (drive->id->dma_ultra >> 8) & 7)) {
+			printk(", UDMA");	/* UDMA BIOS-enabled! */
+		} else if (drive->id->field_valid & 4) {
+			printk(", (U)DMA");	/* Can be BIOS-enabled! */
+		} else {
+			printk(", DMA");
+		}
+	}
+	printk("\n");
 
 	return nslots;
 }
@@ -2956,6 +2970,53 @@
 	ide_add_setting(drive,	"dsc_overlap",		SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1,	1, &drive->dsc_overlap, NULL);
 }
 
+#ifdef CONFIG_IDECD_SLOTS
+static void ide_cdrom_slot_check (ide_drive_t *drive, int nslots)
+{
+	tracktype tracks;
+	struct cdrom_info *info = drive->driver_data;
+	struct cdrom_device_info *devinfo = &info->devinfo;
+	int slot_count = 0, drive_stat = 0, tmp;
+
+	for (slot_count=0;slot_count<nslots;slot_count++) {
+		(void) ide_cdrom_select_disc(devinfo, slot_count);
+		printk("     CD Slot %d ", slot_count+1);
+
+		drive_stat = ide_cdrom_drive_status(devinfo, slot_count);
+		if (drive_stat<0) {
+			continue;
+		} else switch(drive_stat) {
+			case CDS_DISC_OK:
+				/* use routine in Uniform CD-ROM driver */
+				cdrom_count_tracks(devinfo, &tracks);
+				tmp = tracks.audio + tracks.data +
+					tracks.cdi + tracks.xa;
+				printk(": Disc has %d track%s: ", tmp,
+					(tmp == 1)? "" : "s");
+				printk("%d=data %d=audio %d=Cd-I %d=XA\n",
+					tracks.data, tracks.audio,
+					tracks.cdi, tracks.xa);
+				break;
+			case CDS_NO_DISC:
+				printk("Empty slot.\n");
+				break;
+			case CDS_TRAY_OPEN:
+				printk("CD-ROM tray open.\n");
+				break;
+			case CDS_DRIVE_NOT_READY:
+				printk("CD-ROM drive not ready.\n");
+				break;
+			case CDS_NO_INFO:
+				printk("No Information available.\n");
+				break;
+			default:
+				printk("This Should not happen!\n");
+				break;
+		}
+	}
+}
+#endif /* CONFIG_IDECD_SLOTS */
+
 static
 int ide_cdrom_setup (ide_drive_t *drive)
 {
@@ -3083,6 +3144,11 @@
 		return 1;
 	}
 	ide_cdrom_add_settings(drive);
+#ifdef CONFIG_IDECD_SLOTS
+	if (CDROM_CONFIG_FLAGS (drive)->is_changer) {
+		ide_cdrom_slot_check(drive, nslots);
+	}
+#endif /* CONFIG_IDECD_SLOTS */
 	return 0;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)