bin/174711: [fdc] Floppy drive 5.25" 360Kb bug.

Emil Mamedov emil80386 at yahoo.com
Tue May 7 15:26:59 UTC 2013


My previous tarball has been corrupted and I've attached
floppy-diff files to message body:

--- fdc.c.org	2012-03-03 06:15:13.000000000 +0000
+++ fdc.c	2013-01-21 23:18:14.000000000 +0000
@@ -136,33 +136,35 @@
  */
 
 static struct fd_type fd_searchlist_360k[] = {
-	{ FDF_5_360 },
+	{ FDD_5_360 | FL_AUTO},
+	{ FDD_5_180 | FL_AUTO},
 	{ 0 }
 };
 
 static struct fd_type fd_searchlist_12m[] = {
-	{ FDF_5_1200 | FL_AUTO },
-	{ FDF_5_360 | FL_2STEP | FL_AUTO},
+	{ FHD_5_1200 | FL_AUTO },
+	{ FHD_5_360  | FL_2STEP | FL_AUTO},
+	{ FHD_5_180  | FL_2STEP | FL_AUTO},
 	{ 0 }
 };
 
 static struct fd_type fd_searchlist_720k[] = {
-	{ FDF_3_720 },
+	{ FHD_3_720 },
 	{ 0 }
 };
 
 static struct fd_type fd_searchlist_144m[] = {
-	{ FDF_3_1440 | FL_AUTO},
-	{ FDF_3_720 | FL_AUTO},
+	{ FHD_3_1440 | FL_AUTO},
+	{ FHD_3_720  | FL_AUTO},
 	{ 0 }
 };
 
 static struct fd_type fd_searchlist_288m[] = {
-	{ FDF_3_1440 | FL_AUTO },
+	{ FHD_3_1440 | FL_AUTO },
 #if 0
-	{ FDF_3_2880 | FL_AUTO }, /* XXX: probably doesn't work */
+	{ FHD_3_2880 | FL_AUTO }, /* XXX: probably doesn't work */
 #endif
-	{ FDF_3_720 | FL_AUTO},
+	{ FHD_3_720 | FL_AUTO},
 	{ 0 }
 };
 
@@ -297,7 +299,7 @@
 fdprinttype(struct fd_type *ft)
 {
 
-	printf("(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,0x%x)",
+	printf("(%d,%d,0x%x,0x%x,%d,%d,%d,%d,0x%x,%d,%d,0x%x)\n",
 	    ft->sectrac, ft->secsize, ft->datalen, ft->gap, ft->tracks,
 	    ft->size, ft->trans, ft->heads, ft->f_gap, ft->f_inter,
 	    ft->offset_side2, ft->flags);
@@ -856,7 +858,8 @@
 		return (fdc_biodone(fdc, ENXIO));
 
 	/* Check if we lost our media */
-	if (fdin_rd(fdc) & FDI_DCHG) {
+	if ((fdin_rd(fdc) & FDI_DCHG) &&
+	    !(device_get_flags(fd->dev) & FD_NO_CHLINE)) {
 		if (debugflags & 0x40)
 			printf("Lost disk\n");
 		mtx_lock(&fdc->fdc_mtx);
@@ -884,7 +887,7 @@
 
 	mfm = (fd->ft->flags & FL_MFM)? NE7CMD_MFM: 0;
 	steptrac = (fd->ft->flags & FL_2STEP)? 2: 1;
-	i = fd->ft->sectrac * fd->ft->heads;
+	i = fd->ft->sectrac * fd->ft->heads; //sectors per cyl
 	cylinder = bp->bio_pblkno / i;
 	descyl = cylinder * steptrac;
 	sec = bp->bio_pblkno % i;
@@ -928,6 +931,22 @@
 	 * Enhanced controllers do implied seeks for read&write as long as
 	 * we do not need multiple steps per track.
 	 */
+	 /* But if DD diskette in HD FDD then disable do implied seek */
+	if (fdc->fdct == FDC_ENHANCED) {
+	int imp_seek;
+	    if (fd->ft->flags & FL_2STEP) imp_seek = 0x00;
+	    else  imp_seek = 0x40;		    
+	    if (fdc_cmd(fdc, 4,
+		    I8207X_CONFIG,
+		    0,
+		    imp_seek |		/* Disable/Enable  Implied Seek */
+		    0x10 |			/* Polling disabled */
+		    (fifo_threshold - 1),	/* Fifo threshold */
+		    0x00,			/* Precomp track */
+		    0))
+			device_printf(fdc->fdc_dev,
+			    " CONFIGURE failed\n");
+		}
 	if (cylinder != fd->track && (
 	    fdc->fdct != FDC_ENHANCED ||
 	    descyl != cylinder ||
@@ -1229,7 +1248,9 @@
 	if (fdc_sense_int(fdc, &st0, &cyl) == FD_NOT_VALID)
 		goto done;	/* XXX */
 	*recal |= (1 << fd->fdsu);
-	if (fdin_rd(fdc) & FDI_DCHG) {
+	
+	if ((fdin_rd(fdc) & FDI_DCHG) &&
+	    !(device_get_flags(fd->dev) & FD_NO_CHLINE)) {
 		if (debugflags & 0x40)
 			printf("Empty in probe\n");
 		mtx_lock(&fdc->fdc_mtx);
@@ -1238,8 +1259,8 @@
 	} else {
 		if (fdc_sense_drive(fdc, &st3) != 0)
 			goto done;
-		if (debugflags & 0x40)
-			printf("Got disk in probe\n");
+//		if (debugflags & 0x40)
+//			printf("Got disk in probe\n");
 		mtx_lock(&fdc->fdc_mtx);
 		fd->flags &= ~FD_EMPTY;
 		if (st3 & NE7_ST3_WP)
@@ -1341,37 +1362,61 @@
 	 * Stepping to cylinder 2 has the side-effect of clearing the
 	 * unit attention bit.
 	 */
-	oopts = fd->options;
+	oopts = fd->options;	//Saving drive options
 	fd->options |= FDOPT_NOERRLOG | FDOPT_NORETRY;
-	for (; fdtp->heads; fdtp++) {
-		fdsettype(fd, fdtp);
+	for (; fdtp->heads; fdtp++) { //increment drive type from search list
+		fdsettype(fd, fdtp);  //set drive type
 
 		id.cyl = id.head = 0;
-		rv = fdmisccmd(fd, BIO_RDID, &id);
-		if (rv != 0)
-			continue;
-		if (id.cyl != 0 || id.head != 0 || id.secshift != fdtp->secsize)
+		rv = fdmisccmd(fd, BIO_RDID, &id);  //reading cyl0, head0
+		if (rv != 0)  //if error -> next iteration
 			continue;
+		if (id.cyl != 0 || id.head != 0 ||
+		    id.secshift != fdtp->secsize)
+			continue; //if unexpected type  -> next iteration
 		id.cyl = 2;
-		id.head = fd->ft->heads - 1;
+		id.head = fd->ft->heads - 1; //get max head number for
+					    // expected media type(0 or 1)
 		rv = fdmisccmd(fd, BIO_RDID, &id);
-		if (id.cyl != 2 || id.head != fdtp->heads - 1 ||
+		    if (id.cyl != 2 || id.head != fdtp->heads - 1 ||
 		    id.secshift != fdtp->secsize)
-			continue;
-		if (rv == 0)
+			continue; //if unexpected type  -> next iteration
+		if (rv == 0) //if no errors -> exit from cycle
 			break;
 	}
 
-	fd->options = oopts;
+    /* trying get sectors per track
+	searching max sector number */
+	int i ;
+	int spt = 0;
+	for (i=1; i <= fd->ft->sectrac; i++) {
+	id.cyl = id.head = 0;
+	rv = fdmisccmd(fd, BIO_RDID, &id);  //reading cyl0, head0
+	if (rv != 0)  //if error -> next iteration
+			continue;
+	if (id.sec > spt)
+		spt=id.sec;
+	    }
+	    if (debugflags & 0x40) {
+		if (spt == 0)
+		    device_printf(fd->dev, "No media in drive or media without format\n");
+		else		
+		    device_printf(fd->dev, "Sectors per track = %d\n", spt);
+		    }
+
+	fd->options = oopts;	//Restoring drive options
 	if (fdtp->heads == 0) {
 		if (debugflags & 0x40)
 			device_printf(fd->dev, "autoselection failed\n");
 		fdsettype(fd, fd_native_types[fd->type]);
 		return (-1);
 	} else {
+		fd->ft->sectrac = spt;
+		fd->ft->size = spt * fd->ft->heads * fd->ft->tracks ;
 		if (debugflags & 0x40) {
 			device_printf(fd->dev,
-			    "autoselected %d KB medium\n", fd->ft->size / 2);
+	    "autoselected %d KB medium\n",
+		(128 << fd->ft->secsize) * fd->ft->size / 1024 );
 			fdprinttype(fd->ft);
 		}
 		return (0);
@@ -1710,8 +1755,7 @@
 		break;
 	case 0x81:
 	case 0x90:
-		device_set_desc(dev,
-		    "Enhanced floppy controller");
+		device_set_desc(dev, "Enhanced floppy controller");
 		fdc->fdct = FDC_ENHANCED;
 		break;
 	default:


--- fdcio.h.org	2012-03-03 06:15:13.000000000 +0000
+++ fdcio.h	2012-01-17 21:23:37.000000000 +0000
@@ -181,46 +181,53 @@
  * XXX: should have been done 20 years ago to make sense.
  */
 #ifdef PC98
-#define FDF_3_1722 21,2,0xFF,0x04,82,0,2,2,0x0C,2,0,FL_MFM
-#define FDF_3_1476 18,2,0xFF,0x1B,82,0,2,2,0x54,1,0,FL_MFM
-#define FDF_3_1440 18,2,0xFF,0x1B,80,0,2,2,0x54,1,0,FL_MFM
-#define FDF_3_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM
-#define FDF_3_820  10,2,0xFF,0x10,82,0,1,2,0x30,1,0,FL_MFM
-#define FDF_3_800  10,2,0xFF,0x10,80,0,1,2,0x30,1,0,FL_MFM
-#define FDF_3_720   9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM
-#define FDF_3_360   9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP
-#define FDF_3_640   8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM
-#define FDF_3_1230  8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM
-#define FDF_3_1280  8,3,0xFF,0x35,80,0,0,2,0x74,1,0,FL_MFM
-#define FDF_3_1480  9,3,0xFF,0x35,82,0,0,2,0x47,1,0,FL_MFM
-#define FDF_3_1640 10,3,0xFF,0x1B,82,0,2,2,0x54,1,0,FL_MFM
-#define FDF_5_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM
-#define FDF_5_820  10,2,0xFF,0x10,82,0,1,2,0x30,1,0,FL_MFM
-#define FDF_5_800  10,2,0xFF,0x10,80,0,1,2,0x30,1,0,FL_MFM
-#define FDF_5_720   9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM
-#define FDF_5_360   9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP
-#define FDF_5_640   8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM
-#define FDF_5_1230  8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM
-#define FDF_5_1280  8,3,0xFF,0x35,80,0,0,2,0x74,1,0,FL_MFM
+#define FHD_3_1722 21,2,0xFF,0x04,82,0,2,2,0x0C,2,0,FL_MFM
+#define FHD_3_1476 18,2,0xFF,0x1B,82,0,2,2,0x54,1,0,FL_MFM
+#define FHD_3_1440 18,2,0xFF,0x1B,80,0,2,2,0x54,1,0,FL_MFM
+#define FHD_3_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM
+#define FHD_3_820  10,2,0xFF,0x10,82,0,1,2,0x30,1,0,FL_MFM
+#define FHD_3_800  10,2,0xFF,0x10,80,0,1,2,0x30,1,0,FL_MFM
+#define FHD_3_720   9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM
+#define FHD_3_360   9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP
+#define FHD_3_640   8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM
+#define FHD_3_1230  8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM
+#define FHD_3_1280  8,3,0xFF,0x35,80,0,0,2,0x74,1,0,FL_MFM
+#define FHD_3_1480  9,3,0xFF,0x35,82,0,0,2,0x47,1,0,FL_MFM
+#define FHD_3_1640 10,3,0xFF,0x1B,82,0,2,2,0x54,1,0,FL_MFM
+#define FHD_5_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM
+#define FHD_5_820  10,2,0xFF,0x10,82,0,1,2,0x30,1,0,FL_MFM
+#define FHD_5_800  10,2,0xFF,0x10,80,0,1,2,0x30,1,0,FL_MFM
+#define FHD_5_720   9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM
+#define FHD_5_360   9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP
+#define FHD_5_640   8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM
+#define FHD_5_1230  8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM
+#define FHD_5_1280  8,3,0xFF,0x35,80,0,0,2,0x74,1,0,FL_MFM
 #else /* PC98 */
-#define FDF_3_2880 36,2,0xFF,0x1B,80,0,FDC_1MBPS,002,0x4C,1,1,FL_MFM|FL_PERPND
-#define FDF_3_1722 21,2,0xFF,0x04,82,0,FDC_500KBPS,2,0x0C,2,0,FL_MFM
-#define FDF_3_1476 18,2,0xFF,0x1B,82,0,FDC_500KBPS,2,0x6C,1,0,FL_MFM
-#define FDF_3_1440 18,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x6C,1,0,FL_MFM
-#define FDF_3_1200 15,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x54,1,0,FL_MFM
-#define FDF_3_820  10,2,0xFF,0x10,82,0,FDC_250KBPS,2,0x2e,1,0,FL_MFM
-#define FDF_3_800  10,2,0xFF,0x10,80,0,FDC_250KBPS,2,0x2e,1,0,FL_MFM
-#define FDF_3_720   9,2,0xFF,0x20,80,0,FDC_250KBPS,2,0x50,1,0,FL_MFM
-#define FDF_5_1480 18,2,0xFF,0x02,82,0,FDC_500KBPS,2,0x02,2,0,FL_MFM 
-#define FDF_5_1440 18,2,0xFF,0x02,80,0,FDC_500KBPS,2,0x02,2,0,FL_MFM
-#define FDF_5_1230  8,3,0xFF,0x35,77,0,FDC_500KBPS,2,0x74,1,0,FL_MFM
-#define FDF_5_1200 15,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x54,1,0,FL_MFM
-#define FDF_5_820  10,2,0xFF,0x10,82,0,FDC_300KBPS,2,0x2e,1,0,FL_MFM
-#define FDF_5_800  10,2,0xFF,0x10,80,0,FDC_300KBPS,2,0x2e,1,0,FL_MFM
-#define FDF_5_720   9,2,0xFF,0x20,80,0,FDC_300KBPS,2,0x50,1,0,FL_MFM
-#define FDF_5_640   8,2,0xFF,0x2A,80,0,FDC_300KBPS,2,0x50,1,0,FL_MFM
-#define FDF_5_360   9,2,0xFF,0x23,40,0,FDC_300KBPS,2,0x50,1,0,FL_MFM
-/* XXX:                      0x2a ? */
+
+	    /* HD floppy drive */
+#define FHD_3_2880 36,2,0xFF,0x1B,80,0,FDC_1MBPS,002,0x4C,1,1,FL_MFM|FL_PERPND
+#define FHD_3_1722 21,2,0xFF,0x04,82,0,FDC_500KBPS,2,0x0C,2,0,FL_MFM
+#define FHD_3_1476 18,2,0xFF,0x1B,82,0,FDC_500KBPS,2,0x6C,1,0,FL_MFM
+#define FHD_3_1440 18,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x6C,1,0,FL_MFM
+#define FHD_3_1200 15,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x54,1,0,FL_MFM
+#define FHD_3_820  10,2,0xFF,0x10,82,0,FDC_250KBPS,2,0x2e,1,0,FL_MFM
+#define FHD_3_800  10,2,0xFF,0x10,80,0,FDC_250KBPS,2,0x2e,1,0,FL_MFM
+#define FHD_3_720   9,2,0xFF,0x20,80,0,FDC_250KBPS,2,0x50,1,0,FL_MFM
+#define FHD_5_1480 18,2,0xFF,0x02,82,0,FDC_500KBPS,2,0x02,2,0,FL_MFM 
+#define FHD_5_1440 18,2,0xFF,0x02,80,0,FDC_500KBPS,2,0x02,2,0,FL_MFM
+#define FHD_5_1230  8,3,0xFF,0x35,77,0,FDC_500KBPS,2,0x74,1,0,FL_MFM
+#define FHD_5_1200 15,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x54,1,0,FL_MFM
+#define FHD_5_820  10,2,0xFF,0x10,82,0,FDC_300KBPS,2,0x2e,1,0,FL_MFM
+#define FHD_5_800  10,2,0xFF,0x10,80,0,FDC_300KBPS,2,0x2e,1,0,FL_MFM
+#define FHD_5_720   9,2,0xFF,0x20,80,0,FDC_300KBPS,2,0x50,1,0,FL_MFM
+#define FHD_5_640   8,2,0xFF,0x2A,80,0,FDC_300KBPS,2,0x50,1,0,FL_MFM
+#define FHD_5_360   9,2,0xFF,0x23,40,0,FDC_300KBPS,2,0x50,1,0,FL_MFM|FL_2STEP
+#define FHD_5_180   9,2,0xFF,0x23,40,0,FDC_300KBPS,1,0x50,1,0,FL_MFM|FL_2STEP
+	    /* DD floppy drive */
+#define FDD_5_360   9,2,0xFF,0x2A,40,0,FDC_250KBPS,2,0x50,1,0,FL_MFM
+#define FDD_5_180   9,2,0xFF,0x2A,40,0,FDC_250KBPS,1,0x50,1,0,FL_MFM
+#define FDD_5_320   8,2,0xFF,0x2A,40,0,FDC_250KBPS,2,0x50,1,0,FL_MFM
+#define FDD_5_160   8,2,0xFF,0x2A,40,0,FDC_250KBPS,1,0x50,1,0,FL_MFM
 #endif
 
 #endif /* !_MACHINE_IOCTL_FD_H_ */


--- fdcontrol.c.org	2012-03-03 06:15:13.000000000 +0000
+++ fdcontrol.c	2013-01-23 22:41:34.000000000 +0000
@@ -41,7 +41,7 @@
 #include "fdutil.h"
 
 
-static	int format, verbose, show = 1, showfmt;
+static	int format = 0, verbose =0 , show = 1, showfmt = 0;
 static	char *fmtstring;
 
 static void showdev(enum fd_drivetype, const char *);
@@ -51,7 +51,7 @@
 usage(void)
 {
 	errx(EX_USAGE,
-	     "usage: fdcontrol [-F] [-d dbg] [-f fmt] [-s fmtstr] [-v] device");
+	     "usage: fdcontrol [-F] [-f fmt] [-s fmtstr] [-v] device");
 }
 
 void
@@ -72,14 +72,11 @@
 	enum fd_drivetype type;
 	struct fd_type ft, newft, *fdtp;
 	const char *name, *descr;
-	int fd, i, autofmt;
+	int fd, i;
 
-	autofmt = 0;
-	while((i = getopt(argc, argv, "aFf:s:v")) != -1)
+	while((i = getopt(argc, argv, "Ff:s:v")) != -1)
 		switch(i) {
 
-		case 'a':
-			autofmt = 1;
 		case 'F':
 			showfmt = 1;
 			show = 0;
@@ -121,19 +118,12 @@
 
 	if (ioctl(fd, FD_GDTYPE, &type) == -1)
 		err(EX_OSERR, "ioctl(FD_GDTYPE)");
-	if (ioctl(fd, FD_GTYPE, &ft) == -1)
-		err(EX_OSERR, "ioctl(FD_GTYPE)");
-
+	
 	if (show) {
 		showdev(type, argv[0]);
 		return (0);
 	}
 
-	if (autofmt) {
-		memset(&newft, 0, sizeof newft);
-		ft = newft;
-	}
-
 	if (format) {
 		getname(type, &name, &descr);
 		fdtp = get_fmt(format, type);
@@ -149,6 +139,14 @@
 		ft = newft;
 	}
 
+	if (format || fmtstring) {
+		if (ioctl(fd, FD_STYPE, &ft) == -1)
+			err(EX_OSERR, "ioctl(FD_STYPE)");
+	}
+
+	if (ioctl(fd, FD_GTYPE, &ft) == -1)
+		err(EX_OSERR, "ioctl(FD_GTYPE)");
+
 	if (showfmt) {
 		if (verbose) {
 			const char *s;
@@ -159,7 +157,7 @@
 			print_fmt(ft);
 			if (ft.datalen != 0xff &&
 			    ft.datalen != (128 << ft.secsize))
-				printf("\tData length:\t%d\n", ft.datalen);
+				printf("\tData length:\t0x%x\n", ft.datalen);
 			printf("\tSector size:\t%d\n", 128 << ft.secsize);
 			printf("\tSectors/track:\t%d\n", ft.sectrac);
 			printf("\tHeads/cylinder:\t%d\n", ft.heads);
@@ -170,8 +168,8 @@
 			case 2: printf("\tTransfer rate:\t250 kbps\n"); break;
 			case 3: printf("\tTransfer rate:\t1 Mbps\n"); break;
 			}
-			printf("\tSector gap:\t%d\n", ft.gap);
-			printf("\tFormat gap:\t%d\n", ft.f_gap);
+			printf("\tSector gap:\t0x%x\n", ft.gap);
+			printf("\tFormat gap:\t0x%x\n", ft.f_gap);
 			printf("\tInterleave:\t%d\n", ft.f_inter);
 			printf("\tSide offset:\t%d\n", ft.offset_side2);
 			printf("\tFlags\t\t<");
@@ -196,14 +194,7 @@
 		} else {
 			print_fmt(ft);
 		}
-		return (0);
-	}
-
-	if (format || fmtstring) {
-		if (ioctl(fd, FD_STYPE, &ft) == -1)
-			err(EX_OSERR, "ioctl(FD_STYPE)");
-		return (0);
 	}
 
-	return 0;
+	return (close(fd));
 }


--- fdcontrol.8.org	2012-03-03 06:15:13.000000000 +0000
+++ fdcontrol.8	2013-01-20 20:33:45.000000000 +0000
@@ -34,7 +34,6 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl F
-.Op Fl d Ar dbg
 .Op Fl f Ar fmt
 .Op Fl s Ar fmtstr
 .Op Fl v
@@ -93,30 +92,6 @@
 .Fl v ,
 some more text will be returned, including the total capacity of the
 density settings in kilobytes.
-.Ss Debug Control
-If the
-.Xr fdc 4
-driver was configured with the
-.Dv FDC_DEBUG
-option, by default, device debugging information is still disabled
-since it could produce huge amounts of kernel messages.
-It needs to
-be turned on using
-.Nm
-together with
-.Dq Fl d Li 1 ,
-usually immediately before starting an operation on the respective
-device the debug information is wanted for, and later turned off again
-using
-.Dq Fl d Li 0 .
-Note that debugging levels are a driver's global option that will
-affect any drives and controllers using the
-.Xr fdc 4
-driver, regardless which
-.Ar device
-was specified on the
-.Nm
-command line.
 .Ss Density Control
 The
 .Xr fdc 4
@@ -206,8 +181,9 @@
 .It Ar sectrac
 The number of sectors per track.
 .It Ar secsize
-The sector size code, 0 = 128 bytes (or less), 1 = 256 bytes, 2 = 512
-bytes, 3 = 1024 bytes.
+The sector size in bytes. Previously was sector size code:
+ 0 = 128 bytes (or less), 1 = 256 bytes, 2 = 512 bytes,
+ 3 = 1024 bytes.
 .It Ar datalen
 The actual sector size if the size code is 0, or the (ignored) value
 0xFF for larger size codes.


--- fdformat.c.org	2012-03-03 06:15:13.000000000 +0000
+++ fdformat.c	2013-01-20 10:21:27.000000000 +0000
@@ -112,27 +112,7 @@
 usage (void)
 {
 	errx(EX_USAGE,
-	     "usage: fdformat [-F fill] [-f fmt] [-s fmtstr] [-nqvy] device");
-}
-
-static int
-yes (void)
-{
-	char reply[256], *p;
-
-	reply[sizeof(reply) - 1] = 0;
-	for (;;) {
-		fflush(stdout);
-		if (!fgets (reply, sizeof(reply) - 1, stdin))
-			return (0);
-		for (p=reply; *p==' ' || *p=='\t'; ++p)
-			continue;
-		if (*p=='y' || *p=='Y')
-			return (1);
-		if (*p=='n' || *p=='N' || *p=='\n' || *p=='\r')
-			return (0);
-		printf("Answer `yes' or `no': ");
-	}
+	     "usage: fdformat [-F fill] [-f fmt] [-s fmtstr] [-nqv] device");
 }
 
 int
@@ -191,10 +171,6 @@
 			verify_only = 1;
 			break;
 
-		case 'y':	/* confirm */
-			confirm = 1;
-			break;
-
 		default:
 			usage();
 		}
@@ -281,16 +257,7 @@
 				fdt.tracks * fdt.heads * bytes_per_track / 1024,
 				device);
 	}
-	else if(!quiet && !confirm) {
-		printf("Format %dK floppy `%s'? (y/n): ",
-			fdt.tracks * fdt.heads * bytes_per_track / 1024,
-			device);
-		if(!yes()) {
-			printf("Not confirmed.\n");
-			return (EX_UNAVAILABLE);
-		}
-	}
-
+	
 	/*
 	 * Formatting.
 	 */


--- fdformat.1.org	2012-03-03 06:15:13.000000000 +0000
+++ fdformat.1	2013-01-20 10:32:30.000000000 +0000
@@ -35,7 +35,7 @@
 .Op Fl F Ar fill
 .Op Fl f Ar fmt
 .Op Fl s Ar fmtstr
-.Op Fl nqvy
+.Op Fl nqv
 .Ar device
 .Sh DESCRIPTION
 The
@@ -84,9 +84,6 @@
 .Ar device .
 .It Fl v
 Do not format, verify only.
-.It Fl y
-Do not ask for confirmation whether to format the floppy disk but
-still report formatting status.
 .El
 .Pp
 For non-autoselecting subdevices, neither


--- fdutil.c.org	2012-03-03 06:15:13.000000000 +0000
+++ fdutil.c	2013-01-22 22:42:21.000000000 +0000
@@ -90,93 +90,97 @@
 static struct fd_type fd_types_auto[1] =
     { { 0,0,0,0,0,0,0,0,0,0,0,FL_AUTO } };
 
-
 static struct fd_type fd_types_288m[] = {
 #if 0
-	{ FDF_3_2880 },
+	{ FHD_3_2880 },
 #endif
-	{ FDF_3_1722 },
-	{ FDF_3_1476 },
-	{ FDF_3_1440 },
-	{ FDF_3_1200 },
-	{ FDF_3_820 },
-	{ FDF_3_800 },
-	{ FDF_3_720 },
+	{ FHD_3_1722 },
+	{ FHD_3_1476 },
+	{ FHD_3_1440 },
+	{ FHD_3_1200 },
+	{ FHD_3_820 },
+	{ FHD_3_800 },
+	{ FHD_3_720 },
 	{ 0,0,0,0,0,0,0,0,0,0,0,0 }
 };
 
 static struct fd_type fd_types_144m[] = {
 #ifdef PC98
 #if 0
-	{ FDF_3_1722 },
-	{ FDF_3_1476 },
+	{ FHD_3_1722 },
+	{ FHD_3_1476 },
 #endif
-	{ FDF_3_1440 },
-	{ FDF_3_1200 },
+	{ FHD_3_1440 },
+	{ FHD_3_1200 },
 #if 0
-	{ FDF_3_820 },
-	{ FDF_3_800 },
+	{ FHD_3_820 },
+	{ FHD_3_800 },
 #endif
-	{ FDF_3_720 },
-	{ FDF_3_360 },
-	{ FDF_3_640 },
-	{ FDF_3_1230 },
+	{ FHD_3_720 },
+	{ FHD_3_360 },
+	{ FHD_3_640 },
+	{ FHD_3_1230 },
 #if 0
-	{ FDF_3_1280 },
-	{ FDF_3_1480 },
-	{ FDF_3_1640 },
+	{ FHD_3_1280 },
+	{ FHD_3_1480 },
+	{ FHD_3_1640 },
 #endif
 	{ 0,0,0,0,0,0,0,0,0,0,0,0 }
+//end of PC98
 #else
-	{ FDF_3_1722 },
-	{ FDF_3_1476 },
-	{ FDF_3_1440 },
-	{ FDF_3_1200 },
-	{ FDF_3_820 },
-	{ FDF_3_800 },
-	{ FDF_3_720 },
+	{ FHD_3_1722 },
+	{ FHD_3_1476 },
+	{ FHD_3_1440 },
+	{ FHD_3_1200 },
+	{ FHD_3_820 },
+	{ FHD_3_800 },
+	{ FHD_3_720 },
 	{ 0,0,0,0,0,0,0,0,0,0,0,0 }
 #endif
 };
 
 static struct fd_type fd_types_12m[] = {
 #ifdef PC98
-	{ FDF_5_1200 },
+	{ FHD_5_1200 },
 #if 0
-	{ FDF_5_820 },
-	{ FDF_5_800 },
+	{ FHD_5_820 },
+	{ FHD_5_800 },
 #endif
-	{ FDF_5_720 },
-	{ FDF_5_360 },
-	{ FDF_5_640 },
-	{ FDF_5_1230 },
+	{ FHD_5_720 },
+	{ FHD_5_360 },
+	{ FHD_5_640 },
+	{ FHD_5_1230 },
 #if 0
-	{ FDF_5_1280 },
+	{ FHD_5_1280 },
 #endif
 	{ 0,0,0,0,0,0,0,0,0,0,0,0 }
+//end of PC98
 #else
-	{ FDF_5_1200 },
-	{ FDF_5_1230 },
-	{ FDF_5_1480 },
-	{ FDF_5_1440 },
-	{ FDF_5_820 },
-	{ FDF_5_800 },
-	{ FDF_5_720 },
-	{ FDF_5_360 | FL_2STEP },
-	{ FDF_5_640 },
+	{ FHD_5_1200 },
+	{ FHD_5_1230 },
+	{ FHD_5_1480 },
+	{ FHD_5_1440 },
+	{ FHD_5_820 },
+	{ FHD_5_800 },
+	{ FHD_5_720 },
+	{ FHD_5_360 | FL_2STEP },
+	{ FHD_5_640 },
 	{ 0,0,0,0,0,0,0,0,0,0,0,0 }
 #endif
 };
 
 static struct fd_type fd_types_720k[] =
 {
-	{ FDF_3_720 },
+	{ FHD_3_720 },
 	{ 0,0,0,0,0,0,0,0,0,0,0,0 }
 };
 
 static struct fd_type fd_types_360k[] =
 {
-	{ FDF_5_360 },
+	{ FDD_5_360 },
+	{ FDD_5_180 },
+	{ FDD_5_320 },
+	{ FDD_5_160 },
 	{ 0,0,0,0,0,0,0,0,0,0,0,0 }
 };
 



More information about the freebsd-i386 mailing list