1 /*++
2 
3 Copyright (c) Microsoft. All rights reserved.
4 
5 Module Name:
6 
7     iopriv.hpp
8 
9 Abstract:
10 
11     This module defines private interfaces for the I/O package
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19     Both kernel and user mode
20 
21 Revision History:
22 
23 --*/
24 
25 #ifndef _IOPRIV_H_
26 #define _IOPRIV_H_
27 
28 #if ((FX_CORE_MODE)==(FX_CORE_USER_MODE))
29 #define FX_IS_USER_MODE (TRUE)
30 #define FX_IS_KERNEL_MODE (FALSE)
31 #elif ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
32 #define FX_IS_USER_MODE (FALSE)
33 #define FX_IS_KERNEL_MODE (TRUE)
34 #endif
35 
36 /*#if defined(MODE_AGNSOTIC_FXPKGIO_NOT_IN_SHARED_FOLDER)
37 #include <fx.hpp>
38 #else
39 // common header file for all irphandler\* files
40 #include "irphandlerspriv.hpp"
41 #endif
42 
43 #if FX_IS_USER_MODE
44 #define PWDF_REQUEST_PARAMETERS  PVOID
45 #define PFN_WDF_REQUEST_CANCEL   PVOID
46 #define PIO_CSQ_IRP_CONTEXT      PVOID
47 #endif*/
48 
49 extern "C" {
50 #include "mx.h"
51 }
52 
53 #include "fxmin.hpp"
54 
55 #include "wdfmemory.h"
56 #include "wdfrequest.h"
57 #include "wdfio.h"
58 #include "wdfdevice.h"
59 #include "wdfwmi.h"
60 #include "wdfchildlist.h"
61 #include "wdfpdo.h"
62 #include "wdffdo.h"
63 #include "fxirpqueue.hpp"
64 #include "fxcallback.hpp"
65 
66 // <FxSystemWorkItem.hpp>
67 __drv_functionClass(EVT_SYSTEMWORKITEM)
68 __drv_maxIRQL(PASSIVE_LEVEL)
69 __drv_maxFunctionIRQL(DISPATCH_LEVEL)
70 __drv_sameIRQL
71 typedef
72 VOID
73 EVT_SYSTEMWORKITEM(
74     __in PVOID Parameter
75     );
76 
77 typedef EVT_SYSTEMWORKITEM *PFN_WDF_SYSTEMWORKITEM;
78 
79 // </FxSystemWorkItem.hpp>
80 
81 #include "fxsystemthread.hpp"
82 
83 #include "fxcallbackspinlock.hpp"
84 #include "fxcallbackmutexlock.hpp"
85 #include "fxtransactionedlist.hpp"
86 
87 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
88 #include "fxirpkm.hpp"
89 #else
90 #include "fxirpum.hpp"
91 #endif
92 
93 
94 #include "fxpackage.hpp"
95 #include "fxcollection.hpp"
96 #include "fxdeviceinitshared.hpp"
97 #include "fxdevicetomxinterface.hpp"
98 
99 #include "ifxmemory.hpp"
100 #include "fxcallback.hpp"
101 #include "fxrequestcontext.hpp"
102 #include "fxrequestcontexttypes.h"
103 #include "fxrequestbase.hpp"
104 #include "fxmemoryobject.hpp"
105 #include "fxmemorybufferpreallocated.hpp"
106 #include "fxrequestmemory.hpp"
107 #include "fxrequest.hpp"
108 #include "fxrequestbuffer.hpp"
109 #include "fxsyncrequest.hpp"
110 
111 #include "shared/irphandlers/irphandlerspriv.hpp"
112 #include "fxpkgpnp.hpp"
113 #include "fxpkgio.hpp"
114 #include "fxioqueue.hpp"
115 #include "fxioqueuecallbacks.hpp"
116 
117 
118 //
119 // At this time we are unable to include wdf17.h in the share code, thus for
120 // now we simply cut and paste the needed structures.
121 //
122 typedef struct _WDF_IO_QUEUE_CONFIG_V1_7 {
123     ULONG                                       Size;
124 
125     WDF_IO_QUEUE_DISPATCH_TYPE                  DispatchType;
126 
127     WDF_TRI_STATE                               PowerManaged;
128 
129     BOOLEAN                                     AllowZeroLengthRequests;
130 
131     BOOLEAN                                     DefaultQueue;
132 
133     PFN_WDF_IO_QUEUE_IO_DEFAULT                 EvtIoDefault;
134 
135     PFN_WDF_IO_QUEUE_IO_READ                    EvtIoRead;
136 
137     PFN_WDF_IO_QUEUE_IO_WRITE                   EvtIoWrite;
138 
139     PFN_WDF_IO_QUEUE_IO_DEVICE_CONTROL          EvtIoDeviceControl;
140 
141     PFN_WDF_IO_QUEUE_IO_INTERNAL_DEVICE_CONTROL EvtIoInternalDeviceControl;
142 
143     PFN_WDF_IO_QUEUE_IO_STOP                    EvtIoStop;
144 
145     PFN_WDF_IO_QUEUE_IO_RESUME                  EvtIoResume;
146 
147     PFN_WDF_IO_QUEUE_IO_CANCELED_ON_QUEUE       EvtIoCanceledOnQueue;
148 
149 } WDF_IO_QUEUE_CONFIG_V1_7, *PWDF_IO_QUEUE_CONFIG_V1_7;
150 
151 //
152 // At this time we are unable to include wdf19.h in the shared code, thus for
153 // now we simply cut and paste the needed structures.
154 //
155 //
156 typedef struct _WDF_IO_QUEUE_CONFIG_V1_9 {
157     ULONG                                       Size;
158 
159     WDF_IO_QUEUE_DISPATCH_TYPE                  DispatchType;
160 
161     WDF_TRI_STATE                               PowerManaged;
162 
163     BOOLEAN                                     AllowZeroLengthRequests;
164 
165     BOOLEAN                                     DefaultQueue;
166 
167     PFN_WDF_IO_QUEUE_IO_DEFAULT                 EvtIoDefault;
168 
169     PFN_WDF_IO_QUEUE_IO_READ                    EvtIoRead;
170 
171     PFN_WDF_IO_QUEUE_IO_WRITE                   EvtIoWrite;
172 
173     PFN_WDF_IO_QUEUE_IO_DEVICE_CONTROL          EvtIoDeviceControl;
174 
175     PFN_WDF_IO_QUEUE_IO_INTERNAL_DEVICE_CONTROL EvtIoInternalDeviceControl;
176 
177     PFN_WDF_IO_QUEUE_IO_STOP                    EvtIoStop;
178 
179     PFN_WDF_IO_QUEUE_IO_RESUME                  EvtIoResume;
180 
181     PFN_WDF_IO_QUEUE_IO_CANCELED_ON_QUEUE       EvtIoCanceledOnQueue;
182 
183     union {
184         struct {
185             ULONG NumberOfPresentedRequests;
186 
187         } Parallel;
188 
189     } Settings;
190 
191 } WDF_IO_QUEUE_CONFIG_V1_9, *PWDF_IO_QUEUE_CONFIG_V1_9;
192 
193 
194 //
195 // public headers
196 //
197 /*#include "wdfDevice.h"
198 #include "wdfChildList.h"
199 #include "wdfPdo.h"
200 #include "wdffdo.h"
201 #include "wdfQueryInterface.h"
202 #include "wdfMemory.h"
203 #include "wdfWmi.h"
204 
205 #if FX_IS_KERNEL_MODE
206 #include "wdfrequest.h"
207 #endif
208 #include "wdfio.h"
209 
210 
211 
212 #include "FxCallback.hpp"
213 
214 
215 #include "FxRequestBaseShared.hpp"
216 #include "FxRequestShared.hpp"
217 
218 // FxDevice To Shared interface header
219 #include "FxDeviceToMxInterface.hpp"
220 #include "FxRequestToMxInterface.hpp"
221 
222 #if defined(MODE_AGNSOTIC_FXPKGIO_NOT_IN_SHARED_FOLDER)
223 #include "FxRequestToMxInterfaceKM.hpp"
224 #endif
225 
226 //
227 // private headers
228 //
229 #include "FxTransactionedList.hpp"
230 #include "FxSystemThread.hpp"
231 
232 #if FX_IS_KERNEL_MODE
233 #include "FxFileObject.hpp"
234 #endif
235 
236 #include "Fxirpqueue.hpp"
237 
238 #include "FxCallbackSpinLock.hpp"
239 #include "FxCallbackMutexLock.hpp"
240 
241 //#include "FxDeviceInterface.hpp"
242 //#include "FxQueryInterface.hpp"
243 //#include "FxPnpCallbacks.hpp"
244 #include "FxPackage.hpp"
245 
246 #include "FxChildList.hpp"
247 #include "FxPkgPnp.hpp"
248 #include "FxPkgPdo.hpp"
249 
250 #include "FxPkgIo.hpp"
251 #include "FxIoQueue.hpp"
252 
253 
254 #if !defined(MODE_AGNSOTIC_FXPKGIO_NOT_IN_SHARED_FOLDER)
255 
256 // <wdf17.h>
257 //
258 // This is the structure used to configure an IoQueue and
259 // register callback events to it.
260 //
261 //
262 typedef struct _WDF_IO_QUEUE_CONFIG_V1_7 {
263     ULONG                                       Size;
264 
265     WDF_IO_QUEUE_DISPATCH_TYPE                  DispatchType;
266 
267     WDF_TRI_STATE                               PowerManaged;
268 
269     BOOLEAN                                     AllowZeroLengthRequests;
270 
271     BOOLEAN                                     DefaultQueue;
272 
273     PFN_WDF_IO_QUEUE_IO_DEFAULT                 EvtIoDefault;
274 
275     PFN_WDF_IO_QUEUE_IO_READ                    EvtIoRead;
276 
277     PFN_WDF_IO_QUEUE_IO_WRITE                   EvtIoWrite;
278 
279     PFN_WDF_IO_QUEUE_IO_DEVICE_CONTROL          EvtIoDeviceControl;
280 
281     PFN_WDF_IO_QUEUE_IO_INTERNAL_DEVICE_CONTROL EvtIoInternalDeviceControl;
282 
283     PFN_WDF_IO_QUEUE_IO_STOP                    EvtIoStop;
284 
285     PFN_WDF_IO_QUEUE_IO_RESUME                  EvtIoResume;
286 
287     PFN_WDF_IO_QUEUE_IO_CANCELED_ON_QUEUE       EvtIoCanceledOnQueue;
288 
289 } WDF_IO_QUEUE_CONFIG_V1_7, *PWDF_IO_QUEUE_CONFIG_V1_7;
290 
291 // </wdf17.h>
292 
293 //
294 // <wdfbugcoded.h>
295 //
296 typedef struct _WDF_QUEUE_FATAL_ERROR_DATA {
297     WDFQUEUE Queue;
298 
299     WDFREQUEST Request;
300 
301     NTSTATUS Status;
302 
303 } WDF_QUEUE_FATAL_ERROR_DATA, *PWDF_QUEUE_FATAL_ERROR_DATA;
304 
305 // </wdfbugcoded.h>
306 
307 #endif //MODE_AGNSOTIC_FXPKGIO_NOT_IN_SHARED_FOLDER*/
308 
309 #endif  //_IOPRIV_H_
310