[comp.os.minix] floppy.c mods for 720k

bdale@winfree.UUCP (03/22/87)

As I mentioned previously, a friend and I got Minix moved to 3.5 disks and
have been playing with it on my Toshiba T1100+ and his Zenith 181.  The
original method was to sort of diskcopy the 360k distribution disks onto
the first half of 720k floppies...

The following is a diff of the changes I made to kernel/floppy.c to support
720k disks in 720k drives.  No promises, but it seems to be working on my
Toshiba.  The only gotcha is that if you have Minix up and want to do a
mkfs of a 720k floppy, the invocation seems to need to be:
	  mkfs /dev/at1 720
as it complains that 720k is too big for the minor device when you try to
do it with /dev/fd1.  Once the fs is made, it doesn't seem to matter.  This
may just be due to it assuming 360k, I haven't thought it all through yet.


*** floppy.c.dist	Sat Mar 21 10:01:06 1987
--- floppy.c	Sat Mar 21 21:11:24 1987
***************
*** 15,20 ****
--- 15,21 ----
   *   floppy_task:	main entry when system is brought up
   *
   *  Changes:
+  *      870321 Bdale  add table entry for 720k drives, up max drives to 4
   *	27 october 1986 by Jakob Schripsema: fdc_results fixed for 8 MHz
   */
  
***************
*** 102,111 ****
  #define MOTOR_RUNNING   0xFF	/* message type for clock interrupt */
  #define MAX_ERRORS        20	/* how often to try rd/wt before quitting */
  #define MAX_RESULTS        8	/* max number of bytes controller returns */
! #define NR_DRIVES          2	/* maximum number of drives */
  #define DIVISOR          128	/* used for sector size encoding */
  #define MAX_FDC_RETRY    100	/* max # times to try to output to FDC */
! #define NT                 4	/* number of diskette/drive combinations */
  
  /* Variables. */
  PRIVATE struct floppy {		/* main drive struct, one entry per drive */
--- 103,112 ----
  #define MOTOR_RUNNING   0xFF	/* message type for clock interrupt */
  #define MAX_ERRORS        20	/* how often to try rd/wt before quitting */
  #define MAX_RESULTS        8	/* max number of bytes controller returns */
! #define NR_DRIVES          4	/* maximum number of drives */
  #define DIVISOR          128	/* used for sector size encoding */
  #define MAX_FDC_RETRY    100	/* max # times to try to output to FDC */
! #define NT                 5	/* number of diskette/drive combinations */
  
  /* Variables. */
  PRIVATE struct floppy {		/* main drive struct, one entry per drive */
***************
*** 141,156 ****
! /* Four combinations of diskette/drive are supported:
   * # Drive  diskette  Sectors  Tracks  Rotation Data-rate  Comment
   * 0  360K    360K      9       40     300 RPM  250 kbps   Standard PC DSDD
!  * 1  720K    360K      9       40     300 RPM  250 kbps   Quad density PC
!  * 2  1.2M    360K      9       40     360 RPM  300 kbps   PC disk in AT drive
!  * 3  1.2M    1.2M     15       80     360 RPM  500 kbps   AT disk in AT drive
   */
! PRIVATE int gap[NT]           = {0x2A, 0x2A, 0x23, 0x1B}; /* gap size */
! PRIVATE int rate[NT]          = {0x02, 0x02, 0x01, 0x00}; /* 250,300,500 kbps*/
! PRIVATE int nr_sectors[NT]    = {9,    9,    9,    15};   /* sectors/track */
! PRIVATE int nr_blocks[NT]     = {720,  720,  720,  2400}; /* sectors/diskette*/
! PRIVATE int steps_per_cyl[NT] = {1,    2,    2,    1};	  /* 2 = dbl step */
! PRIVATE int mtr_setup[NT]     = {HZ/4,HZ/4,3*HZ/4,3*HZ/4};/* in ticks */
  
  /*===========================================================================*
   *				floppy_task				     * 
--- 142,164 ----
! /* Five combinations of diskette/drive are supported:
   * # Drive  diskette  Sectors  Tracks  Rotation Data-rate  Comment
   * 0  360K    360K      9       40     300 RPM  250 kbps   Standard PC DSDD
!  * 1  720K    360K      9       40     300 RPM  250 kbps   80trk drv, PC disk
!  * 2  720K    720K      9       80     300 RPM  250 kbps   80trk drv, 720k disk
!  * 3  1.2M    360K      9       40     360 RPM  300 kbps   PC disk in AT drive
!  * 4  1.2M    1.2M     15       80     360 RPM  500 kbps   AT disk in AT drive
   */
! PRIVATE int gap[NT] = 
!         {0x2A, 0x2A, 0x2A, 0x23, 0x1B}; /* gap size */
! PRIVATE int rate[NT] = 
!         {0x02, 0x02, 0x02, 0x01, 0x00}; /* 250,300,500 kbps*/
! PRIVATE int nr_sectors[NT] = 
!         {9,    9,    9,    9,    15};   /* sectors/track */
! PRIVATE int nr_blocks[NT] = 
!         {720,  720,  1440, 720,  2400}; /* sectors/diskette*/
! PRIVATE int steps_per_cyl[NT] = 
!         {1,    2,    1,    2,    1};	  /* 2 = dbl step */
! PRIVATE int mtr_setup[NT] = 
!         {HZ/4, HZ/4, HZ/4, 3*HZ/4,3*HZ/4};/* in ticks */
  
  /*===========================================================================*
   *				floppy_task				     * 
-- 

Bdale Garbee, N3EUA		phone: 303/593-9828 h, 303/590-2868 w
uucp: {bellcore,crash,hp-lsd,hpcsma,ncc,pitt,usafa,vixie}!winfree!bdale
fido: sysop of 128/19		packet: n3eua @ k0hoa, Colorado Springs