]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/BdsDxe/FrontPage.c
Fix a typo in Pcd name
[mirror_edk2.git] / MdeModulePkg / Universal / BdsDxe / FrontPage.c
index 3151aeb1a5799c936e5bcbce2400e24601869ab6..3eb4a53ff1ad9cf776df3de966795c363a2137cb 100644 (file)
@@ -37,6 +37,28 @@ FRONT_PAGE_CALLBACK_DATA  gFrontPagePrivate = {
   }\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 NULL, illegal syntax, or unknown name.\r
+  @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 FakeExtractConfig (\r
@@ -45,35 +67,26 @@ FakeExtractConfig (
   OUT EFI_STRING                             *Progress,\r
   OUT EFI_STRING                             *Results\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    This function allows a caller to extract the current configuration for one\r
-    or more named elements from the target driver.\r
-\r
-  Arguments:\r
-    This       - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-    Request    - A null-terminated Unicode string in <ConfigRequest> format.\r
-    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
-    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
-  Returns:\r
-    EFI_SUCCESS           - The Results is filled with the requested values.\r
-    EFI_OUT_OF_RESOURCES  - Not enough memory to store the results.\r
-    EFI_INVALID_PARAMETER - Request is NULL, illegal syntax, or unknown name.\r
-    EFI_NOT_FOUND         - Routing data doesn't match any storage in this driver.\r
-\r
---*/\r
 {\r
   return EFI_NOT_FOUND;\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
 FakeRouteConfig (\r
@@ -81,29 +94,28 @@ FakeRouteConfig (
   IN  CONST EFI_STRING                       Configuration,\r
   OUT EFI_STRING                             *Progress\r
   )\r
-/*++\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
 \r
-  Routine Description:\r
-    This function processes the results of changes in configuration.\r
+/**\r
+  This function processes the results of changes in configuration.\r
 \r
-  Arguments:\r
-    This          - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-    Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
-    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
-  Returns:\r
-    EFI_SUCCESS           - The Results is processed successfully.\r
-    EFI_INVALID_PARAMETER - Configuration is NULL.\r
-    EFI_NOT_FOUND         - Routing data doesn't match any storage in this driver.\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
---*/\r
-{\r
-  return EFI_SUCCESS;\r
-}\r
+  @retval  EFI_SUCCESS           The callback successfully handled the action.\r
+  @retval  EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the variable and its data.\r
+  @retval  EFI_DEVICE_ERROR      The variable could not be saved.\r
+  @retval  EFI_UNSUPPORTED       The specified Action is not supported by the callback.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 FrontPageCallback (\r
@@ -114,34 +126,11 @@ FrontPageCallback (
   IN  EFI_IFR_TYPE_VALUE                     *Value,\r
   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    This function processes the results of changes in configuration.\r
-\r
-  Arguments:\r
-    This          - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-    Action        - Specifies the type of action taken by the browser.\r
-    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
-    Type          - The type of value for the question.\r
-    Value         - A pointer to the data being sent to the original exporting driver.\r
-    ActionRequest - On return, points to the action requested by the callback function.\r
-\r
-  Returns:\r
-    EFI_SUCCESS          - The callback successfully handled the action.\r
-    EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.\r
-    EFI_DEVICE_ERROR     - The variable could not be saved.\r
-    EFI_UNSUPPORTED      - The specified Action is not supported by the callback.\r
-\r
---*/\r
 {\r
   CHAR8                         *LanguageString;\r
   CHAR8                         *LangCode;\r
   CHAR8                         Lang[RFC_3066_ENTRY_SIZE];\r
-#ifdef LANG_SUPPORT\r
   CHAR8                         OldLang[ISO_639_2_ENTRY_SIZE];\r
-#endif\r
   UINTN                         Index;\r
   EFI_STATUS                    Status;\r
 \r
@@ -190,21 +179,21 @@ FrontPageCallback (
                     Lang\r
                     );\r
 \r
-#ifdef LANG_SUPPORT\r
-    //\r
-    // Set UEFI deprecated variable "Lang" for backwards compatibility\r
-    //\r
-    Status = ConvertRfc3066LanguageToIso639Language (Lang, OldLang);\r
-    if (!EFI_ERROR (Status)) {\r
-      Status = gRT->SetVariable (\r
-                      L"Lang",\r
-                      &gEfiGlobalVariableGuid,\r
-                      EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-                      ISO_639_2_ENTRY_SIZE,\r
-                      OldLang\r
-                      );\r
+    if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) {\r
+      //\r
+      // Set UEFI deprecated variable "Lang" for backwards compatibility\r
+      //\r
+      Status = ConvertRfc3066LanguageToIso639Language (Lang, OldLang);\r
+      if (!EFI_ERROR (Status)) {\r
+        Status = gRT->SetVariable (\r
+                        L"Lang",\r
+                        &gEfiGlobalVariableGuid,\r
+                        EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+                        ISO_639_2_ENTRY_SIZE,\r
+                        OldLang\r
+                        );\r
+      }\r
     }\r
-#endif\r
 \r
     FreePool (LanguageString);\r
     break;\r
@@ -237,23 +226,20 @@ FrontPageCallback (
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-InitializeFrontPage (\r
-  BOOLEAN                         ReInitializeStrings\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
   Initialize HII information for the FrontPage\r
 \r
-Arguments:\r
-  None\r
 \r
-Returns:\r
-  EFI_SUCCESS       - The operation is successful.\r
-  EFI_DEVICE_ERROR  - If the dynamic opcode creation failed.\r
+  @param InitializeHiiData    TRUE if HII elements need to be initialized.\r
 \r
---*/\r
+  @retval  EFI_SUCCESS        The operation is successful.\r
+  @retval  EFI_DEVICE_ERROR   If the dynamic opcode creation failed.\r
+\r
+**/\r
+EFI_STATUS\r
+InitializeFrontPage (\r
+  IN BOOLEAN                         InitializeHiiData\r
+  )\r
 {\r
   EFI_STATUS                  Status;\r
   EFI_HII_PACKAGE_LIST_HEADER *PackageList;\r
@@ -270,7 +256,7 @@ Returns:
   UINTN                       Index;\r
   EFI_HII_HANDLE              HiiHandle;\r
 \r
-  if (!ReInitializeStrings) {\r
+  if (InitializeHiiData) {\r
     //\r
     // Initialize the Device Manager\r
     //\r
@@ -458,21 +444,17 @@ Returns:
   return Status;\r
 }\r
 \r
+/**\r
+  Call the browser and display the front page\r
+\r
+  @return   Status code that will be returned by\r
+            EFI_FORM_BROWSER2_PROTOCOL.SendForm ().\r
+\r
+**/\r
 EFI_STATUS\r
 CallFrontPage (\r
   VOID\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Call the browser and display the front page\r
-\r
-Arguments:\r
-  None\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   EFI_STATUS                  Status;\r
   EFI_BROWSER_ACTION_REQUEST  ActionRequest;\r
@@ -485,12 +467,6 @@ Returns:
     (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)\r
     );\r
 \r
-\r
-  //\r
-  // Drop the TPL level from TPL_APPLICATION to TPL_APPLICATION\r
-  //\r
-  gBS->RestoreTPL (TPL_APPLICATION);\r
-\r
   ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
   Status = gFormBrowser2->SendForm (\r
                             gFormBrowser2,\r
@@ -508,30 +484,26 @@ Returns:
     EnableResetRequired ();\r
   }\r
 \r
-  gBS->RaiseTPL (TPL_APPLICATION);\r
   return Status;\r
 }\r
 \r
+/**\r
+  Acquire the string associated with the ProducerGuid and return it.\r
+\r
+\r
+  @param ProducerGuid    - The Guid to search the HII database for\r
+  @param Token           - The token value of the string to extract\r
+  @param String          - The string that is extracted\r
+\r
+  @retval  EFI_SUCCESS  The function returns EFI_SUCCESS always.\r
+\r
+**/\r
 EFI_STATUS\r
 GetProducerString (\r
   IN      EFI_GUID                  *ProducerGuid,\r
   IN      EFI_STRING_ID             Token,\r
   OUT     CHAR16                    **String\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Acquire the string associated with the ProducerGuid and return it.\r
-\r
-Arguments:\r
-  ProducerGuid - The Guid to search the HII database for\r
-  Token - The token value of the string to extract\r
-  String - The string that is extracted\r
-\r
-Returns:\r
-  EFI_SUCCESS - The function returns EFI_SUCCESS always.\r
-\r
---*/\r
 {\r
   EFI_STATUS      Status;\r
 \r
@@ -543,23 +515,21 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Convert Processor Frequency Data to a string\r
+\r
+\r
+  @param ProcessorFrequency - The frequency data to process\r
+  @param String          - The string that is created\r
+\r
+  @return VOID.\r
+\r
+**/\r
 VOID\r
 ConvertProcessorToString (\r
   IN  EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency,\r
   OUT CHAR16                            **String\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Convert Processor Frequency Data to a string\r
-\r
-Arguments:\r
-  ProcessorFrequency - The frequency data to process\r
-  String - The string that is created\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   CHAR16  *StringBuffer;\r
   UINTN   Index;\r
@@ -586,23 +556,19 @@ Returns:
   return ;\r
 }\r
 \r
+/**\r
+  Convert Memory Size to a string.\r
+\r
+\r
+  @param MemorySize      - The size of the memory to process\r
+  @param String          - The string that is created\r
+\r
+**/\r
 VOID\r
 ConvertMemorySizeToString (\r
   IN  UINT32          MemorySize,\r
   OUT CHAR16          **String\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Convert Memory Size to a string\r
-\r
-Arguments:\r
-  MemorySize - The size of the memory to process\r
-  String - The string that is created\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   CHAR16  *StringBuffer;\r
 \r
@@ -616,21 +582,14 @@ Returns:
   return ;\r
 }\r
 \r
+/**\r
+  Update the banner information for the Front Page based on DataHub information.\r
+\r
+**/\r
 VOID\r
 UpdateFrontPageStrings (\r
   VOID\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Update the banner information for the Front Page based on DataHub information\r
-\r
-Arguments:\r
-  None\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   EFI_STATUS                        Status;\r
   EFI_STRING_ID                     TokenToUpdate;\r
@@ -727,32 +686,30 @@ Returns:
   return ;\r
 }\r
 \r
+/**\r
+  Function waits for a given event to fire, or for an optional timeout to expire.\r
+\r
+\r
+  @param Event           The event to wait for\r
+                        \r
+  @param Timeout         An optional timeout value in 100 ns units.\r
+\r
+  @retval  EFI_SUCCESS       Event fired before Timeout expired.\r
+  @retval  EFI_TIME_OUT      Timout expired before Event fired..\r
+\r
+**/\r
 EFI_STATUS\r
 WaitForSingleEvent (\r
   IN EFI_EVENT                  Event,\r
   IN UINT64                     Timeout OPTIONAL\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Function waits for a given event to fire, or for an optional timeout to expire.\r
-\r
-Arguments:\r
-  Event            - The event to wait for\r
-  Timeout          - An optional timeout value in 100 ns units.\r
-\r
-Returns:\r
-  EFI_SUCCESS      - Event fired before Timeout expired.\r
-  EFI_TIME_OUT     - Timout expired before Event fired..\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
   UINTN       Index;\r
   EFI_EVENT   TimerEvent;\r
   EFI_EVENT   WaitList[2];\r
 \r
-  if (Timeout) {\r
+  if (Timeout != 0) {\r
     //\r
     // Create a timer event\r
     //\r
@@ -794,24 +751,21 @@ Returns:
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-ShowProgress (\r
-  IN UINT16                       TimeoutDefault\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
   Function show progress bar to wait for user input.\r
 \r
-Arguments:\r
-  TimeoutDefault   - The fault time out value before the system\r
-                     continue to boot.\r
 \r
-Returns:\r
-  EFI_SUCCESS      - User pressed some key except "Enter"\r
-  EFI_TIME_OUT     - Timout expired or user press "Enter"\r
+  @param TimeoutDefault  - The fault time out value before the system\r
+                         continue to boot.\r
+\r
+  @retval  EFI_SUCCESS       User pressed some key except "Enter"\r
+  @retval  EFI_TIME_OUT      Timout expired or user press "Enter"\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+ShowProgress (\r
+  IN UINT16                       TimeoutDefault\r
+  )\r
 {\r
   EFI_STATUS                    Status;\r
   CHAR16                        *TmpStr;\r
@@ -890,28 +844,25 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-VOID\r
-PlatformBdsEnterFrontPage (\r
-  IN UINT16                       TimeoutDefault,\r
-  IN BOOLEAN                      ConnectAllHappened\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
   This function is the main entry of the platform setup entry.\r
   The function will present the main menu of the system setup,\r
   this is the platform reference part and can be customize.\r
 \r
-Arguments:\r
-  TimeoutDefault     - The fault time out value before the system\r
-                       continue to boot.\r
-  ConnectAllHappened - The indicater to check if the connect all have\r
-                       already happended.\r
 \r
-Returns:\r
-  None\r
+  @param TimeoutDefault  - The fault time out value before the system\r
+                         continue to boot.\r
+  @param ConnectAllHappened - The indicater to check if the connect all have\r
+                         already happended.\r
 \r
---*/\r
+  @return VOID.\r
+\r
+**/\r
+VOID\r
+PlatformBdsEnterFrontPage (\r
+  IN UINT16                       TimeoutDefault,\r
+  IN BOOLEAN                      ConnectAllHappened\r
+  )\r
 {\r
   EFI_STATUS                    Status;\r
   EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\r
@@ -925,9 +876,13 @@ Returns:
   }\r
 \r
   if (TimeoutDefault != 0xffff) {\r
-    gBS->RestoreTPL (TPL_APPLICATION);\r
     Status = ShowProgress (TimeoutDefault);\r
-    gBS->RaiseTPL (TPL_APPLICATION);\r
+\r
+    //\r
+    // Ensure screen is clear when switch Console from Graphics mode to Text mode\r
+    //\r
+    gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
+    gST->ConOut->ClearScreen (gST->ConOut);\r
 \r
     if (EFI_ERROR (Status)) {\r
       //\r
@@ -939,7 +894,7 @@ Returns:
 \r
   do {\r
 \r
-    InitializeFrontPage (TRUE);\r
+    InitializeFrontPage (FALSE);\r
 \r
     //\r
     // Update Front Page strings\r
@@ -1015,9 +970,7 @@ Returns:
   //\r
   //Will leave browser, check any reset required change is applied? if yes, reset system\r
   //\r
-  gBS->RestoreTPL (TPL_APPLICATION);\r
   SetupResetReminder ();\r
-  gBS->RaiseTPL (TPL_APPLICATION);\r
 \r
 Exit:\r
   //\r