X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FLibrary%2FUefiBootManagerLib%2FInternalBm.h;h=8d7215ab04c85eba973f2be59a66a07b3657de71;hp=290ce3fc548149f5979d1fed1bfeb7530a47fdcc;hb=54127af53d43c143ee4da734f5472acd085c5b58;hpb=d95ff8e8d86b36482b815141233f6c315b43c203 diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h index 290ce3fc54..8d7215ab04 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h @@ -1,7 +1,7 @@ /** @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 @@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include @@ -38,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 @@ -91,8 +95,6 @@ typedef enum { BmMessageSataBoot, BmMessageUsbBoot, BmMessageScsiBoot, - BmMessageNetworkBoot, - BmMessageHttpBoot, BmMiscBoot } BM_BOOT_TYPE; @@ -102,7 +104,10 @@ 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[]; /** @@ -162,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. @@ -217,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 ); /** @@ -342,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. @@ -434,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_