[comp.os.minix] Problem with two drives on autoconfigure XT wini *fixed*

overby@plains.UUCP (Glen Overby) (12/29/89)

I have discovered a problem in running two drives using xt_wini with the
auto-configure option (for Western Digital "Autoconfigure", "SuperBios" and
"GEN-2" ROMs/controlers).  The problem is that the device driver does not
read the geometry information from the second drive; instead, it reads the
first drive twice.

Western Digital stores their disk geometry information in the 17 bytes
preceding the partition table.  Since this is in sector zero of head zero of
track zero (the boot block), it can always be read regardless of the drive.
This area contains a 16-byte table just like the ones in ROM, plus another
byte that their ROM does strange things with when configuring the drive (I
haven't figured it out yet, but mine are always 1).  I really like how WD
stored the drive parameters on the drive.  Thats the way it should have been
done in the first place -- ROM tables will simply never fit every type of
drive.  My only gripe is that they don't document it!

The symptoms showed up when I was unable to access more cylinders on my
second drive than on my first (I have 306 and 613 cylinders on drives 0 and
1, respectively).  I added some printfs of the param0 and param1 structures,
and even a hex dump of the autoconfigure area of the boot sector, and the
problem became fairly obvious.

This problem does not exist in the any other drivers since the XT driver is
the only one that has an WD-compatable auto-configure option.

The fix is a very simple one: set the drive number to 1 when reading the
configuration sector from drive 1.  Here is my 1-line fix, relative to 1.5.0:

*** xt_wini.c.orig	Tue Dec 26 14:09:40 1989
--- xt_wini.c	Thu Dec 28 12:00:39 1989
***************
*** 682,687 ****
--- 682,688 ----
  	wini[DEV_PER_DRIVE].wn_low = wini[0].wn_low = 0L;
  	wini[DEV_PER_DRIVE].wn_size = wini[0].wn_size
  		   = (long)AUTO_CYLS * (long)AUTO_HEADS * (long)NR_SECTORS;
+ 	wini[DEV_PER_DRIVE].wn_drive = 1 << 5;	/* Set drive number */
  	cim_xt_wini();		/* ready for XT wini interrupts */
  	if(w_reset() != OK)
  	  panic("cannot setup for reading winchester parameter tables",0);

-- 
		Glen Overby	<overby@plains.nodak.edu>
	uunet!plains!overby (UUCP)  ncoverby@ndsuvax, overby@plains (Bitnet)