]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg:Rename DeviceManagerLib to DeviceManagerUiLib
authorDandan Bi <dandan.bi@intel.com>
Tue, 19 Jan 2016 03:30:33 +0000 (03:30 +0000)
committerdandanbi <dandanbi@Edk2>
Tue, 19 Jan 2016 03:30:33 +0000 (03:30 +0000)
Avoid any confusion,add the keyword "Ui",
user can understand the use of the library clearly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19666 6f19259b-4bc3-4df7-8a09-765794883524

12 files changed:
MdeModulePkg/Library/DeviceManagerLib/DeviceManager.c [deleted file]
MdeModulePkg/Library/DeviceManagerLib/DeviceManager.h [deleted file]
MdeModulePkg/Library/DeviceManagerLib/DeviceManagerLib.inf [deleted file]
MdeModulePkg/Library/DeviceManagerLib/DeviceManagerLib.uni [deleted file]
MdeModulePkg/Library/DeviceManagerLib/DeviceManagerStrings.uni [deleted file]
MdeModulePkg/Library/DeviceManagerLib/DeviceManagerVfr.Vfr [deleted file]
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c [new file with mode: 0644]
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h [new file with mode: 0644]
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni [new file with mode: 0644]
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf [new file with mode: 0644]
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.uni [new file with mode: 0644]
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerVfr.Vfr [new file with mode: 0644]

diff --git a/MdeModulePkg/Library/DeviceManagerLib/DeviceManager.c b/MdeModulePkg/Library/DeviceManagerLib/DeviceManager.c
deleted file mode 100644 (file)
index ba3f631..0000000
+++ /dev/null
@@ -1,925 +0,0 @@
-/** @file\r
-The device manager reference implementation\r
-\r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
-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 "DeviceManager.h"\r
-\r
-DEVICE_MANAGER_CALLBACK_DATA  gDeviceManagerPrivate = {\r
-  DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE,\r
-  NULL,\r
-  NULL,\r
-  {\r
-    DeviceManagerExtractConfig,\r
-    DeviceManagerRouteConfig,\r
-    DeviceManagerCallback\r
-  }\r
-};\r
-\r
-#define  MAX_MAC_ADDRESS_NODE_LIST_LEN    10\r
-\r
-EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID;\r
-\r
-//\r
-// Which Mac Address string is select\r
-// it will decide what menu need to show in the NETWORK_DEVICE_FORM_ID form.\r
-//\r
-EFI_STRING  mSelectedMacAddrString;\r
-\r
-//\r
-// The Mac Address show in the NETWORK_DEVICE_LIST_FORM_ID\r
-//\r
-MAC_ADDRESS_NODE_LIST  mMacDeviceList;\r
-\r
-HII_VENDOR_DEVICE_PATH  mDeviceManagerHiiVendorDevicePath = {\r
-  {\r
-    {\r
-      HARDWARE_DEVICE_PATH,\r
-      HW_VENDOR_DP,\r
-      {\r
-        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
-        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
-      }\r
-    },\r
-    //\r
-    // {102579A0-3686-466e-ACD8-80C087044F4A}\r
-    //\r
-    { 0x102579a0, 0x3686, 0x466e, { 0xac, 0xd8, 0x80, 0xc0, 0x87, 0x4, 0x4f, 0x4a } }\r
-  },\r
-  {\r
-    END_DEVICE_PATH_TYPE,\r
-    END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
-    { \r
-      (UINT8) (END_DEVICE_PATH_LENGTH),\r
-      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
-    }\r
-  }\r
-};\r
-\r
-/**\r
-  Extract device path for given HII handle and class guid.\r
-\r
-  @param Handle          The HII handle.\r
-\r
-  @retval  NULL          Fail to get the device path string.\r
-  @return  PathString    Get the device path string.\r
-\r
-**/\r
-CHAR16 *\r
-DmExtractDevicePathFromHiiHandle (\r
-  IN      EFI_HII_HANDLE      Handle\r
-  )\r
-{\r
-  EFI_STATUS                       Status;\r
-  EFI_HANDLE                       DriverHandle;\r
-\r
-  ASSERT (Handle != NULL);\r
-\r
-  if (Handle == NULL) {\r
-    return NULL;\r
-  }\r
-\r
-  Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);\r
-  if (EFI_ERROR (Status)) {\r
-    return NULL;\r
-  }\r
-  //\r
-  // Get device path string.\r
-  //\r
-  return ConvertDevicePathToText(DevicePathFromHandle (DriverHandle), FALSE, FALSE);\r
-}\r
-\r
-/**\r
-  Get the mac address string from the device path.\r
-  if the device path has the vlan, get the vanid also.\r
-  \r
-  @param MacAddressNode              Device path begin with mac address \r
-  @param PBuffer                     Output string buffer contain mac address.\r
-\r
-**/\r
-BOOLEAN \r
-GetMacAddressString(\r
-  IN  MAC_ADDR_DEVICE_PATH   *MacAddressNode,\r
-  OUT CHAR16                 **PBuffer\r
-  )\r
-{\r
-  UINTN                 HwAddressSize;\r
-  UINTN                 Index;\r
-  UINT8                 *HwAddress;\r
-  EFI_DEVICE_PATH_PROTOCOL  *Node;\r
-  UINT16                VlanId;\r
-  CHAR16                *String;\r
-  UINTN                 BufferLen;\r
-\r
-  VlanId = 0;\r
-  String = NULL;\r
-  ASSERT(MacAddressNode != NULL);\r
-\r
-  HwAddressSize = sizeof (EFI_MAC_ADDRESS);\r
-  if (MacAddressNode->IfType == 0x01 || MacAddressNode->IfType == 0x00) {\r
-    HwAddressSize = 6;\r
-  }\r
-\r
-  //\r
-  // The output format is MAC:XX:XX:XX:...\XXXX\r
-  // The size is the Number size + ":" size + Vlan size(\XXXX) + End\r
-  //\r
-  BufferLen = (4 + 2 * HwAddressSize + (HwAddressSize - 1) + 5 + 1) * sizeof (CHAR16);\r
-  String = AllocateZeroPool (BufferLen);\r
-  if (String == NULL) {\r
-    return FALSE;\r
-  }\r
-\r
-  *PBuffer = String;\r
-  StrCpyS(String, BufferLen / sizeof (CHAR16), L"MAC:");\r
-  String += 4;\r
-  \r
-  //\r
-  // Convert the MAC address into a unicode string.\r
-  //\r
-  HwAddress = &MacAddressNode->MacAddress.Addr[0];\r
-  for (Index = 0; Index < HwAddressSize; Index++) {\r
-    String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(HwAddress++), 2);\r
-    if (Index < HwAddressSize - 1) {\r
-      *String++ = L':';\r
-    }\r
-  }\r
-\r
-  //\r
-  // If VLAN is configured, it will need extra 5 characters like "\0005".\r
-  // Plus one unicode character for the null-terminator.\r
-  //\r
-  Node = (EFI_DEVICE_PATH_PROTOCOL  *)MacAddressNode;\r
-  while (!IsDevicePathEnd (Node)) {\r
-    if (Node->Type == MESSAGING_DEVICE_PATH && Node->SubType == MSG_VLAN_DP) {\r
-      VlanId = ((VLAN_DEVICE_PATH *) Node)->VlanId;\r
-    }\r
-    Node = NextDevicePathNode (Node);\r
-  }\r
-\r
-  if (VlanId != 0) {\r
-    *String++ = L'\\';\r
-    String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, VlanId, 4);\r
-  }\r
-\r
-  //\r
-  // Null terminate the Unicode string\r
-  //\r
-  *String = L'\0';\r
-\r
-  return TRUE;\r
-}\r
-\r
-/**\r
-  Save question id and prompt id to the mac device list.\r
-  If the same mac address has saved yet, no need to add more.\r
-\r
-  @param MacAddrString               Mac address string.\r
-\r
-  @retval  EFI_SUCCESS               Add the item is successful.\r
-  @return  Other values if failed to Add the item.\r
-**/\r
-BOOLEAN \r
-AddIdToMacDeviceList (\r
-  IN  EFI_STRING        MacAddrString\r
-  )\r
-{\r
-  MENU_INFO_ITEM *TempDeviceList;\r
-  UINTN          Index;\r
-  EFI_STRING     StoredString;\r
-  EFI_STRING_ID  PromptId;\r
-  EFI_HII_HANDLE HiiHandle;\r
-\r
-  HiiHandle =   gDeviceManagerPrivate.HiiHandle;\r
-  TempDeviceList = NULL;\r
-\r
-  for (Index = 0; Index < mMacDeviceList.CurListLen; Index ++) {\r
-    StoredString = HiiGetString (HiiHandle, mMacDeviceList.NodeList[Index].PromptId, NULL);\r
-    if (StoredString == NULL) {\r
-      return FALSE;\r
-    }\r
-\r
-    //\r
-    // Already has save the same mac address to the list.\r
-    //\r
-    if (StrCmp (MacAddrString, StoredString) == 0) {\r
-      return FALSE;\r
-    }\r
-  }\r
-\r
-  PromptId = HiiSetString(HiiHandle, 0, MacAddrString, NULL);\r
-  //\r
-  // If not in the list, save it.\r
-  //\r
-  if (mMacDeviceList.MaxListLen > mMacDeviceList.CurListLen + 1) {\r
-    mMacDeviceList.NodeList[mMacDeviceList.CurListLen].PromptId = PromptId;\r
-    mMacDeviceList.NodeList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);\r
-  } else {\r
-    mMacDeviceList.MaxListLen += MAX_MAC_ADDRESS_NODE_LIST_LEN;\r
-    if (mMacDeviceList.CurListLen != 0) {\r
-      TempDeviceList = (MENU_INFO_ITEM *)AllocateCopyPool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen, (VOID *)mMacDeviceList.NodeList);\r
-    } else {\r
-      TempDeviceList = (MENU_INFO_ITEM *)AllocatePool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen);\r
-    }\r
-\r
-    if (TempDeviceList == NULL) {\r
-      return FALSE;\r
-    }\r
-    TempDeviceList[mMacDeviceList.CurListLen].PromptId = PromptId;  \r
-    TempDeviceList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);\r
-\r
-    if (mMacDeviceList.CurListLen > 0) {\r
-      FreePool(mMacDeviceList.NodeList);\r
-    }\r
-\r
-    mMacDeviceList.NodeList = TempDeviceList;\r
-  }\r
-  mMacDeviceList.CurListLen ++;\r
-\r
-  return TRUE;\r
-}\r
-\r
-/**\r
-  Check the devcie path, try to find whether it has mac address path.\r
-\r
-  In this function, first need to check whether this path has mac address path.\r
-  second, when the mac address device path has find, also need to deicide whether\r
-  need to add this mac address relate info to the menu.\r
-\r
-  @param    *Node            Input device which need to be check.\r
-  @param    NextShowFormId   FormId Which need to be show.\r
-  @param    *NeedAddItem     Whether need to add the menu in the network device list.\r
-\r
-  @retval  TRUE              Has mac address device path.\r
-  @retval  FALSE             NOT Has mac address device path.\r
-\r
-**/\r
-BOOLEAN\r
-IsMacAddressDevicePath (\r
-  IN  VOID          *Node,\r
-  IN EFI_FORM_ID    NextShowFormId,\r
-  OUT BOOLEAN       *NeedAddItem\r
-  )\r
-{\r
-  EFI_DEVICE_PATH_PROTOCOL   *DevicePath;\r
-  CHAR16                     *Buffer;\r
-  BOOLEAN                    ReturnVal;\r
-\r
-  ASSERT (Node != NULL);\r
-  *NeedAddItem = FALSE;\r
-  ReturnVal    = FALSE;\r
-  Buffer    = NULL;\r
-\r
-  DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;\r
-\r
-  //\r
-  // find the partition device path node\r
-  //\r
-  while (!IsDevicePathEnd (DevicePath)) {\r
-    if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
-       (DevicePathSubType (DevicePath) == MSG_MAC_ADDR_DP)) {\r
-      ReturnVal = TRUE;\r
-\r
-      if (DEVICE_MANAGER_FORM_ID == NextShowFormId) {\r
-        *NeedAddItem = TRUE;\r
-        break;\r
-      } \r
-      \r
-      if (!GetMacAddressString((MAC_ADDR_DEVICE_PATH*)DevicePath, &Buffer)) {\r
-        break;\r
-      }\r
-\r
-      if (NETWORK_DEVICE_FORM_ID == NextShowFormId) {\r
-        if (StrCmp (Buffer, mSelectedMacAddrString) == 0) {\r
-          *NeedAddItem = TRUE;\r
-        }\r
-        break;\r
-      }\r
-\r
-      if (NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId) {\r
-        //\r
-        // Same handle may has two network child handle, so the questionid \r
-        // has the offset of SAME_HANDLE_KEY_OFFSET.\r
-        //\r
-        if (AddIdToMacDeviceList (Buffer)) {\r
-          *NeedAddItem = TRUE;\r
-        }\r
-        break;\r
-      }\r
-    }\r
-    DevicePath = NextDevicePathNode (DevicePath);\r
-  }\r
-\r
-  if (Buffer != NULL) {\r
-    FreePool (Buffer);\r
-  }\r
-\r
-  return ReturnVal;\r
-}\r
-\r
-/**\r
-  Check to see if the device path is for the network device.\r
-\r
-  @param Handle          The HII handle which include the mac address device path.\r
-  @param NextShowFormId  The FormId of the form which will be show next time.\r
-  @param ItemCount       The new add Mac address item count.\r
-\r
-  @retval  TRUE          Need to add new item in the menu.\r
-  @return  FALSE         Do not need to add the menu about the network.\r
-\r
-**/\r
-BOOLEAN \r
-IsNeedAddNetworkMenu (\r
-  IN      EFI_HII_HANDLE      Handle,\r
-  IN      EFI_FORM_ID         NextShowFormId,\r
-  OUT     UINTN               *ItemCount\r
-  )\r
-{\r
-  EFI_STATUS     Status;\r
-  UINTN          EntryCount;\r
-  UINTN          Index;  \r
-  EFI_HII_HANDLE HiiDeviceManagerHandle;\r
-  EFI_HANDLE     DriverHandle;\r
-  EFI_HANDLE     ControllerHandle;\r
-  EFI_DEVICE_PATH_PROTOCOL   *DevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL   *TmpDevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL   *ChildDevicePath;\r
-  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY   *OpenInfoBuffer;\r
-  BOOLEAN        IsNeedAdd;\r
-\r
-  HiiDeviceManagerHandle = gDeviceManagerPrivate.HiiHandle;\r
-  IsNeedAdd  = FALSE;\r
-  OpenInfoBuffer = NULL;\r
-  if ((Handle == NULL) || (ItemCount == NULL)) {\r
-    return FALSE;\r
-  }\r
-  *ItemCount = 0;\r
-\r
-  Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);\r
-  if (EFI_ERROR (Status)) {\r
-    return FALSE;\r
-  }\r
-  //\r
-  // Get the device path by the got Driver handle .\r
-  //\r
-  Status = gBS->HandleProtocol (DriverHandle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePath);\r
-  if (EFI_ERROR (Status)) {\r
-    return FALSE;\r
-  }\r
-  TmpDevicePath = DevicePath;\r
-\r
-  // \r
-  // Check whether this device path include mac address device path.\r
-  // If this path has mac address path, get the value whether need \r
-  // add this info to the menu and return.\r
-  // Else check more about the child handle devcie path.\r
-  //\r
-  if (IsMacAddressDevicePath(TmpDevicePath, NextShowFormId,&IsNeedAdd)) {\r
-    if ((NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId) && IsNeedAdd) {\r
-      (*ItemCount) = 1;\r
-    }\r
-    return IsNeedAdd;\r
-  }\r
-\r
-  //\r
-  // Search whether this path is the controller path, not he child handle path.\r
-  // And the child handle has the network devcie connected.\r
-  //\r
-  TmpDevicePath = DevicePath;\r
-  Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &TmpDevicePath, &ControllerHandle);\r
-  if (EFI_ERROR (Status)) {\r
-    return FALSE;\r
-  }\r
-\r
-  if (!IsDevicePathEnd (TmpDevicePath)) {\r
-    return FALSE;    \r
-  }\r
-\r
-  //\r
-  // Retrieve the list of agents that are consuming the specific protocol\r
-  // on ControllerHandle.\r
-  // The buffer point by OpenInfoBuffer need be free at this function.\r
-  //\r
-  Status = gBS->OpenProtocolInformation (\r
-                  ControllerHandle,\r
-                  &gEfiPciIoProtocolGuid,\r
-                  &OpenInfoBuffer,\r
-                  &EntryCount\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return FALSE;\r
-  }\r
-\r
-  //\r
-  // Inspect if ChildHandle is one of the agents.\r
-  //\r
-  Status = EFI_UNSUPPORTED;\r
-  for (Index = 0; Index < EntryCount; Index++) {\r
-    //\r
-    // Query all the children created by the controller handle's driver\r
-    //\r
-    if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {\r
-      Status = gBS->OpenProtocol (\r
-                      OpenInfoBuffer[Index].ControllerHandle,\r
-                      &gEfiDevicePathProtocolGuid,\r
-                      (VOID **) &ChildDevicePath,\r
-                      NULL,\r
-                      NULL,\r
-                      EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                      );\r
-      if (EFI_ERROR (Status)) {\r
-        continue;\r
-      }\r
-\r
-      // \r
-      // Check whether this device path include mac address device path.\r
-      //\r
-      if (!IsMacAddressDevicePath(ChildDevicePath, NextShowFormId,&IsNeedAdd)) {\r
-        //\r
-        // If this path not has mac address path, check the other.\r
-        //\r
-        continue;\r
-      } else {\r
-        //\r
-        // If need to update the NETWORK_DEVICE_LIST_FORM, try to get more.\r
-        //\r
-        if ((NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId)) {\r
-          if (IsNeedAdd) {\r
-            (*ItemCount) += 1;\r
-          }\r
-          continue;\r
-        } else {\r
-          //\r
-          // If need to update other form, return whether need to add to the menu.\r
-          //          \r
-          goto Done;\r
-        }\r
-      }\r
-    }\r
-  }\r
-\r
-Done:\r
-  if (OpenInfoBuffer != NULL) {\r
-    FreePool (OpenInfoBuffer);  \r
-  }\r
-  return IsNeedAdd; \r
-}\r
-\r
-/**\r
-  Dynamic create Hii information for Device Manager.\r
-\r
-  @param   NextShowFormId     The FormId which need to be show.\r
-\r
-**/\r
-VOID\r
-CreateDeviceManagerForm(\r
-  IN EFI_FORM_ID      NextShowFormId\r
-)\r
-{\r
-  UINTN                       Index;\r
-  EFI_STRING                  String;\r
-  EFI_STRING_ID               Token;\r
-  EFI_STRING_ID               TokenHelp;\r
-  EFI_HII_HANDLE              *HiiHandles;\r
-  EFI_HII_HANDLE              HiiHandle;\r
-  EFI_GUID                    FormSetGuid;\r
-  VOID                        *StartOpCodeHandle;\r
-  VOID                        *EndOpCodeHandle;\r
-  EFI_IFR_GUID_LABEL          *StartLabel;\r
-  EFI_IFR_GUID_LABEL          *EndLabel;\r
-  BOOLEAN                     AddNetworkMenu;\r
-  UINTN                       AddItemCount;\r
-  UINTN                       NewStringLen;\r
-  EFI_STRING                  NewStringTitle;\r
-  CHAR16                      *DevicePathStr;\r
-  EFI_STRING_ID               DevicePathId;\r
-  EFI_IFR_FORM_SET            *Buffer;      \r
-  UINTN                       BufferSize;   \r
-  UINT8                       ClassGuidNum; \r
-  EFI_GUID                    *ClassGuid;   \r
-  UINTN                       TempSize;\r
-  UINT8                       *Ptr;\r
-  EFI_STATUS                  Status;\r
-\r
-  TempSize =0;\r
-  BufferSize = 0;\r
-  Buffer = NULL;\r
-\r
-  HiiHandle = gDeviceManagerPrivate.HiiHandle;\r
-  AddNetworkMenu = FALSE;\r
-  AddItemCount = 0;\r
-  //\r
-  // If need show the Network device list form, clear the old save list first.\r
-  //\r
-  if ((NextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) && (mMacDeviceList.CurListLen > 0)) {\r
-    mMacDeviceList.CurListLen = 0;\r
-  }\r
-\r
-  //\r
-  // Update the network device form titile.\r
-  //\r
-  if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {\r
-    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);\r
-    NewStringLen = StrLen(mSelectedMacAddrString) * 2;\r
-    NewStringLen += (StrLen(String) + 2) * 2;\r
-    NewStringTitle = AllocatePool (NewStringLen);\r
-    UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);\r
-    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);    \r
-    FreePool (String);\r
-    FreePool (NewStringTitle);\r
-  }\r
-\r
-  //\r
-  // Allocate space for creation of UpdateData Buffer\r
-  //\r
-  StartOpCodeHandle = HiiAllocateOpCodeHandle ();\r
-  ASSERT (StartOpCodeHandle != NULL);\r
-\r
-  EndOpCodeHandle = HiiAllocateOpCodeHandle ();\r
-  ASSERT (EndOpCodeHandle != NULL);\r
-\r
-  //\r
-  // Create Hii Extend Label OpCode as the start opcode\r
-  //\r
-  StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
-  StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
-  //\r
-  // According to the next show Form id(mNextShowFormId) to decide which form need to update.\r
-  //\r
-  StartLabel->Number       = (UINT16) (LABEL_FORM_ID_OFFSET + NextShowFormId);\r
-\r
-  //\r
-  // Create Hii Extend Label OpCode as the end opcode\r
-  //\r
-  EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
-  EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
-  EndLabel->Number       = LABEL_END;\r
-\r
-  //\r
-  // Get all the Hii handles\r
-  //\r
-  HiiHandles = HiiGetHiiHandles (NULL);\r
-  ASSERT (HiiHandles != NULL);\r
-\r
-  //\r
-  // Search for formset of each class type\r
-  //\r
-  for (Index = 0; HiiHandles[Index] != NULL; Index++) {\r
-    Status = HiiGetFormSetFromHiiHandle(HiiHandles[Index], &Buffer,&BufferSize);\r
-    if (EFI_ERROR (Status)){\r
-      continue;\r
-    }\r
-    Ptr = (UINT8 *)Buffer;\r
-    while(TempSize < BufferSize)  {\r
-      TempSize += ((EFI_IFR_OP_HEADER *) Ptr)->Length;\r
-      if (((EFI_IFR_OP_HEADER *) Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)){\r
-        Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;\r
-        continue;\r
-      } \r
-\r
-      ClassGuidNum = (UINT8) (((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);\r
-      ClassGuid = (EFI_GUID *) (VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));\r
-      while (ClassGuidNum-- > 0) {\r
-        if (CompareGuid (&gEfiHiiPlatformSetupFormsetGuid, ClassGuid)== 0) {\r
-          ClassGuid ++;\r
-          continue;\r
-        }\r
-\r
-        String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle, NULL);\r
-        if (String == NULL) {\r
-          String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);\r
-          ASSERT (String != NULL);\r
-        }\r
-        Token = HiiSetString (HiiHandle, 0, String, NULL);\r
-        FreePool (String);\r
-\r
-        String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->Help, NULL);\r
-        if (String == NULL) {\r
-          String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);\r
-          ASSERT (String != NULL);\r
-        }\r
-        TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);\r
-        FreePool (String);\r
-\r
-        FormSetGuid = ((EFI_IFR_FORM_SET *)Ptr)->Guid;\r
-\r
-        //\r
-        // Network device process\r
-        // \r
-        if (IsNeedAddNetworkMenu (HiiHandles[Index], NextShowFormId,&AddItemCount)) {\r
-          if (NextShowFormId == DEVICE_MANAGER_FORM_ID) {\r
-            //\r
-            // Only show one menu item "Network Config" in the device manger form.\r
-            //\r
-            if (!AddNetworkMenu) {\r
-              AddNetworkMenu = TRUE;\r
-              HiiCreateGotoOpCode (\r
-                StartOpCodeHandle,\r
-                NETWORK_DEVICE_LIST_FORM_ID,\r
-                STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_TITLE),\r
-                STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_HELP),\r
-                EFI_IFR_FLAG_CALLBACK,\r
-                (EFI_QUESTION_ID) QUESTION_NETWORK_DEVICE_ID\r
-              );\r
-            }\r
-          } else if (NextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) {\r
-            //\r
-            // In network device list form, same mac address device only show one menu.\r
-            //\r
-            while (AddItemCount > 0) {\r
-              HiiCreateGotoOpCode (\r
-                StartOpCodeHandle,\r
-                NETWORK_DEVICE_FORM_ID,\r
-                mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId,\r
-                STRING_TOKEN (STR_NETWORK_DEVICE_HELP),\r
-                EFI_IFR_FLAG_CALLBACK,\r
-                mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].QuestionId\r
-              );\r
-              AddItemCount -= 1;\r
-            }\r
-          } else if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {\r
-            //\r
-            // In network device form, only the selected mac address device need to be show.\r
-            //\r
-            DevicePathStr = DmExtractDevicePathFromHiiHandle(HiiHandles[Index]);\r
-            DevicePathId  = 0;\r
-            if (DevicePathStr != NULL){\r
-              DevicePathId =  HiiSetString (HiiHandle, 0, DevicePathStr, NULL);\r
-              FreePool(DevicePathStr);\r
-            }\r
-            HiiCreateGotoExOpCode (\r
-              StartOpCodeHandle,\r
-              0,\r
-              Token,\r
-              TokenHelp,\r
-              0,\r
-              (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),\r
-              0,\r
-              &FormSetGuid,    \r
-              DevicePathId\r
-            );\r
-          }\r
-        } else {\r
-          //\r
-          // Not network device process, only need to show at device manger form.\r
-          //\r
-          if (NextShowFormId == DEVICE_MANAGER_FORM_ID) {\r
-            DevicePathStr = DmExtractDevicePathFromHiiHandle(HiiHandles[Index]);\r
-            DevicePathId  = 0;\r
-            if (DevicePathStr != NULL){\r
-              DevicePathId =  HiiSetString (HiiHandle, 0, DevicePathStr, NULL);\r
-              FreePool(DevicePathStr);\r
-            }\r
-            HiiCreateGotoExOpCode (\r
-              StartOpCodeHandle,\r
-              0,\r
-              Token,\r
-              TokenHelp,\r
-              0,\r
-              (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),\r
-              0,\r
-              &FormSetGuid,\r
-              DevicePathId\r
-            );\r
-          }\r
-        }\r
-        break;\r
-      }\r
-\r
-      Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;\r
-    }\r
-    FreePool(Buffer);\r
-    Buffer = NULL;\r
-    TempSize = 0;\r
-    BufferSize = 0;\r
-  }\r
-\r
-  HiiUpdateForm (\r
-    HiiHandle,\r
-    &mDeviceManagerGuid,\r
-    NextShowFormId,\r
-    StartOpCodeHandle,\r
-    EndOpCodeHandle\r
-    );\r
-\r
-  HiiFreeOpCodeHandle (StartOpCodeHandle);\r
-  HiiFreeOpCodeHandle (EndOpCodeHandle);\r
-  FreePool (HiiHandles);\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
-\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 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
-DeviceManagerExtractConfig (\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
-  if (Progress == NULL || Results == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-  *Progress = Request;\r
-  return EFI_NOT_FOUND;\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 <ConfigResp> 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
-DeviceManagerRouteConfig (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  CONST EFI_STRING                       Configuration,\r
-  OUT EFI_STRING                             *Progress\r
-  )\r
-{\r
-  if (Configuration == NULL || Progress == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  *Progress = Configuration;\r
-\r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
-  This function is invoked if user selected a interactive opcode from Device Manager's\r
-  Formset. If user set VBIOS, the new value is saved to EFI variable.\r
-\r
-  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param Action          Specifies the type of action taken by the browser.\r
-  @param QuestionId      A unique value which is sent to the original exporting driver\r
-                         so that it can identify the type of data to expect.\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           The callback successfully handled the action.\r
-  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DeviceManagerCallback (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  EFI_BROWSER_ACTION                     Action,\r
-  IN  EFI_QUESTION_ID                        QuestionId,\r
-  IN  UINT8                                  Type,\r
-  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
-  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
-  )\r
-{\r
-  UINTN CurIndex;\r
-\r
-  if (Action != EFI_BROWSER_ACTION_CHANGING) {\r
-    //\r
-    // Do nothing for other UEFI Action. Only do call back when data is changed.\r
-    //\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-  if ((Value == NULL) || (ActionRequest == NULL)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-  if ((QuestionId < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET) && (QuestionId >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {\r
-    //\r
-    // If user select the mac address, need to record mac address string to support next form show.\r
-    //\r
-    for (CurIndex = 0; CurIndex < mMacDeviceList.CurListLen; CurIndex ++) {\r
-      if (mMacDeviceList.NodeList[CurIndex].QuestionId == QuestionId) {\r
-         mSelectedMacAddrString = HiiGetString (gDeviceManagerPrivate.HiiHandle, mMacDeviceList.NodeList[CurIndex].PromptId, NULL);\r
-      }\r
-    }\r
-    CreateDeviceManagerForm(NETWORK_DEVICE_FORM_ID);\r
-  } else if(QuestionId == QUESTION_NETWORK_DEVICE_ID){\r
-    CreateDeviceManagerForm(NETWORK_DEVICE_LIST_FORM_ID);\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Install Boot Manager Menu driver.\r
-\r
-  @param ImageHandle     The image handle.\r
-  @param SystemTable     The system table.\r
-\r
-  @retval  EFI_SUCEESS  Install Boot manager menu success.\r
-  @retval  Other        Return error status.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DeviceManagerLibConstructor (\r
-  IN EFI_HANDLE                            ImageHandle,\r
-  IN EFI_SYSTEM_TABLE                      *SystemTable\r
-)\r
-{\r
-  EFI_STATUS                  Status;\r
-\r
-  gDeviceManagerPrivate.DriverHandle = NULL;\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &gDeviceManagerPrivate.DriverHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  &mDeviceManagerHiiVendorDevicePath,\r
-                  &gEfiHiiConfigAccessProtocolGuid,\r
-                  &gDeviceManagerPrivate.ConfigAccess,\r
-                  NULL\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Publish our HII data.\r
-  //\r
-  gDeviceManagerPrivate.HiiHandle = HiiAddPackages (\r
-                  &mDeviceManagerGuid,\r
-                  gDeviceManagerPrivate.DriverHandle,\r
-                  DeviceManagerVfrBin,\r
-                  DeviceManagerLibStrings,\r
-                  NULL\r
-                  );\r
-  ASSERT (gDeviceManagerPrivate.HiiHandle != NULL);\r
-\r
-  //\r
-  // Update boot manager page \r
-  //\r
-  CreateDeviceManagerForm (DEVICE_MANAGER_FORM_ID);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Unloads the application and its installed protocol.\r
-\r
-  @param  ImageHandle     Handle that identifies the image to be unloaded.\r
-  @param  SystemTable     The system table.\r
-\r
-  @retval EFI_SUCCESS           The image has been unloaded.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DeviceManagerLibDestructor(\r
-  IN EFI_HANDLE                            ImageHandle,\r
-  IN EFI_SYSTEM_TABLE                      *SystemTable\r
-)\r
-{\r
-  EFI_STATUS                  Status;\r
-\r
-  Status = gBS->UninstallMultipleProtocolInterfaces (\r
-                  gDeviceManagerPrivate.DriverHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  &mDeviceManagerHiiVendorDevicePath,\r
-                  &gEfiHiiConfigAccessProtocolGuid,\r
-                  &gDeviceManagerPrivate.ConfigAccess,\r
-                  NULL\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  HiiRemovePackages (gDeviceManagerPrivate.HiiHandle);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
diff --git a/MdeModulePkg/Library/DeviceManagerLib/DeviceManager.h b/MdeModulePkg/Library/DeviceManagerLib/DeviceManager.h
deleted file mode 100644 (file)
index 88606ce..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/** @file\r
-The device manager reference implement\r
-\r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
-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 _DEVICE_MANAGER_H_\r
-#define _DEVICE_MANAGER_H_\r
-\r
-#include <Guid/MdeModuleHii.h>\r
-#include <Guid/HiiPlatformSetupFormset.h>\r
-\r
-#include <Protocol/HiiConfigAccess.h>\r
-#include <Protocol/PciIo.h>\r
-\r
-#include <Library/PrintLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/UefiHiiServicesLib.h>\r
-\r
-//\r
-// These are defined as the same with vfr file\r
-//\r
-#define DEVICE_MANAGER_FORMSET_GUID  \\r
-  { \\r
-  0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \\r
-  }\r
-\r
-#define LABEL_END                            0xffff\r
-#define LABEL_FORM_ID_OFFSET                 0x0100\r
-\r
-#define DEVICE_MANAGER_FORM_ID               0x1000\r
-#define NETWORK_DEVICE_LIST_FORM_ID          0x1001\r
-#define NETWORK_DEVICE_FORM_ID               0x1002\r
-#define DEVICE_KEY_OFFSET                    0x4000\r
-#define NETWORK_DEVICE_LIST_KEY_OFFSET       0x2000\r
-\r
-#define MAX_KEY_SECTION_LEN                  0x1000\r
-\r
-#define QUESTION_NETWORK_DEVICE_ID           0x3FFF\r
-//\r
-// These are the VFR compiler generated data representing our VFR data.\r
-//\r
-extern UINT8  DeviceManagerVfrBin[];\r
-\r
-#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE  SIGNATURE_32 ('D', 'M', 'C', 'B')\r
-\r
-///\r
-/// HII specific Vendor Device Path definition.\r
-///\r
-typedef struct {\r
-  VENDOR_DEVICE_PATH             VendorDevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL       End;\r
-} HII_VENDOR_DEVICE_PATH;\r
-\r
-typedef struct {\r
-  UINTN                           Signature;\r
-\r
-  ///\r
-  /// Device Manager HII relative handles\r
-  ///\r
-  EFI_HII_HANDLE                  HiiHandle;\r
-\r
-  EFI_HANDLE                      DriverHandle;\r
-\r
-  ///\r
-  /// Device Manager Produced protocols\r
-  ///\r
-  EFI_HII_CONFIG_ACCESS_PROTOCOL  ConfigAccess;\r
-\r
-  ///\r
-  /// Configuration data\r
-  ///\r
-  UINT8                           VideoBios;\r
-} DEVICE_MANAGER_CALLBACK_DATA;\r
-\r
-typedef struct {\r
-  EFI_STRING_ID    PromptId;\r
-  EFI_QUESTION_ID  QuestionId;\r
-}MENU_INFO_ITEM;\r
-\r
-typedef struct {\r
-  UINTN           CurListLen;\r
-  UINTN           MaxListLen;\r
-  MENU_INFO_ITEM  *NodeList;\r
-} MAC_ADDRESS_NODE_LIST;\r
-\r
-#define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \\r
-  CR (a, \\r
-      DEVICE_MANAGER_CALLBACK_DATA, \\r
-      ConfigAccess, \\r
-      DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \\r
-      )\r
-typedef struct {\r
-  EFI_STRING_ID  StringId;\r
-  UINT16         Class;\r
-} DEVICE_MANAGER_MENU_ITEM;\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
-\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 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
-DeviceManagerExtractConfig (\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
-/**\r
-  This function processes the results of changes in configuration.\r
-\r
-\r
-  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param Configuration   A null-terminated Unicode string in <ConfigResp> 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
-DeviceManagerRouteConfig (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  CONST EFI_STRING                       Configuration,\r
-  OUT EFI_STRING                             *Progress\r
-  );\r
-\r
-/**\r
-  This function is invoked if user selected a interactive opcode from Device Manager's\r
-  Formset. If user set VBIOS, the new value is saved to EFI variable.\r
-\r
-  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-  @param Action          Specifies the type of action taken by the browser.\r
-  @param QuestionId      A unique value which is sent to the original exporting driver\r
-                         so that it can identify the type of data to expect.\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           The callback successfully handled the action.\r
-  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DeviceManagerCallback (\r
-  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
-  IN  EFI_BROWSER_ACTION                     Action,\r
-  IN  EFI_QUESTION_ID                        QuestionId,\r
-  IN  UINT8                                  Type,\r
-  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
-  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
-  );\r
-\r
-#endif\r
diff --git a/MdeModulePkg/Library/DeviceManagerLib/DeviceManagerLib.inf b/MdeModulePkg/Library/DeviceManagerLib/DeviceManagerLib.inf
deleted file mode 100644 (file)
index 7baf566..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-## @file\r
-#  Device Manager Library used by UiApp\r
-#  \r
-#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
-#  This program and the accompanying materials are licensed and made available under\r
-#  the terms and conditions of the BSD License that accompanies this distribution.\r
-#  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
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = DeviceManagerLib\r
-  MODULE_UNI_FILE                = DeviceManagerLib.uni\r
-  FILE_GUID                      = 75EBDC2E-5323-4F31-A41D-FD1A7A9FC65E\r
-  MODULE_TYPE                    = DXE_DRIVER\r
-  VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = NULL|DXE_DRIVER UEFI_APPLICATION\r
-  CONSTRUCTOR                    = DeviceManagerLibConstructor\r
-  DESTRUCTOR                     = DeviceManagerLibDestructor\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]\r
-  DeviceManager.h\r
-  DeviceManagerVfr.Vfr\r
-  DeviceManagerStrings.uni\r
-  DeviceManager.c\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  MdeModulePkg/MdeModulePkg.dec\r
-\r
-[LibraryClasses]\r
-  DevicePathLib\r
-  BaseLib\r
-  MemoryAllocationLib\r
-  UefiBootServicesTableLib\r
-  BaseMemoryLib\r
-  DebugLib\r
-  PrintLib\r
-  HiiLib\r
-  UefiHiiServicesLib\r
-\r
-[Guids]\r
-  gEfiHiiPlatformSetupFormsetGuid               ## CONSUMES ## GUID (Indicate the formset class guid to be displayed)\r
-  gEfiIfrTianoGuid                              ## CONSUMES ## GUID (Extended IFR Guid Opcode)\r
-  gEfiIfrFrontPageGuid                          ## CONSUMES ## GUID (Indicate the formset in this library need to dispaly in which page)\r
-\r
-[Protocols]\r
-  gEfiHiiConfigAccessProtocolGuid               ## CONSUMES\r
diff --git a/MdeModulePkg/Library/DeviceManagerLib/DeviceManagerLib.uni b/MdeModulePkg/Library/DeviceManagerLib/DeviceManagerLib.uni
deleted file mode 100644 (file)
index 2b2fc64..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// /** @file\r
-// Device Manager Library used by UiApp\r
-//\r
-// Device Manager Library used by UiApp\r
-//\r
-// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
-//\r
-// This program and the accompanying materials are licensed and made available under\r
-// the terms and conditions of the BSD License that accompanies this distribution.\r
-// 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
-#string STR_MODULE_ABSTRACT\r
-#language en-US\r
-"Device Manager Library used by UiApp"\r
-\r
-#string STR_MODULE_DESCRIPTION\r
-#language en-US\r
-"Device Manager Library used by UiApp"\r
-\r
-\r
diff --git a/MdeModulePkg/Library/DeviceManagerLib/DeviceManagerStrings.uni b/MdeModulePkg/Library/DeviceManagerLib/DeviceManagerStrings.uni
deleted file mode 100644 (file)
index 061e4be..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-///** @file\r
-//\r
-//  String definitions for the Device Manager.\r
-//\r
-//  Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
-//  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
-\r
-#langdef   en-US "English"\r
-#langdef   fr-FR "Français"\r
-\r
-#string STR_EDKII_MENU_TITLE           #language en-US  "Device Manager"\r
-                                       #language fr-FR  "Device Manager"\r
-#string STR_EDKII_MENU_HELP            #language en-US  "This selection will take you to the Device Manager"\r
-                                       #language fr-FR  "This selection will take you to the Device Manager"\r
-#string STR_DEVICES_LIST               #language en-US  "Devices List"\r
-                                       #language fr-FR  "Devices List"\r
-#string STR_DISK_DEVICE                #language en-US  "Disk Devices"\r
-                                       #language fr-FR  "Disk Devices"\r
-#string STR_VIDEO_DEVICE               #language en-US  "Video Devices"\r
-                                       #language fr-FR  "Video Devices"\r
-#string STR_NETWORK_DEVICE             #language en-US  "Network Devices"\r
-                                       #language fr-FR  "Network Devices"\r
-#string STR_INPUT_DEVICE               #language en-US  "Input Devices"\r
-                                       #language fr-FR  "Input Devices"\r
-#string STR_ON_BOARD_DEVICE            #language en-US  "Motherboard Devices"\r
-                                       #language fr-FR  "Motherboard Devices"\r
-#string STR_OTHER_DEVICE               #language en-US  "Other Devices"\r
-                                       #language fr-FR  "Other Devices"\r
-#string STR_MISSING_STRING             #language en-US  "Missing String"\r
-                                       #language fr-FR  "Missing String"\r
-#string STR_EMPTY_STRING               #language en-US  ""\r
-                                       #language fr-FR  ""\r
-#string STR_EXIT_STRING                #language en-US  "Press ESC to exit."\r
-                                       #language fr-FR  "Press ESC to exit."\r
-#string STR_FORM_NETWORK_DEVICE_TITLE  #language en-US  "Network Device"\r
-                                       #language fr-FR  "Network Device"\r
-#string STR_FORM_NETWORK_DEVICE_HELP   #language en-US  "Network Device Help..."\r
-                                       #language fr-FR  "Network Device Help..."\r
-#string STR_NETWORK_DEVICE_STRING      #language en-US  "Network Device"\r
-                                       #language fr-FR  "Network Device"\r
-#string STR_FORM_NETWORK_DEVICE_LIST_HELP   #language en-US  "Select the network device according the MAC address"\r
-                                            #language fr-FR  "Select the network device according the MAC address"\r
-#string STR_FORM_NETWORK_DEVICE_LIST_TITLE  #language en-US  "Network Device List"\r
-                                            #language fr-FR  "Network Device List"\r
-#string STR_NETWORK_DEVICE_LIST_STRING      #language en-US  "Network Device List"\r
-                                            #language fr-FR  "Network Device List"\r
-#string STR_NETWORK_DEVICE_HELP             #language en-US  "Network Device"\r
-                                            #language fr-FR  "Network Device"\r
-//\r
-// Ensure that this is the last string.  We are using it programmatically\r
-// to do string token re-usage settings for the Device Manager since we are\r
-// constantly recreating this page based on HII population.\r
-////\r
diff --git a/MdeModulePkg/Library/DeviceManagerLib/DeviceManagerVfr.Vfr b/MdeModulePkg/Library/DeviceManagerLib/DeviceManagerVfr.Vfr
deleted file mode 100644 (file)
index f7b2080..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-///** @file\r
-//\r
-//  Device Manager formset.\r
-//\r
-//  Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
-//  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
-#define FORMSET_GUID  { 0x3ebfa8e6, 0x511d, 0x4b5b, 0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27 }\r
-\r
-#define LABEL_DEVICES_LIST                 0x1100\r
-#define LABEL_NETWORK_DEVICE_LIST_ID       0x1101\r
-#define LABEL_NETWORK_DEVICE_ID            0x1102\r
-#define LABEL_END                          0xffff\r
-\r
-#define DEVICE_MANAGER_FORM_ID             0x1000\r
-#define NETWORK_DEVICE_LIST_FORM_ID        0x1001\r
-#define NETWORK_DEVICE_FORM_ID             0x1002\r
-\r
-formset\r
-  guid      = FORMSET_GUID,\r
-  title     = STRING_TOKEN(STR_EDKII_MENU_TITLE),\r
-  help      = STRING_TOKEN(STR_EDKII_MENU_HELP),\r
-  classguid = gEfiIfrFrontPageGuid,\r
-\r
-  form formid = DEVICE_MANAGER_FORM_ID,\r
-    title  = STRING_TOKEN(STR_EDKII_MENU_TITLE);\r
-    subtitle text = STRING_TOKEN(STR_DEVICES_LIST);\r
-\r
-    label LABEL_DEVICES_LIST;\r
-    label LABEL_END;\r
-\r
-    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
-    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
-    subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
-  endform;\r
-\r
-  form formid = NETWORK_DEVICE_LIST_FORM_ID,\r
-    title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_LIST_TITLE);\r
-    subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_LIST_STRING);\r
-\r
-    label LABEL_NETWORK_DEVICE_LIST_ID;\r
-    label LABEL_END;\r
-\r
-    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
-    subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
-  endform;\r
-\r
-  form formid = NETWORK_DEVICE_FORM_ID,\r
-    title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_TITLE);\r
-    subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_STRING);\r
-\r
-    label LABEL_NETWORK_DEVICE_ID;\r
-    label LABEL_END;\r
-\r
-    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
-    subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
-  endform;\r
-endformset;
\ No newline at end of file
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
new file mode 100644 (file)
index 0000000..ba3f631
--- /dev/null
@@ -0,0 +1,925 @@
+/** @file\r
+The device manager reference implementation\r
+\r
+Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+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 "DeviceManager.h"\r
+\r
+DEVICE_MANAGER_CALLBACK_DATA  gDeviceManagerPrivate = {\r
+  DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE,\r
+  NULL,\r
+  NULL,\r
+  {\r
+    DeviceManagerExtractConfig,\r
+    DeviceManagerRouteConfig,\r
+    DeviceManagerCallback\r
+  }\r
+};\r
+\r
+#define  MAX_MAC_ADDRESS_NODE_LIST_LEN    10\r
+\r
+EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID;\r
+\r
+//\r
+// Which Mac Address string is select\r
+// it will decide what menu need to show in the NETWORK_DEVICE_FORM_ID form.\r
+//\r
+EFI_STRING  mSelectedMacAddrString;\r
+\r
+//\r
+// The Mac Address show in the NETWORK_DEVICE_LIST_FORM_ID\r
+//\r
+MAC_ADDRESS_NODE_LIST  mMacDeviceList;\r
+\r
+HII_VENDOR_DEVICE_PATH  mDeviceManagerHiiVendorDevicePath = {\r
+  {\r
+    {\r
+      HARDWARE_DEVICE_PATH,\r
+      HW_VENDOR_DP,\r
+      {\r
+        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
+        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
+      }\r
+    },\r
+    //\r
+    // {102579A0-3686-466e-ACD8-80C087044F4A}\r
+    //\r
+    { 0x102579a0, 0x3686, 0x466e, { 0xac, 0xd8, 0x80, 0xc0, 0x87, 0x4, 0x4f, 0x4a } }\r
+  },\r
+  {\r
+    END_DEVICE_PATH_TYPE,\r
+    END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
+    { \r
+      (UINT8) (END_DEVICE_PATH_LENGTH),\r
+      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
+    }\r
+  }\r
+};\r
+\r
+/**\r
+  Extract device path for given HII handle and class guid.\r
+\r
+  @param Handle          The HII handle.\r
+\r
+  @retval  NULL          Fail to get the device path string.\r
+  @return  PathString    Get the device path string.\r
+\r
+**/\r
+CHAR16 *\r
+DmExtractDevicePathFromHiiHandle (\r
+  IN      EFI_HII_HANDLE      Handle\r
+  )\r
+{\r
+  EFI_STATUS                       Status;\r
+  EFI_HANDLE                       DriverHandle;\r
+\r
+  ASSERT (Handle != NULL);\r
+\r
+  if (Handle == NULL) {\r
+    return NULL;\r
+  }\r
+\r
+  Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);\r
+  if (EFI_ERROR (Status)) {\r
+    return NULL;\r
+  }\r
+  //\r
+  // Get device path string.\r
+  //\r
+  return ConvertDevicePathToText(DevicePathFromHandle (DriverHandle), FALSE, FALSE);\r
+}\r
+\r
+/**\r
+  Get the mac address string from the device path.\r
+  if the device path has the vlan, get the vanid also.\r
+  \r
+  @param MacAddressNode              Device path begin with mac address \r
+  @param PBuffer                     Output string buffer contain mac address.\r
+\r
+**/\r
+BOOLEAN \r
+GetMacAddressString(\r
+  IN  MAC_ADDR_DEVICE_PATH   *MacAddressNode,\r
+  OUT CHAR16                 **PBuffer\r
+  )\r
+{\r
+  UINTN                 HwAddressSize;\r
+  UINTN                 Index;\r
+  UINT8                 *HwAddress;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Node;\r
+  UINT16                VlanId;\r
+  CHAR16                *String;\r
+  UINTN                 BufferLen;\r
+\r
+  VlanId = 0;\r
+  String = NULL;\r
+  ASSERT(MacAddressNode != NULL);\r
+\r
+  HwAddressSize = sizeof (EFI_MAC_ADDRESS);\r
+  if (MacAddressNode->IfType == 0x01 || MacAddressNode->IfType == 0x00) {\r
+    HwAddressSize = 6;\r
+  }\r
+\r
+  //\r
+  // The output format is MAC:XX:XX:XX:...\XXXX\r
+  // The size is the Number size + ":" size + Vlan size(\XXXX) + End\r
+  //\r
+  BufferLen = (4 + 2 * HwAddressSize + (HwAddressSize - 1) + 5 + 1) * sizeof (CHAR16);\r
+  String = AllocateZeroPool (BufferLen);\r
+  if (String == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  *PBuffer = String;\r
+  StrCpyS(String, BufferLen / sizeof (CHAR16), L"MAC:");\r
+  String += 4;\r
+  \r
+  //\r
+  // Convert the MAC address into a unicode string.\r
+  //\r
+  HwAddress = &MacAddressNode->MacAddress.Addr[0];\r
+  for (Index = 0; Index < HwAddressSize; Index++) {\r
+    String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(HwAddress++), 2);\r
+    if (Index < HwAddressSize - 1) {\r
+      *String++ = L':';\r
+    }\r
+  }\r
+\r
+  //\r
+  // If VLAN is configured, it will need extra 5 characters like "\0005".\r
+  // Plus one unicode character for the null-terminator.\r
+  //\r
+  Node = (EFI_DEVICE_PATH_PROTOCOL  *)MacAddressNode;\r
+  while (!IsDevicePathEnd (Node)) {\r
+    if (Node->Type == MESSAGING_DEVICE_PATH && Node->SubType == MSG_VLAN_DP) {\r
+      VlanId = ((VLAN_DEVICE_PATH *) Node)->VlanId;\r
+    }\r
+    Node = NextDevicePathNode (Node);\r
+  }\r
+\r
+  if (VlanId != 0) {\r
+    *String++ = L'\\';\r
+    String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, VlanId, 4);\r
+  }\r
+\r
+  //\r
+  // Null terminate the Unicode string\r
+  //\r
+  *String = L'\0';\r
+\r
+  return TRUE;\r
+}\r
+\r
+/**\r
+  Save question id and prompt id to the mac device list.\r
+  If the same mac address has saved yet, no need to add more.\r
+\r
+  @param MacAddrString               Mac address string.\r
+\r
+  @retval  EFI_SUCCESS               Add the item is successful.\r
+  @return  Other values if failed to Add the item.\r
+**/\r
+BOOLEAN \r
+AddIdToMacDeviceList (\r
+  IN  EFI_STRING        MacAddrString\r
+  )\r
+{\r
+  MENU_INFO_ITEM *TempDeviceList;\r
+  UINTN          Index;\r
+  EFI_STRING     StoredString;\r
+  EFI_STRING_ID  PromptId;\r
+  EFI_HII_HANDLE HiiHandle;\r
+\r
+  HiiHandle =   gDeviceManagerPrivate.HiiHandle;\r
+  TempDeviceList = NULL;\r
+\r
+  for (Index = 0; Index < mMacDeviceList.CurListLen; Index ++) {\r
+    StoredString = HiiGetString (HiiHandle, mMacDeviceList.NodeList[Index].PromptId, NULL);\r
+    if (StoredString == NULL) {\r
+      return FALSE;\r
+    }\r
+\r
+    //\r
+    // Already has save the same mac address to the list.\r
+    //\r
+    if (StrCmp (MacAddrString, StoredString) == 0) {\r
+      return FALSE;\r
+    }\r
+  }\r
+\r
+  PromptId = HiiSetString(HiiHandle, 0, MacAddrString, NULL);\r
+  //\r
+  // If not in the list, save it.\r
+  //\r
+  if (mMacDeviceList.MaxListLen > mMacDeviceList.CurListLen + 1) {\r
+    mMacDeviceList.NodeList[mMacDeviceList.CurListLen].PromptId = PromptId;\r
+    mMacDeviceList.NodeList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);\r
+  } else {\r
+    mMacDeviceList.MaxListLen += MAX_MAC_ADDRESS_NODE_LIST_LEN;\r
+    if (mMacDeviceList.CurListLen != 0) {\r
+      TempDeviceList = (MENU_INFO_ITEM *)AllocateCopyPool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen, (VOID *)mMacDeviceList.NodeList);\r
+    } else {\r
+      TempDeviceList = (MENU_INFO_ITEM *)AllocatePool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen);\r
+    }\r
+\r
+    if (TempDeviceList == NULL) {\r
+      return FALSE;\r
+    }\r
+    TempDeviceList[mMacDeviceList.CurListLen].PromptId = PromptId;  \r
+    TempDeviceList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);\r
+\r
+    if (mMacDeviceList.CurListLen > 0) {\r
+      FreePool(mMacDeviceList.NodeList);\r
+    }\r
+\r
+    mMacDeviceList.NodeList = TempDeviceList;\r
+  }\r
+  mMacDeviceList.CurListLen ++;\r
+\r
+  return TRUE;\r
+}\r
+\r
+/**\r
+  Check the devcie path, try to find whether it has mac address path.\r
+\r
+  In this function, first need to check whether this path has mac address path.\r
+  second, when the mac address device path has find, also need to deicide whether\r
+  need to add this mac address relate info to the menu.\r
+\r
+  @param    *Node            Input device which need to be check.\r
+  @param    NextShowFormId   FormId Which need to be show.\r
+  @param    *NeedAddItem     Whether need to add the menu in the network device list.\r
+\r
+  @retval  TRUE              Has mac address device path.\r
+  @retval  FALSE             NOT Has mac address device path.\r
+\r
+**/\r
+BOOLEAN\r
+IsMacAddressDevicePath (\r
+  IN  VOID          *Node,\r
+  IN EFI_FORM_ID    NextShowFormId,\r
+  OUT BOOLEAN       *NeedAddItem\r
+  )\r
+{\r
+  EFI_DEVICE_PATH_PROTOCOL   *DevicePath;\r
+  CHAR16                     *Buffer;\r
+  BOOLEAN                    ReturnVal;\r
+\r
+  ASSERT (Node != NULL);\r
+  *NeedAddItem = FALSE;\r
+  ReturnVal    = FALSE;\r
+  Buffer    = NULL;\r
+\r
+  DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;\r
+\r
+  //\r
+  // find the partition device path node\r
+  //\r
+  while (!IsDevicePathEnd (DevicePath)) {\r
+    if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
+       (DevicePathSubType (DevicePath) == MSG_MAC_ADDR_DP)) {\r
+      ReturnVal = TRUE;\r
+\r
+      if (DEVICE_MANAGER_FORM_ID == NextShowFormId) {\r
+        *NeedAddItem = TRUE;\r
+        break;\r
+      } \r
+      \r
+      if (!GetMacAddressString((MAC_ADDR_DEVICE_PATH*)DevicePath, &Buffer)) {\r
+        break;\r
+      }\r
+\r
+      if (NETWORK_DEVICE_FORM_ID == NextShowFormId) {\r
+        if (StrCmp (Buffer, mSelectedMacAddrString) == 0) {\r
+          *NeedAddItem = TRUE;\r
+        }\r
+        break;\r
+      }\r
+\r
+      if (NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId) {\r
+        //\r
+        // Same handle may has two network child handle, so the questionid \r
+        // has the offset of SAME_HANDLE_KEY_OFFSET.\r
+        //\r
+        if (AddIdToMacDeviceList (Buffer)) {\r
+          *NeedAddItem = TRUE;\r
+        }\r
+        break;\r
+      }\r
+    }\r
+    DevicePath = NextDevicePathNode (DevicePath);\r
+  }\r
+\r
+  if (Buffer != NULL) {\r
+    FreePool (Buffer);\r
+  }\r
+\r
+  return ReturnVal;\r
+}\r
+\r
+/**\r
+  Check to see if the device path is for the network device.\r
+\r
+  @param Handle          The HII handle which include the mac address device path.\r
+  @param NextShowFormId  The FormId of the form which will be show next time.\r
+  @param ItemCount       The new add Mac address item count.\r
+\r
+  @retval  TRUE          Need to add new item in the menu.\r
+  @return  FALSE         Do not need to add the menu about the network.\r
+\r
+**/\r
+BOOLEAN \r
+IsNeedAddNetworkMenu (\r
+  IN      EFI_HII_HANDLE      Handle,\r
+  IN      EFI_FORM_ID         NextShowFormId,\r
+  OUT     UINTN               *ItemCount\r
+  )\r
+{\r
+  EFI_STATUS     Status;\r
+  UINTN          EntryCount;\r
+  UINTN          Index;  \r
+  EFI_HII_HANDLE HiiDeviceManagerHandle;\r
+  EFI_HANDLE     DriverHandle;\r
+  EFI_HANDLE     ControllerHandle;\r
+  EFI_DEVICE_PATH_PROTOCOL   *DevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL   *TmpDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL   *ChildDevicePath;\r
+  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY   *OpenInfoBuffer;\r
+  BOOLEAN        IsNeedAdd;\r
+\r
+  HiiDeviceManagerHandle = gDeviceManagerPrivate.HiiHandle;\r
+  IsNeedAdd  = FALSE;\r
+  OpenInfoBuffer = NULL;\r
+  if ((Handle == NULL) || (ItemCount == NULL)) {\r
+    return FALSE;\r
+  }\r
+  *ItemCount = 0;\r
+\r
+  Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);\r
+  if (EFI_ERROR (Status)) {\r
+    return FALSE;\r
+  }\r
+  //\r
+  // Get the device path by the got Driver handle .\r
+  //\r
+  Status = gBS->HandleProtocol (DriverHandle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePath);\r
+  if (EFI_ERROR (Status)) {\r
+    return FALSE;\r
+  }\r
+  TmpDevicePath = DevicePath;\r
+\r
+  // \r
+  // Check whether this device path include mac address device path.\r
+  // If this path has mac address path, get the value whether need \r
+  // add this info to the menu and return.\r
+  // Else check more about the child handle devcie path.\r
+  //\r
+  if (IsMacAddressDevicePath(TmpDevicePath, NextShowFormId,&IsNeedAdd)) {\r
+    if ((NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId) && IsNeedAdd) {\r
+      (*ItemCount) = 1;\r
+    }\r
+    return IsNeedAdd;\r
+  }\r
+\r
+  //\r
+  // Search whether this path is the controller path, not he child handle path.\r
+  // And the child handle has the network devcie connected.\r
+  //\r
+  TmpDevicePath = DevicePath;\r
+  Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &TmpDevicePath, &ControllerHandle);\r
+  if (EFI_ERROR (Status)) {\r
+    return FALSE;\r
+  }\r
+\r
+  if (!IsDevicePathEnd (TmpDevicePath)) {\r
+    return FALSE;    \r
+  }\r
+\r
+  //\r
+  // Retrieve the list of agents that are consuming the specific protocol\r
+  // on ControllerHandle.\r
+  // The buffer point by OpenInfoBuffer need be free at this function.\r
+  //\r
+  Status = gBS->OpenProtocolInformation (\r
+                  ControllerHandle,\r
+                  &gEfiPciIoProtocolGuid,\r
+                  &OpenInfoBuffer,\r
+                  &EntryCount\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // Inspect if ChildHandle is one of the agents.\r
+  //\r
+  Status = EFI_UNSUPPORTED;\r
+  for (Index = 0; Index < EntryCount; Index++) {\r
+    //\r
+    // Query all the children created by the controller handle's driver\r
+    //\r
+    if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {\r
+      Status = gBS->OpenProtocol (\r
+                      OpenInfoBuffer[Index].ControllerHandle,\r
+                      &gEfiDevicePathProtocolGuid,\r
+                      (VOID **) &ChildDevicePath,\r
+                      NULL,\r
+                      NULL,\r
+                      EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                      );\r
+      if (EFI_ERROR (Status)) {\r
+        continue;\r
+      }\r
+\r
+      // \r
+      // Check whether this device path include mac address device path.\r
+      //\r
+      if (!IsMacAddressDevicePath(ChildDevicePath, NextShowFormId,&IsNeedAdd)) {\r
+        //\r
+        // If this path not has mac address path, check the other.\r
+        //\r
+        continue;\r
+      } else {\r
+        //\r
+        // If need to update the NETWORK_DEVICE_LIST_FORM, try to get more.\r
+        //\r
+        if ((NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId)) {\r
+          if (IsNeedAdd) {\r
+            (*ItemCount) += 1;\r
+          }\r
+          continue;\r
+        } else {\r
+          //\r
+          // If need to update other form, return whether need to add to the menu.\r
+          //          \r
+          goto Done;\r
+        }\r
+      }\r
+    }\r
+  }\r
+\r
+Done:\r
+  if (OpenInfoBuffer != NULL) {\r
+    FreePool (OpenInfoBuffer);  \r
+  }\r
+  return IsNeedAdd; \r
+}\r
+\r
+/**\r
+  Dynamic create Hii information for Device Manager.\r
+\r
+  @param   NextShowFormId     The FormId which need to be show.\r
+\r
+**/\r
+VOID\r
+CreateDeviceManagerForm(\r
+  IN EFI_FORM_ID      NextShowFormId\r
+)\r
+{\r
+  UINTN                       Index;\r
+  EFI_STRING                  String;\r
+  EFI_STRING_ID               Token;\r
+  EFI_STRING_ID               TokenHelp;\r
+  EFI_HII_HANDLE              *HiiHandles;\r
+  EFI_HII_HANDLE              HiiHandle;\r
+  EFI_GUID                    FormSetGuid;\r
+  VOID                        *StartOpCodeHandle;\r
+  VOID                        *EndOpCodeHandle;\r
+  EFI_IFR_GUID_LABEL          *StartLabel;\r
+  EFI_IFR_GUID_LABEL          *EndLabel;\r
+  BOOLEAN                     AddNetworkMenu;\r
+  UINTN                       AddItemCount;\r
+  UINTN                       NewStringLen;\r
+  EFI_STRING                  NewStringTitle;\r
+  CHAR16                      *DevicePathStr;\r
+  EFI_STRING_ID               DevicePathId;\r
+  EFI_IFR_FORM_SET            *Buffer;      \r
+  UINTN                       BufferSize;   \r
+  UINT8                       ClassGuidNum; \r
+  EFI_GUID                    *ClassGuid;   \r
+  UINTN                       TempSize;\r
+  UINT8                       *Ptr;\r
+  EFI_STATUS                  Status;\r
+\r
+  TempSize =0;\r
+  BufferSize = 0;\r
+  Buffer = NULL;\r
+\r
+  HiiHandle = gDeviceManagerPrivate.HiiHandle;\r
+  AddNetworkMenu = FALSE;\r
+  AddItemCount = 0;\r
+  //\r
+  // If need show the Network device list form, clear the old save list first.\r
+  //\r
+  if ((NextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) && (mMacDeviceList.CurListLen > 0)) {\r
+    mMacDeviceList.CurListLen = 0;\r
+  }\r
+\r
+  //\r
+  // Update the network device form titile.\r
+  //\r
+  if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {\r
+    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);\r
+    NewStringLen = StrLen(mSelectedMacAddrString) * 2;\r
+    NewStringLen += (StrLen(String) + 2) * 2;\r
+    NewStringTitle = AllocatePool (NewStringLen);\r
+    UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);\r
+    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);    \r
+    FreePool (String);\r
+    FreePool (NewStringTitle);\r
+  }\r
+\r
+  //\r
+  // Allocate space for creation of UpdateData Buffer\r
+  //\r
+  StartOpCodeHandle = HiiAllocateOpCodeHandle ();\r
+  ASSERT (StartOpCodeHandle != NULL);\r
+\r
+  EndOpCodeHandle = HiiAllocateOpCodeHandle ();\r
+  ASSERT (EndOpCodeHandle != NULL);\r
+\r
+  //\r
+  // Create Hii Extend Label OpCode as the start opcode\r
+  //\r
+  StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
+  StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
+  //\r
+  // According to the next show Form id(mNextShowFormId) to decide which form need to update.\r
+  //\r
+  StartLabel->Number       = (UINT16) (LABEL_FORM_ID_OFFSET + NextShowFormId);\r
+\r
+  //\r
+  // Create Hii Extend Label OpCode as the end opcode\r
+  //\r
+  EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
+  EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
+  EndLabel->Number       = LABEL_END;\r
+\r
+  //\r
+  // Get all the Hii handles\r
+  //\r
+  HiiHandles = HiiGetHiiHandles (NULL);\r
+  ASSERT (HiiHandles != NULL);\r
+\r
+  //\r
+  // Search for formset of each class type\r
+  //\r
+  for (Index = 0; HiiHandles[Index] != NULL; Index++) {\r
+    Status = HiiGetFormSetFromHiiHandle(HiiHandles[Index], &Buffer,&BufferSize);\r
+    if (EFI_ERROR (Status)){\r
+      continue;\r
+    }\r
+    Ptr = (UINT8 *)Buffer;\r
+    while(TempSize < BufferSize)  {\r
+      TempSize += ((EFI_IFR_OP_HEADER *) Ptr)->Length;\r
+      if (((EFI_IFR_OP_HEADER *) Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)){\r
+        Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;\r
+        continue;\r
+      } \r
+\r
+      ClassGuidNum = (UINT8) (((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);\r
+      ClassGuid = (EFI_GUID *) (VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));\r
+      while (ClassGuidNum-- > 0) {\r
+        if (CompareGuid (&gEfiHiiPlatformSetupFormsetGuid, ClassGuid)== 0) {\r
+          ClassGuid ++;\r
+          continue;\r
+        }\r
+\r
+        String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle, NULL);\r
+        if (String == NULL) {\r
+          String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);\r
+          ASSERT (String != NULL);\r
+        }\r
+        Token = HiiSetString (HiiHandle, 0, String, NULL);\r
+        FreePool (String);\r
+\r
+        String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->Help, NULL);\r
+        if (String == NULL) {\r
+          String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);\r
+          ASSERT (String != NULL);\r
+        }\r
+        TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);\r
+        FreePool (String);\r
+\r
+        FormSetGuid = ((EFI_IFR_FORM_SET *)Ptr)->Guid;\r
+\r
+        //\r
+        // Network device process\r
+        // \r
+        if (IsNeedAddNetworkMenu (HiiHandles[Index], NextShowFormId,&AddItemCount)) {\r
+          if (NextShowFormId == DEVICE_MANAGER_FORM_ID) {\r
+            //\r
+            // Only show one menu item "Network Config" in the device manger form.\r
+            //\r
+            if (!AddNetworkMenu) {\r
+              AddNetworkMenu = TRUE;\r
+              HiiCreateGotoOpCode (\r
+                StartOpCodeHandle,\r
+                NETWORK_DEVICE_LIST_FORM_ID,\r
+                STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_TITLE),\r
+                STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_HELP),\r
+                EFI_IFR_FLAG_CALLBACK,\r
+                (EFI_QUESTION_ID) QUESTION_NETWORK_DEVICE_ID\r
+              );\r
+            }\r
+          } else if (NextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) {\r
+            //\r
+            // In network device list form, same mac address device only show one menu.\r
+            //\r
+            while (AddItemCount > 0) {\r
+              HiiCreateGotoOpCode (\r
+                StartOpCodeHandle,\r
+                NETWORK_DEVICE_FORM_ID,\r
+                mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId,\r
+                STRING_TOKEN (STR_NETWORK_DEVICE_HELP),\r
+                EFI_IFR_FLAG_CALLBACK,\r
+                mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].QuestionId\r
+              );\r
+              AddItemCount -= 1;\r
+            }\r
+          } else if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {\r
+            //\r
+            // In network device form, only the selected mac address device need to be show.\r
+            //\r
+            DevicePathStr = DmExtractDevicePathFromHiiHandle(HiiHandles[Index]);\r
+            DevicePathId  = 0;\r
+            if (DevicePathStr != NULL){\r
+              DevicePathId =  HiiSetString (HiiHandle, 0, DevicePathStr, NULL);\r
+              FreePool(DevicePathStr);\r
+            }\r
+            HiiCreateGotoExOpCode (\r
+              StartOpCodeHandle,\r
+              0,\r
+              Token,\r
+              TokenHelp,\r
+              0,\r
+              (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),\r
+              0,\r
+              &FormSetGuid,    \r
+              DevicePathId\r
+            );\r
+          }\r
+        } else {\r
+          //\r
+          // Not network device process, only need to show at device manger form.\r
+          //\r
+          if (NextShowFormId == DEVICE_MANAGER_FORM_ID) {\r
+            DevicePathStr = DmExtractDevicePathFromHiiHandle(HiiHandles[Index]);\r
+            DevicePathId  = 0;\r
+            if (DevicePathStr != NULL){\r
+              DevicePathId =  HiiSetString (HiiHandle, 0, DevicePathStr, NULL);\r
+              FreePool(DevicePathStr);\r
+            }\r
+            HiiCreateGotoExOpCode (\r
+              StartOpCodeHandle,\r
+              0,\r
+              Token,\r
+              TokenHelp,\r
+              0,\r
+              (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),\r
+              0,\r
+              &FormSetGuid,\r
+              DevicePathId\r
+            );\r
+          }\r
+        }\r
+        break;\r
+      }\r
+\r
+      Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;\r
+    }\r
+    FreePool(Buffer);\r
+    Buffer = NULL;\r
+    TempSize = 0;\r
+    BufferSize = 0;\r
+  }\r
+\r
+  HiiUpdateForm (\r
+    HiiHandle,\r
+    &mDeviceManagerGuid,\r
+    NextShowFormId,\r
+    StartOpCodeHandle,\r
+    EndOpCodeHandle\r
+    );\r
+\r
+  HiiFreeOpCodeHandle (StartOpCodeHandle);\r
+  HiiFreeOpCodeHandle (EndOpCodeHandle);\r
+  FreePool (HiiHandles);\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
+\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 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
+DeviceManagerExtractConfig (\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
+  if (Progress == NULL || Results == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  *Progress = Request;\r
+  return EFI_NOT_FOUND;\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 <ConfigResp> 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
+DeviceManagerRouteConfig (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  CONST EFI_STRING                       Configuration,\r
+  OUT EFI_STRING                             *Progress\r
+  )\r
+{\r
+  if (Configuration == NULL || Progress == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  *Progress = Configuration;\r
+\r
+  return EFI_NOT_FOUND;\r
+}\r
+\r
+/**\r
+  This function is invoked if user selected a interactive opcode from Device Manager's\r
+  Formset. If user set VBIOS, the new value is saved to EFI variable.\r
+\r
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param Action          Specifies the type of action taken by the browser.\r
+  @param QuestionId      A unique value which is sent to the original exporting driver\r
+                         so that it can identify the type of data to expect.\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           The callback successfully handled the action.\r
+  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DeviceManagerCallback (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  EFI_BROWSER_ACTION                     Action,\r
+  IN  EFI_QUESTION_ID                        QuestionId,\r
+  IN  UINT8                                  Type,\r
+  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
+  )\r
+{\r
+  UINTN CurIndex;\r
+\r
+  if (Action != EFI_BROWSER_ACTION_CHANGING) {\r
+    //\r
+    // Do nothing for other UEFI Action. Only do call back when data is changed.\r
+    //\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+  if ((Value == NULL) || (ActionRequest == NULL)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  if ((QuestionId < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET) && (QuestionId >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {\r
+    //\r
+    // If user select the mac address, need to record mac address string to support next form show.\r
+    //\r
+    for (CurIndex = 0; CurIndex < mMacDeviceList.CurListLen; CurIndex ++) {\r
+      if (mMacDeviceList.NodeList[CurIndex].QuestionId == QuestionId) {\r
+         mSelectedMacAddrString = HiiGetString (gDeviceManagerPrivate.HiiHandle, mMacDeviceList.NodeList[CurIndex].PromptId, NULL);\r
+      }\r
+    }\r
+    CreateDeviceManagerForm(NETWORK_DEVICE_FORM_ID);\r
+  } else if(QuestionId == QUESTION_NETWORK_DEVICE_ID){\r
+    CreateDeviceManagerForm(NETWORK_DEVICE_LIST_FORM_ID);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Install Boot Manager Menu driver.\r
+\r
+  @param ImageHandle     The image handle.\r
+  @param SystemTable     The system table.\r
+\r
+  @retval  EFI_SUCEESS  Install Boot manager menu success.\r
+  @retval  Other        Return error status.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DeviceManagerLibConstructor (\r
+  IN EFI_HANDLE                            ImageHandle,\r
+  IN EFI_SYSTEM_TABLE                      *SystemTable\r
+)\r
+{\r
+  EFI_STATUS                  Status;\r
+\r
+  gDeviceManagerPrivate.DriverHandle = NULL;\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &gDeviceManagerPrivate.DriverHandle,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  &mDeviceManagerHiiVendorDevicePath,\r
+                  &gEfiHiiConfigAccessProtocolGuid,\r
+                  &gDeviceManagerPrivate.ConfigAccess,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  //\r
+  // Publish our HII data.\r
+  //\r
+  gDeviceManagerPrivate.HiiHandle = HiiAddPackages (\r
+                  &mDeviceManagerGuid,\r
+                  gDeviceManagerPrivate.DriverHandle,\r
+                  DeviceManagerVfrBin,\r
+                  DeviceManagerLibStrings,\r
+                  NULL\r
+                  );\r
+  ASSERT (gDeviceManagerPrivate.HiiHandle != NULL);\r
+\r
+  //\r
+  // Update boot manager page \r
+  //\r
+  CreateDeviceManagerForm (DEVICE_MANAGER_FORM_ID);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Unloads the application and its installed protocol.\r
+\r
+  @param  ImageHandle     Handle that identifies the image to be unloaded.\r
+  @param  SystemTable     The system table.\r
+\r
+  @retval EFI_SUCCESS           The image has been unloaded.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DeviceManagerLibDestructor(\r
+  IN EFI_HANDLE                            ImageHandle,\r
+  IN EFI_SYSTEM_TABLE                      *SystemTable\r
+)\r
+{\r
+  EFI_STATUS                  Status;\r
+\r
+  Status = gBS->UninstallMultipleProtocolInterfaces (\r
+                  gDeviceManagerPrivate.DriverHandle,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  &mDeviceManagerHiiVendorDevicePath,\r
+                  &gEfiHiiConfigAccessProtocolGuid,\r
+                  &gDeviceManagerPrivate.ConfigAccess,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  HiiRemovePackages (gDeviceManagerPrivate.HiiHandle);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h
new file mode 100644 (file)
index 0000000..88606ce
--- /dev/null
@@ -0,0 +1,194 @@
+/** @file\r
+The device manager reference implement\r
+\r
+Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+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 _DEVICE_MANAGER_H_\r
+#define _DEVICE_MANAGER_H_\r
+\r
+#include <Guid/MdeModuleHii.h>\r
+#include <Guid/HiiPlatformSetupFormset.h>\r
+\r
+#include <Protocol/HiiConfigAccess.h>\r
+#include <Protocol/PciIo.h>\r
+\r
+#include <Library/PrintLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/UefiHiiServicesLib.h>\r
+\r
+//\r
+// These are defined as the same with vfr file\r
+//\r
+#define DEVICE_MANAGER_FORMSET_GUID  \\r
+  { \\r
+  0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \\r
+  }\r
+\r
+#define LABEL_END                            0xffff\r
+#define LABEL_FORM_ID_OFFSET                 0x0100\r
+\r
+#define DEVICE_MANAGER_FORM_ID               0x1000\r
+#define NETWORK_DEVICE_LIST_FORM_ID          0x1001\r
+#define NETWORK_DEVICE_FORM_ID               0x1002\r
+#define DEVICE_KEY_OFFSET                    0x4000\r
+#define NETWORK_DEVICE_LIST_KEY_OFFSET       0x2000\r
+\r
+#define MAX_KEY_SECTION_LEN                  0x1000\r
+\r
+#define QUESTION_NETWORK_DEVICE_ID           0x3FFF\r
+//\r
+// These are the VFR compiler generated data representing our VFR data.\r
+//\r
+extern UINT8  DeviceManagerVfrBin[];\r
+\r
+#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE  SIGNATURE_32 ('D', 'M', 'C', 'B')\r
+\r
+///\r
+/// HII specific Vendor Device Path definition.\r
+///\r
+typedef struct {\r
+  VENDOR_DEVICE_PATH             VendorDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL       End;\r
+} HII_VENDOR_DEVICE_PATH;\r
+\r
+typedef struct {\r
+  UINTN                           Signature;\r
+\r
+  ///\r
+  /// Device Manager HII relative handles\r
+  ///\r
+  EFI_HII_HANDLE                  HiiHandle;\r
+\r
+  EFI_HANDLE                      DriverHandle;\r
+\r
+  ///\r
+  /// Device Manager Produced protocols\r
+  ///\r
+  EFI_HII_CONFIG_ACCESS_PROTOCOL  ConfigAccess;\r
+\r
+  ///\r
+  /// Configuration data\r
+  ///\r
+  UINT8                           VideoBios;\r
+} DEVICE_MANAGER_CALLBACK_DATA;\r
+\r
+typedef struct {\r
+  EFI_STRING_ID    PromptId;\r
+  EFI_QUESTION_ID  QuestionId;\r
+}MENU_INFO_ITEM;\r
+\r
+typedef struct {\r
+  UINTN           CurListLen;\r
+  UINTN           MaxListLen;\r
+  MENU_INFO_ITEM  *NodeList;\r
+} MAC_ADDRESS_NODE_LIST;\r
+\r
+#define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \\r
+  CR (a, \\r
+      DEVICE_MANAGER_CALLBACK_DATA, \\r
+      ConfigAccess, \\r
+      DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \\r
+      )\r
+typedef struct {\r
+  EFI_STRING_ID  StringId;\r
+  UINT16         Class;\r
+} DEVICE_MANAGER_MENU_ITEM;\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
+\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 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
+DeviceManagerExtractConfig (\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
+/**\r
+  This function processes the results of changes in configuration.\r
+\r
+\r
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param Configuration   A null-terminated Unicode string in <ConfigResp> 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
+DeviceManagerRouteConfig (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  CONST EFI_STRING                       Configuration,\r
+  OUT EFI_STRING                             *Progress\r
+  );\r
+\r
+/**\r
+  This function is invoked if user selected a interactive opcode from Device Manager's\r
+  Formset. If user set VBIOS, the new value is saved to EFI variable.\r
+\r
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param Action          Specifies the type of action taken by the browser.\r
+  @param QuestionId      A unique value which is sent to the original exporting driver\r
+                         so that it can identify the type of data to expect.\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           The callback successfully handled the action.\r
+  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DeviceManagerCallback (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  EFI_BROWSER_ACTION                     Action,\r
+  IN  EFI_QUESTION_ID                        QuestionId,\r
+  IN  UINT8                                  Type,\r
+  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
+  );\r
+\r
+#endif\r
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni
new file mode 100644 (file)
index 0000000..061e4be
--- /dev/null
@@ -0,0 +1,63 @@
+///** @file\r
+//\r
+//  String definitions for the Device Manager.\r
+//\r
+//  Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+//  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
+\r
+#langdef   en-US "English"\r
+#langdef   fr-FR "Français"\r
+\r
+#string STR_EDKII_MENU_TITLE           #language en-US  "Device Manager"\r
+                                       #language fr-FR  "Device Manager"\r
+#string STR_EDKII_MENU_HELP            #language en-US  "This selection will take you to the Device Manager"\r
+                                       #language fr-FR  "This selection will take you to the Device Manager"\r
+#string STR_DEVICES_LIST               #language en-US  "Devices List"\r
+                                       #language fr-FR  "Devices List"\r
+#string STR_DISK_DEVICE                #language en-US  "Disk Devices"\r
+                                       #language fr-FR  "Disk Devices"\r
+#string STR_VIDEO_DEVICE               #language en-US  "Video Devices"\r
+                                       #language fr-FR  "Video Devices"\r
+#string STR_NETWORK_DEVICE             #language en-US  "Network Devices"\r
+                                       #language fr-FR  "Network Devices"\r
+#string STR_INPUT_DEVICE               #language en-US  "Input Devices"\r
+                                       #language fr-FR  "Input Devices"\r
+#string STR_ON_BOARD_DEVICE            #language en-US  "Motherboard Devices"\r
+                                       #language fr-FR  "Motherboard Devices"\r
+#string STR_OTHER_DEVICE               #language en-US  "Other Devices"\r
+                                       #language fr-FR  "Other Devices"\r
+#string STR_MISSING_STRING             #language en-US  "Missing String"\r
+                                       #language fr-FR  "Missing String"\r
+#string STR_EMPTY_STRING               #language en-US  ""\r
+                                       #language fr-FR  ""\r
+#string STR_EXIT_STRING                #language en-US  "Press ESC to exit."\r
+                                       #language fr-FR  "Press ESC to exit."\r
+#string STR_FORM_NETWORK_DEVICE_TITLE  #language en-US  "Network Device"\r
+                                       #language fr-FR  "Network Device"\r
+#string STR_FORM_NETWORK_DEVICE_HELP   #language en-US  "Network Device Help..."\r
+                                       #language fr-FR  "Network Device Help..."\r
+#string STR_NETWORK_DEVICE_STRING      #language en-US  "Network Device"\r
+                                       #language fr-FR  "Network Device"\r
+#string STR_FORM_NETWORK_DEVICE_LIST_HELP   #language en-US  "Select the network device according the MAC address"\r
+                                            #language fr-FR  "Select the network device according the MAC address"\r
+#string STR_FORM_NETWORK_DEVICE_LIST_TITLE  #language en-US  "Network Device List"\r
+                                            #language fr-FR  "Network Device List"\r
+#string STR_NETWORK_DEVICE_LIST_STRING      #language en-US  "Network Device List"\r
+                                            #language fr-FR  "Network Device List"\r
+#string STR_NETWORK_DEVICE_HELP             #language en-US  "Network Device"\r
+                                            #language fr-FR  "Network Device"\r
+//\r
+// Ensure that this is the last string.  We are using it programmatically\r
+// to do string token re-usage settings for the Device Manager since we are\r
+// constantly recreating this page based on HII population.\r
+////\r
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
new file mode 100644 (file)
index 0000000..7baf566
--- /dev/null
@@ -0,0 +1,57 @@
+## @file\r
+#  Device Manager Library used by UiApp\r
+#  \r
+#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  This program and the accompanying materials are licensed and made available under\r
+#  the terms and conditions of the BSD License that accompanies this distribution.\r
+#  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
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = DeviceManagerLib\r
+  MODULE_UNI_FILE                = DeviceManagerLib.uni\r
+  FILE_GUID                      = 75EBDC2E-5323-4F31-A41D-FD1A7A9FC65E\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = NULL|DXE_DRIVER UEFI_APPLICATION\r
+  CONSTRUCTOR                    = DeviceManagerLibConstructor\r
+  DESTRUCTOR                     = DeviceManagerLibDestructor\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]\r
+  DeviceManager.h\r
+  DeviceManagerVfr.Vfr\r
+  DeviceManagerStrings.uni\r
+  DeviceManager.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+  DevicePathLib\r
+  BaseLib\r
+  MemoryAllocationLib\r
+  UefiBootServicesTableLib\r
+  BaseMemoryLib\r
+  DebugLib\r
+  PrintLib\r
+  HiiLib\r
+  UefiHiiServicesLib\r
+\r
+[Guids]\r
+  gEfiHiiPlatformSetupFormsetGuid               ## CONSUMES ## GUID (Indicate the formset class guid to be displayed)\r
+  gEfiIfrTianoGuid                              ## CONSUMES ## GUID (Extended IFR Guid Opcode)\r
+  gEfiIfrFrontPageGuid                          ## CONSUMES ## GUID (Indicate the formset in this library need to dispaly in which page)\r
+\r
+[Protocols]\r
+  gEfiHiiConfigAccessProtocolGuid               ## CONSUMES\r
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.uni b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.uni
new file mode 100644 (file)
index 0000000..2b2fc64
--- /dev/null
@@ -0,0 +1,26 @@
+// /** @file\r
+// Device Manager Library used by UiApp\r
+//\r
+// Device Manager Library used by UiApp\r
+//\r
+// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials are licensed and made available under\r
+// the terms and conditions of the BSD License that accompanies this distribution.\r
+// 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
+#string STR_MODULE_ABSTRACT\r
+#language en-US\r
+"Device Manager Library used by UiApp"\r
+\r
+#string STR_MODULE_DESCRIPTION\r
+#language en-US\r
+"Device Manager Library used by UiApp"\r
+\r
+\r
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerVfr.Vfr b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerVfr.Vfr
new file mode 100644 (file)
index 0000000..f7b2080
--- /dev/null
@@ -0,0 +1,66 @@
+///** @file\r
+//\r
+//  Device Manager formset.\r
+//\r
+//  Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+//  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
+#define FORMSET_GUID  { 0x3ebfa8e6, 0x511d, 0x4b5b, 0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27 }\r
+\r
+#define LABEL_DEVICES_LIST                 0x1100\r
+#define LABEL_NETWORK_DEVICE_LIST_ID       0x1101\r
+#define LABEL_NETWORK_DEVICE_ID            0x1102\r
+#define LABEL_END                          0xffff\r
+\r
+#define DEVICE_MANAGER_FORM_ID             0x1000\r
+#define NETWORK_DEVICE_LIST_FORM_ID        0x1001\r
+#define NETWORK_DEVICE_FORM_ID             0x1002\r
+\r
+formset\r
+  guid      = FORMSET_GUID,\r
+  title     = STRING_TOKEN(STR_EDKII_MENU_TITLE),\r
+  help      = STRING_TOKEN(STR_EDKII_MENU_HELP),\r
+  classguid = gEfiIfrFrontPageGuid,\r
+\r
+  form formid = DEVICE_MANAGER_FORM_ID,\r
+    title  = STRING_TOKEN(STR_EDKII_MENU_TITLE);\r
+    subtitle text = STRING_TOKEN(STR_DEVICES_LIST);\r
+\r
+    label LABEL_DEVICES_LIST;\r
+    label LABEL_END;\r
+\r
+    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
+    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
+    subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
+  endform;\r
+\r
+  form formid = NETWORK_DEVICE_LIST_FORM_ID,\r
+    title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_LIST_TITLE);\r
+    subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_LIST_STRING);\r
+\r
+    label LABEL_NETWORK_DEVICE_LIST_ID;\r
+    label LABEL_END;\r
+\r
+    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
+    subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
+  endform;\r
+\r
+  form formid = NETWORK_DEVICE_FORM_ID,\r
+    title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_TITLE);\r
+    subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_STRING);\r
+\r
+    label LABEL_NETWORK_DEVICE_ID;\r
+    label LABEL_END;\r
+\r
+    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
+    subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
+  endform;\r
+endformset;
\ No newline at end of file