]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Use MemoryAllocationLib to replace boot services memory services functions in...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 29 Mar 2007 06:58:38 +0000 (06:58 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 29 Mar 2007 06:58:38 +0000 (06:58 +0000)
2. Added NULL pointer check before calling FreePool () to fix bugs when free memory.

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

13 files changed:
EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.c
EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.msa
EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Boolean.c
EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c
EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c
EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.c
EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/ProcessOptions.c
EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.c
EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c
EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa
EdkModulePkg/Universal/Variable/RuntimeDxe/VariableIpf.msa
EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.c

index 9e8dbbee7b878c0ee4cd6425b2f4f45e3db72fc9..15e7693d1d9eea99bca83d4b6007f2f91d8b904c 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
     ConPlatform.c\r
-    \r
+\r
 Abstract:\r
 \r
 --*/\r
@@ -47,7 +47,7 @@ ConPlatformTextInDriverBindingSupported (
 /*++\r
 \r
 Routine Description:\r
-  Supported \r
+  Supported\r
 \r
 Arguments:\r
   (Standard DriverBinding Protocol Supported() function)\r
@@ -76,7 +76,7 @@ ConPlatformTextOutDriverBindingSupported (
 /*++\r
 \r
 Routine Description:\r
-  Supported \r
+  Supported\r
 \r
 Arguments:\r
   (Standard DriverBinding Protocol Supported() function)\r
@@ -105,7 +105,7 @@ ConPlatformDriverBindingSupported (
 /*++\r
 \r
 Routine Description:\r
-  Supported \r
+  Supported\r
 \r
 Arguments:\r
   (Standard DriverBinding Protocol Supported() function)\r
@@ -551,7 +551,7 @@ Returns:
   Caller is repsoncible freeing the buffer.\r
 \r
   NULL - Variable was not read\r
-  \r
+\r
 --*/\r
 {\r
   EFI_STATUS  Status;\r
@@ -576,8 +576,8 @@ Returns:
     //\r
     // Allocate the buffer to return\r
     //\r
-    Status = gBS->AllocatePool (EfiBootServicesData, BufferSize, &Buffer);\r
-    if (EFI_ERROR (Status)) {\r
+    Buffer = AllocatePool (BufferSize);\r
+    if (Buffer == NULL) {\r
       return NULL;\r
     }\r
     //\r
@@ -591,7 +591,7 @@ Returns:
                     Buffer\r
                     );\r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (Buffer);\r
+      FreePool (Buffer);\r
       Buffer = NULL;\r
     }\r
   }\r
@@ -616,18 +616,18 @@ Arguments:
   Multi        - A pointer to a multi-instance device path data structure.\r
 \r
   Single       - A pointer to a single-instance device path data structure.\r
-  \r
+\r
   NewDevicePath - If Delete is TRUE, this parameter must not be null, and it\r
-                  points to the remaining device path data structure. \r
+                  points to the remaining device path data structure.\r
                   (remaining device path = Multi - Single.)\r
-  \r
+\r
   Delete        - If TRUE, means removing Single from Multi.\r
-                  If FALSE, the routine just check whether Single matches \r
+                  If FALSE, the routine just check whether Single matches\r
                   with any instance in Multi.\r
 \r
 Returns:\r
 \r
-  The function returns EFI_SUCCESS if the Single is contained within Multi.  \r
+  The function returns EFI_SUCCESS if the Single is contained within Multi.\r
   Otherwise, EFI_NOT_FOUND is returned.\r
 \r
 --*/\r
@@ -658,7 +658,7 @@ Returns:
   while (DevicePathInst) {\r
     if (CompareMem (Single, DevicePathInst, Size) == 0) {\r
       if (!Delete) {\r
-        gBS->FreePool (DevicePathInst);\r
+        FreePool (DevicePathInst);\r
         return EFI_SUCCESS;\r
       }\r
     } else {\r
@@ -667,12 +667,14 @@ Returns:
                             TempDevicePath1,\r
                             DevicePathInst\r
                             );\r
-        gBS->FreePool (TempDevicePath1);\r
+        if (TempDevicePath1 != NULL) {\r
+          FreePool (TempDevicePath1);\r
+        }\r
         TempDevicePath1 = TempDevicePath2;\r
       }\r
     }\r
 \r
-    gBS->FreePool (DevicePathInst);\r
+    FreePool (DevicePathInst);\r
     DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);\r
   }\r
 \r
@@ -693,7 +695,7 @@ ConPlatformUpdateDeviceVariable (
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
 \r
 Arguments:\r
 \r
@@ -730,7 +732,9 @@ Returns:
       //\r
       // The device path is already in the variable\r
       //\r
-      gBS->FreePool (VariableDevicePath);\r
+      if (VariableDevicePath != NULL) {\r
+        FreePool (VariableDevicePath);\r
+      }\r
 \r
       return Status;\r
     }\r
@@ -760,7 +764,9 @@ Returns:
               );\r
   }\r
 \r
-  gBS->FreePool (VariableDevicePath);\r
+  if (VariableDevicePath != NULL) {\r
+    FreePool (VariableDevicePath);\r
+  }\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -774,7 +780,7 @@ Returns:
                   NewVariableDevicePath\r
                   );\r
 \r
-  gBS->FreePool (NewVariableDevicePath);\r
+  FreePool (NewVariableDevicePath);\r
 \r
   return Status;\r
 }\r
index e6fe04f28060ab8e177f58a19f717ad27b4d92ad..c00a95ce92a157e229e0f0392e8e20921beb86fd 100644 (file)
@@ -46,6 +46,9 @@
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>DevicePathLib</Keyword>\r
     </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>MemoryAllocationLib</Keyword>\r
+    </LibraryClass>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>ConPlatform.c</Filename>\r
index d3f77e09f59587bf9c3dd0fb7b43dc594714e544..138725d7be7be3af47f1e28a540ab097f26d8992 100644 (file)
@@ -1,13 +1,13 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
@@ -49,7 +49,7 @@ Arguments:
 \r
 Returns:\r
 \r
-  NONE \r
+  NONE\r
 \r
 --*/\r
 {\r
@@ -76,7 +76,7 @@ Returns:
     //\r
     // Free The Old Stack\r
     //\r
-    gBS->FreePool (mBooleanEvaluationStack);\r
+    FreePool (mBooleanEvaluationStack);\r
   }\r
 \r
   mBooleanEvaluationStack     = NewStack;\r
@@ -96,11 +96,11 @@ Routine Description:
 \r
 Arguments:\r
 \r
-  NONE \r
+  NONE\r
 \r
 Returns:\r
 \r
-  NONE \r
+  NONE\r
 \r
 --*/\r
 {\r
@@ -201,7 +201,7 @@ GrowBooleanExpression (
     //\r
     // Free The Old buffer\r
     //\r
-    gBS->FreePool (*BooleanExpression);\r
+    FreePool (*BooleanExpression);\r
   } else {\r
     //\r
     // Copy data into new buffer\r
@@ -484,7 +484,7 @@ Returns:
 \r
     Width = (*PIterator)->Width;\r
 \r
-    // \r
+    //\r
     //  Because INVALID_OFFSET_VALUE - 1 is reserved for TRUE or FALSE, omit them.\r
     //\r
     if ((*PIterator)->QuestionId1 != INVALID_OFFSET_VALUE &&\r
@@ -498,7 +498,7 @@ Returns:
           MapValue = (UINT8) *MapBuffer;\r
         }\r
 \r
-        gBS->FreePool (MapBuffer);\r
+        FreePool (MapBuffer);\r
       }\r
 \r
       if (MapBuffer2 != NULL) {\r
@@ -508,16 +508,16 @@ Returns:
           MapValue2 = (UINT8) *MapBuffer2;\r
         }\r
 \r
-        gBS->FreePool (MapBuffer2);\r
+        FreePool (MapBuffer2);\r
       }\r
     }\r
 \r
     switch ((*PIterator)->Operand) {\r
     case EFI_IFR_EQ_VAR_VAL_OP:\r
       UnicodeValueToString (\r
-        VariableName, \r
-        FALSE, \r
-        (UINTN) (*PIterator)->QuestionId1, \r
+        VariableName,\r
+        FALSE,\r
+        (UINTN) (*PIterator)->QuestionId1,\r
         (sizeof (VariableName) / sizeof (VariableName[0])) - 1\r
         );\r
 \r
@@ -727,7 +727,7 @@ Returns:
       return Operator;\r
     }\r
 \r
-    // \r
+    //\r
     //  Because INVALID_OFFSET_VALUE - 1 is reserved for TRUE or FALSE, omit them.\r
     //\r
     if (Iterator->QuestionId1 != INVALID_OFFSET_VALUE &&\r
@@ -741,7 +741,7 @@ Returns:
           MapValue = (UINT8) *MapBuffer;\r
         }\r
 \r
-        gBS->FreePool (MapBuffer);\r
+        FreePool (MapBuffer);\r
       }\r
 \r
       if (MapBuffer2 != NULL) {\r
@@ -751,7 +751,7 @@ Returns:
           MapValue2 = (UINT8) *MapBuffer2;\r
         }\r
 \r
-        gBS->FreePool (MapBuffer2);\r
+        FreePool (MapBuffer2);\r
       }\r
     }\r
 \r
@@ -814,9 +814,9 @@ Returns:
       }\r
 \r
       UnicodeValueToString (\r
-        VariableName, \r
-        FALSE, \r
-        (UINTN) Iterator->QuestionId1, \r
+        VariableName,\r
+        FALSE,\r
+        (UINTN) Iterator->QuestionId1,\r
         (sizeof (VariableName) / sizeof (VariableName[0])) - 1\r
         );\r
 \r
@@ -913,7 +913,7 @@ Returns:
             MapValue = (UINT8) *MapBuffer;\r
           }\r
 \r
-          gBS->FreePool (MapBuffer);\r
+          FreePool (MapBuffer);\r
         }\r
 \r
         if (MapBuffer2 != NULL) {\r
@@ -923,7 +923,7 @@ Returns:
             MapValue2 = (UINT8) *MapBuffer2;\r
           }\r
 \r
-          gBS->FreePool (MapBuffer2);\r
+          FreePool (MapBuffer2);\r
         }\r
       }\r
 \r
@@ -947,9 +947,9 @@ Returns:
       //\r
       case EFI_IFR_EQ_VAR_VAL_OP:\r
         UnicodeValueToString (\r
-          VariableName, \r
-          FALSE, \r
-          (UINTN) Iterator->QuestionId1, \r
+          VariableName,\r
+          FALSE,\r
+          (UINTN) Iterator->QuestionId1,\r
           (sizeof (VariableName) / sizeof (VariableName[0])) - 1\r
           );\r
 \r
@@ -1049,7 +1049,7 @@ Returns:
             MapValue = (UINT8) *MapBuffer;\r
           }\r
 \r
-          gBS->FreePool (MapBuffer);\r
+          FreePool (MapBuffer);\r
         }\r
 \r
         if (MapBuffer2 != NULL) {\r
@@ -1059,7 +1059,7 @@ Returns:
             MapValue2 = (UINT8) *MapBuffer2;\r
           }\r
 \r
-          gBS->FreePool (MapBuffer2);\r
+          FreePool (MapBuffer2);\r
         }\r
       }\r
 \r
@@ -1083,9 +1083,9 @@ Returns:
       //\r
       case EFI_IFR_EQ_VAR_VAL_OP:\r
         UnicodeValueToString (\r
-          VariableName, \r
-          FALSE, \r
-          (UINTN) Iterator->QuestionId1, \r
+          VariableName,\r
+          FALSE,\r
+          (UINTN) Iterator->QuestionId1,\r
           (sizeof (VariableName) / sizeof (VariableName[0])) - 1\r
           );\r
 \r
@@ -1205,7 +1205,7 @@ Returns:
             MapValue = (UINT8) *MapBuffer;\r
           }\r
 \r
-          gBS->FreePool (MapBuffer);\r
+          FreePool (MapBuffer);\r
         }\r
 \r
         if (MapBuffer2 != NULL) {\r
@@ -1215,7 +1215,7 @@ Returns:
             MapValue2 = (UINT8) *MapBuffer2;\r
           }\r
 \r
-          gBS->FreePool (MapBuffer2);\r
+          FreePool (MapBuffer2);\r
         }\r
       }\r
 \r
@@ -1231,9 +1231,9 @@ Returns:
       //\r
       case EFI_IFR_EQ_VAR_VAL_OP:\r
         UnicodeValueToString (\r
-          VariableName, \r
-          FALSE, \r
-          (UINTN) Iterator->QuestionId1, \r
+          VariableName,\r
+          FALSE,\r
+          (UINTN) Iterator->QuestionId1,\r
           (sizeof (VariableName) / sizeof (VariableName[0])) - 1\r
           );\r
 \r
@@ -1295,7 +1295,7 @@ Returns:
         PushBool (&StackPtr, Operator);\r
       }\r
       break;\r
-    \r
+\r
     case EFI_IFR_TRUE_OP:\r
       //\r
       // To check whether Ifr is legacy. Once every boolean expression.\r
index 332898f8ad87bc6d919832df787ab79601872919..85e1a0cf984fc5b16b760fafd05182d35930c57d 100644 (file)
@@ -14,7 +14,7 @@ Module Name:
   InputHandler.C\r
 \r
 Abstract:\r
-  \r
+\r
   Implementation for handling user input from the User Interface\r
 \r
 Revision History\r
@@ -86,7 +86,7 @@ ReadString(
   //\r
   CreatePopUp (ScreenSize, 4, &NullCharacter, PromptForDataString, Space, &NullCharacter);\r
 \r
-  gBS->FreePool (PromptForDataString);\r
+  FreePool (PromptForDataString);\r
 \r
   gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_BLACK, EFI_LIGHTGRAY));\r
 \r
@@ -107,8 +107,8 @@ ReadString(
         break;\r
 \r
       case SCAN_ESC:\r
-        gBS->FreePool (TempString);\r
-        gBS->FreePool (BufferedString);\r
+        FreePool (TempString);\r
+        FreePool (BufferedString);\r
         gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
         gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);\r
         return EFI_DEVICE_ERROR;\r
@@ -122,8 +122,8 @@ ReadString(
     case CHAR_CARRIAGE_RETURN:\r
       if (GetStringWidth (StringPtr) >= MenuOption->ThisTag->Minimum) {\r
         SelectionComplete = TRUE;\r
-        gBS->FreePool (TempString);\r
-        gBS->FreePool (BufferedString);\r
+        FreePool (TempString);\r
+        FreePool (BufferedString);\r
         gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
         gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);\r
         return EFI_SUCCESS;\r
@@ -137,8 +137,8 @@ ReadString(
         do {\r
           Status = WaitForKeyStroke (&Key);\r
         } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
-        gBS->FreePool (TempString);\r
-        gBS->FreePool (BufferedString);\r
+        FreePool (TempString);\r
+        FreePool (BufferedString);\r
         gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
         gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);\r
         return EFI_DEVICE_ERROR;\r
@@ -309,7 +309,7 @@ Error:
         WidthOfString = GetStringWidth (Packet->String);\r
         ScreenSize = EFI_MAX(WidthOfString, GetStringWidth (gPressEnter)) / 2;\r
         CreatePopUp (ScreenSize, 4, &NullCharacter, Packet->String, gPressEnter, &NullCharacter);\r
-        gBS->FreePool (Packet);\r
+        FreePool (Packet);\r
 \r
         do {\r
           Status = WaitForKeyStroke (&Key);\r
@@ -422,7 +422,7 @@ Error:
                 WidthOfString = GetStringWidth (Packet->String);\r
                 ScreenSize = EFI_MAX (WidthOfString, GetStringWidth (gPressEnter)) / 2;\r
                 CreatePopUp (ScreenSize, 4, &NullCharacter, Packet->String, gPressEnter, &NullCharacter);\r
-                gBS->FreePool (Packet);\r
+                FreePool (Packet);\r
               }\r
 \r
               StringPtr[0] = CHAR_NULL;\r
@@ -571,8 +571,8 @@ Error:
   } while (1);\r
 \r
 Done:\r
-  gBS->FreePool (TempString);\r
-  gBS->FreePool (TempString2);\r
+  FreePool (TempString);\r
+  FreePool (TempString2);\r
   return Status;\r
 }\r
 \r
@@ -600,7 +600,7 @@ EncodePassword (
 \r
   CopyMem (Password, Buffer, MaxSize);\r
 \r
-  gBS->FreePool (Buffer);\r
+  FreePool (Buffer);\r
   return ;\r
 }\r
 \r
@@ -880,7 +880,7 @@ EnterCarriageReturn:
 \r
             case CHAR_CARRIAGE_RETURN:\r
               SelectionComplete = TRUE;\r
-              gBS->FreePool (StringPtr);\r
+              FreePool (StringPtr);\r
               break;\r
 \r
             default:\r
@@ -1083,7 +1083,7 @@ GetSelectionInputPopUp (
         PopUpWidth = StrLen (StringPtr);\r
       }\r
 \r
-      gBS->FreePool (StringPtr);\r
+      FreePool (StringPtr);\r
     }\r
   }\r
   //\r
@@ -1224,7 +1224,7 @@ GetSelectionInputPopUp (
           TempStringPtr = AllocateZeroPool (sizeof (CHAR16) * (PopUpWidth - 1));\r
           ASSERT (TempStringPtr != NULL);\r
           CopyMem (TempStringPtr, StringPtr, (sizeof (CHAR16) * (PopUpWidth - 5)));\r
-          gBS->FreePool (StringPtr);\r
+          FreePool (StringPtr);\r
           StringPtr = TempStringPtr;\r
           StrCat (StringPtr, (CHAR16 *) L"...");\r
         }\r
@@ -1256,7 +1256,7 @@ GetSelectionInputPopUp (
           PrintStringAt (Start + 2, Index2, StringPtr);\r
         }\r
 \r
-        gBS->FreePool (StringPtr);\r
+        FreePool (StringPtr);\r
         Index2 = Index2 + 1;\r
       }\r
     }\r
@@ -1520,7 +1520,7 @@ TheKey:
       case SCAN_ESC:\r
         gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);\r
         if (ValueArrayBackup != NULL) {\r
-          gBS->FreePool (ValueArrayBackup);\r
+          FreePool (ValueArrayBackup);\r
         }\r
 \r
         return EFI_DEVICE_ERROR;\r
@@ -1537,7 +1537,7 @@ TheKey:
       //\r
       if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {\r
         CopyMem (ValueArray, ValueArrayBackup, ValueCount);\r
-        gBS->FreePool (ValueArrayBackup);\r
+        FreePool (ValueArrayBackup);\r
       } else {\r
         *Value = TempValue;\r
       }\r
index 8c81fd8c54726467c70eb246b0180ee93d010dc3..6bbe810ee2c184fab2138c70b8e53c72eaa9c5ff 100644 (file)
@@ -1,12 +1,12 @@
 /*++\r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
   Presentation.c\r
@@ -60,7 +60,7 @@ ClearLines (
 \r
   gST->ConOut->SetCursorPosition (gST->ConOut, LeftColumn, TopRow);\r
 \r
-  gBS->FreePool (Buffer);\r
+  FreePool (Buffer);\r
   return ;\r
 }\r
 \r
@@ -237,7 +237,7 @@ DisplayPageFrame (
           break;\r
         }\r
 \r
-        gBS->FreePool (StrFrontPageBanner);\r
+        FreePool (StrFrontPageBanner);\r
       }\r
     }\r
   }\r
@@ -318,7 +318,7 @@ DisplayPageFrame (
     }\r
   }\r
 \r
-  gBS->FreePool (Buffer);\r
+  FreePool (Buffer);\r
 \r
 }\r
 \r
@@ -327,7 +327,7 @@ DisplayPageFrame (
 ?F2=Previous Page                 Setup Page                                  ?\r
 +------------------------------------------------------------------------------+\r
 \r
-    \r
+\r
 \r
 \r
 \r
@@ -437,7 +437,7 @@ DisplayForm (
   //\r
   // Remove Buffer allocated for StringPtr after it has been used.\r
   //\r
-  gBS->FreePool (StringPtr);\r
+  FreePool (StringPtr);\r
 \r
   for (Index = 0; FormTags.Tags[Index].Operand != EFI_IFR_END_FORM_OP; Index++) {\r
     GrayOut       = FALSE;\r
@@ -595,7 +595,7 @@ GetOut:
             FormTags.Tags[Index].NumberOfLines++;\r
           }\r
 \r
-          gBS->FreePool (OutputString);\r
+          FreePool (OutputString);\r
         }\r
 \r
         ArrayEntry = 0;\r
@@ -1113,9 +1113,9 @@ Routine Description:
   The function does the most of the works when the EFI_TAG that\r
   user selects on is EFI_IFR_FLAG_INTERACTIVE or EFI_IFR_PASSWORD_OP:\r
   invoke CallBack, update the new form data.\r
-  \r
+\r
 Arguments:\r
-  \r
+\r
   Selection         - The current selection of the form.\r
   CallbackData      - The pointer to host the data passed back by the callback function.\r
   FileFormTagsHead  - Prompt string token of the one-of box\r
@@ -1123,10 +1123,10 @@ Arguments:
   FormHandle        - Output the  the handle of the form.\r
   TitleToken        - Output the  TitleToken of the new page.\r
   FormTags          - Output the  FormFags of the new page.\r
-  \r
-Returns: \r
+\r
+Returns:\r
   VOID\r
-  \r
+\r
 --*/\r
 {\r
   UINTN                       Index;\r
@@ -1212,7 +1212,7 @@ Returns:
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (LocalTags->Tags);\r
+    FreePool (LocalTags->Tags);\r
     return ;\r
   }\r
 \r
@@ -1317,7 +1317,7 @@ Returns:
   }\r
 \r
   if (Packet != NULL) {\r
-    gBS->FreePool (Packet);\r
+    FreePool (Packet);\r
   }\r
 \r
   for (BackupIndex = 0; LocalTags->Tags[BackupIndex].Operand != EFI_IFR_END_FORM_OP; BackupIndex++) {\r
@@ -1347,7 +1347,7 @@ Returns:
   // Delete the buffer associated with previous dynamic page\r
   // We will re-allocate a buffer....\r
   //\r
-  gBS->FreePool (LocalTags->Tags);\r
+  FreePool (LocalTags->Tags);\r
 \r
   Length  = 0xF000;\r
   Buffer  = AllocateZeroPool (Length);\r
index a051b47827eb3e71d3659a14ceda08f44fbe7492..a751727f305c335e94d7c7ddd171b69d1a8a7602 100644 (file)
@@ -1,13 +1,13 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
@@ -16,9 +16,9 @@ Module Name:
 Abstract:\r
 \r
   Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very\r
-  simple implemenation of SPrint() and Print() to support debug. \r
+  simple implemenation of SPrint() and Print() to support debug.\r
 \r
-  You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a \r
+  You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a\r
   time. This makes the implementation very simple.\r
 \r
   VSPrint, Print, SPrint format specification has the follwoing form\r
@@ -122,8 +122,8 @@ _IPrint (
   //\r
   Out->OutputString (Out, &BackupBuffer[PreviousIndex]);\r
 \r
-  gBS->FreePool (Buffer);\r
-  gBS->FreePool (BackupBuffer);\r
+  FreePool (Buffer);\r
+  FreePool (BackupBuffer);\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -202,51 +202,6 @@ Returns:
   return Print ((CHAR16 *) L"%c", Character);\r
 }\r
 \r
-/*\r
-UINTN\r
-PrintToken (\r
-  IN EFI_HII_HANDLE   Handle,\r
-  IN UINT16           Token,\r
-  IN CHAR16           *Language,\r
-  ...\r
-  )\r
-{\r
-  VA_LIST             args;\r
-  UINTN               NumberOfHiiHandles;\r
-  EFI_HANDLE          *HandleBuffer;\r
-  EFI_HII_PROTOCOL    *Hii;\r
-\r
-  //\r
-  // There should only be one HII image\r
-  //\r
-  Status = gBS->LocateHandleBuffer (\r
-                 ByProtocol, \r
-                 &gEfiHiiProtocolGuid, \r
-                 NULL,\r
-                 &NumberOfHiiHandles, \r
-                 &HandleBuffer\r
-                 );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Retrieve the Hii protocol interface\r
-  //\r
-  Status = gBS->HandleProtocol (\r
-                 HandleBuffer[0], \r
-                 &gEfiHiiProtocolGuid, \r
-                 &Hii\r
-                 );\r
-\r
-  Hii->GetString (Hii, Handle, Token, FALSE, Language, \r
-\r
-  VA_START (args, fmt);\r
-  return _IPrint ((UINTN) -1, (UINTN) -1, gST->ConOut, fmt, args);\r
-}\r
-\r
-*/\r
 UINTN\r
 PrintAt (\r
   IN UINTN     Column,\r
@@ -258,7 +213,7 @@ PrintAt (
 \r
 Routine Description:\r
 \r
-  Prints a formatted unicode string to the default console, at \r
+  Prints a formatted unicode string to the default console, at\r
   the supplied cursor position\r
 \r
 Arguments:\r
@@ -289,7 +244,7 @@ PrintStringAt (
 \r
 Routine Description:\r
 \r
-  Prints a unicode string to the default console, at \r
+  Prints a unicode string to the default console, at\r
   the supplied cursor position, using L"%s" format.\r
 \r
 Arguments:\r
@@ -317,7 +272,7 @@ PrintCharAt (
 \r
 Routine Description:\r
 \r
-  Prints a chracter to the default console, at \r
+  Prints a chracter to the default console, at\r
   the supplied cursor position, using L"%c" format.\r
 \r
 Arguments:\r
index 2484f5089c321784aa9660587f34995d08cf110c..a2dc8083460a2b6ef6521608aaeddf7fe8be1948 100644 (file)
@@ -138,7 +138,7 @@ AdjustNvMap (
     }\r
   }\r
 \r
-  gBS->FreePool (VariableDefinition->NvRamMap);\r
+  FreePool (VariableDefinition->NvRamMap);\r
   VariableDefinition->NvRamMap          = NvRamMap;\r
   VariableDefinition->VariableFakeSize  = (UINT16) SizeRequired;\r
 }\r
@@ -226,7 +226,7 @@ ProcessOptions (
                   );\r
 \r
   if (*OptionString != NULL) {\r
-    gBS->FreePool (*OptionString);\r
+    FreePool (*OptionString);\r
     *OptionString = NULL;\r
   }\r
 \r
@@ -311,7 +311,7 @@ ProcessOptions (
       if (!EFI_ERROR (Status)) {\r
         if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {\r
           CopyMem (NvRamMap, ValueArray, MenuOption->ThisTag->StorageWidth);\r
-          gBS->FreePool (ValueArray);\r
+          FreePool (ValueArray);\r
         } else {\r
           //\r
           // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth\r
@@ -359,7 +359,7 @@ ProcessOptions (
                 // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth\r
                 //\r
                 CopyMem (NvRamMap, &Number, MenuOption->ThisTag->StorageWidth);\r
-                gBS->FreePool (StringPtr);\r
+                FreePool (StringPtr);\r
                 break;\r
 \r
               default:\r
@@ -372,7 +372,7 @@ ProcessOptions (
         UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);\r
       } else {\r
         if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {\r
-          gBS->FreePool (ValueArray);\r
+          FreePool (ValueArray);\r
         }\r
 \r
         return EFI_SUCCESS;\r
@@ -434,7 +434,7 @@ ProcessOptions (
             //\r
             // Remove Buffer allocated for StringPtr after it has been used.\r
             //\r
-            gBS->FreePool (StringPtr);\r
+            FreePool (StringPtr);\r
           } else {\r
             //\r
             // The option value is the same as what is stored in NV store.  Print this.\r
@@ -447,7 +447,7 @@ ProcessOptions (
               //\r
               // Remove Buffer allocated for StringPtr after it has been used.\r
               //\r
-              gBS->FreePool (StringPtr);\r
+              FreePool (StringPtr);\r
               Default = 0;\r
               break;\r
             }\r
@@ -475,7 +475,7 @@ ProcessOptions (
         //\r
         // Remove Buffer allocated for StringPtr after it has been used.\r
         //\r
-        gBS->FreePool (StringPtr);\r
+        FreePool (StringPtr);\r
       }\r
     }\r
     break;\r
@@ -1028,7 +1028,7 @@ ProcessOptions (
         UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);\r
       }\r
 \r
-      gBS->FreePool (StringPtr);\r
+      FreePool (StringPtr);\r
       return Status;\r
     } else {\r
       for (Index = 0; Index < gOptionBlockWidth; Index++) {\r
@@ -1073,13 +1073,13 @@ ProcessOptions (
 \r
         if (EFI_ERROR (Status)) {\r
           if (Status == EFI_NOT_READY) {\r
-            gBS->FreePool (StringPtr);\r
+            FreePool (StringPtr);\r
             return EFI_SUCCESS;\r
           }\r
         }\r
 \r
         Status = ReadPassword (MenuOption, TRUE, Tag, PageData, TRUE, FileFormTags, StringPtr);\r
-        gBS->FreePool (StringPtr);\r
+        FreePool (StringPtr);\r
         return EFI_SUCCESS;\r
       }\r
 \r
@@ -1090,7 +1090,7 @@ ProcessOptions (
           //\r
           Status = ReadPassword (MenuOption, TRUE, Tag, PageData, FALSE, FileFormTags, StringPtr);\r
           if (EFI_ERROR (Status)) {\r
-            gBS->FreePool (StringPtr);\r
+            FreePool (StringPtr);\r
             return EFI_SUCCESS;\r
           }\r
 \r
@@ -1102,7 +1102,7 @@ ProcessOptions (
           }\r
 \r
           if (Status != 0) {\r
-            gBS->FreePool (StringPtr);\r
+            FreePool (StringPtr);\r
             return EFI_SUCCESS;\r
           } else {\r
             break;\r
@@ -1123,7 +1123,7 @@ ProcessOptions (
         //\r
         // User couldn't figure out how to type two identical passwords\r
         //\r
-        gBS->FreePool (StringPtr);\r
+        FreePool (StringPtr);\r
         return EFI_SUCCESS;\r
       }\r
       //\r
@@ -1180,8 +1180,8 @@ ProcessOptions (
                         );\r
       }\r
 \r
-      gBS->FreePool (TmpNvRamMap);\r
-      gBS->FreePool (StringPtr);\r
+      FreePool (TmpNvRamMap);\r
+      FreePool (StringPtr);\r
       break;\r
     }\r
 \r
index 759eb5efb993398e5c51870e4163939ade7dd616..a0a7f1ba78891842aa95740caf3a09859cb8fbab 100644 (file)
@@ -1,14 +1,14 @@
 /**@file\r
   Entry and initialization module for the browser.\r
-  \r
+\r
 Copyright (c) 2006 - 2007 Intel Corporation. <BR>\r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -21,7 +21,7 @@ FUNCTIION_KEY_SETTING gFunctionKeySettingTable[] = {
   //\r
   {\r
     {\r
-      0x847bc3fe, \r
+      0x847bc3fe,\r
       0xb974,\r
       0x446d,\r
       {\r
@@ -162,7 +162,7 @@ SendForm (
 Routine Description:\r
 \r
   This is the routine which an external caller uses to direct the browser\r
-  where to obtain it's information.  \r
+  where to obtain it's information.\r
 \r
 Arguments:\r
 \r
@@ -185,7 +185,7 @@ Arguments:
                     needs to provide to the browser the current settings for the "fake" NV variable.  If used, no saving\r
                     of an NV variable will be possible.  This parameter is also ignored if HandleCount > 1.\r
 \r
-Returns: \r
+Returns:\r
 \r
 --*/\r
 {\r
@@ -292,7 +292,7 @@ Returns:
                       );\r
 \r
       if (EFI_ERROR (Status)) {\r
-        gBS->FreePool (CallbackData);\r
+        FreePool (CallbackData);\r
         return Status;;\r
       }\r
 \r
@@ -304,7 +304,7 @@ Returns:
     Status = InitializeBinaryStructures (Handle, UseDatabase, Packet, NvMapOverride, HandleCount, &FileFormTagsHead);\r
 \r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (CallbackData);\r
+      FreePool (CallbackData);\r
       return Status;\r
     }\r
     //\r
@@ -327,7 +327,7 @@ Returns:
 \r
     if (UseDatabase && (HandleCount > 1)) {\r
       if (Selection == NULL) {\r
-        gBS->FreePool (CallbackData);\r
+        FreePool (CallbackData);\r
         return EFI_SUCCESS;\r
       }\r
     }\r
@@ -357,12 +357,12 @@ Returns:
     *Handle = BackupHandle;\r
 \r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (CallbackData);\r
+      FreePool (CallbackData);\r
       return Status;\r
     }\r
 \r
     if (Callback && (AltSelection == NULL)) {\r
-      gBS->FreePool (CallbackData);\r
+      FreePool (CallbackData);\r
       return Status;\r
     }\r
 \r
@@ -379,7 +379,7 @@ Returns:
         //\r
         // If this is the FrontPage, return after every selection\r
         //\r
-        gBS->FreePool (Selection);\r
+        FreePool (Selection);\r
         UiFreeMenu ();\r
 \r
         //\r
@@ -390,11 +390,11 @@ Returns:
         gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
         gST->ConOut->ClearScreen (gST->ConOut);\r
 \r
-        gBS->FreePool (CallbackData);\r
+        FreePool (CallbackData);\r
         return EFI_SUCCESS;\r
       }\r
 \r
-      gBS->FreePool (Selection);\r
+      FreePool (Selection);\r
       UiFreeMenu ();\r
 \r
       //\r
@@ -405,14 +405,14 @@ Returns:
       gST->ConOut->ClearScreen (gST->ConOut);\r
 \r
       if (!Callback) {\r
-        gBS->FreePool (CallbackData);\r
+        FreePool (CallbackData);\r
         return EFI_SUCCESS;\r
       }\r
     }\r
 \r
   } while (!EFI_ERROR (Status));\r
 \r
-  gBS->FreePool (CallbackData);\r
+  FreePool (CallbackData);\r
   return Status;\r
 }\r
 \r
@@ -426,11 +426,11 @@ InitializeSetup (
 \r
 Routine Description:\r
   Initialize Setup\r
-  \r
+\r
 Arguments:\r
   (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
 \r
-Returns: \r
+Returns:\r
   EFI_SUCCESS - Setup loaded.\r
   other       - Setup Error\r
 \r
@@ -491,7 +491,7 @@ Returns:
 \r
   Status      = Hii->NewPack (Hii, PackageList, &gHiiHandle);\r
 \r
-  gBS->FreePool (PackageList);\r
+  FreePool (PackageList);\r
 \r
   //\r
   // Install protocol interface\r
@@ -532,7 +532,7 @@ Arguments:
   Index            - Offset of the current opcode in the Ifr raw data.\r
   FileFormTags     - Pointer of current EFI_FILE_FORM_TAGS structure.\r
   CurrentVariable  - Current variable number.\r
-           \r
+\r
 Returns:\r
   None.\r
 --*/\r
@@ -605,7 +605,7 @@ Arguments:
   NumberOfLines    - Number of lines this opcode occupied.\r
   FileFormTags     - Pointer of current EFI_FILE_FORM_TAGS structure.\r
   CurrentVariable  - Current variable number.\r
-           \r
+\r
 Returns:\r
   None.\r
 --*/\r
@@ -661,7 +661,7 @@ Returns:
         CopyMem (&Tag->Value, &Tag->Default, sizeof (UINT16));\r
       }\r
       break;\r
-    } \r
+    }\r
   }\r
 }\r
 \r
@@ -713,11 +713,11 @@ AddNextInconsistentTag (
 \r
 Routine Description:\r
   Initialize the next inconsistent tag data and add it to the inconsistent tag list.\r
-  \r
+\r
 Arguments:\r
  InconsistentTagsPtr   - Pointer of the inconsistent tag's pointer.\r
 \r
-Returns: \r
+Returns:\r
   None.\r
 \r
 --*/\r
@@ -829,13 +829,14 @@ InitializeTagStructures (
       //\r
       for (Index = 0; Index < NumberOfTags; Index++) {\r
         if (FormTags->Tags[Index].IntList != NULL) {\r
-          gBS->FreePool (FormTags->Tags[Index].IntList);\r
+          FreePool (FormTags->Tags[Index].IntList);\r
         }\r
       }\r
 \r
-      gBS->FreePool (FormTags->Tags);\r
-      gBS->FreePool (FormTags->Next);\r
-      FormTags->Next  = NULL;\r
+      FreePool (FormTags->Tags);\r
+\r
+      ASSERT (FormTags->Next == NULL);\r
+\r
       FormTags->Tags  = NULL;\r
 \r
       FormTags        = SavedFormTags;\r
@@ -1350,7 +1351,7 @@ InitializeTagStructures (
       // Since this op-code doesn't use the next field(s), initialize them with something invalid.\r
       // Unfortunately 0 is a valid offset value for a QuestionId\r
       //\r
-      \r
+\r
       //\r
       // Reserve INVALID_OFFSET_VALUE - 1 for TRUE or FALSE because they are inconsistency tags also, but\r
       // have no coresponding id. The examination of id is needed by evaluating boolean expression.\r
@@ -1571,8 +1572,8 @@ InitPage (
     HomeEscapeString\r
     );\r
   gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
-  gBS->FreePool (HomeEscapeString);\r
-  gBS->FreePool (HomePageString);\r
+  FreePool (HomeEscapeString);\r
+  FreePool (HomePageString);\r
 \r
   return ;\r
 }\r
@@ -1585,14 +1586,14 @@ GetToken (
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
   Get the string based on the TokenID and HII Handle.\r
 \r
 Arguments:\r
 \r
   Token       - The Token ID.\r
   HiiHandle   - Handle of Ifr to be fetched.\r
-           \r
+\r
 Returns:\r
 \r
   The output string.\r
@@ -1618,7 +1619,7 @@ Returns:
       //\r
       // Free the old pool\r
       //\r
-      gBS->FreePool (Buffer);\r
+      FreePool (Buffer);\r
 \r
       //\r
       // Allocate new pool with correct value\r
@@ -1955,8 +1956,8 @@ InitializeBinaryStructures (
             //\r
             // Free the buffer that was allocated that was too small\r
             //\r
-            gBS->FreePool (VariableDefinition->NvRamMap);\r
-            gBS->FreePool (VariableDefinition->FakeNvRamMap);\r
+            FreePool (VariableDefinition->NvRamMap);\r
+            FreePool (VariableDefinition->FakeNvRamMap);\r
 \r
             VariableDefinition->NvRamMap = AllocateZeroPool (SizeOfNvStore);\r
             VariableDefinition->FakeNvRamMap = AllocateZeroPool (SizeOfNvStore + VariableDefinition->VariableFakeSize);\r
@@ -1986,18 +1987,18 @@ InitializeBinaryStructures (
           // if the variable was not found, we will retrieve default values\r
           //\r
           if (Status == EFI_NOT_FOUND) {\r
-        \r
+\r
             if (0 == CompareMem (VariableDefinition->VariableName, L"Setup", 10)) {\r
 \r
               NvMapListHead = NULL;\r
-              \r
+\r
               Status = Hii->GetDefaultImage (Hii, Handle[HandleIndex], EFI_IFR_FLAG_DEFAULT, &NvMapListHead);\r
 \r
               if (!EFI_ERROR (Status)) {\r
                 ASSERT_EFI_ERROR (NULL != NvMapListHead);\r
-                \r
+\r
                 NvMapListNode = NvMapListHead;\r
-                \r
+\r
                 while (NULL != NvMapListNode) {\r
                   if (VariableDefinition->VariableId == NvMapListNode->VariablePack->VariableId) {\r
                     NvMap     = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);\r
@@ -2006,25 +2007,25 @@ InitializeBinaryStructures (
                     }\r
                   NvMapListNode = NvMapListNode->NextVariablePack;\r
                 }\r
-                \r
+\r
                 //\r
                 // Free the buffer that was allocated.\r
                 //\r
-                gBS->FreePool (VariableDefinition->NvRamMap);\r
-                gBS->FreePool (VariableDefinition->FakeNvRamMap);\r
-                \r
+                FreePool (VariableDefinition->NvRamMap);\r
+                FreePool (VariableDefinition->FakeNvRamMap);\r
+\r
                 //\r
                 // Allocate, copy the NvRamMap.\r
                 //\r
                 VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize - VariableDefinition->VariableSize);\r
                 VariableDefinition->VariableSize = (UINT16) NvMapSize;\r
                 VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize + VariableDefinition->VariableSize);\r
-                \r
+\r
                 VariableDefinition->NvRamMap = AllocateZeroPool (VariableDefinition->VariableSize);\r
                 VariableDefinition->FakeNvRamMap = AllocateZeroPool (NvMapSize + VariableDefinition->VariableFakeSize);\r
 \r
                 CopyMem (VariableDefinition->NvRamMap, NvMap, NvMapSize);\r
-                gBS->FreePool (NvMapListHead);\r
+                FreePool (NvMapListHead);\r
               }\r
 \r
             }\r
@@ -2060,7 +2061,7 @@ Arguments:
   HiiHandle   - Handle of Ifr to be fetched.\r
   Packet      - Pointer to IFR packet.\r
   BinaryData  - Buffer to copy the string into\r
-           \r
+\r
 Returns:\r
   Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
 \r
@@ -2098,7 +2099,7 @@ Returns:
 \r
     if (Status == EFI_BUFFER_TOO_SMALL) {\r
 \r
-      gBS->FreePool (Buffer);\r
+      FreePool (Buffer);\r
 \r
       //\r
       // Allocate memory for our Form binary\r
@@ -2121,7 +2122,7 @@ Returns:
 \r
     Status      = Hii->NewPack (Hii, PackageList, &HiiHandle);\r
 \r
-    gBS->FreePool (PackageList);\r
+    FreePool (PackageList);\r
   }\r
 \r
   if (EFI_ERROR (Status)) {\r
index 48b02bf33282fb0ce17e4e83986763a7ce8c8e1a..40bd826023612da0a4d4d0c3108f9b7bdd2ab5ae 100644 (file)
@@ -1,14 +1,14 @@
 /**@file\r
   Implementation for UI.\r
-  \r
-Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -63,7 +63,7 @@ Routine Description:
   Initialize Menu option list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -81,7 +81,7 @@ Routine Description:
   Initialize Menu option list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -100,7 +100,7 @@ Routine Description:
   Remove Menu option list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -119,7 +119,7 @@ Returns:
     (*PreviousSelection)->Handle    = UiMenuList->Selection.Handle;\r
     gEntryNumber                    = UiMenuList->FormerEntryNumber;\r
     RemoveEntryList (&UiMenuList->MenuLink);\r
-    gBS->FreePool (UiMenuList);\r
+    FreePool (UiMenuList);\r
   }\r
 }\r
 \r
@@ -133,7 +133,7 @@ Routine Description:
   Free Menu option linked list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -143,7 +143,7 @@ Returns:
   while (!IsListEmpty (&gMenuList)) {\r
     UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);\r
     RemoveEntryList (&UiMenuList->MenuLink);\r
-    gBS->FreePool (UiMenuList);\r
+    FreePool (UiMenuList);\r
   }\r
 }\r
 \r
@@ -157,7 +157,7 @@ Routine Description:
   Add one menu entry to the linked lst\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -183,7 +183,7 @@ Routine Description:
   Free Menu option linked list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -197,8 +197,8 @@ Returns:
     //\r
     // We allocated space for this description when we did a GetToken, free it here\r
     //\r
-    gBS->FreePool (MenuOption->Description);\r
-    gBS->FreePool (MenuOption);\r
+    FreePool (MenuOption->Description);\r
+    FreePool (MenuOption);\r
   }\r
 }\r
 \r
@@ -213,7 +213,7 @@ Routine Description:
   Refresh screen with current date and/or time based on screen context\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -256,7 +256,7 @@ Returns:
   }\r
 \r
   if (OptionString != NULL) {\r
-    gBS->FreePool (OptionString);\r
+    FreePool (OptionString);\r
   }\r
 }\r
 \r
@@ -373,7 +373,7 @@ Routine Description:
 Arguments:\r
   String - String description for this option.\r
   Context - Context data for entry.\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -414,7 +414,7 @@ Routine Description:
 Arguments:\r
   String - String description for this option.\r
   Context - Context data for entry.\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -457,7 +457,7 @@ Routine Description:
 \r
 Arguments:\r
   NumberOfLines -     The number of lines for the dialog box\r
-  HotKey -            Defines whether a single character is parsed (TRUE) and returned in KeyValue \r
+  HotKey -            Defines whether a single character is parsed (TRUE) and returned in KeyValue\r
                       or a string is returned in StringBuffer.  Two special characters are considered when entering a string, a SCAN_ESC and\r
                       an CHAR_CARRIAGE_RETURN.  SCAN_ESC terminates string input and returns\r
   MaximumStringSize - The maximum size in bytes of a typed in string (each character is a CHAR16) and the minimum string returned is two bytes\r
@@ -465,7 +465,7 @@ Arguments:
   KeyValue -          The EFI_KEY value returned if HotKey is TRUE..\r
   String -            Pointer to the first string in the list\r
   ... -               A series of (quantity == NumberOfLines) text strings which will be used to construct the dialog box\r
-           \r
+\r
 Returns:\r
   EFI_SUCCESS -           Displayed dialog and received user interaction\r
   EFI_INVALID_PARAMETER - One of the parameters was invalid (e.g. (StringBuffer == NULL) && (HotKey == FALSE))\r
@@ -572,8 +572,8 @@ Returns:
       case CHAR_NULL:\r
         switch (Key.ScanCode) {\r
         case SCAN_ESC:\r
-          gBS->FreePool (TempString);\r
-          gBS->FreePool (BufferedString);\r
+          FreePool (TempString);\r
+          FreePool (BufferedString);\r
           gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);\r
           gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
           return EFI_DEVICE_ERROR;\r
@@ -586,8 +586,8 @@ Returns:
 \r
       case CHAR_CARRIAGE_RETURN:\r
         SelectionComplete = TRUE;\r
-        gBS->FreePool (TempString);\r
-        gBS->FreePool (BufferedString);\r
+        FreePool (TempString);\r
+        FreePool (BufferedString);\r
         gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);\r
         gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
         return EFI_SUCCESS;\r
@@ -829,8 +829,8 @@ UpdateStatusBar (
     break;\r
   }\r
 \r
-  gBS->FreePool (InputErrorMessage);\r
-  gBS->FreePool (NvUpdateMessage);\r
+  FreePool (InputErrorMessage);\r
+  FreePool (NvUpdateMessage);\r
   return ;\r
 }\r
 \r
@@ -843,11 +843,11 @@ FreeData (
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
   Used to remove the allocated data instances\r
 \r
 Arguments:\r
-             \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -867,11 +867,11 @@ Returns:
   FileForm = FileFormTagsHead;\r
 \r
   if (FormattedString != NULL) {\r
-    gBS->FreePool (FormattedString);\r
+    FreePool (FormattedString);\r
   }\r
 \r
   if (OptionString != NULL) {\r
-    gBS->FreePool (OptionString);\r
+    FreePool (OptionString);\r
   }\r
 \r
   for (; FileForm != NULL;) {\r
@@ -908,17 +908,17 @@ Returns:
         }\r
 \r
         if (FormTags->Tags[Index].IntList != NULL) {\r
-          gBS->FreePool (FormTags->Tags[Index].IntList);\r
+          FreePool (FormTags->Tags[Index].IntList);\r
         }\r
       }\r
 \r
       if (PreviousFormTags != NULL) {\r
-        gBS->FreePool (FormTags->Tags);\r
+        FreePool (FormTags->Tags);\r
         FormTags = PreviousFormTags;\r
-        gBS->FreePool (FormTags->Next);\r
+        FreePool (FormTags->Next);\r
         FormTags->Next = NULL;\r
       } else {\r
-        gBS->FreePool (FormTags->Tags);\r
+        FreePool (FormTags->Tags);\r
         FormTags = NULL;\r
       }\r
     }\r
@@ -942,7 +942,7 @@ Returns:
       //\r
       // Free the current entry\r
       //\r
-      gBS->FreePool (Inconsistent);\r
+      FreePool (Inconsistent);\r
 \r
       //\r
       // Restore the Previous pointer\r
@@ -963,26 +963,32 @@ Returns:
         PreviousVariableDefinition = VariableDefinition;\r
       }\r
 \r
-      gBS->FreePool (VariableDefinition->VariableName);\r
-      gBS->FreePool (VariableDefinition->NvRamMap);\r
-      gBS->FreePool (VariableDefinition->FakeNvRamMap);\r
+      FreePool (VariableDefinition->VariableName);\r
+\r
+      if (VariableDefinition->NvRamMap != NULL) {\r
+        FreePool (VariableDefinition->NvRamMap);\r
+      }\r
+\r
+      if (VariableDefinition->FakeNvRamMap != NULL) {\r
+        FreePool (VariableDefinition->FakeNvRamMap);\r
+      }\r
 \r
       if (PreviousVariableDefinition != NULL) {\r
         VariableDefinition = PreviousVariableDefinition;\r
-        gBS->FreePool (VariableDefinition->Next);\r
+        FreePool (VariableDefinition->Next);\r
         VariableDefinition->Next = NULL;\r
       } else {\r
-        gBS->FreePool (VariableDefinition);\r
+        FreePool (VariableDefinition);\r
         VariableDefinition = NULL;\r
       }\r
     }\r
 \r
     if (PreviousFileForm != NULL) {\r
       FileForm = PreviousFileForm;\r
-      gBS->FreePool (FileForm->NextFile);\r
+      FreePool (FileForm->NextFile);\r
       FileForm->NextFile = NULL;\r
     } else {\r
-      gBS->FreePool (FileForm);\r
+      FreePool (FileForm);\r
       FileForm = NULL;\r
     }\r
   }\r
@@ -1000,40 +1006,40 @@ Returns:
       PreviousIfrBinary = IfrBinary;\r
     }\r
 \r
-    gBS->FreePool (IfrBinary->IfrPackage);\r
+    FreePool (IfrBinary->IfrPackage);\r
 \r
     if (PreviousIfrBinary != NULL) {\r
       IfrBinary = PreviousIfrBinary;\r
-      gBS->FreePool (IfrBinary->Next);\r
+      FreePool (IfrBinary->Next);\r
       IfrBinary->Next = NULL;\r
     } else {\r
-      gBS->FreePool (IfrBinary);\r
+      FreePool (IfrBinary);\r
       IfrBinary = NULL;\r
     }\r
   }\r
 \r
-  gBS->FreePool (gPreviousValue);\r
+  FreePool (gPreviousValue);\r
   gPreviousValue = NULL;\r
 \r
   //\r
   // Free Browser Strings\r
   //\r
-  gBS->FreePool (gPressEnter);\r
-  gBS->FreePool (gConfirmError);\r
-  gBS->FreePool (gConfirmPassword);\r
-  gBS->FreePool (gPromptForNewPassword);\r
-  gBS->FreePool (gPromptForPassword);\r
-  gBS->FreePool (gToggleCheckBox);\r
-  gBS->FreePool (gNumericInput);\r
-  gBS->FreePool (gMakeSelection);\r
-  gBS->FreePool (gMoveHighlight);\r
-  gBS->FreePool (gEscapeString);\r
-  gBS->FreePool (gEnterCommitString);\r
-  gBS->FreePool (gEnterString);\r
-  gBS->FreePool (gFunctionOneString);\r
-  gBS->FreePool (gFunctionTwoString);\r
-  gBS->FreePool (gFunctionNineString);\r
-  gBS->FreePool (gFunctionTenString);\r
+  FreePool (gPressEnter);\r
+  FreePool (gConfirmError);\r
+  FreePool (gConfirmPassword);\r
+  FreePool (gPromptForNewPassword);\r
+  FreePool (gPromptForPassword);\r
+  FreePool (gToggleCheckBox);\r
+  FreePool (gNumericInput);\r
+  FreePool (gMakeSelection);\r
+  FreePool (gMoveHighlight);\r
+  FreePool (gEscapeString);\r
+  FreePool (gEnterCommitString);\r
+  FreePool (gEnterString);\r
+  FreePool (gFunctionOneString);\r
+  FreePool (gFunctionTwoString);\r
+  FreePool (gFunctionNineString);\r
+  FreePool (gFunctionTenString);\r
   return ;\r
 }\r
 \r
@@ -1046,11 +1052,11 @@ SelectionsAreValid (
 /*++\r
 \r
 Routine Description:\r
-  Initiate late consistency checks against the current page.  \r
+  Initiate late consistency checks against the current page.\r
 \r
 Arguments:\r
   None\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -1103,7 +1109,7 @@ Returns:
               // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth\r
               //\r
               CopyMem (NvRamMap, &Tag->OldValue, Tag->StorageWidth);\r
-              gBS->FreePool (StringPtr);\r
+              FreePool (StringPtr);\r
               break;\r
 \r
             default:\r
@@ -1133,7 +1139,7 @@ Routine Description:
 Arguments:\r
   Tag - The Tag structure passed in.\r
   Handle - The handle in the HII database being used\r
-  \r
+\r
 Returns:\r
   Returns the number of CHAR16 characters that is support.\r
 \r
@@ -1151,7 +1157,7 @@ Returns:
   if ((Tag->Operand == EFI_IFR_TEXT_OP) && (Tag->TextTwo != 0)) {\r
     String  = GetToken (Tag->TextTwo, Handle);\r
     Size    = StrLen (String);\r
-    gBS->FreePool (String);\r
+    FreePool (String);\r
   }\r
 \r
   if ((Tag->Operand == EFI_IFR_SUBTITLE_OP) ||\r
@@ -1188,7 +1194,7 @@ Arguments:
   LineWidth - Width of the desired string to extract in CHAR16 characters\r
   Index - Where in InputString to start the copy process\r
   OutputString - Buffer to copy the string into\r
-           \r
+\r
 Returns:\r
   Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
 \r
@@ -1213,14 +1219,14 @@ Returns:
   // Ensure we have got a valid buffer\r
   //\r
   if (*OutputString != NULL) {\r
-  \r
+\r
     //\r
     //NARROW_CHAR can not be printed in screen, so if a line only contain  the two CHARs: 'NARROW_CHAR + CHAR_CARRIAGE_RETURN' , it is a empty line  in Screen.\r
     //To avoid displaying this  empty line in screen,  just skip  the two CHARs here.\r
     //\r
    if ((InputString[*Index] == NARROW_CHAR) && (InputString[*Index + 1] == CHAR_CARRIAGE_RETURN)) {\r
      *Index = *Index + 2;\r
-   } \r
+   }\r
 \r
     //\r
     // Fast-forward the string and see if there is a carriage-return in the string\r
@@ -1323,7 +1329,7 @@ UpdateOptionSkipLines (
         }\r
       }\r
 \r
-      gBS->FreePool (OutputString);\r
+      FreePool (OutputString);\r
       if (SkipValue != 0) {\r
         SkipValue--;\r
       }\r
@@ -1382,9 +1388,9 @@ Arguments:
   SubMenu          - Indicate is sub menu.\r
   FileFormTagsHead - A pointer to the EFI_FILE_FORM_TAGS structure.\r
   PageData         - A pointer to the EFI_IFR_DATA_ARRAY.\r
-           \r
+\r
 Returns:\r
-  Return the pointer of the menu which selected, \r
+  Return the pointer of the menu which selected,\r
   otherwise return NULL.\r
 \r
 --*/\r
@@ -1548,7 +1554,7 @@ Returns:
         while (gMenuRefreshHead != NULL) {\r
           OldMenuRefreshEntry = gMenuRefreshHead->Next;\r
 \r
-          gBS->FreePool (gMenuRefreshHead);\r
+          FreePool (gMenuRefreshHead);\r
 \r
           gMenuRefreshHead = OldMenuRefreshEntry;\r
         }\r
@@ -1586,7 +1592,7 @@ Returns:
                 }\r
               }\r
 \r
-              gBS->FreePool (OutputString);\r
+              FreePool (OutputString);\r
               if (Temp != 0) {\r
                 Temp--;\r
               }\r
@@ -1681,7 +1687,7 @@ Returns:
                   }\r
                 }\r
 \r
-                gBS->FreePool (OutputString);\r
+                FreePool (OutputString);\r
                 if (Temp2 != 0) {\r
                   Temp2--;\r
                 }\r
@@ -1723,14 +1729,14 @@ Returns:
                   }\r
                 }\r
 \r
-                gBS->FreePool (OutputString);\r
+                FreePool (OutputString);\r
                 if (Temp2 != 0) {\r
                   Temp2--;\r
                 }\r
               }\r
 \r
               Row = OriginalRow;\r
-              gBS->FreePool (StringPtr);\r
+              FreePool (StringPtr);\r
             }\r
           } else {\r
             //\r
@@ -1848,7 +1854,7 @@ Returns:
                 MenuOption->Row++;\r
               }\r
 \r
-              gBS->FreePool (OutputString);\r
+              FreePool (OutputString);\r
             }\r
 \r
             MenuOption->Row = OriginalRow;\r
@@ -1876,7 +1882,7 @@ Returns:
                   MenuOption->Row++;\r
                 }\r
 \r
-                gBS->FreePool (OutputString);\r
+                FreePool (OutputString);\r
               }\r
 \r
               MenuOption->Row = OriginalRow;\r
@@ -1969,7 +1975,7 @@ Returns:
                 MenuOption->Row++;\r
               }\r
 \r
-              gBS->FreePool (OutputString);\r
+              FreePool (OutputString);\r
             }\r
 \r
             MenuOption->Row = OriginalRow;\r
@@ -1990,7 +1996,7 @@ Returns:
                   MenuOption->Row++;\r
                 }\r
 \r
-                gBS->FreePool (OutputString);\r
+                FreePool (OutputString);\r
               }\r
 \r
               MenuOption->Row = OriginalRow;\r
@@ -2022,10 +2028,10 @@ Returns:
     case CfUpdateHelpString:\r
       ControlFlag = CfPrepareToReadKey;\r
 \r
-        if (SubMenu && \r
-            (Repaint || NewLine || \r
+        if (SubMenu &&\r
+            (Repaint || NewLine ||\r
              (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||\r
-             (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) && \r
+             (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) &&\r
             !(gClassOfVfr == EFI_GENERAL_APPLICATION_SUBCLASS)) {\r
         //\r
         // Don't print anything if it is a NULL help token\r
@@ -2305,7 +2311,7 @@ Returns:
       while (gMenuRefreshHead != NULL) {\r
         OldMenuRefreshEntry = gMenuRefreshHead->Next;\r
 \r
-        gBS->FreePool (gMenuRefreshHead);\r
+        FreePool (gMenuRefreshHead);\r
 \r
         gMenuRefreshHead = OldMenuRefreshEntry;\r
       }\r
@@ -2328,7 +2334,7 @@ Returns:
       ExtractRequestedNvMap (FileFormTags, MenuOption->ThisTag->VariableNumber, &VariableDefinition);\r
 \r
       if (SubMenu) {\r
-        if ((MenuOption->ThisTag->Operand == EFI_IFR_TEXT_OP && \r
+        if ((MenuOption->ThisTag->Operand == EFI_IFR_TEXT_OP &&\r
             !(MenuOption->ThisTag->Flags & EFI_IFR_FLAG_INTERACTIVE)) ||\r
             (MenuOption->ThisTag->GrayOut) ||\r
             (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||\r
@@ -2966,9 +2972,9 @@ Returns:
 \r
       if (!EFI_ERROR (Status)) {\r
         ASSERT_EFI_ERROR (NULL != NvMapListHead);\r
-        \r
+\r
         NvMapListNode = NvMapListHead;\r
-        \r
+\r
         while (NULL != NvMapListNode) {\r
           if (FileFormTags->VariableDefinitions->VariableId == NvMapListNode->VariablePack->VariableId) {\r
             NvMap     = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);\r
@@ -2977,20 +2983,20 @@ Returns:
             }\r
           NvMapListNode = NvMapListNode->NextVariablePack;\r
         }\r
-        \r
+\r
         //\r
         // Free the buffer that was allocated.\r
         //\r
-        gBS->FreePool (FileFormTags->VariableDefinitions->NvRamMap);\r
-        gBS->FreePool (FileFormTags->VariableDefinitions->FakeNvRamMap);\r
-        \r
+        FreePool (FileFormTags->VariableDefinitions->NvRamMap);\r
+        FreePool (FileFormTags->VariableDefinitions->FakeNvRamMap);\r
+\r
         //\r
         // Allocate, copy the NvRamMap.\r
         //\r
         FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize - FileFormTags->VariableDefinitions->VariableSize);\r
         FileFormTags->VariableDefinitions->VariableSize = (UINT16) NvMapSize;\r
         FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize + FileFormTags->VariableDefinitions->VariableSize);\r
-        \r
+\r
         FileFormTags->VariableDefinitions->NvRamMap = AllocateZeroPool (FileFormTags->VariableDefinitions->VariableSize);\r
         ASSERT (FileFormTags->VariableDefinitions->NvRamMap != NULL);\r
 \r
@@ -2998,7 +3004,7 @@ Returns:
         ASSERT (FileFormTags->VariableDefinitions->FakeNvRamMap != NULL);\r
 \r
         CopyMem (FileFormTags->VariableDefinitions->NvRamMap, NvMap, NvMapSize);\r
-        gBS->FreePool (NvMapListHead);\r
+        FreePool (NvMapListHead);\r
       }\r
 \r
       UpdateStatusBar (NV_UPDATE_REQUIRED, MenuOption->ThisTag->Flags, TRUE);\r
@@ -3017,7 +3023,7 @@ Returns:
       while (gMenuRefreshHead != NULL) {\r
         OldMenuRefreshEntry = gMenuRefreshHead->Next;\r
 \r
-        gBS->FreePool (gMenuRefreshHead);\r
+        FreePool (gMenuRefreshHead);\r
 \r
         gMenuRefreshHead = OldMenuRefreshEntry;\r
       }\r
@@ -3043,11 +3049,11 @@ ValueIsScroll (
 /*++\r
 \r
 Routine Description:\r
-  Determine if the menu is the last menu that can be selected. \r
+  Determine if the menu is the last menu that can be selected.\r
 \r
 Arguments:\r
   Direction - the scroll direction. False is down. True is up.\r
-           \r
+\r
 Returns:\r
   FALSE -- the menu isn't the last menu that can be selected.\r
   TRUE  -- the menu is the last menu that can be selected.\r
@@ -3087,9 +3093,9 @@ Routine Description:
 Arguments:\r
   Direction - the up or down direction. False is down. True is up.\r
   CurrentPos - Current position.\r
-           \r
+\r
 Returns:\r
-  Return line number to pad. It is possible that we stand on a zero-advance \r
+  Return line number to pad. It is possible that we stand on a zero-advance\r
   data or time opcode, so pad one line when we judge if we are going to scroll outside.\r
 --*/\r
 {\r
index 98137c6a3f0cf83d26a99320a34b1a5da07ec2db..e224558651e24fa5c100a9ea1b0435b630a83d73 100644 (file)
@@ -424,13 +424,9 @@ Returns:
     Variable = NextVariable;\r
   }\r
 \r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  ValidBufferSize,\r
-                  (VOID **) &ValidBuffer\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
+  ValidBuffer = AllocatePool (ValidBufferSize);\r
+  if (ValidBuffer == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
   SetMem (ValidBuffer, ValidBufferSize, 0xff);\r
@@ -481,7 +477,7 @@ Returns:
     }\r
   }\r
 \r
-  gBS->FreePool (ValidBuffer);\r
+  FreePool (ValidBuffer);\r
 \r
   if (EFI_ERROR (Status)) {\r
     *LastVariableOffset = 0;\r
@@ -1253,13 +1249,13 @@ Returns:
         *RemainingVariableStorageSize -= VariableSize;\r
       }\r
     }\r
-    \r
+\r
     //\r
     // Go to the next one\r
     //\r
     Variable = NextVariable;\r
   }\r
\r
+\r
   ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);\r
   return EFI_SUCCESS;\r
 }\r
@@ -1308,14 +1304,9 @@ Returns:
   UINTN                           Index;\r
   UINT8                           Data;\r
 \r
-  Status = gBS->AllocatePool (\r
-                  EfiRuntimeServicesData,\r
-                  sizeof (ESAL_VARIABLE_GLOBAL),\r
-                  (VOID **) &mVariableModuleGlobal\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
+  mVariableModuleGlobal = AllocateRuntimePool (sizeof (ESAL_VARIABLE_GLOBAL));\r
+  if (mVariableModuleGlobal == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
   EfiInitializeLock(&mVariableModuleGlobal->VariableGlobal[Physical].VariableServicesLock, EFI_TPL_NOTIFY);\r
@@ -1323,15 +1314,10 @@ Returns:
   //\r
   // Allocate memory for volatile variable store\r
   //\r
-  Status = gBS->AllocatePool (\r
-                  EfiRuntimeServicesData,\r
-                  VARIABLE_STORE_SIZE + SCRATCH_SIZE,\r
-                  (VOID **) &VolatileVariableStore\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (mVariableModuleGlobal);\r
-    return Status;\r
+  VolatileVariableStore = AllocateRuntimePool (VARIABLE_STORE_SIZE + SCRATCH_SIZE);\r
+  if (VolatileVariableStore == NULL) {\r
+    FreePool (mVariableModuleGlobal);\r
+    return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
   SetMem (VolatileVariableStore, VARIABLE_STORE_SIZE + SCRATCH_SIZE, 0xff);\r
@@ -1367,8 +1353,8 @@ Returns:
 \r
   Status      = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor);\r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (mVariableModuleGlobal);\r
-    gBS->FreePool (VolatileVariableStore);\r
+    FreePool (mVariableModuleGlobal);\r
+    FreePool (VolatileVariableStore);\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
@@ -1378,8 +1364,8 @@ Returns:
                   GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (mVariableModuleGlobal);\r
-    gBS->FreePool (VolatileVariableStore);\r
+    FreePool (mVariableModuleGlobal);\r
+    FreePool (VolatileVariableStore);\r
     return EFI_UNSUPPORTED;\r
   }\r
   //\r
@@ -1448,8 +1434,8 @@ Returns:
     }\r
 \r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (mVariableModuleGlobal);\r
-      gBS->FreePool (VolatileVariableStore);\r
+      FreePool (mVariableModuleGlobal);\r
+      FreePool (VolatileVariableStore);\r
       return Status;\r
     }\r
 \r
@@ -1473,8 +1459,8 @@ Returns:
   }\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (mVariableModuleGlobal);\r
-    gBS->FreePool (VolatileVariableStore);\r
+    FreePool (mVariableModuleGlobal);\r
+    FreePool (VolatileVariableStore);\r
   }\r
 \r
   return Status;\r
index d1e6f3bb931968bdb302f65c0aff210a44d204bf..3607bc4f7f7083408eb203b386fdc5151be33b33 100644 (file)
@@ -52,6 +52,9 @@
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>BaseLib</Keyword>\r
     </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>MemoryAllocationLib</Keyword>\r
+    </LibraryClass>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>Variable.h</Filename>\r
index 11ca3086ba5da961ac0090c3576c7a446ff1c7bb..564fc61e6e9d0b85263f7a7e1cc6c6362f6c1467 100644 (file)
@@ -55,6 +55,9 @@
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>BaseLib</Keyword>\r
     </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>MemoryAllocationLib</Keyword>\r
+    </LibraryClass>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>Variable.h</Filename>\r
index 00ebcf84fdb5689115c29cfca5612a5ed3343f33..4c7249046c0df8a26e8395400e32bd930c866b9a 100644 (file)
@@ -1,20 +1,20 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
   reclaim.c\r
-  \r
+\r
 Abstract:\r
-  \r
+\r
   Handles non-volatile variable store garbage collection, using FTW\r
   (Fault Tolerant Write) protocol.\r
 \r
@@ -82,7 +82,7 @@ GetFvbHandleByAddress (
     }\r
   }\r
 \r
-  gBS->FreePool (HandleBuffer);\r
+  FreePool (HandleBuffer);\r
   return Status;\r
 }\r
 \r
@@ -216,8 +216,8 @@ Returns:
   // Prepare for the variable data\r
   //\r
   FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size;\r
-  Status        = gBS->AllocatePool (EfiRuntimeServicesData, FtwBufferSize, (VOID **) &FtwBuffer);\r
-  if (EFI_ERROR (Status)) {\r
+  FtwBuffer     = AllocateRuntimePool (FtwBufferSize);\r
+  if (FtwBuffer == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -236,6 +236,6 @@ Returns:
                               FtwBuffer\r
                               );\r
 \r
-  gBS->FreePool (FtwBuffer);\r
+  FreePool (FtwBuffer);\r
   return Status;\r
 }\r