1 /**
2  * @file srb.h
3  * Copyright 2012, 2013 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 /* Created by Casper S. Hornstrup <chorns@users.sourceforge.net> */
25 #ifndef __SRB_H
26 #define __SRB_H
27 #pragma GCC system_header
28 #include <_mingw.h>
29 
30 /*
31  * Interface between SCSI miniport drivers and the SCSI port driver.
32  */
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #include "ntddk.h"
39 
40 #if defined(_SCSIPORT_)
41   #define SCSIPORTAPI DECLSPEC_EXPORT
42 #else
43   #define SCSIPORTAPI DECLSPEC_IMPORT
44 #endif
45 
46 #ifdef DBG
47 #define DebugPrint(x) ScsiDebugPrint x
48 #else
49 #define DebugPrint(x)
50 #endif
51 
52 typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS;
53 
54 #define SP_UNINITIALIZED_VALUE            ((ULONG) ~0)
55 #define SP_UNTAGGED                       ((UCHAR) ~0)
56 
57 #define SRB_SIMPLE_TAG_REQUEST            0x20
58 #define SRB_HEAD_OF_QUEUE_TAG_REQUEST     0x21
59 #define SRB_ORDERED_QUEUE_TAG_REQUEST     0x22
60 
61 #define SRB_STATUS_QUEUE_FROZEN           0x40
62 #define SRB_STATUS_AUTOSENSE_VALID        0x80
63 
64 #define SRB_STATUS(Status) \
65   (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
66 
67 #define MAXIMUM_CDB_SIZE                  12
68 
69 #ifdef DBG
70 #define SCSI_PORT_SIGNATURE               0x54524f50
71 #endif
72 
73 
74 #define SCSI_MAXIMUM_LOGICAL_UNITS        8
75 #define SCSI_MAXIMUM_TARGETS_PER_BUS      128
76 #define SCSI_MAXIMUM_LUNS_PER_TARGET      255
77 #define SCSI_MAXIMUM_BUSES                8
78 #define SCSI_MINIMUM_PHYSICAL_BREAKS      16
79 #define SCSI_MAXIMUM_PHYSICAL_BREAKS      255
80 #define SCSI_MAXIMUM_TARGETS              8
81 
82 #define SRB_FUNCTION_WMI                  0x17
83 
84 #define SRB_WMI_FLAGS_ADAPTER_REQUEST     0x0001
85 
86 #define SP_BUS_PARITY_ERROR               0x0001
87 #define SP_UNEXPECTED_DISCONNECT          0x0002
88 #define SP_INVALID_RESELECTION            0x0003
89 #define SP_BUS_TIME_OUT                   0x0004
90 #define SP_PROTOCOL_ERROR                 0x0005
91 #define SP_INTERNAL_ADAPTER_ERROR         0x0006
92 #define SP_REQUEST_TIMEOUT                0x0007
93 #define SP_IRQ_NOT_RESPONDING             0x0008
94 #define SP_BAD_FW_WARNING                 0x0009
95 #define SP_BAD_FW_ERROR                   0x000a
96 #define SP_LOST_WMI_MINIPORT_REQUEST      0x000b
97 
98 /* SCSI_REQUEST_BLOCK.Function constants */
99 #define SRB_FUNCTION_EXECUTE_SCSI         0x00
100 #define SRB_FUNCTION_CLAIM_DEVICE         0x01
101 #define SRB_FUNCTION_IO_CONTROL           0x02
102 #define SRB_FUNCTION_RECEIVE_EVENT        0x03
103 #define SRB_FUNCTION_RELEASE_QUEUE        0x04
104 #define SRB_FUNCTION_ATTACH_DEVICE        0x05
105 #define SRB_FUNCTION_RELEASE_DEVICE       0x06
106 #define SRB_FUNCTION_SHUTDOWN             0x07
107 #define SRB_FUNCTION_FLUSH                0x08
108 #define SRB_FUNCTION_ABORT_COMMAND        0x10
109 #define SRB_FUNCTION_RELEASE_RECOVERY     0x11
110 #define SRB_FUNCTION_RESET_BUS            0x12
111 #define SRB_FUNCTION_RESET_DEVICE         0x13
112 #define SRB_FUNCTION_TERMINATE_IO         0x14
113 #define SRB_FUNCTION_FLUSH_QUEUE          0x15
114 #define SRB_FUNCTION_REMOVE_DEVICE        0x16
115 #define SRB_FUNCTION_WMI                  0x17
116 #define SRB_FUNCTION_LOCK_QUEUE           0x18
117 #define SRB_FUNCTION_UNLOCK_QUEUE         0x19
118 #define SRB_FUNCTION_RESET_LOGICAL_UNIT   0x20
119 
120 /* SCSI_REQUEST_BLOCK.SrbStatus constants */
121 #define SRB_STATUS_PENDING                0x00
122 #define SRB_STATUS_SUCCESS                0x01
123 #define SRB_STATUS_ABORTED                0x02
124 #define SRB_STATUS_ABORT_FAILED           0x03
125 #define SRB_STATUS_ERROR                  0x04
126 #define SRB_STATUS_BUSY                   0x05
127 #define SRB_STATUS_INVALID_REQUEST        0x06
128 #define SRB_STATUS_INVALID_PATH_ID        0x07
129 #define SRB_STATUS_NO_DEVICE              0x08
130 #define SRB_STATUS_TIMEOUT                0x09
131 #define SRB_STATUS_SELECTION_TIMEOUT      0x0A
132 #define SRB_STATUS_COMMAND_TIMEOUT        0x0B
133 #define SRB_STATUS_MESSAGE_REJECTED       0x0D
134 #define SRB_STATUS_BUS_RESET              0x0E
135 #define SRB_STATUS_PARITY_ERROR           0x0F
136 #define SRB_STATUS_REQUEST_SENSE_FAILED   0x10
137 #define SRB_STATUS_NO_HBA                 0x11
138 #define SRB_STATUS_DATA_OVERRUN           0x12
139 #define SRB_STATUS_UNEXPECTED_BUS_FREE    0x13
140 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
141 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH   0x15
142 #define SRB_STATUS_REQUEST_FLUSHED        0x16
143 #define SRB_STATUS_INVALID_LUN            0x20
144 #define SRB_STATUS_INVALID_TARGET_ID      0x21
145 #define SRB_STATUS_BAD_FUNCTION           0x22
146 #define SRB_STATUS_ERROR_RECOVERY         0x23
147 #define SRB_STATUS_NOT_POWERED            0x24
148 #define SRB_STATUS_INTERNAL_ERROR         0x30
149 
150 /* SCSI_REQUEST_BLOCK.SrbFlags constants */
151 #define SRB_FLAGS_QUEUE_ACTION_ENABLE       0x00000002
152 #define SRB_FLAGS_DISABLE_DISCONNECT        0x00000004
153 #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER    0x00000008
154 #define SRB_FLAGS_BYPASS_FROZEN_QUEUE       0x00000010
155 #define SRB_FLAGS_DISABLE_AUTOSENSE         0x00000020
156 #define SRB_FLAGS_DATA_IN                   0x00000040
157 #define SRB_FLAGS_DATA_OUT                  0x00000080
158 #define SRB_FLAGS_NO_DATA_TRANSFER          0x00000000
159 #define SRB_FLAGS_UNSPECIFIED_DIRECTION     (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT)
160 #define SRB_FLAGS_NO_QUEUE_FREEZE           0x00000100
161 #define SRB_FLAGS_ADAPTER_CACHE_ENABLE      0x00000200
162 #define SRB_FLAGS_FREE_SENSE_BUFFER         0x00000400
163 #define SRB_FLAGS_IS_ACTIVE                 0x00010000
164 #define SRB_FLAGS_ALLOCATED_FROM_ZONE       0x00020000
165 #define SRB_FLAGS_SGLIST_FROM_POOL          0x00040000
166 #define SRB_FLAGS_BYPASS_LOCKED_QUEUE       0x00080000
167 #define SRB_FLAGS_NO_KEEP_AWAKE             0x00100000
168 #define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE    0x00200000
169 #define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT  0x00400000
170 #define SRB_FLAGS_DONT_START_NEXT_PACKET    0x00800000
171 #define SRB_FLAGS_PORT_DRIVER_RESERVED      0x0F000000
172 #define SRB_FLAGS_CLASS_DRIVER_RESERVED     0xF0000000
173 
174 typedef struct _SCSI_REQUEST_BLOCK {
175   USHORT  Length;
176   UCHAR  Function;
177   UCHAR  SrbStatus;
178   UCHAR  ScsiStatus;
179   UCHAR  PathId;
180   UCHAR  TargetId;
181   UCHAR  Lun;
182   UCHAR  QueueTag;
183   UCHAR  QueueAction;
184   UCHAR  CdbLength;
185   UCHAR  SenseInfoBufferLength;
186   ULONG  SrbFlags;
187   ULONG  DataTransferLength;
188   ULONG  TimeOutValue;
189   PVOID  DataBuffer;
190   PVOID  SenseInfoBuffer;
191   struct _SCSI_REQUEST_BLOCK  *NextSrb;
192   PVOID  OriginalRequest;
193   PVOID  SrbExtension;
194   _ANONYMOUS_UNION union {
195     ULONG  InternalStatus;
196     ULONG  QueueSortKey;
197   } DUMMYUNIONNAME;
198 #if defined(_WIN64)
199   ULONG Reserved;
200 #endif
201   UCHAR  Cdb[16];
202 } SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
203 
204 #define SCSI_REQUEST_BLOCK_SIZE           sizeof(SCSI_REQUEST_BLOCK)
205 
206 typedef struct _ACCESS_RANGE {
207   SCSI_PHYSICAL_ADDRESS  RangeStart;
208   ULONG  RangeLength;
209   BOOLEAN  RangeInMemory;
210 } ACCESS_RANGE, *PACCESS_RANGE;
211 
212 /* PORT_CONFIGURATION_INFORMATION.Dma64BitAddresses constants */
213 #define SCSI_DMA64_MINIPORT_SUPPORTED     0x01
214 #define SCSI_DMA64_SYSTEM_SUPPORTED       0x80
215 
216 typedef struct _PORT_CONFIGURATION_INFORMATION {
217   ULONG  Length;
218   ULONG  SystemIoBusNumber;
219   INTERFACE_TYPE  AdapterInterfaceType;
220   ULONG  BusInterruptLevel;
221   ULONG  BusInterruptVector;
222   KINTERRUPT_MODE  InterruptMode;
223   ULONG  MaximumTransferLength;
224   ULONG  NumberOfPhysicalBreaks;
225   ULONG  DmaChannel;
226   ULONG  DmaPort;
227   DMA_WIDTH  DmaWidth;
228   DMA_SPEED  DmaSpeed;
229   ULONG  AlignmentMask;
230   ULONG  NumberOfAccessRanges;
231   ACCESS_RANGE  (*AccessRanges)[];
232   PVOID  Reserved;
233   UCHAR  NumberOfBuses;
234   UCHAR  InitiatorBusId[8];
235   BOOLEAN  ScatterGather;
236   BOOLEAN  Master;
237   BOOLEAN  CachesData;
238   BOOLEAN  AdapterScansDown;
239   BOOLEAN  AtdiskPrimaryClaimed;
240   BOOLEAN  AtdiskSecondaryClaimed;
241   BOOLEAN  Dma32BitAddresses;
242   BOOLEAN  DemandMode;
243   BOOLEAN  MapBuffers;
244   BOOLEAN  NeedPhysicalAddresses;
245   BOOLEAN  TaggedQueuing;
246   BOOLEAN  AutoRequestSense;
247   BOOLEAN  MultipleRequestPerLu;
248   BOOLEAN  ReceiveEvent;
249   BOOLEAN  RealModeInitialized;
250   BOOLEAN  BufferAccessScsiPortControlled;
251   UCHAR  MaximumNumberOfTargets;
252   UCHAR  ReservedUchars[2];
253   ULONG  SlotNumber;
254   ULONG  BusInterruptLevel2;
255   ULONG  BusInterruptVector2;
256   KINTERRUPT_MODE  InterruptMode2;
257   ULONG  DmaChannel2;
258   ULONG  DmaPort2;
259   DMA_WIDTH  DmaWidth2;
260   DMA_SPEED  DmaSpeed2;
261   ULONG  DeviceExtensionSize;
262   ULONG  SpecificLuExtensionSize;
263   ULONG  SrbExtensionSize;
264   UCHAR  Dma64BitAddresses;
265   BOOLEAN  ResetTargetSupported;
266   UCHAR  MaximumNumberOfLogicalUnits;
267   BOOLEAN  WmiDataProvider;
268 } PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION;
269 
270 #define CONFIG_INFO_VERSION_2             sizeof(PORT_CONFIGURATION_INFORMATION)
271 
272 typedef enum _SCSI_NOTIFICATION_TYPE {
273 	RequestComplete,
274 	NextRequest,
275 	NextLuRequest,
276 	ResetDetected,
277 	CallDisableInterrupts,
278 	CallEnableInterrupts,
279 	RequestTimerCall,
280 	BusChangeDetected,
281 	WMIEvent,
282 	WMIReregister
283 } SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE;
284 
285 __extension__ /* enums limited to range of integer */
286 typedef enum _SCSI_ADAPTER_CONTROL_TYPE {
287 	ScsiQuerySupportedControlTypes = 0,
288 	ScsiStopAdapter,
289 	ScsiRestartAdapter,
290 	ScsiSetBootConfig,
291 	ScsiSetRunningConfig,
292 	ScsiAdapterControlMax,
293 	MakeAdapterControlTypeSizeOfUlong = 0xffffffff
294 } SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE;
295 
296 typedef enum _SCSI_ADAPTER_CONTROL_STATUS {
297 	ScsiAdapterControlSuccess = 0,
298 	ScsiAdapterControlUnsuccessful
299 } SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS;
300 
301 typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST {
302 	ULONG MaxControlType;
303 	BOOLEAN SupportedTypeList[0];
304 } SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST;
305 
306 typedef SCSI_ADAPTER_CONTROL_STATUS DDKAPI
307 (*PHW_ADAPTER_CONTROL)(
308   /*IN*/ PVOID DeviceExtension,
309   /*IN*/ SCSI_ADAPTER_CONTROL_TYPE ControlType,
310   /*IN*/ PVOID Parameters);
311 
312 typedef BOOLEAN DDKAPI
313 (*PHW_ADAPTER_STATE)(
314   /*IN*/ PVOID DeviceExtension,
315   /*IN*/ PVOID Context,
316   /*IN*/ BOOLEAN SaveState);
317 
318 #define SP_RETURN_NOT_FOUND               0
319 #define SP_RETURN_FOUND                   1
320 #define SP_RETURN_ERROR                   2
321 #define SP_RETURN_BAD_CONFIG              3
322 
323 typedef ULONG DDKAPI
324 (*PHW_FIND_ADAPTER)(
325   /*IN*/ PVOID DeviceExtension,
326   /*IN*/ PVOID HwContext,
327   /*IN*/ PVOID BusInformation,
328   /*IN*/ PCHAR ArgumentString,
329   /*IN OUT*/ PPORT_CONFIGURATION_INFORMATION ConfigInfo,
330   /*OUT*/ PBOOLEAN Again);
331 
332 typedef BOOLEAN DDKAPI
333 (*PHW_INITIALIZE)(
334   /*IN*/ PVOID DeviceExtension);
335 
336 typedef BOOLEAN DDKAPI
337 (*PHW_INTERRUPT)(
338   /*IN*/ PVOID DeviceExtension);
339 
340 typedef BOOLEAN DDKAPI
341 (*PHW_RESET_BUS)(
342   /*IN*/ PVOID DeviceExtension,
343   /*IN*/ ULONG PathId);
344 
345 typedef VOID DDKAPI
346 (*PHW_DMA_STARTED)(
347   /*IN*/ PVOID DeviceExtension);
348 
349 typedef BOOLEAN DDKAPI
350 (*PHW_STARTIO)(
351   /*IN*/ PVOID DeviceExtension,
352   /*IN*/ PSCSI_REQUEST_BLOCK Srb);
353 
354 typedef VOID DDKAPI
355 (*PHW_TIMER)(
356   /*IN*/ PVOID DeviceExtension);
357 
358 typedef struct _HW_INITIALIZATION_DATA {
359   ULONG  HwInitializationDataSize;
360   INTERFACE_TYPE  AdapterInterfaceType;
361   PHW_INITIALIZE  HwInitialize;
362   PHW_STARTIO  HwStartIo;
363   PHW_INTERRUPT  HwInterrupt;
364   PHW_FIND_ADAPTER  HwFindAdapter;
365   PHW_RESET_BUS  HwResetBus;
366   PHW_DMA_STARTED  HwDmaStarted;
367   PHW_ADAPTER_STATE  HwAdapterState;
368   ULONG  DeviceExtensionSize;
369   ULONG  SpecificLuExtensionSize;
370   ULONG  SrbExtensionSize;
371   ULONG  NumberOfAccessRanges;
372   PVOID  Reserved;
373   BOOLEAN  MapBuffers;
374   BOOLEAN  NeedPhysicalAddresses;
375   BOOLEAN  TaggedQueuing;
376   BOOLEAN  AutoRequestSense;
377   BOOLEAN  MultipleRequestPerLu;
378   BOOLEAN  ReceiveEvent;
379   USHORT  VendorIdLength;
380   PVOID  VendorId;
381   USHORT  ReservedUshort;
382   USHORT  DeviceIdLength;
383   PVOID  DeviceId;
384   PHW_ADAPTER_CONTROL  HwAdapterControl;
385 } HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA;
386 
387 SCSIPORTAPI
388 VOID
389 DDKAPI
390 ScsiPortCompleteRequest(
391   /*IN*/ PVOID  HwDeviceExtension,
392   /*IN*/ UCHAR  PathId,
393   /*IN*/ UCHAR  TargetId,
394   /*IN*/ UCHAR  Lun,
395   /*IN*/ UCHAR  SrbStatus);
396 
397 /*
398  * ULONG
399  * ScsiPortConvertPhysicalAddressToUlong(
400  * IN SCSI_PHYSICAL_ADDRESS  Address);
401  */
402 #define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart)
403 
404 SCSIPORTAPI
405 SCSI_PHYSICAL_ADDRESS
406 DDKAPI
407 ScsiPortConvertUlongToPhysicalAddress(
408   /*IN*/ ULONG  UlongAddress);
409 
410 SCSIPORTAPI
411 VOID
412 DDKAPI
413 ScsiPortFlushDma(
414   /*IN*/ PVOID  DeviceExtension);
415 
416 SCSIPORTAPI
417 VOID
418 DDKAPI
419 ScsiPortFreeDeviceBase(
420   /*IN*/ PVOID  HwDeviceExtension,
421   /*IN*/ PVOID  MappedAddress);
422 
423 SCSIPORTAPI
424 ULONG
425 DDKAPI
426 ScsiPortGetBusData(
427   /*IN*/ PVOID  DeviceExtension,
428   /*IN*/ ULONG  BusDataType,
429   /*IN*/ ULONG  SystemIoBusNumber,
430   /*IN*/ ULONG  SlotNumber,
431   /*IN*/ PVOID  Buffer,
432   /*IN*/ ULONG  Length);
433 
434 SCSIPORTAPI
435 PVOID
436 DDKAPI
437 ScsiPortGetDeviceBase(
438   /*IN*/ PVOID  HwDeviceExtension,
439   /*IN*/ INTERFACE_TYPE  BusType,
440   /*IN*/ ULONG  SystemIoBusNumber,
441   /*IN*/ SCSI_PHYSICAL_ADDRESS  IoAddress,
442   /*IN*/ ULONG  NumberOfBytes,
443   /*IN*/ BOOLEAN  InIoSpace);
444 
445 SCSIPORTAPI
446 PVOID
447 DDKAPI
448 ScsiPortGetLogicalUnit(
449   /*IN*/ PVOID  HwDeviceExtension,
450   /*IN*/ UCHAR  PathId,
451   /*IN*/ UCHAR  TargetId,
452   /*IN*/ UCHAR  Lun);
453 
454 SCSIPORTAPI
455 SCSI_PHYSICAL_ADDRESS
456 DDKAPI
457 ScsiPortGetPhysicalAddress(
458   /*IN*/ PVOID  HwDeviceExtension,
459   /*IN*/ PSCSI_REQUEST_BLOCK  Srb  /*OPTIONAL*/,
460   /*IN*/ PVOID  VirtualAddress,
461   /*OUT*/ ULONG  *Length);
462 
463 SCSIPORTAPI
464 PSCSI_REQUEST_BLOCK
465 DDKAPI
466 ScsiPortGetSrb(
467   /*IN*/ PVOID  DeviceExtension,
468   /*IN*/ UCHAR  PathId,
469   /*IN*/ UCHAR  TargetId,
470   /*IN*/ UCHAR  Lun,
471   /*IN*/ LONG  QueueTag);
472 
473 SCSIPORTAPI
474 PVOID
475 DDKAPI
476 ScsiPortGetUncachedExtension(
477   /*IN*/ PVOID  HwDeviceExtension,
478   /*IN*/ PPORT_CONFIGURATION_INFORMATION  ConfigInfo,
479   /*IN*/ ULONG  NumberOfBytes);
480 
481 SCSIPORTAPI
482 PVOID
483 DDKAPI
484 ScsiPortGetVirtualAddress(
485   /*IN*/ PVOID  HwDeviceExtension,
486   /*IN*/ SCSI_PHYSICAL_ADDRESS  PhysicalAddress);
487 
488 SCSIPORTAPI
489 ULONG
490 DDKAPI
491 ScsiPortInitialize(
492   /*IN*/ PVOID  Argument1,
493   /*IN*/ PVOID  Argument2,
494   /*IN*/ struct _HW_INITIALIZATION_DATA  *HwInitializationData,
495   /*IN*/ PVOID  HwContext  /*OPTIONAL*/);
496 
497 SCSIPORTAPI
498 VOID
499 DDKAPI
500 ScsiPortIoMapTransfer(
501   /*IN*/ PVOID  HwDeviceExtension,
502   /*IN*/ PSCSI_REQUEST_BLOCK  Srb,
503   /*IN*/ ULONG  LogicalAddress,
504   /*IN*/ ULONG  Length);
505 
506 SCSIPORTAPI
507 VOID
508 DDKAPI
509 ScsiPortLogError(
510   /*IN*/ PVOID  HwDeviceExtension,
511   /*IN*/ PSCSI_REQUEST_BLOCK  Srb  /*OPTIONAL*/,
512   /*IN*/ UCHAR  PathId,
513   /*IN*/ UCHAR  TargetId,
514   /*IN*/ UCHAR  Lun,
515   /*IN*/ ULONG  ErrorCode,
516   /*IN*/ ULONG  UniqueId);
517 
518 SCSIPORTAPI
519 VOID
520 DDKAPI
521 ScsiPortMoveMemory(
522   /*IN*/ PVOID  WriteBuffer,
523   /*IN*/ PVOID  ReadBuffer,
524   /*IN*/ ULONG  Length);
525 
526 SCSIPORTAPI
527 VOID
528 DDKCDECLAPI
529 ScsiPortNotification(
530   /*IN*/ SCSI_NOTIFICATION_TYPE  NotificationType,
531   /*IN*/ PVOID  HwDeviceExtension,
532   /*IN*/ ...);
533 
534 SCSIPORTAPI
535 VOID
536 DDKAPI
537 ScsiPortQuerySystemTime(
538   /*OUT*/ PLARGE_INTEGER  CurrentTime);
539 
540 SCSIPORTAPI
541 VOID
542 DDKAPI
543 ScsiPortReadPortBufferUchar(
544   /*IN*/ PUCHAR  Port,
545   /*IN*/ PUCHAR  Buffer,
546   /*IN*/ ULONG  Count);
547 
548 SCSIPORTAPI
549 VOID
550 DDKAPI
551 ScsiPortReadPortBufferUlong(
552   /*IN*/ PULONG  Port,
553   /*IN*/ PULONG  Buffer,
554   /*IN*/ ULONG  Count);
555 
556 SCSIPORTAPI
557 VOID
558 DDKAPI
559 ScsiPortReadPortBufferUshort(
560   /*IN*/ PUSHORT  Port,
561   /*IN*/ PUSHORT  Buffer,
562   /*IN*/ ULONG  Count);
563 
564 SCSIPORTAPI
565 UCHAR
566 DDKAPI
567 ScsiPortReadPortUchar(
568   /*IN*/ PUCHAR  Port);
569 
570 SCSIPORTAPI
571 ULONG
572 DDKAPI
573 ScsiPortReadPortUlong(
574   /*IN*/ PULONG  Port);
575 
576 SCSIPORTAPI
577 USHORT
578 DDKAPI
579 ScsiPortReadPortUshort(
580   /*IN*/ PUSHORT  Port);
581 
582 SCSIPORTAPI
583 VOID
584 DDKAPI
585 ScsiPortReadRegisterBufferUchar(
586   /*IN*/ PUCHAR  Register,
587   /*IN*/ PUCHAR  Buffer,
588   /*IN*/ ULONG  Count);
589 
590 SCSIPORTAPI
591 VOID
592 DDKAPI
593 ScsiPortReadRegisterBufferUlong(
594   /*IN*/ PULONG  Register,
595   /*IN*/ PULONG  Buffer,
596   /*IN*/ ULONG  Count);
597 
598 SCSIPORTAPI
599 VOID
600 DDKAPI
601 ScsiPortReadRegisterBufferUshort(
602   /*IN*/ PUSHORT  Register,
603   /*IN*/ PUSHORT  Buffer,
604   /*IN*/ ULONG  Count);
605 
606 SCSIPORTAPI
607 UCHAR
608 DDKAPI
609 ScsiPortReadRegisterUchar(
610   /*IN*/ PUCHAR  Register);
611 
612 SCSIPORTAPI
613 ULONG
614 DDKAPI
615 ScsiPortReadRegisterUlong(
616   /*IN*/ PULONG  Register);
617 
618 SCSIPORTAPI
619 USHORT
620 DDKAPI
621 ScsiPortReadRegisterUshort(
622   /*IN*/ PUSHORT  Register);
623 
624 SCSIPORTAPI
625 ULONG
626 DDKAPI
627 ScsiPortSetBusDataByOffset(
628   /*IN*/ PVOID  DeviceExtension,
629   /*IN*/ ULONG  BusDataType,
630   /*IN*/ ULONG  SystemIoBusNumber,
631   /*IN*/ ULONG  SlotNumber,
632   /*IN*/ PVOID  Buffer,
633   /*IN*/ ULONG  Offset,
634   /*IN*/ ULONG  Length);
635 
636 SCSIPORTAPI
637 VOID
638 DDKAPI
639 ScsiPortStallExecution(
640   /*IN*/ ULONG  Delay);
641 
642 SCSIPORTAPI
643 BOOLEAN
644 DDKAPI
645 ScsiPortValidateRange(
646   /*IN*/ PVOID  HwDeviceExtension,
647   /*IN*/ INTERFACE_TYPE  BusType,
648   /*IN*/ ULONG  SystemIoBusNumber,
649   /*IN*/ SCSI_PHYSICAL_ADDRESS  IoAddress,
650   /*IN*/ ULONG  NumberOfBytes,
651   /*IN*/ BOOLEAN  InIoSpace);
652 
653 SCSIPORTAPI
654 VOID
655 DDKAPI
656 ScsiPortWritePortBufferUchar(
657   /*IN*/ PUCHAR  Port,
658   /*IN*/ PUCHAR  Buffer,
659   /*IN*/ ULONG  Count);
660 
661 SCSIPORTAPI
662 VOID
663 DDKAPI
664 ScsiPortWritePortBufferUlong(
665   /*IN*/ PULONG  Port,
666   /*IN*/ PULONG  Buffer,
667   /*IN*/ ULONG  Count);
668 
669 SCSIPORTAPI
670 VOID
671 DDKAPI
672 ScsiPortWritePortBufferUshort(
673   /*IN*/ PUSHORT  Port,
674   /*IN*/ PUSHORT  Buffer,
675   /*IN*/ ULONG  Count);
676 
677 SCSIPORTAPI
678 VOID
679 DDKAPI
680 ScsiPortWritePortUchar(
681   /*IN*/ PUCHAR  Port,
682   /*IN*/ UCHAR  Value);
683 
684 SCSIPORTAPI
685 VOID
686 DDKAPI
687 ScsiPortWritePortUlong(
688   /*IN*/ PULONG  Port,
689   /*IN*/ ULONG  Value);
690 
691 SCSIPORTAPI
692 VOID
693 DDKAPI
694 ScsiPortWritePortUshort(
695   /*IN*/ PUSHORT  Port,
696   /*IN*/ USHORT  Value);
697 
698 SCSIPORTAPI
699 VOID
700 DDKAPI
701 ScsiPortWriteRegisterBufferUchar(
702   /*IN*/ PUCHAR  Register,
703   /*IN*/ PUCHAR  Buffer,
704   /*IN*/ ULONG  Count);
705 
706 SCSIPORTAPI
707 VOID
708 DDKAPI
709 ScsiPortWriteRegisterBufferUlong(
710   /*IN*/ PULONG  Register,
711   /*IN*/ PULONG  Buffer,
712   /*IN*/ ULONG  Count);
713 
714 SCSIPORTAPI
715 VOID
716 DDKAPI
717 ScsiPortWriteRegisterBufferUshort(
718   /*IN*/ PUSHORT  Register,
719   /*IN*/ PUSHORT  Buffer,
720   /*IN*/ ULONG  Count);
721 
722 SCSIPORTAPI
723 VOID
724 DDKAPI
725 ScsiPortWriteRegisterUchar(
726   /*IN*/ PUCHAR  Register,
727   /*IN*/ ULONG  Value);
728 
729 SCSIPORTAPI
730 VOID
731 DDKAPI
732 ScsiPortWriteRegisterUlong(
733   /*IN*/ PULONG  Register,
734   /*IN*/ ULONG  Value);
735 
736 SCSIPORTAPI
737 VOID
738 DDKAPI
739 ScsiPortWriteRegisterUshort(
740   /*IN*/ PUSHORT  Register,
741   /*IN*/ USHORT  Value);
742 
743 SCSIPORTAPI
744 VOID
745 DDKCDECLAPI
746 ScsiDebugPrint(
747   /*IN*/ ULONG DebugPrintLevel,
748   /*IN*/ PCCHAR DebugMessage,
749   /*IN*/ ...);
750 
751 #ifdef __cplusplus
752 }
753 #endif
754 
755 #endif /* __SRB_H */
756