ReactOS  0.4.14-dev-376-gaedba84
BusLogic958.h File Reference
#include <ntddk.h>
#include <srb.h>
#include <scsi.h>
#include <ntddscsi.h>
#include <scsiwmi.h>
Include dependency graph for BusLogic958.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BusLogic_FetchHostAdapterLocalRAMRequest
 
struct  BusLogic_PCIHostAdapterInformation
 
struct  BusLogic_BoardID
 
struct  BusLogic_TargetFlags
 
struct  BusLogic_ByteCounter
 
struct  BusLogic_TargetStatistics
 
struct  BusLogic_Configuration
 
struct  BusLogic_SynchronousValue
 
struct  BusLogic_SetupInformation
 
struct  BusLogic_ExtendedSetupInformation
 
struct  BusLogic_AutoSCSIData
 
struct  BusLogic_ScatterGatherSegment
 
struct  BusLogic_CCB
 
struct  BusLogic_OutgoingMailbox
 
struct  BusLogic_IncomingMailbox
 
struct  _NONCACHED_EXTENSION
 
struct  BusLogic_HostAdapter
 
struct  _HW_DEVICE_EXTENSION
 
struct  SCSI_Inquiry
 
struct  BusLogic_WmiExtendedSetupInformation
 
union  BusLogic_ControlRegister
 
union  BusLogic_StatusRegister
 
union  BusLogic_InterruptRegister
 
union  BusLogic_GeometryRegister
 
struct  BusLogic_ExtendedMailboxRequest
 

Macros

#define ERROR   1
 
#define WARNING   2
 
#define TRACE   3
 
#define INFO   4
 
#define MAX_TRANSFER_SIZE   64 * 1024
 
#define SG_SUPPORT   1
 
#define TAG_QUEUING   1
 
#define BUSLOGIC_MAXIMUM_TAGS   128
 
#define BusLogic_MaxTaggedQueueDepth   128
 
#define BusLogic_DefaultBusSettleTime   2
 
#define BusLogic_MaxTargetDevices   16
 
#define BusLogic_MaxLogicalUnits   32
 
#define BusLogic_MaxMailboxes   211
 
#define BusLogic_BIOS_BaseOffset   0
 
#define BusLogic_AutoSCSI_BaseOffset   64
 
#define BusLogic_CDB_MaxLength   12
 
#define BusLogic_ScatterGatherLimit   128
 
#define MAX_SG_LIMIT   BusLogic_ScatterGatherLimit
 
#define BusLogic_AggressiveRoundRobinMode   0
 
#define BusLogic_StrictRoundRobinMode   1
 
#define BusLogic_Allocate14Bytes   0x00
 
#define BusLogic_DisableAutoReqSense   0x01
 
#define BusLogic_SizeBuckets   10
 
#define BusLogic_ControlRegisterOffset   0
 
#define BusLogic_StatusRegisterOffset   0
 
#define BusLogic_CommandParameterRegisterOffset   1
 
#define BusLogic_DataInRegisterOffset   1
 
#define BusLogic_InterruptRegisterOffset   2
 
#define BusLogic_GeometryRegisterOffset   3
 

Typedefs

typedef UCHAR BusLogic_RequestedReplyLength_T
 
typedef unsigned int BusLogic_BusAddress_T
 
typedef UCHAR BusLogic_HostAdapterModelNumber_T[5]
 
typedef UCHAR BusLogic_FirmwareVersion3rdDigit_T
 
typedef UCHAR BusLogic_FirmwareVersionLetter_T
 
typedef unsigned int BusLogic_ByteCount_T
 
typedef struct BusLogic_FetchHostAdapterLocalRAMRequest BusLogic_FetchHostAdapterLocalRAMRequest_T
 
typedef enum BusLogic_ISACompatibleIOPort BusLogic_ISACompatibleIOPort_T
 
typedef struct BusLogic_PCIHostAdapterInformation BusLogic_PCIHostAdapterInformation_T
 
typedef struct BusLogic_BoardID BusLogic_BoardID_T
 
typedef struct BusLogic_TargetFlags BusLogic_TargetFlags_T
 
typedef struct BusLogic_ByteCounter BusLogic_ByteCounter_T
 
typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets]
 
typedef struct BusLogic_TargetStatistics BusLogic_TargetStatistics_T
 
typedef struct BusLogic_Configuration BusLogic_Configuration_T
 
typedef struct BusLogic_SynchronousValue BusLogic_SynchronousValue_T
 
typedef BusLogic_SynchronousValue_T BusLogic_SynchronousValues8_T[8]
 
typedef struct BusLogic_SetupInformation BusLogic_SetupInformation_T
 
typedef struct BusLogic_ExtendedSetupInformation BusLogic_ExtendedSetupInformation_T
 
typedef struct BusLogic_AutoSCSIData BusLogic_AutoSCSIData_T
 
typedef struct BusLogic_ScatterGatherSegment BusLogic_ScatterGatherSegment_T
 
typedef UCHAR SCSI_CDB_T[BusLogic_CDB_MaxLength]
 
typedef struct BusLogic_CCB BusLogic_CCB_T
 
typedef struct BusLogic_CCBPBuslogic_CCB_T
 
typedef struct BusLogic_OutgoingMailbox BusLogic_OutgoingMailbox_T
 
typedef struct BusLogic_IncomingMailbox BusLogic_IncomingMailbox_T
 
typedef struct _NONCACHED_EXTENSION NONCACHED_EXTENSION
 
typedef struct _NONCACHED_EXTENSIONPNONCACHED_EXTENSION
 
typedef struct BusLogic_HostAdapter BusLogic_HostAdapter_T
 
typedef struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
 
typedef struct _HW_DEVICE_EXTENSIONPHW_DEVICE_EXTENSION
 
typedef struct SCSI_Inquiry SCSI_Inquiry_T
 
typedef struct BusLogic_WmiExtendedSetupInformation BusLogic_WmiExtendedSetupInformation_T
 
typedef struct BusLogic_WmiExtendedSetupInformationPBusLogic_WmiExtendedSetupInformation_T
 
typedef union BusLogic_ControlRegister BusLogic_ControlRegister_T
 
typedef union BusLogic_StatusRegister BusLogic_StatusRegister_T
 
typedef union BusLogic_InterruptRegister BusLogic_InterruptRegister_T
 
typedef enum BusLogic_BIOS_DiskGeometryTranslation BusLogic_BIOS_DiskGeometryTranslation_T
 
typedef union BusLogic_GeometryRegister BusLogic_GeometryRegister_T
 
typedef UCHAR BusLogic_SynchronousPeriod_T[BusLogic_MaxTargetDevices]
 
typedef UCHAR BusLogic_InstalledDevices8_T[8]
 
typedef unsigned short BusLogic_InstalledDevices_T
 
typedef struct BusLogic_ExtendedMailboxRequest BusLogic_ExtendedMailboxRequest_T
 
typedef enum BusLogic_SetCCBFormatRequest BusLogic_SetCCBFormatRequest_T
 

Enumerations

enum  BusLogic_OperationCode_T {
  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
}
 
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
}
 
enum  BusLogic_ActionCode_T { BusLogic_OutgoingMailboxFree = 0x00, BusLogic_MailboxStartCommand = 0x01, BusLogic_MailboxAbortCommand = 0x02 }
 
enum  BusLogic_CompletionCode_T {
  BusLogic_IncomingMailboxFree = 0x00, BusLogic_CommandCompletedWithoutError = 0x01, BusLogic_CommandAbortedAtHostRequest = 0x02, BusLogic_AbortedCommandNotFound = 0x03,
  BusLogic_CommandCompletedWithError = 0x04, BusLogic_InvalidCCB = 0x05
}
 
enum  BusLogic_CCB_Opcode_T {
  BusLogic_InitiatorCCB = 0x00, BusLogic_TargetCCB = 0x01, BusLogic_InitiatorCCB_ScatterGather = 0x02, BusLogic_InitiatorCCB_ResidualDataLength = 0x03,
  BusLogic_InitiatorCCB_ScatterGatherResidual = 0x04, BusLogic_BusDeviceReset = 0x81
}
 
enum  BusLogic_DataDirection_T { BusLogic_UncheckedDataTransfer = 0, BusLogic_DataInLengthChecked = 1, BusLogic_DataOutLengthChecked = 2, BusLogic_NoDataTransfer = 3 }
 
enum  BusLogic_HostAdapterStatus_T {
  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
}
 
enum  BusLogic_TargetDeviceStatus_T { BusLogic_OperationGood = 0x00, BusLogic_CheckCondition = 0x02, BusLogic_DeviceBusy = 0x08 }
 
enum  BusLogic_QueueTag_T { BusLogic_SimpleQueueTag = 0, BusLogic_HeadOfQueueTag = 1, BusLogic_OrderedQueueTag = 2, BusLogic_ReservedQT = 3 }
 
enum  BusLogic_CCB_Status_T { BusLogic_CCB_Free = 0, BusLogic_CCB_Active = 1, BusLogic_CCB_Completed = 2, BusLogic_CCB_Reset = 3 }
 
enum  BusLogic_HostAdapterType_T { BusLogic_MultiMaster = 1, BusLogic_FlashPoint = 2 }
 
enum  BusLogic_HostAdapterBusType_T {
  BusLogic_Unknown_Bus = 0, BusLogic_ISA_Bus = 1, BusLogic_EISA_Bus = 2, BusLogic_PCI_Bus = 3,
  BusLogic_VESA_Bus = 4, BusLogic_MCA_Bus = 5
}
 
enum  BusLogic_BIOS_DiskGeometryTranslation { BusLogic_BIOS_Disk_Not_Installed = 0, BusLogic_BIOS_Disk_Installed_64x32 = 1, BusLogic_BIOS_Disk_Installed_128x32 = 2, BusLogic_BIOS_Disk_Installed_255x63 = 3 }
 
enum  BusLogic_SetCCBFormatRequest { BusLogic_LegacyLUNFormatCCB = 0, BusLogic_ExtendedLUNFormatCCB = 1 }
 

Functions

ULONG NTAPI DriverEntry (IN PVOID DriverObject, IN PVOID Argument2)
 
ULONG NTAPI BT958HwFindAdapter (IN PVOID HwDeviceExtension, IN PVOID Context, IN PVOID BusInformation, IN PCHAR ArgumentString, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, OUT PBOOLEAN Again)
 
BOOLEAN NTAPI BT958HwInitialize (IN PVOID HwDeviceExtension)
 
BOOLEAN NTAPI BT958HwStartIO (IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
 
BOOLEAN NTAPI BT958HwInterrupt (IN PVOID HwDeviceExtension)
 
BOOLEAN NTAPI BT958HwResetBus (IN PVOID HwDeviceExtension, IN ULONG PathId)
 
SCSI_ADAPTER_CONTROL_STATUS NTAPI BT958HwAdapterControl (IN PVOID HwDeviceExtension, IN SCSI_ADAPTER_CONTROL_TYPE ControlType, IN PVOID Parameters)
 
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 BusLogic_ReadHostAdapterConfiguration (BusLogic_HostAdapter_T *HostAdapter)
 
BOOLEAN BusLogic_InitializeHostAdapter (PHW_DEVICE_EXTENSION deviceExtension, PPORT_CONFIGURATION_INFORMATION ConfigInfo)
 
BOOLEAN BusLogic_TargetDeviceInquiry (BusLogic_HostAdapter_T *HostAdapter)
 
int BusLogic_QueueCommand (IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb, IN PBuslogic_CCB_T ccb)
 
BOOLEAN BusLogic_WriteOutgoingMailbox (PHW_DEVICE_EXTENSION deviceExtension, BusLogic_ActionCode_T ActionCode, BusLogic_CCB_T *CCB)
 
void BusLogic_ScanIncomingMailboxes (PHW_DEVICE_EXTENSION deviceExtension)
 
void BusLogic_QueueCompletedCCB (PHW_DEVICE_EXTENSION deviceExtension, BusLogic_CCB_T *CCB)
 
void BusLogic_ProcessCompletedCCBs (PHW_DEVICE_EXTENSION deviceExtension)
 
UCHAR BusLogic_ComputeResultCode (BusLogic_HostAdapter_T *HostAdapter, BusLogic_HostAdapterStatus_T HostAdapterStatus, BusLogic_TargetDeviceStatus_T TargetDeviceStatus, UCHAR SenseDataLength)
 
BOOLEAN BusLogic_SendBusDeviceReset (IN PVOID HwDeviceExtension, PSCSI_REQUEST_BLOCK Srb)
 
static UCHAR ReadBusLogicPort (PUCHAR adr)
 
static VOID WriteBusLogicPort (UCHAR data, PUCHAR adr)
 
static void BusLogic_InterruptReset (BusLogic_HostAdapter_T *HostAdapter)
 
static void BusLogic_SoftReset (BusLogic_HostAdapter_T *HostAdapter)
 
static void BusLogic_HardReset (BusLogic_HostAdapter_T *HostAdapter)
 
static UCHAR BusLogic_ReadStatusRegister (BusLogic_HostAdapter_T *HostAdapter)
 
static UCHAR BusLogic_ReadInterruptRegister (BusLogic_HostAdapter_T *HostAdapter)
 
static UCHAR BusLogic_ReadGeometryRegister (BusLogic_HostAdapter_T *HostAdapter)
 
static UCHAR BusLogic_ReadDataInRegister (BusLogic_HostAdapter_T *HostAdapter)
 
static void BusLogic_WriteCommandParameterRegister (BusLogic_HostAdapter_T *HostAdapter, UCHAR Value)
 
static void BusLogic_StartMailboxCommand (BusLogic_HostAdapter_T *HostAdapter)
 
static void BusLogic_IncrementByteCounter (BusLogic_ByteCounter_T *ByteCounter, unsigned int Amount)
 
static void BusLogic_IncrementSizeBucket (BusLogic_CommandSizeBuckets_T CommandSizeBuckets, unsigned int Amount)
 
static void BusLogic_IncrementErrorCounter (unsigned short *ErrorCounter)
 

Variables

static BusLogic_HostAdapterBusType_T BusLogic_HostAdapterBusTypes []
 

Macro Definition Documentation

◆ BusLogic_AggressiveRoundRobinMode

#define BusLogic_AggressiveRoundRobinMode   0

Definition at line 105 of file BusLogic958.h.

◆ BusLogic_Allocate14Bytes

#define BusLogic_Allocate14Bytes   0x00

Definition at line 109 of file BusLogic958.h.

◆ BusLogic_AutoSCSI_BaseOffset

#define BusLogic_AutoSCSI_BaseOffset   64

Definition at line 94 of file BusLogic958.h.

◆ BusLogic_BIOS_BaseOffset

#define BusLogic_BIOS_BaseOffset   0

Definition at line 93 of file BusLogic958.h.

◆ BusLogic_CDB_MaxLength

#define BusLogic_CDB_MaxLength   12

Definition at line 97 of file BusLogic958.h.

◆ BusLogic_CommandParameterRegisterOffset

#define BusLogic_CommandParameterRegisterOffset   1

Definition at line 949 of file BusLogic958.h.

◆ BusLogic_ControlRegisterOffset

#define BusLogic_ControlRegisterOffset   0

Definition at line 947 of file BusLogic958.h.

◆ BusLogic_DataInRegisterOffset

#define BusLogic_DataInRegisterOffset   1

Definition at line 950 of file BusLogic958.h.

◆ BusLogic_DefaultBusSettleTime

#define BusLogic_DefaultBusSettleTime   2

Definition at line 78 of file BusLogic958.h.

◆ BusLogic_DisableAutoReqSense

#define BusLogic_DisableAutoReqSense   0x01

Definition at line 110 of file BusLogic958.h.

◆ BusLogic_GeometryRegisterOffset

#define BusLogic_GeometryRegisterOffset   3

Definition at line 952 of file BusLogic958.h.

◆ BusLogic_InterruptRegisterOffset

#define BusLogic_InterruptRegisterOffset   2

Definition at line 951 of file BusLogic958.h.

◆ BUSLOGIC_MAXIMUM_TAGS

#define BUSLOGIC_MAXIMUM_TAGS   128

Definition at line 67 of file BusLogic958.h.

◆ BusLogic_MaxLogicalUnits

#define BusLogic_MaxLogicalUnits   32

Definition at line 84 of file BusLogic958.h.

◆ BusLogic_MaxMailboxes

#define BusLogic_MaxMailboxes   211

Definition at line 90 of file BusLogic958.h.

◆ BusLogic_MaxTaggedQueueDepth

#define BusLogic_MaxTaggedQueueDepth   128

Definition at line 72 of file BusLogic958.h.

◆ BusLogic_MaxTargetDevices

#define BusLogic_MaxTargetDevices   16

Definition at line 81 of file BusLogic958.h.

◆ BusLogic_ScatterGatherLimit

#define BusLogic_ScatterGatherLimit   128

Definition at line 102 of file BusLogic958.h.

◆ BusLogic_SizeBuckets

#define BusLogic_SizeBuckets   10

Definition at line 248 of file BusLogic958.h.

◆ BusLogic_StatusRegisterOffset

#define BusLogic_StatusRegisterOffset   0

Definition at line 948 of file BusLogic958.h.

◆ BusLogic_StrictRoundRobinMode

#define BusLogic_StrictRoundRobinMode   1

Definition at line 106 of file BusLogic958.h.

◆ ERROR

#define ERROR   1

Definition at line 55 of file BusLogic958.h.

◆ INFO

#define INFO   4

Definition at line 58 of file BusLogic958.h.

◆ MAX_SG_LIMIT

#define MAX_SG_LIMIT   BusLogic_ScatterGatherLimit

Definition at line 103 of file BusLogic958.h.

◆ MAX_TRANSFER_SIZE

#define MAX_TRANSFER_SIZE   64 * 1024

Definition at line 61 of file BusLogic958.h.

◆ SG_SUPPORT

#define SG_SUPPORT   1

Definition at line 63 of file BusLogic958.h.

◆ TAG_QUEUING

#define TAG_QUEUING   1

Definition at line 65 of file BusLogic958.h.

◆ TRACE

#define TRACE   3

Definition at line 57 of file BusLogic958.h.

◆ WARNING

#define WARNING   2

Definition at line 56 of file BusLogic958.h.

Typedef Documentation

◆ BusLogic_AutoSCSIData_T

◆ BusLogic_BIOS_DiskGeometryTranslation_T

◆ BusLogic_BoardID_T

◆ BusLogic_BusAddress_T

typedef unsigned int BusLogic_BusAddress_T

Definition at line 172 of file BusLogic958.h.

◆ BusLogic_ByteCount_T

typedef unsigned int BusLogic_ByteCount_T

Definition at line 184 of file BusLogic958.h.

◆ BusLogic_ByteCounter_T

◆ BusLogic_CCB_T

◆ BusLogic_CommandSizeBuckets_T

typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets]

Definition at line 257 of file BusLogic958.h.

◆ BusLogic_Configuration_T

◆ BusLogic_ControlRegister_T

◆ BusLogic_ExtendedMailboxRequest_T

◆ BusLogic_ExtendedSetupInformation_T

◆ BusLogic_FetchHostAdapterLocalRAMRequest_T

◆ BusLogic_FirmwareVersion3rdDigit_T

Definition at line 178 of file BusLogic958.h.

◆ BusLogic_FirmwareVersionLetter_T

Definition at line 181 of file BusLogic958.h.

◆ BusLogic_GeometryRegister_T

◆ BusLogic_HostAdapter_T

◆ BusLogic_HostAdapterModelNumber_T

typedef UCHAR BusLogic_HostAdapterModelNumber_T[5]

Definition at line 175 of file BusLogic958.h.

◆ BusLogic_IncomingMailbox_T

◆ BusLogic_InstalledDevices8_T

typedef UCHAR BusLogic_InstalledDevices8_T[8]

Definition at line 1109 of file BusLogic958.h.

◆ BusLogic_InstalledDevices_T

Definition at line 1115 of file BusLogic958.h.

◆ BusLogic_InterruptRegister_T

◆ BusLogic_ISACompatibleIOPort_T

◆ BusLogic_OutgoingMailbox_T

◆ BusLogic_PCIHostAdapterInformation_T

◆ BusLogic_RequestedReplyLength_T

Definition at line 169 of file BusLogic958.h.

◆ BusLogic_ScatterGatherSegment_T

◆ BusLogic_SetCCBFormatRequest_T

◆ BusLogic_SetupInformation_T

◆ BusLogic_StatusRegister_T

◆ BusLogic_SynchronousPeriod_T

typedef UCHAR BusLogic_SynchronousPeriod_T[BusLogic_MaxTargetDevices]

Definition at line 1103 of file BusLogic958.h.

◆ BusLogic_SynchronousValue_T

◆ BusLogic_SynchronousValues8_T

typedef BusLogic_SynchronousValue_T BusLogic_SynchronousValues8_T[8]

Definition at line 310 of file BusLogic958.h.

◆ BusLogic_TargetFlags_T

◆ BusLogic_TargetStatistics_T

◆ BusLogic_WmiExtendedSetupInformation_T

◆ HW_DEVICE_EXTENSION

◆ NONCACHED_EXTENSION

◆ PBuslogic_CCB_T

◆ PBusLogic_WmiExtendedSetupInformation_T

◆ PHW_DEVICE_EXTENSION

◆ PNONCACHED_EXTENSION

◆ SCSI_CDB_T

typedef UCHAR SCSI_CDB_T[BusLogic_CDB_MaxLength]

Definition at line 537 of file BusLogic958.h.

◆ SCSI_Inquiry_T

Enumeration Type Documentation

◆ BusLogic_ActionCode_T

Enumerator
BusLogic_OutgoingMailboxFree 
BusLogic_MailboxStartCommand 
BusLogic_MailboxAbortCommand 

Definition at line 437 of file BusLogic958.h.

◆ BusLogic_BIOS_DiskGeometryTranslation

Enumerator
BusLogic_BIOS_Disk_Not_Installed 
BusLogic_BIOS_Disk_Installed_64x32 
BusLogic_BIOS_Disk_Installed_128x32 
BusLogic_BIOS_Disk_Installed_255x63 

Definition at line 1005 of file BusLogic958.h.

◆ BusLogic_CCB_Opcode_T

Enumerator
BusLogic_InitiatorCCB 
BusLogic_TargetCCB 
BusLogic_InitiatorCCB_ScatterGather 
BusLogic_InitiatorCCB_ResidualDataLength 
BusLogic_InitiatorCCB_ScatterGatherResidual 
BusLogic_BusDeviceReset 

Definition at line 459 of file BusLogic958.h.

◆ BusLogic_CCB_Status_T

Enumerator
BusLogic_CCB_Free 
BusLogic_CCB_Active 
BusLogic_CCB_Completed 
BusLogic_CCB_Reset 

Definition at line 540 of file BusLogic958.h.

◆ BusLogic_CompletionCode_T

Enumerator
BusLogic_IncomingMailboxFree 
BusLogic_CommandCompletedWithoutError 
BusLogic_CommandAbortedAtHostRequest 
BusLogic_AbortedCommandNotFound 
BusLogic_CommandCompletedWithError 
BusLogic_InvalidCCB 

Definition at line 448 of file BusLogic958.h.

◆ BusLogic_DataDirection_T

Enumerator
BusLogic_UncheckedDataTransfer 
BusLogic_DataInLengthChecked 
BusLogic_DataOutLengthChecked 
BusLogic_NoDataTransfer 

Definition at line 471 of file BusLogic958.h.

◆ BusLogic_HostAdapterBusType_T

Enumerator
BusLogic_Unknown_Bus 
BusLogic_ISA_Bus 
BusLogic_EISA_Bus 
BusLogic_PCI_Bus 
BusLogic_VESA_Bus 
BusLogic_MCA_Bus 

Definition at line 645 of file BusLogic958.h.

◆ BusLogic_HostAdapterStatus_T

Enumerator
BusLogic_CommandCompletedNormally 
BusLogic_LinkedCommandCompleted 
BusLogic_LinkedCommandCompletedWithFlag 
BusLogic_DataUnderRun 
BusLogic_SCSISelectionTimeout 
BusLogic_DataOverRun 
BusLogic_UnexpectedBusFree 
BusLogic_InvalidBusPhaseRequested 
BusLogic_InvalidOutgoingMailboxActionCode 
BusLogic_InvalidCommandOperationCode 
BusLogic_LinkedCCBhasInvalidLUN 
BusLogic_InvalidCommandParameter 
BusLogic_AutoRequestSenseFailed 
BusLogic_TaggedQueuingMessageRejected 
BusLogic_UnsupportedMessageReceived 
BusLogic_HostAdapterHardwareFailed 
BusLogic_TargetFailedResponseToATN 
BusLogic_HostAdapterAssertedRST 
BusLogic_OtherDeviceAssertedRST 
BusLogic_TargetDeviceReconnectedImproperly 
BusLogic_HostAdapterAssertedBusDeviceReset 
BusLogic_AbortQueueGenerated 
BusLogic_HostAdapterSoftwareError 
BusLogic_HostAdapterHardwareTimeoutError 
BusLogic_SCSIParityErrorDetected 

Definition at line 482 of file BusLogic958.h.

483 {
487  BusLogic_DataUnderRun = 0x0C,
489  BusLogic_DataOverRun = 0x12,
BusLogic_HostAdapterStatus_T
Definition: BusLogic958.h:482

◆ BusLogic_HostAdapterType_T

Enumerator
BusLogic_MultiMaster 
BusLogic_FlashPoint 

Definition at line 638 of file BusLogic958.h.

◆ BusLogic_ISACompatibleIOPort

Enumerator
BusLogic_IO_330 
BusLogic_IO_334 
BusLogic_IO_230 
BusLogic_IO_234 
BusLogic_IO_130 
BusLogic_IO_134 
BusLogic_IO_Disable 
BusLogic_IO_Disable2 

Definition at line 196 of file BusLogic958.h.

◆ BusLogic_OperationCode_T

Enumerator
BusLogic_TestCommandCompleteInterrupt 
BusLogic_InitializeMailbox 
BusLogic_ExecuteMailboxCommand 
BusLogic_ExecuteBIOSCommand 
BusLogic_InquireBoardID 
BusLogic_EnableOutgoingMailboxAvailableInt 
BusLogic_SetSCSISelectionTimeout 
BusLogic_SetPreemptTimeOnBus 
BusLogic_SetTimeOffBus 
BusLogic_SetBusTransferRate 
BusLogic_InquireInstalledDevicesID0to7 
BusLogic_InquireConfiguration 
BusLogic_EnableTargetMode 
BusLogic_InquireSetupInformation 
BusLogic_WriteAdapterLocalRAM 
BusLogic_ReadAdapterLocalRAM 
BusLogic_WriteBusMasterChipFIFO 
BusLogic_ReadBusMasterChipFIFO 
BusLogic_EchoCommandData 
BusLogic_HostAdapterDiagnostic 
BusLogic_SetAdapterOptions 
BusLogic_InquireInstalledDevicesID8to15 
BusLogic_InquireTargetDevices 
BusLogic_DisableHostAdapterInterrupt 
BusLogic_InitializeExtendedMailbox 
BusLogic_ExecuteSCSICommand 
BusLogic_InquireFirmwareVersion3rdDigit 
BusLogic_InquireFirmwareVersionLetter 
BusLogic_InquirePCIHostAdapterInformation 
BusLogic_InquireHostAdapterModelNumber 
BusLogic_InquireSynchronousPeriod 
BusLogic_InquireExtendedSetupInformation 
BusLogic_EnableStrictRoundRobinMode 
BusLogic_StoreHostAdapterLocalRAM 
BusLogic_FetchHostAdapterLocalRAM 
BusLogic_StoreLocalDataInEEPROM 
BusLogic_UploadAutoSCSICode 
BusLogic_ModifyIOAddress 
BusLogic_SetCCBFormat 
BusLogic_WriteInquiryBuffer 
BusLogic_ReadInquiryBuffer 
BusLogic_FlashROMUploadDownload 
BusLogic_ReadSCAMData 
BusLogic_WriteSCAMData 

Definition at line 117 of file BusLogic958.h.

118 {
127  BusLogic_SetTimeOffBus = 0x08,
157  BusLogic_SetCCBFormat = 0x96,
161  BusLogic_ReadSCAMData = 0xA8,
BusLogic_OperationCode_T
Definition: BusLogic958.h:117

◆ BusLogic_QueueTag_T

Enumerator
BusLogic_SimpleQueueTag 
BusLogic_HeadOfQueueTag 
BusLogic_OrderedQueueTag 
BusLogic_ReservedQT 

Definition at line 520 of file BusLogic958.h.

◆ BusLogic_SetCCBFormatRequest

Enumerator
BusLogic_LegacyLUNFormatCCB 
BusLogic_ExtendedLUNFormatCCB 

Definition at line 1128 of file BusLogic958.h.

◆ BusLogic_TargetDeviceStatus_T

Enumerator
BusLogic_OperationGood 
BusLogic_CheckCondition 
BusLogic_DeviceBusy 

Definition at line 512 of file BusLogic958.h.

Function Documentation

◆ BT958HwAdapterControl()

SCSI_ADAPTER_CONTROL_STATUS NTAPI BT958HwAdapterControl ( IN PVOID  HwDeviceExtension,
IN SCSI_ADAPTER_CONTROL_TYPE  ControlType,
IN PVOID  Parameters 
)

Definition at line 2651 of file BusLogic958.c.

2673 {
2674  PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
2675  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
2676 // UCHAR *ParameterPointer;
2677 // BusLogic_StatusRegister_T StatusRegister;
2678 // BusLogic_InterruptRegister_T InterruptRegister;
2679 // int Result,ParameterLength;
2680 // long TimeoutCounter;
2681 
2682  PSCSI_SUPPORTED_CONTROL_TYPE_LIST ControlTypeList;
2683  ULONG AdjustedMaxControlType;
2684 
2685  ULONG Index;
2686 // UCHAR Retries;
2687 
2688  // Default Status
2689 // SCSI_ADAPTER_CONTROL_STATUS Status = ScsiAdapterControlSuccess;
2690 
2691  //
2692  // Structure defining which functions this miniport supports
2693  //
2694  BOOLEAN SupportedConrolTypes[ScsiAdapterControlMax] =
2695  {
2696  TRUE, // ScsiQuerySupportedControlTypes
2697  TRUE, // ScsiStopAdapter
2698  TRUE, // ScsiRestartAdapter
2699  FALSE, // ScsiSetBootConfig
2700  FALSE // ScsiSetRunningConfig
2701  };
2702 
2703  DebugPrint((TRACE, "\n BusLogic - Inside HwAdapterControl function \n"));
2704  switch(ControlType)
2705  {
2707  // Reports the adapter-control operations implemented by the miniport. The port
2708  // driver calls HwScsiAdapterControl with this control type after the HBA has been
2709  // initialized but before the first I/O. The miniport fills in the
2710  // SCSI_SUPPORTED_CONTROL_TYPE_LIST structure at Parameters with the operations it
2711  // supports. After HwScsiAdapterControl returns from this call, the port driver
2712  // calls the miniport's HwScsiAdapterControl only for supported operations.
2713  {
2714 
2715  // This entry point provides the method by which SCSIPort determines the
2716  // supported ControlTypes. Parameters is a pointer to a
2717  // SCSI_SUPPORTED_CONTROL_TYPE_LIST structure. Fill in this structure
2718  // honoring the size limits.
2719  ControlTypeList = Parameters;
2720  AdjustedMaxControlType = (ControlTypeList->MaxControlType < ScsiAdapterControlMax) ? ControlTypeList->MaxControlType :ScsiAdapterControlMax;
2721  for (Index = 0; Index < AdjustedMaxControlType; Index++)
2722  {
2723  ControlTypeList->SupportedTypeList[Index] = SupportedConrolTypes[Index];
2724  }
2725  break;
2726  }
2727 
2728  case ScsiStopAdapter:
2729  // Shuts down the HBA. The port driver calls HwScsiAdapterControl with this control
2730  // type when the HBA has been removed from the system, stopped for resource reconfiguration,
2731  // shut down for power management, or otherwise reconfigured or disabled. The port driver
2732  // ensures that there are no uncompleted requests and issues an SRB_FUNCTION_FLUSH request
2733  // to the miniport before calling this routine. The miniport disables interrupts on its HBA,
2734  // halts all processing, (including background processing not subject to interrupts or processing
2735  // of which the port driver is unaware, such as reconstructing fault-tolerant volumes), flushes
2736  // any remaining cached data to persistent storage, and puts the HBA into a state from which it
2737  // can be reinitialized or restarted.
2738  // The miniport should not free its resources when stopping its HBA. If the HBA was removed or
2739  // stopped for PnP resource reconfiguration, the port driver releases resources on behalf of the
2740  // miniport driver. If the HBA is shut down for power management, the miniport's resources are
2741  // preserved so the HBA can be restarted.
2742  {
2743  CHAR Parameter = 0;
2744  DebugPrint((INFO, "\n BusLogic - stopping the device \n"));
2745  if (BusLogic_Command(HostAdapter,
2747  &Parameter,
2748  sizeof(Parameter),
2749  NULL,
2750  0)
2751  < 0)
2752  {
2754  }
2755  break;
2756  }
2757 
2758  case ScsiRestartAdapter:
2759  // Reinitializes an HBA. The port driver calls HwScsiAdapterControl with this control type to power
2760  // up an HBA that was shut down for power management. All resources previously assigned to the miniport
2761  // are still available, and its device extension and logical unit extensions, if any, are intact.
2762  // The miniport performs the same operations as in its HwScsiInitialize routine, such as setting up
2763  // the HBA's registers and its initial state, if any.
2764  // The miniport must not call routines that can only be called from HwScsiFindAdapter or from
2765  // HwScsiAdapterControl when the control type is ScsiSetRunningConfig, such as ScsiPortGetBusData and
2766  // ScsiPortSetBusDataByOffset. If the miniport must call such routines to restart its HBA, it must also
2767  // implement ScsiSetRunningConfig.
2768  // If the miniport does not implement ScsiRestartAdapter, the port driver calls the miniport's HwScsiFindAdapter and HwScsiInitialize routines. However, because such routines might do detection work which is unnecessary for restarting the HBA, such a miniport will not power up its HBA as quickly as a miniport that implements ScsiRestartAdapter.
2769 
2770  // See PR 69004. We were not calling BT958HwInitialize earlier if the
2771  // first two calls succeeded thus causing resume from standby to fail.
2772  {
2773  if (!(BusLogic_HardwareResetHostAdapter(HostAdapter, TRUE) &&
2774  BusLogic_InitializeHostAdapter(deviceExtension, NULL) &&
2775  BT958HwInitialize(HwDeviceExtension))
2776  )
2777  {
2778  DebugPrint((ERROR, "\n Buslogic - Resetting %s Failed\n",
2779  HostAdapter->FullModelName));
2781  }
2782 
2783  ScsiPortStallExecution(HostAdapter->BusSettleTime);
2784  break;
2785  }
2786  default:
2787  {
2789  }
2790  }
2792 }// end BT958HwAdapterControl
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
char CHAR
Definition: xmlstorage.h:175
_In_ PVOID Parameter
Definition: ldrtypes.h:241
OUT BOOLEAN SupportedTypeList[0]
Definition: srb.h:213
UCHAR FullModelName[18]
Definition: BusLogic958.h:676
int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter, BusLogic_OperationCode_T OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
Definition: BusLogic958.c:606
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
unsigned short BusSettleTime
Definition: BusLogic958.h:715
#define TRACE(s)
Definition: solgame.cpp:4
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
BOOLEAN BusLogic_InitializeHostAdapter(PHW_DEVICE_EXTENSION deviceExtension, PPORT_CONFIGURATION_INFORMATION ConfigInfo)
Definition: BusLogic958.c:1175
BOOLEAN BusLogic_HardwareResetHostAdapter(BusLogic_HostAdapter_T *HostAdapter, BOOLEAN HardReset)
Definition: BusLogic958.c:470
static const UCHAR Index[8]
Definition: usbohci.c:18
#define for
Definition: utility.h:88
_In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters
Definition: iotypes.h:872
BOOLEAN NTAPI BT958HwInitialize(IN PVOID HwDeviceExtension)
Definition: BusLogic958.c:2620
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
Definition: precomp.h:83
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI ScsiPortStallExecution(IN ULONG Delay)
Definition: scsiport.c:1473

Referenced by DriverEntry().

◆ BT958HwFindAdapter()

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

Definition at line 173 of file BusLogic958.c.

204 {
205  PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
206  BusLogic_HostAdapter_T *hcsp = &(deviceExtension->hcs);
207 // static UCHAR k = 0;
208  PACCESS_RANGE accessRange;
209 // PCI_COMMON_CONFIG PCICommonConfig;
210  PUCHAR pciAddress;
211  char NumPort = 0;
212 
213  DebugPrint((TRACE,"\n BusLogic - Inside the Find Adapter Routine\n"));
214 
215  *Again = FALSE;
216 
217  accessRange = &((*(ConfigInfo->AccessRanges))[0]);
218 
219  // Inform SCSIPORT that we are NOT a WMI data provider
220  // Sirish, 10th June 2002
221  ConfigInfo->WmiDataProvider = FALSE;
222  /*Sirish, 10th June 2002 BT958WmiInitialize(deviceExtension);*/
223 
224  // Check for configuration information passed in form the system
225  if ((*ConfigInfo->AccessRanges)[0].RangeLength != 0)
226  {
227  // check if the system supplied bus-relative address is valid and has not been
228  // claimed by another device
229  if ( ScsiPortValidateRange(deviceExtension,
230  ConfigInfo->AdapterInterfaceType,
231  ConfigInfo->SystemIoBusNumber,
232  accessRange->RangeStart,
233  accessRange->RangeLength,
234  TRUE) ) // TRUE: iniospace
235  {
236  DebugPrint((INFO,"\n BusLogic - Validate Range function succeeded \n"));
237 
238  // Map the Bus-relative range addresses to system-space logical range addresses
239  // so that these mapped logical addresses can be called with SciPortRead/Writexxx
240  // to determine whether the adapter is an HBA that the driver supports
241 
242  pciAddress = (PUCHAR) ScsiPortGetDeviceBase(deviceExtension,
243  ConfigInfo->AdapterInterfaceType,
244  ConfigInfo->SystemIoBusNumber,
245  accessRange->RangeStart,
246  accessRange->RangeLength,
247  TRUE); // TRUE: iniospace
248 
249  if(pciAddress)
250  {
251  DebugPrint((INFO,"\n BusLogic - Get Device Base function succeeded \n"));
252 
253  memset(hcsp, 0, sizeof(BusLogic_HostAdapter_T));
254 
255  // points to structure of type BT958_HA which has device specific information. This needs
256  // to be either changed or modified with our specific info.
257  hcsp->IO_Address = pciAddress;
258  hcsp->IRQ_Channel = (UCHAR)ConfigInfo->BusInterruptLevel;
259  NumPort++;
260  }
261  }
262  }
263 
264  if (NumPort == 0)
265  {
266  return(SP_RETURN_NOT_FOUND);
267  }
268 
269  // Hardware found, let's find out hardware configuration
270  // and fill out ConfigInfo table for WinNT
271  ConfigInfo->NumberOfBuses = 1;
272  ConfigInfo->MaximumTransferLength = MAX_TRANSFER_SIZE;
273 
274 #if SG_SUPPORT
275  ConfigInfo->ScatterGather = TRUE;
276 #else
277  ConfigInfo->ScatterGather = FALSE;
278 #endif
279 
280  ConfigInfo->Master = TRUE;
281  ConfigInfo->NeedPhysicalAddresses = TRUE;
282  ConfigInfo->Dma32BitAddresses = TRUE;
283  ConfigInfo->InterruptMode = LevelSensitive;
284 
285 #if TAG_QUEUING
286  ConfigInfo->TaggedQueuing = TRUE;
287 #else
288  ConfigInfo->TaggedQueuing = FALSE;
289 #endif
290 
291  // Should we change this to double-word aligned to increase performance
292  ConfigInfo->AlignmentMask = 0x0;
293 
294  if (!Buslogic_InitBT958(deviceExtension,ConfigInfo)) // hardware specific initializations. Find what's for our card
295  {
296  ScsiPortLogError(deviceExtension,
297  NULL,
298  0,
299  0,
300  0,
302  7 << 8);
303 
304  return(SP_RETURN_ERROR);
305  }
306 
307  if (NumPort != 0)
308  *Again = TRUE;
309 
310  return(SP_RETURN_FOUND);
311 
312 } // end BT958FindAdapter()
#define MAX_TRANSFER_SIZE
Definition: BusLogic958.h:61
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
PVOID NTAPI ScsiPortGetDeviceBase(IN PVOID HwDeviceExtension, IN INTERFACE_TYPE BusType, IN ULONG SystemIoBusNumber, IN SCSI_PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfBytes, IN BOOLEAN InIoSpace)
Definition: scsiport.c:562
#define SP_INTERNAL_ADAPTER_ERROR
Definition: srb.h:501
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
#define SP_RETURN_NOT_FOUND
Definition: srb.h:513
#define SP_RETURN_FOUND
Definition: srb.h:514
SCSI_PHYSICAL_ADDRESS RangeStart
Definition: srb.h:41
unsigned char UCHAR
Definition: xmlstorage.h:181
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
Definition: precomp.h:83
ULONG RangeLength
Definition: srb.h:42
BOOLEAN NTAPI ScsiPortValidateRange(IN PVOID HwDeviceExtension, IN INTERFACE_TYPE BusType, IN ULONG SystemIoBusNumber, IN SCSI_PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfBytes, IN BOOLEAN InIoSpace)
Definition: scsiport.c:1481
VOID NTAPI ScsiPortLogError(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN ULONG ErrorCode, IN ULONG UniqueId)
Definition: scsiport.c:1283
#define SP_RETURN_ERROR
Definition: srb.h:515
#define memset(x, y, z)
Definition: compat.h:39
BOOLEAN Buslogic_InitBT958(PHW_DEVICE_EXTENSION deviceExtension, PPORT_CONFIGURATION_INFORMATION ConfigInfo)
Definition: BusLogic958.c:316

Referenced by DriverEntry().

◆ BT958HwInitialize()

BOOLEAN NTAPI BT958HwInitialize ( IN PVOID  HwDeviceExtension)

Definition at line 2620 of file BusLogic958.c.

2630 {
2631  PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
2632  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
2633  CHAR Parameter = 1;
2634 
2635  // enable interrupts
2636  if (BusLogic_Command(HostAdapter,
2638  &Parameter,
2639  sizeof(Parameter),
2640  NULL,
2641  0)
2642  < 0)
2643  {
2644  return FALSE;
2645  }
2646  return TRUE;
2647 }// end BT958HwInitialize
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
_In_ PVOID Parameter
Definition: ldrtypes.h:241
int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter, BusLogic_OperationCode_T OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
Definition: BusLogic958.c:606
smooth NULL
Definition: ftsmooth.c:416
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757

Referenced by BT958HwAdapterControl(), and DriverEntry().

◆ BT958HwInterrupt()

BOOLEAN NTAPI BT958HwInterrupt ( IN PVOID  HwDeviceExtension)

Definition at line 1973 of file BusLogic958.c.

1990 {
1991  PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
1992 // PNONCACHED_EXTENSION noncachedExtension = deviceExtension->NoncachedExtension;
1993  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
1994 // PBuslogic_CCB_T ccb;
1995 // PSCSI_REQUEST_BLOCK srb;
1996 
1997 // ULONG residualBytes;
1998 // ULONG i;
1999 
2000  BusLogic_InterruptRegister_T InterruptRegister;
2001 
2002 
2003  // Read the Host Adapter Interrupt Register.
2004  InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
2005  if (InterruptRegister.Bits.InterruptValid)
2006  {
2007 
2008  // Acknowledge the interrupt and reset the Host Adapter
2009  // Interrupt Register.
2010  BusLogic_InterruptReset(HostAdapter);
2011  // Process valid External SCSI Bus Reset and Incoming Mailbox
2012  // Loaded Interrupts. Command Complete Interrupts are noted,
2013  // and Outgoing Mailbox Available Interrupts are ignored, as
2014  // they are never enabled.
2015  if (InterruptRegister.Bits.ExternalBusReset)
2016  {
2017  HostAdapter->HostAdapterExternalReset = TRUE;
2018  }
2019  else if (InterruptRegister.Bits.IncomingMailboxLoaded)
2020  {
2021  BusLogic_ScanIncomingMailboxes(deviceExtension);
2022  }
2023  else if (InterruptRegister.Bits.CommandComplete)
2024  {
2025  HostAdapter->HostAdapterCommandCompleted = TRUE;
2026  }
2027  }
2028  else
2029  return FALSE;
2030 
2031  // Process any completed CCBs.
2032  if (HostAdapter->FirstCompletedCCB != NULL)
2033  BusLogic_ProcessCompletedCCBs(deviceExtension);
2034 
2035  // Reset the Host Adapter if requested.
2036  if (HostAdapter->HostAdapterExternalReset ||
2037  HostAdapter->HostAdapterInternalError)
2038  {
2039  // I have replaced the NULL with srb->pathid check if this is correct
2040  BT958HwResetBus(HwDeviceExtension, SP_UNTAGGED);
2041  HostAdapter->HostAdapterExternalReset = FALSE;
2042  HostAdapter->HostAdapterInternalError = FALSE;
2043  }
2044  return TRUE;
2045 }// end BT958HwInterrupt
BOOLEAN HostAdapterInternalError
Definition: BusLogic958.h:701
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI BT958HwResetBus(IN PVOID HwDeviceExtension, IN ULONG PathId)
Definition: BusLogic958.c:2448
static UCHAR BusLogic_ReadInterruptRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1065
#define SP_UNTAGGED
Definition: srb.h:225
smooth NULL
Definition: ftsmooth.c:416
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
struct BusLogic_InterruptRegister::@1280 Bits
BusLogic_CCB_T * FirstCompletedCCB
Definition: BusLogic958.h:728
void BusLogic_ScanIncomingMailboxes(PHW_DEVICE_EXTENSION deviceExtension)
Definition: BusLogic958.c:2048
void BusLogic_ProcessCompletedCCBs(PHW_DEVICE_EXTENSION deviceExtension)
Definition: BusLogic958.c:2139
BOOLEAN HostAdapterExternalReset
Definition: BusLogic958.h:700
volatile BOOLEAN HostAdapterCommandCompleted
Definition: BusLogic958.h:704
static void BusLogic_InterruptReset(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1028

Referenced by DriverEntry().

◆ BT958HwResetBus()

BOOLEAN NTAPI BT958HwResetBus ( IN PVOID  HwDeviceExtension,
IN ULONG  PathId 
)

Definition at line 2448 of file BusLogic958.c.

2461 {
2462  PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
2463  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
2464 // BusLogic_CCB_T *CCB;
2465 // int TargetID;
2466  BOOLEAN Result;
2467  BOOLEAN HardReset;
2468 
2469  DebugPrint((TRACE, "\n BusLogic - Reset SCSI bus\n"));
2470 
2471  // Complete all outstanding requests with SRB_STATUS_BUS_RESET.
2472  ScsiPortCompleteRequest(deviceExtension,
2473  (UCHAR)PathId,
2474  0xFF,
2475  0xFF,
2477 
2478  if (HostAdapter->HostAdapterExternalReset)
2479  {
2480  //BusLogic_IncrementErrorCounter(&HostAdapter->ExternalHostAdapterResets);
2481  HardReset = FALSE;
2482  }
2483  else if (HostAdapter->HostAdapterInternalError)
2484  {
2485  //BusLogic_IncrementErrorCounter(&HostAdapter->HostAdapterInternalErrors);
2486  HardReset = TRUE;
2487  }
2488  else
2489  {
2490  //BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[srb->TargetId].HostAdapterResetsRequested);
2491  HardReset = TRUE;
2492  }
2493 
2494  // Think of a way of doing this - Namita
2495  /*
2496  if(srb == NULL)
2497  {
2498  if (HostAdapter->HostAdapterInternalError)
2499  DebugPrint((0,"BusLogic Warning: Resetting %s due to Host Adapter Internal Error\n",HostAdapter->FullModelName));
2500  else
2501  DebugPrint((0,"BUsLogic Warning: Resetting %s due to External SCSI Bus Reset\n",HostAdapter->FullModelName));
2502  }
2503  else
2504  {
2505  DebugPrint((0,"BusLogic Warning: Resetting %s due to Target %d\n", HostAdapter->FullModelName, srb->TargetId));
2506  //BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[srb->TargetId].HostAdapterResetsAttempted);
2507  }
2508  */
2509 
2510  // Attempt to Reset and Reinitialize the Host Adapter.
2511  // Change the initialize routine to make allocation some place else
2512  if (!(BusLogic_HardwareResetHostAdapter(HostAdapter, HardReset) && BusLogic_InitializeHostAdapter(deviceExtension, NULL)))
2513  {
2514  DebugPrint((ERROR, "\n Buslogic - Resetting %s Failed\n",
2515  HostAdapter->FullModelName));
2516  Result = FALSE;
2517  goto Done;
2518  }
2519 
2520  // Check if we have to do this, document says that the scsi port driver takes care of the reset delays - Namita
2521  // Wait a few seconds between the Host Adapter Hard Reset which initiates
2522  // a SCSI Bus Reset and issuing any SCSI Commands. Some SCSI devices get
2523  // confused if they receive SCSI Commands too soon after a SCSI Bus Reset.
2524  // Note that a timer interrupt may occur here, but all active CCBs have
2525  // already been marked Reset and so a reentrant call will return Pending.
2526  if (HardReset)
2527  ScsiPortStallExecution(HostAdapter->BusSettleTime);
2528  Result = TRUE;
2529 
2530 Done:
2531  return Result;
2532 }// end BT958HwResetBus
BOOLEAN HostAdapterInternalError
Definition: BusLogic958.h:701
#define SRB_STATUS_BUS_RESET
Definition: srb.h:345
#define TRUE
Definition: types.h:120
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1117
#define ERROR(name)
Definition: error_private.h:53
VOID NTAPI ScsiPortCompleteRequest(IN PVOID HwDeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN UCHAR SrbStatus)
Definition: scsiport.c:498
UCHAR FullModelName[18]
Definition: BusLogic958.h:676
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
unsigned short BusSettleTime
Definition: BusLogic958.h:715
#define TRACE(s)
Definition: solgame.cpp:4
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
BOOLEAN BusLogic_InitializeHostAdapter(PHW_DEVICE_EXTENSION deviceExtension, PPORT_CONFIGURATION_INFORMATION ConfigInfo)
Definition: BusLogic958.c:1175
BOOLEAN BusLogic_HardwareResetHostAdapter(BusLogic_HostAdapter_T *HostAdapter, BOOLEAN HardReset)
Definition: BusLogic958.c:470
unsigned char UCHAR
Definition: xmlstorage.h:181
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
BOOLEAN HostAdapterExternalReset
Definition: BusLogic958.h:700
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI ScsiPortStallExecution(IN ULONG Delay)
Definition: scsiport.c:1473

Referenced by BT958HwInterrupt(), BT958HwStartIO(), and DriverEntry().

◆ BT958HwStartIO()

BOOLEAN NTAPI BT958HwStartIO ( IN PVOID  HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK  Srb 
)

Definition at line 1458 of file BusLogic958.c.

1474 {
1475  PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
1476 // PNONCACHED_EXTENSION noncachedExtension = deviceExtension->NoncachedExtension;
1477  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
1478 // BusLogic_OutgoingMailbox_T mailboxOut;
1479  PSCSI_REQUEST_BLOCK AbortSRB;
1480 
1482  BusLogic_TargetFlags_T *TargetFlags = &HostAdapter->TargetFlags[Srb->TargetId];
1483 
1484 
1485  DebugPrint((TRACE, "\n BusLogic - Inside Start IO routine\n"));
1486 
1487  // Make sure that this request isn't too long for the adapter. If so
1488  // bounce it back as an invalid request
1489  if (BusLogic_CDB_MaxLength < Srb->CdbLength)
1490  {
1491 
1492  DebugPrint((WARNING, "\n BusLogic - Srb->CdbLength [%d] > MaxCdbLength [%d]."
1493  " Invalid request\n", Srb->CdbLength, BusLogic_CDB_MaxLength));
1494 
1495  Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
1496  ScsiPortNotification(RequestComplete,deviceExtension,Srb);
1497  ScsiPortNotification(NextRequest,deviceExtension,NULL);
1498  return TRUE;
1499  }
1500 
1501  switch (Srb->Function)
1502  {
1503  /*
1504  Sirish, 10th June 2002
1505  // Check if command is a WMI request.
1506  case SRB_FUNCTION_WMI:
1507  // Process the WMI request and return.
1508  return BT958WmiSrb(HwDeviceExtension, (PSCSI_WMI_REQUEST_BLOCK) Srb);
1509  */
1510 
1512 
1513  // get the ccb structure from the extension
1514  ccb = Srb->SrbExtension;
1516 
1517  // Save SRB back pointer in CCB.
1518  ccb->SrbAddress = Srb;
1519 
1520  // Build CCB. - Have some way of knowing that a srb has already been
1521  // completed and you just need to return from here
1522  BusLogic_QueueCommand(HwDeviceExtension ,Srb, ccb);
1523 
1524  // Place the CCB in an Outgoing Mailbox. The higher levels of the SCSI
1525  // Subsystem should not attempt to queue more commands than can be placed
1526  // in Outgoing Mailboxes, so there should always be one free. In the
1527  // unlikely event that there are none available, wait 1 second and try
1528  // again. If that fails, the Host Adapter is probably hung so signal an
1529  // error as a Host Adapter Hard Reset should be initiated soon.
1530 
1532  {
1533  DebugPrint((ERROR, "\n BusLogic - Unable to write Outgoing Mailbox - "
1534  "Pausing for 1 second\n"));
1535  ScsiPortStallExecution(1000);
1537  {
1538  DebugPrint((ERROR, "\n BusLogic - Still unable to write Outgoing"
1539  "Mailbox - Host Adapter Dead?\n"));
1540 
1541  Srb->SrbStatus = SRB_STATUS_ERROR;
1542  ScsiPortNotification(RequestComplete,deviceExtension,Srb);
1543  ScsiPortNotification(NextRequest,deviceExtension,NULL);
1544 
1545  }
1546  }
1547  else
1548  {
1549  /*
1550  * Reverted to pre 1.1.0.0 control flow
1551  * The 1.1.0.0 control flow causes the .NET Server freeze during installs/restarts
1552  * And the fix for that in 1.1.0.1 causes BSODs in XP
1553  * Side note: Ben: the Buslogic emulation never exports more than 1 lun
1554  */
1555  if (TargetFlags->TaggedQueuingActive
1556  && HostAdapter->ActiveCommandsPerLun[Srb->TargetId][Srb->Lun] < BUSLOGIC_MAXIMUM_TAGS) {
1557  ScsiPortNotification(NextLuRequest, HwDeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
1558  }
1559  else {
1560  ScsiPortNotification(NextRequest,deviceExtension,NULL);
1561  }
1562  }
1563  return TRUE;
1564 
1566 
1567  // Get CCB to abort.
1568  ccb = Srb->NextSrb->SrbExtension;
1569 
1570  // Set abort SRB for completion.
1571  ccb->AbortSrb = Srb;
1572 
1573  AbortSRB = ScsiPortGetSrb(HwDeviceExtension,
1574  Srb->PathId,
1575  Srb->TargetId,
1576  Srb->Lun,
1577  Srb->QueueTag);
1578 
1579  if ((AbortSRB != Srb->NextSrb) || (AbortSRB->SrbStatus != SRB_STATUS_PENDING))
1580  {
1581  Srb->SrbStatus = SRB_STATUS_ABORT_FAILED;
1582  ScsiPortNotification(RequestComplete, HwDeviceExtension, Srb);
1583  ScsiPortNotification(NextRequest, HwDeviceExtension, NULL);
1584  return TRUE;
1585  }
1586 
1587  // write the abort information into a mailbox
1589  {
1590  DebugPrint((WARNING, "\n BusLogic - Aborting CCB #%ld to Target %d\n",
1591  ccb->SerialNumber, Srb->TargetId));
1592  // Adapter ready for next request.
1593 
1594  /*
1595  * Reverted to pre 1.1.0.0 control flow
1596  * The 1.1.0.0 control flow causes the .NET Server freeze during installs/restarts
1597  * And the fix for that in 1.1.0.1 causes BSODs in XP
1598  * Side note: Ben: the Buslogic emulation never exports more than 1 lun
1599  */
1600  if (TargetFlags->TaggedQueuingActive
1601  && HostAdapter->ActiveCommandsPerLun[Srb->TargetId][Srb->Lun] < BUSLOGIC_MAXIMUM_TAGS) {
1602  ScsiPortNotification(NextLuRequest, HwDeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
1603  }
1604  else {
1605  ScsiPortNotification(NextRequest,deviceExtension,NULL);
1606  }
1607  }
1608  else
1609  {
1610  DebugPrint((WARNING, "\n BusLogic - Unable to Abort CCB #%ld to Target %d"
1611  " - No Outgoing Mailboxes\n", ccb->SerialNumber,
1612  Srb->TargetId));
1613  Srb->SrbStatus = SRB_STATUS_ERROR;
1614  ScsiPortNotification(RequestComplete, HwDeviceExtension, Srb);
1615  ScsiPortNotification(NextRequest, HwDeviceExtension, NULL);
1616  }
1617  return TRUE;
1618 
1619 
1621 
1622  // Reset SCSI bus.
1623  DebugPrint((INFO, "\n BusLogic - SRB_FUNCTION_RESET_BUS, srb=%x \n",Srb));
1624  BT958HwResetBus(HwDeviceExtension, Srb->PathId);
1625 
1626  Srb->SrbStatus = SRB_STATUS_SUCCESS;
1627  ScsiPortNotification(RequestComplete, HwDeviceExtension, Srb);
1628  ScsiPortNotification(NextRequest, HwDeviceExtension, NULL);
1629  return TRUE;
1630 
1631 
1633 
1634  ccb = Srb->SrbExtension;
1636 
1637  // Save SRB back pointer in CCB.
1638  ccb->SrbAddress = Srb;
1639 
1640  if(!BusLogic_SendBusDeviceReset(HostAdapter, Srb))
1641  {
1642  BT958HwResetBus(HwDeviceExtension, SP_UNTAGGED);
1643  Srb->SrbStatus = SRB_STATUS_SUCCESS;
1644  ScsiPortNotification(RequestComplete, HwDeviceExtension, Srb);
1645  ScsiPortNotification(NextRequest, HwDeviceExtension, NULL);
1646  return TRUE;
1647  }
1648 
1649  /*
1650  * Reverted to pre 1.1.0.0 control flow
1651  * The 1.1.0.0 control flow causes the .NET Server freeze during installs/restarts
1652  * And the fix for that in 1.1.0.1 causes BSODs in XP
1653  * Side note: Ben: the Buslogic emulation never exports more than 1 lun
1654  */
1655  if (TargetFlags->TaggedQueuingActive
1656  && HostAdapter->ActiveCommandsPerLun[Srb->TargetId][Srb->Lun] < BUSLOGIC_MAXIMUM_TAGS) {
1657  ScsiPortNotification(NextLuRequest, HwDeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
1658  }
1659  else {
1660  ScsiPortNotification(NextRequest,deviceExtension,NULL);
1661  }
1662  return TRUE;
1663 
1664  default:
1665 
1666  // Set error, complete request and signal ready for next request.
1667  Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
1668  ScsiPortNotification(RequestComplete,deviceExtension,Srb);
1669  ScsiPortNotification(NextRequest,deviceExtension,NULL);
1670 
1671  return TRUE;
1672 
1673  } // end switch
1674 
1675 }// end BusLogic_TargetDeviceInquiry
#define SRB_STATUS_INVALID_REQUEST
Definition: srb.h:338
VOID BusLogic_InitializeCCB(PBuslogic_CCB_T CCB)
Definition: BusLogic958.c:1425
#define TRUE
Definition: types.h:120
#define BusLogic_CDB_MaxLength
Definition: BusLogic958.h:97
#define SRB_STATUS_ABORT_FAILED
Definition: srb.h:335
#define ERROR(name)
Definition: error_private.h:53
#define SRB_FUNCTION_RESET_DEVICE
Definition: srb.h:319
int BusLogic_QueueCommand(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb, PBuslogic_CCB_T CCB)
Definition: BusLogic958.c:1747
BOOLEAN NTAPI BT958HwResetBus(IN PVOID HwDeviceExtension, IN ULONG PathId)
Definition: BusLogic958.c:2448
UCHAR SrbStatus
Definition: srb.h:243
#define SP_UNTAGGED
Definition: srb.h:225
#define SRB_STATUS_ERROR
Definition: srb.h:336
BusLogic_TargetFlags_T TargetFlags[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:732
#define WARNING
Definition: BusLogic958.h:56
#define BUSLOGIC_MAXIMUM_TAGS
Definition: BusLogic958.h:67
#define SRB_STATUS_PENDING
Definition: srb.h:332
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN BusLogic_WriteOutgoingMailbox(PHW_DEVICE_EXTENSION deviceExtension, BusLogic_ActionCode_T ActionCode, BusLogic_CCB_T *CCB)
Definition: BusLogic958.c:1679
PSCSI_REQUEST_BLOCK NTAPI ScsiPortGetSrb(IN PVOID DeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN LONG QueueTag)
Definition: scsiport.c:643
UCHAR ActiveCommandsPerLun[BusLogic_MaxTargetDevices][BusLogic_MaxLogicalUnits]
Definition: BusLogic958.h:736
#define TRACE(s)
Definition: solgame.cpp:4
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
VOID __cdecl ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType, IN PVOID HwDeviceExtension, IN ...)
Definition: scsiport.c:1308
#define SRB_FUNCTION_RESET_BUS
Definition: srb.h:318
BOOLEAN BusLogic_SendBusDeviceReset(IN PVOID HwDeviceExtension, PSCSI_REQUEST_BLOCK Srb)
Definition: BusLogic958.c:2535
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
#define SRB_FUNCTION_ABORT_COMMAND
Definition: srb.h:316
Definition: precomp.h:83
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307
BOOLEAN TaggedQueuingActive
Definition: BusLogic958.h:240
#define SRB_STATUS_SUCCESS
Definition: srb.h:333
struct _ccb ccb
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
VOID NTAPI ScsiPortStallExecution(IN ULONG Delay)
Definition: scsiport.c:1473

Referenced by DriverEntry().

◆ BT958WmiInitialize()

void BT958WmiInitialize ( IN PHW_DEVICE_EXTENSION  HwDeviceExtension)

Definition at line 52 of file wmi.c.

55 {
57 
58  WmiLibContext = &HwDeviceExtension->WmiLibContext;
59 
60  WmiLibContext->GuidList = BT958GuidList;
61  WmiLibContext->GuidCount = BT958GuidCount;
62  WmiLibContext->QueryWmiRegInfo = BT958QueryWmiRegInfo;
63  WmiLibContext->QueryWmiDataBlock = BT958QueryWmiDataBlock;
64  WmiLibContext->SetWmiDataItem = NULL;
65  WmiLibContext->SetWmiDataBlock = NULL;
66  WmiLibContext->WmiFunctionControl = NULL;
67  WmiLibContext->ExecuteWmiMethod = NULL;
68 }
_In_ PVOID WmiLibContext
Definition: batclass.h:377
SCSIWMIGUIDREGINFO BT958GuidList[]
Definition: wmi.c:41
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN BT958QueryWmiDataBlock(IN PVOID Context, IN PSCSIWMI_REQUEST_CONTEXT RequestContext, IN ULONG GuidIndex, IN ULONG InstanceIndex, IN ULONG InstanceCount, IN OUT PULONG InstanceLengthArray, IN ULONG OutBufferSize, OUT PUCHAR Buffer)
Definition: wmi.c:163
#define BT958GuidCount
Definition: wmi.c:49
UCHAR BT958QueryWmiRegInfo(IN PVOID Context, IN PSCSIWMI_REQUEST_CONTEXT RequestContext, OUT PWCHAR *MofResourceName)
Definition: wmi.c:286

◆ BusLogic_CheckHostAdapter()

BOOLEAN BusLogic_CheckHostAdapter ( BusLogic_HostAdapter_T HostAdapter)

Definition at line 569 of file BusLogic958.c.

579 {
580  BusLogic_ExtendedSetupInformation_T ExtendedSetupInformation;
581  BusLogic_RequestedReplyLength_T RequestedReplyLength;
582  BOOLEAN Result = TRUE;
583 
584  DebugPrint((TRACE, "\n BusLogic - Inside BusLogic_CheckHostAdapter function \n"));
585 
586  //
587  // Issue the Inquire Extended Setup Information command. Only genuine
588  // BusLogic Host Adapters and TRUE clones support this command. Adaptec 1542C
589  // series Host Adapters that respond to the Geometry Register I/O port will
590  // fail this command.
591  RequestedReplyLength = sizeof(ExtendedSetupInformation);
592  if (BusLogic_Command(HostAdapter,
594  &RequestedReplyLength,
595  sizeof(RequestedReplyLength),
596  &ExtendedSetupInformation,
597  sizeof(ExtendedSetupInformation))
598  != sizeof(ExtendedSetupInformation))
599  {
600  Result = FALSE;
601  }
602  return Result;
603 }// end BusLogic_CheckHostAdapter
#define TRUE
Definition: types.h:120
int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter, BusLogic_OperationCode_T OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
Definition: BusLogic958.c:606
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define TRACE(s)
Definition: solgame.cpp:4
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
UCHAR BusLogic_RequestedReplyLength_T
Definition: BusLogic958.h:169

Referenced by Buslogic_InitBT958().

◆ BusLogic_Command()

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

Definition at line 606 of file BusLogic958.c.

638 {
639  UCHAR *ParameterPointer = (UCHAR *) ParameterData;
640  UCHAR *ReplyPointer = (UCHAR *) ReplyData;
642  BusLogic_InterruptRegister_T InterruptRegister;
643  int ReplyBytes = 0, Result;
644  long TimeoutCounter;
645 
646  // Clear out the Reply Data if provided.
647  if (ReplyLength > 0)
648  memset(ReplyData, 0, ReplyLength);
649 
650  // If the IRQ Channel has not yet been acquired, then interrupts must be
651  // disabled while issuing host adapter commands since a Command Complete
652  // interrupt could occur if the IRQ Channel was previously enabled by another
653  // BusLogic Host Adapter or another driver sharing the same IRQ Channel.
654 
655  // Wait for the Host Adapter Ready bit to be set and the Command/Parameter
656  // Register Busy bit to be reset in the Status Register.
657  TimeoutCounter = 10000;
658  while (--TimeoutCounter >= 0)
659  {
660  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
661  if ( StatusRegister.Bits.HostAdapterReady &&
662  !StatusRegister.Bits.CommandParameterRegisterBusy)
663  {
664  break;
665  }
667  }
668  if (TimeoutCounter < 0)
669  {
670  //BusLogic_CommandFailureReason = "Timeout waiting for Host Adapter Ready";
671  Result = -2;
672  goto Done;
673  }
674 
675  // Write the OperationCode to the Command/Parameter Register.
676  HostAdapter->HostAdapterCommandCompleted = FALSE;
677  BusLogic_WriteCommandParameterRegister(HostAdapter, (UCHAR)OperationCode);
678 
679  //Write any additional Parameter Bytes.
680  TimeoutCounter = 10000;
681  while (ParameterLength > 0 && --TimeoutCounter >= 0)
682  {
683  //
684  // Wait 100 microseconds to give the Host Adapter enough time to determine
685  // whether the last value written to the Command/Parameter Register was
686  // valid or not. If the Command Complete bit is set in the Interrupt
687  // Register, then the Command Invalid bit in the Status Register will be
688  // reset if the Operation Code or Parameter was valid and the command
689  // has completed, or set if the Operation Code or Parameter was invalid.
690  // If the Data In Register Ready bit is set in the Status Register, then
691  // the Operation Code was valid, and data is waiting to be read back
692  // from the Host Adapter. Otherwise, wait for the Command/Parameter
693  // Register Busy bit in the Status Register to be reset.
694 
696  InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
697  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
698  if (InterruptRegister.Bits.CommandComplete)
699  break;
700  if (HostAdapter->HostAdapterCommandCompleted)
701  break;
702  if (StatusRegister.Bits.DataInRegisterReady)
703  break;
704  if (StatusRegister.Bits.CommandParameterRegisterBusy)
705  continue;
706  BusLogic_WriteCommandParameterRegister(HostAdapter, *ParameterPointer++);
707  ParameterLength--;
708  }
709  if (TimeoutCounter < 0)
710  {
711  //BusLogic_CommandFailureReason = "Timeout waiting for Parameter Acceptance";
712  Result = -2;
713  goto Done;
714  }
715 
716  // The Modify I/O Address command does not cause a Command Complete Interrupt.
717  if (OperationCode == BusLogic_ModifyIOAddress)
718  {
719  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
720  if (StatusRegister.Bits.CommandInvalid)
721  {
722  //BusLogic_CommandFailureReason = "Modify I/O Address Invalid";
723  Result = -1;
724  goto Done;
725  }
726  Result = 0;
727  goto Done;
728  }
729 
730  // Select an appropriate timeout value for awaiting command completion.
731  switch (OperationCode)
732  {
736  // Approximately 60 seconds.
737  TimeoutCounter = 60*10000;
738  break;
739  default:
740  // Approximately 1 second.
741  TimeoutCounter = 10000;
742  break;
743  }
744 
745  //
746  // Receive any Reply Bytes, waiting for either the Command Complete bit to
747  // be set in the Interrupt Register, or for the Interrupt Handler to set the
748  // Host Adapter Command Completed bit in the Host Adapter structure.
749  while (--TimeoutCounter >= 0)
750  {
751  InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
752  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
753  if (InterruptRegister.Bits.CommandComplete)
754  break;
755  if (HostAdapter->HostAdapterCommandCompleted)
756  break;
757  if (StatusRegister.Bits.DataInRegisterReady)
758  {
759  if (++ReplyBytes <= ReplyLength)
760  {
761  *ReplyPointer++ = BusLogic_ReadDataInRegister(HostAdapter);
762  }
763  else
764  {
765  BusLogic_ReadDataInRegister(HostAdapter);
766  }
767  }
768  if (OperationCode == BusLogic_FetchHostAdapterLocalRAM &&
769  StatusRegister.Bits.HostAdapterReady)
770  {
771  break;
772  }
774  }
775  if (TimeoutCounter < 0)
776  {
777  //BusLogic_CommandFailureReason = "Timeout waiting for Command Complete";
778  Result = -2;
779  goto Done;
780  }
781 
782  // Clear any pending Command Complete Interrupt.
783  BusLogic_InterruptReset(HostAdapter);
784 
785  // Process Command Invalid conditions.
786  if (StatusRegister.Bits.CommandInvalid)
787  {
788  //
789  // Some early BusLogic Host Adapters may not recover properly from
790  // a Command Invalid condition, so if this appears to be the case,
791  // a Soft Reset is issued to the Host Adapter. Potentially invalid
792  // commands are never attempted after Mailbox Initialization is
793  // performed, so there should be no Host Adapter state lost by a
794  // Soft Reset in response to a Command Invalid condition.
795 
797  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
798  if (StatusRegister.Bits.CommandInvalid ||
799  StatusRegister.Bits.Reserved ||
800  StatusRegister.Bits.DataInRegisterReady ||
801  StatusRegister.Bits.CommandParameterRegisterBusy ||
802  !StatusRegister.Bits.HostAdapterReady ||
803  !StatusRegister.Bits.InitializationRequired ||
804  StatusRegister.Bits.DiagnosticActive ||
805  StatusRegister.Bits.DiagnosticFailure)
806  {
807  BusLogic_SoftReset(HostAdapter);
809  }
810  //BusLogic_CommandFailureReason = "Command Invalid";
811  Result = -1;
812  goto Done;
813  }
814 
815  // Handle Excess Parameters Supplied conditions.
816  if (ParameterLength > 0)
817  {
818  //BusLogic_CommandFailureReason = "Excess Parameters Supplied";
819  Result = -1;
820  goto Done;
821  }
822 
823  // Indicate the command completed successfully.
824  Result = ReplyBytes;
825 
826  // Restore the interrupt status if necessary and return.
827 Done:
828  return Result;
829 }// end BusLogic_Command
static BYTE StatusRegister
Definition: ps2.c:57
static UCHAR BusLogic_ReadInterruptRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1065
_Must_inspect_result_ _In_ PFLT_PORT _In_ ULONG _Out_writes_bytes_opt_ ReplyLength PVOID _Inout_opt_ PULONG ReplyLength
Definition: fltkernel.h:1903
static void BusLogic_SoftReset(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1039
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
struct BusLogic_InterruptRegister::@1280 Bits
static UCHAR BusLogic_ReadDataInRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1077
unsigned char UCHAR
Definition: xmlstorage.h:181
_In_ ULONG ParameterLength
Definition: usbdlib.h:193
static void BusLogic_WriteCommandParameterRegister(BusLogic_HostAdapter_T *HostAdapter, UCHAR Value)
Definition: BusLogic958.h:1083
static UCHAR BusLogic_ReadStatusRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1059
#define memset(x, y, z)
Definition: compat.h:39
volatile BOOLEAN HostAdapterCommandCompleted
Definition: BusLogic958.h:704
VOID NTAPI ScsiPortStallExecution(IN ULONG Delay)
Definition: scsiport.c:1473
static void BusLogic_InterruptReset(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1028

Referenced by BT958HwAdapterControl(), BT958HwInitialize(), BT958ReadExtendedSetupInfo(), BusLogic_CheckHostAdapter(), Buslogic_InitBT958(), BusLogic_InitializeHostAdapter(), BusLogic_ReadHostAdapterConfiguration(), and BusLogic_TargetDeviceInquiry().

◆ BusLogic_ComputeResultCode()

UCHAR BusLogic_ComputeResultCode ( BusLogic_HostAdapter_T HostAdapter,
BusLogic_HostAdapterStatus_T  HostAdapterStatus,
BusLogic_TargetDeviceStatus_T  TargetDeviceStatus,
UCHAR  SenseDataLength 
)

Definition at line 2309 of file BusLogic958.c.

2324 {
2325  UCHAR HostStatus = 0;
2326 
2327  // Namita 2Oct CDROM issue
2328  if (TargetDeviceStatus != BusLogic_OperationGood && (HostAdapterStatus == BusLogic_CommandCompletedNormally ||
2329  HostAdapterStatus == BusLogic_LinkedCommandCompleted ||
2330  HostAdapterStatus == BusLogic_LinkedCommandCompletedWithFlag))
2331  {
2332  switch(TargetDeviceStatus)
2333  {
2335  {
2336  HostStatus = SRB_STATUS_ERROR;
2337  if(SenseDataLength != BusLogic_DisableAutoReqSense)
2338  HostStatus |= SRB_STATUS_AUTOSENSE_VALID;
2339  break;
2340  }
2341  case BusLogic_DeviceBusy:
2342  {
2343  HostStatus = SRB_STATUS_BUSY;
2344  break;
2345  }
2347  {
2348  HostStatus = SRB_STATUS_SUCCESS;
2349  break;
2350  }
2351  }
2352  }
2353 
2354  else
2355  {
2356 
2357  switch (HostAdapterStatus)
2358  {
2362  {
2363  HostStatus = SRB_STATUS_SUCCESS;
2364  break;
2365  }
2367  {
2368  HostStatus = SRB_STATUS_SELECTION_TIMEOUT;
2369  break;
2370  }
2374  DebugPrint((WARNING, "\n BusLogic - Driver Protocol Error 0x%02X\n",
2375  HostAdapterStatus));
2376  case BusLogic_DataUnderRun:
2377 
2378  case BusLogic_DataOverRun:
2379  // SRB_STATUS_DATA_OVERRUN
2380 
2382 
2384  // SRB_STATUS_MESSAGE_REJECTED
2388 
2390  // SRB_STATUS_TIMEOUT
2391  {
2392  HostStatus = SRB_STATUS_ERROR;
2393  break;
2394  }
2399  {
2400  HostStatus = SRB_STATUS_BUS_RESET;
2401  break;
2402  }
2404  {
2405  HostStatus = SRB_STATUS_PARITY_ERROR;
2406  break;
2407  }
2409  {
2410  HostStatus = SRB_STATUS_UNEXPECTED_BUS_FREE;
2411  break;
2412  }
2414  {
2415  HostStatus = SRB_STATUS_PHASE_SEQUENCE_FAILURE;
2416  break;
2417  }
2419  {
2420  HostStatus = SRB_STATUS_REQUEST_SENSE_FAILED;
2421  break;
2422  }
2424  {
2425  HostStatus = SRB_STATUS_INVALID_REQUEST;
2426  break;
2427  }
2429  {
2430  HostStatus = SRB_STATUS_NO_HBA;
2431  break;
2432  }
2433  default:
2434  {
2435  DebugPrint((WARNING, "\n BusLogic - Unknown HBA Status 0x%02X\n",
2436  HostAdapterStatus));
2437  HostStatus = SRB_STATUS_ERROR;
2438  break;
2439  }
2440  }
2441  }
2442  return HostStatus;
2443 }// end BusLogic_ComputeResultCode
#define SRB_STATUS_INVALID_REQUEST
Definition: srb.h:338
#define SRB_STATUS_BUS_RESET
Definition: srb.h:345
#define SRB_STATUS_AUTOSENSE_VALID
Definition: srb.h:379
#define SRB_STATUS_PHASE_SEQUENCE_FAILURE
Definition: srb.h:351
#define SRB_STATUS_ERROR
Definition: srb.h:336
#define SRB_STATUS_REQUEST_SENSE_FAILED
Definition: srb.h:347
#define SRB_STATUS_PARITY_ERROR
Definition: srb.h:346
#define WARNING
Definition: BusLogic958.h:56
#define SRB_STATUS_NO_HBA
Definition: srb.h:348
#define SRB_STATUS_BUSY
Definition: srb.h:337
unsigned char UCHAR
Definition: xmlstorage.h:181
#define SRB_STATUS_SELECTION_TIMEOUT
Definition: srb.h:342
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
#define SRB_STATUS_UNEXPECTED_BUS_FREE
Definition: srb.h:350
#define SRB_STATUS_SUCCESS
Definition: srb.h:333
#define BusLogic_DisableAutoReqSense
Definition: BusLogic958.h:110

Referenced by BusLogic_ProcessCompletedCCBs().

◆ BusLogic_HardReset()

static void BusLogic_HardReset ( BusLogic_HostAdapter_T HostAdapter)
static

Definition at line 1049 of file BusLogic958.h.

1050 {
1051  BusLogic_ControlRegister_T ControlRegister;
1052  ControlRegister.All = 0;
1053  ControlRegister.Bits.HardReset = TRUE;
1054  WriteBusLogicPort(ControlRegister.All,
1056 }
#define TRUE
Definition: types.h:120
struct BusLogic_ControlRegister::@1278 Bits
#define BusLogic_ControlRegisterOffset
Definition: BusLogic958.h:947
static VOID WriteBusLogicPort(UCHAR data, PUCHAR adr)
Definition: BusLogic958.h:936

Referenced by BusLogic_HardwareResetHostAdapter().

◆ BusLogic_HardwareResetHostAdapter()

BOOLEAN BusLogic_HardwareResetHostAdapter ( BusLogic_HostAdapter_T HostAdapter,
BOOLEAN  HardReset 
)

Definition at line 470 of file BusLogic958.c.

487 {
489  int TimeoutCounter;
490 
491  // Issue a Hard Reset or Soft Reset Command to the Host Adapter. The Host
492  // Adapter should respond by setting Diagnostic Active in the Status Register.
493  if (HardReset)
494  BusLogic_HardReset(HostAdapter);
495  else
496  BusLogic_SoftReset(HostAdapter);
497 
498  // Wait until Diagnostic Active is set in the Status Register.
499  TimeoutCounter = 100;
500  while (--TimeoutCounter >= 0)
501  {
502  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
503  if (StatusRegister.Bits.DiagnosticActive)
504  break;
505  }
506 
507  // if in spite of waiting for time out period , if it didn't et set, then something is wrong-- so just return.
508  if (TimeoutCounter < 0)
509  return FALSE;
510 
511  //
512  // Wait 100 microseconds to allow completion of any initial diagnostic
513  // activity which might leave the contents of the Status Register
514  // unpredictable.
516 
517  // Wait until Diagnostic Active is reset in the Status Register.
518  TimeoutCounter = 10*10000;
519  while (--TimeoutCounter >= 0)
520  {
521  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
522  if (!StatusRegister.Bits.DiagnosticActive)
523  break;
525  }
526 
527  if (TimeoutCounter < 0)
528  return FALSE;
529 
530  // Wait until at least one of the Diagnostic Failure, Host Adapter Ready,
531  // or Data In Register Ready bits is set in the Status Register.
532  TimeoutCounter = 10000;
533  while (--TimeoutCounter >= 0)
534  {
535  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
536  if (StatusRegister.Bits.DiagnosticFailure ||
537  StatusRegister.Bits.HostAdapterReady ||
538  StatusRegister.Bits.DataInRegisterReady)
539  {
540  break;
541  }
543  }
544 
545  //device didn't respond to reset
546  if (TimeoutCounter < 0)
547  return FALSE;
548 
549  // If Diagnostic Failure is set or Host Adapter Ready is reset, then an
550  // error occurred during the Host Adapter diagnostics. If Data In Register
551  // Ready is set, then there is an Error Code available.
552  if (StatusRegister.Bits.DiagnosticFailure || !StatusRegister.Bits.HostAdapterReady)
553  {
554  DebugPrint((ERROR, "\n BusLogic - Failure - HOST ADAPTER STATUS REGISTER = %02X\n", StatusRegister.All));
555 
556  if (StatusRegister.Bits.DataInRegisterReady)
557  {
558  DebugPrint((ERROR, "HOST ADAPTER ERROR CODE = %d\n", BusLogic_ReadDataInRegister(HostAdapter)));
559  }
560  return FALSE;
561  }
562 
563  // Indicate the Host Adapter Hard Reset completed successfully.
564  return TRUE;
565 }// end BusLogic_HardwareResetHostAdapter
static BYTE StatusRegister
Definition: ps2.c:57
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
static void BusLogic_SoftReset(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1039
static UCHAR BusLogic_ReadDataInRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1077
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
static void BusLogic_HardReset(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1049
static UCHAR BusLogic_ReadStatusRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1059
VOID NTAPI ScsiPortStallExecution(IN ULONG Delay)
Definition: scsiport.c:1473

Referenced by BT958HwAdapterControl(), BT958HwResetBus(), and Buslogic_InitBT958().

◆ BusLogic_IncrementByteCounter()

static void BusLogic_IncrementByteCounter ( BusLogic_ByteCounter_T ByteCounter,
unsigned int  Amount 
)
static

Definition at line 1139 of file BusLogic958.h.

1141 {
1142  ByteCounter->Units += Amount;
1143  if (ByteCounter->Units > 999999999)
1144  {
1145  ByteCounter->Units -= 1000000000;
1146  ByteCounter->Billions++;
1147  }
1148 }
_Must_inspect_result_ _In_ LONGLONG _In_ LONGLONG Amount
Definition: fsrtlfuncs.h:550
unsigned int Units
Definition: BusLogic958.h:253
unsigned int Billions
Definition: BusLogic958.h:254

Referenced by BusLogic_QueueCommand().

◆ BusLogic_IncrementErrorCounter()

static void BusLogic_IncrementErrorCounter ( unsigned short ErrorCounter)
static

Definition at line 1179 of file BusLogic958.h.

1180 {
1181  if (*ErrorCounter < 65535) (*ErrorCounter)++;
1182 }

Referenced by BusLogic_ProcessCompletedCCBs(), and BusLogic_SendBusDeviceReset().

◆ BusLogic_IncrementSizeBucket()

static void BusLogic_IncrementSizeBucket ( BusLogic_CommandSizeBuckets_T  CommandSizeBuckets,
unsigned int  Amount 
)
static

Definition at line 1152 of file BusLogic958.h.

1154 {
1155  int Index = 0;
1156  if (Amount < 8*1024)
1157  {
1158  if (Amount < 2*1024)
1159  Index = (Amount < 1*1024 ? 0 : 1);
1160  else
1161  Index = (Amount < 4*1024 ? 2 : 3);
1162  }
1163  else if (Amount < 128*1024)
1164  {
1165  if (Amount < 32*1024)
1166  Index = (Amount < 16*1024 ? 4 : 5);
1167  else
1168  Index = (Amount < 64*1024 ? 6 : 7);
1169  }
1170  else
1171  Index = (Amount < 256*1024 ? 8 : 9);
1172  CommandSizeBuckets[Index]++;
1173 }
_Must_inspect_result_ _In_ LONGLONG _In_ LONGLONG Amount
Definition: fsrtlfuncs.h:550
static const UCHAR Index[8]
Definition: usbohci.c:18

Referenced by BusLogic_QueueCommand().

◆ Buslogic_InitBT958()

BOOLEAN Buslogic_InitBT958 ( PHW_DEVICE_EXTENSION  deviceExtension,
PPORT_CONFIGURATION_INFORMATION  ConfigInfo 
)

Definition at line 316 of file BusLogic958.c.

331 {
332  CHAR ch;
333 
334  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
335 
336  // Probe the Host Adapter.
337  // If unsuccessful, abort further initialization.
338  if (!BusLogic_ProbeHostAdapter(HostAdapter))
339  return FALSE;
340 
341  // Hard Reset the Host Adapter.
342  // If unsuccessful, abort further initialization.
343  if (!BusLogic_HardwareResetHostAdapter(HostAdapter, TRUE))
344  return FALSE;
345 
346  /*
347  * PR 40284 -- Disable interrupts until driver initialization is complete.
348  */
349  ch = 0;
351  &ch, sizeof(ch), NULL, 0) < 0) {
352  DebugPrint((WARNING, "\n BusLogic - Could not disable interrupts!\n"));
353  } else {
354  DebugPrint((INFO, "\n BusLogic - Disabled interrupts.\n"));
355  }
356 
357  // Check the Host Adapter.
358  // If unsuccessful, abort further initialization.
359  if (!BusLogic_CheckHostAdapter(HostAdapter))
360  return FALSE;
361 
362  // Allocate a Noncached Extension to use for mail boxes.
363  deviceExtension->NoncachedExtension = ScsiPortGetUncachedExtension(deviceExtension,
364  ConfigInfo,
365  sizeof(NONCACHED_EXTENSION));
366 
367  if (deviceExtension->NoncachedExtension == NULL)
368  {
369  // Log error.
370  ScsiPortLogError(deviceExtension,
371  NULL,
372  0,
373  0,
374  0,
376  7 << 8);
377 
378  // abort further initialization
379  return FALSE;
380  }
381 
382  // Read the Host Adapter Configuration, Configure the Host Adapter,
383  // Acquire the System Resources necessary to use the Host Adapter, then
384  // Create the Initial CCBs, Initialize the Host Adapter, and finally
385  // perform Target Device Inquiry.
386  if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) &&
387  //BusLogic_ReportHostAdapterConfiguration(HostAdapter) &&
388  BusLogic_InitializeHostAdapter(deviceExtension, ConfigInfo) &&
389  BusLogic_TargetDeviceInquiry(HostAdapter))
390  {
391  // Fill in the:
392  // 1.Maximum number of scsi target devices that are supported by our adapter
393  ConfigInfo->MaximumNumberOfTargets = HostAdapter->MaxTargetDevices;
394  // 2. Maximum number of logical units per target the HBA can control.
395  ConfigInfo->MaximumNumberOfLogicalUnits = HostAdapter->MaxLogicalUnits;
396  ConfigInfo->InitiatorBusId[0] = HostAdapter->SCSI_ID;
397  // Maximum number of breaks between address ranges that a data buffer can
398  // have if the HBA supports scatter/gather. In other words, the number of
399  // scatter/gather lists minus one.
400  ConfigInfo->NumberOfPhysicalBreaks = HostAdapter->DriverScatterGatherLimit;
401  }
402  else
403  {
404  // An error occurred during Host Adapter Configuration Querying, Host
405  // Adapter Configuration, Host Adapter Initialization, or Target Device Inquiry,
406  // so return FALSE
407 
408  return FALSE;
409  }
410  // Initialization completed successfully
411  return TRUE;
412 } // end Buslogic_InitBT958
PVOID NTAPI ScsiPortGetUncachedExtension(IN PVOID HwDeviceExtension, IN PPORT_CONFIGURATION_INFORMATION ConfigInfo, IN ULONG NumberOfBytes)
Definition: scsiport.c:721
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
BOOLEAN BusLogic_CheckHostAdapter(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.c:569
unsigned short DriverScatterGatherLimit
Definition: BusLogic958.h:706
BOOLEAN BusLogic_ReadHostAdapterConfiguration(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.c:833
#define SP_INTERNAL_ADAPTER_ERROR
Definition: srb.h:501
#define WARNING
Definition: BusLogic958.h:56
int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter, BusLogic_OperationCode_T OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
Definition: BusLogic958.c:606
smooth NULL
Definition: ftsmooth.c:416
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
BOOLEAN BusLogic_InitializeHostAdapter(PHW_DEVICE_EXTENSION deviceExtension, PPORT_CONFIGURATION_INFORMATION ConfigInfo)
Definition: BusLogic958.c:1175
BOOLEAN BusLogic_HardwareResetHostAdapter(BusLogic_HostAdapter_T *HostAdapter, BOOLEAN HardReset)
Definition: BusLogic958.c:470
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
PNONCACHED_EXTENSION NoncachedExtension
Definition: BusLogic958.h:758
Definition: precomp.h:83
VOID NTAPI ScsiPortLogError(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN ULONG ErrorCode, IN ULONG UniqueId)
Definition: scsiport.c:1283
BOOLEAN BusLogic_ProbeHostAdapter(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.c:416
BOOLEAN BusLogic_TargetDeviceInquiry(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.c:1316

Referenced by BT958HwFindAdapter().

◆ BusLogic_InitializeHostAdapter()

BOOLEAN BusLogic_InitializeHostAdapter ( PHW_DEVICE_EXTENSION  deviceExtension,
PPORT_CONFIGURATION_INFORMATION  ConfigInfo 
)

Definition at line 1175 of file BusLogic958.c.

1189 {
1190  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
1191  BusLogic_ExtendedMailboxRequest_T ExtendedMailboxRequest;
1192  UCHAR RoundRobinModeRequest;
1193  UCHAR SetCCBFormatRequest;
1194  int TargetID, LunID;
1195 
1196  // Used when we get the Physical address of the mail boxes
1197  ULONG length;
1198 
1199  // Initialize the pointers to the first and last CCBs that are queued for
1200  // completion processing.
1201  HostAdapter->FirstCompletedCCB = NULL;
1202  HostAdapter->LastCompletedCCB = NULL;
1203 
1204  // Initialize the Bus Device Reset Pending CCB, Tagged Queuing Active,
1205  // Command Successful Flag, Active Commands, and Commands Since Reset
1206  // for each Target Device.
1207  for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1208  {
1209  HostAdapter->BusDeviceResetPendingCCB[TargetID] = NULL;
1210  HostAdapter->TargetFlags[TargetID].TaggedQueuingActive = FALSE;
1211  HostAdapter->TargetFlags[TargetID].CommandSuccessfulFlag = FALSE;
1212 
1213  HostAdapter->ActiveCommandsPerTarget[TargetID] = 0;
1214  for (LunID = 0; LunID < HostAdapter->MaxLogicalUnits; LunID++)
1215  HostAdapter->ActiveCommandsPerLun[TargetID][LunID] = 0;
1216 
1217  HostAdapter->CommandsSinceReset[TargetID] = 0;
1218  }
1219 
1220  // Convert virtual to physical mailbox address.
1222  ScsiPortGetPhysicalAddress(deviceExtension,
1223  NULL,
1224  deviceExtension->NoncachedExtension->MailboxOut,
1225  &length));
1226 
1228  HostAdapter->LastOutgoingMailbox = HostAdapter->FirstOutgoingMailbox + HostAdapter->MailboxCount - 1;
1229  HostAdapter->NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox;
1230 
1231  HostAdapter->FirstIncomingMailbox = (BusLogic_IncomingMailbox_T *) deviceExtension->NoncachedExtension->MailboxIn;
1232  HostAdapter->LastIncomingMailbox = HostAdapter->FirstIncomingMailbox + HostAdapter->MailboxCount - 1;
1233  HostAdapter->NextIncomingMailbox = HostAdapter->FirstIncomingMailbox;
1234 
1235  // Initialize the Outgoing and Incoming Mailbox structures.
1236  memset(HostAdapter->FirstOutgoingMailbox,
1237  0,
1238  HostAdapter->MailboxCount * sizeof(BusLogic_OutgoingMailbox_T));
1239  memset(HostAdapter->FirstIncomingMailbox,
1240  0,
1241  HostAdapter->MailboxCount * sizeof(BusLogic_IncomingMailbox_T));
1242 
1243 
1244  ExtendedMailboxRequest.MailboxCount = HostAdapter->MailboxCount;
1245  ExtendedMailboxRequest.BaseMailboxAddress = deviceExtension->NoncachedExtension->MailboxPA ;
1246 
1247  if (BusLogic_Command(HostAdapter,
1249  &ExtendedMailboxRequest,
1250  sizeof(ExtendedMailboxRequest),
1251  NULL, 0)
1252  < 0)
1253  {
1254  DebugPrint((ERROR, "\n BusLogic - Failure: MAILBOX INITIALIZATION\n"));
1255  return FALSE;
1256  }
1257 
1258  // Enable Strict Round Robin Mode if supported by the Host Adapter. In
1259  // Strict Round Robin Mode, the Host Adapter only looks at the next Outgoing
1260  // Mailbox for each new command, rather than scanning through all the
1261  // Outgoing Mailboxes to find any that have new commands in them. Strict
1262  // Round Robin Mode is significantly more efficient.
1263  if (HostAdapter->StrictRoundRobinModeSupport)
1264  {
1265  RoundRobinModeRequest = BusLogic_StrictRoundRobinMode;
1266  if (BusLogic_Command(HostAdapter,
1268  &RoundRobinModeRequest,
1269  sizeof(RoundRobinModeRequest),
1270  NULL,
1271  0)
1272  < 0)
1273  {
1274  DebugPrint((ERROR, "\n BusLogic - Failure: ENABLE STRICT ROUND ROBIN MODE\n"));
1275  return FALSE;
1276  }
1277  }
1278 
1279  // For Host Adapters that support Extended LUN Format CCBs, issue the Set CCB
1280  // Format command to allow 32 Logical Units per Target Device.
1281 
1282  if (HostAdapter->ExtendedLUNSupport)
1283  {
1284  SetCCBFormatRequest = BusLogic_ExtendedLUNFormatCCB;
1285  if (BusLogic_Command(HostAdapter,
1287  &SetCCBFormatRequest,
1288  sizeof(SetCCBFormatRequest),
1289  NULL,
1290  0)
1291  < 0)
1292  {
1293  DebugPrint((ERROR, "\n BusLogic - Failure: SET CCB FORMAT\n"));
1294  return FALSE;
1295  }
1296  }
1297 
1298  // Announce Successful Initialization.
1299  if (!HostAdapter->HostAdapterInitialized)
1300  {
1301  DebugPrint((INFO, "\n BusLogic - %s Initialized Successfully\n",
1302  HostAdapter, HostAdapter->FullModelName));
1303  }
1304  else
1305  {
1306  DebugPrint((WARNING, "\n BusLogic - %s not initialized Successfully\n",
1307  HostAdapter, HostAdapter->FullModelName));
1308  }
1309  HostAdapter->HostAdapterInitialized = TRUE;
1310  // Indicate the Host Adapter Initialization completed successfully.
1311  return TRUE;
1312 }// end BusLogic_InitializeHostAdapter
#define TRUE
Definition: types.h:120
unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:737
#define ERROR(name)
Definition: error_private.h:53
#define ScsiPortConvertPhysicalAddressToUlong(Address)
Definition: srb.h:949
BOOLEAN StrictRoundRobinModeSupport
Definition: BusLogic958.h:696
BusLogic_CCB_T * BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:730
UCHAR ActiveCommandsPerTarget[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:735
SCSI_PHYSICAL_ADDRESS NTAPI ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, IN PVOID VirtualAddress, OUT ULONG *Length)
Definition: scsiport.c:607
BusLogic_OutgoingMailbox_T * LastOutgoingMailbox
Definition: BusLogic958.h:744
UCHAR FullModelName[18]
Definition: BusLogic958.h:676
BusLogic_TargetFlags_T TargetFlags[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:732
#define WARNING
Definition: BusLogic958.h:56
UCHAR MailboxIn[BusLogic_MaxMailboxes *sizeof(BusLogic_IncomingMailbox_T)]
Definition: BusLogic958.h:633
BusLogic_IncomingMailbox_T * LastIncomingMailbox
Definition: BusLogic958.h:747
int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter, BusLogic_OperationCode_T OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
Definition: BusLogic958.c:606
smooth NULL
Definition: ftsmooth.c:416
UCHAR MailboxOut[BusLogic_MaxMailboxes *sizeof(BusLogic_OutgoingMailbox_T)]
Definition: BusLogic958.h:632
UCHAR ActiveCommandsPerLun[BusLogic_MaxTargetDevices][BusLogic_MaxLogicalUnits]
Definition: BusLogic958.h:736
BOOLEAN HostAdapterInitialized
Definition: BusLogic958.h:699
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
BOOLEAN ExtendedLUNSupport
Definition: BusLogic958.h:691
unsigned char UCHAR
Definition: xmlstorage.h:181
BusLogic_OutgoingMailbox_T * FirstOutgoingMailbox
Definition: BusLogic958.h:743
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
PNONCACHED_EXTENSION NoncachedExtension
Definition: BusLogic958.h:758
BusLogic_IncomingMailbox_T * FirstIncomingMailbox
Definition: BusLogic958.h:746
BusLogic_CCB_T * FirstCompletedCCB
Definition: BusLogic958.h:728
Definition: precomp.h:83
#define BusLogic_StrictRoundRobinMode
Definition: BusLogic958.h:106
BusLogic_OutgoingMailbox_T * NextOutgoingMailbox
Definition: BusLogic958.h:745
BOOLEAN TaggedQueuingActive
Definition: BusLogic958.h:240
unsigned int ULONG
Definition: retypes.h:1
BusLogic_IncomingMailbox_T * NextIncomingMailbox
Definition: BusLogic958.h:748
BOOLEAN CommandSuccessfulFlag
Definition: BusLogic958.h:242
#define memset(x, y, z)
Definition: compat.h:39
BusLogic_CCB_T * LastCompletedCCB
Definition: BusLogic958.h:729

Referenced by BT958HwAdapterControl(), BT958HwResetBus(), and Buslogic_InitBT958().

◆ BusLogic_InterruptReset()

static void BusLogic_InterruptReset ( BusLogic_HostAdapter_T HostAdapter)
static

Definition at line 1028 of file BusLogic958.h.

1029 {
1030  BusLogic_ControlRegister_T ControlRegister;
1031  ControlRegister.All = 0;
1032  ControlRegister.Bits.InterruptReset = TRUE;
1033 
1034  WriteBusLogicPort(ControlRegister.All,
1036 }
#define TRUE
Definition: types.h:120
struct BusLogic_ControlRegister::@1278 Bits
#define BusLogic_ControlRegisterOffset
Definition: BusLogic958.h:947
static VOID WriteBusLogicPort(UCHAR data, PUCHAR adr)
Definition: BusLogic958.h:936

Referenced by BT958HwInterrupt(), and BusLogic_Command().

◆ BusLogic_ProbeHostAdapter()

BOOLEAN BusLogic_ProbeHostAdapter ( BusLogic_HostAdapter_T HostAdapter)

Definition at line 416 of file BusLogic958.c.

428 {
430  BusLogic_InterruptRegister_T InterruptRegister;
431  BusLogic_GeometryRegister_T GeometryRegister;
432 
433  DebugPrint((TRACE,"\n BusLogic - Inside ProbeHostaAdapter function \n"));
434  // Read the Status, Interrupt, and Geometry Registers to test if there are I/O
435  // ports that respond, and to check the values to determine if they are from a
436  // BusLogic Host Adapter. A nonexistent I/O port will return 0xFF, in which
437  // case there is definitely no BusLogic Host Adapter at this base I/O Address.
438  // The test here is a subset of that used by the BusLogic Host Adapter BIOS.
439 
440  InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
441  GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter);
442  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
443 
444  if (StatusRegister.All == 0 ||
445  StatusRegister.Bits.DiagnosticActive ||
446  StatusRegister.Bits.CommandParameterRegisterBusy ||
447  StatusRegister.Bits.Reserved ||
448  StatusRegister.Bits.CommandInvalid ||
449  InterruptRegister.Bits.Reserved != 0)
450  return FALSE;
451 
452  // Check the undocumented Geometry Register to test if there is an I/O port
453  // that responded. Adaptec Host Adapters do not implement the Geometry
454  // Register, so this test helps serve to avoid incorrectly recognizing an
455  // Adaptec 1542A or 1542B as a BusLogic. Unfortunately, the Adaptec 1542C
456  // series does respond to the Geometry Register I/O port, but it will be
457  // rejected later when the Inquire Extended Setup Information command is
458  // issued in BusLogic_CheckHostAdapter. The AMI FastDisk Host Adapter is a
459  // BusLogic clone that implements the same interface as earlier BusLogic
460  // Host Adapters, including the undocumented commands, and is therefore
461  // supported by this driver. However, the AMI FastDisk always returns 0x00
462  // upon reading the Geometry Register, so the extended translation option
463  // should always be left disabled on the AMI FastDisk.
464 
465  if (GeometryRegister.All == 0xFF) return FALSE;
466  return TRUE;
467 }// end BusLogic_ProbeHostAdapter
static BYTE StatusRegister
Definition: ps2.c:57
#define TRUE
Definition: types.h:120
static UCHAR BusLogic_ReadGeometryRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1071
static UCHAR BusLogic_ReadInterruptRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1065
#define TRACE(s)
Definition: solgame.cpp:4
struct BusLogic_InterruptRegister::@1280 Bits
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
static UCHAR BusLogic_ReadStatusRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1059

Referenced by Buslogic_InitBT958().

◆ BusLogic_ProcessCompletedCCBs()

void BusLogic_ProcessCompletedCCBs ( PHW_DEVICE_EXTENSION  deviceExtension)

Definition at line 2139 of file BusLogic958.c.

2150 {
2151  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
2152  PSCSI_REQUEST_BLOCK srb;
2153  PCDB RealCdb;
2154 
2155  if (HostAdapter->ProcessCompletedCCBsActive)
2156  return;
2157  HostAdapter->ProcessCompletedCCBsActive = TRUE;
2158  while (HostAdapter->FirstCompletedCCB != NULL)
2159  {
2160  BusLogic_CCB_T *CCB = HostAdapter->FirstCompletedCCB;
2161 
2162  // Get SRB from CCB.
2163  srb = CCB->SrbAddress;
2164 
2165  HostAdapter->FirstCompletedCCB = CCB->Next;
2166  if (HostAdapter->FirstCompletedCCB == NULL)
2167  HostAdapter->LastCompletedCCB = NULL;
2168 
2169  // Process the Completed CCB.
2170  if (CCB->Opcode == BusLogic_BusDeviceReset)
2171  {
2172  int TargetID = CCB->TargetID, LunID;
2173  DebugPrint((TRACE, "\n BusLogic - Bus Device Reset CCB #%ld to Target "
2174  "%d Completed\n", CCB->SerialNumber, TargetID));
2176 
2177  HostAdapter->TargetFlags[TargetID].TaggedQueuingActive = FALSE;
2178  HostAdapter->CommandsSinceReset[TargetID] = 0;
2179  //HostAdapter->LastResetCompleted[TargetID] = jiffies;
2180  HostAdapter->ActiveCommandsPerTarget[TargetID] = 0;
2181  for (LunID = 0; LunID < HostAdapter->MaxLogicalUnits; LunID++)
2182  HostAdapter->ActiveCommandsPerLun[TargetID][LunID] = 0;
2183 
2184  // Complete all outstanding requests with SRB_STATUS_BUS_RESET.
2185  ScsiPortCompleteRequest(deviceExtension,
2186  (UCHAR)srb->PathId,
2187  srb->TargetId,
2188  0xFF,
2190 
2191 
2192  HostAdapter->BusDeviceResetPendingCCB[TargetID] = NULL;
2193  }
2194  else
2195  {
2196  // Translate the Completion Code, Host Adapter Status, and Target
2197  // Device Status into a SCSI Subsystem Result Code.
2198  switch (CCB->CompletionCode)
2199  {
2201  case BusLogic_InvalidCCB:
2202  {
2203  DebugPrint((ERROR, "\n BusLogic - CCB #%ld to Target %d Impossible "
2204  "State\n", CCB->SerialNumber, CCB->TargetID));
2205  break;
2206  }
2207 
2208  //Processing for CCB that was to be aborted
2210  {
2211  srb = CCB->AbortSrb;
2213  break;
2214  }
2215 
2217  {
2218  HostAdapter->TargetStatistics[CCB->TargetID].CommandsCompleted++;
2219  HostAdapter->TargetFlags[CCB->TargetID].CommandSuccessfulFlag = TRUE;
2220 
2222  break;
2223  }
2224 
2226  {
2227  DebugPrint((TRACE, "\n BusLogic - CCB #%ld to Target %d Aborted\n",
2228  CCB->SerialNumber, CCB->TargetID));
2229  //BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[CCB->TargetID].CommandAbortsCompleted);
2230 
2232 
2233  // Call notification routine for the aborted SRB.
2235  deviceExtension,
2236  srb);
2237 
2238  // Get the abort SRB from CCB.
2239  srb = CCB->AbortSrb;
2240 
2241  // Set status for completing abort request.
2243  break;
2244  }
2245 
2247  {
2248  RealCdb = (PCDB)CCB->CDB;
2249  DebugPrint((ERROR, "\n BusLogic - %x Command completed with error Host - "
2250  "%x Target %x \n", RealCdb->CDB6GENERIC.OperationCode,
2251  CCB->HostAdapterStatus, CCB->TargetDeviceStatus));
2252 
2253  srb->SrbStatus = BusLogic_ComputeResultCode(HostAdapter,
2254  CCB->HostAdapterStatus,
2255  CCB->TargetDeviceStatus,
2256  CCB->SenseDataLength);
2257  if (CCB->HostAdapterStatus != BusLogic_SCSISelectionTimeout)
2258  {
2259  HostAdapter->TargetStatistics[CCB->TargetID].CommandsCompleted++;
2260  }
2261  break;
2262  }
2263 
2264  default:
2265  {
2266  // Log the error.
2267  ScsiPortLogError(deviceExtension,
2268  NULL,
2269  0,
2270  srb->TargetId,
2271  0,
2273  143);
2274 
2275  DebugPrint((ERROR, "\n BusLogic - Unrecognized mailbox status\n"));
2276  }
2277 
2278  }// end switch
2279 
2280 
2281  // When an INQUIRY command completes normally, save the CmdQue (Tagged Queuing Supported)
2282  // and WBus16 (16 Bit Wide Data Transfers Supported) bits.
2283  RealCdb = (PCDB) CCB->CDB;
2284  if (RealCdb->CDB6INQUIRY.OperationCode == SCSIOP_INQUIRY &&
2285  CCB->HostAdapterStatus == BusLogic_CommandCompletedNormally)
2286  {
2287  BusLogic_TargetFlags_T *TargetFlags =&HostAdapter->TargetFlags[CCB->TargetID];
2288  SCSI_Inquiry_T *InquiryResult =(SCSI_Inquiry_T *) srb->DataBuffer;
2289  TargetFlags->TargetExists = TRUE;
2290  TargetFlags->TaggedQueuingSupported = InquiryResult->CmdQue;
2291  TargetFlags->WideTransfersSupported = InquiryResult->WBus16;
2292  }
2293 
2294  DebugPrint((INFO, "\n BusLogic - SCSI Status %x\n", srb->ScsiStatus));
2295  DebugPrint((INFO, "\n BusLogic - HBA Status %x\n", CCB->HostAdapterStatus));
2296 
2297  // Update target status in SRB.
2298  srb->ScsiStatus = (UCHAR)CCB->TargetDeviceStatus;
2299 
2300  // Signal request completion.
2301  ScsiPortNotification(RequestComplete, (PVOID)deviceExtension, srb);
2302  }
2303  }
2304  HostAdapter->ProcessCompletedCCBsActive = FALSE;
2305 }// end BusLogic_ProcessCompletedCCBs
#define SRB_STATUS_BUS_RESET
Definition: srb.h:345
#define TRUE
Definition: types.h:120
unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:737
PVOID DataBuffer
Definition: srb.h:255
#define SRB_STATUS_ABORT_FAILED
Definition: srb.h:335
#define ERROR(name)
Definition: error_private.h:53
Definition: cdstruc.h:1073
Definition: cdrw_hw.h:28
VOID NTAPI ScsiPortCompleteRequest(IN PVOID HwDeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN UCHAR SrbStatus)
Definition: scsiport.c:498
UCHAR BusLogic_ComputeResultCode(BusLogic_HostAdapter_T *HostAdapter, BusLogic_HostAdapterStatus_T HostAdapterStatus, BusLogic_TargetDeviceStatus_T TargetDeviceStatus, UCHAR SenseDataLength)
Definition: BusLogic958.c:2309
BOOLEAN TaggedQueuingSupported
Definition: BusLogic958.h:238
BusLogic_CCB_T * BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:730
UCHAR ActiveCommandsPerTarget[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:735
BusLogic_TargetStatistics_T TargetStatistics[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:749
UCHAR SrbStatus
Definition: srb.h:243
BusLogic_TargetFlags_T TargetFlags[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:732
#define SP_INTERNAL_ADAPTER_ERROR
Definition: srb.h:501
UCHAR ScsiStatus
Definition: srb.h:244
smooth NULL
Definition: ftsmooth.c:416
#define SRB_STATUS_ABORTED
Definition: srb.h:334
union _CDB * PCDB
UCHAR TargetId
Definition: srb.h:246
UCHAR ActiveCommandsPerLun[BusLogic_MaxTargetDevices][BusLogic_MaxLogicalUnits]
Definition: BusLogic958.h:736
#define SCSIOP_INQUIRY
Definition: cdrw_hw.h:888
#define TRACE(s)
Definition: solgame.cpp:4
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
if(!(yy_init))
Definition: macro.lex.yy.c:714
unsigned int CommandsCompleted
Definition: BusLogic958.h:262
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID __cdecl ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType, IN PVOID HwDeviceExtension, IN ...)
Definition: scsiport.c:1308
BOOLEAN CmdQue
Definition: BusLogic958.h:783
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
BusLogic_CCB_T * FirstCompletedCCB
Definition: BusLogic958.h:728
Definition: precomp.h:83
UCHAR PathId
Definition: srb.h:245
struct _CDB::_CDB6GENERIC CDB6GENERIC
static void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter)
Definition: BusLogic958.h:1179
BOOLEAN WBus16
Definition: BusLogic958.h:787
BOOLEAN TaggedQueuingActive
Definition: BusLogic958.h:240
unsigned int ULONG
Definition: retypes.h:1
#define SRB_STATUS_SUCCESS
Definition: srb.h:333
VOID NTAPI ScsiPortLogError(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN ULONG ErrorCode, IN ULONG UniqueId)
Definition: scsiport.c:1283
struct _CDB::_CDB6INQUIRY CDB6INQUIRY
BOOLEAN ProcessCompletedCCBsActive
Definition: BusLogic958.h:703
BOOLEAN CommandSuccessfulFlag
Definition: BusLogic958.h:242
unsigned short BusDeviceResetsCompleted
Definition: BusLogic958.h:274
BOOLEAN WideTransfersSupported
Definition: BusLogic958.h:239
BusLogic_CCB_T * LastCompletedCCB
Definition: BusLogic958.h:729

Referenced by BT958HwInterrupt().

◆ BusLogic_QueueCommand()

int BusLogic_QueueCommand ( IN PVOID  HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK  Srb,
IN PBuslogic_CCB_T  ccb 
)

◆ BusLogic_QueueCompletedCCB()

void BusLogic_QueueCompletedCCB ( PHW_DEVICE_EXTENSION  deviceExtension,
BusLogic_CCB_T CCB 
)

Definition at line 2108 of file BusLogic958.c.

2117 {
2118  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
2119 
2120  CCB->Status = BusLogic_CCB_Completed;
2121  CCB->Next = NULL;
2122  if (HostAdapter->FirstCompletedCCB == NULL)
2123  {
2124  HostAdapter->FirstCompletedCCB = CCB;
2125  HostAdapter->LastCompletedCCB = CCB;
2126  }
2127  else
2128  {
2129  HostAdapter->LastCompletedCCB->Next = CCB;
2130  HostAdapter->LastCompletedCCB = CCB;
2131  }
2132  HostAdapter->ActiveCommandsPerTarget[CCB->TargetID]--;
2133  HostAdapter->ActiveCommandsPerLun[CCB->TargetID][CCB->LogicalUnit]--;
2134 
2135 }// end BusLogic_QueueCompletedCCB
Definition: cdstruc.h:1073
UCHAR ActiveCommandsPerTarget[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:735
smooth NULL
Definition: ftsmooth.c:416
UCHAR ActiveCommandsPerLun[BusLogic_MaxTargetDevices][BusLogic_MaxLogicalUnits]
Definition: BusLogic958.h:736
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
struct BusLogic_CCB * Next
Definition: BusLogic958.h:591
struct _CCB CCB
BusLogic_CCB_T * FirstCompletedCCB
Definition: BusLogic958.h:728
BusLogic_CCB_T * LastCompletedCCB
Definition: BusLogic958.h:729

Referenced by BusLogic_ScanIncomingMailboxes().

◆ BusLogic_ReadDataInRegister()

static UCHAR BusLogic_ReadDataInRegister ( BusLogic_HostAdapter_T HostAdapter)
static

Definition at line 1077 of file BusLogic958.h.

1078 {
1080 }
static UCHAR ReadBusLogicPort(PUCHAR adr)
Definition: BusLogic958.h:930
#define BusLogic_DataInRegisterOffset
Definition: BusLogic958.h:950

Referenced by BusLogic_Command(), and BusLogic_HardwareResetHostAdapter().

◆ BusLogic_ReadGeometryRegister()

static UCHAR BusLogic_ReadGeometryRegister ( BusLogic_HostAdapter_T HostAdapter)
static

Definition at line 1071 of file BusLogic958.h.

1072 {
1074 }
static UCHAR ReadBusLogicPort(PUCHAR adr)
Definition: BusLogic958.h:930
#define BusLogic_GeometryRegisterOffset
Definition: BusLogic958.h:952

Referenced by BusLogic_ProbeHostAdapter(), and BusLogic_ReadHostAdapterConfiguration().

◆ BusLogic_ReadHostAdapterConfiguration()

BOOLEAN BusLogic_ReadHostAdapterConfiguration ( BusLogic_HostAdapter_T HostAdapter)

save it in the Host Adapter structure. The BIOS is disabled if the

Definition at line 833 of file BusLogic958.c.

844 {
845  BusLogic_BoardID_T BoardID;
847  BusLogic_SetupInformation_T SetupInformation;
848  BusLogic_ExtendedSetupInformation_T ExtendedSetupInformation;
849  BusLogic_HostAdapterModelNumber_T HostAdapterModelNumber;
850  BusLogic_FirmwareVersion3rdDigit_T FirmwareVersion3rdDigit;
851  BusLogic_FirmwareVersionLetter_T FirmwareVersionLetter;
852  BusLogic_PCIHostAdapterInformation_T PCIHostAdapterInformation;
853  BusLogic_FetchHostAdapterLocalRAMRequest_T FetchHostAdapterLocalRAMRequest;
854  BusLogic_AutoSCSIData_T AutoSCSIData;
855  BusLogic_GeometryRegister_T GeometryRegister;
856  BusLogic_RequestedReplyLength_T RequestedReplyLength;
857  UCHAR *TargetPointer, Character;
858  ULONG /*TargetID,*/ i;
859 
860 
861  // Issue the Inquire Board ID command.
862  if (BusLogic_Command(HostAdapter,
864  NULL,
865  0,
866  &BoardID, sizeof(BoardID))
867  != sizeof(BoardID))
868  {
869  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE BOARD ID\n"));
870  return FALSE;
871  }
872 
873  // Issue the Inquire Configuration command.
874  if (BusLogic_Command(HostAdapter,
876  NULL,
877  0,
878  &Configuration, sizeof(Configuration))
879  != sizeof(Configuration))
880  {
881  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE CONFIGURATION\n"));
882  return FALSE;
883  }
884 
885  // Issue the Inquire Setup Information command.
886  RequestedReplyLength = sizeof(SetupInformation);
887  if (BusLogic_Command(HostAdapter,
889  &RequestedReplyLength,
890  sizeof(RequestedReplyLength),
891  &SetupInformation,
892  sizeof(SetupInformation))
893  != sizeof(SetupInformation))
894  {
895  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE SETUP INFORMATION\n"));
896  return FALSE;
897  }
898 
899  // Issue the Inquire Extended Setup Information command.
900  RequestedReplyLength = sizeof(ExtendedSetupInformation);
901  if (BusLogic_Command(HostAdapter,
903  &RequestedReplyLength,
904  sizeof(RequestedReplyLength),
905  &ExtendedSetupInformation,
906  sizeof(ExtendedSetupInformation))
907  != sizeof(ExtendedSetupInformation))
908  {
909  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE EXTENDED SETUP INFORMATION\n"));
910  return FALSE;
911  }
912 
913  // Issue the Inquire Firmware Version 3rd Digit command.
914  FirmwareVersion3rdDigit = '\0';
915  if (BoardID.FirmwareVersion1stDigit > '0')
916  {
917  if (BusLogic_Command(HostAdapter,
919  NULL,
920  0,
921  &FirmwareVersion3rdDigit,
922  sizeof(FirmwareVersion3rdDigit))
923  != sizeof(FirmwareVersion3rdDigit))
924  {
925  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE FIRMWARE 3RD DIGIT\n"));
926  return FALSE;
927  }
928  }
929 
930  // Issue the Inquire Host Adapter Model Number command.
931  RequestedReplyLength = sizeof(HostAdapterModelNumber);
932  if (BusLogic_Command(HostAdapter,
934  &RequestedReplyLength,
935  sizeof(RequestedReplyLength),
936  &HostAdapterModelNumber,
937  sizeof(HostAdapterModelNumber))
938  != sizeof(HostAdapterModelNumber))
939  {
940  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE HOST ADAPTER MODEL NUMBER\n"));
941  return FALSE;
942  }
943 
944  // BusLogic MultiMaster Host Adapters can be identified by their model number
945  // and the major version number of their firmware as follows:
946  //
947  // 5.xx BusLogic "W" Series Host Adapters:
948  // BT-948/958/958D
949  // Save the Model Name and Host Adapter Name in the Host Adapter structure.
950  TargetPointer = HostAdapter->ModelName;
951  *TargetPointer++ = 'B';
952  *TargetPointer++ = 'T';
953  *TargetPointer++ = '-';
954  for (i = 0; i < sizeof(HostAdapterModelNumber); i++)
955  {
956  Character = HostAdapterModelNumber[i];
957  if (Character == ' ' || Character == '\0') break;
958  *TargetPointer++ = Character;
959  }
960  *TargetPointer++ = '\0';
961 
962  // Save the Firmware Version in the Host Adapter structure.
963  TargetPointer = HostAdapter->FirmwareVersion;
964  *TargetPointer++ = BoardID.FirmwareVersion1stDigit;
965  *TargetPointer++ = '.';
966  *TargetPointer++ = BoardID.FirmwareVersion2ndDigit;
967  if (FirmwareVersion3rdDigit != ' ' && FirmwareVersion3rdDigit != '\0')
968  *TargetPointer++ = FirmwareVersion3rdDigit;
969  *TargetPointer = '\0';
970 
971  // Issue the Inquire Firmware Version Letter command.
972  if (strcmp((char*)HostAdapter->FirmwareVersion, "3.3") >= 0)
973  {
974  if (BusLogic_Command(HostAdapter,
976  NULL,
977  0,
978  &FirmwareVersionLetter,
979  sizeof(FirmwareVersionLetter))
980  != sizeof(FirmwareVersionLetter))
981  {
982  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE FIRMWARE VERSION LETTER\n"));
983  return FALSE;
984  }
985  if (FirmwareVersionLetter != ' ' && FirmwareVersionLetter != '\0')
986  {
987  *TargetPointer++ = FirmwareVersionLetter;
988  }
989  *TargetPointer = '\0';
990  }
991 
992 
993  // Save the Host Adapter SCSI ID in the Host Adapter structure.
994  HostAdapter->SCSI_ID = Configuration.HostAdapterID;
995 
996  // Determine the Bus Type and save it in the Host Adapter structure, determine
997  // and save the IRQ Channel if necessary, and determine and save the DMA
998  // Channel for ISA Host Adapters.
999  HostAdapter->HostAdapterBusType = BusLogic_HostAdapterBusTypes[HostAdapter->ModelName[3] - '4'];
1000 
1001  GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter);
1002 
1003  // Determine whether Extended Translation is enabled and save it in
1004  // the Host Adapter structure.
1005  // HostAdapter->ExtendedTranslationEnabled = GeometryRegister.Bits.ExtendedTranslationEnabled;
1006  HostAdapter->ExtendedTranslationEnabled = GeometryRegister.All;
1007 
1008 
1009  // Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide
1010  // SCSI flag, Differential SCSI flag, SCAM Supported flag, and
1011  // Ultra SCSI flag in the Host Adapter structure.
1012  HostAdapter->HostAdapterScatterGatherLimit = ExtendedSetupInformation.ScatterGatherLimit;
1013 
1014  HostAdapter->DriverScatterGatherLimit = HostAdapter->HostAdapterScatterGatherLimit;
1015 
1017  {
1019  }
1020  if (ExtendedSetupInformation.Misc.LevelSensitiveInterrupt)
1021  {
1022  HostAdapter->LevelSensitiveInterrupt = TRUE;
1023  }
1024 
1025  HostAdapter->HostWideSCSI = ExtendedSetupInformation.HostWideSCSI;
1026 
1027  HostAdapter->HostDifferentialSCSI = ExtendedSetupInformation.HostDifferentialSCSI;
1028 
1029  HostAdapter->HostSupportsSCAM = ExtendedSetupInformation.HostSupportsSCAM;
1030 
1031  HostAdapter->HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI;
1032 
1033 
1034  // Determine whether Extended LUN Format CCBs are supported and save the
1035  // information in the Host Adapter structure.
1036  if (HostAdapter->FirmwareVersion[0] == '5' ||
1037  (HostAdapter->FirmwareVersion[0] == '4' && HostAdapter->HostWideSCSI))
1038  {
1039  HostAdapter->ExtendedLUNSupport = TRUE;
1040  }
1041  // Issue the Inquire PCI Host Adapter Information command to read the
1042  // Termination Information from "W" series MultiMaster Host Adapters.
1043  if (HostAdapter->FirmwareVersion[0] == '5')
1044  {
1045  if (BusLogic_Command(HostAdapter,
1047  NULL,
1048  0,
1049  &PCIHostAdapterInformation,
1050  sizeof(PCIHostAdapterInformation))
1051  != sizeof(PCIHostAdapterInformation))
1052  {
1053  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE PCI HOST ADAPTER INFORMATION\n"));
1054  return FALSE;
1055  }
1056 
1057  // Save the Termination Information in the Host Adapter structure.
1058  if (PCIHostAdapterInformation.GenericInfoValid)
1059  {
1060  HostAdapter->TerminationInfoValid = TRUE;
1061  HostAdapter->LowByteTerminated = PCIHostAdapterInformation.LowByteTerminated;
1062  HostAdapter->HighByteTerminated = PCIHostAdapterInformation.HighByteTerminated;
1063  }
1064  }
1065 
1066  // Issue the Fetch Host Adapter Local RAM command to read the AutoSCSI data
1067  // from "W" and "C" series MultiMaster Host Adapters.
1068  if (HostAdapter->FirmwareVersion[0] >= '4')
1069  {
1070  FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_AutoSCSI_BaseOffset;
1071  FetchHostAdapterLocalRAMRequest.ByteCount = sizeof(AutoSCSIData);
1072  if (BusLogic_Command(HostAdapter,
1074  &FetchHostAdapterLocalRAMRequest,
1075  sizeof(FetchHostAdapterLocalRAMRequest),
1076  &AutoSCSIData,
1077  sizeof(AutoSCSIData))
1078  != sizeof(AutoSCSIData))
1079  {
1080  DebugPrint((ERROR, "\n BusLogic - Failure: FETCH HOST ADAPTER LOCAL RAM\n"));
1081  return FALSE;
1082  }
1083  // Save the Parity Checking Enabled, Bus Reset Enabled, and Termination
1084  // Information in the Host Adapter structure.
1085  HostAdapter->ParityCheckingEnabled = AutoSCSIData.ParityCheckingEnabled;
1086  HostAdapter->BusResetEnabled = AutoSCSIData.BusResetEnabled;
1087 
1088  // Save the Wide Permitted, Fast Permitted, Synchronous Permitted,
1089  // Disconnect Permitted, Ultra Permitted, and SCAM Information in the
1090  // Host Adapter structure.
1091  HostAdapter->WidePermitted = AutoSCSIData.WidePermitted;
1092  HostAdapter->FastPermitted = AutoSCSIData.FastPermitted;
1093  HostAdapter->SynchronousPermitted = AutoSCSIData.SynchronousPermitted;
1094  HostAdapter->DisconnectPermitted = AutoSCSIData.DisconnectPermitted;
1095  if (HostAdapter->HostUltraSCSI)
1096  {
1097  HostAdapter->UltraPermitted = AutoSCSIData.UltraPermitted;
1098  }
1099  if (HostAdapter->HostSupportsSCAM)
1100  {
1101  HostAdapter->SCAM_Enabled = AutoSCSIData.SCAM_Enabled;
1102  HostAdapter->SCAM_Level2 = AutoSCSIData.SCAM_Level2;
1103  }
1104  }
1105 
1106  // Determine the maximum number of Target IDs and Logical Units supported by
1107  // this driver for Wide and Narrow Host Adapters.
1108  HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8);
1109  HostAdapter->MaxLogicalUnits = (HostAdapter->ExtendedLUNSupport ? 32 : 8);
1110 
1111  // Select appropriate values for the Mailbox Count,
1112  // Initial CCBs, and Incremental CCBs variables based on whether or not Strict
1113  // Round Robin Mode is supported. If Strict Round Robin Mode is supported,
1114  // then there is no performance degradation in using the maximum possible
1115  // number of Outgoing and Incoming Mailboxes and allowing the Tagged and
1116  // Untagged Queue Depths to determine the actual utilization. If Strict Round
1117  // Robin Mode is not supported, then the Host Adapter must scan all the
1118  // Outgoing Mailboxes whenever an Outgoing Mailbox entry is made, which can
1119  // cause a substantial performance penalty. The host adapters actually have
1120  // room to store the following number of CCBs internally; that is, they can
1121  // internally queue and manage this many active commands on the SCSI bus
1122  // simultaneously. Performance measurements demonstrate that the Driver Queue
1123  // Depth should be set to the Mailbox Count, rather than the Host Adapter
1124  // Queue Depth (internal CCB capacity), as it is more efficient to have the
1125  // queued commands waiting in Outgoing Mailboxes if necessary than to block
1126  // the process in the higher levels of the SCSI Subsystem.
1127  //
1128  // 192 BT-948/958/958D
1129  if (HostAdapter->FirmwareVersion[0] == '5')
1130  {
1131  HostAdapter->HostAdapterQueueDepth = 192;
1132  }
1133 
1134  if (strcmp((char*)HostAdapter->FirmwareVersion, "3.31") >= 0)
1135  {
1136  HostAdapter->StrictRoundRobinModeSupport = TRUE;
1137  HostAdapter->MailboxCount = BusLogic_MaxMailboxes;
1138  }
1139 
1140  //
1141  // Tagged Queuing support is available and operates properly on all "W" series
1142  // MultiMaster Host Adapters, on "C" series MultiMaster Host Adapters with
1143  // firmware version 4.22 and above, and on "S" series MultiMaster Host
1144  // Adapters with firmware version 3.35 and above.
1145  HostAdapter->TaggedQueuingPermitted = 0xFFFF;
1146 
1147  //
1148  // Determine the Host Adapter BIOS Address if the BIOS is enabled and
1150  // BIOS_Address is 0.
1151  HostAdapter->BIOS_Address = ExtendedSetupInformation.BIOS_Address << 12;
1152 
1153  //
1154  //Initialize parameters for MultiMaster Host Adapters.
1155 
1156  //
1157  // Initialize the Host Adapter Full Model Name from the Model Name.
1158  strcpy((char*)HostAdapter->FullModelName, "BusLogic ");
1159  strcat((char*)HostAdapter->FullModelName, (char*)HostAdapter->ModelName);
1160 
1161  // Tagged Queuing is only allowed if Disconnect/Reconnect is permitted.
1162  // Therefore, mask the Tagged Queuing Permitted Default bits with the
1163  // Disconnect/Reconnect Permitted bits.
1164  HostAdapter->TaggedQueuingPermitted &= HostAdapter->DisconnectPermitted;
1165 
1166  // Select an appropriate value for Bus Settle Time either from a BusLogic
1167  // Driver Options specification, or from BusLogic_DefaultBusSettleTime.
1169 
1170  // Indicate reading the Host Adapter Configuration completed successfully.
1171  return TRUE;
1172 }// end BusLogic_ReadHostAdapterConfiguration
BOOLEAN ExtendedTranslationEnabled
Definition: BusLogic958.h:683
unsigned short HostAdapterQueueDepth
Definition: BusLogic958.h:712
BOOLEAN HostDifferentialSCSI
Definition: BusLogic958.h:688
#define TRUE
Definition: types.h:120
UCHAR BusLogic_FirmwareVersion3rdDigit_T
Definition: BusLogic958.h:178
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
unsigned short TaggedQueuingPermitted
Definition: BusLogic958.h:721
unsigned short DisconnectPermitted
Definition: BusLogic958.h:720
#define ERROR(name)
Definition: error_private.h:53
BOOLEAN StrictRoundRobinModeSupport
Definition: BusLogic958.h:696
static UCHAR BusLogic_ReadGeometryRegister(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1071
unsigned short WidePermitted
Definition: BusLogic958.h:399
static BusLogic_HostAdapterBusType_T BusLogic_HostAdapterBusTypes[]
Definition: BusLogic958.h:659
unsigned short DriverScatterGatherLimit
Definition: BusLogic958.h:706
UCHAR FirmwareVersion1stDigit
Definition: BusLogic958.h:229
BOOLEAN HighByteTerminated
Definition: BusLogic958.h:694
unsigned short WidePermitted
Definition: BusLogic958.h:719
#define BusLogic_MaxMailboxes
Definition: BusLogic958.h:90
UCHAR FullModelName[18]
Definition: BusLogic958.h:676
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned short SynchronousPermitted
Definition: BusLogic958.h:401
#define BusLogic_AutoSCSI_BaseOffset
Definition: BusLogic958.h:94
BOOLEAN LevelSensitiveInterrupt
Definition: BusLogic958.h:686
BOOLEAN TerminationInfoValid
Definition: BusLogic958.h:692
int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter, BusLogic_OperationCode_T OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
Definition: BusLogic958.c:606
smooth NULL
Definition: ftsmooth.c:416
UCHAR BusLogic_FirmwareVersionLetter_T
Definition: BusLogic958.h:181
unsigned short BusSettleTime
Definition: BusLogic958.h:715
unsigned short UltraPermitted
Definition: BusLogic958.h:411
BOOLEAN ExtendedLUNSupport
Definition: BusLogic958.h:691
unsigned char UCHAR
Definition: xmlstorage.h:181
BusLogic_HostAdapterBusType_T HostAdapterBusType
Definition: BusLogic958.h:672
unsigned short DisconnectPermitted
Definition: BusLogic958.h:402
unsigned short SynchronousPermitted
Definition: BusLogic958.h:716
CConfiguration Configuration
Definition: main.cpp:11
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
unsigned short FastPermitted
Definition: BusLogic958.h:400
UCHAR BusLogic_HostAdapterModelNumber_T[5]
Definition: BusLogic958.h:175
struct BusLogic_ExtendedSetupInformation::@1277 Misc
UCHAR FirmwareVersion2ndDigit
Definition: BusLogic958.h:230
#define BusLogic_DefaultBusSettleTime
Definition: BusLogic958.h:78
unsigned short FastPermitted
Definition: BusLogic958.h:717
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
UCHAR BusLogic_RequestedReplyLength_T
Definition: BusLogic958.h:169
BOOLEAN ParityCheckingEnabled
Definition: BusLogic958.h:684
UCHAR FirmwareVersion[6]
Definition: BusLogic958.h:675
unsigned short HostAdapterScatterGatherLimit
Definition: BusLogic958.h:705
#define BusLogic_ScatterGatherLimit
Definition: BusLogic958.h:102
BusLogic_BusAddress_T BIOS_Address
Definition: BusLogic958.h:726
unsigned short UltraPermitted
Definition: BusLogic958.h:718

Referenced by Buslogic_InitBT958().

◆ BusLogic_ReadInterruptRegister()

static UCHAR BusLogic_ReadInterruptRegister ( BusLogic_HostAdapter_T HostAdapter)
static

Definition at line 1065 of file BusLogic958.h.

1066 {
1068 }
#define BusLogic_InterruptRegisterOffset
Definition: BusLogic958.h:951
static UCHAR ReadBusLogicPort(PUCHAR adr)
Definition: BusLogic958.h:930

Referenced by BT958HwInterrupt(), BusLogic_Command(), and BusLogic_ProbeHostAdapter().

◆ BusLogic_ReadStatusRegister()

static UCHAR BusLogic_ReadStatusRegister ( BusLogic_HostAdapter_T HostAdapter)
static

Definition at line 1059 of file BusLogic958.h.

1060 {
1062 }
#define BusLogic_StatusRegisterOffset
Definition: BusLogic958.h:948
static UCHAR ReadBusLogicPort(PUCHAR adr)
Definition: BusLogic958.h:930

Referenced by BusLogic_Command(), BusLogic_HardwareResetHostAdapter(), and BusLogic_ProbeHostAdapter().

◆ BusLogic_ScanIncomingMailboxes()

void BusLogic_ScanIncomingMailboxes ( PHW_DEVICE_EXTENSION  deviceExtension)

Definition at line 2048 of file BusLogic958.c.

2056 {
2057  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
2058 
2059 
2060  // Scan through the Incoming Mailboxes in Strict Round Robin fashion, saving
2061  // any completed CCBs for further processing. It is essential that for each
2062  // CCB and SCSI Command issued, command completion processing is performed
2063  // exactly once. Therefore, only Incoming Mailboxes with completion code
2064  // Command Completed Without Error, Command Completed With Error, or Command
2065  // Aborted At Host Request are saved for completion processing. When an
2066  // Incoming Mailbox has a completion code of Aborted Command Not Found, the
2067  // CCB had already completed or been aborted before the current Abort request
2068  // was processed, and so completion processing has already occurred and no
2069  // further action should be taken.
2070  BusLogic_IncomingMailbox_T *NextIncomingMailbox = HostAdapter->NextIncomingMailbox;
2071  BusLogic_CompletionCode_T CompletionCode;
2072 
2073  while ((CompletionCode = NextIncomingMailbox->CompletionCode) != BusLogic_IncomingMailboxFree)
2074  {
2075  // Convert Physical CCB to Virtual.
2077  ScsiPortConvertUlongToPhysicalAddress(NextIncomingMailbox->CCB));
2078 
2079  DebugPrint((INFO, "\n Buslogic - Virtual CCB %lx\n", CCB));
2080  if (CompletionCode != BusLogic_AbortedCommandNotFound)
2081  {
2082  if (CCB->Status == BusLogic_CCB_Active || CCB->Status == BusLogic_CCB_Reset)
2083  {
2084 
2085  // Save the Completion Code for this CCB and queue the CCB
2086  // for completion processing.
2087  CCB->CompletionCode = CompletionCode;
2088  BusLogic_QueueCompletedCCB(deviceExtension,CCB);
2089  }
2090  else
2091  {
2092  // If a CCB ever appears in an Incoming Mailbox and is not marked
2093  // as status Active or Reset, then there is most likely a bug in
2094  // the Host Adapter firmware.
2095  DebugPrint((ERROR, "\n BusLogic - Illegal CCB #%ld status %d in "
2096  "Incoming Mailbox\n", CCB->SerialNumber, CCB->Status));
2097  }
2098  }
2099  NextIncomingMailbox->CompletionCode = BusLogic_IncomingMailboxFree;
2100  if (++NextIncomingMailbox > HostAdapter->LastIncomingMailbox)
2101  NextIncomingMailbox = HostAdapter->FirstIncomingMailbox;
2102  }
2103  HostAdapter->NextIncomingMailbox = NextIncomingMailbox;
2104 }// end BusLogic_ScanIncomingMailboxes
#define ERROR(name)
Definition: error_private.h:53
Definition: cdstruc.h:1073
BusLogic_IncomingMailbox_T * LastIncomingMailbox
Definition: BusLogic958.h:747
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
SCSI_PHYSICAL_ADDRESS NTAPI ScsiPortConvertUlongToPhysicalAddress(IN ULONG_PTR UlongAddress)
Definition: scsiport.c:520
void BusLogic_QueueCompletedCCB(PHW_DEVICE_EXTENSION deviceExtension, BusLogic_CCB_T *CCB)
Definition: BusLogic958.c:2108
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
BusLogic_BusAddress_T CCB
Definition: BusLogic958.h:614
BusLogic_IncomingMailbox_T * FirstIncomingMailbox
Definition: BusLogic958.h:746
Definition: precomp.h:83
PVOID NTAPI ScsiPortGetVirtualAddress(IN PVOID HwDeviceExtension, IN SCSI_PHYSICAL_ADDRESS PhysicalAddress)
Definition: scsiport.c:806
BusLogic_IncomingMailbox_T * NextIncomingMailbox
Definition: BusLogic958.h:748
BusLogic_CompletionCode_T
Definition: BusLogic958.h:448

Referenced by BT958HwInterrupt().

◆ BusLogic_SendBusDeviceReset()

BOOLEAN BusLogic_SendBusDeviceReset ( IN PVOID  HwDeviceExtension,
PSCSI_REQUEST_BLOCK  Srb 
)

Definition at line 2535 of file BusLogic958.c.

2548 {
2549 
2550  PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
2551  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
2552 
2553  UCHAR TargetID = Srb->TargetId;
2554  PBuslogic_CCB_T CCB = Srb->SrbExtension;
2555  BOOLEAN Result = FALSE;
2557 
2558  // If this is a Synchronous Reset and a Bus Device Reset is already pending
2559  // for this Target Device, do not send a second one. Add this Command to
2560  // the list of Commands for which completion processing must be performed
2561  // when the Bus Device Reset CCB completes.
2562 
2563  if (HostAdapter->BusDeviceResetPendingCCB[TargetID] != NULL)
2564  {
2565  DebugPrint((WARNING, "\n BusLogic - Unable to Reset Command to Target %d - "
2566  "Reset Pending\n", TargetID));
2567  Result = TRUE;
2568  goto Done;
2569  }
2570 
2571  DebugPrint((WARNING, "\n BusLogic - Sending Bus Device Reset CCB #%ld to Target %d\n",
2572  CCB->SerialNumber, TargetID));
2573  CCB->Opcode = BusLogic_BusDeviceReset;
2574  CCB->TargetID = TargetID;
2575 
2576 
2577  // Attempt to write an Outgoing Mailbox with the Bus Device Reset CCB.
2578  // If sending a Bus Device Reset is impossible, attempt a full Host
2579  // Adapter Hard Reset and SCSI Bus Reset.
2581  {
2582  DebugPrint((WARNING, "\n BusLogic - Unable to write Outgoing Mailbox for "
2583  "Bus Device Reset\n"));
2584  goto Done;
2585  }
2586 
2587  // If there is a currently executing CCB in the Host Adapter for this Command
2588  // (i.e. this is an Asynchronous Reset), then an Incoming Mailbox entry may be
2589  // made with a completion code of BusLogic_HostAdapterAssertedBusDeviceReset.
2590  // If there is no active CCB for this Command (i.e. this is a Synchronous
2591  // Reset), then the Bus Device Reset CCB's Command field will have been set
2592  // to the Command so that the interrupt for the completion of the Bus Device
2593  // Reset can call the Completion Routine for the Command. On successful
2594  // execution of a Bus Device Reset, older firmware versions did return the
2595  // pending CCBs with the appropriate completion code, but more recent firmware
2596  // versions only return the Bus Device Reset CCB itself. This driver handles
2597  // both cases by marking all the currently executing CCBs to this Target
2598  // Device as Reset. When the Bus Device Reset CCB is processed by the
2599  // interrupt handler, any remaining CCBs marked as Reset will have completion
2600  // processing performed.
2601 
2603  HostAdapter->BusDeviceResetPendingCCB[TargetID] = CCB;
2604  //HostAdapter->LastResetAttempted[TargetID] = jiffies;
2605 
2606  // FlashPoint Host Adapters may have already completed the Bus Device
2607  // Reset and BusLogic_QueueCompletedCCB been called, or it may still be
2608  // pending.
2609 
2610  Result = TRUE;
2611  // If a Bus Device Reset was not possible for some reason, force a full
2612  // Host Adapter Hard Reset and SCSI Bus Reset.
2613 
2614 Done:
2615  return Result;
2616 }
#define TRUE
Definition: types.h:120
Definition: cdstruc.h:1073
BusLogic_CCB_T * BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:730
BusLogic_TargetStatistics_T TargetStatistics[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:749
#define WARNING
Definition: BusLogic958.h:56
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
unsigned short BusDeviceResetsAttempted
Definition: BusLogic958.h:273
BOOLEAN BusLogic_WriteOutgoingMailbox(PHW_DEVICE_EXTENSION deviceExtension, BusLogic_ActionCode_T ActionCode, BusLogic_CCB_T *CCB)
Definition: BusLogic958.c:1679
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _CCB CCB
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
static void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter)
Definition: BusLogic958.h:1179
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
unsigned short BusDeviceResetsRequested
Definition: BusLogic958.h:272

Referenced by BT958HwStartIO().

◆ BusLogic_SoftReset()

static void BusLogic_SoftReset ( BusLogic_HostAdapter_T HostAdapter)
static

Definition at line 1039 of file BusLogic958.h.

1040 {
1041  BusLogic_ControlRegister_T ControlRegister;
1042  ControlRegister.All = 0;
1043  ControlRegister.Bits.SoftReset = TRUE;
1044  WriteBusLogicPort(ControlRegister.All,
1046 }
#define TRUE
Definition: types.h:120
struct BusLogic_ControlRegister::@1278 Bits
#define BusLogic_ControlRegisterOffset
Definition: BusLogic958.h:947
static VOID WriteBusLogicPort(UCHAR data, PUCHAR adr)
Definition: BusLogic958.h:936

Referenced by BusLogic_Command(), and BusLogic_HardwareResetHostAdapter().

◆ BusLogic_StartMailboxCommand()

static void BusLogic_StartMailboxCommand ( BusLogic_HostAdapter_T HostAdapter)
static

Definition at line 1094 of file BusLogic958.h.

1095 {
1098 }
static void BusLogic_WriteCommandParameterRegister(BusLogic_HostAdapter_T *HostAdapter, UCHAR Value)
Definition: BusLogic958.h:1083

Referenced by BusLogic_WriteOutgoingMailbox().

◆ BusLogic_TargetDeviceInquiry()

BOOLEAN BusLogic_TargetDeviceInquiry ( BusLogic_HostAdapter_T HostAdapter)

Definition at line 1316 of file BusLogic958.c.

1328 {
1329  BusLogic_InstalledDevices_T InstalledDevices;
1330 // BusLogic_InstalledDevices8_T InstalledDevicesID0to7;
1331  BusLogic_SetupInformation_T SetupInformation;
1332  BusLogic_SynchronousPeriod_T SynchronousPeriod;
1333  BusLogic_RequestedReplyLength_T RequestedReplyLength;
1334  int TargetID;
1335 
1336  // Wait a few seconds between the Host Adapter Hard Reset which initiates
1337  // a SCSI Bus Reset and issuing any SCSI Commands. Some SCSI devices get
1338  // confused if they receive SCSI Commands too soon after a SCSI Bus Reset.
1339  ScsiPortStallExecution(HostAdapter->BusSettleTime);
1340 
1341  //
1342  // Issue the Inquire Target Devices command for host adapters with firmware
1343  // version 4.25 or later, or the Inquire Installed Devices ID 0 to 7 command
1344  // for older host adapters. This is necessary to force Synchronous Transfer
1345  // Negotiation so that the Inquire Setup Information and Inquire Synchronous
1346  // Period commands will return valid data. The Inquire Target Devices command
1347  // is preferable to Inquire Installed Devices ID 0 to 7 since it only probes
1348  // Logical Unit 0 of each Target Device.
1349  if (strcmp((char*)HostAdapter->FirmwareVersion, "4.25") >= 0)
1350  {
1351  if (BusLogic_Command(HostAdapter,
1353  NULL,
1354  0,
1355  &InstalledDevices,
1356  sizeof(InstalledDevices))
1357  != sizeof(InstalledDevices))
1358  {
1359  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE TARGET DEVICES\n"));
1360  return FALSE;
1361  }
1362  for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1363  {
1364  HostAdapter->TargetFlags[TargetID].TargetExists = (InstalledDevices & (1 << TargetID) ? TRUE : FALSE);
1365  }
1366  }
1367 
1368  // Issue the Inquire Setup Information command.
1369  RequestedReplyLength = sizeof(SetupInformation);
1370  if (BusLogic_Command(HostAdapter,
1372  &RequestedReplyLength,
1373  sizeof(RequestedReplyLength),
1374  &SetupInformation, sizeof(SetupInformation))
1375  != sizeof(SetupInformation))
1376  {
1377  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE SETUP INFORMATION\n"));
1378  return FALSE;
1379  }
1380 
1381  for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1382  {
1383  HostAdapter->SynchronousOffset[TargetID] = (TargetID < 8
1384  ? SetupInformation.SynchronousValuesID0to7[TargetID].Offset
1385  : SetupInformation.SynchronousValuesID8to15[TargetID-8].Offset);
1386  }
1387  if (strcmp((char*)HostAdapter->FirmwareVersion, "5.06L") >= 0)
1388  {
1389  for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1390  {
1391  HostAdapter->TargetFlags[TargetID].WideTransfersActive = (TargetID < 8
1392  ? (SetupInformation.WideTransfersActiveID0to7 & (1 << TargetID)
1393  ? TRUE : FALSE)
1394  : (SetupInformation.WideTransfersActiveID8to15 & (1 << (TargetID-8))
1395  ? TRUE : FALSE));
1396  }
1397  }
1398 
1399 
1400  // Issue the Inquire Synchronous Period command.
1401  if (HostAdapter->FirmwareVersion[0] >= '3')
1402  {
1403  RequestedReplyLength = sizeof(SynchronousPeriod);
1404  if (BusLogic_Command(HostAdapter,
1406  &RequestedReplyLength,
1407  sizeof(RequestedReplyLength),
1408  &SynchronousPeriod,
1409  sizeof(SynchronousPeriod))
1410  != sizeof(SynchronousPeriod))
1411  {
1412  DebugPrint((ERROR, "\n BusLogic - Failure: INQUIRE SYNCHRONOUS PERIOD\n"));
1413  return FALSE;
1414  }
1415  for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1416  {
1417  HostAdapter->SynchronousPeriod[TargetID] = SynchronousPeriod[TargetID];
1418  }
1419  }
1420 
1421  // Indicate the Target Device Inquiry completed successfully.
1422  return TRUE;
1423 }// end BusLogic_TargetDeviceInquiry
BOOLEAN WideTransfersActive
Definition: BusLogic958.h:241
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
UCHAR SynchronousPeriod[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:733
UCHAR SynchronousOffset[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:734
BusLogic_TargetFlags_T TargetFlags[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:732
BusLogic_SynchronousValues8_T SynchronousValuesID0to7
Definition: BusLogic958.h:322
int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter, BusLogic_OperationCode_T OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
Definition: BusLogic958.c:606
smooth NULL
Definition: ftsmooth.c:416
unsigned short BusSettleTime
Definition: BusLogic958.h:715
unsigned short BusLogic_InstalledDevices_T
Definition: BusLogic958.h:1115
UCHAR BusLogic_SynchronousPeriod_T[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:1103
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
BusLogic_SynchronousValues8_T SynchronousValuesID8to15
Definition: BusLogic958.h:329
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
UCHAR BusLogic_RequestedReplyLength_T
Definition: BusLogic958.h:169
UCHAR FirmwareVersion[6]
Definition: BusLogic958.h:675
VOID NTAPI ScsiPortStallExecution(IN ULONG Delay)
Definition: scsiport.c:1473

Referenced by Buslogic_InitBT958().

◆ BusLogic_WriteCommandParameterRegister()

static void BusLogic_WriteCommandParameterRegister ( BusLogic_HostAdapter_T HostAdapter,
UCHAR  Value 
)
static

Definition at line 1083 of file BusLogic958.h.

1085 {
1088 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
static VOID WriteBusLogicPort(UCHAR data, PUCHAR adr)
Definition: BusLogic958.h:936
#define BusLogic_CommandParameterRegisterOffset
Definition: BusLogic958.h:949

Referenced by BusLogic_Command(), and BusLogic_StartMailboxCommand().

◆ BusLogic_WriteOutgoingMailbox()

BOOLEAN BusLogic_WriteOutgoingMailbox ( PHW_DEVICE_EXTENSION  deviceExtension,
BusLogic_ActionCode_T  ActionCode,
BusLogic_CCB_T CCB 
)

Definition at line 1679 of file BusLogic958.c.

1699 {
1700  BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
1701  BusLogic_OutgoingMailbox_T *NextOutgoingMailbox;
1702  ULONG length;
1703 
1704  NextOutgoingMailbox = HostAdapter->NextOutgoingMailbox;
1705 
1706  if (NextOutgoingMailbox->ActionCode == BusLogic_OutgoingMailboxFree)
1707  {
1708  CCB->Status = BusLogic_CCB_Active;
1709 
1710  // The CCB field must be written before the Action Code field since
1711  // the Host Adapter is operating asynchronously and the locking code
1712  // does not protect against simultaneous access by the Host Adapter.
1713 
1714  // Get CCB physical address.
1715  NextOutgoingMailbox->CCB = ScsiPortConvertPhysicalAddressToUlong( ScsiPortGetPhysicalAddress(deviceExtension,
1716  NULL,
1717  CCB,
1718  &length));
1719 
1720  NextOutgoingMailbox->ActionCode = (UCHAR)ActionCode;
1721 
1722  BusLogic_StartMailboxCommand(HostAdapter);
1723 
1724  if (++NextOutgoingMailbox > HostAdapter->LastOutgoingMailbox)
1725  {
1726  NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox;
1727  }
1728 
1729  HostAdapter->NextOutgoingMailbox = NextOutgoingMailbox;
1730  if (ActionCode == BusLogic_MailboxStartCommand)
1731  {
1732  HostAdapter->ActiveCommandsPerTarget[CCB->TargetID]++;
1733  // check this Namita
1734  HostAdapter->ActiveCommandsPerLun[CCB->TargetID][CCB->LogicalUnit]++;
1735  if (CCB->Opcode != BusLogic_BusDeviceReset)
1736  {
1737  HostAdapter->TargetStatistics[CCB->TargetID].CommandsAttempted++;
1738  }
1739  }
1740  return TRUE;
1741  }
1742  return FALSE;
1743 }// end BusLogic_WriteOutgoingMailbox
#define TRUE
Definition: types.h:120
Definition: cdstruc.h:1073
#define ScsiPortConvertPhysicalAddressToUlong(Address)
Definition: srb.h:949
UCHAR ActiveCommandsPerTarget[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:735
BusLogic_TargetStatistics_T TargetStatistics[BusLogic_MaxTargetDevices]
Definition: BusLogic958.h:749
SCSI_PHYSICAL_ADDRESS NTAPI ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, IN PVOID VirtualAddress, OUT ULONG *Length)
Definition: scsiport.c:607
BusLogic_OutgoingMailbox_T * LastOutgoingMailbox
Definition: BusLogic958.h:744
smooth NULL
Definition: ftsmooth.c:416
UCHAR ActiveCommandsPerLun[BusLogic_MaxTargetDevices][BusLogic_MaxLogicalUnits]
Definition: BusLogic958.h:736
BusLogic_HostAdapter_T hcs
Definition: BusLogic958.h:757
BusLogic_BusAddress_T CCB
Definition: BusLogic958.h:604
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned char UCHAR
Definition: xmlstorage.h:181
BusLogic_OutgoingMailbox_T * FirstOutgoingMailbox
Definition: BusLogic958.h:743
unsigned int CommandsAttempted
Definition: BusLogic958.h:261
static void BusLogic_StartMailboxCommand(BusLogic_HostAdapter_T *HostAdapter)
Definition: BusLogic958.h:1094
BusLogic_OutgoingMailbox_T * NextOutgoingMailbox
Definition: BusLogic958.h:745
unsigned int ULONG
Definition: retypes.h:1

Referenced by BT958HwStartIO(), and BusLogic_SendBusDeviceReset().

◆ DriverEntry()

ULONG NTAPI DriverEntry ( IN PVOID  DriverObject,
IN PVOID  Argument2 
)

Definition at line 6177 of file atapi.c.

6198 {
6199  HW_INITIALIZATION_DATA hwInitializationData;
6200  ULONG adapterCount;
6201  ULONG i;
6202  ULONG statusToReturn, newStatus;
6203 
6204  DebugPrint((1,"\n\nATAPI IDE MiniPort Driver\n"));
6205 
6206  statusToReturn = 0xffffffff;
6207 
6208  //
6209  // Zero out structure.
6210  //
6211 
6212  AtapiZeroMemory(((PUCHAR)&hwInitializationData), sizeof(HW_INITIALIZATION_DATA));
6213 
6214  //
6215  // Set size of hwInitializationData.
6216  //
6217 
6218  hwInitializationData.HwInitializationDataSize =
6219  sizeof(HW_INITIALIZATION_DATA);
6220 
6221  //
6222  // Set entry points.
6223  //
6224 
6225  hwInitializationData.HwInitialize = AtapiHwInitialize;
6226  hwInitializationData.HwResetBus = AtapiResetController;
6227  hwInitializationData.HwStartIo = AtapiStartIo;
6228  hwInitializationData.HwInterrupt = AtapiInterrupt;
6229 
6230  //
6231  // Specify size of extensions.
6232  //
6233 
6234  hwInitializationData.DeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION);
6235  hwInitializationData.SpecificLuExtensionSize = sizeof(HW_LU_EXTENSION);
6236 
6237  //
6238  // Indicate PIO device.
6239  //
6240 
6241  hwInitializationData.MapBuffers = TRUE;
6242 
6243  //
6244  // Native Mode Devices
6245  //
6246  for (i=0; i <NUM_NATIVE_MODE_ADAPTERS; i++) {
6247  hwInitializationData.HwFindAdapter = AtapiFindNativeModeController;
6248  hwInitializationData.NumberOfAccessRanges = 4;
6249  hwInitializationData.AdapterInterfaceType = PCIBus;
6250 
6251  hwInitializationData.VendorId = NativeModeAdapters[i].VendorId;
6252  hwInitializationData.VendorIdLength = (USHORT) NativeModeAdapters[i].VendorIdLength;
6253  hwInitializationData.DeviceId = NativeModeAdapters[i].DeviceId;
6254  hwInitializationData.DeviceIdLength = (USHORT) NativeModeAdapters[i].DeviceIdLength;
6255 
6256  newStatus = ScsiPortInitialize(DriverObject,
6257  Argument2,
6258  &hwInitializationData,
6259  (PVOID)(ULONG_PTR)i);
6260  if (newStatus < statusToReturn)
6261  statusToReturn = newStatus;
6262  }
6263 
6264  hwInitializationData.VendorId = 0;
6265  hwInitializationData.VendorIdLength = 0;
6266  hwInitializationData.DeviceId = 0;
6267  hwInitializationData.DeviceIdLength = 0;
6268 
6269  //
6270  // The adapter count is used by the find adapter routine to track how
6271  // which adapter addresses have been tested.