1 // SPDX-License-Identifier: GPL-2.0+
3 * Root node for system services
5 * Copyright (c) 2018 Heinrich Schuchardt
10 #include <efi_loader.h>
12 const efi_guid_t efi_u_boot_guid = U_BOOT_GUID;
14 efi_handle_t efi_root = NULL;
17 struct efi_device_path_vendor vendor;
18 struct efi_device_path end;
22 * efi_root_node_register() - create root node
24 * Create the root node on which we install all protocols that are
25 * not related to a loaded image or a driver.
29 efi_status_t efi_root_node_register(void)
32 struct efi_root_dp *dp;
34 /* Create device path protocol */
35 dp = calloc(1, sizeof(*dp));
37 return EFI_OUT_OF_RESOURCES;
39 /* Fill vendor node */
40 dp->vendor.dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE;
41 dp->vendor.dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR;
42 dp->vendor.dp.length = sizeof(struct efi_device_path_vendor);
43 dp->vendor.guid = efi_u_boot_guid;
46 dp->end.type = DEVICE_PATH_TYPE_END;
47 dp->end.sub_type = DEVICE_PATH_SUB_TYPE_END;
48 dp->end.length = sizeof(struct efi_device_path);
50 /* Create root node and install protocols */
51 ret = EFI_CALL(efi_install_multiple_protocol_interfaces
53 /* Device path protocol */
54 &efi_guid_device_path, dp,
55 #if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT)
56 /* Device path to text protocol */
57 &efi_guid_device_path_to_text_protocol,
58 (void *)&efi_device_path_to_text,
60 /* Device path utilities protocol */
61 &efi_guid_device_path_utilities_protocol,
62 (void *)&efi_device_path_utilities,
63 #if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL2)
64 #if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL)
65 /* Deprecated Unicode collation protocol */
66 &efi_guid_unicode_collation_protocol,
67 (void *)&efi_unicode_collation_protocol,
69 /* Current Unicode collation protocol */
70 &efi_guid_unicode_collation_protocol2,
71 (void *)&efi_unicode_collation_protocol2,
73 #if CONFIG_IS_ENABLED(EFI_LOADER_HII)
74 /* HII string protocol */
75 &efi_guid_hii_string_protocol,
76 (void *)&efi_hii_string,
77 /* HII database protocol */
78 &efi_guid_hii_database_protocol,
79 (void *)&efi_hii_database,
80 /* HII configuration routing protocol */
81 &efi_guid_hii_config_routing_protocol,
82 (void *)&efi_hii_config_routing,
85 efi_root->type = EFI_OBJECT_TYPE_U_BOOT_FIRMWARE;