Patch for SCSI emulation of IDE/ATAPI PD/CD drives

William Riede (wriede@shell.monmouth.com)
Fri, 30 Jan 1998 22:21:14 -0500 (EST)


I have for quite some time now (5 months) run my NEC IDE/ATAPI PD/CD drive
(PD-1 ODX654P) without a hitch by virtue of the attached patch.

The change to scsi.c simply gets the drive recognized with the proper flags
set, and the change to ide-scsi.c translates the write command in a way that
already was done for the read command.

I'd like anyone that has the same drive to test this patch, and would like the
gurus to comment on its appropriateness. It is against 2.0.33.

Thanks, Willem Riede.

---------------------
diff -u drivers/scsi/scsi.c.orig drivers/scsi/scsi.c
--- drivers/scsi/scsi.c.orig Mon Aug 11 16:37:24 1997
+++ drivers/scsi/scsi.c Sat Jan 24 15:00:40 1998
@@ -278,6 +278,7 @@
{"IOMEGA","Io20S *F","*", BLIST_KEY},
{"INSITE","Floptical F*8I","*", BLIST_KEY},
{"INSITE","I325VM","*", BLIST_KEY},
+{"NEC","PD-1 ODX654P","*", BLIST_FORCELUN | BLIST_SINGLELUN},
{"NRC","MBR-7","*", BLIST_FORCELUN | BLIST_SINGLELUN},
{"NRC","MBR-7.4","*", BLIST_FORCELUN | BLIST_SINGLELUN},
{"NAKAMICH","MJ-4.8S","*", BLIST_FORCELUN | BLIST_SINGLELUN},
diff -u drivers/scsi/ide-scsi.c.orig drivers/scsi/ide-scsi.c
--- drivers/scsi/ide-scsi.c.orig Mon Aug 4 14:45:55 1997
+++ drivers/scsi/ide-scsi.c Sat Jan 24 15:00:40 1998
@@ -160,6 +160,11 @@
c[3] = c[1] & 0x1f; c[2] = 0; c[1] &= 0xe0;
c[0] += (READ_10 - READ_6);
}
+ if (c[0] == WRITE_6) {
+ c[8] = c[4]; c[5] = c[3]; c[4] = c[2];
+ c[3] = c[1] & 0x1f; c[2] = 0; c[1] &= 0xe0;
+ c[0] = WRITE_10;
+ }
if (c[0] == MODE_SENSE || (c[0] == MODE_SELECT && buf[3] == 8)) {
pc->request_transfer -= 4;
memset (c, 0, 12);
@@ -247,10 +252,6 @@
struct request *rq = pc->rq;
unsigned int temp;

-#if IDESCSI_DEBUG_LOG
- printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n");
-#endif /* IDESCSI_DEBUG_LOG */
-
if (clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
#if IDESCSI_DEBUG_LOG
printk ("ide-scsi: %s: DMA complete\n", drive->name);
@@ -261,6 +262,10 @@

status = GET_STAT(); /* Clear the interrupt */

+#if IDESCSI_DEBUG_LOG
+ printk (KERN_INFO "idescsi_pc_intr interrupt status %x\n", status);
+#endif /* IDESCSI_DEBUG_LOG */
+
if ((status & DRQ_STAT) == 0) { /* No more interrupts */
#if IDESCSI_DEBUG_LOG
printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred);
@@ -325,6 +330,13 @@
ide_do_reset (drive);
return;
}
+#if IDESCSI_DEBUG_LOG
+ printk (KERN_INFO "packet %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x\n",
+ scsi->pc->c[0],scsi->pc->c[1],scsi->pc->c[2],scsi->pc->c[3],
+ scsi->pc->c[4],scsi->pc->c[5],scsi->pc->c[6],scsi->pc->c[7],
+ scsi->pc->c[8],scsi->pc->c[9],scsi->pc->c[10],scsi->pc->c[11]);
+#endif /* IDESCSI_DEBUG_LOG */
+
ide_set_handler (drive, &idescsi_pc_intr, WAIT_CMD); /* Set the interrupt routine */
atapi_output_bytes (drive, scsi->pc->c, 12); /* Send the actual packet */
}