Home | History | Annotate | Line # | Download | only in protocol
      1 /*	$NetBSD: efidbg.h,v 1.1.1.1 2014/04/01 16:16:07 jakllsch Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1999, 2000
      5  * Intel Corporation.
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  *
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  *
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * 3. All advertising materials mentioning features or use of this software
     20  *    must display the following acknowledgement:
     21  *
     22  *    This product includes software developed by Intel Corporation and
     23  *    its contributors.
     24  *
     25  * 4. Neither the name of Intel Corporation or its contributors may be
     26  *    used to endorse or promote products derived from this software
     27  *    without specific prior written permission.
     28  *
     29  * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS''
     30  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     32  * ARE DISCLAIMED.  IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE
     33  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     34  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     35  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     36  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     37  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     38  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     39  * THE POSSIBILITY OF SUCH DAMAGE.
     40  *
     41  */
     42 
     43 
     44 #ifndef _EFIDBG_H_
     45 #define _EFIDBG_H_
     46 
     47 #include "eficontext.h"
     48 #include "efiser.h"
     49 
     50 typedef struct _DEBUGPORT_16550_CONFIG_DATA {
     51         UINT32							PortAddress;
     52         UINT64                          BaudRate;
     53     	UINT32               			ReceiveFifoDepth;
     54     	UINT32               			Timeout;
     55         UINT8                           Parity;
     56         UINT8                           DataBits;
     57         UINT8                           StopBits;
     58 	    UINT32                       	ControlMask;
     59         BOOLEAN							RtsCtsEnable;		// RTS, CTS control
     60 } DEBUGPORT_16550_CONFIG_DATA;
     61 
     62 typedef struct _DEBUGPORT_16550_DEVICE_PATH {
     63         EFI_DEVICE_PATH                 Header;
     64         DEBUGPORT_16550_CONFIG_DATA		ConfigData;
     65 } DEBUGPORT_16550_DEVICE_PATH;
     66 
     67 typedef union {
     68     EFI_DEVICE_PATH                     DevPath;
     69     DEBUGPORT_16550_DEVICE_PATH         Uart;
     70     // add new types of debugport device paths to this union...
     71 } DEBUGPORT_DEV_PATH;
     72 
     73 
     74 //
     75 // Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25}
     76 //
     77 
     78 #define DEBUG_SUPPORT_PROTOCOL \
     79 { 0x2755590C, 0x6F3C, 0x42fa, 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 }
     80 
     81 
     82 typedef UINTN EXCEPTION_TYPE;
     83 
     84 typedef
     85 VOID
     86 (*EXCEPTION_HANDLER) (
     87 	IN EXCEPTION_TYPE ExceptionType,
     88     IN SYSTEM_CONTEXT *SystemContext
     89     );
     90 
     91 typedef
     92 EFI_STATUS
     93 (EFIAPI *EFI_REGISTER_TIMER_TICK_CALLBACK) (
     94     IN struct _EFI_DEBUG_SUPPORT_INTERFACE  *This,
     95     IN EXCEPTION_HANDLER	                TimerTickCallback
     96     );
     97 
     98 typedef
     99 EFI_STATUS
    100 (EFIAPI *EFI_REGISTER_EXCEPTION_HANDLER) (
    101     IN     struct _EFI_DEBUG_SUPPORT_INTERFACE  *This,
    102     IN     EXCEPTION_HANDLER                    ExceptionHandler,
    103     IN     EXCEPTION_TYPE                       ExceptionType
    104     );
    105 
    106 typedef
    107 EFI_STATUS
    108 (EFIAPI *EFI_IP_CALL_TRACE) (
    109     IN     struct _EFI_DEBUG_SUPPORT_INTERFACE  *This
    110     );
    111 
    112 
    113 #define EFI_DEBUG_SUPPORT_INTERFACE_REVISION     0x00010000
    114 
    115 typedef struct _EFI_DEBUG_SUPPORT_INTERFACE {
    116     UINT32                          	Revision;
    117     EFI_REGISTER_TIMER_TICK_CALLBACK	RegisterTimerTickCallback;
    118     EFI_REGISTER_EXCEPTION_HANDLER  	RegisterExceptionHandler;
    119     EFI_IP_CALL_TRACE               	IpCallTrace;
    120 } EFI_DEBUG_SUPPORT_INTERFACE;
    121 
    122 
    123 //
    124 // Debugport io protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0}
    125 //
    126 
    127 #define DEBUGPORT_IO_PROTOCOL \
    128 { 0XEBA4E8D2, 0X3858, 0X41EC, 0XA2, 0X81, 0X26, 0X47, 0XBA, 0X96, 0X60, 0XD0 }
    129 
    130 
    131 typedef
    132 EFI_STATUS
    133 (EFIAPI *EFI_DEBUGPORT_IO_RESET) (
    134     IN struct _EFI_DEBUGPORT_IO_INTERFACE  	*This
    135     );
    136 
    137 typedef
    138 EFI_STATUS
    139 (EFIAPI *EFI_DEBUGPORT_IO_READ) (
    140     IN     struct _EFI_DEBUGPORT_IO_INTERFACE	*This,
    141     IN OUT UINTN                    		*BufferSize,
    142     OUT VOID                         		*Buffer
    143     );
    144 
    145 typedef
    146 EFI_STATUS
    147 (EFIAPI *EFI_DEBUGPORT_IO_WRITE) (
    148     IN     struct _EFI_DEBUGPORT_IO_INTERFACE *This,
    149     IN OUT UINTN                    		*BufferSize,
    150     IN VOID                         		*Buffer
    151     );
    152 
    153 #define EFI_DEBUGPORT_IO_INTERFACE_REVISION   0x00010000
    154 
    155 typedef struct _EFI_DEBUGPORT_IO_INTERFACE {
    156     UINT32                          		Revision;
    157     EFI_DEBUGPORT_IO_READ					Read;
    158     EFI_DEBUGPORT_IO_WRITE					Write;
    159     EFI_DEBUGPORT_IO_RESET					Reset;
    160 } EFI_DEBUGPORT_IO_INTERFACE;
    161 
    162 
    163 //
    164 // Debugport UART16550 control protocol {628EA978-4C26-4605-BC02-A42A496917DD}
    165 //
    166 
    167 #define DEBUGPORT_UART16550_CONTROL_PROTOCOL \
    168 { 0X628EA978, 0X4C26, 0X4605, 0XBC, 0X2, 0XA4, 0X2A, 0X49, 0X69, 0X17, 0XDD }
    169 
    170 // Note: The definitions for EFI_PARITY_TYPE, EFI_STOP_BITS_TYPE, and
    171 // SERIAL_IO_MODE are included from efiser.h
    172 
    173 typedef
    174 EFI_STATUS
    175 (EFIAPI *EFI_UART16550_SET_ATTRIBUTES) (
    176     IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE  	*This,
    177     IN UINT64                       	BaudRate,
    178     IN UINT32                       	ReceiveFifoDepth,
    179     IN UINT32                       	Timeout,
    180     IN EFI_PARITY_TYPE       			Parity,
    181     IN UINT8                        	DataBits,
    182     IN EFI_STOP_BITS_TYPE    			StopBits
    183     );
    184 
    185 typedef
    186 EFI_STATUS
    187 (EFIAPI *EFI_UART16550_SET_CONTROL_BITS) (
    188     IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE  	*This,
    189     IN UINT32                       	Control
    190     );
    191 
    192 typedef
    193 EFI_STATUS
    194 (EFIAPI *EFI_UART16550_GET_CONTROL_BITS) (
    195     IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE	*This,
    196     OUT UINT32                      	*Control
    197     );
    198 
    199 #define EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE_REVISION   0x00010000
    200 
    201 typedef struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE {
    202     UINT32                          	Revision;
    203 	EFI_UART16550_SET_ATTRIBUTES		SetAttributes;
    204 	EFI_UART16550_SET_CONTROL_BITS		SetControl;
    205 	EFI_UART16550_GET_CONTROL_BITS 		GetControl;
    206 	DEBUGPORT_16550_CONFIG_DATA			*Mode;
    207 } EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE;
    208 
    209 
    210 #define DEVICE_PATH_DEBUGPORT DEBUGPORT_IO_PROTOCOL
    211 
    212 #endif /* _EFIDBG_H_ */
    213