From: dxper@dtek.chalmers.se (Per Anders Olausson)
Newsgroups: comp.unix.bsd
Subject: 386BSD:  720Kb floppy driver + mtools patches
Keywords: 386bsd floppy 720kb
Date: 29 Aug 92 17:20:08 GMT
Organization: Chalmers University of Technology, Gothenburg Sweden


  Since people seem to like the idea of putting 720kb floppy disks into 1.44Mb
drives and I myself had need for it I went through the floppy driver and 
uncommented all the floppy type code which was already there + added an entry
for 720kb floppies. This works for me and hopefully for all you netpeople out
there but I'm naturally wondering why it was all commented. Hmmmm . . .

  I also changed the device specification to mtools so that it uses the
correct device names. I didn't remove the 320kb entry in mtools however, even
though there is no support for it in the device driver.

After you have recompiled the kernel and mtools all you need to do is:

	$ cd /dev
	$ MAKEDEV fd0
	$ MAKEDEV fd1

if you haven't patched the kernel to support #! stuff you have to run 

	$ sh MAKEDEV fd0

instead.

  Now back to our favorite What's-the-name-of-the-group-flame-contest...

pao

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	fd.patch
#	mtools.patch
#
echo x - fd.patch
sed 's/^X//' >fd.patch << 'END-of-fd.patch'
X*** fd.c.orig	Sat Aug 29 18:22:39 1992
X--- fd.c	Sat Aug 29 18:24:56 1992
X***************
X*** 60,66 ****
X  #define b_cylin b_resid
X  #define b_step b_resid
X  #define FDBLK 512
X! #define NUMTYPES 4
X  
X  struct fd_type {
X  	int	sectrac;		/* sectors per track         */
X--- 60,66 ----
X  #define b_cylin b_resid
X  #define b_step b_resid
X  #define FDBLK 512
X! #define NUMTYPES 5
X  
X  struct fd_type {
X  	int	sectrac;		/* sectors per track         */
X***************
X*** 76,81 ****
X--- 76,82 ----
X  struct fd_type fd_types[NUMTYPES] = {
X   	{ 18,2,0xFF,0x1B,80,2880,1,0 },	/* 1.44 meg HD 3.5in floppy    */
X  	{ 15,2,0xFF,0x1B,80,2400,1,0 },	/* 1.2 meg HD floppy           */
X+ 	{ 9,2,0xFF,0x20,80,1440,1,2  }, /* 720k floppy in HD drive     */
X  	{ 9,2,0xFF,0x23,40,720,2,1 },	/* 360k floppy in 1.2meg drive */
X  	{ 9,2,0xFF,0x2A,40,720,1,1 },	/* 360k floppy in DD drive     */
X  };
X***************
X*** 211,218 ****
X   	int	unit, type, s;
X  
X   	unit = FDUNIT(minor(bp->b_dev));
X!  	/*type = FDTYPE(minor(bp->b_dev));*/
X! 	type = fd_unit[unit].type;
X  
X  #ifdef FDTEST
X  printf("fdstrat%d, blk = %d, bcount = %d, addr = %x|",
X--- 212,219 ----
X   	int	unit, type, s;
X  
X   	unit = FDUNIT(minor(bp->b_dev));
X!  	type = FDTYPE(minor(bp->b_dev));
X! 	/*type = fd_unit[unit].type;*/
X  
X  #ifdef FDTEST
X  printf("fdstrat%d, blk = %d, bcount = %d, addr = %x|",
X***************
X*** 281,288 ****
X  int unit;
X  {
X  	fd_unit[unit].motor = 0;
X! 	if (unit) set_motor(0,0);
X! 	else set_motor(1,0);
X  }
X  
X  fd_turnon(unit)
X--- 282,288 ----
X  int unit;
X  {
X  	fd_unit[unit].motor = 0;
X! 	set_motor(unit,0);
X  }
X  
X  fd_turnon(unit)
X***************
X*** 327,339 ****
X  	int	flags;
X  {
X   	int unit = FDUNIT(minor(dev));
X!  	/*int type = FDTYPE(minor(dev));*/
X  	int s;
X  
X  	fdopenf = 1;
X  	/* check bounds */
X  	if (unit >= NFD) return(ENXIO);
X! 	/*if (type >= NUMTYPES) return(ENXIO);*/
X  
X  	/* Set proper disk type, only allow one type */
X  	return 0;
X--- 327,339 ----
X  	int	flags;
X  {
X   	int unit = FDUNIT(minor(dev));
X!  	int type = FDTYPE(minor(dev));
X  	int s;
X  
X  	fdopenf = 1;
X  	/* check bounds */
X  	if (unit >= NFD) return(ENXIO);
X! 	if (type >= NUMTYPES) return(ENXIO);
X  
X  	/* Set proper disk type, only allow one type */
X  	return 0;
X***************
X*** 442,449 ****
X  	dp = &fd_unit[fd_drive].head;
X  	bp = dp->b_actf;
X  	read = bp->b_flags & B_READ;
X!  	/*ft = &fd_types[FDTYPE(bp->b_dev)];*/
X!  	ft = &fd_types[fd_unit[fd_drive].type];
X  
X  	switch (fd_state) {
X  	case 1 : /* SEEK DONE, START DMA */
X--- 442,449 ----
X  	dp = &fd_unit[fd_drive].head;
X  	bp = dp->b_actf;
X  	read = bp->b_flags & B_READ;
X!  	ft = &fd_types[FDTYPE(bp->b_dev)];
X!  	/*ft = &fd_types[fd_unit[fd_drive].type];*/
X  
X  	switch (fd_state) {
X  	case 1 : /* SEEK DONE, START DMA */
END-of-fd.patch
echo x - mtools.patch
sed 's/^X//' >mtools.patch << 'END-of-mtools.patch'
X*** devices.c.0_1	Sat Jun 27 23:05:01 1992
X--- devices.c	Sat Aug 29 18:59:22 1992
X***************
X*** 20,34 ****
X  #ifdef __386BSD__
X  struct device devices[] = {
X  	{'A', "/dev/rfd0a", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, /* 1.44m */
X! 	{'A', "/dev/rfd0a", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, /* 1.2m */
X! 	{'A', "/dev/rfd0a", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},  /* 720k */
X! 	{'A', "/dev/rfd0a", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},  /* 360k */
X! 	{'A', "/dev/rfd0a", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},  /* 320k */
X  	{'B', "/dev/rfd1a", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, /* 1.44m */
X! 	{'B', "/dev/rfd1a", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, /* 1.2m */
X! 	{'B', "/dev/rfd1a", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},  /* 720k */
X! 	{'B', "/dev/rfd1a", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},  /* 360k */
X! 	{'B', "/dev/rfd1a", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},  /* 320k */
X  	{'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
X  };
X  #endif /* __386BSD__ */
X--- 20,36 ----
X  #ifdef __386BSD__
X  struct device devices[] = {
X  	{'A', "/dev/rfd0a", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, /* 1.44m */
X! 	{'A', "/dev/rfd0b", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, /* 1.2m */
X! 	{'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},  /* 720k */
X! 	{'A', "/dev/rfd0d", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},  /* 360k */
X! 	{'A', "/dev/rfd0e", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},  /* 360k */
X! 	{'A', "/dev/rfd0f", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},  /* 320k */
X  	{'B', "/dev/rfd1a", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, /* 1.44m */
X! 	{'B', "/dev/rfd1b", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, /* 1.2m */
X! 	{'B', "/dev/rfd1c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},  /* 720k */
X! 	{'B', "/dev/rfd1d", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},  /* 360k */
X! 	{'B', "/dev/rfd1e", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},  /* 360k */
X! 	{'B', "/dev/rfd1f", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},  /* 320k */
X  	{'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
X  };
X  #endif /* __386BSD__ */
END-of-mtools.patch
exit

--
-------------------------------Andrew Olausson--------------------------------
--------------------------Unemployed Unix Specialist--------------------------
------------------------------pao@cd.chalmers.se------------------------------
-------------------------------pa-ola@proxxi.se-------------------------------
Newsgroups: comp.unix.bsd