]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DevicePathDxe/DevicePath.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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
9d510e61 6SPDX-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
1436aea4 19GLOBAL_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
1436aea4 30GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {\r
95276127 31 ConvertDeviceNodeToText,\r
32 ConvertDevicePathToText\r
33};\r
34\r
1436aea4 35GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {\r
572f5d8a 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 53EFI_STATUS\r
54EFIAPI\r
55DevicePathEntryPoint (\r
1436aea4
MK
56 IN EFI_HANDLE ImageHandle,\r
57 IN EFI_SYSTEM_TABLE *SystemTable\r
95276127 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
1436aea4
MK
69 &gEfiDevicePathUtilitiesProtocolGuid,\r
70 &mDevicePathUtilities,\r
71 &gEfiDevicePathToTextProtocolGuid,\r
72 &mDevicePathToText,\r
73 &gEfiDevicePathFromTextProtocolGuid,\r
74 &mDevicePathFromText,\r
95276127 75 NULL\r
76 );\r
77 } else {\r
78 Status = gBS->InstallMultipleProtocolInterfaces (\r
4d0a30a4 79 &Handle,\r
1436aea4
MK
80 &gEfiDevicePathUtilitiesProtocolGuid,\r
81 &mDevicePathUtilities,\r
82 &gEfiDevicePathToTextProtocolGuid,\r
83 &mDevicePathToText,\r
95276127 84 NULL\r
85 );\r
86 }\r
87 } else {\r
88 if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r
89 Status = gBS->InstallMultipleProtocolInterfaces (\r
4d0a30a4 90 &Handle,\r
1436aea4
MK
91 &gEfiDevicePathUtilitiesProtocolGuid,\r
92 &mDevicePathUtilities,\r
93 &gEfiDevicePathFromTextProtocolGuid,\r
94 &mDevicePathFromText,\r
95276127 95 NULL\r
96 );\r
97 } else {\r
98 Status = gBS->InstallMultipleProtocolInterfaces (\r
4d0a30a4 99 &Handle,\r
1436aea4
MK
100 &gEfiDevicePathUtilitiesProtocolGuid,\r
101 &mDevicePathUtilities,\r
95276127 102 NULL\r
103 );\r
104 }\r
105 }\r
1436aea4 106\r
95276127 107 return Status;\r
108}\r