ReactOS  0.4.15-dev-1200-gc3b3fcd
debug.h
Go to the documentation of this file.
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 
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
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 
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 
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);
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 
_In_ PTRANSFER_PACKET Pkt
Definition: classp.h:1754
char * DbgGetSrbStatusStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:722
char * DbgGetScsiOpStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:609
unsigned char * PUCHAR
Definition: retypes.h:3
char * DbgGetIoctlStr(ULONG ioctl)
Definition: debug.c:571
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
struct SRB_ALIGN _STORAGE_REQUEST_BLOCK_HEADER * PSTORAGE_REQUEST_BLOCK_HEADER
long LONG
Definition: pedump.c:60
#define ioctl
Definition: wintirpc.h:60
unsigned char BOOLEAN
#define SnapDiskStartup()
Definition: debug.h:124
char * DbgGetAdditionalSenseCodeStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:826
static const UCHAR Index[8]
Definition: usbohci.c:18
SECURITY_INTEGER TimeStamp
Definition: sspi.h:78
ULONG_PTR SIZE_T
Definition: typedefs.h:80
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define ClasspInitializeDebugGlobals()
Definition: debug.h:123
unsigned int ULONG
Definition: retypes.h:1
char * DbgGetAdditionalSenseCodeQualifierStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:882
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
char * DbgGetSenseCodeStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:777