2009-02-24 16:53:05 +01:00
|
|
|
/** @file
|
2009-06-17 10:46:49 +02:00
|
|
|
Generic BDS library defines general interfaces for BDS driver including:
|
2009-07-09 14:01:01 +02:00
|
|
|
1) BDS boot policy interface
|
|
|
|
2) BDS boot device connect interface
|
2009-06-17 10:46:49 +02:00
|
|
|
3) BDS Misc interfaces for mainting boot variable, ouput string.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-06-17 10:46:49 +02:00
|
|
|
Copyright (c) 2004 - 2009, Intel Corporation. <BR>
|
2009-02-24 16:53:05 +01:00
|
|
|
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
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef _GENERIC_BDS_LIB_H_
|
|
|
|
#define _GENERIC_BDS_LIB_H_
|
|
|
|
|
|
|
|
extern EFI_HANDLE mBdsImageHandle;
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// Constants which are variable names used to access variables
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// Data structures and defines
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define FRONT_PAGE_QUESTION_ID 0x0000
|
|
|
|
#define FRONT_PAGE_DATA_WIDTH 0x01
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// ConnectType
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define CONSOLE_OUT 0x00000001
|
|
|
|
#define STD_ERROR 0x00000002
|
|
|
|
#define CONSOLE_IN 0x00000004
|
|
|
|
#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// Load Option Attributes
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define LOAD_OPTION_ACTIVE 0x00000001
|
|
|
|
#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
|
|
|
|
|
|
|
|
#define LOAD_OPTION_HIDDEN 0x00000008
|
|
|
|
#define LOAD_OPTION_CATEGORY 0x00001F00
|
|
|
|
|
|
|
|
#define LOAD_OPTION_CATEGORY_BOOT 0x00000000
|
|
|
|
#define LOAD_OPTION_CATEGORY_APP 0x00000100
|
|
|
|
|
|
|
|
#define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001
|
|
|
|
#define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002
|
|
|
|
|
|
|
|
#define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
2009-07-09 14:01:01 +02:00
|
|
|
/// Define Maximum characters that will be accepted
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define MAX_CHAR 480
|
|
|
|
#define MAX_CHAR_SIZE (MAX_CHAR * 2)
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// Define maximum characters for boot option variable "BootXXXX"
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define BOOT_OPTION_MAX_CHAR 10
|
|
|
|
|
|
|
|
//
|
2009-07-08 14:06:28 +02:00
|
|
|
// This data structure is the part of BDS_CONNECT_ENTRY
|
2009-02-24 16:53:05 +01:00
|
|
|
//
|
|
|
|
#define BDS_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'C', 'O')
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
UINTN Signature;
|
|
|
|
LIST_ENTRY Link;
|
|
|
|
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
|
|
|
|
CHAR16 *OptionName;
|
|
|
|
UINTN OptionNumber;
|
|
|
|
UINT16 BootCurrent;
|
|
|
|
UINT32 Attribute;
|
|
|
|
CHAR16 *Description;
|
|
|
|
VOID *LoadOptions;
|
|
|
|
UINT32 LoadOptionsSize;
|
|
|
|
CHAR16 *StatusString;
|
|
|
|
|
|
|
|
} BDS_COMMON_OPTION;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
UINTN ConnectType;
|
|
|
|
} BDS_CONSOLE_CONNECT_ENTRY;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Bds boot related lib functions
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
Boot from the UEFI spec defined "BootNext" variable.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
BdsLibBootNext (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-15 15:32:34 +02:00
|
|
|
Process the boot option according to the UEFI specification. The legacy boot option device path includes BBS_DEVICE_PATH.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@param Option The boot option to be processed
|
|
|
|
@param DevicePath The device path describing where to load the
|
2009-02-24 16:53:05 +01:00
|
|
|
boot image or the legcy BBS device path to boot
|
|
|
|
the legacy OS
|
|
|
|
@param ExitDataSize The size of exit data.
|
|
|
|
@param ExitData Data returned when Boot image failed.
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval EFI_SUCCESS Boot from the input boot option succeeded.
|
|
|
|
@retval EFI_NOT_FOUND The Device Path is not found in the system
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibBootViaBootOption (
|
|
|
|
IN BDS_COMMON_OPTION * Option,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
|
|
|
|
OUT UINTN *ExitDataSize,
|
|
|
|
OUT CHAR16 **ExitData OPTIONAL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function will enumerate all possible boot devices in the system, and
|
|
|
|
automatically create boot options for Network, Shell, Removable BlockIo,
|
|
|
|
and Non-BlockIo Simplefile devices.
|
|
|
|
|
|
|
|
BDS separates EFI boot options into six types:
|
2009-06-25 06:44:45 +02:00
|
|
|
1. Network - The boot option points to the SimpleNetworkProtocol device.
|
2009-07-09 14:01:01 +02:00
|
|
|
Bds will try to automatically create this type of boot option during enumeration.
|
2009-06-25 06:44:45 +02:00
|
|
|
2. Shell - The boot option points to internal flash shell.
|
2009-07-09 14:01:01 +02:00
|
|
|
Bds will try to automatically create this type of boot option during enumeration.
|
|
|
|
3. Removable BlockIo - The boot option points to a removable media
|
|
|
|
device, such as a USB flash drive or DVD drive.
|
|
|
|
These devices should contain a *removable* blockIo
|
2009-06-25 06:44:45 +02:00
|
|
|
protocol in their device handle.
|
|
|
|
Bds will try to automatically create this type boot option
|
|
|
|
when enumerate.
|
2009-07-09 14:01:01 +02:00
|
|
|
4. Fixed BlockIo - The boot option points to a Fixed blockIo device,
|
|
|
|
such as a hard disk.
|
|
|
|
These devices should contain a *fixed* blockIo
|
2009-06-25 06:44:45 +02:00
|
|
|
protocol in their device handle.
|
2009-07-09 14:01:01 +02:00
|
|
|
BDS will skip fixed blockIo devices, and not
|
2009-06-25 06:44:45 +02:00
|
|
|
automatically create boot option for them. But BDS
|
2009-07-09 14:01:01 +02:00
|
|
|
will help to delete those fixed blockIo boot options,
|
|
|
|
whose description rules conflict with other auto-created
|
2009-06-25 06:44:45 +02:00
|
|
|
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
|
2009-07-09 14:01:01 +02:00
|
|
|
created by the user, either manually or with an OS loader. BDS will not delete or modify
|
2009-06-25 06:44:45 +02:00
|
|
|
these boot options.
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
This function will enumerate all possible boot devices in the system, and
|
2009-06-25 06:44:45 +02:00
|
|
|
automatically create boot options for Network, Shell, Removable BlockIo,
|
|
|
|
and Non-BlockIo Simplefile devices.
|
2009-07-09 14:01:01 +02:00
|
|
|
It will excute once every boot.
|
2009-06-25 06:44:45 +02:00
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@param BdsBootOptionList The header of the linked list that indexed all
|
2009-02-24 16:53:05 +01:00
|
|
|
current boot options
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval EFI_SUCCESS Finished all the boot device enumerations and created
|
|
|
|
the boot option based on the boot device
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
@retval EFI_OUT_OF_RESOURCES Failed to enumerate the boot device and create the boot option list
|
2009-02-24 16:53:05 +01:00
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibEnumerateAllBootOption (
|
|
|
|
IN OUT LIST_ENTRY *BdsBootOptionList
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Build the boot option with the handle parsed in
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@param Handle The handle representing the device path for which to create
|
2009-02-24 16:53:05 +01:00
|
|
|
boot option
|
|
|
|
@param BdsBootOptionList The header of the link list which indexed all
|
|
|
|
current boot options
|
|
|
|
@param String The description of the boot option.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
BdsLibBuildOptionFromHandle (
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN LIST_ENTRY *BdsBootOptionList,
|
|
|
|
IN CHAR16 *String
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Build the on flash shell boot option with the handle parsed in.
|
|
|
|
|
|
|
|
@param Handle The handle which present the device path to create
|
|
|
|
on flash shell boot option
|
|
|
|
@param BdsBootOptionList The header of the link list which indexed all
|
|
|
|
current boot options
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
BdsLibBuildOptionFromShell (
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN OUT LIST_ENTRY *BdsBootOptionList
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Bds misc lib functions
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
Get boot mode by looking up configuration table and parsing HOB list
|
|
|
|
|
|
|
|
@param BootMode Boot mode from PEI handoff HOB.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS Successfully get boot mode
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibGetBootMode (
|
|
|
|
OUT EFI_BOOT_MODE *BootMode
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
The function will go through the driver option link list, and then load and start
|
|
|
|
every driver to which the driver option device path points.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@param BdsDriverLists The header of the current driver option link list
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
BdsLibLoadDrivers (
|
|
|
|
IN LIST_ENTRY *BdsDriverLists
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-15 15:32:34 +02:00
|
|
|
This function processes BootOrder or DriverOrder variables, by calling
|
|
|
|
|
2009-02-24 16:53:05 +01:00
|
|
|
BdsLibVariableToOption () for each UINT16 in the variables.
|
|
|
|
|
2009-07-10 05:26:52 +02:00
|
|
|
@param BdsCommonOptionList The header of the option list base on variable
|
|
|
|
VariableName
|
|
|
|
@param VariableName EFI Variable name indicate the BootOrder or
|
|
|
|
DriverOrder
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS Success create the boot option or driver option
|
|
|
|
list
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Failed to get the boot option or driver option list
|
|
|
|
**/
|
2009-02-24 16:53:05 +01:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibBuildOptionFromVar (
|
|
|
|
IN LIST_ENTRY *BdsCommonOptionList,
|
|
|
|
IN CHAR16 *VariableName
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function reads the EFI variable (VendorGuid/Name) and returns a dynamically allocated
|
|
|
|
buffer and the size of the buffer. If failure, return NULL.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@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 Dynamically allocated memory that contains a copy of the EFI variable
|
|
|
|
Caller is responsible freeing the buffer.
|
|
|
|
@retval NULL Variable was not read
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID *
|
|
|
|
EFIAPI
|
|
|
|
BdsLibGetVariableAndSize (
|
|
|
|
IN CHAR16 *Name,
|
|
|
|
IN EFI_GUID *VendorGuid,
|
|
|
|
OUT UINTN *VariableSize
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
This function prints a series of strings.
|
|
|
|
|
|
|
|
@param ConOut Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
|
|
|
|
@param ... A variable argument list containing series of
|
|
|
|
strings, the last string must be NULL.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS Success print out the string using ConOut.
|
|
|
|
@retval EFI_STATUS Return the status of the ConOut->OutputString ().
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibOutputStrings (
|
|
|
|
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,
|
|
|
|
...
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Build the boot#### or driver#### option from the VariableName. The
|
2009-02-24 16:53:05 +01:00
|
|
|
build boot#### or driver#### will also be linked to BdsCommonOptionList.
|
|
|
|
|
|
|
|
@param BdsCommonOptionList The header of the boot#### or driver#### option
|
|
|
|
link list
|
2009-07-09 14:01:01 +02:00
|
|
|
@param VariableName EFI Variable name, indicates if it is boot#### or
|
2009-02-24 16:53:05 +01:00
|
|
|
driver####
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval BDS_COMMON_OPTION The option that was created
|
2009-02-24 16:53:05 +01:00
|
|
|
@retval NULL Failed to get the new option
|
|
|
|
|
|
|
|
**/
|
|
|
|
BDS_COMMON_OPTION *
|
|
|
|
EFIAPI
|
|
|
|
BdsLibVariableToOption (
|
|
|
|
IN OUT LIST_ENTRY *BdsCommonOptionList,
|
|
|
|
IN CHAR16 *VariableName
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function registers the new boot#### or driver#### option based on
|
2009-02-24 16:53:05 +01:00
|
|
|
the VariableName. The new registered boot#### or driver#### will be linked
|
|
|
|
to BdsOptionList and also update to the VariableName. After the boot#### or
|
|
|
|
driver#### updated, the BootOrder or DriverOrder will also be updated.
|
|
|
|
|
|
|
|
@param BdsOptionList The header of the boot#### or driver#### link list
|
|
|
|
@param DevicePath The device path which the boot#### or driver####
|
|
|
|
option present
|
|
|
|
@param String The description of the boot#### or driver####
|
|
|
|
@param VariableName Indicate if the boot#### or driver#### option
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The boot#### or driver#### have been success
|
|
|
|
registered
|
|
|
|
@retval EFI_STATUS Return the status of gRT->SetVariable ().
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibRegisterNewOption (
|
|
|
|
IN LIST_ENTRY *BdsOptionList,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
|
|
|
IN CHAR16 *String,
|
|
|
|
IN CHAR16 *VariableName
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
2009-07-09 14:01:01 +02:00
|
|
|
// Bds connect and disconnect driver lib funcions
|
2009-02-24 16:53:05 +01:00
|
|
|
//
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function connects all system drivers with the corresponding controllers.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
BdsLibConnectAllDriversToAllControllers (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function connects all system drivers to controllers.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
BdsLibConnectAll (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-15 15:32:34 +02:00
|
|
|
This function creates all handles associated with the given device
|
2009-07-09 14:01:01 +02:00
|
|
|
path node. If the handle associated with one device path node can not
|
|
|
|
be created, then it tries to execute the dispatch to load the missing drivers.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@param DevicePathToConnect The device path to be connected. Can be
|
2009-02-24 16:53:05 +01:00
|
|
|
a multi-instance device path
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval EFI_SUCCESS All handles associates with every device path node
|
|
|
|
were created
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Not enough resources to create new handles
|
|
|
|
@retval EFI_NOT_FOUND At least one handle could not be created
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibConnectDevicePath (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
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 child handles have been connected @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().
|
2009-02-24 16:53:05 +01:00
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibConnectAllEfi (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
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().
|
2009-02-24 16:53:05 +01:00
|
|
|
@retval EFI_SUCCESS All handles have been disconnected
|
2009-07-08 05:10:33 +02:00
|
|
|
@retval EFI_STATUS Error status returned by of gBS->LocateHandleBuffer().
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibDisconnectAllEfi (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Bds console related lib functions
|
|
|
|
//
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function will search every simpletxt device in the current system,
|
2009-07-15 15:32:34 +02:00
|
|
|
and make every simpletxt device a potential console device.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
BdsLibConnectAllConsoles (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function will connect console device based on the console
|
2009-02-24 16:53:05 +01:00
|
|
|
device variable ConIn, ConOut and ErrOut.
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval EFI_SUCCESS At least one of the ConIn and ConOut devices have
|
|
|
|
been connected.
|
2009-02-24 16:53:05 +01:00
|
|
|
@retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibConnectAllDefaultConsoles (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function updates the console variable based on ConVarName. It can
|
2009-02-24 16:53:05 +01:00
|
|
|
add or remove one specific console device path from the variable
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@param ConVarName Console-related variable name: ConIn, ConOut,
|
2009-02-24 16:53:05 +01:00
|
|
|
ErrOut.
|
2009-07-09 14:01:01 +02:00
|
|
|
@param CustomizedConDevicePath The console device path to be added to
|
|
|
|
the console variable ConVarName. Can not be multi-instance.
|
|
|
|
@param ExclusiveDevicePath The console device path to be removed
|
|
|
|
from the console variable ConVarName. Can not be multi-instance.
|
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED The added device path is the same as a removed one.
|
|
|
|
@retval EFI_SUCCESS Successfully added or removed the device path from the
|
2009-02-24 16:53:05 +01:00
|
|
|
console variable.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibUpdateConsoleVariable (
|
|
|
|
IN CHAR16 *ConVarName,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Connect the console device base on the variable ConVarName. If
|
|
|
|
ConVarName is a multi-instance device path, and at least one
|
|
|
|
instance connects successfully, then this function
|
2009-02-24 16:53:05 +01:00
|
|
|
will return success.
|
|
|
|
|
|
|
|
@param ConVarName Console related variable name, ConIn, ConOut,
|
|
|
|
ErrOut.
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval EFI_NOT_FOUND No console devices were connected successfully
|
|
|
|
@retval EFI_SUCCESS Connected at least one instance of the console
|
|
|
|
device path based on the variable ConVarName.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibConnectConsoleVariable (
|
|
|
|
IN CHAR16 *ConVarName
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Bds device path related lib functions
|
|
|
|
//
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Delete the instance in Multi that overlaps with Single
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@param Multi A pointer to a multi-instance device path data
|
|
|
|
structure.
|
|
|
|
@param Single A pointer to a single-instance device path data
|
|
|
|
structure.
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@return This function removes the device path instances in Multi that overlap
|
|
|
|
Single, and returns the resulting device path. If there is no
|
2009-02-24 16:53:05 +01:00
|
|
|
remaining device path as a result, this function will return NULL.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *
|
|
|
|
EFIAPI
|
|
|
|
BdsLibDelPartMatchInstance (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *Multi,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *Single
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function compares a device path data structure to that of all the nodes of a
|
|
|
|
second device path instance.
|
|
|
|
|
|
|
|
@param Multi A pointer to a multi-instance device path data
|
|
|
|
structure.
|
|
|
|
@param Single A pointer to a single-instance device path data
|
|
|
|
structure.
|
|
|
|
|
|
|
|
@retval TRUE If the Single device path is contained within Multi device path.
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval FALSE The Single device path is not contained within Multi device path.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
BdsLibMatchDevicePaths (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *Multi,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *Single
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
This function converts an input device structure to a Unicode string.
|
|
|
|
|
|
|
|
@param DevPath A pointer to the device path structure.
|
|
|
|
|
|
|
|
@return A new allocated Unicode string that represents the device path.
|
|
|
|
|
|
|
|
**/
|
|
|
|
CHAR16 *
|
|
|
|
EFIAPI
|
|
|
|
DevicePathToStr (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Internal definitions
|
|
|
|
//
|
|
|
|
typedef struct {
|
2009-06-24 07:33:36 +02:00
|
|
|
CHAR16 *Str;
|
|
|
|
UINTN Len;
|
|
|
|
UINTN Maxlen;
|
2009-02-24 16:53:05 +01:00
|
|
|
} POOL_PRINT;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
UINT8 Type;
|
|
|
|
UINT8 SubType;
|
|
|
|
VOID (*Function) (POOL_PRINT *, VOID *);
|
|
|
|
} DEVICE_PATH_STRING_TABLE;
|
|
|
|
|
|
|
|
extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
|
|
|
EFI_GUID Guid;
|
|
|
|
UINT8 VendorDefinedData[1];
|
|
|
|
} VENDOR_DEVICE_PATH_WITH_DATA;
|
|
|
|
|
|
|
|
|
|
|
|
extern EFI_GUID mEfiDevicePathMessagingSASGuid;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL Header;
|
|
|
|
UINT16 NetworkProtocol;
|
|
|
|
UINT16 LoginOption;
|
|
|
|
UINT64 Lun;
|
|
|
|
UINT16 TargetPortalGroupTag;
|
2009-06-30 03:55:21 +02:00
|
|
|
CHAR16 TargetName[1];
|
2009-02-24 16:53:05 +01:00
|
|
|
} ISCSI_DEVICE_PATH_WITH_NAME;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Notes: EFI 64 shadow all option rom
|
|
|
|
//
|
|
|
|
#if defined (MDE_CPU_IPF)
|
|
|
|
#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();
|
|
|
|
#else
|
|
|
|
#define EFI64_SHADOW_ALL_LEGACY_ROM()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
Shadow all Legacy OptionRom.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
ShadowAllOptionRom (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// BBS support macros and functions
|
|
|
|
//
|
|
|
|
|
|
|
|
#if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
|
|
|
|
#define REFRESH_LEGACY_BOOT_OPTIONS \
|
|
|
|
BdsDeleteAllInvalidLegacyBootOptions ();\
|
|
|
|
BdsAddNonExistingLegacyBootOptions (); \
|
|
|
|
BdsUpdateLegacyDevOrder ()
|
|
|
|
#else
|
|
|
|
#define REFRESH_LEGACY_BOOT_OPTIONS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
Delete all the invalid legacy boot options.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS All invalide legacy boot options are deleted.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Fail to allocate necessary memory.
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval EFI_NOT_FOUND Fail to retrieve variable of boot order.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsDeleteAllInvalidLegacyBootOptions (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Add the legacy boot options from BBS table if they do not exist.
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
@retval EFI_SUCCESS The boot options are added successfully
|
|
|
|
or they are already in boot options.
|
|
|
|
@retval EFI_NOT_FOUND No legacy boot options is found.
|
|
|
|
@retval EFI_OUT_OF_RESOURCE No enough memory.
|
|
|
|
@return Other value LegacyBoot options are not added.
|
2009-02-24 16:53:05 +01:00
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsAddNonExistingLegacyBootOptions (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Add the legacy boot devices from BBS table into
|
|
|
|
the legacy device boot order.
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
@retval EFI_SUCCESS The boot devices are added successfully.
|
|
|
|
@retval EFI_NOT_FOUND The legacy boot devices are not found.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Memmory or storage is not enough.
|
|
|
|
@retval EFI_DEVICE_ERROR Fail to add the legacy device boot order into EFI variable
|
|
|
|
because of hardware error.
|
2009-02-24 16:53:05 +01:00
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsUpdateLegacyDevOrder (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-15 15:32:34 +02:00
|
|
|
Refresh the boot priority for BBS entries based on boot option entry and boot order.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@param Entry The boot option is to be checked for refresh BBS table.
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
@retval EFI_SUCCESS The boot priority for BBS entries is refreshed successfully.
|
|
|
|
@retval EFI_NOT_FOUND BBS entries can't be found.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Failed to get the legacy device boot order.
|
2009-02-24 16:53:05 +01:00
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsRefreshBbsTableForBoot (
|
|
|
|
IN BDS_COMMON_OPTION *Entry
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-15 15:32:34 +02:00
|
|
|
Delete the Boot Option from EFI Variable. The Boot Order Arrray
|
2009-07-08 14:06:28 +02:00
|
|
|
is also updated.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
@param OptionNumber The number of Boot option want to be deleted.
|
|
|
|
@param BootOrder The Boot Order array.
|
|
|
|
@param BootOrderSize The size of the Boot Order Array.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
@retval EFI_SUCCESS The Boot Option Variable was found and removed
|
|
|
|
@retval EFI_UNSUPPORTED The Boot Option Variable store was inaccessible
|
|
|
|
@retval EFI_NOT_FOUND The Boot Option Variable was not found
|
2009-02-24 16:53:05 +01:00
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsDeleteBootOption (
|
|
|
|
IN UINTN OptionNumber,
|
|
|
|
IN OUT UINT16 *BootOrder,
|
|
|
|
IN OUT UINTN *BootOrderSize
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
2009-07-09 14:01:01 +02:00
|
|
|
//The interface functions related to the Setup Browser Reset Reminder feature
|
2009-02-24 16:53:05 +01:00
|
|
|
//
|
|
|
|
/**
|
|
|
|
Enable the setup browser reset reminder feature.
|
2009-07-09 14:01:01 +02:00
|
|
|
This routine is used in platform tip. If the platform policy needs the feature, use the routine to enable it.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
EnableResetReminderFeature (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Disable the setup browser reset reminder feature.
|
2009-07-09 14:01:01 +02:00
|
|
|
This routine is used in platform tip. If the platform policy does not want the feature, use the routine to disable it.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
DisableResetReminderFeature (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Record the info that a reset is required.
|
|
|
|
A module boolean variable is used to record whether a reset is required.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
EnableResetRequired (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Record the info that no reset is required.
|
|
|
|
A module boolean variable is used to record whether a reset is required.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
DisableResetRequired (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Check whether platform policy enables the reset reminder feature. The default is enabled.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
IsResetReminderFeatureEnable (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Check if the user changed any option setting that needs a system reset to be effective.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
IsResetRequired (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Check whether a reset is needed, and finish the reset reminder feature.
|
2009-07-09 14:01:01 +02:00
|
|
|
If a reset is needed, pop up a menu to notice user, and finish the feature
|
2009-02-24 16:53:05 +01:00
|
|
|
according to the user selection.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
SetupResetReminder (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2009-06-11 10:35:53 +02:00
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// Define the boot type which to classify the boot option type
|
|
|
|
/// Different boot option type could have different boot behavior
|
|
|
|
/// Use their device path node (Type + SubType) as type value
|
|
|
|
/// The boot type here can be added according to requirement
|
|
|
|
///
|
|
|
|
|
|
|
|
///
|
|
|
|
/// ACPI boot type. For ACPI device, cannot use sub-type to distinguish device, so hardcode their value
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define BDS_EFI_ACPI_FLOPPY_BOOT 0x0201
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// Message boot type
|
|
|
|
/// If a device path of boot option only point to a message node, the boot option is message boot type
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#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
|
2009-07-13 12:20:09 +02:00
|
|
|
#define BDS_EFI_MESSAGE_SATA_BOOT 0x0312 // Type 03; Sub-Type 18
|
|
|
|
#define BDS_EFI_MESSAGE_MAC_BOOT 0x030b // Type 03; Sub-Type 11
|
2009-02-24 16:53:05 +01:00
|
|
|
#define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF
|
2009-07-13 12:20:09 +02:00
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// Media boot type
|
|
|
|
/// If a device path of boot option contain a media node, the boot option is media boot type
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define BDS_EFI_MEDIA_HD_BOOT 0x0401 // Type 04; Sub-Type 01
|
|
|
|
#define BDS_EFI_MEDIA_CDROM_BOOT 0x0402 // Type 04; Sub-Type 02
|
2009-07-08 14:06:28 +02:00
|
|
|
///
|
|
|
|
/// BBS boot type
|
|
|
|
/// If a device path of boot option contain a BBS node, the boot option is BBS boot type
|
|
|
|
///
|
2009-02-24 16:53:05 +01:00
|
|
|
#define BDS_LEGACY_BBS_BOOT 0x0501 // Type 05; Sub-Type 01
|
|
|
|
|
|
|
|
#define BDS_EFI_UNSUPPORT 0xFFFF
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Check whether an instance in BlockIoDevicePath has the same partition node as the HardDriveDevicePath device path
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@param BlockIoDevicePath Multi device path instances to check
|
|
|
|
@param HardDriveDevicePath A device path starting with a hard drive media
|
2009-02-24 16:53:05 +01:00
|
|
|
device path.
|
|
|
|
|
|
|
|
@retval TRUE There is a matched device path instance.
|
|
|
|
@retval FALSE There is no matched device path instance.
|
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
MatchPartitionDevicePathNode (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath,
|
|
|
|
IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Expand a device path that starts with a hard drive media device path node to be a
|
2009-07-15 15:32:34 +02:00
|
|
|
full device path that includes the full hardware path to the device. This function enables the device to boot.
|
|
|
|
To avoid requiring a connect on every boot, the front match is saved in a variable (the part point
|
|
|
|
to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ).
|
|
|
|
All successful history device paths
|
|
|
|
that point to the front part of the partition node will be saved.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@param HardDriveDevicePath EFI Device Path to boot, if it starts with a hard
|
|
|
|
drive media device path.
|
|
|
|
@return A Pointer to the full device path or NULL if a valid Hard Drive devic path
|
|
|
|
cannot be found.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *
|
|
|
|
EFIAPI
|
|
|
|
BdsExpandPartitionPartialDevicePathToFull (
|
|
|
|
IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Return the bootable media handle.
|
2009-07-09 14:01:01 +02:00
|
|
|
First, check whether the device is connected.
|
|
|
|
Second, check whether the device path points to a device that supports SimpleFileSystemProtocol.
|
2009-02-24 16:53:05 +01:00
|
|
|
Third, detect the the default boot file in the Media, and return the removable Media handle.
|
|
|
|
|
|
|
|
@param DevicePath Device Path to a bootable device
|
|
|
|
|
2009-07-08 14:06:28 +02:00
|
|
|
@return The bootable media handle. If the media on the DevicePath is not bootable, NULL will return.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_HANDLE
|
|
|
|
EFIAPI
|
|
|
|
BdsLibGetBootableHandle (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Checks whether the Device path in a boot option points to a valid bootable device, and if the device
|
|
|
|
is ready to boot now.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@param DevPath the Device path in a boot option
|
2009-07-09 14:01:01 +02:00
|
|
|
@param CheckMedia if true, check whether the device is ready to boot now.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval TRUE the Device path is valid
|
|
|
|
@retval FALSE the Device path is invalid
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
BdsLibIsValidEFIBootOptDevicePath (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevPath,
|
|
|
|
IN BOOLEAN CheckMedia
|
|
|
|
);
|
2009-06-11 10:35:53 +02:00
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Checks whether the Device path in a boot option points to a valid bootable device, and if the device
|
|
|
|
is ready to boot now.
|
|
|
|
If Description is not NULL and the device path points to a fixed BlockIo
|
|
|
|
device, this function checks whether the description conflicts with other auto-created
|
2009-06-11 10:35:53 +02:00
|
|
|
boot options.
|
|
|
|
|
|
|
|
@param DevPath the Device path in a boot option
|
2009-07-09 14:01:01 +02:00
|
|
|
@param CheckMedia if true, checks if the device is ready to boot now.
|
|
|
|
@param Description the description of a boot option
|
2009-06-11 10:35:53 +02:00
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval TRUE the Device path is valid
|
|
|
|
@retval FALSE the Device path is invalid
|
2009-06-11 10:35:53 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
BdsLibIsValidEFIBootOptDevicePathExt (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevPath,
|
|
|
|
IN BOOLEAN CheckMedia,
|
|
|
|
IN CHAR16 *Description
|
|
|
|
);
|
|
|
|
|
2009-02-24 16:53:05 +01:00
|
|
|
/**
|
|
|
|
For a bootable Device path, return its boot type.
|
|
|
|
|
|
|
|
@param DevicePath The bootable device Path to check
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval BDS_EFI_MEDIA_HD_BOOT If given device path contains MEDIA_DEVICE_PATH type device path node which subtype is MEDIA_HARDDRIVE_DP @retval BDS_EFI_MEDIA_CDROM_BOOT If given device path contains MEDIA_DEVICE_PATH type device path node which subtype is MEDIA_CDROM_DP @retval BDS_EFI_ACPI_FLOPPY_BOOT If given device path contains ACPI_DEVICE_PATH type device path node which HID is floppy device. @retval BDS_EFI_MESSAGE_ATAPI_BOOT If given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_ATAPI_DP. @retval BDS_EFI_MESSAGE_SCSI_BOOT If given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_SCSI_DP. @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT If given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_USB_DP. @retval BDS_EFI_MESSAGE_MISC_BOOT If the device path not contains any media device path node, and its last device path node point to a message device path node. @retval BDS_LEGACY_BBS_BOOT If given device path contains BBS_DEVICE_PATH type device path node. @retval BDS_EFI_UNSUPPORT An EFI Removable BlockIO device path not point to a media and message device,
|
2009-02-24 16:53:05 +01:00
|
|
|
**/
|
|
|
|
UINT32
|
|
|
|
EFIAPI
|
|
|
|
BdsGetBootTypeFromDevicePath (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This routine registers a function to adjust the different types of memory page numbers
|
|
|
|
just before booting, and saves the updated info into the variable for the next boot to use.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
BdsLibSaveMemoryTypeInformation (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
This function checks if a Fv file device path is valid, according to a file GUID. If it is invalid,
|
|
|
|
it tries to return the valid device path.
|
2009-02-24 16:53:05 +01:00
|
|
|
FV address maybe changes for memory layout adjust from time to time, use this funciton
|
|
|
|
could promise the Fv file device path is right.
|
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@param DevicePath on input, the Fv file device path to check. On
|
2009-02-24 16:53:05 +01:00
|
|
|
output, the updated valid Fv file device path
|
2009-07-09 14:01:01 +02:00
|
|
|
@param FileGuid the Fv file GUID
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER the input DevicePath or FileGuid is invalid
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval EFI_UNSUPPORTED the input DevicePath does not contain an Fv file
|
|
|
|
GUID at all
|
|
|
|
@retval EFI_ALREADY_STARTED the input DevicePath has pointed to the Fv file and is
|
2009-02-24 16:53:05 +01:00
|
|
|
valid
|
2009-07-09 14:01:01 +02:00
|
|
|
@retval EFI_SUCCESS successfully updated the invalid DevicePath
|
|
|
|
and returned the updated device path in DevicePath
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibUpdateFvFileDevicePath (
|
|
|
|
IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,
|
|
|
|
IN EFI_GUID *FileGuid
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Connect the specific USB device that matches the RemainingDevicePath,
|
2009-02-24 16:53:05 +01:00
|
|
|
and whose bus is determined by Host Controller (Uhci or Ehci)
|
|
|
|
|
|
|
|
@param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci
|
|
|
|
(0xFF)
|
|
|
|
@param RemainingDevicePath a short-form device path that starts with the first
|
|
|
|
element being a USB WWID or a USB Class device
|
|
|
|
path
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The specific Usb device is connected successfully.
|
|
|
|
@retval EFI_INVALID_PARAMETER Invalid HostControllerPi (not 0x00, 0x20 or 0xFF)
|
|
|
|
or RemainingDevicePath is not the USB class device path.
|
|
|
|
@retval EFI_NOT_FOUND The device specified by device path is not found.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
BdsLibConnectUsbDevByShortFormDP(
|
|
|
|
IN UINT8 HostControllerPI,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// The implementation of this function is provided by Platform code.
|
|
|
|
//
|
|
|
|
/**
|
2009-07-09 14:01:01 +02:00
|
|
|
Convert Vendor device path to a device name.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
2009-07-09 14:01:01 +02:00
|
|
|
@param Str The buffer storing device name
|
2009-02-24 16:53:05 +01:00
|
|
|
@param DevPath Pointer to vendor device path
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
DevPathVendor (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Concatenates a formatted unicode string to allocated pool.
|
|
|
|
The caller must free the resulting buffer.
|
|
|
|
|
|
|
|
@param Str Tracks the allocated pool, size in use, and amount of pool allocated.
|
2009-06-24 07:33:36 +02:00
|
|
|
@param Fmt The format string
|
2009-02-24 16:53:05 +01:00
|
|
|
@param ... The data will be printed.
|
|
|
|
|
|
|
|
@return Allocated buffer with the formatted string printed in it.
|
|
|
|
The caller must free the allocated buffer.
|
|
|
|
The buffer allocation is not packed.
|
|
|
|
|
|
|
|
**/
|
|
|
|
CHAR16 *
|
|
|
|
EFIAPI
|
|
|
|
CatPrint (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
2009-06-24 07:33:36 +02:00
|
|
|
IN CHAR16 *Fmt,
|
2009-02-24 16:53:05 +01:00
|
|
|
...
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-07-10 05:26:52 +02:00
|
|
|
Use SystemTable ConOut to stop video based Simple Text Out consoles from going
|
|
|
|
to the video device. Put up LogoFile on every video device that is a console.
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@param[in] LogoFile File name of logo to display on the center of the screen.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
|
|
|
|
@retval EFI_UNSUPPORTED Logo not found
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
EnableQuietBoot (
|
|
|
|
IN EFI_GUID *LogoFile
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-10 05:26:52 +02:00
|
|
|
Use SystemTable ConOut to turn on video based Simple Text Out consoles. The
|
|
|
|
Simple Text Out screens will now be synced up with all non video output devices
|
2009-02-24 16:53:05 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS UGA devices are back in text mode and synced up.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
DisableQuietBoot (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|