]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
Clean up to update the reference of the these macros:
[mirror_edk2.git] / MdeModulePkg / Universal / BdsDxe / BootMaint / BootMaint.h
index 4cc177d60606202d05d02f6df35ac5334824f35e..03b61afdb97a0b8c691b4c0e31df6d7faa1c7e55 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
+/** @file\r
+  Header file for boot maintenance module.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation\r
+Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -9,18 +10,10 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
+**/\r
 \r
-  BootMaint.h\r
-\r
-Abstract:\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-#ifndef _BOOT_MAINT_H\r
-#define _BOOT_MAINT_H\r
+#ifndef _BOOT_MAINT_H_\r
+#define _BOOT_MAINT_H_\r
 \r
 #include "Bds.h"\r
 #include "BBSsupport.h"\r
@@ -30,9 +23,9 @@ Revision History
 //\r
 // Constants which are variable names used to access variables\r
 //\r
-#define VarLegacyDevOrder L"LegacyDevOrder"\r
+#define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"\r
 \r
-#define VarConOutMode L"ConOutMode"\r
+#define VAR_CON_OUT_MODE L"ConOutMode"\r
 \r
 //\r
 // Guid of a NV Variable which store the information about the\r
@@ -46,16 +39,16 @@ Revision History
 //\r
 // String Contant\r
 //\r
-#define StrFloppy       L"Floppy Drive #%02x"\r
-#define StrHardDisk     L"HardDisk Drive #%02x"\r
-#define StrCDROM        L"ATAPI CDROM Drive #%02x"\r
-#define StrNET          L"NET Drive #%02x"\r
-#define StrBEV          L"BEV Drive #%02x"\r
-#define StrFloppyHelp   L"Select Floppy Drive #%02x"\r
-#define StrHardDiskHelp L"Select HardDisk Drive #%02x"\r
-#define StrCDROMHelp    L"Select ATAPI CDROM Drive #%02x"\r
-#define StrNETHelp      L"NET Drive #%02x"\r
-#define StrBEVHelp      L"BEV Drive #%02x"\r
+#define STR_FLOPPY       L"Floppy Drive #%02x"\r
+#define STR_HARDDISK     L"HardDisk Drive #%02x"\r
+#define STR_CDROM        L"ATAPI CDROM Drive #%02x"\r
+#define STR_NET          L"NET Drive #%02x"\r
+#define STR_BEV          L"BEV Drive #%02x"\r
+#define STR_FLOPPY_HELP   L"Select Floppy Drive #%02x"\r
+#define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"\r
+#define STR_CDROM_HELP    L"Select ATAPI CDROM Drive #%02x"\r
+#define STR_NET_HELP      L"NET Drive #%02x"\r
+#define STR_BEV_HELP      L"BEV Drive #%02x"\r
 \r
 //\r
 // Variable created with this flag will be "Efi:...."\r
@@ -68,22 +61,6 @@ Revision History
 #define MAX_CHAR      480\r
 #define MAX_CHAR_SIZE (MAX_CHAR * 2)\r
 \r
-//\r
-// Check to see if current build support option active feature of\r
-// some driver option\r
-//\r
-#ifndef LOAD_OPTION_ACTIVE\r
-#define LOAD_OPTION_ACTIVE  0x00000001\r
-#endif\r
-\r
-//\r
-// Check to see if current build support force reconnect feature of\r
-// some driver option\r
-//\r
-#ifndef LOAD_OPTION_FORCE_RECONNECT\r
-#define LOAD_OPTION_FORCE_RECONNECT 0x00000002\r
-#endif\r
-\r
 extern EFI_GUID mBootMaintGuid;\r
 extern EFI_GUID mFileExplorerGuid;\r
 \r
@@ -105,7 +82,7 @@ extern UINT8    FEBin[];
 //\r
 // Callback function helper\r
 //\r
-#define BMM_CALLBACK_DATA_SIGNATURE     EFI_SIGNATURE_32 ('C', 'b', 'c', 'k')\r
+#define BMM_CALLBACK_DATA_SIGNATURE     SIGNATURE_32 ('C', 'b', 'c', 'k')\r
 #define BMM_CALLBACK_DATA_FROM_THIS(a)  CR (a, BMM_CALLBACK_DATA, BmmConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)\r
 \r
 #define FE_CALLBACK_DATA_FROM_THIS(a)   CR (a, BMM_CALLBACK_DATA, FeConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)\r
@@ -167,13 +144,13 @@ typedef enum {
 //\r
 // All of the signatures that will be used in list structure\r
 //\r
-#define BM_MENU_OPTION_SIGNATURE      EFI_SIGNATURE_32 ('m', 'e', 'n', 'u')\r
-#define BM_LOAD_OPTION_SIGNATURE      EFI_SIGNATURE_32 ('l', 'o', 'a', 'd')\r
-#define BM_CONSOLE_OPTION_SIGNATURE   EFI_SIGNATURE_32 ('c', 'n', 's', 'l')\r
-#define BM_FILE_OPTION_SIGNATURE      EFI_SIGNATURE_32 ('f', 'i', 'l', 'e')\r
-#define BM_HANDLE_OPTION_SIGNATURE    EFI_SIGNATURE_32 ('h', 'n', 'd', 'l')\r
-#define BM_TERMINAL_OPTION_SIGNATURE  EFI_SIGNATURE_32 ('t', 'r', 'm', 'l')\r
-#define BM_MENU_ENTRY_SIGNATURE       EFI_SIGNATURE_32 ('e', 'n', 't', 'r')\r
+#define BM_MENU_OPTION_SIGNATURE      SIGNATURE_32 ('m', 'e', 'n', 'u')\r
+#define BM_LOAD_OPTION_SIGNATURE      SIGNATURE_32 ('l', 'o', 'a', 'd')\r
+#define BM_CONSOLE_OPTION_SIGNATURE   SIGNATURE_32 ('c', 'n', 's', 'l')\r
+#define BM_FILE_OPTION_SIGNATURE      SIGNATURE_32 ('f', 'i', 'l', 'e')\r
+#define BM_HANDLE_OPTION_SIGNATURE    SIGNATURE_32 ('h', 'n', 'd', 'l')\r
+#define BM_TERMINAL_OPTION_SIGNATURE  SIGNATURE_32 ('t', 'r', 'm', 'l')\r
+#define BM_MENU_ENTRY_SIGNATURE       SIGNATURE_32 ('e', 'n', 't', 'r')\r
 \r
 #define BM_LOAD_CONTEXT_SELECT        0x0\r
 #define BM_CONSOLE_CONTEXT_SELECT     0x1\r
@@ -301,13 +278,11 @@ typedef enum {
 \r
 #define STRING_DEPOSITORY_NUMBER        8\r
 \r
-//\r
-// #pragma pack(1)\r
-//\r
-// Serial Ports attributes, first one is the value for\r
-// return from callback function, stringtoken is used to\r
-// display the value properly\r
-//\r
+///\r
+/// Serial Ports attributes, first one is the value for\r
+/// return from callback function, stringtoken is used to\r
+/// display the value properly\r
+///\r
 typedef struct {\r
   UINTN   Value;\r
   UINT16  StringToken;\r
@@ -391,7 +366,7 @@ typedef struct {
   EFI_DEVICE_PATH_PROTOCOL          *DevicePath;\r
   EFI_FILE_HANDLE                   FHandle;\r
   UINT16                            *FileName;\r
-  EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Info;\r
+  EFI_FILE_SYSTEM_VOLUME_LABEL      *Info;\r
 \r
   BOOLEAN                           IsRoot;\r
   BOOLEAN                           IsDir;\r
@@ -476,175 +451,294 @@ typedef struct _STRING_DEPOSITORY {
 //\r
 // For initializing File System menu\r
 //\r
+\r
+/**\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
+  @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
 BOpt_FindFileSystem (\r
   IN BMM_CALLBACK_DATA          *CallbackData\r
-  )\r
-;\r
+  );\r
 \r
-//\r
-// For cleaning up File System menu\r
-//\r
-VOID\r
-BOpt_FreeFileSystem (\r
-  VOID\r
-  )\r
-;\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
-//\r
-// For initializing File Navigation menu\r
-//\r
+  @param CallbackData  The BMM context data.\r
+  @param MenuEntry     The Menu Entry.\r
+\r
+  @retval EFI_SUCCESS         Get files from current dir successfully.\r
+  @return Other value if can't get files from current dir.\r
+\r
+**/\r
 EFI_STATUS\r
 BOpt_FindFiles (\r
   IN BMM_CALLBACK_DATA          *CallbackData,\r
   IN BM_MENU_ENTRY              *MenuEntry\r
-  )\r
-;\r
+  );\r
 \r
-//\r
-// For cleaning up File Navigation menu\r
-//\r
-VOID\r
-BOpt_FreeFiles (\r
-  VOID\r
-  )\r
-;\r
+/**\r
 \r
-//\r
-// For Initializing handle navigation menu\r
-//\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
+  @retval EFI_SUCCESS The function complets successfully.\r
+  @return Other value if failed to build the DriverMenu.\r
+\r
+**/\r
 EFI_STATUS\r
 BOpt_FindDrivers (\r
   VOID\r
-  )\r
-;\r
+  );\r
 \r
-//\r
-// For Cleaning up handle navigation menu\r
-//\r
-VOID\r
-BOpt_FreeDrivers(VOID);\r
+/**\r
 \r
-//\r
-// For initializing Boot Option menu\r
-//\r
+  Build the BootOptionMenu according to BootOrder Variable.\r
+  This Routine will access the Boot#### to get EFI_LOAD_OPTION.\r
+\r
+  @param CallbackData The BMM context data.\r
+\r
+  @return The number of the Var Boot####.\r
+\r
+**/\r
 EFI_STATUS\r
 BOpt_GetBootOptions (\r
   IN  BMM_CALLBACK_DATA         *CallbackData\r
   );\r
 \r
-//\r
-// For Initializing Driver option menu\r
-//\r
+/**\r
+\r
+  Build up all DriverOptionMenu\r
+\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
 BOpt_GetDriverOptions (\r
   IN  BMM_CALLBACK_DATA         *CallbackData\r
   );\r
 \r
-//\r
-// For Cleaning up boot option menu\r
-//\r
-VOID\r
-BOpt_FreeBootOptions (VOID);\r
 \r
-//\r
-// For cleaning up driver option menu\r
-//\r
-VOID\r
-BOpt_FreeDriverOptions(VOID);\r
+/**\r
+  Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().\r
 \r
-//\r
-// For Initializing HD/FD/CD/NET/BEV option menu\r
-//\r
+  \r
+\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
+  Free out resouce allocated from Legacy Boot Options.\r
+\r
+  .\r
+\r
+  .\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
+  Free resources allocated in Allocate Rountine.\r
+\r
+  @param FreeMenu        Menu to be freed\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 BOpt_FreeMenu (\r
   BM_MENU_OPTION        *FreeMenu\r
   );\r
 \r
 \r
-//\r
-// Following are the helper functions used\r
-//\r
+/**\r
+\r
+  Append file name to existing file name.\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
+\r
+  Check whether current FileName point to a valid\r
+  Efi Image File.\r
+\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
 BOpt_IsEfiImageName (\r
   IN UINT16  *FileName\r
   );\r
 \r
+/**\r
+\r
+  Check whether current FileName point to a valid Efi Application\r
+\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
 BOpt_IsEfiApp (\r
   IN EFI_FILE_HANDLE Dir,\r
   IN UINT16          *FileName\r
   );\r
 \r
-//\r
-// Get current unused boot option number\r
-//\r
+/**\r
+\r
+  Get the Option Number that has not been allocated for use.\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
+\r
+  Get the Option Number that is not in use.\r
+\r
+  @return The unused Option Number.\r
+\r
+**/\r
 UINT16\r
-BOpt_GetDriverOptionNumber (VOID);\r
+BOpt_GetDriverOptionNumber (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Create a menu entry give a Menu type.\r
+\r
+  @param MenuType        The Menu type to be created.\r
+\r
+\r
+  @retval NULL           If failed to create the menu.\r
+  @return                The menu.\r
 \r
+**/\r
 BM_MENU_ENTRY                     *\r
 BOpt_CreateMenuEntry (\r
   UINTN           MenuType\r
   );\r
 \r
+/**\r
+  Free up all resource allocated for a BM_MENU_ENTRY.\r
+\r
+  @param MenuEntry   A pointer to BM_MENU_ENTRY.\r
+\r
+**/\r
 VOID\r
 BOpt_DestroyMenuEntry (\r
   BM_MENU_ENTRY         *MenuEntry\r
   );\r
 \r
+/**\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      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
 BOpt_GetMenuEntry (\r
   BM_MENU_OPTION      *MenuOption,\r
   UINTN               MenuNumber\r
   );\r
 \r
-//\r
-// a helper function used to free pool type memory\r
-//\r
-VOID\r
-SafeFreePool (\r
-  IN VOID *Buffer\r
-  );\r
-\r
 //\r
 // Locate all serial io devices for console\r
 //\r
+/**\r
+  Build a list containing all serial devices.\r
+\r
+\r
+  @retval EFI_SUCCESS The function complete successfully.\r
+  @retval EFI_UNSUPPORTED No serial ports present.\r
+\r
+**/\r
 EFI_STATUS\r
-LocateSerialIo (VOID);\r
+LocateSerialIo (\r
+  VOID\r
+  );\r
 \r
 //\r
 // Initializing Console menu\r
 //\r
+/**\r
+  Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu\r
+\r
+\r
+  \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
+  Get mode number according to column and row\r
+\r
+\r
+  @param CallbackData    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 GetConsoleOutMode (\r
   IN  BMM_CALLBACK_DATA    *CallbackData\r
@@ -653,34 +747,126 @@ GetConsoleOutMode (
 //\r
 // Cleaning up console menu\r
 //\r
+/**\r
+  Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu\r
+\r
+\r
+              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
+  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\r
 \r
+  \r
+\r
+**/\r
 VOID\r
 ChangeVariableDevicePath (\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath\r
-);\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath\r
+  );\r
+\r
+/**\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      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 EFI_SUCCESS    The function completes successfully.\r
+\r
+**/\r
 EFI_STATUS\r
 ChangeTerminalDevicePath (\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
-  BOOLEAN                   ChangeTerminal\r
-);\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
+  IN BOOLEAN                   ChangeTerminal\r
+  );\r
 //\r
 // Variable operation by menu selection\r
 //\r
+/**\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    The BMM context data.\r
+  @param NvRamMap        The file explorer formset internal state.\r
+\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
 Var_UpdateBootOption (\r
   IN  BMM_CALLBACK_DATA                   *CallbackData,\r
   IN  FILE_EXPLORER_NV_DATA               *NvRamMap\r
   );\r
 \r
+/**\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
+              EDES_TODO: Add parameter description\r
+\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
+  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
+\r
+  \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
+  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
+  @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
 Var_UpdateDriverOption (\r
   IN  BMM_CALLBACK_DATA         *CallbackData,\r
@@ -690,44 +876,186 @@ Var_UpdateDriverOption (
   IN  UINT8                     ForceReconnect\r
   );\r
 \r
+/**\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
+\r
+  \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
+  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
+\r
+  \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
+  This function delete and build multi-instance device path ConIn\r
+  console device.\r
+\r
+\r
+  \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
+  This function delete and build multi-instance device path ConOut\r
+  console device.\r
 \r
+\r
+  \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
+  This function delete and build multi-instance device path ErrOut\r
+  console device.\r
+\r
 \r
+  \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
+  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
+  \r
 \r
+  \r
+\r
+**/\r
 VOID\r
-Var_UpdateAllConsoleOption (VOID);\r
+Var_UpdateAllConsoleOption (\r
+  VOID\r
+  );\r
 \r
+/**\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    The BMM context data.\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
 Var_UpdateBootNext (\r
   IN BMM_CALLBACK_DATA            *CallbackData\r
   );\r
 \r
+/**\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    The BMM context data.\r
+\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
 Var_UpdateBootOrder (\r
   IN BMM_CALLBACK_DATA            *CallbackData\r
   );\r
 \r
+/**\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    The BMM context data.\r
+\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
 Var_UpdateDriverOrder (\r
   IN BMM_CALLBACK_DATA            *CallbackData\r
   );\r
 \r
+/**\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    The context data for BMM.\r
+\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
 Var_UpdateBBSOption (\r
   IN BMM_CALLBACK_DATA            *CallbackData\r
   );\r
 \r
+/**\r
+  Update the Text Mode of Console.\r
+\r
+  @param CallbackData  The context data for BMM.\r
+\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
 Var_UpdateConMode (\r
   IN BMM_CALLBACK_DATA            *CallbackData\r
@@ -736,187 +1064,288 @@ Var_UpdateConMode (
 //\r
 // Following are page create and refresh functions\r
 //\r
+/**\r
+  Refresh the global UpdateData structure.\r
+\r
+  \r
+\r
+  \r
+\r
+**/\r
 VOID\r
 RefreshUpdateData (\r
   VOID\r
   );\r
 \r
+/**\r
+  Clean up the dynamic opcode at label and form specified by\r
+  both LabelId. \r
+\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
+  \r
+\r
+**/\r
 VOID\r
 CleanUpPage (\r
   IN UINT16                           LabelId,\r
   IN BMM_CALLBACK_DATA                *CallbackData\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
+  Create a lit of boot option from global BootOptionMenu. It\r
+  allow user to delete the boot option.\r
 \r
-VOID\r
-UpdateBootAddPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+  @param CallbackData    The BMM context data.\r
 \r
+  \r
+\r
+**/\r
 VOID\r
 UpdateBootDelPage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
-VOID\r
-UpdateDrvAddFilePage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+/**\r
+  Create a lit of driver option from global DriverMenu.\r
+\r
+  @param CallbackData    The BMM context data.\r
+\r
+  \r
 \r
+**/\r
 VOID\r
 UpdateDrvAddHandlePage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
+/**\r
+  Create a lit of driver option from global DriverOptionMenu. It\r
+  allow user to delete the driver option.\r
+\r
+\r
+  @param CallbackData    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 UpdateDrvDelPage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
-VOID\r
-UpdateDriverAddHandleDescPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+/**\r
+  Prepare the page to allow user to add description for \r
+  a Driver Option.\r
 \r
-VOID\r
-UpdateBootTimeOut (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+  @param CallbackData    The BMM context data.\r
 \r
-VOID\r
-UpdateConInPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+  \r
 \r
+**/\r
 VOID\r
-UpdateConOutPage (\r
+UpdateDriverAddHandleDescPage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
-VOID\r
-UpdateStdErrPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+/**\r
+  Dispatch the correct update page function to call based on\r
+  the UpdatePageId.\r
 \r
+  @param UpdatePageId    The form ID.\r
+  @param CallbackData    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 UpdatePageBody (\r
   IN UINT16                           UpdatePageId,\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
-VOID\r
-UpdateCOM1Page (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
-\r
-VOID\r
-UpdateCOM2Page (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+/**\r
+  Create the dynamic page to allow user to set\r
+  the "BootNext" vaule.\r
 \r
-VOID\r
-UpdateBootOrderPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+  @param CallbackData    The BMM context data.\r
 \r
-VOID\r
-UpdateDriverOrderPage (\r
-  IN BMM_CALLBACK_DATA                *CallbackData\r
-  );\r
+  \r
 \r
+**/\r
 VOID\r
 UpdateBootNextPage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
+/**\r
+  Create the dynamic page to allow user to set\r
+  the "TimeOut" vaule.\r
+\r
+  @param CallbackData    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 UpdateTimeOutPage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
+/**\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    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 UpdateTerminalPage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
+/**\r
+  Refresh the text mode page\r
+\r
+\r
+  @param CallbackData    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 UpdateConModePage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
+/**\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    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 UpdateConCOMPage (\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
   );\r
 \r
+/**\r
+  Create a dynamic page so that Legacy Device boot order\r
+  can be set for specified device type.\r
+\r
+  @param UpdatePageId    The form ID. It also spefies the legacy device type.\r
+  @param CallbackData    The BMM context data.\r
+\r
+  \r
+\r
+**/\r
 VOID\r
 UpdateSetLegacyDeviceOrderPage (\r
   IN UINT16                           UpdatePageId,\r
   IN BMM_CALLBACK_DATA                *CallbackData\r
-);\r
+  );\r
 \r
-EFI_STATUS\r
-BootLegacy (\r
-  IN  UINT16  BbsType,\r
-  IN  UINT16  BbsFlag\r
-);\r
 \r
-BM_MENU_ENTRY                     *\r
-GetCurrentTerminal (\r
-  UINTN       TerminalNumber\r
-);\r
+/**\r
+\r
+  Function opens and returns a file handle to the root directory of a volume.\r
+\r
 \r
+  @param DeviceHandle    - A handle for a device\r
+\r
+  @return A valid file handle or NULL is returned\r
+\r
+**/\r
 EFI_FILE_HANDLE\r
 EfiLibOpenRoot (\r
   IN EFI_HANDLE       DeviceHandle\r
   );\r
 \r
-EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *\r
+/**\r
+\r
+  Function gets the file system information from an open file descriptor,\r
+  and stores it in a buffer allocated from pool.\r
+\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 *\r
 EfiLibFileSystemVolumeLabelInfo (\r
   IN EFI_FILE_HANDLE      FHand\r
   );\r
 \r
+/**\r
+\r
+  Function gets the file information from an open file descriptor, and stores it\r
+  in a buffer allocated from pool.\r
+\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
 EfiLibFileInfo (\r
   IN EFI_FILE_HANDLE      FHand\r
   );\r
 \r
-UINTN\r
-UnicodeToAscii (\r
-  IN  CHAR16  *UStr,\r
-  IN  UINTN   Length,\r
-  OUT CHAR8   *AStr\r
-  );\r
+/**\r
+  This function converts an input device structure to a Unicode string.\r
+\r
+  @param DevPath                  A pointer to the device path structure.\r
+\r
+  @return A new allocated Unicode string that represents the device path.\r
 \r
+**/\r
 CHAR16                            *\r
 DevicePathToStr (\r
   EFI_DEVICE_PATH_PROTOCOL     *DevPath\r
   );\r
 \r
-VOID                              *\r
-EfiAllocateZeroPool (\r
-  IN UINTN            Size\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
+                         that matches ProtocolGuid\r
+\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
 EfiLibLocateProtocol (\r
   IN  EFI_GUID        *ProtocolGuid,\r
   OUT VOID            **Interface\r
   );\r
 \r
+/**\r
+  Adjusts the size of a previously allocated buffer.\r
+\r
+\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
 EfiReallocatePool (\r
   IN VOID                 *OldPool,\r
@@ -924,11 +1353,19 @@ EfiReallocatePool (
   IN UINTN                NewSize\r
   );\r
 \r
-CHAR16                            *\r
-DevicePathToStr (\r
-  EFI_DEVICE_PATH_PROTOCOL     *DevPath\r
-  );\r
+/**\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  Name                  String part of EFI variable name\r
+  @param  VendorGuid            GUID part of EFI variable name\r
+  @param  VarSize          Returns the size of the EFI variable that was read\r
 \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
 BdsLibGetVariableAndSize (\r
   IN CHAR16               *Name,\r
@@ -936,28 +1373,69 @@ BdsLibGetVariableAndSize (
   OUT UINTN               *VarSize\r
   );\r
 \r
+/**\r
+  Function deletes the variable specified by VarName and VarGuid.\r
+\r
+\r
+  @param VarName         - A Null-terminated Unicode string that is\r
+                         the name of the vendor's variable.\r
+                         \r
+  @param VarGuid           - 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
 EfiLibDeleteVariable (\r
   IN CHAR16   *VarName,\r
   IN EFI_GUID *VarGuid\r
   );\r
 \r
+/**\r
+  Duplicate a string.\r
+\r
+  @param Src             The source.\r
+\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
 EfiStrDuplicate (\r
   IN CHAR16   *Src\r
   );\r
 \r
-BOOLEAN\r
-EfiLibMatchDevicePaths (\r
-  IN  EFI_DEVICE_PATH_PROTOCOL *Multi,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL *Single\r
-  );\r
+/**\r
+  Function is used to determine the number of device path instances\r
+  that exist in a device path.\r
+\r
+\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
+\r
+**/\r
 UINTN\r
 EfiDevicePathInstanceCount (\r
   IN EFI_DEVICE_PATH_PROTOCOL      *DevicePath\r
   );\r
 \r
+/**\r
+  Create string tokens for a menu from its help strings and display strings\r
+\r
+\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
 CreateMenuStringToken (\r
   IN BMM_CALLBACK_DATA                *CallbackData,\r
@@ -965,47 +1443,122 @@ CreateMenuStringToken (
   IN BM_MENU_OPTION                   *MenuOption\r
   );\r
 \r
+/**\r
+  Get a string from the Data Hub record based on \r
+  a device path.\r
+\r
+  @param DevPath         The device Path.\r
+\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
 EfiLibStrFromDatahub (\r
   IN EFI_DEVICE_PATH_PROTOCOL                 *DevPath\r
   );\r
 \r
+/**\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      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
+  \r
+\r
+**/\r
 VOID                              *\r
 GetLegacyBootOptionVar (\r
   IN  UINTN                            DeviceType,\r
   OUT UINTN                            *OptionIndex,\r
   OUT UINTN                            *OptionSize\r
- );\r
 );\r
 \r
+/**\r
+  Initialize the Boot Maintenance Utitliy.\r
+\r
+  @retval  EFI_SUCCESS      utility ended successfully.\r
+  @retval  others           contain some errors.\r
+\r
+**/\r
 EFI_STATUS\r
 InitializeBM (\r
   VOID\r
   );\r
 \r
+/**\r
+  Start boot maintenance manager\r
+\r
+\r
+  \r
+\r
+  @retval EFI_SUCCESS If BMM is invoked successfully.\r
+  @return Other value if BMM return unsuccessfully.\r
+\r
+**/\r
 EFI_STATUS\r
 BdsStartBootMaint (\r
   VOID\r
   );\r
 \r
+/**\r
+  Intialize all the string depositories.\r
+\r
+**/\r
 VOID\r
-InitializeStringDepository (VOID);\r
+InitializeStringDepository (\r
+  VOID\r
+  );\r
 \r
+/**\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 - Pointer of the string depository.\r
+\r
+  @retval  EFI_STRING_ID           String token.\r
+\r
+**/\r
 EFI_STRING_ID\r
 GetStringTokenFromDepository (\r
   IN   BMM_CALLBACK_DATA     *CallbackData,\r
   IN   STRING_DEPOSITORY     *StringDepository\r
   );\r
 \r
+/**\r
+  Reclaim string depositories by moving the current node pointer to list head..\r
+**/\r
 VOID\r
 ReclaimStringDepository (\r
   VOID\r
   );\r
 \r
+/**\r
+  Release resource for all the string depositories.\r
+\r
+**/\r
 VOID\r
 CleanUpStringDepository (\r
   VOID\r
   );\r
 \r
+/**\r
+  Function handling request to apply changes for BMM pages.\r
+\r
+\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
 ApplyChangeHandler (\r
   IN  BMM_CALLBACK_DATA               *Private,\r
@@ -1013,29 +1566,92 @@ ApplyChangeHandler (
   IN  EFI_FORM_ID                     FormId\r
   );\r
 \r
+/**\r
+  Discard all changes done to the BMM pages such as Boot Order change,\r
+  Driver order change.\r
+\r
+  @param Private         The BMM context data.\r
+  @param CurrentFakeNVMap The current Fack NV Map.\r
+\r
+**/\r
 VOID\r
 DiscardChangeHandler (\r
   IN  BMM_CALLBACK_DATA               *Private,\r
   IN  BMM_FAKE_NV_DATA                *CurrentFakeNVMap\r
   );\r
 \r
+/**\r
+  Dispatch the display to the next page based on NewPageId.\r
+\r
+  @param Private         The BMM context data.\r
+  @param NewPageId       The original page ID.\r
+\r
+**/\r
 VOID\r
 UpdatePageId (\r
   BMM_CALLBACK_DATA              *Private,\r
   UINT16                         NewPageId\r
   );\r
 \r
+/**\r
+  Boot a file selected by user at File Expoloer of BMM.\r
+\r
+  @param FileContext     The file context data, which contains the device path\r
+                         of the file to be boot from.\r
+\r
+  @retval EFI_SUCCESS    The function completed successfull.\r
+  @return                 Other value if the boot from the file fails.\r
+\r
+**/\r
 EFI_STATUS\r
 BootThisFile (\r
   IN BM_FILE_CONTEXT                   *FileContext\r
   );\r
 \r
+/**\r
+  Update the file explower page with the refershed file system.\r
+\r
+\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
 UpdateFileExplorer (\r
   IN BMM_CALLBACK_DATA            *CallbackData,\r
   IN UINT16                       KeyValue\r
   );\r
 \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
+  @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
 EFIAPI\r
 FileExplorerCallback (\r
@@ -1047,11 +1663,39 @@ FileExplorerCallback (
   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
   );\r
 \r
+/**\r
+  Dispatch BMM formset and FileExplorer formset.\r
+\r
+\r
+  @param CallbackData    The BMM context data.\r
+\r
+  @retval EFI_SUCCESS If function complete successfully.\r
+  @return Other value if the Setup Browser process BMM's pages and\r
+           return unsuccessfully.\r
+\r
+**/\r
 EFI_STATUS\r
 FormSetDispatcher (\r
   IN  BMM_CALLBACK_DATA    *CallbackData\r
   );\r
 \r
+/**\r
+  Function returns the value of the specified variable.\r
+\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
+EfiLibGetVariable (\r
+  IN CHAR16               *Name,\r
+  IN EFI_GUID             *VendorGuid\r
+  );\r
+\r
 //\r
 // Global variable in this program (defined in data.c)\r
 //\r
@@ -1074,7 +1718,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