summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/emulation/qemu-riscv/Kconfig2
-rw-r--r--boot/Kconfig4
-rw-r--r--boot/Makefile2
-rw-r--r--cmd/Kconfig10
-rw-r--r--cmd/efidebug.c4
-rw-r--r--doc/conf.py2
-rw-r--r--doc/genindex.rst4
-rw-r--r--doc/index.rst5
-rw-r--r--doc/sphinx-static/theme_overrides.css47
-rw-r--r--doc/sphinx/kerneldoc.py2
-rw-r--r--doc/sphinx/kfigure.py2
-rw-r--r--doc/sphinx/requirements.txt43
-rw-r--r--doc/usage/cmd/acpi.rst3
-rw-r--r--doc/usage/cmd/addrmap.rst3
-rw-r--r--doc/usage/cmd/armffa.rst3
-rw-r--r--doc/usage/cmd/askenv.rst3
-rw-r--r--doc/usage/cmd/base.rst3
-rw-r--r--doc/usage/cmd/bdinfo.rst3
-rw-r--r--doc/usage/cmd/bind.rst3
-rw-r--r--doc/usage/cmd/blkcache.rst3
-rw-r--r--doc/usage/cmd/bootd.rst3
-rw-r--r--doc/usage/cmd/bootdev.rst3
-rw-r--r--doc/usage/cmd/bootefi.rst3
-rw-r--r--doc/usage/cmd/bootflow.rst3
-rw-r--r--doc/usage/cmd/booti.rst3
-rw-r--r--doc/usage/cmd/bootm.rst3
-rw-r--r--doc/usage/cmd/bootmenu.rst3
-rw-r--r--doc/usage/cmd/bootmeth.rst3
-rw-r--r--doc/usage/cmd/bootz.rst3
-rw-r--r--doc/usage/cmd/button.rst3
-rw-r--r--doc/usage/cmd/cat.rst3
-rw-r--r--doc/usage/cmd/cedit.rst3
-rw-r--r--doc/usage/cmd/cli.rst3
-rw-r--r--doc/usage/cmd/cls.rst3
-rw-r--r--doc/usage/cmd/cmp.rst3
-rw-r--r--doc/usage/cmd/coninfo.rst3
-rw-r--r--doc/usage/cmd/conitrace.rst3
-rw-r--r--doc/usage/cmd/cp.rst3
-rw-r--r--doc/usage/cmd/cyclic.rst3
-rw-r--r--doc/usage/cmd/dm.rst3
-rw-r--r--doc/usage/cmd/ebtupdate.rst3
-rw-r--r--doc/usage/cmd/echo.rst3
-rw-r--r--doc/usage/cmd/efi.rst3
-rw-r--r--doc/usage/cmd/eficonfig.rst3
-rw-r--r--doc/usage/cmd/env.rst3
-rw-r--r--doc/usage/cmd/event.rst3
-rw-r--r--doc/usage/cmd/exception.rst3
-rw-r--r--doc/usage/cmd/exit.rst3
-rw-r--r--doc/usage/cmd/extension.rst3
-rw-r--r--doc/usage/cmd/false.rst3
-rw-r--r--doc/usage/cmd/fatinfo.rst3
-rw-r--r--doc/usage/cmd/fatload.rst3
-rw-r--r--doc/usage/cmd/fdt.rst3
-rw-r--r--doc/usage/cmd/font.rst3
-rw-r--r--doc/usage/cmd/for.rst3
-rw-r--r--doc/usage/cmd/fwu_mdata.rst3
-rw-r--r--doc/usage/cmd/gpio.rst3
-rw-r--r--doc/usage/cmd/gpt.rst3
-rw-r--r--doc/usage/cmd/history.rst3
-rw-r--r--doc/usage/cmd/host.rst3
-rw-r--r--doc/usage/cmd/imxtract.rst3
-rw-r--r--doc/usage/cmd/load.rst3
-rw-r--r--doc/usage/cmd/loadb.rst3
-rw-r--r--doc/usage/cmd/loadm.rst3
-rw-r--r--doc/usage/cmd/loads.rst3
-rw-r--r--doc/usage/cmd/loadx.rst3
-rw-r--r--doc/usage/cmd/loady.rst3
-rw-r--r--doc/usage/cmd/mbr.rst3
-rw-r--r--doc/usage/cmd/md.rst3
-rw-r--r--doc/usage/cmd/mmc.rst3
-rw-r--r--doc/usage/cmd/mtest.rst3
-rw-r--r--doc/usage/cmd/mtrr.rst3
-rw-r--r--doc/usage/cmd/panic.rst3
-rw-r--r--doc/usage/cmd/part.rst3
-rw-r--r--doc/usage/cmd/pause.rst3
-rw-r--r--doc/usage/cmd/pinmux.rst3
-rw-r--r--doc/usage/cmd/printenv.rst3
-rw-r--r--doc/usage/cmd/pstore.rst3
-rw-r--r--doc/usage/cmd/qfw.rst3
-rw-r--r--doc/usage/cmd/reset.rst3
-rw-r--r--doc/usage/cmd/rng.rst3
-rw-r--r--doc/usage/cmd/saves.rst3
-rw-r--r--doc/usage/cmd/sbi.rst3
-rw-r--r--doc/usage/cmd/scmi.rst3
-rw-r--r--doc/usage/cmd/scp03.rst3
-rw-r--r--doc/usage/cmd/seama.rst3
-rw-r--r--doc/usage/cmd/setexpr.rst3
-rw-r--r--doc/usage/cmd/sf.rst3
-rw-r--r--doc/usage/cmd/size.rst3
-rw-r--r--doc/usage/cmd/sleep.rst3
-rw-r--r--doc/usage/cmd/sm.rst3
-rw-r--r--doc/usage/cmd/sound.rst3
-rw-r--r--doc/usage/cmd/source.rst3
-rw-r--r--doc/usage/cmd/temperature.rst3
-rw-r--r--doc/usage/cmd/tftpput.rst3
-rw-r--r--doc/usage/cmd/trace.rst3
-rw-r--r--doc/usage/cmd/true.rst3
-rw-r--r--doc/usage/cmd/ums.rst3
-rw-r--r--doc/usage/cmd/unbind.rst3
-rw-r--r--doc/usage/cmd/ut.rst3
-rw-r--r--doc/usage/cmd/wdt.rst3
-rw-r--r--doc/usage/cmd/wget.rst3
-rw-r--r--doc/usage/cmd/write.rst3
-rw-r--r--doc/usage/cmd/xxd.rst3
-rw-r--r--doc/usage/dfu.rst60
-rw-r--r--drivers/rtc/Kconfig7
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/goldfish_rtc.c105
-rw-r--r--fs/fs.c7
-rw-r--r--include/efi_loader.h28
-rw-r--r--lib/efi_loader/Kconfig11
-rw-r--r--lib/efi_loader/Makefile3
-rw-r--r--lib/efi_loader/efi_bootbin.c211
-rw-r--r--lib/efi_loader/efi_bootmgr.c488
-rw-r--r--lib/efi_loader/efi_device_path.c3
-rw-r--r--lib/efi_loader/efi_helper.c286
-rw-r--r--net/tftp.c10
-rw-r--r--test/boot/bootflow.c2
118 files changed, 1042 insertions, 583 deletions
diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig
index d5f302ffda..9538c66e8b 100644
--- a/board/emulation/qemu-riscv/Kconfig
+++ b/board/emulation/qemu-riscv/Kconfig
@@ -60,6 +60,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy
imply NVME_PCI
imply PCIE_ECAM_GENERIC
imply DM_RNG
+ imply DM_RTC
+ imply RTC_GOLDFISH
imply SCSI
imply SYS_NS16550
imply SIFIVE_SERIAL
diff --git a/boot/Kconfig b/boot/Kconfig
index 0894ecf4df..70ff24808b 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -523,7 +523,7 @@ config BOOTMETH_EXTLINUX_PXE
config BOOTMETH_EFILOADER
bool "Bootdev support for EFI boot"
- depends on BOOTEFI_BOOTMGR
+ depends on EFI_BINARY_EXEC
default y
help
Enables support for EFI boot using bootdevs. This makes the
@@ -558,7 +558,7 @@ config BOOTMETH_DISTRO
select BOOTMETH_SCRIPT if CMDLINE # E.g. Armbian uses scripts
select BOOTMETH_EXTLINUX # E.g. Debian uses these
select BOOTMETH_EXTLINUX_PXE if CMD_PXE && CMD_NET && DM_ETH
- select BOOTMETH_EFILOADER if BOOTEFI_BOOTMGR # E.g. Ubuntu uses this
+ select BOOTMETH_EFILOADER if EFI_BINARY_EXEC # E.g. Ubuntu uses this
config SPL_BOOTMETH_VBE
bool "Bootdev support for Verified Boot for Embedded (SPL)"
diff --git a/boot/Makefile b/boot/Makefile
index a47e002746..f0a279cde1 100644
--- a/boot/Makefile
+++ b/boot/Makefile
@@ -35,7 +35,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o
obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o
obj-$(CONFIG_$(SPL_TPL_)CEDIT) += cedit.o
ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL
-obj-$(CONFIG_BOOTEFI_BOOTMGR) += bootmeth_efi_mgr.o
+obj-$(CONFIG_EFI_BOOTMGR) += bootmeth_efi_mgr.o
obj-$(CONFIG_$(SPL_TPL_)EXPO) += bootflow_menu.o
obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootflow_menu.o
endif
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 26aeeeed03..62d2ae3d3f 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -294,7 +294,7 @@ config CMD_BOOTMETH
config BOOTM_EFI
bool "Support booting UEFI FIT images"
- depends on BOOTEFI_BOOTMGR && CMD_BOOTM && FIT
+ depends on EFI_BINARY_EXEC && CMD_BOOTM && FIT
default y
help
Support booting UEFI FIT images via the bootm command.
@@ -386,7 +386,7 @@ config CMD_BOOTEFI
if CMD_BOOTEFI
config CMD_BOOTEFI_BINARY
bool "Allow booting an EFI binary directly"
- depends on BOOTEFI_BOOTMGR
+ depends on EFI_BINARY_EXEC
default y
help
Select this option to enable direct execution of binary at 'bootefi'.
@@ -395,7 +395,7 @@ config CMD_BOOTEFI_BINARY
config CMD_BOOTEFI_BOOTMGR
bool "UEFI Boot Manager command"
- depends on BOOTEFI_BOOTMGR
+ depends on EFI_BOOTMGR
default y
help
Select this option to enable the 'bootmgr' subcommand of 'bootefi'.
@@ -416,7 +416,7 @@ config CMD_BOOTEFI_HELLO_COMPILE
config CMD_BOOTEFI_HELLO
bool "Allow booting a standard EFI hello world for testing"
- depends on CMD_BOOTEFI_HELLO_COMPILE
+ depends on CMD_BOOTEFI_BINARY && CMD_BOOTEFI_HELLO_COMPILE
default y if CMD_BOOTEFI_SELFTEST
help
This adds a standard EFI hello world application to U-Boot so that
@@ -2153,7 +2153,7 @@ config CMD_EFIDEBUG
config CMD_EFICONFIG
bool "eficonfig - provide menu-driven uefi variables maintenance interface"
default y if !HAS_BOARD_SIZE_LIMIT
- depends on BOOTEFI_BOOTMGR
+ depends on EFI_BOOTMGR
select MENU
help
Enable the 'eficonfig' command which provides the menu-driven UEFI
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index aa8523797e..a3a7556ea4 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1414,7 +1414,7 @@ static __maybe_unused int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
}
static struct cmd_tbl cmd_efidebug_test_sub[] = {
-#ifdef CONFIG_BOOTEFI_BOOTMGR
+#ifdef CONFIG_EFI_BOOTMGR
U_BOOT_CMD_MKENT(bootmgr, CONFIG_SYS_MAXARGS, 1, do_efi_test_bootmgr,
"", ""),
#endif
@@ -1608,7 +1608,7 @@ U_BOOT_LONGHELP(efidebug,
" - show UEFI memory map\n"
"efidebug tables\n"
" - show UEFI configuration tables\n"
-#ifdef CONFIG_BOOTEFI_BOOTMGR
+#ifdef CONFIG_EFI_BOOTMGR
"efidebug test bootmgr\n"
" - run simple bootmgr for test\n"
#endif
diff --git a/doc/conf.py b/doc/conf.py
index 5e2ff1c8f5..c9138a5a5d 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -228,7 +228,7 @@ highlight_language = 'none'
try:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
- html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+ extensions.append('sphinx_rtd_theme')
except ImportError:
sys.stderr.write('Warning: The Sphinx \'sphinx_rtd_theme\' HTML theme was not found. Make sure you have the theme installed to produce pretty HTML output. Falling back to the default theme.\n')
diff --git a/doc/genindex.rst b/doc/genindex.rst
new file mode 100644
index 0000000000..2e452cb8f5
--- /dev/null
+++ b/doc/genindex.rst
@@ -0,0 +1,4 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Index
+=====
diff --git a/doc/index.rst b/doc/index.rst
index 57b42c68e4..43398627d8 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -99,4 +99,7 @@ Chromium OS-specific doc
Indices and tables
==================
-* :ref:`genindex`
+.. toctree::
+ :maxdepth: 1
+
+ genindex
diff --git a/doc/sphinx-static/theme_overrides.css b/doc/sphinx-static/theme_overrides.css
index 522b6d4c49..02e1151815 100644
--- a/doc/sphinx-static/theme_overrides.css
+++ b/doc/sphinx-static/theme_overrides.css
@@ -1,9 +1,41 @@
/* -*- coding: utf-8; mode: css -*-
*
* Sphinx HTML theme customization: read the doc
- *
+ * Please don't add any color definition here, as the theme should
+ * work for both normal and dark modes.
*/
+@import 'css/theme.css';
+@import 'pygments.css';
+
+/* Improve contrast and increase size for easier reading. */
+
+body {
+ font-family: sans-serif;
+ font-size: 100%;
+}
+
+h1, h2, .rst-content .toctree-wrapper p.caption, h3, h4, h5, h6, legend {
+ font-family: sans-serif;
+}
+
+div[class^="highlight"] pre {
+ font-family: monospace;
+ font-size: 100%;
+}
+
+.wy-menu-vertical {
+ font-family: sans-serif;
+}
+
+.c {
+ font-style: normal;
+}
+
+p {
+ font-size: 100%;
+}
+
/* Interim: Code-blocks with line nos - lines and line numbers don't line up.
* see: https://github.com/rtfd/sphinx_rtd_theme/issues/419
*/
@@ -15,6 +47,16 @@ div[class^="highlight"] pre {
line-height: normal;
}
+/* Keep fields from being strangely far apart due to inheirited table CSS. */
+.rst-content table.field-list th.field-name {
+ padding-top: 1px;
+ padding-bottom: 1px;
+}
+.rst-content table.field-list td.field-body {
+ padding-top: 1px;
+ padding-bottom: 1px;
+}
+
@media screen {
/* content column
@@ -56,13 +98,10 @@ div[class^="highlight"] pre {
/* Menu selection and keystrokes */
span.menuselection {
- color: blue;
font-family: "Courier New", Courier, monospace
}
code.kbd, code.kbd span {
- color: white;
- background-color: darkblue;
font-weight: bold;
font-family: "Courier New", Courier, monospace
}
diff --git a/doc/sphinx/kerneldoc.py b/doc/sphinx/kerneldoc.py
index 8189c33b9d..01a55429c5 100644
--- a/doc/sphinx/kerneldoc.py
+++ b/doc/sphinx/kerneldoc.py
@@ -138,7 +138,7 @@ class KernelDocDirective(Directive):
lineoffset = int(match.group(1)) - 1
# we must eat our comments since the upset the markup
else:
- doc = env.srcdir + "/" + env.docname + ":" + str(self.lineno)
+ doc = str(env.srcdir) + "/" + env.docname + ":" + str(self.lineno)
result.append(line, doc + ": " + filename, lineoffset)
lineoffset += 1
diff --git a/doc/sphinx/kfigure.py b/doc/sphinx/kfigure.py
index 788704886e..dea7f91ef5 100644
--- a/doc/sphinx/kfigure.py
+++ b/doc/sphinx/kfigure.py
@@ -266,7 +266,7 @@ def convert_image(img_node, translator, src_fname=None):
if dst_fname:
# the builder needs not to copy one more time, so pop it if exists.
translator.builder.images.pop(img_node['uri'], None)
- _name = dst_fname[len(translator.builder.outdir) + 1:]
+ _name = dst_fname[len(str(translator.builder.outdir)) + 1:]
if isNewer(dst_fname, src_fname):
kernellog.verbose(app,
diff --git a/doc/sphinx/requirements.txt b/doc/sphinx/requirements.txt
index 39ececb96c..840c6cedfd 100644
--- a/doc/sphinx/requirements.txt
+++ b/doc/sphinx/requirements.txt
@@ -1,26 +1,25 @@
-alabaster==0.7.12
-Babel==2.9.1
-certifi==2023.07.22
-charset-normalizer==2.0.12
-docutils==0.16
-idna==3.3
-imagesize==1.3.0
-Jinja2==3.0.3
-MarkupSafe==2.1.1
-packaging==21.3
-Pygments==2.15.1
-pyparsing==3.0.7
-pytz==2023.3
+alabaster==0.7.16
+Babel==2.14.0
+certifi==2023.11.17
+charset-normalizer==3.3.2
+docutils==0.20.1
+idna==3.6
+imagesize==1.4.1
+Jinja2==3.1.3
+MarkupSafe==2.1.3
+packaging==23.2
+Pygments==2.17.2
requests==2.31.0
six==1.16.0
snowballstemmer==2.2.0
-Sphinx==3.4.3
-sphinx-prompt==1.5.0
-sphinx-rtd-theme==1.0.0
-sphinxcontrib-applehelp==1.0.2
-sphinxcontrib-devhelp==1.0.2
-sphinxcontrib-htmlhelp==2.0.0
+Sphinx==7.2.6
+sphinx-prompt==1.8.0
+sphinx-rtd-theme==2.0.0
+sphinxcontrib-applehelp==1.0.8
+sphinxcontrib-devhelp==1.0.6
+sphinxcontrib-htmlhelp==2.0.5
+sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
-sphinxcontrib-qthelp==1.0.3
-sphinxcontrib-serializinghtml==1.1.5
-urllib3==2.0.7
+sphinxcontrib-qthelp==1.0.7
+sphinxcontrib-serializinghtml==1.1.10
+urllib3==2.1.0
diff --git a/doc/usage/cmd/acpi.rst b/doc/usage/cmd/acpi.rst
index 6b9b8949f3..a630f1ec5e 100644
--- a/doc/usage/cmd/acpi.rst
+++ b/doc/usage/cmd/acpi.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: acpi (command)
+
acpi command
============
diff --git a/doc/usage/cmd/addrmap.rst b/doc/usage/cmd/addrmap.rst
index 472fd547f3..6d0dbceefe 100644
--- a/doc/usage/cmd/addrmap.rst
+++ b/doc/usage/cmd/addrmap.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: addrmap (command)
+
addrmap command
===============
diff --git a/doc/usage/cmd/armffa.rst b/doc/usage/cmd/armffa.rst
index 13fa90c129..4f41e3393f 100644
--- a/doc/usage/cmd/armffa.rst
+++ b/doc/usage/cmd/armffa.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+.. index::
+ single: armffa (command)
+
armffa command
==============
diff --git a/doc/usage/cmd/askenv.rst b/doc/usage/cmd/askenv.rst
index b85ceface1..e2b3c5379a 100644
--- a/doc/usage/cmd/askenv.rst
+++ b/doc/usage/cmd/askenv.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: askenv (command)
+
askenv command
==============
diff --git a/doc/usage/cmd/base.rst b/doc/usage/cmd/base.rst
index db9cd4d978..0d030a1d1e 100644
--- a/doc/usage/cmd/base.rst
+++ b/doc/usage/cmd/base.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: base (command)
+
base command
============
diff --git a/doc/usage/cmd/bdinfo.rst b/doc/usage/cmd/bdinfo.rst
index 5261085a06..a21fbc83cc 100644
--- a/doc/usage/cmd/bdinfo.rst
+++ b/doc/usage/cmd/bdinfo.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2023, Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
+.. index::
+ single: bdinfo (command)
+
bdinfo command
==============
diff --git a/doc/usage/cmd/bind.rst b/doc/usage/cmd/bind.rst
index 1a5cffcb72..2345778366 100644
--- a/doc/usage/cmd/bind.rst
+++ b/doc/usage/cmd/bind.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: bind (command)
+
bind command
============
diff --git a/doc/usage/cmd/blkcache.rst b/doc/usage/cmd/blkcache.rst
index d3b2254cfa..0329261ba9 100644
--- a/doc/usage/cmd/blkcache.rst
+++ b/doc/usage/cmd/blkcache.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2023, Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
+.. index::
+ single: blkcache (command)
+
blkcache command
================
diff --git a/doc/usage/cmd/bootd.rst b/doc/usage/cmd/bootd.rst
index 380ef15283..619cfb601a 100644
--- a/doc/usage/cmd/bootd.rst
+++ b/doc/usage/cmd/bootd.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: bootd (command)
+
bootd command
=============
diff --git a/doc/usage/cmd/bootdev.rst b/doc/usage/cmd/bootdev.rst
index fb638b5807..658020e7c7 100644
--- a/doc/usage/cmd/bootdev.rst
+++ b/doc/usage/cmd/bootdev.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: bootdev (command)
+
bootdev command
===============
diff --git a/doc/usage/cmd/bootefi.rst b/doc/usage/cmd/bootefi.rst
index cb03df4e1c..3efe9e9df5 100644
--- a/doc/usage/cmd/bootefi.rst
+++ b/doc/usage/cmd/bootefi.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
+.. index::
+ single: bootefi (command)
+
bootefi command
===============
diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst
index 27e1330ad8..16ba986dc8 100644
--- a/doc/usage/cmd/bootflow.rst
+++ b/doc/usage/cmd/bootflow.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: bootflow (command)
+
bootflow command
================
diff --git a/doc/usage/cmd/booti.rst b/doc/usage/cmd/booti.rst
index d631fb571d..313efb83cc 100644
--- a/doc/usage/cmd/booti.rst
+++ b/doc/usage/cmd/booti.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: booti (command)
+
booti command
=============
diff --git a/doc/usage/cmd/bootm.rst b/doc/usage/cmd/bootm.rst
index a7e5f6ce69..e409ebc193 100644
--- a/doc/usage/cmd/bootm.rst
+++ b/doc/usage/cmd/bootm.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: bootm (command)
+
bootm command
=============
diff --git a/doc/usage/cmd/bootmenu.rst b/doc/usage/cmd/bootmenu.rst
index 684a18d8e1..294cc02b17 100644
--- a/doc/usage/cmd/bootmenu.rst
+++ b/doc/usage/cmd/bootmenu.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. (C) Copyright 2011-2012 Pali Rohár <pali@kernel.org>
+.. index::
+ single: bootmenu (command)
+
bootmenu command
================
diff --git a/doc/usage/cmd/bootmeth.rst b/doc/usage/cmd/bootmeth.rst
index f632d74e1d..95651fdc7c 100644
--- a/doc/usage/cmd/bootmeth.rst
+++ b/doc/usage/cmd/bootmeth.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: bootmeth (command)
+
bootmeth command
================
diff --git a/doc/usage/cmd/bootz.rst b/doc/usage/cmd/bootz.rst
index 78953e9ca2..b85875adde 100644
--- a/doc/usage/cmd/bootz.rst
+++ b/doc/usage/cmd/bootz.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: bootz (command)
+
bootz command
=============
diff --git a/doc/usage/cmd/button.rst b/doc/usage/cmd/button.rst
index ea41762757..6c6794f31b 100644
--- a/doc/usage/cmd/button.rst
+++ b/doc/usage/cmd/button.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: button (command)
+
button command
==============
diff --git a/doc/usage/cmd/cat.rst b/doc/usage/cmd/cat.rst
index 5aaf497f27..b22dc6184a 100644
--- a/doc/usage/cmd/cat.rst
+++ b/doc/usage/cmd/cat.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: cat (command)
+
cat command
===========
diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst
index f415b48699..b39d708281 100644
--- a/doc/usage/cmd/cedit.rst
+++ b/doc/usage/cmd/cedit.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: cedit (command)
+
cedit command
=============
diff --git a/doc/usage/cmd/cli.rst b/doc/usage/cmd/cli.rst
index a0cf5958fb..81487722f6 100644
--- a/doc/usage/cmd/cli.rst
+++ b/doc/usage/cmd/cli.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: cli (command)
+
cli command
===========
diff --git a/doc/usage/cmd/cls.rst b/doc/usage/cmd/cls.rst
index b5c43e0a2e..828276742b 100644
--- a/doc/usage/cmd/cls.rst
+++ b/doc/usage/cmd/cls.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: cls (command)
+
cls command
===========
diff --git a/doc/usage/cmd/cmp.rst b/doc/usage/cmd/cmp.rst
index 66865ebd7e..a383074736 100644
--- a/doc/usage/cmd/cmp.rst
+++ b/doc/usage/cmd/cmp.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: cmp (command)
+
cmp command
===========
diff --git a/doc/usage/cmd/coninfo.rst b/doc/usage/cmd/coninfo.rst
index 76cb6c3329..a66cf90a27 100644
--- a/doc/usage/cmd/coninfo.rst
+++ b/doc/usage/cmd/coninfo.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: coninfo (command)
+
coninfo command
===============
diff --git a/doc/usage/cmd/conitrace.rst b/doc/usage/cmd/conitrace.rst
index d9916c865e..38ec66ad52 100644
--- a/doc/usage/cmd/conitrace.rst
+++ b/doc/usage/cmd/conitrace.rst
@@ -1,3 +1,6 @@
+.. index::
+ single: conitrace (command)
+
conitrace command
=================
diff --git a/doc/usage/cmd/cp.rst b/doc/usage/cmd/cp.rst
index bea379ff36..434dfedfc2 100644
--- a/doc/usage/cmd/cp.rst
+++ b/doc/usage/cmd/cp.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: cp (command)
+
cp command
==========
diff --git a/doc/usage/cmd/cyclic.rst b/doc/usage/cmd/cyclic.rst
index 3085cc7204..ac1e4c663b 100644
--- a/doc/usage/cmd/cyclic.rst
+++ b/doc/usage/cmd/cyclic.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: cyclic (command)
+
cyclic command
==============
diff --git a/doc/usage/cmd/dm.rst b/doc/usage/cmd/dm.rst
index 12b7edeed6..9bef2eeaed 100644
--- a/doc/usage/cmd/dm.rst
+++ b/doc/usage/cmd/dm.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: dm (command)
+
dm command
==========
diff --git a/doc/usage/cmd/ebtupdate.rst b/doc/usage/cmd/ebtupdate.rst
index d90474ccec..22415ee07b 100644
--- a/doc/usage/cmd/ebtupdate.rst
+++ b/doc/usage/cmd/ebtupdate.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: ebtupdate (command)
+
ebtupdate command
=================
diff --git a/doc/usage/cmd/echo.rst b/doc/usage/cmd/echo.rst
index 861abdfd1e..ebc9ff5f84 100644
--- a/doc/usage/cmd/echo.rst
+++ b/doc/usage/cmd/echo.rst
@@ -1,3 +1,6 @@
+.. index::
+ single: echo (command)
+
echo command
============
diff --git a/doc/usage/cmd/efi.rst b/doc/usage/cmd/efi.rst
index ef37ff2f4c..b19d36188a 100644
--- a/doc/usage/cmd/efi.rst
+++ b/doc/usage/cmd/efi.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
+.. index::
+ single: efi (command)
+
efi command
===========
diff --git a/doc/usage/cmd/eficonfig.rst b/doc/usage/cmd/eficonfig.rst
index 30eb72bfd0..83a3ebf4f0 100644
--- a/doc/usage/cmd/eficonfig.rst
+++ b/doc/usage/cmd/eficonfig.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. (C) Copyright 2022, Masahisa Kojima <masahisa.kojima@linaro.org>
+.. index::
+ single: eficonfig (command)
+
eficonfig command
=================
diff --git a/doc/usage/cmd/env.rst b/doc/usage/cmd/env.rst
index 1bebfa4e71..a859e32798 100644
--- a/doc/usage/cmd/env.rst
+++ b/doc/usage/cmd/env.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0-or-later:
+.. index::
+ single: env (command)
+
env command
===========
diff --git a/doc/usage/cmd/event.rst b/doc/usage/cmd/event.rst
index 47c900d17e..5c5e304373 100644
--- a/doc/usage/cmd/event.rst
+++ b/doc/usage/cmd/event.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: event (command)
+
event command
=============
diff --git a/doc/usage/cmd/exception.rst b/doc/usage/cmd/exception.rst
index 27df88bd5c..9cb492d604 100644
--- a/doc/usage/cmd/exception.rst
+++ b/doc/usage/cmd/exception.rst
@@ -1,3 +1,6 @@
+.. index::
+ single: exception (command)
+
exception command
=================
diff --git a/doc/usage/cmd/exit.rst b/doc/usage/cmd/exit.rst
index 3edb12809c..2f250bf4bd 100644
--- a/doc/usage/cmd/exit.rst
+++ b/doc/usage/cmd/exit.rst
@@ -1,3 +1,6 @@
+.. index::
+ single: exit (command)
+
exit command
============
diff --git a/doc/usage/cmd/extension.rst b/doc/usage/cmd/extension.rst
index 6366cf56e7..4c261e7495 100644
--- a/doc/usage/cmd/extension.rst
+++ b/doc/usage/cmd/extension.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2021, Kory Maincent <kory.maincent@bootlin.com>
+.. index::
+ single: extension (command)
+
extension command
=================
diff --git a/doc/usage/cmd/false.rst b/doc/usage/cmd/false.rst
index a17fe86021..510377e22c 100644
--- a/doc/usage/cmd/false.rst
+++ b/doc/usage/cmd/false.rst
@@ -1,3 +1,6 @@
+.. index::
+ single: false (command)
+
false command
=============
diff --git a/doc/usage/cmd/fatinfo.rst b/doc/usage/cmd/fatinfo.rst
index af2eba4344..2e05ab8bec 100644
--- a/doc/usage/cmd/fatinfo.rst
+++ b/doc/usage/cmd/fatinfo.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: fatinfo (command)
+
fatinfo command
===============
diff --git a/doc/usage/cmd/fatload.rst b/doc/usage/cmd/fatload.rst
index 93acb27a53..6c048b7bda 100644
--- a/doc/usage/cmd/fatload.rst
+++ b/doc/usage/cmd/fatload.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: fatload (command)
+
fatload command
===============
diff --git a/doc/usage/cmd/fdt.rst b/doc/usage/cmd/fdt.rst
index 36b8230877..3e8c32cdea 100644
--- a/doc/usage/cmd/fdt.rst
+++ b/doc/usage/cmd/fdt.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: fdt (command)
+
fdt command
===========
diff --git a/doc/usage/cmd/font.rst b/doc/usage/cmd/font.rst
index 8ba149d759..adcd5126d0 100644
--- a/doc/usage/cmd/font.rst
+++ b/doc/usage/cmd/font.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: font (command)
+
font command
============
diff --git a/doc/usage/cmd/for.rst b/doc/usage/cmd/for.rst
index f9e504979c..4c98419b28 100644
--- a/doc/usage/cmd/for.rst
+++ b/doc/usage/cmd/for.rst
@@ -1,3 +1,6 @@
+.. index::
+ single: for (command)
+
for command
===========
diff --git a/doc/usage/cmd/fwu_mdata.rst b/doc/usage/cmd/fwu_mdata.rst
index ea3c22724a..f1bf08fde1 100644
--- a/doc/usage/cmd/fwu_mdata.rst
+++ b/doc/usage/cmd/fwu_mdata.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: fwu_mdata_read (command)
+
fwu_mdata_read command
======================
diff --git a/doc/usage/cmd/gpio.rst b/doc/usage/cmd/gpio.rst
index ee902138f1..4b0dc2716e 100644
--- a/doc/usage/cmd/gpio.rst
+++ b/doc/usage/cmd/gpio.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: gpio (command)
+
gpio command
============
diff --git a/doc/usage/cmd/gpt.rst b/doc/usage/cmd/gpt.rst
index cbbe44ab58..8534f78cba 100644
--- a/doc/usage/cmd/gpt.rst
+++ b/doc/usage/cmd/gpt.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: gpt (command)
+
gpt command
===========
diff --git a/doc/usage/cmd/history.rst b/doc/usage/cmd/history.rst
index 33d3fcd624..564a159665 100644
--- a/doc/usage/cmd/history.rst
+++ b/doc/usage/cmd/history.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: history (command)
+
history command
===============
diff --git a/doc/usage/cmd/host.rst b/doc/usage/cmd/host.rst
index e14508986c..072497db90 100644
--- a/doc/usage/cmd/host.rst
+++ b/doc/usage/cmd/host.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: host (command)
+
host command
============
diff --git a/doc/usage/cmd/imxtract.rst b/doc/usage/cmd/imxtract.rst
index 16be60b4aa..235d15e445 100644
--- a/doc/usage/cmd/imxtract.rst
+++ b/doc/usage/cmd/imxtract.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: imxtract (command)
+
imxtract command
================
diff --git a/doc/usage/cmd/load.rst b/doc/usage/cmd/load.rst
index 2c892ee1cb..bfa45c6f36 100644
--- a/doc/usage/cmd/load.rst
+++ b/doc/usage/cmd/load.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: load (command)
+
load command
============
diff --git a/doc/usage/cmd/loadb.rst b/doc/usage/cmd/loadb.rst
index 0464b1f41c..4f9a52c793 100644
--- a/doc/usage/cmd/loadb.rst
+++ b/doc/usage/cmd/loadb.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: loadb (command)
+
loadb command
=============
diff --git a/doc/usage/cmd/loadm.rst b/doc/usage/cmd/loadm.rst
index b657114043..005840a27b 100644
--- a/doc/usage/cmd/loadm.rst
+++ b/doc/usage/cmd/loadm.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: loadm (command)
+
loadm command
=============
diff --git a/doc/usage/cmd/loads.rst b/doc/usage/cmd/loads.rst
index e4cb063df6..0a2ac14acf 100644
--- a/doc/usage/cmd/loads.rst
+++ b/doc/usage/cmd/loads.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: loads (command)
+
loads command
=============
diff --git a/doc/usage/cmd/loadx.rst b/doc/usage/cmd/loadx.rst
index facca9b969..661b36723c 100644
--- a/doc/usage/cmd/loadx.rst
+++ b/doc/usage/cmd/loadx.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: loadx (command)
+
loadx command
=============
diff --git a/doc/usage/cmd/loady.rst b/doc/usage/cmd/loady.rst
index 3f8227ecf2..8367759471 100644
--- a/doc/usage/cmd/loady.rst
+++ b/doc/usage/cmd/loady.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: loady (command)
+
loady command
=============
diff --git a/doc/usage/cmd/mbr.rst b/doc/usage/cmd/mbr.rst
index bddf2f612a..925a118105 100644
--- a/doc/usage/cmd/mbr.rst
+++ b/doc/usage/cmd/mbr.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: mbr (command)
+
mbr command
===========
diff --git a/doc/usage/cmd/md.rst b/doc/usage/cmd/md.rst
index 7e9944e0dc..9ea148a8dc 100644
--- a/doc/usage/cmd/md.rst
+++ b/doc/usage/cmd/md.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: md (command)
+
md command
==========
diff --git a/doc/usage/cmd/mmc.rst b/doc/usage/cmd/mmc.rst
index 8394f647e8..5a64400eea 100644
--- a/doc/usage/cmd/mmc.rst
+++ b/doc/usage/cmd/mmc.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: mmc (command)
+
mmc command
===========
diff --git a/doc/usage/cmd/mtest.rst b/doc/usage/cmd/mtest.rst
index 81d1f8fd1b..e01f2a6d57 100644
--- a/doc/usage/cmd/mtest.rst
+++ b/doc/usage/cmd/mtest.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2022, Heinrich Schuchardt <xypron.glpk@gmx.de>
+.. index::
+ single: mtest (command)
+
mtest command
=============
diff --git a/doc/usage/cmd/mtrr.rst b/doc/usage/cmd/mtrr.rst
index 531153bb3e..c65618950b 100644
--- a/doc/usage/cmd/mtrr.rst
+++ b/doc/usage/cmd/mtrr.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: mtrr (command)
+
mtrr command
============
diff --git a/doc/usage/cmd/panic.rst b/doc/usage/cmd/panic.rst
index 115eba5bde..ba5ea62610 100644
--- a/doc/usage/cmd/panic.rst
+++ b/doc/usage/cmd/panic.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: panic (command)
+
panic command
=============
diff --git a/doc/usage/cmd/part.rst b/doc/usage/cmd/part.rst
index eee5225cad..58be38781e 100644
--- a/doc/usage/cmd/part.rst
+++ b/doc/usage/cmd/part.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: part (command)
+
part command
============
diff --git a/doc/usage/cmd/pause.rst b/doc/usage/cmd/pause.rst
index c79e399c02..6cdd83d316 100644
--- a/doc/usage/cmd/pause.rst
+++ b/doc/usage/cmd/pause.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0-or-later:
+.. index::
+ single: pause (command)
+
pause command
=============
diff --git a/doc/usage/cmd/pinmux.rst b/doc/usage/cmd/pinmux.rst
index 9f4392cd0d..30c5eb16a6 100644
--- a/doc/usage/cmd/pinmux.rst
+++ b/doc/usage/cmd/pinmux.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: pinmux (command)
+
pinmux command
==============
diff --git a/doc/usage/cmd/printenv.rst b/doc/usage/cmd/printenv.rst
index d4184fd65e..dfdb362493 100644
--- a/doc/usage/cmd/printenv.rst
+++ b/doc/usage/cmd/printenv.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: printenv (command)
+
printenv command
================
diff --git a/doc/usage/cmd/pstore.rst b/doc/usage/cmd/pstore.rst
index 1c8374513a..63a437135e 100644
--- a/doc/usage/cmd/pstore.rst
+++ b/doc/usage/cmd/pstore.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: pstore (command)
+
pstore command
==============
diff --git a/doc/usage/cmd/qfw.rst b/doc/usage/cmd/qfw.rst
index e734b26671..40770acb3c 100644
--- a/doc/usage/cmd/qfw.rst
+++ b/doc/usage/cmd/qfw.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: qfw (command)
+
qfw command
===========
diff --git a/doc/usage/cmd/reset.rst b/doc/usage/cmd/reset.rst
index 384d5d60f8..126db21cdb 100644
--- a/doc/usage/cmd/reset.rst
+++ b/doc/usage/cmd/reset.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: reset (command)
+
reset command
=============
diff --git a/doc/usage/cmd/rng.rst b/doc/usage/cmd/rng.rst
index 1a352da41a..274e4d88df 100644
--- a/doc/usage/cmd/rng.rst
+++ b/doc/usage/cmd/rng.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: rng (command)
+
rng command
===========
diff --git a/doc/usage/cmd/saves.rst b/doc/usage/cmd/saves.rst
index 5823f88379..b380a4feb6 100644
--- a/doc/usage/cmd/saves.rst
+++ b/doc/usage/cmd/saves.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: saves (command)
+
saves command
=============
diff --git a/doc/usage/cmd/sbi.rst b/doc/usage/cmd/sbi.rst
index 713e0b9c81..5492925a8b 100644
--- a/doc/usage/cmd/sbi.rst
+++ b/doc/usage/cmd/sbi.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: sbi (command)
+
sbi command
===========
diff --git a/doc/usage/cmd/scmi.rst b/doc/usage/cmd/scmi.rst
index 9ea7e0e41d..9591cdc07a 100644
--- a/doc/usage/cmd/scmi.rst
+++ b/doc/usage/cmd/scmi.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: scmi (command)
+
scmi command
============
diff --git a/doc/usage/cmd/scp03.rst b/doc/usage/cmd/scp03.rst
index 7ff87ed85a..5fdddb3e81 100644
--- a/doc/usage/cmd/scp03.rst
+++ b/doc/usage/cmd/scp03.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: scp03 (command)
+
scp03 command
=============
diff --git a/doc/usage/cmd/seama.rst b/doc/usage/cmd/seama.rst
index 356c00a723..17fd559f48 100644
--- a/doc/usage/cmd/seama.rst
+++ b/doc/usage/cmd/seama.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: seama (command)
+
seama command
=============
diff --git a/doc/usage/cmd/setexpr.rst b/doc/usage/cmd/setexpr.rst
index 4d19fa340d..d245a13ca8 100644
--- a/doc/usage/cmd/setexpr.rst
+++ b/doc/usage/cmd/setexpr.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: setexpr (command)
+
setexpr command
===============
diff --git a/doc/usage/cmd/sf.rst b/doc/usage/cmd/sf.rst
index 71bd1be517..24d5dc692d 100644
--- a/doc/usage/cmd/sf.rst
+++ b/doc/usage/cmd/sf.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: sf (command)
+
sf command
==========
diff --git a/doc/usage/cmd/size.rst b/doc/usage/cmd/size.rst
index f0c35e4826..306fcba0ba 100644
--- a/doc/usage/cmd/size.rst
+++ b/doc/usage/cmd/size.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: size (command)
+
size command
============
diff --git a/doc/usage/cmd/sleep.rst b/doc/usage/cmd/sleep.rst
index d19e5b3af8..a372e4da0e 100644
--- a/doc/usage/cmd/sleep.rst
+++ b/doc/usage/cmd/sleep.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2023, Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
+.. index::
+ single: sleep (command)
+
sleep command
=============
diff --git a/doc/usage/cmd/sm.rst b/doc/usage/cmd/sm.rst
index f6524a1c2e..b767647d77 100644
--- a/doc/usage/cmd/sm.rst
+++ b/doc/usage/cmd/sm.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: sm (command)
+
sm command
==========
diff --git a/doc/usage/cmd/sound.rst b/doc/usage/cmd/sound.rst
index 2cfe9b7ad1..97d610f374 100644
--- a/doc/usage/cmd/sound.rst
+++ b/doc/usage/cmd/sound.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2022, Heinrich Schuchardt <xypron.glpk@gmx.de>
+.. index::
+ single: sound (command)
+
sound command
=============
diff --git a/doc/usage/cmd/source.rst b/doc/usage/cmd/source.rst
index 697f644745..0de5f33390 100644
--- a/doc/usage/cmd/source.rst
+++ b/doc/usage/cmd/source.rst
@@ -1,6 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
.. Copyright 2022, Heinrich Schuchardt <xypron.glpk@gmx.de>
+.. index::
+ single: source (command)
+
source command
==============
diff --git a/doc/usage/cmd/temperature.rst b/doc/usage/cmd/temperature.rst
index a5144ec50f..945bc8204a 100644
--- a/doc/usage/cmd/temperature.rst
+++ b/doc/usage/cmd/temperature.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0-or-later
+.. index::
+ single: temperature (command)
+
temperature command
===================
diff --git a/doc/usage/cmd/tftpput.rst b/doc/usage/cmd/tftpput.rst
index 52ba7b179a..351c9faa38 100644
--- a/doc/usage/cmd/tftpput.rst
+++ b/doc/usage/cmd/tftpput.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: tftpput (command)
+
tftpput command
===============
diff --git a/doc/usage/cmd/trace.rst b/doc/usage/cmd/trace.rst
index 3bdf4f0a86..ad6db12394 100644
--- a/doc/usage/cmd/trace.rst
+++ b/doc/usage/cmd/trace.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: trace (command)
+
trace command
=============
diff --git a/doc/usage/cmd/true.rst b/doc/usage/cmd/true.rst
index f9ef71b2d1..adf641386b 100644
--- a/doc/usage/cmd/true.rst
+++ b/doc/usage/cmd/true.rst
@@ -1,3 +1,6 @@
+.. index::
+ single: true (command)
+
true command
============
diff --git a/doc/usage/cmd/ums.rst b/doc/usage/cmd/ums.rst
index 3cde5fa1f2..9d379e3c82 100644
--- a/doc/usage/cmd/ums.rst
+++ b/doc/usage/cmd/ums.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+
+.. index::
+ single: ums (command)
+
ums command
===========
diff --git a/doc/usage/cmd/unbind.rst b/doc/usage/cmd/unbind.rst
index 594e4f0689..0309e90f6e 100644
--- a/doc/usage/cmd/unbind.rst
+++ b/doc/usage/cmd/unbind.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: unbind (command)
+
unbind command
==============
diff --git a/doc/usage/cmd/ut.rst b/doc/usage/cmd/ut.rst
index a3039634f2..ddc48ec42d 100644
--- a/doc/usage/cmd/ut.rst
+++ b/doc/usage/cmd/ut.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: ut (command)
+
ut command
==========
diff --git a/doc/usage/cmd/wdt.rst b/doc/usage/cmd/wdt.rst
index 8bb8b36178..f48b884090 100644
--- a/doc/usage/cmd/wdt.rst
+++ b/doc/usage/cmd/wdt.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: wdt (command)
+
wdt command
===========
diff --git a/doc/usage/cmd/wget.rst b/doc/usage/cmd/wget.rst
index 8e7383b6c6..b8ca35bb14 100644
--- a/doc/usage/cmd/wget.rst
+++ b/doc/usage/cmd/wget.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: wget (command)
+
wget command
============
diff --git a/doc/usage/cmd/write.rst b/doc/usage/cmd/write.rst
index c16870d6dc..f42dc003dd 100644
--- a/doc/usage/cmd/write.rst
+++ b/doc/usage/cmd/write.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0-or-later:
+.. index::
+ single: write (command)
+
write command
=============
diff --git a/doc/usage/cmd/xxd.rst b/doc/usage/cmd/xxd.rst
index 13bb4389cc..f010a9dbb4 100644
--- a/doc/usage/cmd/xxd.rst
+++ b/doc/usage/cmd/xxd.rst
@@ -1,5 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0+:
+.. index::
+ single: xxd (command)
+
xxd command
===========
diff --git a/doc/usage/dfu.rst b/doc/usage/dfu.rst
index 8845a71df3..8cc09c308d 100644
--- a/doc/usage/dfu.rst
+++ b/doc/usage/dfu.rst
@@ -6,11 +6,11 @@ Device Firmware Upgrade (DFU)
Overview
--------
-The Device Firmware Upgrade (DFU) allows to download and upload firmware
-to/from U-Boot connected over USB.
+Device Firmware Upgrade (DFU) enables the download and upload of firmware
+to/from U-Boot while connected over USB.
U-Boot follows the Universal Serial Bus Device Class Specification for
-Device Firmware Upgrade Version 1.1 the USB forum (DFU v1.1 in www.usb.org).
+Device Firmware Upgrade Version 1.1 from the USB forum (DFU v1.1 in www.usb.org).
U-Boot implements this DFU capability (CONFIG_DFU) with the command dfu
(cmd/dfu.c / CONFIG_CMD_DFU) based on:
@@ -43,7 +43,7 @@ target (for example OTP), only based on the weak functions:
Configuration Options
---------------------
-The following configuration option are relevant for device firmware upgrade:
+The following configuration options are relevant to device firmware upgrade:
* CONFIG_DFU
* CONFIG_DFU_OVER_USB
@@ -60,7 +60,7 @@ The following configuration option are relevant for device firmware upgrade:
Environment variables
---------------------
-The dfu command uses 3 environments variables:
+The dfu command uses 3 environment variables:
dfu_alt_info
The DFU setting for the USB download gadget with a semicolon separated
@@ -90,17 +90,17 @@ Commands
--------
dfu <USB_controller> [<interface> <dev>] list
- list the alternate device defined in *dfu_alt_info*
+ List the alternate device defined in *dfu_alt_info*.
dfu <USB_controller> [<interface> <dev>] [<timeout>]
- start the dfu stack on the USB instance with the selected medium
+ Start the dfu stack on the USB instance with the selected medium
backend and use the *dfu_alt_info* variable to configure the
- alternate setting and link each one with the medium
- The dfu command continue until receive a ^C in console or
- a DFU detach transaction from HOST. If CONFIG_DFU_TIMEOUT option
- is enabled and <timeout> parameter is present in the command line,
+ alternate setting and link each one with the medium.
+ The dfu command continues until it receives a ^C in the console or
+ a DFU detach transaction from the HOST. If the CONFIG_DFU_TIMEOUT option
+ is enabled and a <timeout> parameter is present in the command line,
the DFU operation will be aborted automatically after <timeout>
- seconds of waiting remote to initiate DFU session.
+ seconds of waiting for the remote to initiate a DFU session.
The possible values of <interface> are (with <USB controller> = 0 in the dfu
command example)
@@ -139,11 +139,11 @@ mmc
u-boot raw 0x80 0x800;uImage ext4 0 2
- If don't want to flash given image file to storage, use "skip" type
- entity.
+ If you don't want to flash the given image file to storage, use the "skip"
+ type entity.
- - It can be used to protect flashing wrong image for the specific board.
- - Especailly, this layout will be useful when thor protocol is used,
+ - It can be used to protect from flashing the wrong image for the specific board.
+ - Especially, this layout will be useful when the thor protocol is used,
which performs flashing in batch mode, where more than one file is
processed.
@@ -153,18 +153,18 @@ mmc
u-boot-<board1>.bin raw 0x80 0x800; u-boot-<board2>.bin skip 0 0
- When flashing new system image requires do some more complex things
- than just writing data to the storage medium, one can use 'script'
- type. Data written to such entity will be executed as a command list
- in the u-boot's shell. This for example allows to re-create partition
- layout and even set new *dfu_alt_info* for the newly created paritions.
- Such script would look like::
+ When flashing a new system image requires you to do some more complex
+ things than just writing data to the storage medium, one can use 'script'
+ type. Data written to such an entity will be executed as a command list
+ in the u-boot's shell. This for example allows you to re-create a partition
+ layout and even set a new *dfu_alt_info* for the newly created partitions.
+ Such a script would look like::
setenv dfu_alt_info ...
setenv mbr_parts ...
mbr write ...
- Please note that this means that user will be able to execute any
+ Please note that this means the user will be able to execute any
arbitrary commands just like in the u-boot's shell.
nand
@@ -216,8 +216,8 @@ sf
each element in *dfu_alt_info* being either of:
* <name> raw <offset> <size> raw access to sf device
- * <name> part <dev_id> <part_id> raw acces to partition
- * <name> partubi <dev_id> <part_id> raw acces to ubi partition
+ * <name> part <dev_id> <part_id> raw access to partition
+ * <name> partubi <dev_id> <part_id> raw access to ubi partition
with
@@ -288,17 +288,17 @@ Callbacks
The weak callback functions can be implemented to manage specific behavior
dfu_initiated_callback
- called when the DFU transaction is started, used to initiase the device
+ called when the DFU transaction is started, used to initialize the device
dfu_flush_callback
called at the end of the DFU write after DFU manifestation, used to manage
- the device when DFU transaction is closed
+ the device when the DFU transaction is closed
Host tools
----------
When U-Boot runs the dfu stack, the DFU host tools can be used
-to send/receive firmwares on each configurated alternate.
+to send/receive firmware images on each configured alternate.
For example dfu-util is a host side implementation of the DFU 1.1
specifications(http://dfu-util.sourceforge.net/) which works with U-Boot.
@@ -409,8 +409,8 @@ Same example with MTD backend
Example 3
-firmware located in SD Card (mmc) and virtual partition on OTP and PMIC not
-volatile memory
+firmware located in SD Card (mmc) and virtual partition on OTP and PMIC
+non-volatile memory
- alternate 1 (alt=1) for scard
- alternate 2 (alt=2) for OTP (virtual)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 23173139e0..7fc53a6d61 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -122,6 +122,13 @@ config RTC_EMULATION
CONFIG_BOOTP_NTPSERVER. The RTC time is advanced according to CPU
ticks.
+config RTC_GOLDFISH
+ bool "Enable Goldfish driver"
+ depends on DM_RTC
+ help
+ The Goldfish RTC is a virtual device which may be supplied by QEMU.
+ It is enabled by default on QEMU's RISC-V virt machine.
+
config RTC_ISL1208
bool "Enable ISL1208 driver"
depends on DM_RTC
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 308fab8da9..03a424c31a 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_RTC_DS1374) += ds1374.o
obj-$(CONFIG_RTC_DS3231) += ds3231.o
obj-$(CONFIG_RTC_DS3232) += ds3232.o
obj-$(CONFIG_RTC_EMULATION) += emul_rtc.o
+obj-$(CONFIG_RTC_GOLDFISH) += goldfish_rtc.o
obj-$(CONFIG_RTC_HT1380) += ht1380.o
obj-$(CONFIG_$(SPL_TPL_)RTC_SANDBOX) += i2c_rtc_emul.o
obj-$(CONFIG_RTC_ISL1208) += isl1208.o
diff --git a/drivers/rtc/goldfish_rtc.c b/drivers/rtc/goldfish_rtc.c
new file mode 100644
index 0000000000..1ace990385
--- /dev/null
+++ b/drivers/rtc/goldfish_rtc.c
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2023, Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
+ *
+ * This driver emulates a real time clock based on timer ticks.
+ */
+
+#include <div64.h>
+#include <dm.h>
+#include <mapmem.h>
+#include <rtc.h>
+#include <linux/io.h>
+
+/**
+ * struct goldfish_rtc - private data for RTC driver
+ */
+struct goldfish_rtc {
+ /**
+ * @base: base address for register file
+ */
+ void __iomem *base;
+ /**
+ * @isdst: daylight saving time
+ */
+ int isdst;
+};
+
+/* Register offsets */
+#define GOLDFISH_TIME_LOW 0x00
+#define GOLDFISH_TIME_HIGH 0x04
+
+static int goldfish_rtc_get(struct udevice *dev, struct rtc_time *time)
+{
+ struct goldfish_rtc *priv = dev_get_priv(dev);
+ void __iomem *base = priv->base;
+ u64 time_high;
+ u64 time_low;
+ u64 now;
+
+ time_low = ioread32(base + GOLDFISH_TIME_LOW);
+ time_high = ioread32(base + GOLDFISH_TIME_HIGH);
+ now = (time_high << 32) | time_low;
+
+ do_div(now, 1000000000U);
+
+ rtc_to_tm(now, time);
+ time->tm_isdst = priv->isdst;
+
+ return 0;
+}
+
+static int goldfish_rtc_set(struct udevice *dev, const struct rtc_time *time)
+{
+ struct goldfish_rtc *priv = dev_get_priv(dev);
+ void __iomem *base = priv->base;
+ u64 now;
+
+ if (time->tm_year < 1970)
+ return -EINVAL;
+
+ now = rtc_mktime(time) * 1000000000ULL;
+ iowrite32(now >> 32, base + GOLDFISH_TIME_HIGH);
+ iowrite32(now, base + GOLDFISH_TIME_LOW);
+
+ if (time->tm_isdst > 0)
+ priv->isdst = 1;
+ else if (time->tm_isdst < 0)
+ priv->isdst = -1;
+ else
+ priv->isdst = 0;
+
+ return 0;
+}
+
+int goldfish_rtc_probe(struct udevice *dev)
+{
+ struct goldfish_rtc *priv = dev_get_priv(dev);
+ fdt_addr_t addr;
+
+ addr = dev_read_addr(dev);
+ if (addr == FDT_ADDR_T_NONE)
+ return -EINVAL;
+ priv->base = map_sysmem(addr, 0x20);
+
+ return 0;
+}
+
+static const struct rtc_ops goldfish_rtc_ops = {
+ .get = goldfish_rtc_get,
+ .set = goldfish_rtc_set,
+};
+
+static const struct udevice_id goldfish_rtc_of_match[] = {
+ { .compatible = "google,goldfish-rtc", },
+ {},
+};
+
+U_BOOT_DRIVER(rtc_goldfish) = {
+ .name = "rtc_goldfish",
+ .id = UCLASS_RTC,
+ .ops = &goldfish_rtc_ops,
+ .probe = goldfish_rtc_probe,
+ .of_match = goldfish_rtc_of_match,
+ .priv_auto = sizeof(struct goldfish_rtc),
+};
diff --git a/fs/fs.c b/fs/fs.c
index f1a0b70d1d..acf465bdd8 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -791,10 +791,9 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
return 1;
}
- if (IS_ENABLED(CONFIG_CMD_BOOTEFI))
- efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
- (argc > 4) ? argv[4] : "", map_sysmem(addr, 0),
- len_read);
+ efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
+ (argc > 4) ? argv[4] : "", map_sysmem(addr, 0),
+ len_read);
printf("%llu bytes read in %lu ms", len_read, time);
if (time > 0) {
diff --git a/include/efi_loader.h b/include/efi_loader.h
index d3725041b2..d5fca2fa5e 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -90,11 +90,7 @@ efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len);
* back to u-boot world
*/
void efi_restore_gd(void);
-/* Call this to unset the current device name */
-void efi_clear_bootdev(void);
-/* Call this to set the current device name */
-void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
- void *buffer, size_t buffer_size);
+
/* Called by networking code to memorize the dhcp ack package */
void efi_net_set_dhcp_ack(void *pkt, int len);
/* Print information about all loaded images */
@@ -116,10 +112,6 @@ static inline efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
/* No loader configured, stub out EFI_ENTRY */
static inline void efi_restore_gd(void) { }
-static inline void efi_clear_bootdev(void) { }
-static inline void efi_set_bootdev(const char *dev, const char *devnr,
- const char *path, void *buffer,
- size_t buffer_size) { }
static inline void efi_net_set_dhcp_ack(void *pkt, int len) { }
static inline void efi_print_image_infos(void *pc) { }
static inline efi_status_t efi_launch_capsules(void)
@@ -129,6 +121,20 @@ static inline efi_status_t efi_launch_capsules(void)
#endif /* CONFIG_IS_ENABLED(EFI_LOADER) */
+#if CONFIG_IS_ENABLED(EFI_BINARY_EXEC)
+/* Call this to unset the current device name */
+void efi_clear_bootdev(void);
+/* Call this to set the current device name */
+void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
+ void *buffer, size_t buffer_size);
+#else
+static inline void efi_clear_bootdev(void) { }
+
+static inline void efi_set_bootdev(const char *dev, const char *devnr,
+ const char *path, void *buffer,
+ size_t buffer_size) { }
+#endif
+
/* Maximum number of configuration tables */
#define EFI_MAX_CONFIGURATION_TABLES 16
@@ -541,8 +547,8 @@ efi_status_t efi_env_set_load_options(efi_handle_t handle, const char *env_var,
u16 **load_options);
/* Install device tree */
efi_status_t efi_install_fdt(void *fdt);
-/* Run loaded UEFI image */
-efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size);
+/* Execute loaded UEFI image */
+efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options);
/* Run loaded UEFI image with given fdt */
efi_status_t efi_binary_run(void *image, size_t size, void *fdt);
/* Initialize variable services */
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index ea807342f0..db5571de1d 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -32,7 +32,16 @@ config EFI_LOADER
if EFI_LOADER
-config BOOTEFI_BOOTMGR
+config EFI_BINARY_EXEC
+ bool "Execute UEFI binary"
+ default y
+ help
+ Select this option if you want to execute the UEFI binary after
+ loading it with U-Boot load commands or other methods.
+ You may enable CMD_BOOTEFI_BINARY so that you can use bootefi
+ command to do that.
+
+config EFI_BOOTMGR
bool "UEFI Boot Manager"
default y
select BOOTMETH_GLOBAL if BOOTSTD
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 25060bbd95..fcb0af7e7d 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -49,7 +49,8 @@ targets += initrddump.o
endif
obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
-obj-$(CONFIG_BOOTEFI_BOOTMGR) += efi_bootmgr.o
+obj-$(CONFIG_EFI_BOOTMGR) += efi_bootmgr.o
+obj-$(CONFIG_EFI_BINARY_EXEC) += efi_bootbin.o
obj-y += efi_boottime.o
obj-y += efi_helper.o
obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c
new file mode 100644
index 0000000000..733cc1a61b
--- /dev/null
+++ b/lib/efi_loader/efi_bootbin.c
@@ -0,0 +1,211 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * For the code moved from cmd/bootefi.c
+ * Copyright (c) 2016 Alexander Graf
+ */
+
+#define LOG_CATEGORY LOGC_EFI
+
+#include <charset.h>
+#include <efi.h>
+#include <efi_loader.h>
+#include <env.h>
+#include <image.h>
+#include <log.h>
+#include <malloc.h>
+
+static struct efi_device_path *bootefi_image_path;
+static struct efi_device_path *bootefi_device_path;
+static void *image_addr;
+static size_t image_size;
+
+/**
+ * efi_get_image_parameters() - return image parameters
+ *
+ * @img_addr: address of loaded image in memory
+ * @img_size: size of loaded image
+ */
+void efi_get_image_parameters(void **img_addr, size_t *img_size)
+{
+ *img_addr = image_addr;
+ *img_size = image_size;
+}
+
+/**
+ * efi_clear_bootdev() - clear boot device
+ */
+void efi_clear_bootdev(void)
+{
+ efi_free_pool(bootefi_device_path);
+ efi_free_pool(bootefi_image_path);
+ bootefi_device_path = NULL;
+ bootefi_image_path = NULL;
+ image_addr = NULL;
+ image_size = 0;
+}
+
+/**
+ * efi_set_bootdev() - set boot device
+ *
+ * This function is called when a file is loaded, e.g. via the 'load' command.
+ * We use the path to this file to inform the UEFI binary about the boot device.
+ *
+ * @dev: device, e.g. "MMC"
+ * @devnr: number of the device, e.g. "1:2"
+ * @path: path to file loaded
+ * @buffer: buffer with file loaded
+ * @buffer_size: size of file loaded
+ */
+void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
+ void *buffer, size_t buffer_size)
+{
+ struct efi_device_path *device, *image;
+ efi_status_t ret;
+
+ log_debug("dev=%s, devnr=%s, path=%s, buffer=%p, size=%zx\n", dev,
+ devnr, path, buffer, buffer_size);
+
+ /* Forget overwritten image */
+ if (buffer + buffer_size >= image_addr &&
+ image_addr + image_size >= buffer)
+ efi_clear_bootdev();
+
+ /* Remember only PE-COFF and FIT images */
+ if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) {
+ if (IS_ENABLED(CONFIG_FIT) &&
+ !fit_check_format(buffer, IMAGE_SIZE_INVAL)) {
+ /*
+ * FIT images of type EFI_OS are started via command
+ * bootm. We should not use their boot device with the
+ * bootefi command.
+ */
+ buffer = 0;
+ buffer_size = 0;
+ } else {
+ log_debug("- not remembering image\n");
+ return;
+ }
+ }
+
+ /* efi_set_bootdev() is typically called repeatedly, recover memory */
+ efi_clear_bootdev();
+
+ image_addr = buffer;
+ image_size = buffer_size;
+
+ ret = efi_dp_from_name(dev, devnr, path, &device, &image);
+ if (ret == EFI_SUCCESS) {
+ bootefi_device_path = device;
+ if (image) {
+ /* FIXME: image should not contain device */
+ struct efi_device_path *image_tmp = image;
+
+ efi_dp_split_file_path(image, &device, &image);
+ efi_free_pool(image_tmp);
+ }
+ bootefi_image_path = image;
+ log_debug("- boot device %pD\n", device);
+ if (image)
+ log_debug("- image %pD\n", image);
+ } else {
+ log_debug("- efi_dp_from_name() failed, err=%lx\n", ret);
+ efi_clear_bootdev();
+ }
+}
+
+/**
+ * efi_run_image() - run loaded UEFI image
+ *
+ * @source_buffer: memory address of the UEFI image
+ * @source_size: size of the UEFI image
+ * Return: status code
+ */
+efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
+{
+ efi_handle_t mem_handle = NULL, handle;
+ struct efi_device_path *file_path = NULL;
+ struct efi_device_path *msg_path;
+ efi_status_t ret, ret2;
+ u16 *load_options;
+
+ if (!bootefi_device_path || !bootefi_image_path) {
+ log_debug("Not loaded from disk\n");
+ /*
+ * Special case for efi payload not loaded from disk,
+ * such as 'bootefi hello' or for example payload
+ * loaded directly into memory via JTAG, etc:
+ */
+ file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
+ (uintptr_t)source_buffer,
+ source_size);
+ /*
+ * Make sure that device for device_path exist
+ * in load_image(). Otherwise, shell and grub will fail.
+ */
+ ret = efi_install_multiple_protocol_interfaces(&mem_handle,
+ &efi_guid_device_path,
+ file_path, NULL);
+ if (ret != EFI_SUCCESS)
+ goto out;
+ msg_path = file_path;
+ } else {
+ file_path = efi_dp_concat(bootefi_device_path,
+ bootefi_image_path, false);
+ msg_path = bootefi_image_path;
+ log_debug("Loaded from disk\n");
+ }
+
+ log_info("Booting %pD\n", msg_path);
+
+ ret = EFI_CALL(efi_load_image(false, efi_root, file_path, source_buffer,
+ source_size, &handle));
+ if (ret != EFI_SUCCESS) {
+ log_err("Loading image failed\n");
+ goto out;
+ }
+
+ /* Transfer environment variable as load options */
+ ret = efi_env_set_load_options(handle, "bootargs", &load_options);
+ if (ret != EFI_SUCCESS)
+ goto out;
+
+ ret = do_bootefi_exec(handle, load_options);
+
+out:
+ ret2 = efi_uninstall_multiple_protocol_interfaces(mem_handle,
+ &efi_guid_device_path,
+ file_path, NULL);
+ efi_free_pool(file_path);
+ return (ret != EFI_SUCCESS) ? ret : ret2;
+}
+
+/**
+ * efi_binary_run() - run loaded UEFI image
+ *
+ * @image: memory address of the UEFI image
+ * @size: size of the UEFI image
+ * @fdt: device-tree
+ *
+ * Execute an EFI binary image loaded at @image.
+ * @size may be zero if the binary is loaded with U-Boot load command.
+ *
+ * Return: status code
+ */
+efi_status_t efi_binary_run(void *image, size_t size, void *fdt)
+{
+ efi_status_t ret;
+
+ /* Initialize EFI drivers */
+ ret = efi_init_obj_list();
+ if (ret != EFI_SUCCESS) {
+ log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
+ ret & ~EFI_ERROR_MASK);
+ return -1;
+ }
+
+ ret = efi_install_fdt(fdt);
+ if (ret != EFI_SUCCESS)
+ return ret;
+
+ return efi_run_image(image, size);
+}
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index dd2dd23c7b..68d7db5ea3 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -3,8 +3,6 @@
* EFI boot manager
*
* Copyright (c) 2017 Rob Clark
- * For the code moved from cmd/bootefi.c
- * Copyright (c) 2016 Alexander Graf
*/
#define LOG_CATEGORY LOGC_EFI
@@ -21,17 +19,6 @@
#include <efi_variable.h>
#include <asm/unaligned.h>
-/* TODO: temporarily added here; clean up later */
-#include <bootm.h>
-#include <efi_selftest.h>
-#include <env.h>
-#include <mapmem.h>
-#include <asm/global_data.h>
-#include <linux/libfdt.h>
-#include <linux/libfdt_env.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
static const struct efi_boot_services *bs;
static const struct efi_runtime_services *rs;
@@ -1128,384 +1115,6 @@ out:
return ret;
}
-static struct efi_device_path *bootefi_image_path;
-static struct efi_device_path *bootefi_device_path;
-static void *image_addr;
-static size_t image_size;
-
-/**
- * efi_get_image_parameters() - return image parameters
- *
- * @img_addr: address of loaded image in memory
- * @img_size: size of loaded image
- */
-void efi_get_image_parameters(void **img_addr, size_t *img_size)
-{
- *img_addr = image_addr;
- *img_size = image_size;
-}
-
-/**
- * efi_clear_bootdev() - clear boot device
- */
-void efi_clear_bootdev(void)
-{
- efi_free_pool(bootefi_device_path);
- efi_free_pool(bootefi_image_path);
- bootefi_device_path = NULL;
- bootefi_image_path = NULL;
- image_addr = NULL;
- image_size = 0;
-}
-
-/**
- * efi_set_bootdev() - set boot device
- *
- * This function is called when a file is loaded, e.g. via the 'load' command.
- * We use the path to this file to inform the UEFI binary about the boot device.
- *
- * @dev: device, e.g. "MMC"
- * @devnr: number of the device, e.g. "1:2"
- * @path: path to file loaded
- * @buffer: buffer with file loaded
- * @buffer_size: size of file loaded
- */
-void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
- void *buffer, size_t buffer_size)
-{
- struct efi_device_path *device, *image;
- efi_status_t ret;
-
- log_debug("dev=%s, devnr=%s, path=%s, buffer=%p, size=%zx\n", dev,
- devnr, path, buffer, buffer_size);
-
- /* Forget overwritten image */
- if (buffer + buffer_size >= image_addr &&
- image_addr + image_size >= buffer)
- efi_clear_bootdev();
-
- /* Remember only PE-COFF and FIT images */
- if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) {
- if (IS_ENABLED(CONFIG_FIT) &&
- !fit_check_format(buffer, IMAGE_SIZE_INVAL)) {
- /*
- * FIT images of type EFI_OS are started via command
- * bootm. We should not use their boot device with the
- * bootefi command.
- */
- buffer = 0;
- buffer_size = 0;
- } else {
- log_debug("- not remembering image\n");
- return;
- }
- }
-
- /* efi_set_bootdev() is typically called repeatedly, recover memory */
- efi_clear_bootdev();
-
- image_addr = buffer;
- image_size = buffer_size;
-
- ret = efi_dp_from_name(dev, devnr, path, &device, &image);
- if (ret == EFI_SUCCESS) {
- bootefi_device_path = device;
- if (image) {
- /* FIXME: image should not contain device */
- struct efi_device_path *image_tmp = image;
-
- efi_dp_split_file_path(image, &device, &image);
- efi_free_pool(image_tmp);
- }
- bootefi_image_path = image;
- log_debug("- boot device %pD\n", device);
- if (image)
- log_debug("- image %pD\n", image);
- } else {
- log_debug("- efi_dp_from_name() failed, err=%lx\n", ret);
- efi_clear_bootdev();
- }
-}
-
-/**
- * efi_env_set_load_options() - set load options from environment variable
- *
- * @handle: the image handle
- * @env_var: name of the environment variable
- * @load_options: pointer to load options (output)
- * Return: status code
- */
-efi_status_t efi_env_set_load_options(efi_handle_t handle,
- const char *env_var,
- u16 **load_options)
-{
- const char *env = env_get(env_var);
- size_t size;
- u16 *pos;
- efi_status_t ret;
-
- *load_options = NULL;
- if (!env)
- return EFI_SUCCESS;
- size = sizeof(u16) * (utf8_utf16_strlen(env) + 1);
- pos = calloc(size, 1);
- if (!pos)
- return EFI_OUT_OF_RESOURCES;
- *load_options = pos;
- utf8_utf16_strcpy(&pos, env);
- ret = efi_set_load_options(handle, size, *load_options);
- if (ret != EFI_SUCCESS) {
- free(*load_options);
- *load_options = NULL;
- }
- return ret;
-}
-
-/**
- * copy_fdt() - Copy the device tree to a new location available to EFI
- *
- * The FDT is copied to a suitable location within the EFI memory map.
- * Additional 12 KiB are added to the space in case the device tree needs to be
- * expanded later with fdt_open_into().
- *
- * @fdtp: On entry a pointer to the flattened device tree.
- * On exit a pointer to the copy of the flattened device tree.
- * FDT start
- * Return: status code
- */
-static efi_status_t copy_fdt(void **fdtp)
-{
- unsigned long fdt_ram_start = -1L, fdt_pages;
- efi_status_t ret = 0;
- void *fdt, *new_fdt;
- u64 new_fdt_addr;
- uint fdt_size;
- int i;
-
- for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
- u64 ram_start = gd->bd->bi_dram[i].start;
- u64 ram_size = gd->bd->bi_dram[i].size;
-
- if (!ram_size)
- continue;
-
- if (ram_start < fdt_ram_start)
- fdt_ram_start = ram_start;
- }
-
- /*
- * Give us at least 12 KiB of breathing room in case the device tree
- * needs to be expanded later.
- */
- fdt = *fdtp;
- fdt_pages = efi_size_in_pages(fdt_totalsize(fdt) + 0x3000);
- fdt_size = fdt_pages << EFI_PAGE_SHIFT;
-
- ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES,
- EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
- &new_fdt_addr);
- if (ret != EFI_SUCCESS) {
- log_err("ERROR: Failed to reserve space for FDT\n");
- goto done;
- }
- new_fdt = (void *)(uintptr_t)new_fdt_addr;
- memcpy(new_fdt, fdt, fdt_totalsize(fdt));
- fdt_set_totalsize(new_fdt, fdt_size);
-
- *fdtp = (void *)(uintptr_t)new_fdt_addr;
-done:
- return ret;
-}
-
-/**
- * get_config_table() - get configuration table
- *
- * @guid: GUID of the configuration table
- * Return: pointer to configuration table or NULL
- */
-static void *get_config_table(const efi_guid_t *guid)
-{
- size_t i;
-
- for (i = 0; i < systab.nr_tables; i++) {
- if (!guidcmp(guid, &systab.tables[i].guid))
- return systab.tables[i].table;
- }
- return NULL;
-}
-
-/**
- * efi_install_fdt() - install device tree
- *
- * If fdt is not EFI_FDT_USE_INTERNAL, the device tree located at that memory
- * address will be installed as configuration table, otherwise the device
- * tree located at the address indicated by environment variable fdt_addr or as
- * fallback fdtcontroladdr will be used.
- *
- * On architectures using ACPI tables device trees shall not be installed as
- * configuration table.
- *
- * @fdt: address of device tree or EFI_FDT_USE_INTERNAL to use
- * the hardware device tree as indicated by environment variable
- * fdt_addr or as fallback the internal device tree as indicated by
- * the environment variable fdtcontroladdr
- * Return: status code
- */
-efi_status_t efi_install_fdt(void *fdt)
-{
- struct bootm_headers img = { 0 };
- efi_status_t ret;
-
- /*
- * The EBBR spec requires that we have either an FDT or an ACPI table
- * but not both.
- */
- if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) && fdt)
- log_warning("WARNING: Can't have ACPI table and device tree - ignoring DT.\n");
-
- if (fdt == EFI_FDT_USE_INTERNAL) {
- const char *fdt_opt;
- uintptr_t fdt_addr;
-
- /* Look for device tree that is already installed */
- if (get_config_table(&efi_guid_fdt))
- return EFI_SUCCESS;
- /* Check if there is a hardware device tree */
- fdt_opt = env_get("fdt_addr");
- /* Use our own device tree as fallback */
- if (!fdt_opt) {
- fdt_opt = env_get("fdtcontroladdr");
- if (!fdt_opt) {
- log_err("ERROR: need device tree\n");
- return EFI_NOT_FOUND;
- }
- }
- fdt_addr = hextoul(fdt_opt, NULL);
- if (!fdt_addr) {
- log_err("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
- return EFI_LOAD_ERROR;
- }
- fdt = map_sysmem(fdt_addr, 0);
- }
-
- /* Install device tree */
- if (fdt_check_header(fdt)) {
- log_err("ERROR: invalid device tree\n");
- return EFI_LOAD_ERROR;
- }
-
- /* Create memory reservations as indicated by the device tree */
- efi_carve_out_dt_rsv(fdt);
-
- if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE))
- return EFI_SUCCESS;
-
- /* Prepare device tree for payload */
- ret = copy_fdt(&fdt);
- if (ret) {
- log_err("ERROR: out of memory\n");
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (image_setup_libfdt(&img, fdt, NULL)) {
- log_err("ERROR: failed to process device tree\n");
- return EFI_LOAD_ERROR;
- }
-
- efi_try_purge_kaslr_seed(fdt);
-
- if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
- ret = efi_tcg2_measure_dtb(fdt);
- if (ret == EFI_SECURITY_VIOLATION) {
- log_err("ERROR: failed to measure DTB\n");
- return ret;
- }
- }
-
- /* Install device tree as UEFI table */
- ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
- if (ret != EFI_SUCCESS) {
- log_err("ERROR: failed to install device tree\n");
- return ret;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- * do_bootefi_exec() - execute EFI binary
- *
- * The image indicated by @handle is started. When it returns the allocated
- * memory for the @load_options is freed.
- *
- * @handle: handle of loaded image
- * @load_options: load options
- * Return: status code
- *
- * Load the EFI binary into a newly assigned memory unwinding the relocation
- * information, install the loaded image protocol, and call the binary.
- */
-static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
-{
- efi_status_t ret;
- efi_uintn_t exit_data_size = 0;
- u16 *exit_data = NULL;
- struct efi_event *evt;
-
- /* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
- switch_to_non_secure_mode();
-
- /*
- * The UEFI standard requires that the watchdog timer is set to five
- * minutes when invoking an EFI boot option.
- *
- * Unified Extensible Firmware Interface (UEFI), version 2.7 Errata A
- * 7.5. Miscellaneous Boot Services - EFI_BOOT_SERVICES.SetWatchdogTimer
- */
- ret = efi_set_watchdog(300);
- if (ret != EFI_SUCCESS) {
- log_err("ERROR: Failed to set watchdog timer\n");
- goto out;
- }
-
- /* Call our payload! */
- ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
- if (ret != EFI_SUCCESS) {
- log_err("## Application failed, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
- if (exit_data) {
- log_err("## %ls\n", exit_data);
- efi_free_pool(exit_data);
- }
- }
-
- efi_restore_gd();
-
-out:
- free(load_options);
-
- if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD)) {
- if (efi_initrd_deregister() != EFI_SUCCESS)
- log_err("Failed to remove loadfile2 for initrd\n");
- }
-
- /* Notify EFI_EVENT_GROUP_RETURN_TO_EFIBOOTMGR event group. */
- list_for_each_entry(evt, &efi_events, link) {
- if (evt->group &&
- !guidcmp(evt->group,
- &efi_guid_event_group_return_to_efibootmgr)) {
- efi_signal_event(evt);
- EFI_CALL(systab.boottime->close_event(evt));
- break;
- }
- }
-
- /* Control is returned to U-Boot, disable EFI watchdog */
- efi_set_watchdog(0);
-
- return ret;
-}
-
/**
* efi_bootmgr_run() - execute EFI boot manager
* @fdt: Flat device tree
@@ -1542,100 +1151,3 @@ efi_status_t efi_bootmgr_run(void *fdt)
return do_bootefi_exec(handle, load_options);
}
-
-/**
- * efi_run_image() - run loaded UEFI image
- *
- * @source_buffer: memory address of the UEFI image
- * @source_size: size of the UEFI image
- * Return: status code
- */
-efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
-{
- efi_handle_t mem_handle = NULL, handle;
- struct efi_device_path *file_path = NULL;
- struct efi_device_path *msg_path;
- efi_status_t ret, ret2;
- u16 *load_options;
-
- if (!bootefi_device_path || !bootefi_image_path) {
- log_debug("Not loaded from disk\n");
- /*
- * Special case for efi payload not loaded from disk,
- * such as 'bootefi hello' or for example payload
- * loaded directly into memory via JTAG, etc:
- */
- file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
- (uintptr_t)source_buffer,
- source_size);
- /*
- * Make sure that device for device_path exist
- * in load_image(). Otherwise, shell and grub will fail.
- */
- ret = efi_install_multiple_protocol_interfaces(&mem_handle,
- &efi_guid_device_path,
- file_path, NULL);
- if (ret != EFI_SUCCESS)
- goto out;
- msg_path = file_path;
- } else {
- file_path = efi_dp_concat(bootefi_device_path,
- bootefi_image_path, false);
- msg_path = bootefi_image_path;
- log_debug("Loaded from disk\n");
- }
-
- log_info("Booting %pD\n", msg_path);
-
- ret = EFI_CALL(efi_load_image(false, efi_root, file_path, source_buffer,
- source_size, &handle));
- if (ret != EFI_SUCCESS) {
- log_err("Loading image failed\n");
- goto out;
- }
-
- /* Transfer environment variable as load options */
- ret = efi_env_set_load_options(handle, "bootargs", &load_options);
- if (ret != EFI_SUCCESS)
- goto out;
-
- ret = do_bootefi_exec(handle, load_options);
-
-out:
- ret2 = efi_uninstall_multiple_protocol_interfaces(mem_handle,
- &efi_guid_device_path,
- file_path, NULL);
- efi_free_pool(file_path);
- return (ret != EFI_SUCCESS) ? ret : ret2;
-}
-
-/**
- * efi_binary_run() - run loaded UEFI image
- *
- * @image: memory address of the UEFI image
- * @size: size of the UEFI image
- * @fdt: device-tree
- *
- * Execute an EFI binary image loaded at @image.
- * @size may be zero if the binary is loaded with U-Boot load command.
- *
- * Return: status code
- */
-efi_status_t efi_binary_run(void *image, size_t size, void *fdt)
-{
- efi_status_t ret;
-
- /* Initialize EFI drivers */
- ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
- return -1;
- }
-
- ret = efi_install_fdt(fdt);
- if (ret != EFI_SUCCESS)
- return ret;
-
- return efi_run_image(image, size);
-}
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 500fa10d40..46aa59b9e4 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -1061,7 +1061,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
if (path && !file)
return EFI_INVALID_PARAMETER;
- if (!strcmp(dev, "Mem") || !strcmp(dev, "hostfs")) {
+ if (IS_ENABLED(CONFIG_EFI_BINARY_EXEC) &&
+ (!strcmp(dev, "Mem") || !strcmp(dev, "hostfs"))) {
/* loadm command and semihosting */
efi_get_image_parameters(&image_addr, &image_size);
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 17f27ca1a0..11066eb505 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -4,13 +4,20 @@
*/
#define LOG_CATEGORY LOGC_EFI
+#include <bootm.h>
#include <env.h>
+#include <image.h>
+#include <log.h>
#include <malloc.h>
+#include <mapmem.h>
#include <dm.h>
#include <fs.h>
+#include <efi_api.h>
#include <efi_load_initrd.h>
#include <efi_loader.h>
#include <efi_variable.h>
+#include <linux/libfdt.h>
+#include <linux/list.h>
#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_LOAD_FILE2_INITRD)
/* GUID used by Linux to identify the LoadFile2 protocol with the initrd */
@@ -281,3 +288,282 @@ bool efi_search_bootorder(u16 *bootorder, efi_uintn_t num, u32 target, u32 *inde
return false;
}
+
+/**
+ * efi_env_set_load_options() - set load options from environment variable
+ *
+ * @handle: the image handle
+ * @env_var: name of the environment variable
+ * @load_options: pointer to load options (output)
+ * Return: status code
+ */
+efi_status_t efi_env_set_load_options(efi_handle_t handle,
+ const char *env_var,
+ u16 **load_options)
+{
+ const char *env = env_get(env_var);
+ size_t size;
+ u16 *pos;
+ efi_status_t ret;
+
+ *load_options = NULL;
+ if (!env)
+ return EFI_SUCCESS;
+ size = sizeof(u16) * (utf8_utf16_strlen(env) + 1);
+ pos = calloc(size, 1);
+ if (!pos)
+ return EFI_OUT_OF_RESOURCES;
+ *load_options = pos;
+ utf8_utf16_strcpy(&pos, env);
+ ret = efi_set_load_options(handle, size, *load_options);
+ if (ret != EFI_SUCCESS) {
+ free(*load_options);
+ *load_options = NULL;
+ }
+ return ret;
+}
+
+/**
+ * copy_fdt() - Copy the device tree to a new location available to EFI
+ *
+ * The FDT is copied to a suitable location within the EFI memory map.
+ * Additional 12 KiB are added to the space in case the device tree needs to be
+ * expanded later with fdt_open_into().
+ *
+ * @fdtp: On entry a pointer to the flattened device tree.
+ * On exit a pointer to the copy of the flattened device tree.
+ * FDT start
+ * Return: status code
+ */
+static efi_status_t copy_fdt(void **fdtp)
+{
+ unsigned long fdt_ram_start = -1L, fdt_pages;
+ efi_status_t ret = 0;
+ void *fdt, *new_fdt;
+ u64 new_fdt_addr;
+ uint fdt_size;
+ int i;
+
+ for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+ u64 ram_start = gd->bd->bi_dram[i].start;
+ u64 ram_size = gd->bd->bi_dram[i].size;
+
+ if (!ram_size)
+ continue;
+
+ if (ram_start < fdt_ram_start)
+ fdt_ram_start = ram_start;
+ }
+
+ /*
+ * Give us at least 12 KiB of breathing room in case the device tree
+ * needs to be expanded later.
+ */
+ fdt = *fdtp;
+ fdt_pages = efi_size_in_pages(fdt_totalsize(fdt) + 0x3000);
+ fdt_size = fdt_pages << EFI_PAGE_SHIFT;
+
+ ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES,
+ EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
+ &new_fdt_addr);
+ if (ret != EFI_SUCCESS) {
+ log_err("ERROR: Failed to reserve space for FDT\n");
+ goto done;
+ }
+ new_fdt = (void *)(uintptr_t)new_fdt_addr;
+ memcpy(new_fdt, fdt, fdt_totalsize(fdt));
+ fdt_set_totalsize(new_fdt, fdt_size);
+
+ *fdtp = (void *)(uintptr_t)new_fdt_addr;
+done:
+ return ret;
+}
+
+/**
+ * get_config_table() - get configuration table
+ *
+ * @guid: GUID of the configuration table
+ * Return: pointer to configuration table or NULL
+ */
+static void *get_config_table(const efi_guid_t *guid)
+{
+ size_t i;
+
+ for (i = 0; i < systab.nr_tables; i++) {
+ if (!guidcmp(guid, &systab.tables[i].guid))
+ return systab.tables[i].table;
+ }
+ return NULL;
+}
+
+/**
+ * efi_install_fdt() - install device tree
+ *
+ * If fdt is not EFI_FDT_USE_INTERNAL, the device tree located at that memory
+ * address will be installed as configuration table, otherwise the device
+ * tree located at the address indicated by environment variable fdt_addr or as
+ * fallback fdtcontroladdr will be used.
+ *
+ * On architectures using ACPI tables device trees shall not be installed as
+ * configuration table.
+ *
+ * @fdt: address of device tree or EFI_FDT_USE_INTERNAL to use
+ * the hardware device tree as indicated by environment variable
+ * fdt_addr or as fallback the internal device tree as indicated by
+ * the environment variable fdtcontroladdr
+ * Return: status code
+ */
+efi_status_t efi_install_fdt(void *fdt)
+{
+ struct bootm_headers img = { 0 };
+ efi_status_t ret;
+
+ /*
+ * The EBBR spec requires that we have either an FDT or an ACPI table
+ * but not both.
+ */
+ if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) && fdt)
+ log_warning("WARNING: Can't have ACPI table and device tree - ignoring DT.\n");
+
+ if (fdt == EFI_FDT_USE_INTERNAL) {
+ const char *fdt_opt;
+ uintptr_t fdt_addr;
+
+ /* Look for device tree that is already installed */
+ if (get_config_table(&efi_guid_fdt))
+ return EFI_SUCCESS;
+ /* Check if there is a hardware device tree */
+ fdt_opt = env_get("fdt_addr");
+ /* Use our own device tree as fallback */
+ if (!fdt_opt) {
+ fdt_opt = env_get("fdtcontroladdr");
+ if (!fdt_opt) {
+ log_err("ERROR: need device tree\n");
+ return EFI_NOT_FOUND;
+ }
+ }
+ fdt_addr = hextoul(fdt_opt, NULL);
+ if (!fdt_addr) {
+ log_err("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
+ return EFI_LOAD_ERROR;
+ }
+ fdt = map_sysmem(fdt_addr, 0);
+ }
+
+ /* Install device tree */
+ if (fdt_check_header(fdt)) {
+ log_err("ERROR: invalid device tree\n");
+ return EFI_LOAD_ERROR;
+ }
+
+ /* Create memory reservations as indicated by the device tree */
+ efi_carve_out_dt_rsv(fdt);
+
+ if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE))
+ return EFI_SUCCESS;
+
+ /* Prepare device tree for payload */
+ ret = copy_fdt(&fdt);
+ if (ret) {
+ log_err("ERROR: out of memory\n");
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (image_setup_libfdt(&img, fdt, NULL)) {
+ log_err("ERROR: failed to process device tree\n");
+ return EFI_LOAD_ERROR;
+ }
+
+ efi_try_purge_kaslr_seed(fdt);
+
+ if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
+ ret = efi_tcg2_measure_dtb(fdt);
+ if (ret == EFI_SECURITY_VIOLATION) {
+ log_err("ERROR: failed to measure DTB\n");
+ return ret;
+ }
+ }
+
+ /* Install device tree as UEFI table */
+ ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
+ if (ret != EFI_SUCCESS) {
+ log_err("ERROR: failed to install device tree\n");
+ return ret;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ * do_bootefi_exec() - execute EFI binary
+ *
+ * The image indicated by @handle is started. When it returns the allocated
+ * memory for the @load_options is freed.
+ *
+ * @handle: handle of loaded image
+ * @load_options: load options
+ * Return: status code
+ *
+ * Load the EFI binary into a newly assigned memory unwinding the relocation
+ * information, install the loaded image protocol, and call the binary.
+ */
+efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
+{
+ efi_status_t ret;
+ efi_uintn_t exit_data_size = 0;
+ u16 *exit_data = NULL;
+ struct efi_event *evt;
+
+ /* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
+ switch_to_non_secure_mode();
+
+ /*
+ * The UEFI standard requires that the watchdog timer is set to five
+ * minutes when invoking an EFI boot option.
+ *
+ * Unified Extensible Firmware Interface (UEFI), version 2.7 Errata A
+ * 7.5. Miscellaneous Boot Services - EFI_BOOT_SERVICES.SetWatchdogTimer
+ */
+ ret = efi_set_watchdog(300);
+ if (ret != EFI_SUCCESS) {
+ log_err("ERROR: Failed to set watchdog timer\n");
+ goto out;
+ }
+
+ /* Call our payload! */
+ ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
+ if (ret != EFI_SUCCESS) {
+ log_err("## Application failed, r = %lu\n",
+ ret & ~EFI_ERROR_MASK);
+ if (exit_data) {
+ log_err("## %ls\n", exit_data);
+ efi_free_pool(exit_data);
+ }
+ }
+
+ efi_restore_gd();
+
+out:
+ free(load_options);
+
+ if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD)) {
+ if (efi_initrd_deregister() != EFI_SUCCESS)
+ log_err("Failed to remove loadfile2 for initrd\n");
+ }
+
+ /* Notify EFI_EVENT_GROUP_RETURN_TO_EFIBOOTMGR event group. */
+ list_for_each_entry(evt, &efi_events, link) {
+ if (evt->group &&
+ !guidcmp(evt->group,
+ &efi_guid_event_group_return_to_efibootmgr)) {
+ efi_signal_event(evt);
+ EFI_CALL(systab.boottime->close_event(evt));
+ break;
+ }
+ }
+
+ /* Control is returned to U-Boot, disable EFI watchdog */
+ efi_set_watchdog(0);
+
+ return ret;
+}
diff --git a/net/tftp.c b/net/tftp.c
index 88e71e67de..2e33541349 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -302,12 +302,10 @@ static void tftp_complete(void)
time_start * 1000, "/s");
}
puts("\ndone\n");
- if (IS_ENABLED(CONFIG_CMD_BOOTEFI)) {
- if (!tftp_put_active)
- efi_set_bootdev("Net", "", tftp_filename,
- map_sysmem(tftp_load_addr, 0),
- net_boot_file_size);
- }
+ if (!tftp_put_active)
+ efi_set_bootdev("Net", "", tftp_filename,
+ map_sysmem(tftp_load_addr, 0),
+ net_boot_file_size);
net_set_state(NETLOOP_SUCCESS);
}
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 104f49deef..fa54dde661 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -374,7 +374,7 @@ static int bootflow_system(struct unit_test_state *uts)
{
struct udevice *bootstd, *dev;
- if (!IS_ENABLED(CONFIG_BOOTEFI_BOOTMGR))
+ if (!IS_ENABLED(CONFIG_EFI_BOOTMGR))
return -EAGAIN;
ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
ut_assertok(device_bind(bootstd, DM_DRIVER_GET(bootmeth_efi_mgr),