TianoCore EDK2 master
Loading...
Searching...
No Matches
ConPlatform.c File Reference
#include "ConPlatform.h"

Go to the source code of this file.

Macros

#define USB_BASE_CLASS_MISCELLANEOUS   0xEF
 
#define USB_MISCELLANEOUS_SUBCLASS_COMMON   0x02
 
#define USB_MISCELLANEOUS_PROTOCOL_IAD   0x01
 

Functions

EFI_STATUS EFIAPI InitializeConPlatform (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI ConPlatformTextInDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
 
EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
 
EFI_STATUS ConPlatformDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_GUID *ProtocolGuid)
 
EFI_STATUS EFIAPI ConPlatformTextInDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI ConPlatformTextInDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
VOID ConPlatformUnInstallProtocol (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_GUID *ProtocolGuid)
 
VOID * ConPlatformGetVariable (IN CHAR16 *Name)
 
BOOLEAN IsGopSibling (IN EFI_DEVICE_PATH_PROTOCOL *Left, IN EFI_DEVICE_PATH_PROTOCOL *Right)
 
BOOLEAN MatchUsbClass (IN EFI_USB_IO_PROTOCOL *UsbIo, IN USB_CLASS_DEVICE_PATH *UsbClass)
 
BOOLEAN MatchUsbWwid (IN EFI_USB_IO_PROTOCOL *UsbIo, IN USB_WWID_DEVICE_PATH *UsbWwid)
 
BOOLEAN MatchUsbShortformDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FullPath, IN EFI_DEVICE_PATH_PROTOCOL *ShortformPath)
 
EFI_STATUS ConPlatformMatchDevicePaths (IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single, OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL, IN BOOLEAN Delete)
 
EFI_STATUS ConPlatformUpdateDeviceVariable (IN CHAR16 *VariableName, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONPLATFORM_VAR_OPERATION Operation)
 
BOOLEAN ConPlatformUpdateGopCandidate (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 

Variables

EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding
 
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding
 

Detailed Description

Console Platform DXE Driver, install Console Device Guids and update Console Environment Variables.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ConPlatform.c.

Macro Definition Documentation

◆ USB_BASE_CLASS_MISCELLANEOUS

#define USB_BASE_CLASS_MISCELLANEOUS   0xEF

Definition at line 35 of file ConPlatform.c.

◆ USB_MISCELLANEOUS_PROTOCOL_IAD

#define USB_MISCELLANEOUS_PROTOCOL_IAD   0x01

Definition at line 37 of file ConPlatform.c.

◆ USB_MISCELLANEOUS_SUBCLASS_COMMON

#define USB_MISCELLANEOUS_SUBCLASS_COMMON   0x02

Definition at line 36 of file ConPlatform.c.

Function Documentation

◆ ConPlatformDriverBindingSupported()

EFI_STATUS ConPlatformDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_GUID ProtocolGuid 
)

Test to see if the specified protocol is supported on ControllerHandle.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to test.
ProtocolGuidThe specfic protocol.
Return values
EFI_SUCCESSThis driver supports this device.
otherThis driver does not support this device.

Definition at line 149 of file ConPlatform.c.

◆ ConPlatformGetVariable()

VOID * ConPlatformGetVariable ( IN CHAR16 *  Name)

Get the necessary size of buffer and read the variable.

First get the necessary size of buffer. Then read the EFI variable (Name) and return a dynamically allocated buffer. On failure return NULL.

Parameters
NameString part of EFI variable name
Returns
Dynamically allocated memory that contains a copy of the EFI variable. Caller is repsoncible freeing the buffer. Return NULL means Variable was not read.

Definition at line 661 of file ConPlatform.c.

◆ ConPlatformMatchDevicePaths()

EFI_STATUS ConPlatformMatchDevicePaths ( IN EFI_DEVICE_PATH_PROTOCOL Multi,
IN EFI_DEVICE_PATH_PROTOCOL Single,
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath  OPTIONAL,
IN BOOLEAN  Delete 
)

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.
NewDevicePathIf Delete is TRUE, this parameter must not be null, and it points to the remaining device path data structure. (remaining device path = Multi - Single.)
DeleteIf TRUE, means removing Single from Multi. If FALSE, the routine just check whether Single matches with any instance in Multi.
Return values
EFI_SUCCESSIf the Single is contained within Multi.
EFI_NOT_FOUNDIf the Single is not contained within Multi.
EFI_INVALID_PARAMETERMulti is NULL.
EFI_INVALID_PARAMETERSingle is NULL.
EFI_INVALID_PARAMETERNewDevicePath is NULL when Delete is TRUE.

Definition at line 1076 of file ConPlatform.c.

◆ ConPlatformTextInDriverBindingStart()

EFI_STATUS EFIAPI ConPlatformTextInDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Start this driver on the device for console input.

Start this driver on ControllerHandle by opening Simple Text Input Protocol, reading Device Path, and installing Console In Devcice GUID on ControllerHandle.

Append its device path into the console environment variables ConInDev.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to bind driver to
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver is added to ControllerHandle
EFI_ALREADY_STARTEDThis driver is already running on ControllerHandle
otherThis driver does not support this device.

Definition at line 219 of file ConPlatform.c.

◆ ConPlatformTextInDriverBindingStop()

EFI_STATUS EFIAPI ConPlatformTextInDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE ChildHandleBuffer 
)

Stop this driver on ControllerHandle by removing Console In Devcice GUID and closing the Simple Text Input protocol on ControllerHandle.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to stop driver on
NumberOfChildrenNumber of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver.
ChildHandleBufferList of Child Handles to Stop.
Return values
EFI_SUCCESSThis driver is removed ControllerHandle
otherThis driver was not removed from this device

Definition at line 470 of file ConPlatform.c.

◆ ConPlatformTextInDriverBindingSupported()

EFI_STATUS EFIAPI ConPlatformTextInDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath  OPTIONAL 
)

Test to see if EFI_SIMPLE_TEXT_INPUT_PROTOCOL is supported on ControllerHandle.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to test.
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver supports this device.
otherThis driver does not support this device.

Definition at line 97 of file ConPlatform.c.

◆ ConPlatformTextOutDriverBindingStart()

EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Start this driver on the device for console output and standard error output.

Start this driver on ControllerHandle by opening Simple Text Output Protocol, reading Device Path, and installing Console Out Devcic GUID, Standard Error Device GUID on ControllerHandle.

Append its device path into the console environment variables ConOutDev, ErrOutDev.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to bind driver to
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver is added to ControllerHandle
EFI_ALREADY_STARTEDThis driver is already running on ControllerHandle
otherThis driver does not support this device

Definition at line 326 of file ConPlatform.c.

◆ ConPlatformTextOutDriverBindingStop()

EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE ChildHandleBuffer 
)

Stop this driver on ControllerHandle by removing Console Out Devcice GUID and closing the Simple Text Output protocol on ControllerHandle.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to stop driver on
NumberOfChildrenNumber of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver.
ChildHandleBufferList of Child Handles to Stop.
Return values
EFI_SUCCESSThis driver is removed ControllerHandle
otherThis driver was not removed from this device

Definition at line 543 of file ConPlatform.c.

◆ ConPlatformTextOutDriverBindingSupported()

EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath  OPTIONAL 
)

Test to see if EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is supported on ControllerHandle.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to test.
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver supports this device.
otherThis driver does not support this device.

Definition at line 124 of file ConPlatform.c.

◆ ConPlatformUnInstallProtocol()

VOID ConPlatformUnInstallProtocol ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Handle,
IN EFI_GUID ProtocolGuid 
)

Uninstall the specified protocol.

Parameters
ThisProtocol instance pointer.
HandleHandle of device to uninstall protocol on.
ProtocolGuidThe specified protocol need to be uninstalled.

Definition at line 617 of file ConPlatform.c.

◆ ConPlatformUpdateDeviceVariable()

EFI_STATUS ConPlatformUpdateDeviceVariable ( IN CHAR16 *  VariableName,
IN EFI_DEVICE_PATH_PROTOCOL DevicePath,
IN CONPLATFORM_VAR_OPERATION  Operation 
)

Update console environment variables.

Parameters
VariableNameConsole environment variables, ConOutDev, ConInDev ErrOutDev, ConIn ,ConOut or ErrOut.
DevicePathConsole devcie's device path.
OperationVariable operations, including APPEND, CHECK and DELETE.
Return values
EFI_SUCCESSVariable operates successfully.
EFI_OUT_OF_RESOURCESIf variable cannot be appended.
otherVariable updating failed.

Definition at line 1171 of file ConPlatform.c.

◆ ConPlatformUpdateGopCandidate()

BOOLEAN ConPlatformUpdateGopCandidate ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath)

Update ConOutDev and ErrOutDev variables to add the device path of GOP controller itself and the sibling controllers.

Parameters
DevicePathPointer to device's device path.
Return values
TRUEThe devcie is a GOP device.
FALSEThe devcie is not a GOP device.

Definition at line 1276 of file ConPlatform.c.

◆ InitializeConPlatform()

EFI_STATUS EFIAPI InitializeConPlatform ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Entrypoint of this module.

This function is the entrypoint of this module. It installs Driver Binding Protocols together with Component Name Protocols.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.

Definition at line 53 of file ConPlatform.c.

◆ IsGopSibling()

BOOLEAN IsGopSibling ( IN EFI_DEVICE_PATH_PROTOCOL Left,
IN EFI_DEVICE_PATH_PROTOCOL Right 
)

Function returns TRUE when the two input device paths point to the two GOP child handles that have the same parent.

Parameters
LeftA pointer to a device path data structure.
RightA pointer to a device path data structure.
Return values
TRUELeft and Right share the same parent.
FALSELeft and Right don't share the same parent or either of them is not a GOP device path.

Definition at line 726 of file ConPlatform.c.

◆ MatchUsbClass()

BOOLEAN MatchUsbClass ( IN EFI_USB_IO_PROTOCOL UsbIo,
IN USB_CLASS_DEVICE_PATH UsbClass 
)

Check whether a USB device match the specified USB Class device path. This function follows "Load Option Processing" behavior in UEFI specification.

Parameters
UsbIoUSB I/O protocol associated with the USB device.
UsbClassThe USB Class device path to match.
Return values
TRUEThe USB device match the USB Class device path.
FALSEThe USB device does not match the USB Class device path.

Definition at line 779 of file ConPlatform.c.

◆ MatchUsbShortformDevicePath()

BOOLEAN MatchUsbShortformDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL FullPath,
IN EFI_DEVICE_PATH_PROTOCOL ShortformPath 
)

Compare whether a full console device path matches a USB shortform device path.

Parameters
[in]FullPathFull console device path.
[in]ShortformPathShort-form device path. Short-form device node may in the beginning or in the middle.
Return values
TRUEThe full console device path matches the short-form device path.
FALSEThe full console device path doesn't match the short-form device path.

Definition at line 990 of file ConPlatform.c.

◆ MatchUsbWwid()

BOOLEAN MatchUsbWwid ( IN EFI_USB_IO_PROTOCOL UsbIo,
IN USB_WWID_DEVICE_PATH UsbWwid 
)

Check whether a USB device match the specified USB WWID device path. This function follows "Load Option Processing" behavior in UEFI specification.

Parameters
UsbIoUSB I/O protocol associated with the USB device.
UsbWwidThe USB WWID device path to match.
Return values
TRUEThe USB device match the USB WWID device path.
FALSEThe USB device does not match the USB WWID device path.

Definition at line 877 of file ConPlatform.c.

Variable Documentation

◆ gConPlatformTextInDriverBinding

EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding
Initial value:
= {
0xa,
}
EFI_STATUS EFIAPI ConPlatformTextInDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: ConPlatform.c:470
EFI_STATUS EFIAPI ConPlatformTextInDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: ConPlatform.c:219
EFI_STATUS EFIAPI ConPlatformTextInDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
Definition: ConPlatform.c:97
#define NULL
Definition: Base.h:319

Definition at line 12 of file ConPlatform.c.

◆ gConPlatformTextOutDriverBinding

EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding
Initial value:
= {
0xa,
}
EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: ConPlatform.c:326
EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
Definition: ConPlatform.c:124
EFI_STATUS EFIAPI ConPlatformTextOutDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: ConPlatform.c:543

Definition at line 21 of file ConPlatform.c.