]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
Correct a typo: Change the type of the 4th parameter of EFI_DRIVER_HEALTH_PROTOCOL...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / DeviceMngr / DeviceManager.c
index 1857ffa0a1c93789eb3120db9f983e3a30e01f5e..14e71e3e52b803fb6913a7c992aa2457c27c0783 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The platform device manager reference implementation\r
 \r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, 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
@@ -34,9 +34,6 @@ DEVICE_MANAGER_CALLBACK_DATA  gDeviceManagerPrivate = {
 \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
@@ -72,10 +69,7 @@ HII_VENDOR_DEVICE_PATH  mDeviceManagerHiiVendorDevicePath = {
         (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
+    DEVICE_MANAGER_FORMSET_GUID\r
   },\r
   {\r
     END_DEVICE_PATH_TYPE,\r
@@ -97,10 +91,7 @@ HII_VENDOR_DEVICE_PATH  mDriverHealthHiiVendorDevicePath = {
           (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
       }\r
     },\r
-    //\r
-    // {D8F76651-1675-4986-BED4-3824B2F1F4C8}\r
-    //\r
-    { 0xd8f76651, 0x1675, 0x4986, { 0xbe, 0xd4, 0x38, 0x24, 0xb2, 0xf1, 0xf4, 0xc8 } }\r
+    DRIVER_HEALTH_FORMSET_GUID\r
   },\r
   {\r
     END_DEVICE_PATH_TYPE,\r
@@ -142,35 +133,30 @@ DeviceManagerCallback (
 {\r
   UINTN CurIndex;\r
 \r
-  if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
-    if ((Value == NULL) || (ActionRequest == NULL)) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-\r
-    gCallbackKey = QuestionId;\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
+  if (Action != EFI_BROWSER_ACTION_CHANGING) {\r
     //\r
-    // Request to exit SendForm(), so as to switch to selected form\r
+    // All other action return unsupported.\r
     //\r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+    return EFI_UNSUPPORTED;\r
+  }\r
 \r
-    return EFI_SUCCESS;\r
+  if (Value == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  //\r
-  // All other action return unsupported.\r
-  //\r
-  return EFI_UNSUPPORTED;\r
+  gCallbackKey = QuestionId;\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
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -588,7 +574,6 @@ IsNeedAddNetworkMenu (
   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
@@ -597,7 +582,6 @@ IsNeedAddNetworkMenu (
   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
@@ -775,7 +759,7 @@ CallDeviceManager (
     // Publish our HII data.\r
     //\r
     HiiHandle = HiiAddPackages (\r
-                  &mDeviceManagerGuid,\r
+                  &gDeviceManagerFormSetGuid,\r
                   gDeviceManagerPrivate.DriverHandle,\r
                   DeviceManagerVfrBin,\r
                   BdsDxeStrings,\r
@@ -884,7 +868,7 @@ CallDeviceManager (
           AddNetworkMenu = TRUE;\r
           HiiCreateGotoOpCode (\r
             StartOpCodeHandle,\r
-            DEVICE_MANAGER_FORM_ID,\r
+            INVALID_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
@@ -898,7 +882,7 @@ CallDeviceManager (
         while (AddItemCount > 0) {\r
             HiiCreateGotoOpCode (\r
               StartOpCodeHandle,\r
-              NETWORK_DEVICE_LIST_FORM_ID,\r
+              INVALID_FORM_ID,\r
               mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId,\r
               STRING_TOKEN (STR_NETWORK_DEVICE_HELP),\r
               EFI_IFR_FLAG_CALLBACK,\r
@@ -912,7 +896,7 @@ CallDeviceManager (
         //\r
         HiiCreateGotoOpCode (\r
           StartOpCodeHandle,\r
-          NETWORK_DEVICE_FORM_ID,\r
+          INVALID_FORM_ID,\r
           Token,\r
           TokenHelp,\r
           EFI_IFR_FLAG_CALLBACK,\r
@@ -927,7 +911,7 @@ CallDeviceManager (
       if (mNextShowFormId == DEVICE_MANAGER_FORM_ID) {\r
         HiiCreateGotoOpCode (\r
           StartOpCodeHandle,\r
-          DEVICE_MANAGER_FORM_ID,\r
+          INVALID_FORM_ID,\r
           Token,\r
           TokenHelp,\r
           EFI_IFR_FLAG_CALLBACK,\r
@@ -980,7 +964,7 @@ CallDeviceManager (
 \r
   HiiUpdateForm (\r
     HiiHandle,\r
-    &mDeviceManagerGuid,\r
+    &gDeviceManagerFormSetGuid,\r
     mNextShowFormId,\r
     StartOpCodeHandle,\r
     EndOpCodeHandle\r
@@ -991,7 +975,7 @@ CallDeviceManager (
                            gFormBrowser2,\r
                            &HiiHandle,\r
                            1,\r
-                           &mDeviceManagerGuid,\r
+                           &gDeviceManagerFormSetGuid,\r
                            mNextShowFormId,\r
                            NULL,\r
                            &ActionRequest\r
@@ -1108,7 +1092,7 @@ DriverHealthCallback (
   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
   )\r
 {\r
-  if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
+  if (Action == EFI_BROWSER_ACTION_CHANGED) {\r
     if ((Value == NULL) || (ActionRequest == NULL)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
@@ -1166,11 +1150,9 @@ CallDriverHealth (
   DRIVER_HEALTH_INFO          *DriverHealthInfo;\r
   LIST_ENTRY                  *Link;\r
   EFI_DEVICE_PATH_PROTOCOL    *DriverDevicePath;\r
-  UINTN                       Length;\r
   BOOLEAN                     RebootRequired;\r
 \r
   Index               = 0;\r
-  Length              = 0;\r
   DriverHealthInfo    = NULL;  \r
   DriverDevicePath    = NULL;\r
   InitializeListHead (&DriverHealthList);\r
@@ -1181,7 +1163,7 @@ CallDriverHealth (
     // Publish Driver Health HII data.\r
     //\r
     HiiHandle = HiiAddPackages (\r
-                  &mDeviceManagerGuid,\r
+                  &gDeviceManagerFormSetGuid,\r
                   gDeviceManagerPrivate.DriverHealthHandle,\r
                   DriverHealthVfrBin,\r
                   BdsDxeStrings,\r
@@ -1379,7 +1361,7 @@ CallDriverHealth (
 \r
   Status = HiiUpdateForm (\r
              HiiHandle,\r
-             &mDriverHealthGuid,\r
+             &gDriverHealthFormSetGuid,\r
              DRIVER_HEALTH_FORM_ID,\r
              StartOpCodeHandle,\r
              EndOpCodeHandle\r
@@ -1389,7 +1371,7 @@ CallDriverHealth (
 \r
   Status = HiiUpdateForm (\r
             HiiHandle,\r
-            &mDriverHealthGuid,\r
+            &gDriverHealthFormSetGuid,\r
             DRIVER_HEALTH_FORM_ID,\r
             StartOpCodeHandleRepair,\r
             EndOpCodeHandleRepair\r
@@ -1402,7 +1384,7 @@ CallDriverHealth (
                            gFormBrowser2,\r
                            &HiiHandle,\r
                            1,\r
-                           &mDriverHealthGuid,\r
+                           &gDriverHealthFormSetGuid,\r
                            DRIVER_HEALTH_FORM_ID,\r
                            NULL,\r
                            &ActionRequest\r
@@ -1961,7 +1943,7 @@ ProcessSingleControllerHealth (
                                DriverHealth,\r
                                ControllerHandle,\r
                                ChildHandle,\r
-                               (EFI_DRIVER_HEALTH_REPAIR_PROGRESS_NOTIFY) RepairNotify\r
+                               RepairNotify\r
                                );\r
     }\r
     //\r
@@ -2037,24 +2019,20 @@ ProcessSingleControllerHealth (
 \r
 \r
 /**\r
-  Platform specific notification function for controller repair operations.\r
-\r
-  If the driver for a controller support the Driver Health Protocol and the\r
-  current state of the controller is EfiDriverHealthStatusRepairRequired then\r
-  when the Repair() service of the Driver Health Protocol is called, this \r
-  platform specific notification function can display the progress of the repair\r
-  operation.  Some platforms may choose to not display anything, other may choose\r
-  to show the percentage complete on text consoles, and other may choose to render\r
-  a progress bar on text and graphical consoles.\r
-\r
-  This function displays the percentage of the repair operation that has been\r
-  completed on text consoles.  The percentage is Value / Limit * 100%.\r
-  \r
-  @param  Value               Value in the range 0..Limit the the repair has completed..\r
-  @param  Limit               The maximum value of Value\r
+  Reports the progress of a repair operation.\r
+\r
+  @param[in]  Value             A value between 0 and Limit that identifies the current \r
+                                progress of the repair operation.\r
+\r
+  @param[in]  Limit             The maximum value of Value for the current repair operation.\r
+                                For example, a driver that wants to specify progress in \r
+                                percent would use a Limit value of 100.\r
+\r
+  @retval EFI_SUCCESS           The progress of a repair operation is reported successfully.\r
 \r
 **/\r
-VOID\r
+EFI_STATUS\r
+EFIAPI\r
 RepairNotify (\r
   IN  UINTN Value,\r
   IN  UINTN Limit\r
@@ -2068,6 +2046,7 @@ RepairNotify (
     Percent = Value * 100 / Limit;\r
     Print(L"Repair Progress = %3d%%\n\r", Percent);\r
   }\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -2185,7 +2164,7 @@ DriverHealthSelectBestLanguage (
   CHAR8           *LanguageVariable;\r
   CHAR8           *BestLanguage;\r
 \r
-  LanguageVariable =  GetEfiGlobalVariable (Iso639Language ? L"Lang" : L"PlatformLang");\r
+  GetEfiGlobalVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", (VOID**)&LanguageVariable, NULL);\r
 \r
   BestLanguage = GetBestLanguage(\r
                    SupportedLanguages,\r