Pull request efi-2023-07-rc4

Documentation:
 
 * man pages for loadb, loadx
 
 UEFI:
 
 * check return value of part_get_info()
 * improve unit test for RegisterProtocolNotify()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmR5wToACgkQxIHbvCwF
 GsRSeA//bNyY18niu1qBL4gKhljyRv/rurqU3a5hiyC8yOcbSXsHh0cmFoi++yrj
 PxE0urD2CIMaXMnp97aFjcR4JweIjlV9PSAOcnvrjERJYJSZ7+dOeRQS6LUQuQxf
 1AaEu0HGljflfuUL4IZEBUYukeLAY4qMUCpI/Etq89XFXxELWTmUi0Rm/KtUmPmb
 /BP6Hto8+Mj26HOkUWeWA7AhCpNH7HPz8/PyE2BMWEgCh1vFUHmG0iRv92SPzkLp
 vR/V/0jhWTIYNGrdOeQHTmWcFaca6DrrSXMbEcCwsEPaMv4YJy49XKjhe40IMhZv
 Mj7k5jaEVE/M+QG3VUCinwe5zayPvlooSDO+2VQ2DRm6akqBc+gumb4D6fjaRrTt
 /+PO44zO0T0D5qyY4cPgYZvVXsodBzQ20C3OAJw8LNPhw2MTAPTnmS810X9aSSsc
 V9w/J2Hu+RzIzSF5wQrP3ZLKhFS2hvjm2I4DENCj8MUCdQ15UaCkWi2vUBLOMCcy
 hngTOEyWFJc/YtAf3Eak39a0k0EqIDQggLVaCPFKeictG2nF9YsiEzyctiAXPVn0
 rWF9aULa26jc8bs9Yw0nz39uIqNpPKjEwJKXZZT9AAGOi06tvRNk6Is56v89gC6h
 bYHoErdQcaJK6f3MUzCCtDmw29tO+oBKKv0MbTXszqp6VT25/vg=
 =rUPv
 -----END PGP SIGNATURE-----

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

Pull request efi-2023-07-rc4

Documentation:

* man pages for loadb, loadx

UEFI:

* check return value of part_get_info()
* improve unit test for RegisterProtocolNotify()
This commit is contained in:
Tom Rini 2023-06-02 12:13:01 -04:00
commit 26659d4265
7 changed files with 171 additions and 11 deletions

View file

@ -11,7 +11,7 @@ Android Boot Image is used to boot Android OS. It usually contains kernel image
(like ``zImage`` file) and ramdisk. Sometimes it can contain additional (like ``zImage`` file) and ramdisk. Sometimes it can contain additional
binaries. This image is built as a part of AOSP (called ``boot.img``), and being binaries. This image is built as a part of AOSP (called ``boot.img``), and being
flashed into ``boot`` partition on eMMC. Bootloader then reads that image from flashed into ``boot`` partition on eMMC. Bootloader then reads that image from
``boot`` partition to RAM and boots the kernel from it. Kernel than starts ``boot`` partition to RAM and boots the kernel from it. Kernel then starts
``init`` process from the ramdisk. It should be mentioned that recovery image ``init`` process from the ramdisk. It should be mentioned that recovery image
(``recovery.img``) also has Android Boot Image format. (``recovery.img``) also has Android Boot Image format.

70
doc/usage/cmd/loadb.rst Normal file
View file

@ -0,0 +1,70 @@
.. SPDX-License-Identifier: GPL-2.0+:
loadb command
=============
Synopsis
--------
::
loadb [addr [baud]]
Description
-----------
The loady command is used to transfer a file to the device via the serial line
using the Kermit protocol.
The number of transferred bytes is saved in environment variable filesize.
addr
load address, defaults to environment variable loadaddr or if loadaddr is
not set to configuration variable CONFIG_SYS_LOAD_ADDR
baud
baud rate for the Kermit transmission. After the transmission the baud
rate is reset to the original value.
Example
-------
In the example below the terminal emulation program picocom and G-Kermit
serve to transfer a file to a device.
.. code-block:: bash
picocom --baud 115200 --send-cmd "gkermit -iXvs" /dev/ttyUSB0
After entering the loadb command the key sequence <CTRL-A><CTRL-S> is used to
let picocom prompt for the file name. Picocom invokes G-Kermit for the file
transfer.
::
=> loadb 60800000 115200
## Ready for binary (kermit) download to 0x60800000 at 115200 bps...
*** file: helloworld.efi
$ gkermit -iXvs helloworld.efi
G-Kermit 2.01, The Kermit Project, 2021-11-15
Escape back to your local Kermit and give a RECEIVE command.
KERMIT READY TO SEND...
|
*** exit status: 0 ***
## Total Size = 0x00000c00 = 3072 Bytes
## Start Addr = 0x60800000
=>
The transfer can be cancelled by pressing <CTRL+C>.
Configuration
-------------
The command is only available if CONFIG_CMD_LOADB=y.
Return value
------------
The return value $? is 0 (true) on success, 1 (false) on error.

77
doc/usage/cmd/loadx.rst Normal file
View file

@ -0,0 +1,77 @@
.. SPDX-License-Identifier: GPL-2.0+:
loadx command
=============
Synopsis
--------
::
loadx [addr [baud]]
Description
-----------
The loadx command is used to transfer a file to the device via the serial line
using the XMODEM protocol.
The number of transferred bytes is saved in environment variable filesize.
addr
load address, defaults to environment variable loadaddr or if loadaddr is
not set to configuration variable CONFIG_SYS_LOAD_ADDR
baud
baud rate for the ymodem transmission. After the transmission the baud
rate is reset to the original value.
Example
-------
In the example below the terminal emulation program picocom was used to
transfer a file to the device.
.. code-block::
picocom --send-cmd 'sx -b vv' --baud 115200 /dev/ttyUSB0
After entering the loadx command the key sequence <CTRL-A><CTRL-S> is used to
let picocom prompt for the file name. Picocom invokes the program sx for the
file transfer.
::
=> loadx 60800000 115200
## Ready for binary (xmodem) download to 0x60800000 at 115200 bps...
C
*** file: helloworld.efi
$ sx -b vv helloworld.efi
sx: cannot open vv: No such file or directory
Sending helloworld.efi, 24 blocks: Give your local XMODEM receive command now.
Xmodem sectors/kbytes sent: 0/ 0kRetry 0: NAK on sector
Bytes Sent: 3072 BPS:1147
Transfer incomplete
*** exit status: 1 ***
## Total Size = 0x00000c00 = 3072 Bytes
## Start Addr = 0x60800000
=>
The transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds
of inactivity on terminal.
Configuration
-------------
The command is only available if CONFIG_CMD_LOADB=y.
Initial timeout in seconds while waiting for transfer is configured by
config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout.
Setting it to 0 means infinite timeout.
Return value
------------
The return value $? is 0 (true) on success, 1 (false) otherwise.

View file

@ -56,6 +56,9 @@ file transfer.
6165f 6165f
=> =>
Transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds
of inactivity on terminal.
Configuration Configuration
------------- -------------
@ -65,10 +68,7 @@ Initial timeout in seconds while waiting for transfer is configured by
config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout. config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout.
Setting it to 0 means infinite timeout. Setting it to 0 means infinite timeout.
Transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds
of inactivity on terminal.
Return value Return value
------------ ------------
The return value $? is always 0 (true). The return value $? is 0 (true) on success, 1 (false) otherwise.

View file

@ -63,7 +63,9 @@ Shell commands
cmd/gpio cmd/gpio
cmd/host cmd/host
cmd/load cmd/load
cmd/loadb
cmd/loadm cmd/loadm
cmd/loadx
cmd/loady cmd/loady
cmd/mbr cmd/mbr
cmd/md cmd/md

View file

@ -843,12 +843,17 @@ static unsigned dp_part_size(struct blk_desc *desc, int part)
* @buf buffer to which the device path is written * @buf buffer to which the device path is written
* @desc block device descriptor * @desc block device descriptor
* @part partition number, 0 identifies a block device * @part partition number, 0 identifies a block device
*
* Return: pointer to position after the node
*/ */
static void *dp_part_node(void *buf, struct blk_desc *desc, int part) static void *dp_part_node(void *buf, struct blk_desc *desc, int part)
{ {
struct disk_partition info; struct disk_partition info;
int ret;
part_get_info(desc, part, &info); ret = part_get_info(desc, part, &info);
if (ret < 0)
return buf;
if (desc->part_type == PART_TYPE_ISO) { if (desc->part_type == PART_TYPE_ISO) {
struct efi_device_path_cdrom_path *cddp = buf; struct efi_device_path_cdrom_path *cddp = buf;

View file

@ -24,6 +24,7 @@ struct context {
efi_uintn_t notify_count; efi_uintn_t notify_count;
efi_uintn_t handle_count; efi_uintn_t handle_count;
efi_handle_t *handles; efi_handle_t *handles;
efi_status_t ret;
}; };
static struct efi_boot_services *boottime; static struct efi_boot_services *boottime;
@ -46,17 +47,18 @@ static struct efi_event *event;
static void EFIAPI notify(struct efi_event *event, void *context) static void EFIAPI notify(struct efi_event *event, void *context)
{ {
struct context *cp = context; struct context *cp = context;
efi_status_t ret;
efi_uintn_t handle_count; efi_uintn_t handle_count;
efi_handle_t *handles; efi_handle_t *handles;
cp->notify_count++; cp->notify_count++;
for (;;) { for (;;) {
ret = boottime->locate_handle_buffer(BY_REGISTER_NOTIFY, NULL, cp->ret = boottime->locate_handle_buffer(BY_REGISTER_NOTIFY,
cp->registration_key, NULL,
&handle_count, &handles); cp->registration_key,
if (ret != EFI_SUCCESS) &handle_count,
&handles);
if (cp->ret != EFI_SUCCESS)
break; break;
cp->handle_count += handle_count; cp->handle_count += handle_count;
cp->handles = handles; cp->handles = handles;
@ -204,6 +206,10 @@ static int execute(void)
efi_st_error("LocateHandle failed\n"); efi_st_error("LocateHandle failed\n");
return EFI_ST_FAILURE; return EFI_ST_FAILURE;
} }
if (context.ret != EFI_NOT_FOUND) {
efi_st_error("LocateHandle did not return EFI_NOT_FOUND\n");
return EFI_ST_FAILURE;
}
ret = boottime->free_pool(context.handles); ret = boottime->free_pool(context.handles);
if (ret != EFI_SUCCESS) { if (ret != EFI_SUCCESS) {
efi_st_error("FreePool failed\n"); efi_st_error("FreePool failed\n");