patch-2.0.30 linux/drivers/cdrom/cdu31a.c
Next file: linux/drivers/char/Config.in
Previous file: linux/drivers/block/ll_rw_blk.c
Back to the patch index
Back to the overall index
- Lines: 277
- Date:
Tue Apr 8 08:47:45 1997
- Orig file:
v2.0.29/linux/drivers/cdrom/cdu31a.c
- Orig date:
Wed Dec 11 06:05:36 1996
diff -u --recursive --new-file v2.0.29/linux/drivers/cdrom/cdu31a.c linux/drivers/cdrom/cdu31a.c
@@ -1,25 +1,25 @@
/*
-* Sony CDU-31A CDROM interface device driver.
-*
-* Corey Minyard (minyard@wf-rch.cirr.com)
-*
-* Colossians 3:17
-*
-* The Sony interface device driver handles Sony interface CDROM
-* drives and provides a complete block-level interface as well as an
-* ioctl() interface compatible with the Sun (as specified in
-* include/linux/cdrom.h). With this interface, CDROMs can be
-* accessed and standard audio CDs can be played back normally.
-*
-* WARNING - All autoprobes have been removed from the driver.
-* You MUST configure the CDU31A via a LILO config
-* at boot time or in lilo.conf. I have the
-* following in my lilo.conf:
-*
-* append="cdu31a=0x1f88,0,PAS"
-*
-* The first number is the I/O base address of the
-* card. The second is the interrupt (0 means none).
+ * Sony CDU-31A CDROM interface device driver.
+ *
+ * Corey Minyard (minyard@wf-rch.cirr.com)
+ *
+ * Colossians 3:17
+ *
+ * The Sony interface device driver handles Sony interface CDROM
+ * drives and provides a complete block-level interface as well as an
+ * ioctl() interface compatible with the Sun (as specified in
+ * include/linux/cdrom.h). With this interface, CDROMs can be
+ * accessed and standard audio CDs can be played back normally.
+ *
+ * WARNING - All autoprobes have been removed from the driver.
+ * You MUST configure the CDU31A via a LILO config
+ * at boot time or in lilo.conf. I have the
+ * following in my lilo.conf:
+ *
+ * append="cdu31a=0x1f88,0,PAS"
+ *
+ * The first number is the I/O base address of the
+ * card. The second is the interrupt (0 means none).
* The third should be "PAS" if on a Pro-Audio
* spectrum, or nothing if on something else.
*
@@ -171,6 +171,8 @@
* still here, if the eject button is pushed while the
* drive light is flashing, the drive will return a bad
* status and be reset. It recovers, though.
+ *
+ * 03/07/97 - Fixed a problem with timers.
*/
#include <linux/major.h>
@@ -931,6 +933,9 @@
volatile int val;
+#if DEBUG
+ printk("Entering handle_sony_cd_attention\n");
+#endif
if (is_attention())
{
if (num_consecutive_attentions > CDU31A_MAX_CONSECUTIVE_ATTENTIONS)
@@ -938,6 +943,9 @@
printk("cdu31a: Too many consecutive attentions: %d\n",
num_consecutive_attentions);
num_consecutive_attentions = 0;
+#if DEBUG
+ printk("Leaving handle_sony_cd_attention at %d\n", __LINE__);
+#endif
return(0);
}
@@ -980,6 +988,9 @@
}
num_consecutive_attentions++;
+#if DEBUG
+ printk("Leaving handle_sony_cd_attention at %d\n", __LINE__);
+#endif
return(1);
}
else if (abort_read_started)
@@ -996,10 +1007,16 @@
val = read_data_register();
}
abort_read_started = 0;
+#if DEBUG
+ printk("Leaving handle_sony_cd_attention at %d\n", __LINE__);
+#endif
return(1);
}
num_consecutive_attentions = 0;
+#if DEBUG
+ printk("Leaving handle_sony_cd_attention at %d\n", __LINE__);
+#endif
return(0);
}
@@ -1088,6 +1105,9 @@
unsigned int retry_count;
+#if DEBUG
+ printk("Entering start_request\n");
+#endif
log_to_msf(sector, params);
/* If requested, read exactly what was asked. */
if (read_nsect_only)
@@ -1128,6 +1148,9 @@
if (is_busy())
{
printk("CDU31A: Timeout while waiting to issue command\n");
+#if DEBUG
+ printk("Leaving start_request at %d\n", __LINE__);
+#endif
return(1);
}
else
@@ -1143,8 +1166,14 @@
sony_next_block = sector * 4;
readahead_dataleft = 0;
readahead_bad = 0;
+#if DEBUG
+ printk("Leaving start_request at %d\n", __LINE__);
+#endif
return(0);
}
+#if DEBUG
+ printk("Leaving start_request at %d\n", __LINE__);
+#endif
}
/* Abort a pending read operation. Clear all the drive status and
@@ -1186,6 +1215,13 @@
static void
handle_abort_timeout(unsigned long data)
{
+ unsigned long flags;
+
+#if DEBUG
+ printk("Entering handle_abort_timeout\n");
+#endif
+ save_flags(flags);
+ cli();
/* If it is in use, ignore it. */
if (!sony_inuse)
{
@@ -1202,6 +1238,10 @@
readahead_bad = 0;
abort_read_started = 1;
}
+ restore_flags(flags);
+#if DEBUG
+ printk("Leaving handle_abort_timeout\n");
+#endif
}
/* Actually get data and status from the drive. */
@@ -1216,6 +1256,9 @@
volatile unsigned char val;
+#if DEBUG
+ printk("Entering input_data\n");
+#endif
/* If an XA disk on a CDU31A, skip the first 12 bytes of data from
the disk. The real data is after that. */
if (sony_xa_mode)
@@ -1264,6 +1307,9 @@
val = read_data_register();
}
}
+#if DEBUG
+ printk("Leaving input_data at %d\n", __LINE__);
+#endif
}
/* read data from the drive. Note the nsect must be <= 4. */
@@ -1280,6 +1326,10 @@
unsigned int skip;
+#if DEBUG
+ printk("Entering read_data_block\n");
+#endif
+
res_reg[0] = 0;
res_reg[1] = 0;
*res_size = 0;
@@ -1345,6 +1395,9 @@
{
get_result(res_reg, res_size);
}
+#if DEBUG
+ printk("Leaving read_data_block at %d\n", __LINE__);
+#endif
return;
}
}
@@ -1464,6 +1517,9 @@
}
}
}
+#if DEBUG
+ printk("Leaving read_data_block at %d\n", __LINE__);
+#endif
}
/*
@@ -1484,6 +1540,10 @@
unsigned long flags;
+#if DEBUG
+ printk("Entering do_cdu31a_request\n");
+#endif
+
/*
* Make sure no one else is using the driver; wait for them
* to finish if it is so.
@@ -1501,6 +1561,9 @@
end_request(0);
}
restore_flags(flags);
+#if DEBUG
+ printk("Leaving do_cdu31a_request at %d\n", __LINE__);
+#endif
return;
}
}
@@ -1516,11 +1579,8 @@
sti();
- /* If the timer is running, cancel it. */
- if (cdu31a_abort_timer.next != NULL)
- {
- del_timer(&cdu31a_abort_timer);
- }
+ /* Make sure the timer is cancelled. */
+ del_timer(&cdu31a_abort_timer);
while (1)
{
@@ -1692,6 +1752,7 @@
}
end_do_cdu31a_request:
+ cli();
#if 0
/* After finished, cancel any pending operations. */
abort_read();
@@ -1706,6 +1767,9 @@
sony_inuse = 0;
wake_up_interruptible(&sony_wait);
restore_flags(flags);
+#if DEBUG
+ printk("Leaving do_cdu31a_request at %d\n", __LINE__);
+#endif
}
/* Copy overlapping buffers. */
@@ -3139,8 +3203,7 @@
/* use 'mount -o block=2048' */
blksize_size[MAJOR_NR] = &cdu31a_block_size;
- cdu31a_abort_timer.next = NULL;
- cdu31a_abort_timer.prev = NULL;
+ init_timer(&cdu31a_abort_timer);
cdu31a_abort_timer.function = handle_abort_timeout;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov