From: veit@du9ds3.uni-duisburg.de (Holger Veit)
Newsgroups: comp.unix.bsd
Subject: Re: 386BSD 0.1, disklabel problem isolated !
Date: 29 Jul 92 13:41:11 GMT
Reply-To: veit@du9ds3.uni-duisburg.de
Organization: Uni-Duisburg FB9 Datenverarbeitung

In <1992Jul26.080147.4506@data.fls.dk> phk@data.fls.dk (Poul-Henning Kamp) writes:

>I have a Western Digital WDC 4200 "Piranha" disk, it's an IDE of 202 Mb.
>The real physical layout is 1263 cyl, 8 heads, 41 sectors.  But to keep
>MS/DOS happy the drive reports 967 cyl, 12 heads 35 sect.  If I set the
>BIOS to the real values 1263,8,41 and create a 15 Mb DOS partition,
>install 386BSD 0.1 from the dist.fs things are OK until I try to boot the
>386BSD from the disk.

>It seems from the debug that the disklabel IS found, but then the drive 
>is probed and the cylinder count is clipped to 967, though the heads and the
>sect counts is left untouched.

>Since a lot of this translation stuff is going on, I think it is important
>to get this handled right:

>    1) Use BIOS-values and boot-block to find disklabel.

>    2) Use values in disklabel, unless the drive tells us otherwise:

>	if(drive.sect == label.sect && drive.head == label.head)
>	    label.cyl = drive.cyl;

>In my experience this will solve the most widespread problems with
>ESDI/IDE drives:

>    1) drives simply not matched by the BIOS, in this case the disklabel
>       can containe the right values, supported by the drives own idea.

>    2) drives crippled by manufactures to match a "VENDOR_X"-67 Mb drive,
>       even though the drive is 84 Mb, the right cylinder count can be picked
>       up from the drive.

>    3) cases like mine where even the bloddy drive is exposed to the famous
>       MS-DOS brain-damage...

>As soon as I can I'll produce a patch for this.

>Don't forget to enjoy other aspects of life, even though you have got your
>own unix box at home now !  :-)
>-- 
>phk@data.fls.dk		  || If you can't join 'em -- beat 'em !
>Poul-Henning Kamp	  ||			the Danish foreign minister
>FLS DATA A/S		  ||
>Phone: (+45) 36 18 12 35  ||

I would consider it dangerous to take the "real physical layout" as a 
reference (here "1263 cyl, 8 heads, 41 sectors"), in particular the number of
sectors. Unlike MFM and RLL drives it is a common practice of the 
"intelligent" (?) IDE controller on the disk board to have different numbers
of sectors depending on the length/diameter of the track. Provided a constant
write density you can place more sectors on an outer track than on an
inner track. There are IDE drives which accept whatever configuration they are
told and do translation of these values to their native internal format. 
Seems to be that you have such a drive. 
BTW, how can you enter 1263 cylinders in the free BIOS entry? Your BIOS may 
accept this value (although it should be clipped to 1023), but do you know
what DOS makes of this. The parameter list of the generic INT13 calls clip
the cylinder number to 10 bits (unless you have an AWARD AT BIOS which uses
more bits, according to Ralf Brown's INTERRUPT.LST). 

But I wish you good luck with you patch, although I suspect that it will be
yet another not portable island solution.

Holger

-- 
|  |   / Holger Veit             | INTERNET: veit@du9ds3.uni-duisburg.de
|__|  /  University of Duisburg  | BITNET: veit%du9ds3.uni-duisburg.de@UNIDO
|  | /   Dept. of Electr. Eng.   | "No, my programs are not BUGGY, these are
|  |/    Inst. f. Dataprocessing |          just unexpected FEATURES"