mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
efi_loader: simplify protocol installation
By using InstallMultipleProtocolInterfaces() the coding for installing protocol interfaces on the root node can be simplified. Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
7657ae12f3
commit
f1465c1597
1 changed files with 25 additions and 51 deletions
|
@ -26,16 +26,10 @@ struct efi_root_dp {
|
|||
*/
|
||||
efi_status_t efi_root_node_register(void)
|
||||
{
|
||||
efi_handle_t root;
|
||||
efi_status_t ret;
|
||||
efi_handle_t root = NULL;
|
||||
struct efi_root_dp *dp;
|
||||
|
||||
/* Create handle */
|
||||
ret = efi_create_handle(&root);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/* Install device path protocol */
|
||||
/* Create device path protocol */
|
||||
dp = calloc(1, sizeof(*dp));
|
||||
if (!dp)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
@ -51,49 +45,29 @@ efi_status_t efi_root_node_register(void)
|
|||
dp->end.sub_type = DEVICE_PATH_SUB_TYPE_END;
|
||||
dp->end.length = sizeof(struct efi_device_path);
|
||||
|
||||
/* Install device path protocol */
|
||||
ret = efi_add_protocol(root, &efi_guid_device_path, dp);
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
/* Install device path to text protocol */
|
||||
ret = efi_add_protocol(root, &efi_guid_device_path_to_text_protocol,
|
||||
(void *)&efi_device_path_to_text);
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
/* Install device path utilities protocol */
|
||||
ret = efi_add_protocol(root, &efi_guid_device_path_utilities_protocol,
|
||||
(void *)&efi_device_path_utilities);
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
/* Install Unicode collation protocol */
|
||||
ret = efi_add_protocol(root, &efi_guid_unicode_collation_protocol,
|
||||
(void *)&efi_unicode_collation_protocol);
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
/* Create root node and install protocols */
|
||||
return EFI_CALL(efi_install_multiple_protocol_interfaces(&root,
|
||||
/* Device path protocol */
|
||||
&efi_guid_device_path, dp,
|
||||
/* Device path to text protocol */
|
||||
&efi_guid_device_path_to_text_protocol,
|
||||
(void *)&efi_device_path_to_text,
|
||||
/* Device path utilities protocol */
|
||||
&efi_guid_device_path_utilities_protocol,
|
||||
(void *)&efi_device_path_utilities,
|
||||
/* Unicode collation protocol */
|
||||
&efi_guid_unicode_collation_protocol,
|
||||
(void *)&efi_unicode_collation_protocol,
|
||||
#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
|
||||
/* Install HII string protocol */
|
||||
ret = efi_add_protocol(root, &efi_guid_hii_string_protocol,
|
||||
(void *)&efi_hii_string);
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
/* Install HII database protocol */
|
||||
ret = efi_add_protocol(root, &efi_guid_hii_database_protocol,
|
||||
(void *)&efi_hii_database);
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
/* Install HII configuration routing protocol */
|
||||
ret = efi_add_protocol(root, &efi_guid_hii_config_routing_protocol,
|
||||
(void *)&efi_hii_config_routing);
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto failure;
|
||||
/* HII string protocol */
|
||||
&efi_guid_hii_string_protocol,
|
||||
(void *)&efi_hii_string,
|
||||
/* HII database protocol */
|
||||
&efi_guid_hii_database_protocol,
|
||||
(void *)&efi_hii_database,
|
||||
/* HII configuration routing protocol */
|
||||
&efi_guid_hii_config_routing_protocol,
|
||||
(void *)&efi_hii_config_routing,
|
||||
#endif
|
||||
|
||||
failure:
|
||||
return ret;
|
||||
NULL));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue