TianoCore EDK2 master
Loading...
Searching...
No Matches
Serial.h File Reference

Go to the source code of this file.

Data Structures

struct  PCI_SERIAL_PARAMETER
 
struct  SERIAL_DEV_FIFO
 
union  PARENT_IO_PROTOCOL_PTR
 
struct  PCI_DEVICE_INFO
 
struct  SERIAL_DEV
 
union  SERIAL_PORT_IER
 
union  SERIAL_PORT_FCR
 
union  SERIAL_PORT_LCR
 
union  SERIAL_PORT_MCR
 
union  SERIAL_PORT_LSR
 
union  SERIAL_PORT_MSR
 

Macros

#define SIO_SERIAL_PORT_NAME   L"SIO Serial Port #%d"
 
#define PCI_SERIAL_PORT_NAME   L"PCI Serial Port #%d"
 
#define SERIAL_PORT_NAME_LEN   (sizeof (SIO_SERIAL_PORT_NAME) / sizeof (CHAR16) + MAXIMUM_VALUE_CHARACTERS)
 
#define TIMEOUT_STALL_INTERVAL   10
 
#define SERIAL_MAX_FIFO_SIZE   17
 Actual FIFO size is 16. FIFO based on circular wastes one unit.
 
#define SERIAL_DEV_SIGNATURE   SIGNATURE_32 ('s', 'e', 'r', 'd')
 
#define SERIAL_DEV_FROM_THIS(a)   CR (a, SERIAL_DEV, SerialIo, SERIAL_DEV_SIGNATURE)
 
#define SERIAL_PORT_DEFAULT_TIMEOUT   1000000
 
#define SERIAL_PORT_SUPPORT_CONTROL_MASK
 
#define SERIAL_PORT_MIN_TIMEOUT   1
 
#define SERIAL_PORT_MAX_TIMEOUT   100000000
 
#define SERIAL_REGISTER_THR   0
 WO Transmit Holding Register.
 
#define SERIAL_REGISTER_RBR   0
 RO Receive Buffer Register.
 
#define SERIAL_REGISTER_DLL   0
 R/W Divisor Latch LSB.
 
#define SERIAL_REGISTER_DLM   1
 R/W Divisor Latch MSB.
 
#define SERIAL_REGISTER_IER   1
 R/W Interrupt Enable Register.
 
#define SERIAL_REGISTER_IIR   2
 RO Interrupt Identification Register.
 
#define SERIAL_REGISTER_FCR   2
 WO FIFO Cotrol Register.
 
#define SERIAL_REGISTER_LCR   3
 R/W Line Control Register.
 
#define SERIAL_REGISTER_MCR   4
 R/W Modem Control Register.
 
#define SERIAL_REGISTER_LSR   5
 R/W Line Status Register.
 
#define SERIAL_REGISTER_MSR   6
 R/W Modem Status Register.
 
#define SERIAL_REGISTER_SCR   7
 R/W Scratch Pad Register.
 
#define READ_RBR(S)   SerialReadRegister (S, SERIAL_REGISTER_RBR)
 
#define READ_DLL(S)   SerialReadRegister (S, SERIAL_REGISTER_DLL)
 
#define READ_DLM(S)   SerialReadRegister (S, SERIAL_REGISTER_DLM)
 
#define READ_IER(S)   SerialReadRegister (S, SERIAL_REGISTER_IER)
 
#define READ_IIR(S)   SerialReadRegister (S, SERIAL_REGISTER_IIR)
 
#define READ_LCR(S)   SerialReadRegister (S, SERIAL_REGISTER_LCR)
 
#define READ_MCR(S)   SerialReadRegister (S, SERIAL_REGISTER_MCR)
 
#define READ_LSR(S)   SerialReadRegister (S, SERIAL_REGISTER_LSR)
 
#define READ_MSR(S)   SerialReadRegister (S, SERIAL_REGISTER_MSR)
 
#define READ_SCR(S)   SerialReadRegister (S, SERIAL_REGISTER_SCR)
 
#define WRITE_THR(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_THR, D)
 
#define WRITE_DLL(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_DLL, D)
 
#define WRITE_DLM(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_DLM, D)
 
#define WRITE_IER(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_IER, D)
 
#define WRITE_FCR(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_FCR, D)
 
#define WRITE_LCR(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_LCR, D)
 
#define WRITE_MCR(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_MCR, D)
 
#define WRITE_LSR(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_LSR, D)
 
#define WRITE_MSR(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_MSR, D)
 
#define WRITE_SCR(S, D)   SerialWriteRegister (S, SERIAL_REGISTER_SCR, D)
 

Functions

EFI_STATUS EFIAPI SerialControllerDriverSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI SerialControllerDriverStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI SerialControllerDriverStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
EFI_STATUS EFIAPI SerialReset (IN EFI_SERIAL_IO_PROTOCOL *This)
 
EFI_STATUS EFIAPI SerialSetAttributes (IN EFI_SERIAL_IO_PROTOCOL *This, IN UINT64 BaudRate, IN UINT32 ReceiveFifoDepth, IN UINT32 Timeout, IN EFI_PARITY_TYPE Parity, IN UINT8 DataBits, IN EFI_STOP_BITS_TYPE StopBits)
 
EFI_STATUS EFIAPI SerialSetControl (IN EFI_SERIAL_IO_PROTOCOL *This, IN UINT32 Control)
 
EFI_STATUS EFIAPI SerialGetControl (IN EFI_SERIAL_IO_PROTOCOL *This, OUT UINT32 *Control)
 
EFI_STATUS EFIAPI SerialWrite (IN EFI_SERIAL_IO_PROTOCOL *This, IN OUT UINTN *BufferSize, IN VOID *Buffer)
 
EFI_STATUS EFIAPI SerialRead (IN EFI_SERIAL_IO_PROTOCOL *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
 
BOOLEAN SerialPresent (IN SERIAL_DEV *SerialDevice)
 
BOOLEAN SerialFifoFull (IN SERIAL_DEV_FIFO *Fifo)
 
BOOLEAN SerialFifoEmpty (IN SERIAL_DEV_FIFO *Fifo)
 
EFI_STATUS SerialFifoAdd (IN SERIAL_DEV_FIFO *Fifo, IN UINT8 Data)
 
EFI_STATUS SerialFifoRemove (IN SERIAL_DEV_FIFO *Fifo, OUT UINT8 *Data)
 
EFI_STATUS SerialReceiveTransmit (IN SERIAL_DEV *SerialDevice)
 
UINT8 SerialReadRegister (IN SERIAL_DEV *SerialDev, IN UINT32 Offset)
 
VOID SerialWriteRegister (IN SERIAL_DEV *SerialDev, IN UINT32 Offset, IN UINT8 Data)
 
EFI_STATUS EFIAPI SerialComponentNameGetDriverName (IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
 
EFI_STATUS EFIAPI SerialComponentNameGetControllerName (IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
 
VOID AddName (IN SERIAL_DEV *SerialDevice, IN UINT32 Uid)
 
BOOLEAN VerifyUartParameters (IN UINT32 ClockRate, IN UINT64 BaudRate, IN UINT8 DataBits, IN EFI_PARITY_TYPE Parity, IN EFI_STOP_BITS_TYPE StopBits, OUT UINT64 *Divisor, OUT UINT64 *ActualBaudRate)
 
UART_DEVICE_PATHSkipControllerDevicePathNode (EFI_DEVICE_PATH_PROTOCOL *DevicePath, BOOLEAN *ContainsControllerNode, UINT32 *ControllerNumber)
 
BOOLEAN IsUartFlowControlDevicePathNode (IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl)
 

Variables

EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver
 
EFI_COMPONENT_NAME_PROTOCOL gPciSioSerialComponentName
 
EFI_COMPONENT_NAME2_PROTOCOL gPciSioSerialComponentName2
 

Detailed Description

Header file for PciSioSerial Driver

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

Definition in file Serial.h.

Macro Definition Documentation

◆ PCI_SERIAL_PORT_NAME

#define PCI_SERIAL_PORT_NAME   L"PCI Serial Port #%d"

Definition at line 41 of file Serial.h.

◆ READ_DLL

#define READ_DLL (   S)    SerialReadRegister (S, SERIAL_REGISTER_DLL)

Definition at line 260 of file Serial.h.

◆ READ_DLM

#define READ_DLM (   S)    SerialReadRegister (S, SERIAL_REGISTER_DLM)

Definition at line 261 of file Serial.h.

◆ READ_IER

#define READ_IER (   S)    SerialReadRegister (S, SERIAL_REGISTER_IER)

Definition at line 262 of file Serial.h.

◆ READ_IIR

#define READ_IIR (   S)    SerialReadRegister (S, SERIAL_REGISTER_IIR)

Definition at line 263 of file Serial.h.

◆ READ_LCR

#define READ_LCR (   S)    SerialReadRegister (S, SERIAL_REGISTER_LCR)

Definition at line 264 of file Serial.h.

◆ READ_LSR

#define READ_LSR (   S)    SerialReadRegister (S, SERIAL_REGISTER_LSR)

Definition at line 266 of file Serial.h.

◆ READ_MCR

#define READ_MCR (   S)    SerialReadRegister (S, SERIAL_REGISTER_MCR)

Definition at line 265 of file Serial.h.

◆ READ_MSR

#define READ_MSR (   S)    SerialReadRegister (S, SERIAL_REGISTER_MSR)

Definition at line 267 of file Serial.h.

◆ READ_RBR

#define READ_RBR (   S)    SerialReadRegister (S, SERIAL_REGISTER_RBR)

Definition at line 259 of file Serial.h.

◆ READ_SCR

#define READ_SCR (   S)    SerialReadRegister (S, SERIAL_REGISTER_SCR)

Definition at line 268 of file Serial.h.

◆ SERIAL_DEV_FROM_THIS

#define SERIAL_DEV_FROM_THIS (   a)    CR (a, SERIAL_DEV, SerialIo, SERIAL_DEV_SIGNATURE)

Definition at line 123 of file Serial.h.

◆ SERIAL_DEV_SIGNATURE

#define SERIAL_DEV_SIGNATURE   SIGNATURE_32 ('s', 'e', 'r', 'd')

Definition at line 122 of file Serial.h.

◆ SERIAL_MAX_FIFO_SIZE

#define SERIAL_MAX_FIFO_SIZE   17

Actual FIFO size is 16. FIFO based on circular wastes one unit.

Definition at line 75 of file Serial.h.

◆ SERIAL_PORT_DEFAULT_TIMEOUT

#define SERIAL_PORT_DEFAULT_TIMEOUT   1000000

Definition at line 128 of file Serial.h.

◆ SERIAL_PORT_MAX_TIMEOUT

#define SERIAL_PORT_MAX_TIMEOUT   100000000

Definition at line 142 of file Serial.h.

◆ SERIAL_PORT_MIN_TIMEOUT

#define SERIAL_PORT_MIN_TIMEOUT   1

Definition at line 141 of file Serial.h.

◆ SERIAL_PORT_NAME_LEN

#define SERIAL_PORT_NAME_LEN   (sizeof (SIO_SERIAL_PORT_NAME) / sizeof (CHAR16) + MAXIMUM_VALUE_CHARACTERS)

Definition at line 42 of file Serial.h.

◆ SERIAL_PORT_SUPPORT_CONTROL_MASK

#define SERIAL_PORT_SUPPORT_CONTROL_MASK
Value:
(EFI_SERIAL_CLEAR_TO_SEND | \
EFI_SERIAL_DATA_SET_READY | \
EFI_SERIAL_RING_INDICATE | \
EFI_SERIAL_CARRIER_DETECT | \
EFI_SERIAL_REQUEST_TO_SEND | \
EFI_SERIAL_DATA_TERMINAL_READY | \
EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | \
EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE | \
EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE | \
EFI_SERIAL_OUTPUT_BUFFER_EMPTY | \
EFI_SERIAL_INPUT_BUFFER_EMPTY)

Definition at line 129 of file Serial.h.

◆ SERIAL_REGISTER_DLL

#define SERIAL_REGISTER_DLL   0

R/W Divisor Latch LSB.

Definition at line 148 of file Serial.h.

◆ SERIAL_REGISTER_DLM

#define SERIAL_REGISTER_DLM   1

R/W Divisor Latch MSB.

Definition at line 149 of file Serial.h.

◆ SERIAL_REGISTER_FCR

#define SERIAL_REGISTER_FCR   2

WO FIFO Cotrol Register.

Definition at line 152 of file Serial.h.

◆ SERIAL_REGISTER_IER

#define SERIAL_REGISTER_IER   1

R/W Interrupt Enable Register.

Definition at line 150 of file Serial.h.

◆ SERIAL_REGISTER_IIR

#define SERIAL_REGISTER_IIR   2

RO Interrupt Identification Register.

Definition at line 151 of file Serial.h.

◆ SERIAL_REGISTER_LCR

#define SERIAL_REGISTER_LCR   3

R/W Line Control Register.

Definition at line 153 of file Serial.h.

◆ SERIAL_REGISTER_LSR

#define SERIAL_REGISTER_LSR   5

R/W Line Status Register.

Definition at line 155 of file Serial.h.

◆ SERIAL_REGISTER_MCR

#define SERIAL_REGISTER_MCR   4

R/W Modem Control Register.

Definition at line 154 of file Serial.h.

◆ SERIAL_REGISTER_MSR

#define SERIAL_REGISTER_MSR   6

R/W Modem Status Register.

Definition at line 156 of file Serial.h.

◆ SERIAL_REGISTER_RBR

#define SERIAL_REGISTER_RBR   0

RO Receive Buffer Register.

Definition at line 147 of file Serial.h.

◆ SERIAL_REGISTER_SCR

#define SERIAL_REGISTER_SCR   7

R/W Scratch Pad Register.

Definition at line 157 of file Serial.h.

◆ SERIAL_REGISTER_THR

#define SERIAL_REGISTER_THR   0

WO Transmit Holding Register.

Definition at line 146 of file Serial.h.

◆ SIO_SERIAL_PORT_NAME

#define SIO_SERIAL_PORT_NAME   L"SIO Serial Port #%d"

Definition at line 40 of file Serial.h.

◆ TIMEOUT_STALL_INTERVAL

#define TIMEOUT_STALL_INTERVAL   10

Definition at line 47 of file Serial.h.

◆ WRITE_DLL

#define WRITE_DLL (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_DLL, D)

Definition at line 271 of file Serial.h.

◆ WRITE_DLM

#define WRITE_DLM (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_DLM, D)

Definition at line 272 of file Serial.h.

◆ WRITE_FCR

#define WRITE_FCR (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_FCR, D)

Definition at line 274 of file Serial.h.

◆ WRITE_IER

#define WRITE_IER (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_IER, D)

Definition at line 273 of file Serial.h.

◆ WRITE_LCR

#define WRITE_LCR (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_LCR, D)

Definition at line 275 of file Serial.h.

◆ WRITE_LSR

#define WRITE_LSR (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_LSR, D)

Definition at line 277 of file Serial.h.

◆ WRITE_MCR

#define WRITE_MCR (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_MCR, D)

Definition at line 276 of file Serial.h.

◆ WRITE_MSR

#define WRITE_MSR (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_MSR, D)

Definition at line 278 of file Serial.h.

◆ WRITE_SCR

#define WRITE_SCR (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_SCR, D)

Definition at line 279 of file Serial.h.

◆ WRITE_THR

#define WRITE_THR (   S,
 
)    SerialWriteRegister (S, SERIAL_REGISTER_THR, D)

Definition at line 270 of file Serial.h.

Function Documentation

◆ AddName()

VOID AddName ( IN SERIAL_DEV SerialDevice,
IN UINT32  Instance 
)

Add the component name for the serial io device

Parameters
SerialDeviceA pointer to the SERIAL_DEV instance.
UidUnique ID for the serial device.

Add the ISO639-2 and RFC4646 component name both for the Serial IO device

Parameters
SerialDeviceA pointer to the SERIAL_DEV instance.
InstanceInstance ID for the serial device.

Definition at line 251 of file ComponentName.c.

◆ IsUartFlowControlDevicePathNode()

BOOLEAN IsUartFlowControlDevicePathNode ( IN UART_FLOW_CONTROL_DEVICE_PATH FlowControl)

Check the device path node whether it's the Flow Control node or not.

Parameters
[in]FlowControlThe device path node to be checked.
Return values
TRUEIt's the Flow Control node.
FALSEIt's not.

Definition at line 97 of file Serial.c.

◆ SerialComponentNameGetControllerName()

EFI_STATUS EFIAPI SerialComponentNameGetControllerName ( IN EFI_COMPONENT_NAME_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_HANDLE ChildHandle  OPTIONAL,
IN CHAR8 *  Language,
OUT CHAR16 **  ControllerName 
)

Retrieves a Unicode string that is the user readable name of the controller that is being managed by a driver.

This function retrieves the user readable name of the controller specified by ControllerHandle and ChildHandle in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the controller name is returned in ControllerName, and EFI_SUCCESS is returned. If the driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle, then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters
This[in]A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle[in]The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned.
ChildHandle[in]The handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to retrieve the name of the bus controller. It will not be NULL for a bus driver that wishes to retrieve the name of a child controller.
Language[in]A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
ControllerName[out]A pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by Language from the point of view of the driver specified by This.
Return values
EFI_SUCCESSThe Unicode string for the user readable name in the language specified by Language for the driver specified by This was returned in DriverName.
EFI_INVALID_PARAMETERControllerHandle is NULL.
EFI_INVALID_PARAMETERChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERControllerName is NULL.
EFI_UNSUPPORTEDThe driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Definition at line 166 of file ComponentName.c.

◆ SerialComponentNameGetDriverName()

EFI_STATUS EFIAPI SerialComponentNameGetDriverName ( IN EFI_COMPONENT_NAME_PROTOCOL This,
IN CHAR8 *  Language,
OUT CHAR16 **  DriverName 
)

Retrieves a Unicode string that is the user readable name of the driver.

This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters
This[in]A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
Language[in]A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
DriverName[out]A pointer to the Unicode string to return. This Unicode string is the name of the driver specified by This in the language specified by Language.
Return values
EFI_SUCCESSThe Unicode string for the Driver specified by This and the language specified by Language was returned in DriverName.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERDriverName is NULL.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Definition at line 81 of file ComponentName.c.

◆ SerialControllerDriverStart()

EFI_STATUS EFIAPI SerialControllerDriverStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Start to management the controller passed in

Parameters
ThisA pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
ControllerThe handle of the controller to test.
RemainingDevicePathA pointer to the remaining portion of a device path.
Returns
EFI_SUCCESS Driver is started successfully

Definition at line 806 of file Serial.c.

◆ SerialControllerDriverStop()

EFI_STATUS EFIAPI SerialControllerDriverStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE ChildHandleBuffer 
)

Disconnect this driver with the controller, uninstall related protocol instance

Parameters
ThisA pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
ControllerThe handle of the controller to test.
NumberOfChildrenNumber of child device.
ChildHandleBufferA pointer to the remaining portion of a device path.
Return values
EFI_SUCCESSOperation successfully
EFI_DEVICE_ERRORCannot stop the driver successfully

Definition at line 1164 of file Serial.c.

◆ SerialControllerDriverSupported()

EFI_STATUS EFIAPI SerialControllerDriverSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Check to see if this driver supports the given controller

Parameters
ThisA pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
ControllerThe handle of the controller to test.
RemainingDevicePathA pointer to the remaining portion of a device path.
Returns
EFI_SUCCESS This driver can support the given controller

Definition at line 351 of file Serial.c.

◆ SerialFifoAdd()

EFI_STATUS SerialFifoAdd ( IN SERIAL_DEV_FIFO Fifo,
IN UINT8  Data 
)

Add data to specific FIFO.

Parameters
FifoA pointer to the Data Structure SERIAL_DEV_FIFO
Datathe data added to FIFO
Return values
EFI_SUCCESSAdd data to specific FIFO successfully
EFI_OUT_OF_RESOURCEFailed to add data because FIFO is already full

◆ SerialFifoEmpty()

BOOLEAN SerialFifoEmpty ( IN SERIAL_DEV_FIFO Fifo)

Detect whether specific FIFO is empty or not.

Parameters
FifoA pointer to the Data Structure SERIAL_DEV_FIFO
Returns
whether specific FIFO is empty or not

Definition at line 229 of file SerialIo.c.

◆ SerialFifoFull()

BOOLEAN SerialFifoFull ( IN SERIAL_DEV_FIFO Fifo)

Detect whether specific FIFO is full or not.

Parameters
FifoA pointer to the Data Structure SERIAL_DEV_FIFO
Returns
whether specific FIFO is full or not

Definition at line 214 of file SerialIo.c.

◆ SerialFifoRemove()

EFI_STATUS SerialFifoRemove ( IN SERIAL_DEV_FIFO Fifo,
OUT UINT8 *  Data 
)

Remove data from specific FIFO.

Parameters
FifoA pointer to the Data Structure SERIAL_DEV_FIFO
Datathe data removed from FIFO
Return values
EFI_SUCCESSRemove data from specific FIFO successfully
EFI_OUT_OF_RESOURCEFailed to remove data because FIFO is empty

◆ SerialGetControl()

EFI_STATUS EFIAPI SerialGetControl ( IN EFI_SERIAL_IO_PROTOCOL This,
OUT UINT32 *  Control 
)

Get ControlBits.

Parameters
ThisPointer to EFI_SERIAL_IO_PROTOCOL
ControlControl signals of the serial device
Return values
EFI_SUCCESSGet Control signals successfully

Retrieves the status of the control bits on a serial device

Parameters
ThisProtocol instance pointer.
ControlA pointer to return the current Control signals from the serial device.
Return values
EFI_SUCCESSThe control bits were read from the serial device.
EFI_DEVICE_ERRORThe serial device is not functioning correctly.

Get ControlBits.

Parameters
[in]ThisPointer to EFI_SERIAL_IO_PROTOCOL.
[out]ControlControl signals of the serial device.
Return values
EFI_SUCCESSGet Control signals successfully.

Definition at line 425 of file SerialIo.c.

◆ SerialPresent()

BOOLEAN SerialPresent ( IN SERIAL_DEV SerialDevice)

Use scratchpad register to test if this serial port is present.

Parameters
SerialDevicePointer to serial device structure
Returns
if this serial port is present

Definition at line 1318 of file SerialIo.c.

◆ SerialRead()

EFI_STATUS EFIAPI SerialRead ( IN EFI_SERIAL_IO_PROTOCOL This,
IN OUT UINTN BufferSize,
OUT VOID *  Buffer 
)

Read the specified number of bytes from serial device.

Parameters
ThisPointer to EFI_SERIAL_IO_PROTOCOL
BufferSizeOn input the size of Buffer, on output the amount of data returned in buffer
BufferThe buffer to return the data into
Return values
EFI_SUCCESSThe data were read successfully
EFI_DEVICE_ERRORThe device reported an error
EFI_TIMEOUTThe read operation was stopped due to timeout

Reads data from a serial device.

Parameters
ThisProtocol instance pointer.
BufferSizeOn input, the size of the Buffer. On output, the amount of data returned in Buffer.
BufferThe buffer to return the data into.
Return values
EFI_SUCCESSThe data was read.
EFI_DEVICE_ERRORThe device reported an error.
EFI_TIMEOUTThe data write was stopped due to a timeout.

Read the specified number of bytes from serial device.

Parameters
[in]ThisPointer to EFI_SERIAL_IO_PROTOCOL.
[in,out]BufferSizeOn input the size of Buffer, on output the amount of data returned in buffer.
[out]BufferThe buffer to return the data into.
Return values
EFI_SUCCESSThe data were read successfully.
EFI_DEVICE_ERRORThe device reported an error.
EFI_TIMEOUTThe read operation was stopped due to timeout.

Definition at line 481 of file SerialIo.c.

◆ SerialReadRegister()

UINT8 SerialReadRegister ( IN SERIAL_DEV SerialDev,
IN UINT32  Offset 
)

Read serial port.

Parameters
SerialDevPointer to serial device
OffsetOffset in register group
Returns
Data read from serial port

Definition at line 1361 of file SerialIo.c.

◆ SerialReceiveTransmit()

EFI_STATUS SerialReceiveTransmit ( IN SERIAL_DEV SerialDevice)

Reads and writes all available data.

Parameters
SerialDeviceThe device to flush
Return values
EFI_SUCCESSData was read/written successfully.
EFI_OUT_OF_RESOURCEFailed because software receive FIFO is full. Note, when this happens, pending writes are not done.

Reads and writes all available data.

Parameters
SerialDeviceThe device to transmit.
Return values
EFI_SUCCESSData was read/written successfully.
EFI_OUT_OF_RESOURCEFailed because software receive FIFO is full. Note, when this happens, pending writes are not done.

Definition at line 309 of file SerialIo.c.

◆ SerialReset()

EFI_STATUS EFIAPI SerialReset ( IN EFI_SERIAL_IO_PROTOCOL This)

Reset serial device.

Parameters
ThisPointer to EFI_SERIAL_IO_PROTOCOL
Return values
EFI_SUCCESSReset successfully
EFI_DEVICE_ERRORFailed to reset

Reset the serial device.

Parameters
ThisProtocol instance pointer.
Return values
EFI_SUCCESSThe device was reset.
EFI_DEVICE_ERRORThe serial device could not be reset.

Reset serial device.

Parameters
[in]ThisPointer to EFI_SERIAL_IO_PROTOCOL.
Return values
EFI_SUCCESSReset successfully.

Definition at line 217 of file SerialIo.c.

◆ SerialSetAttributes()

EFI_STATUS EFIAPI SerialSetAttributes ( IN EFI_SERIAL_IO_PROTOCOL This,
IN UINT64  BaudRate,
IN UINT32  ReceiveFifoDepth,
IN UINT32  Timeout,
IN EFI_PARITY_TYPE  Parity,
IN UINT8  DataBits,
IN EFI_STOP_BITS_TYPE  StopBits 
)

Set new attributes to a serial device.

Parameters
ThisPointer to EFI_SERIAL_IO_PROTOCOL
BaudRateThe baudrate of the serial device
ReceiveFifoDepthThe depth of receive FIFO buffer
TimeoutThe request timeout for a single char
ParityThe type of parity used in serial device
DataBitsNumber of databits used in serial device
StopBitsNumber of stopbits used in serial device
Return values
EFI_SUCCESSThe new attributes were set
EFI_INVALID_PARAMETERSOne or more attributes have an unsupported value
EFI_UNSUPPORTEDData Bits can not set to 5 or 6
EFI_DEVICE_ERRORThe serial device is not functioning correctly (no return)

Sets the baud rate, receive FIFO depth, transmit/receive time out, parity, data bits, and stop bits on a serial device.

Parameters
ThisProtocol instance pointer.
BaudRateThe requested baud rate. A BaudRate value of 0 will use the the device's default interface speed.
ReceiveFifoDepthThe requested depth of the FIFO on the receive side of the serial interface. A ReceiveFifoDepth value of 0 will use the device's default FIFO depth.
TimeoutThe requested time out for a single character in microseconds. This timeout applies to both the transmit and receive side of the interface. A Timeout value of 0 will use the device's default time out value.
ParityThe type of parity to use on this serial device. A Parity value of DefaultParity will use the device's default parity value.
DataBitsThe number of data bits to use on the serial device. A DataBits value of 0 will use the device's default data bit setting.
StopBitsThe number of stop bits to use on this serial device. A StopBits value of DefaultStopBits will use the device's default number of stop bits.
Return values
EFI_SUCCESSThe device was reset.
EFI_INVALID_PARAMETEROne or more attributes has an unsupported value.
EFI_DEVICE_ERRORThe serial device is not functioning correctly.

Set new attributes to a serial device.

Parameters
[in]ThisPointer to EFI_SERIAL_IO_PROTOCOL.
[in]BaudRateThe baudrate of the serial device.
[in]ReceiveFifoDepthThe depth of receive FIFO buffer.
[in]TimeoutThe request timeout for a single char.
[in]ParityThe type of parity used in serial device.
[in]DataBitsNumber of databits used in serial device.
[in]StopBitsNumber of stopbits used in serial device.
Return values
EFI_SUCCESSThe new attributes were set.
EFI_INVALID_PARAMETEROne or more attributes have an unsupported value.
EFI_DEVICE_ERRORThe serial device is not functioning correctly (no return).

Definition at line 282 of file SerialIo.c.

◆ SerialSetControl()

EFI_STATUS EFIAPI SerialSetControl ( IN EFI_SERIAL_IO_PROTOCOL This,
IN UINT32  Control 
)

Set Control Bits.

Parameters
ThisPointer to EFI_SERIAL_IO_PROTOCOL
ControlControl bits that can be settable
Return values
EFI_SUCCESSNew Control bits were set successfully
EFI_UNSUPPORTEDThe Control bits wanted to set are not supported

Set the control bits on a serial device

Parameters
ThisProtocol instance pointer.
ControlSet the bits of Control that are settable.
Return values
EFI_SUCCESSThe new control bits were set on the serial device.
EFI_UNSUPPORTEDThe serial device does not support this operation.
EFI_DEVICE_ERRORThe serial device is not functioning correctly.

Set Control Bits.

Parameters
[in]ThisPointer to EFI_SERIAL_IO_PROTOCOL.
[in]ControlControl bits that can be settable.
Return values
EFI_SUCCESSNew Control bits were set successfully.
EFI_UNSUPPORTEDThe Control bits wanted to set are not supported.

Definition at line 405 of file SerialIo.c.

◆ SerialWrite()

EFI_STATUS EFIAPI SerialWrite ( IN EFI_SERIAL_IO_PROTOCOL This,
IN OUT UINTN BufferSize,
IN VOID *  Buffer 
)

Write the specified number of bytes to serial device.

Parameters
ThisPointer to EFI_SERIAL_IO_PROTOCOL
BufferSizeOn input the size of Buffer, on output the amount of data actually written
BufferThe buffer of data to write
Return values
EFI_SUCCESSThe data were written successfully
EFI_DEVICE_ERRORThe device reported an error
EFI_TIMEOUTThe write operation was stopped due to timeout

Writes data to a serial device.

Parameters
ThisProtocol instance pointer.
BufferSizeOn input, the size of the Buffer. On output, the amount of data actually written.
BufferThe buffer of data to write
Return values
EFI_SUCCESSThe data was written.
EFI_DEVICE_ERRORThe device reported an error.
EFI_TIMEOUTThe data write was stopped due to a timeout.

Write the specified number of bytes to serial device.

Parameters
[in]ThisPointer to EFI_SERIAL_IO_PROTOCOL.
[in,out]BufferSizeOn input the size of Buffer, on output the amount of data actually written.
[in]BufferThe buffer of data to write.
Return values
EFI_SUCCESSThe data were written successfully.
EFI_DEVICE_ERRORThe device reported an error.
EFI_TIMEOUTThe write operation was stopped due to timeout.

Definition at line 448 of file SerialIo.c.

◆ SerialWriteRegister()

VOID SerialWriteRegister ( IN SERIAL_DEV SerialDev,
IN UINT32  Offset,
IN UINT8  Data 
)

Write serial port.

Parameters
SerialDevPointer to serial device
OffsetOffset in register group
Datadata which is to be written to some serial port register

Definition at line 1405 of file SerialIo.c.

◆ SkipControllerDevicePathNode()

UART_DEVICE_PATH * SkipControllerDevicePathNode ( EFI_DEVICE_PATH_PROTOCOL DevicePath,
BOOLEAN *  ContainsControllerNode,
UINT32 *  ControllerNumber 
)

Skip the optional Controller device path node and return the pointer to the next device path node.

Parameters
DevicePathPointer to the device path.
ContainsControllerNodeReturns TRUE if the Controller device path exists.
ControllerNumberReturns the Controller Number if Controller device path exists.
Returns
Pointer to the next device path node.

Definition at line 22 of file SerialIo.c.

◆ VerifyUartParameters()

BOOLEAN VerifyUartParameters ( IN UINT32  ClockRate,
IN UINT64  BaudRate,
IN UINT8  DataBits,
IN EFI_PARITY_TYPE  Parity,
IN EFI_STOP_BITS_TYPE  StopBits,
OUT UINT64 *  Divisor,
OUT UINT64 *  ActualBaudRate 
)

Checks whether the UART parameters are valid and computes the Divisor.

Parameters
ClockRateThe clock rate of the serial device used to verify the BaudRate. Do not verify the BaudRate if it's 0.
BaudRateThe requested baudrate of the serial device.
DataBitsNumber of databits used in serial device.
ParityThe type of parity used in serial device.
StopBitsNumber of stopbits used in serial device.
DivisorReturn the divisor if ClockRate is not 0.
ActualBaudRateReturn the actual supported baudrate without exceeding BaudRate. NULL means baudrate degradation is not allowed. If the requested BaudRate is not supported, the routine returns TRUE and the Actual Baud Rate when ActualBaudRate is not NULL, returns FALSE when ActualBaudRate is NULL.
Return values
TRUEThe UART parameters are valid.
FALSEThe UART parameters are not valid.

Definition at line 71 of file SerialIo.c.

Variable Documentation

◆ gPciSioSerialComponentName

EFI_COMPONENT_NAME_PROTOCOL gPciSioSerialComponentName
extern

Definition at line 14 of file ComponentName.c.

◆ gPciSioSerialComponentName2

EFI_COMPONENT_NAME2_PROTOCOL gPciSioSerialComponentName2
extern

Definition at line 23 of file ComponentName.c.

◆ gSerialControllerDriver

EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver
extern

Definition at line 15 of file Serial.c.