buslogic958.h
来自「一个类似windows」· C头文件 代码 · 共 1,180 行 · 第 1/3 页
H
1,180 行
/*
* vmscsi-- Miniport driver for the Buslogic BT 958 SCSI Controller
* under Windows 2000/XP/Server 2003
*
* Based in parts on the buslogic driver for the same device
* available with the GNU Linux Operating System.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//_________________________________________________________________________________________
//
// File description :The header file the driver for BusLogic-958 SCSI Host adapter card.
// The technical refernece for this driver is at :
//
// Author: Namita Lal, Sirish Raghuram ( Calsoft Pvt Ltd)
// Date: 10th June 2002
// Status: Released
// Revision History: Changed queue depth to 191 - June 2002
//
//_________________________________________________________________________________________
// Prototype for functions
#ifndef _BT958_H_
#define _BT958_H_
#include <ntddk.h>
#include <srb.h>
#include <scsi.h>
#include <ntddscsi.h>
#include <scsiwmi.h>
//#include <ntos/kefuncs.h>
//#include "miniport.h"
//#include "scsi.h"
//#include "scsiwmi.h"
//_________________________________________________________________________________________
// #defines
//_________________________________________________________________________________________
// Max transfer size
#define MAX_TRANSFER_SIZE 64 * 1024
// flag to turn on Scatter gather support
#define SG_SUPPORT 1
// flag to turn on tagged command queuing
#define TAG_QUEUING 1
#define BUSLOGIC_MAXIMUM_TAGS 128
// Define the maximum, maximum automatic, minimum automatic, and default Queue
// Depth to allow for Target Devices depending on whether or not they support
// Tagged Queuing and whether or not ISA Bounce Buffers are required.
#define BusLogic_MaxTaggedQueueDepth 128
// Define the default amount of time in seconds to wait between a Host Adapter
// Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
// Some SCSI devices get confused if they receive SCSI commands too soon after
// a SCSI Bus Reset.
#define BusLogic_DefaultBusSettleTime 2
// Define the maximum number of Target Devices supported by this driver.
#define BusLogic_MaxTargetDevices 16
// Define the maximum number of Logical unit supported/Target Devices supported by this driver.
#define BusLogic_MaxLogicalUnits 32
// Define the maximum number of Mailboxes that should be used for MultiMaster
// Host Adapters. This number is chosen to be larger than the maximum Host
// Adapter Queue Depth and small enough so that the Host Adapter structure
// does not cross an allocation block size boundary.
#define BusLogic_MaxMailboxes 211
// Define the Fetch Host Adapter Local RAM request type.
#define BusLogic_BIOS_BaseOffset 0
#define BusLogic_AutoSCSI_BaseOffset 64
// Define the SCSI Command Descriptor Block (CDB).
#define BusLogic_CDB_MaxLength 12
// Define the maximum number of Scatter/Gather Segments used by this driver.
// For optimal performance, it is important that this limit be at least as
// large as the largest single request generated by the I/O Subsystem.
#define BusLogic_ScatterGatherLimit 128
#define MAX_SG_LIMIT BusLogic_ScatterGatherLimit
#define BusLogic_AggressiveRoundRobinMode 0
#define BusLogic_StrictRoundRobinMode 1
// Define the Codes for byte 3 (Request sense allocation length) of the CCB structure.
#define BusLogic_Allocate14Bytes 0x00
#define BusLogic_DisableAutoReqSense 0x01
//_________________________________________________________________________________________
//_________________________________________________________________________________________
// typedef
//_________________________________________________________________________________________
typedef enum
{
BusLogic_TestCommandCompleteInterrupt = 0x00,
BusLogic_InitializeMailbox = 0x01,
BusLogic_ExecuteMailboxCommand = 0x02,
BusLogic_ExecuteBIOSCommand = 0x03,
BusLogic_InquireBoardID = 0x04,
BusLogic_EnableOutgoingMailboxAvailableInt = 0x05,
BusLogic_SetSCSISelectionTimeout = 0x06,
BusLogic_SetPreemptTimeOnBus = 0x07,
BusLogic_SetTimeOffBus = 0x08,
BusLogic_SetBusTransferRate = 0x09,
BusLogic_InquireInstalledDevicesID0to7 =0x0A,
BusLogic_InquireConfiguration = 0x0B,
BusLogic_EnableTargetMode = 0x0C,
BusLogic_InquireSetupInformation = 0x0D,
BusLogic_WriteAdapterLocalRAM = 0x1A,
BusLogic_ReadAdapterLocalRAM = 0x1B,
BusLogic_WriteBusMasterChipFIFO = 0x1C,
BusLogic_ReadBusMasterChipFIFO = 0x1D,
BusLogic_EchoCommandData = 0x1F,
BusLogic_HostAdapterDiagnostic = 0x20,
BusLogic_SetAdapterOptions = 0x21,
BusLogic_InquireInstalledDevicesID8to15 = 0x23,
BusLogic_InquireTargetDevices = 0x24,
BusLogic_DisableHostAdapterInterrupt = 0x25,
BusLogic_InitializeExtendedMailbox = 0x81,
BusLogic_ExecuteSCSICommand = 0x83,
BusLogic_InquireFirmwareVersion3rdDigit = 0x84,
BusLogic_InquireFirmwareVersionLetter = 0x85,
BusLogic_InquirePCIHostAdapterInformation = 0x86,
BusLogic_InquireHostAdapterModelNumber =0x8B,
BusLogic_InquireSynchronousPeriod = 0x8C,
BusLogic_InquireExtendedSetupInformation = 0x8D,
BusLogic_EnableStrictRoundRobinMode = 0x8F,
BusLogic_StoreHostAdapterLocalRAM = 0x90,
BusLogic_FetchHostAdapterLocalRAM = 0x91,
BusLogic_StoreLocalDataInEEPROM = 0x92,
BusLogic_UploadAutoSCSICode = 0x94,
BusLogic_ModifyIOAddress = 0x95,
BusLogic_SetCCBFormat = 0x96,
BusLogic_WriteInquiryBuffer = 0x9A,
BusLogic_ReadInquiryBuffer = 0x9B,
BusLogic_FlashROMUploadDownload = 0xA7,
BusLogic_ReadSCAMData = 0xA8,
BusLogic_WriteSCAMData = 0xA9
}BusLogic_OperationCode_T;
// Define the Requested Reply Length type used by the Inquire Setup Information,
// Inquire Host Adapter Model Number, Inquire Synchronous Period, and Inquire
// Extended Setup Information commands.
typedef UCHAR BusLogic_RequestedReplyLength_T;
// Define a 32 bit Bus Address data type.
typedef unsigned int BusLogic_BusAddress_T;
// Define the Inquire Host Adapter Model Number reply type.
typedef UCHAR BusLogic_HostAdapterModelNumber_T[5];
// Define the Inquire Firmware Version 3rd Digit reply type.
typedef UCHAR BusLogic_FirmwareVersion3rdDigit_T;
// Define the Inquire Firmware Version Letter reply type.
typedef UCHAR BusLogic_FirmwareVersionLetter_T;
// Define a 32 bit Byte Count data type.
typedef unsigned int BusLogic_ByteCount_T;
typedef struct BusLogic_FetchHostAdapterLocalRAMRequest
{
UCHAR ByteOffset; // Byte 0
UCHAR ByteCount; // Byte 1
}
BusLogic_FetchHostAdapterLocalRAMRequest_T;
// Define the Inquire PCI Host Adapter Information reply type. The ISA
// Compatible I/O Port values are defined here and are also used with
// the Modify I/O Address command.
typedef enum BusLogic_ISACompatibleIOPort
{
BusLogic_IO_330 = 0,
BusLogic_IO_334 = 1,
BusLogic_IO_230 = 2,
BusLogic_IO_234 = 3,
BusLogic_IO_130 = 4,
BusLogic_IO_134 = 5,
BusLogic_IO_Disable = 6,
BusLogic_IO_Disable2 = 7
}
BusLogic_ISACompatibleIOPort_T;
#pragma pack (1)
typedef struct BusLogic_PCIHostAdapterInformation
{
UCHAR ISACompatibleIOPort; /* Byte 0 */
UCHAR PCIAssignedIRQChannel; /* Byte 1 */
BOOLEAN LowByteTerminated:1; /* Byte 2 Bit 0 */
BOOLEAN HighByteTerminated:1; /* Byte 2 Bit 1 */
UCHAR :2; /* Byte 2 Bits 2-3 */
BOOLEAN JP1:1; /* Byte 2 Bit 4 */
BOOLEAN JP2:1; /* Byte 2 Bit 5 */
BOOLEAN JP3:1; /* Byte 2 Bit 6 */
BOOLEAN GenericInfoValid:1; /* Byte 2 Bit 7 */
UCHAR :8; /* Byte 3 */
}BusLogic_PCIHostAdapterInformation_T;
// Define the Inquire Board ID reply structure.
typedef struct BusLogic_BoardID
{
UCHAR BoardType; /* Byte 0 */
UCHAR CustomFeatures; /* Byte 1 */
UCHAR FirmwareVersion1stDigit; /* Byte 2 */
UCHAR FirmwareVersion2ndDigit; /* Byte 3 */
} BusLogic_BoardID_T;
#pragma pack ()
// Define the Host Adapter Target Flags structure.
typedef struct BusLogic_TargetFlags
{
BOOLEAN TargetExists:1;
BOOLEAN TaggedQueuingSupported:1;
BOOLEAN WideTransfersSupported:1;
BOOLEAN TaggedQueuingActive:1;
BOOLEAN WideTransfersActive:1;
BOOLEAN CommandSuccessfulFlag:1;
BOOLEAN TargetInfoReported:1;
}
BusLogic_TargetFlags_T;
// Define the Host Adapter Target Statistics structure.
#define BusLogic_SizeBuckets 10
// Define a 10^18 Statistics Byte Counter data type.
typedef struct BusLogic_ByteCounter
{
unsigned int Units;
unsigned int Billions;
}BusLogic_ByteCounter_T;
typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets];
typedef struct BusLogic_TargetStatistics
{
unsigned int CommandsAttempted;
unsigned int CommandsCompleted;
unsigned int ReadCommands;
unsigned int WriteCommands;
BusLogic_ByteCounter_T TotalBytesRead;
BusLogic_ByteCounter_T TotalBytesWritten;
BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets;
BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets;
unsigned short CommandAbortsRequested;
unsigned short CommandAbortsAttempted;
unsigned short CommandAbortsCompleted;
unsigned short BusDeviceResetsRequested;
unsigned short BusDeviceResetsAttempted;
unsigned short BusDeviceResetsCompleted;
unsigned short HostAdapterResetsRequested;
unsigned short HostAdapterResetsAttempted;
unsigned short HostAdapterResetsCompleted;
}
BusLogic_TargetStatistics_T;
#pragma pack (1)
// Define the Inquire Configuration reply structure.
typedef struct BusLogic_Configuration
{
UCHAR :5; /* Byte 0 Bits 0-4 */
BOOLEAN DMA_Channel5:1; /* Byte 0 Bit 5 */
BOOLEAN DMA_Channel6:1; /* Byte 0 Bit 6 */
BOOLEAN DMA_Channel7:1; /* Byte 0 Bit 7 */
BOOLEAN IRQ_Channel9:1; /* Byte 1 Bit 0 */
BOOLEAN IRQ_Channel10:1; /* Byte 1 Bit 1 */
BOOLEAN IRQ_Channel11:1; /* Byte 1 Bit 2 */
BOOLEAN IRQ_Channel12:1; /* Byte 1 Bit 3 */
UCHAR :1; /* Byte 1 Bit 4 */
BOOLEAN IRQ_Channel14:1; /* Byte 1 Bit 5 */
BOOLEAN IRQ_Channel15:1; /* Byte 1 Bit 6 */
UCHAR :1; /* Byte 1 Bit 7 */
UCHAR HostAdapterID:4; /* Byte 2 Bits 0-3 */
UCHAR :4; /* Byte 2 Bits 4-7 */
}BusLogic_Configuration_T;
// Define the Inquire Setup Information reply structure.
typedef struct BusLogic_SynchronousValue
{
UCHAR Offset:4; /* Bits 0-3 */
UCHAR TransferPeriod:3; /* Bits 4-6 */
BOOLEAN Synchronous:1; /* Bit 7 */
}BusLogic_SynchronousValue_T;
typedef BusLogic_SynchronousValue_T
BusLogic_SynchronousValues8_T[8];
typedef struct BusLogic_SetupInformation
{
BOOLEAN SynchronousInitiationEnabled:1; /* Byte 0 Bit 0 */
BOOLEAN ParityCheckingEnabled:1; /* Byte 0 Bit 1 */
UCHAR :6; /* Byte 0 Bits 2-7 */
UCHAR BusTransferRate; /* Byte 1 */
UCHAR PreemptTimeOnBus; /* Byte 2 */
UCHAR TimeOffBus; /* Byte 3 */
UCHAR MailboxCount; /* Byte 4 */
UCHAR MailboxAddress[3]; /* Bytes 5-7 */
BusLogic_SynchronousValues8_T SynchronousValuesID0to7; /* Bytes 8-15 */
UCHAR DisconnectPermittedID0to7; /* Byte 16 */
UCHAR Signature; /* Byte 17 */
UCHAR CharacterD; /* Byte 18 */
UCHAR HostBusType; /* Byte 19 */
UCHAR WideTransfersPermittedID0to7; /* Byte 20 */
UCHAR WideTransfersActiveID0to7; /* Byte 21 */
BusLogic_SynchronousValues8_T SynchronousValuesID8to15;/* Bytes 22-29 */
UCHAR DisconnectPermittedID8to15; /* Byte 30 */
UCHAR :8; /* Byte 31 */
UCHAR WideTransfersPermittedID8to15; /* Byte 32 */
UCHAR WideTransfersActiveID8to15; /* Byte 33 */
}BusLogic_SetupInformation_T;
// Something has to be done about the packing machanism of these structures - Namita
// Define the Inquire Extended Setup Information reply structure.
typedef struct BusLogic_ExtendedSetupInformation
{
UCHAR BusType; // Byte 0
UCHAR BIOS_Address; // Byte 1
unsigned short ScatterGatherLimit; // Bytes 2-3
UCHAR MailboxCount; // Byte 4
BusLogic_BusAddress_T BaseMailboxAddress; // Bytes 5-8
struct
{
UCHAR :2; // Byte 9 Bits 0-1
BOOLEAN FastOnEISA:1; // Byte 9 Bit 2
UCHAR :3; // Byte 9 Bits 3-5
BOOLEAN LevelSensitiveInterrupt:1; // Byte 9 Bit 6
UCHAR :1;
} Misc; // Byte 9 Bit 7
UCHAR FirmwareRevision[3]; // Bytes 10-12
BOOLEAN HostWideSCSI:1; // Byte 13 Bit 0
BOOLEAN HostDifferentialSCSI:1; // Byte 13 Bit 1
BOOLEAN HostSupportsSCAM:1; // Byte 13 Bit 2
BOOLEAN HostUltraSCSI:1; // Byte 13 Bit 3
BOOLEAN HostSmartTermination:1; // Byte 13 Bit 4
UCHAR :3; // Byte 13 Bits 5-7
}BusLogic_ExtendedSetupInformation_T;
// Define the Host Adapter Local RAM AutoSCSI structure.
typedef struct BusLogic_AutoSCSIData
{
UCHAR InternalFactorySignature[2];/* Bytes 0-1 */
UCHAR InformationByteCount; /* Byte 2 */
UCHAR HostAdapterType[6]; /* Bytes 3-8 */
UCHAR :8; /* Byte 9 */
UCHAR FloppyEnabled:1; /* Byte 10 Bit 0 */
UCHAR FloppySecondary:1; /* Byte 10 Bit 1 */
UCHAR LevelSensitiveInterrupt:1; /* Byte 10 Bit 2 */
UCHAR :2; /* Byte 10 Bits 3-4 */
UCHAR SystemRAMAreaForBIOS:3; /* Byte 10 Bits 5-7 */
UCHAR DMA_Channel:7; /* Byte 11 Bits 0-6 */
UCHAR DMA_AutoConfiguration:1; /* Byte 11 Bit 7 */
UCHAR IRQ_Channel:7; /* Byte 12 Bits 0-6 */
UCHAR IRQ_AutoConfiguration:1; /* Byte 12 Bit 7 */
UCHAR DMA_TransferRate; /* Byte 13 */
UCHAR SCSI_ID; /* Byte 14 */
UCHAR LowByteTerminated:1; /* Byte 15 Bit 0 */
UCHAR ParityCheckingEnabled:1; /* Byte 15 Bit 1 */
UCHAR HighByteTerminated:1; /* Byte 15 Bit 2 */
UCHAR NoisyCablingEnvironment:1; /* Byte 15 Bit 3 */
UCHAR FastSynchronousNegotiation:1; /* Byte 15 Bit 4 */
UCHAR BusResetEnabled:1; /* Byte 15 Bit 5 */
UCHAR :1; /* Byte 15 Bit 6 */
UCHAR ActiveNegationEnabled:1; /* Byte 15 Bit 7 */
UCHAR BusOnDelay; /* Byte 16 */
UCHAR BusOffDelay; /* Byte 17 */
UCHAR HostAdapterBIOSEnabled:1; /* Byte 18 Bit 0 */
UCHAR BIOSRedirectionOfINT19Enabled:1; /* Byte 18 Bit 1 */
UCHAR ExtendedTranslationEnabled:1; /* Byte 18 Bit 2 */
UCHAR MapRemovableAsFixedEnabled:1; /* Byte 18 Bit 3 */
UCHAR :1; /* Byte 18 Bit 4 */
UCHAR BIOSSupportsMoreThan2DrivesEnabled:1;/* Byte 18 Bit 5 */
UCHAR BIOSInterruptModeEnabled:1; /* Byte 18 Bit 6 */
UCHAR FlopticalSupportEnabled:1; /* Byte 19 Bit 7 */
unsigned short DeviceEnabled:16; /* Bytes 19-20 */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?