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;
15 struct efi_device_path_vendor vendor;
16 struct efi_device_path end;
20 * efi_root_node_register() - create root node
22 * Create the root node on which we install all protocols that are
23 * not related to a loaded image or a driver.
27 efi_status_t efi_root_node_register(void)
31 struct efi_root_dp *dp;
34 ret = efi_create_handle(&root);
35 if (ret != EFI_SUCCESS)
38 /* Install device path protocol */
39 dp = calloc(1, sizeof(*dp));
41 return EFI_OUT_OF_RESOURCES;
43 /* Fill vendor node */
44 dp->vendor.dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE;
45 dp->vendor.dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR;
46 dp->vendor.dp.length = sizeof(struct efi_device_path_vendor);
47 dp->vendor.guid = efi_u_boot_guid;
50 dp->end.type = DEVICE_PATH_TYPE_END;
51 dp->end.sub_type = DEVICE_PATH_SUB_TYPE_END;
52 dp->end.length = sizeof(struct efi_device_path);
54 /* Install device path protocol */
55 ret = efi_add_protocol(root, &efi_guid_device_path, dp);
56 if (ret != EFI_SUCCESS)
59 /* Install device path to text protocol */
60 ret = efi_add_protocol(root, &efi_guid_device_path_to_text_protocol,
61 (void *)&efi_device_path_to_text);
62 if (ret != EFI_SUCCESS)
65 /* Install device path utilities protocol */
66 ret = efi_add_protocol(root, &efi_guid_device_path_utilities_protocol,
67 (void *)&efi_device_path_utilities);
68 if (ret != EFI_SUCCESS)
71 /* Install Unicode collation protocol */
72 ret = efi_add_protocol(root, &efi_guid_unicode_collation_protocol,
73 (void *)&efi_unicode_collation_protocol);
74 if (ret != EFI_SUCCESS)