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