mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
c7823a8f8a
commit
e99aa5a211
|
@ -22,10 +22,31 @@ Abstract:
|
|||
|
||||
#include "DevicePath.h"
|
||||
|
||||
DEVICE_PATH_DRIVER_PRIVATE_DATA mPrivateData;
|
||||
EFI_HANDLE mDevicePathHandle = NULL;
|
||||
|
||||
EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
|
||||
EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -21,23 +21,8 @@ Abstract:
|
|||
#ifndef _DEVICE_PATH_DRIVER_H
|
||||
#define _DEVICE_PATH_DRIVER_H
|
||||
|
||||
extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
|
||||
extern EFI_GUID mEfiDevicePathMessagingSASGuid;
|
||||
|
||||
#define DEVICE_PATH_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('D', 'P', 'D', 'V')
|
||||
|
||||
typedef struct {
|
||||
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE Handle;
|
||||
//
|
||||
// Produced protocols
|
||||
//
|
||||
EFI_DEVICE_PATH_UTILITIES_PROTOCOL DevicePathUtilities;
|
||||
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL DevicePathFromText;
|
||||
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL DevicePathToText;
|
||||
|
||||
} DEVICE_PATH_DRIVER_PRIVATE_DATA;
|
||||
extern const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
|
||||
extern const EFI_GUID mEfiDevicePathMessagingSASGuid;
|
||||
|
||||
#define MAX_CHAR 480
|
||||
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
|
||||
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>DevicePath</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
|
@ -59,6 +49,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
|||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DevicePathLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PcdLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>DevicePath.c</Filename>
|
||||
|
@ -71,7 +64,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
|||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
|
@ -109,4 +102,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
|||
<ModuleEntryPoint>DevicePathEntryPoint</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
||||
<PcdCoded>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdDevicePathSupportDevicePathToText</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<DefaultValue>FALSE</DefaultValue>
|
||||
<HelpText>If TRUE, then the Device Path To Text Protocol should be produced by the platform</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<DefaultValue>FALSE</DefaultValue>
|
||||
<HelpText>If TRUE, then the Device Path From Text Protocol should be produced by the platform</HelpText>
|
||||
</PcdEntry>
|
||||
</PcdCoded>
|
||||
</ModuleSurfaceArea>
|
|
@ -2174,7 +2174,7 @@ DevPathFromTextBBS (
|
|||
return (EFI_DEVICE_PATH_PROTOCOL *) Bbs;
|
||||
}
|
||||
|
||||
DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[] = {
|
||||
{L"Pci", DevPathFromTextPci},
|
||||
{L"PcCard", DevPathFromTextPcCard},
|
||||
{L"MemoryMapped", DevPathFromTextMemoryMapped},
|
||||
|
|
|
@ -1255,7 +1255,7 @@ DevPathToTextNodeUnknown (
|
|||
CatPrint (Str, L"?");
|
||||
}
|
||||
|
||||
DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable[] = {
|
||||
{HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci},
|
||||
{HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard},
|
||||
{HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap},
|
||||
|
|
Loading…
Reference in New Issue