Re: [Fwd: Hard disk geometry]

Guest section DW (dwguest@win.tue.nl)
Fri, 22 Oct 1999 01:24:03 +0200 (MET DST)


Simon Kirby wrote:

> Remembering what I've read on linux-kernel, I thought that the INT 0x13
> geometry interface was not reliable due to how old bioses don't support
> reading the extended geometry off of big disks (where the geometry is
> bigger than 1023, and more recently, where the geometry is bigger than
> 16383 (I think the INT 0x13 interface returns this in a short and so the
> ATA spec now says that drives are supposed to return this size and the
> BIOS/operating system should later use another call to find the real
> geometry)).

I was more thinking of using the new INT 0x13 interface, which uses
32-bit values. From Ralph Brown's interrupt list:

--------d-1348-------------------------------
INT 13 - IBM/MS INT 13 Extensions - GET DRIVE PARAMETERS
AH = 48h
DL = drive (80h-FFh)
DS:SI -> buffer for drive parameters (see #00273)
Return: CF clear if successful
AH = 00h
DS:SI buffer filled
CF set on error
AH = error code (see #00234)
BUG: several different Compaq BIOSes incorrectly report high-numbered
drives (such as 90h, B0h, D0h, and F0h) as present, giving
them the same geometry as drive 80h; as a workaround, scan
through disk numbers, stopping as soon as the number of valid drives
encountered equals the value in 0040h:0075h

As I found, this workaround does not help.

Both the old and the new interface are very unreliable.
And of course the new interface may not be present.

> >From what I remember also, I thought Linux got geometry information this
> way:
>
> 1. User specified on commad line
> 2. The partition table (not sure how)
> 3. Its own direct disk probing
> 4. INT 0x13

I don't think it uses INT 0x13. There's a comment in the source
suggesting an implementation.

The comment was too optimistic. The implementation fails.
You can see what is used (on i386) in setup.S.
There is an int13 call to check whether hd1 exists.
Unfortunately, we do not know which disk that is.

> Also, "fdisk" reads this information from the kernel somehow, so you
> might want to look at the code for it. :)

fdisk (and parted) use the HDIO_GETGEOMETRY ioctl. However, Linux
isn't good at detecting the geometry, so the ioctl sometimes returns
the wrong geometry.

This sentence presupposes that there is a geometry that one could detect.
That assumption is false.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/