Commit Graph

98903 Commits

Author SHA1 Message Date
Simon Glass
ccdb52faf0 console: Update conio command to show uclass
When an stdio device is provided by a driver model device, optionally
show the uclass.

Be careful to avoid increasing code size, since this is a common
command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 06:02:03 -06:00
Simon Glass
249bb45cb3 console: Update coninfo to use sdev instead of dev
The 'dev' variable is generally used for driver model, so change
do_coninfo() to use sdev, to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 06:02:03 -06:00
Simon Glass
8aa1e7c81e cli: Avoid sending ANSI characters to a non-terminal
Detect if there is no terminal present (this only works on sandbox) and
skip sending ANSI characters when the CLI starts up. This avoids having
them in logs, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 06:02:03 -06:00
Simon Glass
ae8fb2dbf1 post: Include config.h in the header
The post system requires use of CFG_xxx values which are only included
via the config.h header. Most files don't include this now.

The serial.h header includes post.h which causes a build error on any
platform which enables CONFIG_POST, such as pg_wcom_seli8

Add an explicit #include of config.h in the post.h header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 06:02:03 -06:00
Simon Glass
1ee02ca627 sandbox: Provide a way to tell if the video is visible
Sandbox is often run with the display disabled, so even though it has a
video device, it is not being shown. Provide a way to detect this. For
all other platforms, we assume the display is shown, when there is a
video device.

Series-changes: 2
- Add new patch to provide a way to tell if the video is visible

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 06:02:03 -06:00
Simon Glass
f1d98d202e sandbox: Add a function to detect terminal connection
Add a serial_is_tty() function that determines if the serial console
is connected to a terminal. For sandbox, this uses os_isatty() to
check stdin, except for cooked mode, where we don't want to assume
anything about the terminal.

For other platforms, it always returns true.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 06:02:03 -06:00
Simon Glass
0d5c9d1529 serial: Cache the terminal size
Add serial_priv structure to serial uclass to cache terminal dimensions.
When serial_query_size() successfully queries the terminal, store the
results in the uclass-private data for later retrieval.

This avoids repeated terminal queries and improves performance when
different subsystems need the terminal size.

Series-changes: 3
- Drop unnecessary 'dev' argument

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 06:02:03 -06:00
Simon Glass
8364e9af3e serial: Generalise the code to check the terminal size
The EFI loader has some code to check the size (rows and columns) of an
attached terminal. Move this over to the serial uclass so that it can be
used elsewhere.

Create a new CONFIG_SERIAL_TERM_PRESENT to control whether it should be
used. Enable that for the EFI loader to preserve existing behaviour.

Adjust the implementation so that it returns a useful error code on
failure. Put the ESC and cESC values in the serial.h header.

Series-changes: 3
- Update comment for serial_query_size()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 06:01:53 -06:00
Simon Glass
38af9c7f97 video: Mark keyboards as driver model stdio devices
Set the DEV_FLAGS_DM flag so keybaords are recognised as being provided
by a driver model device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-25 06:54:01 -06:00
Simon Glass
e9a72c6b7c video: Mark the vidconsole as a driver model stdio device
Set the DEV_FLAGS_DM flag so this stdio device is recognised as being
provided by a driver model device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-25 06:54:01 -06:00
Simon Glass
82732edd5a bdinfo: Show the serial device
Show the name of the serial device with the 'bdinfo' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-25 06:54:00 -06:00
Simon Glass
03cd5e055b Merge branch 'loads' into 'master'
efi: Improvements to env print -e

See merge request u-boot/u-boot!161
2025-08-22 22:39:44 +00:00
Simon Glass
31bd3547bb cmd: Add -s flag to printenv -e for sorted output
Add support for sorting EFI variables by name when using printenv -e.
The -s flag sorts variables alphabetically before display, useful when
dealing with large numbers of variables.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: Improvements to env print -e
Printing EFI variables can be quite verbose, with many hundreds of lines
of text. Part of this is because GUIDs and hex dumps are included. It
can also be hard to find a few variables visually in an unsorted list.

This series makes the feature more user-friendly:
- Puts verbose output behind a -v flag, so that 'env print -e' behaves
  more like 'env print'
- Adds a -s option to sort the list
END
Series-links: 1:15
2025-08-22 08:23:17 -06:00
Simon Glass
ba43199ce9 efi: nvedit: Place variables in an alist before printing them
Rather than printing as we go, add variables to an alist so they can be
printed when all variables are present.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-22 08:23:17 -06:00
Simon Glass
ceb8cb140e efi: Refactor error handling in efi_dump_var_all()
Rather than freeing the variable in several places, put it at the end.
Assume failure by default, returning success only if all steps passed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-22 08:23:17 -06:00
Simon Glass
5247ae8219 efi: Rename var_name64 to name in efi_dump_var_all()
This variable name is quite long. There is only one 'name' (the variable
name) and it has to be u16 as it is an EFI variable. So rename it to
'name'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-22 08:23:17 -06:00
Simon Glass
b60fd4dae9 efi: Change env print -e to show only names by default
Change the default behavior of 'printenv -e' to show only EFI variable
names. The previous verbose output is now available with the -v flag.
This makes the command more user-friendly for quick variable listing.

Update documentation to reflect the new behavior and provide examples
of all three output modes: default (names only), -n (details without
hex dump), and -v (full verbose output).

It might be nicer to use -d to enable the dump, rather than have it on
by default.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-22 08:23:17 -06:00
Simon Glass
b6c3c5ec6a efi: Enable access to efi variables from the app
Enable the 'setenv -e' feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-22 08:23:17 -06:00
Simon Glass
b0341ef417 efi: Move guid used for variables to common files
Move efi_guid_image_security_database to a common file so that it can be
used by the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-22 08:23:17 -06:00
Simon Glass
a815f55022 Merge branch 'loadr' into 'master'
efi: app: Support booting an OS

See merge request u-boot/u-boot!160
2025-08-22 14:13:19 +00:00
Simon Glass
96d39714e4 test: efi: Add a test for the app booting Ubuntu via EFI
Now that the EFI app supports booting Ubuntu via the EFI bootmeth, add
a test for this, for ARM. This uses the sjg lab.

Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: app: Support booting an OS
This series completes the work to get the EFI app booting an EFI
application (e.g. Ubuntu):

- efidebug dh now works, and is slightly enhanced
- device paths which refer to the underlying EFI layer can now be
  requested by the app
- a test is provided, for EFI on ARM booting into Ubuntu using the sjg
  lab
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:12
2025-08-20 10:07:17 -06:00
Simon Glass
2e0fab9f72 efi: app: Allow booting an EFI app
Enable booting an app from the U-Boot app, since many distros package
their bootloader as an EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
49d762e7ef efi: Add a little debugging to calculate_paths()
Provide some debugging for when things go wrong.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
cea7a888bf efi: Add device-path support for EFI media devices
Add proper device-path handling for UCLASS_EFI_MEDIA devices in both
dp_size() and dp_fill() functions. This enables EFI applications to use
firmware device-paths for media devices accessed through the EFI block
I/O protocol.

Add some debugging while we are here.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
9a7c744421 efi: Show component names and other info with efidebug dh
If a component name is available, show it, along with the supported
languages.

Also indicate at the top if the handle is a driver, rather than listing
that protocol at the end.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
2d2b8cff43 efi: Add the component-name2 protocol to efidebug dh
Add the GUID and API for this protocol so that we can use it in the
'efidebug dh' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
27893c8309 efi: Update efidebug dh to work with the app
Make use of the boot-time services rather than internal functions, so
that the app can implement this command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
3637e38ab8 efi: Show the device name only with the EFI loader
The 'efidebug dh' command dereferences a handle to obtain the device
name.

The format of an EFI handle is not defined by the spec, so when running
in the app we cannot assume that the handle can be dereferenced. Even if
the EFI provider happens to be U-Boot it might be a different version.

So don't try display the device name with the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
c029c38ad0 efi: Use a local var for a handle with efidebug dh
Rather than repeating handles[i], put it in a variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
ed609a9439 efi: Use a function to obtain boot services in efi debug
Rather than accessing the EFI loader's structure, create an
efi_get_boot() function to match that used by the app, so that the
call to protocols_per_handle() can operate in the app as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
e82779fb09 efi: Drop the BS macro with efi debug
Even if this is a subtle dig at EFI, it is only used once and there is
not much benefit in retaining it. Access the system-table directly,
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
f06ec4fbcd efi: Move driver-binding guid to a common file
Move efi_guid_driver_binding_protocol to lib/efi so that it can be used
from the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
4f95b262c8 efi: Drop EFI_CALL() from efidebug command
The intend of this macro is to debug calls from an app. But the efidebug
command is not an app, so it really doesn't make a lot of sense to call
via that macro. Remove EFI_CALL() from do_efi_show_handles() so that the
app can use this code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
a7117cda66 test/py: Support a timing report when max_count is 0
If only a single test runs, it does not set the max_count variable, so
it remains as zero. Handle this situation as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
c96e0fc2d9 Merge branch 'pate' into 'master'
patman: Various small tweaks

See merge request u-boot/u-boot!159
2025-08-20 16:05:02 +00:00
Simon Glass
c3b2c14731 patman: Support autolink when some series are archived
Archived series currently cause an error when autolink is attempted. Add
a check to avoid this.

Series-to: u-boot
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:458284
2025-08-20 09:54:41 -06:00
Simon Glass
12a20d3122 patman: Correct parsing of branch names
The name 'x86a' must be parsed as a branch name, not as versio 86 of
branch 'x'. Correct the regex and add a test for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:54:41 -06:00
Simon Glass
a9ea16e399 patman: Allow using the first commit as series description
Sometimes series don't have a cover letter. Add a --use-commit option to
easily use the first commit's subject instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:54:41 -06:00
Simon Glass
e26ea124fb patman: Allow showing progress on archived series
Sometimes it is useful to include archived series in the progress report
so you can see all the work completed. Add a flag for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:54:41 -06:00
Simon Glass
16667556bd patman: Allow listing archived series
Sometimes it is useful to include archived series in the listing so you
can see which series could potentially be unarchived. Add a flag for
this.

Add a --include-archived option to the 'series ls' command for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:54:41 -06:00
Simon Glass
da1cdaf278 patman: Move split_name_version to patchstream
This function is needed by 'patman status', meaning that it must import
cser_helper which needs pygit2

Move it to patchstream so that pygit2 is not needed for the
'patman status' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:54:41 -06:00
Simon Glass
abb8470f86 patman: Avoid needing pygit2 for all subcommands
If pygit2 does not exist, patman refuses to work at all, but most
subcommands don't need it. Move the imports to resolve this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:54:41 -06:00
Simon Glass
822223cf91 Merge branch 'loadq2' into 'master'
efi: Move towards the EFI app booting EFI applications

See merge request u-boot/u-boot!158
2025-08-20 15:54:27 +00:00
Simon Glass
a3f84444ba efi: doc: Add documentation for efidebug command in the app
Mention the efidebug command specifically the EFI-app documentaion, to
highlight its usefulness.

Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: Move towards the EFI app booting EFI applications
This series adds various new features to the EFI app, mostly by moving
code over from the EFI loader implementation.

In particular it adds support for the efidebug command (with only a
subset of subcommands so far).

The main approach is to make use of the system table (for both the app
and the loader) instead of directly calling EFI-loader code.

It also includes a few fixes, which likely have no effect but will help
to avoid confusion in future.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Series-version: 2
Series-changes: 2
- Mention the 'dh' subcommand
- Mention that 'order' allows the boot order to be changed
- Mention the eficonfig command and the underlying UEFI firmware
Series-links: 2:10
2025-08-20 09:05:49 -06:00
Simon Glass
acff53b00d efi: app: Support efidebug boot add, rm and order
Enable these commands in the app, since the requires pieces are now in
place.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:05:49 -06:00
Simon Glass
fc274ee3d0 efi: Move efi_load_option_dp_join() to a common file
This function is useful in the app so move it to the common helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:05:49 -06:00
Simon Glass
c8c34fba1c efi: app: Use the same efi_free_pool() signature as loader
The app has a function of this name, but it does not return any value.
Return success (always) so that we can use the same signature.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:05:49 -06:00
Simon Glass
c43c1681ee efi: Move efi_string utilities to the common directory
This file contains some useful utility functions which are not specific
to the EFI loader. Move them to lib/efi so they can be used by the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:05:49 -06:00
Simon Glass
fe33f0fbfb efi: app: Implement %pD in the app
This printf() extension is useful for the app. Add an implementation of
efi_dp_str() so that it works as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:05:49 -06:00
Simon Glass
16ed1a82ab efi: app: Find the device-path-to-text protocol on startup
Some protocols are generally useful for the app and it makes sense to
store these in the priv struct rather than requesting them each time
they are needed.

Add a new function which locates the device-path-to-text protocol and
stores it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 09:05:49 -06:00