Re: aic7xxx_biosparam

Andries Brouwer
2002-11-18T00:43:41Z

On Sun, Nov 17, 2002 at 07:27:42PM -0500, Doug Ledford wrote:

> So, this is the change I made to update it so that it won't puke on large
> devices. It seems to be working OK for me, but I didn't check the gcc
> assembly output to see if it's horrible. Unless someone tells me I'm
> smoking crack for making this change, I'll submit it pretty soon (I don't
> consider myself a partition expert, I'm just trying to make sure that when
> geometry does get defined on my driver that it at least is something the
> Adaptec BIOS will accept, and the Adaptec BIOS *only* accepts the two
> listed head/sector combos).

Yes. But note: the number of cylinders (i) is totally immaterial,
(ii) is returned in a short, the only place where it is used.
Thus, computing values larger than 65535 is undesired, they will
be truncated later.

That is why you can replace this strange

> + while( capacity >= (cylinders * sectors * heads))
> + cylinders++;
> + cylinders--;

by a test like:

if (capacity > 65535 * sectors * heads)
cylinders = 65535;
else
cylinders = ((unsigned int) capacity) / (sectors * heads);

Andries