Re: Only display ACPI bootmenu key if ACPI is present

From: John Baldwin <jhb_at_freebsd.org>
Date: Wed, 10 Nov 2010 11:58:06 -0500
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
_at__at_ -140,12 +140,16 _at__at_
 	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
_at__at_ -180,11 +184,18 _at__at_
 	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 _at_
+			1+ dup
+			menuidx !
+			-2 bootacpikey !
 		then
 	else
 		-2 bootacpikey !

-- 
John Baldwin
Received on Wed Nov 10 2010 - 15:58:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:09 UTC