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
157 lines
5.4 KiB
/*++
|
|
|
|
Copyright (C) Microsoft Corporation, 1991 - 1999
|
|
|
|
Module Name:
|
|
|
|
debug.h
|
|
|
|
Abstract:
|
|
|
|
|
|
Author:
|
|
|
|
Environment:
|
|
|
|
kernel mode only
|
|
|
|
Notes:
|
|
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
|
|
VOID ClassDebugPrint(CLASS_DEBUG_LEVEL DebugPrintLevel, PCCHAR DebugMessage, ...);
|
|
|
|
#if DBG
|
|
|
|
#pragma optimize("", off) // leave call-frames intact in debug
|
|
|
|
typedef struct _CLASSPNP_GLOBALS {
|
|
|
|
//
|
|
// whether or not to ASSERT for lost irps
|
|
//
|
|
|
|
ULONG BreakOnLostIrps;
|
|
ULONG SecondsToWaitForIrps;
|
|
|
|
//
|
|
// use a buffered debug print to help
|
|
// catch timing issues that do not
|
|
// reproduce with std debugprints enabled
|
|
//
|
|
|
|
ULONG UseBufferedDebugPrint;
|
|
ULONG UseDelayedRetry;
|
|
|
|
//
|
|
// the next four are the buffered printing support
|
|
// (currently unimplemented) and require the spinlock
|
|
// to use
|
|
//
|
|
|
|
ULONG Index; // index into buffer
|
|
KSPIN_LOCK SpinLock;
|
|
PUCHAR Buffer; // requires spinlock to access
|
|
ULONG NumberOfBuffers; // number of buffers available
|
|
SIZE_T EachBufferSize; // size of each buffer
|
|
|
|
//
|
|
// interlocked variables to initialize
|
|
// this data only once
|
|
//
|
|
|
|
LONG Initializing;
|
|
LONG Initialized;
|
|
|
|
} CLASSPNP_GLOBALS, *PCLASSPNP_GLOBALS;
|
|
|
|
#define DBGTRACE(dbgTraceLevel, args_in_parens) \
|
|
if (ClassDebug & (1 << (dbgTraceLevel+15))){ \
|
|
DbgPrint("CLASSPNP> *** TRACE *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
|
|
DbgPrint(" > "); \
|
|
DbgPrint args_in_parens; \
|
|
DbgPrint("\n"); \
|
|
if (DebugTrapOnWarn && (dbgTraceLevel == ClassDebugWarning)){ \
|
|
DbgBreakPoint(); \
|
|
} \
|
|
}
|
|
#define DBGWARN(args_in_parens) \
|
|
{ \
|
|
DbgPrint("CLASSPNP> *** WARNING *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
|
|
DbgPrint(" > "); \
|
|
DbgPrint args_in_parens; \
|
|
DbgPrint("\n"); \
|
|
if (DebugTrapOnWarn){ \
|
|
DbgBreakPoint(); \
|
|
} \
|
|
}
|
|
#define DBGERR(args_in_parens) \
|
|
{ \
|
|
DbgPrint("CLASSPNP> *** ERROR *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
|
|
DbgPrint(" > "); \
|
|
DbgPrint args_in_parens; \
|
|
DbgPrint("\n"); \
|
|
DbgBreakPoint(); \
|
|
}
|
|
#define DBGTRAP(args_in_parens) \
|
|
{ \
|
|
DbgPrint("CLASSPNP> *** COVERAGE TRAP *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
|
|
DbgPrint(" > "); \
|
|
DbgPrint args_in_parens; \
|
|
DbgPrint("\n"); \
|
|
DbgBreakPoint(); \
|
|
}
|
|
|
|
|
|
#define DBGGETIOCTLSTR(_ioctl) DbgGetIoctlStr(_ioctl)
|
|
#define DBGGETSCSIOPSTR(_pSrb) DbgGetScsiOpStr(_pSrb)
|
|
#define DBGGETSENSECODESTR(_pSrb) DbgGetSenseCodeStr(_pSrb)
|
|
#define DBGGETADSENSECODESTR(_pSrb) DbgGetAdditionalSenseCodeStr(_pSrb)
|
|
#define DBGGETADSENSEQUALIFIERSTR(_pSrb) DbgGetAdditionalSenseCodeQualifierStr(_pSrb)
|
|
#define DBGCHECKRETURNEDPKT(_pkt) DbgCheckReturnedPkt(_pkt)
|
|
#define DBGGETSRBSTATUSSTR(_pSrb) DbgGetSrbStatusStr(_pSrb)
|
|
#define DBGLOGSENDPACKET(_pkt) DbgLogSendPacket(_pkt)
|
|
#define DBGLOGRETURNPACKET(_pkt) DbgLogReturnPacket(_pkt)
|
|
#define DBGLOGFLUSHINFO(_fdoData, _isIO, _isFUA, _isFlush) DbgLogFlushInfo(_fdoData, _isIO, _isFUA, _isFlush)
|
|
|
|
VOID ClasspInitializeDebugGlobals();
|
|
char *DbgGetIoctlStr(ULONG ioctl);
|
|
char *DbgGetScsiOpStr(PSCSI_REQUEST_BLOCK Srb);
|
|
char *DbgGetSenseCodeStr(PSCSI_REQUEST_BLOCK Srb);
|
|
char *DbgGetAdditionalSenseCodeStr(PSCSI_REQUEST_BLOCK Srb);
|
|
char *DbgGetAdditionalSenseCodeQualifierStr(PSCSI_REQUEST_BLOCK Srb);
|
|
VOID DbgCheckReturnedPkt(TRANSFER_PACKET *Pkt);
|
|
char *DbgGetSrbStatusStr(PSCSI_REQUEST_BLOCK Srb);
|
|
VOID DbgLogSendPacket(TRANSFER_PACKET *Pkt);
|
|
VOID DbgLogReturnPacket(TRANSFER_PACKET *Pkt);
|
|
VOID DbgLogFlushInfo(PCLASS_PRIVATE_FDO_DATA FdoData, BOOLEAN IsIO, BOOLEAN IsFUA, BOOLEAN IsFlush);
|
|
|
|
extern CLASSPNP_GLOBALS ClasspnpGlobals;
|
|
extern LONG ClassDebug;
|
|
extern BOOLEAN DebugTrapOnWarn;
|
|
|
|
#else
|
|
|
|
#define ClasspInitializeDebugGlobals()
|
|
#define DBGWARN(args_in_parens)
|
|
#define DBGERR(args_in_parens)
|
|
#define DBGTRACE(dbgTraceLevel, args_in_parens)
|
|
#define DBGTRAP(args_in_parens)
|
|
|
|
#define DBGGETIOCTLSTR(_ioctl)
|
|
#define DBGGETSCSIOPSTR(_pSrb)
|
|
#define DBGGETSENSECODESTR(_pSrb)
|
|
#define DBGGETADSENSECODESTR(_pSrb)
|
|
#define DBGGETADSENSEQUALIFIERSTR(_pSrb)
|
|
#define DBGCHECKRETURNEDPKT(_pkt)
|
|
#define DBGGETSRBSTATUSSTR(_pSrb)
|
|
#define DBGLOGSENDPACKET(_pkt)
|
|
#define DBGLOGRETURNPACKET(_pkt)
|
|
#define DBGLOGFLUSHINFO(_fdoData, _isIO, _isFUA, _isFlush)
|
|
|
|
#endif
|
|
|