X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FLibrary%2FUefiBootManagerLib%2FInternalBm.h;h=8d7215ab04c85eba973f2be59a66a07b3657de71;hp=9baba8689b5738dde7c163a45d1023f648b30a34;hb=54127af53d43c143ee4da734f5472acd085c5b58;hpb=f41c71d26a3ddeaf0f5e1442ab5f5eb87d951892 diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h index 9baba8689b..8d7215ab04 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h @@ -1,7 +1,8 @@ /** @file BDS library definition, include the file and data structure -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -21,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include @@ -37,12 +39,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include #include +#include +#include +#include -#include #include #include #include @@ -90,7 +95,6 @@ typedef enum { BmMessageSataBoot, BmMessageUsbBoot, BmMessageScsiBoot, - BmMessageNetworkBoot, BmMiscBoot } BM_BOOT_TYPE; @@ -100,12 +104,23 @@ CHAR16 * IN EFI_HANDLE Handle ); -#define BM_OPTION_NAME_LEN sizeof ("SysPrep####") +// +// PlatformRecovery#### is the load option with the longest name +// +#define BM_OPTION_NAME_LEN sizeof ("PlatformRecovery####") extern CHAR16 *mBmLoadOptionName[]; +/** + Visitor function to be called by BmForEachVariable for each variable + in variable storage. + + @param Name Variable name. + @param Guid Variable GUID. + @param Context The same context passed to BmForEachVariable. +**/ typedef VOID -(*VARIABLE_VISITOR) ( +(*BM_VARIABLE_VISITOR) ( CHAR16 *Name, EFI_GUID *Guid, VOID *Context @@ -118,8 +133,8 @@ VOID @param Context The context passed to Visitor function. **/ VOID -ForEachVariable ( - VARIABLE_VISITOR Visitor, +BmForEachVariable ( + BM_VARIABLE_VISITOR Visitor, VOID *Context ); @@ -152,28 +167,6 @@ typedef struct { #define BM_HOTKEY_FROM_LINK(a) CR (a, BM_HOTKEY, Link, BM_HOTKEY_SIGNATURE) -/** - Get the image file buffer data and buffer size by its device path. - - @param FilePath On input, a pointer to an allocated buffer containing the device - path of the file. - On output the pointer could be NULL when the function fails to - load the boot option, or could point to an allocated buffer containing - the device path of the file. - It could be updated by either short-form device path expanding, - or default boot file path appending. - Caller is responsible to free it when it's non-NULL. - @param FileSize A pointer to the size of the file buffer. - - @retval NULL File is NULL, or FileSize is NULL. Or, the file can't be found. - @retval other The file buffer. The caller is responsible to free the memory. -**/ -VOID * -BmLoadEfiBootOption ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, - OUT UINTN *FileSize - ); - /** Get the Option Number that wasn't used. @@ -207,35 +200,19 @@ BmWriteBootToOsPerformanceData ( IN VOID *Context ); - -/** - Get the headers (dos, image, optional header) from an image - - @param Device SimpleFileSystem device handle - @param FileName File name for the image - @param DosHeader Pointer to dos header - @param Hdr The buffer in which to return the PE32, PE32+, or TE header. - - @retval EFI_SUCCESS Successfully get the machine type. - @retval EFI_NOT_FOUND The file is not found. - @retval EFI_LOAD_ERROR File is not a valid image file. - -**/ -EFI_STATUS -BmGetImageHeader ( - IN EFI_HANDLE Device, - IN CHAR16 *FileName, - OUT EFI_IMAGE_DOS_HEADER *DosHeader, - OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr - ); - /** This routine adjust the memory information for different memory type and - save them into the variables for next boot. + save them into the variables for next boot. It resets the system when + memory information is updated and the current boot option belongs to + boot category instead of application category. It doesn't count the + reserved memory occupied by RAM Disk. + + @param Boot TRUE if current boot option belongs to boot + category instead of application category. **/ VOID BmSetMemoryTypeInformationVariable ( - VOID + IN BOOLEAN Boot ); /** @@ -332,25 +309,6 @@ BmSetVariableAndReportStatusCodeOnError ( IN VOID *Data ); -/** - Get the load option by its device path. - - @param FilePath The device path pointing to a load option. - It could be a short-form device path. - @param FullPath Return the full device path of the load option after - short-form device path expanding. - Caller is responsible to free it. - @param FileSize Return the load option size. - - @return The load option buffer. Caller is responsible to free the memory. -**/ -VOID * -BmGetLoadOptionBuffer ( - IN EFI_DEVICE_PATH_PROTOCOL *FilePath, - OUT EFI_DEVICE_PATH_PROTOCOL **FullPath, - OUT UINTN *FileSize - ); - /** Return whether the PE header of the load option is valid or not. @@ -406,27 +364,6 @@ BmDelPartMatchInstance ( IN EFI_DEVICE_PATH_PROTOCOL *Single ); - -/** - Return the index of the load option in the load option array. - - The function consider two load options are equal when the - OptionType, Attributes, Description, FilePath and OptionalData are equal. - - @param Key Pointer to the load option to be found. - @param Array Pointer to the array of load options to be found. - @param Count Number of entries in the Array. - - @retval -1 Key wasn't found in the Array. - @retval 0 ~ Count-1 The index of the Key in the Array. -**/ -INTN -BmFindLoadOption ( - IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key, - IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array, - IN UINTN Count - ); - /** Repair all the controllers according to the Driver Health status queried. **/ @@ -445,4 +382,59 @@ BmPrintDp ( EFI_DEVICE_PATH_PROTOCOL *DevicePath ); +/** + Convert a single character to number. + It assumes the input Char is in the scope of L'0' ~ L'9' and L'A' ~ L'F' + + @param Char The input char which need to convert to int. + + @return The converted 8-bit number or (UINTN) -1 if conversion failed. +**/ +UINTN +BmCharToUint ( + IN CHAR16 Char + ); + +/** + Return the boot description for the controller. + + @param Handle Controller handle. + + @return The description string. +**/ +CHAR16 * +BmGetBootDescription ( + IN EFI_HANDLE Handle + ); + +/** + Enumerate all boot option descriptions and append " 2"/" 3"/... to make + unique description. + + @param BootOptions Array of boot options. + @param BootOptionCount Count of boot options. +**/ +VOID +BmMakeBootOptionDescriptionUnique ( + EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions, + UINTN BootOptionCount + ); + +/** + Get the file buffer from the specified Load File instance. + + @param LoadFileHandle The specified Load File instance. + @param FilePath The file path which will pass to LoadFile(). + @param FullPath Return the full device path pointing to the load option. + @param FileSize Return the size of the load option. + + @return The load option buffer or NULL if fails. +**/ +VOID * +BmGetFileBufferFromLoadFile ( + EFI_HANDLE LoadFileHandle, + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + OUT EFI_DEVICE_PATH_PROTOCOL **FullPath, + OUT UINTN *FileSize + ); #endif // _INTERNAL_BM_H_