buslogic958.h

来自「这是一个开放源代码的与WINNT/WIN2K/WIN2003兼容的操作系统」· C头文件 代码 · 共 1,187 行 · 第 1/4 页

H
1,187
字号
/*
 * 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
//_________________________________________________________________________________________

// Debug levels
#define ERROR   1
#define WARNING 2
#define TRACE   3
#define INFO    4

// 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 */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?