Re: 2.6.x partition breakage and dual booting

From: Andries Brouwer
Date: Tue Jun 01 2004 - 18:58:51 EST


On Tue, Jun 01, 2004 at 11:10:27AM -0400, Patrick J. LoPresti wrote:

> Now, starting with 2.6.5 Linux actually invokes INT13/AH=08h during
> real-mode startup and stashes the values away. They are available via
> Dell's EDD module. So, to find the Windows-compatible geometry, you
> simply:
>
> modprobe edd
> cat /sys/firmware/edd/int13_dev80/{legacy_heads,legacy_sectors}
>
> (And add 1 to the "heads" value because the legacy BIOS interface is
> freaky.)

Now that we are discussing this stuff anyway:
The names chosen are really bad, they are an invitation for
confusion and bugs.

We have "sectors" and it gives a count of sectors, like 0x7280b80
(yecch - why in hex??).
But "legacy_sectors" is not a number of sectors, but a number of
sectors per track, just like "default_sectors_per_track".

We have "default_heads" and it is a number of heads, like 0xff
(yecch - why in hex??).
But "legacy_heads" is not a number of heads, it is the largest
head number, that is, one less than the number of heads.

Please, now that this is still unused, fix your names and/or
your code. Names could be legacy_max_head (etc.) if you want
to keep the values, or otherwise add 1 to the values.

Note that sectors are counted from 1 here, so by some coincidence
legacy_max_sectors_per_track is the same as legacy_sectors_per_track.

Also - people will try to match the 0x7280b80 for int13_dev83 with
the 120064896 sectors that dmesg or hdparm -g reports for /dev/hdf.
Life would be easier with values given in decimal, as they are
everywhere else.

Andries


> There is just one catch. This assumes BIOS device 80h (the boot
> device) is the disk you care about. If not, you need to figure out
> which BIOS device corresponds to the disk you do care about. This is
> the hard part, but it is not THAT hard, because the /sys/firmware/edd
> interface exposes lots of information which will help you deduce this
> correspondence.

It is basically impossible, but it is easy to give heuristics
that very often work. Very good that that now is a job left
to user space.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/