summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c')
-rw-r--r--MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c
index e1e629442a..dfe211205b 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c
@@ -13,12 +13,11 @@
**/
-
#include "UefiDevicePathLib.h"
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathLibDevicePathToText = NULL;
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathLibDevicePathToText = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText = NULL;
/**
The constructor function caches the pointer to DevicePathUtilites protocol,
@@ -37,16 +36,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLib
EFI_STATUS
EFIAPI
UefiDevicePathLibOptionalDevicePathProtocolConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = gBS->LocateProtocol (
&gEfiDevicePathUtilitiesProtocolGuid,
NULL,
- (VOID**) &mDevicePathLibDevicePathUtilities
+ (VOID **)&mDevicePathLibDevicePathUtilities
);
ASSERT_EFI_ERROR (Status);
ASSERT (mDevicePathLibDevicePathUtilities != NULL);
@@ -256,8 +255,8 @@ AppendDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GetNextDevicePathInstance (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT UINTN *Size
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ OUT UINTN *Size
)
{
if (mDevicePathLibDevicePathUtilities != NULL) {
@@ -289,9 +288,9 @@ GetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
CreateDeviceNode (
- IN UINT8 NodeType,
- IN UINT8 NodeSubType,
- IN UINT16 NodeLength
+ IN UINT8 NodeType,
+ IN UINT8 NodeSubType,
+ IN UINT16 NodeLength
)
{
if (mDevicePathLibDevicePathUtilities != NULL) {
@@ -338,15 +337,16 @@ IsDevicePathMultiInstance (
**/
VOID *
UefiDevicePathLibLocateProtocol (
- EFI_GUID *ProtocolGuid
+ EFI_GUID *ProtocolGuid
)
{
- EFI_STATUS Status;
- VOID *Protocol;
+ EFI_STATUS Status;
+ VOID *Protocol;
+
Status = gBS->LocateProtocol (
ProtocolGuid,
NULL,
- (VOID**) &Protocol
+ (VOID **)&Protocol
);
if (EFI_ERROR (Status)) {
return NULL;
@@ -381,6 +381,7 @@ ConvertDeviceNodeToText (
if (mDevicePathLibDevicePathToText == NULL) {
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathToText != NULL) {
return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);
}
@@ -406,14 +407,15 @@ ConvertDeviceNodeToText (
CHAR16 *
EFIAPI
ConvertDevicePathToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
)
{
if (mDevicePathLibDevicePathToText == NULL) {
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathToText != NULL) {
return mDevicePathLibDevicePathToText->ConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
}
@@ -435,12 +437,13 @@ ConvertDevicePathToText (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
ConvertTextToDeviceNode (
- IN CONST CHAR16 *TextDeviceNode
+ IN CONST CHAR16 *TextDeviceNode
)
{
if (mDevicePathLibDevicePathFromText == NULL) {
mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathFromText != NULL) {
return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (TextDeviceNode);
}
@@ -463,12 +466,13 @@ ConvertTextToDeviceNode (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
ConvertTextToDevicePath (
- IN CONST CHAR16 *TextDevicePath
+ IN CONST CHAR16 *TextDevicePath
)
{
if (mDevicePathLibDevicePathFromText == NULL) {
mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
}
+
if (mDevicePathLibDevicePathFromText != NULL) {
return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (TextDevicePath);
}