source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/ddk/srb.h@ 1167

Last change on this file since 1167 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 22.6 KB
RevLine 
[1166]1/*
2 * scsi.h
3 *
4 * Interface between SCSI miniport drivers and the SCSI port driver.
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 _NTSRB_
24#define _NTSRB_
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#define SCSI_MAXIMUM_LOGICAL_UNITS 8
31#define SCSI_MAXIMUM_TARGETS_PER_BUS 128
32#define SCSI_MAXIMUM_LUNS_PER_TARGET 255
33#define SCSI_MAXIMUM_BUSES 8
34#define SCSI_MINIMUM_PHYSICAL_BREAKS 16
35#define SCSI_MAXIMUM_PHYSICAL_BREAKS 255
36#define SCSI_MAXIMUM_TARGETS 8
37
38/* PORT_CONFIGURATION_INFORMATION.Dma64BitAddresses constants */
39#define SCSI_DMA64_MINIPORT_SUPPORTED 0x01
40#define SCSI_DMA64_SYSTEM_SUPPORTED 0x80
41#if (NTDDI_VERSION > NTDDI_WS03SP1)
42#define SCSI_DMA64_MINIPORT_FULL64BIT_SUPPORTED 0x02
43#endif
44
45#define SP_UNINITIALIZED_VALUE ((ULONG) ~0)
46#define SP_UNTAGGED ((UCHAR) ~0)
47
48/* Asynchronous events */
49#define SRBEV_BUS_RESET 0x0001
50#define SRBEV_SCSI_ASYNC_NOTIFICATION 0x0002
51
52#define MAXIMUM_CDB_SIZE 12
53
54#if DBG
55#define DebugPrint(x) ScsiDebugPrint x
56#else
57#define DebugPrint(x)
58#endif
59
60#define SCSI_COMBINE_BUS_TARGET(Bus, Target)( \
61 ((((UCHAR) (Target)) & ~(0x20 - 1)) << 8) | \
62 (((UCHAR) (Bus)) << 5) | \
63 (((UCHAR) (Target)) & (0x20 - 1)))
64
65#define SCSI_DECODE_BUS_TARGET(Value, Bus, Target)( \
66 Bus = (UCHAR) ((Value) >> 5), \
67 Target = (UCHAR) ((((Value) >> 8) & ~(0x20 - 1)) | ((Value) & (0x20 - 1))))
68
69/* SCSI_REQUEST_BLOCK.Function constants */
70#define SRB_FUNCTION_EXECUTE_SCSI 0x00
71#define SRB_FUNCTION_CLAIM_DEVICE 0x01
72#define SRB_FUNCTION_IO_CONTROL 0x02
73#define SRB_FUNCTION_RECEIVE_EVENT 0x03
74#define SRB_FUNCTION_RELEASE_QUEUE 0x04
75#define SRB_FUNCTION_ATTACH_DEVICE 0x05
76#define SRB_FUNCTION_RELEASE_DEVICE 0x06
77#define SRB_FUNCTION_SHUTDOWN 0x07
78#define SRB_FUNCTION_FLUSH 0x08
79#define SRB_FUNCTION_ABORT_COMMAND 0x10
80#define SRB_FUNCTION_RELEASE_RECOVERY 0x11
81#define SRB_FUNCTION_RESET_BUS 0x12
82#define SRB_FUNCTION_RESET_DEVICE 0x13
83#define SRB_FUNCTION_TERMINATE_IO 0x14
84#define SRB_FUNCTION_FLUSH_QUEUE 0x15
85#define SRB_FUNCTION_REMOVE_DEVICE 0x16
86#define SRB_FUNCTION_WMI 0x17
87#define SRB_FUNCTION_LOCK_QUEUE 0x18
88#define SRB_FUNCTION_UNLOCK_QUEUE 0x19
89#define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20
90#define SRB_FUNCTION_SET_LINK_TIMEOUT 0x21
91#define SRB_FUNCTION_LINK_TIMEOUT_OCCURRED 0x22
92#define SRB_FUNCTION_LINK_TIMEOUT_COMPLETE 0x23
93#define SRB_FUNCTION_POWER 0x24
94#define SRB_FUNCTION_PNP 0x25
95#define SRB_FUNCTION_DUMP_POINTERS 0x26
96
97/* SCSI_REQUEST_BLOCK.SrbStatus constants */
98#define SRB_STATUS_PENDING 0x00
99#define SRB_STATUS_SUCCESS 0x01
100#define SRB_STATUS_ABORTED 0x02
101#define SRB_STATUS_ABORT_FAILED 0x03
102#define SRB_STATUS_ERROR 0x04
103#define SRB_STATUS_BUSY 0x05
104#define SRB_STATUS_INVALID_REQUEST 0x06
105#define SRB_STATUS_INVALID_PATH_ID 0x07
106#define SRB_STATUS_NO_DEVICE 0x08
107#define SRB_STATUS_TIMEOUT 0x09
108#define SRB_STATUS_SELECTION_TIMEOUT 0x0A
109#define SRB_STATUS_COMMAND_TIMEOUT 0x0B
110#define SRB_STATUS_MESSAGE_REJECTED 0x0D
111#define SRB_STATUS_BUS_RESET 0x0E
112#define SRB_STATUS_PARITY_ERROR 0x0F
113#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
114#define SRB_STATUS_NO_HBA 0x11
115#define SRB_STATUS_DATA_OVERRUN 0x12
116#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
117#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
118#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
119#define SRB_STATUS_REQUEST_FLUSHED 0x16
120#define SRB_STATUS_INVALID_LUN 0x20
121#define SRB_STATUS_INVALID_TARGET_ID 0x21
122#define SRB_STATUS_BAD_FUNCTION 0x22
123#define SRB_STATUS_ERROR_RECOVERY 0x23
124#define SRB_STATUS_NOT_POWERED 0x24
125#define SRB_STATUS_LINK_DOWN 0x25
126#define SRB_STATUS_INTERNAL_ERROR 0x30
127
128#define SRB_STATUS_QUEUE_FROZEN 0x40
129#define SRB_STATUS_AUTOSENSE_VALID 0x80
130
131#define SRB_STATUS(Status) \
132 (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
133
134/* SCSI_REQUEST_BLOCK.SrbFlags constants */
135#define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002
136#define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004
137#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
138#define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010
139#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
140#define SRB_FLAGS_DATA_IN 0x00000040
141#define SRB_FLAGS_DATA_OUT 0x00000080
142#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
143#define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT)
144#define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100
145#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200
146#define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400
147#define SRB_FLAGS_IS_ACTIVE 0x00010000
148#define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000
149#define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000
150#define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000
151#define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000
152#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000
153#define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000
154#define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000
155#define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000
156#define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000
157
158#if DBG
159#define SCSI_PORT_SIGNATURE 0x54524f50
160#endif
161
162#define SRB_SIMPLE_TAG_REQUEST 0x20
163#define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21
164#define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22
165
166#define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x0001
167#define SRB_POWER_FLAGS_ADAPTER_REQUEST 0x0001
168#define SRB_PNP_FLAGS_ADAPTER_REQUEST 0x0001
169
170#define SP_BUS_PARITY_ERROR 0x0001
171#define SP_UNEXPECTED_DISCONNECT 0x0002
172#define SP_INVALID_RESELECTION 0x0003
173#define SP_BUS_TIME_OUT 0x0004
174#define SP_PROTOCOL_ERROR 0x0005
175#define SP_INTERNAL_ADAPTER_ERROR 0x0006
176#define SP_REQUEST_TIMEOUT 0x0007
177#define SP_IRQ_NOT_RESPONDING 0x0008
178#define SP_BAD_FW_WARNING 0x0009
179#define SP_BAD_FW_ERROR 0x000a
180#define SP_LOST_WMI_MINIPORT_REQUEST 0x000b
181
182#define SP_VER_TRACE_SUPPORT 0x0010
183
184#define SP_RETURN_NOT_FOUND 0
185#define SP_RETURN_FOUND 1
186#define SP_RETURN_ERROR 2
187#define SP_RETURN_BAD_CONFIG 3
188
189typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS;
190
191typedef struct _ACCESS_RANGE {
192 SCSI_PHYSICAL_ADDRESS RangeStart;
193 ULONG RangeLength;
194 BOOLEAN RangeInMemory;
195} ACCESS_RANGE, *PACCESS_RANGE;
196
197typedef struct _PORT_CONFIGURATION_INFORMATION {
198 ULONG Length;
199 ULONG SystemIoBusNumber;
200 INTERFACE_TYPE AdapterInterfaceType;
201 ULONG BusInterruptLevel;
202 ULONG BusInterruptVector;
203 KINTERRUPT_MODE InterruptMode;
204 ULONG MaximumTransferLength;
205 ULONG NumberOfPhysicalBreaks;
206 ULONG DmaChannel;
207 ULONG DmaPort;
208 DMA_WIDTH DmaWidth;
209 DMA_SPEED DmaSpeed;
210 ULONG AlignmentMask;
211 ULONG NumberOfAccessRanges;
212 ACCESS_RANGE (*AccessRanges)[];
213 PVOID Reserved;
214 UCHAR NumberOfBuses;
215 UCHAR InitiatorBusId[8];
216 BOOLEAN ScatterGather;
217 BOOLEAN Master;
218 BOOLEAN CachesData;
219 BOOLEAN AdapterScansDown;
220 BOOLEAN AtdiskPrimaryClaimed;
221 BOOLEAN AtdiskSecondaryClaimed;
222 BOOLEAN Dma32BitAddresses;
223 BOOLEAN DemandMode;
224 BOOLEAN MapBuffers;
225 BOOLEAN NeedPhysicalAddresses;
226 BOOLEAN TaggedQueuing;
227 BOOLEAN AutoRequestSense;
228 BOOLEAN MultipleRequestPerLu;
229 BOOLEAN ReceiveEvent;
230 BOOLEAN RealModeInitialized;
231 BOOLEAN BufferAccessScsiPortControlled;
232 UCHAR MaximumNumberOfTargets;
233 UCHAR ReservedUchars[2];
234 ULONG SlotNumber;
235 ULONG BusInterruptLevel2;
236 ULONG BusInterruptVector2;
237 KINTERRUPT_MODE InterruptMode2;
238 ULONG DmaChannel2;
239 ULONG DmaPort2;
240 DMA_WIDTH DmaWidth2;
241 DMA_SPEED DmaSpeed2;
242 ULONG DeviceExtensionSize;
243 ULONG SpecificLuExtensionSize;
244 ULONG SrbExtensionSize;
245 UCHAR Dma64BitAddresses;
246 BOOLEAN ResetTargetSupported;
247 UCHAR MaximumNumberOfLogicalUnits;
248 BOOLEAN WmiDataProvider;
249} PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION;
250
251#define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION)
252
253#ifdef __GNUC__
254__extension__ /* enums limited to range of integer */
255#endif
256typedef enum _SCSI_ADAPTER_CONTROL_TYPE {
257 ScsiQuerySupportedControlTypes = 0,
258 ScsiStopAdapter,
259 ScsiRestartAdapter,
260 ScsiSetBootConfig,
261 ScsiSetRunningConfig,
262 ScsiAdapterControlMax,
263 MakeAdapterControlTypeSizeOfUlong = 0xffffffff
264} SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE;
265
266typedef enum _SCSI_ADAPTER_CONTROL_STATUS {
267 ScsiAdapterControlSuccess = 0,
268 ScsiAdapterControlUnsuccessful
269} SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS;
270
271typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST {
272 ULONG MaxControlType;
273 BOOLEAN SupportedTypeList[0];
274} SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST;
275
276typedef struct _SCSI_REQUEST_BLOCK {
277 USHORT Length;
278 UCHAR Function;
279 UCHAR SrbStatus;
280 UCHAR ScsiStatus;
281 UCHAR PathId;
282 UCHAR TargetId;
283 UCHAR Lun;
284 UCHAR QueueTag;
285 UCHAR QueueAction;
286 UCHAR CdbLength;
287 UCHAR SenseInfoBufferLength;
288 ULONG SrbFlags;
289 ULONG DataTransferLength;
290 ULONG TimeOutValue;
291 PVOID DataBuffer;
292 PVOID SenseInfoBuffer;
293 struct _SCSI_REQUEST_BLOCK *NextSrb;
294 PVOID OriginalRequest;
295 PVOID SrbExtension;
296 _ANONYMOUS_UNION union {
297 ULONG InternalStatus;
298 ULONG QueueSortKey;
299 ULONG LinkTimeoutValue;
300 } DUMMYUNIONNAME;
301#if defined(_WIN64)
302 ULONG Reserved;
303#endif
304 UCHAR Cdb[16];
305} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
306
307#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK)
308
309typedef struct _SCSI_WMI_REQUEST_BLOCK {
310 USHORT Length;
311 UCHAR Function;
312 UCHAR SrbStatus;
313 UCHAR WMISubFunction;
314 UCHAR PathId;
315 UCHAR TargetId;
316 UCHAR Lun;
317 UCHAR Reserved1;
318 UCHAR WMIFlags;
319 UCHAR Reserved2[2];
320 ULONG SrbFlags;
321 ULONG DataTransferLength;
322 ULONG TimeOutValue;
323 PVOID DataBuffer;
324 PVOID DataPath;
325 PVOID Reserved3;
326 PVOID OriginalRequest;
327 PVOID SrbExtension;
328 ULONG Reserved4;
329#if (NTDDI_VERSION >= NTDDI_WS03SP1) && defined(_WIN64)
330 ULONG Reserved6;
331#endif
332 UCHAR Reserved5[16];
333} SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
334
335typedef enum _STOR_DEVICE_POWER_STATE {
336 StorPowerDeviceUnspecified = 0,
337 StorPowerDeviceD0,
338 StorPowerDeviceD1,
339 StorPowerDeviceD2,
340 StorPowerDeviceD3,
341 StorPowerDeviceMaximum
342} STOR_DEVICE_POWER_STATE, *PSTOR_DEVICE_POWER_STATE;
343
344typedef enum _STOR_POWER_ACTION {
345 StorPowerActionNone = 0,
346 StorPowerActionReserved,
347 StorPowerActionSleep,
348 StorPowerActionHibernate,
349 StorPowerActionShutdown,
350 StorPowerActionShutdownReset,
351 StorPowerActionShutdownOff,
352 StorPowerActionWarmEject
353} STOR_POWER_ACTION, *PSTOR_POWER_ACTION;
354
355typedef struct _SCSI_POWER_REQUEST_BLOCK {
356 USHORT Length;
357 UCHAR Function;
358 UCHAR SrbStatus;
359 UCHAR SrbPowerFlags;
360 UCHAR PathId;
361 UCHAR TargetId;
362 UCHAR Lun;
363 STOR_DEVICE_POWER_STATE DevicePowerState;
364 ULONG SrbFlags;
365 ULONG DataTransferLength;
366 ULONG TimeOutValue;
367 PVOID DataBuffer;
368 PVOID SenseInfoBuffer;
369 struct _SCSI_REQUEST_BLOCK *NextSrb;
370 PVOID OriginalRequest;
371 PVOID SrbExtension;
372 STOR_POWER_ACTION PowerAction;
373#if defined(_WIN64)
374 ULONG Reserved;
375#endif
376 UCHAR Reserved5[16];
377} SCSI_POWER_REQUEST_BLOCK, *PSCSI_POWER_REQUEST_BLOCK;
378
379typedef enum _STOR_PNP_ACTION {
380 StorStartDevice = 0x0,
381 StorRemoveDevice = 0x2,
382 StorStopDevice = 0x4,
383 StorQueryCapabilities = 0x9,
384 StorQueryResourceRequirements = 0xB,
385 StorFilterResourceRequirements = 0xD,
386 StorSurpriseRemoval = 0x17
387} STOR_PNP_ACTION, *PSTOR_PNP_ACTION;
388
389typedef struct _STOR_DEVICE_CAPABILITIES {
390 USHORT Version;
391 ULONG DeviceD1:1;
392 ULONG DeviceD2:1;
393 ULONG LockSupported:1;
394 ULONG EjectSupported:1;
395 ULONG Removable:1;
396 ULONG DockDevice:1;
397 ULONG UniqueID:1;
398 ULONG SilentInstall:1;
399 ULONG SurpriseRemovalOK:1;
400 ULONG NoDisplayInUI:1;
401} STOR_DEVICE_CAPABILITIES, *PSTOR_DEVICE_CAPABILITIES;
402
403typedef struct _SCSI_PNP_REQUEST_BLOCK {
404 USHORT Length;
405 UCHAR Function;
406 UCHAR SrbStatus;
407 UCHAR PnPSubFunction;
408 UCHAR PathId;
409 UCHAR TargetId;
410 UCHAR Lun;
411 STOR_PNP_ACTION PnPAction;
412 ULONG SrbFlags;
413 ULONG DataTransferLength;
414 ULONG TimeOutValue;
415 PVOID DataBuffer;
416 PVOID SenseInfoBuffer;
417 struct _SCSI_REQUEST_BLOCK *NextSrb;
418 PVOID OriginalRequest;
419 PVOID SrbExtension;
420 ULONG SrbPnPFlags;
421#if defined(_WIN64)
422 ULONG Reserved;
423#endif
424 UCHAR Reserved4[16];
425} SCSI_PNP_REQUEST_BLOCK, *PSCSI_PNP_REQUEST_BLOCK;
426
427typedef BOOLEAN
428(NTAPI *PHW_INITIALIZE)(
429 IN PVOID DeviceExtension);
430
431typedef BOOLEAN
432(NTAPI *PHW_STARTIO)(
433 IN PVOID DeviceExtension,
434 IN PSCSI_REQUEST_BLOCK Srb);
435
436typedef BOOLEAN
437(NTAPI *PHW_INTERRUPT)(
438 IN PVOID DeviceExtension);
439
440typedef VOID
441(NTAPI *PHW_TIMER)(
442 IN PVOID DeviceExtension);
443
444typedef VOID
445(NTAPI *PHW_DMA_STARTED)(
446 IN PVOID DeviceExtension);
447
448typedef ULONG
449(NTAPI *PHW_FIND_ADAPTER)(
450 IN PVOID DeviceExtension,
451 IN PVOID HwContext,
452 IN PVOID BusInformation,
453 IN PCHAR ArgumentString,
454 IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
455 OUT PBOOLEAN Again);
456
457typedef BOOLEAN
458(NTAPI *PHW_RESET_BUS)(
459 IN PVOID DeviceExtension,
460 IN ULONG PathId);
461
462typedef BOOLEAN
463(NTAPI *PHW_ADAPTER_STATE)(
464 IN PVOID DeviceExtension,
465 IN PVOID Context,
466 IN BOOLEAN SaveState);
467
468typedef SCSI_ADAPTER_CONTROL_STATUS
469(NTAPI *PHW_ADAPTER_CONTROL)(
470 IN PVOID DeviceExtension,
471 IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
472 IN PVOID Parameters);
473
474typedef enum _SCSI_NOTIFICATION_TYPE {
475 RequestComplete,
476 NextRequest,
477 NextLuRequest,
478 ResetDetected,
479 CallDisableInterrupts,
480 CallEnableInterrupts,
481 RequestTimerCall,
482 BusChangeDetected,
483 WMIEvent,
484 WMIReregister,
485 LinkUp,
486 LinkDown,
487 QueryTickCount,
488 BufferOverrunDetected,
489 TraceNotification
490} SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE;
491
492typedef struct _HW_INITIALIZATION_DATA {
493 ULONG HwInitializationDataSize;
494 INTERFACE_TYPE AdapterInterfaceType;
495 PHW_INITIALIZE HwInitialize;
496 PHW_STARTIO HwStartIo;
497 PHW_INTERRUPT HwInterrupt;
498 PHW_FIND_ADAPTER HwFindAdapter;
499 PHW_RESET_BUS HwResetBus;
500 PHW_DMA_STARTED HwDmaStarted;
501 PHW_ADAPTER_STATE HwAdapterState;
502 ULONG DeviceExtensionSize;
503 ULONG SpecificLuExtensionSize;
504 ULONG SrbExtensionSize;
505 ULONG NumberOfAccessRanges;
506 PVOID Reserved;
507 BOOLEAN MapBuffers;
508 BOOLEAN NeedPhysicalAddresses;
509 BOOLEAN TaggedQueuing;
510 BOOLEAN AutoRequestSense;
511 BOOLEAN MultipleRequestPerLu;
512 BOOLEAN ReceiveEvent;
513 USHORT VendorIdLength;
514 PVOID VendorId;
515 _ANONYMOUS_UNION union {
516 USHORT ReservedUshort;
517 USHORT PortVersionFlags;
518 } DUMMYUNIONNAME;
519 USHORT DeviceIdLength;
520 PVOID DeviceId;
521 PHW_ADAPTER_CONTROL HwAdapterControl;
522} HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA;
523
524#if defined(_NTDDK_)
525#define SCSIPORTAPI
526#else
527#define SCSIPORTAPI DECLSPEC_IMPORT
528#endif
529
530SCSIPORTAPI
531VOID
532NTAPI
533ScsiPortCompleteRequest(
534 IN PVOID HwDeviceExtension,
535 IN UCHAR PathId,
536 IN UCHAR TargetId,
537 IN UCHAR Lun,
538 IN UCHAR SrbStatus);
539
540SCSIPORTAPI
541ULONG
542NTAPI
543ScsiPortConvertPhysicalAddressToUlong(
544 IN SCSI_PHYSICAL_ADDRESS Address);
545
546#define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart)
547#define ScsiPortConvertPhysicalAddressToULongPtr(Address) ((ULONG_PTR)((Address).QuadPart))
548
549SCSIPORTAPI
550SCSI_PHYSICAL_ADDRESS
551NTAPI
552ScsiPortConvertUlongToPhysicalAddress(
553 IN ULONG_PTR UlongAddress);
554
555SCSIPORTAPI
556VOID
557NTAPI
558ScsiPortFlushDma(
559 IN PVOID DeviceExtension);
560
561SCSIPORTAPI
562VOID
563NTAPI
564ScsiPortFreeDeviceBase(
565 IN PVOID HwDeviceExtension,
566 IN PVOID MappedAddress);
567
568SCSIPORTAPI
569ULONG
570NTAPI
571ScsiPortGetBusData(
572 IN PVOID DeviceExtension,
573 IN ULONG BusDataType,
574 IN ULONG SystemIoBusNumber,
575 IN ULONG SlotNumber,
576 IN PVOID Buffer,
577 IN ULONG Length);
578
579SCSIPORTAPI
580PVOID
581NTAPI
582ScsiPortGetDeviceBase(
583 IN PVOID HwDeviceExtension,
584 IN INTERFACE_TYPE BusType,
585 IN ULONG SystemIoBusNumber,
586 IN SCSI_PHYSICAL_ADDRESS IoAddress,
587 IN ULONG NumberOfBytes,
588 IN BOOLEAN InIoSpace);
589
590SCSIPORTAPI
591PVOID
592NTAPI
593ScsiPortGetLogicalUnit(
594 IN PVOID HwDeviceExtension,
595 IN UCHAR PathId,
596 IN UCHAR TargetId,
597 IN UCHAR Lun);
598
599SCSIPORTAPI
600SCSI_PHYSICAL_ADDRESS
601NTAPI
602ScsiPortGetPhysicalAddress(
603 IN PVOID HwDeviceExtension,
604 IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
605 IN PVOID VirtualAddress,
606 OUT ULONG *Length);
607
608SCSIPORTAPI
609PSCSI_REQUEST_BLOCK
610NTAPI
611ScsiPortGetSrb(
612 IN PVOID DeviceExtension,
613 IN UCHAR PathId,
614 IN UCHAR TargetId,
615 IN UCHAR Lun,
616 IN LONG QueueTag);
617
618SCSIPORTAPI
619PVOID
620NTAPI
621ScsiPortGetUncachedExtension(
622 IN PVOID HwDeviceExtension,
623 IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
624 IN ULONG NumberOfBytes);
625
626SCSIPORTAPI
627PVOID
628NTAPI
629ScsiPortGetVirtualAddress(
630 IN PVOID HwDeviceExtension,
631 IN SCSI_PHYSICAL_ADDRESS PhysicalAddress);
632
633SCSIPORTAPI
634ULONG
635NTAPI
636ScsiPortInitialize(
637 IN PVOID Argument1,
638 IN PVOID Argument2,
639 IN struct _HW_INITIALIZATION_DATA *HwInitializationData,
640 IN PVOID HwContext OPTIONAL);
641
642SCSIPORTAPI
643VOID
644NTAPI
645ScsiPortIoMapTransfer(
646 IN PVOID HwDeviceExtension,
647 IN PSCSI_REQUEST_BLOCK Srb,
648 IN PVOID LogicalAddress,
649 IN ULONG Length);
650
651SCSIPORTAPI
652VOID
653NTAPI
654ScsiPortLogError(
655 IN PVOID HwDeviceExtension,
656 IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
657 IN UCHAR PathId,
658 IN UCHAR TargetId,
659 IN UCHAR Lun,
660 IN ULONG ErrorCode,
661 IN ULONG UniqueId);
662
663SCSIPORTAPI
664VOID
665__cdecl
666ScsiPortNotification(
667 IN SCSI_NOTIFICATION_TYPE NotificationType,
668 IN PVOID HwDeviceExtension,
669 IN ...);
670
671SCSIPORTAPI
672VOID
673NTAPI
674ScsiPortQuerySystemTime(
675 OUT PLARGE_INTEGER CurrentTime);
676
677SCSIPORTAPI
678ULONG
679NTAPI
680ScsiPortSetBusDataByOffset(
681 IN PVOID DeviceExtension,
682 IN ULONG BusDataType,
683 IN ULONG SystemIoBusNumber,
684 IN ULONG SlotNumber,
685 IN PVOID Buffer,
686 IN ULONG Offset,
687 IN ULONG Length);
688
689SCSIPORTAPI
690VOID
691NTAPI
692ScsiPortStallExecution(
693 IN ULONG Delay);
694
695SCSIPORTAPI
696BOOLEAN
697NTAPI
698ScsiPortValidateRange(
699 IN PVOID HwDeviceExtension,
700 IN INTERFACE_TYPE BusType,
701 IN ULONG SystemIoBusNumber,
702 IN SCSI_PHYSICAL_ADDRESS IoAddress,
703 IN ULONG NumberOfBytes,
704 IN BOOLEAN InIoSpace);
705
706SCSIPORTAPI
707VOID
708__cdecl
709ScsiDebugPrint(
710 IN ULONG DebugPrintLevel,
711 IN PCCHAR DebugMessage,
712 IN ...);
713
714#if defined(_M_AMD64)
715
716#define ScsiPortReadPortUchar READ_PORT_UCHAR
717#define ScsiPortReadPortUshort READ_PORT_USHORT
718#define ScsiPortReadPortUlong READ_PORT_ULONG
719
720#define ScsiPortReadPortBufferUchar READ_PORT_BUFFER_UCHAR
721#define ScsiPortReadPortBufferUshort READ_PORT_BUFFER_USHORT
722#define ScsiPortReadPortBufferUlong READ_PORT_BUFFER_ULONG
723
724#define ScsiPortReadRegisterUchar READ_REGISTER_UCHAR
725#define ScsiPortReadRegisterUshort READ_REGISTER_USHORT
726#define ScsiPortReadRegisterUlong READ_REGISTER_ULONG
727
728#define ScsiPortReadRegisterBufferUchar READ_REGISTER_BUFFER_UCHAR
729#define ScsiPortReadRegisterBufferUshort READ_REGISTER_BUFFER_USHORT
730#define ScsiPortReadRegisterBufferUlong READ_REGISTER_BUFFER_ULONG
731
732#define ScsiPortWritePortUchar WRITE_PORT_UCHAR
733#define ScsiPortWritePortUshort WRITE_PORT_USHORT
734#define ScsiPortWritePortUlong WRITE_PORT_ULONG
735
736#define ScsiPortWritePortBufferUchar WRITE_PORT_BUFFER_UCHAR
737#define ScsiPortWritePortBufferUshort WRITE_PORT_BUFFER_USHORT
738#define ScsiPortWritePortBufferUlong WRITE_PORT_BUFFER_ULONG
739
740#define ScsiPortWriteRegisterUchar WRITE_REGISTER_UCHAR
741#define ScsiPortWriteRegisterUshort WRITE_REGISTER_USHORT
742#define ScsiPortWriteRegisterUlong WRITE_REGISTER_ULONG
743
744#define ScsiPortWriteRegisterBufferUchar WRITE_REGISTER_BUFFER_UCHAR
745#define ScsiPortWriteRegisterBufferUshort WRITE_REGISTER_BUFFER_USHORT
746#define ScsiPortWriteRegisterBufferUlong WRITE_REGISTER_BUFFER_ULONG
747
748#define ScsiPortMoveMemory memmove
749
750#else
751
752SCSIPORTAPI
753UCHAR
754NTAPI
755ScsiPortReadPortUchar(
756 IN PUCHAR Port);
757
758SCSIPORTAPI
759ULONG
760NTAPI
761ScsiPortReadPortUlong(
762 IN PULONG Port);
763
764SCSIPORTAPI
765USHORT
766NTAPI
767ScsiPortReadPortUshort(
768 IN PUSHORT Port);
769
770SCSIPORTAPI
771VOID
772NTAPI
773ScsiPortReadPortBufferUchar(
774 IN PUCHAR Port,
775 IN PUCHAR Buffer,
776 IN ULONG Count);
777
778SCSIPORTAPI
779VOID
780NTAPI
781ScsiPortReadPortBufferUlong(
782 IN PULONG Port,
783 IN PULONG Buffer,
784 IN ULONG Count);
785
786SCSIPORTAPI
787VOID
788NTAPI
789ScsiPortReadPortBufferUshort(
790 IN PUSHORT Port,
791 IN PUSHORT Buffer,
792 IN ULONG Count);
793
794SCSIPORTAPI
795UCHAR
796NTAPI
797ScsiPortReadRegisterUchar(
798 IN PUCHAR Register);
799
800SCSIPORTAPI
801ULONG
802NTAPI
803ScsiPortReadRegisterUlong(
804 IN PULONG Register);
805
806SCSIPORTAPI
807USHORT
808NTAPI
809ScsiPortReadRegisterUshort(
810 IN PUSHORT Register);
811
812SCSIPORTAPI
813VOID
814NTAPI
815ScsiPortReadRegisterBufferUchar(
816 IN PUCHAR Register,
817 IN PUCHAR Buffer,
818 IN ULONG Count);
819
820SCSIPORTAPI
821VOID
822NTAPI
823ScsiPortReadRegisterBufferUlong(
824 IN PULONG Register,
825 IN PULONG Buffer,
826 IN ULONG Count);
827
828SCSIPORTAPI
829VOID
830NTAPI
831ScsiPortReadRegisterBufferUshort(
832 IN PUSHORT Register,
833 IN PUSHORT Buffer,
834 IN ULONG Count);
835
836SCSIPORTAPI
837VOID
838NTAPI
839ScsiPortWritePortUchar(
840 IN PUCHAR Port,
841 IN UCHAR Value);
842
843SCSIPORTAPI
844VOID
845NTAPI
846ScsiPortWritePortUlong(
847 IN PULONG Port,
848 IN ULONG Value);
849
850SCSIPORTAPI
851VOID
852NTAPI
853ScsiPortWritePortUshort(
854 IN PUSHORT Port,
855 IN USHORT Value);
856
857SCSIPORTAPI
858VOID
859NTAPI
860ScsiPortWritePortBufferUchar(
861 IN PUCHAR Port,
862 IN PUCHAR Buffer,
863 IN ULONG Count);
864
865SCSIPORTAPI
866VOID
867NTAPI
868ScsiPortWritePortBufferUlong(
869 IN PULONG Port,
870 IN PULONG Buffer,
871 IN ULONG Count);
872
873SCSIPORTAPI
874VOID
875NTAPI
876ScsiPortWritePortBufferUshort(
877 IN PUSHORT Port,
878 IN PUSHORT Buffer,
879 IN ULONG Count);
880
881SCSIPORTAPI
882VOID
883NTAPI
884ScsiPortWriteRegisterUchar(
885 IN PUCHAR Register,
886 IN UCHAR Value);
887
888SCSIPORTAPI
889VOID
890NTAPI
891ScsiPortWriteRegisterUlong(
892 IN PULONG Register,
893 IN ULONG Value);
894
895SCSIPORTAPI
896VOID
897NTAPI
898ScsiPortWriteRegisterUshort(
899 IN PUSHORT Register,
900 IN USHORT Value);
901
902SCSIPORTAPI
903VOID
904NTAPI
905ScsiPortWriteRegisterBufferUchar(
906 IN PUCHAR Register,
907 IN PUCHAR Buffer,
908 IN ULONG Count);
909
910SCSIPORTAPI
911VOID
912NTAPI
913ScsiPortWriteRegisterBufferUlong(
914 IN PULONG Register,
915 IN PULONG Buffer,
916 IN ULONG Count);
917
918SCSIPORTAPI
919VOID
920NTAPI
921ScsiPortWriteRegisterBufferUshort(
922 IN PUSHORT Register,
923 IN PUSHORT Buffer,
924 IN ULONG Count);
925
926SCSIPORTAPI
927VOID
928NTAPI
929ScsiPortMoveMemory(
930 IN PVOID WriteBuffer,
931 IN PVOID ReadBuffer,
932 IN ULONG Length);
933
934#endif /* defined(_M_AMD64) */
935
936#ifdef __cplusplus
937}
938#endif
939
940#endif /* _NTSRB_ */
Note: See TracBrowser for help on using the repository browser.