Add 4 APIs to DevicePathLib: ConvertDeviceNodeToText, ConvertDevicePathToText, ConvertTextToDeviceNode and ConvertTextToDevicePath.
Add a new instance of DevicePathLib which tries to locate the protocol and if it's not found, it uses the internal functions. Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14504 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Device Path Driver to produce DevPathUtilities Protocol, DevPathFromText Protocol
|
||||
and DevPathToText Protocol.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -13,19 +13,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "DevicePath.h"
|
||||
|
||||
EFI_HANDLE mDevicePathHandle = NULL;
|
||||
#include <Uefi.h>
|
||||
#include <Protocol/DevicePathUtilities.h>
|
||||
#include <Protocol/DevicePathToText.h>
|
||||
#include <Protocol/DevicePathFromText.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {
|
||||
GetDevicePathSizeProtocolInterface,
|
||||
DuplicateDevicePathProtocolInterface,
|
||||
AppendDevicePathProtocolInterface,
|
||||
AppendDeviceNodeProtocolInterface,
|
||||
AppendDevicePathInstanceProtocolInterface,
|
||||
GetNextDevicePathInstanceProtocolInterface,
|
||||
IsDevicePathMultiInstanceProtocolInterface,
|
||||
CreateDeviceNodeProtocolInterface
|
||||
GetDevicePathSize,
|
||||
DuplicateDevicePath,
|
||||
AppendDevicePath,
|
||||
AppendDevicePathNode,
|
||||
AppendDevicePathInstance,
|
||||
GetNextDevicePathInstance,
|
||||
IsDevicePathMultiInstance,
|
||||
CreateDeviceNode
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {
|
||||
@@ -38,11 +43,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePa
|
||||
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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The user Entry Point for DevicePath module.
|
||||
|
||||
@@ -64,12 +64,14 @@ DevicePathEntryPoint (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
Handle = NULL;
|
||||
Status = EFI_UNSUPPORTED;
|
||||
if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {
|
||||
if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mDevicePathHandle,
|
||||
&Handle,
|
||||
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
|
||||
&gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
|
||||
&gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
|
||||
@@ -77,7 +79,7 @@ DevicePathEntryPoint (
|
||||
);
|
||||
} else {
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mDevicePathHandle,
|
||||
&Handle,
|
||||
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
|
||||
&gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
|
||||
NULL
|
||||
@@ -86,14 +88,14 @@ DevicePathEntryPoint (
|
||||
} else {
|
||||
if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mDevicePathHandle,
|
||||
&Handle,
|
||||
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
|
||||
&gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mDevicePathHandle,
|
||||
&Handle,
|
||||
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
|
||||
NULL
|
||||
);
|
||||
|
Reference in New Issue
Block a user