ReactOS  0.4.15-dev-2945-g7100a24
fxdmatransactionapi.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxDmaTransactionAPI.cpp
8 
9 Abstract:
10 
11  Base for WDF DMA Transaction APIs
12 
13 Environment:
14 
15  Kernel mode only.
16 
17 Notes:
18 
19 
20 Revision History:
21 
22 --*/
23 
24 #include "fxdmapch.hpp"
25 
26 extern "C" {
27 // #include "FxDmaTransactionAPI.tmh"
28 }
29 
30 //
31 // Extern "C" the entire file
32 //
33 extern "C" {
34 
38 WDFEXPORT(WdfDmaTransactionCreate)(
39  __in
41  __in
42  WDFDMAENABLER DmaEnabler,
43  __in_opt
45  __out
46  WDFDMATRANSACTION * DmaTransactionHandle
47  )
48 {
52 
54  DmaEnabler,
56  (PVOID *) &pDmaEnabler,
58 
60 
62 
64  Attributes,
66  );
67  if (!NT_SUCCESS(status)) {
68  return status;
69  }
70 
71  switch (pDmaEnabler->GetProfile())
72  {
76  Attributes,
79  break;
80 
87  Attributes,
90  );
91  break;
92 
96  Attributes,
99  break;
100 
101  default:
102  NT_ASSERTMSG("Unknown profile for DMA enabler", FALSE);
104  break;
105  }
106 
107  return status;
108 }
109 
112 NTSTATUS
113 WDFEXPORT(WdfDmaTransactionInitializeUsingRequest)(
114  __in
116  __in
117  WDFDMATRANSACTION DmaTransaction,
118  __in
119  WDFREQUEST Request,
120  __in
122  __in
124  )
125 {
133 
137  (PVOID *) &pDmaTrans,
139 
141 
147  "Initialization of WDFDMATRANSACTION 0x%p using WDFREQUEST %p, "
148  "DmaDirection 0x%x is an invalid value, %!STATUS!",
150  return status;
151  }
152 
154  Request,
156  (PVOID *) &pReqObj);
157 
158  reqLength = 0;
159 
161 
162  //
163  // Get the MDL and Length from the request.
164  //
165  switch (stack->MajorFunction) {
166 
167  case IRP_MJ_READ:
168 
171 
173  "Dma direction %!WDF_DMA_DIRECTION! of WDFTRANSACTION "
174  "0x%p doesn't match with the WDFREQUEST 0x%p type "
175  "%!WDF_REQUEST_TYPE! %!STATUS!",
177  stack->MajorFunction, status);
178 
179  return status;
180  }
181 
182  reqLength = stack->Parameters.Read.Length;
183 
184  status = pReqObj->GetMdl(&mdl);
185  break;
186 
187  case IRP_MJ_WRITE:
188 
191 
193  "Dma direction %!WDF_DMA_DIRECTION! of WDFTRANSACTION "
194  "0x%p doesn't match with the WDFREQUEST 0x%p type "
195  "%!WDF_REQUEST_TYPE! %!STATUS!",
197  stack->MajorFunction, status);
198 
199  return status;
200  }
201 
202  reqLength = stack->Parameters.Write.Length;
203 
204  status = pReqObj->GetMdl(&mdl);
205  break;
206 
209 
210  switch (METHOD_FROM_CTL_CODE(stack->Parameters.DeviceIoControl.IoControlCode)) {
211  case METHOD_BUFFERED:
212 
214  reqLength = stack->Parameters.DeviceIoControl.InputBufferLength;
215  } else {
216  reqLength = stack->Parameters.DeviceIoControl.OutputBufferLength;
217  }
218 
219  //
220  // In this case both input buffer and output buffer map
221  // to the same MDL and it's probed for read & write access.
222  // So it's okay for DMA transfer in either direction.
223  //
224  status = pReqObj->GetMdl(&mdl);
225  break;
226 
227  case METHOD_IN_DIRECT:
228  //
229  // For this type, the output buffer is probed for read access.
230  // So the direction of DMA transfer is WdfDmaDirectionWriteToDevice.
231  //
233 
235 
238  "Dma direction %!WDF_DMA_DIRECTION! of WDFTRANSACTION "
239  "0x%p doesn't match with WDFREQUEST 0x%p ioctl type "
240  "METHOD_IN_DIRECT %!STATUS!",
242  return status;
243  }
244 
245  reqLength = stack->Parameters.DeviceIoControl.OutputBufferLength;
246 
248 
249  break;
250 
251  case METHOD_OUT_DIRECT:
252  //
253  // For this type, the output buffer is probed for write access.
254  // So the direction of DMA transfer is WdfDmaDirectionReadFromDevice.
255  //
257 
259 
262  "Dma direction %!WDF_DMA_DIRECTION! of WDFTRANSACTION "
263  "0x%p doesn't match with WDFREQUEST 0x%p ioctl type "
264  "METHOD_OUT_DIRECT %!STATUS!",
266 
267  return status;
268  }
269 
270  reqLength = stack->Parameters.DeviceIoControl.OutputBufferLength;
271 
273 
274  break;
275  default:
276 
278 
280  "Invalid ioctl code in WDFREQUEST 0x%p %!STATUS!",
281  Request, status);
282 
284  break;
285 
286  }// End of switch(ioctType)
287  break;
288 
289  default:
291  break;
292 
293  }
294 
295  if (!NT_SUCCESS(status)) {
297  "Couldn't retrieve mdl from WDFREQUEST 0x%p for "
298  "WDFTRANSACTION 0x%p %!STATUS!",
300  return status;
301  }
302 
303  if (reqLength == 0) {
307  "Zero length request, %!STATUS!", status);
308  return status;
309  }
310 
311  //
312  // If the DMA enabler is packet based, make sure the virtual address and
313  // the length of transfer are within bounds. Basically, we are checking
314  // to see if the length of data to be transferred doesn't span multiple
315  // MDLs, because packet based DMA doesn't support chained MDLs.
316  //
318  ULONG length;
319 
321 
322  if (reqLength > length) {
326  "WDFREQUEST %p transfer length (%d) is out of bounds of MDL "
327  "Byte count (%d), %!STATUS!",
329 
330  return status;
331  }
332  }
333 
334  //
335  // Parms appear OK, so initialize this instance.
336  //
338  DmaDirection,
339  mdl,
340  0,
341  reqLength);
342 
343  if (!NT_SUCCESS(status)) {
345  "WDFTANSACTION 0x%p initialization failed: "
346  "%!STATUS!", DmaTransaction, status);
347  return status;
348  }
349 
350  //
351  // Set this Request in the new DmaTransaction. The request will
352  // take a reference on this request when it starts executing.
353  //
355 
357 }
358 
359 
362 NTSTATUS
363 WDFEXPORT(WdfDmaTransactionInitializeUsingOffset)(
364  __in
366  __in
367  WDFDMATRANSACTION DmaTransaction,
368  __in
370  __in
372  __in
373  PMDL Mdl,
374  __in
375  size_t Offset,
376  __in
378  size_t Length
379  )
380 {
381  //
382  // Stub this out by calling the regular initialize method. Eventually
383  // the regular initialize method will call this instead.
384  //
385 
386  return WDFEXPORT(WdfDmaTransactionInitialize)(
390  DmaDirection,
391  Mdl,
393  Length
394  );
395 }
396 
399 NTSTATUS
400 WDFEXPORT(WdfDmaTransactionInitialize)(
401  __in
403  __in
404  WDFDMATRANSACTION DmaTransaction,
405  __in
407  __in
409  __in
410  PMDL Mdl,
411 
412  //__drv_when(DmaDirection == WdfDmaDirectionReadFromDevice, __out_bcount(Length))
413  //__drv_when(DmaDirection == WdfDmaDirectionWriteToDevice, __in_bcount(Length))
414  __in
416  __in
417  __drv_when(Length == 0, __drv_reportError(Length cannot be zero))
418  size_t Length
419  )
420 {
423  PUCHAR pVA;
424  ULONG mdlLength;
426 
430  (PVOID *) &pDmaTrans,
432 
435 
436  if (Length == 0) {
439  "Can't initialize WDFDMATRANSACTION 0x%p with "
440  "zero length transfer", DmaTransaction);
441  return status;
442  }
443 
449  "Initialization of WDFDMATRANSACTION 0x%p,DmaDirection 0x%x is an "
450  "invalid value, %!STATUS!", DmaTransaction, DmaDirection, status);
451  return status;
452  }
453 
454  //
455  // Make sure the VirtualAddress is within the first MDL bounds.
456  //
458  mdlLength = MmGetMdlByteCount(Mdl);
459 
460  if (VirtualAddress < pVA ||
461  VirtualAddress >= WDF_PTR_ADD_OFFSET(pVA, mdlLength)) {
465  "VirtualAddress %p is not within the Mdl bounds, StartVA (%p) + "
466  "ByteCount (0x%x), %!STATUS! ",
467  VirtualAddress, pVA, mdlLength, status);
468 
469  return status;
470  }
471 
472  //
473  // Get the DmaEnabler
474  //
478  (PVOID *) &pDmaTrans);
479 
481  //
482  // Make sure the MDL is not a chained MDL by checking
483  // to see if the virtual address and the length
484  // are within bounds.
485  //
487  WDF_PTR_ADD_OFFSET(pVA, mdlLength)) {
491  "VirtualAddress+Length (%p+%I64d) is out of bounds of MDL VA + MDL "
492  "Byte count (max address is %p). "
493  "Possibly a chained MDL, %!STATUS!",
495  WDF_PTR_ADD_OFFSET(pVA, mdlLength), status);
496 
497  return status;
498  }
499  }
500 
502  DmaDirection,
503  Mdl,
507  ),
508  (ULONG) Length);
509 
510  if (!NT_SUCCESS(status)) {
512  "WDFTANSACTION 0x%p initialization failed: "
513  "%!STATUS!", DmaTransaction, status);
514  }
515 
516  return status;
517 }
518 
519 
522 NTSTATUS
523 WDFEXPORT(WdfDmaTransactionExecute)(
524  __in
526  __in
527  WDFDMATRANSACTION DmaTransaction,
528  __in_opt
530  )
531 {
533 
537  (PVOID *) &pDmaTrans);
538 
539  return pDmaTrans->Execute(Context);
540 }
541 
544 NTSTATUS
545 WDFEXPORT(WdfDmaTransactionRelease)(
546  __in
548  __in
549  WDFDMATRANSACTION DmaTransaction
550  )
551 {
553 
557  (PVOID *) &pDmaTrans);
558 
559  //
560  // Release map registers allocated for this specific transaction,
561  // but not map registers which were allocated through
562  // AllocateResources.
563  //
565  return STATUS_SUCCESS;
566 }
567 
568 
570 BOOLEAN
571 WDFEXPORT(WdfDmaTransactionDmaCompleted)(
572  __in
574  __in
575  WDFDMATRANSACTION DmaTransaction,
576  __out
577  NTSTATUS * pStatus
578  )
579 {
581 
585  (PVOID *) &pDmaTrans);
586 
588 
589 
590  //
591  // Indicate this DMA has been completed.
592  //
594 }
595 
597 BOOLEAN
598 WDFEXPORT(WdfDmaTransactionDmaCompletedWithLength)(
599  __in
601  __in
602  WDFDMATRANSACTION DmaTransaction,
603  __in
604  size_t TransferredLength,
605  __out
606  NTSTATUS * pStatus
607  )
608 {
610 
614  (PVOID *) &pDmaTrans);
615 
617 
618  //
619  // Indicate this DMA transfer has been completed.
620  //
622  pStatus,
624 }
625 
627 BOOLEAN
628 WDFEXPORT(WdfDmaTransactionDmaCompletedFinal)(
629  __in
631  __in
632  WDFDMATRANSACTION DmaTransaction,
633  __in
634  size_t FinalTransferredLength,
635  __out
636  NTSTATUS * pStatus
637  )
638 {
640 
644  (PVOID *) &pDmaTrans);
645 
647 
648  //
649  // Indicate this DMA FinalLength has completed.
650  //
652  pStatus,
654 }
655 
656 
658 size_t
659 WDFEXPORT(WdfDmaTransactionGetBytesTransferred)(
660  __in
662  __in
663  WDFDMATRANSACTION DmaTransaction
664  )
665 {
667 
671  (PVOID *) &pDmaTrans);
672 
673  return pDmaTrans->GetBytesTransferred();
674 }
675 
677 VOID
678 WDFEXPORT(WdfDmaTransactionSetMaximumLength)(
679  __in
681  __in
682  WDFDMATRANSACTION DmaTransaction,
683  __in
684  size_t MaximumLength
685  )
686 {
688 
692  (PVOID *) &pDmaTrans);
693 
695 }
696 
698 WDFREQUEST
699 WDFEXPORT(WdfDmaTransactionGetRequest)(
700  __in
702  __in
703  WDFDMATRANSACTION DmaTransaction
704  )
705 {
708 
712  (PVOID *) &pDmaTrans);
713 
715 
716  if (pRequest != NULL) {
717  return pRequest->GetHandle();
718  }
719  else {
720  return NULL;
721  }
722 }
723 
725 size_t
726 WDFEXPORT(WdfDmaTransactionGetCurrentDmaTransferLength)(
727  __in
729  __in
730  WDFDMATRANSACTION DmaTransaction
731  )
732 {
734 
738  (PVOID *) &pDmaTrans);
739 
741 }
742 
743 
745 WDFDEVICE
746 WDFEXPORT(WdfDmaTransactionGetDevice)(
747  __in
749  __in
750  WDFDMATRANSACTION DmaTransaction
751  )
752 {
754 
758  (PVOID *) &pDmaTrans);
759 
761 }
762 
764 VOID
765 WDFEXPORT(WdfDmaTransactionSetChannelConfigurationCallback)(
766  __in
768  __in
769  WDFDMATRANSACTION DmaTransaction,
770  __in_opt
772  __in_opt
774  )
775 {
778 
782  (PVOID *) &pDmaTrans,
784 
785  //
786  // Verify that the transaction belongs to a system profile enabler.
787  //
788 
793  "Cannot call %!FUNC! on non-system-profile "
794  "WDFDMATRANSACTION (%p) (transaction profile "
795  "is %!WDF_DMA_PROFILE!).",
797  profile);
799  return;
800  }
801 
802  //
803  // Cast the transaction to the right sub-type now that we've verified the
804  // profile.
805  //
806 
810 }
811 
813 VOID
814 WDFEXPORT(WdfDmaTransactionSetTransferCompleteCallback)(
815  __in
817  __in
818  WDFDMATRANSACTION DmaTransaction,
819  __in_opt
821  __in_opt
823  )
824 {
827 
831  (PVOID *) &pDmaTrans,
833 
834  //
835  // Verify that the transaction belongs to a system profile enabler.
836  //
837 
839  if ((profile != WdfDmaProfileSystem) &&
842  "Cannot call %!FUNC! on non-system-profile "
843  "WDFDMATRANSACTION (%p) (transaction profile "
844  "is %!WDF_DMA_PROFILE!).",
846  profile);
848  return;
849  }
850 
851  //
852  // Cast the transaction to the right sub-type now that we've verified the
853  // profile.
854  //
855 
859 
860 }
861 
863 VOID
864 WDFEXPORT(WdfDmaTransactionSetDeviceAddressOffset)(
865  __in
867  __in
868  WDFDMATRANSACTION DmaTransaction,
869  __in
870  ULONG Offset
871  )
872 {
875 
879  (PVOID *) &pDmaTrans,
881 
882  //
883  // Verify that the transaction belongs to a system profile enabler.
884  //
885 
887  if ((profile != WdfDmaProfileSystem) &&
890  "Cannot call %!FUNC! on non-system-profile "
891  "WDFDMATRANSACTION (%p) (transaction profile "
892  "is %!WDF_DMA_PROFILE!).",
894  profile);
896  return;
897  }
898 
899  //
900  // Cast the transaction to the right sub-type now that we've verified the
901  // profile.
902  //
903 
906 }
907 
909 PVOID
910 WDFEXPORT(WdfDmaTransactionWdmGetTransferContext)(
911  __in
913  __in
914  WDFDMATRANSACTION DmaTransaction
915  )
916 {
919 
923  (PVOID *) &pDmaTrans,
925 
928  "Cannot call %!FUNC! for WDFDMATRANSACTION %p "
929  "because the parent WDFDMAENABLER (%p) is not "
930  "configured to use DMA version 3.",
934  return NULL;
935  }
936 
938 
944  "Cannot call %!FUNC! on WDFDMATRANSACTION %p "
945  "becuase it is uninitialized, reused, deleted "
946  "(state is %!FxDmaTransactionState!).",
948  state
949  );
951  return NULL;
952  }
953 
954  return pDmaTrans->GetTransferContext();
955 }
956 
958 VOID
959 WDFEXPORT(WdfDmaTransactionGetTransferInfo)(
960  __in
962  __in
963  WDFDMATRANSACTION DmaTransaction,
964  __out_opt
966  __out_opt
968  )
969 {
972 
976  (PVOID *) &pDmaTrans,
978 
980 }
981 
982 //
983 // Stubbed WDF 1.11 DMA DDIs start here.
984 //
985 
987 VOID
988 WDFEXPORT(WdfDmaTransactionSetImmediateExecution)(
989  __in
991  __in
992  WDFDMATRANSACTION DmaTransaction,
993  __in
995  )
996 {
999 
1003  (PVOID *) &pDmaTrans,
1004  &pFxDriverGlobals);
1005 
1006  if (pDmaTrans->GetDmaEnabler()->UsesDmaV3() == FALSE)
1007  {
1009  "Cannot call %!FUNC! for WDFDMATRANSACTION %p "
1010  "because the parent WDFDMAENABLER (%p) is not "
1011  "configured to use DMA version 3.",
1015  return;
1016  }
1017 
1019 }
1020 
1022 NTSTATUS
1023 WDFEXPORT(WdfDmaTransactionAllocateResources)(
1024  __in
1026  __in
1027  WDFDMATRANSACTION DmaTransaction,
1028  __in
1030  __in
1032  __in
1034  __in
1036  )
1040 
1041  NTSTATUS status;
1042 
1046  (PVOID *) &pDmaTrans,
1047  &pFxDriverGlobals);
1048 
1049  //
1050  // Only valid if DMA V3 is enabled.
1051  //
1052 
1053  if (pDmaTrans->GetDmaEnabler()->UsesDmaV3() == FALSE)
1054  {
1056 
1058  "Cannot call %!FUNC! on WDFDMATRANSACTION %p "
1059  "because WDFDMAENABLER %p was not configured "
1060  "for DMA version 3 - %!STATUS!.",
1063  status);
1065  return status;
1066  }
1067 
1068  //
1069  // Only valid for packet or system profile transactions.
1070  //
1076 
1078 
1080  "Cannot call %!FUNC! on non packet or system "
1081  "profile WDFDMATRANSACTION (%p) (transaction "
1082  "profile is %!WDF_DMA_PROFILE!) - %!STATUS!.",
1084  profile,
1085  status);
1087  return status;
1088  }
1089 
1090  //
1091  // Validate the direction value.
1092  //
1098  "Allocation of DMA adapter for WDFDMATRANSACTION 0x%p, "
1099  "DmaDirection 0x%x is an invalid value, %!STATUS!",
1102  return status;
1103  }
1104 
1106 
1107  status = pDmaTrans->ReserveAdapter(RequiredMapRegisters,
1108  DmaDirection,
1111 
1112  return status;
1113 }
1115 VOID
1116 WDFEXPORT(WdfDmaTransactionFreeResources)(
1117  __in
1119  __in
1120  WDFDMATRANSACTION DmaTransaction
1121  )
1122 {
1125 
1129  (PVOID *) &pDmaTrans,
1130  &pFxDriverGlobals);
1131 
1132  //
1133  // Only valid for packet or system profile transactions.
1134  //
1136  if ((profile != WdfDmaProfilePacket) &&
1141  "Cannot call %!FUNC! on non packet or system "
1142  "profile WDFDMATRANSACTION (%p) (transaction "
1143  "profile is %!WDF_DMA_PROFILE!).",
1145  profile);
1147  return;
1148  }
1149 
1150  //
1151  // Only valid if DMA V3 is enabled.
1152  //
1153 
1154  if (pDmaTrans->GetDmaEnabler()->UsesDmaV3() == FALSE)
1155  {
1157  "Cannot call %!FUNC! on WDFDMATRANSACTION %p "
1158  "because WDFDMAENABLER %p was not configured "
1159  "for DMA version 3",
1163  return;
1164  }
1165 
1166  pDmaTrans->ReleaseAdapter();
1167 
1168  return;
1169 }
1171 BOOLEAN
1172 WDFEXPORT(WdfDmaTransactionCancel)(
1173  __in
1175  __in
1176  WDFDMATRANSACTION DmaTransaction
1177  )
1178 {
1181 
1185  (PVOID *) &pDmaTrans,
1186  &pFxDriverGlobals);
1187 
1188  //
1189  // Only valid if the enabler uses DMA v3
1190  //
1191 
1192  if (pDmaTrans->GetDmaEnabler()->UsesDmaV3() == FALSE) {
1194  "Cannot call %!FUNC! WDFDMATRANSACTION (%p) "
1195  "because enabler is not using DMA version 3",
1196  DmaTransaction);
1198  return FALSE;
1199  }
1200 
1202 }
1203 
1205 VOID
1206 WDFEXPORT(WdfDmaTransactionStopSystemTransfer)(
1207  __in
1209  __in
1210  WDFDMATRANSACTION DmaTransaction
1211  )
1212 {
1215 
1219  (PVOID *) &pDmaTrans,
1220  &pFxDriverGlobals);
1221 
1222  //
1223  // Verify that the transaction belongs to a system profile enabler.
1224  //
1225 
1227  if ((profile != WdfDmaProfileSystem) &&
1230  "Cannot call %!FUNC! on non-system-profile "
1231  "WDFDMATRANSACTION (%p) (transaction profile "
1232  "is %!WDF_DMA_PROFILE!).",
1234  profile);
1236  return;
1237  }
1238 
1239  //
1240  // Cast the transaction to the right sub-type now that we've verified the
1241  // profile.
1242  //
1243 
1246  return;
1247 }
1248 
1249 
1250 
1251 } // extern "C"
__in WDFDMATRANSACTION __out_opt ULONG __out_opt ULONG * ScatterGatherElementCount
#define NT_ASSERTMSG
Definition: rtlfuncs.h:3311
_In_ WDFDMATRANSACTION _In_ size_t FinalTransferredLength
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL Mdl
__in WDFDMATRANSACTION __out NTSTATUS * pStatus
__forceinline VOID SetMaximumFragmentLength(size_t MaximumFragmentLength)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define __drv_reportError(why)
Definition: driverspecs.h:319
_Must_inspect_result_ __in WDFDMAENABLER __in_opt WDF_OBJECT_ATTRIBUTES __out WDFDMATRANSACTION * DmaTransactionHandle
EVT_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE * PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE
__in WDFDMATRANSACTION __in_opt PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE DmaCompletionRoutine
_In_ WDFDMATRANSACTION _In_opt_ PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE _In_opt_ PVOID DmaCompletionContext
__inline WDF_DMA_PROFILE GetProfile(VOID)
#define MmGetMdlVirtualAddress(_Mdl)
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144
_In_ WDFDMATRANSACTION _In_opt_ PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL ConfigureRoutine
#define METHOD_FROM_CTL_CODE(ctrlCode)
#define __in_opt
Definition: dbghelp.h:38
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST Request
BOOLEAN UsesDmaV3(VOID)
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
PIO_STACK_LOCATION GetCurrentIrpStackLocation(VOID)
Definition: fxirpum.cpp:370
_Must_inspect_result_ __drv_maxIRQL(DISPATCH_LEVEL) NTSTATUS WDFEXPORT(WdfDmaTransactionCreate)(__in PWDF_DRIVER_GLOBALS DriverGlobals
FxRequest * pRequest
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
__forceinline size_t GetBytesTransferred(VOID)
VOID SetImmediateExecution(__in BOOLEAN Value)
__forceinline FxRequest * GetRequest(VOID)
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
__in WDFDMATRANSACTION __in_opt PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE __in_opt PVOID DmaCompletionContext
VOID SetDeviceAddressOffset(__in ULONG Offset)
DriverGlobals
_Must_inspect_result_ NTSTATUS GetDeviceControlOutputMdl(__out PMDL *pMdl)
_Must_inspect_result_ NTSTATUS GetMdl(__out PMDL *pMdl)
Definition: fxrequestkm.cpp:80
_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION DmaDirection
_In_ WDFDMATRANSACTION _Out_opt_ ULONG * MapRegisterCount
#define METHOD_IN_DIRECT
Definition: nt_native.h:595
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ WDFDMATRANSACTION _In_ WDF_DMA_DIRECTION _In_ ULONG _In_ PFN_WDF_RESERVE_DMA _In_ PVOID EvtReserveDmaContext
WDF_EXTERN_C_START enum _WDF_DMA_PROFILE WDF_DMA_PROFILE
__inline WDFDEVICE GetDeviceHandle(VOID)
#define __out_opt
Definition: dbghelp.h:65
#define FALSE
Definition: types.h:117
__in WDFDMATRANSACTION __in size_t MaximumLength
FxPointerNotNull(pFxDriverGlobals, DmaTransactionHandle)
#define TRACINGDMA
Definition: dbgtrace.h:71
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
ULONG reqLength
return STATUS_SUCCESS
__inline WDFDMAENABLER GetHandle(VOID)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction
#define __out
Definition: dbghelp.h:62
VOID SetTransferCompleteCallback(__in_opt PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE Callback, __in_opt PVOID Context)
unsigned char BOOLEAN
int zero
Definition: sehframes.cpp:29
EVT_WDF_RESERVE_DMA * PFN_WDF_RESERVE_DMA
BOOLEAN DmaCompleted(__in size_t TransferredLength, __out NTSTATUS *ReturnStatus, __in FxDmaCompletionType CompletionType)
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL __in size_t __in __drv_when(Length==0, __drv_reportError(Length cannot be zero)) size_t Length)
_Must_inspect_result_ __in WDFDMATRANSACTION __in_opt WDFCONTEXT Context
EVT_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL * PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL
__in WDFDMATRANSACTION __in WDF_DMA_DIRECTION __in ULONG __in PFN_WDF_RESERVE_DMA __in PVOID EvtReserveDmaContext
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
void * PVOID
Definition: retypes.h:9
_In_ WDFDMAENABLER _In_ WDF_DMA_DIRECTION DmaDirection
WDF_DMA_PROFILE profile
Definition: _stack.h:47
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), DmaEnabler, FX_TYPE_DMA_ENABLER,(PVOID *) &pDmaEnabler, &pFxDriverGlobals)
#define METHOD_OUT_DIRECT
Definition: nt_native.h:596
PIO_STACK_LOCATION stack
_In_ WDFDMATRANSACTION _In_opt_ PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE DmaCompletionRoutine
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
BOOLEAN CancelResourceAllocation(VOID)
_In_ WDFDMATRANSACTION _In_ size_t TransferredLength
__in WDFDMATRANSACTION __out_opt ULONG * MapRegisterCount
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID ReleaseForReuse(__in BOOLEAN ForceRelease)
__forceinline FxDmaEnabler * GetDmaEnabler(VOID)
__in WDFDMATRANSACTION __in_opt PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL __in_opt PVOID ConfigureContext
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL __in PVOID VirtualAddress
__forceinline VOID SetRequest(__in FxRequest *Request)
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
_In_ WDFDMATRANSACTION _In_ WDF_DMA_DIRECTION _In_ ULONG RequiredMapRegisters
__inline BOOLEAN SupportsChainedMdls(VOID)
__in WDFDMATRANSACTION __in size_t TransferredLength
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in FxDmaEnabler *DmaEnabler, __out WDFDMATRANSACTION *Transaction)
FxDmaTransactionState state
FxIrp * GetFxIrp(VOID)
Definition: fxrequest.hpp:957
MDL
Definition: mmtypes.h:117
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
_Must_inspect_result_ NTSTATUS Initialize(__in PFN_WDF_PROGRAM_DMA ProgramDmaFunction, __in WDF_DMA_DIRECTION DmaDirection, __in PMDL Mdl, __in size_t Offset, __in ULONG Length)
__forceinline size_t GetCurrentFragmentLength(VOID)
#define _Must_inspect_result_
Definition: ms_sal.h:558
MDL * mdl
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
__success(TRUE) __drv_maxIRQL(DISPATCH_LEVEL) NTSTATUS WDFEXPORT(WdfDmaTransactionRelease)(__in PWDF_DRIVER_GLOBALS DriverGlobals
_Must_inspect_result_ __in WDFDMATRANSACTION DmaTransaction
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in FxDmaEnabler *DmaEnabler, __out WDFDMATRANSACTION *Transaction)
__in WDFDMATRANSACTION __in BOOLEAN UseImmediateExecution
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
_Must_inspect_result_ NTSTATUS Execute(__in PVOID Context)
FxRequest * pReqObj
EVT_WDF_PROGRAM_DMA * PFN_WDF_PROGRAM_DMA
#define METHOD_BUFFERED
Definition: nt_native.h:594
_In_ WDFDMATRANSACTION _In_opt_ PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL _In_opt_ PVOID ConfigureContext
FxDmaTransactionState GetTransactionState(VOID)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define MmGetMdlByteCount(_Mdl)
__in WDFDMATRANSACTION __in size_t FinalTransferredLength
#define NULL
Definition: types.h:112
_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST __in PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction
VOID GetTransferInfo(__out_opt ULONG *MapRegisterCount, __out_opt ULONG *ScatterGatherElementCount)
FxObjectHandleGetPtr(pFxDriverGlobals, Request, FX_TYPE_REQUEST,(PVOID *) &pReqObj)
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
FxDmaEnabler * pDmaEnabler
__in WDFDMATRANSACTION __in_opt PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL ConfigureRoutine
_Must_inspect_result_ __in WDFDMAENABLER __in_opt WDF_OBJECT_ATTRIBUTES * Attributes
#define IRP_MJ_READ
Definition: rdpdr.c:46
_Must_inspect_result_ _In_ WDFDMAENABLER DmaEnabler
FxDmaSystemTransaction * systemTransaction
enum _WDF_DMA_DIRECTION WDF_DMA_DIRECTION
unsigned int ULONG
Definition: retypes.h:1
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
VOID SetConfigureChannelCallback(__in_opt PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL Callback, __in_opt PVOID Context)
FxDmaTransactionBase * pDmaTrans
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
_In_ WDFDMATRANSACTION _In_ WDF_DMA_DIRECTION _In_ ULONG _In_ PFN_WDF_RESERVE_DMA EvtReserveDmaFunction
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in FxDmaEnabler *DmaEnabler, __out WDFDMATRANSACTION *Transaction)
__in WDFDMATRANSACTION __in WDF_DMA_DIRECTION __in ULONG __in PFN_WDF_RESERVE_DMA EvtReserveDmaFunction
#define __in
Definition: dbghelp.h:35
PFX_DRIVER_GLOBALS pFxDriverGlobals
_In_ WDFDMATRANSACTION _In_ BOOLEAN UseImmediateExecution
#define WDF_PTR_GET_OFFSET(_base, _addr)
Definition: wdfcore.h:147
_Must_inspect_result_ _In_ WDFDMAENABLER _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDMATRANSACTION * DmaTransaction
__inline WDFREQUEST GetHandle(VOID)
__in WDFDMATRANSACTION __in WDF_DMA_DIRECTION __in ULONG RequiredMapRegisters
_Must_inspect_result_ __in WDFDMAENABLER DmaEnabler
FxVerifierDbgBreakPoint(pFxDriverGlobals)
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
FxDmaTransactionState
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL __in size_t Offset
_In_ WDFDMATRANSACTION _Out_opt_ ULONG _Out_opt_ ULONG * ScatterGatherElementCount
Definition: ps.c:97