]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DevicePathDxe/DevicePath.c
MdePkg: Convert all .uni files to utf-8
[mirror_edk2.git] / MdeModulePkg / Universal / DevicePathDxe / DevicePath.c
CommitLineData
13d40edd 1/** @file\r
95276127 2 Device Path Driver to produce DevPathUtilities Protocol, DevPathFromText Protocol\r
3 and DevPathToText Protocol.\r
4\r
4d0a30a4 5Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 6This program and the accompanying materials\r
13d40edd 7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
95276127 15\r
4d0a30a4
RN
16#include <Uefi.h>\r
17#include <Protocol/DevicePathUtilities.h>\r
18#include <Protocol/DevicePathToText.h>\r
19#include <Protocol/DevicePathFromText.h>\r
20#include <Library/UefiDriverEntryPoint.h>\r
21#include <Library/UefiBootServicesTableLib.h>\r
22#include <Library/DevicePathLib.h>\r
23#include <Library/PcdLib.h>\r
95276127 24\r
572f5d8a 25GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {\r
4d0a30a4
RN
26 GetDevicePathSize,\r
27 DuplicateDevicePath,\r
28 AppendDevicePath,\r
29 AppendDevicePathNode,\r
30 AppendDevicePathInstance,\r
31 GetNextDevicePathInstance,\r
32 IsDevicePathMultiInstance,\r
33 CreateDeviceNode\r
95276127 34};\r
35\r
572f5d8a 36GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {\r
95276127 37 ConvertDeviceNodeToText,\r
38 ConvertDevicePathToText\r
39};\r
40\r
572f5d8a 41GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {\r
42 ConvertTextToDeviceNode,\r
43 ConvertTextToDevicePath\r
95276127 44};\r
45\r
572f5d8a 46/**\r
47 The user Entry Point for DevicePath module.\r
48\r
48557c65 49 This is the entry point for DevicePath module. It installs the UEFI Device Path Utility Protocol and\r
50 optionally the Device Path to Text and Device Path from Text protocols based on feature flags.\r
572f5d8a 51\r
52 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
53 @param[in] SystemTable A pointer to the EFI System Table.\r
54\r
55 @retval EFI_SUCCESS The entry point is executed successfully.\r
56 @retval Others Some error occurs when executing this entry point.\r
57\r
58**/\r
95276127 59EFI_STATUS\r
60EFIAPI\r
61DevicePathEntryPoint (\r
62 IN EFI_HANDLE ImageHandle,\r
63 IN EFI_SYSTEM_TABLE *SystemTable\r
64 )\r
95276127 65{\r
66 EFI_STATUS Status;\r
4d0a30a4 67 EFI_HANDLE Handle;\r
572f5d8a 68\r
4d0a30a4 69 Handle = NULL;\r
95276127 70 Status = EFI_UNSUPPORTED;\r
71 if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {\r
72 if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r
73 Status = gBS->InstallMultipleProtocolInterfaces (\r
4d0a30a4 74 &Handle,\r
95276127 75 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r
76 &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,\r
77 &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,\r
78 NULL\r
79 );\r
80 } else {\r
81 Status = gBS->InstallMultipleProtocolInterfaces (\r
4d0a30a4 82 &Handle,\r
95276127 83 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r
84 &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,\r
85 NULL\r
86 );\r
87 }\r
88 } else {\r
89 if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r
90 Status = gBS->InstallMultipleProtocolInterfaces (\r
4d0a30a4 91 &Handle,\r
95276127 92 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r
93 &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,\r
94 NULL\r
95 );\r
96 } else {\r
97 Status = gBS->InstallMultipleProtocolInterfaces (\r
4d0a30a4 98 &Handle,\r
95276127 99 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r
100 NULL\r
101 );\r
102 }\r
103 }\r
104 return Status;\r
105}\r