1314879Simp/** @file 2314879Simp 3314879Simp The file defines the EFI Debugport protocol. 4314879Simp This protocol is used by debug agent to communicate with the 5314879Simp remote debug host. 6314879Simp 7314879Simp Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> 8314879Simp This program and the accompanying materials 9314879Simp are licensed and made available under the terms and conditions of the BSD License 10314879Simp which accompanies this distribution. The full text of the license may be found at 11314879Simp http://opensource.org/licenses/bsd-license.php 12314879Simp 13314879Simp THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14314879Simp WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15314879Simp 16314879Simp**/ 17314879Simp 18314879Simp#ifndef __DEBUG_PORT_H__ 19314879Simp#define __DEBUG_PORT_H__ 20314879Simp 21314879Simp 22314879Simp/// 23314879Simp/// DebugPortIo protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0} 24314879Simp/// 25314879Simp#define EFI_DEBUGPORT_PROTOCOL_GUID \ 26314879Simp { \ 27314879Simp 0xEBA4E8D2, 0x3858, 0x41EC, {0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \ 28314879Simp } 29314879Simp 30314879Simpextern EFI_GUID gEfiDebugPortProtocolGuid; 31314879Simp 32314879Simptypedef struct _EFI_DEBUGPORT_PROTOCOL EFI_DEBUGPORT_PROTOCOL; 33314879Simp 34314879Simp// 35314879Simp// DebugPort member functions 36314879Simp// 37314879Simp 38314879Simp/** 39314879Simp Resets the debugport. 40314879Simp 41314879Simp @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance. 42314879Simp 43314879Simp @retval EFI_SUCCESS The debugport device was reset and is in usable state. 44314879Simp @retval EFI_DEVICE_ERROR The debugport device could not be reset and is unusable. 45314879Simp 46314879Simp**/ 47314879Simptypedef 48314879SimpEFI_STATUS 49314879Simp(EFIAPI *EFI_DEBUGPORT_RESET)( 50314879Simp IN EFI_DEBUGPORT_PROTOCOL *This 51314879Simp ); 52314879Simp 53314879Simp/** 54314879Simp Writes data to the debugport. 55314879Simp 56314879Simp @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance. 57314879Simp @param Timeout The number of microseconds to wait before timing out a write operation. 58314879Simp @param BufferSize On input, the requested number of bytes of data to write. On output, the 59314879Simp number of bytes of data actually written. 60314879Simp @param Buffer A pointer to a buffer containing the data to write. 61314879Simp 62314879Simp @retval EFI_SUCCESS The data was written. 63314879Simp @retval EFI_DEVICE_ERROR The device reported an error. 64314879Simp @retval EFI_TIMEOUT The data write was stopped due to a timeout. 65314879Simp 66314879Simp**/ 67314879Simptypedef 68314879SimpEFI_STATUS 69314879Simp(EFIAPI *EFI_DEBUGPORT_WRITE)( 70314879Simp IN EFI_DEBUGPORT_PROTOCOL *This, 71314879Simp IN UINT32 Timeout, 72314879Simp IN OUT UINTN *BufferSize, 73314879Simp IN VOID *Buffer 74314879Simp ); 75314879Simp 76314879Simp/** 77314879Simp Reads data from the debugport. 78314879Simp 79314879Simp @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance. 80314879Simp @param Timeout The number of microseconds to wait before timing out a read operation. 81314879Simp @param BufferSize On input, the requested number of bytes of data to read. On output, the 82314879Simp number of bytes of data actually number of bytes 83314879Simp of data read and returned in Buffer. 84314879Simp @param Buffer A pointer to a buffer into which the data read will be saved. 85314879Simp 86314879Simp @retval EFI_SUCCESS The data was read. 87314879Simp @retval EFI_DEVICE_ERROR The device reported an error. 88314879Simp @retval EFI_TIMEOUT The operation was stopped due to a timeout or overrun. 89314879Simp 90314879Simp**/ 91314879Simptypedef 92314879SimpEFI_STATUS 93314879Simp(EFIAPI *EFI_DEBUGPORT_READ)( 94314879Simp IN EFI_DEBUGPORT_PROTOCOL *This, 95314879Simp IN UINT32 Timeout, 96314879Simp IN OUT UINTN *BufferSize, 97314879Simp OUT VOID *Buffer 98314879Simp ); 99314879Simp 100314879Simp/** 101314879Simp Checks to see if any data is available to be read from the debugport device. 102314879Simp 103314879Simp @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance. 104314879Simp 105314879Simp @retval EFI_SUCCESS At least one byte of data is available to be read. 106314879Simp @retval EFI_DEVICE_ERROR The debugport device is not functioning correctly. 107314879Simp @retval EFI_NOT_READY No data is available to be read. 108314879Simp 109314879Simp**/ 110314879Simptypedef 111314879SimpEFI_STATUS 112314879Simp(EFIAPI *EFI_DEBUGPORT_POLL)( 113314879Simp IN EFI_DEBUGPORT_PROTOCOL *This 114314879Simp ); 115314879Simp 116314879Simp/// 117314879Simp/// This protocol provides the communication link between the debug agent and the remote host. 118314879Simp/// 119314879Simpstruct _EFI_DEBUGPORT_PROTOCOL { 120314879Simp EFI_DEBUGPORT_RESET Reset; 121314879Simp EFI_DEBUGPORT_WRITE Write; 122314879Simp EFI_DEBUGPORT_READ Read; 123314879Simp EFI_DEBUGPORT_POLL Poll; 124314879Simp}; 125314879Simp 126314879Simp// 127314879Simp// DEBUGPORT variable definitions... 128314879Simp// 129314879Simp#define EFI_DEBUGPORT_VARIABLE_NAME L"DEBUGPORT" 130314879Simp#define EFI_DEBUGPORT_VARIABLE_GUID EFI_DEBUGPORT_PROTOCOL_GUID 131314879Simp 132314879Simpextern EFI_GUID gEfiDebugPortVariableGuid; 133314879Simp 134314879Simp// 135314879Simp// DebugPort device path definitions... 136314879Simp// 137314879Simp#define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID 138314879Simp 139314879Simpextern EFI_GUID gEfiDebugPortDevicePathGuid; 140314879Simp 141314879Simptypedef struct { 142314879Simp EFI_DEVICE_PATH_PROTOCOL Header; 143314879Simp EFI_GUID Guid; 144314879Simp} DEBUGPORT_DEVICE_PATH; 145314879Simp 146314879Simp#endif 147