]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h
Clean up code
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / IsaSerialDxe / Serial.h
index 6bef39b48b3bfb7505563f4278248b7f10ac98b5..deb79265264c4ff5c186a32f335c3bef0775c1b4 100644 (file)
@@ -1,47 +1,29 @@
-/*++\r
-\r
-  Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-\r
-Module Name:\r
-\r
-  serial.h\r
+/** @file\r
+  Include for Serial Driver\r
+  \r
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
 \r
-Abstract:\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-  Include for Serial Driver\r
+**/\r
 \r
-Revision History:\r
+#ifndef _SERIAL_H_\r
+#define _SERIAL_H_\r
 \r
---*/\r
 \r
-#ifndef _SERIAL_H\r
-#define _SERIAL_H\r
+#include <FrameworkDxe.h>\r
 \r
-//\r
-// The package level header files this module uses\r
-//\r
-#include <PiDxe.h>\r
-#include <FrameworkPei.h>\r
-//\r
-// The protocols, PPI and GUID defintions for this module\r
-//\r
 #include <Protocol/IsaIo.h>\r
 #include <Protocol/SerialIo.h>\r
 #include <Protocol/DevicePath.h>\r
-//\r
-// The Library classes this module consumes\r
-//\r
+\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/BaseLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
@@ -49,16 +31,18 @@ Revision History:
 #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_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    EFI_SIGNATURE_32 ('s', 'e', 'r', 'd')\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
@@ -80,10 +64,10 @@ typedef struct {
 } SERIAL_DEV_FIFO;\r
 \r
 typedef enum {\r
-  UART8250  = 0,\r
-  UART16450 = 1,\r
-  UART16550 = 2,\r
-  UART16550A= 3\r
+  Uart8250  = 0,\r
+  Uart16450 = 1,\r
+  Uart16550 = 2,\r
+  Uart16550A= 3\r
 } EFI_UART_TYPE;\r
 \r
 //\r
@@ -125,26 +109,16 @@ typedef struct {
   EFI_UNICODE_STRING_TABLE               *ControllerNameTable;\r
 } SERIAL_DEV;\r
 \r
-#include "ComponentName.h"\r
-\r
 #define SERIAL_DEV_FROM_THIS(a) CR (a, SERIAL_DEV, SerialIo, SERIAL_DEV_SIGNATURE)\r
 \r
-//\r
-// Globale Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL  gSerialControllerDriver;\r
-\r
 //\r
 // Serial Driver Defaults\r
 //\r
-#define SERIAL_PORT_DEFAULT_BAUD_RATE           115200\r
 #define SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH  1\r
 #define SERIAL_PORT_DEFAULT_TIMEOUT             1000000\r
-#define SERIAL_PORT_DEFAULT_PARITY              NoParity\r
-#define SERIAL_PORT_DEFAULT_DATA_BITS           8\r
-#define SERIAL_PORT_DEFAULT_STOP_BITS           1\r
 #define SERIAL_PORT_DEFAULT_CONTROL_MASK        0\r
 \r
+\r
 //\r
 // (24000000/13)MHz input clock\r
 //\r
@@ -180,17 +154,17 @@ extern EFI_DRIVER_BINDING_PROTOCOL  gSerialControllerDriver;
 //  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
+//     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 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
@@ -207,55 +181,25 @@ typedef union {
   UINT8                 Data;\r
 } SERIAL_PORT_IER;\r
 \r
-//\r
-//  Name:   SERIAL_PORT_IIR_BITS\r
-//  Purpose:  Define each bit in Interrupt Identification Register\r
-//  Context:\r
-//  Fields:\r
-//      IPS    Bit0: Interrupt Pending Status\r
-//      IIB    Bit1-Bit3: Interrupt ID Bits\r
-//      Reserved Bit4-Bit5: Reserved\r
-//      FIFOES   Bit6-Bit7: FIFO Mode Enable Status\r
-//\r
-typedef struct {\r
-  UINT8 IPS : 1;\r
-  UINT8 IIB : 3;\r
-  UINT8 Reserved : 2;\r
-  UINT8 FIFOES : 2;\r
-} SERIAL_PORT_IIR_BITS;\r
-\r
-//\r
-//  Name:   SERIAL_PORT_IIR\r
-//  Purpose:\r
-//  Context:\r
-//  Fields:\r
-//      Bits    SERIAL_PORT_IIR_BITS:  Bits of the IIR\r
-//      Data    UINT8: the value of the IIR\r
-//\r
-typedef union {\r
-  SERIAL_PORT_IIR_BITS  Bits;\r
-  UINT8                 Data;\r
-} SERIAL_PORT_IIR;\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
+//      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
+//      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 TrFIFOE : 1;\r
+  UINT8 ResetRF : 1;\r
+  UINT8 ResetTF : 1;\r
+  UINT8 Dms : 1;\r
   UINT8 Reserved : 2;\r
-  UINT8 RTB : 2;\r
+  UINT8 Rtb : 2;\r
 } SERIAL_PORT_FCR_BITS;\r
 \r
 //\r
@@ -276,22 +220,22 @@ typedef union {
 //  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
+//      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
+  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
@@ -312,19 +256,19 @@ typedef union {
 //  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
+//      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 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
@@ -346,24 +290,24 @@ typedef union {
 //  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
+//      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
+  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
@@ -388,20 +332,20 @@ typedef union {
 //      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
+//      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
+  UINT8 Cts : 1;\r
+  UINT8 Dsr : 1;\r
+  UINT8 Ri : 1;\r
+  UINT8 Dcd : 1;\r
 } SERIAL_PORT_MSR_BITS;\r
 \r
 //\r
@@ -447,7 +391,16 @@ typedef union {
 // 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
@@ -456,6 +409,15 @@ SerialControllerDriverSupported (
   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
@@ -464,6 +426,18 @@ SerialControllerDriverStart (
   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
@@ -476,12 +450,38 @@ SerialControllerDriverStop (
 //\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
@@ -494,6 +494,16 @@ IsaSerialSetAttributes (
   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
@@ -501,6 +511,15 @@ IsaSerialSetControl (
   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
@@ -508,6 +527,19 @@ IsaSerialGetControl (
   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
@@ -516,6 +548,19 @@ IsaSerialWrite (
   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
@@ -527,38 +572,101 @@ IsaSerialRead (
 //\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
@@ -566,6 +674,15 @@ IsaSerialReadPort (
   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
@@ -574,4 +691,148 @@ IsaSerialWritePort (
   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 not a valid EFI_HANDLE.\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