Home | History | Annotate | Line # | Download | only in inc
      1 /*	$NetBSD: efiser.h,v 1.1.1.2 2018/08/16 18:17:47 jmcneill Exp $	*/
      2 
      3 #ifndef _EFI_SER_H
      4 #define _EFI_SER_H
      5 
      6 /*++
      7 
      8 Copyright (c) 1998  Intel Corporation
      9 
     10 Module Name:
     11 
     12     efiser.h
     13 
     14 Abstract:
     15 
     16     EFI serial protocol
     17 
     18 Revision History
     19 
     20 --*/
     21 
     22 //
     23 // Serial protocol
     24 //
     25 
     26 #define EFI_SERIAL_IO_PROTOCOL_GUID \
     27     { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} }
     28 #define SERIAL_IO_PROTOCOL EFI_SERIAL_IO_PROTOCOL_GUID
     29 
     30 INTERFACE_DECL(_EFI_SERIAL_IO_PROTOCOL);
     31 
     32 typedef enum {
     33     DefaultParity,
     34     NoParity,
     35     EvenParity,
     36     OddParity,
     37     MarkParity,
     38     SpaceParity
     39 } EFI_PARITY_TYPE;
     40 
     41 typedef enum {
     42     DefaultStopBits,
     43     OneStopBit,         // 1 stop bit
     44     OneFiveStopBits,    // 1.5 stop bits
     45     TwoStopBits         // 2 stop bits
     46 } EFI_STOP_BITS_TYPE;
     47 
     48 #define EFI_SERIAL_CLEAR_TO_SEND                   0x0010  // RO
     49 #define EFI_SERIAL_DATA_SET_READY                  0x0020  // RO
     50 #define EFI_SERIAL_RING_INDICATE                   0x0040  // RO
     51 #define EFI_SERIAL_CARRIER_DETECT                  0x0080  // RO
     52 #define EFI_SERIAL_REQUEST_TO_SEND                 0x0002  // WO
     53 #define EFI_SERIAL_DATA_TERMINAL_READY             0x0001  // WO
     54 #define EFI_SERIAL_INPUT_BUFFER_EMPTY              0x0100  // RO
     55 #define EFI_SERIAL_OUTPUT_BUFFER_EMPTY             0x0200  // RO
     56 #define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE        0x1000  // RW
     57 #define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE        0x2000  // RW
     58 #define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE    0x4000  // RW
     59 
     60 typedef
     61 EFI_STATUS
     62 (EFIAPI *EFI_SERIAL_RESET) (
     63     IN struct _EFI_SERIAL_IO_PROTOCOL  *This
     64     );
     65 
     66 typedef
     67 EFI_STATUS
     68 (EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) (
     69     IN struct _EFI_SERIAL_IO_PROTOCOL  *This,
     70     IN UINT64                          BaudRate,
     71     IN UINT32                          ReceiveFifoDepth,
     72     IN UINT32                          Timeout,
     73     IN EFI_PARITY_TYPE                 Parity,
     74     IN UINT8                           DataBits,
     75     IN EFI_STOP_BITS_TYPE              StopBits
     76     );
     77 
     78 typedef
     79 EFI_STATUS
     80 (EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) (
     81     IN struct _EFI_SERIAL_IO_PROTOCOL  *This,
     82     IN UINT32                          Control
     83     );
     84 
     85 typedef
     86 EFI_STATUS
     87 (EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) (
     88     IN struct _EFI_SERIAL_IO_PROTOCOL  *This,
     89     OUT UINT32                         *Control
     90     );
     91 
     92 typedef
     93 EFI_STATUS
     94 (EFIAPI *EFI_SERIAL_WRITE) (
     95     IN struct _EFI_SERIAL_IO_PROTOCOL  *This,
     96     IN OUT UINTN                       *BufferSize,
     97     IN VOID                            *Buffer
     98     );
     99 
    100 typedef
    101 EFI_STATUS
    102 (EFIAPI *EFI_SERIAL_READ) (
    103     IN struct _EFI_SERIAL_IO_PROTOCOL  *This,
    104     IN OUT UINTN                       *BufferSize,
    105     OUT VOID                           *Buffer
    106     );
    107 
    108 typedef struct {
    109     UINT32                  ControlMask;
    110 
    111     // current Attributes
    112     UINT32                  Timeout;
    113     UINT64                  BaudRate;
    114     UINT32                  ReceiveFifoDepth;
    115     UINT32                  DataBits;
    116     UINT32                  Parity;
    117     UINT32                  StopBits;
    118 } SERIAL_IO_MODE;
    119 
    120 #define SERIAL_IO_INTERFACE_REVISION    0x00010000
    121 
    122 typedef struct _EFI_SERIAL_IO_PROTOCOL {
    123     UINT32                       Revision;
    124     EFI_SERIAL_RESET             Reset;
    125     EFI_SERIAL_SET_ATTRIBUTES    SetAttributes;
    126     EFI_SERIAL_SET_CONTROL_BITS  SetControl;
    127     EFI_SERIAL_GET_CONTROL_BITS  GetControl;
    128     EFI_SERIAL_WRITE             Write;
    129     EFI_SERIAL_READ              Read;
    130 
    131     SERIAL_IO_MODE               *Mode;
    132 } EFI_SERIAL_IO_PROTOCOL;
    133 
    134 typedef struct _EFI_SERIAL_IO_PROTOCOL _SERIAL_IO_INTERFACE;
    135 typedef EFI_SERIAL_IO_PROTOCOL SERIAL_IO_INTERFACE;
    136 
    137 #endif
    138 
    139