[DDK]
[reactos.git] / reactos / include / ddk / storport.h
1 /*
2 * storport.h
3 *
4 * StorPort interface
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #ifndef __STORPORT_H
24 #define __STORPORT_H
25
26 #include "srb.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #if defined(_STORPORT_)
33 #define STORPORTAPI
34 #else
35 #define STORPORTAPI DECLSPEC_IMPORT
36 #endif
37
38 typedef PHYSICAL_ADDRESS STOR_PHYSICAL_ADDRESS;
39
40 typedef struct _STOR_SCATTER_GATHER_ELEMENT {
41 STOR_PHYSICAL_ADDRESS PhysicalAddress;
42 ULONG Length;
43 ULONG_PTR Reserved;
44 } STOR_SCATTER_GATHER_ELEMENT, *PSTOR_SCATTER_GATHER_ELEMENT;
45
46 typedef struct _STOR_SCATTER_GATHER_LIST {
47 ULONG NumberOfElements;
48 ULONG_PTR Reserved;
49 STOR_SCATTER_GATHER_ELEMENT List[0];
50 } STOR_SCATTER_GATHER_LIST, *PSTOR_SCATTER_GATHER_LIST;
51
52 typedef struct _SCSI_WMI_REQUEST_BLOCK {
53 USHORT Length;
54 UCHAR Function;
55 UCHAR SrbStatus;
56 UCHAR WMISubFunction;
57 UCHAR PathId;
58 UCHAR TargetId;
59 UCHAR Lun;
60 UCHAR Reserved1;
61 UCHAR WMIFlags;
62 UCHAR Reserved2[2];
63 ULONG SrbFlags;
64 ULONG DataTransferLength;
65 ULONG TimeOutValue;
66 PVOID DataBuffer;
67 PVOID DataPath;
68 PVOID Reserved3;
69 PVOID OriginalRequest;
70 PVOID SrbExtension;
71 ULONG Reserved4;
72 UCHAR Reserved5[16];
73 } SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
74
75 STORPORTAPI
76 ULONG
77 NTAPI
78 StorPortInitialize(
79 IN PVOID Argument1,
80 IN PVOID Argument2,
81 IN PHW_INITIALIZATION_DATA HwInitializationData,
82 IN PVOID Unused);
83
84 STORPORTAPI
85 VOID
86 NTAPI
87 StorPortFreeDeviceBase(
88 IN PVOID HwDeviceExtension,
89 IN PVOID MappedAddress);
90
91 STORPORTAPI
92 ULONG
93 NTAPI
94 StorPortGetBusData(
95 IN PVOID DeviceExtension,
96 IN ULONG BusDataType,
97 IN ULONG SystemIoBusNumber,
98 IN ULONG SlotNumber,
99 IN PVOID Buffer,
100 IN ULONG Length);
101
102 STORPORTAPI
103 ULONG
104 NTAPI
105 StorPortSetBusDataByOffset(
106 IN PVOID DeviceExtension,
107 IN ULONG BusDataType,
108 IN ULONG SystemIoBusNumber,
109 IN ULONG SlotNumber,
110 IN PVOID Buffer,
111 IN ULONG Offset,
112 IN ULONG Length);
113
114 STORPORTAPI
115 PVOID
116 NTAPI
117 StorPortGetDeviceBase(
118 IN PVOID HwDeviceExtension,
119 IN INTERFACE_TYPE BusType,
120 IN ULONG SystemIoBusNumber,
121 IN SCSI_PHYSICAL_ADDRESS IoAddress,
122 IN ULONG NumberOfBytes,
123 IN BOOLEAN InIoSpace);
124
125 STORPORTAPI
126 PVOID
127 NTAPI
128 StorPortGetLogicalUnit(
129 IN PVOID HwDeviceExtension,
130 IN UCHAR PathId,
131 IN UCHAR TargetId,
132 IN UCHAR Lun);
133
134 STORPORTAPI
135 PSCSI_REQUEST_BLOCK
136 NTAPI
137 StorPortGetSrb(
138 IN PVOID DeviceExtension,
139 IN UCHAR PathId,
140 IN UCHAR TargetId,
141 IN UCHAR Lun,
142 IN LONG QueueTag);
143
144 STORPORTAPI
145 STOR_PHYSICAL_ADDRESS
146 NTAPI
147 StorPortGetPhysicalAddress(
148 IN PVOID HwDeviceExtension,
149 IN PSCSI_REQUEST_BLOCK Srb,
150 IN PVOID VirtualAddress,
151 OUT ULONG *Length);
152
153 STORPORTAPI
154 PVOID
155 NTAPI
156 StorPortGetVirtualAddress(
157 IN PVOID HwDeviceExtension,
158 IN STOR_PHYSICAL_ADDRESS PhysicalAddress);
159
160 STORPORTAPI
161 PVOID
162 NTAPI
163 StorPortGetUncachedExtension(
164 IN PVOID HwDeviceExtension,
165 IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
166 IN ULONG NumberOfBytes);
167
168 STORPORTAPI
169 VOID
170 __cdecl
171 StorPortNotification(
172 IN SCSI_NOTIFICATION_TYPE NotificationType,
173 IN PVOID HwDeviceExtension,
174 IN ...);
175
176 STORPORTAPI
177 VOID
178 NTAPI
179 StorPortLogError(
180 IN PVOID HwDeviceExtension,
181 IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
182 IN UCHAR PathId,
183 IN UCHAR TargetId,
184 IN UCHAR Lun,
185 IN ULONG ErrorCode,
186 IN ULONG UniqueId);
187
188 STORPORTAPI
189 VOID
190 NTAPI
191 StorPortCompleteRequest(
192 IN PVOID HwDeviceExtension,
193 IN UCHAR PathId,
194 IN UCHAR TargetId,
195 IN UCHAR Lun,
196 IN UCHAR SrbStatus);
197
198 STORPORTAPI
199 VOID
200 NTAPI
201 StorPortMoveMemory(
202 IN PVOID WriteBuffer,
203 IN PVOID ReadBuffer,
204 IN ULONG Length);
205
206 STORPORTAPI
207 VOID
208 NTAPI
209 StorPortStallExecution(
210 IN ULONG Delay);
211
212 STORPORTAPI
213 STOR_PHYSICAL_ADDRESS
214 NTAPI
215 StorPortConvertUlong64ToPhysicalAddress(
216 IN ULONG64 UlongAddress);
217
218 STORPORTAPI
219 ULONG64
220 NTAPI
221 StorPortConvertPhysicalAddressToUlong64(
222 IN STOR_PHYSICAL_ADDRESS Address);
223
224 STORPORTAPI
225 BOOLEAN
226 NTAPI
227 StorPortValidateRange(
228 IN PVOID HwDeviceExtension,
229 IN INTERFACE_TYPE BusType,
230 IN ULONG SystemIoBusNumber,
231 IN STOR_PHYSICAL_ADDRESS IoAddress,
232 IN ULONG NumberOfBytes,
233 IN BOOLEAN InIoSpace);
234
235 STORPORTAPI
236 VOID
237 __cdecl
238 StorPortDebugPrint(
239 IN ULONG DebugPrintLevel,
240 IN PCCHAR DebugMessage,
241 IN ...);
242
243 STORPORTAPI
244 UCHAR
245 NTAPI
246 StorPortReadPortUchar(
247 IN PUCHAR Port);
248
249 STORPORTAPI
250 ULONG
251 NTAPI
252 StorPortReadPortUlong(
253 IN PULONG Port);
254
255 STORPORTAPI
256 USHORT
257 NTAPI
258 StorPortReadPortUshort(
259 IN PUSHORT Port);
260
261 STORPORTAPI
262 UCHAR
263 NTAPI
264 StorPortReadRegisterUchar(
265 IN PUCHAR Register);
266
267 STORPORTAPI
268 ULONG
269 NTAPI
270 StorPortReadRegisterUlong(
271 IN PULONG Register);
272
273 STORPORTAPI
274 USHORT
275 NTAPI
276 StorPortReadRegisterUshort(
277 IN PUSHORT Register);
278
279 STORPORTAPI
280 VOID
281 NTAPI
282 StorPortWritePortUchar(
283 IN PUCHAR Port,
284 IN UCHAR Value);
285
286 STORPORTAPI
287 VOID
288 NTAPI
289 StorPortWritePortUlong(
290 IN PULONG Port,
291 IN ULONG Value);
292
293 STORPORTAPI
294 VOID
295 NTAPI
296 StorPortWritePortUshort(
297 IN PUSHORT Port,
298 IN USHORT Value);
299
300 STORPORTAPI
301 VOID
302 NTAPI
303 StorPortWriteRegisterUchar(
304 IN PUCHAR Port,
305 IN UCHAR Value);
306
307 STORPORTAPI
308 VOID
309 NTAPI
310 StorPortWriteRegisterUlong(
311 IN PULONG Port,
312 IN ULONG Value);
313
314 STORPORTAPI
315 VOID
316 NTAPI
317 StorPortWriteRegisterUshort(
318 IN PUSHORT Port,
319 IN USHORT Value);
320
321 STORPORTAPI
322 BOOLEAN
323 NTAPI
324 StorPortPauseDevice(
325 IN PVOID HwDeviceExtension,
326 IN UCHAR PathId,
327 IN UCHAR TargetId,
328 IN UCHAR Lun,
329 IN ULONG TimeOut);
330
331 STORPORTAPI
332 BOOLEAN
333 NTAPI
334 StorPortResumeDevice(
335 IN PVOID HwDeviceExtension,
336 IN UCHAR PathId,
337 IN UCHAR TargetId,
338 IN UCHAR Lun);
339
340 STORPORTAPI
341 BOOLEAN
342 NTAPI
343 StorPortPause(
344 IN PVOID HwDeviceExtension,
345 IN ULONG TimeOut);
346
347 STORPORTAPI
348 BOOLEAN
349 NTAPI
350 StorPortResume(
351 IN PVOID HwDeviceExtension);
352
353 STORPORTAPI
354 BOOLEAN
355 NTAPI
356 StorPortDeviceBusy(
357 IN PVOID HwDeviceExtension,
358 IN UCHAR PathId,
359 IN UCHAR TargetId,
360 IN UCHAR Lun,
361 IN ULONG RequestsToComplete);
362
363 STORPORTAPI
364 BOOLEAN
365 NTAPI
366 StorPortDeviceReady(
367 IN PVOID HwDeviceExtension,
368 IN UCHAR PathId,
369 IN UCHAR TargetId,
370 IN UCHAR Lun);
371
372 STORPORTAPI
373 BOOLEAN
374 NTAPI
375 StorPortBusy(
376 IN PVOID HwDeviceExtension,
377 IN ULONG RequestsToComplete);
378
379 STORPORTAPI
380 BOOLEAN
381 NTAPI
382 StorPortReady(
383 IN PVOID HwDeviceExtension);
384
385 STORPORTAPI
386 PSTOR_SCATTER_GATHER_LIST
387 NTAPI
388 StorPortGetScatterGatherList(
389 IN PVOID DeviceExtension,
390 IN PSCSI_REQUEST_BLOCK Srb);
391
392 typedef BOOLEAN
393 (NTAPI *PSTOR_SYNCHRONIZED_ACCESS)(
394 IN PVOID HwDeviceExtension,
395 IN PVOID Context);
396
397 STORPORTAPI
398 VOID
399 NTAPI
400 StorPortSynchronizeAccess(
401 IN PVOID HwDeviceExtension,
402 IN PSTOR_SYNCHRONIZED_ACCESS SynchronizedAccessRoutine,
403 IN PVOID Context);
404
405 #if DBG
406 #define DebugPrint(x) StorPortDebugPrint x
407 #else
408 #define DebugPrint(x)
409 #endif
410
411 #ifdef __cplusplus
412 }
413 #endif
414
415 #endif /* __STORPORT_H */