scsi: Port buslogic driver to 64 bits
Subsystems (2)
cover scsi: Port buslogic driver to 64 bits
This patchset ports buslogic driver to 64-bit.
Current buslogic driver is composed of two components - SCCB manager which communicates with adapter to execute SCSI commands (contained in FlashPoint.c), and Linux driver part that interfaces with rest of the kernel (contained in BusLogic.c). SCCB manager code came from the Mylex SDK. SCCB manager code is used by flashpoint adapters only. Multimaster adapters do not need SCCB manager since the SCSI state machine is implemented in firmware on these adapters. If the filenames alone did not give it away already, buslogic driver code is full of CamelCase, besides being full of very ling lines, and is just very difficult to read and understand. So the first step was to clean up the existing code. First patch in the set does just that. Second patch includes necessary code modifications to allow the driver to build and run on 64-bit kernel. Since SCCB manager code came from Mylex SDK, I have tried to touch it only when necessary which includes not fixing all CamelCase issues in FlashPoint.c. Many lines over 80 characters remain in BusLogic.c. These fall into two categories generally -
(1) it prints a message and I didn't want to touch driver messages in case there are scripts out there that parse driver messages,
(2) code is indented deeply and is hard to keep it under 80 characters. Such code could use refactoring at some point.
I have tested this patch with a flashpoint adapter on 64-bit and 32-bit kernels with fio running random read/write test while verifying data. I also measured performance for current buslogic driver and buslogic driver with these patches with 32-bit and 64-bit kernel and ensured there was no degradation in performance.
Khalid Aziz (2):
Fix CamelCase and extra long lines in the BusLogic driver Port buslogic driver to 64-bit.
drivers/scsi/BusLogic.c | 4490 ++++++++++++++++++++++++--------------------- drivers/scsi/BusLogic.h | 1489 ++++++++------- drivers/scsi/FlashPoint.c | 625 +++---- drivers/scsi/Kconfig | 2 +- 4 files changed, 3395 insertions(+), 3211 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/2 scsi: Fix style issues in buslogic driver
Fix CamelCase and extra long lines in the buslogic driver.
--- drivers/scsi/BusLogic.c | 4491 ++++++++++++++++++++++++--------------------- drivers/scsi/BusLogic.h | 1484 ++++++++------- drivers/scsi/FlashPoint.c | 35 +- 3 files changed, 3123 insertions(+), 2887 deletions(-)
drivers/scsi/BusLogic.c +2380 -2111
@@ -26,8 +26,8 @@*/ -#define BusLogic_DriverVersion "2.1.16" -#define BusLogic_DriverDate "18 July 2002" +#define blogic_drvr_version "2.1.17" +#define blogic_drvr_date "25 April 2013"#include <linux/module.h> #include <linux/init.h>
@@ -60,24 +60,24 @@#define FAILURE (-1)#endif -static struct scsi_host_template Bus_Logic_template; +static struct scsi_host_template blogic_template;/* -BusLogic_DriverOptionsCount is a count of the number of BusLogic Driver +blogic_drvr_options_count is a count of the number of BusLogic Driver Options specifications provided via the Linux Kernel Command Line or via the Loadable Kernel Module Installation Facility. */ -static int BusLogic_DriverOptionsCount; +static int blogic_drvr_options_count;/* -BusLogic_DriverOptions is an array of Driver Options structures representing +blogic_drvr_options is an array of Driver Options structures representing BusLogic Driver Options specifications provided via the Linux Kernel Command Line or via the Loadable Kernel Module Installation Facility. */ -static struct BusLogic_DriverOptions BusLogic_DriverOptions[BusLogic_MaxHostAdapters]; +static struct blogic_drvr_options blogic_drvr_options[BLOGIC_MAX_ADAPTERS ];/*
@@ -92,241 +92,250 @@ module_param(BusLogic, charp, 0);/* -BusLogic_ProbeOptions is a set of Probe Options to be applied across +blogic_probe_options is a set of Probe Options to be applied across all BusLogic Host Adapters. */ -static struct BusLogic_ProbeOptions BusLogic_ProbeOptions; +static struct blogic_probe_options blogic_probe_options;/* -BusLogic_GlobalOptions is a set of Global Options to be applied across +blogic_global_options is a set of Global Options to be applied across all BusLogic Host Adapters. */ -static struct BusLogic_GlobalOptions BusLogic_GlobalOptions; +static struct blogic_global_options blogic_global_options; -static LIST_HEAD (BusLogic_host_list); +static LIST_HEAD (blogic_host_list);/* -BusLogic_ProbeInfoCount is the number of entries in BusLogic_ProbeInfoList. +blogic_probeinfo_count is the number of entries in blogic_probeinfo_list. */ -static int BusLogic_ProbeInfoCount; +static int blogic_probeinfo_count;/* -BusLogic_ProbeInfoList is the list of I/O Addresses and Bus Probe Information +blogic_probeinfo_list is the list of I/O Addresses and Bus Probe Information to be checked for potential BusLogic Host Adapters. It is initialized by interrogating the PCI Configuration Space on PCI machines as well as from the list of standard BusLogic I/O Addresses. */ -static struct BusLogic_ProbeInfo *BusLogic_ProbeInfoList; +static struct blogic_probeinfo *blogic_probeinfo_list;/* -BusLogic_CommandFailureReason holds a string identifying the reason why a -call to BusLogic_Command failed. It is only non-NULL when BusLogic_Command +blogic_cmd_failure_reason holds a string identifying the reason why a +call to blogic_cmd failed. It is only non-NULL when blogic_cmd returns a failure code. */ -static char *BusLogic_CommandFailureReason; +static char *blogic_cmd_failure_reason;/* -BusLogic_AnnounceDriver announces the Driver Version and Date, Author's +blogic_announce_drvr announces the Driver Version and Date, Author's Name, Copyright Notice, and Electronic Mail Address. */ -static void BusLogic_AnnounceDriver (struct BusLogic_HostAdapter *HostAdapter) +static void blogic_announce_drvr (struct blogic_adapter *adapter) { -BusLogic_Announce ("***** BusLogic SCSI Driver Version " BusLogic_DriverVersion" of " BusLogic_DriverDate" *****\n" , HostAdapter); -BusLogic_Announce ("Copyright 1995-1998 by Leonard N. Zubkoff " "<[email protected]>\n" , HostAdapter); +blogic_announce ("***** BusLogic SCSI Driver Version " blogic_drvr_version" of " blogic_drvr_date" *****\n" , adapter); +blogic_announce ("Copyright 1995-1998 by Leonard N. Zubkoff " "<[email protected]>\n" , adapter); }/* -BusLogic_DriverInfo returns the Host Adapter Name to identify this SCSI +blogic_drvr_info returns the Host Adapter Name to identify this SCSI Driver and Host Adapter. */ -static const char *BusLogic_DriverInfo (struct Scsi_Host *Host) +static const char *blogic_drvr_info (struct Scsi_Host *host) { -struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata; -return HostAdapter->FullModelName; +struct blogic_adapter *adapter = + (struct blogic_adapter *) host->hostdata; +return adapter->full_model; }/* -BusLogic_InitializeCCBs initializes a group of Command Control Blocks (CCBs) -for Host Adapter from the BlockSize bytes located at BlockPointer. The newly +blogic_init_ccbs initializes a group of Command Control Blocks (CCBs) +for Host Adapter from the blk_size bytes located at blk_pointer. The newly created CCBs are added to Host Adapter's free list. */ -static void BusLogic_InitializeCCBs (struct BusLogic_HostAdapter *HostAdapter,void *BlockPointer,int BlockSize,dma_addr_t BlockPointerHandle) +static void blogic_init_ccbs (struct blogic_adapter *adapter,void *blk_pointer, +int blk_size,dma_addr_t blkp) { -struct BusLogic_CCB *CCB = (struct BusLogic_CCB *) BlockPointer; +struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer;unsigned int offset =0 ; -memset (BlockPointer,0 , BlockSize); -CCB ->AllocationGroupHead = BlockPointerHandle; -CCB ->AllocationGroupSize = BlockSize; -while ((BlockSize -=sizeof (struct BusLogic_CCB )) >=0 ) { -CCB ->Status = BusLogic_CCB_Free; -CCB ->HostAdapter = HostAdapter; -CCB ->DMA_Handle = (u32 ) BlockPointerHandle + offset; -if (BusLogic_FlashPointHostAdapterP (HostAdapter)) { -CCB ->CallbackFunction = BusLogic_QueueCompletedCCB; -CCB ->BaseAddress = HostAdapter->FlashPointInfo.BaseAddress; +memset (blk_pointer,0 , blk_size); + ccb->allocgrp_head = blkp; + ccb->allocgrp_size = blk_size; +while ((blk_size -=sizeof (struct blogic_ccb )) >=0 ) { + ccb->status =BLOGIC_CCB_FREE ; + ccb->adapter = adapter; + ccb->dma_handle = (u32 ) blkp + offset; +if (blogic_flashpoint_type (adapter)) { + ccb->callback = blogic_qcompleted_ccb; + ccb->base_addr = adapter->fpinfo.base_addr; } -CCB ->Next = HostAdapter->Free_CCBs; -CCB ->NextAll = HostAdapter->All_CCBs; - HostAdapter->Free_CCBs =CCB ; - HostAdapter->All_CCBs =CCB ; - HostAdapter->AllocatedCCBs++; -CCB ++; - offset +=sizeof (struct BusLogic_CCB ); + ccb->next = adapter->free_ccbs; + ccb->next_all = adapter->all_ccbs; + adapter->free_ccbs = ccb; + adapter->all_ccbs = ccb; + adapter->alloc_ccbs++; + ccb++; + offset +=sizeof (struct blogic_ccb ); } }/* -BusLogic_CreateInitialCCBs allocates the initial CCBs for Host Adapter. +blogic_create_initccbs allocates the initial CCBs for Host Adapter. */ -static bool __init BusLogic_CreateInitialCCBs (struct BusLogic_HostAdapter *HostAdapter) +static bool __init blogic_create_initccbs (struct blogic_adapter *adapter) { -int BlockSize = BusLogic_CCB_AllocationGroupSize *sizeof (struct BusLogic_CCB ); -void *BlockPointer; -dma_addr_t BlockPointerHandle; -while (HostAdapter->AllocatedCCBs < HostAdapter->InitialCCBs) { - BlockPointer =pci_alloc_consistent (HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle); -if (BlockPointer ==NULL ) { -BusLogic_Error ("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n" , HostAdapter); +int blk_size =BLOGIC_CCB_GRP_ALLOCSIZE *sizeof (struct blogic_ccb ); +void *blk_pointer; +dma_addr_t blkp; +while (adapter->alloc_ccbs < adapter->initccbs) { + blk_pointer =pci_alloc_consistent (adapter->pci_device, + blk_size, &blkp); +if (blk_pointer ==NULL ) { +blogic_err ("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n" , + adapter);return false; } -BusLogic_InitializeCCBs (HostAdapter, BlockPointer, BlockSize, BlockPointerHandle); +blogic_init_ccbs (adapter, blk_pointer, blk_size, blkp); }return true; }/* -BusLogic_DestroyCCBs deallocates the CCBs for Host Adapter. +blogic_destroy_ccbs deallocates the CCBs for Host Adapter. */ -static void BusLogic_DestroyCCBs (struct BusLogic_HostAdapter *HostAdapter) +static void blogic_destroy_ccbs (struct blogic_adapter *adapter) { -struct BusLogic_CCB *NextCCB = HostAdapter->All_CCBs, *CCB , *Last_CCB =NULL ; - HostAdapter->All_CCBs =NULL ; - HostAdapter->Free_CCBs =NULL ; -while ((CCB = NextCCB) !=NULL ) { - NextCCB =CCB ->NextAll; -if (CCB ->AllocationGroupHead) { -if (Last_CCB) -pci_free_consistent (HostAdapter->PCI_Device, Last_CCB->AllocationGroupSize, Last_CCB, Last_CCB->AllocationGroupHead); - Last_CCB =CCB ; +struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb =NULL ; + adapter->all_ccbs =NULL ; + adapter->free_ccbs =NULL ; +while ((ccb = next_ccb) !=NULL ) { + next_ccb = ccb->next_all; +if (ccb->allocgrp_head) { +if (lastccb) +pci_free_consistent (adapter->pci_device, + lastccb->allocgrp_size, lastccb, + lastccb->allocgrp_head); + lastccb = ccb; } } -if (Last_CCB) -pci_free_consistent (HostAdapter->PCI_Device, Last_CCB->AllocationGroupSize, Last_CCB, Last_CCB->AllocationGroupHead); +if (lastccb) +pci_free_consistent (adapter->pci_device, lastccb->allocgrp_size, + lastccb, lastccb->allocgrp_head); }/* -BusLogic_CreateAdditionalCCBs allocates Additional CCBs for Host Adapter. If +blogic_create_addlccbs allocates Additional CCBs for Host Adapter. If allocation fails and there are no remaining CCBs available, the Driver Queue Depth is decreased to a known safe value to avoid potential deadlocks when multiple host adapters share the same IRQ Channel. */ -static void BusLogic_CreateAdditionalCCBs (struct BusLogic_HostAdapter *HostAdapter,int AdditionalCCBs,bool SuccessMessageP) +static void blogic_create_addlccbs (struct blogic_adapter *adapter, +int addl_ccbs,bool print_success) { -int BlockSize = BusLogic_CCB_AllocationGroupSize *sizeof (struct BusLogic_CCB ); -int PreviouslyAllocated = HostAdapter->AllocatedCCBs; -void *BlockPointer; -dma_addr_t BlockPointerHandle; -if (AdditionalCCBs <=0 ) +int blk_size =BLOGIC_CCB_GRP_ALLOCSIZE *sizeof (struct blogic_ccb ); +int prev_alloc = adapter->alloc_ccbs; +void *blk_pointer; +dma_addr_t blkp; +if (addl_ccbs <=0 )return ; -while (HostAdapter->AllocatedCCBs - PreviouslyAllocated < AdditionalCCBs) { - BlockPointer =pci_alloc_consistent (HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle); -if (BlockPointer ==NULL ) +while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) { + blk_pointer =pci_alloc_consistent (adapter->pci_device, + blk_size, &blkp); +if (blk_pointer ==NULL )break ; -BusLogic_InitializeCCBs (HostAdapter, BlockPointer, BlockSize, BlockPointerHandle); +blogic_init_ccbs (adapter, blk_pointer, blk_size, blkp); } -if (HostAdapter->AllocatedCCBs > PreviouslyAllocated) { -if (SuccessMessageP) -BusLogic_Notice ("Allocated %d additional CCBs (total now %d)\n" , HostAdapter, HostAdapter->AllocatedCCBs - PreviouslyAllocated, HostAdapter->AllocatedCCBs); +if (adapter->alloc_ccbs > prev_alloc) { +if (print_success) +blogic_notice ("Allocated %d additional CCBs (total now %d)\n" , adapter, adapter->alloc_ccbs - prev_alloc, adapter->alloc_ccbs);return ; } -BusLogic_Notice ("Failed to allocate additional CCBs\n" , HostAdapter); -if (HostAdapter->DriverQueueDepth > HostAdapter->AllocatedCCBs - HostAdapter->TargetDeviceCount) { - HostAdapter->DriverQueueDepth = HostAdapter->AllocatedCCBs - HostAdapter->TargetDeviceCount; - HostAdapter->SCSI_Host->can_queue = HostAdapter->DriverQueueDepth; +blogic_notice ("Failed to allocate additional CCBs\n" , adapter); +if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) { + adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count; + adapter->scsi_host->can_queue = adapter->drvr_qdepth; } }/* -BusLogic_AllocateCCB allocates a CCB from Host Adapter's free list, +blogic_alloc_ccb allocates a CCB from Host Adapter's free list, allocating more memory from the Kernel if necessary. The Host Adapter's Lock should already have been acquired by the caller. */ -static struct BusLogic_CCB *BusLogic_AllocateCCB (struct BusLogic_HostAdapter - *HostAdapter) +static struct blogic_ccb *blogic_alloc_ccb (struct blogic_adapter *adapter) { -static unsigned long SerialNumber =0 ; -struct BusLogic_CCB *CCB ; -CCB = HostAdapter->Free_CCBs; -if (CCB !=NULL ) { -CCB ->SerialNumber = ++SerialNumber; - HostAdapter->Free_CCBs =CCB ->Next; -CCB ->Next =NULL ; -if (HostAdapter->Free_CCBs ==NULL ) -BusLogic_CreateAdditionalCCBs (HostAdapter, HostAdapter->IncrementalCCBs, true); -return CCB ; - } -BusLogic_CreateAdditionalCCBs (HostAdapter, HostAdapter->IncrementalCCBs, true); -CCB = HostAdapter->Free_CCBs; -if (CCB ==NULL ) +static unsigned long serial; +struct blogic_ccb *ccb; + ccb = adapter->free_ccbs; +if (ccb !=NULL ) { + ccb->serial = ++serial; + adapter->free_ccbs = ccb->next; + ccb->next =NULL ; +if (adapter->free_ccbs ==NULL ) +blogic_create_addlccbs (adapter, adapter->inc_ccbs, + true); +return ccb; + } +blogic_create_addlccbs (adapter, adapter->inc_ccbs, true); + ccb = adapter->free_ccbs; +if (ccb ==NULL )return NULL ; -CCB ->SerialNumber = ++SerialNumber; - HostAdapter->Free_CCBs =CCB ->Next; -CCB ->Next =NULL ; -return CCB ; + ccb->serial = ++serial; + adapter->free_ccbs = ccb->next; + ccb->next =NULL ; +return ccb; }/* -BusLogic_DeallocateCCB deallocates a CCB, returning it to the Host Adapter's +blogic_dealloc_ccb deallocates a CCB, returning it to the Host Adapter's free list. The Host Adapter's Lock should already have been acquired by the caller. */ -static void BusLogic_DeallocateCCB (struct BusLogic_CCB *CCB ) +static void blogic_dealloc_ccb (struct blogic_ccb *ccb) { -struct BusLogic_HostAdapter *HostAdapter =CCB ->HostAdapter; +struct blogic_adapter *adapter = ccb->adapter; -scsi_dma_unmap (CCB ->Command); -pci_unmap_single (HostAdapter->PCI_Device,CCB ->SenseDataPointer, -CCB ->SenseDataLength,PCI_DMA_FROMDEVICE ); +scsi_dma_unmap (ccb->command); +pci_unmap_single (adapter->pci_device, ccb->sensedata, + ccb->sense_datalen,PCI_DMA_FROMDEVICE ); -CCB ->Command =NULL ; -CCB ->Status = BusLogic_CCB_Free; -CCB ->Next = HostAdapter->Free_CCBs; - HostAdapter->Free_CCBs =CCB ; + ccb->command =NULL ; + ccb->status =BLOGIC_CCB_FREE ; + ccb->next = adapter->free_ccbs; + adapter->free_ccbs = ccb; }/* -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 +blogic_cmd sends the command opcode to adapter, optionally +providing paramlen bytes of param and receiving at most +replylen bytes of reply; any excess reply data is received but discarded. 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. -BusLogic_Command is called exclusively during host adapter detection and +blogic_cmd 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
@@ -334,255 +343,270 @@ static void BusLogic_DeallocateCCB(struct BusLogic_CCB *CCB)waiting for the Host Adapter Ready bit to be set in the Status Register. */ -static int BusLogic_Command (struct BusLogic_HostAdapter *HostAdapter,enum BusLogic_OperationCode OperationCode,void *ParameterData,int ParameterLength,void *ReplyData,int ReplyLength) +static int blogic_cmd (struct blogic_adapter *adapter,enum blogic_opcode opcode, +void *param,int paramlen,void *reply,int replylen) { -unsigned char *ParameterPointer = (unsigned char *) ParameterData; -unsigned char *ReplyPointer = (unsigned char *) ReplyData; -union BusLogic_StatusRegister StatusRegister; -union BusLogic_InterruptRegister InterruptRegister; -unsigned long ProcessorFlags =0 ; -int ReplyBytes =0 , Result; -long TimeoutCounter; +unsigned char *param_p = (unsigned char *) param; +unsigned char *reply_p = (unsigned char *) reply; +union blogic_stat_reg statusreg; +union blogic_int_reg intreg; +unsigned long processor_flag =0 ; +int reply_b =0 , result; +long timeout;/* Clear out the Reply Data if provided. */ -if (ReplyLength >0 ) -memset (ReplyData,0 , ReplyLength); +if (replylen >0 ) +memset (reply,0 , replylen);/* -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. +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. */ -if (!HostAdapter->IRQ_ChannelAcquired) -local_irq_save (ProcessorFlags); +if (!adapter->irq_acquired) +local_irq_save (processor_flag);/* -Wait for the Host Adapter Ready bit to be set and the Command/Parameter -Register Busy bit to be reset in the Status Register. +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.sr.HostAdapterReady && !StatusRegister.sr.CommandParameterRegisterBusy) + timeout =10000 ; +while (--timeout >=0 ) { + statusreg.all =blogic_rdstatus (adapter); +if (statusreg.sr.adapter_ready && !statusreg.sr.cmd_param_busy)break ;udelay (100 ); } -if (TimeoutCounter <0 ) { - BusLogic_CommandFailureReason ="Timeout waiting for Host Adapter Ready" ; - Result =-2 ; - goto Done; +if (timeout <0 ) { + blogic_cmd_failure_reason ="Timeout waiting for Host Adapter Ready" ; + result =-2 ; + goto done; }/* -Write the OperationCode to the Command/Parameter Register. +Write the opcode to the Command/Parameter Register. */ - HostAdapter->HostAdapterCommandCompleted = false; -BusLogic_WriteCommandParameterRegister (HostAdapter, OperationCode); + adapter->adapter_cmd_complete = false; +blogic_setcmdparam (adapter, opcode);/* Write any additional Parameter Bytes. */ - TimeoutCounter =10000 ; -while (ParameterLength >0 && --TimeoutCounter >=0 ) { + timeout =10000 ; +while (paramlen >0 && --timeout >=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. +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. */ udelay (100 ); - InterruptRegister.All =BusLogic_ReadInterruptRegister (HostAdapter); - StatusRegister.All =BusLogic_ReadStatusRegister (HostAdapter); -if (InterruptRegister.ir.CommandComplete) + intreg.all =blogic_rdint (adapter); + statusreg.all =blogic_rdstatus (adapter); +if (intreg.ir.cmd_complete)break ; -if (HostAdapter->HostAdapterCommandCompleted) +if (adapter->adapter_cmd_complete)break ; -if (StatusRegister.sr.DataInRegisterReady) +if (statusreg.sr.datain_ready)break ; -if (StatusRegister.sr.CommandParameterRegisterBusy) +if (statusreg.sr.cmd_param_busy)continue ; -BusLogic_WriteCommandParameterRegister (HostAdapter, *ParameterPointer++); - ParameterLength--; +blogic_setcmdparam (adapter, *param_p++); + paramlen--; } -if (TimeoutCounter <0 ) { - BusLogic_CommandFailureReason ="Timeout waiting for Parameter Acceptance" ; - Result =-2 ; - goto Done; +if (timeout <0 ) { + blogic_cmd_failure_reason ="Timeout waiting for Parameter Acceptance" ; + result =-2 ; + goto done; }/* -The Modify I/O Address command does not cause a Command Complete Interrupt. +The Modify I/O Address command does not cause a Command Complete +Interrupt. */ -if (OperationCode == BusLogic_ModifyIOAddress) { - StatusRegister.All =BusLogic_ReadStatusRegister (HostAdapter); -if (StatusRegister.sr.CommandInvalid) { - BusLogic_CommandFailureReason ="Modify I/O Address Invalid" ; - Result =-1 ; - goto Done; +if (opcode ==BLOGIC_MOD_IOADDR ) { + statusreg.all =blogic_rdstatus (adapter); +if (statusreg.sr.cmd_invalid) { + blogic_cmd_failure_reason ="Modify I/O Address Invalid" ; + result =-1 ; + goto done; } -if (BusLogic_GlobalOptions.TraceConfiguration) -BusLogic_Notice ("BusLogic_Command(%02X) Status = %02X: " "(Modify I/O Address)\n" , HostAdapter, OperationCode, StatusRegister.All); - Result =0 ; - goto Done; +if (blogic_global_options.trace_config) +blogic_notice ("blogic_cmd(%02X) Status = %02X: " "(Modify I/O Address)\n" , adapter, opcode, statusreg.all); + result =0 ; + goto done; }/* Select an appropriate timeout value for awaiting command completion. */ -switch (OperationCode) { -case BusLogic_InquireInstalledDevicesID0to7: -case BusLogic_InquireInstalledDevicesID8to15: -case BusLogic_InquireTargetDevices: +switch (opcode) { +case BLOGIC_INQ_DEV0TO7 : +case BLOGIC_INQ_DEV8TO15 : +case BLOGIC_INQ_DEV :/* Approximately 60 seconds. */ - TimeoutCounter =60 *10000 ; + timeout =60 *10000 ;break ;default :/* Approximately 1 second. */ - TimeoutCounter =10000 ; + timeout =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. +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.ir.CommandComplete) +while (--timeout >=0 ) { + intreg.all =blogic_rdint (adapter); + statusreg.all =blogic_rdstatus (adapter); +if (intreg.ir.cmd_complete)break ; -if (HostAdapter->HostAdapterCommandCompleted) +if (adapter->adapter_cmd_complete)break ; -if (StatusRegister.sr.DataInRegisterReady) { -if (++ReplyBytes <= ReplyLength) - *ReplyPointer++ =BusLogic_ReadDataInRegister (HostAdapter); +if (statusreg.sr.datain_ready) { +if (++reply_b <= replylen) + *reply_p++ =blogic_rddatain (adapter);else -BusLogic_ReadDataInRegister (HostAdapter); +blogic_rddatain (adapter); } -if (OperationCode == BusLogic_FetchHostAdapterLocalRAM && StatusRegister.sr.HostAdapterReady) +if (opcode ==BLOGIC_FETCH_LOCALRAM && + statusreg.sr.adapter_ready)break ;udelay (100 ); } -if (TimeoutCounter <0 ) { - BusLogic_CommandFailureReason ="Timeout waiting for Command Complete" ; - Result =-2 ; - goto Done; +if (timeout <0 ) { + blogic_cmd_failure_reason ="Timeout waiting for Command Complete" ; + result =-2 ; + goto done; }/* Clear any pending Command Complete Interrupt. */ -BusLogic_InterruptReset (HostAdapter); +blogic_intreset (adapter);/* Provide tracing information if requested. */ -if (BusLogic_GlobalOptions.TraceConfiguration) { +if (blogic_global_options.trace_config) {int i; -BusLogic_Notice ("BusLogic_Command(%02X) Status = %02X: %2d ==> %2d:" , HostAdapter, OperationCode, StatusRegister.All, ReplyLength, ReplyBytes); -if (ReplyLength > ReplyBytes) - ReplyLength = ReplyBytes; -for (i =0 ; i < ReplyLength; i++) -BusLogic_Notice (" %02X" , HostAdapter, ((unsigned char *) ReplyData)[i]); -BusLogic_Notice ("\n" , HostAdapter); +blogic_notice ("blogic_cmd(%02X) Status = %02X: %2d ==> %2d:" , + adapter, opcode, statusreg.all, replylen, + reply_b); +if (replylen > reply_b) + replylen = reply_b; +for (i =0 ; i < replylen; i++) +blogic_notice (" %02X" , adapter, + ((unsigned char *) reply)[i]); +blogic_notice ("\n" , adapter); }/* Process Command Invalid conditions. */ -if (StatusRegister.sr.CommandInvalid) { +if (statusreg.sr.cmd_invalid) {/* -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 +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. */ udelay (1000 ); - StatusRegister.All =BusLogic_ReadStatusRegister (HostAdapter); -if (StatusRegister.sr.CommandInvalid || - StatusRegister.sr.Reserved || - StatusRegister.sr.DataInRegisterReady || - StatusRegister.sr.CommandParameterRegisterBusy || !StatusRegister.sr.HostAdapterReady || !StatusRegister.sr.InitializationRequired || StatusRegister.sr.DiagnosticActive || StatusRegister.sr.DiagnosticFailure) { -BusLogic_SoftReset (HostAdapter); + statusreg.all =blogic_rdstatus (adapter); +if (statusreg.sr.cmd_invalid || statusreg.sr.rsvd || + statusreg.sr.datain_ready || + statusreg.sr.cmd_param_busy || + !statusreg.sr.adapter_ready || + !statusreg.sr.init_reqd || + statusreg.sr.diag_active || + statusreg.sr.diag_failed) { +blogic_softreset (adapter);udelay (1000 ); } - BusLogic_CommandFailureReason ="Command Invalid" ; - Result =-1 ; - goto Done; + blogic_cmd_failure_reason ="Command Invalid" ; + result =-1 ; + goto done; }/* Handle Excess Parameters Supplied conditions. */ -if (ParameterLength >0 ) { - BusLogic_CommandFailureReason ="Excess Parameters Supplied" ; - Result =-1 ; - goto Done; +if (paramlen >0 ) { + blogic_cmd_failure_reason ="Excess Parameters Supplied" ; + result =-1 ; + goto done; }/* Indicate the command completed successfully. */ - BusLogic_CommandFailureReason =NULL ; - Result = ReplyBytes; + blogic_cmd_failure_reason =NULL ; + result = reply_b;/* Restore the interrupt status if necessary and return. */ - Done: -if (!HostAdapter->IRQ_ChannelAcquired) -local_irq_restore (ProcessorFlags); -return Result; +done: +if (!adapter->irq_acquired) +local_irq_restore (processor_flag); +return result; }/* -BusLogic_AppendProbeAddressISA appends a single ISA I/O Address to the list +blogic_add_probeaddr_isa appends a single ISA I/O Address to the list of I/O Address and Bus Probe Information to be checked for potential BusLogic Host Adapters. */ -static void __init BusLogic_AppendProbeAddressISA (unsigned long IO_Address) +static void __init blogic_add_probeaddr_isa (unsigned long io_addr) { -struct BusLogic_ProbeInfo *ProbeInfo; -if (BusLogic_ProbeInfoCount >= BusLogic_MaxHostAdapters) +struct blogic_probeinfo *probeinfo; +if (blogic_probeinfo_count >=BLOGIC_MAX_ADAPTERS )return ; - ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; - ProbeInfo->HostAdapterType = BusLogic_MultiMaster; - ProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus; - ProbeInfo->IO_Address = IO_Address; - ProbeInfo->PCI_Device =NULL ; + probeinfo = &blogic_probeinfo_list[blogic_probeinfo_count++]; + probeinfo->adapter_type =BLOGIC_MULTIMASTER ; + probeinfo->adapter_bus_type =BLOGIC_ISA_BUS ; + probeinfo->io_addr = io_addr; + probeinfo->pci_device =NULL ; }/* -BusLogic_InitializeProbeInfoListISA initializes the list of I/O Address and +blogic_init_probeinfo_isa initializes the list of I/O Address and Bus Probe Information to be checked for potential BusLogic SCSI Host Adapters only from the list of standard BusLogic MultiMaster ISA I/O Addresses. */ -static void __init BusLogic_InitializeProbeInfoListISA (struct BusLogic_HostAdapter - *PrototypeHostAdapter) +static void __init blogic_init_probeinfo_isa (struct blogic_adapter *adapter) {/* -If BusLogic Driver Options specifications requested that ISA Bus Probes -be inhibited, do not proceed further. +If BusLogic Driver Options specifications requested that ISA +Bus Probes be inhibited, do not proceed further. */ -if (BusLogic_ProbeOptions.NoProbeISA) +if (blogic_probe_options.noprobe_isa)return ;/* Append the list of standard BusLogic MultiMaster ISA I/O Addresses. */ -if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe330) -BusLogic_AppendProbeAddressISA (0x330 ); -if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe334) -BusLogic_AppendProbeAddressISA (0x334 ); -if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe230) -BusLogic_AppendProbeAddressISA (0x230 ); -if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe234) -BusLogic_AppendProbeAddressISA (0x234 ); -if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe130) -BusLogic_AppendProbeAddressISA (0x130 ); -if (!BusLogic_ProbeOptions.LimitedProbeISA || BusLogic_ProbeOptions.Probe134) -BusLogic_AppendProbeAddressISA (0x134 ); +if (!blogic_probe_options.limited_isa || blogic_probe_options.probe330) +blogic_add_probeaddr_isa (0x330 ); +if (!blogic_probe_options.limited_isa || blogic_probe_options.probe334) +blogic_add_probeaddr_isa (0x334 ); +if (!blogic_probe_options.limited_isa || blogic_probe_options.probe230) +blogic_add_probeaddr_isa (0x230 ); +if (!blogic_probe_options.limited_isa || blogic_probe_options.probe234) +blogic_add_probeaddr_isa (0x234 ); +if (!blogic_probe_options.limited_isa || blogic_probe_options.probe130) +blogic_add_probeaddr_isa (0x130 ); +if (!blogic_probe_options.limited_isa || blogic_probe_options.probe134) +blogic_add_probeaddr_isa (0x134 ); }
@@ -590,25 +614,35 @@ static void __init BusLogic_InitializeProbeInfoListISA(struct BusLogic_HostAdapt/* -BusLogic_SortProbeInfo sorts a section of BusLogic_ProbeInfoList in order +blogic_sort_probeinfo sorts a section of blogic_probeinfo_list in order of increasing PCI Bus and Device Number. */ -static void __init BusLogic_SortProbeInfo (struct BusLogic_ProbeInfo *ProbeInfoList,int ProbeInfoCount) +static void __init blogic_sort_probeinfo (struct blogic_probeinfo + *probeinfo_list,int probeinfo_cnt) { -int LastInterchange = ProbeInfoCount -1 , Bound, j; -while (LastInterchange >0 ) { - Bound = LastInterchange; - LastInterchange =0 ; -for (j =0 ; j < Bound; j++) { -struct BusLogic_ProbeInfo *ProbeInfo1 = &ProbeInfoList[j]; -struct BusLogic_ProbeInfo *ProbeInfo2 = &ProbeInfoList[j +1 ]; -if (ProbeInfo1->Bus > ProbeInfo2->Bus || (ProbeInfo1->Bus == ProbeInfo2->Bus && (ProbeInfo1->Device > ProbeInfo2->Device))) { -struct BusLogic_ProbeInfo TempProbeInfo; -memcpy (&TempProbeInfo, ProbeInfo1,sizeof (struct BusLogic_ProbeInfo )); -memcpy (ProbeInfo1, ProbeInfo2,sizeof (struct BusLogic_ProbeInfo )); -memcpy (ProbeInfo2, &TempProbeInfo,sizeof (struct BusLogic_ProbeInfo )); - LastInterchange = j; +int last_exchange = probeinfo_cnt -1 , bound, j; + +while (last_exchange >0 ) { + bound = last_exchange; + last_exchange =0 ; +for (j =0 ; j < bound; j++) { +struct blogic_probeinfo *probeinfo1 = + &probeinfo_list[j]; +struct blogic_probeinfo *probeinfo2 = + &probeinfo_list[j +1 ]; +if (probeinfo1->bus > probeinfo2->bus || + (probeinfo1->bus == probeinfo2->bus && + (probeinfo1->dev > probeinfo2->dev))) { +struct blogic_probeinfo tmp_probeinfo; + +memcpy (&tmp_probeinfo, probeinfo1, +sizeof (struct blogic_probeinfo )); +memcpy (probeinfo1, probeinfo2, +sizeof (struct blogic_probeinfo )); +memcpy (probeinfo2, &tmp_probeinfo, +sizeof (struct blogic_probeinfo )); + last_exchange = j; } } }
@@ -616,84 +650,88 @@ static void __init BusLogic_SortProbeInfo(struct BusLogic_ProbeInfo *ProbeInfoLi/* -BusLogic_InitializeMultiMasterProbeInfo initializes the list of I/O Address +blogic_init_mm_probeinfo initializes the list of I/O Address and Bus Probe Information to be checked for potential BusLogic MultiMaster SCSI Host Adapters by interrogating the PCI Configuration Space on PCI machines as well as from the list of standard BusLogic MultiMaster ISA I/O Addresses. It returns the number of PCI MultiMaster Host Adapters found. */ -static int __init BusLogic_InitializeMultiMasterProbeInfo (struct BusLogic_HostAdapter - *PrototypeHostAdapter) +static int __init blogic_init_mm_probeinfo (struct blogic_adapter *adapter) { -struct BusLogic_ProbeInfo *PrimaryProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount]; -int NonPrimaryPCIMultiMasterIndex = BusLogic_ProbeInfoCount +1 ; -int NonPrimaryPCIMultiMasterCount =0 , PCIMultiMasterCount =0 ; -bool ForceBusDeviceScanningOrder = false; -bool ForceBusDeviceScanningOrderChecked = false; -bool StandardAddressSeen[6 ]; -struct pci_dev *PCI_Device =NULL ; +struct blogic_probeinfo *pr_probeinfo = + &blogic_probeinfo_list[blogic_probeinfo_count]; +int nonpr_mmindex = blogic_probeinfo_count +1 ; +int nonpr_mmcount =0 , mmcount =0 ; +bool force_scan_order = false; +bool force_scan_order_checked = false; +bool addr_seen[6 ]; +struct pci_dev *pci_device =NULL ;int i; -if (BusLogic_ProbeInfoCount >= BusLogic_MaxHostAdapters) +if (blogic_probeinfo_count >=BLOGIC_MAX_ADAPTERS )return 0 ; - BusLogic_ProbeInfoCount++; + blogic_probeinfo_count++;for (i =0 ; i <6 ; i++) - StandardAddressSeen[i] = false; -/* -Iterate over the MultiMaster PCI Host Adapters. For each enumerated host -adapter, determine whether its ISA Compatible I/O Port is enabled and if -so, whether it is assigned the Primary I/O Address. A host adapter that is -assigned the Primary I/O Address will always be the preferred boot device. -The MultiMaster BIOS will first recognize a host adapter at the Primary I/O -Address, then any other PCI host adapters, and finally any host adapters -located at the remaining standard ISA I/O Addresses. When a PCI host -adapter is found with its ISA Compatible I/O Port enabled, a command is -issued to disable the ISA Compatible I/O Port, and it is noted that the + addr_seen[i] = false; +/* +Iterate over the MultiMaster PCI Host Adapters. For each +enumerated host adapter, determine whether its ISA Compatible +I/O Port is enabled and if so, whether it is assigned the +Primary I/O Address. A host adapter that is assigned the +Primary I/O Address will always be the preferred boot device. +The MultiMaster BIOS will first recognize a host adapter at +the Primary I/O Address, then any other PCI host adapters, +and finally any host adapters located at the remaining +standard ISA I/O Addresses. When a PCI host adapter is found +with its ISA Compatible I/O Port enabled, a command is issued +to disable the ISA Compatible I/O Port, and it is noted that the particular standard ISA I/O Address need not be probed. */ - PrimaryProbeInfo->IO_Address =0 ; -while ((PCI_Device =pci_get_device (PCI_VENDOR_ID_BUSLOGIC ,PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER , PCI_Device)) !=NULL ) { -struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; -struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; -enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest; -unsigned char Bus; -unsigned char Device; -unsigned int IRQ_Channel; -unsigned long BaseAddress0; -unsigned long BaseAddress1; -unsigned long IO_Address; -unsigned long PCI_Address; - -if (pci_enable_device (PCI_Device)) + pr_probeinfo->io_addr =0 ; +while ((pci_device =pci_get_device (PCI_VENDOR_ID_BUSLOGIC , +PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER , + pci_device)) !=NULL ) { +struct blogic_adapter *adapter = adapter; +struct blogic_adapter_info adapter_info; +enum blogic_isa_ioport mod_ioaddr_req; +unsigned char bus; +unsigned char device; +unsigned int irq_ch; +unsigned long base_addr0; +unsigned long base_addr1; +unsigned long io_addr; +unsigned long pci_addr; + +if (pci_enable_device (pci_device))continue ; -if (pci_set_dma_mask (PCI_Device,DMA_BIT_MASK (32 ) )) +if (pci_set_dma_mask (pci_device,DMA_BIT_MASK (32 )))continue ; - Bus = PCI_Device->bus->number; - Device = PCI_Device->devfn >>3 ; - IRQ_Channel = PCI_Device->irq; - IO_Address = BaseAddress0 =pci_resource_start (PCI_Device,0 ); - PCI_Address = BaseAddress1 =pci_resource_start (PCI_Device,1 ); + bus = pci_device->bus->number; + device = pci_device->devfn >>3 ; + irq_ch = pci_device->irq; + io_addr = base_addr0 =pci_resource_start (pci_device,0 ); + pci_addr = base_addr1 =pci_resource_start (pci_device,1 ); -if (pci_resource_flags (PCI_Device,0 ) &IORESOURCE_MEM ) { -BusLogic_Error ("BusLogic: Base Address0 0x%X not I/O for " "MultiMaster Host Adapter\n" ,NULL , BaseAddress0); -BusLogic_Error ("at PCI Bus %d Device %d I/O Address 0x%X\n" ,NULL , Bus, Device, IO_Address); +if (pci_resource_flags (pci_device,0 ) &IORESOURCE_MEM ) { +blogic_err ("BusLogic: Base Address0 0x%X not I/O for " "MultiMaster Host Adapter\n" ,NULL , base_addr0); +blogic_err ("at PCI Bus %d Device %d I/O Address 0x%X\n" ,NULL , bus, device, io_addr);continue ; } -if (pci_resource_flags (PCI_Device,1 ) &IORESOURCE_IO ) { -BusLogic_Error ("BusLogic: Base Address1 0x%X not Memory for " "MultiMaster Host Adapter\n" ,NULL , BaseAddress1); -BusLogic_Error ("at PCI Bus %d Device %d PCI Address 0x%X\n" ,NULL , Bus, Device, PCI_Address); +if (pci_resource_flags (pci_device,1 ) &IORESOURCE_IO ) { +blogic_err ("BusLogic: Base Address1 0x%X not Memory for " "MultiMaster Host Adapter\n" ,NULL , base_addr1); +blogic_err ("at PCI Bus %d Device %d PCI Address 0x%X\n" ,NULL , bus, device, pci_addr);continue ; } -if (IRQ_Channel ==0 ) { -BusLogic_Error ("BusLogic: IRQ Channel %d invalid for " "MultiMaster Host Adapter\n" ,NULL , IRQ_Channel); -BusLogic_Error ("at PCI Bus %d Device %d I/O Address 0x%X\n" ,NULL , Bus, Device, IO_Address); +if (irq_ch ==0 ) { +blogic_err ("BusLogic: IRQ Channel %d invalid for " "MultiMaster Host Adapter\n" ,NULL , irq_ch); +blogic_err ("at PCI Bus %d Device %d I/O Address 0x%X\n" ,NULL , bus, device, io_addr);continue ; } -if (BusLogic_GlobalOptions.TraceProbe) { -BusLogic_Notice ("BusLogic: PCI MultiMaster Host Adapter " "detected at\n" ,NULL ); -BusLogic_Notice ("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n" ,NULL , Bus, Device, IO_Address, PCI_Address); +if (blogic_global_options.trace_probe) { +blogic_notice ("BusLogic: PCI MultiMaster Host Adapter " "detected at\n" ,NULL ); +blogic_notice ("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n" ,NULL , bus, device, io_addr, pci_addr); }/* Issue the Inquire PCI Host Adapter Information command to determine
@@ -701,238 +739,258 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAdknown and enabled, note that the particular Standard ISA I/O Address should not be probed. */ - HostAdapter->IO_Address = IO_Address; -BusLogic_InterruptReset (HostAdapter); -if (BusLogic_Command (HostAdapter, BusLogic_InquirePCIHostAdapterInformation,NULL ,0 , &PCIHostAdapterInformation,sizeof (PCIHostAdapterInformation)) - ==sizeof (PCIHostAdapterInformation)) { -if (PCIHostAdapterInformation.ISACompatibleIOPort <6 ) - StandardAddressSeen[PCIHostAdapterInformation.ISACompatibleIOPort] = true; + adapter->io_addr = io_addr; +blogic_intreset (adapter); +if (blogic_cmd (adapter,BLOGIC_INQ_PCI_INFO ,NULL ,0 , + &adapter_info,sizeof (adapter_info)) == +sizeof (adapter_info)) { +if (adapter_info.isa_port <6 ) + addr_seen[adapter_info.isa_port] = true; }else - PCIHostAdapterInformation.ISACompatibleIOPort = BusLogic_IO_Disable; + adapter_info.isa_port =BLOGIC_IO_DISABLE ;/* -* Issue the Modify I/O Address command to disable the ISA Compatible -* I/O Port. On PCI Host Adapters, the Modify I/O Address command -* allows modification of the ISA compatible I/O Address that the Host -* Adapter responds to; it does not affect the PCI compliant I/O Address -* assigned at system initialization. +Issue the Modify I/O Address command to disable the +ISA Compatible I/O Port. On PCI Host Adapters, the +Modify I/O Address command allows modification of the +ISA compatible I/O Address that the Host Adapter +responds to; it does not affect the PCI compliant +I/O Address assigned at system initialization. */ - ModifyIOAddressRequest = BusLogic_IO_Disable; -BusLogic_Command (HostAdapter, BusLogic_ModifyIOAddress, &ModifyIOAddressRequest,sizeof (ModifyIOAddressRequest),NULL ,0 ); + mod_ioaddr_req =BLOGIC_IO_DISABLE ; +blogic_cmd (adapter,BLOGIC_MOD_IOADDR , &mod_ioaddr_req, +sizeof (mod_ioaddr_req),NULL ,0 );/* -For the first MultiMaster Host Adapter enumerated, issue the Fetch -Host Adapter Local RAM command to read byte 45 of the AutoSCSI area, -for the setting of the "Use Bus And Device # For PCI Scanning Seq." -option. Issue the Inquire Board ID command since this option is +For the first MultiMaster Host Adapter enumerated, +issue the Fetch Host Adapter Local RAM command to read +byte 45 of the AutoSCSI area, for the setting of the +"Use Bus And Device # For PCI Scanning Seq." option. +Issue the Inquire Board ID command since this option is only valid for the BT-948/958/958D. */ -if (!ForceBusDeviceScanningOrderChecked) { -struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; -struct BusLogic_AutoSCSIByte45 AutoSCSIByte45; -struct BusLogic_BoardID BoardID; - FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_AutoSCSI_BaseOffset +45 ; - FetchHostAdapterLocalRAMRequest.ByteCount =sizeof (AutoSCSIByte45); -BusLogic_Command (HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest,sizeof (FetchHostAdapterLocalRAMRequest), &AutoSCSIByte45,sizeof (AutoSCSIByte45)); -BusLogic_Command (HostAdapter, BusLogic_InquireBoardID,NULL ,0 , &BoardID,sizeof (BoardID)); -if (BoardID.FirmwareVersion1stDigit =='5' ) - ForceBusDeviceScanningOrder = AutoSCSIByte45.ForceBusDeviceScanningOrder; - ForceBusDeviceScanningOrderChecked = true; +if (!force_scan_order_checked) { +struct blogic_fetch_localram fetch_localram; +struct blogic_autoscsi_byte45 autoscsi_byte45; +struct blogic_board_id id; + + fetch_localram.offset =BLOGIC_AUTOSCSI_BASE +45 ; + fetch_localram.count =sizeof (autoscsi_byte45); +blogic_cmd (adapter,BLOGIC_FETCH_LOCALRAM , + &fetch_localram,sizeof (fetch_localram), + &autoscsi_byte45, +sizeof (autoscsi_byte45)); +blogic_cmd (adapter,BLOGIC_GET_BOARD_ID ,NULL ,0 , &id, +sizeof (id)); +if (id.fw_ver_digit1 =='5' ) + force_scan_order = + autoscsi_byte45.force_scan_order; + force_scan_order_checked = true; }/* -Determine whether this MultiMaster Host Adapter has its ISA -Compatible I/O Port enabled and is assigned the Primary I/O Address. -If it does, then it is the Primary MultiMaster Host Adapter and must -be recognized first. If it does not, then it is added to the list -for probing after any Primary MultiMaster Host Adapter is probed. +Determine whether this MultiMaster Host Adapter has its +ISA Compatible I/O Port enabled and is assigned the +Primary I/O Address. If it does, then it is the Primary +MultiMaster Host Adapter and must be recognized first. +If it does not, then it is added to the list for probing +after any Primary MultiMaster Host Adapter is probed. */ -if (PCIHostAdapterInformation.ISACompatibleIOPort == BusLogic_IO_330) { - PrimaryProbeInfo->HostAdapterType = BusLogic_MultiMaster; - PrimaryProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; - PrimaryProbeInfo->IO_Address = IO_Address; - PrimaryProbeInfo->PCI_Address = PCI_Address; - PrimaryProbeInfo->Bus = Bus; - PrimaryProbeInfo->Device = Device; - PrimaryProbeInfo->IRQ_Channel = IRQ_Channel; - PrimaryProbeInfo->PCI_Device =pci_dev_get (PCI_Device); - PCIMultiMasterCount++; - }else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { -struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; - ProbeInfo->HostAdapterType = BusLogic_MultiMaster; - ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; - ProbeInfo->IO_Address = IO_Address; - ProbeInfo->PCI_Address = PCI_Address; - ProbeInfo->Bus = Bus; - ProbeInfo->Device = Device; - ProbeInfo->IRQ_Channel = IRQ_Channel; - ProbeInfo->PCI_Device =pci_dev_get (PCI_Device); - NonPrimaryPCIMultiMasterCount++; - PCIMultiMasterCount++; +if (adapter_info.isa_port ==BLOGIC_IO_330 ) { + pr_probeinfo->adapter_type =BLOGIC_MULTIMASTER ; + pr_probeinfo->adapter_bus_type =BLOGIC_PCI_BUS ; + pr_probeinfo->io_addr = io_addr; + pr_probeinfo->pci_addr = pci_addr; + pr_probeinfo->bus = bus; + pr_probeinfo->dev = device; + pr_probeinfo->irq_ch = irq_ch; + pr_probeinfo->pci_device =pci_dev_get (pci_device); + mmcount++; + }else if (blogic_probeinfo_count <BLOGIC_MAX_ADAPTERS ) { +struct blogic_probeinfo *probeinfo = + &blogic_probeinfo_list[blogic_probeinfo_count++]; + probeinfo->adapter_type =BLOGIC_MULTIMASTER ; + probeinfo->adapter_bus_type =BLOGIC_PCI_BUS ; + probeinfo->io_addr = io_addr; + probeinfo->pci_addr = pci_addr; + probeinfo->bus = bus; + probeinfo->dev = device; + probeinfo->irq_ch = irq_ch; + probeinfo->pci_device =pci_dev_get (pci_device); + nonpr_mmcount++; + mmcount++; }else -BusLogic_Warning ("BusLogic: Too many Host Adapters " "detected\n" ,NULL ); - } -/* -If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq." option is ON -for the first enumerated MultiMaster Host Adapter, and if that host adapter -is a BT-948/958/958D, then the MultiMaster BIOS will recognize MultiMaster -Host Adapters in the order of increasing PCI Bus and Device Number. In -that case, sort the probe information into the same order the BIOS uses. -If this option is OFF, then the MultiMaster BIOS will recognize MultiMaster -Host Adapters in the order they are enumerated by the PCI BIOS, and hence -no sorting is necessary. -*/ -if (ForceBusDeviceScanningOrder) -BusLogic_SortProbeInfo (&BusLogic_ProbeInfoList[NonPrimaryPCIMultiMasterIndex], NonPrimaryPCIMultiMasterCount); -/* -If no PCI MultiMaster Host Adapter is assigned the Primary I/O Address, -then the Primary I/O Address must be probed explicitly before any PCI -host adapters are probed. -*/ -if (!BusLogic_ProbeOptions.NoProbeISA) -if (PrimaryProbeInfo->IO_Address ==0 && - (!BusLogic_ProbeOptions.LimitedProbeISA || - BusLogic_ProbeOptions.Probe330)) { - PrimaryProbeInfo->HostAdapterType = BusLogic_MultiMaster; - PrimaryProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus; - PrimaryProbeInfo->IO_Address =0x330 ; +blogic_warn ("BusLogic: Too many Host Adapters " "detected\n" ,NULL ); + } +/* +If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq." +option is ON for the first enumerated MultiMaster Host Adapter, +and if that host adapter is a BT-948/958/958D, then the +MultiMaster BIOS will recognize MultiMaster Host Adapters in +the order of increasing PCI Bus and Device Number. In that case, +sort the probe information into the same order the BIOS uses. +If this option is OFF, then the MultiMaster BIOS will recognize +MultiMaster Host Adapters in the order they are enumerated by +the PCI BIOS, and hence no sorting is necessary. +*/ +if (force_scan_order) +blogic_sort_probeinfo (&blogic_probeinfo_list[nonpr_mmindex], + nonpr_mmcount); +/* +If no PCI MultiMaster Host Adapter is assigned the Primary +I/O Address, then the Primary I/O Address must be probed +explicitly before any PCI host adapters are probed. +*/ +if (!blogic_probe_options.noprobe_isa) +if (pr_probeinfo->io_addr ==0 && + (!blogic_probe_options.limited_isa || + blogic_probe_options.probe330)) { + pr_probeinfo->adapter_type =BLOGIC_MULTIMASTER ; + pr_probeinfo->adapter_bus_type =BLOGIC_ISA_BUS ; + pr_probeinfo->io_addr =0x330 ; }/* Append the list of standard BusLogic MultiMaster ISA I/O Addresses, omitting the Primary I/O Address which has already been handled. */ -if (!BusLogic_ProbeOptions.NoProbeISA) { -if (!StandardAddressSeen[1 ] && - (!BusLogic_ProbeOptions.LimitedProbeISA || - BusLogic_ProbeOptions.Probe334)) -BusLogic_AppendProbeAddressISA (0x334 ); -if (!StandardAddressSeen[2 ] && - (!BusLogic_ProbeOptions.LimitedProbeISA || - BusLogic_ProbeOptions.Probe230)) -BusLogic_AppendProbeAddressISA (0x230 ); -if (!StandardAddressSeen[3 ] && - (!BusLogic_ProbeOptions.LimitedProbeISA || - BusLogic_ProbeOptions.Probe234)) -BusLogic_AppendProbeAddressISA (0x234 ); -if (!StandardAddressSeen[4 ] && - (!BusLogic_ProbeOptions.LimitedProbeISA || - BusLogic_ProbeOptions.Probe130)) -BusLogic_AppendProbeAddressISA (0x130 ); -if (!StandardAddressSeen[5 ] && - (!BusLogic_ProbeOptions.LimitedProbeISA || - BusLogic_ProbeOptions.Probe134)) -BusLogic_AppendProbeAddressISA (0x134 ); +if (!blogic_probe_options.noprobe_isa) { +if (!addr_seen[1 ] && + (!blogic_probe_options.limited_isa || + blogic_probe_options.probe334)) +blogic_add_probeaddr_isa (0x334 ); +if (!addr_seen[2 ] && + (!blogic_probe_options.limited_isa || + blogic_probe_options.probe230)) +blogic_add_probeaddr_isa (0x230 ); +if (!addr_seen[3 ] && + (!blogic_probe_options.limited_isa || + blogic_probe_options.probe234)) +blogic_add_probeaddr_isa (0x234 ); +if (!addr_seen[4 ] && + (!blogic_probe_options.limited_isa || + blogic_probe_options.probe130)) +blogic_add_probeaddr_isa (0x130 ); +if (!addr_seen[5 ] && + (!blogic_probe_options.limited_isa || + blogic_probe_options.probe134)) +blogic_add_probeaddr_isa (0x134 ); }/* Iterate over the older non-compliant MultiMaster PCI Host Adapters, noting the PCI bus location and assigned IRQ Channel. */ - PCI_Device =NULL ; -while ((PCI_Device =pci_get_device (PCI_VENDOR_ID_BUSLOGIC ,PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC , PCI_Device)) !=NULL ) { -unsigned char Bus; -unsigned char Device; -unsigned int IRQ_Channel; -unsigned long IO_Address; + pci_device =NULL ; +while ((pci_device =pci_get_device (PCI_VENDOR_ID_BUSLOGIC , +PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC , + pci_device)) !=NULL ) { +unsigned char bus; +unsigned char device; +unsigned int irq_ch; +unsigned long io_addr; -if (pci_enable_device (PCI_Device)) +if (pci_enable_device (pci_device))continue ; -if (pci_set_dma_mask (PCI_Device,DMA_BIT_MASK (32 ))) +if (pci_set_dma_mask (pci_device,DMA_BIT_MASK (32 )))continue ; - Bus = PCI_Device->bus->number; - Device = PCI_Device->devfn >>3 ; - IRQ_Channel = PCI_Device->irq; - IO_Address =pci_resource_start (PCI_Device,0 ); + bus = pci_device->bus->number; + device = pci_device->devfn >>3 ; + irq_ch = pci_device->irq; + io_addr =pci_resource_start (pci_device,0 ); -if (IO_Address ==0 || IRQ_Channel ==0 ) +if (io_addr ==0 || irq_ch ==0 )continue ; -for (i =0 ; i < BusLogic_ProbeInfoCount; i++) { -struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[i]; -if (ProbeInfo->IO_Address == IO_Address && ProbeInfo->HostAdapterType == BusLogic_MultiMaster) { - ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; - ProbeInfo->PCI_Address =0 ; - ProbeInfo->Bus = Bus; - ProbeInfo->Device = Device; - ProbeInfo->IRQ_Channel = IRQ_Channel; - ProbeInfo->PCI_Device =pci_dev_get (PCI_Device); +for (i =0 ; i < blogic_probeinfo_count; i++) { +struct blogic_probeinfo *probeinfo = + &blogic_probeinfo_list[i]; +if (probeinfo->io_addr == io_addr && + probeinfo->adapter_type ==BLOGIC_MULTIMASTER ) { + probeinfo->adapter_bus_type =BLOGIC_PCI_BUS ; + probeinfo->pci_addr =0 ; + probeinfo->bus = bus; + probeinfo->dev = device; + probeinfo->irq_ch = irq_ch; + probeinfo->pci_device =pci_dev_get (pci_device);break ; } } } -return PCIMultiMasterCount; +return mmcount; }/* -BusLogic_InitializeFlashPointProbeInfo initializes the list of I/O Address +blogic_init_fp_probeinfo initializes the list of I/O Address and Bus Probe Information to be checked for potential BusLogic FlashPoint Host Adapters by interrogating the PCI Configuration Space. It returns the number of FlashPoint Host Adapters found. */ -static int __init BusLogic_InitializeFlashPointProbeInfo (struct BusLogic_HostAdapter - *PrototypeHostAdapter) +static int __init blogic_init_fp_probeinfo (struct blogic_adapter *adapter) { -int FlashPointIndex = BusLogic_ProbeInfoCount, FlashPointCount =0 ; -struct pci_dev *PCI_Device =NULL ; +int fpindex = blogic_probeinfo_count, fpcount =0 ; +struct pci_dev *pci_device =NULL ;/* Interrogate PCI Configuration Space for any FlashPoint Host Adapters. */ -while ((PCI_Device =pci_get_device (PCI_VENDOR_ID_BUSLOGIC ,PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT , PCI_Device)) !=NULL ) { -unsigned char Bus; -unsigned char Device; -unsigned int IRQ_Channel; -unsigned long BaseAddress0; -unsigned long BaseAddress1; -unsigned long IO_Address; -unsigned long PCI_Address; - -if (pci_enable_device (PCI_Device)) +while ((pci_device =pci_get_device (PCI_VENDOR_ID_BUSLOGIC , +PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT , + pci_device)) !=NULL ) { +unsigned char bus; +unsigned char device; +unsigned int irq_ch; +unsigned long base_addr0; +unsigned long base_addr1; +unsigned long io_addr; +unsigned long pci_addr; + +if (pci_enable_device (pci_device))continue ; -if (pci_set_dma_mask (PCI_Device,DMA_BIT_MASK (32 ))) +if (pci_set_dma_mask (pci_device,DMA_BIT_MASK (32 )))continue ; - Bus = PCI_Device->bus->number; - Device = PCI_Device->devfn >>3 ; - IRQ_Channel = PCI_Device->irq; - IO_Address = BaseAddress0 =pci_resource_start (PCI_Device,0 ); - PCI_Address = BaseAddress1 =pci_resource_start (PCI_Device,1 ); + bus = pci_device->bus->number; + device = pci_device->devfn >>3 ; + irq_ch = pci_device->irq; + io_addr = base_addr0 =pci_resource_start (pci_device,0 ); + pci_addr = base_addr1 =pci_resource_start (pci_device,1 );#ifdef CONFIG_SCSI_FLASHPOINT -if (pci_resource_flags (PCI_Device,0 ) &IORESOURCE_MEM ) { -BusLogic_Error ("BusLogic: Base Address0 0x%X not I/O for " "FlashPoint Host Adapter\n" ,NULL , BaseAddress0); -BusLogic_Error ("at PCI Bus %d Device %d I/O Address 0x%X\n" ,NULL , Bus, Device, IO_Address); +if (pci_resource_flags (pci_device,0 ) &IORESOURCE_MEM ) { +blogic_err ("BusLogic: Base Address0 0x%X not I/O for " "FlashPoint Host Adapter\n" ,NULL , base_addr0); +blogic_err ("at PCI Bus %d Device %d I/O Address 0x%X\n" ,NULL , bus, device, io_addr);continue ; } -if (pci_resource_flags (PCI_Device,1 ) &IORESOURCE_IO ) { -BusLogic_Error ("BusLogic: Base Address1 0x%X not Memory for " "FlashPoint Host Adapter\n" ,NULL , BaseAddress1); -BusLogic_Error ("at PCI Bus %d Device %d PCI Address 0x%X\n" ,NULL , Bus, Device, PCI_Address); +if (pci_resource_flags (pci_device,1 ) &IORESOURCE_IO ) { +blogic_err ("BusLogic: Base Address1 0x%X not Memory for " "FlashPoint Host Adapter\n" ,NULL , base_addr1); +blogic_err ("at PCI Bus %d Device %d PCI Address 0x%X\n" ,NULL , bus, device, pci_addr);continue ; } -if (IRQ_Channel ==0 ) { -BusLogic_Error ("BusLogic: IRQ Channel %d invalid for " "FlashPoint Host Adapter\n" ,NULL , IRQ_Channel); -BusLogic_Error ("at PCI Bus %d Device %d I/O Address 0x%X\n" ,NULL , Bus, Device, IO_Address); +if (irq_ch ==0 ) { +blogic_err ("BusLogic: IRQ Channel %d invalid for " "FlashPoint Host Adapter\n" ,NULL , irq_ch); +blogic_err ("at PCI Bus %d Device %d I/O Address 0x%X\n" ,NULL , bus, device, io_addr);continue ; } -if (BusLogic_GlobalOptions.TraceProbe) { -BusLogic_Notice ("BusLogic: FlashPoint Host Adapter " "detected at\n" ,NULL ); -BusLogic_Notice ("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n" ,NULL , Bus, Device, IO_Address, PCI_Address); +if (blogic_global_options.trace_probe) { +blogic_notice ("BusLogic: FlashPoint Host Adapter " "detected at\n" ,NULL ); +blogic_notice ("BusLogic: PCI Bus %d Device %d I/O Address " "0x%X PCI Address 0x%X\n" ,NULL , bus, device, io_addr, pci_addr); } -if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { -struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; - ProbeInfo->HostAdapterType = BusLogic_FlashPoint; - ProbeInfo->HostAdapterBusType = BusLogic_PCI_Bus; - ProbeInfo->IO_Address = IO_Address; - ProbeInfo->PCI_Address = PCI_Address; - ProbeInfo->Bus = Bus; - ProbeInfo->Device = Device; - ProbeInfo->IRQ_Channel = IRQ_Channel; - ProbeInfo->PCI_Device =pci_dev_get (PCI_Device); - FlashPointCount++; +if (blogic_probeinfo_count <BLOGIC_MAX_ADAPTERS ) { +struct blogic_probeinfo *probeinfo = + &blogic_probeinfo_list[blogic_probeinfo_count++]; + probeinfo->adapter_type =BLOGIC_FLASHPOINT ; + probeinfo->adapter_bus_type =BLOGIC_PCI_BUS ; + probeinfo->io_addr = io_addr; + probeinfo->pci_addr = pci_addr; + probeinfo->bus = bus; + probeinfo->dev = device; + probeinfo->irq_ch = irq_ch; + probeinfo->pci_device =pci_dev_get (pci_device); + fpcount++; }else -BusLogic_Warning ("BusLogic: Too many Host Adapters " "detected\n" ,NULL ); +blogic_warn ("BusLogic: Too many Host Adapters " "detected\n" ,NULL );#else -BusLogic_Error ("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n" ,NULL , Bus, Device); -BusLogic_Error ("BusLogic: I/O Address 0x%X PCI Address 0x%X, irq %d, " "but FlashPoint\n" ,NULL , IO_Address, PCI_Address, IRQ_Channel); -BusLogic_Error ("BusLogic: support was omitted in this kernel " "configuration.\n" ,NULL ); +blogic_err ("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n" ,NULL , bus, device); +blogic_err ("BusLogic: I/O Address 0x%X PCI Address 0x%X, irq %d, " "but FlashPoint\n" ,NULL , io_addr, pci_addr, irq_ch); +blogic_err ("BusLogic: support was omitted in this kernel " "configuration.\n" ,NULL );#endif }/*
@@ -940,13 +998,13 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAdaincreasing PCI Bus and Device Number, so sort the probe information into the same order the BIOS uses. */ -BusLogic_SortProbeInfo (&BusLogic_ProbeInfoList[FlashPointIndex], FlashPointCount); -return FlashPointCount; +blogic_sort_probeinfo (&blogic_probeinfo_list[fpindex], fpcount); +return fpcount; }/* -BusLogic_InitializeProbeInfoList initializes the list of I/O Address and Bus +blogic_init_probeinfo_list initializes the list of I/O Address and Bus Probe Information to be checked for potential BusLogic SCSI Host Adapters by interrogating the PCI Configuration Space on PCI machines as well as from the list of standard BusLogic MultiMaster ISA I/O Addresses. By default, if both
@@ -958,104 +1016,125 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAdaa particular probe order. */ -static void __init BusLogic_InitializeProbeInfoList (struct BusLogic_HostAdapter - *PrototypeHostAdapter) +static void __init blogic_init_probeinfo_list (struct blogic_adapter *adapter) {/* -If a PCI BIOS is present, interrogate it for MultiMaster and FlashPoint -Host Adapters; otherwise, default to the standard ISA MultiMaster probe. -*/ -if (!BusLogic_ProbeOptions.NoProbePCI) { -if (BusLogic_ProbeOptions.MultiMasterFirst) { -BusLogic_InitializeMultiMasterProbeInfo (PrototypeHostAdapter); -BusLogic_InitializeFlashPointProbeInfo (PrototypeHostAdapter); - }else if (BusLogic_ProbeOptions.FlashPointFirst) { -BusLogic_InitializeFlashPointProbeInfo (PrototypeHostAdapter); -BusLogic_InitializeMultiMasterProbeInfo (PrototypeHostAdapter); +If a PCI BIOS is present, interrogate it for MultiMaster and +FlashPoint Host Adapters; otherwise, default to the standard +ISA MultiMaster probe. +*/ +if (!blogic_probe_options.noprobe_pci) { +if (blogic_probe_options.multimaster_first) { +blogic_init_mm_probeinfo (adapter); +blogic_init_fp_probeinfo (adapter); + }else if (blogic_probe_options.flashpoint_first) { +blogic_init_fp_probeinfo (adapter); +blogic_init_mm_probeinfo (adapter); }else { -int FlashPointCount =BusLogic_InitializeFlashPointProbeInfo (PrototypeHostAdapter); -int PCIMultiMasterCount =BusLogic_InitializeMultiMasterProbeInfo (PrototypeHostAdapter); -if (FlashPointCount >0 && PCIMultiMasterCount >0 ) { -struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[FlashPointCount]; -struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; -struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; -struct BusLogic_BIOSDriveMapByte Drive0MapByte; -while (ProbeInfo->HostAdapterBusType != BusLogic_PCI_Bus) - ProbeInfo++; - HostAdapter->IO_Address = ProbeInfo->IO_Address; - FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_BIOS_BaseOffset + BusLogic_BIOS_DriveMapOffset +0 ; - FetchHostAdapterLocalRAMRequest.ByteCount =sizeof (Drive0MapByte); -BusLogic_Command (HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest,sizeof (FetchHostAdapterLocalRAMRequest), &Drive0MapByte,sizeof (Drive0MapByte)); +int fpcount =blogic_init_fp_probeinfo (adapter); +int mmcount =blogic_init_mm_probeinfo (adapter); +if (fpcount >0 && mmcount >0 ) { +struct blogic_probeinfo *probeinfo = + &blogic_probeinfo_list[fpcount]; +struct blogic_adapter *myadapter = adapter; +struct blogic_fetch_localram fetch_localram; +struct blogic_bios_drvmap d0_mapbyte; + +while (probeinfo->adapter_bus_type != +BLOGIC_PCI_BUS ) + probeinfo++; + myadapter->io_addr = probeinfo->io_addr; + fetch_localram.offset = +BLOGIC_BIOS_BASE +BLOGIC_BIOS_DRVMAP ; + fetch_localram.count =sizeof (d0_mapbyte); +blogic_cmd (myadapter,BLOGIC_FETCH_LOCALRAM , + &fetch_localram, +sizeof (fetch_localram), + &d0_mapbyte, +sizeof (d0_mapbyte));/* -If the Map Byte for BIOS Drive 0 indicates that BIOS Drive 0 -is controlled by this PCI MultiMaster Host Adapter, then -reverse the probe order so that MultiMaster Host Adapters are -probed before FlashPoint Host Adapters. +If the Map Byte for BIOS Drive 0 indicates +that BIOS Drive 0 is controlled by this +PCI MultiMaster Host Adapter, then reverse +the probe order so that MultiMaster Host +Adapters are probed before FlashPoint Host +Adapters. */ -if (Drive0MapByte.DiskGeometry != BusLogic_BIOS_Disk_Not_Installed) { -struct BusLogic_ProbeInfo SavedProbeInfo[BusLogic_MaxHostAdapters]; -int MultiMasterCount = BusLogic_ProbeInfoCount - FlashPointCount; -memcpy (SavedProbeInfo, BusLogic_ProbeInfoList, BusLogic_ProbeInfoCount *sizeof (struct BusLogic_ProbeInfo )); -memcpy (&BusLogic_ProbeInfoList[0 ], &SavedProbeInfo[FlashPointCount], MultiMasterCount *sizeof (struct BusLogic_ProbeInfo )); -memcpy (&BusLogic_ProbeInfoList[MultiMasterCount], &SavedProbeInfo[0 ], FlashPointCount *sizeof (struct BusLogic_ProbeInfo )); +if (d0_mapbyte.diskgeom !=BLOGIC_BIOS_NODISK ) { +struct blogic_probeinfo saved_probeinfo[BLOGIC_MAX_ADAPTERS ]; +int mmcount = blogic_probeinfo_count - fpcount; + +memcpy (saved_probeinfo, + blogic_probeinfo_list, + blogic_probeinfo_count *sizeof (struct blogic_probeinfo )); +memcpy (&blogic_probeinfo_list[0 ], + &saved_probeinfo[fpcount], + mmcount *sizeof (struct blogic_probeinfo )); +memcpy (&blogic_probeinfo_list[mmcount], + &saved_probeinfo[0 ], + fpcount *sizeof (struct blogic_probeinfo )); } } } - }else -BusLogic_InitializeProbeInfoListISA (PrototypeHostAdapter); + }else { +blogic_init_probeinfo_isa (adapter); + } }#else -#define BusLogic_InitializeProbeInfoList (adapter) \ - BusLogic_InitializeProbeInfoListISA(adapter) +#define blogic_init_probeinfo_list (adapter) \ + blogic_init_probeinfo_isa(adapter)#endif /* CONFIG_PCI */ /* -BusLogic_Failure prints a standardized error message, and then returns false. +blogic_failure prints a standardized error message, and then returns false. */ -static bool BusLogic_Failure (struct BusLogic_HostAdapter *HostAdapter,char *ErrorMessage) +static bool blogic_failure (struct blogic_adapter *adapter,char *msg) { -BusLogic_AnnounceDriver (HostAdapter); -if (HostAdapter->HostAdapterBusType == BusLogic_PCI_Bus) { -BusLogic_Error ("While configuring BusLogic PCI Host Adapter at\n" , HostAdapter); -BusLogic_Error ("Bus %d Device %d I/O Address 0x%X PCI Address 0x%X:\n" , HostAdapter, HostAdapter->Bus, HostAdapter->Device, HostAdapter->IO_Address, HostAdapter->PCI_Address); +blogic_announce_drvr (adapter); +if (adapter->adapter_bus_type ==BLOGIC_PCI_BUS ) { +blogic_err ("While configuring BusLogic PCI Host Adapter at\n" , + adapter); +blogic_err ("Bus %d Device %d I/O Address 0x%X PCI Address 0x%X:\n" , adapter, adapter->bus, adapter->dev, adapter->io_addr, adapter->pci_addr); }else -BusLogic_Error ("While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n" , HostAdapter, HostAdapter->IO_Address); -BusLogic_Error ("%s FAILED - DETACHING\n" , HostAdapter, ErrorMessage); -if (BusLogic_CommandFailureReason !=NULL ) -BusLogic_Error ("ADDITIONAL FAILURE INFO - %s\n" , HostAdapter, BusLogic_CommandFailureReason); +blogic_err ("While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n" , adapter, adapter->io_addr); +blogic_err ("%s FAILED - DETACHING\n" , adapter, msg); +if (blogic_cmd_failure_reason !=NULL ) +blogic_err ("ADDITIONAL FAILURE INFO - %s\n" , adapter, + blogic_cmd_failure_reason);return false; }/* -BusLogic_ProbeHostAdapter probes for a BusLogic Host Adapter. +blogic_probe probes for a BusLogic Host Adapter. */ -static bool __init BusLogic_ProbeHostAdapter (struct BusLogic_HostAdapter *HostAdapter) +static bool __init blogic_probe (struct blogic_adapter *adapter) { -union BusLogic_StatusRegister StatusRegister; -union BusLogic_InterruptRegister InterruptRegister; -union BusLogic_GeometryRegister GeometryRegister; +union blogic_stat_reg statusreg; +union blogic_int_reg intreg; +union blogic_geo_reg georeg;/* FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager. */ -if (BusLogic_FlashPointHostAdapterP (HostAdapter)) { -struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; - FlashPointInfo->BaseAddress = (u32 ) HostAdapter->IO_Address; - FlashPointInfo->IRQ_Channel = HostAdapter->IRQ_Channel; - FlashPointInfo->Present = false; -if (!(FlashPoint_ProbeHostAdapter (FlashPointInfo) ==0 && FlashPointInfo->Present)) { -BusLogic_Error ("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n" , HostAdapter, HostAdapter->Bus, HostAdapter->Device); -BusLogic_Error ("BusLogic: I/O Address 0x%X PCI Address 0x%X, " "but FlashPoint\n" , HostAdapter, HostAdapter->IO_Address, HostAdapter->PCI_Address); -BusLogic_Error ("BusLogic: Probe Function failed to validate it.\n" , HostAdapter); +if (blogic_flashpoint_type (adapter)) { +struct fpoint_info *fpinfo = &adapter->fpinfo; + fpinfo->base_addr = (u32 ) adapter->io_addr; + fpinfo->irq_ch = adapter->irq_ch; + fpinfo->present = false; +if (!(FlashPoint_ProbeHostAdapter (fpinfo) ==0 && + fpinfo->present)) { +blogic_err ("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n" , adapter, adapter->bus, adapter->dev); +blogic_err ("BusLogic: I/O Address 0x%X PCI Address 0x%X, " "but FlashPoint\n" , adapter, adapter->io_addr, adapter->pci_addr); +blogic_err ("BusLogic: Probe Function failed to validate it.\n" , adapter);return false; } -if (BusLogic_GlobalOptions.TraceProbe) -BusLogic_Notice ("BusLogic_Probe(0x%X): FlashPoint Found\n" , HostAdapter, HostAdapter->IO_Address); +if (blogic_global_options.trace_probe) +blogic_notice ("BusLogic_Probe(0x%X): FlashPoint Found\n" , adapter, adapter->io_addr);/* Indicate the Host Adapter Probe completed successfully. */
@@ -1068,28 +1147,32 @@ static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAdcase 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. */ - StatusRegister.All =BusLogic_ReadStatusRegister (HostAdapter); - InterruptRegister.All =BusLogic_ReadInterruptRegister (HostAdapter); - GeometryRegister.All =BusLogic_ReadGeometryRegister (HostAdapter); -if (BusLogic_GlobalOptions.TraceProbe) -BusLogic_Notice ("BusLogic_Probe(0x%X): Status 0x%02X, Interrupt 0x%02X, " "Geometry 0x%02X\n" , HostAdapter, HostAdapter->IO_Address, StatusRegister.All, InterruptRegister.All, GeometryRegister.All); -if (StatusRegister.All ==0 || StatusRegister.sr.DiagnosticActive || StatusRegister.sr.CommandParameterRegisterBusy || StatusRegister.sr.Reserved || StatusRegister.sr.CommandInvalid || InterruptRegister.ir.Reserved !=0 ) + statusreg.all =blogic_rdstatus (adapter); + intreg.all =blogic_rdint (adapter); + georeg.all =blogic_rdgeom (adapter); +if (blogic_global_options.trace_probe) +blogic_notice ("BusLogic_Probe(0x%X): Status 0x%02X, Interrupt 0x%02X, " "Geometry 0x%02X\n" , adapter, adapter->io_addr, statusreg.all, intreg.all, georeg.all); +if (statusreg.all ==0 || statusreg.sr.diag_active || + statusreg.sr.cmd_param_busy || statusreg.sr.rsvd || + statusreg.sr.cmd_invalid || intreg.ir.rsvd !=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 ) +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 blogic_checkadapter. 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 (georeg.all ==0xFF )return false;/* Indicate the Host Adapter Probe completed successfully.
@@ -1099,27 +1182,28 @@ static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAd/* -BusLogic_HardwareResetHostAdapter issues a Hardware Reset to the Host Adapter -and waits for Host Adapter Diagnostics to complete. If HardReset is true, a +blogic_hwreset issues a Hardware Reset to the Host Adapter +and waits for Host Adapter Diagnostics to complete. If hard_reset 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. */ -static bool BusLogic_HardwareResetHostAdapter (struct BusLogic_HostAdapter - *HostAdapter,bool HardReset) +static bool blogic_hwreset (struct blogic_adapter *adapter,bool hard_reset) { -union BusLogic_StatusRegister StatusRegister; -int TimeoutCounter; +union blogic_stat_reg statusreg; +int timeout;/* -FlashPoint Host Adapters are Hard Reset by the FlashPoint SCCB Manager. +FlashPoint Host Adapters are Hard Reset by the FlashPoint +SCCB Manager. */ -if (BusLogic_FlashPointHostAdapterP (HostAdapter)) { -struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; - FlashPointInfo->HostSoftReset = !HardReset; - FlashPointInfo->ReportDataUnderrun = true; - HostAdapter->CardHandle =FlashPoint_HardwareResetHostAdapter (FlashPointInfo); -if (HostAdapter->CardHandle == FlashPoint_BadCardHandle) +if (blogic_flashpoint_type (adapter)) { +struct fpoint_info *fpinfo = &adapter->fpinfo; + fpinfo->softreset = !hard_reset; + fpinfo->report_underrun = true; + adapter->cardhandle = +FlashPoint_HardwareResetHostAdapter (fpinfo); +if (adapter->cardhandle ==FPOINT_BADCARD_HANDLE )return false;/* Indicate the Host Adapter Hard Reset completed successfully.
@@ -1127,26 +1211,27 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapterreturn true; }/* -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. +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); +if (hard_reset) +blogic_hardreset (adapter);else -BusLogic_SoftReset (HostAdapter); +blogic_softreset (adapter);/* Wait until Diagnostic Active is set in the Status Register. */ - TimeoutCounter =5 *10000 ; -while (--TimeoutCounter >=0 ) { - StatusRegister.All =BusLogic_ReadStatusRegister (HostAdapter); -if (StatusRegister.sr.DiagnosticActive) + timeout =5 *10000 ; +while (--timeout >=0 ) { + statusreg.all =blogic_rdstatus (adapter); +if (statusreg.sr.diag_active)break ;udelay (100 ); } -if (BusLogic_GlobalOptions.TraceHardwareReset) -BusLogic_Notice ("BusLogic_HardwareReset(0x%X): Diagnostic Active, " "Status 0x%02X\n" , HostAdapter, HostAdapter->IO_Address, StatusRegister.All); -if (TimeoutCounter <0 ) +if (blogic_global_options.trace_hw_reset) +blogic_notice ("BusLogic_HardwareReset(0x%X): Diagnostic Active, " "Status 0x%02X\n" , adapter, adapter->io_addr, statusreg.all); +if (timeout <0 )return false;/* Wait 100 microseconds to allow completion of any initial diagnostic
@@ -1157,45 +1242,46 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter/* Wait until Diagnostic Active is reset in the Status Register. */ - TimeoutCounter =10 *10000 ; -while (--TimeoutCounter >=0 ) { - StatusRegister.All =BusLogic_ReadStatusRegister (HostAdapter); -if (!StatusRegister.sr.DiagnosticActive) + timeout =10 *10000 ; +while (--timeout >=0 ) { + statusreg.all =blogic_rdstatus (adapter); +if (!statusreg.sr.diag_active)break ;udelay (100 ); } -if (BusLogic_GlobalOptions.TraceHardwareReset) -BusLogic_Notice ("BusLogic_HardwareReset(0x%X): Diagnostic Completed, " "Status 0x%02X\n" , HostAdapter, HostAdapter->IO_Address, StatusRegister.All); -if (TimeoutCounter <0 ) +if (blogic_global_options.trace_hw_reset) +blogic_notice ("BusLogic_HardwareReset(0x%X): Diagnostic Completed, " "Status 0x%02X\n" , adapter, adapter->io_addr, statusreg.all); +if (timeout <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. +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.sr.DiagnosticFailure || StatusRegister.sr.HostAdapterReady || StatusRegister.sr.DataInRegisterReady) + timeout =10000 ; +while (--timeout >=0 ) { + statusreg.all =blogic_rdstatus (adapter); +if (statusreg.sr.diag_failed || statusreg.sr.adapter_ready || statusreg.sr.datain_ready)break ;udelay (100 ); } -if (BusLogic_GlobalOptions.TraceHardwareReset) -BusLogic_Notice ("BusLogic_HardwareReset(0x%X): Host Adapter Ready, " "Status 0x%02X\n" , HostAdapter, HostAdapter->IO_Address, StatusRegister.All); -if (TimeoutCounter <0 ) +if (blogic_global_options.trace_hw_reset) +blogic_notice ("BusLogic_HardwareReset(0x%X): Host Adapter Ready, " "Status 0x%02X\n" , adapter, adapter->io_addr, statusreg.all); +if (timeout <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.sr.DiagnosticFailure || !StatusRegister.sr.HostAdapterReady) { - BusLogic_CommandFailureReason =NULL ; -BusLogic_Failure (HostAdapter,"HARD RESET DIAGNOSTICS" ); -BusLogic_Error ("HOST ADAPTER STATUS REGISTER = %02X\n" , HostAdapter, StatusRegister.All); -if (StatusRegister.sr.DataInRegisterReady) { -unsigned char ErrorCode =BusLogic_ReadDataInRegister (HostAdapter); -BusLogic_Error ("HOST ADAPTER ERROR CODE = %d\n" , HostAdapter, ErrorCode); - } +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 (statusreg.sr.diag_failed || !statusreg.sr.adapter_ready) { + blogic_cmd_failure_reason =NULL ; +blogic_failure (adapter,"HARD RESET DIAGNOSTICS" ); +blogic_err ("HOST ADAPTER STATUS REGISTER = %02X\n" , adapter, + statusreg.all); +if (statusreg.sr.datain_ready) +blogic_err ("HOST ADAPTER ERROR CODE = %d\n" , adapter, +blogic_rddatain (adapter));return false; }/*
@@ -1206,161 +1292,172 @@ static bool BusLogic_HardwareResetHostAdapter(struct BusLogic_HostAdapter/* -BusLogic_CheckHostAdapter checks to be sure this really is a BusLogic +blogic_checkadapter checks to be sure this really is a BusLogic Host Adapter. */ -static bool __init BusLogic_CheckHostAdapter (struct BusLogic_HostAdapter *HostAdapter) +static bool __init blogic_checkadapter (struct blogic_adapter *adapter) { -struct BusLogic_ExtendedSetupInformation ExtendedSetupInformation; -unsigned char RequestedReplyLength; -bool Result = true; +struct blogic_ext_setup ext_setupinfo; +unsigned char req_replylen; +bool result = true;/* FlashPoint Host Adapters do not require this protection. */ -if (BusLogic_FlashPointHostAdapterP (HostAdapter)) +if (blogic_flashpoint_type (adapter))return true;/* -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. +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; + req_replylen =sizeof (ext_setupinfo); +if (blogic_cmd (adapter,BLOGIC_INQ_EXTSETUP , &req_replylen, +sizeof (req_replylen), &ext_setupinfo, +sizeof (ext_setupinfo)) !=sizeof (ext_setupinfo)) + result = false;/* Provide tracing information if requested and return. */ -if (BusLogic_GlobalOptions.TraceProbe) -BusLogic_Notice ("BusLogic_Check(0x%X): MultiMaster %s\n" , HostAdapter, HostAdapter->IO_Address, (Result ?"Found" :"Not Found" )); -return Result; +if (blogic_global_options.trace_probe) +blogic_notice ("BusLogic_Check(0x%X): MultiMaster %s\n" , adapter, + adapter->io_addr, + (result ?"Found" :"Not Found" )); +return result; }/* -BusLogic_ReadHostAdapterConfiguration reads the Configuration Information +blogic_rdconfig reads the Configuration Information from Host Adapter and initializes the Host Adapter structure. */ -static bool __init BusLogic_ReadHostAdapterConfiguration (struct BusLogic_HostAdapter - *HostAdapter) +static bool __init blogic_rdconfig (struct blogic_adapter *adapter) { -struct BusLogic_BoardID BoardID; -struct BusLogic_Configuration Configuration; -struct BusLogic_SetupInformation SetupInformation; -struct BusLogic_ExtendedSetupInformation ExtendedSetupInformation; -unsigned char HostAdapterModelNumber[5 ]; -unsigned char FirmwareVersion3rdDigit; -unsigned char FirmwareVersionLetter; -struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; -struct BusLogic_FetchHostAdapterLocalRAMRequest FetchHostAdapterLocalRAMRequest; -struct BusLogic_AutoSCSIData AutoSCSIData; -union BusLogic_GeometryRegister GeometryRegister; -unsigned char RequestedReplyLength; -unsigned char *TargetPointer, Character; -int TargetID, i; -/* -Configuration Information for FlashPoint Host Adapters is provided in the -FlashPoint_Info structure by the FlashPoint SCCB Manager's Probe Function. -Initialize fields in the Host Adapter structure from the FlashPoint_Info -structure. -*/ -if (BusLogic_FlashPointHostAdapterP (HostAdapter)) { -struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo; - TargetPointer = HostAdapter->ModelName; - *TargetPointer++ ='B' ; - *TargetPointer++ ='T' ; - *TargetPointer++ ='-' ; -for (i =0 ; i <sizeof (FlashPointInfo->ModelNumber); i++) - *TargetPointer++ = FlashPointInfo->ModelNumber[i]; - *TargetPointer++ ='\0' ; -strcpy (HostAdapter->FirmwareVersion, FlashPoint_FirmwareVersion); - HostAdapter->SCSI_ID = FlashPointInfo->SCSI_ID; - HostAdapter->ExtendedTranslationEnabled = FlashPointInfo->ExtendedTranslationEnabled; - HostAdapter->ParityCheckingEnabled = FlashPointInfo->ParityCheckingEnabled; - HostAdapter->BusResetEnabled = !FlashPointInfo->HostSoftReset; - HostAdapter->LevelSensitiveInterrupt = true; - HostAdapter->HostWideSCSI = FlashPointInfo->HostWideSCSI; - HostAdapter->HostDifferentialSCSI = false; - HostAdapter->HostSupportsSCAM = true; - HostAdapter->HostUltraSCSI = true; - HostAdapter->ExtendedLUNSupport = true; - HostAdapter->TerminationInfoValid = true; - HostAdapter->LowByteTerminated = FlashPointInfo->LowByteTerminated; - HostAdapter->HighByteTerminated = FlashPointInfo->HighByteTerminated; - HostAdapter->SCAM_Enabled = FlashPointInfo->SCAM_Enabled; - HostAdapter->SCAM_Level2 = FlashPointInfo->SCAM_Level2; - HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit; - HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ?16 :8 ); - HostAdapter->MaxLogicalUnits =32 ; - HostAdapter->InitialCCBs =4 * BusLogic_CCB_AllocationGroupSize; - HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize; - HostAdapter->DriverQueueDepth =255 ; - HostAdapter->HostAdapterQueueDepth = HostAdapter->DriverQueueDepth; - HostAdapter->SynchronousPermitted = FlashPointInfo->SynchronousPermitted; - HostAdapter->FastPermitted = FlashPointInfo->FastPermitted; - HostAdapter->UltraPermitted = FlashPointInfo->UltraPermitted; - HostAdapter->WidePermitted = FlashPointInfo->WidePermitted; - HostAdapter->DisconnectPermitted = FlashPointInfo->DisconnectPermitted; - HostAdapter->TaggedQueuingPermitted =0xFFFF ; - goto Common; +struct blogic_board_id id; +struct blogic_config config; +struct blogic_setup_info setupinfo; +struct blogic_ext_setup ext_setupinfo; +unsigned char model[5 ]; +unsigned char fw_ver_digit3; +unsigned char fw_ver_letter; +struct blogic_adapter_info adapter_info; +struct blogic_fetch_localram fetch_localram; +struct blogic_autoscsi autoscsi; +union blogic_geo_reg georeg; +unsigned char req_replylen; +unsigned char *tgt, ch; +int tgt_id, i; +/* +Configuration Information for FlashPoint Host Adapters is +provided in the fpoint_info structure by the FlashPoint +SCCB Manager's Probe Function. Initialize fields in the +Host Adapter structure from the fpoint_info structure. +*/ +if (blogic_flashpoint_type (adapter)) { +struct fpoint_info *fpinfo = &adapter->fpinfo; + tgt = adapter->model; + *tgt++ ='B' ; + *tgt++ ='T' ; + *tgt++ ='-' ; +for (i =0 ; i <sizeof (fpinfo->model); i++) + *tgt++ = fpinfo->model[i]; + *tgt++ ='\0' ; +strcpy (adapter->fw_ver,FLASHPOINT_FW_VER ); + adapter->scsi_id = fpinfo->scsi_id; + adapter->ext_trans_enable = fpinfo->ext_trans_enable; + adapter->parity = fpinfo->parity; + adapter->reset_enabled = !fpinfo->softreset; + adapter->level_int = true; + adapter->wide = fpinfo->wide; + adapter->differential = false; + adapter->scam = true; + adapter->ultra = true; + adapter->ext_lun = true; + adapter->terminfo_valid = true; + adapter->low_term = fpinfo->low_term; + adapter->high_term = fpinfo->high_term; + adapter->scam_enabled = fpinfo->scam_enabled; + adapter->scam_lev2 = fpinfo->scam_lev2; + adapter->drvr_sglimit =BLOGIC_SG_LIMIT ; + adapter->maxdev = (adapter->wide ?16 :8 ); + adapter->maxlun =32 ; + adapter->initccbs =4 *BLOGIC_CCB_GRP_ALLOCSIZE ; + adapter->inc_ccbs =BLOGIC_CCB_GRP_ALLOCSIZE ; + adapter->drvr_qdepth =255 ; + adapter->adapter_qdepth = adapter->drvr_qdepth; + adapter->sync_ok = fpinfo->sync_ok; + adapter->fast_ok = fpinfo->fast_ok; + adapter->ultra_ok = fpinfo->ultra_ok; + adapter->wide_ok = fpinfo->wide_ok; + adapter->discon_ok = fpinfo->discon_ok; + adapter->tagq_ok =0xFFFF ; + goto common; }/* Issue the Inquire Board ID command. */ -if (BusLogic_Command (HostAdapter, BusLogic_InquireBoardID,NULL ,0 , &BoardID,sizeof (BoardID)) !=sizeof (BoardID)) -return BusLogic_Failure (HostAdapter,"INQUIRE BOARD ID" ); +if (blogic_cmd (adapter,BLOGIC_GET_BOARD_ID ,NULL ,0 , &id, +sizeof (id)) !=sizeof (id)) +return blogic_failure (adapter,"INQUIRE BOARD ID" );/* Issue the Inquire Configuration command. */ -if (BusLogic_Command (HostAdapter, BusLogic_InquireConfiguration,NULL ,0 , &Configuration,sizeof (Configuration)) - !=sizeof (Configuration)) -return BusLogic_Failure (HostAdapter,"INQUIRE CONFIGURATION" ); +if (blogic_cmd (adapter,BLOGIC_INQ_CONFIG ,NULL ,0 , &config, +sizeof (config)) + !=sizeof (config)) +return blogic_failure (adapter,"INQUIRE CONFIGURATION" );/* Issue the Inquire Setup Information command. */ - RequestedReplyLength =sizeof (SetupInformation); -if (BusLogic_Command (HostAdapter, BusLogic_InquireSetupInformation, &RequestedReplyLength,sizeof (RequestedReplyLength), &SetupInformation,sizeof (SetupInformation)) - !=sizeof (SetupInformation)) -return BusLogic_Failure (HostAdapter,"INQUIRE SETUP INFORMATION" ); + req_replylen =sizeof (setupinfo); +if (blogic_cmd (adapter,BLOGIC_INQ_SETUPINFO , &req_replylen, +sizeof (req_replylen), &setupinfo, +sizeof (setupinfo)) !=sizeof (setupinfo)) +return blogic_failure (adapter,"INQUIRE SETUP INFORMATION" );/* Issue the Inquire Extended Setup Information command. */ - RequestedReplyLength =sizeof (ExtendedSetupInformation); -if (BusLogic_Command (HostAdapter, BusLogic_InquireExtendedSetupInformation, &RequestedReplyLength,sizeof (RequestedReplyLength), &ExtendedSetupInformation,sizeof (ExtendedSetupInformation)) - !=sizeof (ExtendedSetupInformation)) -return BusLogic_Failure (HostAdapter,"INQUIRE EXTENDED SETUP INFORMATION" ); + req_replylen =sizeof (ext_setupinfo); +if (blogic_cmd (adapter,BLOGIC_INQ_EXTSETUP , &req_replylen, +sizeof (req_replylen), &ext_setupinfo, +sizeof (ext_setupinfo)) !=sizeof (ext_setupinfo)) +return blogic_failure (adapter,"INQUIRE EXTENDED SETUP INFORMATION" );/* Issue the Inquire Firmware Version 3rd Digit command. */ - FirmwareVersion3rdDigit ='\0' ; -if (BoardID.FirmwareVersion1stDigit >'0' ) -if (BusLogic_Command (HostAdapter, BusLogic_InquireFirmwareVersion3rdDigit,NULL ,0 , &FirmwareVersion3rdDigit,sizeof (FirmwareVersion3rdDigit)) - !=sizeof (FirmwareVersion3rdDigit)) -return BusLogic_Failure (HostAdapter,"INQUIRE FIRMWARE 3RD DIGIT" ); + fw_ver_digit3 ='\0' ; +if (id.fw_ver_digit1 >'0' ) +if (blogic_cmd (adapter,BLOGIC_INQ_FWVER_D3 ,NULL ,0 , + &fw_ver_digit3, +sizeof (fw_ver_digit3)) !=sizeof (fw_ver_digit3)) +return blogic_failure (adapter,"INQUIRE FIRMWARE 3RD DIGIT" );/* Issue the Inquire Host Adapter Model Number command. */ -if (ExtendedSetupInformation.BusType =='A' && BoardID.FirmwareVersion1stDigit =='2' ) +if (ext_setupinfo.bus_type =='A' && id.fw_ver_digit1 =='2' )/* BusLogic BT-542B ISA 2.xx */ -strcpy (HostAdapterModelNumber,"542B" ); -else if (ExtendedSetupInformation.BusType =='E' && BoardID.FirmwareVersion1stDigit =='2' && (BoardID.FirmwareVersion2ndDigit <='1' || (BoardID.FirmwareVersion2ndDigit =='2' && FirmwareVersion3rdDigit =='0' ))) +strcpy (model,"542B" ); +else if (ext_setupinfo.bus_type =='E' && id.fw_ver_digit1 =='2' && + (id.fw_ver_digit2 <='1' || (id.fw_ver_digit2 =='2' && + fw_ver_digit3 =='0' )))/* BusLogic BT-742A EISA 2.1x or 2.20 */ -strcpy (HostAdapterModelNumber,"742A" ); -else if (ExtendedSetupInformation.BusType =='E' && BoardID.FirmwareVersion1stDigit =='0' ) +strcpy (model,"742A" ); +else if (ext_setupinfo.bus_type =='E' && id.fw_ver_digit1 =='0' )/* AMI FastDisk EISA Series 441 0.x */ -strcpy (HostAdapterModelNumber,"747A" ); +strcpy (model,"747A" );else { - RequestedReplyLength =sizeof (HostAdapterModelNumber); -if (BusLogic_Command (HostAdapter, BusLogic_InquireHostAdapterModelNumber, &RequestedReplyLength,sizeof (RequestedReplyLength), &HostAdapterModelNumber,sizeof (HostAdapterModelNumber)) - !=sizeof (HostAdapterModelNumber)) -return BusLogic_Failure (HostAdapter,"INQUIRE HOST ADAPTER MODEL NUMBER" ); + req_replylen =sizeof (model); +if (blogic_cmd (adapter,BLOGIC_INQ_MODELNO , &req_replylen, +sizeof (req_replylen), &model, +sizeof (model)) !=sizeof (model)) +return blogic_failure (adapter,"INQUIRE HOST ADAPTER MODEL NUMBER" ); }/* -BusLogic MultiMaster Host Adapters can be identified by their model number -and the major version number of their firmware as follows: +BusLogic MultiMaster Host Adapters can be identified by their +model number and the major version number of their firmware +as follows: 5.xx BusLogic "W" Series Host Adapters: BT-948/958/958D
@@ -1374,497 +1471,532 @@ static bool __init BusLogic_ReadHostAdapterConfiguration(struct BusLogic_HostAda0.xx AMI FastDisk VLB/EISA BusLogic Clone Host Adapter */ /* -Save the Model Name and Host Adapter Name in the Host Adapter structure. +Save the Model Name and Host Adapter Name in the Host Adapter +structure. */ - TargetPointer = HostAdapter->ModelName; - *TargetPointer++ ='B' ; - *TargetPointer++ ='T' ; - *TargetPointer++ ='-' ; -for (i =0 ; i <sizeof (HostAdapterModelNumber); i++) { - Character = HostAdapterModelNumber[i]; -if (Character ==' ' || Character =='\0' ) + tgt = adapter->model; + *tgt++ ='B' ; + *tgt++ ='T' ; + *tgt++ ='-' ; +for (i =0 ; i <sizeof (model); i++) { + ch = model[i]; +if (ch ==' ' || ch =='\0' )break ; - *TargetPointer++ = Character; + *tgt++ = ch; } - *TargetPointer++ ='\0' ; + *tgt++ ='\0' ;/* Save the Firmware Version in the Host Adapter structure. */ - TargetPointer = HostAdapter->FirmwareVersion; - *TargetPointer++ = BoardID.FirmwareVersion1stDigit; - *TargetPointer++ ='.' ; - *TargetPointer++ = BoardID.FirmwareVersion2ndDigit; -if (FirmwareVersion3rdDigit !=' ' && FirmwareVersion3rdDigit !='\0' ) - *TargetPointer++ = FirmwareVersion3rdDigit; - *TargetPointer ='\0' ; + tgt = adapter->fw_ver; + *tgt++ = id.fw_ver_digit1; + *tgt++ ='.' ; + *tgt++ = id.fw_ver_digit2; +if (fw_ver_digit3 !=' ' && fw_ver_digit3 !='\0' ) + *tgt++ = fw_ver_digit3; + *tgt ='\0' ;/* Issue the Inquire Firmware Version Letter command. */ -if (strcmp (HostAdapter->FirmwareVersion,"3.3" ) >=0 ) { -if (BusLogic_Command (HostAdapter, BusLogic_InquireFirmwareVersionLetter,NULL ,0 , &FirmwareVersionLetter,sizeof (FirmwareVersionLetter)) - !=sizeof (FirmwareVersionLetter)) -return BusLogic_Failure (HostAdapter,"INQUIRE FIRMWARE VERSION LETTER" ); -if (FirmwareVersionLetter !=' ' && FirmwareVersionLetter !='\0' ) - *TargetPointer++ = FirmwareVersionLetter; - *TargetPointer ='\0' ; +if (strcmp (adapter->fw_ver,"3.3" ) >=0 ) { +if (blogic_cmd (adapter,BLOGIC_INQ_FWVER_LETTER ,NULL ,0 , + &fw_ver_letter, +sizeof (fw_ver_letter)) !=sizeof (fw_ver_letter)) +return blogic_failure (adapter,"INQUIRE FIRMWARE VERSION LETTER" ); +if (fw_ver_letter !=' ' && fw_ver_letter !='\0' ) + *tgt++ = fw_ver_letter; + *tgt ='\0' ; }/* Save the Host Adapter SCSI ID in the Host Adapter structure. */ - HostAdapter->SCSI_ID = Configuration.HostAdapterID; -/* -Determine the Bus Type and save it in the Host Adapter structure, determine -and save the IRQ Channel if necessary, and determine and save the DMA -Channel for ISA Host Adapters. -*/ - HostAdapter->HostAdapterBusType = BusLogic_HostAdapterBusTypes[HostAdapter->ModelName[3 ] -'4' ]; -if (HostAdapter->IRQ_Channel ==0 ) { -if (Configuration.IRQ_Channel9) - HostAdapter->IRQ_Channel =9 ; -else if (Configuration.IRQ_Channel10) - HostAdapter->IRQ_Channel =10 ; -else if (Configuration.IRQ_Channel11) - HostAdapter->IRQ_Channel =11 ; -else if (Configuration.IRQ_Channel12) - HostAdapter->IRQ_Channel =12 ; -else if (Configuration.IRQ_Channel14) - HostAdapter->IRQ_Channel =14 ; -else if (Configuration.IRQ_Channel15) - HostAdapter->IRQ_Channel =15 ; - } -if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus) { -if (Configuration.DMA_Channel5) - HostAdapter->DMA_Channel =5 ; -else if (Configuration.DMA_Channel6) - HostAdapter->DMA_Channel =6 ; -else if (Configuration.DMA_Channel7) - HostAdapter->DMA_Channel =7 ; + adapter->scsi_id = config.id; +/* +Determine the Bus Type and save it in the Host Adapter structure, +determine and save the IRQ Channel if necessary, and determine +and save the DMA Channel for ISA Host Adapters. +*/ + adapter->adapter_bus_type = + blogic_adater_bus_types[adapter->model[3 ] -'4' ]; +if (adapter->irq_ch ==0 ) { +if (config.irq_ch9) + adapter->irq_ch =9 ; +else if (config.irq_ch10) + adapter->irq_ch =10 ; +else if (config.irq_ch11) + adapter->irq_ch =11 ; +else if (config.irq_ch12) + adapter->irq_ch =12 ; +else if (config.irq_ch14) + adapter->irq_ch =14 ; +else if (config.irq_ch15) + adapter->irq_ch =15 ; + } +if (adapter->adapter_bus_type ==BLOGIC_ISA_BUS ) { +if (config.dma_ch5) + adapter->dma_ch =5 ; +else if (config.dma_ch6) + adapter->dma_ch =6 ; +else if (config.dma_ch7) + adapter->dma_ch =7 ; }/* Determine whether Extended Translation is enabled and save it in the Host Adapter structure. */ - GeometryRegister.All =BusLogic_ReadGeometryRegister (HostAdapter); - HostAdapter->ExtendedTranslationEnabled = GeometryRegister.gr.ExtendedTranslationEnabled; + georeg.all =blogic_rdgeom (adapter); + adapter->ext_trans_enable = georeg.gr.ext_trans_enable;/* Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide SCSI flag, Differential SCSI flag, SCAM Supported flag, and Ultra SCSI flag in the Host Adapter structure. */ - HostAdapter->HostAdapterScatterGatherLimit = ExtendedSetupInformation.ScatterGatherLimit; - HostAdapter->DriverScatterGatherLimit = HostAdapter->HostAdapterScatterGatherLimit; -if (HostAdapter->HostAdapterScatterGatherLimit > BusLogic_ScatterGatherLimit) - HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit; -if (ExtendedSetupInformation.Misc.LevelSensitiveInterrupt) - HostAdapter->LevelSensitiveInterrupt = true; - HostAdapter->HostWideSCSI = ExtendedSetupInformation.HostWideSCSI; - HostAdapter->HostDifferentialSCSI = ExtendedSetupInformation.HostDifferentialSCSI; - HostAdapter->HostSupportsSCAM = ExtendedSetupInformation.HostSupportsSCAM; - HostAdapter->HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI; + adapter->adapter_sglimit = ext_setupinfo.sg_limit; + adapter->drvr_sglimit = adapter->adapter_sglimit; +if (adapter->adapter_sglimit >BLOGIC_SG_LIMIT ) + adapter->drvr_sglimit =BLOGIC_SG_LIMIT ; +if (ext_setupinfo.misc.level_int) + adapter->level_int = true; + adapter->wide = ext_setupinfo.wide; + adapter->differential = ext_setupinfo.differential; + adapter->scam = ext_setupinfo.scam; + adapter->ultra = ext_setupinfo.ultra;/* Determine whether Extended LUN Format CCBs are supported and save the information in the Host Adapter structure. */ -if (HostAdapter->FirmwareVersion[0 ] =='5' || (HostAdapter->FirmwareVersion[0 ] =='4' && HostAdapter->HostWideSCSI)) - HostAdapter->ExtendedLUNSupport = true; +if (adapter->fw_ver[0 ] =='5' || (adapter->fw_ver[0 ] =='4' && + adapter->wide)) + adapter->ext_lun = true;/* Issue the Inquire PCI Host Adapter Information command to read the Termination Information from "W" series MultiMaster Host Adapters. */ -if (HostAdapter->FirmwareVersion[0 ] =='5' ) { -if (BusLogic_Command (HostAdapter, BusLogic_InquirePCIHostAdapterInformation,NULL ,0 , &PCIHostAdapterInformation,sizeof (PCIHostAdapterInformation)) - !=sizeof (PCIHostAdapterInformation)) -return BusLogic_Failure (HostAdapter,"INQUIRE PCI HOST ADAPTER INFORMATION" ); +if (adapter->fw_ver[0 ] =='5' ) { +if (blogic_cmd (adapter,BLOGIC_INQ_PCI_INFO ,NULL ,0 , + &adapter_info, +sizeof (adapter_info)) !=sizeof (adapter_info)) +return blogic_failure (adapter,"INQUIRE PCI HOST ADAPTER INFORMATION" );/* -Save the Termination Information in the Host Adapter structure. +Save the Termination Information in the Host Adapter +structure. */ -if (PCIHostAdapterInformation.GenericInfoValid) { - HostAdapter->TerminationInfoValid = true; - HostAdapter->LowByteTerminated = PCIHostAdapterInformation.LowByteTerminated; - HostAdapter->HighByteTerminated = PCIHostAdapterInformation.HighByteTerminated; +if (adapter_info.genericinfo_valid) { + adapter->terminfo_valid = true; + adapter->low_term = adapter_info.low_term; + adapter->high_term = adapter_info.high_term; } }/* -Issue the Fetch Host Adapter Local RAM command to read the AutoSCSI data -from "W" and "C" series MultiMaster Host Adapters. +Issue the Fetch Host Adapter Local RAM command to read the +AutoSCSI data from "W" and "C" series MultiMaster Host Adapters. */ -if (HostAdapter->FirmwareVersion[0 ] >='4' ) { - FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_AutoSCSI_BaseOffset; - FetchHostAdapterLocalRAMRequest.ByteCount =sizeof (AutoSCSIData); -if (BusLogic_Command (HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest,sizeof (FetchHostAdapterLocalRAMRequest), &AutoSCSIData,sizeof (AutoSCSIData)) - !=sizeof (AutoSCSIData)) -return BusLogic_Failure (HostAdapter,"FETCH HOST ADAPTER LOCAL RAM" ); +if (adapter->fw_ver[0 ] >='4' ) { + fetch_localram.offset =BLOGIC_AUTOSCSI_BASE ; + fetch_localram.count =sizeof (autoscsi); +if (blogic_cmd (adapter,BLOGIC_FETCH_LOCALRAM , &fetch_localram, +sizeof (fetch_localram), &autoscsi, +sizeof (autoscsi)) !=sizeof (autoscsi)) +return blogic_failure (adapter,"FETCH HOST ADAPTER LOCAL RAM" );/* -Save the Parity Checking Enabled, Bus Reset Enabled, and Termination -Information in the Host Adapter structure. +Save the Parity Checking Enabled, Bus Reset Enabled, +and Termination Information in the Host Adapter structure. */ - HostAdapter->ParityCheckingEnabled = AutoSCSIData.ParityCheckingEnabled; - HostAdapter->BusResetEnabled = AutoSCSIData.BusResetEnabled; -if (HostAdapter->FirmwareVersion[0 ] =='4' ) { - HostAdapter->TerminationInfoValid = true; - HostAdapter->LowByteTerminated = AutoSCSIData.LowByteTerminated; - HostAdapter->HighByteTerminated = AutoSCSIData.HighByteTerminated; + adapter->parity = autoscsi.parity; + adapter->reset_enabled = autoscsi.reset_enabled; +if (adapter->fw_ver[0 ] =='4' ) { + adapter->terminfo_valid = true; + adapter->low_term = autoscsi.low_term; + adapter->high_term = autoscsi.high_term; }/* -Save the Wide Permitted, Fast Permitted, Synchronous Permitted, -Disconnect Permitted, Ultra Permitted, and SCAM Information in the -Host Adapter structure. +Save the Wide Permitted, Fast Permitted, Synchronous +Permitted, Disconnect Permitted, Ultra Permitted, and +SCAM Information in the Host Adapter structure. */ - HostAdapter->WidePermitted = AutoSCSIData.WidePermitted; - HostAdapter->FastPermitted = AutoSCSIData.FastPermitted; - HostAdapter->SynchronousPermitted = AutoSCSIData.SynchronousPermitted; - HostAdapter->DisconnectPermitted = AutoSCSIData.DisconnectPermitted; -if (HostAdapter->HostUltraSCSI) - HostAdapter->UltraPermitted = AutoSCSIData.UltraPermitted; -if (HostAdapter->HostSupportsSCAM) { - HostAdapter->SCAM_Enabled = AutoSCSIData.SCAM_Enabled; - HostAdapter->SCAM_Level2 = AutoSCSIData.SCAM_Level2; + adapter->wide_ok = autoscsi.wide_ok; + adapter->fast_ok = autoscsi.fast_ok; + adapter->sync_ok = autoscsi.sync_ok; + adapter->discon_ok = autoscsi.discon_ok; +if (adapter->ultra) + adapter->ultra_ok = autoscsi.ultra_ok; +if (adapter->scam) { + adapter->scam_enabled = autoscsi.scam_enabled; + adapter->scam_lev2 = autoscsi.scam_lev2; } }/* -Initialize fields in the Host Adapter structure for "S" and "A" series -MultiMaster Host Adapters. +Initialize fields in the Host Adapter structure for "S" and "A" +series MultiMaster Host Adapters. */ -if (HostAdapter->FirmwareVersion[0 ] <'4' ) { -if (SetupInformation.SynchronousInitiationEnabled) { - HostAdapter->SynchronousPermitted =0xFF ; -if (HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus) { -if (ExtendedSetupInformation.Misc.FastOnEISA) - HostAdapter->FastPermitted =0xFF ; -if (strcmp (HostAdapter->ModelName,"BT-757" ) ==0 ) - HostAdapter->WidePermitted =0xFF ; +if (adapter->fw_ver[0 ] <'4' ) { +if (setupinfo.sync) { + adapter->sync_ok =0xFF ; +if (adapter->adapter_bus_type ==BLOGIC_EISA_BUS ) { +if (ext_setupinfo.misc.fast_on_eisa) + adapter->fast_ok =0xFF ; +if (strcmp (adapter->model,"BT-757" ) ==0 ) + adapter->wide_ok =0xFF ; } } - HostAdapter->DisconnectPermitted =0xFF ; - HostAdapter->ParityCheckingEnabled = SetupInformation.ParityCheckingEnabled; - HostAdapter->BusResetEnabled = true; + adapter->discon_ok =0xFF ; + adapter->parity = setupinfo.parity; + adapter->reset_enabled = true; }/* -Determine the maximum number of Target IDs and Logical Units supported by -this driver for Wide and Narrow Host Adapters. +Determine the maximum number of Target IDs and Logical Units +supported by this driver for Wide and Narrow Host Adapters. */ - HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ?16 :8 ); - HostAdapter->MaxLogicalUnits = (HostAdapter->ExtendedLUNSupport ?32 :8 ); + adapter->maxdev = (adapter->wide ?16 :8 ); + adapter->maxlun = (adapter->ext_lun ?32 :8 );/* Select appropriate values for the Mailbox Count, Driver Queue Depth, -Initial CCBs, and Incremental CCBs variables based on whether or not Strict -Round Robin Mode is supported. If Strict Round Robin Mode is supported, -then there is no performance degradation in using the maximum possible -number of Outgoing and Incoming Mailboxes and allowing the Tagged and -Untagged Queue Depths to determine the actual utilization. If Strict Round -Robin Mode is not supported, then the Host Adapter must scan all the -Outgoing Mailboxes whenever an Outgoing Mailbox entry is made, which can -cause a substantial performance penalty. The host adapters actually have -room to store the following number of CCBs internally; that is, they can -internally queue and manage this many active commands on the SCSI bus -simultaneously. Performance measurements demonstrate that the Driver Queue -Depth should be set to the Mailbox Count, rather than the Host Adapter -Queue Depth (internal CCB capacity), as it is more efficient to have the -queued commands waiting in Outgoing Mailboxes if necessary than to block -the process in the higher levels of the SCSI Subsystem. +Initial CCBs, and Incremental CCBs variables based on whether +or not Strict Round Robin Mode is supported. If Strict Round +Robin Mode is supported, then there is no performance degradation +in using the maximum possible number of Outgoing and Incoming +Mailboxes and allowing the Tagged and Untagged Queue Depths to +determine the actual utilization. If Strict Round Robin Mode is +not supported, then the Host Adapter must scan all the Outgoing +Mailboxes whenever an Outgoing Mailbox entry is made, which can +cause a substantial performance penalty. The host adapters +actually have room to store the following number of CCBs +internally; that is, they can internally queue and manage this +many active commands on the SCSI bus simultaneously. Performance +measurements demonstrate that the Driver Queue Depth should be +set to the Mailbox Count, rather than the Host Adapter Queue +Depth (internal CCB capacity), as it is more efficient to have the +queued commands waiting in Outgoing Mailboxes if necessary than +to block the process in the higher levels of the SCSI Subsystem. 192 BT-948/958/958D 100 BT-946C/956C/956CD/747C/757C/757CD/445C 50 BT-545C/540CF 30 BT-747S/747D/757S/757D/445S/545S/542D/542B/742A */ -if (HostAdapter->FirmwareVersion[0 ] =='5' ) - HostAdapter->HostAdapterQueueDepth =192 ; -else if (HostAdapter->FirmwareVersion[0 ] =='4' ) - HostAdapter->HostAdapterQueueDepth = (HostAdapter->HostAdapterBusType != BusLogic_ISA_Bus ?100 :50 ); +if (adapter->fw_ver[0 ] =='5' ) + adapter->adapter_qdepth =192 ; +else if (adapter->fw_ver[0 ] =='4' ) + adapter->adapter_qdepth = (adapter->adapter_bus_type != +BLOGIC_ISA_BUS ?100 :50 );else - HostAdapter->HostAdapterQueueDepth =30 ; -if (strcmp (HostAdapter->FirmwareVersion,"3.31" ) >=0 ) { - HostAdapter->StrictRoundRobinModeSupport = true; - HostAdapter->MailboxCount = BusLogic_MaxMailboxes; + adapter->adapter_qdepth =30 ; +if (strcmp (adapter->fw_ver,"3.31" ) >=0 ) { + adapter->strict_rr = true; + adapter->mbox_count =BLOGIC_MAX_MAILBOX ; }else { - HostAdapter->StrictRoundRobinModeSupport = false; - HostAdapter->MailboxCount =32 ; + adapter->strict_rr = false; + adapter->mbox_count =32 ; } - HostAdapter->DriverQueueDepth = HostAdapter->MailboxCount; - HostAdapter->InitialCCBs =4 * BusLogic_CCB_AllocationGroupSize; - HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize; + adapter->drvr_qdepth = adapter->mbox_count; + adapter->initccbs =4 *BLOGIC_CCB_GRP_ALLOCSIZE ; + adapter->inc_ccbs =BLOGIC_CCB_GRP_ALLOCSIZE ;/* -Tagged Queuing support is available and operates properly on all "W" series -MultiMaster Host Adapters, on "C" series MultiMaster Host Adapters with -firmware version 4.22 and above, and on "S" series MultiMaster Host -Adapters with firmware version 3.35 and above. +Tagged Queuing support is available and operates properly on +all "W" series MultiMaster Host Adapters, on "C" series +MultiMaster Host Adapters with firmware version 4.22 and above, +and on "S" series MultiMaster Host Adapters with firmware version +3.35 and above. */ - HostAdapter->TaggedQueuingPermitted =0 ; -switch (HostAdapter->FirmwareVersion[0 ]) { + adapter->tagq_ok =0 ; +switch (adapter->fw_ver[0 ]) {case '5' : - HostAdapter->TaggedQueuingPermitted =0xFFFF ; + adapter->tagq_ok =0xFFFF ;break ;case '4' : -if (strcmp (HostAdapter->FirmwareVersion,"4.22" ) >=0 ) - HostAdapter->TaggedQueuingPermitted =0xFFFF ; +if (strcmp (adapter->fw_ver,"4.22" ) >=0 ) + adapter->tagq_ok =0xFFFF ;break ;case '3' : -if (strcmp (HostAdapter->FirmwareVersion,"3.35" ) >=0 ) - HostAdapter->TaggedQueuingPermitted =0xFFFF ; +if (strcmp (adapter->fw_ver,"3.35" ) >=0 ) + adapter->tagq_ok =0xFFFF ;break ; }/* Determine the Host Adapter BIOS Address if the BIOS is enabled and save it in the Host Adapter structure. The BIOS is disabled if the -BIOS_Address is 0. +bios_addr is 0. */ - HostAdapter->BIOS_Address = ExtendedSetupInformation.BIOS_Address <<12 ; + adapter->bios_addr = ext_setupinfo.bios_addr <<12 ;/* -ISA Host Adapters require Bounce Buffers if there is more than 16MB memory. +ISA Host Adapters require Bounce Buffers if there is more than +16MB memory. */ -if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus && (void *) high_memory > (void *)MAX_DMA_ADDRESS ) - HostAdapter->BounceBuffersRequired = true; +if (adapter->adapter_bus_type ==BLOGIC_ISA_BUS && + (void *) high_memory > (void *)MAX_DMA_ADDRESS ) + adapter->need_bouncebuf = true;/* -BusLogic BT-445S Host Adapters prior to board revision E have a hardware -bug whereby when the BIOS is enabled, transfers to/from the same address -range the BIOS occupies modulo 16MB are handled incorrectly. Only properly -functioning BT-445S Host Adapters have firmware version 3.37, so require -that ISA Bounce Buffers be used for the buggy BT-445S models if there is -more than 16MB memory. +BusLogic BT-445S Host Adapters prior to board revision E have a +hardware bug whereby when the BIOS is enabled, transfers to/from +the same address range the BIOS occupies modulo 16MB are handled +incorrectly. Only properly functioning BT-445S Host Adapters +have firmware version 3.37, so require that ISA Bounce Buffers +be used for the buggy BT-445S models if there is more than 16MB +memory. */ -if (HostAdapter->BIOS_Address >0 &&strcmp (HostAdapter->ModelName,"BT-445S" ) ==0 &&strcmp (HostAdapter->FirmwareVersion,"3.37" ) <0 && (void *) high_memory > (void *)MAX_DMA_ADDRESS ) - HostAdapter->BounceBuffersRequired = true; +if (adapter->bios_addr >0 &&strcmp (adapter->model,"BT-445S" ) ==0 && +strcmp (adapter->fw_ver,"3.37" ) <0 && + (void *) high_memory > (void *)MAX_DMA_ADDRESS ) + adapter->need_bouncebuf = true;/* -Initialize parameters common to MultiMaster and FlashPoint Host Adapters. +Initialize parameters common to MultiMaster and FlashPoint +Host Adapters. */ - Common: +common:/* Initialize the Host Adapter Full Model Name from the Model Name. */ -strcpy (HostAdapter->FullModelName,"BusLogic " ); -strcat (HostAdapter->FullModelName, HostAdapter->ModelName); +strcpy (adapter->full_model,"BusLogic " ); +strcat (adapter->full_model, adapter->model);/* Select an appropriate value for the Tagged Queue Depth either from a BusLogic Driver Options specification, or based on whether this Host -Adapter requires that ISA Bounce Buffers be used. The Tagged Queue Depth -is left at 0 for automatic determination in BusLogic_SelectQueueDepths. -Initialize the Untagged Queue Depth. -*/ -for (TargetID =0 ; TargetID < BusLogic_MaxTargetDevices; TargetID++) { -unsigned char QueueDepth =0 ; -if (HostAdapter->DriverOptions !=NULL && HostAdapter->DriverOptions->QueueDepth[TargetID] >0 ) - QueueDepth = HostAdapter->DriverOptions->QueueDepth[TargetID]; -else if (HostAdapter->BounceBuffersRequired) - QueueDepth = BusLogic_TaggedQueueDepthBB; - HostAdapter->QueueDepth[TargetID] = QueueDepth; - } -if (HostAdapter->BounceBuffersRequired) - HostAdapter->UntaggedQueueDepth = BusLogic_UntaggedQueueDepthBB; +Adapter requires that ISA Bounce Buffers be used. The Tagged Queue +Depth is left at 0 for automatic determination in +BusLogic_SelectQueueDepths. Initialize the Untagged Queue Depth. +*/ +for (tgt_id =0 ; tgt_id <BLOGIC_MAXDEV ; tgt_id++) { +unsigned char qdepth =0 ; +if (adapter->drvr_opts !=NULL && + adapter->drvr_opts->qdepth[tgt_id] >0 ) + qdepth = adapter->drvr_opts->qdepth[tgt_id]; +else if (adapter->need_bouncebuf) + qdepth =BLOGIC_TAG_DEPTH_BB ; + adapter->qdepth[tgt_id] = qdepth; + } +if (adapter->need_bouncebuf) + adapter->untag_qdepth =BLOGIC_UNTAG_DEPTH_BB ;else - HostAdapter->UntaggedQueueDepth = BusLogic_UntaggedQueueDepth; -if (HostAdapter->DriverOptions !=NULL ) - HostAdapter->CommonQueueDepth = HostAdapter->DriverOptions->CommonQueueDepth; -if (HostAdapter->CommonQueueDepth >0 && HostAdapter->CommonQueueDepth < HostAdapter->UntaggedQueueDepth) - HostAdapter->UntaggedQueueDepth = HostAdapter->CommonQueueDepth; + adapter->untag_qdepth =BLOGIC_UNTAG_DEPTH ; +if (adapter->drvr_opts !=NULL ) + adapter->common_qdepth = adapter->drvr_opts->common_qdepth; +if (adapter->common_qdepth >0 && + adapter->common_qdepth < adapter->untag_qdepth) + adapter->untag_qdepth = adapter->common_qdepth;/* Tagged Queuing is only allowed if Disconnect/Reconnect is permitted. Therefore, mask the Tagged Queuing Permitted Default bits with the Disconnect/Reconnect Permitted bits. */ - HostAdapter->TaggedQueuingPermitted &= HostAdapter->DisconnectPermitted; + adapter->tagq_ok &= adapter->discon_ok;/* -Combine the default Tagged Queuing Permitted bits with any BusLogic Driver -Options Tagged Queuing specification. +Combine the default Tagged Queuing Permitted bits with any +BusLogic Driver Options Tagged Queuing specification. */ -if (HostAdapter->DriverOptions !=NULL ) - HostAdapter->TaggedQueuingPermitted = - (HostAdapter->DriverOptions->TaggedQueuingPermitted & HostAdapter->DriverOptions->TaggedQueuingPermittedMask) | (HostAdapter->TaggedQueuingPermitted & ~HostAdapter->DriverOptions->TaggedQueuingPermittedMask); +if (adapter->drvr_opts !=NULL ) + adapter->tagq_ok = (adapter->drvr_opts->tagq_ok & + adapter->drvr_opts->tagq_ok_mask) | + (adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask);/* -Select an appropriate value for Bus Settle Time either from a BusLogic -Driver Options specification, or from BusLogic_DefaultBusSettleTime. +Select an appropriate value for Bus Settle Time either from a +BusLogic Driver Options specification, or from +BLOGIC_BUS_SETTLE_TIME. */ -if (HostAdapter->DriverOptions !=NULL && HostAdapter->DriverOptions->BusSettleTime >0 ) - HostAdapter->BusSettleTime = HostAdapter->DriverOptions->BusSettleTime; +if (adapter->drvr_opts !=NULL && + adapter->drvr_opts->bus_settle_time >0 ) + adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time;else - HostAdapter->BusSettleTime = BusLogic_DefaultBusSettleTime; + adapter->bus_settle_time =BLOGIC_BUS_SETTLE_TIME ;/* -Indicate reading the Host Adapter Configuration completed successfully. +Indicate reading the Host Adapter Configuration completed +successfully. */ return true; }/* -BusLogic_ReportHostAdapterConfiguration reports the configuration of -Host Adapter. +blogic_reportconfig reports the configuration of Host Adapter. */ -static bool __init BusLogic_ReportHostAdapterConfiguration (struct BusLogic_HostAdapter - *HostAdapter) +static bool __init blogic_reportconfig (struct blogic_adapter *adapter) { -unsigned short AllTargetsMask = (1 << HostAdapter->MaxTargetDevices) -1 ; -unsigned short SynchronousPermitted, FastPermitted; -unsigned short UltraPermitted, WidePermitted; -unsigned short DisconnectPermitted, TaggedQueuingPermitted; -bool CommonSynchronousNegotiation, CommonTaggedQueueDepth; -char SynchronousString[BusLogic_MaxTargetDevices +1 ]; -char WideString[BusLogic_MaxTargetDevices +1 ]; -char DisconnectString[BusLogic_MaxTargetDevices +1 ]; -char TaggedQueuingString[BusLogic_MaxTargetDevices +1 ]; -char *SynchronousMessage = SynchronousString; -char *WideMessage = WideString; -char *DisconnectMessage = DisconnectString; -char *TaggedQueuingMessage = TaggedQueuingString; -int TargetID; -BusLogic_Info ("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n" , - HostAdapter, HostAdapter->ModelName, - BusLogic_HostAdapterBusNames[HostAdapter->HostAdapterBusType], (HostAdapter->HostWideSCSI ?" Wide" :"" ), (HostAdapter->HostDifferentialSCSI ?" Differential" :"" ), (HostAdapter->HostUltraSCSI ?" Ultra" :"" )); -BusLogic_Info (" Firmware Version: %s, I/O Address: 0x%X, " "IRQ Channel: %d/%s\n" , HostAdapter, HostAdapter->FirmwareVersion, HostAdapter->IO_Address, HostAdapter->IRQ_Channel, (HostAdapter->LevelSensitiveInterrupt ?"Level" :"Edge" )); -if (HostAdapter->HostAdapterBusType != BusLogic_PCI_Bus) { -BusLogic_Info (" DMA Channel: " , HostAdapter); -if (HostAdapter->DMA_Channel >0 ) -BusLogic_Info ("%d, " , HostAdapter, HostAdapter->DMA_Channel); +unsigned short alltgt_mask = (1 << adapter->maxdev) -1 ; +unsigned short sync_ok, fast_ok; +unsigned short ultra_ok, wide_ok; +unsigned short discon_ok, tagq_ok; +bool common_syncneg, common_tagq_depth; +char syncstr[BLOGIC_MAXDEV +1 ]; +char widestr[BLOGIC_MAXDEV +1 ]; +char discon_str[BLOGIC_MAXDEV +1 ]; +char tagq_str[BLOGIC_MAXDEV +1 ]; +char *syncmsg = syncstr; +char *widemsg = widestr; +char *discon_msg = discon_str; +char *tagq_msg = tagq_str; +int tgt_id; + +blogic_info ("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n" , adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ?" Wide" :"" ), (adapter->differential ?" Differential" :"" ), (adapter->ultra ?" Ultra" :"" )); +blogic_info (" Firmware Version: %s, I/O Address: 0x%X, " "IRQ Channel: %d/%s\n" , adapter, adapter->fw_ver, adapter->io_addr, adapter->irq_ch, (adapter->level_int ?"Level" :"Edge" )); +if (adapter->adapter_bus_type !=BLOGIC_PCI_BUS ) { +blogic_info (" DMA Channel: " , adapter); +if (adapter->dma_ch >0 ) +blogic_info ("%d, " , adapter, adapter->dma_ch);else -BusLogic_Info ("None, " , HostAdapter); -if (HostAdapter->BIOS_Address >0 ) -BusLogic_Info ("BIOS Address: 0x%X, " , HostAdapter, HostAdapter->BIOS_Address); +blogic_info ("None, " , adapter); +if (adapter->bios_addr >0 ) +blogic_info ("BIOS Address: 0x%X, " , adapter, + adapter->bios_addr);else -BusLogic_Info ("BIOS Address: None, " , HostAdapter); +blogic_info ("BIOS Address: None, " , adapter); }else { -BusLogic_Info (" PCI Bus: %d, Device: %d, Address: " , HostAdapter, HostAdapter->Bus, HostAdapter->Device); -if (HostAdapter->PCI_Address >0 ) -BusLogic_Info ("0x%X, " , HostAdapter, HostAdapter->PCI_Address); +blogic_info (" PCI Bus: %d, Device: %d, Address: " , adapter, + adapter->bus, adapter->dev); +if (adapter->pci_addr >0 ) +blogic_info ("0x%X, " , adapter, adapter->pci_addr);else -BusLogic_Info ("Unassigned, " , HostAdapter); - } -BusLogic_Info ("Host Adapter SCSI ID: %d\n" , HostAdapter, HostAdapter->SCSI_ID); -BusLogic_Info (" Parity Checking: %s, Extended Translation: %s\n" , HostAdapter, (HostAdapter->ParityCheckingEnabled ?"Enabled" :"Disabled" ), (HostAdapter->ExtendedTranslationEnabled ?"Enabled" :"Disabled" )); - AllTargetsMask &= ~(1 << HostAdapter->SCSI_ID); - SynchronousPermitted = HostAdapter->SynchronousPermitted & AllTargetsMask; - FastPermitted = HostAdapter->FastPermitted & AllTargetsMask; - UltraPermitted = HostAdapter->UltraPermitted & AllTargetsMask; -if ((BusLogic_MultiMasterHostAdapterP (HostAdapter) && (HostAdapter->FirmwareVersion[0 ] >='4' || HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus)) ||BusLogic_FlashPointHostAdapterP (HostAdapter)) { - CommonSynchronousNegotiation = false; -if (SynchronousPermitted ==0 ) { - SynchronousMessage ="Disabled" ; - CommonSynchronousNegotiation = true; - }else if (SynchronousPermitted == AllTargetsMask) { -if (FastPermitted ==0 ) { - SynchronousMessage ="Slow" ; - CommonSynchronousNegotiation = true; - }else if (FastPermitted == AllTargetsMask) { -if (UltraPermitted ==0 ) { - SynchronousMessage ="Fast" ; - CommonSynchronousNegotiation = true; - }else if (UltraPermitted == AllTargetsMask) { - SynchronousMessage ="Ultra" ; - CommonSynchronousNegotiation = true; +blogic_info ("Unassigned, " , adapter); + } +blogic_info ("Host Adapter SCSI ID: %d\n" , adapter, adapter->scsi_id); +blogic_info (" Parity Checking: %s, Extended Translation: %s\n" , + adapter, (adapter->parity ?"Enabled" :"Disabled" ), + (adapter->ext_trans_enable ?"Enabled" :"Disabled" )); + alltgt_mask &= ~(1 << adapter->scsi_id); + sync_ok = adapter->sync_ok & alltgt_mask; + fast_ok = adapter->fast_ok & alltgt_mask; + ultra_ok = adapter->ultra_ok & alltgt_mask; +if ((blogic_multimaster_type (adapter) && + (adapter->fw_ver[0 ] >='4' || + adapter->adapter_bus_type ==BLOGIC_EISA_BUS )) || +blogic_flashpoint_type (adapter)) { + common_syncneg = false; +if (sync_ok ==0 ) { + syncmsg ="Disabled" ; + common_syncneg = true; + }else if (sync_ok == alltgt_mask) { +if (fast_ok ==0 ) { + syncmsg ="Slow" ; + common_syncneg = true; + }else if (fast_ok == alltgt_mask) { +if (ultra_ok ==0 ) { + syncmsg ="Fast" ; + common_syncneg = true; + }else if (ultra_ok == alltgt_mask) { + syncmsg ="Ultra" ; + common_syncneg = true; } } } -if (!CommonSynchronousNegotiation) { -for (TargetID =0 ; TargetID < HostAdapter->MaxTargetDevices; TargetID++) - SynchronousString[TargetID] = ((!(SynchronousPermitted & (1 << TargetID))) ?'N' : (!(FastPermitted & (1 << TargetID)) ?'S' : (!(UltraPermitted & (1 << TargetID)) ?'F' :'U' ))); - SynchronousString[HostAdapter->SCSI_ID] ='#' ; - SynchronousString[HostAdapter->MaxTargetDevices] ='\0' ; +if (!common_syncneg) { +for (tgt_id =0 ; tgt_id < adapter->maxdev; tgt_id++) + syncstr[tgt_id] = ((!(sync_ok & (1 << tgt_id))) ?'N' : (!(fast_ok & (1 << tgt_id)) ?'S' : (!(ultra_ok & (1 << tgt_id)) ?'F' :'U' ))); + syncstr[adapter->scsi_id] ='#' ; + syncstr[adapter->maxdev] ='\0' ; } }else - SynchronousMessage = (SynchronousPermitted ==0 ?"Disabled" :"Enabled" ); - WidePermitted = HostAdapter->WidePermitted & AllTargetsMask; -if (WidePermitted ==0 ) - WideMessage ="Disabled" ; -else if (WidePermitted == AllTargetsMask) - WideMessage ="Enabled" ; + syncmsg = (sync_ok ==0 ?"Disabled" :"Enabled" ); + wide_ok = adapter->wide_ok & alltgt_mask; +if (wide_ok ==0 ) + widemsg ="Disabled" ; +else if (wide_ok == alltgt_mask) + widemsg ="Enabled" ;else { -for (TargetID =0 ; TargetID < HostAdapter->MaxTargetDevices; TargetID++) - WideString[TargetID] = ((WidePermitted & (1 << TargetID)) ?'Y' :'N' ); - WideString[HostAdapter->SCSI_ID] ='#' ; - WideString[HostAdapter->MaxTargetDevices] ='\0' ; - } - DisconnectPermitted = HostAdapter->DisconnectPermitted & AllTargetsMask; -if (DisconnectPermitted ==0 ) - DisconnectMessage ="Disabled" ; -else if (DisconnectPermitted == AllTargetsMask) - DisconnectMessage ="Enabled" ; +for (tgt_id =0 ; tgt_id < adapter->maxdev; tgt_id++) + widestr[tgt_id] = ((wide_ok & (1 << tgt_id)) ?'Y' :'N' ); + widestr[adapter->scsi_id] ='#' ; + widestr[adapter->maxdev] ='\0' ; + } + discon_ok = adapter->discon_ok & alltgt_mask; +if (discon_ok ==0 ) + discon_msg ="Disabled" ; +else if (discon_ok == alltgt_mask) + discon_msg ="Enabled" ;else { -for (TargetID =0 ; TargetID < HostAdapter->MaxTargetDevices; TargetID++) - DisconnectString[TargetID] = ((DisconnectPermitted & (1 << TargetID)) ?'Y' :'N' ); - DisconnectString[HostAdapter->SCSI_ID] ='#' ; - DisconnectString[HostAdapter->MaxTargetDevices] ='\0' ; - } - TaggedQueuingPermitted = HostAdapter->TaggedQueuingPermitted & AllTargetsMask; -if (TaggedQueuingPermitted ==0 ) - TaggedQueuingMessage ="Disabled" ; -else if (TaggedQueuingPermitted == AllTargetsMask) - TaggedQueuingMessage ="Enabled" ; +for (tgt_id =0 ; tgt_id < adapter->maxdev; tgt_id++) + discon_str[tgt_id] = ((discon_ok & (1 << tgt_id)) ?'Y' :'N' ); + discon_str[adapter->scsi_id] ='#' ; + discon_str[adapter->maxdev] ='\0' ; + } + tagq_ok = adapter->tagq_ok & alltgt_mask; +if (tagq_ok ==0 ) + tagq_msg ="Disabled" ; +else if (tagq_ok == alltgt_mask) + tagq_msg ="Enabled" ;else { -for (TargetID =0 ; TargetID < HostAdapter->MaxTargetDevices; TargetID++) - TaggedQueuingString[TargetID] = ((TaggedQueuingPermitted & (1 << TargetID)) ?'Y' :'N' ); - TaggedQueuingString[HostAdapter->SCSI_ID] ='#' ; - TaggedQueuingString[HostAdapter->MaxTargetDevices] ='\0' ; - } -BusLogic_Info (" Synchronous Negotiation: %s, Wide Negotiation: %s\n" , HostAdapter, SynchronousMessage, WideMessage); -BusLogic_Info (" Disconnect/Reconnect: %s, Tagged Queuing: %s\n" , HostAdapter, DisconnectMessage, TaggedQueuingMessage); -if (BusLogic_MultiMasterHostAdapterP (HostAdapter)) { -BusLogic_Info (" Scatter/Gather Limit: %d of %d segments, " "Mailboxes: %d\n" , HostAdapter, HostAdapter->DriverScatterGatherLimit, HostAdapter->HostAdapterScatterGatherLimit, HostAdapter->MailboxCount); -BusLogic_Info (" Driver Queue Depth: %d, " "Host Adapter Queue Depth: %d\n" , HostAdapter, HostAdapter->DriverQueueDepth, HostAdapter->HostAdapterQueueDepth); +for (tgt_id =0 ; tgt_id < adapter->maxdev; tgt_id++) + tagq_str[tgt_id] = ((tagq_ok & (1 << tgt_id)) ?'Y' :'N' ); + tagq_str[adapter->scsi_id] ='#' ; + tagq_str[adapter->maxdev] ='\0' ; + } +blogic_info (" Synchronous Negotiation: %s, Wide Negotiation: %s\n" , + adapter, syncmsg, widemsg); +blogic_info (" Disconnect/Reconnect: %s, Tagged Queuing: %s\n" , adapter, + discon_msg, tagq_msg); +if (blogic_multimaster_type (adapter)) { +blogic_info (" Scatter/Gather Limit: %d of %d segments, " "Mailboxes: %d\n" , adapter, adapter->drvr_sglimit, adapter->adapter_sglimit, adapter->mbox_count); +blogic_info (" Driver Queue Depth: %d, " "Host Adapter Queue Depth: %d\n" , adapter, adapter->drvr_qdepth, adapter->adapter_qdepth); }else -BusLogic_Info (" Driver Queue Depth: %d, " "Scatter/Gather Limit: %d segments\n" , HostAdapter, HostAdapter->DriverQueueDepth, HostAdapter->DriverScatterGatherLimit); -BusLogic_Info (" Tagged Queue Depth: " , HostAdapter); - CommonTaggedQueueDepth = true; -for (TargetID =1 ; TargetID < HostAdapter->MaxTargetDevices; TargetID++) -if (HostAdapter->QueueDepth[TargetID] != HostAdapter->QueueDepth[0 ]) { - CommonTaggedQueueDepth = false; +blogic_info (" Driver Queue Depth: %d, " "Scatter/Gather Limit: %d segments\n" , adapter, adapter->drvr_qdepth, adapter->drvr_sglimit); +blogic_info (" Tagged Queue Depth: " , adapter); + common_tagq_depth = true; +for (tgt_id =1 ; tgt_id < adapter->maxdev; tgt_id++) +if (adapter->qdepth[tgt_id] != adapter->qdepth[0 ]) { + common_tagq_depth = false;break ; } -if (CommonTaggedQueueDepth) { -if (HostAdapter->QueueDepth[0 ] >0 ) -BusLogic_Info ("%d" , HostAdapter, HostAdapter->QueueDepth[0 ]); +if (common_tagq_depth) { +if (adapter->qdepth[0 ] >0 ) +blogic_info ("%d" , adapter, adapter->qdepth[0 ]);else -BusLogic_Info ("Automatic" , HostAdapter); +blogic_info ("Automatic" , adapter); }else -BusLogic_Info ("Individual" , HostAdapter); -BusLogic_Info (", Untagged Queue Depth: %d\n" , HostAdapter, HostAdapter->UntaggedQueueDepth); -if (HostAdapter->TerminationInfoValid) { -if (HostAdapter->HostWideSCSI) -BusLogic_Info (" SCSI Bus Termination: %s" , HostAdapter, (HostAdapter->LowByteTerminated ? (HostAdapter->HighByteTerminated ?"Both Enabled" :"Low Enabled" ) - : (HostAdapter->HighByteTerminated ?"High Enabled" :"Both Disabled" ))); +blogic_info ("Individual" , adapter); +blogic_info (", Untagged Queue Depth: %d\n" , adapter, + adapter->untag_qdepth); +if (adapter->terminfo_valid) { +if (adapter->wide) +blogic_info (" SCSI Bus Termination: %s" , adapter, + (adapter->low_term ? (adapter->high_term ?"Both Enabled" :"Low Enabled" ) : (adapter->high_term ?"High Enabled" :"Both Disabled" )));else -BusLogic_Info (" SCSI Bus Termination: %s" , HostAdapter, (HostAdapter->LowByteTerminated ?"Enabled" :"Disabled" )); -if (HostAdapter->HostSupportsSCAM) -BusLogic_Info (", SCAM: %s" , HostAdapter, (HostAdapter->SCAM_Enabled ? (HostAdapter->SCAM_Level2 ?"Enabled, Level 2" :"Enabled, Level 1" ) - :"Disabled" )); -BusLogic_Info ("\n" , HostAdapter); +blogic_info (" SCSI Bus Termination: %s" , adapter, + (adapter->low_term ?"Enabled" :"Disabled" )); +if (adapter->scam) +blogic_info (", SCAM: %s" , adapter, + (adapter->scam_enabled ? (adapter->scam_lev2 ?"Enabled, Level 2" :"Enabled, Level 1" ) :"Disabled" )); +blogic_info ("\n" , adapter); }/* -Indicate reporting the Host Adapter configuration completed successfully. +Indicate reporting the Host Adapter configuration completed +successfully. */ return true; }/* -BusLogic_AcquireResources acquires the system resources necessary to use +blogic_getres acquires the system resources necessary to use Host Adapter. */ -static bool __init BusLogic_AcquireResources (struct BusLogic_HostAdapter *HostAdapter) +static bool __init blogic_getres (struct blogic_adapter *adapter) { -if (HostAdapter->IRQ_Channel ==0 ) { -BusLogic_Error ("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n" , HostAdapter); +if (adapter->irq_ch ==0 ) { +blogic_err ("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n" , + adapter);return false; }/* Acquire shared access to the IRQ Channel. */ -if (request_irq (HostAdapter->IRQ_Channel, BusLogic_InterruptHandler,IRQF_SHARED , HostAdapter->FullModelName, HostAdapter) <0 ) { -BusLogic_Error ("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n" , HostAdapter, HostAdapter->IRQ_Channel); +if (request_irq (adapter->irq_ch, blogic_inthandler,IRQF_SHARED , + adapter->full_model, adapter) <0 ) { +blogic_err ("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n" , + adapter, adapter->irq_ch);return false; } - HostAdapter->IRQ_ChannelAcquired = true; + adapter->irq_acquired = true;/* Acquire exclusive access to the DMA Channel. */ -if (HostAdapter->DMA_Channel >0 ) { -if (request_dma (HostAdapter->DMA_Channel, HostAdapter->FullModelName) <0 ) { -BusLogic_Error ("UNABLE TO ACQUIRE DMA CHANNEL %d - DETACHING\n" , HostAdapter, HostAdapter->DMA_Channel); +if (adapter->dma_ch >0 ) {
Lines of this file are not shown. View the raw message.
drivers/scsi/BusLogic.h +726 -758
1,484 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.10.4
Part of the diff is not shown here. View the raw message.
PATCH 2/2 scsi: 64-bit port of buslogic driver
In reply to Khalid AzizPort buslogic driver to 64-bit.
--- drivers/scsi/BusLogic.c | 7 +- drivers/scsi/BusLogic.h | 43 ++-- drivers/scsi/FlashPoint.c | 618 +++++++++++++++++++++------------------------ drivers/scsi/Kconfig | 2 +- 4 files changed, 309 insertions(+), 361 deletions(-)
drivers/scsi/BusLogic.c +3 -4
@@ -1203,7 +1203,7 @@ static bool blogic_hwreset(struct blogic_adapter *adapter, bool hard_reset) fpinfo->report_underrun = true; adapter->cardhandle =FlashPoint_HardwareResetHostAdapter (fpinfo); -if (adapter->cardhandle ==FPOINT_BADCARD_HANDLE ) +if (adapter->cardhandle == (void *)FPOINT_BADCARD_HANDLE )return false;/* Indicate the Host Adapter Hard Reset completed successfully.
@@ -2360,8 +2360,7 @@ static int __init blogic_init(void)return -ENOMEM ; } - adapter = -kzalloc (sizeof (struct blogic_adapter ),GFP_KERNEL ); + adapter =kzalloc (sizeof (struct blogic_adapter ),GFP_KERNEL );if (adapter ==NULL ) {kfree (blogic_probeinfo_list);blogic_err ("BusLogic: Unable to allocate Prototype Host Adapter\n" ,NULL );
@@ -3069,7 +3068,7 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command,if (blogic_multimaster_type (adapter)) ccb->data = (unsigned int ) ccb->dma_handle + ((unsigned long ) &ccb->sglist - (unsigned long ) ccb);else - ccb->data =virt_to_32bit_virt (ccb->sglist); + ccb->data = ccb->sglist;scsi_for_each_sg (command, sg, count, i) { ccb->sglist[i].segbytes =sg_dma_len (sg);
drivers/scsi/BusLogic.h +23 -20
99 lines not on this page · raw message
drivers/scsi/FlashPoint.c +282 -336
1,450 lines not on this page · raw message
drivers/scsi/Kconfig +1 -1
@@ -633,7 +633,7 @@ config SCSI_BUSLOGIC config SCSI_FLASHPOINT bool "FlashPoint support" - depends on SCSI_BUSLOGIC && PCI && X86_32 + depends on SCSI_BUSLOGIC && PCI help This option allows you to add FlashPoint support to the BusLogic SCSI driver. The FlashPoint SCCB Manager code is
Signature · 1 line
1.7.10.4