Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. This header provides debugging support prototypes and macros
  7. Author:
  8. Neil Sandlin (neilsa) Jan 1 2002
  9. Revision History:
  10. --*/
  11. #if !defined(_DEBUG_)
  12. #define DEBUG
  13. #if DBG
  14. //
  15. // Debug mask flags
  16. //
  17. #define SDBUS_DEBUG_ALL 0x0FFFFFFF
  18. #define SDBUS_DEBUG_FAIL 0x00000001
  19. #define SDBUS_DEBUG_WARNING 0x00000002
  20. #define SDBUS_DEBUG_INFO 0x00000004
  21. #define SDBUS_DEBUG_ENUM 0x00000010
  22. #define SDBUS_DEBUG_TUPLES 0x00000020
  23. #define SDBUS_DEBUG_PNP 0x00000040
  24. #define SDBUS_DEBUG_POWER 0x00000080
  25. #define SDBUS_DEBUG_INTERFACE 0x00000100
  26. #define SDBUS_DEBUG_IOCTL 0x00000200
  27. #define SDBUS_DEBUG_WORKENG 0x00000400
  28. #define SDBUS_DEBUG_WORKPROC 0x00000800
  29. #define SDBUS_DEBUG_EVENT 0x00001000
  30. #define SDBUS_DEBUG_CARD_EVT 0x00002000
  31. #define SDBUS_DEBUG_DEVICE 0x00010000
  32. #define SDBUS_DEBUG_DUMP_REGS 0x00020000
  33. #define SDBUS_DEBUG_BREAK 0x10000000
  34. #define SDBUS_DEBUG_LOG 0x20000000
  35. #define DBGLOGWIDTH 128
  36. #define DBGLOGCOUNT 500
  37. typedef struct _SDBUS_STRING_MAP {
  38. ULONG Id;
  39. PCHAR String;
  40. } SDBUS_STRING_MAP, *PSDBUS_STRING_MAP;
  41. //
  42. // Debug globals
  43. //
  44. extern ULONG SdbusDebugMask;
  45. extern SDBUS_STRING_MAP SdbusDbgPnpIrpStringMap[];
  46. extern SDBUS_STRING_MAP SdbusDbgPoIrpStringMap[];
  47. extern SDBUS_STRING_MAP SdbusDbgDeviceRelationStringMap[];
  48. extern SDBUS_STRING_MAP SdbusDbgSystemPowerStringMap[];
  49. extern SDBUS_STRING_MAP SdbusDbgDevicePowerStringMap[];
  50. extern PSDBUS_STRING_MAP SdbusDbgStatusStringMap;
  51. extern SDBUS_STRING_MAP SdbusDbgFdoPowerWorkerStringMap[];
  52. extern SDBUS_STRING_MAP SdbusDbgPdoPowerWorkerStringMap[];
  53. extern SDBUS_STRING_MAP SdbusDbgSocketPowerWorkerStringMap[];
  54. extern SDBUS_STRING_MAP SdbusDbgConfigurationWorkerStringMap[];
  55. extern SDBUS_STRING_MAP SdbusDbgTupleStringMap[];
  56. extern SDBUS_STRING_MAP SdbusDbgWakeStateStringMap[];
  57. extern SDBUS_STRING_MAP SdbusDbgEventStringMap[];
  58. extern SDBUS_STRING_MAP SdbusDbgWPFunctionStringMap[];
  59. extern SDBUS_STRING_MAP SdbusDbgWorkerStateStringMap[];
  60. extern SDBUS_STRING_MAP SdbusDbgSocketStateStringMap[];
  61. //
  62. // Debug prototypes
  63. //
  64. PCHAR
  65. SdbusDbgLookupString(
  66. IN PSDBUS_STRING_MAP Map,
  67. IN ULONG Id
  68. );
  69. VOID
  70. SdbusDebugPrint(
  71. ULONG DebugMask,
  72. PCCHAR DebugMessage,
  73. ...
  74. );
  75. VOID
  76. SdbusDumpDbgLog(
  77. );
  78. VOID
  79. SdbusPrintLogEntry(
  80. LONG index
  81. );
  82. VOID
  83. SdbusClearDbgLog(
  84. );
  85. VOID
  86. SdbusInitializeDbgLog(
  87. PUCHAR buffer
  88. );
  89. VOID
  90. SdbusDebugDumpCsd(
  91. PSD_CSD pSdCsd
  92. );
  93. VOID
  94. SdbusDebugDumpCid(
  95. PSD_CID pSdCid
  96. );
  97. VOID
  98. DebugDumpSdResponse(
  99. PULONG pResp,
  100. UCHAR ResponseType
  101. );
  102. //
  103. // Debug macros
  104. //
  105. #define DebugPrint(X) SdbusDebugPrint X
  106. #define STATUS_STRING(_Status) \
  107. (_Status) == STATUS_SUCCESS ? \
  108. "STATUS_SUCCESS" : SdbusDbgLookupString(SdbusDbgStatusStringMap, (_Status))
  109. #define PNP_IRP_STRING(_Irp) \
  110. SdbusDbgLookupString(SdbusDbgPnpIrpStringMap, (_Irp))
  111. #define PO_IRP_STRING(_Irp) \
  112. SdbusDbgLookupString(SdbusDbgPoIrpStringMap, (_Irp))
  113. #define RELATION_STRING(_Relation) \
  114. SdbusDbgLookupString(SdbusDbgDeviceRelationStringMap, (_Relation))
  115. #define SYSTEM_POWER_STRING(_State) \
  116. SdbusDbgLookupString(SdbusDbgSystemPowerStringMap, (_State))
  117. #define DEVICE_POWER_STRING(_State) \
  118. SdbusDbgLookupString(SdbusDbgDevicePowerStringMap, (_State))
  119. #define FDO_POWER_WORKER_STRING(_State) \
  120. SdbusDbgLookupString(SdbusDbgFdoPowerWorkerStringMap, (_State))
  121. #define PDO_POWER_WORKER_STRING(_State) \
  122. SdbusDbgLookupString(SdbusDbgPdoPowerWorkerStringMap, (_State))
  123. #define SOCKET_POWER_WORKER_STRING(_State) \
  124. SdbusDbgLookupString(SdbusDbgSocketPowerWorkerStringMap, (_State))
  125. #define TUPLE_STRING(_Tuple) \
  126. SdbusDbgLookupString(SdbusDbgTupleStringMap, (_Tuple))
  127. #define WAKESTATE_STRING(_State) \
  128. SdbusDbgLookupString(SdbusDbgWakeStateStringMap, (_State))
  129. #define EVENT_STRING(_State) \
  130. SdbusDbgLookupString(SdbusDbgEventStringMap, (_State))
  131. #define WP_FUNC_STRING(_State) \
  132. SdbusDbgLookupString(SdbusDbgWPFunctionStringMap, (_State))
  133. #define WORKER_STATE_STRING(_State) \
  134. SdbusDbgLookupString(SdbusDbgWorkerStateStringMap, (_State))
  135. #define SOCKET_STATE_STRING(_State) \
  136. SdbusDbgLookupString(SdbusDbgSocketStateStringMap, (_State))
  137. //
  138. // Structures
  139. //
  140. #else
  141. //
  142. // !defined DBG
  143. //
  144. #define DebugPrint(X)
  145. #define SdbusDumpDbgLog()
  146. #define DebugDumpSdResponse(x, y)
  147. #define DUMP_SOCKET(Socket)
  148. #define PDO_TRACE(PdoExt, Context)
  149. #define STATUS_STRING(_Status) ""
  150. #define PNP_IRP_STRING(_Irp) ""
  151. #define PO_IRP_STRING(_Irp) ""
  152. #define RELATION_STRING(_Relation) ""
  153. #define SYSTEM_POWER_STRING(_State) ""
  154. #define DEVICE_POWER_STRING(_State) ""
  155. #endif // DBG
  156. #endif