VMware BusLogic SCSI driver vendor drop
Added: vendor/VMware/
Added: vendor/VMware/buslogic/
Added: vendor/VMware/buslogic/current/
Added: vendor/VMware/buslogic/current/BT958.bmf
Added: vendor/VMware/buslogic/current/BT958.mof
Added: vendor/VMware/buslogic/current/BT958dt.h
Added: vendor/VMware/buslogic/current/BusLogic958.c
Added: vendor/VMware/buslogic/current/BusLogic958.h
Added: vendor/VMware/buslogic/current/BusLogic958.rc
Added: vendor/VMware/buslogic/current/Log.c
Added: vendor/VMware/buslogic/current/Log.h
Added: vendor/VMware/buslogic/current/makefile
Added: vendor/VMware/buslogic/current/makefile.inc
Added: vendor/VMware/buslogic/current/resource.h
Added: vendor/VMware/buslogic/current/sources
Added: vendor/VMware/buslogic/current/wmi.c

Added: vendor/VMware/buslogic/current/BT958.bmf
(Binary files differ)
Property changes on: vendor/VMware/buslogic/current/BT958.bmf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: vendor/VMware/buslogic/current/BT958.mof
--- vendor/VMware/buslogic/current/BT958.mof	2005-08-18 21:25:04 UTC (rev 17431)
+++ vendor/VMware/buslogic/current/BT958.mof	2005-08-18 21:36:35 UTC (rev 17432)
@@ -0,0 +1,30 @@
+[
+    Dynamic, Provider("WMIProv"),
+    WMI,
+    Description ("BT958 Extended Setup Information (Operation Code 8Dh)"),
+    guid ("{CBD60D59-CE49-4cf4-AB7A-DEC6F4988D1A}"),
+    HeaderName("BT958ExtendedSetupInfo"),
+    GuidName1("BT958Wmi_ExtendedSetupInfo_Guid"),
+    WmiExpense(0)
+]
+class BT958ExtendedSetupInfoGuid
+{
+    [read,key] String InstanceName;
+    [read] boolean Active;
+
+    [read, WmiDataId(1), WmiVersion(1)]	uint8 BusType;				            
+	[read, WmiDataId(2), WmiVersion(1)]	uint8  BIOS_Address;				        
+	[read, WmiDataId(3), WmiVersion(1)]	uint16 ScatterGatherLimit;		
+	[read, WmiDataId(4), WmiVersion(1)]	uint8  MailboxCount;				        
+	[read, WmiDataId(5), WmiVersion(1)] uint32 BaseMailboxAddress;	
+	[read, WmiDataId(6), WmiVersion(1)] boolean FastOnEISA:1;
+	[read, WmiDataId(7), WmiVersion(1)] boolean LevelSensitiveInterrupt:1;	
+	[read, WmiDataId(8), WmiVersion(1), max(3)] uint8 FirmwareRevision[];		        
+    [read, WmiDataId(9), WmiVersion(1)] boolean HostWideSCSI:1;				    
+	[read, WmiDataId(10), WmiVersion(1)] boolean HostDifferentialSCSI:1;			
+	[read, WmiDataId(11), WmiVersion(1)] boolean HostSupportsSCAM:1;				
+	[read, WmiDataId(12), WmiVersion(1)] boolean HostUltraSCSI:1;				    
+	[read, WmiDataId(13), WmiVersion(1)] boolean HostSmartTermination:1;			
+};
+
+
Property changes on: vendor/VMware/buslogic/current/BT958.mof
___________________________________________________________________
Name: svn:eol-style
   + native

Added: vendor/VMware/buslogic/current/BT958dt.h
--- vendor/VMware/buslogic/current/BT958dt.h	2005-08-18 21:25:04 UTC (rev 17431)
+++ vendor/VMware/buslogic/current/BT958dt.h	2005-08-18 21:36:35 UTC (rev 17432)
@@ -0,0 +1,105 @@
+/*
+ * vmscsi-- Miniport driver for the Buslogic BT 958 SCSI Controller 
+ *          under Windows 2000/XP/Server 2003
+ *
+ *          Based in parts on the buslogic driver for the same device
+ *          available with the GNU Linux Operating System.
+ *          
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+
+#ifndef _BT958dt_h_
+#define _BT958dt_h_
+
+// BT958ExtendedSetupInfoGuid - BT958ExtendedSetupInfo
+// BT958 Extended Setup Information (Operation Code 8Dh)
+#define BT958Wmi_ExtendedSetupInfo_Guid \
+    { 0xcbd60d59,0xce49,0x4cf4, { 0xab,0x7a,0xde,0xc6,0xf4,0x98,0x8d,0x1a } }
+
+DEFINE_GUID(BT958ExtendedSetupInfoGuid_GUID, \
+            0xcbd60d59,0xce49,0x4cf4,0xab,0x7a,0xde,0xc6,0xf4,0x98,0x8d,0x1a);
+
+
+typedef struct _BT958ExtendedSetupInfo
+{
+    // 
+    UCHAR BusType;
+    #define BT958ExtendedSetupInfo_BusType_SIZE sizeof(UCHAR)
+    #define BT958ExtendedSetupInfo_BusType_ID 1
+
+    // 
+    UCHAR BIOS_Address;
+    #define BT958ExtendedSetupInfo_BIOS_Address_SIZE sizeof(UCHAR)
+    #define BT958ExtendedSetupInfo_BIOS_Address_ID 2
+
+    // 
+    USHORT ScatterGatherLimit;
+    #define BT958ExtendedSetupInfo_ScatterGatherLimit_SIZE sizeof(USHORT)
+    #define BT958ExtendedSetupInfo_ScatterGatherLimit_ID 3
+
+    // 
+    UCHAR MailboxCount;
+    #define BT958ExtendedSetupInfo_MailboxCount_SIZE sizeof(UCHAR)
+    #define BT958ExtendedSetupInfo_MailboxCount_ID 4
+
+    // 
+    ULONG BaseMailboxAddress;
+    #define BT958ExtendedSetupInfo_BaseMailboxAddress_SIZE sizeof(ULONG)
+    #define BT958ExtendedSetupInfo_BaseMailboxAddress_ID 5
+
+    // 
+    BOOLEAN FastOnEISA;
+    #define BT958ExtendedSetupInfo_FastOnEISA_SIZE sizeof(BOOLEAN)
+    #define BT958ExtendedSetupInfo_FastOnEISA_ID 6
+
+    // 
+    BOOLEAN LevelSensitiveInterrupt;
+    #define BT958ExtendedSetupInfo_LevelSensitiveInterrupt_SIZE sizeof(BOOLEAN)
+    #define BT958ExtendedSetupInfo_LevelSensitiveInterrupt_ID 7
+
+    // 
+    UCHAR FirmwareRevision[3];
+    #define BT958ExtendedSetupInfo_FirmwareRevision_SIZE sizeof(UCHAR[3])
+    #define BT958ExtendedSetupInfo_FirmwareRevision_ID 8
+
+    // 
+    BOOLEAN HostWideSCSI;
+    #define BT958ExtendedSetupInfo_HostWideSCSI_SIZE sizeof(BOOLEAN)
+    #define BT958ExtendedSetupInfo_HostWideSCSI_ID 9
+
+    // 
+    BOOLEAN HostDifferentialSCSI;
+    #define BT958ExtendedSetupInfo_HostDifferentialSCSI_SIZE sizeof(BOOLEAN)
+    #define BT958ExtendedSetupInfo_HostDifferentialSCSI_ID 10
+
+    // 
+    BOOLEAN HostSupportsSCAM;
+    #define BT958ExtendedSetupInfo_HostSupportsSCAM_SIZE sizeof(BOOLEAN)
+    #define BT958ExtendedSetupInfo_HostSupportsSCAM_ID 11
+
+    // 
+    BOOLEAN HostUltraSCSI;
+    #define BT958ExtendedSetupInfo_HostUltraSCSI_SIZE sizeof(BOOLEAN)
+    #define BT958ExtendedSetupInfo_HostUltraSCSI_ID 12
+
+    // 
+    BOOLEAN HostSmartTermination;
+    #define BT958ExtendedSetupInfo_HostSmartTermination_SIZE sizeof(BOOLEAN)
+    #define BT958ExtendedSetupInfo_HostSmartTermination_ID 13
+
+} BT958ExtendedSetupInfo, *PBT958ExtendedSetupInfo;
+
+#endif
Property changes on: vendor/VMware/buslogic/current/BT958dt.h
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: vendor/VMware/buslogic/current/BusLogic958.c
--- vendor/VMware/buslogic/current/BusLogic958.c	2005-08-18 21:25:04 UTC (rev 17431)
+++ vendor/VMware/buslogic/current/BusLogic958.c	2005-08-18 21:36:35 UTC (rev 17432)
@@ -0,0 +1,2743 @@
+/*
+ * vmscsi-- Miniport driver for the Buslogic BT 958 SCSI Controller 
+ *          under Windows 2000/XP/Server 2003
+ *
+ *          Based in parts on the buslogic driver for the same device
+ *          available with the GNU Linux Operating System.
+ *          
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+//____________________________________________________________________________________
+//
+// File description :The driver for BusLogic-BT958 SCSI Host adapter card.
+// This driver assumes that the host adapter(HA from now on) is a PCI device.
+// This is an effort to build a driver for this card for the windows XP ennvironment
+// since the native XP installation doesnt provide this driver.
+//
+// The technical refernece for this device is at :
+//
+// Author: Namita Lal, Sirish Raghuram Calsoft Pvt Ltd
+// Date:   5th Feb 2003
+// Status: Driver version 1.2.0.0
+//         Performance tuned
+//         Correctness tested for
+//            1. Installation at OS install time
+//            2. Installation in an installed OS
+//            3. Installation by upgrading a previous version
+//         on all flavours of WinXP and Win Server 2003
+//         For Win2k however, please refer PR 22812
+/*
+Revision History: 
+v1.0.0.4  // Pre final release to VMware in Sep 2001, without WMI
+    |
+    |
+    v
+v1.0.0.5  // Sep 2001 release to VMware, with WMI
+    |
+    |
+    v
+v1.0.0.6  // Fix for bug with Nero Burning ROM in XP
+    |	  // where SCSI_AUTO_SENSE is turned off at times
+    |
+    |
+    |---------> v1.1.0.0	// Performance optimizations:
+    |		    |			// A. WMI disabled, B. Queueing depth increased
+    |		    |			// C. Control flow changed (bug)
+    |		    |
+    |		    v
+    |		v1.1.0.1	// Fix for .NET restart freeze with 1.1.0.0
+    |					// Breaks on XP
+    |
+    v
+v1.2.0.0  // A. WMI disabled, B. Queueing depth increased
+		  // CURRENT VERSION
+*/
+//____________________________________________________________________________________
+
+#include "BusLogic958.h"
+
+ULONG
+DriverEntry(IN PVOID DriverObject,
+			IN PVOID Argument2
+	  	   )
+//_________________________________________________________________________
+// Routine Description:
+//              Installable driver initialization entry point for system.
+// Arguments:
+//              Driver Object
+// Return Value:
+//              Status from ScsiPortInitialize()
+//_________________________________________________________________________
+{
+    HW_INITIALIZATION_DATA hwInitializationData;
+    ULONG Status;
+    ULONG i;
+    ULONG HwContext;
+    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"));
+
+	// Zero out structure. 
+    for (i = 0; i < sizeof(HW_INITIALIZATION_DATA); i++) 
+	{
+        ((PUCHAR) & hwInitializationData)[i] = 0;
+    }
+
+    // Set size of hwInitializationData. 
+    hwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA);
+
+    // Set entry points. 
+    hwInitializationData.HwInitialize =     BT958HwInitialize;
+	hwInitializationData.HwResetBus =       BT958HwResetBus;
+    hwInitializationData.HwStartIo =        BT958HwStartIO;
+    hwInitializationData.HwInterrupt =      BT958HwInterrupt;
+    hwInitializationData.HwAdapterControl = BT958HwAdapterControl;
+	hwInitializationData.HwFindAdapter =    BT958HwFindAdapter;
+
+	// Inidicate no buffer mapping but will need physical addresses
+    hwInitializationData.NeedPhysicalAddresses = TRUE;
+    
+	// Indicate Auto request sense is supported
+	hwInitializationData.AutoRequestSense = TRUE;
+	hwInitializationData.MultipleRequestPerLu = TRUE;
+
+#if TAG_QUEUING
+    hwInitializationData.TaggedQueuing = TRUE;
+#else
+    hwInitializationData.TaggedQueuing = FALSE;
+#endif
+        
+    hwInitializationData.AdapterInterfaceType = PCIBus;
+
+	// Fill in the vendor id and the device id
+    hwInitializationData.VendorId = &VendorId;
+    hwInitializationData.VendorIdLength = 4;
+    hwInitializationData.DeviceId = &DeviceId;
+    hwInitializationData.DeviceIdLength = 4;
+	
+
+    hwInitializationData.NumberOfAccessRanges = 2;
+
+
+	// Specify size of extensions. 
+    hwInitializationData.DeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION);
+
+	// logical unit extension 
+    hwInitializationData.SrbExtensionSize = sizeof(BusLogic_CCB_T);
+
+    HwContext = 0;
+
+	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));
+    return( Status );
+
+} // end DriverEntry() 
+
+
+ULONG
+BT958HwFindAdapter(IN PVOID HwDeviceExtension,
+				   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 
+//              has been allocated, to gather information about the adapter's configuration.
+//
+// Arguments:
+//              HwDeviceExtension - HBA miniport driver's adapter data storage
+//              Context - Register base address
+//              ConfigInfo - Configuration information structure describing HBA
+//              This structure is defined in PORT.H.
+//
+// Return Value:
+//              HwScsiFindAdapter must return one of the following status values:
+//				SP_RETURN_FOUND: Indicates a supported HBA was found and that the HBA-relevant 
+//								 configuration information was successfully determined and set in 
+//								 the PORT_CONFIGURATION_INFORMATION structure. 
+//				SP_RETURN_ERROR: Indicates an HBA was found but there was error obtaining the 
+//								 configuration information. If possible, such an error should be 
+//								 logged with ScsiPortLogError. 
+//				SP_RETURN_BAD_CONFIG: Indicates the supplied configuration information was invalid 
+//									  for the adapter. 
+//				SP_RETURN_NOT_FOUND: Indicates no supported HBA was found for the supplied 
+//									 configuration information. 
+//________________________________________________________________________________________________
+{
+    PHW_DEVICE_EXTENSION deviceExtension = HwDeviceExtension;
+    BusLogic_HostAdapter_T *hcsp = &(deviceExtension->hcs);
+    static UCHAR k = 0;
+    PACCESS_RANGE   accessRange;
+    PCI_COMMON_CONFIG PCICommonConfig;
+    PUCHAR   pciAddress, portFound;
+    char    NumPort = 0;
+
+	DebugPrint((0,"\n BusLogic -  Inside the Find Adapter Routine\n"));
+
+    *Again = FALSE;
+
+	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 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"));
+
+			// 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 
+
+			if(pciAddress)
+			{
+				DebugPrint((0,"\n BusLogic -  Get Device Base  function suceeded \n"));
+
+				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++;
+			}
+		}
+	}
+
+    if (NumPort == 0) 
+	{
+        return(SP_RETURN_NOT_FOUND);
+    }
+
+    //  Hardware found, let's find out hardware configuration
+    //  and fill out ConfigInfo table for WinNT     
+	ConfigInfo->NumberOfBuses = 1;
+    ConfigInfo->MaximumTransferLength = MAX_TRANSFER_SIZE; 
+    
+#if SG_SUPPORT                                     
+    ConfigInfo->ScatterGather = TRUE;
+#else
+    ConfigInfo->ScatterGather = FALSE;
+#endif
+
+    ConfigInfo->Master = TRUE;
+    ConfigInfo->NeedPhysicalAddresses = TRUE;
+    ConfigInfo->Dma32BitAddresses = TRUE;
+    ConfigInfo->InterruptMode =  LevelSensitive;
+
+#if TAG_QUEUING
+    ConfigInfo->TaggedQueuing = TRUE;
+#else
+    ConfigInfo->TaggedQueuing = FALSE;
+#endif
+
+	// Should we change this to double-word aligned to increase performance
+	ConfigInfo->AlignmentMask = 0x0;     
+	
+    portFound =     hcsp->IO_Address;
+
+    if (!Buslogic_InitBT958(deviceExtension,ConfigInfo)) // harware specific initializations. Find what's for our card
+	{
+       ScsiPortLogError(deviceExtension,
+                         NULL,
+                         0,
+                         0,
+                         0,
+                         SP_INTERNAL_ADAPTER_ERROR,
+                         7 << 8);
+
+       return(SP_RETURN_ERROR);
+	}
+	
+	if (NumPort != 0)
+        *Again = TRUE;
+
+    return(SP_RETURN_FOUND);
+
+} // end BT958FindAdapter() 
+
+
+BOOLEAN 
+Buslogic_InitBT958(PHW_DEVICE_EXTENSION deviceExtension, 
+				   PPORT_CONFIGURATION_INFORMATION ConfigInfo)
+//_________________________________________________________________________
+// Routine Description:
+//			    This routine is called from the driver's FindAdapter routine
+//			    On invocation this routine probes the host adapter to check 
+//				if its hardware registers are responding correctly, and 
+//			    initializes the device and makes it ready for IO
+// Arguments:
+//              1. deviceExtension
+//              2. Port Configuration info 
+// Return Value:
+//              TRUE : Device initialized properly
+//              FALSE : Device failed to initialize
+//_________________________________________________________________________
+{
+
+	BusLogic_HostAdapter_T *HostAdapter = &(deviceExtension->hcs);
+		
+	// Probe the Host Adapter.  
+	// If unsuccessful, abort further initialization.
+    if (!BusLogic_ProbeHostAdapter(HostAdapter)) 
+		return   FALSE;	
+    
+	// Hard Reset the Host Adapter.  
+	// If unsuccessful, abort further initialization.
+    if (!BusLogic_HardwareResetHostAdapter(HostAdapter, TRUE)) 
+		return FALSE;
+
+  	// Check the Host Adapter.  
+	// If unsuccessful, abort further initialization.
+    if (!BusLogic_CheckHostAdapter(HostAdapter)) 
+		return FALSE;    
+	
+	// Allocate a Noncached Extension to use for mail boxes.
+	deviceExtension->NoncachedExtension =  ScsiPortGetUncachedExtension(deviceExtension,
+																	  ConfigInfo,
+																	  sizeof(NONCACHED_EXTENSION));
+
+	if (deviceExtension->NoncachedExtension == NULL) 
+	{     
+		// Log error.
+		ScsiPortLogError(deviceExtension,
+							 NULL,
+							 0,
+							 0,
+							 0,
+							 SP_INTERNAL_ADAPTER_ERROR,
+							 7 << 8);
+
+		// abort further initialization
+		return FALSE;
+	}
+
+	// Read the Host Adapter Configuration, Configure the Host Adapter,
+	// Acquire the System Resources necessary to use the Host Adapter, then
+	// Create the Initial CCBs, Initialize the Host Adapter, and finally
+	// perform Target Device Inquiry.
+    if (BusLogic_ReadHostAdapterConfiguration(HostAdapter)           &&
+		//BusLogic_ReportHostAdapterConfiguration(HostAdapter)       &&
+	    BusLogic_InitializeHostAdapter(deviceExtension, ConfigInfo)	 &&
+	    BusLogic_TargetDeviceInquiry(HostAdapter))
+	{
+		// Fill in the:
+		// 1.Maximum number of scsi target devices that are supported by our adapter
+		ConfigInfo->MaximumNumberOfTargets = HostAdapter->MaxTargetDevices;
+		// 2. Maximum number of logical units per target the HBA can control. 
+		ConfigInfo->MaximumNumberOfLogicalUnits  = HostAdapter->MaxLogicalUnits;
+		ConfigInfo->InitiatorBusId[0] = HostAdapter->SCSI_ID;
+		// Maximum number of breaks between address ranges that a data buffer can 
+		// have if the HBA supports scatter/gather. In other words, the number of 
+		// scatter/gather lists minus one. 
+		ConfigInfo->NumberOfPhysicalBreaks = HostAdapter->DriverScatterGatherLimit;		
+	}
+    else
+	{
+		// An error occurred during Host Adapter Configuration Querying, Host
+		// Adapter Configuration, Host Adapter Initialization, or Target Device Inquiry,
+		// so return FALSE
+	  	  
+		return FALSE;	  
+	}	
+	// Initialization completed successfully
+	return TRUE;
+} // end Buslogic_InitBT958
+
+
+BOOLEAN
+BusLogic_ProbeHostAdapter(BusLogic_HostAdapter_T *HostAdapter)
+//____________________________________________________________________________________
+// Routine Description: BusLogic_ProbeHostAdapter probes for a BusLogic Host Adapter.
+//						The routine reads the status, interrupt and geometry regiter and
+//					    checks if their contents are valid
+// Arguments:
+//              1. Host Adapter structure 
+//
+// Return Value:
+//              TRUE: Probe completed successfully
+//              FALSE: Probe failed
+//____________________________________________________________________________________
+{
+  BusLogic_StatusRegister_T StatusRegister;
+  BusLogic_InterruptRegister_T InterruptRegister;
+  BusLogic_GeometryRegister_T GeometryRegister;
+  
+  DebugPrint((0,"\n BusLogic -  Inside ProbeHostaAdapter funtion \n"));
+  //  Read the Status, Interrupt, and Geometry Registers to test if there are I/O
+  //  ports that respond, and to check the values to determine if they are from a
+  //  BusLogic Host Adapter.  A nonexistent I/O port will return 0xFF, in which
+  //  case there is definitely no BusLogic Host Adapter at this base I/O Address.
+  //  The test here is a subset of that used by the BusLogic Host Adapter BIOS.
+  
+  InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
+  GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter);
+  StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+  
+  if (StatusRegister.All == 0 ||
+      StatusRegister.Bits.DiagnosticActive ||
+      StatusRegister.Bits.CommandParameterRegisterBusy ||
+      StatusRegister.Bits.Reserved ||
+      StatusRegister.Bits.CommandInvalid ||
+      InterruptRegister.Bits.Reserved != 0)
+    return FALSE;
+  
+  //  Check the undocumented Geometry Register to test if there is an I/O port
+  //  that responded.  Adaptec Host Adapters do not implement the Geometry
+  //  Register, so this test helps serve to avoid incorrectly recognizing an
+  //  Adaptec 1542A or 1542B as a BusLogic.  Unfortunately, the Adaptec 1542C
+  //  series does respond to the Geometry Register I/O port, but it will be
+  //  rejected later when the Inquire Extended Setup Information command is
+  //  issued in BusLogic_CheckHostAdapter.  The AMI FastDisk Host Adapter is a
+  //  BusLogic clone that implements the same interface as earlier BusLogic
+  //  Host Adapters, including the undocumented commands, and is therefore
+  //  supported by this driver.  However, the AMI FastDisk always returns 0x00
+  //  upon reading the Geometry Register, so the extended translation option
+  //  should always be left disabled on the AMI FastDisk.
+  
+  if (GeometryRegister.All == 0xFF) return FALSE;
+  return TRUE;
+}// end BusLogic_ProbeHostAdapter
+
+BOOLEAN 
+BusLogic_HardwareResetHostAdapter(BusLogic_HostAdapter_T  *HostAdapter, 
+								  BOOLEAN HardReset)
+//_________________________________________________________________________
+// Routine Description: BusLogic_HardwareResetHostAdapter issues a Hardware 
+//                      Reset to the Host Adapter and waits for Host Adapter 
+//                      Diagnostics to complete.  If HardReset is TRUE, a
+//						Hard Reset is performed which also initiates a SCSI 
+//                      Bus Reset.  Otherwise, a Soft Reset is performed which 
+//                      only resets the Host Adapter without forcing a SCSI 
+//                      Bus Reset.
+// Arguments:
+//              1. Host Adapter structure 
+//              2. Boolean HardReset - True: Do hard reset
+// Return Value:
+//              TRUE : Reset completed successfully
+//              FALSE : Reset failed
+//_________________________________________________________________________
+{
+  BusLogic_StatusRegister_T StatusRegister;
+  int TimeoutCounter;
+  
+  //  Issue a Hard Reset or Soft Reset Command to the Host Adapter.  The Host
+  //  Adapter should respond by setting Diagnostic Active in the Status Register.
+  if (HardReset)
+	BusLogic_HardReset(HostAdapter);
+  else 
+	BusLogic_SoftReset(HostAdapter);
+  
+  // Wait until Diagnostic Active is set in the Status Register.
+  TimeoutCounter = 5*10000;
+  while (--TimeoutCounter >= 0)
+  {
+      StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+      if (StatusRegister.Bits.DiagnosticActive) 
+		  break;
+      ScsiPortStallExecution(100);
+  }
+  
+  // if inspite of waiting for time out period , if it didn't et set, then something is wrong-- so just return.
+  if (TimeoutCounter < 0) 
+	  return FALSE;
+  
+  //
+  //  Wait 100 microseconds to allow completion of any initial diagnostic
+  //  activity which might leave the contents of the Status Register
+  //  unpredictable.
+  ScsiPortStallExecution(100);
+  
+  //  Wait until Diagnostic Active is reset in the Status Register.
+  TimeoutCounter = 10*10000;
+  while (--TimeoutCounter >= 0)
+  {
+      StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+      if (!StatusRegister.Bits.DiagnosticActive) 
+		  break;
+      ScsiPortStallExecution(100);
+  }
+  
+  if (TimeoutCounter < 0) 
+	  return FALSE;
+  
+  //  Wait until at least one of the Diagnostic Failure, Host Adapter Ready,
+  //  or Data In Register Ready bits is set in the Status Register.  
+  TimeoutCounter = 10000;
+  while (--TimeoutCounter >= 0)
+  {
+      StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+      if (StatusRegister.Bits.DiagnosticFailure ||
+		  StatusRegister.Bits.HostAdapterReady ||
+	      StatusRegister.Bits.DataInRegisterReady)
+	  {
+		break;
+	  }
+      ScsiPortStallExecution(100);
+   }
+  
+  //device didn't respond to reset
+  if (TimeoutCounter < 0)
+	  return FALSE;
+  
+  //  If Diagnostic Failure is set or Host Adapter Ready is reset, then an
+  //  error occurred during the Host Adapter diagnostics.  If Data In Register
+  //  Ready is set, then there is an Error Code available.
+  if (StatusRegister.Bits.DiagnosticFailure || !StatusRegister.Bits.HostAdapterReady)
+  {
+  	  DebugPrint((0,"Failure - HOST ADAPTER STATUS REGISTER = %02X\n",  StatusRegister.All));
+      
+      if (StatusRegister.Bits.DataInRegisterReady)
+	  {
+		UCHAR ErrorCode = BusLogic_ReadDataInRegister(HostAdapter);
+		DebugPrint((0,"HOST ADAPTER ERROR CODE = %d\n", ErrorCode));
+	  }
+      return FALSE;
+  }  
+  //  Indicate the Host Adapter Hard Reset completed successfully.  
+  return TRUE;
+}// end BusLogic_HardwareResetHostAdapter
+
+
+BOOLEAN 
+BusLogic_CheckHostAdapter(BusLogic_HostAdapter_T *HostAdapter)
+//_________________________________________________________________________
+// Routine Description: BusLogic_CheckHostAdapter checks to be sure this 
+//                      really is a BusLogic
+// Arguments:
+//              1. Host Adapter Structure
+// Return Value:
+//              TRUE : Buslogic adapter detected
+//              FALSE : Card is not a Buslogic adapter
+//_________________________________________________________________________
+{
+  BusLogic_ExtendedSetupInformation_T ExtendedSetupInformation;
+  BusLogic_RequestedReplyLength_T RequestedReplyLength;
+  BOOLEAN Result = TRUE;
+
+  DebugPrint((0,"\n BusLogic -  Inside BusLogic_CheckHostAdapter funtion \n"));
+ 
+  //
+  //  Issue the Inquire Extended Setup Information command.  Only genuine
+  //  BusLogic Host Adapters and TRUE clones support this command.  Adaptec 1542C
+  //  series Host Adapters that respond to the Geometry Register I/O port will
+  //  fail this command.
+  RequestedReplyLength = sizeof(ExtendedSetupInformation);
+  if (BusLogic_Command(HostAdapter,
+					   BusLogic_InquireExtendedSetupInformation,
+					   &RequestedReplyLength,
+					   sizeof(RequestedReplyLength),
+					   &ExtendedSetupInformation,
+					   sizeof(ExtendedSetupInformation))
+      != sizeof(ExtendedSetupInformation))
+  {
+    Result = FALSE;
+  }
+  return Result;
+}// end BusLogic_CheckHostAdapter
+
+int 
+BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter,
+				 BusLogic_OperationCode_T OperationCode,
+				 void *ParameterData,
+				 int ParameterLength,
+				 void *ReplyData,
+				 int ReplyLength)
+//______________________________________________________________________________________________
+// Routine Description:
+//						BusLogic_Command sends the command OperationCode to HostAdapter, optionally
+//						providing ParameterLength bytes of ParameterData and receiving at most
+//						ReplyLength bytes of ReplyData; any excess reply data is received but
+//						discarded.
+//
+//						BusLogic_Command is called exclusively during host adapter detection and
+//						initialization, so performance and latency are not critical, and exclusive
+//						access to the Host Adapter hardware is assumed.  Once the host adapter and
+//						driver are initialized, the only Host Adapter command that is issued is the
+//						single byte Execute Mailbox Command operation code, which does not require
+//						waiting for the Host Adapter Ready bit to be set in the Status Register.
+// Arguments:
+//              1. HostAdapter - Host Adapter structure
+//              2. OperationCode - Operation code for the command
+//				3. ParameterData - Buffer containing parameters that needs to be passed as part 
+//  			   of the command
+//				4. ParameterLength - Number of parameters
+//				5. ReplyData - Buffer where reply data is copied
+//				6. ReplyLength - The length of the reply data
+// Return Value:
+//				On success, this function returns the number of reply bytes read from
+//				the Host Adapter (including any discarded data); on failure, it returns
+//				-1 if the command was invalid, or -2 if a timeout occurred.
+//_________________________________________________________________________________________________
+{
+  UCHAR *ParameterPointer = (UCHAR *) ParameterData;
+  UCHAR *ReplyPointer = (UCHAR *) ReplyData;
+  BusLogic_StatusRegister_T StatusRegister;
+  BusLogic_InterruptRegister_T InterruptRegister;
+  int ReplyBytes = 0, Result;
+  long TimeoutCounter;
+
+  //  Clear out the Reply Data if provided.
+  if (ReplyLength > 0)
+    memset(ReplyData, 0, ReplyLength);
+  
+  //  If the IRQ Channel has not yet been acquired, then interrupts must be
+  //  disabled while issuing host adapter commands since a Command Complete
+  //  interrupt could occur if the IRQ Channel was previously enabled by another
+  //  BusLogic Host Adapter or another driver sharing the same IRQ Channel.
+  
+  //  Wait for the Host Adapter Ready bit to be set and the Command/Parameter
+  //  Register Busy bit to be reset in the Status Register.  
+  TimeoutCounter = 10000;
+  while (--TimeoutCounter >= 0)
+  {
+      StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+      if ( StatusRegister.Bits.HostAdapterReady &&
+		  !StatusRegister.Bits.CommandParameterRegisterBusy)
+	  {
+			break;
+	  }
+      ScsiPortStallExecution(100);
+  }
+  if (TimeoutCounter < 0)
+  {
+      //BusLogic_CommandFailureReason = "Timeout waiting for Host Adapter Ready";
+      Result = -2;
+      goto Done;
+  }
+  
+  //  Write the OperationCode to the Command/Parameter Register.
+  HostAdapter->HostAdapterCommandCompleted = FALSE;
+  BusLogic_WriteCommandParameterRegister(HostAdapter, (UCHAR)OperationCode);
+  
+  //Write any additional Parameter Bytes.
+  TimeoutCounter = 10000;
+  while (ParameterLength > 0 && --TimeoutCounter >= 0)
+  {
+    //
+	// Wait 100 microseconds to give the Host Adapter enough time to determine
+	// whether the last value written to the Command/Parameter Register was
+	// valid or not.  If the Command Complete bit is set in the Interrupt
+	// Register, then the Command Invalid bit in the Status Register will be
+	// reset if the Operation Code or Parameter was valid and the command
+	// has completed, or set if the Operation Code or Parameter was invalid.
+	// If the Data In Register Ready bit is set in the Status Register, then
+	// the Operation Code was valid, and data is waiting to be read back
+	// from the Host Adapter.  Otherwise, wait for the Command/Parameter
+	// Register Busy bit in the Status Register to be reset.
+      
+      ScsiPortStallExecution(100);
+      InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
+      StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+      if (InterruptRegister.Bits.CommandComplete) 
+		  break;
+      if (HostAdapter->HostAdapterCommandCompleted) 
+		  break;
+      if (StatusRegister.Bits.DataInRegisterReady) 
+		  break;
+      if (StatusRegister.Bits.CommandParameterRegisterBusy)
+		  continue;
+      BusLogic_WriteCommandParameterRegister(HostAdapter, *ParameterPointer++);
+      ParameterLength--;
+  }
+  if (TimeoutCounter < 0)
+  {
+      //BusLogic_CommandFailureReason =  "Timeout waiting for Parameter Acceptance";
+      Result = -2;
+      goto Done;
+  }
+  
+  // The Modify I/O Address command does not cause a Command Complete Interrupt.
+  if (OperationCode == BusLogic_ModifyIOAddress)
+  {
+    StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+    if (StatusRegister.Bits.CommandInvalid)
+	{
+	  //BusLogic_CommandFailureReason = "Modify I/O Address Invalid";
+	  Result = -1;
+	  goto Done;
+	}
+    Result = 0;
+    goto Done;
+  }
+  
+  //  Select an appropriate timeout value for awaiting command completion.
+  switch (OperationCode)
+  {
+    case BusLogic_InquireInstalledDevicesID0to7:
+    case BusLogic_InquireInstalledDevicesID8to15:
+    case BusLogic_InquireTargetDevices:
+      // Approximately 60 seconds. 
+      TimeoutCounter = 60*10000;
+      break;
+    default:
+      // Approximately 1 second. 
+      TimeoutCounter = 10000;
+      break;
+  }
+
+  //
+  //  Receive any Reply Bytes, waiting for either the Command Complete bit to
+  //  be set in the Interrupt Register, or for the Interrupt Handler to set the
+  //  Host Adapter Command Completed bit in the Host Adapter structure.
+  while (--TimeoutCounter >= 0)
+  {
+    InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
+    StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+    if (InterruptRegister.Bits.CommandComplete) 
+		break;
+    if (HostAdapter->HostAdapterCommandCompleted) 
+		break;
+    if (StatusRegister.Bits.DataInRegisterReady)
+	{
+	  if (++ReplyBytes <= ReplyLength)
+	  {
+	    *ReplyPointer++ = BusLogic_ReadDataInRegister(HostAdapter);
+	  }
+	  else
+	  {
+		  BusLogic_ReadDataInRegister(HostAdapter);
+	  }
+	}
+    if (OperationCode == BusLogic_FetchHostAdapterLocalRAM &&
+		StatusRegister.Bits.HostAdapterReady) 
+	{
+	  break;
+	}
+    ScsiPortStallExecution(100);
+  }
+  if (TimeoutCounter < 0)
+  {
+      //BusLogic_CommandFailureReason = "Timeout waiting for Command Complete";
+      Result = -2;
+      goto Done;
+  }
+  
+  //  Clear any pending Command Complete Interrupt.
+  BusLogic_InterruptReset(HostAdapter);
+  
+  //  Process Command Invalid conditions.
+  if (StatusRegister.Bits.CommandInvalid)
+  {
+    //
+	// Some early BusLogic Host Adapters may not recover properly from
+	// a Command Invalid condition, so if this appears to be the case,
+	// a Soft Reset is issued to the Host Adapter.  Potentially invalid
+	// commands are never attempted after Mailbox Initialization is
+	// performed, so there should be no Host Adapter state lost by a
+	// Soft Reset in response to a Command Invalid condition.
+      
+	ScsiPortStallExecution(1000);
+	StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
+	if (StatusRegister.Bits.CommandInvalid             ||
+	  StatusRegister.Bits.Reserved                     ||
+	  StatusRegister.Bits.DataInRegisterReady          ||
+	  StatusRegister.Bits.CommandParameterRegisterBusy ||
+	  !StatusRegister.Bits.HostAdapterReady            ||
+	  !StatusRegister.Bits.InitializationRequired      ||
+	  StatusRegister.Bits.DiagnosticActive             ||
+	  StatusRegister.Bits.DiagnosticFailure)
+	{
+		BusLogic_SoftReset(HostAdapter);
+		ScsiPortStallExecution(1000);
+	}
+	//BusLogic_CommandFailureReason = "Command Invalid";
+	Result = -1;
+	goto Done;
+  }
+  
+  // Handle Excess Parameters Supplied conditions.
+  if (ParameterLength > 0)
+  {
+      //BusLogic_CommandFailureReason = "Excess Parameters Supplied";
+      Result = -1;
+      goto Done;
+  }
+  
+  //  Indicate the command completed successfully.
+  Result = ReplyBytes;
+  
+  //  Restore the interrupt status if necessary and return.
+Done:
+  return Result;
+}// end BusLogic_Command
+
+
+BOOLEAN 
+BusLogic_ReadHostAdapterConfiguration(BusLogic_HostAdapter_T  *HostAdapter)
+//___________________________________________________________________________________________
+// Routine Description:
+//					BusLogic_ReadHostAdapterConfiguration reads the Configuration Information
+//					from Host Adapter and initializes the Host Adapter structure.
+// Arguments:
+//              1. Host adapter structure
+// Return Value:
+//              TRUE : Configuration read properly
+//              FALSE : Encounter failure
+//___________________________________________________________________________________________
+{
+  BusLogic_BoardID_T BoardID;
+  BusLogic_Configuration_T Configuration;
+  BusLogic_SetupInformation_T SetupInformation;
+  BusLogic_ExtendedSetupInformation_T ExtendedSetupInformation;
+  BusLogic_HostAdapterModelNumber_T HostAdapterModelNumber;
+  BusLogic_FirmwareVersion3rdDigit_T FirmwareVersion3rdDigit;
+  BusLogic_FirmwareVersionLetter_T FirmwareVersionLetter;
+  BusLogic_PCIHostAdapterInformation_T PCIHostAdapterInformation;
+  BusLogic_FetchHostAdapterLocalRAMRequest_T FetchHostAdapterLocalRAMRequest;
+  BusLogic_AutoSCSIData_T AutoSCSIData;
[truncated at 1000 lines; 3858 more skipped]