\r
extern EFI_HANDLE mBdsImageHandle;\r
\r
-//\r
-// Constants which are variable names used to access variables\r
-//\r
+///\r
+/// Constants which are variable names used to access variables\r
+///\r
#define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"\r
\r
-//\r
-// Data structures and defines\r
-//\r
+///\r
+/// Data structures and defines\r
+///\r
#define FRONT_PAGE_QUESTION_ID 0x0000\r
#define FRONT_PAGE_DATA_WIDTH 0x01\r
\r
-//\r
-// ConnectType\r
-//\r
+///\r
+/// ConnectType\r
+///\r
#define CONSOLE_OUT 0x00000001\r
#define STD_ERROR 0x00000002\r
#define CONSOLE_IN 0x00000004\r
#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)\r
\r
-//\r
-// Load Option Attributes defined in EFI Specification\r
-//\r
+///\r
+/// Load Option Attributes\r
+///\r
#define LOAD_OPTION_ACTIVE 0x00000001\r
#define LOAD_OPTION_FORCE_RECONNECT 0x00000002\r
\r
\r
#define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)\r
\r
-//\r
-// Define Maxmim characters that will be accepted\r
-//\r
+///\r
+/// Define Maxmim characters that will be accepted\r
+///\r
#define MAX_CHAR 480\r
#define MAX_CHAR_SIZE (MAX_CHAR * 2)\r
\r
-#define MIN_ALIGNMENT_SIZE 4\r
-#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r
-\r
-//\r
-// Define maximum characters for boot option variable "BootXXXX"\r
-//\r
+///\r
+/// Define maximum characters for boot option variable "BootXXXX"\r
+///\r
#define BOOT_OPTION_MAX_CHAR 10\r
\r
//\r
-// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.\r
+// This data structure is the part of BDS_CONNECT_ENTRY\r
//\r
#define BDS_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'C', 'O')\r
\r
UINTN ConnectType;\r
} BDS_CONSOLE_CONNECT_ENTRY;\r
\r
-//\r
-// Lib Functions\r
-//\r
-\r
//\r
// Bds boot related lib functions\r
//\r
@retval EFI_SUCCESS Finished all the boot device enumerate and create\r
the boot option base on that boot device\r
\r
+ @retval EFI_OUT_OF_RESOURCES Failed to enumerate the boot device and create the boot option list\r
**/\r
EFI_STATUS\r
EFIAPI\r
Process BootOrder, or DriverOrder variables, by calling\r
BdsLibVariableToOption () for each UINT16 in the variables.\r
\r
- @param BdsCommonOptionList The header of the option list base on variable\r
- VariableName\r
- @param VariableName EFI Variable name indicate the BootOrder or\r
- DriverOrder\r
-\r
- @retval EFI_SUCCESS Success create the boot option or driver option\r
- list\r
- @retval EFI_OUT_OF_RESOURCES Failed to get the boot option or driver option list\r
+ @param BdsCommonOptionList The header of the option list base on variable VariableName.\r
+ @param VariableName EFI Variable name indicate the BootOrder or DriverOrder.\r
\r
+ @retval EFI_SUCCESS Success create the boot option or driver option list.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to get the boot option or driver option list.\r
**/\r
EFI_STATUS\r
EFIAPI\r
);\r
\r
/**\r
-\r
Add the legacy boot options from BBS table if they do not exist.\r
\r
- @retval EFI_SUCCESS The boot options are added successfully \r
- or they are already in boot options.\r
-\r
+ @retval EFI_SUCCESS The boot options are added successfully \r
+ or they are already in boot options.\r
+ @retval EFI_NOT_FOUND No legacy boot options is found.\r
+ @retval EFI_OUT_OF_RESOURCE No enough memory.\r
+ @return Other value LegacyBoot options are not added.\r
**/\r
EFI_STATUS\r
EFIAPI\r
);\r
\r
/**\r
-\r
Add the legacy boot devices from BBS table into \r
the legacy device boot order.\r
\r
- @retval EFI_SUCCESS The boot devices are added successfully.\r
-\r
+ @retval EFI_SUCCESS The boot devices are added successfully.\r
+ @retval EFI_NOT_FOUND The legacy boot devices are not found.\r
+ @retval EFI_OUT_OF_RESOURCES Memmory or storage is not enough.\r
+ @retval EFI_DEVICE_ERROR Fail to add the legacy device boot order into EFI variable\r
+ because of hardware error.\r
**/\r
EFI_STATUS\r
EFIAPI\r
);\r
\r
/**\r
-\r
Set the boot priority for BBS entries based on boot option entry and boot order.\r
\r
@param Entry The boot option is to be checked for refresh BBS table.\r
\r
- @retval EFI_SUCCESS The boot priority for BBS entries is refreshed successfully.\r
-\r
+ @retval EFI_SUCCESS The boot priority for BBS entries is refreshed successfully.\r
+ @retval EFI_NOT_FOUND BBS entries can't be found.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to get the legacy device boot order.\r
**/\r
EFI_STATUS\r
EFIAPI\r
);\r
\r
/**\r
+ Deletete the Boot Option from EFI Variable. The Boot Order Arrray\r
+ is also updated.\r
\r
- Delete boot option specified by OptionNumber and adjust the boot order.\r
-\r
- @param OptionNumber The boot option to be deleted.\r
- @param BootOrder Boot order list to be adjusted by remove this boot option.\r
- @param BootOrderSize The size of Boot order list will be modified.\r
- \r
- @retval EFI_SUCCESS The boot option is deleted successfully.\r
+ @param OptionNumber The number of Boot option want to be deleted.\r
+ @param BootOrder The Boot Order array.\r
+ @param BootOrderSize The size of the Boot Order Array.\r
\r
+ @retval EFI_SUCCESS The Boot Option Variable was found and removed\r
+ @retval EFI_UNSUPPORTED The Boot Option Variable store was inaccessible\r
+ @retval EFI_NOT_FOUND The Boot Option Variable was not found\r
**/\r
EFI_STATUS\r
EFIAPI\r
);\r
\r
\r
-//\r
-// Define the boot option default description \r
-// NOTE: This is not defined in UEFI spec.\r
-//\r
+///\r
+/// Define the boot option default description \r
+///\r
#define DESCRIPTION_FLOPPY L"EFI Floppy"\r
#define DESCRIPTION_FLOPPY_NUM L"EFI Floppy %d"\r
#define DESCRIPTION_DVD L"EFI DVD/CDROM"\r
#define DESCRIPTION_NON_BLOCK L"EFI Non-Block Boot Device"\r
#define DESCRIPTION_NON_BLOCK_NUM L"EFI Non-Block Boot Device %d"\r
\r
-//\r
-// Define the boot type which to classify the boot option type\r
-// Different boot option type could have different boot behavior\r
-// Use their device path node (Type + SubType) as type value\r
-// The boot type here can be added according to requirement\r
-//\r
-//\r
-// ACPI boot type. For ACPI device, cannot use sub-type to distinguish device, so hardcode their value\r
-//\r
+///\r
+/// Define the boot type which to classify the boot option type\r
+/// Different boot option type could have different boot behavior\r
+/// Use their device path node (Type + SubType) as type value\r
+/// The boot type here can be added according to requirement\r
+///\r
+\r
+///\r
+/// ACPI boot type. For ACPI device, cannot use sub-type to distinguish device, so hardcode their value\r
+///\r
#define BDS_EFI_ACPI_FLOPPY_BOOT 0x0201\r
-//\r
-// Message boot type\r
-// If a device path of boot option only point to a message node, the boot option is message boot type\r
-//\r
+///\r
+/// Message boot type\r
+/// If a device path of boot option only point to a message node, the boot option is message boot type\r
+///\r
#define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01\r
#define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02\r
#define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05\r
#define BDS_EFI_MESSAGE_SATA_BOOT 0x0318 // Type 03; Sub-Type 18\r
#define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF\r
-//\r
-// Media boot type\r
-// If a device path of boot option contain a media node, the boot option is media boot type\r
-//\r
+///\r
+/// Media boot type\r
+/// If a device path of boot option contain a media node, the boot option is media boot type\r
+///\r
#define BDS_EFI_MEDIA_HD_BOOT 0x0401 // Type 04; Sub-Type 01\r
#define BDS_EFI_MEDIA_CDROM_BOOT 0x0402 // Type 04; Sub-Type 02\r
-//\r
-// BBS boot type\r
-// If a device path of boot option contain a BBS node, the boot option is BBS boot type\r
-//\r
+///\r
+/// BBS boot type\r
+/// If a device path of boot option contain a BBS node, the boot option is BBS boot type\r
+///\r
#define BDS_LEGACY_BBS_BOOT 0x0501 // Type 05; Sub-Type 01\r
\r
#define BDS_EFI_UNSUPPORT 0xFFFF\r
\r
-//\r
-// USB host controller Programming Interface.\r
-//\r
+///\r
+/// USB host controller Programming Interface.\r
+///\r
#define PCI_CLASSC_PI_UHCI 0x00\r
#define PCI_CLASSC_PI_EHCI 0x20\r
\r
\r
@param DevicePath Device Path to a bootable device\r
\r
- @retval NULL The media on the DevicePath is not bootable\r
+ @return The bootable media handle. If the media on the DevicePath is not bootable, NULL will return.\r
\r
**/\r
EFI_HANDLE\r
}\r
\r
/**\r
-\r
Add the legacy boot options from BBS table if they do not exist.\r
\r
- @retval EFI_SUCCESS The boot options are added successfully \r
- or they are already in boot options.\r
-\r
+ @retval EFI_SUCCESS The boot options are added successfully \r
+ or they are already in boot options.\r
+ @retval EFI_NOT_FOUND No legacy boot options is found.\r
+ @retval EFI_OUT_OF_RESOURCE No enough memory.\r
+ @return Other value LegacyBoot options are not added.\r
**/\r
EFI_STATUS\r
EFIAPI\r
@param BbsTable The BBS table.\r
@param BbsCount The BBS Count.\r
\r
- @retval EFI_SUCCES The buffer is created and the EFI variable named \r
- VAR_LEGACY_DEV_ORDER and EfiLegacyDevOrderGuid is\r
- set correctly.\r
- @return Other value if the set of EFI variable fails. Check gRT->SetVariable\r
- for detailed information.\r
-\r
+ @retval EFI_SUCCES The buffer is created and the EFI variable named \r
+ VAR_LEGACY_DEV_ORDER and EfiLegacyDevOrderGuid is\r
+ set correctly.\r
+ @retval EFI_OUT_OF_RESOURCES Memmory or storage is not enough.\r
+ @retval EFI_DEVICE_ERROR Fail to add the device order into EFI variable fail\r
+ because of hardware error.\r
**/\r
EFI_STATUS\r
BdsCreateDevOrder (\r
}\r
\r
/**\r
-\r
Add the legacy boot devices from BBS table into \r
the legacy device boot order.\r
\r
- @retval EFI_SUCCESS The boot devices are added successfully.\r
-\r
+ @retval EFI_SUCCESS The boot devices are added successfully.\r
+ @retval EFI_NOT_FOUND The legacy boot devices are not found.\r
+ @retval EFI_OUT_OF_RESOURCES Memmory or storage is not enough.\r
+ @retval EFI_DEVICE_ERROR Fail to add the legacy device boot order into EFI variable\r
+ because of hardware error.\r
**/\r
EFI_STATUS\r
EFIAPI\r
@param LocalBbsTable The BBS table.\r
@param Priority The prority table.\r
\r
- @retval EFI_SUCCESS The function completes successfully.\r
- @retval EFI_NOT_FOUND Failed to find device.\r
+ @retval EFI_SUCCESS The function completes successfully.\r
+ @retval EFI_NOT_FOUND Failed to find device.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to get the efi variable of device order.\r
\r
**/\r
EFI_STATUS\r
}\r
\r
/**\r
-\r
Set the boot priority for BBS entries based on boot option entry and boot order.\r
\r
@param Entry The boot option is to be checked for refresh BBS table.\r
\r
- @retval EFI_SUCCESS The boot priority for BBS entries is refreshed successfully.\r
- @return status of BdsSetBootPriority4SameTypeDev()\r
+ @retval EFI_SUCCESS The boot priority for BBS entries is refreshed successfully.\r
+ @retval EFI_NOT_FOUND BBS entries can't be found.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to get the legacy device boot order.\r
**/\r
EFI_STATUS\r
EFIAPI\r