Pull request for efi-2023-01-rc2

Documentation:
 
 * fix building with Sphinx 5.0+
 * man-pages for cmp and bootd commands
 
 UEFI:
 
 * Avoid unaligned access in efi_file_from_path()
 * More bug fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmN0od4ACgkQxIHbvCwF
 GsTLVA/+Ign2/NPOeFfzvWE+9CRhZgAMDqYB0NYsPc1q/xWDNYwn/qt8s52m/TDX
 HtlWKgH8dZ7DGP4TN9pTYRNrkQeNF60mGAvW2zUQJjh5y801f4v0VZz2O2SqDU3W
 69K33nMktL2ScD+ZuvusN4HwxHnE8xuHefM4Wqrm6MfWFiOsuiq1k6zy45+5J6Lt
 ZFQWoegkEUsQ94JrQjUqyVDM5gH9f2fuiJuvGRb8hhHJLznY5HI6Kt+Nv/ZxjRZX
 nWX0CE4w3h2NXsr7X57WJ83VgOtzyFEprjVD973r0osmvGibjEBcWSWLN40bKESx
 7ajWzdIhs5RS8iikpD7il8lEfDh/aK0Z1+MwyHZR1cMTHqSj1WQ53OtlNkumkHkW
 C+53BKjyMgQHP0lVIznBncQBLS8NIP15x5FH9s0JthYO248FwBo7zgzSOY3qRDG+
 38+SIl5PnUAmITptQljEkmOaE97QFseS366mINH2kYu06W5WsQX75YZByf2WQ9lm
 b6GSyfCjbAXo041GCIsgJDjvMXmqi68P16O5VKxzcAhkTXh3Cel5BZqvrje/6U1o
 48/0D2l178FmHeeis5Idmu4Gbd85Uy4ex8kNvKjfk9Oskf0Mwvh37dXYzr22P3OY
 ONjZkmhmTnsy14InLk9s+w8++NTpanWrjeUs940xXJeGQpg7G68=
 =rXaa
 -----END PGP SIGNATURE-----

Merge tag 'efi-2023-01-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-01-rc2

Documentation:

* fix building with Sphinx 5.0+
* man-pages for cmp and bootd commands

UEFI:

* Avoid unaligned access in efi_file_from_path()
* More bug fixes
This commit is contained in:
Tom Rini 2022-11-16 11:08:51 -05:00
commit bebb393b34
10 changed files with 183 additions and 19 deletions

View file

@ -889,6 +889,10 @@ M: Ilias Apalodimas <ilias.apalodimas@linaro.org>
S: Maintained
T: git https://source.denx.de/u-boot/custodians/u-boot-efi.git
F: arch/arm/lib/*_efi.*
F: cmd/bootefi.c
F: cmd/eficonfig.c
F: cmd/efidebug.c
F: cmd/nvedit_efi.c
F: doc/api/efi.rst
F: doc/develop/uefi/*
F: doc/mkeficapsule.1

View file

@ -1527,8 +1527,6 @@ static efi_status_t eficonfig_edit_boot_option(u16 *varname, struct eficonfig_bo
}
ret = eficonfig_set_boot_option(varname, final_dp, final_dp_size, bo->description, tmp);
if (ret != EFI_SUCCESS)
goto out;
out:
free(tmp);
free(bo->optional_data);
@ -2280,10 +2278,10 @@ efi_status_t eficonfig_delete_invalid_boot_option(struct eficonfig_media_boot_op
{
u32 i, j;
efi_uintn_t size;
efi_status_t ret;
void *load_option;
struct efi_load_option lo;
u16 varname[] = u"Boot####";
efi_status_t ret = EFI_SUCCESS;
for (i = 0; i <= 0xFFFF; i++) {
efi_uintn_t tmp;

View file

@ -178,7 +178,7 @@ finally:
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:

38
doc/usage/cmd/bootd.rst Normal file
View file

@ -0,0 +1,38 @@
.. SPDX-License-Identifier: GPL-2.0+:
bootd command
=============
Synopsis
--------
::
bootd
Description
-----------
The bootd command executes the command stored in the environment variable
*bootcmd*, i.e. it does the same thing as *run bootcmd*.
Example
-------
::
=> setenv bootcmd 'echo Hello World'
=> bootd
Hello World
=> setenv bootcmd true
=> bootd; echo $?
0
=> setenv bootcmd false
=> bootd; echo $?
1
Return value
------------
The return value $? of the bootd command is the return value of the command in
the environment variable *bootcmd*.

105
doc/usage/cmd/cmp.rst Normal file
View file

@ -0,0 +1,105 @@
.. SPDX-License-Identifier: GPL-2.0+:
cmp command
===========
Synopsis
--------
::
cmp [.b, .w, .l, .q] addr1 addr2 count
Description
-----------
The cmp command is used to compare two memory areas. By default it works on
four byte tuples. By appending .b, .w, .l, .q the size of the tuples is
controlled:
cmp.b
compare 1 byte tuples
cmp.w
compare 2 byte tuples
cmp.l
compare 4 byte tuples
cmp.q
compare 8 byte tuples
The parameters are used as follows:
addr1
Address of the first memory area.
addr2
Address of the second memory area.
count
Number of bytes to compare (as hexadecimal number).
Example
-------
In the example below the strings "Hello world\n" and "Hello World\n" are written
to memory and then compared.
::
=> mm.b 0x1000000
01000000: 00 ? 48
01000001: 00 ? 65
01000002: 00 ? 6c
01000003: 00 ? 6c
01000004: 00 ? 6f
01000005: 00 ? 20
01000006: 00 ? 77
01000007: 00 ? 6f
01000008: 00 ? 72
01000009: 00 ? 6c
0100000a: 00 ? 64
0100000b: 00 ? 0d
0100000c: 00 ? => <INTERRUPT>
=> mm.b 0x101000
00101000: 00 ? 48
00101001: 00 ? 65
00101002: 00 ? 6c
00101003: 00 ? 6c
00101004: 00 ? 6f
00101005: 00 ? 20
00101006: 00 ? 57
00101007: 00 ? 6f
00101008: 00 ? 72
00101009: 00 ? 6c
0010100a: 00 ? 64
0010100b: 00 ? 0d
0010100c: 00 ? => <INTERRUPT>
=> cmp 0x1000000 0x101000 0xc
word at 0x01000004 (0x6f77206f) != word at 0x00101004 (0x6f57206f)
Total of 1 word(s) were the same
=> cmp.b 0x1000000 0x101000 0xc
byte at 0x01000006 (0x77) != byte at 0x00101006 (0x57)
Total of 6 byte(s) were the same
=> cmp.w 0x1000000 0x101000 0xc
halfword at 0x01000006 (0x6f77) != halfword at 0x00101006 (0x6f57)
Total of 3 halfword(s) were the same
=> cmp.l 0x1000000 0x101000 0xc
word at 0x01000004 (0x6f77206f) != word at 0x00101004 (0x6f57206f)
Total of 1 word(s) were the same
=> cmp.q 0x1000000 0x101000 0xc
double word at 0x01000000 (0x6f77206f6c6c6548) != double word at 0x00101000 (0x6f57206f6c6c6548)
Total of 0 double word(s) were the same
Configuration
-------------
The cmp command is only available if CONFIG_CMD_MEMORY=y. The cmp.q command is
only available if additionally CONFIG_MEM_SUPPORT_64BIT_DATA=y.
Return value
------------
The return value $? is true (0) if the compared memory areas are equal.
The reutrn value is false (1) if the compared memory areas differ.

View file

@ -23,6 +23,7 @@ Shell commands
cmd/addrmap
cmd/askenv
cmd/base
cmd/bootd
cmd/bootdev
cmd/bootefi
cmd/bootflow
@ -34,6 +35,7 @@ Shell commands
cmd/cat
cmd/cbsysinfo
cmd/cls
cmd/cmp
cmd/conitrace
cmd/cyclic
cmd/dm

View file

@ -651,7 +651,7 @@ enum gd_flags {
*/
GD_FLG_FDT_CHANGED = 0x100000,
/**
* GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
* @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
*/
GD_FLG_CYCLIC_RUNNING = 0x200000,
};

View file

@ -23,26 +23,23 @@ struct host_sb_plat {
/**
* struct host_ops - operations supported by UCLASS_HOST
*
* @attach_file: Attach a new file to a device
* @detach_file: Detach a file from a device
*/
struct host_ops {
/*
* attach_file() - Attach a new file to the device
/**
* @attach_file: - Attach a new file to the device
*
* @dev: Device to update
* @filename: Name of the file, e.g. "/path/to/disk.img"
* Returns: 0 if OK, -EEXIST if a file is already attached, other -ve on
* @attach_file.dev: Device to update
* @attach_file.filename: Name of the file, e.g. "/path/to/disk.img"
* @attach_file.Returns: 0 if OK, -EEXIST if a file is already attached, other -ve on
* other error
*/
int (*attach_file)(struct udevice *dev, const char *filename);
/**
* detach_file() - Detach a file from the device
* @detach_file: - Detach a file from the device
*
* @dev: Device to detach from
* Returns: 0 if OK, -ENOENT if no file is attached, other -ve on other
* @detach_file.dev: Device to detach from
* @detach_file.Returns: 0 if OK, -ENOENT if no file is attached, other -ve on other
* error
*/
int (*detach_file)(struct udevice *dev);

View file

@ -2754,7 +2754,7 @@ efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle,
{
const efi_guid_t *protocol;
void *protocol_interface;
efi_status_t ret;
efi_status_t ret = EFI_SUCCESS;
size_t i = 0;
efi_va_list argptr_copy;

View file

@ -1098,6 +1098,15 @@ static const struct efi_file_handle efi_file_handle_protocol = {
/**
* efi_file_from_path() - open file via device path
*
* The device path @fp consists of the device path of the handle with the
* simple file system protocol and one or more file path device path nodes.
* The concatenation of all file path names provides the total file path.
*
* The code starts at the first file path node and tries to open that file or
* directory. If there is a succeding file path node, the code opens it relative
* to this directory and continues iterating until reaching the last file path
* node.
*
* @fp: device path
* Return: EFI_FILE_PROTOCOL for the file or NULL
*/
@ -1128,16 +1137,27 @@ struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp)
container_of(fp, struct efi_device_path_file_path, dp);
struct efi_file_handle *f2;
u16 *filename;
size_t filename_sz;
if (!EFI_DP_TYPE(fp, MEDIA_DEVICE, FILE_PATH)) {
printf("bad file path!\n");
f->close(f);
EFI_CALL(f->close(f));
return NULL;
}
filename = u16_strdup(fdp->str);
/*
* UEFI specification requires pointers that are passed to
* protocol member functions to be aligned. So memcpy it
* unconditionally
*/
if (fdp->dp.length <= offsetof(struct efi_device_path_file_path, str))
return NULL;
filename_sz = fdp->dp.length -
offsetof(struct efi_device_path_file_path, str);
filename = malloc(filename_sz);
if (!filename)
return NULL;
memcpy(filename, fdp->str, filename_sz);
EFI_CALL(ret = f->open(f, &f2, filename,
EFI_FILE_MODE_READ, 0));
free(filename);