buslogic958.h

来自「ReactOS是一些高手根据Windows XP的内核编写出的类XP。内核实现机」· C头文件 代码 · 共 1,187 行 · 第 1/4 页

H
1,187
字号
  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;

typedef struct BusLogic_WmiExtendedSetupInformation
{
  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 
  BOOLEAN FastOnEISA;                   // Byte 9 
  BOOLEAN LevelSensitiveInterrupt;      // Byte 10
  UCHAR FirmwareRevision[3];            // Bytes 11-14 
  BOOLEAN HostWideSCSI;                 // Byte 15
  BOOLEAN HostDifferentialSCSI;         // Byte 16
  BOOLEAN HostSupportsSCAM;             // Byte 17
  BOOLEAN HostUltraSCSI;                // Byte 18
  BOOLEAN HostSmartTermination;         // Byte 19
}BusLogic_WmiExtendedSetupInformation_T, *PBusLogic_WmiExtendedSetupInformation_T;

#pragma pack ()

//_________________________________________________________________________________________
// function declaractions
//_________________________________________________________________________________________
ULONG
STDCALL
DriverEntry(IN PVOID DriverObject,
            IN PVOID Argument2
            );

ULONG
STDCALL
BT958HwFindAdapter(IN PVOID HwDeviceExtension,
                   IN PVOID Context,
                   IN PVOID BusInformation,
                   IN PCHAR ArgumentString,
                   IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
                   OUT PBOOLEAN Again
                  );

BOOLEAN
STDCALL
BT958HwInitialize(IN PVOID HwDeviceExtension);

BOOLEAN
STDCALL
BT958HwStartIO(IN PVOID HwDeviceExtension,
               IN PSCSI_REQUEST_BLOCK Srb
              );

BOOLEAN
STDCALL
BT958HwInterrupt(IN PVOID HwDeviceExtension);

BOOLEAN
STDCALL
BT958HwResetBus(IN PVOID HwDeviceExtension,
                IN ULONG PathId
               );

SCSI_ADAPTER_CONTROL_STATUS
STDCALL
BT958HwAdapterControl(IN PVOID HwDeviceExtension,
                      IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
                      IN PVOID Parameters
                      );
#if 0
BOOLEAN
BT958WmiSrb(IN     PHW_DEVICE_EXTENSION    HwDeviceExtension,
            IN OUT PSCSI_WMI_REQUEST_BLOCK Srb);
#endif
void 
BT958WmiInitialize( IN PHW_DEVICE_EXTENSION HwDeviceExtension);


BOOLEAN 
Buslogic_InitBT958(PHW_DEVICE_EXTENSION deviceExtension, 
                   PPORT_CONFIGURATION_INFORMATION ConfigInfo);

BOOLEAN 
BusLogic_ProbeHostAdapter(BusLogic_HostAdapter_T *HostAdapter);

BOOLEAN 
BusLogic_HardwareResetHostAdapter(BusLogic_HostAdapter_T  *HostAdapter, 
                                  BOOLEAN HardReset);

BOOLEAN 
BusLogic_CheckHostAdapter(BusLogic_HostAdapter_T *HostAdapter);

int 
BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter,
                 BusLogic_OperationCode_T OperationCode,
                 void *ParameterData,
                 int ParameterLength,
                 void *ReplyData,
                 int ReplyLength);

BOOLEAN 

⌨️ 快捷键说明

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