summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhalid Aziz <khalid.aziz@oracle.com>2013-05-16 19:44:13 -0600
committerJames Bottomley <JBottomley@Parallels.com>2013-06-26 18:18:48 -0700
commit839cb99e8f748391059d10388c8aea48a88c142c (patch)
tree718db65aa0ac282e373739ab97a6b7fbc9216069
parent3b9373e95a6019cf89abe6c8b17c07828db96ad4 (diff)
[SCSI] BusLogic: Fix style issues
Fix CamelCase and extra long lines in the buslogic driver. Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/BusLogic.c4453
-rw-r--r--drivers/scsi/BusLogic.h1482
-rw-r--r--drivers/scsi/FlashPoint.c35
3 files changed, 3105 insertions, 2865 deletions
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 344d87599cd2..6ec36d83af6c 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -26,8 +26,8 @@
*/
-#define BusLogic_DriverVersion "2.1.16"
-#define BusLogic_DriverDate "18 July 2002"
+#define blogic_drvr_version "2.1.16"
+#define blogic_drvr_date "18 July 2002"
#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,251 @@ 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 " "<lnz@dandelion.com>\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 " "<lnz@dandelion.com>\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 +344,274 @@ 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--;
- }
- if (TimeoutCounter < 0) {
- BusLogic_CommandFailureReason = "Timeout waiting for Parameter Acceptance";
- Result = -2;
- goto Done;
- }
- /*
- The Modify I/O Address command does not cause a Command Complete Interrupt.
- */
- if (OperationCode == BusLogic_ModifyIOAddress) {
- StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
- if (StatusRegister.sr.CommandInvalid) {
- BusLogic_CommandFailureReason = "Modify I/O Address Invalid";
- Result = -1;
- goto Done;
+ blogic_setcmdparam(adapter, *param_p++);
+ paramlen--;
+ }
+ 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.
+ */
+ 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 +619,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 +655,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