[2.1.47] patch to avoid the ATAPI CD locking at boot

Andrea Arcangeli (arcangeli@mbox.queen.it)
Tue, 29 Jul 1997 15:07:12 +0200 (CEST)


Description of the problem (you must have an ATAPI CD to try the following
it):
1. Reboot your machine
2. Wait lilo prompt
3. Before boot linux open your ATAPI CD-ROM (as you want to insert a CD,
you can also insert a CD)
4. Don' t close the CD-ROM with the eject button, but leave it opened
5. With the CD-ROM opened start linux from lilo (that is waiting from
point 2).
6. When the boot is finished and you are logging into your system try to
open the CD-ROM with the eject button (the same you pressed at point 3
to open it)
7. The CD is locked

This patch fix the bug:

diff -u linux/drivers/block/ide-probe.c /home/andrea/devel/linux_2.1.47_dev/drivers/block/ide-probe.c
--- linux/drivers/block/ide-probe.c Thu Jul 17 11:04:37 1997
+++ /home/andrea/devel/linux_2.1.47_dev/drivers/block/ide-probe.c Tue Jul 29 14:29:05 1997
@@ -1,5 +1,5 @@
/*
- * linux/drivers/block/ide-probe.c Version 1.01 Jan 26, 1997
+ * linux/drivers/block/ide-probe.c Version 1.02 Jul 29, 1997
*
* Copyright (C) 1994-1996 Linus Torvalds & authors (see below)
*/
@@ -38,6 +38,8 @@
*
* Version 1.00 move drive probing code from ide.c to ide-probe.c
* Version 1.01 fix compilation problem for m68k
+ * Version 1.02 increase WAIT_PIDENTIFY to avoid CD-ROM locking at boot
+ * by Andrea Arcangeli <arcangeli@mbox.queen.it>
*/

#undef REALLY_SLOW_IO /* most systems can safely undef this */
diff -u linux/drivers/block/ide.h /home/andrea/devel/linux_2.1.47_dev/drivers/block/ide.h
--- linux/drivers/block/ide.h Mon Jul 28 18:42:51 1997
+++ /home/andrea/devel/linux_2.1.47_dev/drivers/block/ide.h Tue Jul 29 14:31:39 1997
@@ -158,7 +158,8 @@
#else
#define WAIT_READY (3*HZ/100) /* 30msec - should be instantaneous */
#endif /* CONFIG_APM */
-#define WAIT_PIDENTIFY (1*HZ) /* 1sec - should be less than 3ms (?) */
+#define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?)
+ if all ATAPI CD is closed at
boot */
#define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */
#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */

The patch is against [2.1.47].

Andrea Arcangeli