]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/DebugPort.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / DebugPort.h
CommitLineData
d1f95000 1/** @file\r
9095d37b 2\r
c311f86b 3 The file defines the EFI Debugport protocol.\r
4 This protocol is used by debug agent to communicate with the\r
5 remote debug host.\r
d1f95000 6\r
9095d37b 7 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 9\r
d1f95000 10**/\r
11\r
12#ifndef __DEBUG_PORT_H__\r
13#define __DEBUG_PORT_H__\r
14\r
15\r
99e8ed21 16///\r
17/// DebugPortIo protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0}\r
18///\r
d1f95000 19#define EFI_DEBUGPORT_PROTOCOL_GUID \\r
20 { \\r
21 0xEBA4E8D2, 0x3858, 0x41EC, {0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \\r
22 }\r
23\r
24extern EFI_GUID gEfiDebugPortProtocolGuid;\r
25\r
26typedef struct _EFI_DEBUGPORT_PROTOCOL EFI_DEBUGPORT_PROTOCOL;\r
27\r
28//\r
29// DebugPort member functions\r
30//\r
31\r
9095d37b 32/**\r
d1f95000 33 Resets the debugport.\r
9095d37b 34\r
d1f95000 35 @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance.\r
9095d37b 36\r
d1f95000 37 @retval EFI_SUCCESS The debugport device was reset and is in usable state.\r
38 @retval EFI_DEVICE_ERROR The debugport device could not be reset and is unusable.\r
9095d37b 39\r
d1f95000 40**/\r
41typedef\r
42EFI_STATUS\r
8b13229b 43(EFIAPI *EFI_DEBUGPORT_RESET)(\r
d1f95000 44 IN EFI_DEBUGPORT_PROTOCOL *This\r
45 );\r
46\r
9095d37b 47/**\r
d1f95000 48 Writes data to the debugport.\r
9095d37b 49\r
d1f95000 50 @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance.\r
51 @param Timeout The number of microseconds to wait before timing out a write operation.\r
52 @param BufferSize On input, the requested number of bytes of data to write. On output, the\r
53 number of bytes of data actually written.\r
9095d37b
LG
54 @param Buffer A pointer to a buffer containing the data to write.\r
55\r
d1f95000 56 @retval EFI_SUCCESS The data was written.\r
57 @retval EFI_DEVICE_ERROR The device reported an error.\r
58 @retval EFI_TIMEOUT The data write was stopped due to a timeout.\r
9095d37b 59\r
d1f95000 60**/\r
61typedef\r
62EFI_STATUS\r
8b13229b 63(EFIAPI *EFI_DEBUGPORT_WRITE)(\r
d1f95000 64 IN EFI_DEBUGPORT_PROTOCOL *This,\r
65 IN UINT32 Timeout,\r
66 IN OUT UINTN *BufferSize,\r
67 IN VOID *Buffer\r
68 );\r
69\r
9095d37b 70/**\r
d1f95000 71 Reads data from the debugport.\r
9095d37b 72\r
d1f95000 73 @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance.\r
74 @param Timeout The number of microseconds to wait before timing out a read operation.\r
75 @param BufferSize On input, the requested number of bytes of data to read. On output, the\r
76 number of bytes of data actually number of bytes\r
77 of data read and returned in Buffer.\r
78 @param Buffer A pointer to a buffer into which the data read will be saved.\r
9095d37b 79\r
d1f95000 80 @retval EFI_SUCCESS The data was read.\r
81 @retval EFI_DEVICE_ERROR The device reported an error.\r
82 @retval EFI_TIMEOUT The operation was stopped due to a timeout or overrun.\r
9095d37b 83\r
d1f95000 84**/\r
85typedef\r
86EFI_STATUS\r
8b13229b 87(EFIAPI *EFI_DEBUGPORT_READ)(\r
d1f95000 88 IN EFI_DEBUGPORT_PROTOCOL *This,\r
89 IN UINT32 Timeout,\r
90 IN OUT UINTN *BufferSize,\r
91 OUT VOID *Buffer\r
92 );\r
93\r
9095d37b 94/**\r
d1f95000 95 Checks to see if any data is available to be read from the debugport device.\r
9095d37b 96\r
d1f95000 97 @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance.\r
9095d37b 98\r
d1f95000 99 @retval EFI_SUCCESS At least one byte of data is available to be read.\r
100 @retval EFI_DEVICE_ERROR The debugport device is not functioning correctly.\r
101 @retval EFI_NOT_READY No data is available to be read.\r
9095d37b 102\r
d1f95000 103**/\r
104typedef\r
105EFI_STATUS\r
8b13229b 106(EFIAPI *EFI_DEBUGPORT_POLL)(\r
d1f95000 107 IN EFI_DEBUGPORT_PROTOCOL *This\r
108 );\r
109\r
44717a39 110///\r
111/// This protocol provides the communication link between the debug agent and the remote host.\r
112///\r
d1f95000 113struct _EFI_DEBUGPORT_PROTOCOL {\r
114 EFI_DEBUGPORT_RESET Reset;\r
115 EFI_DEBUGPORT_WRITE Write;\r
116 EFI_DEBUGPORT_READ Read;\r
117 EFI_DEBUGPORT_POLL Poll;\r
118};\r
119\r
120//\r
121// DEBUGPORT variable definitions...\r
122//\r
123#define EFI_DEBUGPORT_VARIABLE_NAME L"DEBUGPORT"\r
124#define EFI_DEBUGPORT_VARIABLE_GUID EFI_DEBUGPORT_PROTOCOL_GUID\r
068a82fc
LG
125\r
126extern EFI_GUID gEfiDebugPortVariableGuid;\r
d1f95000 127\r
128//\r
129// DebugPort device path definitions...\r
130//\r
131#define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID\r
068a82fc
LG
132\r
133extern EFI_GUID gEfiDebugPortDevicePathGuid;\r
d1f95000 134\r
135typedef struct {\r
136 EFI_DEVICE_PATH_PROTOCOL Header;\r
137 EFI_GUID Guid;\r
138} DEBUGPORT_DEVICE_PATH;\r
139\r
140#endif\r