]> git.proxmox.com Git - mirror_edk2.git/commitdiff
[BDS] Device Manager was requested to add more sub-level menu about network device.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Dec 2010 01:44:07 +0000 (01:44 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Dec 2010 01:44:07 +0000 (01:44 +0000)
Now show menu like:
Network Device List -> Mac:XX:XX:XX... -> IPv4 Network Config
                       Mac:XX:XX:XX...    VLAN Configuration

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

IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr

index 818a899d4dc20879bc6ce9fa986b31324d28758d..68c32cde4f5d3a8c4fa9c357c8fdd38e57d00ff0 100644 (file)
   gEfiSerialIoProtocolGuid                      ## PROTOCOL CONSUMES\r
   gEfiDevicePathProtocolGuid                    ## PROTOCOL CONSUMES\r
   gEfiDriverHealthProtocolGuid                  ## PROTOCOL SOMETIMES_CONSUMES\r
+  gEfiPciIoProtocolGuid                         ## PROTOCOL CONSUMES\r
 \r
 [FeaturePcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate\r
index 2e3d355a6d5b438a874e5bf3e080689b8f6b9aca..79c12b460729af4a70555a9f796409b4519c949c 100644 (file)
@@ -32,9 +32,27 @@ DEVICE_MANAGER_CALLBACK_DATA  gDeviceManagerPrivate = {
   }\r
 };\r
 \r
+#define  MAX_MAC_ADDRESS_NODE_LIST_LEN    10\r
+\r
 EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID;\r
 EFI_GUID mDriverHealthGuid = DRIVER_HEALTH_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
+// Which form Id need to be show.\r
+//\r
+EFI_FORM_ID      mNextShowFormId = DEVICE_MANAGER_FORM_ID;  \r
+\r
+//\r
+// The Mac Address show in the NETWORK_DEVICE_LIST_FORM_ID\r
+//\r
+MAC_ADDRESS_NODE_LIST  mMacDeviceList;\r
+\r
 DEVICE_MANAGER_MENU_ITEM  mDeviceManagerMenuItemTable[] = {\r
   { STRING_TOKEN (STR_DISK_DEVICE),     EFI_DISK_DEVICE_CLASS },\r
   { STRING_TOKEN (STR_VIDEO_DEVICE),    EFI_VIDEO_DEVICE_CLASS },\r
@@ -122,6 +140,8 @@ DeviceManagerCallback (
   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
   )\r
 {\r
+  UINTN CurIndex;\r
+  \r
   if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
     //\r
     // Do nothing for UEFI OPEN/CLOSE Action\r
@@ -135,6 +155,17 @@ DeviceManagerCallback (
 \r
   gCallbackKey = QuestionId;\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
+  }\r
+  \r
   //\r
   // Request to exit SendForm(), so as to switch to selected form\r
   //\r
@@ -181,6 +212,9 @@ InitializeDeviceManager (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  mMacDeviceList.CurListLen = 0;\r
+  mMacDeviceList.MaxListLen = 0;\r
+\r
   return Status;\r
 }\r
 \r
@@ -310,6 +344,379 @@ ExtractDisplayedHiiFormFromHiiHandle (
   return 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
+  StrCpy(String, 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 NewQuestionId               New question id.\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    *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
+  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 == mNextShowFormId) {\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 == mNextShowFormId) {\r
+        if (StrCmp (Buffer, mSelectedMacAddrString) == 0) {\r
+          *NeedAddItem = TRUE;\r
+        }\r
+        break;\r
+      }\r
+\r
+      if (NETWORK_DEVICE_LIST_FORM_ID == mNextShowFormId) {\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 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
+  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, &IsNeedAdd)) {\r
+    if ((NETWORK_DEVICE_LIST_FORM_ID == mNextShowFormId) && 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, &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 == mNextShowFormId)) {\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
   Call the browser and display the device manager to allow user\r
   to configure the platform.\r
@@ -343,12 +750,18 @@ CallDeviceManager (
   EFI_IFR_GUID_LABEL          *EndLabel;\r
   UINTN                       NumHandles;\r
   EFI_HANDLE                  *DriverHealthHandles;\r
+  BOOLEAN                     AddNetworkMenu;\r
+  UINTN                       AddItemCount;\r
+  UINTN                       NewStringLen;\r
+  EFI_STRING                  NewStringTitle;\r
 \r
   HiiHandles    = NULL;\r
   Status        = EFI_SUCCESS;\r
   gCallbackKey  = 0;\r
   NumHandles    = 0;\r
   DriverHealthHandles = NULL;\r
+  AddNetworkMenu = FALSE;\r
+  AddItemCount   = 0;\r
 \r
   //\r
   // Connect all prior to entering the platform setup menu.\r
@@ -378,8 +791,25 @@ CallDeviceManager (
   }\r
 \r
   //\r
-  // Create Subtitle OpCodes\r
+  // If need show the Network device list form, clear the old save list first.\r
+  //\r
+  if ((mNextShowFormId == 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 (mNextShowFormId == NETWORK_DEVICE_FORM_ID) {\r
+    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);\r
+    NewStringLen = (StrLen(String) + StrLen(mSelectedMacAddrString) + 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
@@ -394,7 +824,10 @@ CallDeviceManager (
   //\r
   StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
   StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
-  StartLabel->Number       = LABEL_DEVICES_LIST;\r
+  //\r
+  // According to the next show Form id(mNextShowFormId) to decide which form need to update.\r
+  //\r
+  StartLabel->Number       = LABEL_FORM_ID_OFFSET + mNextShowFormId;\r
 \r
   //\r
   // Create Hii Extend Label OpCode as the end opcode\r
@@ -403,8 +836,6 @@ CallDeviceManager (
   EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
   EndLabel->Number       = LABEL_END;\r
 \r
-  HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_DEVICES_LIST), 0, 0, 1);\r
-\r
   //\r
   // Get all the Hii handles\r
   //\r
@@ -415,6 +846,13 @@ CallDeviceManager (
   // Search for formset of each class type\r
   //\r
   for (Index = 0; HiiHandles[Index] != NULL; Index++) {\r
+    //\r
+    //  The QuestionId in the form which will call the driver form has this asssumption.\r
+    //  QuestionId = Handle Index + NETWORK_DEVICE_LIST_KEY_OFFSET;\r
+    //  Different QuestionId at least has the section of NETWORK_DEVICE_LIST_KEY_OFFSET.\r
+    //\r
+    ASSERT(Index < MAX_KEY_SECTION_LEN);\r
+\r
     if (!ExtractDisplayedHiiFormFromHiiHandle (HiiHandles[Index], &gEfiHiiPlatformSetupFormsetGuid, &FormSetTitle, &FormSetHelp)) {\r
       continue;\r
     }\r
@@ -435,21 +873,71 @@ CallDeviceManager (
     TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);\r
     FreePool (String);\r
 \r
-    HiiCreateActionOpCode (\r
-      StartOpCodeHandle,\r
-      (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),\r
-      Token,\r
-      TokenHelp,\r
-      EFI_IFR_FLAG_CALLBACK,\r
-      0\r
-      );\r
+    //\r
+    // Network device process\r
+    // \r
+    if (IsNeedAddNetworkMenu (HiiHandles[Index], &AddItemCount)) {\r
+      if (mNextShowFormId == 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
+          HiiCreateActionOpCode (\r
+            StartOpCodeHandle,\r
+            (EFI_QUESTION_ID) QUESTION_NETWORK_DEVICE_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
+            0\r
+            );\r
+        }\r
+      } else if (mNextShowFormId == 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
+            HiiCreateActionOpCode (\r
+              StartOpCodeHandle,\r
+              mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].QuestionId,\r
+              mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId,\r
+              STRING_TOKEN (STR_NETWORK_DEVICE_HELP),\r
+              EFI_IFR_FLAG_CALLBACK,\r
+              0\r
+              );\r
+            AddItemCount -= 1;\r
+          }\r
+      } else if (mNextShowFormId == NETWORK_DEVICE_FORM_ID) {\r
+        //\r
+        // In network device form, only the selected mac address device need to be show.\r
+        //\r
+        HiiCreateActionOpCode (\r
+          StartOpCodeHandle,\r
+          (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),\r
+          Token,\r
+          TokenHelp,\r
+          EFI_IFR_FLAG_CALLBACK,\r
+          0\r
+          );\r
+      }\r
+    } else {\r
+      //\r
+      // \r
+      // Not network device process, only need to show at device manger form.\r
+      //\r
+      if (mNextShowFormId == DEVICE_MANAGER_FORM_ID) {\r
+        HiiCreateActionOpCode (\r
+          StartOpCodeHandle,\r
+          (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),\r
+          Token,\r
+          TokenHelp,\r
+          EFI_IFR_FLAG_CALLBACK,\r
+          0\r
+          );\r
+      }\r
+    }\r
   }\r
 \r
-  //\r
-  // Add End Opcode for Subtitle\r
-  //\r
-  HiiCreateEndOpCode (StartOpCodeHandle);\r
-\r
   Status = gBS->LocateHandleBuffer (\r
                 ByProtocol,\r
                 &gEfiDriverHealthProtocolGuid,\r
@@ -494,7 +982,7 @@ CallDeviceManager (
   HiiUpdateForm (\r
     HiiHandle,\r
     &mDeviceManagerGuid,\r
-    DEVICE_MANAGER_FORM_ID,\r
+    mNextShowFormId,\r
     StartOpCodeHandle,\r
     EndOpCodeHandle\r
     );\r
@@ -505,7 +993,7 @@ CallDeviceManager (
                            &HiiHandle,\r
                            1,\r
                            &mDeviceManagerGuid,\r
-                           0,\r
+                           mNextShowFormId,\r
                            NULL,\r
                            &ActionRequest\r
                            );\r
@@ -514,10 +1002,10 @@ CallDeviceManager (
   }\r
 \r
   //\r
-  // We will have returned from processing a callback - user either hit ESC to exit, or selected\r
+  // We will have returned from processing a callback, selected\r
   // a target to display\r
   //\r
-  if ((gCallbackKey != 0) && (gCallbackKey != DEVICE_MANAGER_KEY_DRIVER_HEALTH)) {\r
+  if ((gCallbackKey >= DEVICE_KEY_OFFSET)) {\r
     ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
     Status = gFormBrowser2->SendForm (\r
                              gFormBrowser2,\r
@@ -537,6 +1025,7 @@ CallDeviceManager (
     // Force return to Device Manager\r
     //\r
     gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;\r
+    goto Done;\r
   }\r
 \r
   //\r
@@ -548,8 +1037,38 @@ CallDeviceManager (
     // Force return to Device Manager\r
     //\r
     gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;\r
+    goto Done;\r
+  }\r
+\r
+  //\r
+  // Enter from device manager and into the network device list.\r
+  //\r
+  if (gCallbackKey == QUESTION_NETWORK_DEVICE_ID) {\r
+    mNextShowFormId = NETWORK_DEVICE_LIST_FORM_ID;\r
+    gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;\r
+    goto Done;\r
+  }\r
+\r
+  //\r
+  // In this case, go from the network device list to the specify device.\r
+  //\r
+  if ((gCallbackKey < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET ) && (gCallbackKey >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {\r
+         mNextShowFormId = NETWORK_DEVICE_FORM_ID;\r
+    gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;\r
+    goto Done;\r
   }\r
 \r
+  //\r
+  // Select the ESC, the gCallbackKey == 0.\r
+  //\r
+  if(mNextShowFormId - 1 < DEVICE_MANAGER_FORM_ID) {\r
+    mNextShowFormId = DEVICE_MANAGER_FORM_ID;\r
+  } else {\r
+    mNextShowFormId = mNextShowFormId - 1;\r
+    gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;\r
+  }\r
+\r
+Done:\r
   //\r
   // Remove our packagelist from HII database.\r
   //\r
index 83c4d736d0ccfa69a0ecf208d9b160ba02e1f3e0..fc39b3c90788052c414d72f9f03d449d48c4d32d 100644 (file)
@@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "Bds.h"\r
 #include "FrontPage.h"\r
+#include <Protocol/PciIo.h>\r
 \r
 //\r
 // These are defined as the same with vfr file\r
@@ -31,8 +32,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   0xf76e0a70, 0xb5ed, 0x4c38, {0xac, 0x9a, 0xe5, 0xf5, 0x4b, 0xf1, 0x6e, 0x34} \\r
   }\r
 \r
-#define LABEL_DEVICES_LIST                   0x0080\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
+#define LABEL_FORM_ID_OFFSET                 0x0100\r
 \r
 #define LABEL_DRIVER_HEALTH                  0x2000\r
 #define LABEL_DRIVER_HEALTH_END              0x2001\r
@@ -43,16 +47,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define LABEL_VBIOS                          0x0040\r
 \r
 #define DEVICE_MANAGER_FORM_ID               0x1000\r
-#define DRIVER_HEALTH_FORM_ID                0x1001\r
-\r
-#define DEVICE_KEY_OFFSET                    0x1000\r
-#define DEVICE_MANAGER_KEY_VBIOS             0x2000\r
+#define NETWORK_DEVICE_LIST_FORM_ID          0x1001\r
+#define NETWORK_DEVICE_FORM_ID               0x1002\r
+#define DRIVER_HEALTH_FORM_ID                0x1003\r
+#define DEVICE_KEY_OFFSET                    0x4000\r
+#define NETWORK_DEVICE_LIST_KEY_OFFSET       0x2000\r
+#define DEVICE_MANAGER_KEY_VBIOS             0x3000\r
+#define MAX_KEY_SECTION_LEN                  0x1000\r
 \r
 #define DEVICE_MANAGER_KEY_DRIVER_HEALTH     0x1111\r
 #define DRIVER_HEALTH_KEY_OFFSET             0x2000\r
 #define DRIVER_HEALTH_REPAIR_ALL_KEY         0x3000\r
 #define DRIVER_HEALTH_RETURN_KEY             0x4000\r
 \r
+#define QUESTION_NETWORK_DEVICE_ID           0x3FFF\r
 //\r
 // These are the VFR compiler generated data representing our VFR data.\r
 //\r
@@ -124,6 +132,17 @@ typedef struct {
   EFI_DRIVER_HEALTH_STATUS        HealthStatus;\r
 } DRIVER_HEALTH_INFO;\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_HEALTH_INFO_FROM_LINK(a) \\r
   CR (a, \\r
       DRIVER_HEALTH_INFO, \\r
index 31571be5c697307d862194d68b646554f61661db..d9545a624e121dc127ed382b6886cd566c864bb7 100644 (file)
Binary files a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni and b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni differ
index 8414b8f0968411823f7637a4253cbdff3ad790ce..36ee573930fcd7655d87cdd4ce9080545ec0f0bc 100644 (file)
 #define EFI_ON_BOARD_DEVICE_CLASS          0x0010\r
 #define EFI_OTHER_DEVICE_CLASS             0x0020\r
 #define LABEL_VBIOS                        0x0040\r
-\r
-#define LABEL_DEVICES_LIST                 0x0080\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_CLASS               0x0000\r
 #define FRONT_PAGE_SUBCLASS                0x0003\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
 #define DEVICE_MANAGER_KEY_DRIVER_HEALTH   0x1111\r
 \r
@@ -44,6 +47,7 @@ formset
   form formid = DEVICE_MANAGER_FORM_ID,\r
        title  = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE);\r
 \r
+    subtitle text = STRING_TOKEN(STR_DEVICES_LIST);\r
     //\r
     // This is where devices get added to the device manager hierarchy\r
     //\r
@@ -76,5 +80,27 @@ formset
     subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
 \r
   endform;\r
+\r
+  form formid = NETWORK_DEVICE_LIST_FORM_ID,\r
+       title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_LIST_TITLE);\r
+\r
+    subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_LIST_STRING);\r
+\r
+       label LABEL_NETWORK_DEVICE_LIST_ID;\r
+       label LABEL_END;\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
+\r
+    subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_STRING);\r
+\r
+       label LABEL_NETWORK_DEVICE_ID;\r
+       label LABEL_END;\r
+       subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
+    subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
+  endform;\r
 endformset;\r
 \r