i386/70241: boot1 logic fix for large disks

Valentin Nechayev netch at netch.kiev.ua
Mon Aug 9 23:20:24 PDT 2004


>Number:         70241
>Category:       i386
>Synopsis:       boot1 logic fix for large disks
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 10 06:20:23 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Valentin Nechayev
>Release:        FreeBSD 4.10-RELEASE-p2 i386
>Organization:
private
>Environment:
FreeBSD (any modern one)

>Description:

boot1 (src/src/sys/boot/i386/boot2/boot1.s) contains code (used by boot1,
boot2, and loader) to read disks, until kernel initializes its drivers
and get control.

This code uses makes BIOS calls in real x86 mode. To select between
"plain old" (geometerized) interface (B-1302 in Ralf Brown's terms)
and Int13x/EDD interface (d-1342), it uses EDD installation checking and
BIOS geometry request. Current logic (introduced in revision 1.13) tries
to fit arguments in B-1302 limitations (1024 cylinders, 256 heads, 63 sectors)
and use EDD only when it can't be fit (cyl>1023).

The problem appeared with ATA disks larger than 32G and Award 6.00 BIOSes.
In following I'll partially cite my message from hackers@
(http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2004-03/0181.html)

==={{{
The main factor to kill old access is strange BIOS translation for disks
larger than 32G. For two my home disks:

Model: IBM IC35L040AVER07-0
LBA size: 80418240 blocks
BIOS geometry in "LBA" mode: 5005*255*63
BIOS geometry in "NORMAL" mode: 19710*16*255
BIOS geometry in "LARGE" mode: 1314*240*255

Model: SAMSUNG SP1203N
LBA size: 234493056 blocks
BIOS geometry in "LBA" mode: 14596*255*63
BIOS geometry in "NORMAL" mode: 57473*16*255
BIOS geometry in "LARGE" mode: 3831*240*255
===}}}

So, BIOS translates geometry in any mode other than LBA[-assisted], to
one with 255 sectors. But geometry reporting interface (B-1308) can show
only 63 sectors, and boot1 code calls BIOS to load another block than
is supposed.

This was proven practically using system with Award BIOS and FreeBSD.
When switching BIOS to any translation other than LBA, boot failed
(boot2 loaded incorrect data instead of loader or kernel).

I asked Award support for reasons of such strange BIOS behavior;
silence was reply. I suppose no modern system uses traditional interface
when EDD is available (at least Linux and MS-Windows use EDD whenever possible),so

>How-To-Repeat:

All required data are in description section. In my letter in hackers@
(see URL above) I shown DOS mode test program and its results showing that
BIOS uses 255 sectors in internal calculations when reporting 63 sectors.

>Fix:

Revert logic of selection between traditional and EDD reading mode
to one which prefers EDD if available (as was in the same file in revisions
1.11 and 1.12). This is supported by John Baldwin (private conversation
after thread in hackers@):

==={{{
The problem is that there are BIOS's out there that claim to support EDD but
still don't work correctly.  I don't remember all the details at this point,
but I think it had to do with sysinstall not always being in sync with the
BIOS about how sectors were in a cylinder.  I guess though we could just turn
EDD on by default in 5.x or perhaps 6.0.  5.x doesn't really run well on a
386 or even a 486, and that is the class of machine that has problems with
EDD.
===}}}

So, at least preference to EDD is reasonable for -current; but I think
it can be also applicable for modern 4.* systems, at least as build option
or runtime flag. If it's needed I can attach patch for such variants.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list