ReactOS 0.4.15-dev-7953-g1f49173
fxioqueue.hpp
Go to the documentation of this file.
1
2/*++
3
4Copyright (c) Microsoft. All rights reserved.
5
6Module Name:
7
8 FxIoQueue.h
9
10Abstract:
11
12 This module implements the I/O package queue object
13
14Author:
15
16
17
18
19Environment:
20
21 Both kernel and user mode
22
23Revision History:
24
25
26--*/
27
28#ifndef _FXIOQUEUE_H_
29#define _FXIOQUEUE_H_
30
32
33extern "C" {
34#if defined(EVENT_TRACING)
35#include "FxIoQueue.hpp.tmh"
36#endif
37}
38
39
40//
41// These FxIoQueue public Enum and Struct are used to tie the queue
42// with FxPkgIo.
43//
49};
50
52public:
53 //
54 // Data members.
55 //
58
59public:
60 //
61 // Manager functions.
62 //
65 ) :
67 {
70 }
71
73 {
75 }
76
77private:
78 //
79 // Turn off unsupported manager functions.
80 //
82
83 //
84 // Block default behavior to shallow copy the object because it contains
85 // a double-link entry; shallow copying the object produces an invalid
86 // copy because the double-link entry is not properly re-initialized.
87 //
89
91
92public:
93 //
94 // Helper functions.
95 //
96 static
100 )
101 {
103 }
104
105 static
106 BOOLEAN
109 )
110 {
113 }
114
115 __inline
116 BOOLEAN
119 )
120 {
121 return (NodeType == m_Type) ? TRUE : FALSE;
122 }
123};
124
125//
126// These FxIoQueue private Enum's control the internal state machine
127//
128
129// begin_wpp enum
146// end_wpp
147
149 //
150 // Total Number of Reserved requests
151 //
153 //
154 // Callback invoked to allocate resources for reserved requests at init time
155 //
157 //
158 // Callback invoked to allocate resources for non-reserved requests at run time
159 //
161 //
162 // Callback invoked to Examine the IRP and decide whether to fail it or not
163 //
165 //
166 // Policy configured for forward progress
167 //
169 //
170 // List of available reserved requests
171 //
173
174 //
175 // List of in use reserved requests
176 //
178
179 //
180 // List of all pended IRPs
181 //
183 //
184 // This lock is used to add new entreies to the pended IRP list
185 // or the add the request back to the Reserved List
186 //
188
190
191//
192// This defines the valid arguments to the
193// SetStatus call.
194//
203
204
205//
206// This defines the internal queue state.
207//
208typedef enum _FX_IO_QUEUE_STATE {
209 //
210 // private == public values (low word).
211 //
217 //
218 // private values only (high word).
219 //
220 // Queue is being shut down. Flag on means do not queue any request
221 // even if the accept request state is set. This flag prevents the
222 // following scenarios:
223 // (1) a race condition where a dispatch queue handler changes the
224 // state of the queue to accept_requests while we are in the
225 // middle of a power stopping (purge) operation (Win7 719587).
226 // (2) another thread calling Stop or Start on a queue that is in the
227 // middle of a power stopping (purge) operation.
228 //
229 FxIoQueueShutdown = 0x00010000
231
233
234 friend VOID GetTriageInfo(VOID);
235
236private:
237
238 //
239 // forward progress fields
240 //
242
243 //
244 // This is a true indicator whether the Queue is ready for forward progress
245 //
247
248 //
249 // Specifies that the queue has been configured
250 // with driver callbacks and presentation serialization
251 //
253
254 //
255 // TRUE if this is a power managed queue. If TRUE, it is reported
256 // as a power managed queue, and will automatically start/resume
257 // based on power management requests.
258 //
259 // If false, the device driver has manual control on start/resume.
260 //
262
263 //
264 // This is TRUE if we have an outstanding reference to the
265 // Pnp package about having I/O in our queue.
266 //
268
269 //
270 // If TRUE, zero length read/writes are allowed to the driver.
271 // Otherwise, they are completed automatically with STATUS_SUCCESS.
272 //
274
275 //
276 // True if callback operations to the driver occur at
277 // PASSIVE_LEVEL. Also marked in FxObject, but this cache
278 // avoids acquiring FxObject state lock.
279 //
281
282 //
283 // This is set before m_FinishDisposing is signalled to
284 // allow the Dispose thread to continue deletion of
285 // queue resources. Once this is set, no thread is
286 // allowed to run thru DispatchEvents.
287 //
289
290 //
291 // This is set when the I/O package marks the queue
292 // for deleting, but the I/O queue deferrs its final
293 // dereference until all outstanding I/O's to the
294 // device driver are completed.
295 //
298
299 //
300 // Power State of the Queue
301 //
303
304 //
305 // This is the type of queue, and is configured by the
306 // user at initial queue creation time.
307 //
309
310 //
311 // Maximum number of driver presented Requests on a parallel Queue
312 //
314
315 //
316 // This is the current processing status of the queue.
317 //
319
320 //
321 // The FxIoQueue tracks a request from the time it arrives by being
322 // enqueued, until it leaves by being completed, or forwarded.
323 //
324 // At any given time, a request may be in one the following five states:
325 //
326 // 1) Request is queued and cancelable
327 //
328 // It is on the FxIrpQueue m_Queue using the LIST_ENTRY
329 // FxRequest::m_Irp->Tail.Overlay.ListEntry
330 //
331 // 2) Request has been passed to the driver, and is not cancelable
332 //
333 // It is on the LIST_ENTRY m_DriverNonCancelable using the LIST_ENTRY
334 // FxRequest::m_OwnerListEntry
335 //
336 // It is also on the LIST_ENTRY m_DriverInFlight using the LIST_ENTRY
337 // FxRequest::m_InFlightListEntry
338 //
339 // 3) Request has been passed to the driver, and is cancelable
340 //
341 // It is on the FxIrpQueue m_DriverCancelable using the LIST_ENTRY
342 // FxRequest::m_Irp->Tail.Overlay.ListEntry
343 //
344 // It is also on the LIST_ENTRY m_DriverInFlight using the LIST_ENTRY
345 // FxRequest::m_InFlightListEntry
346 //
347 // 4) Request has been cancelled, but the driver has not been notified
348 //
349 // It is on the LIST_ENTRY m_Cancelled using the LIST_ENTRY
350 // FxRequest::m_OwnerListEntry
351 //
352 // 5) Request has been cancelled, driver has been notified, but has
353 // not completed it yet
354 //
355 // It is on the LIST_ENTRY m_DriverNonCancelable using the LIST_ENTRY
356 // FxRequest::m_OwnerListEntry
357 //
358 // It is also on the LIST_ENTRY m_DriverInFlight using the LIST_ENTRY
359 // FxRequest::m_InFlightListEntry
360 //
361
362 //
363 // This is the Queue of current requests that have not
364 // been presented to the driver
365 //
367
368 //
369 // This is the list of requests that driver has accepted
370 // and is working on, but wants to be cancelable.
371 //
373
374 //
375 // This is a list of cancelled requests to be notified to the driver.
376 //
377 // FxListEntryQueueOwned of FxRequest is used for linkage
378 //
380
381 //
382 // This is a list of request cancelled on queue waiting
383 // to be notified to the driver.
384 //
385 // FxListEntryQueueOwned of FxRequest is used for linkage
386 //
388
389 //
390 // This is a list of requests that the driver has accepted
391 // and is working on, but has not been completed.
392 //
393 // They may, or may not be cancelable.
394 //
395 // FxListEntryDriverOwned of FxRequest is used for linkage
396 //
398
399 //
400 // This is the list of power stop/start requests to be notified to
401 // the driver.
402 //
403 // FxListEntryDriverOwned of FxRequest is used for linkage
404 //
406
407 //
408 // This is the list of power stop requests in which the driver
409 // has been notified, and must be zero before power code can
410 // resume the power thread.
411 //
412 // FxListEntryDriverOwned of FxRequest is used for linkage
413 //
415
416 //
417 // Pointer to FxPkgIo object that contains this queue.
418 // (No additional reference count)
419 //
421
422 //
423 // Weak pointer to the associated FxCxDeviceInfo struct.
424 //
426
427 //
428 // This is the count of currently executing callback
429 // handlers into the device driver.
430 //
431 // It is used to control the dispatch state to prevent stack
432 // recursions, as well as to handle notification when a queue
433 // is idle and has no callbacks outstanding.
434 //
436
437 //
438 // This is set when a queue goes from empty to
439 // having requests and allows a callback to the driver
440 // when a queue is ready.
441 //
443
444 //
445 // This flag is set when the we return no_more_requests from
446 // WdfRequesdtGetNextRequest but the queue actually holds one or
447 // more requests in cancellation state (their cancellation routine
448 // are already running).
449 // This flag insures that we call the ReadyNotify callback when a new
450 // request is inserted in the queue.
451 //
453
454 //
455 // This is set when the driver starts a WdfIoQueueStopAndPurge operation.
456 // This is cleared in the following conditions:
457 // (a) there are no more driver owned requests.
458 // (b) driver re-enables the dispatch gate.
459 // When set any requeued requests will be automatically deleted.
460 //
462
464
465 //
466 // This is the number of requests the driver
467 // currently is processing both cancellable and noncancellable.
468 //
469 // For serial queue dispatch mode, this is used
470 // to control when a request can be presented to the driver.
471 // This is also used to implement counted Queues to make
472 // sure the count doesn't exceed max. allowed on the
473 // parallel Queue.
474 //
476
477 //
478 // This is the number of requests that are about to be completed using two
479 // phase completion technique (to support queued-by-driver requests).
480 //
482
483 //
484 // These are the driver configured callbacks to send
485 // I/O events to the driver
486 //
495
497
498 //
499 // These are status events registered by the device driver
500 //
503
506
509
510 //
511 // The following items support the callback constraints
512 // and handle locking and deferral
513 //
516
517 //
518 // These are the passive and dispatch level presentation locks
519 //
522
523 //
524 // This pointer allows the proper lock to be acquired
525 // based on the configuration with a minimal of runtime
526 // checks. This is configured by ConfigureLocking()
527 //
530
531 //
532 // The IoQueue must sometimes defer event delivery to the
533 // device driver due to interactions with current locks held,
534 // and the device driver configured callback constraints.
535 //
536 // When a deferral occurs, a DPC or FxSystemWorkItem is used
537 // to post an event to later deliver the event(s) to the device
538 // driver. Whether a DPC or WorkItem is used depends
539 // on the drivers configured execution level constraints.
540 //
541 // The IoQueue is designed to be robust in that multiple events
542 // may occur while the queued DPC or WorkItem is outstanding,
543 // and they will be properly processed without having to enqueue
544 // one for each event. Basically, they are just a signal that
545 // an IoQueue needs some attention that could result in device
546 // driver notification.
547 //
548 // KDPC is only needed in kernel mode
549 //
550
551
552
553#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
555#endif
556
558
559 //
560 // These are true if the associated Dpc or Work Item is queued
561 //
564
565 //
566 // Track whether the above DPC and WorkItem needs to be requeued.
567 //
569
570 // This is set when the Queue is power idle
572
573
574
575
576
577#if (FX_CORE_MODE==FX_CORE_USER_MODE)
579#endif
580
581public:
582
583 //
584 // List node to tie the queue with FxPkgIo.
585 //
587 //
588 // List entry is used by FxPkgIo to iterate list all the queues without
589 // holding a lock.
590 //
592
593public:
594 // Factory function
596 static
598 _Create(
602 __in_opt FxDriver* Caller,
603 __in FxPkgIo* PkgIo,
604 __in BOOLEAN InitialPowerStateOn,
606 );
607
608 FxIoQueue(
609 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
610 __in FxPkgIo* PkgIo
611 );
612
613 virtual
615 );
616
622 __in_opt FxDriver* Caller,
623 __in BOOLEAN InitialPowerStateOn
624 );
625
627 VOID
628 CancelForQueue(
631 );
632
633 // Do not specify argument names
635 VOID,
636 VerifyCancelForDriver,
638 );
639
640 VOID
643 );
644
645 // Do not specify argument names
647 VOID,
648 VerifyValidateCompletedRequest,
650 );
651
652 __inline
653 VOID
656 )
657 {
658 //
659 // This is called when a FxRequest object completes based
660 // on the callback event registered by the I/O queue support
661 // routines.
662 //
663
664 KIRQL irql;
665
666#if FX_VERBOSE_TRACE
668 "Enter: WDFQUEUE 0x%p, WDFREQUEST 0x%p",
669 GetObjectHandle(),Request->GetHandle());
670#endif
671 VerifyValidateCompletedRequest(GetDriverGlobals(), Request);
672
673 Lock(&irql);
674
675 //
676 // I/O has been completed by the driver
677 //
679
680 //
681 // Don't run the event dispatcher if we come from a Request
682 // complete callback in order to prevent stack recursion.
683 //
684 // Since some other thread (possibly this thread higher on
685 // the stack) is running the dispatcher, no events will get lost.
686 //
687 DispatchInternalEvents(irql);
688 }
689
690 __inline
691 VOID
694 )
695 {
696 //
697 // This is called when a driver created request is about to be completed.
698 // This callback removes the FxRequest object from the internal queue linked
699 // lists. A call to PostRequestCompletedCallback must be made after irp is
700 // completed.
701 //
702
703 KIRQL irql;
704
705#if FX_VERBOSE_TRACE
707 "Enter: WDFQUEUE 0x%p, WDFREQUEST 0x%p",
708 GetObjectHandle(),Request->GetHandle());
709#endif
710
711 VerifyValidateCompletedRequest(GetDriverGlobals(), Request);
712
713 Lock(&irql);
714
715 //
716 // I/O has been completed by the driver
717 //
719
720 Unlock(irql);
721 }
722
723 __inline
724 VOID
727 )
728 {
729 // Do not acccess Request, at this point the object may have already been
730 // deleted or reused.
731
732 //
733 // This is called when a queued-by-driver request (driver created) is
734 // completed or sent to a lower driver with 'send-and-forget' option.
735 // This callback allows the queue to schedule another request for delivery.
736 //
737
738 KIRQL irql;
739
740#if FX_VERBOSE_TRACE
742 "Enter: WDFQUEUE 0x%p, WDFREQUEST 0x%p",
744#else
746#endif
747
748 Lock(&irql);
749
750 //
751 // I/O has been completed by the driver
752 //
754
755 //
756 // Don't run the event dispatcher if we come from a Request
757 // complete callback in order to prevent stack recursion.
758 //
759 // Since some other thread (possibly this thread higher on
760 // the stack) is running the dispatcher, no events will get lost.
761 //
762 DispatchInternalEvents(irql);
763 }
764
765 __inline
766 FxDriver*
768 return m_PkgIo->GetDriver();
769 }
770
771 __inline
772 CfxDevice*
774 {
775 return m_Device;
776 }
777
778 __inline
779 FxPkgIo*
781 return m_PkgIo;
782 }
783
784 WDFQUEUE
785 __inline
787 VOID
788 )
789 {
790 return (WDFQUEUE) GetObjectHandle();
791 }
792
793 __inline
794 BOOLEAN
796 return m_PowerManaged;
797 }
798
799 VOID
801 VOID
802 );
803
804 VOID
806 VOID
807 );
808
809 VOID
812 );
813
814 VOID
816 VOID
817 );
818
819 VOID
821 VOID
822 );
823
824 VOID
826 VOID
827 );
828
830 GetState(
831 __out_opt PULONG pQueueCount,
832 __out_opt PULONG pDriverCount
833 );
834
835 VOID
836 SetState(
838 );
839
840
841 __inline
842 BOOLEAN
845 )
846 {
847 ASSERT(!(State & 0x80000000)); // Don't allow FX_IO_QUEUE_SET states
848 return (((int)m_QueueState & (int) (State)) != 0);
849 }
850
851 __inline
852 BOOLEAN
855 )
856 {
857 ASSERT(!(State & 0x80000000)); // Don't allow FX_IO_QUEUE_SET states
858 return (((int)m_QueueState & (int) (State)) != 0);
859 }
860
861 // GetRequest Verifiers
862 // Do not specify argument names
864 NTSTATUS,
865 VerifyGetRequestUpdateFlags,
867 );
868
869 // Do not specify argument names
871 VOID,
872 VerifyGetRequestRestoreFlags,
874 );
875
881 __deref_out FxRequest** pOutRequest
882 );
883
884 // PeekRequest Verifiers
885 // Do not specify argument names
887 NTSTATUS,
888 VerifyPeekRequest,
890 );
891
898 __deref_out FxRequest** pOutRequest
899 );
900
901 // ForwardRequest Verifiers
902 // Do not specify argument names
904 NTSTATUS,
905 VerifyForwardRequest,
908 );
909
915 );
916
917 // QueueDriverCreatedRequest
918 // Do not specify argument names
920 NTSTATUS,
921 VerifyQueueDriverCreatedRequest,
924 );
925
930 __in BOOLEAN ParentQueue
931 );
932
934 VOID
935 ProcessAcknowledgedRequests(
938 );
939
940 // Do not specify argument names
942 NTSTATUS,
943 VerifyRequeue,
945 );
946
949 Requeue(
951 );
952
953 // Do not specify argument names
955 NTSTATUS,
956 VerifyRequestCancelable,
959 );
960
967 __in BOOLEAN FailIfIrpIsCancelled
968 );
969
974 );
975
976
981 );
982
987 );
988
990 BOOLEAN
993 );
994
997 BOOLEAN
998 DispatchEvents(
1001 );
1002
1005 __inline
1006 VOID
1007 DispatchInternalEvents(
1009 )
1010 /*++
1011
1012 Routine Description:
1013
1014 Dispatch events and requests from the queue to the driver.
1015
1016 The IoQueue object lock must be held on entry, but this
1017 routine returns to the caller with the lock released.
1018
1019 To avoid recursion, this routine checks to see if this or another
1020 thread is already in the dispatch-event loop. If so, it
1021 doesn't re-enter the dispatch-even loop.
1022
1023 --*/
1024 {
1025 if(m_Dispatching == 0) {
1026 //
1027 // Nobody is dispatching events so we must
1028 // call the main DispatchEvents function because
1029 // the caller of this function might have affected the
1030 // state of the queue.
1031 //
1032 (VOID) DispatchEvents(PreviousIrql);
1033
1034 } else {
1035
1037 }
1038 }
1039
1040
1041 VOID
1044 );
1045
1046 virtual
1047 VOID
1049 __out WDF_EXECUTION_LEVEL* ExecutionLevel,
1050 __out WDF_SYNCHRONIZATION_SCOPE* SynchronizationScope
1051 ) {
1052
1053 if (ExecutionLevel != NULL) {
1054 *ExecutionLevel = m_ExecutionLevel;
1055 }
1056
1057 if (SynchronizationScope != NULL) {
1058 *SynchronizationScope = m_SynchronizationScope;
1059 }
1060 }
1061
1062 virtual
1066 )
1067 {
1068 if (LockObject != NULL) {
1070 }
1071
1072 return m_CallbackLockPtr;
1073 }
1074
1076 virtual
1077 NTSTATUS
1080 )
1081 {
1082 switch (Params->Type) {
1083 case FX_TYPE_QUEUE:
1084 *Params->Object = (FxIoQueue*) this;
1085 break;
1086
1088 *Params->Object = (IFxHasCallbacks*) this;
1089 break;
1090
1091 default:
1092 return FxNonPagedObject::QueryInterface(Params); // __super call
1093 }
1094
1095 return STATUS_SUCCESS;
1096 }
1097
1098 virtual
1099 BOOLEAN
1100 Dispose(
1101 VOID
1102 );
1103
1104 //
1105 // Start the Queue
1106 //
1107 VOID
1108 QueueStart(
1109 VOID
1110 );
1111
1112 //
1113 // Idle/Stop the Queue
1114 //
1116 NTSTATUS
1117 QueueIdle(
1118 __in BOOLEAN CancelQueueRequests,
1119 __in_opt PFN_WDF_IO_QUEUE_STATE IdleComplete,
1121 );
1122
1123 //
1124 // Idle the Queue
1125 //
1127 NTSTATUS
1129 __in BOOLEAN CancelRequests
1130 );
1131
1132 //
1133 // Purge the Queue
1134 //
1136 NTSTATUS
1137 QueuePurge(
1138 __in BOOLEAN CancelQueueRequests,
1139 __in BOOLEAN CancelDriverRequests,
1142 );
1143
1145 NTSTATUS
1147 VOID
1148 );
1149
1150 //
1151 // Idle the Queue
1152 //
1154 NTSTATUS
1155 QueueDrain(
1158 );
1159
1160 //
1161 // Idle the Queue
1162 //
1164 NTSTATUS
1166 VOID
1167 );
1168
1169 //
1170 // Notify the driver through a callback when the queue transitions
1171 // from no requests to having a request.
1172 //
1174 NTSTATUS
1178 );
1179
1180
1181 VOID
1184 );
1185
1186 //
1187 // Return count of queued and driver pending requests.
1188 //
1189 VOID
1191 __out_opt PULONG pQueuedRequests,
1192 __out_opt PULONG pDriverPendingRequests
1193 );
1194
1195
1197 NTSTATUS
1200 __in_opt FxDriver* Caller
1201 );
1202
1203 VOID
1205 VOID
1206 );
1207
1208 VOID
1210 VOID
1211 );
1212
1213 __inline
1214 static
1215 FxIoQueue*
1218 )
1219 {
1221 }
1222
1223 __inline
1224 static
1225 FxIoQueue*
1228 )
1229 {
1231 }
1232
1234 VOID
1235 FatalError(
1237 );
1238
1239 BOOLEAN
1242 );
1243
1244 __inline
1245 VOID
1248 )
1249 {
1250 if (m_PowerManaged) {
1252 }
1253 }
1254
1256 NTSTATUS
1258 __in MdIrp Irp,
1259 __deref_out_opt FxRequest **ReservedRequest
1260 );
1261
1262 __inline
1263 BOOLEAN
1265 VOID
1266 )
1267 {
1269 }
1270
1271 __inline
1272 NTSTATUS
1275 )
1276 /*++
1277
1278 Routine Description:
1279 Give callback to allocate resources at runtime for a general request
1280 (not a reserved request).
1281
1282 --*/
1283 {
1285
1286 ASSERT(Request->IsReserved() == FALSE);
1287
1290 Request->SetPresented();
1292 GetHandle(), Request->GetHandle());
1293 }
1294
1295 return status;
1296 }
1297
1298 VOID
1300 __in FxRequest *ReservedRequest
1301 );
1302
1304 NTSTATUS
1307 );
1308
1310 NTSTATUS
1313 );
1314
1315 // ForwardRequestWorker verifiers
1316 // Do not specify argument names
1318 ,
1319 SHORT,
1320 0,
1321 VerifyForwardRequestUpdateFlags,
1323 );
1324
1326 NTSTATUS
1330 );
1331
1332 // ForwardRequestToParent Verifiers
1333 // Do not specify argument names
1335 NTSTATUS,
1336 VerifyForwardRequestToParent,
1337 _In_ FxIoQueue*,
1339 );
1340
1342 NTSTATUS
1347 );
1348
1349 __inline
1350 VOID
1352 __in FxCxDeviceInfo* CxDeviceInfo
1353 )
1354 {
1355 m_CxDeviceInfo = CxDeviceInfo;
1356 }
1357
1358 __inline
1361 VOID
1362 )
1363 {
1364 return m_CxDeviceInfo;
1365 }
1366
1367 __inline
1368 VOID
1370 VOID
1371 )
1372 {
1374 }
1375
1376 VOID
1378 VOID
1379 );
1380
1381 VOID
1383 VOID
1384 );
1385
1386private:
1387
1388 //
1389 // Helper functions for event processing loop DispatchEvents()
1390 //
1392 VOID
1393 ProcessIdleComplete(
1395 );
1396
1398 VOID
1399 ProcessPurgeComplete(
1401 );
1402
1404 VOID
1405 ProcessReadyNotify(
1407 );
1408
1410 BOOLEAN
1411 ProcessCancelledRequests(
1413 );
1414
1416 BOOLEAN
1417 ProcessCancelledRequestsOnQueue(
1419 );
1420
1422 BOOLEAN
1423 ProcessPowerEvents(
1425 );
1426
1427 __inline
1428 BOOLEAN
1430 VOID
1431 )
1432 {
1436 return TRUE;
1437 }
1438 else {
1439 return FALSE;
1440 }
1441 }
1442
1443 //
1444 // Insert in the list of requests that the driver is operating
1445 // on.
1446 //
1447 // Must be called with the FxIoQueue lock held.
1448 //
1449 __inline
1450 VOID
1453 )
1454 {
1456
1458 return;
1459 }
1460
1461 //
1462 // Remove the request from the list that the driver is operating
1463 // on.
1464 //
1465 // Must be called with the FxIoQueue lock held.
1466 //
1467 // Note: ForwardRequest and two phase completions (queued-by-driver) cases breaks
1468 // this up and manipulates the list entry and m_DriverIoCount separately.
1469 //
1470 __inline
1471 VOID
1474 )
1475 {
1476 PLIST_ENTRY listEntry;
1477
1478 listEntry = Request->GetListEntry(FxListEntryDriverOwned);
1479
1480 RemoveEntryList(listEntry);
1481 InitializeListHead(listEntry);
1482
1484 ASSERT(m_DriverIoCount >= 0);
1485
1486 return;
1487 }
1488
1489 //
1490 // Pre-Remove the request from the list that the driver is operating on
1491 // (the first of two phase completion).
1492 //
1493 // Must be called with the FxIoQueue lock held.
1494 //
1495 __inline
1496 VOID
1499 )
1500 {
1501 PLIST_ENTRY listEntry;
1502
1503 listEntry = Request->GetListEntry(FxListEntryDriverOwned);
1504
1505 RemoveEntryList(listEntry);
1506 InitializeListHead(listEntry);
1507
1510
1511 return;
1512 }
1513
1514 //
1515 // Post-Remove the request from the list that the driver is operating on
1516 // (the second of two phase completion).
1517 //
1518 // Must be called with the FxIoQueue lock held.
1519 //
1520 __inline
1521 VOID
1523 VOID
1524 )
1525 {
1528
1530 ASSERT(m_DriverIoCount >= 0);
1531 return;
1532 }
1533
1534 //
1535 // This is called after inserting a new request in the IRP queue.
1536 //
1537 // Must be called with the FxIoQueue lock held.
1538 //
1539 __inline
1540 VOID
1542 VOID
1543 )
1544 {
1545 if (m_Queue.GetRequestCount() == 1L ||
1547
1549 }
1550 }
1551
1552 //
1553 // Indicate that the queue went from empty to having one or more requests.
1554 //
1555 // Must be called with the FxIoQueue lock held.
1556 //
1557 __inline
1558 VOID
1560 VOID
1561 )
1562 {
1565
1569
1572 }
1573 }
1574 }
1575
1576 NTSTATUS
1580 );
1581
1582 __inline
1583 NTSTATUS
1587 )
1588 {
1590
1591 if (*Request != NULL) {
1593 }
1594 else {
1595 status = STATUS_SUCCESS; // nothing to do.
1596 }
1597
1598 return status;
1599 }
1600
1601 VOID
1604 );
1605
1607 NTSTATUS
1609 __in MdIrp Irp
1610 );
1611
1613 MdIrp
1616 );
1617
1618 BOOLEAN
1619 IsPagingIo(
1620 __in MdIrp Irp
1621 );
1622
1623 VOID
1625 __in FxRequest *ReservedRequest
1626 )
1627 {
1628 KIRQL oldIrql;
1629 PLIST_ENTRY listEntry;
1630
1632
1633 listEntry = ReservedRequest->GetListEntry(FxListEntryForwardProgress);
1634
1635 m_FwdProgContext->m_PendedReserveLock.Acquire(&oldIrql);
1636
1637 RemoveEntryList(listEntry);
1638 InitializeListHead(listEntry);
1639
1641
1642 if (GetDriverGlobals()->FxVerifierIO) {
1644 }
1645
1646 m_FwdProgContext->m_PendedReserveLock.Release(oldIrql);
1647 }
1648
1649
1650 VOID
1652 __in PLIST_ENTRY IrpListHead,
1654 );
1655
1656 VOID
1657 CancelIrps(
1658 __in PLIST_ENTRY IrpListHead
1659 );
1660
1661 VOID
1664 );
1665
1666 VOID
1668 VOID
1669 );
1670
1671protected:
1672 static
1673 EVT_IRP_QUEUE_CANCEL
1675
1676 //
1677 // This is our Cancel Safe Queue Callback from
1678 // FxIrpQueue notifying us of an I/O cancellation
1679 // on a driver owned request (driver queue)
1680 //
1681 static
1682 EVT_IRP_QUEUE_CANCEL
1684
1685 static
1686 EVT_SYSTEMWORKITEM
1688
1689 static
1692
1693 static
1694 EVT_WDF_IO_QUEUE_STATE
1696
1697 static
1698 EVT_WDF_IO_QUEUE_STATE
1700
1701 static
1704
1705};
1706
1707#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1708#include "fxioqueuekm.hpp"
1709#else
1710#include "fxioqueueum.hpp"
1711#endif
1712
1713
1714#endif // _FXIOQUEUE_H_
NodeType
Definition: Node.h:6
unsigned char BOOLEAN
#define VOID
Definition: acefi.h:82
LONG NTSTATUS
Definition: precomp.h:26
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
PFN_WDF_IO_ALLOCATE_REQUEST_RESOURCES Method
_Must_inspect_result_ NTSTATUS Invoke(__in WDFQUEUE Queue, __in WDFREQUEST Request)
DECLSPEC_NORETURN VOID FatalError(__in NTSTATUS Status)
Definition: fxioqueue.cpp:6339
__inline VOID InsertInDriverOwnedList(__in FxRequest *Request)
Definition: fxioqueue.hpp:1451
BOOLEAN m_PassiveLevel
Definition: fxioqueue.hpp:280
__inline FxCxDeviceInfo * GetCxDeviceInfo(VOID)
Definition: fxioqueue.hpp:1360
_Must_inspect_result_ NTSTATUS QueueIdle(__in BOOLEAN CancelQueueRequests, __in_opt PFN_WDF_IO_QUEUE_STATE IdleComplete, __in_opt WDFCONTEXT Context)
Definition: fxioqueue.cpp:3584
__inline FxPkgIo * GetPackage(VOID)
Definition: fxioqueue.hpp:780
FxObject * m_CallbackLockObjectPtr
Definition: fxioqueue.hpp:529
__inline VOID PostRequestCompletedCallback(__in FxRequest *Request)
Definition: fxioqueue.hpp:725
_Must_inspect_result_ NTSTATUS ForwardRequest(__in FxIoQueue *pDestQueue, __in FxRequest *pRequest)
Definition: fxioqueue.cpp:1712
FxSystemWorkItem * m_SystemWorkItem
Definition: fxioqueue.hpp:557
FX_DECLARE_VF_FUNCTION_P1(NTSTATUS, VerifyPeekRequest, _In_ FxRequest *)
_Must_inspect_result_ NTSTATUS QueueDrainSynchronously(VOID)
Definition: fxioqueue.cpp:4177
FxIoQueueNode m_IoPkgListNode
Definition: fxioqueue.hpp:586
static __inline FxIoQueue * _FromPowerSListEntry(__in PSINGLE_LIST_ENTRY Entry)
Definition: fxioqueue.hpp:1226
__drv_requiresIRQL(DISPATCH_LEVEL) VOID ProcessReadyNotify(__out PKIRQL PreviousIrql)
__inline BOOLEAN IsForwardProgressQueue(VOID)
Definition: fxioqueue.hpp:1264
BOOLEAN m_PowerManaged
Definition: fxioqueue.hpp:261
WDFCONTEXT m_ReadyNotifyContext
Definition: fxioqueue.hpp:508
FxIoQueueIoDefault m_IoDefault
Definition: fxioqueue.hpp:487
FX_DECLARE_VF_FUNCTION_P1(NTSTATUS, VerifyRequeue, _In_ FxRequest *)
BOOLEAN m_RequeueDeferredDispatcher
Definition: fxioqueue.hpp:568
__inline VOID PreRemoveFromDriverOwnedList(__in FxRequest *Request)
Definition: fxioqueue.hpp:1497
MxEvent m_RequestWaitEventUm
Definition: fxioqueue.hpp:578
static __inline FxIoQueue * _FromIoPkgListEntry(__in PLIST_ENTRY Entry)
Definition: fxioqueue.hpp:1216
WDF_SYNCHRONIZATION_SCOPE m_SynchronizationScope
Definition: fxioqueue.hpp:515
__inline BOOLEAN IsState(__in WDF_IO_QUEUE_STATE State)
Definition: fxioqueue.hpp:843
BOOLEAN m_IsDevicePowerPolicyOwner
Definition: fxioqueue.hpp:463
static EVT_WDF_IO_QUEUE_STATE _IdleComplete
Definition: fxioqueue.hpp:1699
virtual ~FxIoQueue()
Definition: fxioqueue.cpp:142
__inline VOID RemoveFromDriverOwnedList(__in FxRequest *Request)
Definition: fxioqueue.hpp:1472
BOOLEAN IsPagingIo(__in MdIrp Irp)
Definition: fxioqueuekm.hpp:30
MxEvent m_PowerIdle
Definition: fxioqueue.hpp:571
PFXIO_FORWARD_PROGRESS_CONTEXT m_FwdProgContext
Definition: fxioqueue.hpp:241
static MdCancelRoutineType _WdmCancelRoutineForReservedIrp
Definition: fxioqueue.hpp:1703
volatile BOOLEAN m_CancelDispatchedRequests
Definition: fxioqueue.hpp:461
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS DriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in PWDF_IO_QUEUE_CONFIG Config, __in_opt FxDriver *Caller, __in FxPkgIo *PkgIo, __in BOOLEAN InitialPowerStateOn, __deref_out FxIoQueue **Object)
Definition: fxioqueue.cpp:164
FxCallbackSpinLock m_CallbackSpinLock
Definition: fxioqueue.hpp:520
__inline VOID SetInterruptQueue(VOID)
Definition: fxioqueue.hpp:1369
__inline FxDriver * GetDriver(VOID)
Definition: fxioqueue.hpp:767
VOID VerifierVerifyFwdProgListsLocked(VOID)
Definition: fxioqueue.cpp:6486
_Must_inspect_result_ NTSTATUS RequestCancelable(__in FxRequest *pRequest, __in BOOLEAN Cancelable, __in_opt PFN_WDF_REQUEST_CANCEL EvtRequestCancel, __in BOOLEAN FailIfIrpIsCancelled)
Definition: fxioqueue.cpp:2093
volatile LONG m_TwoPhaseCompletions
Definition: fxioqueue.hpp:481
FxCallbackMutexLock m_CallbackMutexLock
Definition: fxioqueue.hpp:521
FxIoQueueIoDeviceControl m_IoDeviceControl
Definition: fxioqueue.hpp:492
LIST_ENTRY m_DriverOwned
Definition: fxioqueue.hpp:397
_Must_inspect_result_ NTSTATUS QueueRequest(__in FxRequest *pRequest)
Definition: fxioqueue.cpp:2245
WDF_EXECUTION_LEVEL m_ExecutionLevel
Definition: fxioqueue.hpp:514
_Must_inspect_result_ NTSTATUS QueueRequestFromForward(__in FxRequest *pRequest)
Definition: fxioqueue.cpp:2351
FxIoQueueIoState m_PurgeComplete
Definition: fxioqueue.hpp:504
static EVT_SYSTEMWORKITEM _DeferredDispatchThreadThunk
Definition: fxioqueue.hpp:1687
volatile LONG m_DriverIoCount
Definition: fxioqueue.hpp:475
__in_opt FxRequest * NewRequest
Definition: fxioqueue.hpp:1000
FxIoQueueIoCanceledOnQueue m_IoCanceledOnQueue
Definition: fxioqueue.hpp:494
FX_DECLARE_VF_FUNCTION_P1_EX(, SHORT, 0, VerifyForwardRequestUpdateFlags, _In_ FxRequest *)
VOID GetRequestCount(__out_opt PULONG pQueuedRequests, __out_opt PULONG pDriverPendingRequests)
Definition: fxioqueue.cpp:4227
volatile BOOLEAN m_Disposing
Definition: fxioqueue.hpp:296
volatile ULONG m_Dispatching
Definition: fxioqueue.hpp:435
_Must_inspect_result_ BOOLEAN CanThreadDispatchEventsLocked(__in KIRQL PreviousIrql)
Definition: fxioqueue.cpp:2633
_Must_inspect_result_ NTSTATUS ReadyNotify(__in PFN_WDF_IO_QUEUE_STATE QueueReady, __in_opt WDFCONTEXT Context)
Definition: fxioqueue.cpp:3455
FX_DECLARE_VF_FUNCTION_P2(NTSTATUS, VerifyRequestCancelable, _In_ FxRequest *, _In_ BOOLEAN)
__inline VOID SetCxDeviceInfo(__in FxCxDeviceInfo *CxDeviceInfo)
Definition: fxioqueue.hpp:1351
_Must_inspect_result_ NTSTATUS QueueIdleSynchronously(__in BOOLEAN CancelRequests)
Definition: fxioqueue.cpp:3838
__inline VOID SetTransitionFromEmpty(VOID)
Definition: fxioqueue.hpp:1559
_Must_inspect_result_ NTSTATUS GetReservedRequest(__in MdIrp Irp, __deref_out_opt FxRequest **ReservedRequest)
BOOLEAN IsIoEventHandlerRegistered(__in WDF_REQUEST_TYPE RequestType)
Definition: fxioqueue.cpp:6178
static EVT_IRP_QUEUE_CANCEL _IrpCancelForDriver
Definition: fxioqueue.hpp:1683
__inline VOID RequestCompletedCallback(__in FxRequest *Request)
Definition: fxioqueue.hpp:654
__inline VOID PreRequestCompletedCallback(__in FxRequest *Request)
Definition: fxioqueue.hpp:692
__inline VOID PostRemoveFromDriverOwnedList(VOID)
Definition: fxioqueue.hpp:1522
FxIrpQueue m_DriverCancelable
Definition: fxioqueue.hpp:372
VOID ReturnReservedRequest(__in FxRequest *ReservedRequest)
VOID FlushByFileObject(__in MdFileObject FileObject)
Definition: fxioqueue.cpp:4256
FxIoQueueIoInternalDeviceControl m_IoInternalDeviceControl
Definition: fxioqueue.hpp:493
volatile BOOLEAN m_ForceTransitionFromEmptyWhenAddingNewRequest
Definition: fxioqueue.hpp:452
_Must_inspect_result_ NTSTATUS AssignForwardProgressPolicy(__in PWDF_IO_QUEUE_FORWARD_PROGRESS_POLICY Policy)
friend VOID GetTriageInfo(VOID)
FxIoQueueIoStop m_IoStop
Definition: fxioqueue.hpp:488
BOOLEAN m_Configured
Definition: fxioqueue.hpp:252
__inline CfxDevice * GetDevice(VOID)
Definition: fxioqueue.hpp:773
__drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN ProcessCancelledRequests(__out PKIRQL PreviousIrql)
WDF_IO_QUEUE_DISPATCH_TYPE m_Type
Definition: fxioqueue.hpp:308
VOID DeferredDispatchRequestsFromDpc(VOID)
Definition: fxioqueue.cpp:2475
FX_DECLARE_VF_FUNCTION_P2(NTSTATUS, VerifyForwardRequestToParent, _In_ FxIoQueue *, _In_ FxRequest *)
__inline BOOLEAN IsPowerManaged()
Definition: fxioqueue.hpp:795
LIST_ENTRY m_PowerNotify
Definition: fxioqueue.hpp:405
VOID PutBackReservedRequest(__in FxRequest *ReservedRequest)
Definition: fxioqueue.hpp:1624
__inline VOID CheckTransitionFromEmpty(VOID)
Definition: fxioqueue.hpp:1541
BOOLEAN m_SupportForwardProgress
Definition: fxioqueue.hpp:246
FX_IO_QUEUE_STATE m_QueueState
Definition: fxioqueue.hpp:318
FxCallbackLock * m_IoCancelCallbackLockPtr
Definition: fxioqueue.hpp:496
FxCxDeviceInfo * m_CxDeviceInfo
Definition: fxioqueue.hpp:425
NTSTATUS InsertNewRequestLocked(__deref_in FxRequest **Request, __in KIRQL PreviousIrql)
Definition: fxioqueue.cpp:2571
__inline BOOLEAN IsState(__in FX_IO_QUEUE_STATE State)
Definition: fxioqueue.hpp:853
ULONG m_MaxParallelQueuePresentedRequests
Definition: fxioqueue.hpp:313
VOID CancelIrps(__in PLIST_ENTRY IrpListHead)
Definition: fxioqueue.cpp:6436
__in __drv_restoresIRQL KIRQL PreviousIrql
Definition: fxioqueue.hpp:631
_Must_inspect_result_ NTSTATUS GetRequest(__in_opt MdFileObject FileObject, __in_opt FxRequest *TagRequest, __deref_out FxRequest **pOutRequest)
Definition: fxioqueue.cpp:962
MxEvent m_FinishDisposing
Definition: fxioqueue.hpp:297
_Releases_lock_(this->m_SpinLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN DispatchEvents(__in __drv_restoresIRQL KIRQL PreviousIrql
_Must_inspect_result_ NTSTATUS PeekRequest(__in_opt FxRequest *TagRequest, __in_opt MdFileObject FileObject, __out_opt PWDF_REQUEST_PARAMETERS Parameters, __deref_out FxRequest **pOutRequest)
Definition: fxioqueue.cpp:1197
FxIoQueueIoState m_ReadyNotify
Definition: fxioqueue.hpp:507
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
Definition: fxioqueue.hpp:1078
_Must_inspect_result_ MdIrp GetForwardProgressIrpLocked(__in_opt PFILE_OBJECT FileObject)
Definition: fxioqueueum.hpp:60
VOID CancelForDriver(__in FxRequest *pRequest)
Definition: fxioqueue.cpp:4535
FxIrpQueue m_Queue
Definition: fxioqueue.hpp:366
WDFCONTEXT m_PurgeCompleteContext
Definition: fxioqueue.hpp:505
VOID StartPowerTransitionOff(VOID)
Definition: fxioqueue.cpp:5780
BOOLEAN m_WorkItemQueued
Definition: fxioqueue.hpp:563
VOID FreeAllReservedRequests(__in BOOLEAN Verify)
Definition: fxioqueueum.hpp:81
SINGLE_LIST_ENTRY m_PowerSListEntry
Definition: fxioqueue.hpp:591
_Releases_lock_(this->m_SpinLock.m_Lock) VOID CancelForQueue(__in FxRequest *pRequest
VOID SetStateForShutdown(VOID)
Definition: fxioqueue.cpp:6101
_Must_inspect_result_ NTSTATUS QueuePurge(__in BOOLEAN CancelQueueRequests, __in BOOLEAN CancelDriverRequests, __in_opt PFN_WDF_IO_QUEUE_STATE PurgeComplete, __in_opt WDFCONTEXT Context)
Definition: fxioqueue.cpp:3894
virtual VOID GetConstraints(__out WDF_EXECUTION_LEVEL *ExecutionLevel, __out WDF_SYNCHRONIZATION_SCOPE *SynchronizationScope)
Definition: fxioqueue.hpp:1048
_Must_inspect_result_ NTSTATUS QueuePurgeSynchronously(VOID)
Definition: fxioqueue.cpp:4107
FxIoQueueIoState m_IdleComplete
Definition: fxioqueue.hpp:501
__inline BOOLEAN IsPowerStateNotifyingDriver(VOID)
Definition: fxioqueue.hpp:1429
_Must_inspect_result_ NTSTATUS RequestCompleteEvent(__in FxRequest *Request)
_Must_inspect_result_ NTSTATUS QueueForwardProgressIrpLocked(__in MdIrp Irp)
Definition: fxioqueueum.hpp:46
_Must_inspect_result_ NTSTATUS AllocateReservedRequest(__deref_out FxRequest **Request)
Definition: fxioqueue.cpp:6359
__drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN ProcessCancelledRequestsOnQueue(__out PKIRQL PreviousIrql)
WDFQUEUE __inline GetHandle(VOID)
Definition: fxioqueue.hpp:786
VOID ResetStateForRestart(VOID)
Definition: fxioqueue.cpp:6130
__drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN ProcessPowerEvents(__out PKIRQL PreviousIrql)
__inline VOID SetPowerState(__in FXIOQUEUE_POWER_STATE PowerState)
Definition: fxioqueue.hpp:1246
BOOLEAN m_DpcQueued
Definition: fxioqueue.hpp:562
__drv_requiresIRQL(DISPATCH_LEVEL) VOID ProcessPurgeComplete(__out PKIRQL PreviousIrql)
FX_DECLARE_VF_FUNCTION_P1(NTSTATUS, VerifyGetRequestUpdateFlags, _In_ FxRequest *)
VOID PurgeForwardProgressIrps(__in_opt MdFileObject FileObject)
Definition: fxioqueue.cpp:6467
LIST_ENTRY m_PowerDriverNotified
Definition: fxioqueue.hpp:414
FxIoQueueIoWrite m_IoWrite
Definition: fxioqueue.hpp:491
BOOLEAN m_AllowZeroLengthRequests
Definition: fxioqueue.hpp:273
__inline NTSTATUS InsertNewRequest(__in FxRequest **Request, __in KIRQL PreviousIrql)
Definition: fxioqueue.hpp:1584
static MdDeferredRoutineType _DeferredDispatchDpcThunk
Definition: fxioqueue.hpp:1691
_Must_inspect_result_ NTSTATUS QueueDriverCreatedRequest(__in FxRequest *Request, __in BOOLEAN ParentQueue)
Definition: fxioqueue.cpp:1791
FX_DECLARE_VF_FUNCTION_P2(NTSTATUS, VerifyForwardRequest, _In_ FxIoQueue *, _In_ FxRequest *)
FX_DECLARE_VF_FUNCTION_P1(VOID, VerifyGetRequestRestoreFlags, _In_ FxRequest *)
VOID FlushQueuedDpcs(VOID)
_Must_inspect_result_ NTSTATUS ConfigureConstraints(__in_opt PWDF_OBJECT_ATTRIBUTES ObjectAttributes, __in_opt FxDriver *Caller)
Definition: fxioqueue.cpp:571
VOID ResumeProcessingForPower(VOID)
Definition: fxioqueue.cpp:6046
LIST_ENTRY m_CanceledOnQueueList
Definition: fxioqueue.hpp:387
FX_DECLARE_VF_FUNCTION_P2(NTSTATUS, VerifyQueueDriverCreatedRequest, _In_ FxRequest *, _Inout_ SHORT *)
FxIoQueueIoResume m_IoResume
Definition: fxioqueue.hpp:489
KDPC m_Dpc
Definition: fxioqueue.hpp:554
VOID GetForwardProgressIrps(__in PLIST_ENTRY IrpListHead, __in_opt MdFileObject FileObject)
_Must_inspect_result_ NTSTATUS QueueDrain(__in_opt PFN_WDF_IO_QUEUE_STATE DrainComplete, __in_opt WDFCONTEXT Context)
Definition: fxioqueue.cpp:4158
volatile BOOLEAN m_TransitionFromEmpty
Definition: fxioqueue.hpp:442
__drv_requiresIRQL(DISPATCH_LEVEL) VOID ProcessAcknowledgedRequests(__in FxRequest *Request
WDFCONTEXT m_IdleCompleteContext
Definition: fxioqueue.hpp:502
volatile BOOLEAN m_Deleted
Definition: fxioqueue.hpp:288
VOID InsertQueueDpc(VOID)
FXIOQUEUE_POWER_STATE m_PowerState
Definition: fxioqueue.hpp:302
FxCallbackLock * m_CallbackLockPtr
Definition: fxioqueue.hpp:528
virtual FxCallbackLock * GetCallbackLockPtr(__deref_out FxObject **LockObject)
Definition: fxioqueue.hpp:1064
volatile BOOLEAN m_PowerReferenced
Definition: fxioqueue.hpp:267
FxPkgIo * m_PkgIo
Definition: fxioqueue.hpp:420
__inline NTSTATUS InvokeAllocateResourcesCallback(__in FxRequest *Request)
Definition: fxioqueue.hpp:1273
LIST_ENTRY m_Cancelled
Definition: fxioqueue.hpp:379
VOID StopProcessingForPower(__in FxIoStopProcessingForPowerAction Action)
Definition: fxioqueue.cpp:5841
virtual BOOLEAN Dispose(VOID)
Definition: fxioqueue.cpp:448
_Must_inspect_result_ NTSTATUS ForwardRequestWorker(__in FxRequest *Request, __in FxIoQueue *DestQueue)
Definition: fxioqueue.cpp:1354
__drv_requiresIRQL(DISPATCH_LEVEL) VOID ProcessIdleComplete(__out PKIRQL PreviousIrql)
FxIoQueueIoRead m_IoRead
Definition: fxioqueue.hpp:490
VOID SetState(__in FX_IO_QUEUE_SET_STATE NewStatus)
Definition: fxioqueue.cpp:805
VOID StartPowerTransitionOn(VOID)
Definition: fxioqueue.cpp:6001
VOID DeferredDispatchRequestsFromWorkerThread(VOID)
Definition: fxioqueue.cpp:2520
VOID DispatchRequestToDriver(__in FxRequest *pRequest)
Definition: fxioqueue.cpp:3110
static EVT_IRP_QUEUE_CANCEL _IrpCancelForQueue
Definition: fxioqueue.hpp:1674
static EVT_WDF_IO_QUEUE_STATE _PurgeComplete
Definition: fxioqueue.hpp:1695
LONG GetRequestCount()
Definition: fxirpqueue.hpp:193
MxLock m_SpinLock
Definition: fxobject.hpp:296
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
CfxDevice * m_Device
Definition: fxobject.hpp:329
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
Definition: fxobject.hpp:1474
VOID MarkNoDeleteDDI(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1118
static PVOID __inline _ToHandle(__in FxObject *Object)
Definition: fxobject.hpp:659
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
Definition: fxobject.cpp:255
FxDriver * GetDriver(VOID)
Definition: fxpkgio.cpp:543
_Must_inspect_result_ NTSTATUS __inline PowerReference(__in BOOLEAN WaitForD0, __in_opt PVOID Tag=NULL, __in_opt LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxpkgpnp.hpp:3486
MdLock m_Lock
Definition: mxlock.h:40
#define _Releases_lock_(lock)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
_In_ PIRP Irp
Definition: csq.h:116
#define __out_opt
Definition: dbghelp.h:65
#define __in
Definition: dbghelp.h:35
#define __deref_out
Definition: dbghelp.h:26
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define __deref_out_opt
Definition: dbghelp.h:29
#define TRACINGIO
Definition: dbgtrace.h:66
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
@ Verify
Definition: msg.c:1065
KIRQL irql
Definition: wave.h:1
#define __drv_restoresIRQL
Definition: driverspecs.h:322
#define __drv_requiresIRQL(irql)
Definition: driverspecs.h:321
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
UCHAR KIRQL
Definition: env_spec_w32.h:591
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
return pObject GetObjectHandle()
DeviceInit Pdo ForwardRequestToParent
FxRequest * pRequest
DriverGlobals
_Must_inspect_result_ NTSTATUS _In_ FxRequest * TagRequest
Definition: fxioqueue.cpp:885
_Must_inspect_result_ NTSTATUS _In_ FxIoQueue * DestQueue
Definition: fxioqueue.cpp:1476
_Must_inspect_result_ NTSTATUS _In_ FxIoQueue * pDestQueue
Definition: fxioqueue.cpp:1667
_FX_IO_QUEUE_SET_STATE
Definition: fxioqueue.hpp:195
@ FxIoQueueClearShutdown
Definition: fxioqueue.hpp:201
@ FxIoQueueSetAcceptRequests
Definition: fxioqueue.hpp:196
@ FxIoQueueSetShutdown
Definition: fxioqueue.hpp:200
@ FxIoQueueClearDispatchRequests
Definition: fxioqueue.hpp:199
@ FxIoQueueSetDispatchRequests
Definition: fxioqueue.hpp:198
@ FxIoQueueClearAcceptRequests
Definition: fxioqueue.hpp:197
FxIoQueueNodeType
Definition: fxioqueue.hpp:44
@ FxIoQueueNodeTypeLast
Definition: fxioqueue.hpp:48
@ FxIoQueueNodeTypeInvalid
Definition: fxioqueue.hpp:45
@ FxIoQueueNodeTypeQueue
Definition: fxioqueue.hpp:46
@ FxIoQueueNodeTypeBookmark
Definition: fxioqueue.hpp:47
_FX_IO_QUEUE_STATE
Definition: fxioqueue.hpp:208
@ FxIoQueueShutdown
Definition: fxioqueue.hpp:229
@ FxIoQueueDispatchRequests
Definition: fxioqueue.hpp:213
@ FxIoQueueAcceptRequests
Definition: fxioqueue.hpp:212
@ FxIoQueuePnpHeld
Definition: fxioqueue.hpp:216
@ FxIoQueueNoRequests
Definition: fxioqueue.hpp:214
@ FxIoQueueDriverNoRequests
Definition: fxioqueue.hpp:215
struct _FXIO_FORWARD_PROGRESS_CONTEXT * PFXIO_FORWARD_PROGRESS_CONTEXT
FxIoQueuePowerState
Definition: fxioqueue.hpp:130
@ FxIoQueuePowerStartingTransition
Definition: fxioqueue.hpp:134
@ FxIoQueuePowerPurgeDriverNotified
Definition: fxioqueue.hpp:140
@ FxIoQueuePowerRestarting
Definition: fxioqueue.hpp:141
@ FxIoQueuePowerStoppingDriverNotified
Definition: fxioqueue.hpp:137
@ FxIoQueuePowerRestartingNotifyingDriver
Definition: fxioqueue.hpp:142
@ FxIoQueuePowerInvalid
Definition: fxioqueue.hpp:131
@ FxIoQueuePowerStopping
Definition: fxioqueue.hpp:135
@ FxIoQueuePowerStoppingNotifyingDriver
Definition: fxioqueue.hpp:136
@ FxIoQueuePowerLast
Definition: fxioqueue.hpp:144
@ FxIoQueuePowerPurgeNotifyingDriver
Definition: fxioqueue.hpp:139
@ FxIoQueuePowerOn
Definition: fxioqueue.hpp:132
@ FxIoQueuePowerPurge
Definition: fxioqueue.hpp:138
@ FxIoQueuePowerOff
Definition: fxioqueue.hpp:133
@ FxIoQueuePowerRestartingDriverNotified
Definition: fxioqueue.hpp:143
enum FxIoQueuePowerState FXIOQUEUE_POWER_STATE
enum _FX_IO_QUEUE_STATE FX_IO_QUEUE_STATE
enum _FX_IO_QUEUE_SET_STATE FX_IO_QUEUE_SET_STATE
struct _FXIO_FORWARD_PROGRESS_CONTEXT FXIO_FORWARD_PROGRESS_CONTEXT
pQueue QueueStart()
return pTarget GetState()
#define FX_DECLARE_VF_FUNCTION_P1(rt, fnName, at1)
Definition: fxmacros.hpp:94
@ ObjectLock
Definition: fxobject.hpp:129
FxIoStopProcessingForPowerAction
@ FxListEntryDriverOwned
Definition: fxrequest.hpp:378
@ FxListEntryForwardProgress
Definition: fxrequest.hpp:381
@ FX_TYPE_QUEUE
Definition: fxtypes.h:48
@ FX_TYPE_IHASCALLBACKS
Definition: fxtypes.h:114
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
#define _Inout_
Definition: ms_sal.h:378
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _In_
Definition: ms_sal.h:308
PFILE_OBJECT MdFileObject
Definition: mxgeneralkm.h:32
KDEFERRED_ROUTINE MdDeferredRoutineType
Definition: mxkm.h:35
IWudfIrp * MdIrp
Definition: mxum.h:103
WUDF_DRIVER_CANCEL MdCancelRoutineType
Definition: mxum.h:143
#define DECLSPEC_NORETURN
Definition: ntbasedef.h:176
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
#define STATUS_SUCCESS
Definition: shellext.h:65
#define __deref_in
Definition: specstrings.h:137
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
base of all file and directory entries
Definition: entries.h:83
LIST_ENTRY m_ListEntry
Definition: fxioqueue.hpp:56
FxIoQueueNode(const FxIoQueueNode &)
static BOOLEAN _IsValidNodeType(__in FxIoQueueNodeType NodeType)
Definition: fxioqueue.hpp:107
FxIoQueueNodeType m_Type
Definition: fxioqueue.hpp:57
static FxIoQueueNode * _FromListEntry(__in PLIST_ENTRY Entry)
Definition: fxioqueue.hpp:98
FxIoQueueNode(FxIoQueueNodeType NodeType)
Definition: fxioqueue.hpp:63
__inline BOOLEAN IsNodeType(__in FxIoQueueNodeType NodeType)
Definition: fxioqueue.hpp:117
FxIoQueueNode & operator=(const FxIoQueueNode &)
WDF_IO_FORWARD_PROGRESS_RESERVED_POLICY m_Policy
Definition: fxioqueue.hpp:168
FxIoQueueForwardProgressAllocateResourcesReserved m_IoReservedResourcesAllocate
Definition: fxioqueue.hpp:156
FxIoQueueForwardProgressAllocateResources m_IoResourcesAllocate
Definition: fxioqueue.hpp:160
FxIoQueueForwardProgressExamineIrp m_IoExamineIrp
Definition: fxioqueue.hpp:164
Definition: ketypes.h:699
Definition: typedefs.h:120
Definition: ntbasedef.h:628
Definition: ps.c:97
#define LockObject(Object)
Definition: titypes.h:34
#define GetHandle(h)
Definition: treelist.c:116
uint32_t * PULONG
Definition: typedefs.h:59
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
Definition: wdfchildlist.h:476
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
enum _WDF_REQUEST_TYPE WDF_REQUEST_TYPE
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFQUEUE _In_ _Strict_type_match_ WDF_REQUEST_TYPE RequestType
Definition: wdfdevice.h:4233
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3034
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY Policy
Definition: wdfinterrupt.h:653
EVT_WDF_IO_QUEUE_STATE * PFN_WDF_IO_QUEUE_STATE
Definition: wdfio.h:380
_In_ WDFQUEUE _In_opt_ PFN_WDF_IO_QUEUE_STATE PurgeComplete
Definition: wdfio.h:1030
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_IO_QUEUE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES QueueAttributes
Definition: wdfio.h:617
@ WdfIoQueueDriverNoRequests
Definition: wdfio.h:128
@ WdfIoQueueAcceptRequests
Definition: wdfio.h:125
@ WdfIoQueueDispatchRequests
Definition: wdfio.h:126
@ WdfIoQueueNoRequests
Definition: wdfio.h:127
@ WdfIoQueuePnpHeld
Definition: wdfio.h:129
WDF_EXTERN_C_START enum _WDF_IO_QUEUE_DISPATCH_TYPE WDF_IO_QUEUE_DISPATCH_TYPE
enum _WDF_IO_FORWARD_PROGRESS_RESERVED_POLICY WDF_IO_FORWARD_PROGRESS_RESERVED_POLICY
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ PFN_WDF_IO_QUEUE_STATE QueueReady
Definition: wdfio.h:1067
enum _WDF_IO_QUEUE_STATE WDF_IO_QUEUE_STATE
_In_ WDFQUEUE _In_opt_ PFN_WDF_IO_QUEUE_STATE DrainComplete
Definition: wdfio.h:968
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
WDF_EXTERN_C_START enum _WDF_EXECUTION_LEVEL WDF_EXECUTION_LEVEL
enum _WDF_SYNCHRONIZATION_SCOPE WDF_SYNCHRONIZATION_SCOPE
_Must_inspect_result_ _In_ WDFREQUEST _In_ WDFQUEUE _In_ PWDF_REQUEST_FORWARD_OPTIONS ForwardOptions
Definition: wdfrequest.h:1736
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308
_In_ WDFREQUEST _In_ BOOLEAN Requeue
Definition: wdfrequest.h:1654
EVT_WDF_REQUEST_CANCEL * PFN_WDF_REQUEST_CANCEL
Definition: wdfrequest.h:130
_In_ WDFREQUEST _In_ PFN_WDF_REQUEST_CANCEL EvtRequestCancel
Definition: wdfrequest.h:730
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
_In_ BOOLEAN Cancelable
Definition: iofuncs.h:1258
* PFILE_OBJECT
Definition: iotypes.h:1998
static void Initialize()
Definition: xlate.c:212