29 #define BusLogic_DriverVersion "2.1.16"
30 #define BusLogic_DriverDate "18 July 2002"
32 #include <linux/module.h>
35 #include <linux/types.h>
40 #include <linux/stat.h>
41 #include <linux/pci.h>
45 #include <linux/slab.h>
51 #include <scsi/scsi.h>
71 static int BusLogic_DriverOptionsCount;
89 static char *BusLogic;
115 static int BusLogic_ProbeInfoCount;
134 static char *BusLogic_CommandFailureReason;
153 static const char *BusLogic_DriverInfo(
struct Scsi_Host *Host)
169 memset(BlockPointer, 0, BlockSize);
172 while ((BlockSize -=
sizeof(
struct BusLogic_CCB)) >= 0) {
202 if (BlockPointer ==
NULL) {
203 BusLogic_Error(
"UNABLE TO ALLOCATE CCB GROUP - DETACHING\n", HostAdapter);
206 BusLogic_InitializeCCBs(HostAdapter, BlockPointer, BlockSize, BlockPointerHandle);
221 while ((CCB = NextCCB) !=
NULL) {
241 static void BusLogic_CreateAdditionalCCBs(
struct BusLogic_HostAdapter *HostAdapter,
int AdditionalCCBs,
bool SuccessMessageP)
247 if (AdditionalCCBs <= 0)
249 while (HostAdapter->
AllocatedCCBs - PreviouslyAllocated < AdditionalCCBs) {
251 if (BlockPointer ==
NULL)
253 BusLogic_InitializeCCBs(HostAdapter, BlockPointer, BlockSize, BlockPointerHandle);
284 BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->
IncrementalCCBs,
true);
287 BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->
IncrementalCCBs,
true);
304 static void BusLogic_DeallocateCCB(
struct BusLogic_CCB *CCB)
339 unsigned char *ParameterPointer = (
unsigned char *) ParameterData;
340 unsigned char *ReplyPointer = (
unsigned char *) ReplyData;
343 unsigned long ProcessorFlags = 0;
344 int ReplyBytes = 0, Result;
350 memset(ReplyData, 0, ReplyLength);
363 TimeoutCounter = 10000;
364 while (--TimeoutCounter >= 0) {
370 if (TimeoutCounter < 0) {
371 BusLogic_CommandFailureReason =
"Timeout waiting for Host Adapter Ready";
379 BusLogic_WriteCommandParameterRegister(HostAdapter, OperationCode);
383 TimeoutCounter = 10000;
384 while (ParameterLength > 0 && --TimeoutCounter >= 0) {
398 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
400 if (InterruptRegister.ir.CommandComplete)
408 BusLogic_WriteCommandParameterRegister(HostAdapter, *ParameterPointer++);
411 if (TimeoutCounter < 0) {
412 BusLogic_CommandFailureReason =
"Timeout waiting for Parameter Acceptance";
422 BusLogic_CommandFailureReason =
"Modify I/O Address Invalid";
434 switch (OperationCode) {
439 TimeoutCounter = 60 * 10000;
443 TimeoutCounter = 10000;
451 while (--TimeoutCounter >= 0) {
452 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
454 if (InterruptRegister.ir.CommandComplete)
459 if (++ReplyBytes <= ReplyLength)
460 *ReplyPointer++ = BusLogic_ReadDataInRegister(HostAdapter);
462 BusLogic_ReadDataInRegister(HostAdapter);
468 if (TimeoutCounter < 0) {
469 BusLogic_CommandFailureReason =
"Timeout waiting for Command Complete";
476 BusLogic_InterruptReset(HostAdapter);
482 BusLogic_Notice(
"BusLogic_Command(%02X) Status = %02X: %2d ==> %2d:", HostAdapter, OperationCode,
StatusRegister.All, ReplyLength, ReplyBytes);
483 if (ReplyLength > ReplyBytes)
484 ReplyLength = ReplyBytes;
485 for (i = 0; i < ReplyLength; i++)
486 BusLogic_Notice(
" %02X", HostAdapter, ((
unsigned char *) ReplyData)[i]);
507 BusLogic_SoftReset(HostAdapter);
510 BusLogic_CommandFailureReason =
"Command Invalid";
517 if (ParameterLength > 0) {
518 BusLogic_CommandFailureReason =
"Excess Parameters Supplied";
525 BusLogic_CommandFailureReason =
NULL;
543 static void __init BusLogic_AppendProbeAddressISA(
unsigned long IO_Address)
548 ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++];
563 *PrototypeHostAdapter)
575 BusLogic_AppendProbeAddressISA(0x330);
577 BusLogic_AppendProbeAddressISA(0x334);
579 BusLogic_AppendProbeAddressISA(0x230);
581 BusLogic_AppendProbeAddressISA(0x234);
583 BusLogic_AppendProbeAddressISA(0x130);
585 BusLogic_AppendProbeAddressISA(0x134);
599 int LastInterchange = ProbeInfoCount - 1, Bound,
j;
600 while (LastInterchange > 0) {
601 Bound = LastInterchange;
603 for (j = 0; j < Bound; j++) {
606 if (ProbeInfo1->
Bus > ProbeInfo2->
Bus || (ProbeInfo1->
Bus == ProbeInfo2->
Bus && (ProbeInfo1->
Device > ProbeInfo2->
Device))) {
627 *PrototypeHostAdapter)
629 struct BusLogic_ProbeInfo *PrimaryProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount];
630 int NonPrimaryPCIMultiMasterIndex = BusLogic_ProbeInfoCount + 1;
631 int NonPrimaryPCIMultiMasterCount = 0, PCIMultiMasterCount = 0;
632 bool ForceBusDeviceScanningOrder =
false;
633 bool ForceBusDeviceScanningOrderChecked =
false;
634 bool StandardAddressSeen[6];
639 BusLogic_ProbeInfoCount++;
640 for (i = 0; i < 6; i++)
641 StandardAddressSeen[i] =
false;
661 unsigned int IRQ_Channel;
662 unsigned long BaseAddress0;
663 unsigned long BaseAddress1;
664 unsigned long IO_Address;
665 unsigned long PCI_Address;
673 Bus = PCI_Device->
bus->number;
674 Device = PCI_Device->
devfn >> 3;
675 IRQ_Channel = PCI_Device->
irq;
680 BusLogic_Error(
"BusLogic: Base Address0 0x%X not I/O for " "MultiMaster Host Adapter\n",
NULL, BaseAddress0);
681 BusLogic_Error(
"at PCI Bus %d Device %d I/O Address 0x%X\n",
NULL, Bus, Device, IO_Address);
685 BusLogic_Error(
"BusLogic: Base Address1 0x%X not Memory for " "MultiMaster Host Adapter\n",
NULL, BaseAddress1);
686 BusLogic_Error(
"at PCI Bus %d Device %d PCI Address 0x%X\n",
NULL, Bus, Device, PCI_Address);
689 if (IRQ_Channel == 0) {
690 BusLogic_Error(
"BusLogic: IRQ Channel %d invalid for " "MultiMaster Host Adapter\n",
NULL, IRQ_Channel);
691 BusLogic_Error(
"at PCI Bus %d Device %d I/O Address 0x%X\n",
NULL, Bus, Device, IO_Address);
696 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);
705 BusLogic_InterruptReset(HostAdapter);
707 ==
sizeof(PCIHostAdapterInformation)) {
708 if (PCIHostAdapterInformation.ISACompatibleIOPort < 6)
709 StandardAddressSeen[PCIHostAdapterInformation.ISACompatibleIOPort] =
true;
728 if (!ForceBusDeviceScanningOrderChecked) {
733 FetchHostAdapterLocalRAMRequest.ByteCount =
sizeof(AutoSCSIByte45);
734 BusLogic_Command(HostAdapter,
BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest,
sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIByte45,
sizeof(AutoSCSIByte45));
736 if (BoardID.FirmwareVersion1stDigit ==
'5')
737 ForceBusDeviceScanningOrder = AutoSCSIByte45.ForceBusDeviceScanningOrder;
738 ForceBusDeviceScanningOrderChecked =
true;
747 if (PCIHostAdapterInformation.ISACompatibleIOPort ==
BusLogic_IO_330) {
752 PrimaryProbeInfo->
Bus = Bus;
756 PCIMultiMasterCount++;
758 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++];
767 NonPrimaryPCIMultiMasterCount++;
768 PCIMultiMasterCount++;
782 if (ForceBusDeviceScanningOrder)
783 BusLogic_SortProbeInfo(&BusLogic_ProbeInfoList[NonPrimaryPCIMultiMasterIndex], NonPrimaryPCIMultiMasterCount);
802 if (!StandardAddressSeen[1] &&
805 BusLogic_AppendProbeAddressISA(0x334);
806 if (!StandardAddressSeen[2] &&
809 BusLogic_AppendProbeAddressISA(0x230);
810 if (!StandardAddressSeen[3] &&
813 BusLogic_AppendProbeAddressISA(0x234);
814 if (!StandardAddressSeen[4] &&
817 BusLogic_AppendProbeAddressISA(0x130);
818 if (!StandardAddressSeen[5] &&
821 BusLogic_AppendProbeAddressISA(0x134);
840 Bus = PCI_Device->
bus->number;
841 Device = PCI_Device->
devfn >> 3;
842 IRQ_Channel = PCI_Device->
irq;
845 if (IO_Address == 0 || IRQ_Channel == 0)
847 for (i = 0; i < BusLogic_ProbeInfoCount; i++) {
860 return PCIMultiMasterCount;
872 *PrototypeHostAdapter)
874 int FlashPointIndex = BusLogic_ProbeInfoCount, FlashPointCount = 0;
882 unsigned int IRQ_Channel;
883 unsigned long BaseAddress0;
884 unsigned long BaseAddress1;
885 unsigned long IO_Address;
886 unsigned long PCI_Address;
894 Bus = PCI_Device->
bus->number;
895 Device = PCI_Device->
devfn >> 3;
896 IRQ_Channel = PCI_Device->
irq;
899 #ifdef CONFIG_SCSI_FLASHPOINT
901 BusLogic_Error(
"BusLogic: Base Address0 0x%X not I/O for " "FlashPoint Host Adapter\n",
NULL, BaseAddress0);
902 BusLogic_Error(
"at PCI Bus %d Device %d I/O Address 0x%X\n",
NULL, Bus, Device, IO_Address);
906 BusLogic_Error(
"BusLogic: Base Address1 0x%X not Memory for " "FlashPoint Host Adapter\n",
NULL, BaseAddress1);
907 BusLogic_Error(
"at PCI Bus %d Device %d PCI Address 0x%X\n",
NULL, Bus, Device, PCI_Address);
910 if (IRQ_Channel == 0) {
911 BusLogic_Error(
"BusLogic: IRQ Channel %d invalid for " "FlashPoint Host Adapter\n",
NULL, IRQ_Channel);
912 BusLogic_Error(
"at PCI Bus %d Device %d I/O Address 0x%X\n",
NULL, Bus, Device, IO_Address);
917 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);
920 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++];
933 BusLogic_Error(
"BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n",
NULL, Bus, Device);
934 BusLogic_Error(
"BusLogic: I/O Address 0x%X PCI Address 0x%X, irq %d, " "but FlashPoint\n",
NULL, IO_Address, PCI_Address, IRQ_Channel);
935 BusLogic_Error(
"BusLogic: support was omitted in this kernel " "configuration.\n",
NULL);
943 BusLogic_SortProbeInfo(&BusLogic_ProbeInfoList[FlashPointIndex], FlashPointCount);
944 return FlashPointCount;
962 *PrototypeHostAdapter)
970 BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter);
971 BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter);
973 BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter);
974 BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter);
976 int FlashPointCount = BusLogic_InitializeFlashPointProbeInfo(PrototypeHostAdapter);
977 int PCIMultiMasterCount = BusLogic_InitializeMultiMasterProbeInfo(PrototypeHostAdapter);
978 if (FlashPointCount > 0 && PCIMultiMasterCount > 0) {
987 FetchHostAdapterLocalRAMRequest.ByteCount =
sizeof(Drive0MapByte);
988 BusLogic_Command(HostAdapter,
BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest,
sizeof(FetchHostAdapterLocalRAMRequest), &Drive0MapByte,
sizeof(Drive0MapByte));
997 int MultiMasterCount = BusLogic_ProbeInfoCount - FlashPointCount;
999 memcpy(&BusLogic_ProbeInfoList[0], &SavedProbeInfo[FlashPointCount], MultiMasterCount *
sizeof(
struct BusLogic_ProbeInfo));
1000 memcpy(&BusLogic_ProbeInfoList[MultiMasterCount], &SavedProbeInfo[0], FlashPointCount *
sizeof(
struct BusLogic_ProbeInfo));
1005 BusLogic_InitializeProbeInfoListISA(PrototypeHostAdapter);
1010 #define BusLogic_InitializeProbeInfoList(adapter) \
1011 BusLogic_InitializeProbeInfoListISA(adapter)
1021 BusLogic_AnnounceDriver(HostAdapter);
1023 BusLogic_Error(
"While configuring BusLogic PCI Host Adapter at\n", HostAdapter);
1026 BusLogic_Error(
"While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n", HostAdapter, HostAdapter->
IO_Address);
1027 BusLogic_Error(
"%s FAILED - DETACHING\n", HostAdapter, ErrorMessage);
1028 if (BusLogic_CommandFailureReason !=
NULL)
1029 BusLogic_Error(
"ADDITIONAL FAILURE INFO - %s\n", HostAdapter, BusLogic_CommandFailureReason);
1050 FlashPointInfo->
Present =
false;
1052 BusLogic_Error(
"BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", HostAdapter, HostAdapter->
Bus, HostAdapter->
Device);
1054 BusLogic_Error(
"BusLogic: Probe Function failed to validate it.\n", HostAdapter);
1072 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
1073 GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter);
1075 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);
1092 if (GeometryRegister.All == 0xFF)
1110 *HostAdapter,
bool HardReset)
1134 BusLogic_HardReset(HostAdapter);
1136 BusLogic_SoftReset(HostAdapter);
1140 TimeoutCounter = 5 * 10000;
1141 while (--TimeoutCounter >= 0) {
1149 if (TimeoutCounter < 0)
1160 TimeoutCounter = 10 * 10000;
1161 while (--TimeoutCounter >= 0) {
1169 if (TimeoutCounter < 0)
1175 TimeoutCounter = 10000;
1176 while (--TimeoutCounter >= 0) {
1184 if (TimeoutCounter < 0)
1192 BusLogic_CommandFailureReason =
NULL;
1193 BusLogic_Failure(HostAdapter,
"HARD RESET DIAGNOSTICS");
1196 unsigned char ErrorCode = BusLogic_ReadDataInRegister(HostAdapter);
1197 BusLogic_Error(
"HOST ADAPTER ERROR CODE = %d\n", HostAdapter, ErrorCode);
1216 unsigned char RequestedReplyLength;
1229 RequestedReplyLength =
sizeof(ExtendedSetupInformation);
1231 !=
sizeof(ExtendedSetupInformation))
1237 BusLogic_Notice(
"BusLogic_Check(0x%X): MultiMaster %s\n", HostAdapter, HostAdapter->
IO_Address, (Result ?
"Found" :
"Not Found"));
1254 unsigned char HostAdapterModelNumber[5];
1255 unsigned char FirmwareVersion3rdDigit;
1256 unsigned char FirmwareVersionLetter;
1261 unsigned char RequestedReplyLength;
1262 unsigned char *TargetPointer, Character;
1273 *TargetPointer++ =
'B';
1274 *TargetPointer++ =
'T';
1275 *TargetPointer++ =
'-';
1276 for (i = 0; i <
sizeof(FlashPointInfo->
ModelNumber); i++)
1277 *TargetPointer++ = FlashPointInfo->
ModelNumber[i];
1278 *TargetPointer++ =
'\0';
1314 return BusLogic_Failure(HostAdapter,
"INQUIRE BOARD ID");
1320 return BusLogic_Failure(HostAdapter,
"INQUIRE CONFIGURATION");
1324 RequestedReplyLength =
sizeof(SetupInformation);
1325 if (BusLogic_Command(HostAdapter,
BusLogic_InquireSetupInformation, &RequestedReplyLength,
sizeof(RequestedReplyLength), &SetupInformation,
sizeof(SetupInformation))
1326 !=
sizeof(SetupInformation))
1327 return BusLogic_Failure(HostAdapter,
"INQUIRE SETUP INFORMATION");
1331 RequestedReplyLength =
sizeof(ExtendedSetupInformation);
1333 !=
sizeof(ExtendedSetupInformation))
1334 return BusLogic_Failure(HostAdapter,
"INQUIRE EXTENDED SETUP INFORMATION");
1338 FirmwareVersion3rdDigit =
'\0';
1339 if (BoardID.FirmwareVersion1stDigit >
'0')
1341 !=
sizeof(FirmwareVersion3rdDigit))
1342 return BusLogic_Failure(HostAdapter,
"INQUIRE FIRMWARE 3RD DIGIT");
1346 if (ExtendedSetupInformation.BusType ==
'A' && BoardID.FirmwareVersion1stDigit ==
'2')
1348 strcpy(HostAdapterModelNumber,
"542B");
1349 else if (ExtendedSetupInformation.BusType ==
'E' && BoardID.FirmwareVersion1stDigit ==
'2' && (BoardID.FirmwareVersion2ndDigit <=
'1' || (BoardID.FirmwareVersion2ndDigit ==
'2' && FirmwareVersion3rdDigit ==
'0')))
1351 strcpy(HostAdapterModelNumber,
"742A");
1352 else if (ExtendedSetupInformation.BusType ==
'E' && BoardID.FirmwareVersion1stDigit ==
'0')
1354 strcpy(HostAdapterModelNumber,
"747A");
1356 RequestedReplyLength =
sizeof(HostAdapterModelNumber);
1358 !=
sizeof(HostAdapterModelNumber))
1359 return BusLogic_Failure(HostAdapter,
"INQUIRE HOST ADAPTER MODEL NUMBER");
1380 *TargetPointer++ =
'B';
1381 *TargetPointer++ =
'T';
1382 *TargetPointer++ =
'-';
1383 for (i = 0; i <
sizeof(HostAdapterModelNumber); i++) {
1384 Character = HostAdapterModelNumber[
i];
1385 if (Character ==
' ' || Character ==
'\0')
1387 *TargetPointer++ = Character;
1389 *TargetPointer++ =
'\0';
1394 *TargetPointer++ = BoardID.FirmwareVersion1stDigit;
1395 *TargetPointer++ =
'.';
1396 *TargetPointer++ = BoardID.FirmwareVersion2ndDigit;
1397 if (FirmwareVersion3rdDigit !=
' ' && FirmwareVersion3rdDigit !=
'\0')
1398 *TargetPointer++ = FirmwareVersion3rdDigit;
1399 *TargetPointer =
'\0';
1405 !=
sizeof(FirmwareVersionLetter))
1406 return BusLogic_Failure(HostAdapter,
"INQUIRE FIRMWARE VERSION LETTER");
1407 if (FirmwareVersionLetter !=
' ' && FirmwareVersionLetter !=
'\0')
1408 *TargetPointer++ = FirmwareVersionLetter;
1409 *TargetPointer =
'\0';
1447 GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter);
1458 if (ExtendedSetupInformation.Misc.LevelSensitiveInterrupt)
1460 HostAdapter->
HostWideSCSI = ExtendedSetupInformation.HostWideSCSI;
1463 HostAdapter->
HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI;
1476 !=
sizeof(PCIHostAdapterInformation))
1477 return BusLogic_Failure(HostAdapter,
"INQUIRE PCI HOST ADAPTER INFORMATION");
1481 if (PCIHostAdapterInformation.GenericInfoValid) {
1493 FetchHostAdapterLocalRAMRequest.ByteCount =
sizeof(AutoSCSIData);
1494 if (BusLogic_Command(HostAdapter,
BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest,
sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIData,
sizeof(AutoSCSIData))
1495 !=
sizeof(AutoSCSIData))
1496 return BusLogic_Failure(HostAdapter,
"FETCH HOST ADAPTER LOCAL RAM");
1521 HostAdapter->
SCAM_Level2 = AutoSCSIData.SCAM_Level2;
1529 if (SetupInformation.SynchronousInitiationEnabled) {
1532 if (ExtendedSetupInformation.Misc.FastOnEISA)
1612 HostAdapter->
BIOS_Address = ExtendedSetupInformation.BIOS_Address << 12;
1645 unsigned char QueueDepth = 0;
1701 bool CommonSynchronousNegotiation, CommonTaggedQueueDepth;
1702 char SynchronousString[BusLogic_MaxTargetDevices + 1];
1703 char WideString[BusLogic_MaxTargetDevices + 1];
1704 char DisconnectString[BusLogic_MaxTargetDevices + 1];
1705 char TaggedQueuingString[BusLogic_MaxTargetDevices + 1];
1706 char *SynchronousMessage = SynchronousString;
1707 char *WideMessage = WideString;
1708 char *DisconnectMessage = DisconnectString;
1709 char *TaggedQueuingMessage = TaggedQueuingString;
1711 BusLogic_Info(
"Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n",
1726 BusLogic_Info(
" PCI Bus: %d, Device: %d, Address: ", HostAdapter, HostAdapter->
Bus, HostAdapter->
Device);
1734 AllTargetsMask &= ~(1 << HostAdapter->
SCSI_ID);
1736 FastPermitted = HostAdapter->
FastPermitted & AllTargetsMask;
1739 CommonSynchronousNegotiation =
false;
1740 if (SynchronousPermitted == 0) {
1741 SynchronousMessage =
"Disabled";
1742 CommonSynchronousNegotiation =
true;
1743 }
else if (SynchronousPermitted == AllTargetsMask) {
1744 if (FastPermitted == 0) {
1745 SynchronousMessage =
"Slow";
1746 CommonSynchronousNegotiation =
true;
1747 }
else if (FastPermitted == AllTargetsMask) {
1748 if (UltraPermitted == 0) {
1749 SynchronousMessage =
"Fast";
1750 CommonSynchronousNegotiation =
true;
1751 }
else if (UltraPermitted == AllTargetsMask) {
1752 SynchronousMessage =
"Ultra";
1753 CommonSynchronousNegotiation =
true;
1757 if (!CommonSynchronousNegotiation) {
1759 SynchronousString[TargetID] = ((!(SynchronousPermitted & (1 << TargetID))) ?
'N' : (!(FastPermitted & (1 <<
TargetID)) ?
'S' : (!(UltraPermitted & (1 <<
TargetID)) ?
'F' :
'U')));
1760 SynchronousString[HostAdapter->
SCSI_ID] =
'#';
1764 SynchronousMessage = (SynchronousPermitted == 0 ?
"Disabled" :
"Enabled");
1765 WidePermitted = HostAdapter->
WidePermitted & AllTargetsMask;
1766 if (WidePermitted == 0)
1767 WideMessage =
"Disabled";
1768 else if (WidePermitted == AllTargetsMask)
1769 WideMessage =
"Enabled";
1772 WideString[TargetID] = ((WidePermitted & (1 << TargetID)) ?
'Y' :
'N');
1773 WideString[HostAdapter->
SCSI_ID] =
'#';
1777 if (DisconnectPermitted == 0)
1778 DisconnectMessage =
"Disabled";
1779 else if (DisconnectPermitted == AllTargetsMask)
1780 DisconnectMessage =
"Enabled";
1783 DisconnectString[TargetID] = ((DisconnectPermitted & (1 << TargetID)) ?
'Y' :
'N');
1784 DisconnectString[HostAdapter->
SCSI_ID] =
'#';
1788 if (TaggedQueuingPermitted == 0)
1789 TaggedQueuingMessage =
"Disabled";
1790 else if (TaggedQueuingPermitted == AllTargetsMask)
1791 TaggedQueuingMessage =
"Enabled";
1794 TaggedQueuingString[TargetID] = ((TaggedQueuingPermitted & (1 << TargetID)) ?
'Y' :
'N');
1795 TaggedQueuingString[HostAdapter->
SCSI_ID] =
'#';
1798 BusLogic_Info(
" Synchronous Negotiation: %s, Wide Negotiation: %s\n", HostAdapter, SynchronousMessage, WideMessage);
1799 BusLogic_Info(
" Disconnect/Reconnect: %s, Tagged Queuing: %s\n", HostAdapter, DisconnectMessage, TaggedQueuingMessage);
1806 CommonTaggedQueueDepth =
true;
1809 CommonTaggedQueueDepth =
false;
1812 if (CommonTaggedQueueDepth) {
1846 BusLogic_Error(
"NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n", HostAdapter);
1947 return BusLogic_Failure(HostAdapter,
"MAILBOX ALLOCATION");
1963 ExtendedMailboxRequest.MailboxCount = HostAdapter->
MailboxCount;
1966 return BusLogic_Failure(HostAdapter,
"MAILBOX INITIALIZATION");
1977 return BusLogic_Failure(HostAdapter,
"ENABLE STRICT ROUND ROBIN MODE");
1985 if (BusLogic_Command(HostAdapter,
BusLogic_SetCCBFormat, &SetCCBFormatRequest,
sizeof(SetCCBFormatRequest),
NULL, 0) < 0)
1986 return BusLogic_Failure(HostAdapter,
"SET CCB FORMAT");
2013 u16 InstalledDevices;
2014 u8 InstalledDevicesID0to7[8];
2017 unsigned char RequestedReplyLength;
2055 !=
sizeof(InstalledDevices))
2056 return BusLogic_Failure(HostAdapter,
"INQUIRE TARGET DEVICES");
2058 HostAdapter->
TargetFlags[TargetID].TargetExists = (InstalledDevices & (1 << TargetID) ?
true :
false);
2068 !=
sizeof(InstalledDevicesID0to7))
2069 return BusLogic_Failure(HostAdapter,
"INQUIRE INSTALLED DEVICES ID 0 TO 7");
2070 for (TargetID = 0; TargetID < 8; TargetID++)
2071 HostAdapter->
TargetFlags[TargetID].TargetExists = (InstalledDevicesID0to7[TargetID] != 0 ?
true :
false);
2076 RequestedReplyLength =
sizeof(SetupInformation);
2077 if (BusLogic_Command(HostAdapter,
BusLogic_InquireSetupInformation, &RequestedReplyLength,
sizeof(RequestedReplyLength), &SetupInformation,
sizeof(SetupInformation))
2078 !=
sizeof(SetupInformation))
2079 return BusLogic_Failure(HostAdapter,
"INQUIRE SETUP INFORMATION");
2081 HostAdapter->
SynchronousOffset[TargetID] = (TargetID < 8 ? SetupInformation.SynchronousValuesID0to7[TargetID].Offset : SetupInformation.SynchronousValuesID8to15[TargetID - 8].Offset);
2084 HostAdapter->
TargetFlags[TargetID].WideTransfersActive = (TargetID < 8 ? (SetupInformation.WideTransfersActiveID0to7 & (1 << TargetID)
2086 : (SetupInformation.WideTransfersActiveID8to15 & (1 << (TargetID - 8))
2098 RequestedReplyLength =
sizeof(SynchronousPeriod);
2099 if (BusLogic_Command(HostAdapter,
BusLogic_InquireSynchronousPeriod, &RequestedReplyLength,
sizeof(RequestedReplyLength), &SynchronousPeriod,
sizeof(SynchronousPeriod))
2100 !=
sizeof(SynchronousPeriod))
2101 return BusLogic_Failure(HostAdapter,
"INQUIRE SYNCHRONOUS PERIOD");
2106 if (SetupInformation.SynchronousValuesID0to7[TargetID].Offset > 0)
2146 static int BusLogic_SlaveConfigure(
struct scsi_device *Device)
2149 int TargetID = Device->
id;
2150 int QueueDepth = HostAdapter->
QueueDepth[TargetID];
2153 if (QueueDepth == 0)
2165 if (HostAdapter->
TargetFlags[TargetID].TargetExists) {
2169 BusLogic_CreateAdditionalCCBs(HostAdapter, QueueDepth - HostAdapter->
AllocatedCCBs,
false);
2181 static int __init BusLogic_init(
void)
2183 int BusLogicHostAdapterCount = 0, DriverOptionsIndex = 0, ProbeIndex;
2189 BusLogic_Setup(BusLogic);
2194 BusLogic_ProbeInfoList =
2196 if (BusLogic_ProbeInfoList ==
NULL) {
2201 PrototypeHostAdapter =
2203 if (PrototypeHostAdapter ==
NULL) {
2204 kfree(BusLogic_ProbeInfoList);
2210 if (BusLogic !=
NULL)
2211 BusLogic_Setup(BusLogic);
2214 for (ProbeIndex = 0; ProbeIndex < BusLogic_ProbeInfoCount; ProbeIndex++) {
2225 HostAdapter->
Bus = ProbeInfo->
Bus;
2240 if (!BusLogic_ProbeHostAdapter(HostAdapter)) {
2248 if (!BusLogic_HardwareResetHostAdapter(HostAdapter,
true)) {
2255 if (!BusLogic_CheckHostAdapter(HostAdapter)) {
2262 if (DriverOptionsIndex < BusLogic_DriverOptionsCount)
2268 BusLogic_AnnounceDriver(HostAdapter);
2300 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) &&
2301 BusLogic_ReportHostAdapterConfiguration(HostAdapter) &&
2302 BusLogic_AcquireResources(HostAdapter) &&
2303 BusLogic_CreateInitialCCBs(HostAdapter) &&
2304 BusLogic_InitializeHostAdapter(HostAdapter) &&
2305 BusLogic_TargetDeviceInquiry(HostAdapter)) {
2318 "BusLogic: Release and re-register of "
2319 "port 0x%04lx failed \n",
2321 BusLogic_DestroyCCBs(HostAdapter);
2322 BusLogic_ReleaseResources(HostAdapter);
2327 BusLogic_InitializeHostStructure(HostAdapter,
2329 if (scsi_add_host(Host, HostAdapter->
PCI_Device
2333 "BusLogic: scsi_add_host()"
2335 BusLogic_DestroyCCBs(HostAdapter);
2336 BusLogic_ReleaseResources(HostAdapter);
2342 BusLogicHostAdapterCount++;
2354 BusLogic_DestroyCCBs(HostAdapter);
2355 BusLogic_ReleaseResources(HostAdapter);
2361 kfree(PrototypeHostAdapter);
2362 kfree(BusLogic_ProbeInfoList);
2363 BusLogic_ProbeInfoList =
NULL;
2390 BusLogic_DestroyCCBs(HostAdapter);
2391 BusLogic_ReleaseResources(HostAdapter);
2410 static void BusLogic_QueueCompletedCCB(
struct BusLogic_CCB *CCB)
2434 switch (HostAdapterStatus) {
2446 BusLogic_Warning(
"BusLogic Driver Protocol Error 0x%02X\n", HostAdapter, HostAdapterStatus);
2470 BusLogic_Warning(
"Unknown Host Adapter Status 0x%02X\n", HostAdapter, HostAdapterStatus);
2474 return (HostStatus << 16) | TargetDeviceStatus;
2515 BusLogic_QueueCompletedCCB(CCB);
2557 BusLogic_IncrementErrorCounter(&HostAdapter->
TargetStatistics[TargetID].BusDeviceResetsCompleted);
2564 BusLogic_DeallocateCCB(CCB);
2573 while (Command !=
NULL) {
2574 struct scsi_cmnd *NextCommand = Command->reset_chain;
2575 Command->reset_chain =
NULL;
2578 Command = NextCommand;
2588 BusLogic_DeallocateCCB(CCB);
2607 .CommandsCompleted++;
2609 .CommandSuccessfulFlag =
true;
2615 .CommandAbortsCompleted);
2622 .CommandsCompleted++;
2655 BusLogic_DeallocateCCB(CCB);
2671 static irqreturn_t BusLogic_InterruptHandler(
int IRQ_Channel,
void *DeviceIdentifier)
2674 unsigned long ProcessorFlags;
2687 InterruptRegister.
All = BusLogic_ReadInterruptRegister(HostAdapter);
2688 if (InterruptRegister.ir.InterruptValid) {
2693 BusLogic_InterruptReset(HostAdapter);
2700 if (InterruptRegister.ir.ExternalBusReset)
2702 else if (InterruptRegister.ir.IncomingMailboxLoaded)
2703 BusLogic_ScanIncomingMailboxes(HostAdapter);
2704 else if (InterruptRegister.ir.CommandComplete)
2719 BusLogic_Warning(
"Internal FlashPoint Error detected" " - Resetting Host Adapter\n", HostAdapter);
2728 BusLogic_ProcessCompletedCCBs(HostAdapter);
2735 BusLogic_ResetHostAdapter(HostAdapter,
false);
2740 BusLogic_ResetHostAdapter(HostAdapter,
true);
2746 spin_unlock_irqrestore(HostAdapter->
SCSI_Host->host_lock, ProcessorFlags);
2771 BusLogic_StartMailboxCommand(HostAdapter);
2787 static int BusLogic_host_reset(
struct scsi_cmnd * SCpnt)
2791 unsigned int id = SCpnt->
device->id;
2795 spin_lock_irq(SCpnt->
device->host->host_lock);
2797 BusLogic_IncrementErrorCounter(&
stats->HostAdapterResetsRequested);
2799 rc = BusLogic_ResetHostAdapter(HostAdapter,
false);
2800 spin_unlock_irq(SCpnt->
device->host->host_lock);
2809 static int BusLogic_QueueCommand_lck(
struct scsi_cmnd *Command,
void (*CompletionRoutine) (
struct scsi_cmnd *))
2814 unsigned char *CDB = Command->
cmnd;
2815 int CDB_Length = Command->
cmd_len;
2816 int TargetID = Command->
device->id;
2818 int BufferLength = scsi_bufflen(Command);
2828 CompletionRoutine(Command);
2837 CCB = BusLogic_AllocateCCB(HostAdapter);
2839 spin_unlock_irq(HostAdapter->
SCSI_Host->host_lock);
2841 spin_lock_irq(HostAdapter->
SCSI_Host->host_lock);
2842 CCB = BusLogic_AllocateCCB(HostAdapter);
2845 CompletionRoutine(Command);
2864 CCB->DataPointer = Virtual_to_32Bit_Virtual(CCB->ScatterGatherList);
2867 CCB->ScatterGatherList[
i].SegmentByteCount =
2869 CCB->ScatterGatherList[
i].SegmentDataPointer =
2872 }
else if (!Count) {
2882 TargetStatistics[
TargetID].ReadCommands++;
2883 BusLogic_IncrementByteCounter(&TargetStatistics[TargetID].TotalBytesRead, BufferLength);
2884 BusLogic_IncrementSizeBucket(TargetStatistics[TargetID].ReadCommandSizeBuckets, BufferLength);
2889 TargetStatistics[
TargetID].WriteCommands++;
2890 BusLogic_IncrementByteCounter(&TargetStatistics[TargetID].TotalBytesWritten, BufferLength);
2891 BusLogic_IncrementSizeBucket(TargetStatistics[TargetID].WriteCommandSizeBuckets, BufferLength);
2920 TargetFlags->TaggedQueuingActive =
true;
2921 BusLogic_Notice(
"Tagged Queuing now active for Target %d\n", HostAdapter, TargetID);
2923 if (TargetFlags->TaggedQueuingActive) {
2946 CCB->QueueTag = QueueTag;
2949 CCB->LegacyQueueTag = QueueTag;
2967 spin_unlock_irq(HostAdapter->
SCSI_Host->host_lock);
2968 BusLogic_Warning(
"Unable to write Outgoing Mailbox - " "Pausing for 1 second\n", HostAdapter);
2970 spin_lock_irq(HostAdapter->
SCSI_Host->host_lock);
2972 BusLogic_Warning(
"Still unable to write Outgoing Mailbox - " "Host Adapter Dead?\n", HostAdapter);
2973 BusLogic_DeallocateCCB(CCB);
2984 TargetStatistics[
TargetID].CommandsAttempted++;
2991 BusLogic_ProcessCompletedCCBs(HostAdapter);
3003 static int BusLogic_AbortCommand(
struct scsi_cmnd *Command)
3007 int TargetID = Command->
device->id;
3009 BusLogic_IncrementErrorCounter(&HostAdapter->
TargetStatistics[TargetID].CommandAbortsRequested);
3018 BusLogic_Warning(
"Unable to Abort Command to Target %d - " "No CCB Found\n", HostAdapter, TargetID);
3021 BusLogic_Warning(
"Unable to Abort Command to Target %d - " "CCB Completed\n", HostAdapter, TargetID);
3024 BusLogic_Warning(
"Unable to Abort Command to Target %d - " "CCB Reset\n", HostAdapter, TargetID);
3043 BusLogic_IncrementErrorCounter(&HostAdapter->
TargetStatistics[TargetID].CommandAbortsAttempted);
3054 BusLogic_IncrementErrorCounter(&HostAdapter->
TargetStatistics[TargetID].CommandAbortsAttempted);
3062 BusLogic_ProcessCompletedCCBs(HostAdapter);
3084 if (!(BusLogic_HardwareResetHostAdapter(HostAdapter, HardReset) && BusLogic_InitializeHostAdapter(HostAdapter))) {
3095 BusLogic_DeallocateCCB(CCB);
3104 spin_unlock_irq(HostAdapter->
SCSI_Host->host_lock);
3106 spin_lock_irq(HostAdapter->
SCSI_Host->host_lock);
3139 if (capacity >= 4 * 1024 * 1024 ) {
3140 DiskParameters->Heads = 255;
3141 DiskParameters->Sectors = 63;
3143 DiskParameters->Heads = 128;
3144 DiskParameters->Sectors = 32;
3147 DiskParameters->Heads = 64;
3148 DiskParameters->Sectors = 32;
3150 DiskParameters->Cylinders = (
unsigned long) capacity / (DiskParameters->Heads * DiskParameters->Sectors);
3159 if (*(
unsigned short *) (buf + 64) == 0xAA55) {
3161 struct partition *PartitionEntry = FirstPartitionEntry;
3162 int SavedCylinders = DiskParameters->Cylinders, PartitionNumber;
3163 unsigned char PartitionEntryEndHead = 0, PartitionEntryEndSector = 0;
3164 for (PartitionNumber = 0; PartitionNumber < 4; PartitionNumber++) {
3165 PartitionEntryEndHead = PartitionEntry->end_head;
3166 PartitionEntryEndSector = PartitionEntry->end_sector & 0x3F;
3167 if (PartitionEntryEndHead == 64 - 1) {
3168 DiskParameters->Heads = 64;
3169 DiskParameters->Sectors = 32;
3171 }
else if (PartitionEntryEndHead == 128 - 1) {
3172 DiskParameters->Heads = 128;
3173 DiskParameters->Sectors = 32;
3175 }
else if (PartitionEntryEndHead == 255 - 1) {
3176 DiskParameters->Heads = 255;
3177 DiskParameters->Sectors = 63;
3182 if (PartitionNumber == 4) {
3183 PartitionEntryEndHead = FirstPartitionEntry->end_head;
3184 PartitionEntryEndSector = FirstPartitionEntry->end_sector & 0x3F;
3186 DiskParameters->Cylinders = (
unsigned long) capacity / (DiskParameters->Heads * DiskParameters->Sectors);
3187 if (PartitionNumber < 4 && PartitionEntryEndSector == DiskParameters->Sectors) {
3188 if (DiskParameters->Cylinders != SavedCylinders)
3189 BusLogic_Warning(
"Adopting Geometry %d/%d from Partition Table\n", HostAdapter, DiskParameters->Heads, DiskParameters->Sectors);
3190 }
else if (PartitionEntryEndHead > 0 || PartitionEntryEndSector > 0) {
3191 BusLogic_Warning(
"Warning: Partition Table appears to " "have Geometry %d/%d which is\n", HostAdapter, PartitionEntryEndHead + 1, PartitionEntryEndSector);
3192 BusLogic_Warning(
"not compatible with current BusLogic " "Host Adapter Geometry %d/%d\n", HostAdapter, DiskParameters->Heads, DiskParameters->Sectors);
3204 static int BusLogic_ProcDirectoryInfo(
struct Scsi_Host *
shost,
char *ProcBuffer,
char **StartPointer,
off_t Offset,
int BytesAvailable,
int WriteFlag)
3221 Current Driver Queue Depth: %d\n\
3224 DATA TRANSFER STATISTICS\n\
3226 Target Tagged Queuing Queue Depth Active Attempted Completed\n\
3227 ====== ============== =========== ====== ========= =========\n");
3233 ?
" Permitted" :
" Disabled"))
3234 :
"Not Supported"));
3235 Length +=
sprintf(&Buffer[Length],
3236 " %3d %3u %9u %9u\n", HostAdapter->
QueueDepth[TargetID], HostAdapter->
ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted);
3239 Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\
3240 ====== ============= ============== =================== ===================\n");
3245 Length +=
sprintf(&Buffer[
Length],
" %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands);
3246 if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0)
3247 Length +=
sprintf(&Buffer[
Length],
" %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units);
3249 Length +=
sprintf(&Buffer[
Length],
" %9u", TargetStatistics[TargetID].TotalBytesRead.Units);
3250 if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0)
3251 Length +=
sprintf(&Buffer[
Length],
" %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units);
3253 Length +=
sprintf(&Buffer[
Length],
" %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units);
3256 Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\
3257 ====== ======= ========= ========= ========= ========= =========\n");
3264 " %2d Read %9u %9u %9u %9u %9u\n", TargetID,
3265 TargetStatistics[TargetID].ReadCommandSizeBuckets[0],
3266 TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]);
3269 " %2d Write %9u %9u %9u %9u %9u\n", TargetID,
3270 TargetStatistics[TargetID].WriteCommandSizeBuckets[0],
3271 TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]);
3274 Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\
3275 ====== ======= ========= ========= ========= ========= =========\n");
3282 " %2d Read %9u %9u %9u %9u %9u\n", TargetID,
3283 TargetStatistics[TargetID].ReadCommandSizeBuckets[5],
3284 TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]);
3287 " %2d Write %9u %9u %9u %9u %9u\n", TargetID,
3288 TargetStatistics[TargetID].WriteCommandSizeBuckets[5],
3289 TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]);
3292 ERROR RECOVERY STATISTICS\n\
3294 Command Aborts Bus Device Resets Host Adapter Resets\n\
3295 Target Requested Completed Requested Completed Requested Completed\n\
3296 ID \\\\\\\\ Attempted //// \\\\\\\\ Attempted //// \\\\\\\\ Attempted ////\n\
3297 ====== ===== ===== ===== ===== ===== ===== ===== ===== =====\n");
3303 %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted);
3309 if ((
Length -= Offset) <= 0)
3311 if (
Length >= BytesAvailable)
3314 *StartPointer = ProcBuffer;
3326 static bool BeginningOfLine =
true;
3330 Length =
vsprintf(Buffer, Format, Arguments);
3333 static int AnnouncementLines = 0;
3336 if (++AnnouncementLines <= 2)
3337 printk(
"%sscsi: %s", BusLogic_MessageLevelMap[MessageLevel], Buffer);
3341 if (BeginningOfLine) {
3342 if (Buffer[0] !=
'\n' || Length > 1)
3343 printk(
"%sscsi%d: %s", BusLogic_MessageLevelMap[MessageLevel], HostAdapter->
HostNumber, Buffer);
3347 if (BeginningOfLine) {
3349 printk(
"%sscsi%d: %s", BusLogic_MessageLevelMap[MessageLevel], HostAdapter->
HostNumber, Buffer);
3351 printk(
"%s%s", BusLogic_MessageLevelMap[MessageLevel], Buffer);
3355 BeginningOfLine = (Buffer[Length - 1] ==
'\n');
3364 static bool __init BusLogic_ParseKeyword(
char **StringPointer,
char *Keyword)
3366 char *Pointer = *StringPointer;
3367 while (*Keyword !=
'\0') {
3368 char StringChar = *Pointer++;
3369 char KeywordChar = *Keyword++;
3370 if (StringChar >=
'A' && StringChar <=
'Z')
3371 StringChar +=
'a' -
'Z';
3372 if (KeywordChar >=
'A' && KeywordChar <=
'Z')
3373 KeywordChar +=
'a' -
'Z';
3374 if (StringChar != KeywordChar)
3377 *StringPointer = Pointer;
3399 static int __init BusLogic_ParseDriverOptions(
char *OptionsString)
3405 while (*OptionsString !=
'\0' && *OptionsString !=
';') {
3407 if (BusLogic_ParseKeyword(&OptionsString,
"IO:")) {
3408 unsigned long IO_Address =
simple_strtoul(OptionsString, &OptionsString, 0);
3410 switch (IO_Address) {
3430 BusLogic_Error(
"BusLogic: Invalid Driver Options " "(invalid I/O Address 0x%X)\n",
NULL, IO_Address);
3433 }
else if (BusLogic_ParseKeyword(&OptionsString,
"NoProbeISA"))
3435 else if (BusLogic_ParseKeyword(&OptionsString,
"NoProbePCI"))
3437 else if (BusLogic_ParseKeyword(&OptionsString,
"NoProbe"))
3439 else if (BusLogic_ParseKeyword(&OptionsString,
"NoSortPCI"))
3441 else if (BusLogic_ParseKeyword(&OptionsString,
"MultiMasterFirst"))
3443 else if (BusLogic_ParseKeyword(&OptionsString,
"FlashPointFirst"))
3446 else if (BusLogic_ParseKeyword(&OptionsString,
"QueueDepth:[") || BusLogic_ParseKeyword(&OptionsString,
"QD:[")) {
3448 unsigned short QueueDepth =
simple_strtoul(OptionsString, &OptionsString, 0);
3450 BusLogic_Error(
"BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n",
NULL, QueueDepth);
3454 if (*OptionsString ==
',')
3456 else if (*OptionsString ==
']')
3459 BusLogic_Error(
"BusLogic: Invalid Driver Options " "(',' or ']' expected at '%s')\n",
NULL, OptionsString);
3463 if (*OptionsString !=
']') {
3464 BusLogic_Error(
"BusLogic: Invalid Driver Options " "(']' expected at '%s')\n",
NULL, OptionsString);
3468 }
else if (BusLogic_ParseKeyword(&OptionsString,
"QueueDepth:") || BusLogic_ParseKeyword(&OptionsString,
"QD:")) {
3469 unsigned short QueueDepth =
simple_strtoul(OptionsString, &OptionsString, 0);
3471 BusLogic_Error(
"BusLogic: Invalid Driver Options " "(invalid Queue Depth %d)\n",
NULL, QueueDepth);
3476 DriverOptions->
QueueDepth[TargetID] = QueueDepth;
3477 }
else if (BusLogic_ParseKeyword(&OptionsString,
"TaggedQueuing:") || BusLogic_ParseKeyword(&OptionsString,
"TQ:")) {
3478 if (BusLogic_ParseKeyword(&OptionsString,
"Default")) {
3481 }
else if (BusLogic_ParseKeyword(&OptionsString,
"Enable")) {
3484 }
else if (BusLogic_ParseKeyword(&OptionsString,
"Disable")) {
3488 unsigned short TargetBit;
3490 switch (*OptionsString++) {
3509 else if (BusLogic_ParseKeyword(&OptionsString,
"BusSettleTime:") || BusLogic_ParseKeyword(&OptionsString,
"BST:")) {
3511 if (BusSettleTime > 5 * 60) {
3512 BusLogic_Error(
"BusLogic: Invalid Driver Options " "(invalid Bus Settle Time %d)\n",
NULL, BusSettleTime);
3516 }
else if (BusLogic_ParseKeyword(&OptionsString,
"InhibitTargetInquiry"))
3517 DriverOptions->
LocalOptions.InhibitTargetInquiry =
true;
3519 else if (BusLogic_ParseKeyword(&OptionsString,
"TraceProbe"))
3521 else if (BusLogic_ParseKeyword(&OptionsString,
"TraceHardwareReset"))
3523 else if (BusLogic_ParseKeyword(&OptionsString,
"TraceConfiguration"))
3525 else if (BusLogic_ParseKeyword(&OptionsString,
"TraceErrors"))
3527 else if (BusLogic_ParseKeyword(&OptionsString,
"Debug")) {
3533 if (*OptionsString ==
',')
3535 else if (*OptionsString !=
';' && *OptionsString !=
'\0') {
3536 BusLogic_Error(
"BusLogic: Unexpected Driver Option '%s' " "ignored\n",
NULL, OptionsString);
3537 *OptionsString =
'\0';
3540 if (!(BusLogic_DriverOptionsCount == 0 || BusLogic_ProbeInfoCount == 0 || BusLogic_DriverOptionsCount == BusLogic_ProbeInfoCount)) {
3541 BusLogic_Error(
"BusLogic: Invalid Driver Options " "(all or no I/O Addresses must be specified)\n",
NULL);
3549 if (DriverOptions->
QueueDepth[TargetID] == 1) {
3550 unsigned short TargetBit = 1 <<
TargetID;
3554 if (*OptionsString ==
';')
3556 if (*OptionsString ==
'\0')
3568 .proc_name =
"BusLogic",
3569 .proc_info = BusLogic_ProcDirectoryInfo,
3571 .info = BusLogic_DriverInfo,
3572 .queuecommand = BusLogic_QueueCommand,
3573 .slave_configure = BusLogic_SlaveConfigure,
3574 .bios_param = BusLogic_BIOSDiskParameters,
3575 .eh_host_reset_handler = BusLogic_host_reset,
3577 .eh_abort_handler = BusLogic_AbortCommand,
3579 .unchecked_isa_dma = 1,
3588 static int __init BusLogic_Setup(
char *
str)
3598 if (str ==
NULL || *str ==
'\0')
3600 return BusLogic_ParseDriverOptions(str);
3607 static void __exit BusLogic_exit(
void)
3612 BusLogic_ReleaseHostAdapter(ha);
3615 __setup("BusLogic=", BusLogic_Setup);