]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Change library class PlatDriOverLib to PlatformDriOverrideLib
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 24 Feb 2009 08:26:40 +0000 (08:26 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 24 Feb 2009 08:26:40 +0000 (08:26 +0000)
Move Application Platform Override Manager into Application directory.
Add comments in Network library class to say they are only intended to be used by UEFI network stack modules.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7641 6f19259b-4bc3-4df7-8a09-765794883524

22 files changed:
MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.c [new file with mode: 0644]
MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.h [new file with mode: 0644]
MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.inf [new file with mode: 0644]
MdeModulePkg/Application/PlatOverMngr/Vfr.vfr [new file with mode: 0644]
MdeModulePkg/Application/PlatOverMngr/VfrStrings.uni [new file with mode: 0644]
MdeModulePkg/Include/Library/IpIoLib.h
MdeModulePkg/Include/Library/NetLib.h
MdeModulePkg/Include/Library/PlatDriOverLib.h [deleted file]
MdeModulePkg/Include/Library/PlatformDriverOverrideLib.h [new file with mode: 0644]
MdeModulePkg/Include/Library/UdpIoLib.h
MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf
MdeModulePkg/Library/DxePlatDriOverLib/PlatDriOver.h
MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c
MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/MdeModulePkg.dsc
MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.c [deleted file]
MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.h [deleted file]
MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.inf [deleted file]
MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/Vfr.vfr [deleted file]
MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/VfrStrings.uni [deleted file]
MdeModulePkg/Universal/PlatformDriverOverride/PlatformDriOverrideDxe/PlatformDriOverride.c
MdeModulePkg/Universal/PlatformDriverOverride/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf

diff --git a/MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.c b/MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.c
new file mode 100644 (file)
index 0000000..3711a91
--- /dev/null
@@ -0,0 +1,1441 @@
+/** @file\r
+\r
+  A UI application to offer a UI interface in device manager to let user configue\r
+  platform override protocol to override the default algorithm for matching\r
+  drivers to controllers.\r
+\r
+  The main flow:\r
+  1. The UI application dynamicly locate all controller device path.\r
+  2. The UI application dynamicly locate all drivers which support binding protocol.\r
+  3. The UI application export and dynamicly update two menu to let user select the\r
+     mapping between drivers to controllers.\r
+  4. The UI application save all the mapping info in NV variables which will be consumed\r
+     by platform override protocol driver to publish the platform override protocol.\r
+\r
+Copyright (c) 2007 - 2008, 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
+\r
+**/\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Protocol/HiiConfigAccess.h>\r
+#include <Protocol/HiiConfigRouting.h>\r
+#include <Protocol/HiiDatabase.h>\r
+#include <Protocol/FormBrowser2.h>\r
+#include <Protocol/LoadedImage.h>\r
+#include <Protocol/FirmwareVolume2.h>\r
+#include <Protocol/PciIo.h>\r
+#include <Protocol/BusSpecificDriverOverride.h>\r
+#include <Protocol/ComponentName2.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Guid/GlobalVariable.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/UefiApplicationEntryPoint.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/PlatformDriverOverrideLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/IfrSupportLib.h>\r
+#include <Library/ExtendedHiiLib.h>\r
+#include <Library/ExtendedIfrSupportLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/GenericBdsLib.h>\r
+#include "PlatOverMngr.h"\r
+\r
+#define EFI_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('C', 'l', 'b', 'k')\r
+#define EFI_CALLBACK_INFO_FROM_THIS(a)  CR (a, EFI_CALLBACK_INFO, ConfigAccess, EFI_CALLBACK_INFO_SIGNATURE)\r
+\r
+typedef struct {\r
+  UINTN                           Signature;\r
+  EFI_HANDLE                      DriverHandle;\r
+  EFI_HII_HANDLE                  RegisteredHandle;\r
+  PLAT_OVER_MNGR_DATA             FakeNvData;\r
+  EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
+  EFI_HII_CONFIG_ACCESS_PROTOCOL  ConfigAccess;\r
+} EFI_CALLBACK_INFO;\r
+\r
+//\r
+// uni string and Vfr Binary data.\r
+//\r
+extern UINT8  VfrBin[];\r
+extern UINT8  PlatOverMngrStrings[];\r
+\r
+//\r
+// module global data\r
+//\r
+EFI_GUID                     mPlatformOverridesManagerGuid = PLAT_OVER_MNGR_GUID;\r
+LIST_ENTRY                   mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);\r
+\r
+EFI_HANDLE                   *mDevicePathHandleBuffer;\r
+EFI_HANDLE                   *mDriverImageHandleBuffer;\r
+\r
+INTN                         mSelectedCtrIndex;\r
+EFI_STRING_ID                mControllerToken[MAX_CHOICE_NUM];\r
+UINTN                        mDriverImageHandleCount;\r
+EFI_STRING_ID                mDriverImageToken[MAX_CHOICE_NUM];\r
+EFI_STRING_ID                mDriverImageFilePathToken[MAX_CHOICE_NUM];\r
+EFI_LOADED_IMAGE_PROTOCOL    *mDriverImageProtocol[MAX_CHOICE_NUM];\r
+EFI_DEVICE_PATH_PROTOCOL     *mControllerDevicePathProtocol[MAX_CHOICE_NUM];\r
+UINTN                        mSelectedDriverImageNum;\r
+UINTN                        mLastSavedDriverImageNum;\r
+CHAR8                        mLanguage[RFC_3066_ENTRY_SIZE];\r
+UINT16                       mCurrentPage;\r
+\r
+/**\r
+  Do string convertion for the ComponentName supported language. It do\r
+  the convertion just for english language code from RFC 3066 to ISO 639-2.\r
+  Then it will check whether the converted language is in the supported language list.\r
+  If not supported, NULL is returned.\r
+  If Language is not english, NULL is returned.\r
+\r
+  @param SupportedLanguages        Pointer to ComponentName supported language string list. ISO 639-2 language\r
+  @param Language                  The language string. RFC 3066 language\r
+\r
+  @return  English language string (ISO 639-2)\r
+  @return  NULL if the conertion is not successful.\r
+\r
+**/\r
+CHAR8 *\r
+ConvertComponentNameSupportLanguage (\r
+  IN CHAR8                           *SupportedLanguages,\r
+  IN CHAR8                           *Language\r
+  )\r
+{\r
+  CHAR8    *LangCode;\r
+  LangCode = NULL;\r
+\r
+  //\r
+  // Check the input language is English\r
+  //\r
+  if (AsciiStrnCmp (Language, "en-", 3) != 0) {\r
+    return NULL;\r
+  }\r
+  \r
+  //\r
+  // Check SupportedLanguages format\r
+  //\r
+  if (AsciiStrStr (SupportedLanguages, "en-") != NULL) {\r
+    //\r
+    // Create RFC 3066 language\r
+    //\r
+    LangCode = AllocateZeroPool(AsciiStrSize (Language));\r
+    AsciiStrCpy (LangCode, Language);\r
+  } else if (AsciiStrStr (SupportedLanguages, "en") != NULL) {\r
+    //\r
+    // Create ISO 639-2 Language\r
+    //\r
+    LangCode = AllocateZeroPool(4);\r
+    AsciiStrCpy (LangCode, "eng");    \r
+  }\r
+  \r
+  return LangCode;\r
+}\r
+\r
+/**\r
+  Get the driver name by ComponentName or ComponentName2 protocol \r
+  according to the driver binding handle\r
+\r
+  @param DriverBindingHandle  The Handle of DriverBinding.\r
+\r
+  @retval !NULL               Pointer into the image name if the image name is found,\r
+  @retval NULL                Pointer to NULL if the image name is not found.\r
+\r
+**/\r
+CHAR16 *\r
+GetComponentName (\r
+  IN EFI_HANDLE                      DriverBindingHandle\r
+  )\r
+{\r
+  EFI_STATUS                   Status;\r
+  EFI_COMPONENT_NAME_PROTOCOL  *ComponentName;\r
+  EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;\r
+  CHAR8                        *SupportedLanguage;\r
+  CHAR16                       *DriverName;\r
+\r
+  ComponentName  = NULL;\r
+  ComponentName2 = NULL;\r
+  Status = gBS->OpenProtocol (\r
+                 DriverBindingHandle,\r
+                 &gEfiComponentName2ProtocolGuid,\r
+                 (VOID **) &ComponentName2,\r
+                 NULL,\r
+                 NULL,\r
+                 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                 );\r
+  if (EFI_ERROR(Status)) {\r
+    Status = gBS->OpenProtocol (\r
+                   DriverBindingHandle,\r
+                   &gEfiComponentNameProtocolGuid,\r
+                   (VOID **) &ComponentName,\r
+                   NULL,\r
+                   NULL,\r
+                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                   );\r
+  }\r
+\r
+  Status     = EFI_SUCCESS;\r
+  DriverName = NULL;\r
+  if (ComponentName != NULL) {\r
+    if (ComponentName->GetDriverName != NULL) {\r
+      SupportedLanguage = ConvertComponentNameSupportLanguage (ComponentName->SupportedLanguages, mLanguage);\r
+      if (SupportedLanguage != NULL) {\r
+        Status = ComponentName->GetDriverName (\r
+                                  ComponentName,\r
+                                  SupportedLanguage,\r
+                                  &DriverName\r
+                                  );\r
+        FreePool (SupportedLanguage);\r
+      }\r
+    }\r
+  } else if (ComponentName2 != NULL) {\r
+    if (ComponentName2->GetDriverName != NULL) {\r
+      Status = ComponentName2->GetDriverName (\r
+                                 ComponentName2,\r
+                                 mLanguage,\r
+                                 &DriverName\r
+                                 );\r
+    }\r
+  }\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    return NULL;\r
+  }\r
+\r
+  return DriverName;\r
+}\r
+\r
+/**\r
+  Get the image name from EFI UI section.\r
+  Get FV protocol by its loaded image protoocl to abastract EFI UI section.\r
+\r
+  @param Image            Pointer to the loaded image protocol\r
+\r
+  @retval !NULL           Pointer to the image name if the image name is found,\r
+  @retval NULL            NULL if the image name is not found.\r
+\r
+**/\r
+CHAR16 *\r
+GetImageName (\r
+  IN EFI_LOADED_IMAGE_PROTOCOL *Image\r
+  )\r
+{\r
+  EFI_STATUS                        Status;\r
+  EFI_DEVICE_PATH_PROTOCOL          *DevPathNode;\r
+  EFI_DEVICE_PATH_PROTOCOL          *AlignedDevPathNode;\r
+  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;\r
+  VOID                              *Buffer;\r
+  UINTN                             BufferSize;\r
+  UINT32                            AuthenticationStatus;\r
+  EFI_GUID                          *NameGuid;\r
+  EFI_FIRMWARE_VOLUME2_PROTOCOL     *Fv2;\r
+\r
+  Fv2         = NULL;\r
+  Buffer      = NULL;\r
+  BufferSize  = 0;\r
+\r
+  if (Image->FilePath == NULL) {\r
+    return NULL;\r
+  }\r
+  DevPathNode  = Image->FilePath;\r
+\r
+  while (!IsDevicePathEnd (DevPathNode)) {\r
+    //\r
+    // Make sure device path node is aligned when accessing it's FV Name Guid field.\r
+    //\r
+    AlignedDevPathNode = AllocateCopyPool (DevicePathNodeLength(DevPathNode), DevPathNode);\r
+    \r
+    //\r
+    // Find the Fv File path\r
+    //\r
+    NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)AlignedDevPathNode);\r
+    if (NameGuid != NULL) {\r
+      FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) AlignedDevPathNode;\r
+      Status = gBS->HandleProtocol (\r
+                    Image->DeviceHandle,\r
+                    &gEfiFirmwareVolume2ProtocolGuid,\r
+                    (VOID **) &Fv2\r
+                    );\r
+      //\r
+      // Locate Image EFI UI section to get the image name.\r
+      //\r
+      if (!EFI_ERROR (Status)) {\r
+        Status = Fv2->ReadSection (\r
+                        Fv2,\r
+                        &FvFilePath->FvFileName,\r
+                        EFI_SECTION_USER_INTERFACE,\r
+                        0,\r
+                        &Buffer,\r
+                        &BufferSize,\r
+                        &AuthenticationStatus\r
+                        );\r
+        if (!EFI_ERROR (Status)) {\r
+          FreePool (AlignedDevPathNode);\r
+          break;\r
+        }\r
+        Buffer = NULL;\r
+      }\r
+    }\r
+    \r
+    FreePool (AlignedDevPathNode);\r
+    \r
+    //\r
+    // Next device path node\r
+    //\r
+    DevPathNode = NextDevicePathNode (DevPathNode);\r
+  }\r
+\r
+  return Buffer;\r
+}\r
+\r
+/**\r
+  Prepare the first page to let user select the device controller which need to\r
+  add mapping drivers if user select 'Refresh' in first page.\r
+  During first page, user will see all currnet controller device path in system,\r
+  select any device path will go to second page to select its overrides drivers.\r
+\r
+  @param  Private        Pointer to EFI_CALLBACK_INFO.\r
+  @param  KeyValue       The callback key value of device controller item in first page.\r
+  @param  FakeNvData     Pointer to PLAT_OVER_MNGR_DATA.\r
+\r
+  @retval EFI_SUCCESS    Always returned.\r
+\r
+**/\r
+EFI_STATUS\r
+UpdateDeviceSelectPage (\r
+  IN EFI_CALLBACK_INFO                *Private,\r
+  IN UINT16                           KeyValue,\r
+  IN PLAT_OVER_MNGR_DATA              *FakeNvData\r
+  )\r
+{\r
+  EFI_HII_UPDATE_DATA                       UpdateData;\r
+  EFI_STATUS                                Status;\r
+  UINTN                                     LangSize;\r
+  UINTN                                     Index;\r
+  UINTN                                     DevicePathHandleCount;\r
+  CHAR16                                    *NewString;\r
+  EFI_STRING_ID                             NewStringToken;\r
+  CHAR16                                    *ControllerName;\r
+  EFI_DEVICE_PATH_PROTOCOL                  *ControllerDevicePath;\r
+  EFI_PCI_IO_PROTOCOL                       *PciIo;\r
+  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;\r
+  UINTN                                     Len;\r
+  \r
+  //\r
+  // set current page form ID.\r
+  //\r
+  mCurrentPage = FORM_ID_DEVICE;  \r
+  \r
+  //\r
+  // Get Platform supported Language (RFC_3066 format)\r
+  //\r
+  LangSize = RFC_3066_ENTRY_SIZE;\r
+  Status = gRT->GetVariable (\r
+              L"PlatformLang",\r
+              &gEfiGlobalVariableGuid,\r
+              NULL,\r
+              &LangSize,\r
+              mLanguage\r
+              );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  //\r
+  // Initial the mapping database in memory\r
+  //\r
+  FreeMappingDatabase (&mMappingDataBase);\r
+  Status = InitOverridesMapping (&mMappingDataBase);\r
+\r
+  //\r
+  // Clear all the content in the first page\r
+  //\r
+  UpdateData.BufferSize = UPDATE_DATA_SIZE;\r
+  UpdateData.Offset = 0;\r
+  UpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
+  ASSERT (UpdateData.Data != NULL);\r
+  //\r
+  // Clear first page form\r
+  //\r
+  IfrLibUpdateForm (\r
+    Private->RegisteredHandle,\r
+    &mPlatformOverridesManagerGuid,\r
+    FORM_ID_DEVICE,\r
+    FORM_ID_DEVICE,\r
+    FALSE,\r
+    &UpdateData\r
+    );\r
+\r
+  //\r
+  // When user enter the page at first time, the 'first refresh' string is given to notify user to refresh all the drivers,\r
+  // then the 'first refresh' string will be replaced by the 'refresh' string, and the two strings content are same after the replacement\r
+  //\r
+  NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH);\r
+  HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH), &NewString);\r
+  ASSERT (NewString != NULL);\r
+  Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);\r
+  ASSERT_EFI_ERROR (Status);\r
+  FreePool (NewString);\r
+\r
+  NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH_HELP);\r
+  HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH_HELP), &NewString);\r
+  ASSERT (NewString != NULL);\r
+  Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);\r
+  ASSERT_EFI_ERROR (Status);\r
+  FreePool (NewString);\r
+\r
+  //\r
+  // created needed controller device item in first page\r
+  //\r
+  DevicePathHandleCount  = 0;\r
+  Status = gBS->LocateHandleBuffer (\r
+                  ByProtocol,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  NULL,\r
+                  &DevicePathHandleCount,\r
+                  &mDevicePathHandleBuffer\r
+                  );\r
+  if (EFI_ERROR (Status) || (DevicePathHandleCount == 0)) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  for (Index = 0; Index < DevicePathHandleCount; Index++) {\r
+    if (FakeNvData->PciDeviceFilter == 0x01) {\r
+      //\r
+      // Only care PCI device which contain efi driver in its option rom.\r
+      //\r
+\r
+      //\r
+      // Check whether it is a pci device\r
+      //\r
+      ControllerDevicePath = NULL;\r
+      Status = gBS->OpenProtocol (\r
+                      mDevicePathHandleBuffer[Index],\r
+                      &gEfiPciIoProtocolGuid,\r
+                      (VOID **) &PciIo,\r
+                      NULL,\r
+                      NULL,\r
+                      EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                      );\r
+      if (EFI_ERROR (Status)) {\r
+        continue;\r
+      }\r
+      //\r
+      // Check whether it contain efi driver in its option rom\r
+      //\r
+      Status = gBS->HandleProtocol(\r
+                       mDevicePathHandleBuffer[Index],\r
+                       &gEfiBusSpecificDriverOverrideProtocolGuid,\r
+                       (VOID **) &BusSpecificDriverOverride\r
+                       );\r
+      if (EFI_ERROR (Status) || BusSpecificDriverOverride == NULL) {\r
+        continue;\r
+      }\r
+    }\r
+\r
+    ControllerDevicePath = NULL;\r
+    Status = gBS->OpenProtocol (\r
+                    mDevicePathHandleBuffer[Index],\r
+                    &gEfiDevicePathProtocolGuid,\r
+                    (VOID **) &ControllerDevicePath,\r
+                    NULL,\r
+                    NULL,\r
+                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                    );\r
+    ASSERT_EFI_ERROR (Status);\r
+    //\r
+    // Save the device path protocol interface\r
+    //\r
+    mControllerDevicePathProtocol[Index] = ControllerDevicePath;\r
+\r
+    //\r
+    // Get the driver name\r
+    //\r
+    ControllerName = DevicePathToStr (ControllerDevicePath);\r
+\r
+    //\r
+    // Export the driver name string and create item in set options page\r
+    //\r
+    Len = StrSize (ControllerName);\r
+    NewString = AllocateZeroPool (Len + StrSize (L"--"));\r
+    ASSERT (NewString != NULL);\r
+    if (EFI_ERROR (CheckMapping (ControllerDevicePath,NULL, &mMappingDataBase, NULL, NULL))) {\r
+      StrCat (NewString, L"--");\r
+    } else {\r
+      StrCat (NewString, L"**");\r
+    }\r
+    StrCat (NewString, ControllerName);\r
+\r
+    NewStringToken = mControllerToken[Index];\r
+    if (NewStringToken == 0) {\r
+      Status = HiiLibNewString (Private->RegisteredHandle, &NewStringToken, NewString);\r
+    } else {\r
+      Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);\r
+    }\r
+    ASSERT_EFI_ERROR (Status);\r
+    FreePool (NewString);\r
+    //\r
+    // Save the device path string toke for next access use\r
+    //\r
+    mControllerToken[Index] = NewStringToken;\r
+\r
+    CreateGotoOpCode (\r
+      FORM_ID_DRIVER,\r
+      NewStringToken,\r
+      STRING_TOKEN (STR_GOTO_HELP_DRIVER),\r
+      EFI_IFR_FLAG_CALLBACK,\r
+      (UINT16) (Index + KEY_VALUE_DEVICE_OFFSET),\r
+      &UpdateData\r
+      );\r
+  }\r
+\r
+  //\r
+  // Update first page form\r
+  //\r
+  IfrLibUpdateForm (\r
+    Private->RegisteredHandle,\r
+    &mPlatformOverridesManagerGuid,\r
+    FORM_ID_DEVICE,\r
+    FORM_ID_DEVICE,\r
+    FALSE,\r
+    &UpdateData\r
+    );\r
+\r
+  FreePool (UpdateData.Data);\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Get the first Driver Binding handle which has the specific image handle.\r
+\r
+  @param  ImageHandle          The Image handle\r
+\r
+  @return                      Handle to Driver binding\r
+  @retval NULL                 The paramter is not valid or the driver binding handle is not found.\r
+\r
+**/\r
+EFI_HANDLE\r
+GetDriverBindingHandleFromImageHandle (\r
+  IN  EFI_HANDLE   ImageHandle\r
+  )\r
+{\r
+  EFI_STATUS                        Status;\r
+  UINTN                             Index;\r
+  UINTN                             DriverBindingHandleCount;\r
+  EFI_HANDLE                        *DriverBindingHandleBuffer;\r
+  EFI_DRIVER_BINDING_PROTOCOL       *DriverBindingInterface;\r
+  EFI_HANDLE                        DriverBindingHandle;\r
+\r
+  DriverBindingHandle = NULL;\r
+\r
+  if (ImageHandle == NULL) {\r
+    return NULL;\r
+  }\r
+  //\r
+  // Get all drivers which support driver binding protocol\r
+  //\r
+  DriverBindingHandleCount  = 0;\r
+  Status = gBS->LocateHandleBuffer (\r
+                  ByProtocol,\r
+                  &gEfiDriverBindingProtocolGuid,\r
+                  NULL,\r
+                  &DriverBindingHandleCount,\r
+                  &DriverBindingHandleBuffer\r
+                  );\r
+  if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {\r
+    return NULL;\r
+  }\r
+  \r
+  //\r
+  // Get the first Driver Binding handle which has the specific image handle.\r
+  //\r
+  for (Index = 0; Index < DriverBindingHandleCount; Index++) {\r
+    DriverBindingInterface = NULL;\r
+    Status = gBS->OpenProtocol (\r
+                    DriverBindingHandleBuffer[Index],\r
+                    &gEfiDriverBindingProtocolGuid,\r
+                    (VOID **) &DriverBindingInterface,\r
+                    NULL,\r
+                    NULL,\r
+                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      continue;\r
+    }\r
+\r
+    if (DriverBindingInterface->ImageHandle == ImageHandle) {\r
+      DriverBindingHandle = DriverBindingHandleBuffer[Index];\r
+      break;\r
+    }\r
+  }\r
+\r
+  FreePool (DriverBindingHandleBuffer);\r
+  return DriverBindingHandle;\r
+}\r
+\r
+/**\r
+  Prepare to let user select the drivers which need mapping with the device controller\r
+  selected in first page.\r
+\r
+  @param  Private        Pointer to EFI_CALLBACK_INFO.\r
+  @param  KeyValue       The callback key value of device controller item in first page.\r
+                         KeyValue is larger than or equal to KEY_VALUE_DEVICE_OFFSET.\r
+  @param  FakeNvData     Pointer to PLAT_OVER_MNGR_DATA.\r
+\r
+  @retval EFI_SUCCESS    Always returned.\r
+\r
+**/\r
+EFI_STATUS\r
+UpdateBindingDriverSelectPage (\r
+  IN EFI_CALLBACK_INFO                *Private,\r
+  IN UINT16                           KeyValue,\r
+  IN PLAT_OVER_MNGR_DATA              *FakeNvData\r
+  )\r
+{\r
+  EFI_HII_UPDATE_DATA                       UpdateData;\r
+  EFI_STATUS                                Status;\r
+  UINTN                                     Index;\r
+  CHAR16                                    *NewString;\r
+  EFI_STRING_ID                             NewStringToken;\r
+  EFI_STRING_ID                             NewStringHelpToken;\r
+  UINTN                                     DriverImageHandleCount;\r
+  EFI_LOADED_IMAGE_PROTOCOL                 *LoadedImage;\r
+  CHAR16                                    *DriverName;\r
+  BOOLEAN                                   FreeDriverName;\r
+  EFI_DEVICE_PATH_PROTOCOL                  *LoadedImageDevicePath;\r
+  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;\r
+  EFI_HANDLE                                DriverBindingHandle;\r
+\r
+  //\r
+  // If user select a controller item in the first page  the following code will be run.\r
+  // During second page, user will see all currnet driver bind protocol driver, the driver name and its device path will be shown\r
+  //\r
+  //First acquire the list of Loaded Image Protocols, and then when  want the name of the driver, look up all the Driver Binding Protocols\r
+  // and find the first one whose ImageHandle field matches the image handle of the Loaded Image Protocol.\r
+  // then use the Component Name Protocol on the same handle as the first matching Driver Binding Protocol to look up the name of the driver.\r
+  //\r
+\r
+  mCurrentPage = FORM_ID_DRIVER;\r
+  //\r
+  // Switch the item callback key value to its NO. in mDevicePathHandleBuffer\r
+  //\r
+  mSelectedCtrIndex = KeyValue - KEY_VALUE_DEVICE_OFFSET;\r
+  ASSERT (mSelectedCtrIndex > 0 && mSelectedCtrIndex < MAX_CHOICE_NUM);\r
+\r
+  mLastSavedDriverImageNum = 0;\r
+  //\r
+  // Clear all the content in dynamic page\r
+  //\r
+  UpdateData.BufferSize = UPDATE_DATA_SIZE;\r
+  UpdateData.Offset = 0;\r
+  UpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
+  ASSERT (UpdateData.Data != NULL);\r
+  //\r
+  // Clear second page form\r
+  //\r
+  IfrLibUpdateForm (\r
+    Private->RegisteredHandle,\r
+    &mPlatformOverridesManagerGuid,\r
+    FORM_ID_DRIVER,\r
+    FORM_ID_DRIVER,\r
+    FALSE,\r
+    &UpdateData\r
+    );\r
+\r
+  //\r
+  // Show all driver which support loaded image protocol in second page\r
+  //\r
+  DriverImageHandleCount  = 0;\r
+  Status = gBS->LocateHandleBuffer (\r
+                  ByProtocol,\r
+                  &gEfiLoadedImageProtocolGuid,\r
+                  NULL,\r
+                  &DriverImageHandleCount,\r
+                  &mDriverImageHandleBuffer\r
+                  );\r
+  if (EFI_ERROR (Status) || (DriverImageHandleCount == 0)) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  mDriverImageHandleCount = DriverImageHandleCount;\r
+  for (Index = 0; Index < DriverImageHandleCount; Index++) {\r
+    //\r
+    // Step1: Get the driver image total file path for help string and the driver name.\r
+    //\r
+\r
+    //\r
+    // Find driver's Loaded Image protocol\r
+    //\r
+    LoadedImage =NULL;\r
+\r
+    Status = gBS->OpenProtocol (\r
+                    mDriverImageHandleBuffer[Index],\r
+                    &gEfiLoadedImageProtocolGuid,\r
+                    (VOID **) &LoadedImage,\r
+                    NULL,\r
+                    NULL,\r
+                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      FakeNvData->DriSelection[Index] = 0x00;\r
+      continue;\r
+    }\r
+    mDriverImageProtocol[Index] = LoadedImage;\r
+    //\r
+    // Find its related driver binding protocol\r
+    //\r
+    DriverBindingHandle = GetDriverBindingHandleFromImageHandle (mDriverImageHandleBuffer[Index]);\r
+    if (DriverBindingHandle == NULL) {\r
+      FakeNvData->DriSelection[Index] = 0x00;\r
+      continue;\r
+    }\r
+\r
+    //\r
+    // Get the EFI Loaded Image Device Path Protocol\r
+    //\r
+    LoadedImageDevicePath = NULL;\r
+    Status = gBS->HandleProtocol (\r
+                        mDriverImageHandleBuffer[Index],\r
+                        &gEfiLoadedImageDevicePathProtocolGuid,\r
+                        (VOID **) &LoadedImageDevicePath\r
+                        );\r
+    if (LoadedImageDevicePath == NULL) {\r
+      FakeNvData->DriSelection[Index] = 0x00;\r
+      continue;\r
+    }\r
+\r
+    if (FakeNvData->PciDeviceFilter == 0x01) {\r
+      //\r
+      // only care the driver which is in a Pci device option rom,\r
+      // and the driver's LoadedImage->DeviceHandle must point to a pci device which has efi option rom\r
+      //\r
+      if (!EFI_ERROR (Status)) {\r
+        Status = gBS->HandleProtocol(\r
+                         LoadedImage->DeviceHandle,\r
+                         &gEfiBusSpecificDriverOverrideProtocolGuid,\r
+                         (VOID **) &BusSpecificDriverOverride\r
+                         );\r
+        if (EFI_ERROR (Status) || BusSpecificDriverOverride == NULL) {\r
+          FakeNvData->DriSelection[Index] = 0x00;\r
+          continue;\r
+        }\r
+      } else {\r
+        FakeNvData->DriSelection[Index] = 0x00;\r
+        continue;\r
+      }\r
+    }\r
+\r
+    //\r
+    // For driver name, try to get its component name, if fail, get its image name,\r
+    // if also fail, give a default name.\r
+    //\r
+    FreeDriverName = FALSE;\r
+    DriverName = GetComponentName (DriverBindingHandle);\r
+    if (DriverName == NULL) {\r
+      //\r
+      // get its image name\r
+      //\r
+      DriverName = GetImageName (LoadedImage);\r
+    }\r
+    if (DriverName == NULL) {\r
+      //\r
+      // give a default name\r
+      //\r
+      HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_DRIVER_DEFAULT_NAME), &DriverName);\r
+      ASSERT (DriverName != NULL);\r
+      FreeDriverName = TRUE;  // the DriverName string need to free pool\r
+    }\r
+\r
+\r
+    //\r
+    // Step2 Export the driver name string and create check box item in second page\r
+    //\r
+\r
+    //\r
+    // First create the driver image name\r
+    //\r
+    NewString = AllocateZeroPool (StrSize (DriverName));\r
+    ASSERT (NewString != NULL); \r
+    if (EFI_ERROR (CheckMapping (mControllerDevicePathProtocol[mSelectedCtrIndex], LoadedImageDevicePath, &mMappingDataBase, NULL, NULL))) {\r
+      FakeNvData->DriSelection[Index] = 0x00;\r
+    } else {\r
+      FakeNvData->DriSelection[Index] = 0x01;\r
+      mLastSavedDriverImageNum++;\r
+    }\r
+    StrCat (NewString, DriverName);\r
+    NewStringToken = mDriverImageToken[Index];\r
+    if (NewStringToken == 0) {\r
+      Status = HiiLibNewString (Private->RegisteredHandle, &NewStringToken, NewString);\r
+    } else {\r
+      Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);\r
+    }\r
+    mDriverImageToken[Index] = NewStringToken;\r
+    ASSERT_EFI_ERROR (Status);\r
+    FreePool (NewString);\r
+    if (FreeDriverName) {\r
+      FreePool (DriverName);\r
+    }\r
+\r
+    //\r
+    // Second create the driver image device path as item help string\r
+    //\r
+    DriverName = DevicePathToStr (LoadedImageDevicePath);\r
+\r
+    NewString = AllocateZeroPool (StrSize (DriverName));\r
+    ASSERT (NewString != NULL); \r
+    StrCat (NewString, DriverName);\r
+    NewStringHelpToken = mDriverImageFilePathToken[Index];\r
+    if (NewStringHelpToken == 0) {\r
+      Status = HiiLibNewString (Private->RegisteredHandle, &NewStringHelpToken, NewString);\r
+    } else {\r
+      Status = HiiLibSetString (Private->RegisteredHandle, NewStringHelpToken, NewString);\r
+    }\r
+    mDriverImageFilePathToken[Index] = NewStringHelpToken;\r
+    ASSERT_EFI_ERROR (Status);\r
+    FreePool (NewString);\r
+    FreePool (DriverName);\r
+\r
+    CreateCheckBoxOpCode (\r
+      (UINT16) (DRIVER_SELECTION_QUESTION_ID + Index),\r
+      VARSTORE_ID_PLAT_OVER_MNGR,\r
+      (UINT16) (DRIVER_SELECTION_VAR_OFFSET + Index),\r
+      NewStringToken,\r
+      NewStringHelpToken,\r
+      0,\r
+      0,\r
+      &UpdateData\r
+      );\r
+  }\r
+\r
+  //\r
+  // Update second page form\r
+  //\r
+  IfrLibUpdateForm (\r
+    Private->RegisteredHandle,\r
+    &mPlatformOverridesManagerGuid,\r
+    FORM_ID_DRIVER,\r
+    FORM_ID_DRIVER,\r
+    FALSE,\r
+    &UpdateData\r
+    );\r
+\r
+  FreePool (UpdateData.Data);\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Prepare to let user select the priority order of the drivers which are\r
+  selected in second page.\r
+\r
+  @param  Private        Pointer to EFI_CALLBACK_INFO.\r
+  @param  KeyValue       The callback key value of device controller item in first page.\r
+  @param  FakeNvData     Pointer to PLAT_OVER_MNGR_DATA.\r
+\r
+  @retval EFI_SUCCESS    Always returned.\r
+\r
+**/\r
+EFI_STATUS\r
+UpdatePrioritySelectPage (\r
+  IN EFI_CALLBACK_INFO                *Private,\r
+  IN UINT16                           KeyValue,\r
+  IN PLAT_OVER_MNGR_DATA              *FakeNvData\r
+  )\r
+{\r
+  EFI_HII_UPDATE_DATA                       UpdateData;\r
+  UINTN                                     Index;\r
+  EFI_DEVICE_PATH_PROTOCOL                  *LoadedImageDevicePath;\r
+  IFR_OPTION                                *IfrOptionList;\r
+  UINTN                                     SelectedDriverImageNum;\r
+  UINT32                                    DriverImageNO;\r
+  UINTN                                     MinNO;\r
+  UINTN                                     Index1;\r
+  UINTN                                     TempNO[100];\r
+\r
+  //\r
+  // Following code will be run if user select 'order ... priority' item in second page\r
+  // Prepare third page.  In third page, user will order the  drivers priority which are selected in second page\r
+  //\r
+  mCurrentPage = FORM_ID_ORDER;\r
+\r
+  UpdateData.BufferSize = UPDATE_DATA_SIZE;\r
+  UpdateData.Offset = 0;\r
+  UpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
+  ASSERT (UpdateData.Data != NULL);\r
+  //\r
+  // Clear third page form\r
+  //\r
+  IfrLibUpdateForm (\r
+    Private->RegisteredHandle,\r
+    &mPlatformOverridesManagerGuid,\r
+    FORM_ID_ORDER,\r
+    FORM_ID_ORDER,\r
+    FALSE,\r
+    &UpdateData\r
+    );\r
+\r
+  //\r
+  // Check how many drivers have been selected\r
+  //\r
+  SelectedDriverImageNum = 0;\r
+  for (Index = 0; Index < mDriverImageHandleCount; Index++) {\r
+    if (FakeNvData->DriSelection[Index] != 0) {\r
+      SelectedDriverImageNum ++;\r
+    }\r
+  }\r
+\r
+  mSelectedDriverImageNum = SelectedDriverImageNum;\r
+  if (SelectedDriverImageNum == 0) {\r
+    return EFI_SUCCESS;\r
+  }\r
+  \r
+  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * mSelectedDriverImageNum);\r
+  ASSERT (IfrOptionList != NULL);\r
+  //\r
+  // Create order list for those selected drivers\r
+  //\r
+  SelectedDriverImageNum = 0;\r
+  for (Index = 0; Index < mDriverImageHandleCount; Index++) {\r
+    if (FakeNvData->DriSelection[Index] != 0) {\r
+      IfrOptionList[SelectedDriverImageNum].StringToken = mDriverImageToken[Index];\r
+      //\r
+      // Use the NO. in driver binding buffer as value, will use it later\r
+      //\r
+      IfrOptionList[SelectedDriverImageNum].Value.u8 = (UINT8) (Index + 1);\r
+      IfrOptionList[SelectedDriverImageNum].Flags = 0;\r
+\r
+      //\r
+      // Get the EFI Loaded Image Device Path Protocol\r
+      //\r
+      LoadedImageDevicePath = NULL;\r
+      gBS->HandleProtocol (\r
+                 mDriverImageHandleBuffer[Index],\r
+                 &gEfiLoadedImageDevicePathProtocolGuid,\r
+                 (VOID **) &LoadedImageDevicePath\r
+                 );\r
+      ASSERT (LoadedImageDevicePath != NULL);\r
+\r
+      //\r
+      // Check the driver DriverImage's order number in mapping database\r
+      //\r
+      DriverImageNO = 0;\r
+      CheckMapping (\r
+              mControllerDevicePathProtocol[mSelectedCtrIndex],\r
+              LoadedImageDevicePath,\r
+              &mMappingDataBase,\r
+              NULL,\r
+              &DriverImageNO\r
+              );\r
+      if (DriverImageNO == 0) {\r
+        DriverImageNO = (UINT32) mLastSavedDriverImageNum + 1;\r
+        mLastSavedDriverImageNum++;\r
+      }\r
+      TempNO[SelectedDriverImageNum] = DriverImageNO;\r
+      SelectedDriverImageNum ++;\r
+    }\r
+  }\r
+\r
+  ASSERT (SelectedDriverImageNum == mSelectedDriverImageNum);\r
+  //\r
+  // NvRamMap Must be clear firstly\r
+  //\r
+  ZeroMem (FakeNvData->DriOrder, sizeof (FakeNvData->DriOrder));\r
+\r
+  //\r
+  // Order the selected drivers according to the info already in mapping database\r
+  // the less order number in mapping database the less order number in NvRamMap\r
+  //\r
+  for (Index=0; Index < SelectedDriverImageNum; Index++) {\r
+    //\r
+    // Find the minimal order number in TempNO array,  its index in TempNO is same as IfrOptionList array\r
+    //\r
+    MinNO = 0;\r
+    for (Index1=0; Index1 < SelectedDriverImageNum; Index1++) {\r
+      if (TempNO[Index1] < TempNO[MinNO]) {\r
+        MinNO = Index1;\r
+      }\r
+    }\r
+    //\r
+    // the IfrOptionList[MinNO].Value = the driver NO. in driver binding buffer\r
+    //\r
+    FakeNvData->DriOrder[Index] =IfrOptionList[MinNO].Value.u8;\r
+    TempNO[MinNO] = MAX_CHOICE_NUM + 1;\r
+  }\r
+\r
+  CreateOrderedListOpCode (\r
+    (UINT16) DRIVER_ORDER_QUESTION_ID,\r
+    VARSTORE_ID_PLAT_OVER_MNGR,\r
+    (UINT16) DRIVER_ORDER_VAR_OFFSET,\r
+    mControllerToken[mSelectedCtrIndex],\r
+    mControllerToken[mSelectedCtrIndex],\r
+    EFI_IFR_FLAG_RESET_REQUIRED,\r
+    0,\r
+    EFI_IFR_NUMERIC_SIZE_1,\r
+    (UINT8) MAX_CHOICE_NUM,\r
+    IfrOptionList,\r
+    SelectedDriverImageNum,\r
+    &UpdateData\r
+    );\r
+\r
+  //\r
+  // Update third page form\r
+  //\r
+  IfrLibUpdateForm (\r
+    Private->RegisteredHandle,\r
+    &mPlatformOverridesManagerGuid,\r
+    FORM_ID_ORDER,\r
+    FORM_ID_ORDER,\r
+    FALSE,\r
+    &UpdateData\r
+    );\r
+\r
+  FreePool (IfrOptionList);\r
+  FreePool (UpdateData.Data);\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Save the save the mapping database to NV variable.\r
+\r
+  @param  Private        Pointer to EFI_CALLBACK_INFO.\r
+  @param  KeyValue       The callback key value of device controller item in first page.\r
+  @param  FakeNvData     Pointer to PLAT_OVER_MNGR_DATA.\r
+\r
+  @retval EFI_SUCCESS    Always returned.\r
+\r
+**/\r
+EFI_STATUS\r
+CommintChanges (\r
+  IN EFI_CALLBACK_INFO                *Private,\r
+  IN UINT16                           KeyValue,\r
+  IN PLAT_OVER_MNGR_DATA              *FakeNvData\r
+  )\r
+{\r
+  EFI_STATUS                                Status;\r
+  UINTN                                     Index;\r
+  UINTN                                     SelectedDriverImageNum;\r
+  EFI_DEVICE_PATH_PROTOCOL                  *LoadedImageDevicePath;\r
+  //\r
+  //  Following code will be run if user select 'commint changes' in third page\r
+  //  user enter 'Commit Changes' to save the mapping database\r
+  //\r
+  DeleteDriverImage (mControllerDevicePathProtocol[mSelectedCtrIndex], NULL, &mMappingDataBase);\r
+  for (SelectedDriverImageNum = 0; SelectedDriverImageNum < mSelectedDriverImageNum; SelectedDriverImageNum++) {\r
+    //\r
+    // DriOrder[SelectedDriverImageNum] = the driver NO. in driver binding buffer\r
+    //\r
+    Index = FakeNvData->DriOrder[SelectedDriverImageNum] - 1;\r
+\r
+    //\r
+    // Get the EFI Loaded Image Device Path Protocol\r
+    //\r
+    LoadedImageDevicePath = NULL;\r
+    Status = gBS->HandleProtocol (\r
+                        mDriverImageHandleBuffer[Index],\r
+                        &gEfiLoadedImageDevicePathProtocolGuid,\r
+                        (VOID **) &LoadedImageDevicePath\r
+                        );\r
+    ASSERT (LoadedImageDevicePath != NULL);\r
+\r
+    InsertDriverImage (\r
+            mControllerDevicePathProtocol[mSelectedCtrIndex],\r
+            LoadedImageDevicePath,\r
+            &mMappingDataBase,\r
+            (UINT32)SelectedDriverImageNum + 1\r
+            );\r
+  }\r
+  Status = SaveOverridesMapping (&mMappingDataBase);\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  This function allows a caller to extract the current configuration for one\r
+  or more named elements from the target driver.\r
+\r
+  @param  This         Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param  Request      A null-terminated Unicode string in <ConfigRequest> format.\r
+  @param  Progress     On return, points to a character in the Request string.\r
+                       Points to the string's null terminator if request was successful.\r
+                       Points to the most recent '&' before the first failing name/value\r
+                       pair (or the beginning of the string if the failure is in the\r
+                       first name/value pair) if the request was not successful.\r
+  @param  Results      A null-terminated Unicode string in <ConfigAltResp> format which\r
+                       has all values filled in for the names in the Request string.\r
+                       String to be allocated by the called function.\r
+\r
+  @retval EFI_SUCCESS            The Results is filled with the requested values.\r
+  @retval EFI_OUT_OF_RESOURCES   Not enough memory to store the results.\r
+  @retval EFI_INVALID_PARAMETER  Request is NULL, illegal syntax, or unknown name.\r
+  @retval EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatOverMngrExtractConfig (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  CONST EFI_STRING                       Request,\r
+  OUT EFI_STRING                             *Progress,\r
+  OUT EFI_STRING                             *Results\r
+  )\r
+{\r
+  EFI_STATUS                       Status;\r
+  EFI_CALLBACK_INFO                *Private;\r
+  EFI_HII_CONFIG_ROUTING_PROTOCOL  *HiiConfigRouting;\r
+\r
+  if (Request == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  Private = EFI_CALLBACK_INFO_FROM_THIS (This);\r
+  HiiConfigRouting = Private->HiiConfigRouting;\r
+\r
+  //\r
+  // Convert buffer data to <ConfigResp> by helper function BlockToConfig()\r
+  //\r
+  Status = HiiConfigRouting->BlockToConfig (\r
+                                HiiConfigRouting,\r
+                                Request,\r
+                                (UINT8 *) &Private->FakeNvData,\r
+                                sizeof (PLAT_OVER_MNGR_DATA),\r
+                                Results,\r
+                                Progress\r
+                                );\r
+  return Status;\r
+}\r
+\r
+/**\r
+  This function processes the results of changes in configuration.\r
+\r
+  @param  This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param  Configuration   A null-terminated Unicode string in <ConfigRequest> format.\r
+  @param  Progress        A pointer to a string filled in with the offset of the most\r
+                          recent '&' before the first failing name/value pair (or the\r
+                          beginning of the string if the failure is in the first\r
+                          name/value pair) or the terminating NULL if all was successful.\r
+\r
+  @retval EFI_SUCCESS            The Results is processed successfully.\r
+  @retval EFI_INVALID_PARAMETER  Configuration is NULL.\r
+  @retval EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatOverMngrRouteConfig (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  CONST EFI_STRING                       Configuration,\r
+  OUT EFI_STRING                             *Progress\r
+  )\r
+{\r
+  EFI_CALLBACK_INFO                         *Private;\r
+  EFI_STATUS                                Status;\r
+  UINT16                                    KeyValue;\r
+  UINTN                                     BufferSize;\r
+  PLAT_OVER_MNGR_DATA                       *FakeNvData;\r
+\r
+  Private     = EFI_CALLBACK_INFO_FROM_THIS (This);\r
+\r
+  FakeNvData = &Private->FakeNvData;\r
+  BufferSize = sizeof (PLAT_OVER_MNGR_DATA);\r
+  Status = GetBrowserData (NULL, NULL, &BufferSize, (UINT8 *) FakeNvData);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  if (mCurrentPage == FORM_ID_DRIVER) {\r
+    KeyValue = KEY_VALUE_DRIVER_GOTO_ORDER;\r
+    UpdatePrioritySelectPage (Private, KeyValue, FakeNvData);\r
+    KeyValue = KEY_VALUE_ORDER_SAVE_AND_EXIT;\r
+    CommintChanges (Private, KeyValue, FakeNvData);\r
+    //\r
+    // Since UpdatePrioritySelectPage will change mCurrentPage,\r
+    // should ensure the mCurrentPage still indicate the second page here\r
+    //\r
+    mCurrentPage = FORM_ID_DRIVER;\r
+  }\r
+\r
+  if (mCurrentPage == FORM_ID_ORDER) {\r
+    KeyValue = KEY_VALUE_ORDER_SAVE_AND_EXIT;\r
+    CommintChanges (Private, KeyValue, FakeNvData);\r
+  }\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  This is the function that is called to provide results data to the driver.  This data\r
+  consists of a unique key which is used to identify what data is either being passed back\r
+  or being asked for.\r
+\r
+  @param  This           Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param  Action         A null-terminated Unicode string in <ConfigRequest> format.\r
+  @param  KeyValue       A unique Goto OpCode callback value which record user's selection.\r
+                         0x100 <= KeyValue <0x500 : user select a controller item in the first page;\r
+                         KeyValue == 0x1234       : user select 'Refresh' in first page, or user select 'Go to Previous Menu' in second page\r
+                         KeyValue == 0x1235       : user select 'Pci device filter' in first page\r
+                         KeyValue == 0x1500       : user select 'order ... priority' item in second page\r
+                         KeyValue == 0x1800       : user select 'commint changes' in third page\r
+                         KeyValue == 0x2000       : user select 'Go to Previous Menu' in third page\r
+  @param  Type           The type of value for the question.\r
+  @param  Value          A pointer to the data being sent to the original exporting driver.\r
+  @param  ActionRequest  On return, points to the action requested by the callback function.\r
+\r
+  @retval EFI_SUCCESS    Always returned.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatOverMngrCallback (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  EFI_BROWSER_ACTION                     Action,\r
+  IN  EFI_QUESTION_ID                        KeyValue,\r
+  IN  UINT8                                  Type,\r
+  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
+  )\r
+{\r
+  EFI_CALLBACK_INFO                         *Private;\r
+  EFI_STATUS                                Status;\r
+  EFI_STRING_ID                             NewStringToken;\r
+  UINTN                                     BufferSize;\r
+  PLAT_OVER_MNGR_DATA                       *FakeNvData;\r
+  EFI_INPUT_KEY                             Key;\r
+\r
+  Private = EFI_CALLBACK_INFO_FROM_THIS (This);\r
+\r
+  FakeNvData = &Private->FakeNvData;\r
+  BufferSize = sizeof (PLAT_OVER_MNGR_DATA);\r
+  Status = GetBrowserData (NULL, NULL, &BufferSize, (UINT8 *) FakeNvData);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  if (KeyValue == KEY_VALUE_DEVICE_REFRESH ||\r
+      KeyValue == KEY_VALUE_DEVICE_FILTER ||\r
+      KeyValue == KEY_VALUE_DRIVER_GOTO_PREVIOUS\r
+      ) {\r
+    UpdateDeviceSelectPage (Private, KeyValue, FakeNvData);\r
+    //\r
+    // Update page title string\r
+    //\r
+    NewStringToken = STRING_TOKEN (STR_TITLE);\r
+    Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"First, Select the controller by device path");\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
+  if (((KeyValue >= KEY_VALUE_DEVICE_OFFSET) && (KeyValue < KEY_VALUE_DEVICE_MAX)) || (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS)) {\r
+    if (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS) {\r
+      KeyValue = (EFI_QUESTION_ID) (mSelectedCtrIndex + KEY_VALUE_DEVICE_OFFSET);\r
+    }\r
+    UpdateBindingDriverSelectPage (Private, KeyValue, FakeNvData);\r
+    //\r
+    // Update page title string\r
+    //\r
+    NewStringToken = STRING_TOKEN (STR_TITLE);\r
+    Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"Second, Select drivers for the previous selected controller");\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
+  if (KeyValue == KEY_VALUE_DRIVER_GOTO_ORDER) {\r
+    UpdatePrioritySelectPage (Private, KeyValue, FakeNvData);\r
+    //\r
+    // Update page title string\r
+    //\r
+    NewStringToken = STRING_TOKEN (STR_TITLE);\r
+    Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"Finally, Set the priority order for the drivers and save them");\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
+  if (KeyValue == KEY_VALUE_ORDER_SAVE_AND_EXIT) {\r
+    Status = CommintChanges (Private, KeyValue, FakeNvData);\r
+    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
+    if (EFI_ERROR (Status)) {\r
+      IfrLibCreatePopUp (1, &Key, L"Single Override Info too large, Saving Error!");\r
+      return EFI_DEVICE_ERROR;\r
+    }\r
+  }\r
+\r
+  if (KeyValue == KEY_VALUE_DEVICE_CLEAR) {\r
+    //\r
+    // Deletes all environment variable(s) that contain the override mappings info\r
+    //\r
+    FreeMappingDatabase (&mMappingDataBase);\r
+    Status = SaveOverridesMapping (&mMappingDataBase);\r
+    UpdateDeviceSelectPage (Private, KeyValue, FakeNvData);\r
+  }\r
+  //\r
+  // Pass changed uncommitted data back to Form Browser\r
+  //\r
+  BufferSize = sizeof (PLAT_OVER_MNGR_DATA);\r
+  Status = SetBrowserData (NULL, NULL, BufferSize, (UINT8 *) FakeNvData, NULL);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  The driver Entry Point. The funciton will export a disk device class formset and\r
+  its callback function to hii database.\r
+\r
+  @param  ImageHandle    The firmware allocated handle for the EFI image.\r
+  @param  SystemTable    A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS    The entry point is executed successfully.\r
+  @retval other          Some error occurs when executing this entry point.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatOverMngrInit (\r
+  IN EFI_HANDLE                   ImageHandle,\r
+  IN EFI_SYSTEM_TABLE             *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_HII_DATABASE_PROTOCOL   *HiiDatabase;\r
+  EFI_HII_PACKAGE_LIST_HEADER *PackageList;\r
+  EFI_CALLBACK_INFO           *CallbackInfo;\r
+  EFI_HANDLE                  DriverHandle;\r
+  EFI_FORM_BROWSER2_PROTOCOL       *FormBrowser2;\r
+  \r
+  //\r
+  // There should only be one HII protocol\r
+  //\r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiHiiDatabaseProtocolGuid,\r
+                  NULL,\r
+                  (VOID **) &HiiDatabase\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // There should only be one Form Configuration protocol\r
+  //\r
+  Status = gBS->LocateProtocol (\r
+                 &gEfiFormBrowser2ProtocolGuid,\r
+                 NULL,\r
+                 (VOID **) &FormBrowser2\r
+                 );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  CallbackInfo = AllocateZeroPool (sizeof (EFI_CALLBACK_INFO));\r
+  if (CallbackInfo == NULL) {\r
+    return EFI_BAD_BUFFER_SIZE;\r
+  }\r
+\r
+  CallbackInfo->Signature = EFI_CALLBACK_INFO_SIGNATURE;\r
+  CallbackInfo->ConfigAccess.ExtractConfig = PlatOverMngrExtractConfig;\r
+  CallbackInfo->ConfigAccess.RouteConfig   = PlatOverMngrRouteConfig;\r
+  CallbackInfo->ConfigAccess.Callback      = PlatOverMngrCallback;\r
+\r
+  //\r
+  // Create driver handle used by HII database\r
+  //\r
+  Status = HiiLibCreateHiiDriverHandle (&DriverHandle);\r
+  if (EFI_ERROR (Status)) {\r
+    goto Finish;\r
+  }\r
+  CallbackInfo->DriverHandle = DriverHandle;\r
+\r
+  //\r
+  // Install Config Access protocol to driver handle\r
+  //\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &DriverHandle,\r
+                  &gEfiHiiConfigAccessProtocolGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  &CallbackInfo->ConfigAccess\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    goto Finish;\r
+  }\r
+\r
+  //\r
+  // Publish our HII data\r
+  //\r
+  PackageList = HiiLibPreparePackageList (\r
+                  2,\r
+                  &mPlatformOverridesManagerGuid,\r
+                  VfrBin,\r
+                  PlatOverMngrStrings\r
+                  );\r
+  ASSERT (PackageList != NULL);\r
+\r
+  Status = HiiDatabase->NewPackageList (\r
+                           HiiDatabase,\r
+                           PackageList,\r
+                           DriverHandle,\r
+                           &CallbackInfo->RegisteredHandle\r
+                           );\r
+  FreePool (PackageList);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    goto Finish;\r
+  }\r
+\r
+  //\r
+  // Locate ConfigRouting protocol\r
+  //\r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiHiiConfigRoutingProtocolGuid,\r
+                  NULL,\r
+                  (VOID **) &CallbackInfo->HiiConfigRouting\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    goto Finish;\r
+  }\r
+\r
+  //\r
+  // Clear all the globle variable\r
+  //\r
+  mDriverImageHandleCount = 0;\r
+  mCurrentPage = 0;\r
+  ZeroMem (mDriverImageToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));\r
+  ZeroMem (mDriverImageFilePathToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));\r
+  ZeroMem (mControllerToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));\r
+  ZeroMem (mDriverImageProtocol, MAX_CHOICE_NUM * sizeof (EFI_LOADED_IMAGE_PROTOCOL *));\r
+\r
+  //\r
+  // Show the page\r
+  //\r
+  Status = FormBrowser2->SendForm (\r
+                           FormBrowser2,\r
+                           &CallbackInfo->RegisteredHandle,\r
+                           1,\r
+                           NULL,\r
+                           0,\r
+                           NULL,\r
+                           NULL\r
+                           );\r
+  if (EFI_ERROR (Status)) {\r
+    goto Finish;\r
+  }\r
+\r
+  Status = HiiDatabase->RemovePackageList (HiiDatabase, CallbackInfo->RegisteredHandle);\r
+  if (EFI_ERROR (Status)) {\r
+    goto Finish;\r
+  }\r
+  \r
+  return EFI_SUCCESS;\r
+\r
+Finish:\r
+  if (CallbackInfo->DriverHandle != NULL) {\r
+    HiiLibDestroyHiiDriverHandle (CallbackInfo->DriverHandle);\r
+  }\r
+  if (CallbackInfo != NULL) {\r
+    FreePool (CallbackInfo);\r
+  }\r
+\r
+  return Status;\r
+}\r
diff --git a/MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.h b/MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.h
new file mode 100644 (file)
index 0000000..12bbf6a
--- /dev/null
@@ -0,0 +1,71 @@
+/** @file\r
+  \r
+  The defintions are required both by Source code and Vfr file.\r
+  The PLAT_OVER_MNGR_DATA structure, form guid and Ifr question ID are defined. \r
+\r
+Copyright (c) 2007 - 2008, 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
+\r
+**/\r
+\r
+#ifndef _PLAT_OVER_MNGR_H_\r
+#define _PLAT_OVER_MNGR_H_\r
+\r
+#define PLAT_OVER_MNGR_GUID \\r
+  { \\r
+    0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \\r
+  }\r
+\r
+//\r
+// The max number of the supported driver list.\r
+//\r
+#define MAX_CHOICE_NUM    0x00ff\r
+#define UPDATE_DATA_SIZE  0x1000\r
+\r
+#define FORM_ID_DEVICE                 0x1100\r
+#define FORM_ID_DRIVER                 0x1200\r
+#define FORM_ID_ORDER                  0x1500\r
+\r
+#define KEY_VALUE_DEVICE_OFFSET        0x0100\r
+#define KEY_VALUE_DEVICE_MAX           (KEY_VALUE_DEVICE_OFFSET + MAX_CHOICE_NUM)\r
+\r
+#define KEY_VALUE_DEVICE_REFRESH       0x1234\r
+#define KEY_VALUE_DEVICE_FILTER        0x1235\r
+#define KEY_VALUE_DEVICE_CLEAR         0x1236\r
+\r
+#define KEY_VALUE_DRIVER_GOTO_PREVIOUS 0x1300\r
+#define KEY_VALUE_DRIVER_GOTO_ORDER    0x1301\r
+\r
+#define KEY_VALUE_ORDER_GOTO_PREVIOUS  0x2000\r
+#define KEY_VALUE_ORDER_SAVE_AND_EXIT  0x1800\r
+\r
+#define VARSTORE_ID_PLAT_OVER_MNGR     0x1000\r
+\r
+typedef struct {\r
+  UINT8   DriSelection[MAX_CHOICE_NUM];\r
+  UINT8   DriOrder[MAX_CHOICE_NUM];\r
+  UINT8   PciDeviceFilter;\r
+} PLAT_OVER_MNGR_DATA;\r
+\r
+//\r
+// Field offset of structure PLAT_OVER_MNGR_DATA\r
+//\r
+#define VAR_OFFSET(Field)              ((UINTN) &(((PLAT_OVER_MNGR_DATA *) 0)->Field))\r
+#define DRIVER_SELECTION_VAR_OFFSET     (VAR_OFFSET (DriSelection))\r
+#define DRIVER_ORDER_VAR_OFFSET         (VAR_OFFSET (DriOrder))\r
+\r
+//\r
+// Tool automatic generated Question Id start from 1\r
+// In order to avoid to conflict them, the Driver Selection and Order QuestionID offset is defined from 0x0500.\r
+//\r
+#define QUESTION_ID_OFFSET              0x0500\r
+#define DRIVER_SELECTION_QUESTION_ID    (VAR_OFFSET (DriSelection) + QUESTION_ID_OFFSET)\r
+#define DRIVER_ORDER_QUESTION_ID        (VAR_OFFSET (DriOrder) + QUESTION_ID_OFFSET)\r
+\r
+#endif\r
diff --git a/MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.inf b/MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.inf
new file mode 100644 (file)
index 0000000..e8e3487
--- /dev/null
@@ -0,0 +1,88 @@
+#/** @file\r
+#\r
+#  A UI application to offer a UI interface in device manager to let user configue\r
+#  platform override protocol to override the default algorithm for matching\r
+#  drivers to controllers.\r
+#\r
+#  The main flow:\r
+#  1. The UI application dynamicly locate all controller device path.\r
+#  2. The UI application dynamicly locate all drivers which support binding protocol.\r
+#  3. The UI application export and dynamicly update two menu to let user select the\r
+#     mapping between drivers to controllers.\r
+#  4. The UI application save all the mapping info in NV variables for the following boot, \r
+#     which will be consumed by platform override protocol driver to publish the platform override protocol.\r
+#\r
+# Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.\r
+#\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
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = PlatOverMngr\r
+  FILE_GUID                      = 56D95BFE-F991-4898-B3BE-B8F37C927F48\r
+  MODULE_TYPE                    = UEFI_APPLICATION\r
+  VERSION_STRING                 = 1.0\r
+  ENTRY_POINT                    = PlatOverMngrInit\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+  VfrStrings.uni\r
+  Vfr.vfr\r
+  PlatOverMngr.c\r
+  PlatOverMngr.h\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+  BaseLib\r
+  DebugLib\r
+  UefiLib\r
+  UefiApplicationEntryPoint\r
+  UefiBootServicesTableLib\r
+  PlatformDriverOverrideLib\r
+  HiiLib\r
+  IfrSupportLib\r
+  ExtendedHiiLib\r
+  ExtendedIfrSupportLib\r
+  BaseMemoryLib\r
+  MemoryAllocationLib\r
+  UefiRuntimeServicesTableLib\r
+  DevicePathLib\r
+  GenericBdsLib\r
+  \r
+[Guids]\r
+  gEfiGlobalVariableGuid                        ## CONSUMED ## Variable:L"PlatformLang" this variable specifies the platform supported language string (RFC 3066 format)\r
+\r
+[Protocols]\r
+  gEfiComponentName2ProtocolGuid                ## SOMETIMES_CONSUMED (Get Driver Name if ComponentName2Protocol exists)\r
+  gEfiComponentNameProtocolGuid                 ## SOMETIMES_CONSUMED (Get Driver Name if ComponentNameProtocol exists and ComponentName2Protocol doesn't exist)\r
+  gEfiFirmwareVolume2ProtocolGuid               ## SOMETIMES_CONSUMED (Get Driver Name from EFI UI section if ComponentName2Protocol and ComponentNameProtocol don't exist)\r
+  gEfiPciIoProtocolGuid                         ## SOMETIMES_CONSUMED (Find the PCI device if PciIo protocol is installed)\r
+  gEfiBusSpecificDriverOverrideProtocolGuid     ## SOMETIMES_CONSUMED (Check whether the PCI device contains one or more efi drivers in its option rom by this protocol) \r
+\r
+  gEfiDriverBindingProtocolGuid                 ## SOMETIMES_CONSUMED\r
+  gEfiLoadedImageProtocolGuid                   ## SOMETIMES_CONSUMED\r
+  gEfiLoadedImageDevicePathProtocolGuid         ## SOMETIMES_CONSUMED (Show the drivers in the second page that support DriverBindingProtocol, LoadedImageProtocol and LoadedImageDevicePathProtocol)\r
+  gEfiDevicePathProtocolGuid                    ## SOMETIMES_CONSUMED (Show the controller device in the first page that support DevicePathProtocol)\r
+\r
+  gEfiHiiDatabaseProtocolGuid                   ## CONSUMED\r
+  gEfiFormBrowser2ProtocolGuid                  ## CONSUMED\r
+  gEfiHiiConfigRoutingProtocolGuid              ## CONSUMED\r
+  gEfiHiiConfigAccessProtocolGuid               ## PRODUCED\r
+  
\ No newline at end of file
diff --git a/MdeModulePkg/Application/PlatOverMngr/Vfr.vfr b/MdeModulePkg/Application/PlatOverMngr/Vfr.vfr
new file mode 100644 (file)
index 0000000..b3cd038
--- /dev/null
@@ -0,0 +1,110 @@
+// *++\r
+//\r
+// Copyright (c) 2007 - 2008, 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
+//\r
+// Module Name:\r
+//\r
+//   Vfr.vfr\r
+//\r
+// Abstract:\r
+//\r
+//   Platform driver Override manager formset\r
+//\r
+//\r
+// --*/\r
+\r
+#include "PlatOverMngr.h"\r
+\r
+#define EFI_DISK_DEVICE_CLASS          0x01\r
+#define LABEL_END                      0xffff\r
+\r
+formset\r
+  guid     = PLAT_OVER_MNGR_GUID,\r
+  title    = STRING_TOKEN(STR_ENTRY_TITLE),\r
+  help     = STRING_TOKEN(STR_TITLE_HELP),\r
+  class    = EFI_DISK_DEVICE_CLASS,\r
+  subclass = 0xff,\r
+\r
+  varstore PLAT_OVER_MNGR_DATA,\r
+    varid = VARSTORE_ID_PLAT_OVER_MNGR,\r
+    name  = Data,\r
+    guid  = PLAT_OVER_MNGR_GUID;\r
+\r
+  form formid = FORM_ID_DEVICE,\r
+       title = STRING_TOKEN(STR_TITLE);\r
+\r
+    text\r
+      help   = STRING_TOKEN(STR_FIRST_REFRESH_HELP),\r
+      text   = STRING_TOKEN(STR_FIRST_REFRESH),\r
+      text   = STRING_TOKEN(STR_NULL_STRING),\r
+      flags  = INTERACTIVE,\r
+      key    = KEY_VALUE_DEVICE_REFRESH;\r
+\r
+    checkbox varid = Data.PciDeviceFilter,\r
+      prompt   = STRING_TOKEN(STR_PCI_DEVICE_FILTER_PROMPT),\r
+      help     = STRING_TOKEN(STR_PCI_DEVICE_FILTER_HELP),\r
+      flags    = INTERACTIVE,\r
+      key      = KEY_VALUE_DEVICE_FILTER,\r
+    endcheckbox;\r
+\r
+    label FORM_ID_DEVICE;\r
+    label LABEL_END;\r
+\r
+    subtitle text = STRING_TOKEN(STR_NULL_STRING);\r
+\r
+    goto FORM_ID_DEVICE,\r
+      prompt  = STRING_TOKEN(STR_CLEAR_ALL),\r
+      help    = STRING_TOKEN(STR_CLEAR_ALL_HELP),\r
+      flags   = INTERACTIVE | RESET_REQUIRED,\r
+      key     = KEY_VALUE_DEVICE_CLEAR;\r
+  endform;\r
+\r
+  form formid = FORM_ID_DRIVER,\r
+       title = STRING_TOKEN(STR_TITLE);\r
+\r
+    goto FORM_ID_DEVICE,\r
+      prompt  = STRING_TOKEN(STR_GOTO_PREVIOUS),\r
+      help    = STRING_TOKEN(STR_NULL_STRING),\r
+      flags   = INTERACTIVE,\r
+      key     = KEY_VALUE_DRIVER_GOTO_PREVIOUS;\r
+\r
+    goto FORM_ID_ORDER,\r
+      prompt  = STRING_TOKEN(STR_TITLE_ORDER),\r
+      help    = STRING_TOKEN(STR_TITLE_ORDER_HELP),\r
+      flags   = INTERACTIVE,\r
+      key     = KEY_VALUE_DRIVER_GOTO_ORDER;\r
+\r
+    label FORM_ID_DRIVER;\r
+    label LABEL_END;\r
+\r
+  endform;\r
+\r
+  form formid = FORM_ID_ORDER,\r
+       title = STRING_TOKEN(STR_TITLE);\r
+\r
+    goto FORM_ID_DRIVER,\r
+      prompt  = STRING_TOKEN(STR_GOTO_PREVIOUS),\r
+      help    = STRING_TOKEN(STR_NULL_STRING),\r
+      flags   = INTERACTIVE,\r
+      key     = KEY_VALUE_ORDER_GOTO_PREVIOUS;\r
+\r
+    label FORM_ID_ORDER;\r
+    label LABEL_END;\r
+\r
+    subtitle text = STRING_TOKEN(STR_NULL_STRING);\r
+\r
+    goto FORM_ID_ORDER,\r
+      prompt  = STRING_TOKEN(STR_SAVE_AND_EXIT),\r
+      help    = STRING_TOKEN(STR_NULL_STRING),\r
+      flags   = INTERACTIVE | RESET_REQUIRED,\r
+      key     = KEY_VALUE_ORDER_SAVE_AND_EXIT;\r
+  endform;\r
+\r
+endformset;\r
diff --git a/MdeModulePkg/Application/PlatOverMngr/VfrStrings.uni b/MdeModulePkg/Application/PlatOverMngr/VfrStrings.uni
new file mode 100644 (file)
index 0000000..fe14d30
Binary files /dev/null and b/MdeModulePkg/Application/PlatOverMngr/VfrStrings.uni differ
index 4f40074ae59d8af8ee8c0fffaeddfb3ce4393f8c..a4fbcfd1a37d09fc4c1d0b7e74c004f30a874365 100644 (file)
@@ -1,5 +1,6 @@
 /** @file\r
-  This library provides IpIo layer upon EFI IP4 Protocol.\r
+  Ihis library is only intended to be used by UEFI network stack modules.\r
+  It provides IpIo layer upon EFI IP4 Protocol.\r
 \r
 Copyright (c) 2005 - 2008, Intel Corporation.<BR>\r
 All rights reserved. This program and the accompanying materials\r
index 7a33546870377e14d63f0d64d0d2e4e880337fbc..5045e8dcb093a571a96686548f40381a3678eb7e 100644 (file)
@@ -1,5 +1,6 @@
 /** @file\r
-  This library provides basic function for UEFI network stack.\r
+  Ihis library is only intended to be used by UEFI network stack modules.\r
+  It provides basic function for UEFI network stack.\r
 \r
 Copyright (c) 2005 - 2008, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
diff --git a/MdeModulePkg/Include/Library/PlatDriOverLib.h b/MdeModulePkg/Include/Library/PlatDriOverLib.h
deleted file mode 100644 (file)
index ee42f8b..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/** @file\r
-\r
-  This library provides basic platform driver override functions.\r
-\r
-Copyright (c) 2007 - 2008, 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
-\r
-**/\r
-\r
-#ifndef _PLAT_DRI_OVER_LIB_H_\r
-#define _PLAT_DRI_OVER_LIB_H_\r
-\r
-#include <Protocol/DevicePath.h>\r
-\r
-/**\r
-  Free all the mapping database memory resource and initialize the mapping list entry.\r
-\r
-  @param  MappingDataBase          Mapping database list entry pointer\r
-\r
-  @retval EFI_INVALID_PARAMETER    mapping database list entry is NULL\r
-  @retval EFI_SUCCESS              Free success\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FreeMappingDatabase (\r
-  IN  OUT  LIST_ENTRY            *MappingDataBase\r
-  )\r
-;
-\r
-/**\r
-  Read the NV environment variable(s) that contain the override mappings from Controller Device Path to\r
-  a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.\r
-\r
-  @param  MappingDataBase          Mapping database list entry pointer\r
-\r
-  @retval EFI_INVALID_PARAMETER    MappingDataBase pointer is null\r
-  @retval EFI_NOT_FOUND            Cannot find the 'PlatDriOver' NV variable\r
-  @retval EFI_VOLUME_CORRUPTED     The found NV variable is corrupted\r
-  @retval EFI_SUCCESS              Create the mapping database in memory successfully\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitOverridesMapping (\r
-  OUT  LIST_ENTRY            *MappingDataBase\r
-  )\r
-;
-\r
-/**\r
-  Save the memory mapping database into NV environment variable(s).\r
-  If MappingDataBase list is empty, then delete all platform override NV variables.\r
-\r
-  @param  MappingDataBase          Mapping database list entry pointer\r
-\r
-  @retval EFI_INVALID_PARAMETER    MappingDataBase pointer is null\r
-  @retval EFI_SUCCESS              Save memory mapping database successfully\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SaveOverridesMapping (\r
-  IN  LIST_ENTRY              *MappingDataBase\r
-  )\r
-;
-\r
-/**\r
-  Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.\r
-\r
-  @param  ControllerHandle         The device handle of the controller to check if\r
-                                   a driver override exists.\r
-  @param  DriverImageHandle        On output, a pointer to the next driver handle.\r
-                                   Passing in a pointer to NULL, will return the\r
-                                   first driver handle for ControllerHandle.\r
-  @param  MappingDataBase          MappingDataBase - Mapping database list entry\r
-                                   pointer\r
-  @param  CallerImageHandle        The caller driver's image handle, for\r
-                                   UpdateFvFileDevicePath use.\r
-\r
-  @retval EFI_INVALID_PARAMETER    The handle specified by ControllerHandle is not\r
-                                   a valid handle.  Or DriverImagePath is not a\r
-                                   device path that was returned on a previous call\r
-                                   to GetDriverPath().\r
-  @retval EFI_NOT_FOUND            A driver override for ControllerHandle was not\r
-                                   found.\r
-  @retval EFI_UNSUPPORTED          The operation is not supported.\r
-  @retval EFI_SUCCESS              The driver override for ControllerHandle was\r
-                                   returned in DriverImagePath.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-GetDriverFromMapping (\r
-  IN     EFI_HANDLE                                     ControllerHandle,\r
-  IN OUT EFI_HANDLE                                     *DriverImageHandle,\r
-  IN     LIST_ENTRY                                     *MappingDataBase,\r
-  IN     EFI_HANDLE                                     CallerImageHandle\r
-  )\r
-;
-\r
-/**\r
-  Check mapping database whether already has the mapping info which\r
-  records the input Controller to input DriverImage.\r
-\r
-  @param  ControllerDevicePath     The controller device path is to be check.\r
-  @param  DriverImageDevicePath    The driver image device path is to be check.\r
-  @param  MappingDataBase          Mapping database list entry pointer\r
-  @param  DriverInfoNum            the controller's total override driver number\r
-  @param  DriverImageNO            The driver order number for the input DriverImage.\r
-                                   If the DriverImageDevicePath is NULL, DriverImageNO is not set.\r
-\r
-  @retval EFI_INVALID_PARAMETER    ControllerDevicePath or MappingDataBase is NULL.\r
-  @retval EFI_NOT_FOUND            ControllerDevicePath is not found in MappingDataBase or\r
-                                   DriverImageDevicePath is not found in the found DriverImage Info list. \r
-  @retval EFI_SUCCESS              The controller's total override driver number and \r
-                                   input DriverImage's order number is correctly return.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CheckMapping (\r
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath  OPTIONAL,\r
-  IN     LIST_ENTRY                                     *MappingDataBase,\r
-  OUT    UINT32                                         *DriverInfoNum  OPTIONAL,\r
-  OUT    UINT32                                         *DriverImageNO  OPTIONAL\r
-  )\r
-;
-\r
-/**\r
-  Insert a driver image as a controller's override driver into the mapping database.\r
-  The driver image's order number is indicated by DriverImageNO.\r
-\r
-  @param  ControllerDevicePath     The controller device path need to add a\r
-                                   override driver image item\r
-  @param  DriverImageDevicePath    The driver image device path need to be insert\r
-  @param  MappingDataBase          Mapping database list entry pointer\r
-  @param  DriverImageNO            The inserted order number. If this number is taken, \r
-                                   the larger available number will be used.\r
-\r
-  @retval EFI_INVALID_PARAMETER    ControllerDevicePath is NULL, or DriverImageDevicePath is NULL\r
-                                   or MappingDataBase is NULL\r
-  @retval EFI_ALREADY_STARTED      The input Controller to input DriverImage has been \r
-                                   recorded into the mapping database.\r
-  @retval EFI_SUCCESS              The Controller and DriverImage are inserted into \r
-                                   the mapping database successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InsertDriverImage (\r
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,\r
-  IN     LIST_ENTRY                                     *MappingDataBase,\r
-  IN     UINT32                                         DriverImageNO\r
-  )\r
-;
-\r
-/**\r
-  Delete a controller's override driver from the mapping database.\r
-\r
-  @param  ControllerDevicePath     The controller device path will be deleted \r
-                                   when all drivers images on it are removed.\r
-  @param  DriverImageDevicePath    The driver image device path will be delete.\r
-                                   If NULL, all driver image will be delete.\r
-  @param  MappingDataBase          Mapping database list entry pointer\r
-\r
-  @retval EFI_INVALID_PARAMETER    ControllerDevicePath is NULL, or MappingDataBase is NULL\r
-  @retval EFI_NOT_FOUND            ControllerDevicePath is not found in MappingDataBase or\r
-                                   DriverImageDevicePath is not found in the found DriverImage Info list. \r
-  @retval EFI_SUCCESS              Delete the specified driver successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DeleteDriverImage (\r
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
-  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,\r
-  IN     LIST_ENTRY                                     *MappingDataBase\r
-  )\r
-;
-\r
-#endif\r
diff --git a/MdeModulePkg/Include/Library/PlatformDriverOverrideLib.h b/MdeModulePkg/Include/Library/PlatformDriverOverrideLib.h
new file mode 100644 (file)
index 0000000..2af25d5
--- /dev/null
@@ -0,0 +1,188 @@
+/** @file\r
+  Ihis library is only intended to be used by Platform Driver Override Dxe Driver and Application.\r
+  It provides basic platform driver override functions.\r
+\r
+Copyright (c) 2007 - 2009, 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
+\r
+**/\r
+\r
+#ifndef _PLATFORM_DRIVER_OVERRIDE_LIB_H_\r
+#define _PLATFORM_DRIVER_OVERRIDE_LIB_H_\r
+\r
+#include <Protocol/DevicePath.h>\r
+\r
+/**\r
+  Free all the mapping database memory resource and initialize the mapping list entry.\r
+\r
+  @param  MappingDataBase          Mapping database list entry pointer\r
+\r
+  @retval EFI_INVALID_PARAMETER    mapping database list entry is NULL\r
+  @retval EFI_SUCCESS              Free success\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FreeMappingDatabase (\r
+  IN  OUT  LIST_ENTRY            *MappingDataBase\r
+  )\r
+;
+\r
+/**\r
+  Read the NV environment variable(s) that contain the override mappings from Controller Device Path to\r
+  a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.\r
+\r
+  @param  MappingDataBase          Mapping database list entry pointer\r
+\r
+  @retval EFI_INVALID_PARAMETER    MappingDataBase pointer is null\r
+  @retval EFI_NOT_FOUND            Cannot find the 'PlatDriOver' NV variable\r
+  @retval EFI_VOLUME_CORRUPTED     The found NV variable is corrupted\r
+  @retval EFI_SUCCESS              Create the mapping database in memory successfully\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitOverridesMapping (\r
+  OUT  LIST_ENTRY            *MappingDataBase\r
+  )\r
+;
+\r
+/**\r
+  Save the memory mapping database into NV environment variable(s).\r
+  If MappingDataBase list is empty, then delete all platform override NV variables.\r
+\r
+  @param  MappingDataBase          Mapping database list entry pointer\r
+\r
+  @retval EFI_INVALID_PARAMETER    MappingDataBase pointer is null\r
+  @retval EFI_SUCCESS              Save memory mapping database successfully\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SaveOverridesMapping (\r
+  IN  LIST_ENTRY              *MappingDataBase\r
+  )\r
+;
+\r
+/**\r
+  Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.\r
+\r
+  @param  ControllerHandle         The device handle of the controller to check if\r
+                                   a driver override exists.\r
+  @param  DriverImageHandle        On output, a pointer to the next driver handle.\r
+                                   Passing in a pointer to NULL, will return the\r
+                                   first driver handle for ControllerHandle.\r
+  @param  MappingDataBase          MappingDataBase - Mapping database list entry\r
+                                   pointer\r
+  @param  CallerImageHandle        The caller driver's image handle, for\r
+                                   UpdateFvFileDevicePath use.\r
+\r
+  @retval EFI_INVALID_PARAMETER    The handle specified by ControllerHandle is not\r
+                                   a valid handle.  Or DriverImagePath is not a\r
+                                   device path that was returned on a previous call\r
+                                   to GetDriverPath().\r
+  @retval EFI_NOT_FOUND            A driver override for ControllerHandle was not\r
+                                   found.\r
+  @retval EFI_UNSUPPORTED          The operation is not supported.\r
+  @retval EFI_SUCCESS              The driver override for ControllerHandle was\r
+                                   returned in DriverImagePath.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetDriverFromMapping (\r
+  IN     EFI_HANDLE                                     ControllerHandle,\r
+  IN OUT EFI_HANDLE                                     *DriverImageHandle,\r
+  IN     LIST_ENTRY                                     *MappingDataBase,\r
+  IN     EFI_HANDLE                                     CallerImageHandle\r
+  )\r
+;
+\r
+/**\r
+  Check mapping database whether already has the mapping info which\r
+  records the input Controller to input DriverImage.\r
+\r
+  @param  ControllerDevicePath     The controller device path is to be check.\r
+  @param  DriverImageDevicePath    The driver image device path is to be check.\r
+  @param  MappingDataBase          Mapping database list entry pointer\r
+  @param  DriverInfoNum            the controller's total override driver number\r
+  @param  DriverImageNO            The driver order number for the input DriverImage.\r
+                                   If the DriverImageDevicePath is NULL, DriverImageNO is not set.\r
+\r
+  @retval EFI_INVALID_PARAMETER    ControllerDevicePath or MappingDataBase is NULL.\r
+  @retval EFI_NOT_FOUND            ControllerDevicePath is not found in MappingDataBase or\r
+                                   DriverImageDevicePath is not found in the found DriverImage Info list. \r
+  @retval EFI_SUCCESS              The controller's total override driver number and \r
+                                   input DriverImage's order number is correctly return.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CheckMapping (\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath  OPTIONAL,\r
+  IN     LIST_ENTRY                                     *MappingDataBase,\r
+  OUT    UINT32                                         *DriverInfoNum  OPTIONAL,\r
+  OUT    UINT32                                         *DriverImageNO  OPTIONAL\r
+  )\r
+;
+\r
+/**\r
+  Insert a driver image as a controller's override driver into the mapping database.\r
+  The driver image's order number is indicated by DriverImageNO.\r
+\r
+  @param  ControllerDevicePath     The controller device path need to add a\r
+                                   override driver image item\r
+  @param  DriverImageDevicePath    The driver image device path need to be insert\r
+  @param  MappingDataBase          Mapping database list entry pointer\r
+  @param  DriverImageNO            The inserted order number. If this number is taken, \r
+                                   the larger available number will be used.\r
+\r
+  @retval EFI_INVALID_PARAMETER    ControllerDevicePath is NULL, or DriverImageDevicePath is NULL\r
+                                   or MappingDataBase is NULL\r
+  @retval EFI_ALREADY_STARTED      The input Controller to input DriverImage has been \r
+                                   recorded into the mapping database.\r
+  @retval EFI_SUCCESS              The Controller and DriverImage are inserted into \r
+                                   the mapping database successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InsertDriverImage (\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,\r
+  IN     LIST_ENTRY                                     *MappingDataBase,\r
+  IN     UINT32                                         DriverImageNO\r
+  )\r
+;
+\r
+/**\r
+  Delete a controller's override driver from the mapping database.\r
+\r
+  @param  ControllerDevicePath     The controller device path will be deleted \r
+                                   when all drivers images on it are removed.\r
+  @param  DriverImageDevicePath    The driver image device path will be delete.\r
+                                   If NULL, all driver image will be delete.\r
+  @param  MappingDataBase          Mapping database list entry pointer\r
+\r
+  @retval EFI_INVALID_PARAMETER    ControllerDevicePath is NULL, or MappingDataBase is NULL\r
+  @retval EFI_NOT_FOUND            ControllerDevicePath is not found in MappingDataBase or\r
+                                   DriverImageDevicePath is not found in the found DriverImage Info list. \r
+  @retval EFI_SUCCESS              Delete the specified driver successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DeleteDriverImage (\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *ControllerDevicePath,\r
+  IN     EFI_DEVICE_PATH_PROTOCOL                       *DriverImageDevicePath,\r
+  IN     LIST_ENTRY                                     *MappingDataBase\r
+  )\r
+;
+\r
+#endif\r
index f8ffa444edaa479712a344c38837b5cc1a20b764..820b8f2b1bd64e04d40583a7248c52229ef634cf 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
-  The helper routines to access UDP service. It is used by both\r
-  DHCP and MTFTP.\r
+  Ihis library is only intended to be used by UEFI network stack modules.\r
+  It provides the helper routines to access UDP service. It is used by both DHCP and MTFTP.\r
 \r
 Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -169,6 +169,26 @@ BOOLEAN
   IN VOID                   *Context\r
   );\r
 \r
+/**\r
+  Cancel all the sent datagram that pass the selection criteria of ToCancel.\r
+  If ToCancel is NULL, all the datagrams are cancelled.\r
+\r
+  @param[in]  UdpIo                 The UDP_IO_PORT to cancel packet.\r
+  @param[in]  IoStatus              The IoStatus to return to the packet owners.\r
+  @param[in]  ToCancel              The select funtion to test whether to cancel this\r
+                                    packet or not.\r
+  @param[in]  Context               The opaque parameter to the ToCancel.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+UdpIoCancelDgrams (\r
+  IN UDP_IO_PORT            *UdpIo,\r
+  IN EFI_STATUS             IoStatus,\r
+  IN UDP_IO_TO_CANCEL       ToCancel,        OPTIONAL\r
+  IN VOID                   *Context\r
+  );\r
+\r
 /**\r
   Create a UDP_IO_PORT to access the UDP service. It will create and configure\r
   a UDP child.\r
index 34d05bfc5ee4edd3b3f8765a1c4ba41a467dd74c..8514bc2bf0da91be2417dc76d887575817d4b5fa 100644 (file)
@@ -24,7 +24,7 @@
   FILE_GUID                      = 8bd8d711-2736-46d7-8c81-5de68e0a9e88\r
   MODULE_TYPE                    = DXE_DRIVER\r
   VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = PlatDriOverLib|DXE_DRIVER UEFI_DRIVER UEFI_APPLICATION\r
+  LIBRARY_CLASS                  = PlatformDriverOverrideLib|DXE_DRIVER UEFI_DRIVER UEFI_APPLICATION\r
 \r
 #\r
 # The following information is for reference only and not required by the build tools.\r
index 3d9fb2d724496c808460a08620d4bf554552b3b7..99b7dfcad23914c0e66dfe291eed0cbe541a7aba 100644 (file)
@@ -32,7 +32,7 @@
 #include <Library/DevicePathLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DxeServicesTableLib.h>\r
-#include <Library/PlatDriOverLib.h>\r
+#include <Library/PlatformDriverOverrideLib.h>\r
 \r
 #include <Guid/OverrideVariable.h>\r
 #include <VariableFormat.h>\r
index 151a67aff6a8721dc07f460141ef95e20bd20b41..3e95393221aa6c5e5b9a3ad3fc0d87296df3aa22 100644 (file)
@@ -482,6 +482,7 @@ FREE_MEM:
 \r
 **/\r
 VOID\r
+EFIAPI\r
 UdpIoCancelDgrams (\r
   IN UDP_IO_PORT            *UdpIo,\r
   IN EFI_STATUS             IoStatus,\r
index c8fde3abdccb1fbe09c313a09c8f09665a2b2344..33aecd3b43119ae0a933ce51d5b22815e8099b9e 100644 (file)
@@ -48,7 +48,7 @@
   RecoveryLib|Include/Library/RecoveryLib.h\r
   \r
   ##  @libraryclass  Basic platform driver override functions.\r
-  PlatDriOverLib|Include/Library/PlatDriOverLib.h\r
+  PlatformDriverOverrideLib|Include/Library/PlatformDriverOverrideLib.h\r
 \r
   ##  @libraryclass  Provides HII related functions.\r
   HiiLib|Include/Library/HiiLib.h\r
index c824ef35f21502e70e6bba50d14bbffca54265cd..7c69fa25e42548a092f4d48c1ac43155da9bc3d3 100644 (file)
@@ -76,7 +76,7 @@
   PlatformBdsLib|MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf\r
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
   PlatformBdsLib|MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf\r
-  PlatDriOverLib|MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf\r
+  PlatformDriverOverrideLib|MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf\r
   OemHookStatusCodeLib|IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf\r
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
   GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf\r
   MdeModulePkg/Universal/PCD/Dxe/Pcd.inf\r
   MdeModulePkg/Universal/PCD/Pei/Pcd.inf\r
   MdeModulePkg/Universal/PlatformDriverOverride/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf\r
-  MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.inf\r
+  MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.inf\r
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf\r
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf\r
   MdeModulePkg/Universal/Variable/Application/VariableInfo.inf\r
diff --git a/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.c b/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.c
deleted file mode 100644 (file)
index b7f790c..0000000
+++ /dev/null
@@ -1,1441 +0,0 @@
-/** @file\r
-\r
-  A UI application to offer a UI interface in device manager to let user configue\r
-  platform override protocol to override the default algorithm for matching\r
-  drivers to controllers.\r
-\r
-  The main flow:\r
-  1. The UI application dynamicly locate all controller device path.\r
-  2. The UI application dynamicly locate all drivers which support binding protocol.\r
-  3. The UI application export and dynamicly update two menu to let user select the\r
-     mapping between drivers to controllers.\r
-  4. The UI application save all the mapping info in NV variables which will be consumed\r
-     by platform override protocol driver to publish the platform override protocol.\r
-\r
-Copyright (c) 2007 - 2008, 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
-\r
-**/\r
-\r
-#include <PiDxe.h>\r
-\r
-#include <Protocol/HiiConfigAccess.h>\r
-#include <Protocol/HiiConfigRouting.h>\r
-#include <Protocol/HiiDatabase.h>\r
-#include <Protocol/FormBrowser2.h>\r
-#include <Protocol/LoadedImage.h>\r
-#include <Protocol/FirmwareVolume2.h>\r
-#include <Protocol/PciIo.h>\r
-#include <Protocol/BusSpecificDriverOverride.h>\r
-#include <Protocol/ComponentName2.h>\r
-#include <Protocol/ComponentName.h>\r
-#include <Protocol/DriverBinding.h>\r
-#include <Guid/GlobalVariable.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/UefiApplicationEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/PlatDriOverLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/IfrSupportLib.h>\r
-#include <Library/ExtendedHiiLib.h>\r
-#include <Library/ExtendedIfrSupportLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/GenericBdsLib.h>\r
-#include "PlatOverMngr.h"\r
-\r
-#define EFI_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('C', 'l', 'b', 'k')\r
-#define EFI_CALLBACK_INFO_FROM_THIS(a)  CR (a, EFI_CALLBACK_INFO, ConfigAccess, EFI_CALLBACK_INFO_SIGNATURE)\r
-\r
-typedef struct {\r
-  UINTN                           Signature;\r
-  EFI_HANDLE                      DriverHandle;\r
-  EFI_HII_HANDLE                  RegisteredHandle;\r
-  PLAT_OVER_MNGR_DATA             FakeNvData;\r
-  EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
-  EFI_HII_CONFIG_ACCESS_PROTOCOL  ConfigAccess;\r
-} EFI_CALLBACK_INFO;\r
-\r
-//\r
-// uni string and Vfr Binary data.\r
-//\r
-extern UINT8  VfrBin[];\r
-extern UINT8  PlatOverMngrStrings[];\r
-\r
-//\r
-// module global data\r
-//\r
-EFI_GUID                     mPlatformOverridesManagerGuid = PLAT_OVER_MNGR_GUID;\r
-LIST_ENTRY                   mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);\r
-\r
-EFI_HANDLE                   *mDevicePathHandleBuffer;\r
-EFI_HANDLE                   *mDriverImageHandleBuffer;\r
-\r
-INTN                         mSelectedCtrIndex;\r
-EFI_STRING_ID                mControllerToken[MAX_CHOICE_NUM];\r
-UINTN                        mDriverImageHandleCount;\r
-EFI_STRING_ID                mDriverImageToken[MAX_CHOICE_NUM];\r
-EFI_STRING_ID                mDriverImageFilePathToken[MAX_CHOICE_NUM];\r
-EFI_LOADED_IMAGE_PROTOCOL    *mDriverImageProtocol[MAX_CHOICE_NUM];\r
-EFI_DEVICE_PATH_PROTOCOL     *mControllerDevicePathProtocol[MAX_CHOICE_NUM];\r
-UINTN                        mSelectedDriverImageNum;\r
-UINTN                        mLastSavedDriverImageNum;\r
-CHAR8                        mLanguage[RFC_3066_ENTRY_SIZE];\r
-UINT16                       mCurrentPage;\r
-\r
-/**\r
-  Do string convertion for the ComponentName supported language. It do\r
-  the convertion just for english language code from RFC 3066 to ISO 639-2.\r
-  Then it will check whether the converted language is in the supported language list.\r
-  If not supported, NULL is returned.\r
-  If Language is not english, NULL is returned.\r
-\r
-  @param SupportedLanguages        Pointer to ComponentName supported language string list. ISO 639-2 language\r
-  @param Language                  The language string. RFC 3066 language\r
-\r
-  @return  English language string (ISO 639-2)\r
-  @return  NULL if the conertion is not successful.\r
-\r
-**/\r
-CHAR8 *\r
-ConvertComponentNameSupportLanguage (\r
-  IN CHAR8                           *SupportedLanguages,\r
-  IN CHAR8                           *Language\r
-  )\r
-{\r
-  CHAR8    *LangCode;\r
-  LangCode = NULL;\r
-\r
-  //\r
-  // Check the input language is English\r
-  //\r
-  if (AsciiStrnCmp (Language, "en-", 3) != 0) {\r
-    return NULL;\r
-  }\r
-  \r
-  //\r
-  // Check SupportedLanguages format\r
-  //\r
-  if (AsciiStrStr (SupportedLanguages, "en-") != NULL) {\r
-    //\r
-    // Create RFC 3066 language\r
-    //\r
-    LangCode = AllocateZeroPool(AsciiStrSize (Language));\r
-    AsciiStrCpy (LangCode, Language);\r
-  } else if (AsciiStrStr (SupportedLanguages, "en") != NULL) {\r
-    //\r
-    // Create ISO 639-2 Language\r
-    //\r
-    LangCode = AllocateZeroPool(4);\r
-    AsciiStrCpy (LangCode, "eng");    \r
-  }\r
-  \r
-  return LangCode;\r
-}\r
-\r
-/**\r
-  Get the driver name by ComponentName or ComponentName2 protocol \r
-  according to the driver binding handle\r
-\r
-  @param DriverBindingHandle  The Handle of DriverBinding.\r
-\r
-  @retval !NULL               Pointer into the image name if the image name is found,\r
-  @retval NULL                Pointer to NULL if the image name is not found.\r
-\r
-**/\r
-CHAR16 *\r
-GetComponentName (\r
-  IN EFI_HANDLE                      DriverBindingHandle\r
-  )\r
-{\r
-  EFI_STATUS                   Status;\r
-  EFI_COMPONENT_NAME_PROTOCOL  *ComponentName;\r
-  EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;\r
-  CHAR8                        *SupportedLanguage;\r
-  CHAR16                       *DriverName;\r
-\r
-  ComponentName  = NULL;\r
-  ComponentName2 = NULL;\r
-  Status = gBS->OpenProtocol (\r
-                 DriverBindingHandle,\r
-                 &gEfiComponentName2ProtocolGuid,\r
-                 (VOID **) &ComponentName2,\r
-                 NULL,\r
-                 NULL,\r
-                 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                 );\r
-  if (EFI_ERROR(Status)) {\r
-    Status = gBS->OpenProtocol (\r
-                   DriverBindingHandle,\r
-                   &gEfiComponentNameProtocolGuid,\r
-                   (VOID **) &ComponentName,\r
-                   NULL,\r
-                   NULL,\r
-                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                   );\r
-  }\r
-\r
-  Status     = EFI_SUCCESS;\r
-  DriverName = NULL;\r
-  if (ComponentName != NULL) {\r
-    if (ComponentName->GetDriverName != NULL) {\r
-      SupportedLanguage = ConvertComponentNameSupportLanguage (ComponentName->SupportedLanguages, mLanguage);\r
-      if (SupportedLanguage != NULL) {\r
-        Status = ComponentName->GetDriverName (\r
-                                  ComponentName,\r
-                                  SupportedLanguage,\r
-                                  &DriverName\r
-                                  );\r
-        FreePool (SupportedLanguage);\r
-      }\r
-    }\r
-  } else if (ComponentName2 != NULL) {\r
-    if (ComponentName2->GetDriverName != NULL) {\r
-      Status = ComponentName2->GetDriverName (\r
-                                 ComponentName2,\r
-                                 mLanguage,\r
-                                 &DriverName\r
-                                 );\r
-    }\r
-  }\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    return NULL;\r
-  }\r
-\r
-  return DriverName;\r
-}\r
-\r
-/**\r
-  Get the image name from EFI UI section.\r
-  Get FV protocol by its loaded image protoocl to abastract EFI UI section.\r
-\r
-  @param Image            Pointer to the loaded image protocol\r
-\r
-  @retval !NULL           Pointer to the image name if the image name is found,\r
-  @retval NULL            NULL if the image name is not found.\r
-\r
-**/\r
-CHAR16 *\r
-GetImageName (\r
-  IN EFI_LOADED_IMAGE_PROTOCOL *Image\r
-  )\r
-{\r
-  EFI_STATUS                        Status;\r
-  EFI_DEVICE_PATH_PROTOCOL          *DevPathNode;\r
-  EFI_DEVICE_PATH_PROTOCOL          *AlignedDevPathNode;\r
-  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;\r
-  VOID                              *Buffer;\r
-  UINTN                             BufferSize;\r
-  UINT32                            AuthenticationStatus;\r
-  EFI_GUID                          *NameGuid;\r
-  EFI_FIRMWARE_VOLUME2_PROTOCOL     *Fv2;\r
-\r
-  Fv2         = NULL;\r
-  Buffer      = NULL;\r
-  BufferSize  = 0;\r
-\r
-  if (Image->FilePath == NULL) {\r
-    return NULL;\r
-  }\r
-  DevPathNode  = Image->FilePath;\r
-\r
-  while (!IsDevicePathEnd (DevPathNode)) {\r
-    //\r
-    // Make sure device path node is aligned when accessing it's FV Name Guid field.\r
-    //\r
-    AlignedDevPathNode = AllocateCopyPool (DevicePathNodeLength(DevPathNode), DevPathNode);\r
-    \r
-    //\r
-    // Find the Fv File path\r
-    //\r
-    NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)AlignedDevPathNode);\r
-    if (NameGuid != NULL) {\r
-      FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) AlignedDevPathNode;\r
-      Status = gBS->HandleProtocol (\r
-                    Image->DeviceHandle,\r
-                    &gEfiFirmwareVolume2ProtocolGuid,\r
-                    (VOID **) &Fv2\r
-                    );\r
-      //\r
-      // Locate Image EFI UI section to get the image name.\r
-      //\r
-      if (!EFI_ERROR (Status)) {\r
-        Status = Fv2->ReadSection (\r
-                        Fv2,\r
-                        &FvFilePath->FvFileName,\r
-                        EFI_SECTION_USER_INTERFACE,\r
-                        0,\r
-                        &Buffer,\r
-                        &BufferSize,\r
-                        &AuthenticationStatus\r
-                        );\r
-        if (!EFI_ERROR (Status)) {\r
-          FreePool (AlignedDevPathNode);\r
-          break;\r
-        }\r
-        Buffer = NULL;\r
-      }\r
-    }\r
-    \r
-    FreePool (AlignedDevPathNode);\r
-    \r
-    //\r
-    // Next device path node\r
-    //\r
-    DevPathNode = NextDevicePathNode (DevPathNode);\r
-  }\r
-\r
-  return Buffer;\r
-}\r
-\r
-/**\r
-  Prepare the first page to let user select the device controller which need to\r
-  add mapping drivers if user select 'Refresh' in first page.\r
-  During first page, user will see all currnet controller device path in system,\r
-  select any device path will go to second page to select its overrides drivers.\r
-\r
-  @param  Private        Pointer to EFI_CALLBACK_INFO.\r
-  @param  KeyValue       The callback key value of device controller item in first page.\r
-  @param  FakeNvData     Pointer to PLAT_OVER_MNGR_DATA.\r
-\r
-  @retval EFI_SUCCESS    Always returned.\r
-\r
-**/\r
-EFI_STATUS\r
-UpdateDeviceSelectPage (\r
-  IN EFI_CALLBACK_INFO                *Private,\r
-  IN UINT16                           KeyValue,\r
-  IN PLAT_OVER_MNGR_DATA              *FakeNvData\r
-  )\r
-{\r
-  EFI_HII_UPDATE_DATA                       UpdateData;\r
-  EFI_STATUS                                Status;\r
-  UINTN                                     LangSize;\r
-  UINTN                                     Index;\r
-  UINTN                                     DevicePathHandleCount;\r
-  CHAR16                                    *NewString;\r
-  EFI_STRING_ID                             NewStringToken;\r
-  CHAR16                                    *ControllerName;\r
-  EFI_DEVICE_PATH_PROTOCOL                  *ControllerDevicePath;\r
-  EFI_PCI_IO_PROTOCOL                       *PciIo;\r
-  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;\r
-  UINTN                                     Len;\r
-  \r
-  //\r
-  // set current page form ID.\r
-  //\r
-  mCurrentPage = FORM_ID_DEVICE;  \r
-  \r
-  //\r
-  // Get Platform supported Language (RFC_3066 format)\r
-  //\r
-  LangSize = RFC_3066_ENTRY_SIZE;\r
-  Status = gRT->GetVariable (\r
-              L"PlatformLang",\r
-              &gEfiGlobalVariableGuid,\r
-              NULL,\r
-              &LangSize,\r
-              mLanguage\r
-              );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Initial the mapping database in memory\r
-  //\r
-  FreeMappingDatabase (&mMappingDataBase);\r
-  Status = InitOverridesMapping (&mMappingDataBase);\r
-\r
-  //\r
-  // Clear all the content in the first page\r
-  //\r
-  UpdateData.BufferSize = UPDATE_DATA_SIZE;\r
-  UpdateData.Offset = 0;\r
-  UpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
-  ASSERT (UpdateData.Data != NULL);\r
-  //\r
-  // Clear first page form\r
-  //\r
-  IfrLibUpdateForm (\r
-    Private->RegisteredHandle,\r
-    &mPlatformOverridesManagerGuid,\r
-    FORM_ID_DEVICE,\r
-    FORM_ID_DEVICE,\r
-    FALSE,\r
-    &UpdateData\r
-    );\r
-\r
-  //\r
-  // When user enter the page at first time, the 'first refresh' string is given to notify user to refresh all the drivers,\r
-  // then the 'first refresh' string will be replaced by the 'refresh' string, and the two strings content are same after the replacement\r
-  //\r
-  NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH);\r
-  HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH), &NewString);\r
-  ASSERT (NewString != NULL);\r
-  Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);\r
-  ASSERT_EFI_ERROR (Status);\r
-  FreePool (NewString);\r
-\r
-  NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH_HELP);\r
-  HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH_HELP), &NewString);\r
-  ASSERT (NewString != NULL);\r
-  Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);\r
-  ASSERT_EFI_ERROR (Status);\r
-  FreePool (NewString);\r
-\r
-  //\r
-  // created needed controller device item in first page\r
-  //\r
-  DevicePathHandleCount  = 0;\r
-  Status = gBS->LocateHandleBuffer (\r
-                  ByProtocol,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  NULL,\r
-                  &DevicePathHandleCount,\r
-                  &mDevicePathHandleBuffer\r
-                  );\r
-  if (EFI_ERROR (Status) || (DevicePathHandleCount == 0)) {\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  for (Index = 0; Index < DevicePathHandleCount; Index++) {\r
-    if (FakeNvData->PciDeviceFilter == 0x01) {\r
-      //\r
-      // Only care PCI device which contain efi driver in its option rom.\r
-      //\r
-\r
-      //\r
-      // Check whether it is a pci device\r
-      //\r
-      ControllerDevicePath = NULL;\r
-      Status = gBS->OpenProtocol (\r
-                      mDevicePathHandleBuffer[Index],\r
-                      &gEfiPciIoProtocolGuid,\r
-                      (VOID **) &PciIo,\r
-                      NULL,\r
-                      NULL,\r
-                      EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                      );\r
-      if (EFI_ERROR (Status)) {\r
-        continue;\r
-      }\r
-      //\r
-      // Check whether it contain efi driver in its option rom\r
-      //\r
-      Status = gBS->HandleProtocol(\r
-                       mDevicePathHandleBuffer[Index],\r
-                       &gEfiBusSpecificDriverOverrideProtocolGuid,\r
-                       (VOID **) &BusSpecificDriverOverride\r
-                       );\r
-      if (EFI_ERROR (Status) || BusSpecificDriverOverride == NULL) {\r
-        continue;\r
-      }\r
-    }\r
-\r
-    ControllerDevicePath = NULL;\r
-    Status = gBS->OpenProtocol (\r
-                    mDevicePathHandleBuffer[Index],\r
-                    &gEfiDevicePathProtocolGuid,\r
-                    (VOID **) &ControllerDevicePath,\r
-                    NULL,\r
-                    NULL,\r
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                    );\r
-    ASSERT_EFI_ERROR (Status);\r
-    //\r
-    // Save the device path protocol interface\r
-    //\r
-    mControllerDevicePathProtocol[Index] = ControllerDevicePath;\r
-\r
-    //\r
-    // Get the driver name\r
-    //\r
-    ControllerName = DevicePathToStr (ControllerDevicePath);\r
-\r
-    //\r
-    // Export the driver name string and create item in set options page\r
-    //\r
-    Len = StrSize (ControllerName);\r
-    NewString = AllocateZeroPool (Len + StrSize (L"--"));\r
-    ASSERT (NewString != NULL);\r
-    if (EFI_ERROR (CheckMapping (ControllerDevicePath,NULL, &mMappingDataBase, NULL, NULL))) {\r
-      StrCat (NewString, L"--");\r
-    } else {\r
-      StrCat (NewString, L"**");\r
-    }\r
-    StrCat (NewString, ControllerName);\r
-\r
-    NewStringToken = mControllerToken[Index];\r
-    if (NewStringToken == 0) {\r
-      Status = HiiLibNewString (Private->RegisteredHandle, &NewStringToken, NewString);\r
-    } else {\r
-      Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);\r
-    }\r
-    ASSERT_EFI_ERROR (Status);\r
-    FreePool (NewString);\r
-    //\r
-    // Save the device path string toke for next access use\r
-    //\r
-    mControllerToken[Index] = NewStringToken;\r
-\r
-    CreateGotoOpCode (\r
-      FORM_ID_DRIVER,\r
-      NewStringToken,\r
-      STRING_TOKEN (STR_GOTO_HELP_DRIVER),\r
-      EFI_IFR_FLAG_CALLBACK,\r
-      (UINT16) (Index + KEY_VALUE_DEVICE_OFFSET),\r
-      &UpdateData\r
-      );\r
-  }\r
-\r
-  //\r
-  // Update first page form\r
-  //\r
-  IfrLibUpdateForm (\r
-    Private->RegisteredHandle,\r
-    &mPlatformOverridesManagerGuid,\r
-    FORM_ID_DEVICE,\r
-    FORM_ID_DEVICE,\r
-    FALSE,\r
-    &UpdateData\r
-    );\r
-\r
-  FreePool (UpdateData.Data);\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Get the first Driver Binding handle which has the specific image handle.\r
-\r
-  @param  ImageHandle          The Image handle\r
-\r
-  @return                      Handle to Driver binding\r
-  @retval NULL                 The paramter is not valid or the driver binding handle is not found.\r
-\r
-**/\r
-EFI_HANDLE\r
-GetDriverBindingHandleFromImageHandle (\r
-  IN  EFI_HANDLE   ImageHandle\r
-  )\r
-{\r
-  EFI_STATUS                        Status;\r
-  UINTN                             Index;\r
-  UINTN                             DriverBindingHandleCount;\r
-  EFI_HANDLE                        *DriverBindingHandleBuffer;\r
-  EFI_DRIVER_BINDING_PROTOCOL       *DriverBindingInterface;\r
-  EFI_HANDLE                        DriverBindingHandle;\r
-\r
-  DriverBindingHandle = NULL;\r
-\r
-  if (ImageHandle == NULL) {\r
-    return NULL;\r
-  }\r
-  //\r
-  // Get all drivers which support driver binding protocol\r
-  //\r
-  DriverBindingHandleCount  = 0;\r
-  Status = gBS->LocateHandleBuffer (\r
-                  ByProtocol,\r
-                  &gEfiDriverBindingProtocolGuid,\r
-                  NULL,\r
-                  &DriverBindingHandleCount,\r
-                  &DriverBindingHandleBuffer\r
-                  );\r
-  if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {\r
-    return NULL;\r
-  }\r
-  \r
-  //\r
-  // Get the first Driver Binding handle which has the specific image handle.\r
-  //\r
-  for (Index = 0; Index < DriverBindingHandleCount; Index++) {\r
-    DriverBindingInterface = NULL;\r
-    Status = gBS->OpenProtocol (\r
-                    DriverBindingHandleBuffer[Index],\r
-                    &gEfiDriverBindingProtocolGuid,\r
-                    (VOID **) &DriverBindingInterface,\r
-                    NULL,\r
-                    NULL,\r
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      continue;\r
-    }\r
-\r
-    if (DriverBindingInterface->ImageHandle == ImageHandle) {\r
-      DriverBindingHandle = DriverBindingHandleBuffer[Index];\r
-      break;\r
-    }\r
-  }\r
-\r
-  FreePool (DriverBindingHandleBuffer);\r
-  return DriverBindingHandle;\r
-}\r
-\r
-/**\r
-  Prepare to let user select the drivers which need mapping with the device controller\r
-  selected in first page.\r
-\r
-  @param  Private        Pointer to EFI_CALLBACK_INFO.\r
-  @param  KeyValue       The callback key value of device controller item in first page.\r
-                         KeyValue is larger than or equal to KEY_VALUE_DEVICE_OFFSET.\r
-  @param  FakeNvData     Pointer to PLAT_OVER_MNGR_DATA.\r
-\r
-  @retval EFI_SUCCESS    Always returned.\r
-\r
-**/\r
-EFI_STATUS\r
-UpdateBindingDriverSelectPage (\r
-  IN EFI_CALLBACK_INFO                *Private,\r
-  IN UINT16                           KeyValue,\r
-  IN PLAT_OVER_MNGR_DATA              *FakeNvData\r
-  )\r
-{\r
-  EFI_HII_UPDATE_DATA                       UpdateData;\r
-  EFI_STATUS                                Status;\r
-  UINTN                                     Index;\r
-  CHAR16                                    *NewString;\r
-  EFI_STRING_ID                             NewStringToken;\r
-  EFI_STRING_ID                             NewStringHelpToken;\r
-  UINTN                                     DriverImageHandleCount;\r
-  EFI_LOADED_IMAGE_PROTOCOL                 *LoadedImage;\r
-  CHAR16                                    *DriverName;\r
-  BOOLEAN                                   FreeDriverName;\r
-  EFI_DEVICE_PATH_PROTOCOL                  *LoadedImageDevicePath;\r
-  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;\r
-  EFI_HANDLE                                DriverBindingHandle;\r
-\r
-  //\r
-  // If user select a controller item in the first page  the following code will be run.\r
-  // During second page, user will see all currnet driver bind protocol driver, the driver name and its device path will be shown\r
-  //\r
-  //First acquire the list of Loaded Image Protocols, and then when  want the name of the driver, look up all the Driver Binding Protocols\r
-  // and find the first one whose ImageHandle field matches the image handle of the Loaded Image Protocol.\r
-  // then use the Component Name Protocol on the same handle as the first matching Driver Binding Protocol to look up the name of the driver.\r
-  //\r
-\r
-  mCurrentPage = FORM_ID_DRIVER;\r
-  //\r
-  // Switch the item callback key value to its NO. in mDevicePathHandleBuffer\r
-  //\r
-  mSelectedCtrIndex = KeyValue - KEY_VALUE_DEVICE_OFFSET;\r
-  ASSERT (mSelectedCtrIndex > 0 && mSelectedCtrIndex < MAX_CHOICE_NUM);\r
-\r
-  mLastSavedDriverImageNum = 0;\r
-  //\r
-  // Clear all the content in dynamic page\r
-  //\r
-  UpdateData.BufferSize = UPDATE_DATA_SIZE;\r
-  UpdateData.Offset = 0;\r
-  UpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
-  ASSERT (UpdateData.Data != NULL);\r
-  //\r
-  // Clear second page form\r
-  //\r
-  IfrLibUpdateForm (\r
-    Private->RegisteredHandle,\r
-    &mPlatformOverridesManagerGuid,\r
-    FORM_ID_DRIVER,\r
-    FORM_ID_DRIVER,\r
-    FALSE,\r
-    &UpdateData\r
-    );\r
-\r
-  //\r
-  // Show all driver which support loaded image protocol in second page\r
-  //\r
-  DriverImageHandleCount  = 0;\r
-  Status = gBS->LocateHandleBuffer (\r
-                  ByProtocol,\r
-                  &gEfiLoadedImageProtocolGuid,\r
-                  NULL,\r
-                  &DriverImageHandleCount,\r
-                  &mDriverImageHandleBuffer\r
-                  );\r
-  if (EFI_ERROR (Status) || (DriverImageHandleCount == 0)) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-\r
-  mDriverImageHandleCount = DriverImageHandleCount;\r
-  for (Index = 0; Index < DriverImageHandleCount; Index++) {\r
-    //\r
-    // Step1: Get the driver image total file path for help string and the driver name.\r
-    //\r
-\r
-    //\r
-    // Find driver's Loaded Image protocol\r
-    //\r
-    LoadedImage =NULL;\r
-\r
-    Status = gBS->OpenProtocol (\r
-                    mDriverImageHandleBuffer[Index],\r
-                    &gEfiLoadedImageProtocolGuid,\r
-                    (VOID **) &LoadedImage,\r
-                    NULL,\r
-                    NULL,\r
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      FakeNvData->DriSelection[Index] = 0x00;\r
-      continue;\r
-    }\r
-    mDriverImageProtocol[Index] = LoadedImage;\r
-    //\r
-    // Find its related driver binding protocol\r
-    //\r
-    DriverBindingHandle = GetDriverBindingHandleFromImageHandle (mDriverImageHandleBuffer[Index]);\r
-    if (DriverBindingHandle == NULL) {\r
-      FakeNvData->DriSelection[Index] = 0x00;\r
-      continue;\r
-    }\r
-\r
-    //\r
-    // Get the EFI Loaded Image Device Path Protocol\r
-    //\r
-    LoadedImageDevicePath = NULL;\r
-    Status = gBS->HandleProtocol (\r
-                        mDriverImageHandleBuffer[Index],\r
-                        &gEfiLoadedImageDevicePathProtocolGuid,\r
-                        (VOID **) &LoadedImageDevicePath\r
-                        );\r
-    if (LoadedImageDevicePath == NULL) {\r
-      FakeNvData->DriSelection[Index] = 0x00;\r
-      continue;\r
-    }\r
-\r
-    if (FakeNvData->PciDeviceFilter == 0x01) {\r
-      //\r
-      // only care the driver which is in a Pci device option rom,\r
-      // and the driver's LoadedImage->DeviceHandle must point to a pci device which has efi option rom\r
-      //\r
-      if (!EFI_ERROR (Status)) {\r
-        Status = gBS->HandleProtocol(\r
-                         LoadedImage->DeviceHandle,\r
-                         &gEfiBusSpecificDriverOverrideProtocolGuid,\r
-                         (VOID **) &BusSpecificDriverOverride\r
-                         );\r
-        if (EFI_ERROR (Status) || BusSpecificDriverOverride == NULL) {\r
-          FakeNvData->DriSelection[Index] = 0x00;\r
-          continue;\r
-        }\r
-      } else {\r
-        FakeNvData->DriSelection[Index] = 0x00;\r
-        continue;\r
-      }\r
-    }\r
-\r
-    //\r
-    // For driver name, try to get its component name, if fail, get its image name,\r
-    // if also fail, give a default name.\r
-    //\r
-    FreeDriverName = FALSE;\r
-    DriverName = GetComponentName (DriverBindingHandle);\r
-    if (DriverName == NULL) {\r
-      //\r
-      // get its image name\r
-      //\r
-      DriverName = GetImageName (LoadedImage);\r
-    }\r
-    if (DriverName == NULL) {\r
-      //\r
-      // give a default name\r
-      //\r
-      HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_DRIVER_DEFAULT_NAME), &DriverName);\r
-      ASSERT (DriverName != NULL);\r
-      FreeDriverName = TRUE;  // the DriverName string need to free pool\r
-    }\r
-\r
-\r
-    //\r
-    // Step2 Export the driver name string and create check box item in second page\r
-    //\r
-\r
-    //\r
-    // First create the driver image name\r
-    //\r
-    NewString = AllocateZeroPool (StrSize (DriverName));\r
-    ASSERT (NewString != NULL); \r
-    if (EFI_ERROR (CheckMapping (mControllerDevicePathProtocol[mSelectedCtrIndex], LoadedImageDevicePath, &mMappingDataBase, NULL, NULL))) {\r
-      FakeNvData->DriSelection[Index] = 0x00;\r
-    } else {\r
-      FakeNvData->DriSelection[Index] = 0x01;\r
-      mLastSavedDriverImageNum++;\r
-    }\r
-    StrCat (NewString, DriverName);\r
-    NewStringToken = mDriverImageToken[Index];\r
-    if (NewStringToken == 0) {\r
-      Status = HiiLibNewString (Private->RegisteredHandle, &NewStringToken, NewString);\r
-    } else {\r
-      Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);\r
-    }\r
-    mDriverImageToken[Index] = NewStringToken;\r
-    ASSERT_EFI_ERROR (Status);\r
-    FreePool (NewString);\r
-    if (FreeDriverName) {\r
-      FreePool (DriverName);\r
-    }\r
-\r
-    //\r
-    // Second create the driver image device path as item help string\r
-    //\r
-    DriverName = DevicePathToStr (LoadedImageDevicePath);\r
-\r
-    NewString = AllocateZeroPool (StrSize (DriverName));\r
-    ASSERT (NewString != NULL); \r
-    StrCat (NewString, DriverName);\r
-    NewStringHelpToken = mDriverImageFilePathToken[Index];\r
-    if (NewStringHelpToken == 0) {\r
-      Status = HiiLibNewString (Private->RegisteredHandle, &NewStringHelpToken, NewString);\r
-    } else {\r
-      Status = HiiLibSetString (Private->RegisteredHandle, NewStringHelpToken, NewString);\r
-    }\r
-    mDriverImageFilePathToken[Index] = NewStringHelpToken;\r
-    ASSERT_EFI_ERROR (Status);\r
-    FreePool (NewString);\r
-    FreePool (DriverName);\r
-\r
-    CreateCheckBoxOpCode (\r
-      (UINT16) (DRIVER_SELECTION_QUESTION_ID + Index),\r
-      VARSTORE_ID_PLAT_OVER_MNGR,\r
-      (UINT16) (DRIVER_SELECTION_VAR_OFFSET + Index),\r
-      NewStringToken,\r
-      NewStringHelpToken,\r
-      0,\r
-      0,\r
-      &UpdateData\r
-      );\r
-  }\r
-\r
-  //\r
-  // Update second page form\r
-  //\r
-  IfrLibUpdateForm (\r
-    Private->RegisteredHandle,\r
-    &mPlatformOverridesManagerGuid,\r
-    FORM_ID_DRIVER,\r
-    FORM_ID_DRIVER,\r
-    FALSE,\r
-    &UpdateData\r
-    );\r
-\r
-  FreePool (UpdateData.Data);\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Prepare to let user select the priority order of the drivers which are\r
-  selected in second page.\r
-\r
-  @param  Private        Pointer to EFI_CALLBACK_INFO.\r
-  @param  KeyValue       The callback key value of device controller item in first page.\r
-  @param  FakeNvData     Pointer to PLAT_OVER_MNGR_DATA.\r
-\r
-  @retval EFI_SUCCESS    Always returned.\r
-\r
-**/\r
-EFI_STATUS\r
-UpdatePrioritySelectPage (\r
-  IN EFI_CALLBACK_INFO                *Private,\r
-  IN UINT16                           KeyValue,\r
-  IN PLAT_OVER_MNGR_DATA              *FakeNvData\r
-  )\r
-{\r
-  EFI_HII_UPDATE_DATA                       UpdateData;\r
-  UINTN                                     Index;\r
-  EFI_DEVICE_PATH_PROTOCOL                  *LoadedImageDevicePath;\r
-  IFR_OPTION                                *IfrOptionList;\r
-  UINTN                                     SelectedDriverImageNum;\r
-  UINT32                                    DriverImageNO;\r
-  UINTN                                     MinNO;\r
-  UINTN                                     Index1;\r
-  UINTN                                     TempNO[100];\r
-\r
-  //\r
-  // Following code will be run if user select 'order ... priority' item in second page\r
-  // Prepare third page.  In third page, user will order the  drivers priority which are selected in second page\r
-  //\r
-  mCurrentPage = FORM_ID_ORDER;\r
-\r
-  UpdateData.BufferSize = UPDATE_DATA_SIZE;\r
-  UpdateData.Offset = 0;\r
-  UpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
-  ASSERT (UpdateData.Data != NULL);\r
-  //\r
-  // Clear third page form\r
-  //\r
-  IfrLibUpdateForm (\r
-    Private->RegisteredHandle,\r
-    &mPlatformOverridesManagerGuid,\r
-    FORM_ID_ORDER,\r
-    FORM_ID_ORDER,\r
-    FALSE,\r
-    &UpdateData\r
-    );\r
-\r
-  //\r
-  // Check how many drivers have been selected\r
-  //\r
-  SelectedDriverImageNum = 0;\r
-  for (Index = 0; Index < mDriverImageHandleCount; Index++) {\r
-    if (FakeNvData->DriSelection[Index] != 0) {\r
-      SelectedDriverImageNum ++;\r
-    }\r
-  }\r
-\r
-  mSelectedDriverImageNum = SelectedDriverImageNum;\r
-  if (SelectedDriverImageNum == 0) {\r
-    return EFI_SUCCESS;\r
-  }\r
-  \r
-  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * mSelectedDriverImageNum);\r
-  ASSERT (IfrOptionList != NULL);\r
-  //\r
-  // Create order list for those selected drivers\r
-  //\r
-  SelectedDriverImageNum = 0;\r
-  for (Index = 0; Index < mDriverImageHandleCount; Index++) {\r
-    if (FakeNvData->DriSelection[Index] != 0) {\r
-      IfrOptionList[SelectedDriverImageNum].StringToken = mDriverImageToken[Index];\r
-      //\r
-      // Use the NO. in driver binding buffer as value, will use it later\r
-      //\r
-      IfrOptionList[SelectedDriverImageNum].Value.u8 = (UINT8) (Index + 1);\r
-      IfrOptionList[SelectedDriverImageNum].Flags = 0;\r
-\r
-      //\r
-      // Get the EFI Loaded Image Device Path Protocol\r
-      //\r
-      LoadedImageDevicePath = NULL;\r
-      gBS->HandleProtocol (\r
-                 mDriverImageHandleBuffer[Index],\r
-                 &gEfiLoadedImageDevicePathProtocolGuid,\r
-                 (VOID **) &LoadedImageDevicePath\r
-                 );\r
-      ASSERT (LoadedImageDevicePath != NULL);\r
-\r
-      //\r
-      // Check the driver DriverImage's order number in mapping database\r
-      //\r
-      DriverImageNO = 0;\r
-      CheckMapping (\r
-              mControllerDevicePathProtocol[mSelectedCtrIndex],\r
-              LoadedImageDevicePath,\r
-              &mMappingDataBase,\r
-              NULL,\r
-              &DriverImageNO\r
-              );\r
-      if (DriverImageNO == 0) {\r
-        DriverImageNO = (UINT32) mLastSavedDriverImageNum + 1;\r
-        mLastSavedDriverImageNum++;\r
-      }\r
-      TempNO[SelectedDriverImageNum] = DriverImageNO;\r
-      SelectedDriverImageNum ++;\r
-    }\r
-  }\r
-\r
-  ASSERT (SelectedDriverImageNum == mSelectedDriverImageNum);\r
-  //\r
-  // NvRamMap Must be clear firstly\r
-  //\r
-  ZeroMem (FakeNvData->DriOrder, sizeof (FakeNvData->DriOrder));\r
-\r
-  //\r
-  // Order the selected drivers according to the info already in mapping database\r
-  // the less order number in mapping database the less order number in NvRamMap\r
-  //\r
-  for (Index=0; Index < SelectedDriverImageNum; Index++) {\r
-    //\r
-    // Find the minimal order number in TempNO array,  its index in TempNO is same as IfrOptionList array\r
-    //\r
-    MinNO = 0;\r
-    for (Index1=0; Index1 < SelectedDriverImageNum; Index1++) {\r
-      if (TempNO[Index1] < TempNO[MinNO]) {\r
-        MinNO = Index1;\r
-      }\r
-    }\r
-    //\r
-    // the IfrOptionList[MinNO].Value = the driver NO. in driver binding buffer\r
-    //\r
-    FakeNvData->DriOrder[Index] =IfrOptionList[MinNO].Value.u8;\r
-    TempNO[MinNO] = MAX_CHOICE_NUM + 1;\r
-  }\r
-\r
-  CreateOrderedListOpCode (\r
-    (UINT16) DRIVER_ORDER_QUESTION_ID,\r
-    VARSTORE_ID_PLAT_OVER_MNGR,\r
-    (UINT16) DRIVER_ORDER_VAR_OFFSET,\r
-    mControllerToken[mSelectedCtrIndex],\r
-    mControllerToken[mSelectedCtrIndex],\r
-    EFI_IFR_FLAG_RESET_REQUIRED,\r
-    0,\r
-    EFI_IFR_NUMERIC_SIZE_1,\r
-    (UINT8) MAX_CHOICE_NUM,\r
-    IfrOptionList,\r
-    SelectedDriverImageNum,\r
-    &UpdateData\r
-    );\r
-\r
-  //\r
-  // Update third page form\r
-  //\r
-  IfrLibUpdateForm (\r
-    Private->RegisteredHandle,\r
-    &mPlatformOverridesManagerGuid,\r
-    FORM_ID_ORDER,\r
-    FORM_ID_ORDER,\r
-    FALSE,\r
-    &UpdateData\r
-    );\r
-\r
-  FreePool (IfrOptionList);\r
-  FreePool (UpdateData.Data);\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Save the save the mapping database to NV variable.\r
-\r
-  @param  Private        Pointer to EFI_CALLBACK_INFO.\r
-  @param  KeyValue       The callback key value of device controller item in first page.\r
-  @param  FakeNvData     Pointer to PLAT_OVER_MNGR_DATA.\r
-\r
-  @retval EFI_SUCCESS    Always returned.\r
-\r
-**/\r
-EFI_STATUS\r
-CommintChanges (\r
-  IN EFI_CALLBACK_INFO                *Private,\r
-  IN UINT16                           KeyValue,\r
-  IN PLAT_OVER_MNGR_DATA              *FakeNvData\r
-  )\r
-{\r
-  EFI_STATUS                                Status;\r
-  UINTN                                     Index;\r
-  UINTN                                     SelectedDriverImageNum;\r
-  EFI_DEVICE_PATH_PROTOCOL                  *LoadedImageDevicePath;\r
-  //\r
-  //  Following code will be run if user select 'commint changes' in third page\r
-  //  user enter 'Commit Changes' to save the mapping database\r
-  //\r
-  DeleteDriverImage (mControllerDevicePathProtocol[mSelectedCtrIndex], NULL, &mMappingDataBase);\r
-  for (SelectedDriverImageNum = 0; SelectedDriverImageNum < mSelectedDriverImageNum; SelectedDriverImageNum++) {\r
-    //\r
-    // DriOrder[SelectedDriverImageNum] = the driver NO. in driver binding buffer\r
-    //\r
-    Index = FakeNvData->DriOrder[SelectedDriverImageNum] - 1;\r
-\r
-    //\r
-    // Get the EFI Loaded Image Device Path Protocol\r
-    //\r
-    LoadedImageDevicePath = NULL;\r
-    Status = gBS->HandleProtocol (\r
-                        mDriverImageHandleBuffer[Index],\r
-                        &gEfiLoadedImageDevicePathProtocolGuid,\r
-                        (VOID **) &LoadedImageDevicePath\r
-                        );\r
-    ASSERT (LoadedImageDevicePath != NULL);\r
-\r
-    InsertDriverImage (\r
-            mControllerDevicePathProtocol[mSelectedCtrIndex],\r
-            LoadedImageDevicePath,\r
-            &mMappingDataBase,\r
-            (UINT32)SelectedDriverImageNum + 1\r
-            );\r
-  }\r
-  Status = SaveOverridesMapping (&mMappingDataBase);\r
-\r
-  return Status;\r
-}\r
-\r
-/**\r
-  This function allows a caller to extract the current configuration for one\r
-  or more named elements from the target driver.\r
-\r
-  @param  This         Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param  Request      A null-terminated Unicode string in <ConfigRequest> format.\r
-  @param  Progress     On return, points to a character in the Request string.\r
-                       Points to the string's null terminator if request was successful.\r
-                       Points to the most recent '&' before the first failing name/value\r
-                       pair (or the beginning of the string if the failure is in the\r
-                       first name/value pair) if the request was not successful.\r
-  @param  Results      A null-terminated Unicode string in <ConfigAltResp> format which\r
-                       has all values filled in for the names in the Request string.\r
-                       String to be allocated by the called function.\r
-\r
-  @retval EFI_SUCCESS            The Results is filled with the requested values.\r
-  @retval EFI_OUT_OF_RESOURCES   Not enough memory to store the results.\r
-  @retval EFI_INVALID_PARAMETER  Request is NULL, illegal syntax, or unknown name.\r
-  @retval EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PlatOverMngrExtractConfig (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  CONST EFI_STRING                       Request,\r
-  OUT EFI_STRING                             *Progress,\r
-  OUT EFI_STRING                             *Results\r
-  )\r
-{\r
-  EFI_STATUS                       Status;\r
-  EFI_CALLBACK_INFO                *Private;\r
-  EFI_HII_CONFIG_ROUTING_PROTOCOL  *HiiConfigRouting;\r
-\r
-  if (Request == NULL) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-\r
-  Private = EFI_CALLBACK_INFO_FROM_THIS (This);\r
-  HiiConfigRouting = Private->HiiConfigRouting;\r
-\r
-  //\r
-  // Convert buffer data to <ConfigResp> by helper function BlockToConfig()\r
-  //\r
-  Status = HiiConfigRouting->BlockToConfig (\r
-                                HiiConfigRouting,\r
-                                Request,\r
-                                (UINT8 *) &Private->FakeNvData,\r
-                                sizeof (PLAT_OVER_MNGR_DATA),\r
-                                Results,\r
-                                Progress\r
-                                );\r
-  return Status;\r
-}\r
-\r
-/**\r
-  This function processes the results of changes in configuration.\r
-\r
-  @param  This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param  Configuration   A null-terminated Unicode string in <ConfigRequest> format.\r
-  @param  Progress        A pointer to a string filled in with the offset of the most\r
-                          recent '&' before the first failing name/value pair (or the\r
-                          beginning of the string if the failure is in the first\r
-                          name/value pair) or the terminating NULL if all was successful.\r
-\r
-  @retval EFI_SUCCESS            The Results is processed successfully.\r
-  @retval EFI_INVALID_PARAMETER  Configuration is NULL.\r
-  @retval EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PlatOverMngrRouteConfig (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  CONST EFI_STRING                       Configuration,\r
-  OUT EFI_STRING                             *Progress\r
-  )\r
-{\r
-  EFI_CALLBACK_INFO                         *Private;\r
-  EFI_STATUS                                Status;\r
-  UINT16                                    KeyValue;\r
-  UINTN                                     BufferSize;\r
-  PLAT_OVER_MNGR_DATA                       *FakeNvData;\r
-\r
-  Private     = EFI_CALLBACK_INFO_FROM_THIS (This);\r
-\r
-  FakeNvData = &Private->FakeNvData;\r
-  BufferSize = sizeof (PLAT_OVER_MNGR_DATA);\r
-  Status = GetBrowserData (NULL, NULL, &BufferSize, (UINT8 *) FakeNvData);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  if (mCurrentPage == FORM_ID_DRIVER) {\r
-    KeyValue = KEY_VALUE_DRIVER_GOTO_ORDER;\r
-    UpdatePrioritySelectPage (Private, KeyValue, FakeNvData);\r
-    KeyValue = KEY_VALUE_ORDER_SAVE_AND_EXIT;\r
-    CommintChanges (Private, KeyValue, FakeNvData);\r
-    //\r
-    // Since UpdatePrioritySelectPage will change mCurrentPage,\r
-    // should ensure the mCurrentPage still indicate the second page here\r
-    //\r
-    mCurrentPage = FORM_ID_DRIVER;\r
-  }\r
-\r
-  if (mCurrentPage == FORM_ID_ORDER) {\r
-    KeyValue = KEY_VALUE_ORDER_SAVE_AND_EXIT;\r
-    CommintChanges (Private, KeyValue, FakeNvData);\r
-  }\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  This is the function that is called to provide results data to the driver.  This data\r
-  consists of a unique key which is used to identify what data is either being passed back\r
-  or being asked for.\r
-\r
-  @param  This           Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param  Action         A null-terminated Unicode string in <ConfigRequest> format.\r
-  @param  KeyValue       A unique Goto OpCode callback value which record user's selection.\r
-                         0x100 <= KeyValue <0x500 : user select a controller item in the first page;\r
-                         KeyValue == 0x1234       : user select 'Refresh' in first page, or user select 'Go to Previous Menu' in second page\r
-                         KeyValue == 0x1235       : user select 'Pci device filter' in first page\r
-                         KeyValue == 0x1500       : user select 'order ... priority' item in second page\r
-                         KeyValue == 0x1800       : user select 'commint changes' in third page\r
-                         KeyValue == 0x2000       : user select 'Go to Previous Menu' in third page\r
-  @param  Type           The type of value for the question.\r
-  @param  Value          A pointer to the data being sent to the original exporting driver.\r
-  @param  ActionRequest  On return, points to the action requested by the callback function.\r
-\r
-  @retval EFI_SUCCESS    Always returned.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PlatOverMngrCallback (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  EFI_BROWSER_ACTION                     Action,\r
-  IN  EFI_QUESTION_ID                        KeyValue,\r
-  IN  UINT8                                  Type,\r
-  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
-  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
-  )\r
-{\r
-  EFI_CALLBACK_INFO                         *Private;\r
-  EFI_STATUS                                Status;\r
-  EFI_STRING_ID                             NewStringToken;\r
-  UINTN                                     BufferSize;\r
-  PLAT_OVER_MNGR_DATA                       *FakeNvData;\r
-  EFI_INPUT_KEY                             Key;\r
-\r
-  Private = EFI_CALLBACK_INFO_FROM_THIS (This);\r
-\r
-  FakeNvData = &Private->FakeNvData;\r
-  BufferSize = sizeof (PLAT_OVER_MNGR_DATA);\r
-  Status = GetBrowserData (NULL, NULL, &BufferSize, (UINT8 *) FakeNvData);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  if (KeyValue == KEY_VALUE_DEVICE_REFRESH ||\r
-      KeyValue == KEY_VALUE_DEVICE_FILTER ||\r
-      KeyValue == KEY_VALUE_DRIVER_GOTO_PREVIOUS\r
-      ) {\r
-    UpdateDeviceSelectPage (Private, KeyValue, FakeNvData);\r
-    //\r
-    // Update page title string\r
-    //\r
-    NewStringToken = STRING_TOKEN (STR_TITLE);\r
-    Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"First, Select the controller by device path");\r
-    ASSERT_EFI_ERROR (Status);\r
-  }\r
-\r
-  if (((KeyValue >= KEY_VALUE_DEVICE_OFFSET) && (KeyValue < KEY_VALUE_DEVICE_MAX)) || (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS)) {\r
-    if (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS) {\r
-      KeyValue = (EFI_QUESTION_ID) (mSelectedCtrIndex + KEY_VALUE_DEVICE_OFFSET);\r
-    }\r
-    UpdateBindingDriverSelectPage (Private, KeyValue, FakeNvData);\r
-    //\r
-    // Update page title string\r
-    //\r
-    NewStringToken = STRING_TOKEN (STR_TITLE);\r
-    Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"Second, Select drivers for the previous selected controller");\r
-    ASSERT_EFI_ERROR (Status);\r
-  }\r
-\r
-  if (KeyValue == KEY_VALUE_DRIVER_GOTO_ORDER) {\r
-    UpdatePrioritySelectPage (Private, KeyValue, FakeNvData);\r
-    //\r
-    // Update page title string\r
-    //\r
-    NewStringToken = STRING_TOKEN (STR_TITLE);\r
-    Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"Finally, Set the priority order for the drivers and save them");\r
-    ASSERT_EFI_ERROR (Status);\r
-  }\r
-\r
-  if (KeyValue == KEY_VALUE_ORDER_SAVE_AND_EXIT) {\r
-    Status = CommintChanges (Private, KeyValue, FakeNvData);\r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
-    if (EFI_ERROR (Status)) {\r
-      IfrLibCreatePopUp (1, &Key, L"Single Override Info too large, Saving Error!");\r
-      return EFI_DEVICE_ERROR;\r
-    }\r
-  }\r
-\r
-  if (KeyValue == KEY_VALUE_DEVICE_CLEAR) {\r
-    //\r
-    // Deletes all environment variable(s) that contain the override mappings info\r
-    //\r
-    FreeMappingDatabase (&mMappingDataBase);\r
-    Status = SaveOverridesMapping (&mMappingDataBase);\r
-    UpdateDeviceSelectPage (Private, KeyValue, FakeNvData);\r
-  }\r
-  //\r
-  // Pass changed uncommitted data back to Form Browser\r
-  //\r
-  BufferSize = sizeof (PLAT_OVER_MNGR_DATA);\r
-  Status = SetBrowserData (NULL, NULL, BufferSize, (UINT8 *) FakeNvData, NULL);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  The driver Entry Point. The funciton will export a disk device class formset and\r
-  its callback function to hii database.\r
-\r
-  @param  ImageHandle    The firmware allocated handle for the EFI image.\r
-  @param  SystemTable    A pointer to the EFI System Table.\r
-\r
-  @retval EFI_SUCCESS    The entry point is executed successfully.\r
-  @retval other          Some error occurs when executing this entry point.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PlatOverMngrInit (\r
-  IN EFI_HANDLE                   ImageHandle,\r
-  IN EFI_SYSTEM_TABLE             *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS                  Status;\r
-  EFI_HII_DATABASE_PROTOCOL   *HiiDatabase;\r
-  EFI_HII_PACKAGE_LIST_HEADER *PackageList;\r
-  EFI_CALLBACK_INFO           *CallbackInfo;\r
-  EFI_HANDLE                  DriverHandle;\r
-  EFI_FORM_BROWSER2_PROTOCOL       *FormBrowser2;\r
-  \r
-  //\r
-  // There should only be one HII protocol\r
-  //\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiHiiDatabaseProtocolGuid,\r
-                  NULL,\r
-                  (VOID **) &HiiDatabase\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // There should only be one Form Configuration protocol\r
-  //\r
-  Status = gBS->LocateProtocol (\r
-                 &gEfiFormBrowser2ProtocolGuid,\r
-                 NULL,\r
-                 (VOID **) &FormBrowser2\r
-                 );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  CallbackInfo = AllocateZeroPool (sizeof (EFI_CALLBACK_INFO));\r
-  if (CallbackInfo == NULL) {\r
-    return EFI_BAD_BUFFER_SIZE;\r
-  }\r
-\r
-  CallbackInfo->Signature = EFI_CALLBACK_INFO_SIGNATURE;\r
-  CallbackInfo->ConfigAccess.ExtractConfig = PlatOverMngrExtractConfig;\r
-  CallbackInfo->ConfigAccess.RouteConfig   = PlatOverMngrRouteConfig;\r
-  CallbackInfo->ConfigAccess.Callback      = PlatOverMngrCallback;\r
-\r
-  //\r
-  // Create driver handle used by HII database\r
-  //\r
-  Status = HiiLibCreateHiiDriverHandle (&DriverHandle);\r
-  if (EFI_ERROR (Status)) {\r
-    goto Finish;\r
-  }\r
-  CallbackInfo->DriverHandle = DriverHandle;\r
-\r
-  //\r
-  // Install Config Access protocol to driver handle\r
-  //\r
-  Status = gBS->InstallProtocolInterface (\r
-                  &DriverHandle,\r
-                  &gEfiHiiConfigAccessProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  &CallbackInfo->ConfigAccess\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    goto Finish;\r
-  }\r
-\r
-  //\r
-  // Publish our HII data\r
-  //\r
-  PackageList = HiiLibPreparePackageList (\r
-                  2,\r
-                  &mPlatformOverridesManagerGuid,\r
-                  VfrBin,\r
-                  PlatOverMngrStrings\r
-                  );\r
-  ASSERT (PackageList != NULL);\r
-\r
-  Status = HiiDatabase->NewPackageList (\r
-                           HiiDatabase,\r
-                           PackageList,\r
-                           DriverHandle,\r
-                           &CallbackInfo->RegisteredHandle\r
-                           );\r
-  FreePool (PackageList);\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    goto Finish;\r
-  }\r
-\r
-  //\r
-  // Locate ConfigRouting protocol\r
-  //\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiHiiConfigRoutingProtocolGuid,\r
-                  NULL,\r
-                  (VOID **) &CallbackInfo->HiiConfigRouting\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    goto Finish;\r
-  }\r
-\r
-  //\r
-  // Clear all the globle variable\r
-  //\r
-  mDriverImageHandleCount = 0;\r
-  mCurrentPage = 0;\r
-  ZeroMem (mDriverImageToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));\r
-  ZeroMem (mDriverImageFilePathToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));\r
-  ZeroMem (mControllerToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));\r
-  ZeroMem (mDriverImageProtocol, MAX_CHOICE_NUM * sizeof (EFI_LOADED_IMAGE_PROTOCOL *));\r
-\r
-  //\r
-  // Show the page\r
-  //\r
-  Status = FormBrowser2->SendForm (\r
-                           FormBrowser2,\r
-                           &CallbackInfo->RegisteredHandle,\r
-                           1,\r
-                           NULL,\r
-                           0,\r
-                           NULL,\r
-                           NULL\r
-                           );\r
-  if (EFI_ERROR (Status)) {\r
-    goto Finish;\r
-  }\r
-\r
-  Status = HiiDatabase->RemovePackageList (HiiDatabase, CallbackInfo->RegisteredHandle);\r
-  if (EFI_ERROR (Status)) {\r
-    goto Finish;\r
-  }\r
-  \r
-  return EFI_SUCCESS;\r
-\r
-Finish:\r
-  if (CallbackInfo->DriverHandle != NULL) {\r
-    HiiLibDestroyHiiDriverHandle (CallbackInfo->DriverHandle);\r
-  }\r
-  if (CallbackInfo != NULL) {\r
-    FreePool (CallbackInfo);\r
-  }\r
-\r
-  return Status;\r
-}\r
diff --git a/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.h b/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.h
deleted file mode 100644 (file)
index 12bbf6a..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/** @file\r
-  \r
-  The defintions are required both by Source code and Vfr file.\r
-  The PLAT_OVER_MNGR_DATA structure, form guid and Ifr question ID are defined. \r
-\r
-Copyright (c) 2007 - 2008, 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
-\r
-**/\r
-\r
-#ifndef _PLAT_OVER_MNGR_H_\r
-#define _PLAT_OVER_MNGR_H_\r
-\r
-#define PLAT_OVER_MNGR_GUID \\r
-  { \\r
-    0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \\r
-  }\r
-\r
-//\r
-// The max number of the supported driver list.\r
-//\r
-#define MAX_CHOICE_NUM    0x00ff\r
-#define UPDATE_DATA_SIZE  0x1000\r
-\r
-#define FORM_ID_DEVICE                 0x1100\r
-#define FORM_ID_DRIVER                 0x1200\r
-#define FORM_ID_ORDER                  0x1500\r
-\r
-#define KEY_VALUE_DEVICE_OFFSET        0x0100\r
-#define KEY_VALUE_DEVICE_MAX           (KEY_VALUE_DEVICE_OFFSET + MAX_CHOICE_NUM)\r
-\r
-#define KEY_VALUE_DEVICE_REFRESH       0x1234\r
-#define KEY_VALUE_DEVICE_FILTER        0x1235\r
-#define KEY_VALUE_DEVICE_CLEAR         0x1236\r
-\r
-#define KEY_VALUE_DRIVER_GOTO_PREVIOUS 0x1300\r
-#define KEY_VALUE_DRIVER_GOTO_ORDER    0x1301\r
-\r
-#define KEY_VALUE_ORDER_GOTO_PREVIOUS  0x2000\r
-#define KEY_VALUE_ORDER_SAVE_AND_EXIT  0x1800\r
-\r
-#define VARSTORE_ID_PLAT_OVER_MNGR     0x1000\r
-\r
-typedef struct {\r
-  UINT8   DriSelection[MAX_CHOICE_NUM];\r
-  UINT8   DriOrder[MAX_CHOICE_NUM];\r
-  UINT8   PciDeviceFilter;\r
-} PLAT_OVER_MNGR_DATA;\r
-\r
-//\r
-// Field offset of structure PLAT_OVER_MNGR_DATA\r
-//\r
-#define VAR_OFFSET(Field)              ((UINTN) &(((PLAT_OVER_MNGR_DATA *) 0)->Field))\r
-#define DRIVER_SELECTION_VAR_OFFSET     (VAR_OFFSET (DriSelection))\r
-#define DRIVER_ORDER_VAR_OFFSET         (VAR_OFFSET (DriOrder))\r
-\r
-//\r
-// Tool automatic generated Question Id start from 1\r
-// In order to avoid to conflict them, the Driver Selection and Order QuestionID offset is defined from 0x0500.\r
-//\r
-#define QUESTION_ID_OFFSET              0x0500\r
-#define DRIVER_SELECTION_QUESTION_ID    (VAR_OFFSET (DriSelection) + QUESTION_ID_OFFSET)\r
-#define DRIVER_ORDER_QUESTION_ID        (VAR_OFFSET (DriOrder) + QUESTION_ID_OFFSET)\r
-\r
-#endif\r
diff --git a/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.inf b/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.inf
deleted file mode 100644 (file)
index 7ba07bc..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#/** @file\r
-#\r
-#  A UI application to offer a UI interface in device manager to let user configue\r
-#  platform override protocol to override the default algorithm for matching\r
-#  drivers to controllers.\r
-#\r
-#  The main flow:\r
-#  1. The UI application dynamicly locate all controller device path.\r
-#  2. The UI application dynamicly locate all drivers which support binding protocol.\r
-#  3. The UI application export and dynamicly update two menu to let user select the\r
-#     mapping between drivers to controllers.\r
-#  4. The UI application save all the mapping info in NV variables for the following boot, \r
-#     which will be consumed by platform override protocol driver to publish the platform override protocol.\r
-#\r
-# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.\r
-#\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
-#\r
-#\r
-#**/\r
-\r
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = PlatOverMngr\r
-  FILE_GUID                      = 56D95BFE-F991-4898-B3BE-B8F37C927F48\r
-  MODULE_TYPE                    = UEFI_APPLICATION\r
-  VERSION_STRING                 = 1.0\r
-  ENTRY_POINT                    = PlatOverMngrInit\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources.common]\r
-  VfrStrings.uni\r
-  Vfr.vfr\r
-  PlatOverMngr.c\r
-  PlatOverMngr.h\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  MdeModulePkg/MdeModulePkg.dec\r
-\r
-[LibraryClasses]\r
-  BaseLib\r
-  DebugLib\r
-  UefiLib\r
-  UefiApplicationEntryPoint\r
-  UefiBootServicesTableLib\r
-  PlatDriOverLib\r
-  HiiLib\r
-  IfrSupportLib\r
-  ExtendedHiiLib\r
-  ExtendedIfrSupportLib\r
-  BaseMemoryLib\r
-  MemoryAllocationLib\r
-  UefiRuntimeServicesTableLib\r
-  DevicePathLib\r
-  GenericBdsLib\r
-  \r
-[Guids]\r
-  gEfiGlobalVariableGuid                        ## CONSUMED ## Variable:L"PlatformLang" this variable specifies the platform supported language string (RFC 3066 format)\r
-\r
-[Protocols]\r
-  gEfiComponentName2ProtocolGuid                ## SOMETIMES_CONSUMED (Get Driver Name if ComponentName2Protocol exists)\r
-  gEfiComponentNameProtocolGuid                 ## SOMETIMES_CONSUMED (Get Driver Name if ComponentNameProtocol exists and ComponentName2Protocol doesn't exist)\r
-  gEfiFirmwareVolume2ProtocolGuid               ## SOMETIMES_CONSUMED (Get Driver Name from EFI UI section if ComponentName2Protocol and ComponentNameProtocol don't exist)\r
-  gEfiPciIoProtocolGuid                         ## SOMETIMES_CONSUMED (Find the PCI device if PciIo protocol is installed)\r
-  gEfiBusSpecificDriverOverrideProtocolGuid     ## SOMETIMES_CONSUMED (Check whether the PCI device contains one or more efi drivers in its option rom by this protocol) \r
-\r
-  gEfiDriverBindingProtocolGuid                 ## SOMETIMES_CONSUMED\r
-  gEfiLoadedImageProtocolGuid                   ## SOMETIMES_CONSUMED\r
-  gEfiLoadedImageDevicePathProtocolGuid         ## SOMETIMES_CONSUMED (Show the drivers in the second page that support DriverBindingProtocol, LoadedImageProtocol and LoadedImageDevicePathProtocol)\r
-  gEfiDevicePathProtocolGuid                    ## SOMETIMES_CONSUMED (Show the controller device in the first page that support DevicePathProtocol)\r
-\r
-  gEfiHiiDatabaseProtocolGuid                   ## CONSUMED\r
-  gEfiFormBrowser2ProtocolGuid                  ## CONSUMED\r
-  gEfiHiiConfigRoutingProtocolGuid              ## CONSUMED\r
-  gEfiHiiConfigAccessProtocolGuid               ## PRODUCED\r
-  
\ No newline at end of file
diff --git a/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/Vfr.vfr b/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/Vfr.vfr
deleted file mode 100644 (file)
index b3cd038..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-// *++\r
-//\r
-// Copyright (c) 2007 - 2008, 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
-//\r
-// Module Name:\r
-//\r
-//   Vfr.vfr\r
-//\r
-// Abstract:\r
-//\r
-//   Platform driver Override manager formset\r
-//\r
-//\r
-// --*/\r
-\r
-#include "PlatOverMngr.h"\r
-\r
-#define EFI_DISK_DEVICE_CLASS          0x01\r
-#define LABEL_END                      0xffff\r
-\r
-formset\r
-  guid     = PLAT_OVER_MNGR_GUID,\r
-  title    = STRING_TOKEN(STR_ENTRY_TITLE),\r
-  help     = STRING_TOKEN(STR_TITLE_HELP),\r
-  class    = EFI_DISK_DEVICE_CLASS,\r
-  subclass = 0xff,\r
-\r
-  varstore PLAT_OVER_MNGR_DATA,\r
-    varid = VARSTORE_ID_PLAT_OVER_MNGR,\r
-    name  = Data,\r
-    guid  = PLAT_OVER_MNGR_GUID;\r
-\r
-  form formid = FORM_ID_DEVICE,\r
-       title = STRING_TOKEN(STR_TITLE);\r
-\r
-    text\r
-      help   = STRING_TOKEN(STR_FIRST_REFRESH_HELP),\r
-      text   = STRING_TOKEN(STR_FIRST_REFRESH),\r
-      text   = STRING_TOKEN(STR_NULL_STRING),\r
-      flags  = INTERACTIVE,\r
-      key    = KEY_VALUE_DEVICE_REFRESH;\r
-\r
-    checkbox varid = Data.PciDeviceFilter,\r
-      prompt   = STRING_TOKEN(STR_PCI_DEVICE_FILTER_PROMPT),\r
-      help     = STRING_TOKEN(STR_PCI_DEVICE_FILTER_HELP),\r
-      flags    = INTERACTIVE,\r
-      key      = KEY_VALUE_DEVICE_FILTER,\r
-    endcheckbox;\r
-\r
-    label FORM_ID_DEVICE;\r
-    label LABEL_END;\r
-\r
-    subtitle text = STRING_TOKEN(STR_NULL_STRING);\r
-\r
-    goto FORM_ID_DEVICE,\r
-      prompt  = STRING_TOKEN(STR_CLEAR_ALL),\r
-      help    = STRING_TOKEN(STR_CLEAR_ALL_HELP),\r
-      flags   = INTERACTIVE | RESET_REQUIRED,\r
-      key     = KEY_VALUE_DEVICE_CLEAR;\r
-  endform;\r
-\r
-  form formid = FORM_ID_DRIVER,\r
-       title = STRING_TOKEN(STR_TITLE);\r
-\r
-    goto FORM_ID_DEVICE,\r
-      prompt  = STRING_TOKEN(STR_GOTO_PREVIOUS),\r
-      help    = STRING_TOKEN(STR_NULL_STRING),\r
-      flags   = INTERACTIVE,\r
-      key     = KEY_VALUE_DRIVER_GOTO_PREVIOUS;\r
-\r
-    goto FORM_ID_ORDER,\r
-      prompt  = STRING_TOKEN(STR_TITLE_ORDER),\r
-      help    = STRING_TOKEN(STR_TITLE_ORDER_HELP),\r
-      flags   = INTERACTIVE,\r
-      key     = KEY_VALUE_DRIVER_GOTO_ORDER;\r
-\r
-    label FORM_ID_DRIVER;\r
-    label LABEL_END;\r
-\r
-  endform;\r
-\r
-  form formid = FORM_ID_ORDER,\r
-       title = STRING_TOKEN(STR_TITLE);\r
-\r
-    goto FORM_ID_DRIVER,\r
-      prompt  = STRING_TOKEN(STR_GOTO_PREVIOUS),\r
-      help    = STRING_TOKEN(STR_NULL_STRING),\r
-      flags   = INTERACTIVE,\r
-      key     = KEY_VALUE_ORDER_GOTO_PREVIOUS;\r
-\r
-    label FORM_ID_ORDER;\r
-    label LABEL_END;\r
-\r
-    subtitle text = STRING_TOKEN(STR_NULL_STRING);\r
-\r
-    goto FORM_ID_ORDER,\r
-      prompt  = STRING_TOKEN(STR_SAVE_AND_EXIT),\r
-      help    = STRING_TOKEN(STR_NULL_STRING),\r
-      flags   = INTERACTIVE | RESET_REQUIRED,\r
-      key     = KEY_VALUE_ORDER_SAVE_AND_EXIT;\r
-  endform;\r
-\r
-endformset;\r
diff --git a/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/VfrStrings.uni b/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/VfrStrings.uni
deleted file mode 100644 (file)
index fe14d30..0000000
Binary files a/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/VfrStrings.uni and /dev/null differ
index d6a71703446f5f550aa2ec51c2f84aebff8e7146..64e9a4d64d7019e28d772c3deeefbaccff9dcb60 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2007 - 2008, Intel Corporation\r
+Copyright (c) 2007 - 2009, 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
@@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/PlatDriOverLib.h>\r
+#include <Library/PlatformDriverOverrideLib.h>\r
 #include <Protocol/PlatformDriverOverride.h>\r
 \r
 LIST_ENTRY      mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);\r
index 90ee5133e2a86bb404836fed89e582af17538e03..855fb82a593f00e6288affedc9c6cbe2aae87904 100644 (file)
@@ -4,7 +4,7 @@
 # It only implements one interface GetDriver of PLATFORM_DRIVER_OVERRIDE_PROTOCOL protocol \r
 # and doesn't support other two interfaces GetDriverPath, DriverLoaded. \r
 # \r
-# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.\r
+# Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.\r
 #\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
@@ -41,7 +41,7 @@
   BaseLib\r
   UefiDriverEntryPoint\r
   DebugLib\r
-  PlatDriOverLib\r
+  PlatformDriverOverrideLib\r
   UefiBootServicesTableLib\r
 \r
 [Protocols]\r