]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update Device Path Module to use PCD Feature Flags to determine of the Device Path...
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 19 Sep 2006 19:14:02 +0000 (19:14 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 19 Sep 2006 19:14:02 +0000 (19:14 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1572 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h
EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa
EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c
EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c

index 78c5defe3a98f239fd1677dfb868233ff4f2e58b..6117a3245e4862bb5a59fd632bcbd6cb36691215 100644 (file)
@@ -22,10 +22,31 @@ Abstract:
 
 #include "DevicePath.h"
 
 
 #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 = {\r
+  GetDevicePathSizeProtocolInterface,
+  DuplicateDevicePathProtocolInterface,
+  AppendDevicePathProtocolInterface,
+  AppendDeviceNodeProtocolInterface,
+  AppendDevicePathInstanceProtocolInterface,
+  GetNextDevicePathInstanceProtocolInterface,
+  IsDevicePathMultiInstanceProtocolInterface,
+  CreateDeviceNodeProtocolInterface
+};\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_TO_TEXT_PROTOCOL   mDevicePathToText = {\r
+  ConvertDeviceNodeToText,
+  ConvertDevicePathToText
+};\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {\r
+  ConvertTextToDeviceNode,  \r
+  ConvertTextToDevicePath  \r
+};\r
+\r
+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
 
 EFI_STATUS
 EFIAPI
@@ -49,36 +70,40 @@ DevicePathEntryPoint (
 --*/
 {
   EFI_STATUS  Status;
 --*/
 {
   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)) {\r
+    if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r
+      Status = gBS->InstallMultipleProtocolInterfaces (
+                      &mDevicePathHandle,
+                      &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+                      &gEfiDevicePathToTextProtocolGuid,    &mDevicePathToText,
+                      &gEfiDevicePathFromTextProtocolGuid,  &mDevicePathFromText,
+                      NULL
+                      );
+    } else {\r
+      Status = gBS->InstallMultipleProtocolInterfaces (
+                      &mDevicePathHandle,
+                      &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+                      &gEfiDevicePathToTextProtocolGuid,    &mDevicePathToText,
+                      NULL
+                      );
+    }\r
+  } else {\r
+    if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r
+      Status = gBS->InstallMultipleProtocolInterfaces (
+                      &mDevicePathHandle,
+                      &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+                      &gEfiDevicePathFromTextProtocolGuid,  &mDevicePathFromText,
+                      NULL
+                      );
+    } else {\r
+      Status = gBS->InstallMultipleProtocolInterfaces (
+                      &mDevicePathHandle,
+                      &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
+                      NULL
+                      );
+    }\r
+  }\r
   return Status;
 }
   return Status;
 }
index 8e9072417ed828b8c1cd26a4012e756b9371c8ae..f74a65c48bc100c6c4701f1cbf220d2ebc9dece6 100644 (file)
@@ -21,23 +21,8 @@ Abstract:
 #ifndef _DEVICE_PATH_DRIVER_H\r
 #define _DEVICE_PATH_DRIVER_H\r
 \r
 #ifndef _DEVICE_PATH_DRIVER_H\r
 #define _DEVICE_PATH_DRIVER_H\r
 \r
-extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;\r
-extern EFI_GUID mEfiDevicePathMessagingSASGuid;\r
-\r
-#define DEVICE_PATH_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('D', 'P', 'D', 'V')\r
-\r
-typedef struct {\r
-\r
-  UINT32                             Signature;\r
-  EFI_HANDLE                         Handle;\r
-  //\r
-  // Produced protocols\r
-  //\r
-  EFI_DEVICE_PATH_UTILITIES_PROTOCOL DevicePathUtilities;\r
-  EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL DevicePathFromText;\r
-  EFI_DEVICE_PATH_TO_TEXT_PROTOCOL   DevicePathToText;\r
-\r
-} DEVICE_PATH_DRIVER_PRIVATE_DATA;\r
+extern const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;\r
+extern const EFI_GUID mEfiDevicePathMessagingSASGuid;\r
 \r
 #define MAX_CHAR                   480\r
 \r
 \r
 #define MAX_CHAR                   480\r
 \r
index b96ca9e4bac709bcb3051848b73742280f1b2602..541c01482d5b86c24d10dd92107dc7f1336db695 100644 (file)
@@ -1,15 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <?xml version="1.0" encoding="UTF-8"?>\r
-\r
-<!--Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->\r
-<ModuleSurfaceArea  xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
-\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
   <MsaHeader>\r
     <ModuleName>DevicePath</ModuleName>\r
     <ModuleType>DXE_DRIVER</ModuleType>\r
   <MsaHeader>\r
     <ModuleName>DevicePath</ModuleName>\r
     <ModuleType>DXE_DRIVER</ModuleType>\r
@@ -59,6 +49,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>DevicePathLib</Keyword>\r
     </LibraryClass>\r
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>DevicePathLib</Keyword>\r
     </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PcdLib</Keyword>\r
+    </LibraryClass>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>DevicePath.c</Filename>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>DevicePath.c</Filename>\r
@@ -71,7 +64,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
     <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
     <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
   </PackageDependencies>\r
     <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
     <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
   </PackageDependencies>\r
-  <Protocols>    \r
+  <Protocols>\r
     <Protocol Usage="ALWAYS_CONSUMED">\r
       <ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>\r
     </Protocol>\r
     <Protocol Usage="ALWAYS_CONSUMED">\r
       <ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>\r
     </Protocol>\r
@@ -109,4 +102,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
       <ModuleEntryPoint>DevicePathEntryPoint</ModuleEntryPoint>\r
     </Extern>\r
   </Externs>\r
       <ModuleEntryPoint>DevicePathEntryPoint</ModuleEntryPoint>\r
     </Extern>\r
   </Externs>\r
-</ModuleSurfaceArea>\r
+  <PcdCoded>\r
+    <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">\r
+      <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>\r
+      <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <DefaultValue>FALSE</DefaultValue>\r
+      <HelpText>If TRUE, then the Device Path To Text Protocol should be produced by the platform</HelpText>\r
+    </PcdEntry>\r
+    <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">\r
+      <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>\r
+      <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <DefaultValue>FALSE</DefaultValue>\r
+      <HelpText>If TRUE, then the Device Path From Text Protocol should be produced by the platform</HelpText>\r
+    </PcdEntry>\r
+  </PcdCoded>\r
+</ModuleSurfaceArea>
\ No newline at end of file
index d611b39f615008157602039ef303c5d694b7ac45..cd49359c7622327e106d7142cd668eb4bb4ba92a 100644 (file)
@@ -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"PcCard", DevPathFromTextPcCard},
   {L"MemoryMapped", DevPathFromTextMemoryMapped},
   {L"Pci", DevPathFromTextPci},
   {L"PcCard", DevPathFromTextPcCard},
   {L"MemoryMapped", DevPathFromTextMemoryMapped},
index f38f2ea1101b796eaed7bab9ecbe3c01d4ef2dd9..25c88e07d6d1e285df2427d84084fc288559e627 100644 (file)
@@ -1255,7 +1255,7 @@ DevPathToTextNodeUnknown (
   CatPrint (Str, L"?");\r
 }\r
 \r
   CatPrint (Str, L"?");\r
 }\r
 \r
-DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable[] = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable[] = {\r
   {HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci},\r
   {HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard},\r
   {HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap},\r
   {HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci},\r
   {HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard},\r
   {HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap},\r