Lines Matching +full:acpi +full:- +full:based
1 --
2 -- SPDX-License-Identifier: BSD-2-Clause
3 --
4 -- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
5 -- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
6 -- All rights reserved.
7 --
8 -- Redistribution and use in source and binary forms, with or without
9 -- modification, are permitted provided that the following conditions
10 -- are met:
11 -- 1. Redistributions of source code must retain the above copyright
12 -- notice, this list of conditions and the following disclaimer.
13 -- 2. Redistributions in binary form must reproduce the above copyright
14 -- notice, this list of conditions and the following disclaimer in the
15 -- documentation and/or other materials provided with the distribution.
16 --
17 -- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 -- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 -- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 -- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 -- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 -- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 -- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 -- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 -- SUCH DAMAGE.
28 --
63 -- Globals
64 -- try_include will return the loaded module on success, or false and the error
65 -- message on failure.
69 -- XXX Temporary compat shim; this should be removed once the
70 -- loader.lua_path export has sufficiently spread.
75 -- We only attempt to append an extension if an absolute path
76 -- wasn't specified. This assumes that the caller either wants
77 -- to treat this like it would require() and specify just the
78 -- base filename, or they know what they're doing as they've
79 -- specified an absolute path and we shouldn't impede.
91 -- Module exports
92 -- Commonly appearing constants
97 -- Note that this is a decimal representation, despite the leading 0 that in
98 -- other contexts (outside of Lua) may mean 'octal'
136 -- We can't trust acpi.rsdp to be set if the loader binary doesn't do
137 -- ACPI detection early enough. UEFI loader historically didn't, so
138 -- we'll fallback to assuming ACPI is enabled if this binary does not
139 -- declare that it probes for ACPI early enough
140 if loader.getenv("acpi.rsdp") ~= nil then
152 -- Otherwise, respect disabled if it's set
153 local c = loader.getenv("hint.acpi.0.disabled")
157 function core.setACPI(acpi)
158 if acpi == nil then
159 acpi = not core.acpi
162 if acpi then
163 config.enableModule("acpi")
164 loader.setenv("hint.acpi.0.disabled", "0")
166 config.disableModule("acpi")
167 loader.setenv("hint.acpi.0.disabled", "1")
169 core.acpi = acpi
195 -- Clear the kernel cache on config changes, autodetect might have
196 -- changed or if we've switched boot environments then we could have
197 -- a new kernel set.
230 -- Do not attempt to autodetect if underlying filesystem
231 -- do not support directory listing (e.g. tftp, http)
237 -- Base whether we autodetect kernels or not on a loader.conf(5)
238 -- setting, kernels_autodetect. If it's set to 'yes', we'll add
239 -- any kernels we detect based on the criteria described.
247 -- Automatically detect other bootable kernel directories using a
248 -- heuristic. Any directory in /boot that contains an ordinary file
249 -- named "kernel" is considered eligible.
280 -- If we found more than one kernel, prune the "kernel" specified kernel
281 -- off of the list if it wasn't found during traversal. If we didn't
282 -- actually find any kernels, we just assume that they know what they're
283 -- doing and leave it alone.
293 -- The config/boot bits use the env var as a fallback if the
294 -- menu's kernel selector remains untouched, so we want to
295 -- update our notion of the default kernel to one that is
296 -- actually present.
319 -- Currently selected bootenv is always first/default
320 -- On the rewinded list the bootenv may not exists
332 for curenv_idx = 0, bootenv_count - 1 do
355 for curenv_idx = 0, bootenv_count - 1 do
381 loader.perform("efi-seed-entropy " .. seedsize)
394 -- loadelf() only if we've not already loaded a kernel
403 -- loadelf() only if we've not already loaded a kernel
413 -- Loader too old, no feature support
426 local efiver = loader.getenv("efi-version")
456 -- serial console is comconsole, but also userboot.
457 -- userboot is there, because we have no way to know
458 -- if the user terminal can draw unicode box chars or not.
479 -- Is the menu skipped in the environment in which we've booted?
484 -- This may be a better candidate for a 'utility' module.
497 -- XXX This should go away if we get the table lib into shape for importing.
498 -- As of now, it requires some 'os' functions, so we'll implement this in lua
499 -- for our uses
501 -- Shouldn't reasonably happen
510 -- This is not a cheap operation
513 new_tbl[k - 1] = v
554 -- The graphical-enabled loaders have unicode drawing character support. The
555 -- text-only ones do not. We check the old and new bindings for term_drawrect as
556 -- a proxy for unicode support, which will work on older boot loaders as well
557 -- as be future proof for when we remove the old binding. This also abstracts
558 -- out the test to one spot in case we start to export this notion more directly.
563 -- Sanity check the boot loader revision
564 -- Loaders with version 3.0 have everything that we need without backwards
565 -- compatible hacks. Warn users that still have old versions to upgrade so
566 -- that we can remove the backwards compatible hacks in the future since
567 -- they have been there a long time.