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