]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine all R9 call back function to return EFI_UNSUPPORTED for all unsupported call...
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 20 May 2011 01:28:17 +0000 (01:28 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 20 May 2011 01:28:17 +0000 (01:28 +0000)
Signed-off-by: ydong10
Reviewed-by: lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11680 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c

index 24f57bd5dd10786ec22fb36822a558038a23a102..86820ca5dadb6f4094e43ae5a87efc594dc60ab8 100644 (file)
@@ -3,7 +3,7 @@
   by HII Thunk Modules. These Config access Protocols are used to thunk UEFI Config \r
   Access Callback to Framework HII Callback and EFI Variable Set/Get operations.\r
   \r
-Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2008 - 2011, 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
@@ -1107,132 +1107,131 @@ ThunkCallback (
   EFI_INPUT_KEY                               Key;  \r
   BOOLEAN                                     NvMapAllocated;\r
 \r
-  if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
-    //\r
-    // Ignore UEFI OPEN/CLOSE Action for FrameworkCallback\r
-    //\r
-    return EFI_SUCCESS;\r
-  }\r
+  if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
+    ASSERT (This != NULL);\r
+    ASSERT (Value != NULL);\r
+    ASSERT (ActionRequest != NULL);\r
 \r
-  ASSERT (This != NULL);\r
-  ASSERT (Value != NULL);\r
-  ASSERT (ActionRequest != NULL);\r
+    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
 \r
-  *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
+    ConfigAccess = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (This);\r
 \r
-  ConfigAccess = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (This);\r
+    FormCallbackProtocol = ConfigAccess->FormCallbackProtocol;\r
+    if (FormCallbackProtocol == NULL) {\r
+      ASSERT (FALSE);\r
+      return EFI_UNSUPPORTED;\r
+    }\r
 \r
-  FormCallbackProtocol = ConfigAccess->FormCallbackProtocol;\r
-  if (FormCallbackProtocol == NULL) {\r
-    ASSERT (FALSE);\r
-    return EFI_UNSUPPORTED;\r
-  }\r
+    //\r
+    // Check if the QuestionId match a OneOfOption.\r
+    //\r
+    OneOfOptionMapEntry = GetOneOfOptionMapEntry (ConfigAccess->ThunkContext, QuestionId, Type, Value);\r
 \r
-  //\r
-  // Check if the QuestionId match a OneOfOption.\r
-  //\r
-  OneOfOptionMapEntry = GetOneOfOptionMapEntry (ConfigAccess->ThunkContext, QuestionId, Type, Value);\r
+    if (OneOfOptionMapEntry == NULL) {\r
+      //\r
+      // This is not a One-Of-Option opcode. QuestionId is the KeyValue\r
+      //\r
+      KeyValue = QuestionId;\r
+    } else {\r
+      //\r
+      // Otherwise, use the original Key specified in One Of Option in the Framework VFR syntax.\r
+      //\r
+      KeyValue = OneOfOptionMapEntry->FwKey;\r
+    }\r
 \r
-  if (OneOfOptionMapEntry == NULL) {\r
     //\r
-    // This is not a One-Of-Option opcode. QuestionId is the KeyValue\r
+    // Build the EFI_IFR_DATA_ARRAY\r
     //\r
-    KeyValue = QuestionId;\r
-  } else {\r
+    Data = CreateIfrDataArray (ConfigAccess, QuestionId, Type, Value, &NvMapAllocated);\r
+\r
+    Status = mHiiDatabase->RegisterPackageNotify (\r
+                             mHiiDatabase,\r
+                             EFI_HII_PACKAGE_FORMS,\r
+                             NULL,\r
+                             FormUpdateNotify,\r
+                             EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,\r
+                             &NotifyHandle\r
+                             );\r
     //\r
-    // Otherwise, use the original Key specified in One Of Option in the Framework VFR syntax.\r
+    //Call the Framework Callback function.\r
     //\r
-    KeyValue = OneOfOptionMapEntry->FwKey;\r
-  }\r
-\r
-  //\r
-  // Build the EFI_IFR_DATA_ARRAY\r
-  //\r
-  Data = CreateIfrDataArray (ConfigAccess, QuestionId, Type, Value, &NvMapAllocated);\r
-\r
-  Status = mHiiDatabase->RegisterPackageNotify (\r
-                           mHiiDatabase,\r
-                           EFI_HII_PACKAGE_FORMS,\r
-                           NULL,\r
-                           FormUpdateNotify,\r
-                           EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,\r
-                           &NotifyHandle\r
-                           );\r
-  //\r
-  //Call the Framework Callback function.\r
-  //\r
-  Packet =  NULL;\r
-  Status =  FormCallbackProtocol->Callback (\r
-              FormCallbackProtocol,\r
-              KeyValue,\r
-              Data,\r
-              &Packet\r
-              );\r
-  SyncBrowserDataForNvMapOverride (ConfigAccess, QuestionId);\r
+    Packet =  NULL;\r
+    Status =  FormCallbackProtocol->Callback (\r
+                FormCallbackProtocol,\r
+                KeyValue,\r
+                Data,\r
+                &Packet\r
+                );\r
+    SyncBrowserDataForNvMapOverride (ConfigAccess, QuestionId);\r
 \r
-  //\r
-  // Callback require browser to perform action\r
-  //\r
-  if (EFI_ERROR (Status)) {\r
-    if (Packet != NULL) {\r
-      do {\r
-        CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, Packet->String, NULL);\r
-      } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
-    }\r
     //\r
-    // Error Code in Status is discarded.\r
+    // Callback require browser to perform action\r
     //\r
-  } else {\r
-    if (Packet != NULL) {\r
-        if (Packet->DataArray.EntryCount  == 1 && Packet->DataArray.NvRamMap == NULL) {\r
-          DataEntry = (EFI_IFR_DATA_ENTRY *) ((UINT8 *) Packet + sizeof (EFI_IFR_DATA_ARRAY));\r
-          if ((DataEntry->Flags & EXIT_REQUIRED) == EXIT_REQUIRED) {\r
-              *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
-          }\r
-\r
-          if ((DataEntry->Flags & SAVE_REQUIRED) == SAVE_REQUIRED) {\r
-            Status = ConfigAccess->ConfigAccessProtocol.RouteConfig (\r
-                                      &ConfigAccess->ConfigAccessProtocol,\r
-                                      NULL,\r
-                                      NULL\r
-                                      );\r
+    if (EFI_ERROR (Status)) {\r
+      if (Packet != NULL) {\r
+        do {\r
+          CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, Packet->String, NULL);\r
+        } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+      }\r
+      //\r
+      // Error Code in Status is discarded.\r
+      //\r
+    } else {\r
+      if (Packet != NULL) {\r
+          if (Packet->DataArray.EntryCount  == 1 && Packet->DataArray.NvRamMap == NULL) {\r
+            DataEntry = (EFI_IFR_DATA_ENTRY *) ((UINT8 *) Packet + sizeof (EFI_IFR_DATA_ARRAY));\r
+            if ((DataEntry->Flags & EXIT_REQUIRED) == EXIT_REQUIRED) {\r
+                *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+            }\r
+\r
+            if ((DataEntry->Flags & SAVE_REQUIRED) == SAVE_REQUIRED) {\r
+              Status = ConfigAccess->ConfigAccessProtocol.RouteConfig (\r
+                                        &ConfigAccess->ConfigAccessProtocol,\r
+                                        NULL,\r
+                                        NULL\r
+                                        );\r
+            }\r
           }\r
-        }\r
-        FreePool (Packet);\r
+          FreePool (Packet);\r
+      }\r
     }\r
-  }\r
 \r
-  //\r
-  // Unregister notify for Form package update\r
-  //\r
-  Status = mHiiDatabase->UnregisterPackageNotify (\r
-                           mHiiDatabase,\r
-                           NotifyHandle\r
-                           );\r
-  //\r
-  // UEFI SetupBrowser behaves differently with Framework SetupBrowser when call back function \r
-  // update any forms in HII database. UEFI SetupBrowser will re-parse the displaying form package and load\r
-  // the values from variable storages. Framework SetupBrowser will only re-parse the displaying form packages.\r
-  // To make sure customer's previous changes is saved and the changing question behaves as expected, we\r
-  // issue a EFI_BROWSER_ACTION_REQUEST_SUBMIT to ask UEFI SetupBrowser to save the changes proceed to re-parse\r
-  // the form and load all the variable storages.\r
-  //\r
-  if (*ActionRequest == EFI_BROWSER_ACTION_REQUEST_NONE && mHiiPackageListUpdated) {\r
-    mHiiPackageListUpdated= FALSE;\r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
-  } else {\r
-    if (ConfigAccess->ThunkContext->FormSet->SubClass == EFI_FRONT_PAGE_SUBCLASS ||\r
-        ConfigAccess->ThunkContext->FormSet->SubClass == EFI_SINGLE_USE_SUBCLASS) {\r
-      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+    //\r
+    // Unregister notify for Form package update\r
+    //\r
+    Status = mHiiDatabase->UnregisterPackageNotify (\r
+                             mHiiDatabase,\r
+                             NotifyHandle\r
+                             );\r
+    //\r
+    // UEFI SetupBrowser behaves differently with Framework SetupBrowser when call back function \r
+    // update any forms in HII database. UEFI SetupBrowser will re-parse the displaying form package and load\r
+    // the values from variable storages. Framework SetupBrowser will only re-parse the displaying form packages.\r
+    // To make sure customer's previous changes is saved and the changing question behaves as expected, we\r
+    // issue a EFI_BROWSER_ACTION_REQUEST_SUBMIT to ask UEFI SetupBrowser to save the changes proceed to re-parse\r
+    // the form and load all the variable storages.\r
+    //\r
+    if (*ActionRequest == EFI_BROWSER_ACTION_REQUEST_NONE && mHiiPackageListUpdated) {\r
+      mHiiPackageListUpdated= FALSE;\r
+      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
+    } else {\r
+      if (ConfigAccess->ThunkContext->FormSet->SubClass == EFI_FRONT_PAGE_SUBCLASS ||\r
+          ConfigAccess->ThunkContext->FormSet->SubClass == EFI_SINGLE_USE_SUBCLASS) {\r
+        *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+      }\r
     }\r
-  }\r
 \r
+    //\r
+    // Clean up.\r
+    //\r
+    DestroyIfrDataArray (Data, NvMapAllocated);\r
+\r
+    return Status;\r
+  }\r
 \r
   //\r
-  // Clean up.\r
+  // All other action return unsupported.\r
   //\r
-  DestroyIfrDataArray (Data, NvMapAllocated);\r
-  \r
-  return Status;\r
+  return EFI_UNSUPPORTED;\r
 }\r
 \r