]>
Commit | Line | Data |
---|---|---|
13d40edd | 1 | /** @file\r |
95276127 | 2 | Device Path Driver to produce DevPathUtilities Protocol, DevPathFromText Protocol\r |
3 | and DevPathToText Protocol.\r | |
4 | \r | |
4d0a30a4 | 5 | Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
13d40edd | 7 | \r |
8 | **/\r | |
95276127 | 9 | \r |
4d0a30a4 RN |
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 | |
95276127 | 18 | \r |
572f5d8a | 19 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {\r |
4d0a30a4 RN |
20 | GetDevicePathSize,\r |
21 | DuplicateDevicePath,\r | |
22 | AppendDevicePath,\r | |
23 | AppendDevicePathNode,\r | |
24 | AppendDevicePathInstance,\r | |
25 | GetNextDevicePathInstance,\r | |
26 | IsDevicePathMultiInstance,\r | |
27 | CreateDeviceNode\r | |
95276127 | 28 | };\r |
29 | \r | |
572f5d8a | 30 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {\r |
95276127 | 31 | ConvertDeviceNodeToText,\r |
32 | ConvertDevicePathToText\r | |
33 | };\r | |
34 | \r | |
572f5d8a | 35 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {\r |
36 | ConvertTextToDeviceNode,\r | |
37 | ConvertTextToDevicePath\r | |
95276127 | 38 | };\r |
39 | \r | |
572f5d8a | 40 | /**\r |
41 | The user Entry Point for DevicePath module.\r | |
42 | \r | |
48557c65 | 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 | |
572f5d8a | 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 | |
95276127 | 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 | |
95276127 | 59 | {\r |
60 | EFI_STATUS Status;\r | |
4d0a30a4 | 61 | EFI_HANDLE Handle;\r |
572f5d8a | 62 | \r |
4d0a30a4 | 63 | Handle = NULL;\r |
95276127 | 64 | Status = EFI_UNSUPPORTED;\r |
65 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {\r | |
66 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r | |
67 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
4d0a30a4 | 68 | &Handle,\r |
95276127 | 69 | &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r |
70 | &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,\r | |
71 | &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,\r | |
72 | NULL\r | |
73 | );\r | |
74 | } else {\r | |
75 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
4d0a30a4 | 76 | &Handle,\r |
95276127 | 77 | &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r |
78 | &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,\r | |
79 | NULL\r | |
80 | );\r | |
81 | }\r | |
82 | } else {\r | |
83 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r | |
84 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
4d0a30a4 | 85 | &Handle,\r |
95276127 | 86 | &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r |
87 | &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,\r | |
88 | NULL\r | |
89 | );\r | |
90 | } else {\r | |
91 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
4d0a30a4 | 92 | &Handle,\r |
95276127 | 93 | &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r |
94 | NULL\r | |
95 | );\r | |
96 | }\r | |
97 | }\r | |
98 | return Status;\r | |
99 | }\r |