]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Clean up BootMaint module in BdsDxe.
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 10 Jul 2008 09:00:40 +0000 (09:00 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 10 Jul 2008 09:00:40 +0000 (09:00 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5444 6f19259b-4bc3-4df7-8a09-765794883524

12 files changed:
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
MdeModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
MdeModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.h
MdeModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
MdeModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
MdeModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
MdeModulePkg/Universal/BdsDxe/BootMaint/Data.c
MdeModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c
MdeModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
MdeModulePkg/Universal/BdsDxe/BootMaint/Variable.c

index f30cfaa6df92487ee51a4b6e8b2838a6ccfbacf3..3de94909128e91ad3b7e1f34d58832d0b14b5d75 100644 (file)
 [Packages]\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
+  #\r
+  #This dependency is because of gEfiLegacyBiosProtocolGuid and gEfiDataHubProtocolGuid. It may be removed if a Library class is created to\r
+  #abstract away definition in Framework specification or PI spec incorporates the Legacy Booting Protocols and Data Hub Protocols.\r
+  #\r
   IntelFrameworkPkg/IntelFrameworkPkg.dec\r
 \r
 \r
   gEfiHiiStringProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED\r
   gEfiSimpleFileSystemProtocolGuid              # PROTOCOL ALWAYS_CONSUMED\r
   gEfiLoadFileProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiCpuIoProtocolGuid                         # PROTOCOL ALWAYS_CONSUMED\r
   gEfiBdsArchProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
   gEfiDataHubProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
   gEfiGenericMemTestProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
   gEfiFormBrowser2ProtocolGuid                  # PROTOCOL ALWAYS_CONSUMED\r
   gEfiSerialIoProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiAcpiS3SaveProtocolGuid\r
 \r
 [FeaturePcd.common]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDepricate\r
index b49c93c6adc415222eb0c99bd74f10fae0460586..11ae2b115cdc115d3e21dbd409e1acf88381b18a 100644 (file)
@@ -16,13 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "BBSsupport.h"\r
 \r
-EFI_DEVICE_PATH_PROTOCOL  EndDevicePath[] = {\r
-  END_DEVICE_PATH_TYPE,\r
-  END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
-  END_DEVICE_PATH_LENGTH,\r
-  0\r
-};\r
-\r
 /**\r
 \r
   Translate the first n characters of an Ascii string to\r
@@ -291,7 +284,7 @@ BdsCreateLegacyBootOption (
   //\r
   UnicodeToAscii (BootDesc, StrSize (BootDesc), HelpString);\r
   StringLen = AsciiStrLen (HelpString);\r
-  NewBbsDevPathNode = EfiAllocateZeroPool (sizeof (BBS_BBS_DEVICE_PATH) + StringLen);\r
+  NewBbsDevPathNode = AllocateZeroPool (sizeof (BBS_BBS_DEVICE_PATH) + StringLen);\r
   if (NewBbsDevPathNode == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -320,7 +313,7 @@ BdsCreateLegacyBootOption (
     sizeof (BBS_TABLE) +\r
     sizeof (UINT16);\r
 \r
-  Buffer = EfiAllocateZeroPool (BufferSize);\r
+  Buffer = AllocateZeroPool (BufferSize);\r
   if (Buffer == NULL) {\r
     FreePool (NewBbsDevPathNode);\r
     FreePool (CurrentBbsDevPath);\r
@@ -369,7 +362,7 @@ BdsCreateLegacyBootOption (
   SafeFreePool (Buffer);\r
   Buffer = NULL;\r
 \r
-  NewBootOrderList = EfiAllocateZeroPool (*BootOrderListSize + sizeof (UINT16));\r
+  NewBootOrderList = AllocateZeroPool (*BootOrderListSize + sizeof (UINT16));\r
   if (NULL == NewBootOrderList) {\r
     FreePool (NewBbsDevPathNode);\r
     FreePool (CurrentBbsDevPath);\r
@@ -963,7 +956,7 @@ BdsCreateDevOrder (
   TotalSize += (HeaderSize + sizeof (UINT16) * NETCount);\r
   TotalSize += (HeaderSize + sizeof (UINT16) * BEVCount);\r
 \r
-  DevOrder = EfiAllocateZeroPool (TotalSize);\r
+  DevOrder = AllocateZeroPool (TotalSize);\r
   if (NULL == DevOrder) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -1151,7 +1144,7 @@ BdsUpdateLegacyDevOrder (
   TotalSize += (HeaderSize + NETCount * sizeof (UINT16));\r
   TotalSize += (HeaderSize + BEVCount * sizeof (UINT16));\r
 \r
-  NewDevOrder = EfiAllocateZeroPool (TotalSize);\r
+  NewDevOrder = AllocateZeroPool (TotalSize);\r
   if (NULL == NewDevOrder) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
index ce60cd9391a266e78f0a6d9f638375fad9608618..bab7de6326ae9bf2acf3b018dc8d4bab9674b945 100644 (file)
@@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 // Bugbug: Candidate for a PCD entries\r
 //\r
+#define MAX_BBS_ENTRIES 0x100\r
+\r
 /**\r
   EDES_TODO: Add function description.\r
 \r
@@ -30,8 +32,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return EDES_TODO: Add description for return value\r
 \r
 **/\r
-#define MAX_BBS_ENTRIES 0x100\r
-\r
 VOID\r
 BdsBuildLegacyDevNameString (\r
   IN BBS_TABLE                     *CurBBSEntry,\r
index d5c32c8ac193dc3f212ea62fc0b5d4630d0e0f5a..1630eeb1553fb82c4534fd7f93aa3385d61914ea 100644 (file)
@@ -14,43 +14,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "BootMaint.h"\r
 \r
-/**\r
-  Wrap original AllocatePool gBS call\r
-  and ZeroMem gBS call into a single\r
-  function in order to decrease code length\r
-\r
-\r
-  @param Size            The size to allocate\r
-\r
-  @return  Valid pointer to the allocated buffer\r
-  @retval  Null for failure\r
-\r
-**/\r
-VOID *\r
-EfiAllocateZeroPool (\r
-  IN UINTN            Size\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-  VOID        *Ptr;\r
-  Status = gBS->AllocatePool (EfiBootServicesData, Size, &Ptr);\r
-  if (EFI_ERROR (Status)) {\r
-    Ptr = NULL;\r
-    return Ptr;\r
-  }\r
-\r
-  ZeroMem (Ptr, Size);\r
-  return Ptr;\r
-}\r
-\r
 /**\r
 \r
   Find the first instance of this Protocol\r
   in the system and return it's interface\r
 \r
 \r
-  @param ProtocolGuid    Provides the protocol to search for\r
-  @param Interface       On return, a pointer to the first interface\r
+  @param ProtocolGuid    Provides the protocol to search for\r
+  @param Interface       On return, a pointer to the first interface\r
                          that matches ProtocolGuid\r
 \r
   @retval  EFI_SUCCESS      A protocol instance matching ProtocolGuid was found\r
@@ -131,6 +102,7 @@ EfiLibOpenRoot (
 \r
   @retval  TRUE  if the buffer was reallocated and the caller\r
                  should try the API again.\r
+  @retval  FALSE The caller should not call this function again.\r
 \r
 **/\r
 BOOLEAN\r
@@ -156,7 +128,7 @@ EfiGrowBuffer (
 \r
     SafeFreePool (*Buffer);\r
 \r
-    *Buffer = EfiAllocateZeroPool (BufferSize);\r
+    *Buffer = AllocateZeroPool (BufferSize);\r
 \r
     if (*Buffer != NULL) {\r
       TryAgain = TRUE;\r
@@ -179,11 +151,12 @@ EfiGrowBuffer (
   Function returns the value of the specified variable.\r
 \r
 \r
-  @param Name            A Null-terminated Unicode string that is\r
+  @param Name            A Null-terminated Unicode string that is\r
                          the name of the vendor's variable.\r
-  @param VendorGuid      A unique identifier for the vendor.\r
+  @param VendorGuid      A unique identifier for the vendor.\r
 \r
   @return               The payload of the variable.\r
+  @retval NULL          If the variable can't be read.\r
 \r
 **/\r
 VOID *\r
@@ -244,7 +217,8 @@ EfiLibDeleteVariable (
 \r
   @param FHand           The file handle.\r
 \r
-  @return                A pointer to a buffer with file information or NULL is returned\r
+  @return                A pointer to a buffer with file information.\r
+  @retval                NULL is returned if failed to get Vaolume Label Info.\r
 \r
 **/\r
 EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *\r
@@ -282,7 +256,7 @@ EfiLibFileSystemVolumeLabelInfo (
   @param Src             The source.\r
 \r
   @return A new string which is duplicated copy of the source.\r
-  @retval NULL If there is not enought memory.\r
+  @retval NULL If there is not enough memory.\r
 \r
 **/\r
 CHAR16 *\r
@@ -294,7 +268,7 @@ EfiStrDuplicate (
   UINTN   Size;\r
 \r
   Size  = StrSize (Src);\r
-  Dest  = EfiAllocateZeroPool (Size);\r
+  Dest  = AllocateZeroPool (Size);\r
   ASSERT (Dest != NULL);\r
   if (Dest != NULL) {\r
     CopyMem (Dest, Src, Size);\r
@@ -348,7 +322,7 @@ EfiLibFileInfo (
   that exist in a device path.\r
 \r
 \r
-  @param DevicePath      A pointer to a device path data structure.\r
+  @param DevicePath      A pointer to a device path data structure.\r
 \r
   @return This function counts and returns the number of device path instances\r
           in DevicePath.\r
@@ -378,9 +352,8 @@ EfiDevicePathInstanceCount (
   @param OldSize         - The size of the current buffer.\r
   @param NewSize         - The size of the new buffer.\r
 \r
-  @retval  EFI_SUCEESS            The requested number of bytes were allocated.\r
-  @retval  EFI_OUT_OF_RESOURCES   The pool requested could not be allocated.\r
-  @retval  EFI_INVALID_PARAMETER  The buffer was invalid.\r
+  @return   The newly allocated buffer.\r
+  @retval   NULL  Allocation failed.\r
 \r
 **/\r
 VOID *\r
@@ -394,7 +367,7 @@ EfiReallocatePool (
 \r
   NewPool = NULL;\r
   if (NewSize != 0) {\r
-    NewPool = EfiAllocateZeroPool (NewSize);\r
+    NewPool = AllocateZeroPool (NewSize);\r
   }\r
 \r
   if (OldPool != NULL) {\r
@@ -450,6 +423,7 @@ TimeCompare (
 \r
   @return A string located from the Data Hub records based on\r
           the device path.\r
+  @retval NULL  If failed to get the String from Data Hub.\r
 \r
 **/\r
 UINT16 *\r
index 6eae9c18dd1714603e85e2d4f7005e601a89e549..432be94c9f480723120cde7c52503887dc006327 100644 (file)
@@ -17,6 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "Bds.h"\r
 #include "FrontPage.h"\r
 \r
+EFI_DEVICE_PATH_PROTOCOL  EndDevicePath[] = {\r
+  END_DEVICE_PATH_TYPE,\r
+  END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
+  END_DEVICE_PATH_LENGTH,\r
+  0\r
+};\r
+\r
+\r
 EFI_GUID EfiLegacyDevOrderGuid = EFI_LEGACY_DEV_ORDER_VARIABLE_GUID;\r
 EFI_GUID mBootMaintGuid = BOOT_MAINT_FORMSET_GUID;\r
 EFI_GUID mFileExplorerGuid = FILE_EXPLORE_FORMSET_GUID;\r
@@ -54,9 +62,9 @@ FreeAllMenu (
   Create string tokens for a menu from its help strings and display strings\r
 \r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param HiiHandle       Hii Handle of the package to be updated.\r
-  @param MenuOption      The Menu whose string tokens need to be created\r
+  @param CallbackData    The BMM context data.\r
+  @param HiiHandle       Hii Handle of the package to be updated.\r
+  @param MenuOption      The Menu whose string tokens need to be created\r
 \r
   @retval  EFI_SUCCESS      string tokens created successfully\r
   @retval  others           contain some errors\r
@@ -723,12 +731,13 @@ Error:
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Discard all changes done to the BMM pages such as Boot Order change,\r
+  Driver order change.\r
 \r
-  @param Private         EDES_TODO: Add parameter description\r
-  @param CurrentFakeNVMap EDES_TODO: Add parameter description\r
+  @param Private         The BMM context data.\r
+  @param CurrentFakeNVMap The current Fack NV Map.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -803,7 +812,7 @@ InitializeBM (
   //\r
   // Create CallbackData structures for Driver Callback\r
   //\r
-  BmmCallbackInfo = EfiAllocateZeroPool (sizeof (BMM_CALLBACK_DATA));\r
+  BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA));\r
   if (BmmCallbackInfo == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -811,7 +820,7 @@ InitializeBM (
   //\r
   // Create LoadOption in BmmCallbackInfo for Driver Callback\r
   //\r
-  Ptr = EfiAllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));\r
+  Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));\r
   if (Ptr == NULL) {\r
     SafeFreePool (BmmCallbackInfo);\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -917,7 +926,7 @@ InitializeBM (
   // Allocate space for creation of Buffer\r
   //\r
   gUpdateData.BufferSize = UPDATE_DATA_SIZE;\r
-  gUpdateData.Data = EfiAllocateZeroPool (UPDATE_DATA_SIZE);\r
+  gUpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);\r
   if (gUpdateData.Data == NULL) {\r
     SafeFreePool (BmmCallbackInfo->LoadContext);\r
     SafeFreePool (BmmCallbackInfo);\r
@@ -1031,11 +1040,11 @@ InitializeBM (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Initialized all Menu Option List.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1060,11 +1069,11 @@ InitAllMenu (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Free up all Menu Option list.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1085,9 +1094,9 @@ FreeAllMenu (
   Intialize all the string depositories.\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-           EDES_TODO: Description incomplete  None.\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1096,7 +1105,7 @@ InitializeStringDepository (
   )\r
 {\r
   STRING_DEPOSITORY *StringDepository;\r
-  StringDepository              = EfiAllocateZeroPool (sizeof (STRING_DEPOSITORY) * STRING_DEPOSITORY_NUMBER);\r
+  StringDepository              = AllocateZeroPool (sizeof (STRING_DEPOSITORY) * STRING_DEPOSITORY_NUMBER);\r
   FileOptionStrDepository       = StringDepository++;\r
   ConsoleOptionStrDepository    = StringDepository++;\r
   BootOptionStrDepository       = StringDepository++;\r
@@ -1136,7 +1145,7 @@ GetStringTokenFromDepository (
     //\r
     // If there is no usable node in the list, update the list.\r
     //\r
-    NextListNode = EfiAllocateZeroPool (sizeof (STRING_LIST_NODE));\r
+    NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));\r
 \r
     HiiLibNewString (CallbackData->BmmHiiHandle, &(NextListNode->StringToken), L" ");\r
     ASSERT (NextListNode->StringToken != 0);\r
@@ -1159,9 +1168,9 @@ GetStringTokenFromDepository (
   Reclaim string depositories by moving the current node pointer to list head..\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID \r
 \r
-           EDES_TODO: Description incomplete  None.\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1183,9 +1192,9 @@ ReclaimStringDepository (
   Release resource for all the string depositories.\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-           EDES_TODO: Description incomplete  None.\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1223,9 +1232,10 @@ CleanUpStringDepository (
   Start boot maintenance manager\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS If BMM is invoked successfully.\r
+  @return Other value if BMM return unsuccessfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1272,9 +1282,11 @@ BdsStartBootMaint (
   Dispatch BMM formset and FileExplorer formset.\r
 \r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS If function complete successfully.\r
+  @retturn Other value if the Setup Browser process BMM's pages and\r
+           return unsuccessfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1335,3 +1347,58 @@ FormSetDispatcher (
   return Status;\r
 }\r
 \r
+\r
+/**\r
+  Deletete the Boot Option from EFI Variable. The Boot Order Arrray\r
+  is also updated.\r
+\r
+  @param OptionNumber    EDES_TODO: Add parameter description\r
+  @param BootOrder       The Boot Order array.\r
+  @param BootOrderSize   The size of the Boot Order Array.\r
+\r
+  @return Other value if the Boot Option specified by OptionNumber is not deleteed succesfully.\r
+  @retval EFI_SUCCESS    If function return successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+BdsDeleteBootOption (\r
+  IN UINTN                       OptionNumber,\r
+  IN OUT UINT16                  *BootOrder,\r
+  IN OUT UINTN                   *BootOrderSize\r
+  )\r
+{\r
+  UINT16      BootOption[100];\r
+  UINTN       Index;\r
+  EFI_STATUS  Status;\r
+  UINTN       Index2Del;\r
+\r
+  Status    = EFI_SUCCESS;\r
+  Index2Del = 0;\r
+\r
+  UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", OptionNumber);\r
+  Status = EfiLibDeleteVariable (BootOption, &gEfiGlobalVariableGuid);\r
+  //\r
+  // adjust boot order array\r
+  //\r
+  for (Index = 0; Index < *BootOrderSize / sizeof (UINT16); Index++) {\r
+    if (BootOrder[Index] == OptionNumber) {\r
+      Index2Del = Index;\r
+      break;\r
+    }\r
+  }\r
+\r
+  if (Index != *BootOrderSize / sizeof (UINT16)) {\r
+    for (Index = 0; Index < *BootOrderSize / sizeof (UINT16) - 1; Index++) {\r
+      if (Index >= Index2Del) {\r
+        BootOrder[Index] = BootOrder[Index + 1];\r
+      }\r
+    }\r
+\r
+    *BootOrderSize -= sizeof (UINT16);\r
+  }\r
+\r
+  return Status;\r
+\r
+}\r
+\r
+\r
index 1ac2707c2fecbc4ca0dc0a41ce0b1351d9b88db6..da7badd306a3c9ce1dd638aa18523331a577b7a2 100644 (file)
@@ -469,12 +469,17 @@ typedef struct _STRING_DEPOSITORY {
 //\r
 // For initializing File System menu\r
 //\r
+\r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function build the FsOptionMenu list which records all\r
+  available file system in the system. They includes all instances\r
+  of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, all instances of EFI_LOAD_FILE_SYSTEM\r
+  and all type of legacy boot device.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    BMM context data\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval  EFI_SUCCESS             Success find the file system\r
+  @retval  EFI_OUT_OF_RESOURCES    Can not create menu entry\r
 \r
 **/\r
 EFI_STATUS\r
@@ -483,33 +488,15 @@ BOpt_FindFileSystem (
   )\r
 ;\r
 \r
-//\r
-// For cleaning up File System menu\r
-//\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param VOID            EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-BOpt_FreeFileSystem (\r
-  VOID\r
-  )\r
-;\r
-\r
-//\r
-// For initializing File Navigation menu\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Find files under current directory\r
+  All files and sub-directories in current directory\r
+  will be stored in DirectoryMenu for future use.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param MenuEntry       EDES_TODO: Add parameter description\r
+  @param FileOption  Pointer for Dir to explore.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval TRUE         Get files from current dir successfully.\r
+  @retval FALSE        Can't get files from current dir.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -519,32 +506,17 @@ BOpt_FindFiles (
   )\r
 ;\r
 \r
-//\r
-// For cleaning up File Navigation menu\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param VOID            EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-BOpt_FreeFiles (\r
-  VOID\r
-  )\r
-;\r
 \r
-//\r
-// For Initializing handle navigation menu\r
-//\r
-/**\r
-  EDES_TODO: Add function description.\r
+  Find drivers that will be added as Driver#### variables from handles\r
+  in current system environment\r
+  All valid handles in the system except those consume SimpleFs, LoadFile\r
+  are stored in DriverMenu for future use.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID \r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS The function complets successfully.\r
+  @return Other value if failed to build the DriverMenu.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -553,29 +525,14 @@ BOpt_FindDrivers (
   )\r
 ;\r
 \r
-//\r
-// For Cleaning up handle navigation menu\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-BOpt_FreeDrivers(VOID);\r
-\r
-//\r
-// For initializing Boot Option menu\r
-//\r
-/**\r
-  EDES_TODO: Add function description.\r
+  Build the BootOptionMenu according to BootOrder Variable.\r
+  This Routine will access the Boot#### to get EFI_LOAD_OPTION.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param None\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return The number of the Var Boot####.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -583,15 +540,15 @@ BOpt_GetBootOptions (
   IN  BMM_CALLBACK_DATA         *CallbackData\r
   );\r
 \r
-//\r
-// For Initializing Driver option menu\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  Build up all DriverOptionMenu\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param CallbackData The BMM context data.\r
+\r
+  @return EFI_SUCESS The functin completes successfully.\r
+  @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.\r
+  \r
 \r
 **/\r
 EFI_STATUS\r
@@ -599,71 +556,40 @@ BOpt_GetDriverOptions (
   IN  BMM_CALLBACK_DATA         *CallbackData\r
   );\r
 \r
-//\r
-// For Cleaning up boot option menu\r
-//\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param VOID            EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-BOpt_FreeBootOptions (VOID);\r
-\r
-//\r
-// For cleaning up driver option menu\r
-//\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param VOID            EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-BOpt_FreeDriverOptions(VOID);\r
 \r
-//\r
-// For Initializing HD/FD/CD/NET/BEV option menu\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS The function complete successfully.\r
+  @retval EFI_OUT_OF_RESOURCES No enough memory to complete this function.\r
 \r
 **/\r
 EFI_STATUS\r
-BOpt_GetLegacyOptions(VOID);\r
+BOpt_GetLegacyOptions (\r
+  VOID\r
+  );\r
 \r
-//\r
-// For cleaning up driver option menu\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Free out resouce allocated from Legacy Boot Options.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID.\r
 \r
 **/\r
 VOID\r
-BOpt_FreeLegacyOptions(VOID);\r
+BOpt_FreeLegacyOptions (\r
+  VOID\r
+  );\r
 \r
-//\r
-// this function is used to take place of all other free menu actions\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Free resources allocated in Allocate Rountine\r
 \r
-  @param FreeMenu        EDES_TODO: Add parameter description\r
+  @param FreeMenu        Menu to be freed\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -672,16 +598,15 @@ BOpt_FreeMenu (
   );\r
 \r
 \r
-//\r
-// Following are the helper functions used\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param Str1            EDES_TODO: Add parameter description\r
-  @param Str2            EDES_TODO: Add parameter description\r
+  Append file name to existing file name.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param Str1  The existing file name\r
+  @param Str2  The file name to be appended\r
+\r
+  @return Allocate a new string to hold the appended result.\r
+          Caller is responsible to free the returned string.\r
 \r
 **/\r
 CHAR16                            *\r
@@ -691,11 +616,14 @@ BOpt_AppendFileName (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param FileName        EDES_TODO: Add parameter description\r
+  Check whether current FileName point to a valid\r
+  Efi Image File.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param FileName  File need to be checked.\r
+\r
+  @retval TRUE  Is Efi Image\r
+  @retval FALSE Not a valid Efi Image\r
 \r
 **/\r
 BOOLEAN\r
@@ -704,12 +632,14 @@ BOpt_IsEfiImageName (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param Dir             EDES_TODO: Add parameter description\r
-  @param FileName        EDES_TODO: Add parameter description\r
+  Check whether current FileName point to a valid Efi Application\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param Dir       Pointer to current Directory\r
+  @param FileName  Pointer to current File name.\r
+\r
+  @retval TRUE      Is a valid Efi Application\r
+  @retval FALSE     not a valid Efi Application\r
 \r
 **/\r
 BOOLEAN\r
@@ -718,40 +648,42 @@ BOpt_IsEfiApp (
   IN UINT16          *FileName\r
   );\r
 \r
-//\r
-// Get current unused boot option number\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  Get the Option Number that has not been allocated for use.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @return The available Option Number.\r
 \r
 **/\r
 UINT16\r
-BOpt_GetBootOptionNumber (VOID);\r
+BOpt_GetBootOptionNumber (\r
+  VOID\r
+  );\r
 \r
-//\r
-// Get current unused driver option number\r
-//\r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  Get the Option Number that is not in use.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @return The unused Option Number.\r
 \r
 **/\r
 UINT16\r
-BOpt_GetDriverOptionNumber (VOID);\r
+BOpt_GetDriverOptionNumber (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a menu entry give a Menu type.\r
 \r
-  @param MenuType        EDES_TODO: Add parameter description\r
+  @param MenuType        The Menu type to be created.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+\r
+  @retval NULL           If failed to create the menu.\r
+  @return                The menu.\r
 \r
 **/\r
 BM_MENU_ENTRY                     *\r
@@ -760,11 +692,11 @@ BOpt_CreateMenuEntry (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Free up all resource allocated for a BM_MENU_ENTRY.\r
 \r
-  @param MenuEntry       EDES_TODO: Add parameter description\r
+  @param MenuEntry   A pointer to BM_MENU_ENTRY.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval VOID\r
 \r
 **/\r
 VOID\r
@@ -773,12 +705,15 @@ BOpt_DestroyMenuEntry (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Get the Menu Entry from the list in Menu Entry List.\r
 \r
-  @param MenuOption      EDES_TODO: Add parameter description\r
-  @param MenuNumber      EDES_TODO: Add parameter description\r
+  If MenuNumber is great or equal to the number of Menu\r
+  Entry in the list, then ASSERT.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param MenuOption      The Menu Entry List to read the menu entry.\r
+  @param MenuNumber      The index of Menu Entry.\r
+\r
+  @return The Menu Entry.\r
 \r
 **/\r
 BM_MENU_ENTRY                     *\r
@@ -787,27 +722,12 @@ BOpt_GetMenuEntry (
   UINTN               MenuNumber\r
   );\r
 \r
-//\r
-// a helper function used to free pool type memory\r
-//\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param Buffer          EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-SafeFreePool (\r
-  IN VOID *Buffer\r
-  );\r
-\r
 //\r
 // Locate all serial io devices for console\r
 //\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Build a list containing all serial devices\r
+\r
 \r
   @param VOID            EDES_TODO: Add parameter description\r
 \r
@@ -815,31 +735,37 @@ SafeFreePool (
 \r
 **/\r
 EFI_STATUS\r
-LocateSerialIo (VOID);\r
+LocateSerialIo (\r
+  VOID\r
+  );\r
 \r
 //\r
 // Initializing Console menu\r
 //\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @retval EFI_SUCCESS    The function always complete successfully.\r
 \r
 **/\r
 EFI_STATUS\r
-GetAllConsoles(VOID);\r
+GetAllConsoles(\r
+  VOID\r
+  );\r
 \r
 //\r
 // Get current mode information\r
 //\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Get mode number according to column and row\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param CallbackData    The BMM context data.\r
+\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -851,22 +777,26 @@ GetConsoleOutMode (
 // Cleaning up console menu\r
 //\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID            EDES_TODO: Add parameter description\r
 \r
+  @retval EFI_SUCCESS    The function always complete successfully.\r
 **/\r
 EFI_STATUS\r
-FreeAllConsoles(VOID);\r
+FreeAllConsoles (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the device path that describing a terminal device\r
+  based on the new BaudRate, Data Bits, parity and Stop Bits\r
+  set.\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
+  @param DevicePath\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -875,12 +805,15 @@ ChangeVariableDevicePath (
 );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the multi-instance device path of Terminal Device based on\r
+  the global TerminalMenu. If ChangeTernimal is TRUE, the terminal \r
+  device path in the Terminal Device in TerminalMenu is also updated.\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
-  @param ChangeTerminal  EDES_TODO: Add parameter description\r
+  @param DevicePath      The multi-instance device path.\r
+  @param ChangeTerminal  TRUE, then device path in the Terminal Device \r
+                         in TerminalMenu is also updated; FALSE, no update.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return EFI_SUCCESS    The function completes successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -892,12 +825,16 @@ ChangeTerminalDevicePath (
 // Variable operation by menu selection\r
 //\r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function create a currently loaded Boot Option from \r
+  the BMM. It then appends this Boot Option to the end of \r
+  the "BootOrder" list. It also append this Boot Opotion to the end\r
+  of BootOptionMenu.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param NvRamMap        EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
+  @param NvRamMap        The file explorer formset internal state.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.\r
+  @retval EFI_SUCCESS          If function completes successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -907,37 +844,56 @@ Var_UpdateBootOption (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Delete Boot Option that represent a Deleted state in BootOptionMenu.\r
+  After deleting this boot option, call Var_ChangeBootOrder to\r
+  make sure BootOrder is in valid state.\r
+\r
 \r
   @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS   If all boot load option EFI Variables corresponding to  \r
+                        BM_LOAD_CONTEXT marked for deletion is deleted\r
+  @return Others        If failed to update the "BootOrder" variable after deletion. \r
 \r
 **/\r
 EFI_STATUS\r
-Var_DelBootOption (VOID);\r
+Var_DelBootOption (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  After any operation on Boot####, there will be a discrepancy in BootOrder.\r
+  Since some are missing but in BootOrder, while some are present but are\r
+  not reflected by BootOrder. Then a function rebuild BootOrder from\r
+  scratch by content from BootOptionMenu is needed.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @retval  EFI_SUCCESS  The boot order is updated successfully.\r
+  @return               EFI_STATUS other than EFI_SUCCESS if failed to\r
+                        Set the "BootOrder" EFI Variable.\r
 \r
 **/\r
 EFI_STATUS\r
-Var_ChangeBootOrder (VOID);\r
+Var_ChangeBootOrder (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function create a currently loaded Drive Option from \r
+  the BMM. It then appends this Driver Option to the end of \r
+  the "DriverOrder" list. It append this Driver Opotion to the end\r
+  of DriverOptionMenu.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param HiiHandle       EDES_TODO: Add parameter description\r
-  @param DescriptionData EDES_TODO: Add parameter description\r
-  @param OptionalData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
+  @param HiiHandle       The HII handle associated with the BMM formset.\r
+  @param DescriptionData The description of this driver option.\r
+  @param OptionalData    The optional load option.\r
   @param ForceReconnect  EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.\r
+  @retval EFI_SUCCESS          If function completes successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -950,77 +906,117 @@ Var_UpdateDriverOption (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Delete Load Option that represent a Deleted state in BootOptionMenu.\r
+  After deleting this Driver option, call Var_ChangeDriverOrder to\r
+  make sure DriverOrder is in valid state.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @retval EFI_SUCCESS Load Option is successfully updated.\r
+  @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI\r
+          Variable.\r
 \r
 **/\r
 EFI_STATUS\r
-Var_DelDriverOption (VOID);\r
+Var_DelDriverOption (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  After any operation on Driver####, there will be a discrepancy in\r
+  DriverOrder. Since some are missing but in DriverOrder, while some\r
+  are present but are not reflected by DriverOrder. Then a function\r
+  rebuild DriverOrder from scratch by content from DriverOptionMenu is\r
+  needed.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @retval  EFI_SUCCESS  The driver order is updated successfully.\r
+  @return               EFI_STATUS other than EFI_SUCCESS if failed to\r
+                                 Set the "DriverOrder" EFI Variable.\r
 \r
 **/\r
 EFI_STATUS\r
-Var_ChangeDriverOrder (VOID);\r
+Var_ChangeDriverOrder (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function delete and build multi-instance device path ConIn\r
+  console device.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
 \r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 **/\r
 EFI_STATUS\r
-Var_UpdateConsoleInpOption (VOID);\r
+Var_UpdateConsoleInpOption (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function delete and build multi-instance device path ConOut\r
+  console device.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
 \r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 **/\r
 EFI_STATUS\r
-Var_UpdateConsoleOutOption (VOID);\r
+Var_UpdateConsoleOutOption (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function delete and build multi-instance device path ErrOut\r
+  console device.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
 \r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 **/\r
 EFI_STATUS\r
-Var_UpdateErrorOutOption (VOID);\r
+Var_UpdateErrorOutOption (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the device path of "ConOut", "ConIn" and "ErrOut" \r
+  based on the new BaudRate, Data Bits, parity and Stop Bits\r
+  set.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
-Var_UpdateAllConsoleOption (VOID);\r
+Var_UpdateAllConsoleOption (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function update the "BootNext" EFI Variable. If there is \r
+  no "BootNex" specified in BMM, this EFI Variable is deleted.\r
+  It also update the BMM context data specified the "BootNext"\r
+  vaule.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1029,11 +1025,16 @@ Var_UpdateBootNext (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function update the "BootOrder" EFI Variable based on\r
+  BMM Formset's NV map. It then refresh BootOptionMenu\r
+  with the new "BootOrder" list.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @retval EFI_SUCCESS    Not enough memory to complete the function.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1042,11 +1043,16 @@ Var_UpdateBootOrder (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function update the "DriverOrder" EFI Variable based on\r
+  BMM Formset's NV map. It then refresh DriverOptionMenu\r
+  with the new "DriverOrder" list.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @retval EFI_SUCCESS    Not enough memory to complete the function.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1055,11 +1061,14 @@ Var_UpdateDriverOrder (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the legacy BBS boot option. L"LegacyDevOrder" and EfiLegacyDevOrderGuid EFI Variable\r
+  is udpated with the new Legacy Boot order. The EFI Variable of "Boot####" and gEfiGlobalVariableGuid\r
+  is also updated.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The context data for BMM.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return EFI_SUCCESS    The function completed successfully.\r
+  @retval EFI_NOT_FOUND  If L"LegacyDevOrder" and EfiLegacyDevOrderGuid EFI Variable can be found.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1068,11 +1077,12 @@ Var_UpdateBBSOption (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the Text Mode of Console.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData  The context data for BMM.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCSS If the Text Mode of Console is updated.\r
+  @return Other value if the Text Mode of Console is not updated.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1084,11 +1094,11 @@ Var_UpdateConMode (
 // Following are page create and refresh functions\r
 //\r
 /**\r
-  EDES_TODO: Add function description.\r
+  Refresh the global UpdateData structure.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1097,12 +1107,14 @@ RefreshUpdateData (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Clean up the dynamic opcode at label and form specified by\r
+  both LabelId. \r
 \r
-  @param LabelId         EDES_TODO: Add parameter description\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param LabelId         It is both the Form ID and Label ID for\r
+                         opcode deletion.\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1112,55 +1124,12 @@ CleanUpPage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a lit of boot option from global BootOptionMenu. It\r
+  allow user to delete the boot option.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param UpdatingMenu    EDES_TODO: Add parameter description\r
-  @param UpdatingPage    EDES_TODO: Add parameter description\r
-  @param UpdatingManner  EDES_TODO: Add parameter description\r
-  @param QuestionIdStart EDES_TODO: Add parameter description\r
-  @param GotoForm        EDES_TODO: Add parameter description\r
-  @param GotoAlternateForm EDES_TODO: Add parameter description\r
-  @param DisplayTokenStart EDES_TODO: Add parameter description\r
-  @param HelpTokenStart  EDES_TODO: Add parameter description\r
-  @param KeyValueStart   EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-EFI_STATUS\r
-UpdatePage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData,\r
-  IN BM_MENU_OPTION                   *UpdatingMenu,\r
-  IN UINT16                           UpdatingPage,\r
-  IN UINT16                           UpdatingManner,\r
-  IN UINT16                           QuestionIdStart,\r
-  IN UINT16                           GotoForm,\r
-  IN UINT16                           GotoAlternateForm,\r
-  IN EFI_STRING_ID                    DisplayTokenStart,\r
-  IN EFI_STRING_ID                    HelpTokenStart,\r
-  IN UINT16                           KeyValueStart\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateBootAddPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1169,24 +1138,11 @@ UpdateBootDelPage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateDrvAddFilePage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
+  Create a lit of driver option from global DriverMenu.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1195,11 +1151,13 @@ UpdateDrvAddHandlePage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a lit of driver option from global DriverOptionMenu. It\r
+  allow user to delete the driver option.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param CallbackData    The BMM context data.\r
+\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1208,11 +1166,12 @@ UpdateDrvDelPage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Prepare the page to allow user to add description for \r
+  a Driver Option.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1221,64 +1180,13 @@ UpdateDriverAddHandleDescPage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateBootTimeOut (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateConInPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateConOutPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
+  Dispatch the correct update page function to call based on\r
+  the UpdatePageId.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param UpdatePageId    The form ID.\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateStdErrPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param UpdatePageId    EDES_TODO: Add parameter description\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1288,63 +1196,12 @@ UpdatePageBody (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateCOM1Page (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateCOM2Page (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateBootOrderPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID\r
-UpdateDriverOrderPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
+  Create the dynamic page to allow user to set\r
+  the "BootNext" vaule.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1353,11 +1210,12 @@ UpdateBootNextPage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create the dynamic page to allow user to set\r
+  the "TimeOut" vaule.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1366,11 +1224,13 @@ UpdateTimeOutPage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create the dynamic page which allows user to \r
+  set the property such as Baud Rate, Data Bits,\r
+  Parity, Stop Bits, Terminal Type.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1379,11 +1239,12 @@ UpdateTerminalPage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Refresh the text mode page\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param CallbackData    The BMM context data.\r
+\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1392,11 +1253,12 @@ UpdateConModePage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a list of Goto Opcode for all terminal devices logged\r
+  by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1405,12 +1267,13 @@ UpdateConCOMPage (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a dynamic page so that Legacy Device boot order\r
+  can be set for specified device type.\r
 \r
-  @param UpdatePageId    EDES_TODO: Add parameter description\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param UpdatePageId    The form ID. It also spefies the legacy device type.\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1419,40 +1282,15 @@ UpdateSetLegacyDeviceOrderPage (
   IN BMM_CALLBACK_DATA                *CallbackData\r
 );\r
 \r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param BbsType         EDES_TODO: Add parameter description\r
-  @param BbsFlag         EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-EFI_STATUS\r
-BootLegacy (\r
-  IN  UINT16  BbsType,\r
-  IN  UINT16  BbsFlag\r
-);\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param TerminalNumber  EDES_TODO: Add parameter description\r
+  Function opens and returns a file handle to the root directory of a volume.\r
 \r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-BM_MENU_ENTRY                     *\r
-GetCurrentTerminal (\r
-  UINTN       TerminalNumber\r
-);\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param DeviceHandle    EDES_TODO: Add parameter description\r
+  @param DeviceHandle    - A handle for a device\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return A valid file handle or NULL is returned\r
 \r
 **/\r
 EFI_FILE_HANDLE\r
@@ -1461,11 +1299,15 @@ EfiLibOpenRoot (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param FHand           EDES_TODO: Add parameter description\r
+  Function gets the file system information from an open file descriptor,\r
+  and stores it in a buffer allocated from pool.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+\r
+  @param FHand           The file handle.\r
+\r
+  @return                A pointer to a buffer with file information.\r
+  @retval                NULL is returned if failed to get Vaolume Label Info.\r
 \r
 **/\r
 EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *\r
@@ -1474,11 +1316,13 @@ EfiLibFileSystemVolumeLabelInfo (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param FHand           EDES_TODO: Add parameter description\r
+  Function gets the file information from an open file descriptor, and stores it\r
+  in a buffer allocated from pool.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param FHand           File Handle.\r
+\r
+  @return                A pointer to a buffer with file information or NULL is returned\r
 \r
 **/\r
 EFI_FILE_INFO                     *\r
@@ -1487,13 +1331,16 @@ EfiLibFileInfo (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param UStr            EDES_TODO: Add parameter description\r
-  @param Length          EDES_TODO: Add parameter description\r
-  @param AStr            EDES_TODO: Add parameter description\r
+  change a Unicode string t ASCII string\r
 \r
-  @return EDES_TODO: Add description for return value\r
+\r
+  @param UStr            Unicode string\r
+                         Lenght - most possible length of AStr\r
+  @param Length          The length of UStr.\r
+  @param AStr            ASCII string to pass out\r
+\r
+  @return Actual length\r
 \r
 **/\r
 UINTN\r
@@ -1504,11 +1351,11 @@ UnicodeToAscii (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function converts an input device structure to a Unicode string.\r
 \r
-  @param DevPath         EDES_TODO: Add parameter description\r
+  @param DevPath                  A pointer to the device path structure.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return A new allocated Unicode string that represents the device path.\r
 \r
 **/\r
 CHAR16                            *\r
@@ -1517,25 +1364,17 @@ DevicePathToStr (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param Size            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-VOID                              *\r
-EfiAllocateZeroPool (\r
-  IN UINTN            Size\r
-  );\r
+  Find the first instance of this Protocol\r
+  in the system and return it's interface\r
 \r
-/**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param ProtocolGuid    EDES_TODO: Add parameter description\r
-  @param Interface       EDES_TODO: Add parameter description\r
+  @param ProtocolGuid    Provides the protocol to search for\r
+  @param Interface       On return, a pointer to the first interface\r
+                         that matches ProtocolGuid\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval  EFI_SUCCESS      A protocol instance matching ProtocolGuid was found\r
+  @retval  EFI_NOT_FOUND    No protocol instances were found that match ProtocolGuid\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1545,13 +1384,15 @@ EfiLibLocateProtocol (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Adjusts the size of a previously allocated buffer.\r
 \r
-  @param OldPool         EDES_TODO: Add parameter description\r
-  @param OldSize         EDES_TODO: Add parameter description\r
-  @param NewSize         EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param OldPool         - A pointer to the buffer whose size is being adjusted.\r
+  @param OldSize         - The size of the current buffer.\r
+  @param NewSize         - The size of the new buffer.\r
+\r
+  @return   The newly allocated buffer.\r
+  @retval   NULL  Allocation failed.\r
 \r
 **/\r
 VOID                              *\r
@@ -1562,26 +1403,16 @@ EfiReallocatePool (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Read the EFI variable (VendorGuid/Name) and return a dynamically allocated\r
+  buffer, and the size of the buffer. If failure return NULL.\r
 \r
-  @param DevPath         EDES_TODO: Add parameter description\r
+  @param  Name                  String part of EFI variable name\r
+  @param  VendorGuid            GUID part of EFI variable name\r
+  @param  VariableSize          Returns the size of the EFI variable that was read\r
 \r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-CHAR16                            *\r
-DevicePathToStr (\r
-  EFI_DEVICE_PATH_PROTOCOL     *DevPath\r
-  );\r
-\r
-/**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param Name            EDES_TODO: Add parameter description\r
-  @param VendorGuid      EDES_TODO: Add parameter description\r
-  @param VarSize         EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
+  @return Dynamically allocated memory that contains a copy of the EFI variable.\r
+  @return Caller is responsible freeing the buffer.\r
+  @retval NULL                  Variable was not read\r
 \r
 **/\r
 VOID                              *\r
@@ -1592,12 +1423,18 @@ BdsLibGetVariableAndSize (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Function deletes the variable specified by VarName and VarGuid.\r
 \r
-  @param VarName         EDES_TODO: Add parameter description\r
-  @param VarGuid         EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VarName         - A Null-terminated Unicode string that is\r
+                         the name of the vendor's variable.\r
+                         \r
+  @param VendorGuid           - A unique identifier for the vendor.\r
+\r
+  @retval  EFI_SUCCESS           The variable was found and removed\r
+  @retval  EFI_UNSUPPORTED       The variable store was inaccessible\r
+  @retval  EFI_OUT_OF_RESOURCES  The temporary buffer was not available\r
+  @retval  EFI_NOT_FOUND         The variable was not found\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1607,11 +1444,12 @@ EfiLibDeleteVariable (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Duplicate a string.\r
 \r
-  @param Src             EDES_TODO: Add parameter description\r
+  @param Src             The source.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return A new string which is duplicated copy of the source.\r
+  @retval NULL If there is not enough memory.\r
 \r
 **/\r
 CHAR16                            *\r
@@ -1620,26 +1458,14 @@ EfiStrDuplicate (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param Multi           EDES_TODO: Add parameter description\r
-  @param Single          EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
-\r
-**/\r
-BOOLEAN\r
-EfiLibMatchDevicePaths (\r
-  IN  EFI_DEVICE_PATH_PROTOCOL *Multi,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL *Single\r
-  );\r
+  Function is used to determine the number of device path instances\r
+  that exist in a device path.\r
 \r
-/**\r
-  EDES_TODO: Add function description.\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
+  @param DevicePath      A pointer to a device path data structure.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return This function counts and returns the number of device path instances\r
+          in DevicePath.\r
 \r
 **/\r
 UINTN\r
@@ -1648,13 +1474,15 @@ EfiDevicePathInstanceCount (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create string tokens for a menu from its help strings and display strings\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param HiiHandle       EDES_TODO: Add parameter description\r
-  @param MenuOption      EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param CallbackData    The BMM context data.\r
+  @param HiiHandle       Hii Handle of the package to be updated.\r
+  @param MenuOption      The Menu whose string tokens need to be created\r
+\r
+  @retval  EFI_SUCCESS      string tokens created successfully\r
+  @retval  others           contain some errors\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1665,11 +1493,14 @@ CreateMenuStringToken (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Get a string from the Data Hub record based on \r
+  a device path.\r
 \r
-  @param DevPath         EDES_TODO: Add parameter description\r
+  @param DevPath         The device Path.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return A string located from the Data Hub records based on\r
+          the device path.\r
+  @retval NULL  If failed to get the String from Data Hub.\r
 \r
 **/\r
 UINT16                            *\r
@@ -1678,13 +1509,15 @@ EfiLibStrFromDatahub (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type\r
+  specified by DeviceType.\r
 \r
-  @param DeviceType      EDES_TODO: Add parameter description\r
-  @param OptionIndex     EDES_TODO: Add parameter description\r
-  @param OptionSize      EDES_TODO: Add parameter description\r
+  @param DeviceType      The legacy device type. It can be floppy, network, harddisk, cdrom,\r
+                         etc.\r
+  @param OptionIndex     Returns the index number (#### in Boot####).\r
+  @param OptionSize      Return the size of the Boot### variable.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID                              *\r
@@ -1695,11 +1528,13 @@ GetLegacyBootOptionVar (
  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Initialize the Boot Maintenance Utitliy\r
+\r
 \r
   @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval  EFI_SUCCESS      utility ended successfully\r
+  @retval  others           contain some errors\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1708,11 +1543,13 @@ InitializeBM (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Start boot maintenance manager\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @retval EFI_SUCCESS If BMM is invoked successfully.\r
+  @return Other value if BMM return unsuccessfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1721,23 +1558,27 @@ BdsStartBootMaint (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Intialize all the string depositories.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
-InitializeStringDepository (VOID);\r
+InitializeStringDepository (\r
+  VOID\r
+  );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Fetch a usable string node from the string depository and return the string token.\r
+\r
 \r
   @param CallbackData    EDES_TODO: Add parameter description\r
-  @param StringDepository EDES_TODO: Add parameter description\r
+  @param StringDepository - Pointer of the string depository.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval  EFI_STRING_ID           String token.\r
 \r
 **/\r
 EFI_STRING_ID\r
@@ -1747,11 +1588,12 @@ GetStringTokenFromDepository (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Reclaim string depositories by moving the current node pointer to list head..\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID \r
+\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1760,11 +1602,12 @@ ReclaimStringDepository (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Release resource for all the string depositories.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
+\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1773,13 +1616,15 @@ CleanUpStringDepository (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Function handling request to apply changes for BMM pages.\r
 \r
-  @param Private         EDES_TODO: Add parameter description\r
-  @param CurrentFakeNVMap EDES_TODO: Add parameter description\r
-  @param FormId          EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param Private         - Pointer to callback data buffer.\r
+  @param CurrentFakeNVMap - Pointer to buffer holding data of various values used by BMM\r
+  @param FormId          - ID of the form which has sent the request to apply change.\r
+\r
+  @retval  EFI_SUCCESS       Change successfully applied.\r
+  @retval  Other             Error occurs while trying to apply changes.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1790,12 +1635,13 @@ ApplyChangeHandler (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Discard all changes done to the BMM pages such as Boot Order change,\r
+  Driver order change.\r
 \r
-  @param Private         EDES_TODO: Add parameter description\r
-  @param CurrentFakeNVMap EDES_TODO: Add parameter description\r
+  @param Private         The BMM context data.\r
+  @param CurrentFakeNVMap The current Fack NV Map.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1805,12 +1651,12 @@ DiscardChangeHandler (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Dispatch the display to the next page based on NewPageId.\r
 \r
-  @param Private         EDES_TODO: Add parameter description\r
-  @param NewPageId       EDES_TODO: Add parameter description\r
+  @param Private         The BMM context data.\r
+  @param NewPageId       The original page ID.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1820,11 +1666,13 @@ UpdatePageId (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Boot a file selected by user at File Expoloer of BMM.\r
 \r
-  @param FileContext     EDES_TODO: Add parameter description\r
+  @param FileContext     The file context data, which contains the device path\r
+                         of the file to be boot from.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS    The function completed successfull.\r
+  @retun                 Other value if the boot from the file fails.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1833,12 +1681,14 @@ BootThisFile (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the file explower page with the refershed file system.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param KeyValue        EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param CallbackData    BMM context data\r
+  @param KeyValue        Key value to identify the type of data to expect.\r
+\r
+  @retval  TRUE           Inform the caller to create a callback packet to exit file explorer.\r
+  @retval  FALSE          Indicate that there is no need to exit file explorer.\r
 \r
 **/\r
 BOOLEAN\r
@@ -1848,16 +1698,30 @@ UpdateFileExplorer (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function processes the results of changes in configuration.\r
+  When user select a interactive opcode, this callback will be triggered.\r
+  Based on the Question(QuestionId) that triggers the callback, the corresponding\r
+  actions is performed. It handles:\r
 \r
-  @param This            EDES_TODO: Add parameter description\r
-  @param Action          EDES_TODO: Add parameter description\r
-  @param QuestionId      EDES_TODO: Add parameter description\r
-  @param Type            EDES_TODO: Add parameter description\r
-  @param Value           EDES_TODO: Add parameter description\r
-  @param ActionRequest   EDES_TODO: Add parameter description\r
+  1) the addition of boot option.\r
+  2) the addition of driver option.\r
+  3) exit from file browser\r
+  4) update of file content if a dir is selected.\r
+  5) boot the file if a file is selected in "boot from file"\r
 \r
-  @return EDES_TODO: Add description for return value\r
+\r
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param Action          Specifies the type of action taken by the browser.\r
+  @param QuestionId      A unique value which is sent to the original exporting driver\r
+                         so that it can identify the type of data to expect.\r
+  @param Type            The type of value for the question.\r
+  @param Value           A pointer to the data being sent to the original exporting driver.\r
+  @param ActionRequest   On return, points to the action requested by the callback function.\r
+\r
+  @retval  EFI_SUCCESS           The callback successfully handled the action.\r
+  @retval  EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the variable and its data.\r
+  @retval  EFI_DEVICE_ERROR      The variable could not be saved.\r
+  @retval  EFI_UNSUPPORTED       The specified Action is not supported by the callback.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1872,11 +1736,14 @@ FileExplorerCallback (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Dispatch BMM formset and FileExplorer formset.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param CallbackData    The BMM context data.\r
+\r
+  @retval EFI_SUCCESS If function complete successfully.\r
+  @retturn Other value if the Setup Browser process BMM's pages and\r
+           return unsuccessfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1885,12 +1752,15 @@ FormSetDispatcher (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Function returns the value of the specified variable.\r
 \r
-  @param Name            EDES_TODO: Add parameter description\r
-  @param VendorGuid      EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param Name            A Null-terminated Unicode string that is\r
+                         the name of the vendor's variable.\r
+  @param VendorGuid      A unique identifier for the vendor.\r
+\r
+  @return               The payload of the variable.\r
+  @retval NULL          If the variable can't be read.\r
 \r
 **/\r
 VOID *\r
@@ -1921,7 +1791,7 @@ extern COM_ATTR                   BaudRateList[19];
 extern COM_ATTR                   DataBitsList[4];\r
 extern COM_ATTR                   ParityList[5];\r
 extern COM_ATTR                   StopBitsList[3];\r
-extern EFI_GUID                   Guid[4];\r
+extern EFI_GUID                   TerminalTypeGuid[4];\r
 extern EFI_HII_UPDATE_DATA        gUpdateData;\r
 extern STRING_DEPOSITORY          *FileOptionStrDepository;\r
 extern STRING_DEPOSITORY          *ConsoleOptionStrDepository;\r
index 89c8612d469a86689098a587d575074282848ce6..8baff7bb4cfe34fd63a33526e95ac866f818c743 100644 (file)
@@ -20,15 +20,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "BBSsupport.h"\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a menu entry give a Menu type.\r
 \r
-  @param MenuType        Use this parameter to identify current\r
-                         Menu type\r
+  @param MenuType        The Menu type to be created.\r
 \r
-           EDES_TODO: Incomplete Descriptions  NULL                Cannot allocate memory for current menu\r
-           EDES_TODO: Incomplete Descriptions  entry\r
-           EDES_TODO: Incomplete Descriptions  Others              A valid pointer pointing to the allocated\r
-           EDES_TODO: Incomplete Descriptions  memory pool for current menu entry\r
+\r
+  @retval NULL           If failed to create the menu.\r
+  @return                The menu.\r
 \r
 **/\r
 BM_MENU_ENTRY *\r
@@ -74,12 +72,12 @@ BOpt_CreateMenuEntry (
     return NULL;\r
   }\r
 \r
-  MenuEntry = EfiAllocateZeroPool (sizeof (BM_MENU_ENTRY));\r
+  MenuEntry = AllocateZeroPool (sizeof (BM_MENU_ENTRY));\r
   if (NULL == MenuEntry) {\r
     return MenuEntry;\r
   }\r
 \r
-  MenuEntry->VariableContext = EfiAllocateZeroPool (ContextSize);\r
+  MenuEntry->VariableContext = AllocateZeroPool (ContextSize);\r
   if (NULL == MenuEntry->VariableContext) {\r
     SafeFreePool (MenuEntry);\r
     MenuEntry = NULL;\r
@@ -92,11 +90,11 @@ BOpt_CreateMenuEntry (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Free up all resource allocated for a BM_MENU_ENTRY.\r
 \r
-  @param MenuEntry       EDES_TODO: Add parameter description\r
+  @param MenuEntry   A pointer to BM_MENU_ENTRY.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval VOID\r
 \r
 **/\r
 VOID\r
@@ -173,12 +171,15 @@ BOpt_DestroyMenuEntry (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Get the Menu Entry from the list in Menu Entry List.\r
+\r
+  If MenuNumber is great or equal to the number of Menu\r
+  Entry in the list, then ASSERT.\r
 \r
-  @param MenuOption      EDES_TODO: Add parameter description\r
-  @param MenuNumber      EDES_TODO: Add parameter description\r
+  @param MenuOption      The Menu Entry List to read the menu entry.\r
+  @param MenuNumber      The index of Menu Entry.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return The Menu Entry.\r
 \r
 **/\r
 BM_MENU_ENTRY *\r
@@ -191,9 +192,7 @@ BOpt_GetMenuEntry (
   UINTN           Index;\r
   LIST_ENTRY      *List;\r
 \r
-  if (MenuNumber >= MenuOption->MenuNumber) {\r
-    return NULL;\r
-  }\r
+  ASSERT (MenuNumber < MenuOption->MenuNumber);\r
 \r
   List = MenuOption->Head.ForwardLink;\r
   for (Index = 0; Index < MenuNumber; Index++) {\r
@@ -206,7 +205,10 @@ BOpt_GetMenuEntry (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function build the FsOptionMenu list which records all\r
+  available file system in the system. They includes all instances\r
+  of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, all instances of EFI_LOAD_FILE_SYSTEM\r
+  and all type of legacy boot device.\r
 \r
   @param CallbackData    BMM context data\r
 \r
@@ -273,7 +275,7 @@ BOpt_FindFileSystem (
       // Issue a dummy read to trigger reinstall of BlockIo protocol for removable media\r
       //\r
       if (BlkIo->Media->RemovableMedia) {\r
-        Buffer = EfiAllocateZeroPool (BlkIo->Media->BlockSize);\r
+        Buffer = AllocateZeroPool (BlkIo->Media->BlockSize);\r
         if (NULL == Buffer) {\r
           SafeFreePool (BlkIoHandle);\r
           return EFI_OUT_OF_RESOURCES;\r
@@ -372,7 +374,7 @@ BOpt_FindFileSystem (
       }\r
 \r
       TempStr                   = MenuEntry->HelpString;\r
-      MenuEntry->DisplayString  = EfiAllocateZeroPool (MAX_CHAR);\r
+      MenuEntry->DisplayString  = AllocateZeroPool (MAX_CHAR);\r
       ASSERT (MenuEntry->DisplayString != NULL);\r
       UnicodeSPrint (\r
         MenuEntry->DisplayString,\r
@@ -419,7 +421,7 @@ BOpt_FindFileSystem (
       MenuEntry->HelpString     = DevicePathToStr (FileContext->DevicePath);\r
 \r
       TempStr                   = MenuEntry->HelpString;\r
-      MenuEntry->DisplayString  = EfiAllocateZeroPool (MAX_CHAR);\r
+      MenuEntry->DisplayString  = AllocateZeroPool (MAX_CHAR);\r
       ASSERT (MenuEntry->DisplayString != NULL);\r
       UnicodeSPrint (\r
         MenuEntry->DisplayString,\r
@@ -478,7 +480,7 @@ BOpt_FindFileSystem (
       MenuEntry->HelpString     = DevicePathToStr (FileContext->DevicePath);\r
 \r
       TempStr                   = MenuEntry->HelpString;\r
-      MenuEntry->DisplayString  = EfiAllocateZeroPool (MAX_CHAR);\r
+      MenuEntry->DisplayString  = AllocateZeroPool (MAX_CHAR);\r
       ASSERT (MenuEntry->DisplayString != NULL);\r
       UnicodeSPrint (\r
         MenuEntry->DisplayString,\r
@@ -498,22 +500,18 @@ BOpt_FindFileSystem (
   return EFI_SUCCESS;\r
 }\r
 \r
-VOID\r
-BOpt_FreeMenu (\r
-  BM_MENU_OPTION        *FreeMenu\r
-  )\r
-/*++\r
-\r
-Routine Description\r
+/**\r
   Free resources allocated in Allocate Rountine\r
 \r
-Arguments:\r
-  FreeMenu        Menu to be freed\r
+  @param FreeMenu        Menu to be freed\r
 \r
-Returns:\r
-  VOID\r
+  @return VOID\r
 \r
---*/\r
+**/\r
+VOID\r
+BOpt_FreeMenu (\r
+  BM_MENU_OPTION        *FreeMenu\r
+  )\r
 {\r
   BM_MENU_ENTRY *MenuEntry;\r
   while (!IsListEmpty (&FreeMenu->Head)) {\r
@@ -528,26 +526,22 @@ Returns:
   }\r
 }\r
 \r
-EFI_STATUS\r
-BOpt_FindFiles (\r
-  IN BMM_CALLBACK_DATA          *CallbackData,\r
-  IN BM_MENU_ENTRY              *MenuEntry\r
-  )\r
-/*++\r
-\r
-Routine Description\r
+/**\r
   Find files under current directory\r
   All files and sub-directories in current directory\r
   will be stored in DirectoryMenu for future use.\r
 \r
-Arguments:\r
-  FileOption   -- Pointer for Dir to explore\r
+  @param FileOption  Pointer for Dir to explore.\r
 \r
-Returns:\r
-  TRUE         -- Get files from current dir successfully\r
-  FALSE        -- Can't get files from current dir\r
+  @retval TRUE         Get files from current dir successfully.\r
+  @retval FALSE        Can't get files from current dir.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+BOpt_FindFiles (\r
+  IN BMM_CALLBACK_DATA          *CallbackData,\r
+  IN BM_MENU_ENTRY              *MenuEntry\r
+  )\r
 {\r
   EFI_FILE_HANDLE NewDir;\r
   EFI_FILE_HANDLE Dir;\r
@@ -597,7 +591,7 @@ Returns:
                               );\r
 \r
   DirBufferSize = sizeof (EFI_FILE_INFO) + 1024;\r
-  DirInfo       = EfiAllocateZeroPool (DirBufferSize);\r
+  DirInfo       = AllocateZeroPool (DirBufferSize);\r
   if (DirInfo == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -659,7 +653,7 @@ Returns:
 \r
       if (NewFileContext->IsDir) {\r
         BufferSize                  = StrLen (DirInfo->FileName) * 2 + 6;\r
-        NewMenuEntry->DisplayString = EfiAllocateZeroPool (BufferSize);\r
+        NewMenuEntry->DisplayString = AllocateZeroPool (BufferSize);\r
 \r
         UnicodeSPrint (\r
           NewMenuEntry->DisplayString,\r
@@ -687,22 +681,19 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-BOpt_GetLegacyOptions (\r
-  VOID\r
-  )\r
-/*++\r
-Routine Description:\r
-\r
+/**\r
   Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().\r
 \r
-Arguments:\r
-  None\r
+  @param VOID\r
 \r
-Returns:\r
-  The device info of legacy device.\r
+  @retval EFI_SUCCESS The function complete successfully.\r
+  @retval EFI_OUT_OF_RESOURCES No enough memory to complete this function.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+BOpt_GetLegacyOptions (\r
+  VOID\r
+  )\r
 {\r
   BM_MENU_ENTRY             *NewMenuEntry;\r
   BM_LEGACY_DEVICE_CONTEXT  *NewLegacyDevContext;\r
@@ -780,7 +771,7 @@ Returns:
       sizeof (DescString),\r
       DescString\r
       );\r
-    NewLegacyDevContext->Description = EfiAllocateZeroPool (StrSize (DescString));\r
+    NewLegacyDevContext->Description = AllocateZeroPool (StrSize (DescString));\r
     if (NULL == NewLegacyDevContext->Description) {\r
       break;\r
     }\r
@@ -830,6 +821,14 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Free out resouce allocated from Legacy Boot Options.\r
+\r
+  @param VOID.\r
+\r
+  @return VOID.\r
+\r
+**/\r
 VOID\r
 BOpt_FreeLegacyOptions (\r
   VOID\r
@@ -842,24 +841,20 @@ BOpt_FreeLegacyOptions (
   BOpt_FreeMenu (&LegacyBEVMenu);\r
 }\r
 \r
-EFI_STATUS\r
-BOpt_GetBootOptions (\r
-  IN  BMM_CALLBACK_DATA         *CallbackData\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
 \r
   Build the BootOptionMenu according to BootOrder Variable.\r
-  This Routine will access the Boot#### to get EFI_LOAD_OPTION\r
+  This Routine will access the Boot#### to get EFI_LOAD_OPTION.\r
 \r
-Arguments:\r
-  None\r
+  @param None\r
 \r
-Returns:\r
-  The number of the Var Boot####\r
+  @return The number of the Var Boot####.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+BOpt_GetBootOptions (\r
+  IN  BMM_CALLBACK_DATA         *CallbackData\r
+  )\r
 {\r
   UINTN                     Index;\r
   UINT16                    BootString[10];\r
@@ -929,7 +924,7 @@ Returns:
       continue;\r
     }\r
 \r
-    LoadOption = EfiAllocateZeroPool (BootOptionSize);\r
+    LoadOption = AllocateZeroPool (BootOptionSize);\r
     if (LoadOption == NULL) {\r
       continue;\r
     }\r
@@ -1014,7 +1009,7 @@ Returns:
     LoadOptionPtr += sizeof (UINT16);\r
 \r
     StringSize                  = StrSize ((UINT16 *) LoadOptionPtr);\r
-    NewLoadContext->Description = EfiAllocateZeroPool (StringSize);\r
+    NewLoadContext->Description = AllocateZeroPool (StringSize);\r
     ASSERT (NewLoadContext->Description != NULL);\r
     CopyMem (\r
       NewLoadContext->Description,\r
@@ -1025,7 +1020,7 @@ Returns:
 \r
     LoadOptionPtr += StringSize;\r
 \r
-    NewLoadContext->FilePathList = EfiAllocateZeroPool (NewLoadContext->FilePathListLength);\r
+    NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);\r
     ASSERT (NewLoadContext->FilePathList != NULL);\r
     CopyMem (\r
       NewLoadContext->FilePathList,\r
@@ -1051,7 +1046,7 @@ Returns:
         StringSize -\r
         NewLoadContext->FilePathListLength;\r
 \r
-      NewLoadContext->OptionalData = EfiAllocateZeroPool (OptionalDataSize);\r
+      NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);\r
       ASSERT (NewLoadContext->OptionalData != NULL);\r
       CopyMem (\r
         NewLoadContext->OptionalData,\r
@@ -1072,46 +1067,22 @@ Returns:
   return MenuCount;\r
 }\r
 \r
-CHAR16 *\r
-BdsStrCpy (\r
-  OUT     CHAR16                    *Destination,\r
-  IN      CONST CHAR16              *Source\r
-  )\r
-{\r
-  CHAR16                            *ReturnValue;\r
+/**\r
 \r
-  //\r
-  // Destination cannot be NULL\r
-  //\r
-  ASSERT (Destination != NULL);\r
+  Append file name to existing file name.\r
 \r
-  ReturnValue = Destination;\r
-  while (*Source != L'\0') {\r
-    *(Destination++) = *(Source++);\r
-  }\r
-  *Destination = 0;\r
-  return ReturnValue;\r
-}\r
+  @param Str1  The existing file name\r
+  @param Str2  The file name to be appended\r
 \r
+  @return Allocate a new string to hold the appended result.\r
+          Caller is responsible to free the returned string.\r
+\r
+**/\r
 CHAR16 *\r
 BOpt_AppendFileName (\r
   IN  CHAR16  *Str1,\r
   IN  CHAR16  *Str2\r
   )\r
-/*++\r
-\r
-Routine Description\r
-  Append file name to existing file name.\r
-\r
-Arguments:\r
-  Str1  -   existing file name\r
-  Str2  -   file name to be appended\r
-\r
-Returns:\r
-  Allocate a new string to hold the appended result.\r
-  Caller is responsible to free the returned string.\r
-\r
---*/\r
 {\r
   UINTN   Size1;\r
   UINTN   Size2;\r
@@ -1121,7 +1092,7 @@ Returns:
 \r
   Size1 = StrSize (Str1);\r
   Size2 = StrSize (Str2);\r
-  Str   = EfiAllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));\r
+  Str   = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));\r
   ASSERT (Str != NULL);\r
 \r
   StrCat (Str, Str1);\r
@@ -1140,13 +1111,13 @@ Returns:
       // DO NOT convert the .. if it is at the end of the string. This will\r
       // break the .. behavior in changing directories.\r
       //\r
-      BdsStrCpy (LastSlash, Ptr + 3);\r
+      StrCpy (LastSlash, Ptr + 3);\r
       Ptr = LastSlash;\r
     } else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') {\r
       //\r
       // Convert a "\.\" to a "\"\r
       //\r
-      BdsStrCpy (Ptr, Ptr + 2);\r
+      StrCpy (Ptr, Ptr + 2);\r
       Ptr = LastSlash;\r
     } else if (*Ptr == '\\') {\r
       LastSlash = Ptr;\r
@@ -1158,24 +1129,21 @@ Returns:
   return Str;\r
 }\r
 \r
-BOOLEAN\r
-BOpt_IsEfiImageName (\r
-  IN UINT16  *FileName\r
-  )\r
-/*++\r
+/**\r
 \r
-Routine Description\r
   Check whether current FileName point to a valid\r
   Efi Image File.\r
 \r
-Arguments:\r
-  FileName  -   File need to be checked.\r
+  @param FileName  File need to be checked.\r
 \r
-Returns:\r
-  TRUE  -   Is Efi Image\r
-  FALSE -   Not a valid Efi Image\r
+  @retval TRUE  Is Efi Image\r
+  @retval FALSE Not a valid Efi Image\r
 \r
---*/\r
+**/\r
+BOOLEAN\r
+BOpt_IsEfiImageName (\r
+  IN UINT16  *FileName\r
+  )\r
 {\r
   //\r
   // Search for ".efi" extension\r
@@ -1203,25 +1171,22 @@ Returns:
   return FALSE;\r
 }\r
 \r
-BOOLEAN\r
-BOpt_IsEfiApp (\r
-  IN EFI_FILE_HANDLE Dir,\r
-  IN UINT16          *FileName\r
-  )\r
-/*++\r
+/**\r
 \r
-Routine Description:\r
   Check whether current FileName point to a valid Efi Application\r
 \r
-Arguments:\r
-  Dir       -   Pointer to current Directory\r
-  FileName  -   Pointer to current File name.\r
+  @param Dir       Pointer to current Directory\r
+  @param FileName  Pointer to current File name.\r
 \r
-Returns:\r
-  TRUE      -   Is a valid Efi Application\r
-  FALSE     -   not a valid Efi Application\r
+  @retval TRUE      Is a valid Efi Application\r
+  @retval FALSE     not a valid Efi Application\r
 \r
---*/\r
+**/\r
+BOOLEAN\r
+BOpt_IsEfiApp (\r
+  IN EFI_FILE_HANDLE Dir,\r
+  IN UINT16          *FileName\r
+  )\r
 {\r
   UINTN                       BufferSize;\r
   EFI_IMAGE_DOS_HEADER        DosHdr;\r
@@ -1270,26 +1235,23 @@ Returns:
   }\r
 }\r
 \r
-EFI_STATUS\r
-BOpt_FindDrivers (\r
-  VOID\r
-  )\r
-/*++\r
+/**\r
 \r
-Routine Description\r
   Find drivers that will be added as Driver#### variables from handles\r
   in current system environment\r
   All valid handles in the system except those consume SimpleFs, LoadFile\r
   are stored in DriverMenu for future use.\r
 \r
-Arguments:\r
-  None\r
+  @param VOID \r
 \r
-Returns:\r
-  EFI_SUCCESS\r
-  Others\r
+  @retval EFI_SUCCESS The function complets successfully.\r
+  @return Other value if failed to build the DriverMenu.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+BOpt_FindDrivers (\r
+  VOID\r
+  )\r
 {\r
   UINTN                           NoDevicePathHandles;\r
   EFI_HANDLE                      *DevicePathHandle;\r
@@ -1327,10 +1289,6 @@ Returns:
   for (Index = 0; Index < NoDevicePathHandles; Index++) {\r
     CurHandle = DevicePathHandle[Index];\r
 \r
-    //\r
-    //  Check whether this handle support\r
-    //  driver binding\r
-    //\r
     Status = gBS->HandleProtocol (\r
                     CurHandle,\r
                     &gEfiSimpleFileSystemProtocolGuid,\r
@@ -1371,21 +1329,19 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-UINT16\r
-BOpt_GetBootOptionNumber (\r
-  VOID\r
-  )\r
-/*++\r
+/**\r
 \r
-Routine Description:\r
-  Get the Option Number that does not used\r
+  Get the Option Number that has not been allocated for use.\r
 \r
-Arguments:\r
+  @param VOID\r
 \r
-Returns:\r
-  The Option Number\r
+  @return The available Option Number.\r
 \r
---*/\r
+**/\r
+UINT16\r
+BOpt_GetBootOptionNumber (\r
+  VOID\r
+  )\r
 {\r
   BM_MENU_ENTRY *NewMenuEntry;\r
   UINT16        *BootOrderList;\r
@@ -1423,15 +1379,16 @@ Returns:
       }\r
 \r
       if (Found) {\r
-     UnicodeSPrint (StrTemp, 100, L"Boot%04x", Index);\r
-     DEBUG((DEBUG_ERROR,"INdex= %s\n", StrTemp));\r
-          OptionBuffer = BdsLibGetVariableAndSize (\r
-                    StrTemp,\r
-                    &gEfiGlobalVariableGuid,\r
-                    &OptionSize\r
-                    );\r
-         if (NULL == OptionBuffer)\r
-            break;\r
+        UnicodeSPrint (StrTemp, 100, L"Boot%04x", Index);\r
+        DEBUG((DEBUG_ERROR,"INdex= %s\n", StrTemp));\r
+        OptionBuffer = BdsLibGetVariableAndSize (\r
+                          StrTemp,\r
+                          &gEfiGlobalVariableGuid,\r
+                          &OptionSize\r
+                          );\r
+        if (NULL == OptionBuffer) {\r
+          break;\r
+        }\r
       }\r
     }\r
     //\r
@@ -1448,21 +1405,19 @@ Returns:
   return Number;\r
 }\r
 \r
-UINT16\r
-BOpt_GetDriverOptionNumber (\r
-  VOID\r
-  )\r
-/*++\r
+/**\r
 \r
-Routine Description:\r
-  Get the Option Number that does not used\r
+  Get the Option Number that is not in use.\r
 \r
-Arguments:\r
+  @param VOID\r
 \r
-Returns:\r
-  The Option Number\r
+  @return The unused Option Number.\r
 \r
---*/\r
+**/\r
+UINT16\r
+BOpt_GetDriverOptionNumber (\r
+  VOID\r
+  )\r
 {\r
   BM_MENU_ENTRY *NewMenuEntry;\r
   UINT16        *DriverOrderList;\r
@@ -1514,21 +1469,21 @@ Returns:
   return Number;\r
 }\r
 \r
-EFI_STATUS\r
-BOpt_GetDriverOptions (\r
-  IN  BMM_CALLBACK_DATA         *CallbackData\r
-  )\r
-/*++\r
+/**\r
 \r
-Routine Description:\r
   Build up all DriverOptionMenu\r
 \r
-Arguments:\r
+  @param CallbackData The BMM context data.\r
 \r
-Returns:\r
-  The Option Number\r
+  @return EFI_SUCESS The functin completes successfully.\r
+  @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.\r
+  \r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+BOpt_GetDriverOptions (\r
+  IN  BMM_CALLBACK_DATA         *CallbackData\r
+  )\r
 {\r
   UINTN           Index;\r
   UINT16          DriverString[12];\r
@@ -1579,7 +1534,7 @@ Returns:
       continue;\r
     }\r
 \r
-    LoadOption = EfiAllocateZeroPool (DriverOptionSize);\r
+    LoadOption = AllocateZeroPool (DriverOptionSize);\r
     if (LoadOption == NULL) {\r
       continue;\r
     }\r
@@ -1619,7 +1574,7 @@ Returns:
     LoadOptionPtr += sizeof (UINT16);\r
 \r
     StringSize                  = StrSize ((UINT16 *) LoadOptionPtr);\r
-    NewLoadContext->Description = EfiAllocateZeroPool (StringSize);\r
+    NewLoadContext->Description = AllocateZeroPool (StringSize);\r
     ASSERT (NewLoadContext->Description != NULL);\r
     CopyMem (\r
       NewLoadContext->Description,\r
@@ -1630,7 +1585,7 @@ Returns:
 \r
     LoadOptionPtr += StringSize;\r
 \r
-    NewLoadContext->FilePathList = EfiAllocateZeroPool (NewLoadContext->FilePathListLength);\r
+    NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);\r
     ASSERT (NewLoadContext->FilePathList != NULL);\r
     CopyMem (\r
       NewLoadContext->FilePathList,\r
@@ -1656,7 +1611,7 @@ Returns:
         StringSize -\r
         NewLoadContext->FilePathListLength;\r
 \r
-      NewLoadContext->OptionalData = EfiAllocateZeroPool (OptionalDataSize);\r
+      NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);\r
       ASSERT (NewLoadContext->OptionalData != NULL);\r
       CopyMem (\r
         NewLoadContext->OptionalData,\r
index 270948633b682fbcee47d11882677c5f793099db..0364ba64d36a9e2b5d5cf5ae37221252910afad5 100644 (file)
@@ -15,11 +15,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "BootMaint.h"\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Function creates a device path data structure that identically matches the\r
+  device path passed in.\r
 \r
-  @param DevPath         EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param DevPath         A pointer to a device path data structure.\r
+\r
+  @return        The new copy of DevPath is created to identically match the input.\r
+  @retval  NULL  Otherwise, NULL is returned.\r
 \r
 **/\r
 EFI_DEVICE_PATH_PROTOCOL  *\r
@@ -28,11 +31,12 @@ DevicePathInstanceDup (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update Com Ports attributes from DevicePath\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param DevicePath      DevicePath that contains Com ports\r
+\r
+  @retval EFI_SUCCESS   The update is successful.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -41,18 +45,21 @@ UpdateComAttributeFromVariable (
   );\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the multi-instance device path of Terminal Device based on\r
+  the global TerminalMenu. If ChangeTernimal is TRUE, the terminal \r
+  device path in the Terminal Device in TerminalMenu is also updated.\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
-  @param ChangeTerminal  EDES_TODO: Add parameter description\r
+  @param DevicePath      The multi-instance device path.\r
+  @param ChangeTerminal  TRUE, then device path in the Terminal Device \r
+                         in TerminalMenu is also updated; FALSE, no update.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return EFI_SUCCESS    The function completes successfully.\r
 \r
 **/\r
 EFI_STATUS\r
 ChangeTerminalDevicePath (\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
-  BOOLEAN                   ChangeTerminal\r
+  IN BOOLEAN                   ChangeTerminal\r
   )\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *Node;\r
@@ -78,9 +85,6 @@ ChangeTerminalDevicePath (
     }\r
 \r
     NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);\r
-    if (NULL == NewMenuEntry) {\r
-      return EFI_NOT_FOUND;\r
-    }\r
 \r
     NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
     if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {\r
@@ -162,16 +166,18 @@ ChangeTerminalDevicePath (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the device path that describing a terminal device\r
+  based on the new BaudRate, Data Bits, parity and Stop Bits\r
+  set.\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
+  @param DevicePath\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
 ChangeVariableDevicePath (\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath\r
   )\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *Node;\r
@@ -237,8 +243,8 @@ ChangeVariableDevicePath (
   Retrieve ACPI UID of UART from device path\r
 \r
 \r
-  @param Handle          EDES_TODO: Add parameter description\r
-  @param AcpiUid         EDES_TODO: Add parameter description\r
+  @param Handle          The handle for the UART device.\r
+  @param AcpiUid         The ACPI UID on output.\r
 \r
   @retval  TRUE   Find valid UID from device path\r
   @retval  FALSE  Can't find\r
@@ -287,7 +293,7 @@ RetrieveUartUid (
   @param Handles         EFI_SERIAL_IO_PROTOCOL handle buffer\r
   @param NoHandles       EFI_SERIAL_IO_PROTOCOL handle count\r
 \r
-           EDES_TODO: Incomplete Descriptions  None\r
+  @retval VOID\r
 \r
 **/\r
 VOID\r
@@ -328,13 +334,15 @@ SortedUartHandle (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Test whether DevicePath is a valid Terminal\r
 \r
-  @param DevicePath      EDES_TODO: Add parameter description\r
-  @param Termi           EDES_TODO: Add parameter description\r
-  @param Com             EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param DevicePath      DevicePath to be checked\r
+  @param Termi           If DevicePath is valid Terminal, terminal type is returned.\r
+  @param Com             If DevicePath is valid Terminal, Com Port type is returned.\r
+\r
+  @retval  TRUE         If DevicePath point to a Terminal.\r
+  @retval  FALSE        If DevicePath does not point to a Terminal.\r
 \r
 **/\r
 BOOLEAN\r
@@ -511,7 +519,7 @@ LocateSerialIo (
     Vendor.Header.SubType             = MSG_VENDOR_DP;\r
 \r
     for (Index2 = 0; Index2 < 4; Index2++) {\r
-      CopyMem (&Vendor.Guid, &Guid[Index2], sizeof (EFI_GUID));\r
+      CopyMem (&Vendor.Guid, &TerminalTypeGuid[Index2], sizeof (EFI_GUID));\r
       SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));\r
       NewDevicePath = AppendDevicePathNode (\r
                         NewTerminalContext->DevicePath,\r
@@ -550,7 +558,7 @@ LocateSerialIo (
 \r
   @param DevicePath      DevicePath that contains Com ports\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS   The update is successful.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -672,8 +680,8 @@ UpdateComAttributeFromVariable (
 \r
   @param DevPath         A pointer to a device path data structure.\r
 \r
-           EDES_TODO: Incomplete Descriptions  The new copy of DevPath is created to identically match the input.\r
-           EDES_TODO: Incomplete Descriptions  Otherwise, NULL is returned.\r
+  @return        The new copy of DevPath is created to identically match the input.\r
+  @retval  NULL  Otherwise, NULL is returned.\r
 \r
 **/\r
 EFI_DEVICE_PATH_PROTOCOL *\r
@@ -698,7 +706,7 @@ DevicePathInstanceDup (
   //\r
   NewDevPath = NULL;\r
   if (Size != 0) {\r
-    NewDevPath = EfiAllocateZeroPool (Size);\r
+    NewDevPath = AllocateZeroPool (Size);\r
     ASSERT (NewDevPath != NULL);\r
   }\r
 \r
@@ -714,11 +722,18 @@ DevicePathInstanceDup (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Build up Console Menu based on types passed in. The type can\r
+  be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT\r
+  and BM_CONSOLE_ERR_CONTEXT_SELECT.\r
 \r
-  @param ConsoleMenuType EDES_TODO: Add parameter description\r
+  @param ConsoleMenuType Can be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT\r
+                         and BM_CONSOLE_ERR_CONTEXT_SELECT.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_UNSUPPORTED The type passed in is not in the 3 types defined.\r
+  @retval EFI_NOT_FOUND   If the EFI Variable defined in UEFI spec with name "ConOutDev", \r
+                          "ConInDev" or "ConErrDev" doesn't exists.\r
+  @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operations.\r
+  @retval EFI_SUCCESS          Function completes successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -796,7 +811,7 @@ GetConsoleMenu (
   AllCount                = EfiDevicePathInstanceCount (AllDevicePath);\r
   ConsoleMenu->MenuNumber = 0;\r
   //\r
-  // Following is menu building up for Console Out Devices\r
+  // Following is menu building up for Console Devices selected.\r
   //\r
   MultiDevicePath = AllDevicePath;\r
   Index2          = 0;\r
@@ -844,10 +859,9 @@ GetConsoleMenu (
   Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-           EDES_TODO: Incomplete Descriptions  EFI_SUCCESS\r
-           EDES_TODO: Incomplete Descriptions  Others\r
+  @retval EFI_SUCCESS    The function always complete successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -867,9 +881,7 @@ GetAllConsoles (
 \r
   @param VOID            EDES_TODO: Add parameter description\r
 \r
-           EDES_TODO: Incomplete Descriptions  EFI_SUCCESS\r
-           EDES_TODO: Incomplete Descriptions  Others\r
-\r
+  @retval EFI_SUCCESS    The function always complete successfully.\r
 **/\r
 EFI_STATUS\r
 FreeAllConsoles (\r
@@ -888,11 +900,11 @@ FreeAllConsoles (
 \r
 \r
   @param DevicePath      DevicePath to be checked\r
-  @param Termi           If is terminal, give its type\r
-  @param Com             If is Com Port, give its type\r
+  @param Termi           If DevicePath is valid Terminal, terminal type is returned.\r
+  @param Com             If DevicePath is valid Terminal, Com Port type is returned.\r
 \r
-  @retval  TRUE         If DevicePath point to a Terminal\r
-                        FALSE\r
+  @retval  TRUE         If DevicePath point to a Terminal.\r
+  @retval  FALSE        If DevicePath does not point to a Terminal.\r
 \r
 **/\r
 BOOLEAN\r
@@ -929,19 +941,19 @@ IsTerminalDevicePath (
   //\r
   CopyMem (&TempGuid, &Vendor->Guid, sizeof (EFI_GUID));\r
 \r
-  if (CompareGuid (&TempGuid, &Guid[0])) {\r
+  if (CompareGuid (&TempGuid, &TerminalTypeGuid[0])) {\r
     *Termi      = PC_ANSI;\r
     IsTerminal  = TRUE;\r
   } else {\r
-    if (CompareGuid (&TempGuid, &Guid[1])) {\r
+    if (CompareGuid (&TempGuid, &TerminalTypeGuid[1])) {\r
       *Termi      = VT_100;\r
       IsTerminal  = TRUE;\r
     } else {\r
-      if (CompareGuid (&TempGuid, &Guid[2])) {\r
+      if (CompareGuid (&TempGuid, &TerminalTypeGuid[2])) {\r
         *Termi      = VT_100_PLUS;\r
         IsTerminal  = TRUE;\r
       } else {\r
-        if (CompareGuid (&TempGuid, &Guid[3])) {\r
+        if (CompareGuid (&TempGuid, &TerminalTypeGuid[3])) {\r
           *Termi      = VT_UTF8;\r
           IsTerminal  = TRUE;\r
         } else {\r
@@ -971,9 +983,9 @@ IsTerminalDevicePath (
   Get mode number according to column and row\r
 \r
 \r
-  @param CallbackData    BMM_CALLBACK_DATA\r
+  @param CallbackData    The BMM context data.\r
 \r
-           EDES_TODO: Incomplete Descriptions  None.\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
index 482319ae93d16faba508c407e1e6ff822e4ce11b..f1c57469ae633279bf778416f857e98fc1ec0b93 100644 (file)
@@ -307,7 +307,7 @@ COM_ATTR            StopBitsList[3] = {
 //\r
 // Guid for messaging path, used in Serial port setting.\r
 //\r
-EFI_GUID            Guid[4] = {\r
+EFI_GUID            TerminalTypeGuid[4] = {\r
   DEVICE_PATH_MESSAGING_PC_ANSI,\r
   DEVICE_PATH_MESSAGING_VT_100,\r
   DEVICE_PATH_MESSAGING_VT_100_PLUS,\r
index 03dd09bc2cf1794697bdb191e991e81b684c3215..c2c6252076f30330dfb85540133414433dd6acde 100644 (file)
@@ -18,10 +18,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   Update the File Explore page.\r
 \r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
   @param MenuOption      Pointer to menu options to display.\r
 \r
-           EDES_TODO: Incomplete Descriptions  None.\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -212,6 +212,15 @@ UpdateFileExplorer (
 \r
 /**\r
   This function processes the results of changes in configuration.\r
+  When user select a interactive opcode, this callback will be triggered.\r
+  Based on the Question(QuestionId) that triggers the callback, the corresponding\r
+  actions is performed. It handles:\r
+\r
+  1) the addition of boot option.\r
+  2) the addition of driver option.\r
+  3) exit from file browser\r
+  4) update of file content if a dir is selected.\r
+  5) boot the file if a file is selected in "boot from file"\r
 \r
 \r
   @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
index ac551ab1c376725e439586f98e65aff566a38bc3..1791a5cca2cc6edd94678ee85c8092e7a2c10200 100644 (file)
@@ -1,5 +1,5 @@
 /** @file\r
-  Dynamically Update the pages\r
+Dynamically update the pages.\r
 \r
 Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -17,10 +17,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 /**\r
   Refresh the global UpdateData structure.\r
 \r
+  @param VOID\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
-\r
-           EDES_TODO: Incomplete Descriptions  None.\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -32,11 +31,13 @@ RefreshUpdateData (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Add a "Go back to main page" tag in front of the form when there are no\r
+  "Apply changes" and "Discard changes" tags in the end of the form.\r
+  \r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -64,11 +65,12 @@ UpdatePageStart (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create the "Apply changes" and "Discard changes" tags. And\r
+  ensure user can return to the main page.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -121,12 +123,14 @@ UpdatePageEnd (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Clean up the dynamic opcode at label and form specified by\r
+  both LabelId. \r
 \r
-  @param LabelId         EDES_TODO: Add parameter description\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param LabelId         It is both the Form ID and Label ID for\r
+                         opcode deletion.\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -151,11 +155,13 @@ CleanUpPage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Boot a file selected by user at File Expoloer of BMM.\r
 \r
-  @param FileContext     EDES_TODO: Add parameter description\r
+  @param FileContext     The file context data, which contains the device path\r
+                         of the file to be boot from.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS    The function completed successfull.\r
+  @retun                 Other value if the boot from the file fails.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -192,11 +198,12 @@ BootThisFile (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a list of Goto Opcode for all terminal devices logged\r
+  by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -229,11 +236,12 @@ UpdateConCOMPage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a lit of boot option from global BootOptionMenu. It\r
+  allow user to delete the boot option.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -276,11 +284,11 @@ UpdateBootDelPage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a lit of driver option from global DriverMenu.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -312,11 +320,13 @@ UpdateDrvAddHandlePage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a lit of driver option from global DriverOptionMenu. It\r
+  allow user to delete the driver option.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param CallbackData    The BMM context data.\r
+\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -357,11 +367,12 @@ UpdateDrvDelPage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Prepare the page to allow user to add description for \r
+  a Driver Option.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -431,9 +442,9 @@ UpdateDriverAddHandleDescPage (
 \r
   @param UpdatePageId    EDES_TODO: Add parameter description\r
   @param ConsoleMenu     EDES_TODO: Add parameter description\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -510,13 +521,14 @@ UpdateConsolePage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the page's NV Map if user has changed the order\r
+  a list. This list can be Boot Order or Driver Order.\r
 \r
-  @param UpdatePageId    EDES_TODO: Add parameter description\r
-  @param OptionMenu      EDES_TODO: Add parameter description\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param UpdatePageId    The form ID to be updated.\r
+  @param OptionMenu      The new list.\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -538,7 +550,7 @@ UpdateOrderPage (
 \r
   ZeroMem (CallbackData->BmmFakeNvData.OptionOrder, 100);\r
 \r
-  IfrOptionList = EfiAllocateZeroPool (sizeof (IFR_OPTION) * OptionMenu->MenuNumber);\r
+  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * OptionMenu->MenuNumber);\r
   if (NULL == IfrOptionList) {\r
     return ;\r
   }\r
@@ -580,11 +592,12 @@ UpdateOrderPage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create the dynamic page to allow user to set\r
+  the "BootNext" vaule.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -606,7 +619,7 @@ UpdateBootNextPage (
   CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);\r
 \r
   if (NumberOfOptions > 0) {\r
-    IfrOptionList = EfiAllocateZeroPool ((NumberOfOptions + 1) * sizeof (IFR_OPTION));\r
+    IfrOptionList = AllocateZeroPool ((NumberOfOptions + 1) * sizeof (IFR_OPTION));\r
 \r
     ASSERT (IfrOptionList);\r
 \r
@@ -653,11 +666,12 @@ UpdateBootNextPage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create the dynamic page to allow user to set\r
+  the "TimeOut" vaule.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -697,9 +711,9 @@ UpdateTimeOutPage (
   Refresh the text mode page\r
 \r
 \r
-  @param CallbackData    BMM_CALLBACK_DATA\r
+  @param CallbackData    The BMM context data.\r
 \r
-           EDES_TODO: Incomplete Descriptions  None.\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -744,10 +758,10 @@ UpdateConModePage (
     return;\r
   }\r
 \r
-  IfrOptionList       = EfiAllocateZeroPool (sizeof (IFR_OPTION) * ValidMode);\r
+  IfrOptionList       = AllocateZeroPool (sizeof (IFR_OPTION) * ValidMode);\r
   ASSERT(IfrOptionList != NULL);\r
 \r
-  ModeToken           = EfiAllocateZeroPool (sizeof (EFI_STRING_ID) * ValidMode);\r
+  ModeToken           = AllocateZeroPool (sizeof (EFI_STRING_ID) * ValidMode);\r
   ASSERT(ModeToken != NULL);\r
 \r
   //\r
@@ -802,11 +816,13 @@ UpdateConModePage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create the dynamic page which allows user to \r
+  set the property such as Baud Rate, Data Bits,\r
+  Parity, Stop Bits, Terminal Type.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -835,12 +851,12 @@ UpdateTerminalPage (
 \r
   NewTerminalContext  = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
 \r
-  IfrOptionList       = EfiAllocateZeroPool (sizeof (IFR_OPTION) * 19);\r
+  IfrOptionList       = AllocateZeroPool (sizeof (IFR_OPTION) * 19);\r
   if (IfrOptionList == NULL) {\r
     return ;\r
   }\r
 \r
-  for (Index = 0; Index < 19; Index++) {\r
+  for (Index = 0; Index < sizeof (BaudRateList) / sizeof (BaudRateList [0]); Index++) {\r
     CheckFlags = 0;\r
     if (NewTerminalContext->BaudRate == (UINT64) (BaudRateList[Index].Value)) {\r
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;\r
@@ -866,7 +882,7 @@ UpdateTerminalPage (
     &gUpdateData\r
     );\r
 \r
-  for (Index = 0; Index < 4; Index++) {\r
+  for (Index = 0; Index < sizeof (DataBitsList) / sizeof (DataBitsList[0]); Index++) {\r
     CheckFlags = 0;\r
 \r
     if (NewTerminalContext->DataBits == DataBitsList[Index].Value) {\r
@@ -893,7 +909,7 @@ UpdateTerminalPage (
     &gUpdateData\r
     );\r
 \r
-  for (Index = 0; Index < 5; Index++) {\r
+  for (Index = 0; Index < sizeof (ParityList) / sizeof (ParityList[0]); Index++) {\r
     CheckFlags = 0;\r
     if (NewTerminalContext->Parity == ParityList[Index].Value) {\r
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;\r
@@ -919,7 +935,7 @@ UpdateTerminalPage (
     &gUpdateData\r
     );\r
 \r
-  for (Index = 0; Index < 3; Index++) {\r
+  for (Index = 0; Index < sizeof (StopBitsList) / sizeof (StopBitsList[0]); Index++) {\r
     CheckFlags = 0;\r
     if (NewTerminalContext->StopBits == StopBitsList[Index].Value) {\r
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;\r
@@ -976,12 +992,13 @@ UpdateTerminalPage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Dispatch the correct update page function to call based on\r
+  the UpdatePageId.\r
 \r
-  @param UpdatePageId    EDES_TODO: Add parameter description\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param UpdatePageId    The form ID.\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1018,13 +1035,15 @@ UpdatePageBody (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type\r
+  specified by DeviceType.\r
 \r
-  @param DeviceType      EDES_TODO: Add parameter description\r
-  @param OptionIndex     EDES_TODO: Add parameter description\r
-  @param OptionSize      EDES_TODO: Add parameter description\r
+  @param DeviceType      The legacy device type. It can be floppy, network, harddisk, cdrom,\r
+                         etc.\r
+  @param OptionIndex     Returns the index number (#### in Boot####).\r
+  @param OptionSize      Return the size of the Boot### variable.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID *\r
@@ -1100,12 +1119,13 @@ GetLegacyBootOptionVar (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Create a dynamic page so that Legacy Device boot order\r
+  can be set for specified device type.\r
 \r
-  @param UpdatePageId    EDES_TODO: Add parameter description\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param UpdatePageId    The form ID. It also spefies the legacy device type.\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -1210,7 +1230,7 @@ UpdateSetLegacyDeviceOrderPage (
 \r
   CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);\r
 \r
-  IfrOptionList = EfiAllocateZeroPool (sizeof (IFR_OPTION) * (OptionMenu->MenuNumber + 1));\r
+  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * (OptionMenu->MenuNumber + 1));\r
   if (NULL == IfrOptionList) {\r
     return ;\r
   }\r
@@ -1304,12 +1324,12 @@ UpdateSetLegacyDeviceOrderPage (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Dispatch the display to the next page based on NewPageId.\r
 \r
-  @param Private         EDES_TODO: Add parameter description\r
-  @param NewPageId       EDES_TODO: Add parameter description\r
+  @param Private         The BMM context data.\r
+  @param NewPageId       The original page ID.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
index a5e575f0bf13ecb3aabb99c929c6a11783edb122..7837224e7ea0e98899a594383f06e858a57e047b 100644 (file)
@@ -22,8 +22,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
   @param VOID            EDES_TODO: Add parameter description\r
 \r
-           EDES_TODO: Incomplete Descriptions  EFI_SUCCESS\r
-           EDES_TODO: Incomplete Descriptions  Others\r
+  @retval EFI_SUCCESS   If all boot load option EFI Variables corresponding to  \r
+                        BM_LOAD_CONTEXT marked for deletion is deleted\r
+  @return Others        If failed to update the "BootOrder" variable after deletion. \r
 \r
 **/\r
 EFI_STATUS\r
@@ -87,10 +88,11 @@ Var_DelBootOption (
   scratch by content from BootOptionMenu is needed.\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-           EDES_TODO: Incomplete Descriptions  EFI_SUCCESS\r
-           EDES_TODO: Incomplete Descriptions  Others\r
+  @retval  EFI_SUCCESS  The boot order is updated successfully.\r
+  @return               EFI_STATUS other than EFI_SUCCESS if failed to\r
+                        Set the "BootOrder" EFI Variable.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -138,7 +140,7 @@ Var_ChangeBootOrder (
   BootOrderListSize = BootOptionMenu.MenuNumber;\r
 \r
   if (BootOrderListSize > 0) {\r
-    BootOrderList = EfiAllocateZeroPool (BootOrderListSize * sizeof (UINT16));\r
+    BootOrderList = AllocateZeroPool (BootOrderListSize * sizeof (UINT16));\r
     ASSERT (BootOrderList != NULL);\r
     BootOrderListPtr = BootOrderList;\r
 \r
@@ -178,10 +180,11 @@ Var_ChangeBootOrder (
   make sure DriverOrder is in valid state.\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-           EDES_TODO: Incomplete Descriptions  EFI_SUCCESS\r
-           EDES_TODO: Incomplete Descriptions  Others\r
+  @retval EFI_SUCCESS Load Option is successfully updated.\r
+  @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI\r
+          Variable.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -238,10 +241,11 @@ Var_DelDriverOption (
   needed.\r
 \r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-           EDES_TODO: Incomplete Descriptions  EFI_SUCCESS\r
-           EDES_TODO: Incomplete Descriptions  Others\r
+  @retval  EFI_SUCCESS  The driver order is updated successfully.\r
+  @return               EFI_STATUS other than EFI_SUCCESS if failed to\r
+                                 Set the "DriverOrder" EFI Variable.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -280,7 +284,7 @@ Var_ChangeDriverOrder (
   DriverOrderListSize = DriverOptionMenu.MenuNumber;\r
 \r
   if (DriverOrderListSize > 0) {\r
-    DriverOrderList = EfiAllocateZeroPool (DriverOrderListSize * sizeof (UINT16));\r
+    DriverOrderList = AllocateZeroPool (DriverOrderListSize * sizeof (UINT16));\r
     ASSERT (DriverOrderList != NULL);\r
     DriverOrderListPtr = DriverOrderList;\r
 \r
@@ -315,11 +319,13 @@ Var_ChangeDriverOrder (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the device path of "ConOut", "ConIn" and "ErrOut" \r
+  based on the new BaudRate, Data Bits, parity and Stop Bits\r
+  set.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
+  @param VOID\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return VOID\r
 \r
 **/\r
 VOID\r
@@ -373,13 +379,26 @@ Var_UpdateAllConsoleOption (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param ConsoleName     EDES_TODO: Add parameter description\r
-  @param ConsoleMenu     EDES_TODO: Add parameter description\r
-  @param UpdatePageId    EDES_TODO: Add parameter description\r
-\r
-  @return EDES_TODO: Add description for return value\r
+  This function delete and build multi-instance device path for\r
+  specified type of console device.\r
+\r
+  This function clear the EFI variable defined by ConsoleName and\r
+  gEfiGlobalVariableGuid. It then build the multi-instance device\r
+  path by appending the device path of the Console (In/Out/Err) instance \r
+  in ConsoleMenu. Then it scan all corresponding console device by\r
+  scanning Terminal (built from device supporting Serial I/O instances)\r
+  devices in TerminalMenu. At last, it save a EFI variable specifed\r
+  by ConsoleName and gEfiGlobalVariableGuid.\r
+\r
+  @param ConsoleName     The name for the console device type. They are\r
+                         usually "ConIn", "ConOut" and "ErrOut".\r
+  @param ConsoleMenu     The console memu which is a list of console devices.\r
+  @param UpdatePageId    The flag specifying which type of console device\r
+                         to be processed.\r
+\r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -406,13 +425,10 @@ Var_UpdateConsoleOption (
   };\r
 \r
   //\r
-  // First add all console input device to it from console input menu\r
+  // First add all console input device from console input menu\r
   //\r
   for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {\r
     NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);\r
-    if (NULL == NewMenuEntry) {\r
-      return EFI_NOT_FOUND;\r
-    }\r
 \r
     NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;\r
     if (NewConsoleContext->IsActive) {\r
@@ -425,9 +441,6 @@ Var_UpdateConsoleOption (
 \r
   for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {\r
     NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);\r
-    if (NULL == NewMenuEntry) {\r
-      return EFI_NOT_FOUND;\r
-    }\r
 \r
     NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
     if (((NewTerminalContext->IsConIn != 0) && (UpdatePageId == FORM_CON_IN_ID)) ||\r
@@ -438,7 +451,7 @@ Var_UpdateConsoleOption (
       Vendor.Header.SubType = MSG_VENDOR_DP;\r
       CopyMem (\r
         &Vendor.Guid,\r
-        &Guid[NewTerminalContext->TerminalType],\r
+        &TerminalTypeGuid[NewTerminalContext->TerminalType],\r
         sizeof (EFI_GUID)\r
         );\r
       SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));\r
@@ -473,12 +486,15 @@ Var_UpdateConsoleOption (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function delete and build multi-instance device path ConIn\r
+  console device.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
 \r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 **/\r
 EFI_STATUS\r
 Var_UpdateConsoleInpOption (\r
@@ -489,12 +505,15 @@ Var_UpdateConsoleInpOption (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function delete and build multi-instance device path ConOut\r
+  console device.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
 \r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 **/\r
 EFI_STATUS\r
 Var_UpdateConsoleOutOption (\r
@@ -505,12 +524,15 @@ Var_UpdateConsoleOutOption (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function delete and build multi-instance device path ErrOut\r
+  console device.\r
 \r
-  @param VOID            EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @param VOID\r
 \r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 **/\r
 EFI_STATUS\r
 Var_UpdateErrorOutOption (\r
@@ -521,15 +543,19 @@ Var_UpdateErrorOutOption (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
-\r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param HiiHandle       EDES_TODO: Add parameter description\r
-  @param DescriptionData EDES_TODO: Add parameter description\r
-  @param OptionalData    EDES_TODO: Add parameter description\r
+  This function create a currently loaded Drive Option from \r
+  the BMM. It then appends this Driver Option to the end of \r
+  the "DriverOrder" list. It append this Driver Opotion to the end\r
+  of DriverOptionMenu.\r
+\r
+  @param CallbackData    The BMM context data.\r
+  @param HiiHandle       The HII handle associated with the BMM formset.\r
+  @param DescriptionData The description of this driver option.\r
+  @param OptionalData    The optional load option.\r
   @param ForceReconnect  EDES_TODO: Add parameter description\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.\r
+  @retval EFI_SUCCESS          If function completes successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -576,7 +602,7 @@ Var_UpdateDriverOption (
     BufferSize += StrSize (OptionalData);\r
   }\r
 \r
-  Buffer = EfiAllocateZeroPool (BufferSize);\r
+  Buffer = AllocateZeroPool (BufferSize);\r
   if (NULL == Buffer) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -607,7 +633,7 @@ Var_UpdateDriverOption (
     StrSize (DescriptionData)\r
     );\r
 \r
-  NewLoadContext->Description = EfiAllocateZeroPool (StrSize (DescriptionData));\r
+  NewLoadContext->Description = AllocateZeroPool (StrSize (DescriptionData));\r
   ASSERT (NewLoadContext->Description != NULL);\r
   NewMenuEntry->DisplayString = NewLoadContext->Description;\r
   CopyMem (\r
@@ -623,7 +649,7 @@ Var_UpdateDriverOption (
     GetDevicePathSize (CallbackData->LoadContext->FilePathList)\r
     );\r
 \r
-  NewLoadContext->FilePathList = EfiAllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));\r
+  NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));\r
   ASSERT (NewLoadContext->FilePathList != NULL);\r
 \r
   CopyMem (\r
@@ -669,7 +695,7 @@ Var_UpdateDriverOption (
                       &gEfiGlobalVariableGuid,\r
                       &DriverOrderListSize\r
                       );\r
-  NewDriverOrderList = EfiAllocateZeroPool (DriverOrderListSize + sizeof (UINT16));\r
+  NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));\r
   ASSERT (NewDriverOrderList != NULL);\r
   CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);\r
   NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;\r
@@ -698,14 +724,19 @@ Var_UpdateDriverOption (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function create a currently loaded Boot Option from \r
+  the BMM. It then appends this Boot Option to the end of \r
+  the "BootOrder" list. It also append this Boot Opotion to the end\r
+  of BootOptionMenu.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
-  @param NvRamMap        EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
+  @param NvRamMap        The file explorer formset internal state.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.\r
+  @retval EFI_SUCCESS          If function completes successfully.\r
 \r
 **/\r
+\r
 EFI_STATUS\r
 Var_UpdateBootOption (\r
   IN  BMM_CALLBACK_DATA                   *CallbackData,\r
@@ -742,7 +773,7 @@ Var_UpdateBootOption (
     BufferSize += StrSize (NvRamMap->OptionalData);\r
   }\r
 \r
-  Buffer = EfiAllocateZeroPool (BufferSize);\r
+  Buffer = AllocateZeroPool (BufferSize);\r
   if (NULL == Buffer) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -773,7 +804,7 @@ Var_UpdateBootOption (
     StrSize (NvRamMap->DescriptionData)\r
     );\r
 \r
-  NewLoadContext->Description = EfiAllocateZeroPool (StrSize (NvRamMap->DescriptionData));\r
+  NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->DescriptionData));\r
   ASSERT (NewLoadContext->Description != NULL);\r
 \r
   NewMenuEntry->DisplayString = NewLoadContext->Description;\r
@@ -790,7 +821,7 @@ Var_UpdateBootOption (
     GetDevicePathSize (CallbackData->LoadContext->FilePathList)\r
     );\r
 \r
-  NewLoadContext->FilePathList = EfiAllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));\r
+  NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));\r
   ASSERT (NewLoadContext->FilePathList != NULL);\r
 \r
   CopyMem (\r
@@ -834,7 +865,7 @@ Var_UpdateBootOption (
                     &BootOrderListSize\r
                     );\r
 \r
-  NewBootOrderList = EfiAllocateZeroPool (BootOrderListSize + sizeof (UINT16));\r
+  NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));\r
   ASSERT (NewBootOrderList != NULL);\r
   CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);\r
   NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;\r
@@ -865,11 +896,16 @@ Var_UpdateBootOption (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function update the "BootNext" EFI Variable. If there is \r
+  no "BootNex" specified in BMM, this EFI Variable is deleted.\r
+  It also update the BMM context data specified the "BootNext"\r
+  vaule.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -887,9 +923,7 @@ Var_UpdateBootNext (
   CurrentFakeNVMap  = &CallbackData->BmmFakeNvData;\r
   for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {\r
     NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);\r
-    if (NULL == NewMenuEntry) {\r
-      return EFI_NOT_FOUND;\r
-    }\r
+    ASSERT (NULL != NewMenuEntry);\r
 \r
     NewLoadContext              = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;\r
     NewLoadContext->IsBootNext  = FALSE;\r
@@ -904,9 +938,7 @@ Var_UpdateBootNext (
                   &BootOptionMenu,\r
                   CurrentFakeNVMap->BootNext\r
                   );\r
-  if (NULL == NewMenuEntry) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
+  ASSERT (NewMenuEntry != NULL);\r
 \r
   NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;\r
   Status = gRT->SetVariable (\r
@@ -922,11 +954,16 @@ Var_UpdateBootNext (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function update the "BootOrder" EFI Variable based on\r
+  BMM Formset's NV map. It then refresh BootOptionMenu\r
+  with the new "BootOrder" list.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @retval EFI_SUCCESS    Not enough memory to complete the function.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -939,7 +976,6 @@ Var_UpdateBootOrder (
   UINT16      *BootOrderList;\r
   UINT16      *NewBootOrderList;\r
   UINTN       BootOrderListSize;\r
-  UINT8       *Map;\r
 \r
   BootOrderList     = NULL;\r
   BootOrderListSize = 0;\r
@@ -953,15 +989,11 @@ Var_UpdateBootOrder (
                     &BootOrderListSize\r
                     );\r
 \r
-  NewBootOrderList = EfiAllocateZeroPool (BootOrderListSize);\r
+  NewBootOrderList = AllocateZeroPool (BootOrderListSize);\r
   if (NewBootOrderList == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  Map = EfiAllocateZeroPool (BootOrderListSize / sizeof (UINT16));\r
-  if (Map == NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
   //\r
   // If exists, delete it to hold new BootOrder\r
   //\r
@@ -982,7 +1014,6 @@ Var_UpdateBootOrder (
                   );\r
   SafeFreePool (BootOrderList);\r
   SafeFreePool (NewBootOrderList);\r
-  SafeFreePool (Map);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -995,11 +1026,16 @@ Var_UpdateBootOrder (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  This function update the "DriverOrder" EFI Variable based on\r
+  BMM Formset's NV map. It then refresh DriverOptionMenu\r
+  with the new "DriverOrder" list.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The BMM context data.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCESS    The function complete successfully.\r
+  @retval EFI_SUCCESS    Not enough memory to complete the function.\r
+  @return                The EFI variable can be saved. See gRT->SetVariable \r
+                         for detail return information.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1025,7 +1061,7 @@ Var_UpdateDriverOrder (
                       &DriverOrderListSize\r
                       );\r
 \r
-  NewDriverOrderList = EfiAllocateZeroPool (DriverOrderListSize);\r
+  NewDriverOrderList = AllocateZeroPool (DriverOrderListSize);\r
 \r
   if (NewDriverOrderList == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -1060,11 +1096,14 @@ Var_UpdateDriverOrder (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the legacy BBS boot option. L"LegacyDevOrder" and EfiLegacyDevOrderGuid EFI Variable\r
+  is udpated with the new Legacy Boot order. The EFI Variable of "Boot####" and gEfiGlobalVariableGuid\r
+  is also updated.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData    The context data for BMM.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @return EFI_SUCCESS    The function completed successfully.\r
+  @retval EFI_NOT_FOUND  If L"LegacyDevOrder" and EfiLegacyDevOrderGuid EFI Variable can be found.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1178,7 +1217,7 @@ Var_UpdateBBSOption (
     return EFI_NOT_FOUND;\r
   }\r
 \r
-  NewOrder = (UINT16 *) EfiAllocateZeroPool (DevOrder->Length - sizeof (UINT16));\r
+  NewOrder = (UINT16 *) AllocateZeroPool (DevOrder->Length - sizeof (UINT16));\r
   if (NULL == NewOrder) {\r
     SafeFreePool (VarData);\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -1262,7 +1301,7 @@ Var_UpdateBBSOption (
     Ptr += sizeof (UINT16);\r
     Ptr += StrSize ((CHAR16 *) Ptr);\r
 \r
-    NewOptionPtr = EfiAllocateZeroPool (NewOptionSize);\r
+    NewOptionPtr = AllocateZeroPool (NewOptionSize);\r
     if (NULL == NewOptionPtr) {\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
@@ -1364,11 +1403,12 @@ Var_UpdateBBSOption (
 }\r
 \r
 /**\r
-  EDES_TODO: Add function description.\r
+  Update the Text Mode of Console.\r
 \r
-  @param CallbackData    EDES_TODO: Add parameter description\r
+  @param CallbackData  The context data for BMM.\r
 \r
-  @return EDES_TODO: Add description for return value\r
+  @retval EFI_SUCCSS If the Text Mode of Console is updated.\r
+  @return Other value if the Text Mode of Console is not updated.\r
 \r
 **/\r
 EFI_STATUS\r