summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-19 19:14:02 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-19 19:14:02 +0000
commite99aa5a2113a275c2e16cf049ce8e66642e6c64c (patch)
tree7ea18e2b77a8935e219a77511fb718b669e4d1a3 /EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
parentc7823a8f8a1f6662662117558a8c6f06c7a07a71 (diff)
downloadedk2-platforms-e99aa5a2113a275c2e16cf049ce8e66642e6c64c.tar.xz
Update Device Path Module to use PCD Feature Flags to determine of the Device Path To Text and Text To Device Path Protocols are produced or not.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1572 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c')
-rw-r--r--EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c95
1 files changed, 60 insertions, 35 deletions
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
index 78c5defe3a..6117a3245e 100644
--- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
+++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
@@ -22,10 +22,31 @@ Abstract:
#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 = {
+ GetDevicePathSizeProtocolInterface,
+ DuplicateDevicePathProtocolInterface,
+ AppendDevicePathProtocolInterface,
+ AppendDeviceNodeProtocolInterface,
+ AppendDevicePathInstanceProtocolInterface,
+ GetNextDevicePathInstanceProtocolInterface,
+ IsDevicePathMultiInstanceProtocolInterface,
+ CreateDeviceNodeProtocolInterface
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {
+ ConvertDeviceNodeToText,
+ ConvertDevicePathToText
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {
+ ConvertTextToDeviceNode,
+ ConvertTextToDevicePath
+};
+
+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
@@ -49,36 +70,40 @@ DevicePathEntryPoint (
--*/
{
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)) {
+ if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDevicePathHandle,
+ &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+ &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
+ &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
+ NULL
+ );
+ } else {
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDevicePathHandle,
+ &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+ &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
+ NULL
+ );
+ }
+ } else {
+ if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDevicePathHandle,
+ &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+ &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
+ NULL
+ );
+ } else {
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mDevicePathHandle,
+ &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+ NULL
+ );
+ }
+ }
return Status;
}