Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2002 12:03:11 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        phk@FreeBSD.ORG
Cc:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/boot/i386/boot2 boot2.c
Message-ID:  <XFMail.20021217120311.jhb@FreeBSD.org>
In-Reply-To: <2340.1040055951@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help

On 16-Dec-2002 phk@FreeBSD.ORG wrote:
> In message <XFMail.20021216112015.jhb@FreeBSD.org>, John Baldwin writes:
>>
>>On 14-Dec-2002 Poul-Henning Kamp wrote:
>>> phk         2002/12/14 09:34:28 PST
>>> 
>>>   Modified files:
>>>     sys/boot/i386/boot2  boot2.c 
>>>   Log:
>>>   Don't fill in the table with the BIOS idea about disk-geometry, we don't
>>>   use it.  This saves a surprising number of bytes.
>>
>>It might be nice to use it at some point to improve sysinstall's geometry
>>guesses.  At least that was the plan.
> 
> Well, ACPI can tell us too, and that will even tell which drive is which,
> something this old hack didn't tell us.

Uh, it can?  How?  ACPI can tell you what IDE controllers are present
and what timing parameters to use when doing suspend/resume, but it
doesn't tell you what disks are present AFAIK.  Well, it might tell
you the disks, but it doesn't tell you the geometries.  There's no AML
defined for listing BIOS geometries.  Here's what the IDE controller on
my laptop with an ejectable CD-ROM looks like:

        Device(PX41) {
            Name(_ADR, 0x00070001)              /* PCI device 7, function 1 */
            Device(PRIM) {
                Name(_ADR, 0x0)                 /* Primary channel */
                Method(_STA) {
                    Store("PCI IDE Primary _STA", Debug)
                    Return(0xf)
                }
                Device(MAST) {
                    Name(_ADR, 0x0)             /* Master device is fixed */
                }
                Device(SLAV) {
                    Name(_ADR, 0x1)             /* Slave device is fixed.. note that
                                                   I don't actually have a slave device
                                                   installed, nor is there room for one. */
                }
            }
            Device(SECN) {
                Name(_ADR, 0x1)                 /* Secondary channel */
                Method(_STA) {
                    Store(0x1, \_SB_.PCI0.PX41.SIDE)
                    Return(0xf)
                }
                Device(MAST) {
                    Name(_ADR, 0x0)             /* Master device, ejectable */
                    Method(_STA) {              /* status, checks if a device is present */
                        Store(BEXT(), Local7)
                        Return(Local7)
                    }
                    Method(_EJ3, 1) {           /* device can be ejected at S3 sleep state
                                                   after calling this method */
                        If(Arg0) {
                            Store(0x0, \_SB_.PCI0.PX41.SIDE)
                            Store(0x1, \_SB_.PCI0.PX40.SISI)
                            Store(0x1, \_SB_.PCI0.PX43.SDPW)
                        }
                        Return(0x0)
                    }
                }
                Device(SLAV) {
                    Name(_ADR, 0x1)             /* Slave device, ejectable */
                    Method(_STA) {              /* status, same as above */
                        Store(BEXT(), Local7)
                        Return(Local7)
                    }
                    Name(_EJD, "\_SB_.PCI0.PX41.SECN.MAST")
                }
                Method(BEXT) {                  /* method to see if a device is present in
                                                   the battery bay that is an IDE device on
                                                   the secondary channel */
                    If(\_SB_.PCI0.PX40.ECOK()) {
                        Store(0x0, Local7)
                        Store(\_SB_.PCI0.PX40.EC0_.SHDD, Local0)
                        Store(\_SB_.PCI0.PX41.SIDE, Local1)
                        Store(LNot(\_SB_.PCI0.PX43.SDPW), Local2)
                        Store(LNot(\_SB_.PCI0.PX43.SRST), Local3)
                        Store(LNot(\_SB_.PCI0.PX40.SISI), Local4)
                        If(LAnd(Local0, Local1)) {
                            If(LAnd(Local2, Local3)) {
                                If(Local4) {
                                    Store(0xf, Local7)
                                }
                            }
                        }
                        If(LNot(Local7)) {
                            Store(0x1, \_SB_.PCI0.PX43.SDPW)
                        }
                    }
                    Else {
                        Store(0xf, Local7)
                    }
                    Return(Local7)
                }
            }


My laptop doesn't even have the timing parameter stuff.  But note that
ACPI doesn't tell you if drives are present unless they are ejectable
(such as in a laptop's device bay) and then it will tell you that
something is present, but it doesn't tell you if it's a CD-ROM, hard
drive, etc. If you go read the ACPI spec (www.acpi.info) you will find
on provisions for communicating BIOS geometries.  Matching up BIOS
geometries to drive geometries isn't but so hard.  BIOS geometries are
in a order.  There are some ambiguous cases that you can't figure out
which is which, but there are many cases when you _can_ figure out
which drives have which BIOS geometries and then it can be a great
help.  That said, I haven't heard of sysinstall screwing up geometry
(aside from the 0 heads thing it currently has due to int32_t limits
being exceeded I think) in a while so it may not be all that pressing
of a matter.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20021217120311.jhb>