X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelFrameworkModulePkg%2FInclude%2FLibrary%2FGenericBdsLib.h;h=db302c986a7f002e555508d18f26a47c791734c0;hp=7d1077d713d9094beb29297cb56a2b8510c1d148;hb=0977c9b214465b0d45cd6cae10524fe5d8ef2f55;hpb=8c81cb83b96c81a9891e36d16cc13e789c6f8901 diff --git a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h index 7d1077d713..db302c986a 100644 --- a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h +++ b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h @@ -1,7 +1,10 @@ /** @file - Generic BDS library definition, include the data structure and function. + Generic BDS library defines general interfaces for BDS driver including: + 1) BDS boot policy interface; + 2) BDS boot device connect interface; + 3) BDS Misc interfaces for mainting boot variable, ouput string. -Copyright (c) 2004 - 2008, Intel Corporation.
+Copyright (c) 2004 - 2009, Intel Corporation.
All rights reserved. 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 @@ -15,10 +18,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #ifndef _GENERIC_BDS_LIB_H_ #define _GENERIC_BDS_LIB_H_ -#include -#include - - extern EFI_HANDLE mBdsImageHandle; // @@ -142,9 +141,41 @@ BdsLibBootViaBootOption ( /** - This function will enumerate all possible boot device in the system, - it will only excute once of every boot. - + For EFI boot option, BDS separate them as six types: + 1. Network - The boot option points to the SimpleNetworkProtocol device. + Bds will try to automatically create this type boot option when enumerate. + 2. Shell - The boot option points to internal flash shell. + Bds will try to automatically create this type boot option when enumerate. + 3. Removable BlockIo - The boot option only points to the removable media + device, like USB flash disk, DVD, Floppy etc. + These device should contain a *removable* blockIo + protocol in their device handle. + Bds will try to automatically create this type boot option + when enumerate. + 4. Fixed BlockIo - The boot option only points to a Fixed blockIo device, + like HardDisk. + These device should contain a *fixed* blockIo + protocol in their device handle. + BDS will skip fixed blockIo devices, and NOT + automatically create boot option for them. But BDS + will help to delete those fixed blockIo boot option, + whose description rule conflict with other auto-created + boot options. + 5. Non-BlockIo Simplefile - The boot option points to a device whose handle + has SimpleFileSystem Protocol, but has no blockio + protocol. These devices do not offer blockIo + protocol, but BDS still can get the + \EFI\BOOT\boot{machinename}.EFI by SimpleFileSystem + Protocol. + 6. File - The boot option points to a file. These boot options are usually + created by user manually or OS loader. BDS will not delete or modify + these boot options. + + This function will enumerate all possible boot device in the system, and + automatically create boot options for Network, Shell, Removable BlockIo, + and Non-BlockIo Simplefile devices. + It will only excute once of every boot. + @param BdsBootOptionList The header of the link list which indexed all current boot options @@ -384,12 +415,14 @@ BdsLibConnectDevicePath ( ); /** - This function will connect all current system handles recursively. The - connection will finish until every handle's child handle created if it have. + This function will connect all current system handles recursively. + + gBS->ConnectController() service is invoked for each handle exist in system handler buffer. + If the handle is bus type handler, all childrens also will be connected recursively + by gBS->ConnectController(). - @retval EFI_SUCCESS All handles and it's child handle have been - connected - @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer(). + @retval EFI_SUCCESS All handles and it's child handle have been connected + @retval EFI_STATUS Error status returned by of gBS->LocateHandleBuffer(). **/ EFI_STATUS @@ -398,13 +431,15 @@ BdsLibConnectAllEfi ( VOID ); - /** - This function will disconnect all current system handles. The disconnection - will finish until every handle have been disconnected. + This function will disconnect all current system handles. + + gBS->DisconnectController() is invoked for each handle exists in system handle buffer. + If handle is a bus type handle, all childrens also are disconnected recursively by + gBS->DisconnectController(). @retval EFI_SUCCESS All handles have been disconnected - @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer(). + @retval EFI_STATUS Error status returned by of gBS->LocateHandleBuffer(). **/ EFI_STATUS @@ -552,9 +587,9 @@ DevicePathToStr ( // Internal definitions // typedef struct { - CHAR16 *str; - UINTN len; - UINTN maxlen; + CHAR16 *Str; + UINTN Len; + UINTN Maxlen; } POOL_PRINT; typedef struct { @@ -580,7 +615,7 @@ typedef struct { UINT16 LoginOption; UINT64 Lun; UINT16 TargetPortalGroupTag; - CHAR16 iSCSITargetName[1]; + CHAR16 TargetName[1]; } ISCSI_DEVICE_PATH_WITH_NAME; @@ -773,27 +808,24 @@ SetupResetReminder ( ); -/** - 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 -EFIAPI -BdsLibGetImageHeader ( - IN EFI_HANDLE Device, - IN CHAR16 *FileName, - OUT EFI_IMAGE_DOS_HEADER *DosHeader, - OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr - ); +// +// Define the boot option default description +// NOTE: This is not defined in UEFI spec. +// +#define DESCRIPTION_FLOPPY L"EFI Floppy" +#define DESCRIPTION_FLOPPY_NUM L"EFI Floppy %d" +#define DESCRIPTION_DVD L"EFI DVD/CDROM" +#define DESCRIPTION_DVD_NUM L"EFI DVD/CDROM %d" +#define DESCRIPTION_USB L"EFI USB Device" +#define DESCRIPTION_USB_NUM L"EFI USB Device %d" +#define DESCRIPTION_SCSI L"EFI SCSI Device" +#define DESCRIPTION_SCSI_NUM L"EFI SCSI Device %d" +#define DESCRIPTION_MISC L"EFI Misc Device" +#define DESCRIPTION_MISC_NUM L"EFI Misc Device %d" +#define DESCRIPTION_NETWORK L"EFI Network" +#define DESCRIPTION_NETWORK_NUM L"EFI Network %d" +#define DESCRIPTION_NON_BLOCK L"EFI Non-Block Boot Device" +#define DESCRIPTION_NON_BLOCK_NUM L"EFI Non-Block Boot Device %d" // // Define the boot type which to classify the boot option type @@ -812,6 +844,7 @@ BdsLibGetImageHeader ( #define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01 #define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02 #define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05 +#define BDS_EFI_MESSAGE_SATA_BOOT 0x0318 // Type 03; Sub-Type 18 #define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF // // Media boot type @@ -908,7 +941,30 @@ BdsLibIsValidEFIBootOptDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL *DevPath, IN BOOLEAN CheckMedia ); - + +/** + Check whether the Device path in a boot option point to a valid bootable device, + And if CheckMedia is true, check the device is ready to boot now. + If Description is not NULL and the device path point to a fixed BlockIo + device, check the description whether conflict with other auto-created + boot options. + + @param DevPath the Device path in a boot option + @param CheckMedia if true, check the device is ready to boot now. + @param Description the description in a boot option + + @retval TRUE the Device path is valid + @retval FALSE the Device path is invalid . + +**/ +BOOLEAN +EFIAPI +BdsLibIsValidEFIBootOptDevicePathExt ( + IN EFI_DEVICE_PATH_PROTOCOL *DevPath, + IN BOOLEAN CheckMedia, + IN CHAR16 *Description + ); + /** For a bootable Device path, return its boot type. @@ -1015,7 +1071,6 @@ BdsLibConnectUsbDevByShortFormDP( **/ VOID -EFIAPI DevPathVendor ( IN OUT POOL_PRINT *Str, IN VOID *DevPath @@ -1026,7 +1081,7 @@ DevPathVendor ( The caller must free the resulting buffer. @param Str Tracks the allocated pool, size in use, and amount of pool allocated. - @param fmt The format string + @param Fmt The format string @param ... The data will be printed. @return Allocated buffer with the formatted string printed in it. @@ -1038,7 +1093,7 @@ CHAR16 * EFIAPI CatPrint ( IN OUT POOL_PRINT *Str, - IN CHAR16 *fmt, + IN CHAR16 *Fmt, ... );