OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
DuetBdsLib.h File Reference

Go to the source code of this file.

Data Structures

struct  BDS_CONSOLE_CONNECT_ENTRY
 

Macros

#define CONSOLE_OUT   0x00000001
 
#define STD_ERROR   0x00000002
 
#define CONSOLE_IN   0x00000004
 
#define CONSOLE_ALL   (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
 

Functions

VOID *EFIAPI BdsLibGetVariableAndSize (IN CHAR16 *Name, IN EFI_GUID *VendorGuid, OUT UINTN *VariableSize)
 
VOID EFIAPI BdsLibConnectAllDriversToAllControllers (VOID)
 
VOID EFIAPI BdsLibConnectAll (VOID)
 
EFI_STATUS EFIAPI BdsLibConnectDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect)
 
EFI_STATUS EFIAPI BdsLibConnectAllEfi (VOID)
 
EFI_STATUS EFIAPI BdsLibDisconnectAllEfi (VOID)
 
VOID EFIAPI BdsLibConnectAllConsoles (VOID)
 
EFI_STATUS EFIAPI BdsLibConnectAllDefaultConsoles (VOID)
 
EFI_STATUS EFIAPI BdsLibUpdateConsoleVariable (IN CHAR16 *ConVarName, IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath, IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath)
 
EFI_STATUS EFIAPI BdsLibConnectConsoleVariable (IN CHAR16 *ConVarName)
 
EFI_DEVICE_PATH_PROTOCOL *EFIAPI BdsLibDelPartMatchInstance (IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single)
 
BOOLEAN EFIAPI BdsLibMatchDevicePaths (IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single)
 
EFI_STATUS EFIAPI BdsLibConnectUsbDevByShortFormDP (IN UINT8 HostControllerPI, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
VOID EFIAPI PlatformBdsInit (VOID)
 
VOID EFIAPI PlatformBdsPolicyBehavior (VOID)
 

Detailed Description

Duet BDS library.

Copyright (c) 2004 - 2012, 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 that 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.

Definition in file DuetBdsLib.h.

Macro Definition Documentation

◆ CONSOLE_ALL

#define CONSOLE_ALL   (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)

Definition at line 24 of file DuetBdsLib.h.

◆ CONSOLE_IN

#define CONSOLE_IN   0x00000004

Definition at line 23 of file DuetBdsLib.h.

◆ CONSOLE_OUT

#define CONSOLE_OUT   0x00000001

ConnectType

Definition at line 21 of file DuetBdsLib.h.

◆ STD_ERROR

#define STD_ERROR   0x00000002

Definition at line 22 of file DuetBdsLib.h.

Function Documentation

◆ BdsLibConnectAll()

VOID EFIAPI BdsLibConnectAll ( VOID )

This function connects all system drivers to controllers.

This function will connect all the system driver to controller first, and then special connect the default console, this make sure all the system controller available and the platform default console connected.

Definition at line 36 of file BdsConnect.c.

◆ BdsLibConnectAllConsoles()

VOID EFIAPI BdsLibConnectAllConsoles ( VOID )

This function will search every simpletxt device in the current system, and make every simpletxt device a potential console device.

This function will search every simpletext device in current system, and make every simpletext device as a potential console device.

Definition at line 429 of file BdsConsole.c.

◆ BdsLibConnectAllDefaultConsoles()

EFI_STATUS EFIAPI BdsLibConnectAllDefaultConsoles ( VOID )

This function will connect console device based on the console device variable ConIn, ConOut and ErrOut.

Return values
EFI_SUCCESSAt least one of the ConIn and ConOut devices have been connected.
EFI_STATUSReturn the status of BdsLibConnectConsoleVariable ().

This function will connect console device base on the console device variable ConIn, ConOut and ErrOut.

Return values
EFI_SUCCESSAt least one of the ConIn and ConOut device have been connected success.
EFI_STATUSReturn the status of BdsLibConnectConsoleVariable ().

Definition at line 506 of file BdsConsole.c.

◆ BdsLibConnectAllDriversToAllControllers()

VOID EFIAPI BdsLibConnectAllDriversToAllControllers ( VOID )

This function connects all system drivers with the corresponding controllers.

Connects all drivers to all controllers. This function make sure all the current system driver will manage the corresponding controllers if have. And at the same time, make sure all the system controllers have driver to manage it if have.

Definition at line 315 of file BdsConnect.c.

◆ BdsLibConnectAllEfi()

EFI_STATUS EFIAPI BdsLibConnectAllEfi ( VOID )

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().

Return values
EFI_SUCCESSAll handles and child handles have been connected.
EFI_STATUSReturn the status of gBS->LocateHandleBuffer().

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().

Return values
EFI_SUCCESSAll handles and their child handles have been connected
EFI_STATUSError status returned by of gBS->LocateHandleBuffer().

Definition at line 228 of file BdsConnect.c.

◆ BdsLibConnectConsoleVariable()

EFI_STATUS EFIAPI BdsLibConnectConsoleVariable ( IN CHAR16 * ConVarName)

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 will return success. If the handle associate with one device path node can not be created successfully, then still give chance to do the dispatch, which load the missing drivers if possible.

Parameters
ConVarNameThe console related variable name: ConIn, ConOut, ErrOut.
Return values
EFI_NOT_FOUNDNo console devices were connected successfully
EFI_SUCCESSConnected at least one instance of the console device path based on the variable ConVarName.

Connect the console device base on the variable ConVarName, if device path of the ConVarName is multi-instance device path and anyone of the instances is connected success, then this function will return success. If the handle associate with one device path node can not be created successfully, then still give chance to do the dispatch, which load the missing drivers if possible..

Parameters
ConVarNameConsole related variable name, ConIn, ConOut, ErrOut.
Return values
EFI_NOT_FOUNDThere is not any console devices connected success
EFI_SUCCESSSuccess connect any one instance of the console device path base on the variable ConVarName.

Definition at line 334 of file BdsConsole.c.

◆ BdsLibConnectDevicePath()

EFI_STATUS EFIAPI BdsLibConnectDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePathToConnect)

This function creates all handles associated with the given device path node. If the handle associated with one device path node cannot be created, then it tries to execute the dispatch to load the missing drivers.

Parameters
DevicePathToConnectThe device path to be connected. Can be a multi-instance device path.
Return values
EFI_SUCCESSAll handles associates with every device path node were created.
EFI_OUT_OF_RESOURCESNot enough resources to create new handles.
EFI_NOT_FOUNDAt least one handle could not be created.

This function will create all handles associate with every device path node. If the handle associate with one device path node can not be created successfully, then still give chance to do the dispatch, which load the missing drivers if possible.

Parameters
DevicePathToConnectThe device path which will be connected, it can be a multi-instance device path
Return values
EFI_SUCCESSAll handles associate with every device path node have been created
EFI_OUT_OF_RESOURCESThere is no resource to create new handles
EFI_NOT_FOUNDCreate the handle associate with one device path node failed

Definition at line 94 of file BdsConnect.c.

◆ BdsLibConnectUsbDevByShortFormDP()

EFI_STATUS EFIAPI BdsLibConnectUsbDevByShortFormDP ( IN UINT8 HostControllerPI,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath )

Connect the specific USB device that matches the RemainingDevicePath, and whose bus is determined by Host Controller (Uhci or Ehci).

Parameters
HostControllerPIUhci (0x00) or Ehci (0x20) or Both uhci and ehci (0xFF).
RemainingDevicePathA short-form device path that starts with the first element being a USB WWID or a USB Class device path.
Return values
EFI_SUCCESSThe specific Usb device is connected successfully.
EFI_INVALID_PARAMETERInvalid HostControllerPi (not 0x00, 0x20 or 0xFF) or RemainingDevicePath is not the USB class device path.
EFI_NOT_FOUNDThe device specified by device path is not found.

Connect the specific Usb device which match the short form device path, and whose bus is determined by Host Controller (Uhci or Ehci).

Parameters
HostControllerPIUhci (0x00) or Ehci (0x20) or Both uhci and ehci (0xFF)
RemainingDevicePatha short-form device path that starts with the first element being a USB WWID or a USB Class device path
Returns
EFI_INVALID_PARAMETER RemainingDevicePath is NULL pointer. RemainingDevicePath is not a USB device path. Invalid HostControllerPI type.
EFI_SUCCESS Success to connect USB device
EFI_NOT_FOUND Fail to find handle for USB controller to connect.

Definition at line 355 of file BdsConnect.c.

◆ BdsLibDelPartMatchInstance()

EFI_DEVICE_PATH_PROTOCOL *EFIAPI BdsLibDelPartMatchInstance ( IN EFI_DEVICE_PATH_PROTOCOL * Multi,
IN EFI_DEVICE_PATH_PROTOCOL * Single )

Delete the instance in Multi that overlaps with Single.

Parameters
MultiA pointer to a multi-instance device path data structure.
SingleA pointer to a single-instance device path data structure.
Returns
This function removes the device path instances in Multi that overlap Single, and returns the resulting device path. If there is no remaining device path as a result, this function will return NULL.

Delete the instance in Multi which matches partly with Single instance

Parameters
MultiA pointer to a multi-instance device path data structure.
SingleA pointer to a single-instance device path data structure.
Returns
This function will remove the device path instances in Multi which partly match with the Single, and return the result device path. If there is no remaining device path as a result, this function will return NULL.

Definition at line 93 of file BdsMisc.c.

◆ BdsLibDisconnectAllEfi()

EFI_STATUS EFIAPI BdsLibDisconnectAllEfi ( VOID )

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().

Return values
EFI_SUCCESSAll handles have been disconnected.
EFI_STATUSError status returned by of gBS->LocateHandleBuffer().

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().

Return values
EFI_SUCCESSAll handles have been disconnected
EFI_STATUSError status returned by of gBS->LocateHandleBuffer().

Definition at line 272 of file BdsConnect.c.

◆ BdsLibGetVariableAndSize()

VOID *EFIAPI BdsLibGetVariableAndSize ( IN CHAR16 * Name,
IN EFI_GUID * VendorGuid,
OUT UINTN * VariableSize )

This function reads the EFI variable (VendorGuid/Name) and returns a dynamically allocated buffer and the size of the buffer. If it fails, return NULL.

Parameters
NameThe string part of the EFI variable name.
VendorGuidThe GUID part of the EFI variable name.
VariableSizeReturns the size of the EFI variable that was read.
Returns
Dynamically allocated memory that contains a copy of the EFI variable. The caller is responsible for freeing the buffer.
Return values
NULLThe variable was not read.

Read the EFI variable (VendorGuid/Name) and return a dynamically allocated buffer, and the size of the buffer. If failure return NULL.

Parameters
NameString part of EFI variable name
VendorGuidGUID part of EFI variable name
VariableSizeReturns the size of the EFI variable that was read
Returns
Dynamically allocated memory that contains a copy of the EFI variable Caller is responsible freeing the buffer.
Return values
NULLVariable was not read

Definition at line 36 of file BdsMisc.c.

◆ BdsLibMatchDevicePaths()

BOOLEAN EFIAPI BdsLibMatchDevicePaths ( IN EFI_DEVICE_PATH_PROTOCOL * Multi,
IN EFI_DEVICE_PATH_PROTOCOL * Single )

This function compares a device path data structure to that of all the nodes of a second device path instance.

Parameters
MultiA pointer to a multi-instance device path data structure.
SingleA pointer to a single-instance device path data structure.
Return values
TRUEIf the Single device path is contained within a Multi device path.
FALSEThe Single device path is not contained within a Multi device path.

Function compares a device path data structure to that of all the nodes of a second device path instance.

Parameters
MultiA pointer to a multi-instance device path data structure.
SingleA pointer to a single-instance device path data structure.
Return values
TRUEIf the Single device path is contained within Multi device path.
FALSEThe Single device path is not match within Multi device path.

Definition at line 153 of file BdsMisc.c.

◆ BdsLibUpdateConsoleVariable()

EFI_STATUS EFIAPI BdsLibUpdateConsoleVariable ( IN CHAR16 * ConVarName,
IN EFI_DEVICE_PATH_PROTOCOL * CustomizedConDevicePath,
IN EFI_DEVICE_PATH_PROTOCOL * ExclusiveDevicePath )

This function updates the console variable based on ConVarName. It can add or remove one specific console device path from the variable

Parameters
ConVarNameThe console-related variable name: ConIn, ConOut, ErrOut.
CustomizedConDevicePathThe console device path to be added to the console variable ConVarName. Cannot be multi-instance.
ExclusiveDevicePathThe console device path to be removed from the console variable ConVarName. Cannot be multi-instance.
Return values
EFI_UNSUPPORTEDThe added device path is the same as a removed one.
EFI_SUCCESSSuccessfully added or removed the device path from the console variable.

This function update console variable based on ConVarName, it can add or remove one specific console device path from the variable

Parameters
ConVarNameConsole related variable name, ConIn, ConOut, ErrOut.
CustomizedConDevicePathThe console device path which will be added to the console variable ConVarName, this parameter can not be multi-instance.
ExclusiveDevicePathThe console device path which will be removed from the console variable ConVarName, this parameter can not be multi-instance.
Return values
EFI_UNSUPPORTEDThe added device path is same to the removed one.
EFI_SUCCESSSuccess add or remove the device path from the console variable.

Definition at line 198 of file BdsConsole.c.

◆ PlatformBdsInit()

VOID EFIAPI PlatformBdsInit ( VOID )

Platform Bds initialization. Includes the platform firmware vendor, revision and so crc check.

Definition at line 889 of file BdsPlatform.c.

◆ PlatformBdsPolicyBehavior()

VOID EFIAPI PlatformBdsPolicyBehavior ( VOID )

The function will execute with as the platform policy, current policy is driven by boot mode. IBV/OEM can customize this code for their specific policy action.

Definition at line 1015 of file BdsPlatform.c.