]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / ConfigRouting.c
index 646864f4dfc1bc7a88019562408d011f5f9e2893..c778cd92f89b6da47597ec4de15b9b6ccb3c5289 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL.\r
 \r
-Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2018, 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
@@ -44,7 +44,7 @@ CalculateConfigStringLen (
   //\r
   // The beginning of next <ConfigRequest>/<ConfigResp> should be "&GUID=".\r
   // Will meet '\0' if there is only one <ConfigRequest>/<ConfigResp>.\r
-  // \r
+  //\r
   TmpPtr = StrStr (String, L"&GUID=");\r
   if (TmpPtr == NULL) {\r
     return StrLen (String);\r
@@ -117,7 +117,7 @@ GetDevicePath (
   if (((Length + 1) / 2) < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {\r
     return EFI_NOT_FOUND;\r
   }\r
-  \r
+\r
   //\r
   // The data in <PathHdr> is encoded as hex UNICODE %02x bytes in the same order\r
   // as the device path resides in RAM memory.\r
@@ -127,7 +127,7 @@ GetDevicePath (
   if (DevicePathBuffer == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // Convert DevicePath\r
   //\r
@@ -141,7 +141,7 @@ GetDevicePath (
       DevicePathBuffer [Index/2] = (UINT8) ((DevicePathBuffer [Index/2] << 4) + DigitUint8);\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Validate DevicePath\r
   //\r
@@ -208,10 +208,10 @@ HiiToLower (
 \r
   @param  BufferLen              The length of the Buffer in bytes.\r
 \r
-  @param  Buffer                 Points to a buffer which will be converted to be the \r
+  @param  Buffer                 Points to a buffer which will be converted to be the\r
                                  content of the generated string.\r
 \r
-  @param  Flag                   If 1, the buffer contains data for the value of GUID or PATH stored in \r
+  @param  Flag                   If 1, the buffer contains data for the value of GUID or PATH stored in\r
                                  UINT8 *; if 2, the buffer contains unicode string for the value of NAME;\r
                                  if 3, the buffer contains other data.\r
 \r
@@ -244,7 +244,7 @@ GenerateSubStr (
     ASSERT (*SubStr != NULL);\r
     return;\r
   }\r
-  \r
+\r
   //\r
   // Header + Data + '&' + '\0'\r
   //\r
@@ -317,7 +317,7 @@ GenerateSubStr (
   //\r
   // Convert the uppercase to lowercase since <HexAf> is defined in lowercase format.\r
   //\r
-  StrCatS (Str, Length, L"&");  \r
+  StrCatS (Str, Length, L"&");\r
   HiiToLower (Str);\r
 \r
   *SubStr = Str;\r
@@ -352,7 +352,7 @@ OutputConfigBody (
   if (String == NULL || ConfigBody == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   //\r
   // The setting information should start OFFSET, not ALTCFG.\r
   //\r
@@ -506,7 +506,7 @@ GetValueOfNumber (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto Exit;\r
   }\r
-  \r
+\r
   Length = *Len;\r
   ZeroMem (TemStr, sizeof (TemStr));\r
   for (Index = 0; Index < Length; Index ++) {\r
@@ -1010,10 +1010,10 @@ Exit:
   the missing AltCfgId in AltCfgResq.\r
 \r
   @param  AltCfgResp             Pointer to a null-terminated Unicode string in\r
-                                 <ConfigAltResp> format. The default value string \r
-                                 will be merged into it. \r
+                                 <ConfigAltResp> format. The default value string\r
+                                 will be merged into it.\r
   @param  DefaultAltCfgResp      Pointer to a null-terminated Unicode string in\r
-                                 <MultiConfigAltResp> format. The default value \r
+                                 <MultiConfigAltResp> format. The default value\r
                                  string may contain more than one ConfigAltResp\r
                                  string for the different varstore buffer.\r
 \r
@@ -1036,17 +1036,17 @@ MergeDefaultString (
   UINTN        SizeAltCfgResp;\r
   UINTN        MaxLen;\r
   UINTN        TotalSize;\r
-  \r
+\r
   if (*AltCfgResp == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   //\r
   // Get the request ConfigHdr\r
   //\r
   SizeAltCfgResp  = 0;\r
   StringPtr       = *AltCfgResp;\r
-  \r
+\r
   //\r
   // Find <ConfigHdr> GUID=...&NAME=...&PATH=...\r
   //\r
@@ -1081,18 +1081,18 @@ MergeDefaultString (
   StrnCatS (AltConfigHdr, MaxLen, *AltCfgResp, HeaderLength);\r
   StrCatS (AltConfigHdr, MaxLen, L"&ALTCFG=");\r
   HeaderLength = StrLen (AltConfigHdr);\r
-  \r
+\r
   StringPtrDefault = StrStr (DefaultAltCfgResp, AltConfigHdr);\r
   while (StringPtrDefault != NULL) {\r
     //\r
     // Get AltCfg Name\r
     //\r
     StrnCatS (AltConfigHdr, MaxLen, StringPtrDefault + HeaderLength, 4);\r
-    StringPtr = StrStr (*AltCfgResp, AltConfigHdr); \r
-    \r
+    StringPtr = StrStr (*AltCfgResp, AltConfigHdr);\r
+\r
     //\r
     // Append the found default value string to the input AltCfgResp\r
-    // \r
+    //\r
     if (StringPtr == NULL) {\r
       StringPtrEnd   = StrStr (StringPtrDefault + 1, L"&GUID");\r
       SizeAltCfgResp = StrSize (*AltCfgResp);\r
@@ -1136,16 +1136,16 @@ MergeDefaultString (
       //\r
       CompareAndMergeDefaultString (AltCfgResp, DefaultAltCfgResp, AltConfigHdr);\r
     }\r
-    \r
+\r
     //\r
     // Find next AltCfg String\r
     //\r
     *(AltConfigHdr + HeaderLength) = L'\0';\r
     StringPtrDefault = StrStr (StringPtrDefault + 1, AltConfigHdr);\r
   }\r
-  \r
+\r
   FreePool (AltConfigHdr);\r
-  return EFI_SUCCESS;  \r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -1162,9 +1162,9 @@ InsertDefaultValue (
   )\r
 {\r
   LIST_ENTRY             *Link;\r
-  IFR_DEFAULT_DATA       *DefaultValueArray; \r
+  IFR_DEFAULT_DATA       *DefaultValueArray;\r
   LIST_ENTRY             *DefaultLink;\r
\r
+\r
   DefaultLink   = &BlockData->DefaultValueEntry;\r
 \r
   for (Link = DefaultLink->ForwardLink; Link != DefaultLink; Link = Link->ForwardLink) {\r
@@ -1183,7 +1183,7 @@ InsertDefaultValue (
         DefaultValueArray->Cleaned = DefaultValueData->Cleaned;\r
       }\r
       return;\r
-    } \r
+    }\r
   }\r
 \r
   //\r
@@ -1200,7 +1200,7 @@ InsertDefaultValue (
 \r
   @param  BlockLink      The list entry points to block array.\r
   @param  BlockData      The point to BlockData is added.\r
-  \r
+\r
 **/\r
 VOID\r
 InsertBlockData (\r
@@ -1245,26 +1245,26 @@ InsertBlockData (
       }\r
     } else if (BlockArray->Offset > BlockSingleData->Offset) {\r
       //\r
-      // Insert new block data in the front of block array \r
+      // Insert new block data in the front of block array\r
       //\r
       InsertTailList (Link, &BlockSingleData->Entry);\r
       return;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Add new block data into the tail.\r
   //\r
-  InsertTailList (Link, &BlockSingleData->Entry); \r
+  InsertTailList (Link, &BlockSingleData->Entry);\r
 }\r
 \r
 /**\r
-  Retrieves a pointer to the a Null-terminated ASCII string containing the list \r
-  of languages that an HII handle in the HII Database supports.  The returned \r
+  Retrieves a pointer to the a Null-terminated ASCII string containing the list\r
+  of languages that an HII handle in the HII Database supports.  The returned\r
   string is allocated using AllocatePool().  The caller is responsible for freeing\r
   the returned string using FreePool().  The format of the returned string follows\r
   the language format assumed the HII Database.\r
-  \r
+\r
   If HiiHandle is NULL, then ASSERT().\r
 \r
   @param[in]  HiiHandle  A handle that was previously registered in the HII Database.\r
@@ -1295,8 +1295,8 @@ GetSupportedLanguages (
   Status = mPrivate.HiiString.GetLanguages (&mPrivate.HiiString, HiiHandle, &TempSupportedLanguages, &LanguageSize);\r
 \r
   //\r
-  // If GetLanguages() returns EFI_SUCCESS for a zero size, \r
-  // then there are no supported languages registered for HiiHandle.  If GetLanguages() \r
+  // If GetLanguages() returns EFI_SUCCESS for a zero size,\r
+  // then there are no supported languages registered for HiiHandle.  If GetLanguages()\r
   // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present\r
   // in the HII Database\r
   //\r
@@ -1338,12 +1338,12 @@ GetSupportedLanguages (
 \r
 /**\r
   Retrieves a string from a string package.\r
-  \r
+\r
   If HiiHandle is NULL, then ASSERT().\r
   If StringId is 0, then ASSET.\r
 \r
   @param[in]  HiiHandle  A handle that was previously registered in the HII Database.\r
-  @param[in]  StringId   The identifier of the string to retrieved from the string \r
+  @param[in]  StringId   The identifier of the string to retrieved from the string\r
                          package associated with HiiHandle.\r
 \r
   @retval NULL   The string specified by StringId is not present in the string package.\r
@@ -1370,7 +1370,7 @@ InternalGetString (
 \r
   //\r
   // Initialize all allocated buffers to NULL\r
-  // \r
+  //\r
   SupportedLanguages = NULL;\r
   PlatformLanguage   = NULL;\r
   BestLanguage       = NULL;\r
@@ -1394,11 +1394,11 @@ InternalGetString (
   // Get the best matching language from SupportedLanguages\r
   //\r
   BestLanguage = GetBestLanguage (\r
-                   SupportedLanguages, \r
+                   SupportedLanguages,\r
                    FALSE,                                             // RFC 4646 mode\r
-                   Language,                                          // Highest priority \r
+                   Language,                                          // Highest priority\r
                    PlatformLanguage != NULL ? PlatformLanguage : "",  // Next highest priority\r
-                   SupportedLanguages,                                // Lowest priority \r
+                   SupportedLanguages,                                // Lowest priority\r
                    NULL\r
                    );\r
   if (BestLanguage == NULL) {\r
@@ -1419,8 +1419,8 @@ InternalGetString (
                          NULL\r
                          );\r
   //\r
-  // If GetString() returns EFI_SUCCESS for a zero size, \r
-  // then there are no supported languages registered for HiiHandle.  If GetString() \r
+  // If GetString() returns EFI_SUCCESS for a zero size,\r
+  // then there are no supported languages registered for HiiHandle.  If GetString()\r
   // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present\r
   // in the HII Database\r
   //\r
@@ -1479,12 +1479,12 @@ Error:
 /**\r
   This function checks VarOffset and VarWidth is in the block range.\r
 \r
-  @param  RequestBlockArray  The block array is to be checked. \r
+  @param  RequestBlockArray  The block array is to be checked.\r
   @param  VarOffset          Offset of var to the structure\r
   @param  VarWidth           Width of var.\r
   @param  IsNameValueType    Whether this varstore is name/value varstore or not.\r
   @param  HiiHandle          Hii handle for this hii package.\r
-  \r
+\r
   @retval TRUE   This Var is in the block range.\r
   @retval FALSE  This Var is not in the block range.\r
 **/\r
@@ -1562,18 +1562,18 @@ GetFormPackageData (
   // 0. Get Hii Form Package by HiiHandle\r
   //\r
   Status = ExportFormPackages (\r
-             &mPrivate, \r
-             DataBaseRecord->Handle, \r
-             DataBaseRecord->PackageList, \r
-             0, \r
-             Size, \r
+             &mPrivate,\r
+             DataBaseRecord->Handle,\r
+             DataBaseRecord->PackageList,\r
+             0,\r
+             Size,\r
              HiiFormPackage,\r
              &ResultSize\r
            );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
\r
+\r
   (*HiiFormPackage) = AllocatePool (ResultSize);\r
   if (*HiiFormPackage == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
@@ -1586,18 +1586,18 @@ GetFormPackageData (
   Size   = ResultSize;\r
   ResultSize    = 0;\r
   Status = ExportFormPackages (\r
-             &mPrivate, \r
-             DataBaseRecord->Handle, \r
-             DataBaseRecord->PackageList, \r
+             &mPrivate,\r
+             DataBaseRecord->Handle,\r
+             DataBaseRecord->PackageList,\r
              0,\r
-             Size, \r
+             Size,\r
              *HiiFormPackage,\r
              &ResultSize\r
            );\r
   if (EFI_ERROR (Status)) {\r
     FreePool (*HiiFormPackage);\r
   }\r
-  \r
+\r
   *PackageSize = Size;\r
 \r
   return Status;\r
@@ -1612,7 +1612,7 @@ GetFormPackageData (
                                 the first found varstore will be as ConfigHdr.\r
   @param  IsEfiVarstore         Whether the request storage type is efi varstore type.\r
   @param  EfiVarStore           The efi varstore info which will return.\r
-**/                                \r
+**/\r
 EFI_STATUS\r
 GetVarStoreType (\r
   IN     HII_DATABASE_RECORD        *DataBaseRecord,\r
@@ -1630,12 +1630,12 @@ GetVarStoreType (
   EFI_STRING               GuidStr;\r
   EFI_STRING               NameStr;\r
   EFI_STRING               TempStr;\r
-  UINTN                    LengthString;  \r
+  UINTN                    LengthString;\r
   UINT8                    *HiiFormPackage;\r
   UINTN                    PackageSize;\r
   EFI_IFR_VARSTORE_EFI     *IfrEfiVarStore;\r
   EFI_HII_PACKAGE_HEADER   *PackageHeader;\r
-  \r
+\r
   HiiFormPackage = NULL;\r
   LengthString     = 0;\r
   Status           = EFI_SUCCESS;\r
@@ -1673,8 +1673,8 @@ GetVarStoreType (
     if (IfrOpHdr->OpCode == EFI_IFR_VARSTORE_EFI_OP ) {\r
       IfrEfiVarStore = (EFI_IFR_VARSTORE_EFI *) IfrOpHdr;\r
       //\r
-      // If the length is small than the structure, this is from old efi \r
-      // varstore definition. Old efi varstore get config directly from \r
+      // If the length is small than the structure, this is from old efi\r
+      // varstore definition. Old efi varstore get config directly from\r
       // GetVariable function.\r
       //\r
       if (IfrOpHdr->Length < sizeof (EFI_IFR_VARSTORE_EFI)) {\r
@@ -1715,8 +1715,8 @@ GetVarStoreType (
         }\r
         *IsEfiVarstore = TRUE;\r
         CopyMem (*EfiVarStore, IfrEfiVarStore, IfrOpHdr->Length);\r
-      } \r
-        \r
+      }\r
+\r
       //\r
       // Free allocated temp string.\r
       //\r
@@ -1778,7 +1778,7 @@ GetElementsFromRequest (
 \r
   @retval  TRUE              This varstore is the request one.\r
   @retval  FALSE             This varstore is not the request one.\r
-                                 \r
+\r
 **/\r
 BOOLEAN\r
 IsThisVarstore (\r
@@ -1826,7 +1826,7 @@ IsThisVarstore (
 \r
 Done:\r
   if (GuidStr != NULL) {\r
-    FreePool (GuidStr); \r
+    FreePool (GuidStr);\r
   }\r
 \r
   if (NameStr != NULL) {\r
@@ -1848,7 +1848,7 @@ Done:
                                 the first found varstore will be as ConfigHdr.\r
   @retval  TRUE                 This hii package is the request one.\r
   @retval  FALSE                This hii package is not the request one.\r
-**/                                \r
+**/\r
 BOOLEAN\r
 IsThisPackageList (\r
   IN     HII_DATABASE_RECORD        *DataBaseRecord,\r
@@ -1901,7 +1901,7 @@ IsThisPackageList (
     PackageOffset += IfrOpHdr->Length;\r
 \r
     switch (IfrOpHdr->OpCode) {\r
-    \r
+\r
     case EFI_IFR_VARSTORE_OP:\r
       IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr;\r
 \r
@@ -1947,7 +1947,7 @@ IsThisPackageList (
         goto Done;\r
       }\r
       break;\r
-      \r
+\r
     case EFI_IFR_FORM_OP:\r
     case EFI_IFR_FORM_MAP_OP:\r
       //\r
@@ -1985,7 +1985,7 @@ Done:
   @retval  EFI_SUCCESS           This opcode is required.\r
   @retval  EFI_NOT_FOUND         This opcode is not required.\r
   @retval  Others                Contain some error.\r
-                                 \r
+\r
 **/\r
 EFI_STATUS\r
 IsThisOpcodeRequired (\r
@@ -2042,7 +2042,7 @@ IsThisOpcodeRequired (
       BitWidth = VarWidth;\r
       BitOffset = VarOffset * 8;\r
     }\r
-    \r
+\r
     //\r
     // Check whether this question is in requested block array.\r
     //\r
@@ -2054,7 +2054,7 @@ IsThisOpcodeRequired (
     }\r
 \r
     //\r
-    // Check this var question is in the var storage \r
+    // Check this var question is in the var storage\r
     //\r
     if (((VarOffset + VarWidth) > VarStorageData->Size)) {\r
       return EFI_INVALID_PARAMETER;\r
@@ -2104,7 +2104,7 @@ IsThisOpcodeRequired (
 \r
   @retval EFI_SUCCESS           The block array and the default value array are got.\r
   @retval EFI_INVALID_PARAMETER The varstore definition in the different form packages\r
-                                are conflicted. \r
+                                are conflicted.\r
   @retval EFI_OUT_OF_RESOURCES  No enough memory.\r
 **/\r
 EFI_STATUS\r
@@ -2239,10 +2239,10 @@ ParseIfrData (
       IfrEfiVarStore = (EFI_IFR_VARSTORE_EFI *) IfrOpHdr;\r
 \r
       //\r
-      // If the length is small than the structure, this is from old efi \r
-      // varstore definition. Old efi varstore get config directly from \r
+      // If the length is small than the structure, this is from old efi\r
+      // varstore definition. Old efi varstore get config directly from\r
       // GetVariable function.\r
-      //      \r
+      //\r
       if (IfrOpHdr->Length < sizeof (EFI_IFR_VARSTORE_EFI)) {\r
         break;\r
       }\r
@@ -2317,7 +2317,7 @@ ParseIfrData (
 \r
     case EFI_IFR_REF_OP:\r
       //\r
-      // Ref question is not in IFR Form. This IFR form is not valid. \r
+      // Ref question is not in IFR Form. This IFR form is not valid.\r
       //\r
       if ( VarStoreId == 0) {\r
         Status = EFI_INVALID_PARAMETER;\r
@@ -2358,7 +2358,7 @@ ParseIfrData (
       //\r
 \r
       //\r
-      // Numeric and OneOf question is not in IFR Form. This IFR form is not valid. \r
+      // Numeric and OneOf question is not in IFR Form. This IFR form is not valid.\r
       //\r
       if (VarStoreId == 0) {\r
         Status = EFI_INVALID_PARAMETER;\r
@@ -2408,7 +2408,7 @@ ParseIfrData (
         FirstOneOfOption = TRUE;\r
       } else if (IfrOpHdr->OpCode == EFI_IFR_NUMERIC_OP) {\r
         //\r
-        // Numeric minimum value will be used as default value when no default is specified. \r
+        // Numeric minimum value will be used as default value when no default is specified.\r
         //\r
         DefaultData.Type        = DefaultValueFromDefault;\r
         if (QuestionReferBitField) {\r
@@ -2441,7 +2441,7 @@ ParseIfrData (
         }\r
         //\r
         // Set default value base on the DefaultId list get from IFR data.\r
-        //        \r
+        //\r
         for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {\r
           DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry);\r
           DefaultData.DefaultId   = DefaultDataPtr->DefaultId;\r
@@ -2458,7 +2458,7 @@ ParseIfrData (
 \r
       FirstOrderedList = TRUE;\r
       //\r
-      // OrderedList question is not in IFR Form. This IFR form is not valid. \r
+      // OrderedList question is not in IFR Form. This IFR form is not valid.\r
       //\r
       if (VarStoreId == 0) {\r
         Status = EFI_INVALID_PARAMETER;\r
@@ -2501,10 +2501,10 @@ ParseIfrData (
       // default id by CheckBox Flags if CheckBox flags (Default or Mau) is set, the default value is 1 to be set.\r
       // value by DefaultOption\r
       // default id by DeaultOption DefaultId can override CheckBox Flags and Default value.\r
-      // \r
+      //\r
 \r
       //\r
-      // CheckBox question is not in IFR Form. This IFR form is not valid. \r
+      // CheckBox question is not in IFR Form. This IFR form is not valid.\r
       //\r
       if (VarStoreId == 0) {\r
         Status = EFI_INVALID_PARAMETER;\r
@@ -2651,7 +2651,7 @@ ParseIfrData (
       //\r
 \r
       //\r
-      // Date question is not in IFR Form. This IFR form is not valid. \r
+      // Date question is not in IFR Form. This IFR form is not valid.\r
       //\r
       if (VarStoreId == 0) {\r
         Status = EFI_INVALID_PARAMETER;\r
@@ -2693,7 +2693,7 @@ ParseIfrData (
       //\r
 \r
       //\r
-      // Time question is not in IFR Form. This IFR form is not valid. \r
+      // Time question is not in IFR Form. This IFR form is not valid.\r
       //\r
       if (VarStoreId == 0) {\r
         Status = EFI_INVALID_PARAMETER;\r
@@ -2735,7 +2735,7 @@ ParseIfrData (
       //\r
 \r
       //\r
-      // String question is not in IFR Form. This IFR form is not valid. \r
+      // String question is not in IFR Form. This IFR form is not valid.\r
       //\r
       if (VarStoreId == 0) {\r
         Status = EFI_INVALID_PARAMETER;\r
@@ -2777,7 +2777,7 @@ ParseIfrData (
       //\r
 \r
       //\r
-      // Password question is not in IFR Form. This IFR form is not valid. \r
+      // Password question is not in IFR Form. This IFR form is not valid.\r
       //\r
       if (VarStoreId == 0) {\r
         Status = EFI_INVALID_PARAMETER;\r
@@ -2872,7 +2872,7 @@ ParseIfrData (
           break;\r
         }\r
         //\r
-        // Check this var question is in the var storage \r
+        // Check this var question is in the var storage\r
         //\r
         if ((BlockData->Name == NULL) && ((BlockData->Offset + BlockData->Width) > VarStorageData->Size)) {\r
           Status = EFI_INVALID_PARAMETER;\r
@@ -2899,13 +2899,13 @@ ParseIfrData (
       if (((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT) == EFI_IFR_OPTION_DEFAULT) ||\r
           ((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT_MFG) == EFI_IFR_OPTION_DEFAULT_MFG)) {\r
         //\r
-        // This flag is used to specify whether this option is the first. Set it to FALSE for the following options. \r
-        // The first oneof option value will be used as default value when no default value is specified. \r
+        // This flag is used to specify whether this option is the first. Set it to FALSE for the following options.\r
+        // The first oneof option value will be used as default value when no default value is specified.\r
         //\r
         FirstOneOfOption = FALSE;\r
 \r
         SmallestIdFromFlag = FALSE;\r
-        \r
+\r
         // Prepare new DefaultValue\r
         //\r
         DefaultData.Type     = DefaultValueFromFlag;\r
@@ -2951,19 +2951,19 @@ ParseIfrData (
 \r
       //\r
       // 2. Set as the default value when this is the first option.\r
-      // The first oneof option value will be used as default value when no default value is specified. \r
+      // The first oneof option value will be used as default value when no default value is specified.\r
       //\r
       if (FirstOneOfOption) {\r
-        // This flag is used to specify whether this option is the first. Set it to FALSE for the following options. \r
+        // This flag is used to specify whether this option is the first. Set it to FALSE for the following options.\r
         FirstOneOfOption = FALSE;\r
-        \r
+\r
         //\r
         // Prepare new DefaultValue\r
-        //        \r
+        //\r
         DefaultData.Type     = DefaultValueFromDefault;\r
         CopyMem (&DefaultData.Value, &IfrOneOfOption->Value, IfrOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));\r
         for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {\r
-          DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry); \r
+          DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry);\r
           DefaultData.DefaultId   = DefaultDataPtr->DefaultId;\r
           InsertDefaultValue (BlockData, &DefaultData);\r
         }\r
@@ -3194,7 +3194,7 @@ GetBlockElement (
     if (*StringPtr != 0 && *StringPtr != L'&') {\r
       goto Done;\r
     }\r
-    \r
+\r
     //\r
     // Set Block Data\r
     //\r
@@ -3226,7 +3226,7 @@ GetBlockElement (
       }\r
     }\r
     //\r
-    // If '\0', parsing is finished. \r
+    // If '\0', parsing is finished.\r
     //\r
     if (*StringPtr == 0) {\r
       break;\r
@@ -3343,7 +3343,7 @@ GetNameElement (
     if (HasValue) {\r
       //\r
       // If has value, skip the value.\r
-      //    \r
+      //\r
       StringPtr = NextTag + 1;\r
       *NextTag  = L'=';\r
       StringPtr = StrStr (StringPtr, L"&");\r
@@ -3408,14 +3408,14 @@ GenerateConfigRequest (
   // Append VarStorageData BlockEntry into *Request string\r
   // Now support only one varstore in a form package.\r
   //\r
-  \r
+\r
   //\r
   // Go through all VarStorageData Entry and get BlockEntry for each one for the multiple varstore in a single form package\r
   // Then construct them all to return MultiRequest string : ConfigHdr BlockConfig\r
   //\r
-  \r
+\r
   //\r
-  // Compute the length of the entire request starting with <ConfigHdr> and a \r
+  // Compute the length of the entire request starting with <ConfigHdr> and a\r
   // Null-terminator\r
   //\r
   DataExist = FALSE;\r
@@ -3428,7 +3428,7 @@ GenerateConfigRequest (
       //\r
       // Add <BlockName> length for each Name\r
       //\r
-      // <BlockName> ::= &Name1&Name2&... \r
+      // <BlockName> ::= &Name1&Name2&...\r
       //                 |1| StrLen(Name1)\r
       //\r
       Length = Length + (1 + StrLen (BlockData->Name));\r
@@ -3486,10 +3486,10 @@ GenerateConfigRequest (
       // Append &OFFSET=XXXX&WIDTH=YYYY\0\r
       //\r
       UnicodeSPrint (\r
-        StringPtr, \r
-        (8 + 4 + 7 + 4 + 1) * sizeof (CHAR16), \r
-        L"&OFFSET=%04X&WIDTH=%04X", \r
-        BlockData->Offset, \r
+        StringPtr,\r
+        (8 + 4 + 7 + 4 + 1) * sizeof (CHAR16),\r
+        L"&OFFSET=%04X&WIDTH=%04X",\r
+        BlockData->Offset,\r
         BlockData->Width\r
       );\r
     }\r
@@ -3897,7 +3897,7 @@ GenerateAltConfigResp (
     //                |1| StrLen (ConfigHdr) | 8 | 4 |\r
     //\r
     Length += (1 + StrLen (ConfigHdr) + 8 + 4);\r
-    \r
+\r
     for (LinkData = VarStorageData->BlockEntry.ForwardLink; LinkData != &VarStorageData->BlockEntry; LinkData = LinkData->ForwardLink) {\r
       BlockData = BASE_CR (LinkData, IFR_BLOCK_DATA, Entry);\r
       ListEntry     = &BlockData->DefaultValueEntry;\r
@@ -3923,7 +3923,7 @@ GenerateAltConfigResp (
       }\r
     }\r
   }\r
-  \r
+\r
   //\r
   // No default value is found. The default string doesn't exist.\r
   //\r
@@ -3953,10 +3953,10 @@ GenerateAltConfigResp (
     //                                |1| StrLen (ConfigHdr) | 8 | 4 |\r
     //\r
     UnicodeSPrint (\r
-      StringPtr, \r
-      (1 + StrLen (ConfigHdr) + 8 + 4 + 1) * sizeof (CHAR16), \r
-      L"&%s&ALTCFG=%04X", \r
-      ConfigHdr, \r
+      StringPtr,\r
+      (1 + StrLen (ConfigHdr) + 8 + 4 + 1) * sizeof (CHAR16),\r
+      L"&%s&ALTCFG=%04X",\r
+      ConfigHdr,\r
       DefaultId->DefaultId\r
       );\r
     StringPtr += StrLen (StringPtr);\r
@@ -3971,9 +3971,9 @@ GenerateAltConfigResp (
         }\r
         if (VarStorageData->Type == EFI_HII_VARSTORE_NAME_VALUE) {\r
           UnicodeSPrint (\r
-            StringPtr, \r
-            (1 + StrLen (ConfigHdr) + 1) * sizeof (CHAR16), \r
-            L"&%s=", \r
+            StringPtr,\r
+            (1 + StrLen (ConfigHdr) + 1) * sizeof (CHAR16),\r
+            L"&%s=",\r
             BlockData->Name\r
             );\r
           StringPtr += StrLen (StringPtr);\r
@@ -3983,10 +3983,10 @@ GenerateAltConfigResp (
           // <BlockConfig> ::= 'OFFSET='<Number>&'WIDTH='<Number>&'VALUE'=<Number>\r
           //\r
           UnicodeSPrint (\r
-            StringPtr, \r
+            StringPtr,\r
             (8 + 4 + 7 + 4 + 7 + 1) * sizeof (CHAR16),\r
-            L"&OFFSET=%04X&WIDTH=%04X&VALUE=", \r
-            BlockData->Offset, \r
+            L"&OFFSET=%04X&WIDTH=%04X&VALUE=",\r
+            BlockData->Offset,\r
             BlockData->Width\r
             );\r
           StringPtr += StrLen (StringPtr);\r
@@ -4038,32 +4038,32 @@ GenerateAltConfigResp (
 }\r
 \r
 /**\r
-  This function gets the full request string and full default value string by \r
-  parsing IFR data in HII form packages. \r
-  \r
-  When Request points to NULL string, the request string and default value string \r
-  for each varstore in form package will return. \r
+  This function gets the full request string and full default value string by\r
+  parsing IFR data in HII form packages.\r
+\r
+  When Request points to NULL string, the request string and default value string\r
+  for each varstore in form package will return.\r
 \r
   @param  DataBaseRecord         The DataBaseRecord instance contains the found Hii handle and package.\r
   @param  DevicePath             Device Path which Hii Config Access Protocol is registered.\r
   @param  Request                Pointer to a null-terminated Unicode string in\r
                                  <ConfigRequest> format. When it doesn't contain\r
-                                 any RequestElement, it will be updated to return \r
+                                 any RequestElement, it will be updated to return\r
                                  the full RequestElement retrieved from IFR data.\r
                                  If it points to NULL, the request string for the first\r
                                  varstore in form package will be merged into a\r
-                                 <MultiConfigRequest> format string and return. \r
+                                 <MultiConfigRequest> format string and return.\r
   @param  AltCfgResp             Pointer to a null-terminated Unicode string in\r
                                  <ConfigAltResp> format. When the pointer is to NULL,\r
                                  the full default value string retrieved from IFR data\r
                                  will return. When the pinter is to a string, the\r
                                  full default value string retrieved from IFR data\r
                                  will be merged into the input string and return.\r
-                                 When Request points to NULL, the default value string \r
-                                 for each varstore in form package will be merged into \r
+                                 When Request points to NULL, the default value string\r
+                                 for each varstore in form package will be merged into\r
                                  a <MultiConfigAltResp> format string and return.\r
   @param  PointerProgress        Optional parameter, it can be NULL.\r
-                                 When it is not NULL, if Request is NULL, it returns NULL. \r
+                                 When it is not NULL, if Request is NULL, it returns NULL.\r
                                  On return, points to a character in the Request\r
                                  string. Points to the string's null terminator if\r
                                  request was successful. Points to the most recent\r
@@ -4074,7 +4074,7 @@ GenerateAltConfigResp (
   @retval EFI_SUCCESS            The Results string is set to the full request string.\r
                                  And AltCfgResp contains all default value string.\r
   @retval EFI_OUT_OF_RESOURCES   Not enough memory for the return string.\r
-  @retval EFI_NOT_FOUND          The varstore (Guid and Name) in Request string \r
+  @retval EFI_NOT_FOUND          The varstore (Guid and Name) in Request string\r
                                  can't be found in Form package.\r
   @retval EFI_NOT_FOUND          HiiPackage can't be got on the input HiiHandle.\r
   @retval EFI_INVALID_PARAMETER  Request points to NULL.\r
@@ -4321,7 +4321,7 @@ Done:
   }\r
 \r
   //\r
-  // Free the allocated string \r
+  // Free the allocated string\r
   //\r
   if (ConfigHdr != NULL) {\r
     FreePool (ConfigHdr);\r
@@ -4348,13 +4348,13 @@ Done:
 }\r
 \r
 /**\r
-  This function gets the full request resp string by \r
+  This function gets the full request resp string by\r
   parsing IFR data in HII form packages.\r
 \r
   @param  This                   A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r
                                  instance.\r
-  @param  EfiVarStoreInfo        The efi varstore info which is save in the EFI \r
-                                 varstore data structure.                       \r
+  @param  EfiVarStoreInfo        The efi varstore info which is save in the EFI\r
+                                 varstore data structure.\r
   @param  Request                Pointer to a null-terminated Unicode string in\r
                                  <ConfigRequest> format.\r
   @param  RequestResp            Pointer to a null-terminated Unicode string in\r
@@ -4376,7 +4376,7 @@ Done:
 EFI_STATUS\r
 GetConfigRespFromEfiVarStore (\r
   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,\r
-  IN  EFI_IFR_VARSTORE_EFI                   *EfiVarStoreInfo,    \r
+  IN  EFI_IFR_VARSTORE_EFI                   *EfiVarStoreInfo,\r
   IN  EFI_STRING                             Request,\r
   OUT EFI_STRING                             *RequestResp,\r
   OUT EFI_STRING                             *AccessProgress\r
@@ -4401,8 +4401,8 @@ GetConfigRespFromEfiVarStore (
     goto Done;\r
   }\r
   AsciiStrToUnicodeStrS ((CHAR8 *) EfiVarStoreInfo->Name, VarStoreName, NameSize);\r
-   \r
-  \r
+\r
+\r
   Status = gRT->GetVariable (VarStoreName, &EfiVarStoreInfo->Guid, NULL, &BufferSize, NULL);\r
   if (Status != EFI_BUFFER_TOO_SMALL) {\r
     goto Done;\r
@@ -4434,17 +4434,17 @@ Done:
 \r
 \r
 /**\r
-  This function route the full request resp string for efi varstore. \r
+  This function route the full request resp string for efi varstore.\r
 \r
   @param  This                   A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r
                                  instance.\r
-  @param  EfiVarStoreInfo        The efi varstore info which is save in the EFI \r
-                                 varstore data structure.      \r
+  @param  EfiVarStoreInfo        The efi varstore info which is save in the EFI\r
+                                 varstore data structure.\r
   @param  RequestResp            Pointer to a null-terminated Unicode string in\r
                                  <ConfigResp> format.\r
   @param  Result                 Pointer to a null-terminated Unicode string in\r
                                  <ConfigResp> format.\r
-                                 \r
+\r
   @retval EFI_SUCCESS            The Results string is set to the full request string.\r
                                  And AltCfgResp contains all default value string.\r
   @retval EFI_OUT_OF_RESOURCES   Not enough memory for the return string.\r
@@ -4454,7 +4454,7 @@ Done:
 EFI_STATUS\r
 RouteConfigRespForEfiVarStore (\r
   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,\r
-  IN  EFI_IFR_VARSTORE_EFI                   *EfiVarStoreInfo,  \r
+  IN  EFI_IFR_VARSTORE_EFI                   *EfiVarStoreInfo,\r
   IN  EFI_STRING                             RequestResp,\r
   OUT EFI_STRING                             *Result\r
   )\r
@@ -4479,7 +4479,7 @@ RouteConfigRespForEfiVarStore (
     goto Done;\r
   }\r
   AsciiStrToUnicodeStrS ((CHAR8 *) EfiVarStoreInfo->Name, VarStoreName, NameSize);\r
-      \r
+\r
   Status = gRT->GetVariable (VarStoreName, &EfiVarStoreInfo->Guid, NULL, &BufferSize, NULL);\r
   if (Status != EFI_BUFFER_TOO_SMALL) {\r
     DEBUG ((DEBUG_ERROR, "The variable does not exist!"));\r
@@ -4520,7 +4520,7 @@ Done:
 /**\r
   Validate the config request elements.\r
 \r
-  @param  ConfigElements                A null-terminated Unicode string in <ConfigRequest> format, \r
+  @param  ConfigElements                A null-terminated Unicode string in <ConfigRequest> format,\r
                                         without configHdr field.\r
 \r
   @retval     CHAR16 *    THE first Name/value pair not correct.\r
@@ -4563,7 +4563,7 @@ OffsetWidthValidate (
 /**\r
   Validate the config request elements.\r
 \r
-  @param  ConfigElements                A null-terminated Unicode string in <ConfigRequest> format, \r
+  @param  ConfigElements                A null-terminated Unicode string in <ConfigRequest> format,\r
                                         without configHdr field.\r
 \r
   @retval     CHAR16 *    THE first Name/value pair not correct.\r
@@ -4588,7 +4588,7 @@ NameValueValidate (
     StringPtr += 1;\r
 \r
     StringPtr = StrStr (StringPtr, L"&");\r
-    \r
+\r
     if (StringPtr == NULL) {\r
       return NULL;\r
     }\r
@@ -4696,7 +4696,7 @@ ConfigRequestValidate (
   @retval EFI_INVALID_PARAMETER  Illegal syntax. Progress set to most recent &\r
                                  before the error or the beginning of the string.\r
   @retval EFI_INVALID_PARAMETER  The ExtractConfig function of the underlying HII\r
-                                 Configuration Access Protocol returned \r
+                                 Configuration Access Protocol returned\r
                                  EFI_INVALID_PARAMETER. Progress set to most recent\r
                                  & before the error or the beginning of the string.\r
 \r
@@ -4833,7 +4833,7 @@ HiiConfigRoutingExtractConfig (
         }\r
       }\r
     }\r
-    \r
+\r
     //\r
     // Try to find driver handle by device path.\r
     //\r
@@ -4871,7 +4871,7 @@ HiiConfigRoutingExtractConfig (
     IfrDataParsedFlag = FALSE;\r
     if ((HiiHandle != NULL) && !GetElementsFromRequest(ConfigRequest)) {\r
       //\r
-      // Get the full request string from IFR when HiiPackage is registered to HiiHandle \r
+      // Get the full request string from IFR when HiiPackage is registered to HiiHandle\r
       //\r
       IfrDataParsedFlag = TRUE;\r
       Status = GetFullStringFromHiiFormPackages (Database, DevicePath, &ConfigRequest, &DefaultResults, &AccessProgress);\r
@@ -4900,7 +4900,7 @@ HiiConfigRoutingExtractConfig (
     if (EFI_ERROR (Status)) {\r
       goto Done;\r
     }\r
-    \r
+\r
     if (IsEfiVarStore) {\r
       //\r
       // Call the GetVariable function to extract settings.\r
@@ -4999,7 +4999,7 @@ HiiConfigRoutingExtractConfig (
     ASSERT (*AccessProgress == 0);\r
 \r
     //\r
-    // Update AccessResults by getting default setting from IFR when HiiPackage is registered to HiiHandle \r
+    // Update AccessResults by getting default setting from IFR when HiiPackage is registered to HiiHandle\r
     //\r
     if (!IfrDataParsedFlag && HiiHandle != NULL) {\r
       Status = GetFullStringFromHiiFormPackages (Database, DevicePath, &ConfigRequest, &DefaultResults, NULL);\r
@@ -5015,13 +5015,13 @@ HiiConfigRoutingExtractConfig (
       FreePool (DefaultResults);\r
       DefaultResults = NULL;\r
     }\r
-    \r
+\r
 NextConfigString:\r
     if (!FirstElement) {\r
       Status = AppendToMultiString (Results, L"&");\r
       ASSERT_EFI_ERROR (Status);\r
     }\r
-    \r
+\r
     Status = AppendToMultiString (Results, AccessResults);\r
     ASSERT_EFI_ERROR (Status);\r
 \r
@@ -5049,22 +5049,22 @@ Done:
     FreePool (*Results);\r
     *Results = NULL;\r
   }\r
-  \r
+\r
   if (ConfigRequest != NULL) {\r
     FreePool (ConfigRequest);\r
   }\r
-  \r
+\r
   if (AccessResults != NULL) {\r
     FreePool (AccessResults);\r
   }\r
-  \r
+\r
   if (DefaultResults != NULL) {\r
     FreePool (DefaultResults);\r
   }\r
-  \r
+\r
   if (DevicePath != NULL) {\r
     FreePool (DevicePath);\r
-  }  \r
+  }\r
 \r
   return Status;\r
 }\r
@@ -5079,8 +5079,8 @@ Done:
                                  instance.\r
   @param  Results                Null-terminated Unicode string in\r
                                  <MultiConfigAltResp> format which has all values\r
-                                 filled in for the entirety of the current HII \r
-                                 database. String to be allocated by the  called \r
+                                 filled in for the entirety of the current HII\r
+                                 database. String to be allocated by the  called\r
                                  function. De-allocation is up to the caller.\r
 \r
   @retval EFI_SUCCESS            The Results string is filled with the values\r
@@ -5196,7 +5196,7 @@ HiiConfigRoutingExportConfig (
                              );\r
     if (EFI_ERROR (Status)) {\r
       //\r
-      // Update AccessResults by getting default setting from IFR when HiiPackage is registered to HiiHandle \r
+      // Update AccessResults by getting default setting from IFR when HiiPackage is registered to HiiHandle\r
       //\r
       if (HiiHandle != NULL && DevicePath != NULL) {\r
         IfrDataParsedFlag = TRUE;\r
@@ -5220,7 +5220,7 @@ HiiConfigRoutingExportConfig (
 \r
     if (!EFI_ERROR (Status)) {\r
       //\r
-      // Update AccessResults by getting default setting from IFR when HiiPackage is registered to HiiHandle \r
+      // Update AccessResults by getting default setting from IFR when HiiPackage is registered to HiiHandle\r
       //\r
       if (!IfrDataParsedFlag && HiiHandle != NULL && DevicePath != NULL) {\r
         StringPtr = StrStr (AccessResults, L"&GUID=");\r
@@ -5244,7 +5244,7 @@ HiiConfigRoutingExportConfig (
         FreePool (DefaultResults);\r
         DefaultResults = NULL;\r
       }\r
-      \r
+\r
       //\r
       // Attach this <ConfigAltResp> to a <MultiConfigAltResp>. There is a '&'\r
       // which separates the first <ConfigAltResp> and the following ones.\r
@@ -5253,19 +5253,19 @@ HiiConfigRoutingExportConfig (
         Status = AppendToMultiString (Results, L"&");\r
         ASSERT_EFI_ERROR (Status);\r
       }\r
-      \r
+\r
       Status = AppendToMultiString (Results, AccessResults);\r
       ASSERT_EFI_ERROR (Status);\r
 \r
       FirstElement = FALSE;\r
-      \r
+\r
       FreePool (AccessResults);\r
       AccessResults = NULL;\r
     }\r
   }\r
   FreePool (ConfigAccessHandles);\r
 \r
-  return EFI_SUCCESS;  \r
+  return EFI_SUCCESS;\r
 }\r
 \r
 \r
@@ -5433,7 +5433,7 @@ HiiConfigRoutingRouteConfig (
     if (IsEfiVarstore) {\r
       //\r
       // Call the SetVariable function to route settings.\r
-      //    \r
+      //\r
       Status = RouteConfigRespForEfiVarStore(This, EfiVarStoreInfo, ConfigResp, &AccessProgress);\r
       FreePool (EfiVarStoreInfo);\r
     } else {\r
@@ -5705,7 +5705,7 @@ HiiBlockToConfig (
       Status = EFI_OUT_OF_RESOURCES;\r
       goto Exit;\r
     }\r
-    \r
+\r
     TemString = ValueStr;\r
     TemBuffer = Value + Width - 1;\r
     for (Index = 0; Index < Width; Index ++, TemBuffer --) {\r
@@ -5762,7 +5762,7 @@ HiiBlockToConfig (
     Status = EFI_INVALID_PARAMETER;\r
     goto Exit;\r
   }\r
-  \r
+\r
   HiiToLower (*Config);\r
   *Progress = StringPtr;\r
   return EFI_SUCCESS;\r
@@ -5827,7 +5827,7 @@ Exit:
                                  value pair. Block is left updated and\r
                                  Progress points at the '&' preceding the first\r
                                  non-<BlockName>.\r
-  @retval EFI_BUFFER_TOO_SMALL   Block not large enough. Progress undefined. \r
+  @retval EFI_BUFFER_TOO_SMALL   Block not large enough. Progress undefined.\r
                                  BlockSize is updated with the required buffer size.\r
   @retval EFI_NOT_FOUND          Target for the specified routing data was not found.\r
                                  Progress points to the "G" in "GUID" of the errant\r
@@ -5993,7 +5993,7 @@ HiiConfigToBlock (
       break;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // The input string is not ConfigResp format, return error.\r
   //\r
@@ -6128,10 +6128,10 @@ HiiGetAltCfg (
     &PathStr\r
     );\r
   if (AltCfgId != NULL) {\r
-    GenerateSubStr (L"ALTCFG=", sizeof (UINT16), (VOID *) AltCfgId, 3, &AltIdStr);  \r
+    GenerateSubStr (L"ALTCFG=", sizeof (UINT16), (VOID *) AltCfgId, 3, &AltIdStr);\r
   }\r
   if (Name != NULL) {\r
-    GenerateSubStr (L"NAME=", StrLen (Name) * sizeof (CHAR16), (VOID *) Name, 2, &NameStr);    \r
+    GenerateSubStr (L"NAME=", StrLen (Name) * sizeof (CHAR16), (VOID *) Name, 2, &NameStr);\r
   } else {\r
     GenerateSubStr (L"NAME=", 0, NULL, 2, &NameStr);\r
   }\r