1
2
3
4
5
6
7
8#include <common.h>
9#include <malloc.h>
10#include <efi_dt_fixup.h>
11#include <efi_loader.h>
12
13const efi_guid_t efi_u_boot_guid = U_BOOT_GUID;
14
15efi_handle_t efi_root = NULL;
16
17struct efi_root_dp {
18 struct efi_device_path_vendor vendor;
19 struct efi_device_path end;
20} __packed;
21
22
23
24
25
26
27
28
29
30efi_status_t efi_root_node_register(void)
31{
32 efi_status_t ret;
33 struct efi_root_dp *dp;
34
35
36 dp = calloc(1, sizeof(*dp));
37 if (!dp)
38 return EFI_OUT_OF_RESOURCES;
39
40
41 dp->vendor.dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE;
42 dp->vendor.dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR;
43 dp->vendor.dp.length = sizeof(struct efi_device_path_vendor);
44 dp->vendor.guid = efi_u_boot_guid;
45
46
47 dp->end.type = DEVICE_PATH_TYPE_END;
48 dp->end.sub_type = DEVICE_PATH_SUB_TYPE_END;
49 dp->end.length = sizeof(struct efi_device_path);
50
51
52 ret = EFI_CALL(efi_install_multiple_protocol_interfaces
53 (&efi_root,
54
55 &efi_guid_device_path, dp,
56#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT)
57
58 &efi_guid_device_path_to_text_protocol,
59 (void *)&efi_device_path_to_text,
60#endif
61#ifdef CONFIG_EFI_DEVICE_PATH_UTIL
62
63 &efi_guid_device_path_utilities_protocol,
64 (void *)&efi_device_path_utilities,
65#endif
66#ifdef CONFIG_EFI_DT_FIXUP
67
68 &efi_guid_dt_fixup_protocol,
69 (void *)&efi_dt_fixup_prot,
70#endif
71#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL2)
72 &efi_guid_unicode_collation_protocol2,
73 (void *)&efi_unicode_collation_protocol2,
74#endif
75#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
76
77 &efi_guid_hii_string_protocol,
78 (void *)&efi_hii_string,
79
80 &efi_guid_hii_database_protocol,
81 (void *)&efi_hii_database,
82#endif
83 NULL));
84 efi_root->type = EFI_OBJECT_TYPE_U_BOOT_FIRMWARE;
85 return ret;
86}
87