Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146859024
D42483.1781313347.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D42483.1781313347.diff
View Options
diff --git a/stand/lua/core.lua b/stand/lua/core.lua
--- a/stand/lua/core.lua
+++ b/stand/lua/core.lua
@@ -32,6 +32,7 @@
local core = {}
+local default_acpi = false
local default_safe_mode = false
local default_single_user = false
local default_verbose = false
@@ -46,20 +47,14 @@
end
local function recordDefaults()
- -- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386,
- -- it will generally be set upon execution of the kernel. Because of
- -- this, we can't (or don't really want to) detect/disable ACPI on !i386
- -- reliably. Just set it enabled if we detect it and leave well enough
- -- alone if we don't.
- local boot_acpi = core.isSystem386() and core.getACPIPresent(false)
local boot_single = loader.getenv("boot_single") or "no"
local boot_verbose = loader.getenv("boot_verbose") or "no"
+
+ default_acpi = core.getACPI()
default_single_user = boot_single:lower() ~= "no"
default_verbose = boot_verbose:lower() ~= "no"
- if boot_acpi then
- core.setACPI(true)
- end
+ core.setACPI(default_acpi)
core.setSingleUser(default_single_user)
core.setVerbose(default_verbose)
end
@@ -137,18 +132,18 @@
core.su = single_user
end
-function core.getACPIPresent(checking_system_defaults)
- local c = loader.getenv("hint.acpi.0.rsdp")
+function core.hasACPI()
+ return loader.getenv("acpi.rsdp") ~= nil
+end
- if c ~= nil then
- if checking_system_defaults then
- return true
- end
- -- Otherwise, respect disabled if it's set
- c = loader.getenv("hint.acpi.0.disabled")
- return c == nil or tonumber(c) ~= 1
+function core.getACPI()
+ if not core.hasACPI() then
+ return false
end
- return false
+
+ -- Otherwise, respect disabled if it's set
+ local c = loader.getenv("hint.acpi.0.disabled")
+ return c == nil or tonumber(c) ~= 1
end
function core.setACPI(acpi)
@@ -358,7 +353,7 @@
end
function core.setDefaults()
- core.setACPI(core.getACPIPresent(true))
+ core.setACPI(default_acpi)
core.setSafeMode(default_safe_mode)
core.setSingleUser(default_single_user)
core.setVerbose(default_verbose)
@@ -441,10 +436,6 @@
return false
end
-function core.isSystem386()
- return loader.machine_arch == "i386"
-end
-
-- Is the menu skipped in the environment in which we've booted?
function core.isMenuSkipped()
return string.lower(loader.getenv("beastie_disable") or "") == "yes"
diff --git a/stand/lua/core.lua.8 b/stand/lua/core.lua.8
--- a/stand/lua/core.lua.8
+++ b/stand/lua/core.lua.8
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 21, 2018
+.Dd November 20, 2023
.Dt CORE.LUA 8
.Os
.Sh NAME
@@ -90,7 +90,7 @@
.Ss Exported functions
The following functions are exported from
.Nm :
-.Bl -tag -width core.getACPIPresent -offset indent
+.Bl -tag -width core.setSingleUser -offset indent
.It Fn core.setVerbose verbose
Sets or unsets
.Ev boot_verbose .
@@ -103,15 +103,14 @@
If
.Fa singleUser
is omitted, toggle the current single user setting.
-.It Fn core.getACPIPresent checkingSystemDefaults
-Check whether ACPI is present.
-This will only be accurate for i386-compatible loaders, including non-UEFI
-loaders on amd64 systems.
-If
-.Fa checkingSystemDefaults
-is true, ignore the current value of
-.Ev hint.acpi.0.disabled .
-Otherwise, return true only if ACPI is both present and not disabled.
+.It Fn core.getACPI
+Return true if ACPI is both present and not explicitly disabled by
+.Ev hints.acpi.0.disabled .
+.It Fn core.hasACPI
+Checks whether ACPI support is present.
+This requires the loader to probe the system and set
+.Ev acpi.rsdp
+early before starting the interpreter.
.It Fn core.setACPI acpi
Sets or unsets
.Ev acpi_load ,
@@ -202,9 +201,6 @@
.Ev boot_serial ,
and
.Ev boot_multicons .
-.It Fn core.isSystem386
-Returns true if this bootloader was compiled as an i386 binary.
-This generally applies to i386 loaders as well as non-UEFI loaders on amd64.
.It Fn core.deepCopyTable tbl
Recursively deep copies
.Fa tbl
diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua
--- a/stand/lua/menu.lua
+++ b/stand/lua/menu.lua
@@ -176,7 +176,7 @@
-- acpi
{
entry_type = core.MENU_ENTRY,
- visible = core.isSystem386,
+ visible = core.hasACPI,
name = function()
return OnOff(color.highlight("A") ..
"CPI :", core.acpi)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 13, 1:15 AM (14 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28896318
Default Alt Text
D42483.1781313347.diff (4 KB)
Attached To
Mode
D42483: loader: improve lua ACPI detection and handling
Attached
Detach File
Event Timeline
Log In to Comment