summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1993-12-12 20:26:56 +0000
committerache <ache@FreeBSD.org>1993-12-12 20:26:56 +0000
commit240df334941374fac337c2316d329ac574ddf3a1 (patch)
tree35deddf31fdb963afef02483c3a05cab30d5bfd8
parent1a93a487bc98bd0fc441425074407fa7406c486c (diff)
downloadFreeBSD-src-240df334941374fac337c2316d329ac574ddf3a1.zip
FreeBSD-src-240df334941374fac337c2316d329ac574ddf3a1.tar.gz
Add 360K floppy support.
More work to add 720K floppy support. Restore good old dependance of device and floppy type. Now: fd?a == 1.44 fd?b == 1.2 fd?c == 720 fd?d == 360 in HD fd?e == 360 Add more strict size check in Fdopen, not it refuse: 1) Attempt to open any type expect fd?e, if you have only 360K drive. 2) Attempt to open fd?a if you have only 1.2 drive.
-rw-r--r--sys/dev/fdc/fdc.c27
-rw-r--r--sys/i386/isa/fd.c27
-rw-r--r--sys/isa/fd.c27
3 files changed, 66 insertions, 15 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 794e4a3..c4f686a 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -80,6 +80,12 @@ struct fd_type {
int heads; /* number of heads */
};
+/* This defines must match fd_types */
+#define FD144 0
+#define FD12 1
+#define FD720H 2
+#define FD360H 3
+#define FD360 4
struct fd_type fd_types[NUMTYPES] =
{
{ 18,2,0xFF,0x1B,80,2880,1,0,2 }, /* 1.44 meg HD 3.5in floppy */
@@ -284,16 +290,22 @@ fdattach(dev)
fd_data[fdu].fdsu = fdsu;
printf("fd%d: unit %d type ", fdcu, fdu);
+ /* Fdopen can redefine ft field later */
+
if ((fdt & 0xf0) == RTCFDT_12M) {
printf("1.2MB 5.25in\n");
- fd_data[fdu].type = 1;
- fd_data[fdu].ft = fd_types + 1;
-
+ fd_data[fdu].type = FD12;
+ fd_data[fdu].ft = fd_types + FD12;
}
if ((fdt & 0xf0) == RTCFDT_144M) {
printf("1.44MB 3.5in\n");
- fd_data[fdu].type = 0;
- fd_data[fdu].ft = fd_types + 0;
+ fd_data[fdu].type = FD144;
+ fd_data[fdu].ft = fd_types + FD144;
+ }
+ if ((fdt & 0xf0) == RTCFDT_360K) {
+ printf("360K 5.25in\n");
+ fd_data[fdu].type = FD360;
+ fd_data[fdu].ft = fd_types + FD360;
}
fdt <<= 4;
@@ -517,6 +529,11 @@ Fdopen(dev, flags)
if (fdu >= NFD || fd_data[fdu].fdc == NULL
|| fd_data[fdu].type == NO_TYPE) return(ENXIO);
if (type >= NUMTYPES) return(ENXIO);
+ if (fd_data[fdu].type == FD360 && type != FD360)
+ return(ENXIO);
+ if (fd_data[fdu].type == FD12 && type == FD144)
+ return(ENXIO);
+ fd_data[fdu].ft = fd_types + type;
fd_data[fdu].flags |= FD_OPEN;
return 0;
diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c
index 794e4a3..c4f686a 100644
--- a/sys/i386/isa/fd.c
+++ b/sys/i386/isa/fd.c
@@ -80,6 +80,12 @@ struct fd_type {
int heads; /* number of heads */
};
+/* This defines must match fd_types */
+#define FD144 0
+#define FD12 1
+#define FD720H 2
+#define FD360H 3
+#define FD360 4
struct fd_type fd_types[NUMTYPES] =
{
{ 18,2,0xFF,0x1B,80,2880,1,0,2 }, /* 1.44 meg HD 3.5in floppy */
@@ -284,16 +290,22 @@ fdattach(dev)
fd_data[fdu].fdsu = fdsu;
printf("fd%d: unit %d type ", fdcu, fdu);
+ /* Fdopen can redefine ft field later */
+
if ((fdt & 0xf0) == RTCFDT_12M) {
printf("1.2MB 5.25in\n");
- fd_data[fdu].type = 1;
- fd_data[fdu].ft = fd_types + 1;
-
+ fd_data[fdu].type = FD12;
+ fd_data[fdu].ft = fd_types + FD12;
}
if ((fdt & 0xf0) == RTCFDT_144M) {
printf("1.44MB 3.5in\n");
- fd_data[fdu].type = 0;
- fd_data[fdu].ft = fd_types + 0;
+ fd_data[fdu].type = FD144;
+ fd_data[fdu].ft = fd_types + FD144;
+ }
+ if ((fdt & 0xf0) == RTCFDT_360K) {
+ printf("360K 5.25in\n");
+ fd_data[fdu].type = FD360;
+ fd_data[fdu].ft = fd_types + FD360;
}
fdt <<= 4;
@@ -517,6 +529,11 @@ Fdopen(dev, flags)
if (fdu >= NFD || fd_data[fdu].fdc == NULL
|| fd_data[fdu].type == NO_TYPE) return(ENXIO);
if (type >= NUMTYPES) return(ENXIO);
+ if (fd_data[fdu].type == FD360 && type != FD360)
+ return(ENXIO);
+ if (fd_data[fdu].type == FD12 && type == FD144)
+ return(ENXIO);
+ fd_data[fdu].ft = fd_types + type;
fd_data[fdu].flags |= FD_OPEN;
return 0;
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 794e4a3..c4f686a 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -80,6 +80,12 @@ struct fd_type {
int heads; /* number of heads */
};
+/* This defines must match fd_types */
+#define FD144 0
+#define FD12 1
+#define FD720H 2
+#define FD360H 3
+#define FD360 4
struct fd_type fd_types[NUMTYPES] =
{
{ 18,2,0xFF,0x1B,80,2880,1,0,2 }, /* 1.44 meg HD 3.5in floppy */
@@ -284,16 +290,22 @@ fdattach(dev)
fd_data[fdu].fdsu = fdsu;
printf("fd%d: unit %d type ", fdcu, fdu);
+ /* Fdopen can redefine ft field later */
+
if ((fdt & 0xf0) == RTCFDT_12M) {
printf("1.2MB 5.25in\n");
- fd_data[fdu].type = 1;
- fd_data[fdu].ft = fd_types + 1;
-
+ fd_data[fdu].type = FD12;
+ fd_data[fdu].ft = fd_types + FD12;
}
if ((fdt & 0xf0) == RTCFDT_144M) {
printf("1.44MB 3.5in\n");
- fd_data[fdu].type = 0;
- fd_data[fdu].ft = fd_types + 0;
+ fd_data[fdu].type = FD144;
+ fd_data[fdu].ft = fd_types + FD144;
+ }
+ if ((fdt & 0xf0) == RTCFDT_360K) {
+ printf("360K 5.25in\n");
+ fd_data[fdu].type = FD360;
+ fd_data[fdu].ft = fd_types + FD360;
}
fdt <<= 4;
@@ -517,6 +529,11 @@ Fdopen(dev, flags)
if (fdu >= NFD || fd_data[fdu].fdc == NULL
|| fd_data[fdu].type == NO_TYPE) return(ENXIO);
if (type >= NUMTYPES) return(ENXIO);
+ if (fd_data[fdu].type == FD360 && type != FD360)
+ return(ENXIO);
+ if (fd_data[fdu].type == FD12 && type == FD144)
+ return(ENXIO);
+ fd_data[fdu].ft = fd_types + type;
fd_data[fdu].flags |= FD_OPEN;
return 0;
OpenPOWER on IntegriCloud