1 /*++ 2 3 Copyright (C) Microsoft Corporation, 1991 - 1999 4 5 Module Name: 6 7 debug.h 8 9 Abstract: 10 11 12 Author: 13 14 Environment: 15 16 kernel mode only 17 18 Notes: 19 20 21 Revision History: 22 23 --*/ 24 25 #define DBGGETIOCTLSTR(_ioctl) DbgGetIoctlStr(_ioctl) 26 #define DBGGETSCSIOPSTR(_pSrb) DbgGetScsiOpStr(_pSrb) 27 #define DBGGETSRBSTATUSSTR(_pSrb) DbgGetSrbStatusStr(_pSrb) 28 #define DBGGETSENSECODESTR(_pSrb) DbgGetSenseCodeStr(_pSrb) 29 #define DBGGETADSENSECODESTR(_pSrb) DbgGetAdditionalSenseCodeStr(_pSrb) 30 #define DBGGETADSENSEQUALIFIERSTR(_pSrb) DbgGetAdditionalSenseCodeQualifierStr(_pSrb) 31 32 char *DbgGetIoctlStr(ULONG ioctl); 33 char *DbgGetScsiOpStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb); 34 char *DbgGetSrbStatusStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb); 35 char *DbgGetSenseCodeStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb); 36 char *DbgGetAdditionalSenseCodeStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb); 37 char *DbgGetAdditionalSenseCodeQualifierStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb); 38 39 #if DBG 40 41 typedef struct _CLASSPNP_GLOBALS { 42 43 // 44 // whether or not to NT_ASSERT for lost irps 45 // 46 47 ULONG BreakOnLostIrps; 48 ULONG SecondsToWaitForIrps; 49 50 // 51 // use a buffered debug print to help 52 // catch timing issues that do not 53 // reproduce with std debugprints enabled 54 // 55 56 ULONG UseBufferedDebugPrint; 57 ULONG UseDelayedRetry; 58 59 // 60 // the next four are the buffered printing support 61 // (currently unimplemented) and require the spinlock 62 // to use 63 // 64 65 ULONG Index; // index into buffer 66 KSPIN_LOCK SpinLock; 67 PUCHAR Buffer; // requires spinlock to access 68 ULONG NumberOfBuffers; // number of buffers available 69 SIZE_T EachBufferSize; // size of each buffer 70 71 // 72 // interlocked variables to initialize 73 // this data only once 74 // 75 76 LONG Initializing; 77 LONG Initialized; 78 79 } CLASSPNP_GLOBALS, *PCLASSPNP_GLOBALS; 80 81 82 // 83 // Define a structure used to capture stack traces when we 84 // get an access request and the disks are powered off. This 85 // will help us determine who's causing disk respins. 86 // 87 88 // 89 // How many stack frames to capture each time? 90 // 91 #define DISK_SPINUP_BACKTRACE_LENGTH (0x18) 92 93 // 94 // How many stack traces can we capture before 95 // out buffer wraps? (needs to be power of 2) 96 // 97 #define NUMBER_OF_DISK_SPINUP_TRACES (0x10) 98 99 typedef struct _DISK_SPINUP_TRACES { 100 101 LARGE_INTEGER TimeStamp; // timestamp of the spinup event. 102 PVOID StackTrace[DISK_SPINUP_BACKTRACE_LENGTH]; // Holds stack trace 103 } DISK_SPINUP_TRACES, *PDISK_SPINUP_TRACES; 104 105 106 #define DBGCHECKRETURNEDPKT(_pkt) DbgCheckReturnedPkt(_pkt) 107 #define DBGLOGSENDPACKET(_pkt) DbgLogSendPacket(_pkt) 108 #define DBGLOGRETURNPACKET(_pkt) DbgLogReturnPacket(_pkt) 109 #define DBGLOGFLUSHINFO(_fdoData, _isIO, _isFUA, _isFlush) DbgLogFlushInfo(_fdoData, _isIO, _isFUA, _isFlush) 110 111 VOID ClasspInitializeDebugGlobals(); 112 VOID DbgCheckReturnedPkt(TRANSFER_PACKET *Pkt); 113 VOID DbgLogSendPacket(TRANSFER_PACKET *Pkt); 114 VOID DbgLogReturnPacket(TRANSFER_PACKET *Pkt); 115 VOID DbgLogFlushInfo(PCLASS_PRIVATE_FDO_DATA FdoData, BOOLEAN IsIO, BOOLEAN IsFUA, BOOLEAN IsFlush); 116 VOID SnapDiskStartup(VOID); 117 extern CLASSPNP_GLOBALS ClasspnpGlobals; 118 extern LONG ClassDebug; 119 extern BOOLEAN DebugTrapOnWarn; 120 121 #else 122 123 #define ClasspInitializeDebugGlobals() 124 #define SnapDiskStartup() 125 126 #define DBGCHECKRETURNEDPKT(_pkt) 127 #define DBGLOGSENDPACKET(_pkt) 128 #define DBGLOGRETURNPACKET(_pkt) 129 #define DBGLOGFLUSHINFO(_fdoData, _isIO, _isFUA, _isFlush) 130 131 #endif 132 133