ReactOS  0.4.15-dev-1201-gb2cf5a4
classp.h
Go to the documentation of this file.
1 /*++
2 
3 Copyright (C) Microsoft Corporation, 1991 - 2010
4 
5 Module Name:
6 
7  classp.h
8 
9 Abstract:
10 
11  Private header file for classpnp.sys modules. This contains private
12  structure and function declarations as well as constant values which do
13  not need to be exported.
14 
15 Author:
16 
17 Environment:
18 
19  kernel mode only
20 
21 Notes:
22 
23 
24 Revision History:
25 
26 --*/
27 
28 #define RTL_USE_AVL_TABLES 0
29 
30 #include <stddef.h>
31 #include <stdarg.h>
32 #include <stdlib.h>
33 
34 #include <ntddk.h>
35 
36 #ifdef __REACTOS__
37 #include <pseh/pseh2.h>
38 #endif
39 
40 #include <scsi.h>
41 
42 #include <wmidata.h>
43 #include <classpnp.h>
44 #include <storduid.h>
45 
46 #if CLASS_INIT_GUID
47 #include <initguid.h>
48 #endif
49 
50 #include <mountdev.h>
51 #include <ioevent.h>
52 #include <ntstrsafe.h>
53 #include <ntintsafe.h>
54 
55 #include <wdmguid.h>
56 
57 #if (NTDDI_VERSION >= NTDDI_WIN8)
58 
59 #include <ntpoapi.h>
60 
61 #include <srbhelper.h>
62 
63 #endif
64 
65 #ifdef __REACTOS__
66 #undef MdlMappingNoExecute
67 #define MdlMappingNoExecute 0
68 #define NonPagedPoolNx NonPagedPool
69 #define NonPagedPoolNxCacheAligned NonPagedPoolCacheAligned
70 #undef POOL_NX_ALLOCATION
71 #define POOL_NX_ALLOCATION 0
72 #endif
73 
74 //
75 // Set component ID for DbgPrintEx calls
76 //
77 #ifndef DEBUG_COMP_ID
78 #define DEBUG_COMP_ID DPFLTR_CLASSPNP_ID
79 #endif
80 
81 //
82 // Include header file and setup GUID for tracing
83 //
84 #include <storswtr.h>
85 #define WPP_GUID_CLASSPNP (FA8DE7C4, ACDE, 4443, 9994, C4E2359A9EDB)
86 #ifndef WPP_CONTROL_GUIDS
87 #define WPP_CONTROL_GUIDS WPP_CONTROL_GUIDS_NORMAL_FLAGS(WPP_GUID_CLASSPNP)
88 #endif
89 
90 /*
91  * IA64 requires 8-byte alignment for pointers, but the IA64 NT kernel expects 16-byte alignment
92  */
93 #ifdef _WIN64
94  #define PTRALIGN DECLSPEC_ALIGN(16)
95 #else
96  #define PTRALIGN
97 #endif
98 
99 
101 
106 
108 
109 
110 #define Add2Ptr(P,I) ((PVOID)((PUCHAR)(P) + (I)))
111 
112 #define CLASSP_REG_SUBKEY_NAME (L"Classpnp")
113 
114 #define CLASSP_REG_HACK_VALUE_NAME (L"HackMask")
115 #define CLASSP_REG_MMC_DETECTION_VALUE_NAME (L"MMCDetectionState")
116 #define CLASSP_REG_WRITE_CACHE_VALUE_NAME (L"WriteCacheEnableOverride")
117 #define CLASSP_REG_PERF_RESTORE_VALUE_NAME (L"RestorePerfAtCount")
118 #define CLASSP_REG_REMOVAL_POLICY_VALUE_NAME (L"UserRemovalPolicy")
119 #define CLASSP_REG_IDLE_INTERVAL_NAME (L"IdleInterval")
120 #define CLASSP_REG_IDLE_ACTIVE_MAX (L"IdleOutstandingIoMax")
121 #define CLASSP_REG_IDLE_PRIORITY_SUPPORTED (L"IdlePrioritySupported")
122 #define CLASSP_REG_ACCESS_ALIGNMENT_NOT_SUPPORTED (L"AccessAlignmentQueryNotSupported")
123 #define CLASSP_REG_DISBALE_IDLE_POWER_NAME (L"DisableIdlePowerManagement")
124 #define CLASSP_REG_IDLE_TIMEOUT_IN_SECONDS (L"IdleTimeoutInSeconds")
125 #define CLASSP_REG_DISABLE_D3COLD (L"DisableD3Cold")
126 #define CLASSP_REG_QERR_OVERRIDE_MODE (L"QERROverrideMode")
127 #define CLASSP_REG_LEGACY_ERROR_HANDLING (L"LegacyErrorHandling")
128 #define CLASSP_REG_COPY_OFFLOAD_MAX_TARGET_DURATION (L"CopyOffloadMaxTargetDuration")
129 
130 #define CLASS_PERF_RESTORE_MINIMUM (0x10)
131 #define CLASS_ERROR_LEVEL_1 (0x4)
132 #define CLASS_ERROR_LEVEL_2 (0x8)
133 #define CLASS_MAX_INTERLEAVE_PER_CRITICAL_IO (0x4)
134 
135 #define FDO_HACK_CANNOT_LOCK_MEDIA (0x00000001)
136 #define FDO_HACK_GESN_IS_BAD (0x00000002)
137 #define FDO_HACK_NO_SYNC_CACHE (0x00000004)
138 #define FDO_HACK_NO_RESERVE6 (0x00000008)
139 #define FDO_HACK_GESN_IGNORE_OPCHANGE (0x00000010)
140 
141 #define FDO_HACK_VALID_FLAGS (0x0000001F)
142 #define FDO_HACK_INVALID_FLAGS (~FDO_HACK_VALID_FLAGS)
143 
144 /*
145  * Lots of retries of synchronized SCSI commands that devices may not
146  * even support really slows down the system (especially while booting).
147  * (Even GetDriveCapacity may be failed on purpose if an external disk is powered off).
148  * If a disk cannot return a small initialization buffer at startup
149  * in two attempts (with delay interval) then we cannot expect it to return
150  * data consistently with four retries.
151  * So don't set the retry counts as high here as for data SRBs.
152  *
153  * If we find that these requests are failing consecutively,
154  * despite the retry interval, on otherwise reliable media,
155  * then we should either increase the retry interval for
156  * that failure or (by all means) increase these retry counts as appropriate.
157  */
158 #define NUM_LOCKMEDIAREMOVAL_RETRIES 1
159 #define NUM_MODESENSE_RETRIES 1
160 #define NUM_MODESELECT_RETRIES 1
161 #define NUM_DRIVECAPACITY_RETRIES 1
162 #define NUM_THIN_PROVISIONING_RETRIES 32
163 
164 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
165 
166 //
167 // New code should use the MAXIMUM_RETRIES value.
168 //
169 #define NUM_IO_RETRIES MAXIMUM_RETRIES
170 #define LEGACY_NUM_IO_RETRIES 8
171 
172 #else
173 
174 /*
175  * We retry failed I/O requests at 1-second intervals.
176  * In the case of a failure due to bus reset, we want to make sure that we retry after the allowable
177  * reset time. For SCSI, the allowable reset time is 5 seconds. ScsiPort queues requests during
178  * a bus reset, which should cause us to retry after the reset is over; but the requests queued in
179  * the miniport are failed all the way back to us immediately. In any event, in order to make
180  * extra sure that our retries span the allowable reset time, we should retry more than 5 times.
181  */
182 #define NUM_IO_RETRIES 8
183 
184 #endif // NTDDI_VERSION >= NTDDI_WINBLUE
185 
186 #define CLASS_FILE_OBJECT_EXTENSION_KEY 'eteP'
187 #define CLASSP_VOLUME_VERIFY_CHECKED 0x34
188 
189 #define CLASS_TAG_PRIVATE_DATA 'CPcS'
190 #define CLASS_TAG_SENSE2 '2ScS'
191 #define CLASS_TAG_WORKING_SET 'sWcS'
192 #define CLASSPNP_POOL_TAG_GENERIC 'pCcS'
193 #define CLASSPNP_POOL_TAG_TOKEN_OPERATION 'oTcS'
194 #define CLASSPNP_POOL_TAG_SRB 'rScS'
195 #define CLASSPNP_POOL_TAG_VPD 'pVcS'
196 #define CLASSPNP_POOL_TAG_LOG_MESSAGE 'mlcS'
197 #define CLASSPNP_POOL_TAG_ADDITIONAL_DATA 'DAcS'
198 #define CLASSPNP_POOL_TAG_FIRMWARE 'wFcS'
199 
200 //
201 // Macros related to Token Operation commands
202 //
203 #define MAX_LIST_IDENTIFIER MAXULONG
204 #define NUM_POPULATE_TOKEN_RETRIES 1
205 #define NUM_WRITE_USING_TOKEN_RETRIES 2
206 #define NUM_RECEIVE_TOKEN_INFORMATION_RETRIES 2
207 #define MAX_TOKEN_OPERATION_PARAMETER_DATA_LENGTH MAXUSHORT
208 #define MAX_RECEIVE_TOKEN_INFORMATION_PARAMETER_DATA_LENGTH MAXULONG
209 #define MAX_TOKEN_TRANSFER_SIZE MAXULONGLONG
210 #define MAX_NUMBER_BLOCKS_PER_BLOCK_DEVICE_RANGE_DESCRIPTOR MAXULONG
211 #define DEFAULT_MAX_TARGET_DURATION 4 // 4sec
212 #define DEFAULT_MAX_NUMBER_BYTES_PER_SYNC_WRITE_USING_TOKEN (64ULL * 1024 * 1024) // 64MB
213 #define MAX_NUMBER_BYTES_PER_SYNC_WRITE_USING_TOKEN (256ULL * 1024 * 1024) // 256MB
214 #define MIN_TOKEN_LIST_IDENTIFIERS 256
215 #define MAX_TOKEN_LIST_IDENTIFIERS MAXULONG
216 #define MAX_NUMBER_BLOCK_DEVICE_DESCRIPTORS 64
217 
218 #define REG_DISK_CLASS_CONTROL L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\DISK"
219 #define REG_MAX_LIST_IDENTIFIER_VALUE L"MaximumListIdentifier"
220 
221 #define VPD_PAGE_HEADER_SIZE 0x04
222 
223 
224 //
225 // Number of times to retry get LBA status in case of an error
226 // that can be caused by VPD data change
227 //
228 
229 #define GET_LBA_STATUS_RETRY_COUNT_MAX (2)
230 
232 extern volatile ULONG TokenOperationListIdentifier;
233 
237 extern BOOLEAN ClasspScreenOff;
240 
241 //
242 // Definitions from ntos\rtl\time.c
243 //
244 
246 #define SHIFT10000 13
247 
248 //
249 // Constant to help wih various time conversions
250 //
251 #define CONST_MSECS_PER_SEC 1000
252 
253 #define Convert100nsToMilliseconds(LARGE_INTEGER) \
254  ( \
255  RtlExtendedMagicDivide((LARGE_INTEGER), Magic10000, SHIFT10000) \
256  )
257 
258 #define ConvertMillisecondsTo100ns(MILLISECONDS) ( \
259  RtlExtendedIntegerMultiply ((MILLISECONDS), 10000) \
260  )
261 
262 typedef struct _MEDIA_CHANGE_DETECTION_INFO {
263 
264  //
265  // Mutex to synchronize enable/disable requests and media state changes
266  //
267 
269 
270  //
271  // The current state of the media (present, not present, unknown)
272  // protected by MediaChangeSynchronizationEvent
273  //
274 
276 
277  //
278  // This is a count of how many time MCD has been disabled. if it is
279  // set to zero, then we'll poll the device for MCN events with the
280  // then-current method (ie. TEST UNIT READY or GESN). this is
281  // protected by MediaChangeMutex
282  //
283 
285 
286 
287  //
288  // The timer value to support media change events. This is a countdown
289  // value used to determine when to poll the device for a media change.
290  // The max value for the timer is 255 seconds. This is not protected
291  // by an event -- simply InterlockedExchanged() as needed.
292  //
293 
295 
296  //
297  // recent changes allowed instant retries of the MCN irp. Since this
298  // could cause an infinite loop, keep a count of how many times we've
299  // retried immediately so that we can catch if the count exceeds an
300  // arbitrary limit.
301  //
302 
304 
305  //
306  // use GESN if it's available
307  //
308 
309  struct {
314  PUCHAR Buffer;
315  PMDL Mdl;
317  } Gesn;
318 
319  //
320  // If this value is one, then the irp is currently in use.
321  // If this value is zero, then the irp is available.
322  // Use InterlockedCompareExchange() to set from "available" to "in use".
323  // ASSERT that InterlockedCompareExchange() showed previous value of
324  // "in use" when changing back to "available" state.
325  // This also implicitly protects the MediaChangeSrb and SenseBuffer
326  //
327 
329 
330  //
331  // Pointer to the irp to be used for media change detection.
332  // protected by Interlocked MediaChangeIrpInUse
333  //
334 
336 
337  //
338  // The srb for the media change detection.
339  // protected by Interlocked MediaChangeIrpInUse
340  //
341 
342 #if (NTDDI_VERSION >= NTDDI_WIN8)
343  union {
347  } MediaChangeSrb;
348 #else
350 #endif
352  ULONG SrbFlags;
353 
354  //
355  // Second timer to keep track of how long the media change IRP has been
356  // in use. If this value exceeds the timeout (#defined) then we should
357  // print out a message to the user and set the MediaChangeIrpLost flag
358  // protected by using Interlocked() operations in ClasspSendMediaStateIrp,
359  // the only routine which should modify this value.
360  //
361 
363 
364  //
365  // Set by CdRomTickHandler when we determine that the media change irp has
366  // been lost
367  //
368 
370 
371  //
372  // Buffer size of SenseBuffer
373  //
375 
377 
378 typedef enum {
383 
384 typedef struct _FAILURE_PREDICTION_INFO {
386  ULONG CountDown; // Countdown timer
387  ULONG Period; // Countdown period
388 
390 
392 
393  //
394  // Timestamp of last time the failure prediction info was queried.
395  //
397 
399 
400 
401 
402 //
403 // This struct must always fit within four PVOIDs of info,
404 // as it uses the irp's "PVOID DriverContext[4]" to store
405 // this info
406 //
407 typedef struct _CLASS_RETRY_INFO {
410 
411 typedef struct _CSCAN_LIST {
412 
413  //
414  // The current block which has an outstanding request.
415  //
416 
418 
419  //
420  // The list of blocks past the CurrentBlock to which we're going to do
421  // i/o. This list is maintained in sorted order.
422  //
423 
425 
426  //
427  // The list of blocks behind the current block for which we'll have to
428  // wait until the next scan across the disk. This is kept as a stack,
429  // the cost of sorting it is taken when it's moved over to be the
430  // running list.
431  //
432 
434 
436 
437 //
438 // add to the front of this structure to help prevent illegal
439 // snooping by other utilities.
440 //
441 
442 
443 
449 
450 #if _MSC_VER >= 1600
451 #pragma warning(push)
452 #pragma warning(disable:4214) // bit field types other than int
453 #endif
454 //
455 // CLASS_ERROR_LOG_DATA will still use SCSI_REQUEST_BLOCK even
456 // when using extended SRB as an extended SRB is too large to
457 // fit into. Should revisit this code once classpnp starts to
458 // use greater than 16 byte CDB.
459 //
460 typedef struct _CLASS_ERROR_LOG_DATA {
461  LARGE_INTEGER TickCount; // Offset 0x00
462  ULONG PortNumber; // Offset 0x08
463 
464  UCHAR ErrorPaging : 1; // Offset 0x0c
468 
470 
471  SCSI_REQUEST_BLOCK Srb; // Offset 0x10
472 
473  /*
474  * We define the SenseData as the default length.
475  * Since the sense data returned by the port driver may be longer,
476  * SenseData must be at the end of this structure.
477  * For our internal error log, we only log the default length.
478  */
479  SENSE_DATA SenseData; // Offset 0x50 for x86 (or 0x68 for ia64) (ULONG32 Alignment required!)
480 
482 #if _MSC_VER >= 1600
483 #pragma warning(pop)
484 #endif
485 
486 #define NUM_ERROR_LOG_ENTRIES 16
487 #define DBG_NUM_PACKET_LOG_ENTRIES (64*2) // 64 send&receive's
488 
489 #if (NTDDI_VERSION >= NTDDI_WIN8)
490 typedef
491 VOID
494  );
495 #endif
496 
497 typedef struct _TRANSFER_PACKET {
498 
499  LIST_ENTRY AllPktsListEntry; // entry in fdoData's static AllTransferPacketsList
500  SLIST_ENTRY SlistEntry; // for when in free list (use fast slist)
501 
504 
505  /*
506  * This is the client IRP that this TRANSFER_PACKET is currently
507  * servicing.
508  */
511 
512  /*
513  * Stuff for retrying the transfer.
514  */
515 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
516  UCHAR NumRetries; // Total number of retries remaining.
517  UCHAR NumThinProvisioningRetries; //Number of retries carried out so far for a request failed with THIN_PROVISIONING_SOFT_THRESHOLD_ERROR
518  UCHAR NumIoTimeoutRetries; // Number of retries remaining for a timed-out request.
519  UCHAR TimedOut; // Indicates if this packet has timed-out.
520 #else
522 #endif
525 
527  LONGLONG RetryIn100nsUnits;
528 
529  /*
530  * Event for synchronizing the transfer (optional).
531  * (Note that we can't have the event in the packet itself because
532  * by the time a thread waits on an event the packet may have
533  * been completed and re-issued.
534  */
536 
537  /*
538  * Stuff for retrying during extreme low-memory stress
539  * (when we retry 1 page at a time).
540  * NOTE: These fields are also used for StartIO-based
541  * class drivers, even when not in low memory conditions.
542  */
543  BOOLEAN DriverUsesStartIO; // if this is set, then the below low-mem flags are always used
548 
549  /*
550  * Fields used for cancelling the packet.
551  */
552  // BOOLEAN Cancelled;
553  // KEVENT CancelledEvent;
554 
555  /*
556  * We keep the buffer and length values here as well
557  * as in the SRB because some miniports return
558  * the transferred length in SRB.DataTransferLength,
559  * and if the SRB failed we need that value again for the retry.
560  * We don't trust the lower stack to preserve any of these values in the SRB.
561  */
565 
566  /*
567  * This is a standard SCSI structure that receives a detailed
568  * report about a SCSI error on the hardware.
569  */
571 
572  /*
573  * This is the SRB block for this TRANSFER_PACKET.
574  * For IOCTLs, the SRB block includes two DWORDs for
575  * device object and ioctl code; so these must
576  * immediately follow the SRB block.
577  */
578 
579 #if (NTDDI_VERSION >= NTDDI_WIN8)
581 #else
583 #endif
584  // ULONG SrbIoctlDevObj; // not handling ioctls yet
585  // ULONG SrbIoctlCode;
586 
587  #if DBG
588  LARGE_INTEGER DbgTimeSent;
589  LARGE_INTEGER DbgTimeReturned;
590  ULONG DbgPktId;
591  IRP DbgOriginalIrpCopy;
592  MDL DbgMdlCopy;
593  #endif
594 
597 
599 
600  // The time at which this request was sent to port driver.
602 
603 #if (NTDDI_VERSION >= NTDDI_WIN8)
604  // ActivityId that is associated with the IRP that this transfer packet services.
606 
607  // If non-NULL, called at packet completion with this context.
612 #endif
614 
615 /*
616  * MIN_INITIAL_TRANSFER_PACKETS is the minimum number of packets that
617  * we preallocate at startup for each device (we need at least one packet
618  * to guarantee forward progress during memory stress).
619  * MIN_WORKINGSET_TRANSFER_PACKETS is the number of TRANSFER_PACKETs
620  * we allow to build up and remain for each device;
621  * we _lazily_ work down to this number when they're not needed.
622  * MAX_WORKINGSET_TRANSFER_PACKETS is the number of TRANSFER_PACKETs
623  * that we _immediately_ reduce to when they are not needed.
624  *
625  * The absolute maximum number of packets that we will allocate is
626  * whatever is required by the current activity, up to the memory limit;
627  * as soon as stress ends, we snap down to MAX_WORKINGSET_TRANSFER_PACKETS;
628  * we then lazily work down to MIN_WORKINGSET_TRANSFER_PACKETS.
629  */
630 #define MIN_INITIAL_TRANSFER_PACKETS 1
631 #define MIN_WORKINGSET_TRANSFER_PACKETS_Client 16
632 #define MAX_WORKINGSET_TRANSFER_PACKETS_Client 32
633 #define MIN_WORKINGSET_TRANSFER_PACKETS_Server_UpperBound 256
634 #define MIN_WORKINGSET_TRANSFER_PACKETS_Server_LowerBound 32
635 #define MAX_WORKINGSET_TRANSFER_PACKETS_Server 1024
636 #define MIN_WORKINGSET_TRANSFER_PACKETS_SPACES 512
637 #define MAX_WORKINGSET_TRANSFER_PACKETS_SPACES 2048
638 #define MAX_OUTSTANDING_IO_PER_LUN_DEFAULT 16
639 #define MAX_CLEANUP_TRANSFER_PACKETS_AT_ONCE 8192
640 
641 
642 
643 typedef struct _PNL_SLIST_HEADER {
649 
650 //
651 // !!! WARNING !!!
652 // DO NOT use the following structure in code outside of classpnp
653 // as structure will not be guaranteed between OS versions.
654 //
655 // add to the front of this structure to help prevent illegal
656 // snooping by other utilities.
657 //
659 
660  //
661  // The amount of time allowed for a target to complete a copy offload
662  // operation, in seconds. Default is 4s, but it can be modified via
663  // registry key.
664  //
666 
667 
668 #if (NTDDI_VERSION >= NTDDI_WIN8)
669 
670  //
671  // Periodic timer for polling for media change detection, failure prediction
672  // and class tick function.
673  //
674 
675 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
678 #else
680  KDPC TickTimerDpc;
681 #endif // (NTDDI_VERSION >= NTDDI_WINBLUE)
682 
683  //
684  // Power related and release queue SRBs
685  //
686  union {
689  } PowerSrb;
690 
691  union {
694  } ReleaseQueueSrb;
695 
696 #endif
697 
699 
700  /*
701  * Flag to detect recursion caused by devices
702  * reporting different capacity per each request
703  */
705 
706  //
707  // Local equivalents of MinWorkingSetTransferPackets and MaxWorkingSetTransferPackets.
708  // These values are initialized by the global equivalents but are then adjusted as
709  // requested by the class driver.
710  //
713 
714 #if DBG
715 
716  ULONG MaxOutstandingIOPerLUN;
717 
718 #endif
719 
720  /*
721  * Entry in static list used by debug extension to quickly find all class FDOs.
722  */
724 
725  //
726  // this private structure allows us to
727  // dynamically re-enable the perf benefits
728  // lost due to transient error conditions.
729  // in w2k, a reboot was required. :(
730  //
731  struct {
734  ULONG ReEnableThreshhold; // 0 means never
735  } Perf;
736 
738 
740 
741  // Legacy. Still used by obsolete legacy code.
742  struct {
743  LARGE_INTEGER Delta; // in ticks
744  LARGE_INTEGER Tick; // when it should fire
745  PCLASS_RETRY_INFO ListHead; // singly-linked list
746  ULONG Granularity; // static
747  KSPIN_LOCK Lock; // protective spin lock
748  KDPC Dpc; // DPC routine object
749  KTIMER Timer; // timer to fire DPC
750  } Retry;
751 
755 
756  //
757  // privately allocated release queue irp
758  // protected by fdoExtension->ReleaseQueueSpinLock
759  //
762 
763  /*
764  * Queues for TRANSFER_PACKETs that contextualize the IRPs and SRBs
765  * that we send down to the port driver.
766  * (The free list is an slist so that we can use fast
767  * interlocked operations on it; but the relatively-static
768  * AllTransferPacketsList list has to be
769  * a doubly-linked list since we have to dequeue from the middle).
770  */
773 
774  /*
775  * Queue for deferred client irps
776  */
778 
779  /*
780  * Precomputed maximum transfer length for the hardware.
781  */
783 
784  /*
785  * SCSI_REQUEST_BLOCK template preconfigured with the constant values.
786  * This is slapped into the SRB in the TRANSFER_PACKET for each transfer.
787  */
788 
789 #if (NTDDI_VERSION >= NTDDI_WIN8)
791 #else
793 #endif
794 
796 
797  /*
798  * For non-removable media, we read the drive capacity at start time and cache it.
799  * This is so that ReadDriveCapacity failures at runtime (e.g. due to memory stress)
800  * don't cause I/O on the paging disk to start failing.
801  */
804 
805  //
806  // Idle priority support flag
807  //
809 
810  //
811  // Tick timer enabled
812  //
814 
816 
817  /*
818  * Circular array of timestamped logs of errors that occurred on this device.
819  */
822 
823  //
824  // Number of outstanding critical Io requests from Mm
825  //
827 
828  //
829  // Maximum number of normal Io requests that can be interleaved with the critical ones
830  //
832 
833  //
834  // The timestamp when entering throttle mode
835  //
837 
838  //
839  // The timestamp when exiting throttle mode
840  //
842 
843  //
844  // The longest time ever spent in throttle mode
845  //
847 
848  #if DBG
849  ULONG DbgMaxPktId;
850 
851  /*
852  * Logging fields for ForceUnitAccess and Flush
853  */
854  BOOLEAN DbgInitFlushLogging; // must reset this to 1 for each logging session
855  ULONG DbgNumIORequests;
856  ULONG DbgNumFUAs; // num I/O requests with ForceUnitAccess bit set
857  ULONG DbgNumFlushes; // num SRB_FUNCTION_FLUSH_QUEUE
858  ULONG DbgIOsSinceFUA;
859  ULONG DbgIOsSinceFlush;
860  ULONG DbgAveIOsToFUA; // average number of I/O requests between FUAs
861  ULONG DbgAveIOsToFlush; // ...
862  ULONG DbgMaxIOsToFUA;
863  ULONG DbgMaxIOsToFlush;
864  ULONG DbgMinIOsToFUA;
865  ULONG DbgMinIOsToFlush;
866 
867  /*
868  * Debug log of previously sent packets (including retries).
869  */
870  ULONG DbgPacketLogNextIndex;
872  #endif
873 
874  //
875  // Spin lock for low priority I/O list
876  //
878 
879  //
880  // Queue for low priority I/O
881  //
883 
884  //
885  // Timer for low priority I/O
886  //
888 
889  //
890  // DPC for low priority I/O
891  //
893 
894 #if (NTDDI_VERSION >= NTDDI_WIN8)
895 
896  //
897  // Time (ms) since the completion of the last non-idle request before the
898  // first idle request should be issued. Due to the coarseness of the idle
899  // timer frequency, some variability in the idle interval will be tolerated
900  // such that it is the desired idle interval on average.
901  //
903 
904  //
905  // Max number of active idle requests.
906  //
908 
909 #endif
910 
911  //
912  // Idle duration required to process idle request
913  // to avoid starvation
914  //
916 
917  //
918  // Idle I/O count
919  //
921 
922  //
923  // Flag to indicate timer status
924  //
926 
927  //
928  // Time when the Idle timer was started
929  //
931 
932  //
933  // Normal priority I/O time
934  //
936 
937  //
938  // Time when the last IO of any priority completed.
939  //
941 
942  //
943  // Count of active normal priority I/O
944  //
946 
947  //
948  // Count of active idle priority I/O
949  //
951 
952  //
953  // Support for class drivers to extend
954  // the interpret sense information routine
955  // and retry history per-packet. Copy of
956  // values in driver extension.
957  //
959 
960  //
961  // power process parameters. they work closely with CLASS_POWER_CONTEXT structure.
962  //
965 
966  //
967  // Indicates legacy error handling should be used.
968  // This means:
969  // - Max number of retries for an IO request is 8 (instead of 4).
970  //
972 
973  //
974  // Maximum number of retries allowed for IO requests for this device.
975  //
977 
978  //
979  // Disable All Throttling in case of Error
980  //
982 
983 };
984 
985 //
986 // !!! WARNING !!!
987 // DO NOT use the following structure in code outside of classpnp
988 // as structure will not be guaranteed between OS versions.
989 //
990 // EX_RUNDOWN_REF_CACHE_AWARE is variable size and follows
991 // RemoveLockFailAcquire. EX_RUNDOWN_REF_CACHE_AWARE must be part
992 // of the device extension allocation to avoid issues with a device
993 // that has been PNP remove but still has outstanding references.
994 // In this case, the removed object may still receive incoming requests.
995 //
996 // There are code dependencies on the structure layout. To minimize
997 // code changes, new fields to _CLASS_PRIVATE_COMMON_DATA should be
998 // added based on the following guidance.
999 // - Fixed size: beginning of _CLASS_PRIVATE_COMMON_DATA
1000 // - Variable size: at the end of _CLASS_PRIVATE_COMMON_DATA after the
1001 // last variable size field.
1002 //
1003 
1005 
1006  //
1007  // Cacheaware rundown lock reference
1008  //
1009 
1011 
1012  //
1013  // N.B. EX_RUNDOWN_REF_CACHE_AWARE begins with a pointer-sized item that is
1014  // accessed interlocked, and must be aligned on ARM platforms. In order
1015  // for this to work on ARM64, an additional 32-bit slot must be allocated.
1016  //
1017 
1018 #if defined(_WIN64)
1019  LONG Align;
1020 #endif
1021 
1022  // EX_RUNDOWN_REF_CACHE_AWARE (variable size) follows
1023 
1024 };
1025 
1026 //
1027 // Verify that the size of _CLASS_PRIVATE_COMMON_DATA is pointer size aligned
1028 // to ensure the EX_RUNDOWN_REF_CACHE_AWARE following it is properly aligned.
1029 //
1030 
1031 C_ASSERT((sizeof(struct _CLASS_PRIVATE_COMMON_DATA) % sizeof(PVOID)) == 0);
1032 
1037 
1038 typedef struct _OFFLOAD_READ_CONTEXT {
1039 
1041 
1042  //
1043  // Upper offload read DSM irp.
1044  //
1045 
1047 
1048  //
1049  // A pseudo-irp is used despite the operation being async. This is in
1050  // contrast to normal read and write, which let TransferPktComplete()
1051  // complete the upper IRP directly. Offload requests are enough different
1052  // that it makes more sense to let them manage their own async steps with
1053  // minimal help from TransferPktComplete() (just a continuation function
1054  // call during TransferPktComplete()).
1055  //
1056 
1058 
1059  //
1060  // The offload read context tracks one packet in flight at a time - it'll be
1061  // the POPULATE TOKEN packet first, then RECEIVE ROD TOKEN INFORMATION.
1062  //
1063  // This field exists only for debug purposes.
1064  //
1065 
1067 
1069 
1071 
1073 
1075 
1076  //
1077  // Total sectors that the operation is attempting to process.
1078  //
1079 
1081 
1082  //
1083  // Total sectors actually processed.
1084  //
1085 
1087 
1088  //
1089  // Total upper request size in bytes.
1090  //
1091 
1093 
1094  //
1095  // Just a cached copy of what was in the transfer packet.
1096  //
1097 
1099 
1100  //
1101  // Pointer into the token part of the SCSI buffer (the buffer immediately
1102  // after this struct), for easy reference.
1103  //
1104 
1106 
1107  // The SCSI buffer (in/out buffer, not CDB) for the commands immediately
1108  // follows this struct, so no need to have a field redundantly pointing to
1109  // the buffer.
1111 
1112 
1113 typedef struct _OFFLOAD_WRITE_CONTEXT {
1114 
1116 
1118 
1121 
1123 
1128 
1131 
1134 
1136 
1138 
1142 
1144 
1145  //
1146  // Per-WUT (WRITE USING TOKEN), not overall.
1147  //
1148 
1151 
1153 
1155 
1156  //
1157  // Just a cached copy of what was in the transfer packet.
1158  //
1159 
1161 
1163 
1165 
1166 
1177 
1183 
1184 
1185 #define QERR_SET_ZERO_ODX_OR_TP_ONLY 0
1186 #define QERR_SET_ZERO_ALWAYS 1
1187 #define QERR_SET_ZERO_NEVER 2
1188 
1189 
1190 #define MIN(a, b) ((a) < (b) ? (a) : (b))
1191 #define MAX(a, b) ((a) > (b) ? (a) : (b))
1192 
1193 
1194 #define NOT_READY_RETRY_INTERVAL 10
1195 #define MINIMUM_RETRY_UNITS ((LONGLONG)32)
1196 #define MODE_PAGE_DATA_SIZE 192
1197 
1198 #define CLASS_IDLE_INTERVAL_MIN 12 // 12 milliseconds
1199 #define CLASS_IDLE_INTERVAL 12 // 12 milliseconds
1200 #define CLASS_STARVATION_INTERVAL 500 // 500 milliseconds
1201 
1202 //
1203 // Value of 50 milliseconds in 100 nanoseconds units
1204 //
1205 #define FIFTY_MS_IN_100NS_UNITS 50 * 100
1206 
1207 
1208 /*
1209  * Simple singly-linked-list queuing macros, with no synchronization.
1210  */
1212 {
1213  SListHdr->Next = NULL;
1214 }
1216 {
1217  SListEntry->Next = SListHdr->Next;
1218  SListHdr->Next = SListEntry;
1219 }
1221 {
1222  SINGLE_LIST_ENTRY *sListEntry = SListHdr->Next;
1223  if (sListEntry){
1224  SListHdr->Next = sListEntry->Next;
1225  sListEntry->Next = NULL;
1226  }
1227  return sListEntry;
1228 }
1230 {
1231  return (SListHdr->Next == NULL);
1232 }
1233 
1234 __inline
1235 BOOLEAN
1237  PCLASS_PRIVATE_FDO_DATA FdoData,
1238  PIRP Irp
1239  )
1240 {
1241 #ifndef __REACTOS__
1243  return ((ioPriority <= IoPriorityLow) && (FdoData->IdlePrioritySupported == TRUE));
1244 #else
1245  return (FdoData->IdlePrioritySupported == TRUE);
1246 #endif
1247 }
1248 
1249 __inline
1250 VOID
1252  PIRP Irp,
1253  BOOLEAN Idle
1254  )
1255 {
1256 #ifndef __REACTOS__
1257 // truncation is not an issue for this use case
1258 // nonstandard extension used is not an issue for this use case
1259 #pragma warning(suppress:4305; suppress:4213)
1260  ((BOOLEAN)Irp->Tail.Overlay.DriverContext[1]) = Idle;
1261 #else
1262  ((PULONG_PTR)Irp->Tail.Overlay.DriverContext)[1] = Idle;
1263 #endif
1264 }
1265 
1266 __inline
1267 BOOLEAN
1269  PIRP Irp
1270  )
1271 {
1272 #ifdef _MSC_VER
1273 #pragma warning(suppress:4305) // truncation is not an issue for this use case
1274 #endif
1275  return ((BOOLEAN)Irp->Tail.Overlay.DriverContext[1]);
1276 }
1277 
1278 __inline
1281  VOID
1282  )
1283 {
1284  LARGE_INTEGER currentTime;
1285 
1286 #ifndef __REACTOS__
1287  currentTime.QuadPart = KeQueryUnbiasedInterruptTimePrecise((ULONG64*)&currentTime.QuadPart);
1288 #else
1289  currentTime = KeQueryPerformanceCounter(NULL);
1290 #endif
1291 
1292  return currentTime;
1293 }
1294 
1295 __inline
1296 ULONGLONG
1298  ULONGLONG TimeDiff
1299  )
1300 {
1301  TimeDiff /= (10 * 1000);
1302 
1303  return TimeDiff;
1304 }
1305 
1306 __inline
1307 BOOLEAN
1310  )
1311 {
1312  return SupportInfo->LBProvisioningData.LBPU;
1313 }
1314 
1315 __inline
1316 BOOLEAN
1319  )
1320 {
1321  //
1322  // We only support thinly provisioned devices that also support UNMAP.
1323  //
1324  if (SupportInfo->LBProvisioningData.ProvisioningType == PROVISIONING_TYPE_THIN &&
1325  SupportInfo->LBProvisioningData.LBPU == TRUE)
1326  {
1327  return TRUE;
1328  }
1329 
1330  return FALSE;
1331 }
1332 
1333 __inline
1334 BOOLEAN
1337  )
1338 {
1339  if ( (FdoExtension->MiniportDescriptor != NULL) &&
1340  (FdoExtension->MiniportDescriptor->Portdriver == StoragePortCodeSetSCSIport) ) {
1341  return TRUE;
1342  }
1343 
1344  return FALSE;
1345 }
1346 
1347 
1348 ULONG
1350  _In_ PDEVICE_OBJECT Fdo,
1351  _In_ ULONG BytesPerBlockInBigEndian
1352  );
1353 
1354 DRIVER_INITIALIZE DriverEntry;
1355 
1356 DRIVER_UNLOAD ClassUnload;
1357 
1361 
1362 NTSTATUS
1365  IN PIRP Irp
1366  );
1367 
1368 VOID
1371  );
1372 
1373 NTSTATUS
1375  IN PDEVICE_OBJECT Fdo,
1376  IN PIRP Irp,
1378  IN BOOLEAN Lock
1379  );
1380 
1384 
1387 
1390 
1391 NTSTATUS
1394  );
1395 
1399 
1402 
1403 
1404 //
1405 // Class internal routines
1406 //
1407 
1408 DRIVER_ADD_DEVICE ClassAddDevice;
1409 
1410 IO_COMPLETION_ROUTINE ClasspSendSynchronousCompletion;
1411 
1412 VOID
1413 RetryRequest(
1415  PIRP Irp,
1417  BOOLEAN Associated,
1418  LONGLONG TimeDelta100ns
1419  );
1420 
1421 NTSTATUS
1424  IN PIRP Irp,
1425  IN PVOID Context
1426  );
1427 
1428 NTSTATUS
1430  IN PDEVICE_OBJECT Fdo,
1431  IN PIRP Irp
1432  );
1433 
1434 NTSTATUS
1436  IN PDEVICE_OBJECT Fdo,
1437  IN DEVICE_RELATION_TYPE RelationType,
1438  OUT PDEVICE_RELATIONS *DeviceRelations
1439  );
1440 
1441 NTSTATUS
1446  );
1447 
1448 NTSTATUS
1452  );
1453 
1454 DRIVER_STARTIO ClasspStartIo;
1455 
1456 NTSTATUS
1459  IN PIRP Irp,
1461  );
1462 
1463 NTSTATUS
1466  PIRP Irp,
1467  PVOID Context
1468  );
1469 
1470 NTSTATUS
1473  IN PIRP Irp,
1475  );
1476 
1477 VOID
1480  );
1481 
1482 VOID
1485  );
1486 
1487 VOID
1490  );
1491 
1492 NTSTATUS
1495 );
1496 
1497 VOID
1500 );
1501 
1502 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
1503 BOOLEAN
1506 );
1507 #endif
1508 
1509 NTSTATUS
1512  PIRP Irp
1513  );
1514 
1527 
1528 VOID
1531  );
1532 
1533 NTSTATUS
1536  _In_ PIRP Irp,
1538  );
1539 
1540 //
1541 // routines for dictionary list support
1542 //
1543 
1544 VOID
1546  IN PDICTIONARY Dictionary
1547  );
1548 
1549 BOOLEAN
1551  IN PDICTIONARY Dictionary
1552  );
1553 
1554 NTSTATUS
1556  IN PDICTIONARY Dictionary,
1557  IN ULONGLONG Key,
1558  IN ULONG Size,
1559  IN ULONG Tag,
1560  OUT PVOID *Entry
1561  );
1562 
1563 PVOID
1565  IN PDICTIONARY Dictionary,
1566  IN ULONGLONG Key
1567  );
1568 
1569 VOID
1571  IN PDICTIONARY Dictionary,
1572  IN PVOID Entry
1573  );
1574 
1575 
1576 NTSTATUS
1578  IN PDEVICE_OBJECT Fdo
1579  );
1580 
1581 VOID
1583  IN PDEVICE_OBJECT Fdo
1584  );
1585 
1586 IO_COMPLETION_ROUTINE ClassReleaseQueueCompletion;
1587 
1588 VOID
1591  IN PIRP ReleaseQueueIrp
1592  );
1593 
1594 VOID
1597 );
1598 
1599 //
1600 // class power routines
1601 //
1602 
1605 
1606 NTSTATUS
1607 NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
1610  IN PIRP Irp
1611  );
1612 
1614 NTSTATUS
1617  );
1618 
1619 POWER_SETTING_CALLBACK ClasspPowerSettingCallback;
1620 
1621 //
1622 // Child list routines
1623 //
1624 
1625 VOID
1629  _In_ BOOLEAN AcquireLock
1630  );
1631 
1636  IN BOOLEAN AcquireLock
1637  );
1638 
1639 VOID
1641  IN PCLASS_PRIVATE_FDO_DATA FdoData
1642  );
1643 
1644 KDEFERRED_ROUTINE ClasspRetryRequestDpc;
1645 
1646 VOID
1650  );
1651 
1652 VOID
1654  IN PDEVICE_OBJECT SelfDeviceObject,
1655  IN PIRP Irp,
1656  _In_ _In_range_(0,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) // this is 100 seconds; already an assert in classpnp based on this
1657  IN LONGLONG TimeDelta100ns // in 100ns units
1658  );
1659 
1660 VOID
1663  _In_ PIRP Irp,
1665  );
1666 
1667 NTSTATUS
1670  );
1671 
1672 NTSTATUS
1675  );
1676 
1677 NTSTATUS
1681  );
1682 
1683 VOID
1686  );
1687 
1688 VOID
1691  );
1692 
1693 VOID
1694 NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
1697  IN ULONG_PTR Data
1698  );
1699 
1700 NTSTATUS
1703  );
1704 
1705 VOID
1708  );
1709 VOID
1712  );
1713 
1714 IO_WORKITEM_ROUTINE ClasspUpdateDiskProperties;
1715 
1716 __drv_allocatesMem(Mem)
1717 PTRANSFER_PACKET NewTransferPacket(PDEVICE_OBJECT Fdo);
1724 IO_COMPLETION_ROUTINE TransferPktComplete;
1734 VOID SetupEjectionTransferPacket(TRANSFER_PACKET *Pkt, BOOLEAN PreventMediaRemoval, PKEVENT SyncEventPtr, PIRP OriginalIrp);
1735 VOID SetupModeSenseTransferPacket(TRANSFER_PACKET *Pkt, PKEVENT SyncEventPtr, PVOID ModeSenseBuffer, UCHAR ModeSenseBufferLen, UCHAR PageMode, UCHAR SubPage, PIRP OriginalIrp, UCHAR PageControl);
1736 VOID SetupModeSelectTransferPacket(TRANSFER_PACKET *Pkt, PKEVENT SyncEventPtr, PVOID ModeSelectBuffer, UCHAR ModeSelectBufferLen, BOOLEAN SavePages, PIRP OriginalIrp);
1747 
1751 VOID
1752 ClasspSetupPopulateTokenTransferPacket(
1753  _In_ __drv_aliasesMem POFFLOAD_READ_CONTEXT OffloadReadContext,
1755  _In_ ULONG Length,
1756  _In_reads_bytes_(Length) PUCHAR PopulateTokenBuffer,
1759  );
1760 
1764 VOID
1765 ClasspSetupReceivePopulateTokenInformationTransferPacket(
1766  _In_ POFFLOAD_READ_CONTEXT OffloadReadContext,
1768  _In_ ULONG Length,
1769  _In_reads_bytes_(Length) PUCHAR ReceivePopulateTokenInformationBuffer,
1772  );
1773 
1777 VOID
1778 ClasspSetupWriteUsingTokenTransferPacket(
1779  _In_ __drv_aliasesMem POFFLOAD_WRITE_CONTEXT OffloadWriteContext,
1781  _In_ ULONG Length,
1782  _In_reads_bytes_(Length) PUCHAR WriteUsingTokenBuffer,
1785  );
1786 
1790 VOID
1791 ClasspSetupReceiveWriteUsingTokenInformationTransferPacket(
1792  _In_ POFFLOAD_WRITE_CONTEXT OffloadWriteContext,
1794  _In_ ULONG Length,
1795  _In_reads_bytes_(Length) PUCHAR ReceiveWriteUsingTokenInformationBuffer,
1798  );
1799 
1801  _In_ PDEVICE_OBJECT Fdo,
1802  _In_reads_bytes_(Length) PCHAR ModeSenseBuffer,
1803  _In_ ULONG Length,
1806  );
1807 
1808 NTSTATUS
1810  _In_ PDEVICE_OBJECT Fdo,
1811  _In_reads_bytes_(Length) PCHAR ModeSelectBuffer,
1812  _In_ ULONG Length,
1813  _In_ BOOLEAN SavePages
1814  );
1815 
1818  _In_ PIRP Irp,
1820  );
1821 
1824  _In_ PIRP Irp,
1826  );
1827 
1830  _In_ PIRP Irp,
1832  );
1833 
1837  );
1838 
1840  _In_ PFUNCTIONAL_DEVICE_EXTENSION fdoExtension,
1842  );
1843 
1847  _In_ ULONG SrbSize,
1848  _Out_ PCLASS_VPD_B0_DATA BlockLimitsData
1849  );
1850 
1853  _In_ PIRP Irp,
1855  );
1856 
1859  _Inout_ PIRP Irp,
1861  );
1862 
1865  _In_ PIRP Irp,
1868  );
1869 
1872  _Inout_ PIRP Irp,
1874  );
1875 
1878  _In_ PCLASS_VPD_B0_DATA BlockLimitsData,
1880  _In_ ULONGLONG LengthInBytes,
1882  _Inout_ PULONG DsmOutputLength,
1884  _In_ BOOLEAN ConsolidateableBlocksOnly,
1885  _In_ ULONG OutputVersion,
1886  _Out_ PBOOLEAN BlockLimitsDataMayHaveChanged
1887  );
1888 
1891  );
1892 
1895  );
1896 
1899  );
1900 
1903  );
1904 
1905 IO_WORKITEM_ROUTINE ClasspLogIOEventWithContext;
1906 
1907 VOID
1910  _In_ ULONG SenseBufferSize,
1911  _In_ PVOID SenseData,
1912  _In_ UCHAR SrbStatus,
1913  _In_ UCHAR ScsiStatus,
1915  _In_ ULONG CdbLength,
1916  _In_opt_ PCDB Cdb,
1918  );
1919 
1920 VOID
1923  );
1924 
1925 
1927 NTSTATUS
1928 ClasspGetMaximumTokenListIdentifier(
1932  );
1933 
1935 NTSTATUS
1936 ClasspGetCopyOffloadMaxDuration(
1940  );
1941 
1945 NTSTATUS
1946 ClasspDeviceCopyOffloadProperty(
1950  );
1951 
1955 NTSTATUS
1956 ClasspValidateOffloadSupported(
1958  _In_ PIRP Irp
1959  );
1960 
1964 NTSTATUS
1965 ClasspValidateOffloadInputParameters(
1967  _In_ PIRP Irp
1968  );
1969 
1971 NTSTATUS
1973  _In_ PDEVICE_OBJECT Fdo,
1974  _In_ ULONG ServiceAction,
1975  _Inout_ PULONG CommandBufferLength,
1976  _Out_opt_ PULONG TokenOperationBufferLength,
1977  _Out_opt_ PULONG ReceiveTokenInformationBufferLength
1978  );
1979 
1981 NTSTATUS
1983  _In_ PDEVICE_OBJECT Fdo,
1984  _In_ ULONG ServiceAction,
1985  _In_ ULONG MaxParameterBufferLength,
1986  _Out_ PULONG MaxBlockDescriptorsCount,
1987  _Out_ PULONGLONG MaxBlockDescriptorsLength
1988  );
1989 
1993 VOID
1994 ClasspConvertDataSetRangeToBlockDescr(
1995  _In_ PDEVICE_OBJECT Fdo,
2003  );
2004 
2005 NTSTATUS
2008  _Inout_ PIRP Irp,
2010  );
2011 
2012 
2014 PUCHAR
2016  _In_reads_(Length) PUCHAR HexBuffer,
2017  _In_ ULONG Length,
2018  _Inout_ PULONG UpdateLength
2019  );
2020 
2021 __inline
2022 BOOLEAN
2024  _In_ ULONG CurrentStatus
2025  )
2026 {
2027  BOOLEAN operationCompleted = FALSE;
2028 
2029  switch (CurrentStatus) {
2033  case OPERATION_TERMINATED: {
2034 
2035  operationCompleted = TRUE;
2036  }
2037  }
2038 
2039  return operationCompleted;
2040 }
2041 
2042 __inline
2043 BOOLEAN
2045  _In_ PCDB Cdb
2046  )
2047 {
2048  BOOLEAN tokenOperation = FALSE;
2049 
2050  if (Cdb) {
2051  ULONG opCode = Cdb->AsByte[0];
2052  ULONG serviceAction = Cdb->AsByte[1];
2053 
2054  if ((opCode == SCSIOP_POPULATE_TOKEN && serviceAction == SERVICE_ACTION_POPULATE_TOKEN) ||
2055  (opCode == SCSIOP_WRITE_USING_TOKEN && serviceAction == SERVICE_ACTION_WRITE_USING_TOKEN)) {
2056 
2057  tokenOperation = TRUE;
2058  }
2059  }
2060 
2061  return tokenOperation;
2062 }
2063 
2064 __inline
2065 BOOLEAN
2067  _In_ PCDB Cdb
2068  )
2069 {
2070  BOOLEAN receiveTokenInformation = FALSE;
2071 
2072  if (Cdb) {
2073  ULONG opCode = Cdb->AsByte[0];
2074  ULONG serviceAction = Cdb->AsByte[1];
2075 
2077 
2078  receiveTokenInformation = TRUE;
2079  }
2080  }
2081 
2082  return receiveTokenInformation;
2083 }
2084 
2085 __inline
2086 BOOLEAN
2088  _In_ PCDB Cdb
2089  )
2090 {
2092 
2093  return offloadCommand;
2094 }
2095 
2096 extern LIST_ENTRY AllFdosList;
2097 
2098 
2099 VOID
2102  );
2103 
2104 NTSTATUS
2107  _Out_ PBOOLEAN IsPortable
2108  );
2109 
2110 VOID
2113  );
2114 
2115 NTSTATUS
2118  );
2119 
2120 
2123 NTSTATUS
2124 ClassDetermineTokenOperationCommandSupport(
2126  );
2127 
2129 NTSTATUS
2132  );
2133 
2137 NTSTATUS
2138 ClassDeviceProcessOffloadRead(
2140  _In_ PIRP Irp,
2142  );
2143 
2147 NTSTATUS
2148 ClassDeviceProcessOffloadWrite(
2150  _In_ PIRP Irp,
2152  );
2153 
2157 NTSTATUS
2158 ClasspServicePopulateTokenTransferRequest(
2159  _In_ PDEVICE_OBJECT Fdo,
2160  _In_ PIRP Irp
2161  );
2162 
2164 VOID
2166  _In_ POFFLOAD_READ_CONTEXT OffloadReadContext
2167  );
2168 
2172 NTSTATUS
2173 ClasspServiceWriteUsingTokenTransferRequest(
2174  _In_ PDEVICE_OBJECT Fdo,
2175  _In_ PIRP Irp
2176  );
2177 
2179 VOID
2181  _In_ POFFLOAD_WRITE_CONTEXT OffloadWriteContext
2182  );
2183 
2184 VOID
2187  _In_ PIRP Irp,
2188  _In_ NTSTATUS CompletionStatus
2189  );
2190 
2191 VOID
2193  _In_ __drv_freesMem(mem) POFFLOAD_READ_CONTEXT OffloadReadContext
2194  );
2195 
2196 VOID
2198  _In_ POFFLOAD_READ_CONTEXT OffloadReadContext,
2199  _In_ NTSTATUS CompletionStatus
2200  );
2201 
2202 // PCONTINUATION_ROUTINE
2203 VOID
2206  );
2207 
2208 // PCONTINUATION_ROUTINE
2209 VOID
2212  );
2213 
2214 VOID
2216  _In_ __drv_aliasesMem POFFLOAD_WRITE_CONTEXT OffloadWriteContext
2217  );
2218 
2219 VOID
2221  _In_ __drv_freesMem(mem) POFFLOAD_WRITE_CONTEXT OffloadWriteContext
2222  );
2223 
2224 VOID
2226  _In_ __drv_freesMem(Mem) POFFLOAD_WRITE_CONTEXT OffloadWriteContext,
2227  _In_ NTSTATUS CompletionCausingStatus
2228  );
2229 
2230 VOID
2232  _In_ POFFLOAD_WRITE_CONTEXT OffloadWriteContext,
2233  _In_ NTSTATUS CompletionCausingStatus
2234  );
2235 
2236 VOID
2239  );
2240 
2241 VOID
2243  _In_ POFFLOAD_WRITE_CONTEXT OffloadWriteContext
2244  );
2245 
2246 NTSTATUS
2249  _In_ BOOLEAN ForceQuery
2250  );
2251 
2252 NTSTATUS
2255  _In_ BOOLEAN ForceQuery,
2256  _Out_ PCLASS_VPD_B0_DATA BlockLimitsData,
2257  _Out_ PULONG GenerationCount
2258  );
2259 
2260 NTSTATUS
2263  _In_ PREAD_CAPACITY16_DATA ReadCapacity16Data
2264  );
2265 
2266 NTSTATUS
2270  );
2271 
2272 NTSTATUS
2275  _Inout_ PIRP Irp,
2277  );
2278 
2280 NTSTATUS
2283  _In_ PIRP Irp
2284  );
2285 
2287 NTSTATUS
2288 ClasspPowerActivateDevice(
2290  );
2291 
2293 NTSTATUS
2294 ClasspPowerIdleDevice(
2296  );
2297 
2298 IO_WORKITEM_ROUTINE ClassLogThresholdEvent;
2299 
2300 NTSTATUS
2303  _In_ NTSTATUS IoErrorCode
2304  );
2305 
2307 
2308 NTSTATUS
2311  PIRP Irp
2312  );
2313 
2314 VOID
2317  );
2318 
2319 NTSTATUS
2322  PIRP Irp
2323  );
2324 
2325 VOID
2328  ULONG HistoryCount
2329  );
2330 #define HISTORYINITIALIZERETRYLOGS(_packet) \
2331  { \
2332  if (_packet->RetryHistory != NULL) \
2333  { \
2334  HistoryInitializeRetryLogs( \
2335  _packet->RetryHistory, \
2336  _packet->RetryHistory->TotalHistoryCount \
2337  ); \
2338  } \
2339  }
2340 
2341 VOID
2344  );
2345 #define HISTORYLOGSENDPACKET(_packet) \
2346  { \
2347  if (_packet->RetryHistory != NULL) { \
2348  HistoryLogSendPacket(_packet); \
2349  } \
2350  }
2351 
2352 VOID
2355  );
2356 
2357 #define HISTORYLOGRETURNEDPACKET(_packet) \
2358  { \
2359  if (_packet->RetryHistory != NULL) { \
2360  HistoryLogReturnedPacket(_packet); \
2361  } \
2362  }
2363 
2364 BOOLEAN
2366  _In_ PDEVICE_OBJECT Fdo,
2372  _Out_ NTSTATUS * Status,
2374  LONGLONG * RetryIn100nsUnits
2375  );
2376 
2377 BOOLEAN
2379  _In_opt_z_ PCHAR StringToMatch,
2381  );
2382 
2383 
2384 
2385 #define TRACKING_FORWARD_PROGRESS_PATH1 (0x00000001)
2386 #define TRACKING_FORWARD_PROGRESS_PATH2 (0x00000002)
2387 #define TRACKING_FORWARD_PROGRESS_PATH3 (0x00000004)
2388 
2389 
2390 VOID
2393  );
2394 
2395 VOID
2398  );
2399 
2400 RTL_GENERIC_COMPARE_ROUTINE RemoveTrackingCompareRoutine;
2401 
2402 RTL_GENERIC_ALLOCATE_ROUTINE RemoveTrackingAllocateRoutine;
2403 
2404 RTL_GENERIC_FREE_ROUTINE RemoveTrackingFreeRoutine;
2405 
2406 #if (NTDDI_VERSION >= NTDDI_WIN8)
2407 
2408 typedef PVOID
2411  );
2412 
2413 PVOID
2416  );
2417 
2418 
2419 NTSTATUS
2422  _In_ USHORT AddressType,
2425  _In_ ULONG NumSrbExData,
2426  ...
2427  );
2428 
2429 NTSTATUS
2432  _In_ USHORT AddressType,
2434  _In_ ULONG NumSrbExData,
2435  ...
2436  );
2437 
2438 VOID
2442  );
2443 
2444 __inline PCDB
2447  )
2448 {
2449  return SrbGetCdb(Pkt->Srb);
2450 }
2451 
2452 //
2453 // This inline function calculates number of retries already happened till now for known operation codes
2454 // and set the out parameter - TimesAlreadyRetried with the value, returns True
2455 //
2456 // For unknown operation codes this function will return false and will set TimesAlreadyRetried with zero
2457 //
2458 __inline BOOLEAN
2461  _In_ PCDB Cdb,
2462  _Out_ PULONG TimesAlreadyRetried
2463  )
2464 {
2466  PCLASS_PRIVATE_FDO_DATA fdoData = fdoExtension->PrivateFdoData;
2467 
2468  if (Cdb->MEDIA_REMOVAL.OperationCode == SCSIOP_MEDIUM_REMOVAL)
2469  {
2470  *TimesAlreadyRetried = NUM_LOCKMEDIAREMOVAL_RETRIES - Pkt->NumRetries;
2471  }
2472  else if ((Cdb->MODE_SENSE.OperationCode == SCSIOP_MODE_SENSE) ||
2473  (Cdb->MODE_SENSE.OperationCode == SCSIOP_MODE_SENSE10))
2474  {
2475  *TimesAlreadyRetried = NUM_MODESENSE_RETRIES - Pkt->NumRetries;
2476  }
2477  else if ((Cdb->CDB10.OperationCode == SCSIOP_READ_CAPACITY) ||
2478  (Cdb->CDB16.OperationCode == SCSIOP_READ_CAPACITY16))
2479  {
2480  *TimesAlreadyRetried = NUM_DRIVECAPACITY_RETRIES - Pkt->NumRetries;
2481  }
2482  else if (IS_SCSIOP_READWRITE(Cdb->CDB10.OperationCode))
2483  {
2484  *TimesAlreadyRetried = fdoData->MaxNumberOfIoRetries - Pkt->NumRetries;
2485  }
2486  else if (Cdb->TOKEN_OPERATION.OperationCode == SCSIOP_POPULATE_TOKEN &&
2488  {
2489  *TimesAlreadyRetried = NUM_POPULATE_TOKEN_RETRIES - Pkt->NumRetries;
2490  }
2491  else if (Cdb->TOKEN_OPERATION.OperationCode == SCSIOP_WRITE_USING_TOKEN &&
2493  {
2494  *TimesAlreadyRetried = NUM_WRITE_USING_TOKEN_RETRIES - Pkt->NumRetries;
2495  }
2497  {
2498  *TimesAlreadyRetried = NUM_RECEIVE_TOKEN_INFORMATION_RETRIES - Pkt->NumRetries;
2499  }
2500 
2501  else
2502  {
2503  *TimesAlreadyRetried = 0;
2504  return FALSE;
2505  }
2506 
2507 
2508  return TRUE;
2509 }
2510 
2511 
2512 __inline PVOID
2515  )
2516 {
2517  return SrbGetSenseInfoBuffer(Pkt->Srb);
2518 }
2519 
2520 __inline UCHAR
2523  )
2524 {
2526 }
2527 
2528 
2529 __inline VOID
2532  _In_ PIRP Irp
2533  )
2534 {
2535  if (Srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
2536  {
2537  ((PSTORAGE_REQUEST_BLOCK)Srb)->MiniportContext = (PVOID)Irp;
2538  }
2539  else
2540  {
2541  ((PSCSI_REQUEST_BLOCK)Srb)->SrbExtension = (PVOID)Irp;
2542  }
2543 }
2544 
2545 __inline
2546 BOOLEAN
2550  )
2551 {
2554  (SrbGetSenseInfoBuffer(Srb) != FdoExtension->SenseData))
2555  );
2556 }
2557 
2558 __inline
2559 VOID
2563  )
2564 {
2568 
2570  SrbSetSenseInfoBuffer(Srb, FdoExtension->SenseData);
2573  return;
2574 }
2575 
2576 #endif //NTDDI_WIN8
2577 
2578 BOOLEAN
2581  );
2582 
2583 __inline
2584 ULONG
2587  _In_ ULONG OffsetInBytes,
2588  _In_ ULONG BaseStructureSizeInBytes
2589  )
2590 /*++
2591 
2592 Routine Description:
2593 
2594  This routine returns the maximum size of a buffer that starts at a given offset,
2595  based on the size of the containing structure.
2596 
2597 Arguments:
2598 
2599  BaseAddress - The base address of the structure. The offset is computed relative to this.
2600 
2601  OffsetInBytes - (BaseAddress + OffsetInBytes) points to the beginning of the buffer.
2602 
2603  BaseStructureSizeInBytes - The size of the structure which contains the buffer.
2604 
2605 Return Value:
2606 
2607  max(BaseStructureSizeInBytes - OffsetInBytes, 0). If any operations wrap around,
2608  the return value is 0.
2609 
2610 --*/
2611 
2612 {
2613 
2614  ULONG_PTR offsetAddress = ((ULONG_PTR)BaseAddress + OffsetInBytes);
2615 
2616  if (offsetAddress < (ULONG_PTR)BaseAddress) {
2617  //
2618  // This means BaseAddress + OffsetInBytes > ULONG_PTR_MAX.
2619  //
2620  return 0;
2621  }
2622 
2623  if (OffsetInBytes > BaseStructureSizeInBytes) {
2624  return 0;
2625  }
2626 
2627  return BaseStructureSizeInBytes - OffsetInBytes;
2628 }
2629 
2630 
2631 BOOLEAN
2634  );
2635 
2636 __inline
2637 BOOLEAN
2640  )
2641 {
2642  return ((Status == STATUS_NOT_SUPPORTED) ||
2646 }
2647 
2648 #if defined(__REACTOS__) && (NTDDI_VERSION >= NTDDI_WINBLUE)
2649 __inline
2650 BOOLEAN
2651 ClasspSrbTimeOutStatus (
2653  )
2654 {
2655  UCHAR srbStatus = SrbGetSrbStatus(Srb);
2656  return ((srbStatus == SRB_STATUS_BUS_RESET) ||
2657  (srbStatus == SRB_STATUS_TIMEOUT) ||
2658  (srbStatus == SRB_STATUS_COMMAND_TIMEOUT) ||
2659  (srbStatus == SRB_STATUS_ABORTED));
2660 }
2661 #endif
2662 
2663 NTSTATUS
2666  _Inout_ PIRP Irp
2667  );
2668 
2669 NTSTATUS
2672  _Inout_ PIRP Irp,
2674  );
2675 
2676 NTSTATUS
2679  _Inout_ PIRP Irp,
2681  );
2682 
NTSTATUS ClassPnpStartDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: class.c:1819
_Inout_ PLIST_ENTRY _In_ PVOID FsContext
Definition: fltkernel.h:2239
struct _OPCODE_SENSE_DATA_IO_LOG_MESSAGE_CONTEXT_HEADER OPCODE_SENSE_DATA_IO_LOG_MESSAGE_CONTEXT_HEADER
NTSTATUS ClasspEnqueueIdleRequest(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: clntirp.c:576
signed char * PCHAR
Definition: retypes.h:7
#define SCSIOP_WRITE_USING_TOKEN
Definition: scsi.h:341
__inline VOID ClasspSrbSetOriginalIrp(_In_ PSTORAGE_REQUEST_BLOCK_HEADER Srb, _In_ PIRP Irp)
Definition: classp.h:2530
#define SRB_STATUS_BUS_RESET
Definition: srb.h:345
VOID ClasspBuildRequestEx(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp, _In_ __drv_aliasesMem PSCSI_REQUEST_BLOCK Srb)
Definition: obsolete.c:537
PDEVICE_DATA_SET_RANGE DataSetRanges
Definition: classp.h:1125
NTSTATUS ClassDeviceHwFirmwareActivateProcess(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:8900
#define _IRQL_requires_same_
Definition: no_sal2.h:652
PEX_TIMER TickTimer
Definition: classp.h:676
#define IN
Definition: typedefs.h:39
__drv_allocatesMem(Mem) PTRANSFER_PACKET NewTransferPacket(PDEVICE_OBJECT Fdo)
Definition: exfuncs.h:1476
NTSTATUS SubmitTransferPacket(PTRANSFER_PACKET Pkt)
Definition: xferpkt.c:850
NTSTATUS ClasspAllocatePowerProcessIrp(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
ULONGLONG EntireXferLen
Definition: classp.h:1119
#define _In_opt_z_
Definition: no_sal2.h:221
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
_IRQL_requires_same_ VOID ClasspReceivePopulateTokenInformation(_In_ POFFLOAD_READ_CONTEXT OffloadReadContext)
Definition: class.c:14374
FORCEINLINE UCHAR SrbGetSenseInfoBufferLength(_In_ PVOID Srb)
Definition: srbhelper.h:638
ULONG ClasspModeSense(_In_ PDEVICE_OBJECT Fdo, _In_reads_bytes_(Length) PCHAR ModeSenseBuffer, _In_ ULONG Length, _In_ UCHAR PageMode, _In_ UCHAR PageControl)
Definition: class.c:6681
VOID ClasspCompleteIdleRequest(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: clntirp.c:713
_In_ PTRANSFER_PACKET Pkt
Definition: classp.h:1754
SCSI_REQUEST_BLOCK MediaChangeSrb
Definition: cdromp.h:250
BOOLEAN ClasspUpdateTimerNoWakeTolerance(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: autorun.c:3653
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
enum _BUS_QUERY_ID_TYPE BUS_QUERY_ID_TYPE
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
MEDIA_LOCK_TYPE
Definition: classp.h:378
_In_ size_t _In_ UCHAR PageMode
Definition: cdrom.h:1325
VOID ClasspWriteUsingTokenTransferPacketDone(_In_ PVOID Context)
Definition: class.c:15519
IO_COMPLETION_ROUTINE ClasspSendSynchronousCompletion
Definition: classp.h:1410
#define NUM_ERROR_LOG_ENTRIES
Definition: classp.h:486
BOOLEAN DriverUsesStartIO
Definition: classp.h:543
NTSTATUS NTAPI ClassCreateClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: create.c:57
_In_ PDEVICE_OBJECT Pdo
Definition: classpnp.h:318
NTSTATUS ClasspLogSystemEventWithDeviceNumber(_In_ PDEVICE_OBJECT DeviceObject, _In_ NTSTATUS IoErrorCode)
Definition: utils.c:5354
ULONGLONG TotalSectorsToProcess
Definition: classp.h:1080
NTSTATUS ClasspDeviceGetLBAStatusWorker(_In_ PDEVICE_OBJECT DeviceObject, _In_ PCLASS_VPD_B0_DATA BlockLimitsData, _In_ ULONGLONG StartingOffset, _In_ ULONGLONG LengthInBytes, _Out_ PDEVICE_MANAGE_DATA_SET_ATTRIBUTES_OUTPUT DsmOutput, _Inout_ PULONG DsmOutputLength, _Inout_ PSCSI_REQUEST_BLOCK Srb, _In_ BOOLEAN ConsolidateableBlocksOnly, _In_ ULONG OutputVersion, _Out_ PBOOLEAN BlockLimitsDataMayHaveChanged)
Definition: utils.c:4079
NTSTATUS ClasspEjectionControl(IN PDEVICE_OBJECT Fdo, IN PIRP Irp, IN MEDIA_LOCK_TYPE LockType, IN BOOLEAN Lock)
Definition: create.c:474
NTSTATUS ClasspDeviceMediaTypeProperty(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:1917
RTL_GENERIC_ALLOCATE_ROUTINE RemoveTrackingAllocateRoutine
Definition: classp.h:2402
FORCEINLINE ULONG SrbGetSrbFlags(_In_ PVOID Srb)
Definition: srbhelper.h:927
VOID FreeDictionaryEntry(IN PDICTIONARY Dictionary, IN PVOID Entry)
Definition: dictlib.c:189
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:290
#define IRP_MJ_FLUSH_BUFFERS
ULONG MaxPowerOperationRetryCount
Definition: classp.h:963
STORAGE_REQUEST_BLOCK SrbEx
Definition: classp.h:687
ULONGLONG RequestStartTime
Definition: classp.h:601
KDEFERRED_ROUTINE TransferPacketRetryTimerDpc
Definition: classp.h:1727
struct _CDB::_MEDIA_REMOVAL MEDIA_REMOVAL
PSTORAGE_REQUEST_BLOCK_HEADER SrbTemplate
Definition: classp.h:790
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
Definition: ntbasedef.h:629
PTRANSFER_PACKET DequeueFreeTransferPacket(PDEVICE_OBJECT Fdo, BOOLEAN AllocIfNeeded)
Definition: xferpkt.c:656
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
ULONGLONG DataSetRangeByteOffset
Definition: classp.h:1141
#define DECLSPEC_CACHEALIGN
Definition: ntbasedef.h:264
VOID SetupModeSenseTransferPacket(TRANSFER_PACKET *Pkt, PKEVENT SyncEventPtr, PVOID ModeSenseBuffer, UCHAR ModeSenseBufferLen, UCHAR PageMode, UCHAR SubPage, PIRP OriginalIrp, UCHAR PageControl)
Definition: xferpkt.c:1360
LARGE_INTEGER ThrottleStartTime
Definition: classp.h:836
struct _CLASS_RETRY_INFO CLASS_RETRY_INFO
#define IRP_MJ_SHUTDOWN
#define SRB_FLAGS_FREE_SENSE_BUFFER
Definition: srb.h:398
VOID ClasspFreeDeviceMdl(PMDL Mdl)
Definition: utils.c:615
ULONGLONG TotalSectorsProcessedSuccessfully
Definition: classp.h:1139
ULONGLONG MaxLbaCount
Definition: classp.h:1130
LARGE_INTEGER TickCount
Definition: classp.h:461
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define SCSIOP_MODE_SENSE
Definition: cdrw_hw.h:896
NTSTATUS ClasspPriorityHint(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: utils.c:6480
NTSTATUS ClasspDeviceGetBlockLimitsVPDPage(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _Inout_bytecount_(SrbSize) PSCSI_REQUEST_BLOCK Srb, _In_ ULONG SrbSize, _Out_ PCLASS_VPD_B0_DATA BlockLimitsData)
Definition: utils.c:2521
enum _CLASS_DETECTION_STATE * PCLASS_DETECTION_STATE
_In_ BUS_QUERY_ID_TYPE _In_ PUNICODE_STRING IdString
Definition: classpnp.h:374
uint16_t * PWSTR
Definition: typedefs.h:56
SCSI_REQUEST_BLOCK Srb
Definition: classp.h:1160
NTSTATUS InitializeStorageRequestBlock(_Inout_bytecount_(ByteSize) PSTORAGE_REQUEST_BLOCK Srb, _In_ USHORT AddressType, _In_ ULONG ByteSize, _In_ ULONG NumSrbExData,...)
Definition: srblib.c:206
struct _IO_RETRIED_LOG_MESSAGE_CONTEXT * PIO_RETRIED_LOG_MESSAGE_CONTEXT
ULONGLONG TotalSectorsToProcess
Definition: classp.h:1149
ULONG ClasspCalculateLogicalSectorSize(_In_ PDEVICE_OBJECT Fdo, _In_ ULONG BytesPerBlockInBigEndian)
Definition: utils.c:1483
VOID InterpretCapacityData(PDEVICE_OBJECT Fdo, PREAD_CAPACITY_DATA_EX ReadCapacityData)
Definition: class.c:2640
unsigned char * PUCHAR
Definition: retypes.h:3
#define _In_reads_(size)
Definition: no_sal2.h:228
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_IRQL_requires_same_ NTSTATUS ClasspEnableIdlePower(_In_ PDEVICE_OBJECT DeviceObject)
Definition: power.c:2550
Definition: cdrw_hw.h:28
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS ClasspInitializeGesn(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN PMEDIA_CHANGE_DETECTION_INFO Info)
Definition: autorun.c:1990
SENSE_DATA SenseData
Definition: classp.h:479
struct _FAILURE_PREDICTION_INFO FAILURE_PREDICTION_INFO
DECLSPEC_CACHEALIGN SLIST_HEADER SListHeader
Definition: classp.h:644
KSPIN_LOCK SpinLock
Definition: classp.h:795
UCHAR NumThinProvisioningRetries
Definition: classp.h:517
#define NUM_WRITE_USING_TOKEN_RETRIES
Definition: classp.h:205
ULONGLONG TotalRequestSizeSectors
Definition: classp.h:1120
BOOLEAN LoggedTURFailureSinceLastIO
Definition: classp.h:753
NTSTATUS ClasspDeviceSeekPenaltyProperty(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:2172
PMDL ClasspBuildDeviceMdl(PVOID Buffer, ULONG BufferLen, BOOLEAN WriteToDevice)
Definition: utils.c:582
IO_COMPLETION_ROUTINE ClassReleaseQueueCompletion
Definition: classp.h:1586
__inline VOID SimplePushSlist(SINGLE_LIST_ENTRY *SListHdr, SINGLE_LIST_ENTRY *SListEntry)
Definition: classp.h:1215
NTSTATUS ClasspPersistentReserve(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:6211
VOID ClasspEnableTimer(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: autorun.c:3857
#define SRB_STATUS_COMMAND_TIMEOUT
Definition: srb.h:343
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
NTSTATUS ClasspDeviceGetLBProvisioningVPDPage(_In_ PDEVICE_OBJECT DeviceObject, _Inout_opt_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:2350
NTSTATUS ClasspInitializeTimer(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: autorun.c:3737
FORCEINLINE UCHAR SrbGetSrbStatus(_In_ PVOID Srb)
Definition: srbhelper.h:1330
struct _CLASS_ERROR_LOG_DATA CLASS_ERROR_LOG_DATA
IO_COMPLETION_ROUTINE TransferPktComplete
Definition: classp.h:1724
LIST_ENTRY AllFdosListEntry
Definition: classp.h:723
NTSTATUS AllocateDictionaryEntry(IN PDICTIONARY Dictionary, IN ULONGLONG Key, IN ULONG Size, IN ULONG Tag, OUT PVOID *Entry)
struct _MEDIA_CHANGE_DETECTION_INFO MEDIA_CHANGE_DETECTION_INFO
ULONG LocalMinWorkingSetTransferPackets
Definition: classp.h:711
PSTORAGE_REQUEST_BLOCK_HEADER Srb
Definition: classp.h:580
PIRP DequeueDeferredClientIrp(PDEVICE_OBJECT Fdo)
Definition: clntirp.c:113
VOID ClasspPerfIncrementErrorCount(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: utils.c:432
VOID ClasspPopulateTokenTransferPacketDone(_In_ PVOID Context)
Definition: class.c:14166
UCHAR NumIoTimeoutRetries
Definition: classp.h:518
READ_CAPACITY_DATA_EX LastKnownDriveCapacityData
Definition: classp.h:802
NTSTATUS ClasspInitializeHotplugInfo(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: class.c:12507
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:728
VOID SetupEjectionTransferPacket(TRANSFER_PACKET *Pkt, BOOLEAN PreventMediaRemoval, PKEVENT SyncEventPtr, PIRP OriginalIrp)
Definition: xferpkt.c:1310
__inline BOOLEAN ClasspIsObsoletePortDriver(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: classp.h:1335
PCONTINUATION_ROUTINE ContinuationRoutine
Definition: classp.h:608
FORCEINLINE PCDB SrbGetCdb(_In_ PVOID Srb)
Definition: srbhelper.h:583
VOID FreeDeviceInputMdl(PMDL Mdl)
Definition: utils.c:622
ULONG ClassMaxInterleavePerCriticalIo
Definition: class.c:88
NTSTATUS ClasspIsPortable(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _Out_ PBOOLEAN IsPortable)
Definition: class.c:8837
LIST_ENTRY AllPktsListEntry
Definition: classp.h:499
VOID ClassQueueCapacityChangedEventWorker(_In_ PDEVICE_OBJECT DeviceObject)
Definition: utils.c:5637
BOOLEAN ReleaseQueueIrpAllocated
Definition: classp.h:760
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1155
struct _CDB::_CDB10 CDB10
LIST_ENTRY AllTransferPacketsList
Definition: classp.h:771
struct _MEDIA_CHANGE_DETECTION_INFO * PMEDIA_CHANGE_DETECTION_INFO
PUCHAR LowMemRetry_remainingBufPtr
Definition: classp.h:545
struct _IDLE_POWER_FDO_LIST_ENTRY IDLE_POWER_FDO_LIST_ENTRY
FORCEINLINE VOID SrbSetSenseInfoBufferLength(_In_ PVOID Srb, _In_ UCHAR SenseInfoBufferLength)
Definition: srbhelper.h:675
KDPC RetryTimerDPC
Definition: classp.h:524
NTSTATUS ClassReadCapacity16(_Inout_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:1568
FORCEINLINE VOID SrbClearSrbFlags(_In_ PVOID Srb, _In_ ULONG Flags)
Definition: srbhelper.h:982
NTSTATUS ClasspGetLBProvisioningInfo(_Inout_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: class.c:13087
_IRQL_requires_same_ VOID ClasspReceiveWriteUsingTokenInformation(_In_ POFFLOAD_WRITE_CONTEXT OffloadWriteContext)
Definition: class.c:15937
LIST_ENTRY IdlePowerFDOList
Definition: class.c:113
GUID ActivityId
Definition: classp.h:605
NTSTATUS ClasspCreateClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: create.c:123
NTSTATUS ClasspDeviceTrimProcess(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PGUID ActivityId, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:3476
NTSTATUS ClassIoCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: class2.c:4731
VOID ClassInitializeDispatchTables(PCLASS_DRIVER_EXTENSION DriverExtension)
Definition: dispatch.c:38
VOID TransferPacketQueueRetryDpc(PTRANSFER_PACKET Pkt)
Definition: retry.c:604
UCHAR NumRetries
Definition: classp.h:516
PDEVICE_DSM_OFFLOAD_WRITE_PARAMETERS OffloadWriteParameters
Definition: classp.h:1126
#define DBG_NUM_PACKET_LOG_ENTRIES
Definition: classp.h:487
FAILURE_PREDICTION_METHOD Method
Definition: classp.h:385
DRIVER_ADD_DEVICE ClassAddDevice
Definition: classp.h:1408
LARGE_INTEGER TargetLocationCopy
Definition: classp.h:564
VOID ClasspRetryDpcTimer(IN PCLASS_PRIVATE_FDO_DATA FdoData)
Definition: class.c:12457
STORAGE_HOTPLUG_INFO HotplugInfo
Definition: classp.h:739
NTSTATUS ClassDeviceGetLBProvisioningResources(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:5087
struct TraceInfo Info
#define _In_opt_
Definition: no_sal2.h:213
LARGE_INTEGER LastIoCompletionTime
Definition: classp.h:940
PVOID PowerSettingNotificationHandle
Definition: class.c:119
__inline BOOLEAN ClasspIsTokenOperationComplete(_In_ ULONG CurrentStatus)
Definition: classp.h:2023
struct _CDB::_CDB16 CDB16
uint32_t ULONG_PTR
Definition: typedefs.h:65
VOID DestroyAllTransferPackets(PDEVICE_OBJECT Fdo)
Definition: xferpkt.c:288
#define IRP_MJ_SCSI
struct SRB_ALIGN _STORAGE_REQUEST_BLOCK_HEADER * PSTORAGE_REQUEST_BLOCK_HEADER
NTSTATUS ClasspAllocateReleaseQueueIrp(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
_In_ PVOID _Inout_ PULONG _In_ ULONG MaxBlockDescrCount
Definition: classp.h:1996
ULONG CLONG
Definition: umtypes.h:126
PIO_WORKITEM WorkQueueItem
Definition: classp.h:389
NTSTATUS ClasspAccessAlignmentProperty(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:1700
__inline BOOLEAN ClasspLowerLayerNotSupport(_In_ NTSTATUS Status)
Definition: classp.h:2638
#define _IRQL_requires_min_(irql)
Definition: no_sal2.h:651
VOID ClasspReleaseQueue(IN PDEVICE_OBJECT DeviceObject, IN PIRP ReleaseQueueIrp)
Definition: class.c:11743
NTSTATUS ClasspModeSelect(_In_ PDEVICE_OBJECT Fdo, _In_reads_bytes_(Length) PCHAR ModeSelectBuffer, _In_ ULONG Length, _In_ BOOLEAN SavePages)
Definition: class.c:6919
UCHAR TimedOut
Definition: classp.h:519
__inline VOID SimpleInitSlistHdr(SINGLE_LIST_ENTRY *SListHdr)
Definition: classp.h:1211
__inline UCHAR GET_FDO_EXTENSON_SENSE_DATA_LENGTH(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: classpnp.h:1437
ULONG DbgPeakNumTransferPackets
Definition: classp.h:647
VOID ClasspCompleteOffloadRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ NTSTATUS CompletionStatus)
Definition: class.c:13632
__inline VOID FREE_PORT_ALLOCATED_SENSE_BUFFER_EX(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: classp.h:2560
_In_ ULONG _In_ UCHAR _In_ UCHAR PageControl
Definition: cdrom.h:1316
LARGE_INTEGER ThrottleStopTime
Definition: classp.h:841
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
struct _OFFLOAD_WRITE_CONTEXT * POFFLOAD_WRITE_CONTEXT
GUID ClassGuidWorkingSet
Definition: data.c:217
VOID HistoryLogReturnedPacket(TRANSFER_PACKET *Pkt)
Definition: history.c:83
#define FALSE
Definition: types.h:117
_In_ PTRANSFER_PACKET _In_ ULONG _In_ PIRP _In_ ULONG ListIdentifier
Definition: classp.h:1757
_CLASS_DETECTION_STATE
Definition: classp.h:444
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
ULONGLONG TransferCount
Definition: classp.h:610
long LONG
Definition: pedump.c:60
PVOID DefaultStorageRequestBlockAllocateRoutine(_In_ CLONG ByteSize)
Definition: srblib.c:28
struct _EX_TIMER * PEX_TIMER
Definition: extypes.h:291
#define SERVICE_ACTION_POPULATE_TOKEN
Definition: scsi.h:442
DECLSPEC_CACHEALIGN ULONG NumFreeTransferPackets
Definition: classp.h:645
struct _CLASS_RETRY_INFO * PCLASS_RETRY_INFO
#define CLASS_SRBEX_SCSI_CDB16_BUFFER_SIZE
Definition: classpnp.h:695
VOID ClasspScanForSpecialInRegistry(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: class.c:12651
struct _IDLE_POWER_FDO_LIST_ENTRY * PIDLE_POWER_FDO_LIST_ENTRY
ULONG ReceiveTokenInformationBufferLength
Definition: classp.h:1074
C_ASSERT((sizeof(struct _CLASS_PRIVATE_COMMON_DATA) % sizeof(PVOID))==0)
PDEVICE_OBJECT Fdo
Definition: classp.h:503
_IRQL_requires_(PASSIVE_LEVEL) _IRQL_requires_same_ NTSTATUS ClassDetermineTokenOperationCommandSupport(_In_ PDEVICE_OBJECT DeviceObject)
Definition: class.c:13147
VOID ClassQueueProvisioningTypeChangedEventWorker(_In_ PDEVICE_OBJECT DeviceObject)
Definition: utils.c:5726
NTSTATUS ClasspWriteCacheProperty(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:1199
NTSTATUS ClassQueryPnpCapabilities(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_CAPABILITIES Capabilities)
Definition: class.c:10192
#define __drv_aliasesMem
Definition: btrfs_drv.h:205
_In_ PVOID _Inout_ PULONG _In_ ULONG _Inout_ PULONG _In_ ULONGLONG _Inout_ PDEVICE_DATA_SET_RANGE DataSetRange
Definition: classp.h:1996
CONST LARGE_INTEGER Magic10000
Definition: class.c:89
__inline BOOLEAN ClasspIsThinProvisioned(_In_ PCLASS_FUNCTION_SUPPORT_INFO SupportInfo)
Definition: classp.h:1317
PVOID DeviceExtension
Definition: env_spec_w32.h:418
BOOLEAN ClasspMyStringMatches(_In_opt_z_ PCHAR StringToMatch, _In_z_ PCHAR TargetString)
Definition: utils.c:51
unsigned char BOOLEAN
#define SCSIOP_MODE_SENSE10
Definition: cdrw_hw.h:946
_IRQL_requires_same_ NTSTATUS ClasspStorageEventNotification(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: utils.c:7826
MEDIA_LOCK_TYPE
Definition: cdromp.h:288
_In_z_ PCHAR TargetString
Definition: cdrom.h:954
PDEVICE_OBJECT Fdo
Definition: classp.h:1035
struct _OFFLOAD_READ_CONTEXT OFFLOAD_READ_CONTEXT
LIST_ENTRY IdleIrpList
Definition: classp.h:882
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS ClasspDeviceGetLBAStatus(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:3861
NTSTATUS ClasspBlockLimitsDataSnapshot(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ BOOLEAN ForceQuery, _Out_ PCLASS_VPD_B0_DATA BlockLimitsData, _Out_ PULONG GenerationCount)
Definition: class.c:16504
VOID ClasspInitializeRemoveTracking(_In_ PDEVICE_OBJECT DeviceObject)
Definition: lock.c:500
__inline PVOID ClasspTransferPacketGetSenseInfoBuffer(_In_ PTRANSFER_PACKET Pkt)
Definition: classp.h:2513
#define SRB_STATUS_ABORTED
Definition: srb.h:334
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define _Out_
Definition: no_sal2.h:323
VOID InitLowMemRetry(PTRANSFER_PACKET Pkt, PVOID BufPtr, ULONG Len, LARGE_INTEGER TargetLocation)
Definition: retry.c:670
_IRQL_requires_same_ PUCHAR ClasspBinaryToAscii(_In_reads_(Length) PUCHAR HexBuffer, _In_ ULONG Length, _Inout_ PULONG UpdateLength)
Definition: utils.c:7717
#define NUM_DRIVECAPACITY_RETRIES
Definition: classp.h:161
SCSI_REQUEST_BLOCK Srb
Definition: classp.h:344
DRIVER_STARTIO ClasspStartIo
Definition: classp.h:1454
#define NUM_LOCKMEDIAREMOVAL_RETRIES
Definition: classp.h:158
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
VOID(* PCONTINUATION_ROUTINE)(_In_ PVOID Context)
Definition: classp.h:492
Definition: bufpool.h:45
VOID ClasspCompleteOffloadRead(_In_ POFFLOAD_READ_CONTEXT OffloadReadContext, _In_ NTSTATUS CompletionStatus)
Definition: class.c:14255
struct _CLASS_ERROR_LOG_DATA * PCLASS_ERROR_LOG_DATA
Definition: ntdd8042.h:62
void * PVOID
Definition: retypes.h:9
OPCODE_SENSE_DATA_IO_LOG_MESSAGE_CONTEXT_HEADER ContextHeader
Definition: classp.h:1179
GUID ClassGuidSenseInfo2
Definition: data.c:216
BOOLEAN InLowMemRetry
Definition: classp.h:544
SCSI_REQUEST_BLOCK Srb
Definition: classp.h:471
_In_ BUS_QUERY_ID_TYPE IdType
Definition: classpnp.h:374
struct _CLASS_PRIVATE_FDO_DATA::@1034 Retry
NTSTATUS ServiceTransferRequest(PDEVICE_OBJECT Fdo, PIRP Irp, BOOLEAN PostToDpc)
Definition: class.c:3341
ULONGLONG TotalSectorsProcessed
Definition: classp.h:1086
enum _MEDIA_CHANGE_DETECTION_STATE MEDIA_CHANGE_DETECTION_STATE
struct _IO_RETRIED_LOG_MESSAGE_CONTEXT IO_RETRIED_LOG_MESSAGE_CONTEXT
__inline ULONGLONG ClasspTimeDiffToMs(ULONGLONG TimeDiff)
Definition: classp.h:1297
_In_ PVOID _Inout_ PULONG _In_ ULONG _Inout_ PULONG _In_ ULONGLONG MaxLbaCount
Definition: classp.h:1996
#define TEST_FLAG(Flags, Bit)
Definition: cdrom.h:1495
VOID ClasspUninitializeRemoveTracking(_In_ PDEVICE_OBJECT DeviceObject)
Definition: lock.c:529
BOOLEAN LoggedSYNCFailure
Definition: classp.h:754
struct _CDB::_MODE_SENSE MODE_SENSE
NTSTATUS InterpretReadCapacity16Data(_Inout_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PREAD_CAPACITY16_DATA ReadCapacity16Data)
Definition: utils.c:1517
PVOID(* PSRB_ALLOCATE_ROUTINE)(_In_ CLONG ByteSize)
Definition: classp.h:2409
enum _DEVICE_RELATION_TYPE DEVICE_RELATION_TYPE
IO_WORKITEM_ROUTINE ClasspUpdateDiskProperties
Definition: classp.h:1714
LIST_ENTRY DeferredClientIrpList
Definition: classp.h:777
NTSTATUS ClasspMcnControl(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN PIRP Irp, IN PSCSI_REQUEST_BLOCK Srb)
Definition: autorun.c:3276
PPHYSICAL_DEVICE_EXTENSION ClassRemoveChild(IN PFUNCTIONAL_DEVICE_EXTENSION Parent, IN PPHYSICAL_DEVICE_EXTENSION Child, IN BOOLEAN AcquireLock)
Definition: class.c:12119
LARGE_INTEGER LowMemRetry_nextChunkTargetLocation
Definition: classp.h:547
LARGE_INTEGER Tick
Definition: classp.h:744
MEDIA_CHANGE_DETECTION_STATE MediaChangeDetectionState
Definition: classp.h:275
BOOLEAN TimerInitialized
Definition: classp.h:752
#define MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS
Definition: cdromp.h:50
struct _CSCAN_LIST * PCSCAN_LIST
#define NUM_POPULATE_TOKEN_RETRIES
Definition: classp.h:204
struct _PNL_SLIST_HEADER * PPNL_SLIST_HEADER
__inline BOOLEAN ClasspIsOffloadDataTransferCommand(_In_ PCDB Cdb)
Definition: classp.h:2087
int64_t LONGLONG
Definition: typedefs.h:68
NTSTATUS NTAPI ClassShutdownFlush(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: class.c:8773
#define _Out_opt_
Definition: no_sal2.h:339
PVOID ContinuationContext
Definition: classp.h:609
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
BOOLEAN UsePartialMdl
Definition: classp.h:595
_In_z_ PWSTR RegistryPath
Definition: classp.h:1930
NTSTATUS NTAPI ClassDeviceControlDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: class.c:7258
PDEVICE_MANAGE_DATA_SET_ATTRIBUTES DsmAttributes
Definition: classp.h:1124
PIRP OriginalIrp
Definition: classp.h:509
PVOID GetDictionaryEntry(IN PDICTIONARY Dictionary, IN ULONGLONG Key)
Definition: dictlib.c:157
UCHAR SrbExBuffer[CLASS_SRBEX_SCSI_CDB16_BUFFER_SIZE]
Definition: classp.h:346
__inline BOOLEAN ClasspSupportsUnmap(_In_ PCLASS_FUNCTION_SUPPORT_INFO SupportInfo)
Definition: classp.h:1308
NTSTATUS ClassPnpQueryFdoRelations(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
Definition: class.c:9843
VOID ClasspPerfIncrementSuccessfulIo(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: utils.c:486
_In_ PVOID _Inout_ PULONG CurrentBlockDescrIndex
Definition: classp.h:1996
VOID ClasspConvertToScsiRequestBlock(_Out_ PSCSI_REQUEST_BLOCK Srb, _In_ PSTORAGE_REQUEST_BLOCK SrbEx)
Definition: utils.c:6559
enum _CLASS_DETECTION_STATE CLASS_DETECTION_STATE
ULONG MaxTokenOperationListIdentifier
Definition: class.c:107
PVOID ScreenStateNotificationHandle
Definition: class.c:124
PDEVICE_OBJECT Fdo
Definition: classp.h:1115
#define SERVICE_ACTION_RECEIVE_TOKEN_INFORMATION
Definition: scsi.h:447
_In_ PVOID _Inout_ PULONG _In_ ULONG _Inout_ PULONG _In_ ULONGLONG _Inout_ PDEVICE_DATA_SET_RANGE _Inout_ PULONGLONG TotalSectorsProcessed
Definition: classp.h:1996
NTSTATUS InitializeTransferPackets(PDEVICE_OBJECT Fdo)
Definition: xferpkt.c:45
uint64_t ULONGLONG
Definition: typedefs.h:67
BOOLEAN TokenInvalidated
Definition: classp.h:1154
USHORT StarvationDuration
Definition: classp.h:915
VOID ClasspInitializeIdleTimer(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: clntirp.c:175
PSRB_HISTORY RetryHistory
Definition: classp.h:598
enum MEDIA_LOCK_TYPE * PMEDIA_LOCK_TYPE
VOID CleanupTransferPacketToWorkingSetSize(_In_ PDEVICE_OBJECT Fdo, _In_ BOOLEAN LimitNumPktToDelete, _In_ ULONG Node)
Definition: xferpkt.c:1610
ULONG_PTR HackFlags
Definition: classp.h:737
VOID SetupReadWriteTransferPacket(PTRANSFER_PACKET pkt, PVOID Buf, ULONG Len, LARGE_INTEGER DiskLocation, PIRP OriginalIrp)
Definition: xferpkt.c:718
NTSTATUS ClassRetrieveDeviceRelations(IN PDEVICE_OBJECT Fdo, IN DEVICE_RELATION_TYPE RelationType, OUT PDEVICE_RELATIONS *DeviceRelations)
Definition: class.c:10005
VOID ClasspCleanupProtectedLocks(IN PFILE_OBJECT_EXTENSION FsContext)
Definition: create.c:296
struct _CDB::_TOKEN_OPERATION TOKEN_OPERATION
__inline VOID ClasspMarkIrpAsIdle(PIRP Irp, BOOLEAN Idle)
Definition: classp.h:1251
VOID EnqueueDeferredClientIrp(PDEVICE_OBJECT Fdo, PIRP Irp)
Definition: clntirp.c:78
DRIVER_UNLOAD ClassUnload
Definition: classp.h:1356
VOID ClassRetryRequest(IN PDEVICE_OBJECT SelfDeviceObject, IN PIRP Irp, _In_ _In_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) IN LONGLONG TimeDelta100ns)
Definition: class.c:12317
struct _TRANSFER_PACKET * PTRANSFER_PACKET
_In_ WDFREQUEST _In_ MEDIA_LOCK_TYPE LockType
Definition: cdrom.h:1334
ULONG NumTotalTransferPackets
Definition: classp.h:646
_In_opt_ WDFREQUEST _In_ ULONG _In_ BOOLEAN _In_ PCDB Cdb
Definition: scratch.h:156
__inline LARGE_INTEGER ClasspGetCurrentTime(VOID)
Definition: classp.h:1280
VOID DestroyTransferPacket(_In_ __drv_freesMem(mem) PTRANSFER_PACKET Pkt)
Definition: xferpkt.c:500
_In_ PREAD_CAPACITY_DATA ReadCapacityBuffer
Definition: cdrom.h:1103
#define Len
Definition: deflate.h:82
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR MajorFunctionCode
Definition: classpnp.h:482
BOOLEAN ClasspIsThinProvisioningError(_In_ PSCSI_REQUEST_BLOCK _Srb)
Definition: utils.c:9125
__inline BOOLEAN ClasspIsIdleRequestSupported(PCLASS_PRIVATE_FDO_DATA FdoData, PIRP Irp)
Definition: classp.h:1236
VOID ClassAddChild(_In_ PFUNCTIONAL_DEVICE_EXTENSION Parent, _In_ PPHYSICAL_DEVICE_EXTENSION Child, _In_ BOOLEAN AcquireLock)
Definition: class.c:12058
#define _Inout_
Definition: no_sal2.h:244
LIST_ENTRY AllFdosList
Definition: data.c:29
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IO_WORKITEM_ROUTINE ClassLogResourceExhaustionEvent
Definition: classp.h:2306
POWER_SETTING_CALLBACK ClasspPowerSettingCallback
Definition: classp.h:1619
NTSTATUS ClasspAllocateReleaseRequest(IN PDEVICE_OBJECT Fdo)
Definition: class.c:11489
GUID ClassGuidQueryRegInfoEx
Definition: data.c:215
NTSTATUS NTAPI ClassReadWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: class.c:2431
STORAGE_REQUEST_BLOCK SrbEx
Definition: classp.h:345
VOID ClassQueueThresholdEventWorker(_In_ PDEVICE_OBJECT DeviceObject)
Definition: utils.c:5471
_In_opt_ PVPB _In_ PDEVICE_OBJECT RealDeviceObject
Definition: iofuncs.h:1499
unsigned __int64 ULONG64
Definition: imports.h:198
PPNL_SLIST_HEADER FreeTransferPacketsLists
Definition: classp.h:772
#define NUM_MODESENSE_RETRIES
Definition: classp.h:159
_In_z_ PWSTR _Out_ PULONG MaximumListIdentifier
Definition: classp.h:1930
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI ClassDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: power.c:105
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:630
char * PBOOLEAN
Definition: retypes.h:11
LONGLONG CurrentNoWakeTolerance
Definition: classp.h:677
PCLASS_RETRY_INFO ListHead
Definition: classp.h:745
_In_ PCEVENT_DESCRIPTOR _In_opt_ LPCGUID ActivityId
Definition: wmifuncs.h:119
#define IRP_MJ_POWER
VOID ClassSendEjectionNotification(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: autorun.c:155
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
Status
Definition: gdiplustypes.h:24
struct _OFFLOAD_READ_CONTEXT * POFFLOAD_READ_CONTEXT
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR _In_ ULONG _In_ ULONG PreviousRetryCount
Definition: classpnp.h:482
MDL
Definition: mmtypes.h:117
struct _CLASS_RETRY_INFO * Next
Definition: classp.h:408
UCHAR ReleaseQueueSrbBuffer[CLASS_SRBEX_NO_SRBEX_DATA_BUFFER_SIZE]
Definition: classp.h:693
ULONGLONG OperationStartTime
Definition: classp.h:1162
BOOLEAN IdlePrioritySupported
Definition: classp.h:808
VOID ClasspFreeReleaseRequest(IN PDEVICE_OBJECT Fdo)
Definition: class.c:11525
Definition: ketypes.h:687
PMDL BuildDeviceInputMdl(PVOID Buffer, ULONG BufferLen)
Definition: utils.c:609
#define PROVISIONING_TYPE_THIN
Definition: scsi.h:2590
#define SCSIOP_RECEIVE_ROD_TOKEN_INFORMATION
Definition: scsi.h:343
#define SCSIOP_READ_CAPACITY16
Definition: scsi.h:364
__inline BOOLEAN ClasspIsIdleRequest(PIRP Irp)
Definition: classp.h:1268
#define SCSIOP_MEDIUM_REMOVAL
Definition: cdrw_hw.h:902
#define VOID
Definition: acefi.h:82
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
struct _CSCAN_LIST CSCAN_LIST
#define SERVICE_ACTION_WRITE_USING_TOKEN
Definition: scsi.h:443
VOID ClasspGetInquiryVpdSupportInfo(_Inout_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: class.c:12914
#define SCSIOP_POPULATE_TOKEN
Definition: scsi.h:340
_IRQL_requires_same_ NTSTATUS ClasspGetTokenOperationCommandBufferLength(_In_ PDEVICE_OBJECT Fdo, _In_ ULONG ServiceAction, _Inout_ PULONG CommandBufferLength, _Out_opt_ PULONG TokenOperationBufferLength, _Out_opt_ PULONG ReceiveTokenInformationBufferLength)
Definition: utils.c:7356
NTSTATUS ClasspRefreshFunctionSupportInfo(_Inout_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ BOOLEAN ForceQuery)
Definition: class.c:16395
ULONG NumHighPriorityPagingIo
Definition: classp.h:826
ULONG UpdateDiskPropertiesWorkItemActive
Definition: classp.h:704
BOOLEAN TickTimerEnabled
Definition: classp.h:813
Definition: typedefs.h:119
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
PKEVENT SyncEventPtr
Definition: classp.h:535
KDEFERRED_ROUTINE ClasspRetryRequestDpc
Definition: classp.h:1644
union _CLASS_PRIVATE_FDO_DATA::@1031 PowerSrb
_In_ PTRANSFER_PACKET _In_ ULONG _In_ PIRP OriginalIrp
Definition: classp.h:1757
_In_ ULONG _Inout_bytecount_(cj) DRVENABLEDATA *pded)
Definition: winddi.h:3541
NTSTATUS CreateStorageRequestBlock(_Inout_ PSTORAGE_REQUEST_BLOCK *Srb, _In_ USHORT AddressType, _In_opt_ PSRB_ALLOCATE_ROUTINE AllocateRoutine, _Inout_opt_ ULONG *ByteSize, _In_ ULONG NumSrbExData,...)
Definition: srblib.c:249
_Field_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG RetryIn100nsUnits
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _OPCODE_SENSE_DATA_IO_LOG_MESSAGE_CONTEXT_HEADER * POPCODE_SENSE_DATA_IO_LOG_MESSAGE_CONTEXT_HEADER
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
DRIVER_INITIALIZE DriverEntry
Definition: classp.h:1354
ULONG CopyOffloadMaxTargetDuration
Definition: classp.h:665
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
DRIVER_DISPATCH(nfs41_FsdDispatch)
#define _Deref_out_range_(lb, ub)
Definition: no_sal2.h:33
VOID ClasspContinueOffloadWrite(_In_ __drv_aliasesMem POFFLOAD_WRITE_CONTEXT OffloadWriteContext)
Definition: class.c:15187
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN _In_opt_ WDFREQUEST OriginalRequest
Definition: cdrom.h:989
ULONGLONG BlockNumber
Definition: classp.h:417
VOID ClasspRegisterMountedDeviceInterface(IN PDEVICE_OBJECT DeviceObject)
Definition: class.c:10970
KTIMER RetryTimer
Definition: classp.h:523
#define IRP_MJ_SYSTEM_CONTROL
enum _IO_PRIORITY_HINT IO_PRIORITY_HINT
* PDEVICE_CAPABILITIES
Definition: iotypes.h:948
VOID ClasspZeroQERR(_In_ PDEVICE_OBJECT DeviceObject)
Definition: utils.c:7938
NTSTATUS NTAPI ClassDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: class.c:894
LIST_ENTRY CurrentSweep
Definition: classp.h:424
CLASSPNP_SCAN_FOR_SPECIAL_INFO ClassBadItems[]
Definition: data.c:43
VOID HistoryLogSendPacket(TRANSFER_PACKET *Pkt)
Definition: history.c:45
VOID ClasspDeleteTimer(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: autorun.c:3798
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN WriteToDevice
Definition: cdrom.h:989
UCHAR MaxNumberOfIoRetries
Definition: classp.h:976
LARGE_INTEGER LongestThrottlePeriod
Definition: classp.h:846
#define _In_
Definition: no_sal2.h:204
NTSTATUS ClasspPagingNotificationCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_OBJECT RealDeviceObject)
LIST_ENTRY NextSweep
Definition: classp.h:433
struct _TRANSFER_PACKET TRANSFER_PACKET
__inline BOOLEAN PORT_ALLOCATED_SENSE_EX(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: classp.h:2547
IO_WORKITEM_ROUTINE_EX CleanupTransferPacketToWorkingSetSizeWorker
Definition: classp.h:1745
LARGE_INTEGER Delta
Definition: classp.h:743
__inline BOOLEAN ClasspTransferPacketGetNumberOfRetriesDone(_In_ PTRANSFER_PACKET Pkt, _In_ PCDB Cdb, _Out_ PULONG TimesAlreadyRetried)
Definition: classp.h:2459
BOOLEAN ReservedBoolean
Definition: classp.h:815
VOID ClasspCleanupOffloadReadContext(_In_ __drv_freesMem(mem) POFFLOAD_READ_CONTEXT OffloadReadContext)
Definition: class.c:14335
VOID ClasspReceiveWriteUsingTokenInformationDone(_In_ POFFLOAD_WRITE_CONTEXT OffloadWriteContext, _In_ NTSTATUS CompletionCausingStatus)
Definition: class.c:15695
#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE
Definition: srb.h:405
ULONG LowMemRetry_remainingBufLen
Definition: classp.h:546
NTSTATUS ClasspDeviceLBProvisioningProperty(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:2894
NTSTATUS ClasspDeviceGetBlockDeviceCharacteristicsVPDPage(_In_ PFUNCTIONAL_DEVICE_EXTENSION fdoExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:2072
VOID ClasspReceivePopulateTokenInformationTransferPacketDone(_In_ PVOID Context)
Definition: class.c:14504
#define IS_SCSIOP_READWRITE(opCode)
Definition: cdrom.h:803
unsigned short USHORT
Definition: pedump.c:61
__inline BOOLEAN ClasspIsReceiveTokenInformation(_In_ PCDB Cdb)
Definition: classp.h:2066
STORAGE_REQUEST_BLOCK
Definition: srb.h:652
PTRANSFER_PACKET Pkt
Definition: classp.h:1066
#define SRB_STATUS_TIMEOUT
Definition: srb.h:341
#define _In_z_
Definition: no_sal2.h:239
VOID ClassFreeOrReuseSrb(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN __drv_freesMem(mem) PSCSI_REQUEST_BLOCK Srb)
Definition: obsolete.c:882
FORCEINLINE PVOID SrbGetSenseInfoBuffer(_In_ PVOID Srb)
Definition: srbhelper.h:619
RTL_GENERIC_COMPARE_ROUTINE RemoveTrackingCompareRoutine
Definition: classp.h:2400
BOOLEAN ClasspScreenOff
Definition: autorun.c:124
GUID ClassGuidSrbSupport
Definition: data.c:218
#define CLASS_SRBEX_NO_SRBEX_DATA_BUFFER_SIZE
Definition: classpnp.h:696
BOOLEAN ClasspFailurePredictionPeriodMissed(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: autorun.c:4391
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
SCSI_REQUEST_BLOCK Srb
Definition: classp.h:1098
VOID ClassQueueResourceExhaustionEventWorker(_In_ PDEVICE_OBJECT DeviceObject)
Definition: utils.c:5528
union _CLASS_PRIVATE_FDO_DATA::@1032 ReleaseQueueSrb
_Dispatch_type_(IRP_MJ_CREATE) _Dispatch_type_(IRP_MJ_CLOSE) DRIVER_DISPATCH ClassCreateClose
Definition: create.c:4769
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
VOID RetryRequest(PDEVICE_OBJECT DeviceObject, PIRP Irp, PSCSI_REQUEST_BLOCK Srb, BOOLEAN Associated, LONGLONG TimeDelta100ns)
Definition: obsolete.c:359
unsigned int * PULONG
Definition: retypes.h:1
_In_z_ PWSTR _Out_ PULONG MaxDuration
Definition: classp.h:1938
volatile ULONG TokenOperationListIdentifier
Definition: class.c:108
FAILURE_PREDICTION_METHOD
Definition: classpnp.h:233
NTSTATUS ClassGetPdoId(IN PDEVICE_OBJECT Pdo, IN BUS_QUERY_ID_TYPE IdType, IN PUNICODE_STRING IdString)
Definition: class.c:10151
LARGE_INTEGER LastFailurePredictionQueryTime
Definition: classp.h:396
NTKRNLVISTAAPI IO_PRIORITY_HINT NTAPI IoGetIoPriorityHint(_In_ PIRP Irp)
Definition: io.c:123
#define __drv_freesMem(kind)
Definition: driverspecs.h:254
Definition: classp.h:1033
BOOLEAN InterpretTransferPacketError(PTRANSFER_PACKET Pkt)
Definition: retry.c:40
VOID EnqueueFreeTransferPacket(PDEVICE_OBJECT Fdo, __drv_aliasesMem PTRANSFER_PACKET Pkt)
Definition: xferpkt.c:529
BOOLEAN TestDictionarySignature(IN PDICTIONARY Dictionary)
Definition: dictlib.c:70
ULONGLONG LogicalBlockOffset
Definition: classp.h:1127
__inline PCDB ClasspTransferPacketGetCdb(_In_ PTRANSFER_PACKET Pkt)
Definition: classp.h:2445
#define SCSIOP_READ_CAPACITY
Definition: cdrw_hw.h:904
VOID ClasspDisableTimer(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: autorun.c:3956
VOID HistoryInitializeRetryLogs(_Out_ PSRB_HISTORY History, ULONG HistoryCount)
Definition: history.c:36
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define SLIST_ENTRY(type)
Definition: queue.h:102
BOOLEAN StepLowMemRetry(PTRANSFER_PACKET Pkt)
Definition: retry.c:706
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
VOID InitializeDictionary(IN PDICTIONARY Dictionary)
Definition: dictlib.c:58
VOID SetupModeSelectTransferPacket(TRANSFER_PACKET *Pkt, PKEVENT SyncEventPtr, PVOID ModeSelectBuffer, UCHAR ModeSelectBufferLen, BOOLEAN SavePages, PIRP OriginalIrp)
Definition: xferpkt.c:1420
BOOLEAN DisableThrottling
Definition: classp.h:981
_IRQL_requires_max_(APC_LEVEL) _IRQL_requires_min_(PASSIVE_LEVEL) _IRQL_requires_same_ VOID ClasspSetupPopulateTokenTransferPacket(_In_ __drv_aliasesMem POFFLOAD_READ_CONTEXT OffloadReadContext
Definition: cddata.c:197
Definition: mem.c:156
PMDL PartialMdl
Definition: classp.h:596
NTSTATUS ClasspMediaChangeCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
PUCHAR BufPtrCopy
Definition: classp.h:562
#define BOOLEAN
Definition: pedump.c:73
#define OUT
Definition: typedefs.h:40
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:384
__inline SINGLE_LIST_ENTRY * SimplePopSlist(SINGLE_LIST_ENTRY *SListHdr)
Definition: classp.h:1220
ULONGLONG TotalSectorsProcessed
Definition: classp.h:1150
struct tagContext Context
Definition: acpixf.h:1034
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
NTSTATUS NTAPI ClassSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: classwmi.c:221
NTSTATUS ClassDeviceHwFirmwareDownloadProcess(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:8539
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS ClassDeviceHwFirmwareGetInfoProcess(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: utils.c:8364
SLIST_ENTRY SlistEntry
Definition: classp.h:500
struct _OFFLOAD_WRITE_CONTEXT OFFLOAD_WRITE_CONTEXT
FORCEINLINE VOID SrbSetSenseInfoBuffer(_In_ PVOID Srb, _In_opt_ PVOID SenseInfoBuffer)
Definition: srbhelper.h:657
VOID ClasspQueueLogIOEventWithContextWorker(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SenseBufferSize, _In_ PVOID SenseData, _In_ UCHAR SrbStatus, _In_ UCHAR ScsiStatus, _In_ ULONG ErrorCode, _In_ ULONG CdbLength, _In_opt_ PCDB Cdb, _In_opt_ PTRANSFER_PACKET Pkt)
Definition: utils.c:6010
_IRQL_requires_same_ NTSTATUS ClasspGetTokenOperationDescriptorLimits(_In_ PDEVICE_OBJECT Fdo, _In_ ULONG ServiceAction, _In_ ULONG MaxParameterBufferLength, _Out_ PULONG MaxBlockDescriptorsCount, _Out_ PULONGLONG MaxBlockDescriptorsLength)
Definition: utils.c:7472
#define ULONG_PTR
Definition: config.h:101
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:728
uint32_t * PULONG_PTR
Definition: typedefs.h:65
NTSTATUS NTAPI ClassMinimalPowerHandler(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: power.c:1890
_In_ PTRANSFER_PACKET _In_ ULONG _In_reads_bytes_(Length) PUCHAR PopulateTokenBuffer
SENSE_DATA_EX SrbErrorSenseData
Definition: classp.h:570
VOID ClasspCompleteOffloadWrite(_In_ __drv_freesMem(Mem) POFFLOAD_WRITE_CONTEXT OffloadWriteContext, _In_ NTSTATUS CompletionCausingStatus)
Definition: class.c:15788
ULONG ReceiveTokenInformationBufferLength
Definition: classp.h:1133
PDEVICE_OBJECT Fdo
Definition: classp.h:1040
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
VOID History(INT, LPTSTR)
Definition: history.c:326
BOOLEAN LegacyErrorHandling
Definition: classp.h:971
PTRANSFER_PACKET Pkt
Definition: classp.h:1143
struct _PNL_SLIST_HEADER PNL_SLIST_HEADER
VOID ClasspCleanupOffloadWriteContext(_In_ __drv_freesMem(mem) POFFLOAD_WRITE_CONTEXT OffloadWriteContext)
Definition: class.c:15902
VOID ClasspDisablePowerNotification(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
__inline ULONG ClasspGetMaxUsableBufferLengthFromOffset(_In_ PVOID BaseAddress, _In_ ULONG OffsetInBytes, _In_ ULONG BaseStructureSizeInBytes)
Definition: classp.h:2585
ULONG MaxInterleavedNormalIo
Definition: classp.h:831
__inline UCHAR ClasspTransferPacketGetSenseInfoBufferLength(_In_ PTRANSFER_PACKET Pkt)
Definition: classp.h:2521
PCLASS_INTERPRET_SENSE_INFO2 InterpretSenseInfo
Definition: classp.h:958
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
PTRANSFER_PACKET DequeueFreeTransferPacketEx(_In_ PDEVICE_OBJECT Fdo, _In_ BOOLEAN AllocIfNeeded, _In_ ULONG Node)
Definition: xferpkt.c:661
#define _In_range_(lb, ub)
Definition: no_sal2.h:227
LARGE_INTEGER AntiStarvationStartTime
Definition: classp.h:930
NTSTATUS ClasspDeviceTrimProperty(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:2730
KSPIN_LOCK IdleListLock
Definition: classp.h:877
_In_ PVOID _Inout_ PULONG _In_ ULONG _Inout_ PULONG CurrentLbaCount
Definition: classp.h:1996
__inline BOOLEAN ClasspIsTokenOperation(_In_ PCDB Cdb)
Definition: classp.h:2044
struct _MEDIA_CHANGE_DETECTION_INFO::@1027 Gesn
ULONG DiskIdleTimeoutInMS
Definition: class.c:132
NTSTATUS NTAPI ClassGlobalDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:73
_In_ PRTL_GENERIC_COMPARE_ROUTINE _In_ PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine
Definition: rtlfuncs.h:1089
BOOLEAN InterpretSenseInfoWithoutHistory(_In_ PDEVICE_OBJECT Fdo, _In_opt_ PIRP OriginalRequest, _In_ PSCSI_REQUEST_BLOCK Srb, UCHAR MajorFunctionCode, ULONG IoDeviceCode, ULONG PreviousRetryCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIn100nsUnits)
Definition: class.c:12844
_IRQL_requires_same_ _In_ CLONG ByteSize
Definition: rtltypes.h:393
__inline BOOLEAN SimpleIsSlistEmpty(SINGLE_LIST_ENTRY *SListHdr)
Definition: classp.h:1229
struct _FAILURE_PREDICTION_INFO * PFAILURE_PREDICTION_INFO
KGUARDED_MUTEX IdlePowerFDOListMutex
Definition: class.c:114
RTL_GENERIC_FREE_ROUTINE RemoveTrackingFreeRoutine
Definition: classp.h:2404
CLASS_ERROR_LOG_DATA ErrorLogs[NUM_ERROR_LOG_ENTRIES]
Definition: classp.h:821
#define APC_LEVEL
Definition: env_spec_w32.h:695
UCHAR PowerSrbBuffer[CLASS_SRBEX_SCSI_CDB16_BUFFER_SIZE]
Definition: classp.h:688
_In_ PVOID BlockDescr
Definition: classp.h:1996
struct _CLASS_PRIVATE_FDO_DATA::@1033 Perf
ULONG AllocateNode
Definition: classp.h:611
#define CONST
Definition: pedump.c:81
BOOLEAN IsCachedDriveCapDataValid
Definition: classp.h:803
IO_WORKITEM_ROUTINE ClassLogThresholdEvent
Definition: classp.h:2298
base of all file and directory entries
Definition: entries.h:82
LIST_ENTRY ListEntry
Definition: classp.h:1034
#define NUM_RECEIVE_TOKEN_INFORMATION_RETRIES
Definition: classp.h:206
LARGE_INTEGER LastNonIdleIoTime
Definition: classp.h:935
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
VOID SetupDriveCapacityTransferPacket(TRANSFER_PACKET *Pkt, PVOID ReadCapacityBuffer, ULONG ReadCapacityBufferLen, PKEVENT SyncEventPtr, PIRP OriginalIrp, BOOLEAN Use16ByteCdb)
Definition: xferpkt.c:1475
UCHAR AsByte[16]
Definition: scsi.h:1988
IO_WORKITEM_ROUTINE ClasspLogIOEventWithContext
Definition: classp.h:1905
ULONG BufLenCopy
Definition: classp.h:563
_IRQL_requires_same_ NTSTATUS ClasspGetBlockDeviceTokenLimitsInfo(_Inout_ PDEVICE_OBJECT DeviceObject)
Definition: class.c:13220
NTSTATUS ClasspDuidQueryProperty(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: utils.c:997
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR _In_ ULONG IoDeviceCode
Definition: classpnp.h:482
LONGLONG QuadPart
Definition: typedefs.h:114
BOOLEAN RetryTransferPacket(PTRANSFER_PACKET Pkt)
Definition: retry.c:453
#define _Inout_opt_
Definition: no_sal2.h:258
VOID ClasspReceiveWriteUsingTokenInformationTransferPacketDone(_In_ POFFLOAD_WRITE_CONTEXT OffloadWriteContext)
Definition: class.c:16071
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
ULONGLONG EntireXferLen
Definition: classp.h:1092
Definition: dlist.c:348
BOOLEAN CompleteOriginalIrpWhenLastPacketCompletes
Definition: classp.h:510
#define NT_ASSERT
Definition: rtlfuncs.h:3312
VOID NTAPI ClasspScanForClassHacks(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN ULONG_PTR Data)
Definition: class.c:12634
ULONG LocalMaxWorkingSetTransferPackets
Definition: classp.h:712