+++ /dev/null
-/** @file\r
- Include for Serial Driver\r
-\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef _SERIAL_H_\r
-#define _SERIAL_H_\r
-\r
-\r
-#include <FrameworkDxe.h>\r
-\r
-#include <Protocol/IsaIo.h>\r
-#include <Protocol/SerialIo.h>\r
-#include <Protocol/DevicePath.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/ReportStatusCodeLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-//\r
-// Driver Binding Externs\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gIsaSerialComponentName2;\r
-\r
-//\r
-// Internal Data Structures\r
-//\r
-#define SERIAL_DEV_SIGNATURE SIGNATURE_32 ('s', 'e', 'r', 'd')\r
-#define SERIAL_MAX_BUFFER_SIZE 16\r
-#define TIMEOUT_STALL_INTERVAL 10\r
-\r
-//\r
-// Name: SERIAL_DEV_FIFO\r
-// Purpose: To define Receive FIFO and Transmit FIFO\r
-// Context: Used by serial data transmit and receive\r
-// Fields:\r
-// First UINT32: The index of the first data in array Data[]\r
-// Last UINT32: The index, which you can put a new data into array Data[]\r
-// Surplus UINT32: Identify how many data you can put into array Data[]\r
-// Data[] UINT8 : An array, which used to store data\r
-//\r
-typedef struct {\r
- UINT32 First;\r
- UINT32 Last;\r
- UINT32 Surplus;\r
- UINT8 Data[SERIAL_MAX_BUFFER_SIZE];\r
-} SERIAL_DEV_FIFO;\r
-\r
-typedef enum {\r
- Uart8250 = 0,\r
- Uart16450 = 1,\r
- Uart16550 = 2,\r
- Uart16550A= 3\r
-} EFI_UART_TYPE;\r
-\r
-//\r
-// Name: SERIAL_DEV\r
-// Purpose: To provide device specific information\r
-// Context:\r
-// Fields:\r
-// Signature UINTN: The identity of the serial device\r
-// SerialIo SERIAL_IO_PROTOCOL: Serial I/O protocol interface\r
-// SerialMode SERIAL_IO_MODE:\r
-// DevicePath EFI_DEVICE_PATH_PROTOCOL *: Device path of the serial device\r
-// Handle EFI_HANDLE: The handle instance attached to serial device\r
-// BaseAddress UINT16: The base address of specific serial device\r
-// Receive SERIAL_DEV_FIFO: The FIFO used to store data,\r
-// which is received by UART\r
-// Transmit SERIAL_DEV_FIFO: The FIFO used to store data,\r
-// which you want to transmit by UART\r
-// SoftwareLoopbackEnable BOOLEAN:\r
-// Type EFI_UART_TYPE: Specify the UART type of certain serial device\r
-//\r
-typedef struct {\r
- UINTN Signature;\r
-\r
- EFI_HANDLE Handle;\r
- EFI_SERIAL_IO_PROTOCOL SerialIo;\r
- EFI_SERIAL_IO_MODE SerialMode;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
-\r
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
- UART_DEVICE_PATH UartDevicePath;\r
- EFI_ISA_IO_PROTOCOL *IsaIo;\r
-\r
- UINT16 BaseAddress;\r
- SERIAL_DEV_FIFO Receive;\r
- SERIAL_DEV_FIFO Transmit;\r
- BOOLEAN SoftwareLoopbackEnable;\r
- BOOLEAN HardwareFlowControl;\r
- EFI_UART_TYPE Type;\r
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
-} SERIAL_DEV;\r
-\r
-#define SERIAL_DEV_FROM_THIS(a) CR (a, SERIAL_DEV, SerialIo, SERIAL_DEV_SIGNATURE)\r
-\r
-//\r
-// Serial Driver Defaults\r
-//\r
-#define SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH 1\r
-#define SERIAL_PORT_DEFAULT_TIMEOUT 1000000\r
-#define SERIAL_PORT_SUPPORT_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \\r
- EFI_SERIAL_DATA_SET_READY | \\r
- EFI_SERIAL_RING_INDICATE | \\r
- EFI_SERIAL_CARRIER_DETECT | \\r
- EFI_SERIAL_REQUEST_TO_SEND | \\r
- EFI_SERIAL_DATA_TERMINAL_READY | \\r
- EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | \\r
- EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE | \\r
- EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE | \\r
- EFI_SERIAL_OUTPUT_BUFFER_EMPTY | \\r
- EFI_SERIAL_INPUT_BUFFER_EMPTY)\r
-\r
-//\r
-// 115200 baud with rounding errors\r
-//\r
-#define SERIAL_PORT_MAX_BAUD_RATE 115400\r
-#define SERIAL_PORT_MIN_BAUD_RATE 50\r
-\r
-#define SERIAL_PORT_MAX_RECEIVE_FIFO_DEPTH 16\r
-#define SERIAL_PORT_MIN_TIMEOUT 1 // 1 uS\r
-#define SERIAL_PORT_MAX_TIMEOUT 100000000 // 100 seconds\r
-//\r
-// UART Registers\r
-//\r
-#define SERIAL_REGISTER_THR 0 // WO Transmit Holding Register\r
-#define SERIAL_REGISTER_RBR 0 // RO Receive Buffer Register\r
-#define SERIAL_REGISTER_DLL 0 // R/W Divisor Latch LSB\r
-#define SERIAL_REGISTER_DLM 1 // R/W Divisor Latch MSB\r
-#define SERIAL_REGISTER_IER 1 // R/W Interrupt Enable Register\r
-#define SERIAL_REGISTER_IIR 2 // RO Interrupt Identification Register\r
-#define SERIAL_REGISTER_FCR 2 // WO FIFO Cotrol Register\r
-#define SERIAL_REGISTER_LCR 3 // R/W Line Control Register\r
-#define SERIAL_REGISTER_MCR 4 // R/W Modem Control Register\r
-#define SERIAL_REGISTER_LSR 5 // R/W Line Status Register\r
-#define SERIAL_REGISTER_MSR 6 // R/W Modem Status Register\r
-#define SERIAL_REGISTER_SCR 7 // R/W Scratch Pad Register\r
-#pragma pack(1)\r
-//\r
-// Name: SERIAL_PORT_IER_BITS\r
-// Purpose: Define each bit in Interrupt Enable Register\r
-// Context:\r
-// Fields:\r
-// Ravie Bit0: Receiver Data Available Interrupt Enable\r
-// Theie Bit1: Transmistter Holding Register Empty Interrupt Enable\r
-// Rie Bit2: Receiver Interrupt Enable\r
-// Mie Bit3: Modem Interrupt Enable\r
-// Reserved Bit4-Bit7: Reserved\r
-//\r
-typedef struct {\r
- UINT8 Ravie : 1;\r
- UINT8 Theie : 1;\r
- UINT8 Rie : 1;\r
- UINT8 Mie : 1;\r
- UINT8 Reserved : 4;\r
-} SERIAL_PORT_IER_BITS;\r
-\r
-//\r
-// Name: SERIAL_PORT_IER\r
-// Purpose:\r
-// Context:\r
-// Fields:\r
-// Bits SERIAL_PORT_IER_BITS: Bits of the IER\r
-// Data UINT8: the value of the IER\r
-//\r
-typedef union {\r
- SERIAL_PORT_IER_BITS Bits;\r
- UINT8 Data;\r
-} SERIAL_PORT_IER;\r
-\r
-//\r
-// Name: SERIAL_PORT_FCR_BITS\r
-// Purpose: Define each bit in FIFO Control Register\r
-// Context:\r
-// Fields:\r
-// TrFIFOE Bit0: Transmit and Receive FIFO Enable\r
-// ResetRF Bit1: Reset Reciever FIFO\r
-// ResetTF Bit2: Reset Transmistter FIFO\r
-// Dms Bit3: DMA Mode Select\r
-// Reserved Bit4-Bit5: Reserved\r
-// Rtb Bit6-Bit7: Receive Trigger Bits\r
-//\r
-typedef struct {\r
- UINT8 TrFIFOE : 1;\r
- UINT8 ResetRF : 1;\r
- UINT8 ResetTF : 1;\r
- UINT8 Dms : 1;\r
- UINT8 Reserved : 2;\r
- UINT8 Rtb : 2;\r
-} SERIAL_PORT_FCR_BITS;\r
-\r
-//\r
-// Name: SERIAL_PORT_FCR\r
-// Purpose:\r
-// Context:\r
-// Fields:\r
-// Bits SERIAL_PORT_FCR_BITS: Bits of the FCR\r
-// Data UINT8: the value of the FCR\r
-//\r
-typedef union {\r
- SERIAL_PORT_FCR_BITS Bits;\r
- UINT8 Data;\r
-} SERIAL_PORT_FCR;\r
-\r
-//\r
-// Name: SERIAL_PORT_LCR_BITS\r
-// Purpose: Define each bit in Line Control Register\r
-// Context:\r
-// Fields:\r
-// SerialDB Bit0-Bit1: Number of Serial Data Bits\r
-// StopB Bit2: Number of Stop Bits\r
-// ParEn Bit3: Parity Enable\r
-// EvenPar Bit4: Even Parity Select\r
-// SticPar Bit5: Sticky Parity\r
-// BrCon Bit6: Break Control\r
-// DLab Bit7: Divisor Latch Access Bit\r
-//\r
-typedef struct {\r
- UINT8 SerialDB : 2;\r
- UINT8 StopB : 1;\r
- UINT8 ParEn : 1;\r
- UINT8 EvenPar : 1;\r
- UINT8 SticPar : 1;\r
- UINT8 BrCon : 1;\r
- UINT8 DLab : 1;\r
-} SERIAL_PORT_LCR_BITS;\r
-\r
-//\r
-// Name: SERIAL_PORT_LCR\r
-// Purpose:\r
-// Context:\r
-// Fields:\r
-// Bits SERIAL_PORT_LCR_BITS: Bits of the LCR\r
-// Data UINT8: the value of the LCR\r
-//\r
-typedef union {\r
- SERIAL_PORT_LCR_BITS Bits;\r
- UINT8 Data;\r
-} SERIAL_PORT_LCR;\r
-\r
-//\r
-// Name: SERIAL_PORT_MCR_BITS\r
-// Purpose: Define each bit in Modem Control Register\r
-// Context:\r
-// Fields:\r
-// DtrC Bit0: Data Terminal Ready Control\r
-// Rts Bit1: Request To Send Control\r
-// Out1 Bit2: Output1\r
-// Out2 Bit3: Output2, used to disable interrupt\r
-// Lme; Bit4: Loopback Mode Enable\r
-// Reserved Bit5-Bit7: Reserved\r
-//\r
-typedef struct {\r
- UINT8 DtrC : 1;\r
- UINT8 Rts : 1;\r
- UINT8 Out1 : 1;\r
- UINT8 Out2 : 1;\r
- UINT8 Lme : 1;\r
- UINT8 Reserved : 3;\r
-} SERIAL_PORT_MCR_BITS;\r
-\r
-//\r
-// Name: SERIAL_PORT_MCR\r
-// Purpose:\r
-// Context:\r
-// Fields:\r
-// Bits SERIAL_PORT_MCR_BITS: Bits of the MCR\r
-// Data UINT8: the value of the MCR\r
-//\r
-typedef union {\r
- SERIAL_PORT_MCR_BITS Bits;\r
- UINT8 Data;\r
-} SERIAL_PORT_MCR;\r
-\r
-//\r
-// Name: SERIAL_PORT_LSR_BITS\r
-// Purpose: Define each bit in Line Status Register\r
-// Context:\r
-// Fields:\r
-// Dr Bit0: Receiver Data Ready Status\r
-// Oe Bit1: Overrun Error Status\r
-// Pe Bit2: Parity Error Status\r
-// Fe Bit3: Framing Error Status\r
-// Bi Bit4: Break Interrupt Status\r
-// Thre Bit5: Transmistter Holding Register Status\r
-// Temt Bit6: Transmitter Empty Status\r
-// FIFOe Bit7: FIFO Error Status\r
-//\r
-typedef struct {\r
- UINT8 Dr : 1;\r
- UINT8 Oe : 1;\r
- UINT8 Pe : 1;\r
- UINT8 Fe : 1;\r
- UINT8 Bi : 1;\r
- UINT8 Thre : 1;\r
- UINT8 Temt : 1;\r
- UINT8 FIFOe : 1;\r
-} SERIAL_PORT_LSR_BITS;\r
-\r
-//\r
-// Name: SERIAL_PORT_LSR\r
-// Purpose:\r
-// Context:\r
-// Fields:\r
-// Bits SERIAL_PORT_LSR_BITS: Bits of the LSR\r
-// Data UINT8: the value of the LSR\r
-//\r
-typedef union {\r
- SERIAL_PORT_LSR_BITS Bits;\r
- UINT8 Data;\r
-} SERIAL_PORT_LSR;\r
-\r
-//\r
-// Name: SERIAL_PORT_MSR_BITS\r
-// Purpose: Define each bit in Modem Status Register\r
-// Context:\r
-// Fields:\r
-// DeltaCTS Bit0: Delta Clear To Send Status\r
-// DeltaDSR Bit1: Delta Data Set Ready Status\r
-// TrailingEdgeRI Bit2: Trailing Edge of Ring Indicator Status\r
-// DeltaDCD Bit3: Delta Data Carrier Detect Status\r
-// Cts Bit4: Clear To Send Status\r
-// Dsr Bit5: Data Set Ready Status\r
-// Ri Bit6: Ring Indicator Status\r
-// Dcd Bit7: Data Carrier Detect Status\r
-//\r
-typedef struct {\r
- UINT8 DeltaCTS : 1;\r
- UINT8 DeltaDSR : 1;\r
- UINT8 TrailingEdgeRI : 1;\r
- UINT8 DeltaDCD : 1;\r
- UINT8 Cts : 1;\r
- UINT8 Dsr : 1;\r
- UINT8 Ri : 1;\r
- UINT8 Dcd : 1;\r
-} SERIAL_PORT_MSR_BITS;\r
-\r
-//\r
-// Name: SERIAL_PORT_MSR\r
-// Purpose:\r
-// Context:\r
-// Fields:\r
-// Bits SERIAL_PORT_MSR_BITS: Bits of the MSR\r
-// Data UINT8: the value of the MSR\r
-//\r
-typedef union {\r
- SERIAL_PORT_MSR_BITS Bits;\r
- UINT8 Data;\r
-} SERIAL_PORT_MSR;\r
-\r
-#pragma pack()\r
-//\r
-// Define serial register I/O macros\r
-//\r
-#define READ_RBR(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_RBR)\r
-#define READ_DLL(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_DLL)\r
-#define READ_DLM(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_DLM)\r
-#define READ_IER(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_IER)\r
-#define READ_IIR(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_IIR)\r
-#define READ_LCR(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_LCR)\r
-#define READ_MCR(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_MCR)\r
-#define READ_LSR(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_LSR)\r
-#define READ_MSR(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_MSR)\r
-#define READ_SCR(IO, B) IsaSerialReadPort (IO, B, SERIAL_REGISTER_SCR)\r
-\r
-#define WRITE_THR(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_THR, D)\r
-#define WRITE_DLL(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_DLL, D)\r
-#define WRITE_DLM(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_DLM, D)\r
-#define WRITE_IER(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_IER, D)\r
-#define WRITE_FCR(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_FCR, D)\r
-#define WRITE_LCR(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_LCR, D)\r
-#define WRITE_MCR(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_MCR, D)\r
-#define WRITE_LSR(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_LSR, D)\r
-#define WRITE_MSR(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_MSR, D)\r
-#define WRITE_SCR(IO, B, D) IsaSerialWritePort (IO, B, SERIAL_REGISTER_SCR, D)\r
-\r
-//\r
-// Prototypes\r
-// Driver model protocol interface\r
-//\r
-/**\r
- Check to see if this driver supports the given controller\r
-\r
- @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
- @param Controller The handle of the controller to test.\r
- @param RemainingDevicePath A pointer to the remaining portion of a device path.\r
-\r
- @return EFI_SUCCESS This driver can support the given controller\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SerialControllerDriverSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Start to management the controller passed in\r
-\r
- @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
- @param Controller The handle of the controller to test.\r
- @param RemainingDevicePath A pointer to the remaining portion of a device path.\r
-\r
- @return EFI_SUCCESS Driver is started successfully\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SerialControllerDriverStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Disconnect this driver with the controller, uninstall related protocol instance\r
-\r
- @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
- @param Controller The handle of the controller to test.\r
- @param NumberOfChildren Number of child device.\r
- @param ChildHandleBuffer A pointer to the remaining portion of a device path.\r
-\r
- @retval EFI_SUCCESS Operation successfully\r
- @retval EFI_DEVICE_ERROR Cannot stop the driver successfully\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SerialControllerDriverStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-//\r
-// Serial I/O Protocol Interface\r
-//\r
-/**\r
- Reset serial device.\r
-\r
- @param This Pointer to EFI_SERIAL_IO_PROTOCOL\r
-\r
- @retval EFI_SUCCESS Reset successfully\r
- @retval EFI_DEVICE_ERROR Failed to reset\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaSerialReset (\r
- IN EFI_SERIAL_IO_PROTOCOL *This\r
- );\r
-\r
-/**\r
- Set new attributes to a serial device.\r
-\r
- @param This Pointer to EFI_SERIAL_IO_PROTOCOL\r
- @param BaudRate The baudrate of the serial device\r
- @param ReceiveFifoDepth The depth of receive FIFO buffer\r
- @param Timeout The request timeout for a single char\r
- @param Parity The type of parity used in serial device\r
- @param DataBits Number of databits used in serial device\r
- @param StopBits Number of stopbits used in serial device\r
-\r
- @retval EFI_SUCCESS The new attributes were set\r
- @retval EFI_INVALID_PARAMETERS One or more attributes have an unsupported value\r
- @retval EFI_UNSUPPORTED Data Bits can not set to 5 or 6\r
- @retval EFI_DEVICE_ERROR The serial device is not functioning correctly (no return)\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaSerialSetAttributes (\r
- IN EFI_SERIAL_IO_PROTOCOL *This,\r
- IN UINT64 BaudRate,\r
- IN UINT32 ReceiveFifoDepth,\r
- IN UINT32 Timeout,\r
- IN EFI_PARITY_TYPE Parity,\r
- IN UINT8 DataBits,\r
- IN EFI_STOP_BITS_TYPE StopBits\r
- );\r
-\r
-/**\r
- Set Control Bits.\r
-\r
- @param This Pointer to EFI_SERIAL_IO_PROTOCOL\r
- @param Control Control bits that can be settable\r
-\r
- @retval EFI_SUCCESS New Control bits were set successfully\r
- @retval EFI_UNSUPPORTED The Control bits wanted to set are not supported\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaSerialSetControl (\r
- IN EFI_SERIAL_IO_PROTOCOL *This,\r
- IN UINT32 Control\r
- );\r
-\r
-/**\r
- Get ControlBits.\r
-\r
- @param This Pointer to EFI_SERIAL_IO_PROTOCOL\r
- @param Control Control signals of the serial device\r
-\r
- @retval EFI_SUCCESS Get Control signals successfully\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaSerialGetControl (\r
- IN EFI_SERIAL_IO_PROTOCOL *This,\r
- OUT UINT32 *Control\r
- );\r
-\r
-/**\r
- Write the specified number of bytes to serial device.\r
-\r
- @param This Pointer to EFI_SERIAL_IO_PROTOCOL\r
- @param BufferSize On input the size of Buffer, on output the amount of\r
- data actually written\r
- @param Buffer The buffer of data to write\r
-\r
- @retval EFI_SUCCESS The data were written successfully\r
- @retval EFI_DEVICE_ERROR The device reported an error\r
- @retval EFI_TIMEOUT The write operation was stopped due to timeout\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaSerialWrite (\r
- IN EFI_SERIAL_IO_PROTOCOL *This,\r
- IN OUT UINTN *BufferSize,\r
- IN VOID *Buffer\r
- );\r
-\r
-/**\r
- Read the specified number of bytes from serial device.\r
-\r
- @param This Pointer to EFI_SERIAL_IO_PROTOCOL\r
- @param BufferSize On input the size of Buffer, on output the amount of\r
- data returned in buffer\r
- @param Buffer The buffer to return the data into\r
-\r
- @retval EFI_SUCCESS The data were read successfully\r
- @retval EFI_DEVICE_ERROR The device reported an error\r
- @retval EFI_TIMEOUT The read operation was stopped due to timeout\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaSerialRead (\r
- IN EFI_SERIAL_IO_PROTOCOL *This,\r
- IN OUT UINTN *BufferSize,\r
- OUT VOID *Buffer\r
- );\r
-\r
-//\r
-// Internal Functions\r
-//\r
-/**\r
- Use scratchpad register to test if this serial port is present.\r
-\r
- @param SerialDevice Pointer to serial device structure\r
-\r
- @return if this serial port is present\r
-**/\r
-BOOLEAN\r
-IsaSerialPortPresent (\r
- IN SERIAL_DEV *SerialDevice\r
- );\r
-\r
-/**\r
- Detect whether specific FIFO is full or not.\r
-\r
- @param Fifo A pointer to the Data Structure SERIAL_DEV_FIFO\r
-\r
- @return whether specific FIFO is full or not\r
-\r
-**/\r
-BOOLEAN\r
-IsaSerialFifoFull (\r
- IN SERIAL_DEV_FIFO *Fifo\r
- );\r
-\r
-/**\r
- Detect whether specific FIFO is empty or not.\r
-\r
- @param Fifo A pointer to the Data Structure SERIAL_DEV_FIFO\r
-\r
- @return whether specific FIFO is empty or not\r
-\r
-**/\r
-BOOLEAN\r
-IsaSerialFifoEmpty (\r
- IN SERIAL_DEV_FIFO *Fifo\r
- );\r
-\r
-/**\r
- Add data to specific FIFO.\r
-\r
- @param Fifo A pointer to the Data Structure SERIAL_DEV_FIFO\r
- @param Data the data added to FIFO\r
-\r
- @retval EFI_SUCCESS Add data to specific FIFO successfully\r
- @retval EFI_OUT_OF_RESOURCE Failed to add data because FIFO is already full\r
-\r
-**/\r
-EFI_STATUS\r
-IsaSerialFifoAdd (\r
- IN SERIAL_DEV_FIFO *Fifo,\r
- IN UINT8 Data\r
- );\r
-\r
-/**\r
- Remove data from specific FIFO.\r
-\r
- @param Fifo A pointer to the Data Structure SERIAL_DEV_FIFO\r
- @param Data the data removed from FIFO\r
-\r
- @retval EFI_SUCCESS Remove data from specific FIFO successfully\r
- @retval EFI_OUT_OF_RESOURCE Failed to remove data because FIFO is empty\r
-\r
-**/\r
-EFI_STATUS\r
-IsaSerialFifoRemove (\r
- IN SERIAL_DEV_FIFO *Fifo,\r
- OUT UINT8 *Data\r
- );\r
-\r
-/**\r
- Reads and writes all avaliable data.\r
-\r
- @param SerialDevice The device to flush\r
-\r
- @retval EFI_SUCCESS Data was read/written successfully.\r
- @retval EFI_OUT_OF_RESOURCE Failed because software receive FIFO is full. Note, when\r
- this happens, pending writes are not done.\r
-\r
-**/\r
-EFI_STATUS\r
-IsaSerialReceiveTransmit (\r
- IN SERIAL_DEV *SerialDevice\r
- );\r
-\r
-/**\r
- Use IsaIo protocol to read serial port.\r
-\r
- @param IsaIo Pointer to EFI_ISA_IO_PROTOCOL instance\r
- @param BaseAddress Serial port register group base address\r
- @param Offset Offset in register group\r
-\r
- @return Data read from serial port\r
-\r
-**/\r
-UINT8\r
-IsaSerialReadPort (\r
- IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
- IN UINT16 BaseAddress,\r
- IN UINT32 Offset\r
- );\r
-\r
-/**\r
- Use IsaIo protocol to write serial port.\r
-\r
- @param IsaIo Pointer to EFI_ISA_IO_PROTOCOL instance\r
- @param BaseAddress Serial port register group base address\r
- @param Offset Offset in register group\r
- @param Data data which is to be written to some serial port register\r
-\r
-**/\r
-VOID\r
-IsaSerialWritePort (\r
- IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
- IN UINT16 BaseAddress,\r
- IN UINT32 Offset,\r
- IN UINT8 Data\r
- );\r
-\r
-\r
-//\r
-// EFI Component Name Functions\r
-//\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the driver.\r
-\r
- This function retrieves the user readable name of a driver in the form of a\r
- Unicode string. If the driver specified by This has a user readable name in\r
- the language specified by Language, then a pointer to the driver name is\r
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
- by This does not support the language specified by Language,\r
- then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified\r
- in RFC 4646 or ISO 639-2 language code format.\r
-\r
- @param DriverName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- driver specified by This in the language\r
- specified by Language.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
- This and the language specified by Language was\r
- returned in DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaSerialComponentNameGetDriverName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **DriverName\r
- );\r
-\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param ControllerHandle[in] The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
-\r
- @param ChildHandle[in] The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 4646 or ISO 639-2 language code format.\r
-\r
- @param ControllerName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaSerialComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-/**\r
- Add the component name for the serial io device\r
-\r
- @param SerialDevice A pointer to the SERIAL_DEV instance.\r
-\r
- @param IsaIo A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
-\r
-**/\r
-VOID\r
-AddName (\r
- IN SERIAL_DEV *SerialDevice,\r
- IN EFI_ISA_IO_PROTOCOL *IsaIo\r
- );\r
-\r
-#endif\r