OSDN Git Service

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