Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Floppy Driver Patch

0 views
Skip to first unread message

Alain Knaff

unread,
Feb 3, 1996, 3:00:00 AM2/3/96
to

Hello all,

The following floppy driver patch adds better error reporting to the
formatting ioctl's. Now, FMTBEG fails with EROFS (read only
filesystem) when attempting to format a write-protected disk, and with
ENODEV when attempting to launch fdformat without any disk in the
driver. Some people had trouble figuring out what was wrong when they
got an I/O error from fdformat..., hopefully "read-only filesystem"
will be more explicit than just I/O error.

It also adds detection code for the S82078B floppy controller
(previously detected as 'unknown 82077 variant'). The case statement
doing the floppy disk controller type is now also indented in true
Linus style(tm) :-)

Alain


diff -ur linux-1.3.59/drivers/block/floppy.c linux/drivers/block/floppy.c
--- linux-1.3.59/drivers/block/floppy.c Fri Jan 26 09:49:14 1996
+++ linux/drivers/block/floppy.c Thu Jan 25 22:53:09 1996
@@ -3248,6 +3248,14 @@
return 0;

case FDFMTBEG:
+ LOCK_FDC(drive,1);
+ CALL(poll_drive(1, FD_RAW_NEED_DISK));
+ ret = UDRS->flags;
+ process_fd_request();
+ if(ret & FD_VERIFY)
+ return -ENODEV;
+ if(!(ret & FD_DISK_WRITABLE))
+ return -EROFS;
return 0;
case FDFMTTRK:
if (UDRS->fd_ref != 1)
@@ -3671,30 +3679,33 @@
return FDC_82077; /* Revised 82077AA passes all the tests */
}
switch (reply_buffer[0] >> 5) {
- case 0x0:
- output_byte(FD_SAVE);
- r = result();
- if (r != 17) {
- printk("FDC %d init: SAVE: unexpected return of %d bytes.\n", fdc, r);
- return FDC_UNKNOWN;
- }
- if (!(reply_buffer[0] & 0x40)) {
- printk("FDC %d is a 3Volt 82078SL.\n",fdc);
+ case 0x0:
+ output_byte(FD_SAVE);
+ r = result();
+ if (r != 17) {
+ printk("FDC %d init: SAVE: unexpected return of %d bytes.\n", fdc, r);
+ return FDC_UNKNOWN;
+ }
+ if (!(reply_buffer[0] & 0x40)) {
+ printk("FDC %d is a 3Volt 82078SL.\n",fdc);
+ return FDC_82078;
+ }
+ /* Either a 82078-1 or a 82078SL running at 5Volt */
+ printk("FDC %d is a 82078-1.\n",fdc);
+ return FDC_82078_1;
+ case 0x1:
+ printk("FDC %d is a 44pin 82078\n",fdc);
return FDC_82078;
- }
- /* Either a 82078-1 or a 82078SL running at 5Volt */
- printk("FDC %d is a 82078-1.\n",fdc);
- return FDC_82078_1;
- case 0x1:
- printk("FDC %d is a 44pin 82078\n",fdc);
- return FDC_82078;
- case 0x3:
- printk("FDC %d is a National Semiconductor PC87306\n", fdc);
- return FDC_87306;
- default:
- printk("FDC %d init: Unknown 82077 variant, PARTID = %d.\n",
- fdc, reply_buffer[0] >> 5);
- return FDC_82077_UNKN;
+ case 0x2:
+ printk("FDC %d is a S82078B\n", fdc);
+ return FDC_S82078B;
+ case 0x3:
+ printk("FDC %d is a National Semiconductor PC87306\n", fdc);
+ return FDC_87306;
+ default:
+ printk("FDC %d init: 82077 variant with PARTID=%d.\n",
+ fdc, reply_buffer[0] >> 5);
+ return FDC_82077_UNKN;
}
} /* get_fdc_version */

diff -ur linux-1.3.59/include/linux/fdreg.h linux/include/linux/fdreg.h
--- linux-1.3.59/include/linux/fdreg.h Fri Jan 26 09:46:39 1996
+++ linux/include/linux/fdreg.h Thu Jan 25 21:46:40 1996
@@ -110,6 +110,8 @@
#define FDC_82077_UNKN 0x53 /* Unknown 82077 variant */
#define FDC_82078 0x60 /* 44pin 82078 or 64pin 82078SL */
#define FDC_82078_1 0x61 /* 82078-1 (2Mbps fdc) */
+#define FDC_S82078B 0x62 /* S82078B (first seen on Adaptec AVA-2825 VLB
+ * SCSI/EIDE/Floppy controller) */
#define FDC_87306 0x63 /* National Semiconductor PC 87306 */

/*


0 new messages