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