diff options
author | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-09-19 19:14:02 +0000 |
---|---|---|
committer | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-09-19 19:14:02 +0000 |
commit | e99aa5a2113a275c2e16cf049ce8e66642e6c64c (patch) | |
tree | 7ea18e2b77a8935e219a77511fb718b669e4d1a3 /EdkModulePkg | |
parent | c7823a8f8a1f6662662117558a8c6f06c7a07a71 (diff) | |
download | edk2-e99aa5a2113a275c2e16cf049ce8e66642e6c64c.tar.gz edk2-e99aa5a2113a275c2e16cf049ce8e66642e6c64c.tar.bz2 edk2-e99aa5a2113a275c2e16cf049ce8e66642e6c64c.zip |
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
Diffstat (limited to 'EdkModulePkg')
5 files changed, 84 insertions, 67 deletions
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c index 78c5defe3a..6117a3245e 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c @@ -22,10 +22,31 @@ Abstract: #include "DevicePath.h" -DEVICE_PATH_DRIVER_PRIVATE_DATA mPrivateData; - -EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL; -EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS; +EFI_HANDLE mDevicePathHandle = NULL; + +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; } diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h index 8e9072417e..f74a65c48b 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h @@ -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
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa index b96ca9e4ba..541c01482d 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa @@ -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>
\ No newline at end of file diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c index d611b39f61..cd49359c76 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c @@ -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}, diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c index f38f2ea110..25c88e07d6 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c @@ -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},
|