[comp.os.minix] Minix & Hardcards

jeremiah@compulink.co.uk (Jonathan Allen) (11/29/90)

I am trying to re-make my kernel to run on a 3 head 27 sector
Miniscribe hardcard, as recommended by ast (and others).  I have
defined NR_SECTORS in /usr/include/minix/config.h to 27, so as to
override the default setting in xt_wini.c.  I have also altered the
hard-coded setting of blocks per track from 17 to 27 in read.c

Is this enough?

I should add that it doesn't work - what do I try next ??

Jonathan

jeremiah@compulink.co.uk (Jonathan Allen) (12/08/90)

I'm still having trouble with this hardcard.  MINIX fdisk tells me
the disc should have 3 heads and 27 sectors, and then the partition
table looks like this:

1  2#    MINIX  256 0 1  762 2 26  20736  61801 41066
2  3#    MINIX  763 0 1  768 2 27  61803+ 62288   486
3  4#             0 0 0    0 0  0      0      0     0
4  1# A  DOS-12   0 1 1  255 2 27     27  20735 20709-

Now, setting NR_SECTORS to 26 (as several people have suggested), and
typing:     dd if=/dev/hd? of=/dev/null       apart from taking some
time produced:

   /dev/hd1   20708+0
   /dev/hd2   disc error on 3/2, block 13617   27234+0
   /dev/hd3   disc error on 3/3, block 0       0+0

Running the same 'dd' under the BIOS MINIX produced:

   /dev/hd1   20708+0
   /dev/hd2   41066+0
   /dev/hd3   486+0

Now, what am I doing wrong, and how can I get it to use my hard disc
properly - any further thoughts welcome

Jonathan

cechew@bruce.cs.monash.OZ.AU (Earl Chew) (12/10/90)

In <memo.41021@cix.uucp> jeremiah@compulink.co.uk (Jonathan Allen) writes:

>I'm still having trouble with this hardcard.  MINIX fdisk tells me
>the disc should have 3 heads and 27 sectors, and then the partition
>table looks like this:

>1  2#    MINIX  256 0 1  762 2 26  20736  61801 41066
>2  3#    MINIX  763 0 1  768 2 27  61803+ 62288   486
>3  4#             0 0 0    0 0  0      0      0     0
>4  1# A  DOS-12   0 1 1  255 2 27     27  20735 20709-

>Now, setting NR_SECTORS to 26 (as several people have suggested), and
>typing:     dd if=/dev/hd? of=/dev/null       apart from taking some
>time produced:

If fdisk says `27 sectors' why set NR_SECTORS to `26'?

In general, you should be skeptical about what fdisk tells you since it's only
making an educated guess. You should find out the number of heads, sectors and
cylinders from the spec sheet (if you don't have one, get hold of the drive
listings in the dskutl directory on simtel-20). You should set NR_SECTORS
to the number obtained from the spec sheet. You will then have to format the
disk (I'm assuming that it is new). You can't do this under vanilla Minix so
you'll either have to use the MsDos `debug' technique (as described in your
controller card documentation) or use one of the programs distributed with such
things as OnTrack's Disk Manager. Having done this, you can use fdisk, but
remember to use the -s42 -h99 flags (substitute the number of sectors for 42,
and the correct number of heads for 99).

This might be the cause of your problems. Then again, it might not :-(

Earl
-- 
Earl Chew, Dept of Computer Science, Monash University, Australia 3168
EMAIL: cechew@bruce.cs.monash.edu.au PHONE: 03 5655447 FAX: 03 5655146
----------------------------------------------------------------------

Peter_Van_Epp@cc.sfu.ca (12/10/90)

The way I always figure out the geometry of the disk (and I just got a new
200 M drive and a 386 machine!) is to let the disk bios tell me from DOS.
All you need is a 5 line program under debug (assuming of course that you
have MSDOS!) that looks like this
a 100
mov ah,8
mov dl,80
int 13
nop
nop
 
then do a g=100,106 and when the breakpoint is hit the carry flag should be
clear (indicating success) and the drive parameters are as follows:
ch = max usable cylinder (low 8 bits)
cl = bits 7 and 6 = high 2 bits of max cyl
     bits 5 - 0 = max sector #
dh = max usable head
dl = number of drives.
es:di = address of disk param table (which you don't care about).
This should get you the info you need to feed to fdisk.
Example for my 200m drive:
 
ch = CE 
cl = DC
dh = 0E
dl =1
 
so there are 3CE (or 974) tracks (top 2 bits of cl and all of ch) 
              1C (or 28) sectors per track (from cl bottom 5 bits) 
       and    0E (or 14) as the last usable head (from dh). This  is a little
              confusing because that is the last usable head and they start at
              0 so there are actually 15 heads!
given the above the fdisk command looks like this:
fdisk -h15 -s28 /dev/hd0
and voila all falls into place.
Hope this helps!

cechew@bruce.cs.monash.OZ.AU (Earl Chew) (12/11/90)

In <38601@nigel.ee.udel.edu> Peter_Van_Epp@cc.sfu.ca writes:

>The way I always figure out the geometry of the disk (and I just got a new
>200 M drive and a 386 machine!) is to let the disk bios tell me from DOS.
>All you need is a 5 line program under debug (assuming of course that you
>have MSDOS!) that looks like this
>a 100
>mov ah,8
>mov dl,80
>int 13
>nop
>nop

More user friendly ways along the same lines are to use something like Norton's
NU, or infoplus (posted recently to comp.binaries.ibm.pc). These will tell you
the disk geometry in nice bright friendly letters.

This is well and good, but can lead to *wrong* results. All these schemes rely
on the BIOS to tell you what's what. In particular, on new AT machines, what
the BIOS thinks you have installed is what you tell it (using SETUP, or boot
time configuration using one of the fancy new BIOSs). For example, if I have
a 7 head, 872 cylinder and 17 sector disk, I could use SETUP (or its
equivalent) to tell the BIOS that I have a 4 head, 400 cylinder, 17 sector disk.

Then Norton NU, infoplus or the debug technique described here will report a
4 head, 400 cylinder, 17 sector disk. Alternatively, if I setup the BIOS to
think that I have a 16 head, 1024 cylinder, 26 sector disk, that's what it'll
report to whoever asks --- clearly, this is wrong.

Similar misrepresentations may occur with XT machines and either the
autoconfiguration or dip switch settings.

This can be used in your favour if you wish to format the disk undersized for
whatever reason -- unfortunately, you can't format them oversized :-(.

If you use any of these methods (NU, infoplus, debug, etc), you're assuming
that the last person to muck around with the system configuration got it right
(either that or that the BIOS and the controller are actually smart enough
to snoop around the drive to work out how big it is).

It is wise to look at the label on the drive itself and from there to find out
from the spec sheet how big the drive actually is. Be careful to take into
account the type of controller (ie is it RLL?).

Earl
-- 
Earl Chew, Dept of Computer Science, Monash University, Australia 3168
EMAIL: cechew@bruce.cs.monash.edu.au PHONE: 03 5655447 FAX: 03 5655146
----------------------------------------------------------------------

jeremiah@compulink.co.uk (Jonathan Allen) (12/11/90)

In several messages jeremiah@cix (Jonathan Allen) writes:
>I can't get my hard-card working under Minix

I've at last got this hardcard going properly - hooray!

Thanks to Glen Overby (overby@plains.nodak.edu) who suggested
setting AUTO_BIOS to 1 in config.h - with setting NR_SECTORS
back to the '27' that fdisk wanted, that moved me onto:

   Kernel Panic: unable to set up to read parameters drive 0

Further investigation (and a lot of printf's) showed that the
problem was w_reset() returning the ERR value, which in turn
was caused by an inadequate (in my case) delay at the start of
w_reset().  After the RESET condition is set, there is a short
'for' loop to 'spin' for a while until the SELECT ia asserted.
The constant (who's name escapes me now) was divided by, to make
what is presumably a sensible value on most machines ... well
I removed the '/10' and hey-presto! all of a sudden I was working.
Removing all the printf's and I now have a working system.

Thanks to all (four people) to offered suggestions.

Jonathan