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