efidbg.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * Copyright (c) 1999, 2000
  3. * Intel Corporation.
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. *
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the distribution.
  16. *
  17. * 3. All advertising materials mentioning features or use of this software
  18. * must display the following acknowledgement:
  19. *
  20. * This product includes software developed by Intel Corporation and
  21. * its contributors.
  22. *
  23. * 4. Neither the name of Intel Corporation or its contributors may be
  24. * used to endorse or promote products derived from this software
  25. * without specific prior written permission.
  26. *
  27. * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS''
  28. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  29. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  30. * ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE
  31. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  32. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  33. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  34. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  35. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  36. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  37. * THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef _EFIDBG_H_
  41. #define _EFIDBG_H_
  42. #include "eficontext.h"
  43. #include "efiser.h"
  44. typedef struct _DEBUGPORT_16550_CONFIG_DATA {
  45. UINT32 PortAddress;
  46. UINT64 BaudRate;
  47. UINT32 ReceiveFifoDepth;
  48. UINT32 Timeout;
  49. UINT8 Parity;
  50. UINT8 DataBits;
  51. UINT8 StopBits;
  52. UINT32 ControlMask;
  53. BOOLEAN RtsCtsEnable; // RTS, CTS control
  54. } DEBUGPORT_16550_CONFIG_DATA;
  55. typedef struct _DEBUGPORT_16550_DEVICE_PATH {
  56. EFI_DEVICE_PATH Header;
  57. DEBUGPORT_16550_CONFIG_DATA ConfigData;
  58. } DEBUGPORT_16550_DEVICE_PATH;
  59. typedef union {
  60. EFI_DEVICE_PATH DevPath;
  61. DEBUGPORT_16550_DEVICE_PATH Uart;
  62. // add new types of debugport device paths to this union...
  63. } DEBUGPORT_DEV_PATH;
  64. //
  65. // Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25}
  66. //
  67. #define DEBUG_SUPPORT_PROTOCOL \
  68. { 0x2755590C, 0x6F3C, 0x42fa, 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 }
  69. typedef UINTN EXCEPTION_TYPE;
  70. typedef
  71. VOID
  72. (*EXCEPTION_HANDLER) (
  73. IN EXCEPTION_TYPE ExceptionType,
  74. IN SYSTEM_CONTEXT *SystemContext
  75. );
  76. typedef
  77. EFI_STATUS
  78. (EFIAPI *EFI_REGISTER_TIMER_TICK_CALLBACK) (
  79. IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This,
  80. IN EXCEPTION_HANDLER TimerTickCallback
  81. );
  82. typedef
  83. EFI_STATUS
  84. (EFIAPI *EFI_REGISTER_EXCEPTION_HANDLER) (
  85. IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This,
  86. IN EXCEPTION_HANDLER ExceptionHandler,
  87. IN EXCEPTION_TYPE ExceptionType
  88. );
  89. typedef
  90. EFI_STATUS
  91. (EFIAPI *EFI_IP_CALL_TRACE) (
  92. IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This
  93. );
  94. #define EFI_DEBUG_SUPPORT_INTERFACE_REVISION 0x00010000
  95. typedef struct _EFI_DEBUG_SUPPORT_INTERFACE {
  96. UINT32 Revision;
  97. EFI_REGISTER_TIMER_TICK_CALLBACK RegisterTimerTickCallback;
  98. EFI_REGISTER_EXCEPTION_HANDLER RegisterExceptionHandler;
  99. EFI_IP_CALL_TRACE IpCallTrace;
  100. } EFI_DEBUG_SUPPORT_INTERFACE;
  101. //
  102. // Debugport io protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0}
  103. //
  104. #define DEBUGPORT_IO_PROTOCOL \
  105. { 0XEBA4E8D2, 0X3858, 0X41EC, 0XA2, 0X81, 0X26, 0X47, 0XBA, 0X96, 0X60, 0XD0 }
  106. typedef
  107. EFI_STATUS
  108. (EFIAPI *EFI_DEBUGPORT_IO_RESET) (
  109. IN struct _EFI_DEBUGPORT_IO_INTERFACE *This
  110. );
  111. typedef
  112. EFI_STATUS
  113. (EFIAPI *EFI_DEBUGPORT_IO_READ) (
  114. IN struct _EFI_DEBUGPORT_IO_INTERFACE *This,
  115. IN OUT UINTN *BufferSize,
  116. OUT VOID *Buffer
  117. );
  118. typedef
  119. EFI_STATUS
  120. (EFIAPI *EFI_DEBUGPORT_IO_WRITE) (
  121. IN struct _EFI_DEBUGPORT_IO_INTERFACE *This,
  122. IN OUT UINTN *BufferSize,
  123. IN VOID *Buffer
  124. );
  125. #define EFI_DEBUGPORT_IO_INTERFACE_REVISION 0x00010000
  126. typedef struct _EFI_DEBUGPORT_IO_INTERFACE {
  127. UINT32 Revision;
  128. EFI_DEBUGPORT_IO_READ Read;
  129. EFI_DEBUGPORT_IO_WRITE Write;
  130. EFI_DEBUGPORT_IO_RESET Reset;
  131. } EFI_DEBUGPORT_IO_INTERFACE;
  132. //
  133. // Debugport UART16550 control protocol {628EA978-4C26-4605-BC02-A42A496917DD}
  134. //
  135. #define DEBUGPORT_UART16550_CONTROL_PROTOCOL \
  136. { 0X628EA978, 0X4C26, 0X4605, 0XBC, 0X2, 0XA4, 0X2A, 0X49, 0X69, 0X17, 0XDD }
  137. // Note: The definitions for EFI_PARITY_TYPE, EFI_STOP_BITS_TYPE, and
  138. // SERIAL_IO_MODE are included from efiser.h
  139. typedef
  140. EFI_STATUS
  141. (EFIAPI *EFI_UART16550_SET_ATTRIBUTES) (
  142. IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This,
  143. IN UINT64 BaudRate,
  144. IN UINT32 ReceiveFifoDepth,
  145. IN UINT32 Timeout,
  146. IN EFI_PARITY_TYPE Parity,
  147. IN UINT8 DataBits,
  148. IN EFI_STOP_BITS_TYPE StopBits
  149. );
  150. typedef
  151. EFI_STATUS
  152. (EFIAPI *EFI_UART16550_SET_CONTROL_BITS) (
  153. IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This,
  154. IN UINT32 Control
  155. );
  156. typedef
  157. EFI_STATUS
  158. (EFIAPI *EFI_UART16550_GET_CONTROL_BITS) (
  159. IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This,
  160. OUT UINT32 *Control
  161. );
  162. #define EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE_REVISION 0x00010000
  163. typedef struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE {
  164. UINT32 Revision;
  165. EFI_UART16550_SET_ATTRIBUTES SetAttributes;
  166. EFI_UART16550_SET_CONTROL_BITS SetControl;
  167. EFI_UART16550_GET_CONTROL_BITS GetControl;
  168. DEBUGPORT_16550_CONFIG_DATA *Mode;
  169. } EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE;
  170. #define DEVICE_PATH_DEBUGPORT DEBUGPORT_IO_PROTOCOL
  171. #endif /* _EFIDBG_H_ */