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.

157 lines
5.4 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1991 - 1999
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. Author:
  7. Environment:
  8. kernel mode only
  9. Notes:
  10. Revision History:
  11. --*/
  12. VOID ClassDebugPrint(CLASS_DEBUG_LEVEL DebugPrintLevel, PCCHAR DebugMessage, ...);
  13. #if DBG
  14. #pragma optimize("", off) // leave call-frames intact in debug
  15. typedef struct _CLASSPNP_GLOBALS {
  16. //
  17. // whether or not to ASSERT for lost irps
  18. //
  19. ULONG BreakOnLostIrps;
  20. ULONG SecondsToWaitForIrps;
  21. //
  22. // use a buffered debug print to help
  23. // catch timing issues that do not
  24. // reproduce with std debugprints enabled
  25. //
  26. ULONG UseBufferedDebugPrint;
  27. ULONG UseDelayedRetry;
  28. //
  29. // the next four are the buffered printing support
  30. // (currently unimplemented) and require the spinlock
  31. // to use
  32. //
  33. ULONG Index; // index into buffer
  34. KSPIN_LOCK SpinLock;
  35. PUCHAR Buffer; // requires spinlock to access
  36. ULONG NumberOfBuffers; // number of buffers available
  37. SIZE_T EachBufferSize; // size of each buffer
  38. //
  39. // interlocked variables to initialize
  40. // this data only once
  41. //
  42. LONG Initializing;
  43. LONG Initialized;
  44. } CLASSPNP_GLOBALS, *PCLASSPNP_GLOBALS;
  45. #define DBGTRACE(dbgTraceLevel, args_in_parens) \
  46. if (ClassDebug & (1 << (dbgTraceLevel+15))){ \
  47. DbgPrint("CLASSPNP> *** TRACE *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
  48. DbgPrint(" > "); \
  49. DbgPrint args_in_parens; \
  50. DbgPrint("\n"); \
  51. if (DebugTrapOnWarn && (dbgTraceLevel == ClassDebugWarning)){ \
  52. DbgBreakPoint(); \
  53. } \
  54. }
  55. #define DBGWARN(args_in_parens) \
  56. { \
  57. DbgPrint("CLASSPNP> *** WARNING *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
  58. DbgPrint(" > "); \
  59. DbgPrint args_in_parens; \
  60. DbgPrint("\n"); \
  61. if (DebugTrapOnWarn){ \
  62. DbgBreakPoint(); \
  63. } \
  64. }
  65. #define DBGERR(args_in_parens) \
  66. { \
  67. DbgPrint("CLASSPNP> *** ERROR *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
  68. DbgPrint(" > "); \
  69. DbgPrint args_in_parens; \
  70. DbgPrint("\n"); \
  71. DbgBreakPoint(); \
  72. }
  73. #define DBGTRAP(args_in_parens) \
  74. { \
  75. DbgPrint("CLASSPNP> *** COVERAGE TRAP *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
  76. DbgPrint(" > "); \
  77. DbgPrint args_in_parens; \
  78. DbgPrint("\n"); \
  79. DbgBreakPoint(); \
  80. }
  81. #define DBGGETIOCTLSTR(_ioctl) DbgGetIoctlStr(_ioctl)
  82. #define DBGGETSCSIOPSTR(_pSrb) DbgGetScsiOpStr(_pSrb)
  83. #define DBGGETSENSECODESTR(_pSrb) DbgGetSenseCodeStr(_pSrb)
  84. #define DBGGETADSENSECODESTR(_pSrb) DbgGetAdditionalSenseCodeStr(_pSrb)
  85. #define DBGGETADSENSEQUALIFIERSTR(_pSrb) DbgGetAdditionalSenseCodeQualifierStr(_pSrb)
  86. #define DBGCHECKRETURNEDPKT(_pkt) DbgCheckReturnedPkt(_pkt)
  87. #define DBGGETSRBSTATUSSTR(_pSrb) DbgGetSrbStatusStr(_pSrb)
  88. #define DBGLOGSENDPACKET(_pkt) DbgLogSendPacket(_pkt)
  89. #define DBGLOGRETURNPACKET(_pkt) DbgLogReturnPacket(_pkt)
  90. #define DBGLOGFLUSHINFO(_fdoData, _isIO, _isFUA, _isFlush) DbgLogFlushInfo(_fdoData, _isIO, _isFUA, _isFlush)
  91. VOID ClasspInitializeDebugGlobals();
  92. char *DbgGetIoctlStr(ULONG ioctl);
  93. char *DbgGetScsiOpStr(PSCSI_REQUEST_BLOCK Srb);
  94. char *DbgGetSenseCodeStr(PSCSI_REQUEST_BLOCK Srb);
  95. char *DbgGetAdditionalSenseCodeStr(PSCSI_REQUEST_BLOCK Srb);
  96. char *DbgGetAdditionalSenseCodeQualifierStr(PSCSI_REQUEST_BLOCK Srb);
  97. VOID DbgCheckReturnedPkt(TRANSFER_PACKET *Pkt);
  98. char *DbgGetSrbStatusStr(PSCSI_REQUEST_BLOCK Srb);
  99. VOID DbgLogSendPacket(TRANSFER_PACKET *Pkt);
  100. VOID DbgLogReturnPacket(TRANSFER_PACKET *Pkt);
  101. VOID DbgLogFlushInfo(PCLASS_PRIVATE_FDO_DATA FdoData, BOOLEAN IsIO, BOOLEAN IsFUA, BOOLEAN IsFlush);
  102. extern CLASSPNP_GLOBALS ClasspnpGlobals;
  103. extern LONG ClassDebug;
  104. extern BOOLEAN DebugTrapOnWarn;
  105. #else
  106. #define ClasspInitializeDebugGlobals()
  107. #define DBGWARN(args_in_parens)
  108. #define DBGERR(args_in_parens)
  109. #define DBGTRACE(dbgTraceLevel, args_in_parens)
  110. #define DBGTRAP(args_in_parens)
  111. #define DBGGETIOCTLSTR(_ioctl)
  112. #define DBGGETSCSIOPSTR(_pSrb)
  113. #define DBGGETSENSECODESTR(_pSrb)
  114. #define DBGGETADSENSECODESTR(_pSrb)
  115. #define DBGGETADSENSEQUALIFIERSTR(_pSrb)
  116. #define DBGCHECKRETURNEDPKT(_pkt)
  117. #define DBGGETSRBSTATUSSTR(_pSrb)
  118. #define DBGLOGSENDPACKET(_pkt)
  119. #define DBGLOGRETURNPACKET(_pkt)
  120. #define DBGLOGFLUSHINFO(_fdoData, _isIO, _isFUA, _isFlush)
  121. #endif