]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Device Path Driver to produce DevPathUtilities Protocol, DevPathFromText Protocol\r | |
3 | and DevPathToText Protocol.\r | |
4 | \r | |
5 | Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r | |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
7 | \r | |
8 | **/\r | |
9 | \r | |
10 | #include <Uefi.h>\r | |
11 | #include <Protocol/DevicePathUtilities.h>\r | |
12 | #include <Protocol/DevicePathToText.h>\r | |
13 | #include <Protocol/DevicePathFromText.h>\r | |
14 | #include <Library/UefiDriverEntryPoint.h>\r | |
15 | #include <Library/UefiBootServicesTableLib.h>\r | |
16 | #include <Library/DevicePathLib.h>\r | |
17 | #include <Library/PcdLib.h>\r | |
18 | \r | |
19 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {\r | |
20 | GetDevicePathSize,\r | |
21 | DuplicateDevicePath,\r | |
22 | AppendDevicePath,\r | |
23 | AppendDevicePathNode,\r | |
24 | AppendDevicePathInstance,\r | |
25 | GetNextDevicePathInstance,\r | |
26 | IsDevicePathMultiInstance,\r | |
27 | CreateDeviceNode\r | |
28 | };\r | |
29 | \r | |
30 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {\r | |
31 | ConvertDeviceNodeToText,\r | |
32 | ConvertDevicePathToText\r | |
33 | };\r | |
34 | \r | |
35 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {\r | |
36 | ConvertTextToDeviceNode,\r | |
37 | ConvertTextToDevicePath\r | |
38 | };\r | |
39 | \r | |
40 | /**\r | |
41 | The user Entry Point for DevicePath module.\r | |
42 | \r | |
43 | This is the entry point for DevicePath module. It installs the UEFI Device Path Utility Protocol and\r | |
44 | optionally the Device Path to Text and Device Path from Text protocols based on feature flags.\r | |
45 | \r | |
46 | @param[in] ImageHandle The firmware allocated handle for the EFI image.\r | |
47 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
48 | \r | |
49 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
50 | @retval Others Some error occurs when executing this entry point.\r | |
51 | \r | |
52 | **/\r | |
53 | EFI_STATUS\r | |
54 | EFIAPI\r | |
55 | DevicePathEntryPoint (\r | |
56 | IN EFI_HANDLE ImageHandle,\r | |
57 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
58 | )\r | |
59 | {\r | |
60 | EFI_STATUS Status;\r | |
61 | EFI_HANDLE Handle;\r | |
62 | \r | |
63 | Handle = NULL;\r | |
64 | Status = EFI_UNSUPPORTED;\r | |
65 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {\r | |
66 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r | |
67 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
68 | &Handle,\r | |
69 | &gEfiDevicePathUtilitiesProtocolGuid,\r | |
70 | &mDevicePathUtilities,\r | |
71 | &gEfiDevicePathToTextProtocolGuid,\r | |
72 | &mDevicePathToText,\r | |
73 | &gEfiDevicePathFromTextProtocolGuid,\r | |
74 | &mDevicePathFromText,\r | |
75 | NULL\r | |
76 | );\r | |
77 | } else {\r | |
78 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
79 | &Handle,\r | |
80 | &gEfiDevicePathUtilitiesProtocolGuid,\r | |
81 | &mDevicePathUtilities,\r | |
82 | &gEfiDevicePathToTextProtocolGuid,\r | |
83 | &mDevicePathToText,\r | |
84 | NULL\r | |
85 | );\r | |
86 | }\r | |
87 | } else {\r | |
88 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r | |
89 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
90 | &Handle,\r | |
91 | &gEfiDevicePathUtilitiesProtocolGuid,\r | |
92 | &mDevicePathUtilities,\r | |
93 | &gEfiDevicePathFromTextProtocolGuid,\r | |
94 | &mDevicePathFromText,\r | |
95 | NULL\r | |
96 | );\r | |
97 | } else {\r | |
98 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
99 | &Handle,\r | |
100 | &gEfiDevicePathUtilitiesProtocolGuid,\r | |
101 | &mDevicePathUtilities,\r | |
102 | NULL\r | |
103 | );\r | |
104 | }\r | |
105 | }\r | |
106 | \r | |
107 | return Status;\r | |
108 | }\r |