#include "DevicePath.h"
-DEVICE_PATH_DRIVER_PRIVATE_DATA mPrivateData;
-
-EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
-EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
+EFI_HANDLE mDevicePathHandle = NULL;
+
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {\r
+ GetDevicePathSizeProtocolInterface,
+ DuplicateDevicePathProtocolInterface,
+ AppendDevicePathProtocolInterface,
+ AppendDeviceNodeProtocolInterface,
+ AppendDevicePathInstanceProtocolInterface,
+ GetNextDevicePathInstanceProtocolInterface,
+ IsDevicePathMultiInstanceProtocolInterface,
+ CreateDeviceNodeProtocolInterface
+};\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {\r
+ ConvertDeviceNodeToText,
+ ConvertDevicePathToText
+};\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {\r
+ ConvertTextToDeviceNode, \r
+ ConvertTextToDevicePath \r
+};\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
EFI_STATUS
EFIAPI
--*/
{
EFI_STATUS Status;
-
- mPrivateData.Signature = DEVICE_PATH_DRIVER_SIGNATURE;
-
- mPrivateData.DevicePathUtilities.GetDevicePathSize = GetDevicePathSizeProtocolInterface;
- mPrivateData.DevicePathUtilities.DuplicateDevicePath = DuplicateDevicePathProtocolInterface;
- mPrivateData.DevicePathUtilities.AppendDevicePath = AppendDevicePathProtocolInterface;
- mPrivateData.DevicePathUtilities.AppendDeviceNode = AppendDeviceNodeProtocolInterface;
- mPrivateData.DevicePathUtilities.AppendDevicePathInstance = AppendDevicePathInstanceProtocolInterface;
- mPrivateData.DevicePathUtilities.GetNextDevicePathInstance = GetNextDevicePathInstanceProtocolInterface;
- mPrivateData.DevicePathUtilities.IsDevicePathMultiInstance = IsDevicePathMultiInstanceProtocolInterface;
- mPrivateData.DevicePathUtilities.CreateDeviceNode = CreateDeviceNodeProtocolInterface;
-
- mPrivateData.DevicePathToText.ConvertDeviceNodeToText = ConvertDeviceNodeToText;
- mPrivateData.DevicePathToText.ConvertDevicePathToText = ConvertDevicePathToText;
-
- mPrivateData.DevicePathFromText.ConvertTextToDeviceNode = ConvertTextToDeviceNode;
- mPrivateData.DevicePathFromText.ConvertTextToDevicePath = ConvertTextToDevicePath;
-
- mPrivateData.Handle = NULL;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mPrivateData.Handle,
- &gEfiDevicePathUtilitiesProtocolGuid,
- &mPrivateData.DevicePathUtilities,
- &gEfiDevicePathToTextProtocolGuid,
- &mPrivateData.DevicePathToText,
- &gEfiDevicePathFromTextProtocolGuid,
- &mPrivateData.DevicePathFromText,
- NULL
- );
-
+
+ Status = EFI_UNSUPPORTED;
+ if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {\r
+ if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDevicePathHandle,
+ &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+ &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
+ &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
+ NULL
+ );
+ } else {\r
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDevicePathHandle,
+ &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+ &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
+ NULL
+ );
+ }\r
+ } else {\r
+ if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDevicePathHandle,
+ &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+ &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
+ NULL
+ );
+ } else {\r
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDevicePathHandle,
+ &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+ NULL
+ );
+ }\r
+ }\r
return Status;
}
<?xml version="1.0" encoding="UTF-8"?>\r
-\r
-<!--Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->\r
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
-\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
<MsaHeader>\r
<ModuleName>DevicePath</ModuleName>\r
<ModuleType>DXE_DRIVER</ModuleType>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>DevicePathLib</Keyword>\r
</LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PcdLib</Keyword>\r
+ </LibraryClass>\r
</LibraryClassDefinitions>\r
<SourceFiles>\r
<Filename>DevicePath.c</Filename>\r
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
</PackageDependencies>\r
- <Protocols> \r
+ <Protocols>\r
<Protocol Usage="ALWAYS_CONSUMED">\r
<ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>\r
</Protocol>\r
<ModuleEntryPoint>DevicePathEntryPoint</ModuleEntryPoint>\r
</Extern>\r
</Externs>\r
-</ModuleSurfaceArea>\r
+ <PcdCoded>\r
+ <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">\r
+ <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>\r
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <DefaultValue>FALSE</DefaultValue>\r
+ <HelpText>If TRUE, then the Device Path To Text Protocol should be produced by the platform</HelpText>\r
+ </PcdEntry>\r
+ <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">\r
+ <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>\r
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <DefaultValue>FALSE</DefaultValue>\r
+ <HelpText>If TRUE, then the Device Path From Text Protocol should be produced by the platform</HelpText>\r
+ </PcdEntry>\r
+ </PcdCoded>\r
+</ModuleSurfaceArea>
\ No newline at end of file