[comp.os.minix] fix for xt_wini with WD controllers

bwilson@portia.Stanford.EDU (Robert Wilson) (10/17/90)

Within the last few weeks, I've noticed several postings related to
problems with the xt_wini.c driver in v1.2 and v1.3 when using
Western Digital controllers.  Some of the symptoms include being able
to access only the first 10 MB of 20 MB disks.  Trying to access the
rest of the disk results in errors from the FS.  I've had similar
problems with my WD controller and recently discovered the source of
the problem.  I've mailed the fix to several people, but judging
from the other recent postings, it's probably worth posting for
everyone.

Apparently, most rom-table (non autoconfig) HD controllers use DIP
switches to select the drive type.  The standard IBM controller has two
switches to select from four possible drive types.  Some WD controllers
also use two switches; others use three.  (Glen Overby recently posted
a driver that will handle WD controllers with three switches.)  Still
other WD controllers use jumpers to select the drive type.  Mine has
four jumper positions for each drive (total of eight).  A jumper is
placed in one of the four positions to select the drive type.  If your
controller uses jumpers, the standard xt_wini driver will get confused
and use the wrong drive type.  In many cases, this means it thinks
your drive is only 10 MB when it's really 20 MB.  In other cases, it
may not work at all.  If you think you may be experiencing this
problem, look for the DIP switches or jumpers on your controller board.
If you have switches, then you're dealing with something else.

The fix is fairly simple.  I haven't included a patch file, since I no
longer have source for v1.3.  There's little point in posting a diff
against v1.5 since anyone with v1.5 can just use the bios_wini driver.
Hopefully, it will not be difficult to determine where to modify the
code in xt_wini.c....

First, I defined a new flag, WINI_JUMPERS, in include/minix/config.h.
You can just define this in the compile command if you like.  Set it
to 1 if your controller uses jumpers or 0 otherwise.

Next, in xt_wini.c find the code where type_0 and type_1 are set in
the initialization routine:

   type_0 = i & 3;
   type_1 = (i >> 2) & 3;

Replace this with:

 #if WINI_JUMPERS
   type_0 = find_type(i & 0x0f);
   type_1 = find_type((i & 0xf0) >> 4);
 #else
   type_0 = i & 3;
   type_1 = (i >> 2) & 3;
 #endif

Finally, add the following function to xt_wini.c (you'll also need to
add a declaration for it e.g. FORWARD int find_type(); ):
 
 #if WINI_JUMPERS
 /*==========================================================================*
  *				find_type				     *
  *==========================================================================*/
 PRIVATE int find_type(jmpr)
 unsigned int jmpr;
 {
   int i;
 
   for (i=0; i < 4; i++) {
 	if (!(jmpr & (1 << i))) return i;
   }
   return 0;
 }
 #endif

Hopefully, this will be included in future versions of xt_wini.c.
I don't know anything about the details of disk drivers other than
what I've described here, but I'd be glad to help anyone who needs
help applying these fixes.  Good luck!

Bob Wilson  (bwilson@shasta.stanford.edu)

bwilson@portia.Stanford.EDU (Robert Wilson) (10/27/90)

I recently posted a fix for xt_wini.c to allow it to work with some
Western Digital controllers that use jumpers instead of switches to
select the drive type.  At Andy's request, here are the patches to
1.5.  If you have an XT-type Western Digital controller that does
not work with the xt_wini driver, please try this fix and let me
know what happens.  The two files to be patched are:
	include/minix/config.h
	kernel/xt_wini.c
(Use uud to decode the file; use sh to unshar it; then use patch to
update the source files).  Good luck.

Bob Wilson (bwilson@shasta.stanford.edu)

--------------------------------------------------------------
table
 !"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
begin 644 xt_wini.sh
M96-H;R!X("T@8V]N9FEG+F-D:68*<V5D("<O7E@O<R\O+R<@/B!C;VYF:6<Nz
M8V1I9B \/" G+R<*6"HJ*B!C;VYF:6<N;W)I9PE3=6X@4V5P(#,P(#$U.C0Wy
M.C(U(#$Y.3 *6"TM+2!C;VYF:6<N: E4:'4@3V-T(#(U(#$R.C$S.C(U(#$Yx
M.3 *6"HJ*BHJ*BHJ*BHJ*BHJ*@I8*BHJ(#0Q+#0V("HJ*BH*6"TM+2 T,2PTw
M-R M+2TM"E@@( I8(" O*B!$969I;F5S(&9O<B!K97)N96P@8V]N9FEG=7)Av
M=&EO;BX@*B\*6" @(V1E9FEN92!!551/7T))3U,@(" @(" @(" @, DO*B!Xu
M=%]W:6YI+F,@+2!U<V4@5V5S=&5R;B=S(&%U=&]C;VYF:6<@0DE/4R J+PI8t
M*R C9&5F:6YE(%=)3DE?2E5-4$524R @(" @(" Q"2\J(&IU;7!E<G,@=7-Es
M9"!T;R!S96QE8W0@9')I=F4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