summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-01-15 12:29:23 -0500
committerTom Rini <trini@konsulko.com>2020-01-15 12:29:23 -0500
commit9d5d74c3ccdc78bac969d25e98eab96872e33b5c (patch)
treef2793e4d1149b228e9ee2d04a67f2aae0a804ea7
parentfb537657d9e94a8d489eb9463451e9cf90cbe973 (diff)
parentfaadc04180ef05acfd6523b49a2abf37ae61afad (diff)
downloadu-boot-WIP/15Jan2020.tar.gz
Merge tag 'efi-2020-04-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efiWIP/15Jan2020
Pull request for UEFI sub-system for efi-2020-04-rc1-2 Bug fixes for the UEFI sub-system are provided: * imply VIDEO_ANSI for correct cursor positioning and colors * fix issues in the UEFI block device driver * add missing documentation
-rw-r--r--doc/api/efi.rst6
-rw-r--r--lib/efi_driver/efi_uclass.c11
-rw-r--r--lib/efi_loader/Kconfig1
-rw-r--r--lib/efi_loader/efi_boottime.c8
-rw-r--r--lib/efi_loader/efi_rng.c35
-rw-r--r--lib/efi_selftest/Kconfig1
-rw-r--r--lib/efi_selftest/efi_selftest_block_device.c4
7 files changed, 55 insertions, 11 deletions
diff --git a/doc/api/efi.rst b/doc/api/efi.rst
index 2ca344932e..bc59382608 100644
--- a/doc/api/efi.rst
+++ b/doc/api/efi.rst
@@ -131,6 +131,12 @@ Network protocols
.. kernel-doc:: lib/efi_loader/efi_net.c
:internal:
+Random number generator protocol
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. kernel-doc:: lib/efi_loader/efi_rng.c
+ :internal:
+
Text IO protocols
~~~~~~~~~~~~~~~~~
diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c
index b14746e6b1..25b27ece6d 100644
--- a/lib/efi_driver/efi_uclass.c
+++ b/lib/efi_driver/efi_uclass.c
@@ -112,7 +112,7 @@ static efi_status_t EFIAPI efi_uc_start(
struct efi_driver_binding_extended_protocol *bp =
(struct efi_driver_binding_extended_protocol *)this;
- EFI_ENTRY("%p, %pUl, %ls", this, controller_handle,
+ EFI_ENTRY("%p, %p, %ls", this, controller_handle,
efi_dp_str(remaining_device_path));
/* Attach driver to controller */
@@ -197,9 +197,10 @@ static efi_status_t EFIAPI efi_uc_stop(
efi_status_t ret;
efi_uintn_t count;
struct efi_open_protocol_info_entry *entry_buffer;
- efi_guid_t *guid_controller = NULL;
+ struct efi_driver_binding_extended_protocol *bp =
+ (struct efi_driver_binding_extended_protocol *)this;
- EFI_ENTRY("%p, %pUl, %zu, %p", this, controller_handle,
+ EFI_ENTRY("%p, %p, %zu, %p", this, controller_handle,
number_of_children, child_handle_buffer);
/* Destroy provided child controllers */
@@ -217,7 +218,7 @@ static efi_status_t EFIAPI efi_uc_stop(
/* Destroy all children */
ret = EFI_CALL(systab.boottime->open_protocol_information(
- controller_handle, guid_controller,
+ controller_handle, bp->ops->protocol,
&entry_buffer, &count));
if (ret != EFI_SUCCESS)
goto out;
@@ -237,7 +238,7 @@ static efi_status_t EFIAPI efi_uc_stop(
/* Detach driver from controller */
ret = EFI_CALL(systab.boottime->close_protocol(
- controller_handle, guid_controller,
+ controller_handle, bp->ops->protocol,
this->driver_binding_handle, controller_handle));
out:
return EFI_EXIT(ret);
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 6727336169..a7afa3f29e 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -16,6 +16,7 @@ config EFI_LOADER
select REGEX
imply CFB_CONSOLE_ANSI
imply USB_KEYBOARD_FN_KEYS
+ imply VIDEO_ANSI
help
Select this option if you want to run UEFI applications (like GNU
GRUB or iPXE) on top of U-Boot. If this option is enabled, U-Boot
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 3103a50158..1f598b357a 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -2933,10 +2933,10 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
ret = EFI_CALL(image_obj->entry(image_handle, &systab));
/*
- * Usually UEFI applications call Exit() instead of returning.
- * But because the world doesn't consist of ponies and unicorns,
- * we're happy to emulate that behavior on behalf of a payload
- * that forgot.
+ * Control is returned from a started UEFI image either by calling
+ * Exit() (where exit data can be provided) or by simply returning from
+ * the entry point. In the latter case call Exit() on behalf of the
+ * image.
*/
return EFI_CALL(systab.boottime->exit(image_handle, ret, 0, NULL));
}
diff --git a/lib/efi_loader/efi_rng.c b/lib/efi_loader/efi_rng.c
index 432c986204..a1d0ec842c 100644
--- a/lib/efi_loader/efi_rng.c
+++ b/lib/efi_loader/efi_rng.c
@@ -13,6 +13,17 @@ DECLARE_GLOBAL_DATA_PTR;
const efi_guid_t efi_guid_rng_protocol = EFI_RNG_PROTOCOL_GUID;
+/**
+ * platform_get_rng_device() - retrieve random number generator
+ *
+ * This function retrieves the udevice implementing a hardware random
+ * number generator.
+ *
+ * This function may be overridden if special initialization is needed.
+ *
+ * @dev: udevice
+ * Return: status code
+ */
__weak efi_status_t platform_get_rng_device(struct udevice **dev)
{
int ret;
@@ -29,6 +40,18 @@ __weak efi_status_t platform_get_rng_device(struct udevice **dev)
return EFI_SUCCESS;
}
+/**
+ * rng_getinfo() - get information about random number generation
+ *
+ * This function implement the GetInfo() service of the EFI random number
+ * generator protocol. See the UEFI spec for details.
+ *
+ * @this: random number generator protocol instance
+ * @rng_algorithm_list_size: number of random number generation algorithms
+ * @rng_algorithm_list: descriptions of random number generation
+ * algorithms
+ * Return: status code
+ */
static efi_status_t EFIAPI rng_getinfo(struct efi_rng_protocol *this,
efi_uintn_t *rng_algorithm_list_size,
efi_guid_t *rng_algorithm_list)
@@ -64,6 +87,18 @@ back:
return EFI_EXIT(ret);
}
+/**
+ * rng_getrng() - get random value
+ *
+ * This function implement the GetRng() service of the EFI random number
+ * generator protocol. See the UEFI spec for details.
+ *
+ * @this: random number generator protocol instance
+ * @rng_algorithm: random number generation algorithm
+ * @rng_value_length: number of random bytes to generate, buffer length
+ * @rng_value: buffer to receive random bytes
+ * Return: status code
+ */
static efi_status_t EFIAPI getrng(struct efi_rng_protocol *this,
efi_guid_t *rng_algorithm,
efi_uintn_t rng_value_length,
diff --git a/lib/efi_selftest/Kconfig b/lib/efi_selftest/Kconfig
index d20f5899af..478140330b 100644
--- a/lib/efi_selftest/Kconfig
+++ b/lib/efi_selftest/Kconfig
@@ -3,6 +3,7 @@ config CMD_BOOTEFI_SELFTEST
depends on CMD_BOOTEFI
imply FAT
imply FAT_WRITE
+ imply CMD_POWEROFF if PSCI_RESET || SYSRESET_PSCI
help
This adds a UEFI test application to U-Boot that can be executed
via the 'bootefi selftest' command. It provides extended tests of
diff --git a/lib/efi_selftest/efi_selftest_block_device.c b/lib/efi_selftest/efi_selftest_block_device.c
index 644c5ade21..d98a854e6d 100644
--- a/lib/efi_selftest/efi_selftest_block_device.c
+++ b/lib/efi_selftest/efi_selftest_block_device.c
@@ -257,9 +257,9 @@ static int teardown(void)
disk_handle, &block_io_protocol_guid,
&block_io);
if (r != EFI_SUCCESS) {
- efi_st_todo(
+ efi_st_error(
"Failed to uninstall block I/O protocol\n");
- return EFI_ST_SUCCESS;
+ return EFI_ST_FAILURE;
}
}