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