summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c33
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c51
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c40
-rw-r--r--MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf1
-rw-r--r--MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf1
-rw-r--r--MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf75
-rw-r--r--MdePkg/MdePkg.dsc1
7 files changed, 169 insertions, 33 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
index 9274ef8dda..7d5fb18d25 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
@@ -807,39 +807,6 @@ UefiDevicePathLibIsDevicePathMultiInstance (
/**
- Retrieves the device path protocol from a handle.
-
- This function returns the device path protocol from the handle specified by Handle.
- If Handle is NULL or Handle does not contain a device path protocol, then NULL
- is returned.
-
- @param Handle The handle from which to retrieve the device
- path protocol.
-
- @return The device path protocol from the handle specified by Handle.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-DevicePathFromHandle (
- IN EFI_HANDLE Handle
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_STATUS Status;
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID *) &DevicePath
- );
- if (EFI_ERROR (Status)) {
- DevicePath = NULL;
- }
- return DevicePath;
-}
-
-/**
Allocates a device path for a file and appends it to an existing device path.
If Device is a valid device handle that contains a device path protocol, then a device path for
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
new file mode 100644
index 0000000000..7f3b6076ef
--- /dev/null
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
@@ -0,0 +1,51 @@
+/** @file
+ Device Path services. The thing to remember is device paths are built out of
+ nodes. The device path is terminated by an end node that is length
+ sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL)
+ all over this file.
+
+ The only place where multi-instance device paths are supported is in
+ environment varibles. Multi-instance device paths should never be placed
+ on a Handle.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UefiDevicePathLib.h"
+
+
+/**
+ Retrieves the device path protocol from a handle.
+
+ This function returns the device path protocol from the handle specified by Handle.
+ If Handle is NULL or Handle does not contain a device path protocol, then NULL
+ is returned.
+
+ @param Handle The handle from which to retrieve the device
+ path protocol.
+
+ @return The device path protocol from the handle specified by Handle.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+DevicePathFromHandle (
+ IN EFI_HANDLE Handle
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_STATUS Status;
+
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *) &DevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ DevicePath = NULL;
+ }
+ return DevicePath;
+}
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
new file mode 100644
index 0000000000..930e778d37
--- /dev/null
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c
@@ -0,0 +1,40 @@
+/** @file
+ Device Path services. The thing to remember is device paths are built out of
+ nodes. The device path is terminated by an end node that is length
+ sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL)
+ all over this file.
+
+ The only place where multi-instance device paths are supported is in
+ environment varibles. Multi-instance device paths should never be placed
+ on a Handle.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UefiDevicePathLib.h"
+
+
+/**
+ Retrieves the device path protocol from a handle.
+
+ This function returns the device path protocol from the handle specified by Handle.
+ If Handle is NULL or Handle does not contain a device path protocol, then NULL
+ is returned.
+
+ @param Handle The handle from which to retrieve the device
+ path protocol.
+
+ @return The device path protocol from the handle specified by Handle.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+DevicePathFromHandle (
+ IN EFI_HANDLE Handle
+ )
+{
+ return NULL;
+}
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
index 3c41c0695a..eb85a54a74 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
@@ -26,6 +26,7 @@
[Sources]
DevicePathUtilities.c
+ DevicePathUtilitiesDxeSmm.c
DevicePathToText.c
DevicePathFromText.c
UefiDevicePathLib.c
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf
index e812e3e1d4..81323bc700 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf
@@ -29,6 +29,7 @@
[Sources]
DevicePathUtilities.c
+ DevicePathUtilitiesDxeSmm.c
DevicePathToText.c
DevicePathFromText.c
UefiDevicePathLibOptionalDevicePathProtocol.c
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
new file mode 100644
index 0000000000..23fedf38b7
--- /dev/null
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
@@ -0,0 +1,75 @@
+## @file
+# Instance of Device Path Library based on Memory Allocation Library.
+#
+# Device Path Library that layers on top of the Memory Allocation Library.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UefiDevicePathLib
+ MODULE_UNI_FILE = UefiDevicePathLib.uni
+ FILE_GUID = D8E58437-44D3-4154-B7A7-EB794923EF12
+ MODULE_TYPE = MM_STANDALONE
+ PI_SPECIFICATION_VERSION = 0x00010032
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = DevicePathLib | MM_STANDALONE MM_CORE_STANDALONE
+
+
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ DevicePathUtilities.c
+ DevicePathUtilitiesStandaloneMm.c
+ DevicePathToText.c
+ DevicePathFromText.c
+ UefiDevicePathLib.c
+ UefiDevicePathLib.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ MemoryAllocationLib
+ DebugLib
+ BaseMemoryLib
+ PcdLib
+ PrintLib
+
+[Guids]
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiVTUTF8Guid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiVT100Guid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiVT100PlusGuid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiPcAnsiGuid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiUartDevicePathGuid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiSasDevicePathGuid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiVirtualDiskGuid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiVirtualCdGuid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiPersistentVirtualDiskGuid
+ ## SOMETIMES_CONSUMES ## GUID
+ gEfiPersistentVirtualCdGuid
+
+[Protocols]
+ gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES
+ gEfiDebugPortProtocolGuid ## UNDEFINED
+
+[Pcd]
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount ## SOMETIMES_CONSUMES
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index 8d1a5b20c9..ce00908681 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -109,6 +109,7 @@
MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf
MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf
MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf