--- vendor/VMware/buslogic/current/BusLogic958.c 2005-08-18 21:37:18 UTC (rev 17433)
+++ trunk/reactos/drivers/storage/buslogic/BusLogic958.c 2005-08-18 21:59:20 UTC (rev 17434)
@@ -70,6 +70,7 @@
#include "BusLogic958.h"
ULONG
+STDCALL
DriverEntry(IN PVOID DriverObject,
IN PVOID Argument2
)
@@ -86,16 +87,16 @@
ULONG Status;
ULONG i;
ULONG HwContext;
- static int cardNo = 0;
+// static int cardNo = 0;
UCHAR VendorId[4] = { '1', '0', '4', 'b' };
UCHAR DeviceId[4] = { '1', '0', '4', '0' };
- DebugPrint((0,"\n BusLogic - Inside the DriverEntry function \n"));
+ DebugPrint((0,"\n BusLogic - Inside the DriverEntry function \n"));
// Zero out structure.
for (i = 0; i < sizeof(HW_INITIALIZATION_DATA); i++)
- {
+ {
((PUCHAR) & hwInitializationData)[i] = 0;
}
@@ -104,18 +105,18 @@
// Set entry points.
hwInitializationData.HwInitialize = BT958HwInitialize;
- hwInitializationData.HwResetBus = BT958HwResetBus;
+ hwInitializationData.HwResetBus = BT958HwResetBus;
hwInitializationData.HwStartIo = BT958HwStartIO;
hwInitializationData.HwInterrupt = BT958HwInterrupt;
hwInitializationData.HwAdapterControl = BT958HwAdapterControl;
- hwInitializationData.HwFindAdapter = BT958HwFindAdapter;
+ hwInitializationData.HwFindAdapter = BT958HwFindAdapter;
- // Inidicate no buffer mapping but will need physical addresses
+ // Inidicate no buffer mapping but will need physical addresses
hwInitializationData.NeedPhysicalAddresses = TRUE;
- // Indicate Auto request sense is supported
- hwInitializationData.AutoRequestSense = TRUE;
- hwInitializationData.MultipleRequestPerLu = TRUE;
+ // Indicate Auto request sense is supported
+ hwInitializationData.AutoRequestSense = TRUE;
+ hwInitializationData.MultipleRequestPerLu = TRUE;
#if TAG_QUEUING
hwInitializationData.TaggedQueuing = TRUE;
@@ -125,7 +126,7 @@
hwInitializationData.AdapterInterfaceType = PCIBus;
- // Fill in the vendor id and the device id
+ // Fill in the vendor id and the device id
hwInitializationData.VendorId = &VendorId;
hwInitializationData.VendorIdLength = 4;
hwInitializationData.DeviceId = &DeviceId;
@@ -135,36 +136,36 @@
hwInitializationData.NumberOfAccessRanges = 2;
- // Specify size of extensions.
+ // Specify size of extensions.
hwInitializationData.DeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION);
- // logical unit extension
+ // logical unit extension
hwInitializationData.SrbExtensionSize = sizeof(BusLogic_CCB_T);
HwContext = 0;
- DebugPrint((0,"\n BusLogic - Calling the ScsiPortInitialize Routine\n"));
+ DebugPrint((0,"\n BusLogic - Calling the ScsiPortInitialize Routine\n"));
Status = ScsiPortInitialize(DriverObject,
Argument2,
&hwInitializationData,
&HwContext);
- DebugPrint((0,"\n BusLogic - Exiting the DriverEntry function \n"));
- DebugPrint((0,"\n BusLogic - Status = %ul \n", Status));
+ DebugPrint((0,"\n BusLogic - Exiting the DriverEntry function \n"));
+ DebugPrint((0,"\n BusLogic - Status = %ul \n", Status));
return( Status );
} // end DriverEntry()
ULONG
+STDCALL
BT958HwFindAdapter(IN PVOID HwDeviceExtension,
- IN PVOID Context,
- IN PVOID BusInformation,
- IN PCHAR ArgumentString,
- IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
- OUT PBOOLEAN Again
- )
+ IN PVOID Context,
+ IN PVOID BusInformation,
+ IN PCHAR ArgumentString,
+ IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
+ OUT PBOOLEAN Again)
//_________________________________________________________________________________________________
// Routine Description:
// This function is called by the OS-specific port driver after the necessary storage
@@ -192,61 +193,61 @@
{
PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
BusLogic_HostAdapter_T *hcsp = &(deviceExtension->hcs);
- static UCHAR k = 0;
+// static UCHAR k = 0;
PACCESS_RANGE accessRange;
- PCI_COMMON_CONFIG PCICommonConfig;
+// PCI_COMMON_CONFIG PCICommonConfig;
PUCHAR pciAddress, portFound;
char NumPort = 0;
- DebugPrint((0,"\n BusLogic - Inside the Find Adapter Routine\n"));
+ DebugPrint((0,"\n BusLogic - Inside the Find Adapter Routine\n"));
*Again = FALSE;
- accessRange = &((*(ConfigInfo->AccessRanges))[0]);
+ accessRange = &((*(ConfigInfo->AccessRanges))[0]);
// Inform SCSIPORT that we are NOT a WMI data provider
// Sirish, 10th June 2002
ConfigInfo->WmiDataProvider = FALSE;
/*Sirish, 10th June 2002 BT958WmiInitialize(deviceExtension);*/
- // Check for configuration information passed in form the system
- if ((*ConfigInfo->AccessRanges)[0].RangeLength != 0)
+ // Check for configuration information passed in form the system
+ if ((*ConfigInfo->AccessRanges)[0].RangeLength != 0)
+ {
+ // check if the system supplied bus-relative address is valid and has not been
+ // claimed by anyother device
+ if ( ScsiPortValidateRange(deviceExtension,
+ ConfigInfo->AdapterInterfaceType,
+ ConfigInfo->SystemIoBusNumber,
+ accessRange->RangeStart,
+ accessRange->RangeLength,
+ TRUE) ) // TRUE: iniospace
{
- // check if the system supplied bus-relative address is valid and has not been
- // claimed by anyother device
- if ( ScsiPortValidateRange(deviceExtension,
- ConfigInfo->AdapterInterfaceType,
- ConfigInfo->SystemIoBusNumber,
- accessRange->RangeStart,
- accessRange->RangeLength,
- TRUE) ) // TRUE: iniospace
- {
- DebugPrint((0,"\n BusLogic - BusLogic - Validate Range function suceeded \n"));
+ DebugPrint((0,"\n BusLogic - BusLogic - Validate Range function suceeded \n"));
- // Map the Bus-relative range addresses to system-space logical range addresses
- // so that these mapped logical addresses can be called with SciPortRead/Writexxx
- // to determine whether the adapter is an HBA that the driver supports
+ // Map the Bus-relative range addresses to system-space logical range addresses
+ // so that these mapped logical addresses can be called with SciPortRead/Writexxx
+ // to determine whether the adapter is an HBA that the driver supports
- pciAddress = (PUCHAR) ScsiPortGetDeviceBase(deviceExtension,
- ConfigInfo->AdapterInterfaceType,
- ConfigInfo->SystemIoBusNumber,
- accessRange->RangeStart,
- accessRange->RangeLength,
- TRUE); // TRUE: iniospace
+ pciAddress = (PUCHAR) ScsiPortGetDeviceBase(deviceExtension,
+ ConfigInfo->AdapterInterfaceType,
+ ConfigInfo->SystemIoBusNumber,
+ accessRange->RangeStart,
+ accessRange->RangeLength,
+ TRUE); // TRUE: iniospace
- if(pciAddress)
- {
- DebugPrint((0,"\n BusLogic - Get Device Base function suceeded \n"));
+ if(pciAddress)
+ {
+ DebugPrint((0,"\n BusLogic - Get Device Base function suceeded \n"));
- memset(hcsp, 0, sizeof(BusLogic_HostAdapter_T));
+ memset(hcsp, 0, sizeof(BusLogic_HostAdapter_T));
- // points to structure of type BT958_HA which has device specific information. This needs
- // to be either changed or modified with our specific info.
- hcsp->IO_Address = pciAddress;
- hcsp->IRQ_Channel = (UCHAR)ConfigInfo->BusInterruptLevel;
- NumPort++;
- }
- }
+ // points to structure of type BT958_HA which has device specific information. This needs
+ // to be either changed or modified with our specific info.
+ hcsp->IO_Address = pciAddress;
+ hcsp->IRQ_Channel = (UCHAR)ConfigInfo->BusInterruptLevel;
+ NumPort++;
+ }
+ }
}
if (NumPort == 0)
@@ -534,8 +535,7 @@
if (StatusRegister.Bits.DataInRegisterReady)
{
- UCHAR ErrorCode = BusLogic_ReadDataInRegister(HostAdapter);
- DebugPrint((0,"HOST ADAPTER ERROR CODE = %d\n", ErrorCode));
+ DebugPrint((0,"HOST ADAPTER ERROR CODE = %d\n", BusLogic_ReadDataInRegister(HostAdapter)));
}
return FALSE;
}
@@ -834,7 +834,7 @@
BusLogic_GeometryRegister_T GeometryRegister;
BusLogic_RequestedReplyLength_T RequestedReplyLength;
UCHAR *TargetPointer, Character;
- int TargetID, i;
+ ULONG /*TargetID,*/ i;
// Issue the Inquire Board ID command.
@@ -948,7 +948,7 @@
*TargetPointer = '\0';
// Issue the Inquire Firmware Version Letter command.
- if (strcmp(HostAdapter->FirmwareVersion, "3.3") >= 0)
+ if (strcmp((char*)HostAdapter->FirmwareVersion, "3.3") >= 0)
{
if (BusLogic_Command(HostAdapter,
BusLogic_InquireFirmwareVersionLetter,
@@ -1110,7 +1110,7 @@
HostAdapter->HostAdapterQueueDepth = 192;
}
- if (strcmp(HostAdapter->FirmwareVersion, "3.31") >= 0)
+ if (strcmp((char*)HostAdapter->FirmwareVersion, "3.31") >= 0)
{
HostAdapter->StrictRoundRobinModeSupport = TRUE;
HostAdapter->MailboxCount = BusLogic_MaxMailboxes;
@@ -1134,8 +1134,8 @@
//
// Initialize the Host Adapter Full Model Name from the Model Name.
- strcpy(HostAdapter->FullModelName, "BusLogic ");
- strcat(HostAdapter->FullModelName, HostAdapter->ModelName);
+ strcpy((char*)HostAdapter->FullModelName, "BusLogic ");
+ strcat((char*)HostAdapter->FullModelName, (char*)HostAdapter->ModelName);
// Tagged Queuing is only allowed if Disconnect/Reconnect is permitted.
// Therefore, mask the Tagged Queuing Permitted Default bits with the
@@ -1304,7 +1304,7 @@
//_________________________________________________________________________
{
BusLogic_InstalledDevices_T InstalledDevices;
- BusLogic_InstalledDevices8_T InstalledDevicesID0to7;
+// BusLogic_InstalledDevices8_T InstalledDevicesID0to7;
BusLogic_SetupInformation_T SetupInformation;
BusLogic_SynchronousPeriod_T SynchronousPeriod;
BusLogic_RequestedReplyLength_T RequestedReplyLength;
@@ -1323,7 +1323,7 @@
// Period commands will return valid data. The Inquire Target Devices command
// is preferable to Inquire Installed Devices ID 0 to 7 since it only probes
// Logical Unit 0 of each Target Device.
- if (strcmp(HostAdapter->FirmwareVersion, "4.25") >= 0)
+ if (strcmp((char*)HostAdapter->FirmwareVersion, "4.25") >= 0)
{
if (BusLogic_Command(HostAdapter,
BusLogic_InquireTargetDevices,
@@ -1361,7 +1361,7 @@
? SetupInformation.SynchronousValuesID0to7[TargetID].Offset
: SetupInformation.SynchronousValuesID8to15[TargetID-8].Offset);
}
- if (strcmp(HostAdapter->FirmwareVersion, "5.06L") >= 0)
+ if (strcmp((char*)HostAdapter->FirmwareVersion, "5.06L") >= 0)
{
for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
{
@@ -1399,6 +1399,7 @@
return TRUE;
}// end BusLogic_TargetDeviceInquiry
+VOID
BusLogic_InitializeCCB( PBuslogic_CCB_T CCB)
{
CCB->Opcode = BusLogic_InitiatorCCB;
@@ -1431,6 +1432,7 @@
}
BOOLEAN
+STDCALL
BT958HwStartIO(IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb
)
@@ -1449,9 +1451,9 @@
//__________________________________________________________________________________
{
PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
- PNONCACHED_EXTENSION noncachedExtension = deviceExtension->NoncachedExtension;
+// PNONCACHED_EXTENSION noncachedExtension = deviceExtension->NoncachedExtension;
BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
- BusLogic_OutgoingMailbox_T mailboxOut;
+// BusLogic_OutgoingMailbox_T mailboxOut;
PSCSI_REQUEST_BLOCK AbortSRB;
PBuslogic_CCB_T ccb;
@@ -1739,12 +1741,12 @@
ULONG length;
- UCHAR *Cdb = Srb->Cdb;
- PCDB RealCdb ;
+// UCHAR *Cdb = Srb->Cdb;
+// PCDB RealCdb ;
UCHAR CDB_Length = Srb->CdbLength;
UCHAR TargetID = Srb->TargetId;
UCHAR LogicalUnit = Srb->Lun;
- void *BufferPointer = Srb->DataBuffer;
+// void *BufferPointer = Srb->DataBuffer;
int BufferLength = Srb->DataTransferLength;
if (Srb->DataTransferLength > 0)
@@ -1942,6 +1944,7 @@
BOOLEAN
+STDCALL
BT958HwInterrupt(IN PVOID HwDeviceExtension)
//_________________________________________________________________________
// Routine Description:
@@ -1961,13 +1964,13 @@
//_________________________________________________________________________
{
PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
- PNONCACHED_EXTENSION noncachedExtension = deviceExtension->NoncachedExtension;
+// PNONCACHED_EXTENSION noncachedExtension = deviceExtension->NoncachedExtension;
BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
- PBuslogic_CCB_T ccb;
- PSCSI_REQUEST_BLOCK srb;
+// PBuslogic_CCB_T ccb;
+// PSCSI_REQUEST_BLOCK srb;
- ULONG residualBytes;
- ULONG i;
+// ULONG residualBytes;
+// ULONG i;
BusLogic_InterruptRegister_T InterruptRegister;
@@ -2213,8 +2216,8 @@
case BusLogic_CommandCompletedWithError:
{
- PCDB RealCdb = (PCDB)CCB->CDB;
- DebugPrint((0,"%x Command completed with error Host - %x Target %x \n",RealCdb->CDB6GENERIC.OperationCode,
+// PCDB RealCdb = (PCDB)CCB->CDB;
+ DebugPrint((0,"%x Command completed with error Host - %x Target %x \n",((PCDB)CCB->CDB)->CDB6GENERIC.OperationCode,
CCB->HostAdapterStatus,
CCB->TargetDeviceStatus));
@@ -2290,7 +2293,7 @@
// This function returns the error code that should be returned to port driver
//_________________________________________________________________________________________
{
- UCHAR HostStatus;
+ UCHAR HostStatus = 0;
// Namita 2Oct CDROM issue
if (TargetDeviceStatus != BusLogic_OperationGood && (HostAdapterStatus == BusLogic_CommandCompletedNormally ||
@@ -2310,7 +2313,12 @@
{
HostStatus = SRB_STATUS_BUSY;
}
- }
+ break;
+ case BusLogic_OperationGood:
+
+ HostStatus = SRB_STATUS_SUCCESS;
+ break;
+ }
}
else
@@ -2404,6 +2412,7 @@
BOOLEAN
+STDCALL
BT958HwResetBus(IN PVOID HwDeviceExtension,
IN ULONG PathId)
//_____________________________________________________________________________________
@@ -2420,8 +2429,8 @@
{
PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
- BusLogic_CCB_T *CCB;
- int TargetID;
+// BusLogic_CCB_T *CCB;
+// int TargetID;
BOOLEAN Result;
BOOLEAN HardReset;
@@ -2571,6 +2580,7 @@
}
BOOLEAN
+STDCALL
BT958HwInitialize(IN PVOID HwDeviceExtension)
//_______________________________________________________________________________
// Routine Description:
@@ -2601,6 +2611,7 @@
}// end BT958HwInitialize
SCSI_ADAPTER_CONTROL_STATUS
+STDCALL
BT958HwAdapterControl(IN PVOID HwDeviceExtension,
IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
IN PVOID Parameters)
@@ -2626,20 +2637,20 @@
{
PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
- UCHAR *ParameterPointer;
- BusLogic_StatusRegister_T StatusRegister;
- BusLogic_InterruptRegister_T InterruptRegister;
- int Result,ParameterLength;
- long TimeoutCounter;
+// UCHAR *ParameterPointer;
+// BusLogic_StatusRegister_T StatusRegister;
+// BusLogic_InterruptRegister_T InterruptRegister;
+// int Result,ParameterLength;
+// long TimeoutCounter;
PSCSI_SUPPORTED_CONTROL_TYPE_LIST ControlTypeList;
ULONG AdjustedMaxControlType;
ULONG Index;
- UCHAR Retries;
+// UCHAR Retries;
// Default Status
- SCSI_ADAPTER_CONTROL_STATUS Status = ScsiAdapterControlSuccess;
+// SCSI_ADAPTER_CONTROL_STATUS Status = ScsiAdapterControlSuccess;
//
// Structure defining which functions this miniport supports