summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-06-09 08:20:24 -0400
committerTom Rini <trini@konsulko.com>2021-06-09 08:20:24 -0400
commit5e425a31d33f679549b85776f55181fc3cd3e3b2 (patch)
tree5b86883311169cfcc642a8b9ad737e050a1ca571
parentcb26d5a9265c60cee385d67eff86d115a606fbc5 (diff)
parentb95e5edc424a14c1d03848c03f92389a945d3e61 (diff)
downloadu-boot-5e425a31d33f679549b85776f55181fc3cd3e3b2.tar.gz
u-boot-5e425a31d33f679549b85776f55181fc3cd3e3b2.tar.xz
u-boot-5e425a31d33f679549b85776f55181fc3cd3e3b2.zip
Merge tag 'efi-2021-07-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2021-07-rc5 Documentation: * pinmux and ums man-page Bug fixes: * Consider that partition numbers as hexadecimal. * Avoid a possible NULL dereference in efi_capsule_delete_file().
-rw-r--r--cmd/Kconfig5
-rw-r--r--doc/usage/index.rst8
-rw-r--r--doc/usage/pinmux.rst95
-rw-r--r--doc/usage/ums.rst57
-rw-r--r--lib/efi_loader/efi_capsule.c3
-rw-r--r--lib/efi_loader/efi_disk.c4
-rw-r--r--lib/efi_loader/efi_image_loader.c2
-rw-r--r--lib/efi_loader/efi_var_file.c2
8 files changed, 167 insertions, 9 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index f962bb7141..a9fb4eead2 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1346,8 +1346,11 @@ config CMD_ROCKUSB
config CMD_USB_MASS_STORAGE
bool "UMS usb mass storage"
select USB_FUNCTION_MASS_STORAGE
+ depends on BLK && USB_GADGET
help
- USB mass storage support
+ Enables the command "ums" and the USB mass storage support to the
+ export a block device: U-Boot, the USB device, acts as a simple
+ external hard drive plugged on the host USB port.
config CMD_PVBLOCK
bool "Xen para-virtualized block device"
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index c1f9b6a53b..843b4371f1 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -34,12 +34,14 @@ Shell commands
load
loady
mbr
- mmc
md
+ mmc
+ pinmux
pstore
qfw
+ reset
sbi
+ scp03
size
true
- scp03
- reset
+ ums
diff --git a/doc/usage/pinmux.rst b/doc/usage/pinmux.rst
new file mode 100644
index 0000000000..9f4392cd0d
--- /dev/null
+++ b/doc/usage/pinmux.rst
@@ -0,0 +1,95 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+pinmux command
+==============
+
+Synopsis
+--------
+
+::
+
+ pinmux list
+ pinmux dev [pincontroller-name]
+ pinmux status [-a | pin-name]
+
+Description
+-----------
+
+The pinmux command is used to show the pin-controller muxing.
+
+The 'pinmux list' command diplays the available pin-controller.
+
+The 'pinmux dev' command selects the pin-controller for next commands.
+
+ pincontroller-name
+ name of the pin-controller to select
+
+The 'pinmux status' command displays the pin muxing information.
+
+ \-a
+ display pin muxing of all pin-controllers.
+ pin-name
+ name of the pin to display
+
+Example
+-------
+
+::
+
+ => pinmux list
+ | Device | Driver | Parent
+ | pinctrl-gpio | sandbox_pinctrl_gpio | root_driver
+ | pinctrl | sandbox_pinctrl | root_driver
+ =>
+ => pinmux dev pinctrl
+ dev: pinctrl
+ =>
+ => pinmux status
+ P0 : UART TX.
+ P1 : UART RX.
+ P2 : I2S SCK.
+ P3 : I2S SD.
+ P4 : I2S WS.
+ P5 : GPIO0 bias-pull-up input-disable.
+ P6 : GPIO1 drive-open-drain.
+ P7 : GPIO2 bias-pull-down input-enable.
+ P8 : GPIO3 bias-disable.
+ =>
+ => pinmux status P0
+ P0 : UART TX.
+ =>
+ => pinmux status -a
+ --------------------------
+ pinctrl-gpio:
+ a0 : gpio input .
+ a1 : gpio input .
+ a2 : gpio input .
+ a3 : gpio input .
+ a4 : gpio input .
+ a5 : gpio output .
+ a6 : gpio output .
+ a7 : gpio input .
+ a8 : gpio input .
+ a9 : gpio input .
+ --------------------------
+ pinctrl:
+ P0 : UART TX.
+ P1 : UART RX.
+ P2 : I2S SCK.
+ P3 : I2S SD.
+ P4 : I2S WS.
+ P5 : GPIO0 bias-pull-up input-disable.
+ P6 : GPIO1 drive-open-drain.
+ P7 : GPIO2 bias-pull-down input-enable.
+ P8 : GPIO3 bias-disable.
+
+Configuration
+-------------
+
+The pinmux command is only available if CONFIG_CMD_PINMUX=y.
+
+Return value
+------------
+
+The return value $? is set to 0 (true) if the command succeded and to 1 (false)
+otherwise.
diff --git a/doc/usage/ums.rst b/doc/usage/ums.rst
new file mode 100644
index 0000000000..3cde5fa1f2
--- /dev/null
+++ b/doc/usage/ums.rst
@@ -0,0 +1,57 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+ums command
+===========
+
+Synopsis
+--------
+
+::
+
+ ums <dev> [<interface>] <devnum[:partnum]>
+
+Description
+-----------
+
+Use the USB Mass Storage class (also known as UMS) to make accessible an U-Boot
+block device (fully or with :ref:`U-Boot's partition syntax <partitions>`)
+to a USB host and to enable file transfers. U-Boot, the USB device, acts as a
+simple external hard drive plugged on the host USB port.
+
+This command "ums" stays in the USB's treatment loop until user enters Ctrl-C.
+
+dev
+ USB gadget device number
+
+interface
+ interface for accessing the block device (mmc, sata, scsi, usb, ....)
+ defaults is "mmc"
+
+devnum
+ device number for selected interface
+
+partnum
+ partition number or 0 to expose all partitions, defaults to 0
+
+Example
+-------
+
+::
+
+ => ums 0 mmc 0
+ => ums 0 usb 1:2
+
+Configuration
+-------------
+
+The ums command is only available if CONFIG_CMD_USB_MASS_STORAGE=y
+and depends on CONFIG_USB_USB_GADGET and CONFIG_BLK.
+
+Return value
+------------
+
+The return value $? is set to 0 (true) when the USB stack was successfully
+started and interrupted, with Ctrl-C or after USB cable issue (detection
+timeout or cable removal).
+
+If an error occurs, the return value $? is set to 1 (false).
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 9ead0d2c78..60309d4a07 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -901,7 +901,8 @@ static efi_status_t efi_capsule_delete_file(const u16 *filename)
/* ignore an error */
EFI_CALL((*dirh->close)(dirh));
- ret = EFI_CALL((*fh->delete)(fh));
+ if (ret == EFI_SUCCESS)
+ ret = EFI_CALL((*fh->delete)(fh));
return ret;
}
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 307d5d759b..988907ecb9 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -476,7 +476,7 @@ static efi_status_t efi_disk_add_dev(
efi_system_partition.if_type = desc->if_type;
efi_system_partition.devnum = desc->devnum;
efi_system_partition.part = part;
- EFI_PRINT("EFI system partition: %s %d:%d\n",
+ EFI_PRINT("EFI system partition: %s %x:%x\n",
blk_get_if_type_name(desc->if_type),
desc->devnum, part);
}
@@ -521,7 +521,7 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
if (part_get_info(desc, part, &info))
continue;
- snprintf(devname, sizeof(devname), "%s:%d", pdevname,
+ snprintf(devname, sizeof(devname), "%s:%x", pdevname,
part);
ret = efi_disk_add_dev(parent, dp, if_typename, desc, diskid,
&info, part, NULL);
diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c
index bcd57f7fcc..a0eb63fceb 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -220,7 +220,7 @@ static void efi_set_code_and_data_type(
* @end: End address of region (excluded)
* @nocheck: flag against overlapped regions
*
- * Take one entry of region [@start, @end[ and insert it into the list.
+ * Take one entry of region \[@start, @end\[ and insert it into the list.
*
* * If @nocheck is false, the list will be sorted ascending by address.
* Overlapping entries will not be allowed.
diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
index b171d2d1a8..de076b8cbc 100644
--- a/lib/efi_loader/efi_var_file.c
+++ b/lib/efi_loader/efi_var_file.c
@@ -35,7 +35,7 @@ static efi_status_t __maybe_unused efi_set_blk_dev_to_system_partition(void)
log_err("No EFI system partition\n");
return EFI_DEVICE_ERROR;
}
- snprintf(part_str, PART_STR_LEN, "%u:%u",
+ snprintf(part_str, PART_STR_LEN, "%x:%x",
efi_system_partition.devnum, efi_system_partition.part);
r = fs_set_blk_dev(blk_get_if_type_name(efi_system_partition.if_type),
part_str, FS_TYPE_ANY);