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