VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/SourceLevelDebugPkg/Include/TransferProtocol.h@ 58459

最後變更 在這個檔案從58459是 58459,由 vboxsync 提交於 9 年 前

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

  • 屬性 svn:eol-style 設為 native
檔案大小: 12.7 KB
 
1/** @file
2 Transfer protocol defintions used by debug agent and host. It is only
3 intended to be used by Debug related module implementation.
4
5 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14**/
15
16#ifndef __TRANSFER_PROTOCOL_H__
17#define __TRANSFER_PROTOCOL_H__
18
19#include "ProcessorContext.h"
20
21//
22// Current revision of transfer protocol
23//
24#define DEBUG_AGENT_REVISION ((0 << 16) | 03)
25#define DEBUG_AGENT_CAPABILITIES 0
26
27//
28// Definitions for attach command
29//
30#define DEBUG_STARTING_SYMBOL_ATTACH (0xFA)
31
32//
33// Definition for starting symbol of a normal debug packet. Choose a non-ASCII to avoid conflict with other serial output.
34//
35#define DEBUG_STARTING_SYMBOL_NORMAL (0xFE)
36
37#pragma pack(1)
38
39//
40// Definition for debug packet header for normal debug packets (not including break/attach command)
41//
42typedef struct {
43 UINT8 StartSymbol;
44 UINT8 Command;
45 UINT8 Length; // Length of Debug Packet including header and payload in byte
46 UINT8 SequenceNo;
47 UINT16 Crc;
48} DEBUG_PACKET_HEADER;
49
50//
51// Definition for Command field for debug packets
52//
53#define DEBUG_COMMAND_REQUEST (0 << 7)
54#define DEBUG_COMMAND_RESPONSE (1 << 7)
55
56//
57// HOST initiated commands
58//
59#define DEBUG_COMMAND_RESET (DEBUG_COMMAND_REQUEST | 0x00)
60#define DEBUG_COMMAND_GO (DEBUG_COMMAND_REQUEST | 0x01)
61#define DEBUG_COMMAND_BREAK_CAUSE (DEBUG_COMMAND_REQUEST | 0x02)
62#define DEBUG_COMMAND_SET_HW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x03)
63#define DEBUG_COMMAND_CLEAR_HW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x04)
64#define DEBUG_COMMAND_SINGLE_STEPPING (DEBUG_COMMAND_REQUEST | 0x05)
65#define DEBUG_COMMAND_SET_SW_BREAKPOINT (DEBUG_COMMAND_REQUEST | 0x06)
66#define DEBUG_COMMAND_READ_MEMORY (DEBUG_COMMAND_REQUEST | 0x07)
67#define DEBUG_COMMAND_WRITE_MEMORY (DEBUG_COMMAND_REQUEST | 0x08)
68#define DEBUG_COMMAND_READ_IO (DEBUG_COMMAND_REQUEST | 0x09)
69#define DEBUG_COMMAND_WRITE_IO (DEBUG_COMMAND_REQUEST | 0x0A)
70#define DEBUG_COMMAND_READ_REGISTER (DEBUG_COMMAND_REQUEST | 0x0B)
71#define DEBUG_COMMAND_WRITE_REGISTER (DEBUG_COMMAND_REQUEST | 0x0C)
72#define DEBUG_COMMAND_READ_ALL_REGISTERS (DEBUG_COMMAND_REQUEST | 0x0D)
73#define DEBUG_COMMAND_ARCH_MODE (DEBUG_COMMAND_REQUEST | 0x0E)
74#define DEBUG_COMMAND_READ_MSR (DEBUG_COMMAND_REQUEST | 0x0F)
75#define DEBUG_COMMAND_WRITE_MSR (DEBUG_COMMAND_REQUEST | 0x10)
76#define DEBUG_COMMAND_SET_DEBUG_SETTING (DEBUG_COMMAND_REQUEST | 0x11)
77#define DEBUG_COMMAND_GET_REVISION (DEBUG_COMMAND_REQUEST | 0x12)
78#define DEBUG_COMMAND_GET_EXCEPTION (DEBUG_COMMAND_REQUEST | 0x13)
79#define DEBUG_COMMAND_SET_VIEWPOINT (DEBUG_COMMAND_REQUEST | 0x14)
80#define DEBUG_COMMAND_GET_VIEWPOINT (DEBUG_COMMAND_REQUEST | 0x15)
81#define DEBUG_COMMAND_DETACH (DEBUG_COMMAND_REQUEST | 0x16)
82#define DEBUG_COMMAND_CPUID (DEBUG_COMMAND_REQUEST | 0x17)
83#define DEBUG_COMMAND_SEARCH_SIGNATURE (DEBUG_COMMAND_REQUEST | 0x18)
84#define DEBUG_COMMAND_HALT (DEBUG_COMMAND_REQUEST | 0x19)
85
86//
87// TARGET initiated commands
88//
89#define DEBUG_COMMAND_INIT_BREAK (DEBUG_COMMAND_REQUEST | 0x3F)
90#define DEBUG_COMMAND_BREAK_POINT (DEBUG_COMMAND_REQUEST | 0x3E)
91#define DEBUG_COMMAND_MEMORY_READY (DEBUG_COMMAND_REQUEST | 0x3D)
92#define DEBUG_COMMAND_PRINT_MESSAGE (DEBUG_COMMAND_REQUEST | 0x3C)
93#define DEBUG_COMMAND_ATTACH_BREAK (DEBUG_COMMAND_REQUEST | 0x3B)
94
95//
96// Response commands
97//
98#define DEBUG_COMMAND_OK (DEBUG_COMMAND_RESPONSE | 0x00)
99#define DEBUG_COMMAND_RESEND (DEBUG_COMMAND_RESPONSE | 0x01)
100#define DEBUG_COMMAND_ABORT (DEBUG_COMMAND_RESPONSE | 0x02)
101//
102// The below 2 commands are used when transferring big data (like > ~250 bytes).
103// The sequence is:
104// HOST TARGET
105// Request =>
106// <= IN_PROGRESS with partial data
107// CONTINUE =>
108// (could have multiple IN_PROGRESS and CONTINUE interactions)
109// <= OK with the last part of data
110// OK (no data as ACK) =>
111//
112#define DEBUG_COMMAND_IN_PROGRESS (DEBUG_COMMAND_RESPONSE | 0x03)
113#define DEBUG_COMMAND_CONTINUE (DEBUG_COMMAND_RESPONSE | 0x04)
114//
115// The below 2 commands are used to support deferred halt:
116// TARGET returns HALT_DEFERRED when it receives a HALT request in inter-active mode.
117// TARGET returns HALT_PROCESSED when it receives a GO request and has a pending HALT request.
118//
119#define DEBUG_COMMAND_HALT_DEFERRED (DEBUG_COMMAND_RESPONSE | 0x05)
120#define DEBUG_COMMAND_HALT_PROCESSED (DEBUG_COMMAND_RESPONSE | 0x06)
121
122#define DEBUG_COMMAND_TIMEOUT (DEBUG_COMMAND_RESPONSE | 0x07)
123#define DEBUG_COMMAND_NOT_SUPPORTED (DEBUG_COMMAND_RESPONSE | 0x0F)
124
125//
126// Definition for data field for debug packets
127//
128#define DEBUG_DATA_UPPER_LIMIT 0xff // Upper limit for the data size, by the limit of the packet header definition.
129
130#define DEBUG_DATA_MAXIMUM_REAL_DATA (DEBUG_DATA_UPPER_LIMIT - sizeof (DEBUG_PACKET_HEADER))
131
132//
133// Response data for DEBUG_COMMAND_BREAK_CAUSE
134//
135typedef struct {
136 UINT8 Cause;
137 UINT64 StopAddress;
138} DEBUG_DATA_RESPONSE_BREAK_CAUSE;
139//
140// Break type defintions for DEBUG_DATA_BREAK_CAUSE
141//
142#define DEBUG_DATA_BREAK_CAUSE_UNKNOWN 0
143#define DEBUG_DATA_BREAK_CAUSE_HW_BREAKPOINT 1
144#define DEBUG_DATA_BREAK_CAUSE_STEPPING 2
145#define DEBUG_DATA_BREAK_CAUSE_SW_BREAKPOINT 3
146#define DEBUG_DATA_BREAK_CAUSE_USER_HALT 4
147#define DEBUG_DATA_BREAK_CAUSE_IMAGE_LOAD 5
148#define DEBUG_DATA_BREAK_CAUSE_IMAGE_UNLOAD 6
149#define DEBUG_DATA_BREAK_CAUSE_SYSTEM_RESET 7
150#define DEBUG_DATA_BREAK_CAUSE_EXCEPTION 8
151#define DEBUG_DATA_BREAK_CAUSE_MEMORY_READY 9
152
153//
154// Response data for DEBUG_COMMAND_ARCH_MODE, defined as SOFT_DEBUGGER_PROCESSOR_...
155//
156typedef struct {
157 UINT8 CpuMode;
158} DEBUG_DATA_RESPONSE_ARCH_MODE;
159//
160// Cpu architecture defintions for DEBUG_DATA_RESPONSE_ARCH_MODE
161//
162#define DEBUG_DATA_BREAK_CPU_ARCH_IA16 0
163#define DEBUG_DATA_BREAK_CPU_ARCH_IA32 1
164#define DEBUG_DATA_BREAK_CPU_ARCH_X64 2
165
166typedef struct {
167 UINT8 Length:2; // Refer to below DEBUG_DATA_BREAKPOINT_LENGTH_XX macros
168 UINT8 Access:2; // Refer to below DEBUG_DATA_BREAKPOINT_ACCESS_XX macros
169 UINT8 Index:2; // Index of debug register
170 UINT8 Reserved:2;
171} DEBUG_DATA_BREAKPOINT_TYPE;
172#define DEBUG_DATA_BREAKPOINT_MEMORY_ACCESS (0x3)
173#define DEBUG_DATA_BREAKPOINT_IO_ACCESS (0x2)
174#define DEBUG_DATA_BREAKPOINT_MEMORY_WRITE (0x1)
175#define DEBUG_DATA_BREAKPOINT_MEMORY_EXECUTE (0x0)
176#define DEBUG_DATA_BREAKPOINT_LENGTH_32 (0x3)
177#define DEBUG_DATA_BREAKPOINT_LENGTH_64 (0x2)
178#define DEBUG_DATA_BREAKPOINT_LENGTH_16 (0x1)
179#define DEBUG_DATA_BREAKPOINT_LENGTH_8 (0x0)
180
181//
182// Request data for DEBUG_COMMAND_SET_HW_BREAKPOINT
183//
184typedef struct {
185 DEBUG_DATA_BREAKPOINT_TYPE Type;
186 UINT64 Address;
187} DEBUG_DATA_SET_HW_BREAKPOINT;
188
189//
190// Request data for DEBUG_COMMAND_CLEAR_HW_BREAKPOINT
191//
192typedef struct {
193 UINT8 IndexMask; // 0x0f will clear all hw breakpoints
194} DEBUG_DATA_CLEAR_HW_BREAKPOINT;
195
196//
197// Request and response data for DEBUG_COMMAND_SET_SW_BREAKPOINT
198//
199typedef struct {
200 UINT64 Address;
201} DEBUG_DATA_SET_SW_BREAKPOINT;
202
203typedef struct {
204 UINT8 OriginalData;
205} DEBUG_DATA_RESPONSE_SET_SW_BREAKPOINT;
206
207//
208// Request data for DEBUG_COMMAND_READ_MEMORY
209//
210typedef struct {
211 UINT64 Address;
212 UINT8 Width;
213 UINT16 Count;
214} DEBUG_DATA_READ_MEMORY;
215
216//
217// Request data for DEBUG_COMMAND_WRITE_MEMORY
218//
219typedef struct {
220 UINT64 Address;
221 UINT8 Width;
222 UINT16 Count;
223 UINT8 Data[1]; // The actual length is (Width * Count)
224} DEBUG_DATA_WRITE_MEMORY;
225
226//
227// Request and response data for DEBUG_COMMAND_READ_IO
228//
229typedef struct {
230 UINT64 Port;
231 UINT8 Width;
232} DEBUG_DATA_READ_IO;
233
234typedef struct {
235 UINT8 Data[1]; // The actual length depends on the packet header
236} DEBUG_DATA_RESPONSE_READ_IO;
237
238//
239// Request data for DEBUG_COMMAND_WRITE_IO
240//
241typedef struct {
242 UINT64 Port;
243 UINT8 Width;
244 UINT8 Data[1]; // The actual length is Width
245} DEBUG_DATA_WRITE_IO;
246
247//
248// Request data for DEBUG_COMMAND_READ_REGISTER
249//
250typedef struct {
251 UINT8 Index; // defined as SOFT_DEBUGGER_REGISTER_XX
252} DEBUG_DATA_READ_REGISTER;
253
254//
255// Request data for DEBUG_COMMAND_WRITE_REGISTER
256//
257typedef struct {
258 UINT8 Index; // defined as SOFT_DEBUGGER_REGISTER_XX
259 UINT8 Length;
260 UINT8 Data[1]; // The actual length is Length
261} DEBUG_DATA_WRITE_REGISTER;
262
263//
264// Request and response data for DEBUG_COMMAND_READ_MSR
265//
266typedef struct {
267 UINT32 Index;
268} DEBUG_DATA_READ_MSR;
269
270typedef struct {
271 UINT64 Value;
272} DEBUG_DATA_RESPONSE_READ_MSR;
273
274//
275// Request data for DEBUG_COMMAND_WRITE_MSR
276//
277typedef struct {
278 UINT32 Index;
279 UINT64 Value;
280} DEBUG_DATA_WRITE_MSR;
281
282//
283// Response data for DEBUG_COMMAND_GET_REVISION
284//
285typedef struct {
286 UINT32 Revision;
287 UINT32 Capabilities;
288} DEBUG_DATA_RESPONSE_GET_REVISION;
289
290//
291// Response data for DEBUG_COMMAND_GET_EXCEPTION
292//
293typedef struct {
294 UINT8 ExceptionNum;
295 UINT32 ExceptionData;
296} DEBUG_DATA_RESPONSE_GET_EXCEPTION;
297
298//
299// Request data for DEBUG_DATA_SET_DEBUG_SETTING
300//
301typedef struct {
302 UINT8 Key;
303 UINT8 Value;
304} DEBUG_DATA_SET_DEBUG_SETTING;
305//
306// Supported keys
307//
308#define DEBUG_AGENT_SETTING_SMM_ENTRY_BREAK 1
309#define DEBUG_AGENT_SETTING_PRINT_ERROR_LEVEL 2
310#define DEBUG_AGENT_SETTING_BOOT_SCRIPT_ENTRY_BREAK 3
311//
312// Bitmask of print error level for debug message
313//
314#define DEBUG_AGENT_ERROR BIT0
315#define DEBUG_AGENT_WARNING BIT1
316#define DEBUG_AGENT_INFO BIT2
317#define DEBUG_AGENT_VERBOSE BIT3
318
319//
320// Request data for DEBUG_COMMAND_SET_VIEWPOINT
321//
322typedef struct {
323 UINT32 ViewPoint; // The index of viewpoint will be set
324} DEBUG_DATA_SET_VIEWPOINT;
325
326//
327// Response data for DEBUG_COMMAND_GET_VIEWPOINT
328//
329typedef struct {
330 UINT32 ViewPoint; // The index of viewpoint will be returned
331} DEBUG_DATA_RESPONSE_GET_VIEWPOINT;
332
333//
334// Request and response data for DEBUG_COMMAND_CPUID
335//
336typedef struct {
337 UINT32 Eax; // The value of EAX prior to invoking the CPUID instruction
338 UINT32 Ecx; // The value of ECX prior to invoking the CPUID instruction
339} DEBUG_DATA_CPUID;
340
341typedef struct {
342 UINT32 Eax; // The value of EAX returned by the CPUID instruction
343 UINT32 Ebx; // The value of EBX returned by the CPUID instruction
344 UINT32 Ecx; // The value of ECX returned by the CPUID instruction
345 UINT32 Edx; // The value of EDX returned by the CPUID instruction
346} DEBUG_DATA_RESPONSE_CPUID;
347
348//
349// Request and response data for DEBUG_COMMAND_SEARCH_SIGNATURE
350//
351typedef struct {
352 UINT64 Start;
353 UINT32 Count;
354 UINT32 Alignment;
355 BOOLEAN Positive; // TRUE to search in higher address memory
356 UINT8 DataLength;
357 UINT8 Data[1];
358} DEBUG_DATA_SEARCH_SIGNATURE;
359
360typedef struct {
361 UINT64 Address; // -1 indicates not found
362} DEBUG_DATA_RESPONSE_SEARCH_SIGNATURE;
363
364#pragma pack()
365
366#endif
367
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette