Only display ACPI bootmenu key if ACPI is present
John Baldwin
jhb at freebsd.org
Wed Nov 10 16:58:09 UTC 2010
On Wednesday, November 10, 2010 8:57:35 am John Baldwin wrote:
> On Tuesday, November 09, 2010 5:58:13 pm C. P. Ghost wrote:
> > On Mon, Nov 8, 2010 at 11:14 PM, John Baldwin <jhb at freebsd.org> wrote:
> > > This patch changes the Forth code for the Beastie menu to only display the
> > > menu option to enable or disable ACPI if the loader detects ACPI. This avoids
> > > displaying a menu item prompting to enable ACPI if the BIOS doesn't actually
> > > include ACPI. Any objections?
> >
> > Wouldn't that be a POLA violation? Some admins may be used to the
> > current menu, and would be scratching head as what went wrong.
> > Maybe it would be better to keep the menu option, but make it
> > non-selectable and print next to it something like "(not available)"?
>
> Hmmm, I'll see if I can leave the numbering unchanged but not list
> the item perhaps. Note that we already have the "alternate" numbering on
> other platforms so the menu is already inconsistent across FreeBSD platforms.
It turned out to be easier to leave a blank line to do this, but this patch
does that. It leaves the numbers unchanged but simply omits the '2' option
if the system does not support ACPI.
--- //depot/projects/smpng/sys/boot/forth/beastie.4th 2010-11-08 21:53:18.000000000 0000
+++ //depot/user/jhb/ktrace/boot/forth/beastie.4th 2010-11-10 14:50:44.000000000 0000
@@ -140,12 +140,16 @@
fbsdbw-logo
;
-: acpienabled? ( -- flag )
+: acpipresent? ( -- flag )
s" hint.acpi.0.rsdp" getenv
dup -1 = if
drop false exit
then
2drop
+ true
+;
+
+: acpienabled? ( -- flag )
s" hint.acpi.0.disabled" getenv
dup -1 <> if
s" 0" compare 0<> if
@@ -180,11 +184,18 @@
printmenuitem ." Boot FreeBSD [default]" bootkey !
s" arch-i386" environment? if
drop
- printmenuitem ." Boot FreeBSD with ACPI " bootacpikey !
- acpienabled? if
- ." disabled"
+ acpipresent? if
+ printmenuitem ." Boot FreeBSD with ACPI " bootacpikey !
+ acpienabled? if
+ ." disabled"
+ else
+ ." enabled"
+ then
else
- ." enabled"
+ menuidx @
+ 1+ dup
+ menuidx !
+ -2 bootacpikey !
then
else
-2 bootacpikey !
--
John Baldwin
More information about the freebsd-current
mailing list