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"
|
#include "DevicePath.h"
|
||||||
|
|
||||||
DEVICE_PATH_DRIVER_PRIVATE_DATA mPrivateData;
|
EFI_HANDLE mDevicePathHandle = NULL;
|
||||||
|
|
||||||
EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
|
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {
|
||||||
EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
|
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
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -50,35 +71,39 @@ DevicePathEntryPoint (
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
mPrivateData.Signature = DEVICE_PATH_DRIVER_SIGNATURE;
|
Status = EFI_UNSUPPORTED;
|
||||||
|
if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {
|
||||||
mPrivateData.DevicePathUtilities.GetDevicePathSize = GetDevicePathSizeProtocolInterface;
|
if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
|
||||||
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 (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&mPrivateData.Handle,
|
&mDevicePathHandle,
|
||||||
&gEfiDevicePathUtilitiesProtocolGuid,
|
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
|
||||||
&mPrivateData.DevicePathUtilities,
|
&gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
|
||||||
&gEfiDevicePathToTextProtocolGuid,
|
&gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
|
||||||
&mPrivateData.DevicePathToText,
|
|
||||||
&gEfiDevicePathFromTextProtocolGuid,
|
|
||||||
&mPrivateData.DevicePathFromText,
|
|
||||||
NULL
|
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;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,23 +21,8 @@ Abstract:
|
||||||
#ifndef _DEVICE_PATH_DRIVER_H
|
#ifndef _DEVICE_PATH_DRIVER_H
|
||||||
#define _DEVICE_PATH_DRIVER_H
|
#define _DEVICE_PATH_DRIVER_H
|
||||||
|
|
||||||
extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
|
extern const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
|
||||||
extern EFI_GUID mEfiDevicePathMessagingSASGuid;
|
extern const 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;
|
|
||||||
|
|
||||||
#define MAX_CHAR 480
|
#define MAX_CHAR 480
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<!--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">
|
|
||||||
|
|
||||||
<MsaHeader>
|
<MsaHeader>
|
||||||
<ModuleName>DevicePath</ModuleName>
|
<ModuleName>DevicePath</ModuleName>
|
||||||
<ModuleType>DXE_DRIVER</ModuleType>
|
<ModuleType>DXE_DRIVER</ModuleType>
|
||||||
|
@ -59,6 +49,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
||||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||||
<Keyword>DevicePathLib</Keyword>
|
<Keyword>DevicePathLib</Keyword>
|
||||||
</LibraryClass>
|
</LibraryClass>
|
||||||
|
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||||
|
<Keyword>PcdLib</Keyword>
|
||||||
|
</LibraryClass>
|
||||||
</LibraryClassDefinitions>
|
</LibraryClassDefinitions>
|
||||||
<SourceFiles>
|
<SourceFiles>
|
||||||
<Filename>DevicePath.c</Filename>
|
<Filename>DevicePath.c</Filename>
|
||||||
|
@ -109,4 +102,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
||||||
<ModuleEntryPoint>DevicePathEntryPoint</ModuleEntryPoint>
|
<ModuleEntryPoint>DevicePathEntryPoint</ModuleEntryPoint>
|
||||||
</Extern>
|
</Extern>
|
||||||
</Externs>
|
</Externs>
|
||||||
|
<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>
|
</ModuleSurfaceArea>
|
|
@ -2174,7 +2174,7 @@ DevPathFromTextBBS (
|
||||||
return (EFI_DEVICE_PATH_PROTOCOL *) Bbs;
|
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"Pci", DevPathFromTextPci},
|
||||||
{L"PcCard", DevPathFromTextPcCard},
|
{L"PcCard", DevPathFromTextPcCard},
|
||||||
{L"MemoryMapped", DevPathFromTextMemoryMapped},
|
{L"MemoryMapped", DevPathFromTextMemoryMapped},
|
||||||
|
|
|
@ -1255,7 +1255,7 @@ DevPathToTextNodeUnknown (
|
||||||
CatPrint (Str, L"?");
|
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_PCI_DP, DevPathToTextPci},
|
||||||
{HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard},
|
{HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard},
|
||||||
{HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap},
|
{HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap},
|
||||||
|
|
Loading…
Reference in New Issue