- Move atsmedia.h to PSDK, introduce pragma once and remove the comments block and...
[reactos.git] / drivers / storage / ide / uniata / srb.h
1 /*
2 Module Name:
3
4 srb.h
5
6 Abstract:
7
8 This file defines the interface between SCSI mini-port drivers and the
9 SCSI port driver. It is also used by SCSI class drivers to talk to the
10 SCSI port driver.
11 w2k-related definitions are added by Alter from w2k/xp DDK
12 */
13
14 #ifndef _NTSRB_
15 #define _NTSRB_
16
17 // Define SCSI maximum configuration parameters.
18
19 #define SCSI_MAXIMUM_LOGICAL_UNITS 8
20 #define SCSI_MAXIMUM_TARGETS_PER_BUS 128
21 #define SCSI_MAXIMUM_LUNS_PER_TARGET 255
22 #define SCSI_MAXIMUM_BUSES 8
23 #define SCSI_MINIMUM_PHYSICAL_BREAKS 16
24 #define SCSI_MAXIMUM_PHYSICAL_BREAKS 255
25
26 // This constant is for backward compatibility.
27 // This use to be the maximum number of targets supported.
28
29 #define SCSI_MAXIMUM_TARGETS 8
30 // begin_ntminitape
31 #define MAXIMUM_CDB_SIZE 12
32 // end_ntminitape
33
34 #ifndef USER_MODE
35
36 typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS;
37
38 typedef struct _ACCESS_RANGE {
39 SCSI_PHYSICAL_ADDRESS RangeStart;
40 ULONG RangeLength;
41 BOOLEAN RangeInMemory;
42 }ACCESS_RANGE, *PACCESS_RANGE;
43
44 //
45 // Configuration information structure. Contains the information necessary
46 // to initialize the adapter. NOTE: This structure's must be a multiple of
47 // quadwords.
48 //
49
50 typedef struct _PORT_CONFIGURATION_INFORMATION {
51 ULONG Length; // Length of port configuation information strucuture.
52 ULONG SystemIoBusNumber; // IO bus number (0 for machines that have only 1 IO bus
53 INTERFACE_TYPE AdapterInterfaceType; // EISA, MCA or ISA
54 ULONG BusInterruptLevel; // Interrupt request level for device
55 // Bus interrupt vector used with hardware buses which use as vector as
56 // well as level, such as internal buses.
57 ULONG BusInterruptVector;
58 KINTERRUPT_MODE InterruptMode; // Interrupt mode (level-sensitive or edge-triggered)
59
60 ULONG MaximumTransferLength; // Max bytes that can be transferred in a single SRB
61 ULONG NumberOfPhysicalBreaks; // Number of contiguous blocks of physical memory
62 ULONG DmaChannel; // DMA channel for devices using system DMA
63 ULONG DmaPort;
64 DMA_WIDTH DmaWidth;
65 DMA_SPEED DmaSpeed;
66 ULONG AlignmentMask; // Alignment masked for the adapter for data transfers.
67 ULONG NumberOfAccessRanges; // Number of allocated access range elements.
68 ACCESS_RANGE (*AccessRanges)[]; // Pointer to array of access range elements.
69 PVOID Reserved;
70 UCHAR NumberOfBuses; // Number of SCSI buses attached to the adapter.
71 CCHAR InitiatorBusId[8]; // SCSI bus ID for adapter
72 BOOLEAN ScatterGather; // Indicates that the adapter does scatter/gather
73 BOOLEAN Master; // Indicates that the adapter is a bus master
74 BOOLEAN CachesData; // Host caches data or state.
75 BOOLEAN AdapterScansDown; // Host adapter scans down for bios devices.
76 BOOLEAN AtdiskPrimaryClaimed; // Primary at disk address (0x1F0) claimed.
77 BOOLEAN AtdiskSecondaryClaimed; // Secondary at disk address (0x170) claimed.
78 BOOLEAN Dma32BitAddresses; // The master uses 32-bit DMA addresses.
79 BOOLEAN DemandMode; // Use Demand Mode DMA rather than Single Request.
80 BOOLEAN MapBuffers; // Data buffers must be mapped into virtual address space.
81 BOOLEAN NeedPhysicalAddresses; // We need to tranlate virtual to physical addresses.
82 BOOLEAN TaggedQueuing; // Supports tagged queuing
83 BOOLEAN AutoRequestSense; // Supports auto request sense.
84 BOOLEAN MultipleRequestPerLu; // Supports multiple requests per logical unit.
85 BOOLEAN ReceiveEvent; // Support receive event function.
86 BOOLEAN RealModeInitialized; // Indicates the real-mode driver has initialized the card.
87
88 BOOLEAN BufferAccessScsiPortControlled; // Indicate that the miniport will not touch
89 // the data buffers directly.
90 UCHAR MaximumNumberOfTargets; // Indicator for wide scsi.
91 UCHAR ReservedUchars[2]; // Ensure quadword alignment.
92 ULONG SlotNumber; // Adapter slot number
93 ULONG BusInterruptLevel2; // Interrupt information for a second IRQ.
94 ULONG BusInterruptVector2;
95 KINTERRUPT_MODE InterruptMode2;
96 ULONG DmaChannel2; // DMA information for a second channel.
97 ULONG DmaPort2;
98 DMA_WIDTH DmaWidth2;
99 DMA_SPEED DmaSpeed2;
100
101 } PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION;
102
103 typedef struct _PORT_CONFIGURATION_INFORMATION_NT {
104 // Fields added to allow for the miniport
105 // to update these sizes based on requirements
106 // for large transfers ( > 64K);
107 ULONG DeviceExtensionSize;
108 ULONG SpecificLuExtensionSize;
109 ULONG SrbExtensionSize;
110 } PORT_CONFIGURATION_INFORMATION_NT, *PPORT_CONFIGURATION_INFORMATION_NT;
111
112 typedef struct _PORT_CONFIGURATION_INFORMATION_2K {
113 // Used to determine whether the system and/or the miniport support
114 // 64-bit physical addresses. See SCSI_DMA64_* flags below.
115 UCHAR Dma64BitAddresses;
116 // Indicates that the miniport can accept a SRB_FUNCTION_RESET_DEVICE
117 // to clear all requests to a particular LUN.
118 BOOLEAN ResetTargetSupported;
119 // Indicates that the miniport can support more than 8 logical units per
120 // target (maximum LUN number is one less than this field).
121 UCHAR MaximumNumberOfLogicalUnits;
122 // Supports WMI?
123 BOOLEAN WmiDataProvider;
124 } PORT_CONFIGURATION_INFORMATION_2K, *PPORT_CONFIGURATION_INFORMATION_2K;
125
126 typedef struct _PORT_CONFIGURATION_INFORMATION_COMMON {
127 PORT_CONFIGURATION_INFORMATION comm;
128 PORT_CONFIGURATION_INFORMATION_NT nt4;
129 PORT_CONFIGURATION_INFORMATION_2K w2k;
130 } PORT_CONFIGURATION_INFORMATION_COMMON, *PPORT_CONFIGURATION_INFORMATION_COMMON;
131
132 //
133 // Version control for ConfigInfo structure.
134 //
135
136 #define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION)
137
138 //
139 // Flags for controlling 64-bit DMA use (PORT_CONFIGURATION_INFORMATION field
140 // Dma64BitAddresses)
141 //
142
143 //
144 // Set by scsiport on entering HwFindAdapter if the system can support 64-bit
145 // physical addresses. The miniport can use this information before calling
146 // ScsiPortGetUncachedExtension to modify the DeviceExtensionSize,
147 // SpecificLuExtensionSize & SrbExtensionSize fields to account for the extra
148 // size of the scatter gather list.
149 //
150
151 #define SCSI_DMA64_SYSTEM_SUPPORTED 0x80
152
153 //
154 // Set by the miniport before calling ScsiPortGetUncachedExtension to indicate
155 // that scsiport should provide it with 64-bit physical addresses. If the
156 // system does not support 64-bit PA's then this bit will be ignored.
157 //
158
159 #define SCSI_DMA64_MINIPORT_SUPPORTED 0x01
160
161
162 //
163 // Command type (and parameter) definition(s) for AdapterControl requests.
164 //
165
166 typedef enum _SCSI_ADAPTER_CONTROL_TYPE {
167 ScsiQuerySupportedControlTypes = 0,
168 ScsiStopAdapter,
169 ScsiRestartAdapter,
170 ScsiSetBootConfig,
171 ScsiSetRunningConfig,
172 ScsiAdapterControlMax,
173 MakeAdapterControlTypeSizeOfUlong = 0xffffffff
174 } SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE;
175
176 //
177 // Adapter control status values
178 //
179
180 typedef enum _SCSI_ADAPTER_CONTROL_STATUS {
181 ScsiAdapterControlSuccess = 0,
182 ScsiAdapterControlUnsuccessful
183 } SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS;
184
185 //
186 // Parameters for Adapter Control Functions:
187 //
188
189 //
190 // ScsiQuerySupportedControlTypes:
191 //
192
193 #ifdef _MSC_VER
194 #pragma warning(disable:4200)
195 #endif
196 typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST {
197
198 //
199 // Specifies the number of entries in the adapter control type list.
200 //
201
202 IN ULONG MaxControlType;
203
204 //
205 // The miniport will set TRUE for each control type it supports.
206 // The number of entries in this array is defined by MaxAdapterControlType
207 // - the miniport must not attempt to set any AC types beyond the maximum
208 // value specified.
209 //
210
211 OUT BOOLEAN SupportedTypeList[0];
212
213 } SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST;
214 #ifdef _MSC_VER
215 #pragma warning(disable:4200)
216 #endif
217
218 //
219 // Uninitialized flag value.
220 //
221
222 #define SP_UNINITIALIZED_VALUE ((ULONG) ~0)
223 #define SP_UNTAGGED ((UCHAR) ~0)
224
225 //
226 // Set asynchronous events.
227 //
228
229 #define SRBEV_BUS_RESET 0x0001
230 #define SRBEV_SCSI_ASYNC_NOTIFICATION 0x0002
231
232 // begin_ntminitape
233
234 //
235 // SCSI I/O Request Block
236 //
237
238 typedef struct _SCSI_REQUEST_BLOCK {
239 USHORT Length; // offset 0
240 UCHAR Function; // offset 2
241 UCHAR SrbStatus; // offset 3
242 UCHAR ScsiStatus; // offset 4
243 UCHAR PathId; // offset 5
244 UCHAR TargetId; // offset 6
245 UCHAR Lun; // offset 7
246 UCHAR QueueTag; // offset 8
247 UCHAR QueueAction; // offset 9
248 UCHAR CdbLength; // offset a
249 UCHAR SenseInfoBufferLength; // offset b
250 ULONG SrbFlags; // offset c
251 ULONG DataTransferLength; // offset 10
252 ULONG TimeOutValue; // offset 14
253 PVOID DataBuffer; // offset 18
254 PVOID SenseInfoBuffer; // offset 1c
255 struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20
256 PVOID OriginalRequest; // offset 24
257 PVOID SrbExtension; // offset 28
258 union {
259 ULONG InternalStatus; // offset 2c
260 ULONG QueueSortKey; // offset 2c
261 };
262
263 #if defined(_WIN64)
264 // Force PVOID alignment of Cdb
265 ULONG Reserved;
266
267 #endif
268
269 UCHAR Cdb[16]; // offset 30
270 } SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
271
272 #define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK)
273
274 //
275 // SCSI I/O Request Block for WMI Requests
276 //
277
278 typedef struct _SCSI_WMI_REQUEST_BLOCK {
279 USHORT Length;
280 UCHAR Function; // SRB_FUNCTION_WMI
281 UCHAR SrbStatus;
282 UCHAR WMISubFunction;
283 UCHAR PathId; // If SRB_WMI_FLAGS_ADAPTER_REQUEST is set in
284 UCHAR TargetId; // WMIFlags then PathId, TargetId and Lun are
285 UCHAR Lun; // reserved fields.
286 UCHAR Reserved1;
287 UCHAR WMIFlags;
288 UCHAR Reserved2[2];
289 ULONG SrbFlags;
290 ULONG DataTransferLength;
291 ULONG TimeOutValue;
292 PVOID DataBuffer;
293 PVOID DataPath;
294 PVOID Reserved3;
295 PVOID OriginalRequest;
296 PVOID SrbExtension;
297 ULONG Reserved4;
298 UCHAR Reserved5[16];
299 } SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
300
301 //
302 // SRB Functions
303 //
304
305 #define SRB_FUNCTION_EXECUTE_SCSI 0x00
306 #define SRB_FUNCTION_CLAIM_DEVICE 0x01
307 #define SRB_FUNCTION_IO_CONTROL 0x02
308 #define SRB_FUNCTION_RECEIVE_EVENT 0x03
309 #define SRB_FUNCTION_RELEASE_QUEUE 0x04
310 #define SRB_FUNCTION_ATTACH_DEVICE 0x05
311 #define SRB_FUNCTION_RELEASE_DEVICE 0x06
312 #define SRB_FUNCTION_SHUTDOWN 0x07
313 #define SRB_FUNCTION_FLUSH 0x08
314 #define SRB_FUNCTION_ABORT_COMMAND 0x10
315 #define SRB_FUNCTION_RELEASE_RECOVERY 0x11
316 #define SRB_FUNCTION_RESET_BUS 0x12
317 #define SRB_FUNCTION_RESET_DEVICE 0x13
318 #define SRB_FUNCTION_TERMINATE_IO 0x14
319 #define SRB_FUNCTION_FLUSH_QUEUE 0x15
320 #define SRB_FUNCTION_REMOVE_DEVICE 0x16
321 #define SRB_FUNCTION_WMI 0x17
322 #define SRB_FUNCTION_LOCK_QUEUE 0x18
323 #define SRB_FUNCTION_UNLOCK_QUEUE 0x19
324 #define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20
325
326 //
327 // SRB Status
328 //
329
330 #define SRB_STATUS_PENDING 0x00
331 #define SRB_STATUS_SUCCESS 0x01
332 #define SRB_STATUS_ABORTED 0x02
333 #define SRB_STATUS_ABORT_FAILED 0x03
334 #define SRB_STATUS_ERROR 0x04
335 #define SRB_STATUS_BUSY 0x05
336 #define SRB_STATUS_INVALID_REQUEST 0x06
337 #define SRB_STATUS_INVALID_PATH_ID 0x07
338 #define SRB_STATUS_NO_DEVICE 0x08
339 #define SRB_STATUS_TIMEOUT 0x09
340 #define SRB_STATUS_SELECTION_TIMEOUT 0x0A
341 #define SRB_STATUS_COMMAND_TIMEOUT 0x0B
342 #define SRB_STATUS_MESSAGE_REJECTED 0x0D
343 #define SRB_STATUS_BUS_RESET 0x0E
344 #define SRB_STATUS_PARITY_ERROR 0x0F
345 #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
346 #define SRB_STATUS_NO_HBA 0x11
347 #define SRB_STATUS_DATA_OVERRUN 0x12
348 #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
349 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
350 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
351 #define SRB_STATUS_REQUEST_FLUSHED 0x16
352 #define SRB_STATUS_INVALID_LUN 0x20
353 #define SRB_STATUS_INVALID_TARGET_ID 0x21
354 #define SRB_STATUS_BAD_FUNCTION 0x22
355 #define SRB_STATUS_ERROR_RECOVERY 0x23
356 #define SRB_STATUS_NOT_POWERED 0x24
357
358 //
359 // This value is used by the port driver to indicate that a non-scsi-related
360 // error occured. Miniports must never return this status.
361 //
362
363 #define SRB_STATUS_INTERNAL_ERROR 0x30
364
365 //
366 // Srb status values 0x38 through 0x3f are reserved for internal port driver
367 // use.
368 //
369
370
371
372 //
373 // SRB Status Masks
374 //
375
376 #define SRB_STATUS_QUEUE_FROZEN 0x40
377 #define SRB_STATUS_AUTOSENSE_VALID 0x80
378
379 #define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
380
381 //
382 // SRB Flag Bits
383 //
384
385 #define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002
386 #define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004
387 #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
388 #define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010
389 #define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
390 #define SRB_FLAGS_DATA_IN 0x00000040
391 #define SRB_FLAGS_DATA_OUT 0x00000080
392 #define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
393 #define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT)
394 #define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100
395 #define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200
396 #define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400
397 #define SRB_FLAGS_IS_ACTIVE 0x00010000
398 #define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000
399 #define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000
400 #define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000
401
402 #define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000
403 #define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000
404 #define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000
405 #define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000
406
407 #define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000
408 #define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000
409 //
410 // Queue Action
411 //
412
413 #define SRB_SIMPLE_TAG_REQUEST 0x20
414 #define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21
415 #define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22
416
417 #define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x01
418
419 // end_ntminitape
420
421 //
422 // SCSI Adapter Dependent Routines
423 //
424
425 typedef
426 BOOLEAN
427 (NTAPI *PHW_INITIALIZE) (
428 IN PVOID DeviceExtension
429 );
430
431 typedef
432 BOOLEAN
433 (NTAPI *PHW_STARTIO) (
434 IN PVOID DeviceExtension,
435 IN PSCSI_REQUEST_BLOCK Srb
436 );
437
438 typedef
439 BOOLEAN
440 (NTAPI *PHW_INTERRUPT) (
441 IN PVOID DeviceExtension
442 );
443
444 typedef
445 VOID
446 (NTAPI *PHW_TIMER) (
447 IN PVOID DeviceExtension
448 );
449
450 typedef
451 VOID
452 (NTAPI *PHW_DMA_STARTED) (
453 IN PVOID DeviceExtension
454 );
455
456 typedef
457 ULONG
458 (NTAPI *PHW_FIND_ADAPTER) (
459 IN PVOID DeviceExtension,
460 IN PVOID HwContext,
461 IN PVOID BusInformation,
462 IN PCHAR ArgumentString,
463 IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
464 OUT PBOOLEAN Again
465 );
466
467 typedef
468 BOOLEAN
469 (NTAPI *PHW_RESET_BUS) (
470 IN PVOID DeviceExtension,
471 IN ULONG PathId
472 );
473
474 typedef
475 BOOLEAN
476 (NTAPI *PHW_ADAPTER_STATE) (
477 IN PVOID DeviceExtension,
478 IN PVOID Context,
479 IN BOOLEAN SaveState
480 );
481
482 typedef
483 SCSI_ADAPTER_CONTROL_STATUS
484 (NTAPI *PHW_ADAPTER_CONTROL) (
485 IN PVOID DeviceExtension,
486 IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
487 IN PVOID Parameters
488 );
489
490 //
491 // Port driver error codes
492 //
493
494 #define SP_BUS_PARITY_ERROR 0x0001
495 #define SP_UNEXPECTED_DISCONNECT 0x0002
496 #define SP_INVALID_RESELECTION 0x0003
497 #define SP_BUS_TIME_OUT 0x0004
498 #define SP_PROTOCOL_ERROR 0x0005
499 #define SP_INTERNAL_ADAPTER_ERROR 0x0006
500 #define SP_REQUEST_TIMEOUT 0x0007
501 #define SP_IRQ_NOT_RESPONDING 0x0008
502 #define SP_BAD_FW_WARNING 0x0009
503 #define SP_BAD_FW_ERROR 0x000a
504 #define SP_LOST_WMI_MINIPORT_REQUEST 0x000b
505
506
507 //
508 // Return values for SCSI_HW_FIND_ADAPTER.
509 //
510
511 #define SP_RETURN_NOT_FOUND 0
512 #define SP_RETURN_FOUND 1
513 #define SP_RETURN_ERROR 2
514 #define SP_RETURN_BAD_CONFIG 3
515
516 //
517 // Notification Event Types
518 //
519
520 typedef enum _SCSI_NOTIFICATION_TYPE {
521 RequestComplete,
522 NextRequest,
523 NextLuRequest,
524 ResetDetected,
525 CallDisableInterrupts,
526 CallEnableInterrupts,
527 RequestTimerCall,
528 BusChangeDetected, /* New */
529 WMIEvent,
530 WMIReregister
531 } SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE;
532
533 //
534 // Structure passed between miniport initialization
535 // and SCSI port initialization
536 //
537
538 typedef struct _HW_INITIALIZATION_DATA {
539
540 ULONG HwInitializationDataSize;
541 // Adapter interface type:
542 //
543 // Internal
544 // Isa
545 // Eisa
546 // MicroChannel
547 // TurboChannel
548 // PCIBus
549 // VMEBus
550 // NuBus
551 // PCMCIABus
552 // CBus
553 // MPIBus
554 // MPSABus
555 INTERFACE_TYPE AdapterInterfaceType;
556 // Miniport driver routines
557 PHW_INITIALIZE HwInitialize;
558 PHW_STARTIO HwStartIo;
559 PHW_INTERRUPT HwInterrupt;
560 PHW_FIND_ADAPTER HwFindAdapter;
561 PHW_RESET_BUS HwResetBus;
562 PHW_DMA_STARTED HwDmaStarted;
563 PHW_ADAPTER_STATE HwAdapterState;
564 ULONG DeviceExtensionSize;
565 ULONG SpecificLuExtensionSize;
566 ULONG SrbExtensionSize;
567 ULONG NumberOfAccessRanges;
568 PVOID Reserved;
569
570 BOOLEAN MapBuffers; // Data buffers must be mapped into virtual address space.
571 BOOLEAN NeedPhysicalAddresses; // We need to tranlate virtual to physical addresses.
572 BOOLEAN TaggedQueuing; // Supports tagged queuing
573 BOOLEAN AutoRequestSense; // Supports auto request sense.
574 BOOLEAN MultipleRequestPerLu; // Supports multiple requests per logical unit.
575 BOOLEAN ReceiveEvent; // Support receive event function.
576 USHORT VendorIdLength; // Vendor identification length
577 PVOID VendorId; // Vendor identification
578 USHORT ReservedUshort; // Pad for alignment and future use.
579 USHORT DeviceIdLength; // Device identification length
580 PVOID DeviceId; // Device identification
581
582 } HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA;
583
584 typedef struct _HW_INITIALIZATION_DATA_2K {
585 // Stop adapter routine.
586 PHW_ADAPTER_CONTROL HwAdapterControl;
587
588 } HW_INITIALIZATION_DATA_2K, *PHW_INITIALIZATION_DATA_2K;
589
590 typedef struct _HW_INITIALIZATION_DATA_COMMON {
591 HW_INITIALIZATION_DATA comm;
592 HW_INITIALIZATION_DATA_2K w2k;
593 }HW_INITIALIZATION_DATA_COMMON, *PHW_INITIALIZATION_DATA_COMMON;
594
595 // begin_ntminitape
596
597 #ifndef _NTDDK_
598 #define SCSIPORT_API DECLSPEC_IMPORT
599 #else
600 #define SCSIPORT_API
601 #endif
602
603 // end_ntminitape
604
605 //
606 // Port driver routines called by miniport driver
607 //
608
609 SCSIPORT_API
610 ULONG NTAPI
611 ScsiPortInitialize(
612 IN PVOID Argument1,
613 IN PVOID Argument2,
614 IN struct _HW_INITIALIZATION_DATA *HwInitializationData,
615 IN PVOID HwContext
616 );
617
618 SCSIPORT_API
619 VOID NTAPI
620 ScsiPortFreeDeviceBase(
621 IN PVOID HwDeviceExtension,
622 IN PVOID MappedAddress
623 );
624
625 SCSIPORT_API
626 ULONG NTAPI
627 ScsiPortGetBusData(
628 IN PVOID DeviceExtension,
629 IN ULONG BusDataType,
630 IN ULONG SystemIoBusNumber,
631 IN ULONG SlotNumber,
632 IN PVOID Buffer,
633 IN ULONG Length
634 );
635
636 SCSIPORT_API
637 ULONG NTAPI
638 ScsiPortSetBusDataByOffset(
639 IN PVOID DeviceExtension,
640 IN ULONG BusDataType,
641 IN ULONG SystemIoBusNumber,
642 IN ULONG SlotNumber,
643 IN PVOID Buffer,
644 IN ULONG Offset,
645 IN ULONG Length
646 );
647
648 SCSIPORT_API
649 PVOID NTAPI
650 ScsiPortGetDeviceBase(
651 IN PVOID HwDeviceExtension,
652 IN INTERFACE_TYPE BusType,
653 IN ULONG SystemIoBusNumber,
654 IN SCSI_PHYSICAL_ADDRESS IoAddress,
655 IN ULONG NumberOfBytes,
656 IN BOOLEAN InIoSpace
657 );
658
659 SCSIPORT_API
660 PVOID NTAPI
661 ScsiPortGetLogicalUnit(
662 IN PVOID HwDeviceExtension,
663 IN UCHAR PathId,
664 IN UCHAR TargetId,
665 IN UCHAR Lun
666 );
667
668 SCSIPORT_API
669 PSCSI_REQUEST_BLOCK NTAPI
670 ScsiPortGetSrb(
671 IN PVOID DeviceExtension,
672 IN UCHAR PathId,
673 IN UCHAR TargetId,
674 IN UCHAR Lun,
675 IN LONG QueueTag
676 );
677
678 SCSIPORT_API
679 SCSI_PHYSICAL_ADDRESS NTAPI
680 ScsiPortGetPhysicalAddress(
681 IN PVOID HwDeviceExtension,
682 IN PSCSI_REQUEST_BLOCK Srb,
683 IN PVOID VirtualAddress,
684 OUT ULONG *Length
685 );
686
687 SCSIPORT_API
688 PVOID NTAPI
689 ScsiPortGetVirtualAddress(
690 IN PVOID HwDeviceExtension,
691 IN SCSI_PHYSICAL_ADDRESS PhysicalAddress
692 );
693
694 SCSIPORT_API
695 PVOID NTAPI
696 ScsiPortGetUncachedExtension(
697 IN PVOID HwDeviceExtension,
698 IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
699 IN ULONG NumberOfBytes
700 );
701
702 SCSIPORT_API
703 VOID NTAPI
704 ScsiPortFlushDma(
705 IN PVOID DeviceExtension
706 );
707
708 SCSIPORT_API
709 VOID NTAPI
710 ScsiPortIoMapTransfer(
711 IN PVOID HwDeviceExtension,
712 IN PSCSI_REQUEST_BLOCK Srb,
713 IN PVOID LogicalAddress,
714 IN ULONG Length
715 );
716
717 SCSIPORT_API
718 VOID __cdecl
719 ScsiPortNotification(
720 IN SCSI_NOTIFICATION_TYPE NotificationType,
721 IN PVOID HwDeviceExtension,
722 ...
723 );
724
725 SCSIPORT_API
726 VOID NTAPI
727 ScsiPortLogError(
728 IN PVOID HwDeviceExtension,
729 IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
730 IN UCHAR PathId,
731 IN UCHAR TargetId,
732 IN UCHAR Lun,
733 IN ULONG ErrorCode,
734 IN ULONG UniqueId
735 );
736
737 SCSIPORT_API
738 VOID NTAPI
739 ScsiPortCompleteRequest(
740 IN PVOID HwDeviceExtension,
741 IN UCHAR PathId,
742 IN UCHAR TargetId,
743 IN UCHAR Lun,
744 IN UCHAR SrbStatus
745 );
746
747 SCSIPORT_API
748 VOID NTAPI
749 ScsiPortMoveMemory(
750 IN PVOID WriteBuffer,
751 IN PVOID ReadBuffer,
752 IN ULONG Length
753 );
754
755 SCSIPORT_API
756 UCHAR NTAPI
757 ScsiPortReadPortUchar(
758 IN PUCHAR Port
759 );
760
761 SCSIPORT_API
762 USHORT NTAPI
763 ScsiPortReadPortUshort(
764 IN PUSHORT Port
765 );
766
767 SCSIPORT_API
768 ULONG NTAPI
769 ScsiPortReadPortUlong(
770 IN PULONG Port
771 );
772
773 SCSIPORT_API
774 VOID NTAPI
775 ScsiPortReadPortBufferUchar(
776 IN PUCHAR Port,
777 IN PUCHAR Buffer,
778 IN ULONG Count
779 );
780
781 SCSIPORT_API
782 VOID NTAPI
783 ScsiPortReadPortBufferUshort(
784 IN PUSHORT Port,
785 IN PUSHORT Buffer,
786 IN ULONG Count
787 );
788
789 SCSIPORT_API
790 VOID NTAPI
791 ScsiPortReadPortBufferUlong(
792 IN PULONG Port,
793 IN PULONG Buffer,
794 IN ULONG Count
795 );
796
797 SCSIPORT_API
798 UCHAR NTAPI
799 ScsiPortReadRegisterUchar(
800 IN PUCHAR Register
801 );
802
803 SCSIPORT_API
804 USHORT NTAPI
805 ScsiPortReadRegisterUshort(
806 IN PUSHORT Register
807 );
808
809 SCSIPORT_API
810 ULONG NTAPI
811 ScsiPortReadRegisterUlong(
812 IN PULONG Register
813 );
814
815 SCSIPORT_API
816 VOID NTAPI
817 ScsiPortReadRegisterBufferUchar(
818 IN PUCHAR Register,
819 IN PUCHAR Buffer,
820 IN ULONG Count
821 );
822
823 SCSIPORT_API
824 VOID NTAPI
825 ScsiPortReadRegisterBufferUshort(
826 IN PUSHORT Register,
827 IN PUSHORT Buffer,
828 IN ULONG Count
829 );
830
831 SCSIPORT_API
832 VOID NTAPI
833 ScsiPortReadRegisterBufferUlong(
834 IN PULONG Register,
835 IN PULONG Buffer,
836 IN ULONG Count
837 );
838
839 SCSIPORT_API
840 VOID NTAPI
841 ScsiPortStallExecution(
842 IN ULONG Delay
843 );
844
845 SCSIPORT_API
846 VOID NTAPI
847 ScsiPortWritePortUchar(
848 IN PUCHAR Port,
849 IN UCHAR Value
850 );
851
852 SCSIPORT_API
853 VOID NTAPI
854 ScsiPortWritePortUshort(
855 IN PUSHORT Port,
856 IN USHORT Value
857 );
858
859 SCSIPORT_API
860 VOID NTAPI
861 ScsiPortWritePortUlong(
862 IN PULONG Port,
863 IN ULONG Value
864 );
865
866 SCSIPORT_API
867 VOID NTAPI
868 ScsiPortWritePortBufferUchar(
869 IN PUCHAR Port,
870 IN PUCHAR Buffer,
871 IN ULONG Count
872 );
873
874 SCSIPORT_API
875 VOID NTAPI
876 ScsiPortWritePortBufferUshort(
877 IN PUSHORT Port,
878 IN PUSHORT Buffer,
879 IN ULONG Count
880 );
881
882 SCSIPORT_API
883 VOID NTAPI
884 ScsiPortWritePortBufferUlong(
885 IN PULONG Port,
886 IN PULONG Buffer,
887 IN ULONG Count
888 );
889
890 SCSIPORT_API
891 VOID NTAPI
892 ScsiPortWriteRegisterUchar(
893 IN PUCHAR Register,
894 IN UCHAR Value
895 );
896
897 SCSIPORT_API
898 VOID NTAPI
899 ScsiPortWriteRegisterUshort(
900 IN PUSHORT Register,
901 IN USHORT Value
902 );
903
904 SCSIPORT_API
905 VOID NTAPI
906 ScsiPortWriteRegisterUlong(
907 IN PULONG Register,
908 IN ULONG Value
909 );
910
911 SCSIPORT_API
912 VOID NTAPI
913 ScsiPortWriteRegisterBufferUchar(
914 IN PUCHAR Register,
915 IN PUCHAR Buffer,
916 IN ULONG Count
917 );
918
919 SCSIPORT_API
920 VOID NTAPI
921 ScsiPortWriteRegisterBufferUshort(
922 IN PUSHORT Register,
923 IN PUSHORT Buffer,
924 IN ULONG Count
925 );
926
927 SCSIPORT_API
928 VOID NTAPI
929 ScsiPortWriteRegisterBufferUlong(
930 IN PULONG Register,
931 IN PULONG Buffer,
932 IN ULONG Count
933 );
934
935 SCSIPORT_API
936 SCSI_PHYSICAL_ADDRESS NTAPI
937 ScsiPortConvertUlongToPhysicalAddress(
938 ULONG UlongAddress
939 );
940
941 SCSIPORT_API
942 ULONG NTAPI
943 ScsiPortConvertPhysicalAddressToUlong(
944 SCSI_PHYSICAL_ADDRESS Address
945 );
946
947 #define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart)
948
949 SCSIPORT_API
950 BOOLEAN NTAPI
951 ScsiPortValidateRange(
952 IN PVOID HwDeviceExtension,
953 IN INTERFACE_TYPE BusType,
954 IN ULONG SystemIoBusNumber,
955 IN SCSI_PHYSICAL_ADDRESS IoAddress,
956 IN ULONG NumberOfBytes,
957 IN BOOLEAN InIoSpace
958 );
959
960 // begin_ntminitape
961
962 SCSIPORT_API
963 VOID __cdecl
964 ScsiDebugPrint(
965 ULONG DebugPrintLevel,
966 PCCHAR DebugMessage,
967 ...
968 );
969
970 // end_ntminitape
971
972 #endif //USER_MODE
973
974 #endif //