Path: utzoo!utgpu!watserv1!watmath!att!rutgers!sun-barr!apple!bionet!agate!shelby!portia.stanford.edu!bwilson From: bwilson@portia.Stanford.EDU (Robert Wilson) Newsgroups: comp.os.minix Subject: fix for xt_wini with WD controllers Message-ID: <1990Oct16.234256.19432@portia.Stanford.EDU> Date: 16 Oct 90 23:42:56 GMT Sender: bwilson@portia.Stanford.EDU (Robert Wilson) Organization: AIR, Stanford University Lines: 76 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)