buslogic958.h

来自「一个类似windows」· C头文件 代码 · 共 1,180 行 · 第 1/3 页

H
1,180
字号
  unsigned short WidePermitted:16;			 /* Bytes 21-22 */
  unsigned short FastPermitted:16;			 /* Bytes 23-24 */
  unsigned short SynchronousPermitted:16;	 /* Bytes 25-26 */
  unsigned short DisconnectPermitted:16;	 /* Bytes 27-28 */
  unsigned short SendStartUnitCommand:16;	 /* Bytes 29-30 */
  unsigned short IgnoreInBIOSScan:16;		 /* Bytes 31-32 */
  UCHAR PCIInterruptPin:2;			         /* Byte 33 Bits 0-1 */
  UCHAR HostAdapterIOPortAddress:2;	         /* Byte 33 Bits 2-3 */
  UCHAR StrictRoundRobinModeEnabled:1;		 /* Byte 33 Bit 4 */
  UCHAR VESABusSpeedGreaterThan33MHz:1;		 /* Byte 33 Bit 5 */
  UCHAR VESABurstWriteEnabled:1;			 /* Byte 33 Bit 6 */
  UCHAR VESABurstReadEnabled:1;			     /* Byte 33 Bit 7 */
  unsigned short UltraPermitted:16;			 /* Bytes 34-35 */
  unsigned int :32;					         /* Bytes 36-39 */
  UCHAR :8;									 /* Byte 40 */
  UCHAR AutoSCSIMaximumLUN;					 /* Byte 41 */
  UCHAR :1;									 /* Byte 42 Bit 0 */
  UCHAR SCAM_Dominant:1;					 /* Byte 42 Bit 1 */
  UCHAR SCAM_Enabled:1;						 /* Byte 42 Bit 2 */
  UCHAR SCAM_Level2:1;						 /* Byte 42 Bit 3 */
  UCHAR :4;									 /* Byte 42 Bits 4-7 */
  UCHAR INT13ExtensionEnabled:1;			 /* Byte 43 Bit 0 */
  UCHAR :1;									 /* Byte 43 Bit 1 */
  UCHAR CDROMBootEnabled:1;					 /* Byte 43 Bit 2 */
  UCHAR :5;									 /* Byte 43 Bits 3-7 */
  UCHAR BootTargetID:4;						 /* Byte 44 Bits 0-3 */
  UCHAR BootChannel:4;						 /* Byte 44 Bits 4-7 */
  UCHAR ForceBusDeviceScanningOrder:1;		 /* Byte 45 Bit 0 */
  UCHAR :7;									 /* Byte 45 Bits 1-7 */
  unsigned short NonTaggedToAlternateLUNPermitted;	 /* Bytes 46-47 */
  unsigned short RenegotiateSyncAfterCheckCondition; /* Bytes 48-49 */
  UCHAR Reserved[10];				         /* Bytes 50-59 */
  UCHAR ManufacturingDiagnostic[2];		     /* Bytes 60-61 */
  unsigned short Checksum:16;				 /* Bytes 62-63 */
}BusLogic_AutoSCSIData_T;
#pragma pack()

//  Define the Outgoing Mailbox Action Codes.
typedef enum
{
  BusLogic_OutgoingMailboxFree =		0x00,
  BusLogic_MailboxStartCommand =		0x01,
  BusLogic_MailboxAbortCommand =		0x02
}BusLogic_ActionCode_T;


//  Define the Incoming Mailbox Completion Codes.  The MultiMaster Firmware
//  only uses codes 0 - 4.  The FlashPoint SCCB Manager has no mailboxes, so
//  completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
typedef enum
{
  BusLogic_IncomingMailboxFree =		    0x00,
  BusLogic_CommandCompletedWithoutError =	0x01,
  BusLogic_CommandAbortedAtHostRequest =	0x02,
  BusLogic_AbortedCommandNotFound =		    0x03,
  BusLogic_CommandCompletedWithError =		0x04,
  BusLogic_InvalidCCB =				        0x05
}BusLogic_CompletionCode_T;

//  Define the Command Control Block (CCB) Opcodes.
typedef enum
{
  BusLogic_InitiatorCCB =			            0x00,
  BusLogic_TargetCCB =							0x01,
  BusLogic_InitiatorCCB_ScatterGather =			0x02,
  BusLogic_InitiatorCCB_ResidualDataLength =	0x03,
  BusLogic_InitiatorCCB_ScatterGatherResidual =	0x04,
  BusLogic_BusDeviceReset =						0x81
}BusLogic_CCB_Opcode_T;


//  Define the CCB Data Direction Codes.
typedef enum
{
  BusLogic_UncheckedDataTransfer =		0,
  BusLogic_DataInLengthChecked =		1,
  BusLogic_DataOutLengthChecked =		2,
  BusLogic_NoDataTransfer =				3
}BusLogic_DataDirection_T;


//  Define the Host Adapter Status Codes.  The MultiMaster Firmware does not
//  return status code 0x0C; it uses 0x12 for both overruns and underruns.
typedef enum
{
  BusLogic_CommandCompletedNormally =		0x00,
  BusLogic_LinkedCommandCompleted =		    0x0A,
  BusLogic_LinkedCommandCompletedWithFlag =	0x0B,
  BusLogic_DataUnderRun =					0x0C,
  BusLogic_SCSISelectionTimeout =			0x11,
  BusLogic_DataOverRun =					0x12,
  BusLogic_UnexpectedBusFree =				0x13,
  BusLogic_InvalidBusPhaseRequested =		0x14,
  BusLogic_InvalidOutgoingMailboxActionCode =	0x15,
  BusLogic_InvalidCommandOperationCode =	0x16,
  BusLogic_LinkedCCBhasInvalidLUN =			0x17,
  BusLogic_InvalidCommandParameter =		0x1A,
  BusLogic_AutoRequestSenseFailed =			0x1B,
  BusLogic_TaggedQueuingMessageRejected =	0x1C,
  BusLogic_UnsupportedMessageReceived =		0x1D,
  BusLogic_HostAdapterHardwareFailed =		0x20,
  BusLogic_TargetFailedResponseToATN =		0x21,
  BusLogic_HostAdapterAssertedRST =			0x22,
  BusLogic_OtherDeviceAssertedRST =			0x23,
  BusLogic_TargetDeviceReconnectedImproperly =	0x24,
  BusLogic_HostAdapterAssertedBusDeviceReset =	0x25,
  BusLogic_AbortQueueGenerated =			0x26,
  BusLogic_HostAdapterSoftwareError =		0x27,
  BusLogic_HostAdapterHardwareTimeoutError=	0x30,
  BusLogic_SCSIParityErrorDetected =		0x34
}BusLogic_HostAdapterStatus_T;

//  Define the SCSI Target Device Status Codes.
typedef enum
{
  BusLogic_OperationGood =			0x00,
  BusLogic_CheckCondition =			0x02,
  BusLogic_DeviceBusy =				0x08
}BusLogic_TargetDeviceStatus_T;

//  Define the Queue Tag Codes.
typedef enum
{
  BusLogic_SimpleQueueTag =			0,
  BusLogic_HeadOfQueueTag =			1,
  BusLogic_OrderedQueueTag =		2,
  BusLogic_ReservedQT =				3
}BusLogic_QueueTag_T;

//  Define the Scatter/Gather Segment structure required by the MultiMaster
//  Firmware Interface and the FlashPoint SCCB Manager.
typedef struct BusLogic_ScatterGatherSegment
{
  BusLogic_ByteCount_T SegmentByteCount;		/* Bytes 0-3 */
  BusLogic_BusAddress_T SegmentDataPointer;		/* Bytes 4-7 */
}BusLogic_ScatterGatherSegment_T;


typedef UCHAR SCSI_CDB_T[BusLogic_CDB_MaxLength];

//  Define the Driver CCB Status Codes.
typedef enum
{
  BusLogic_CCB_Free =				0,
  BusLogic_CCB_Active =				1,
  BusLogic_CCB_Completed =			2,
  BusLogic_CCB_Reset =				3
}BusLogic_CCB_Status_T;

//  Define the 32 Bit Mode Command Control Block (CCB) structure.  The first 40
//  bytes are defined by the MultiMaster Firmware The remaining components are 
//  defined by the Scsi MiniportDriver.  
//  Extended LUN Format CCBs differ from Legacy LUN Format 32 Bit Mode
//  CCBs only in having the TagEnable and QueueTag fields moved from byte 17 to
//  byte 1, and the Logical Unit field in byte 17 expanded to 6 bits.  In theory,
//  Extended LUN Format CCBs can support up to 64 Logical Units, but in practice
//  many devices will respond improperly to Logical Units between 32 and 63, and
//  the SCSI-2 specification defines Bit 5 as LUNTAR.  Extended LUN Format CCBs
//  are used by recent versions of the MultiMaster Firmware.
//  Since 64 Logical Units are unlikely to be needed in practice, and
//  since they are problematic for the above reasons, and since limiting them to
//  5 bits simplifies the CCB structure definition, this driver only supports
//  32 Logical Units per Target Device.
typedef struct BusLogic_CCB
{
  UCHAR Opcode;				    /* Byte 0 */
  UCHAR :3;					    /* Byte 1 Bits 0-2 */
  UCHAR DataDirection:2;		/* Byte 1 Bits 3-4 */
  UCHAR TagEnable:1;			/* Byte 1 Bit 5 */
  UCHAR QueueTag:2;			    /* Byte 1 Bits 6-7 */
  UCHAR CDB_Length;				/* Byte 2 */
  UCHAR SenseDataLength;		/* Byte 3 */
  BusLogic_ByteCount_T DataLength;	/* Bytes 4-7 */
  BusLogic_BusAddress_T DataPointer;/* Bytes 8-11 */
  UCHAR :8;					        /* Byte 12 */
  UCHAR :8;					        /* Byte 13 */
  UCHAR HostAdapterStatus;			/* Byte 14 */
  UCHAR TargetDeviceStatus;			/* Byte 15 */
  UCHAR TargetID;				    /* Byte 16 */
  UCHAR LogicalUnit:5;				/* Byte 17 Bits 0-4 */
  UCHAR LegacyTagEnable:1;			/* Byte 17 Bit 5 */
  UCHAR LegacyQueueTag:2;			/* Byte 17 Bits 6-7 */
  SCSI_CDB_T CDB;					/* Bytes 18-29 */
  UCHAR :8;					        /* Byte 30 */
  UCHAR :8;					        /* Byte 31 */
  unsigned int :32;					/* Bytes 32-35 */
  BusLogic_BusAddress_T SenseDataPointer;/* Bytes 36-39 */

  // BusLogic Driver Defined Portion.
  BusLogic_CCB_Status_T Status;
  unsigned long SerialNumber;
  struct BusLogic_HostAdapter *HostAdapter;
  struct BusLogic_CCB *Next;
    BusLogic_ScatterGatherSegment_T ScatterGatherList[BusLogic_ScatterGatherLimit];

  BusLogic_CompletionCode_T CompletionCode;
  // Pointer to the CCB
  PVOID SrbAddress;
  PVOID AbortSrb;
}BusLogic_CCB_T, *PBuslogic_CCB_T;

#pragma pack(1)
//  Define the 32 Bit Mode Outgoing Mailbox structure.
typedef struct BusLogic_OutgoingMailbox
{
  BusLogic_BusAddress_T CCB;/* Bytes 0-3 */
  UCHAR :8;					/* Bytes 4 */
  UCHAR :8;					/* Bytes 5 */
  UCHAR :8;					/* Bytes 6 */
  UCHAR ActionCode;			/* Byte 7 */
}BusLogic_OutgoingMailbox_T;

//  Define the 32 Bit Mode Incoming Mailbox structure.
typedef struct BusLogic_IncomingMailbox
{
  BusLogic_BusAddress_T CCB;	/* Bytes 0-3 */
  UCHAR HostAdapterStatus;		/* Byte 4 */
  UCHAR TargetDeviceStatus;		/* Byte 5 */
  UCHAR :8;						/* Byte 6 */
  UCHAR CompletionCode;			/* Byte 7 */
}BusLogic_IncomingMailbox_T;
#pragma pack ()

//
// The following structure is allocated
// from noncached memory as data will be DMA'd to
// and from it.
typedef struct _NONCACHED_EXTENSION 
{
    // Physical base address of mailboxes
    ULONG MailboxPA;

    // Mailboxes
	UCHAR MailboxOut[BusLogic_MaxMailboxes * sizeof(BusLogic_OutgoingMailbox_T)];														
	UCHAR MailboxIn[BusLogic_MaxMailboxes * sizeof(BusLogic_IncomingMailbox_T)];
} NONCACHED_EXTENSION, *PNONCACHED_EXTENSION;

//  Define the types of BusLogic Host Adapters that are supported and the number
//  of I/O Addresses required by each type.
typedef enum
{
  BusLogic_MultiMaster =			1,
  BusLogic_FlashPoint =				2
}BusLogic_HostAdapterType_T;

//  Define the possible Host Adapter Bus Types.
typedef enum
{
  BusLogic_Unknown_Bus =			0,
  BusLogic_ISA_Bus =				1,
  BusLogic_EISA_Bus =				2,
  BusLogic_PCI_Bus =				3,
  BusLogic_VESA_Bus =				4,
  BusLogic_MCA_Bus =				5
}BusLogic_HostAdapterBusType_T;

#if 0
static char *BusLogic_HostAdapterBusNames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
#endif
static BusLogic_HostAdapterBusType_T
  BusLogic_HostAdapterBusTypes[] ={ BusLogic_VESA_Bus,	   /* BT-4xx */
									BusLogic_ISA_Bus,	   /* BT-5xx */
									BusLogic_MCA_Bus,	   /* BT-6xx */
									BusLogic_EISA_Bus,	   /* BT-7xx */
									BusLogic_Unknown_Bus,  /* BT-8xx */
									BusLogic_PCI_Bus       /* BT-9xx */
                                  };				
//  Define the BusLogic Driver Host Adapter structure
typedef struct BusLogic_HostAdapter
{

  BusLogic_HostAdapterType_T HostAdapterType;
  BusLogic_HostAdapterBusType_T HostAdapterBusType;
    
  UCHAR ModelName[9];
  UCHAR FirmwareVersion[6];
  UCHAR FullModelName[18];
  UCHAR Bus;

  PUCHAR IO_Address;
  UCHAR IRQ_Channel;
  UCHAR SCSI_ID;
  
  BOOLEAN ExtendedTranslationEnabled:1;
  BOOLEAN ParityCheckingEnabled:1;
  BOOLEAN BusResetEnabled:1;
  BOOLEAN LevelSensitiveInterrupt:1;
  BOOLEAN HostWideSCSI:1;
  BOOLEAN HostDifferentialSCSI:1;
  BOOLEAN HostSupportsSCAM:1;
  BOOLEAN HostUltraSCSI:1;
  BOOLEAN ExtendedLUNSupport:1;
  BOOLEAN TerminationInfoValid:1;
  BOOLEAN LowByteTerminated:1;
  BOOLEAN HighByteTerminated:1;
  BOOLEAN BounceBuffersRequired:1;
  BOOLEAN StrictRoundRobinModeSupport:1;
  BOOLEAN SCAM_Enabled:1;
  BOOLEAN SCAM_Level2:1;
  BOOLEAN HostAdapterInitialized:1;
  BOOLEAN HostAdapterExternalReset:1;
  BOOLEAN HostAdapterInternalError:1;

  BOOLEAN ProcessCompletedCCBsActive;
  volatile BOOLEAN HostAdapterCommandCompleted;
  unsigned short HostAdapterScatterGatherLimit;
  unsigned short DriverScatterGatherLimit;
  
  UCHAR MaxTargetDevices;
  UCHAR MaxLogicalUnits;

  unsigned short DriverQueueDepth;
  unsigned short HostAdapterQueueDepth;
  unsigned short UntaggedQueueDepth;
  unsigned short CommonQueueDepth;
  unsigned short BusSettleTime;
  unsigned short SynchronousPermitted;
  unsigned short FastPermitted;
  unsigned short UltraPermitted;
  unsigned short WidePermitted;
  unsigned short DisconnectPermitted;
  unsigned short TaggedQueuingPermitted;
  unsigned short ExternalHostAdapterResets;
  unsigned short HostAdapterInternalErrors;
  unsigned short TargetDeviceCount;
  
  BusLogic_BusAddress_T BIOS_Address;

  BusLogic_CCB_T *FirstCompletedCCB;
  BusLogic_CCB_T *LastCompletedCCB;
  BusLogic_CCB_T *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices];

  BusLogic_TargetFlags_T TargetFlags[BusLogic_MaxTargetDevices];
  UCHAR SynchronousPeriod[BusLogic_MaxTargetDevices];
  UCHAR SynchronousOffset[BusLogic_MaxTargetDevices];
  UCHAR ActiveCommandsPerTarget[BusLogic_MaxTargetDevices];
  UCHAR ActiveCommandsPerLun[BusLogic_MaxTargetDevices][BusLogic_MaxLogicalUnits];
  unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices];
  unsigned long LastSequencePoint[BusLogic_MaxTargetDevices];
  unsigned long LastResetAttempted[BusLogic_MaxTargetDevices];
  unsigned long LastResetCompleted[BusLogic_MaxTargetDevices];

  UCHAR MailboxCount;
  BusLogic_OutgoingMailbox_T *FirstOutgoingMailbox;
  BusLogic_OutgoingMailbox_T *LastOutgoingMailbox;
  BusLogic_OutgoingMailbox_T *NextOutgoingMailbox;
  BusLogic_IncomingMailbox_T *FirstIncomingMailbox;
  BusLogic_IncomingMailbox_T *LastIncomingMailbox;
  BusLogic_IncomingMailbox_T *NextIncomingMailbox;
  BusLogic_TargetStatistics_T TargetStatistics[BusLogic_MaxTargetDevices];  
}BusLogic_HostAdapter_T;


// Buslogic specific port driver device object extension. 
typedef struct 
_HW_DEVICE_EXTENSION
{ 
  BusLogic_HostAdapter_T   hcs;
  PNONCACHED_EXTENSION NoncachedExtension;
  SCSI_WMILIB_CONTEXT WmiLibContext;

} HW_DEVICE_EXTENSION, *PHW_DEVICE_EXTENSION;


//  Define a structure for the SCSI Inquiry command results.
#pragma pack (1)
typedef struct SCSI_Inquiry
{
  UCHAR PeripheralDeviceType:5;	/* Byte 0 Bits 0-4 */
  UCHAR PeripheralQualifier:3;	/* Byte 0 Bits 5-7 */
  UCHAR DeviceTypeModifier:7;	/* Byte 1 Bits 0-6 */
  BOOLEAN RMB:1;				/* Byte 1 Bit 7 */
  UCHAR ANSI_ApprovedVersion:3;	/* Byte 2 Bits 0-2 */
  UCHAR ECMA_Version:3;			/* Byte 2 Bits 3-5 */
  UCHAR ISO_Version:2;			/* Byte 2 Bits 6-7 */
  UCHAR ResponseDataFormat:4;	/* Byte 3 Bits 0-3 */
  UCHAR :2;						/* Byte 3 Bits 4-5 */
  BOOLEAN TrmIOP:1;				/* Byte 3 Bit 6 */
  BOOLEAN AENC:1;				/* Byte 3 Bit 7 */
  UCHAR AdditionalLength;		/* Byte 4 */
  UCHAR :8;						/* Byte 5 */
  UCHAR :8;						/* Byte 6 */
  BOOLEAN SftRe:1;				/* Byte 7 Bit 0 */
  BOOLEAN CmdQue:1;				/* Byte 7 Bit 1 */
  BOOLEAN :1;					/* Byte 7 Bit 2 */
  BOOLEAN Linked:1;				/* Byte 7 Bit 3 */
  BOOLEAN Sync:1;				/* Byte 7 Bit 4 */
  BOOLEAN WBus16:1;				/* Byte 7 Bit 5 */
  BOOLEAN WBus32:1;				/* Byte 7 Bit 6 */
  BOOLEAN RelAdr:1;				/* Byte 7 Bit 7 */
  UCHAR VendorIdentification[8];/* Bytes 8-15 */
  UCHAR ProductIdentification[16];/* Bytes 16-31 */
  UCHAR ProductRevisionLevel[4];/* Bytes 32-35 */
}SCSI_Inquiry_T;

⌨️ 快捷键说明

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