• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/scsi/

Lines Matching refs:HostAdapter

142 static void BusLogic_AnnounceDriver(struct BusLogic_HostAdapter *HostAdapter)
144 BusLogic_Announce("***** BusLogic SCSI Driver Version " BusLogic_DriverVersion " of " BusLogic_DriverDate " *****\n", HostAdapter);
145 BusLogic_Announce("Copyright 1995-1998 by Leonard N. Zubkoff " "<lnz@dandelion.com>\n", HostAdapter);
156 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata;
157 return HostAdapter->FullModelName;
166 static void BusLogic_InitializeCCBs(struct BusLogic_HostAdapter *HostAdapter, void *BlockPointer, int BlockSize, dma_addr_t BlockPointerHandle)
175 CCB->HostAdapter = HostAdapter;
177 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) {
179 CCB->BaseAddress = HostAdapter->FlashPointInfo.BaseAddress;
181 CCB->Next = HostAdapter->Free_CCBs;
182 CCB->NextAll = HostAdapter->All_CCBs;
183 HostAdapter->Free_CCBs = CCB;
184 HostAdapter->All_CCBs = CCB;
185 HostAdapter->AllocatedCCBs++;
196 static bool __init BusLogic_CreateInitialCCBs(struct BusLogic_HostAdapter *HostAdapter)
201 while (HostAdapter->AllocatedCCBs < HostAdapter->InitialCCBs) {
202 BlockPointer = pci_alloc_consistent(HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle);
204 BusLogic_Error("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n", HostAdapter);
207 BusLogic_InitializeCCBs(HostAdapter, BlockPointer, BlockSize, BlockPointerHandle);
217 static void BusLogic_DestroyCCBs(struct BusLogic_HostAdapter *HostAdapter)
219 struct BusLogic_CCB *NextCCB = HostAdapter->All_CCBs, *CCB, *Last_CCB = NULL;
220 HostAdapter->All_CCBs = NULL;
221 HostAdapter->Free_CCBs = NULL;
226 pci_free_consistent(HostAdapter->PCI_Device, Last_CCB->AllocationGroupSize, Last_CCB, Last_CCB->AllocationGroupHead);
231 pci_free_consistent(HostAdapter->PCI_Device, Last_CCB->AllocationGroupSize, Last_CCB, Last_CCB->AllocationGroupHead);
242 static void BusLogic_CreateAdditionalCCBs(struct BusLogic_HostAdapter *HostAdapter, int AdditionalCCBs, bool SuccessMessageP)
245 int PreviouslyAllocated = HostAdapter->AllocatedCCBs;
250 while (HostAdapter->AllocatedCCBs - PreviouslyAllocated < AdditionalCCBs) {
251 BlockPointer = pci_alloc_consistent(HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle);
254 BusLogic_InitializeCCBs(HostAdapter, BlockPointer, BlockSize, BlockPointerHandle);
256 if (HostAdapter->AllocatedCCBs > PreviouslyAllocated) {
258 BusLogic_Notice("Allocated %d additional CCBs (total now %d)\n", HostAdapter, HostAdapter->AllocatedCCBs - PreviouslyAllocated, HostAdapter->AllocatedCCBs);
261 BusLogic_Notice("Failed to allocate additional CCBs\n", HostAdapter);
262 if (HostAdapter->DriverQueueDepth > HostAdapter->AllocatedCCBs - HostAdapter->TargetDeviceCount) {
263 HostAdapter->DriverQueueDepth = HostAdapter->AllocatedCCBs - HostAdapter->TargetDeviceCount;
264 HostAdapter->SCSI_Host->can_queue = HostAdapter->DriverQueueDepth;
275 *HostAdapter)
279 CCB = HostAdapter->Free_CCBs;
282 HostAdapter->Free_CCBs = CCB->Next;
284 if (HostAdapter->Free_CCBs == NULL)
285 BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->IncrementalCCBs, true);
288 BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->IncrementalCCBs, true);
289 CCB = HostAdapter->Free_CCBs;
293 HostAdapter->Free_CCBs = CCB->Next;
307 struct BusLogic_HostAdapter *HostAdapter = CCB->HostAdapter;
310 pci_unmap_single(HostAdapter->PCI_Device, CCB->SenseDataPointer,
315 CCB->Next = HostAdapter->Free_CCBs;
316 HostAdapter->Free_CCBs = CCB;
321 BusLogic_Command sends the command OperationCode to HostAdapter, optionally
338 static int BusLogic_Command(struct BusLogic_HostAdapter *HostAdapter, enum BusLogic_OperationCode OperationCode, void *ParameterData, int ParameterLength, void *ReplyData, int ReplyLength)
358 if (!HostAdapter->IRQ_ChannelAcquired)
366 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
379 HostAdapter->HostAdapterCommandCompleted = false;
380 BusLogic_WriteCommandParameterRegister(HostAdapter, OperationCode);
399 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
400 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
403 if (HostAdapter->HostAdapterCommandCompleted)
409 BusLogic_WriteCommandParameterRegister(HostAdapter, *ParameterPointer++);
421 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
428 BusLogic_Notice("BusLogic_Command(%02X) Status = %02X: " "(Modify I/O Address)\n", HostAdapter, OperationCode, StatusRegister.All);
453 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
454 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
457 if (HostAdapter->HostAdapterCommandCompleted)
461 *ReplyPointer++ = BusLogic_ReadDataInRegister(HostAdapter);
463 BusLogic_ReadDataInRegister(HostAdapter);
477 BusLogic_InterruptReset(HostAdapter);
483 BusLogic_Notice("BusLogic_Command(%02X) Status = %02X: %2d ==> %2d:", HostAdapter, OperationCode, StatusRegister.All, ReplyLength, ReplyBytes);
487 BusLogic_Notice(" %02X", HostAdapter, ((unsigned char *) ReplyData)[i]);
488 BusLogic_Notice("\n", HostAdapter);
503 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
508 BusLogic_SoftReset(HostAdapter);
532 if (!HostAdapter->IRQ_ChannelAcquired)
657 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter;
705 HostAdapter->IO_Address = IO_Address;
706 BusLogic_InterruptReset(HostAdapter);
707 if (BusLogic_Command(HostAdapter, BusLogic_InquirePCIHostAdapterInformation, NULL, 0, &PCIHostAdapterInformation, sizeof(PCIHostAdapterInformation))
721 BusLogic_Command(HostAdapter, BusLogic_ModifyIOAddress, &ModifyIOAddressRequest, sizeof(ModifyIOAddressRequest), NULL, 0);
735 BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIByte45, sizeof(AutoSCSIByte45));
736 BusLogic_Command(HostAdapter, BusLogic_InquireBoardID, NULL, 0, &BoardID, sizeof(BoardID));
981 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter;
986 HostAdapter->IO_Address = ProbeInfo->IO_Address;
989 BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &Drive0MapByte, sizeof(Drive0MapByte));
1020 static bool BusLogic_Failure(struct BusLogic_HostAdapter *HostAdapter, char *ErrorMessage)
1022 BusLogic_AnnounceDriver(HostAdapter);
1023 if (HostAdapter->HostAdapterBusType == BusLogic_PCI_Bus) {
1024 BusLogic_Error("While configuring BusLogic PCI Host Adapter at\n", HostAdapter);
1025 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);
1027 BusLogic_Error("While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n", HostAdapter, HostAdapter->IO_Address);
1028 BusLogic_Error("%s FAILED - DETACHING\n", HostAdapter, ErrorMessage);
1030 BusLogic_Error("ADDITIONAL FAILURE INFO - %s\n", HostAdapter, BusLogic_CommandFailureReason);
1039 static bool __init BusLogic_ProbeHostAdapter(struct BusLogic_HostAdapter *HostAdapter)
1047 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) {
1048 struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo;
1049 FlashPointInfo->BaseAddress = (u32) HostAdapter->IO_Address;
1050 FlashPointInfo->IRQ_Channel = HostAdapter->IRQ_Channel;
1053 BusLogic_Error("BusLogic: FlashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", HostAdapter, HostAdapter->Bus, HostAdapter->Device);
1054 BusLogic_Error("BusLogic: I/O Address 0x%X PCI Address 0x%X, " "but FlashPoint\n", HostAdapter, HostAdapter->IO_Address, HostAdapter->PCI_Address);
1055 BusLogic_Error("BusLogic: Probe Function failed to validate it.\n", HostAdapter);
1059 BusLogic_Notice("BusLogic_Probe(0x%X): FlashPoint Found\n", HostAdapter, HostAdapter->IO_Address);
1072 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
1073 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
1074 GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter);
1076 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);
1111 *HostAdapter, bool HardReset)
1118 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) {
1119 struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo;
1122 HostAdapter->CardHandle = FlashPoint_HardwareResetHostAdapter(FlashPointInfo);
1123 if (HostAdapter->CardHandle == FlashPoint_BadCardHandle)
1135 BusLogic_HardReset(HostAdapter);
1137 BusLogic_SoftReset(HostAdapter);
1143 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
1149 BusLogic_Notice("BusLogic_HardwareReset(0x%X): Diagnostic Active, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All);
1163 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
1169 BusLogic_Notice("BusLogic_HardwareReset(0x%X): Diagnostic Completed, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All);
1178 StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
1184 BusLogic_Notice("BusLogic_HardwareReset(0x%X): Host Adapter Ready, " "Status 0x%02X\n", HostAdapter, HostAdapter->IO_Address, StatusRegister.All);
1194 BusLogic_Failure(HostAdapter, "HARD RESET DIAGNOSTICS");
1195 BusLogic_Error("HOST ADAPTER STATUS REGISTER = %02X\n", HostAdapter, StatusRegister.All);
1197 unsigned char ErrorCode = BusLogic_ReadDataInRegister(HostAdapter);
1198 BusLogic_Error("HOST ADAPTER ERROR CODE = %d\n", HostAdapter, ErrorCode);
1214 static bool __init BusLogic_CheckHostAdapter(struct BusLogic_HostAdapter *HostAdapter)
1222 if (BusLogic_FlashPointHostAdapterP(HostAdapter))
1231 if (BusLogic_Command(HostAdapter, BusLogic_InquireExtendedSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &ExtendedSetupInformation, sizeof(ExtendedSetupInformation))
1238 BusLogic_Notice("BusLogic_Check(0x%X): MultiMaster %s\n", HostAdapter, HostAdapter->IO_Address, (Result ? "Found" : "Not Found"));
1249 *HostAdapter)
1271 if (BusLogic_FlashPointHostAdapterP(HostAdapter)) {
1272 struct FlashPoint_Info *FlashPointInfo = &HostAdapter->FlashPointInfo;
1273 TargetPointer = HostAdapter->ModelName;
1280 strcpy(HostAdapter->FirmwareVersion, FlashPoint_FirmwareVersion);
1281 HostAdapter->SCSI_ID = FlashPointInfo->SCSI_ID;
1282 HostAdapter->ExtendedTranslationEnabled = FlashPointInfo->ExtendedTranslationEnabled;
1283 HostAdapter->ParityCheckingEnabled = FlashPointInfo->ParityCheckingEnabled;
1284 HostAdapter->BusResetEnabled = !FlashPointInfo->HostSoftReset;
1285 HostAdapter->LevelSensitiveInterrupt = true;
1286 HostAdapter->HostWideSCSI = FlashPointInfo->HostWideSCSI;
1287 HostAdapter->HostDifferentialSCSI = false;
1288 HostAdapter->HostSupportsSCAM = true;
1289 HostAdapter->HostUltraSCSI = true;
1290 HostAdapter->ExtendedLUNSupport = true;
1291 HostAdapter->TerminationInfoValid = true;
1292 HostAdapter->LowByteTerminated = FlashPointInfo->LowByteTerminated;
1293 HostAdapter->HighByteTerminated = FlashPointInfo->HighByteTerminated;
1294 HostAdapter->SCAM_Enabled = FlashPointInfo->SCAM_Enabled;
1295 HostAdapter->SCAM_Level2 = FlashPointInfo->SCAM_Level2;
1296 HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit;
1297 HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8);
1298 HostAdapter->MaxLogicalUnits = 32;
1299 HostAdapter->InitialCCBs = 4 * BusLogic_CCB_AllocationGroupSize;
1300 HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize;
1301 HostAdapter->DriverQueueDepth = 255;
1302 HostAdapter->HostAdapterQueueDepth = HostAdapter->DriverQueueDepth;
1303 HostAdapter->SynchronousPermitted = FlashPointInfo->SynchronousPermitted;
1304 HostAdapter->FastPermitted = FlashPointInfo->FastPermitted;
1305 HostAdapter->UltraPermitted = FlashPointInfo->UltraPermitted;
1306 HostAdapter->WidePermitted = FlashPointInfo->WidePermitted;
1307 HostAdapter->DisconnectPermitted = FlashPointInfo->DisconnectPermitted;
1308 HostAdapter->TaggedQueuingPermitted = 0xFFFF;
1314 if (BusLogic_Command(HostAdapter, BusLogic_InquireBoardID, NULL, 0, &BoardID, sizeof(BoardID)) != sizeof(BoardID))
1315 return BusLogic_Failure(HostAdapter, "INQUIRE BOARD ID");
1319 if (BusLogic_Command(HostAdapter, BusLogic_InquireConfiguration, NULL, 0, &Configuration, sizeof(Configuration))
1321 return BusLogic_Failure(HostAdapter, "INQUIRE CONFIGURATION");
1326 if (BusLogic_Command(HostAdapter, BusLogic_InquireSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &SetupInformation, sizeof(SetupInformation))
1328 return BusLogic_Failure(HostAdapter, "INQUIRE SETUP INFORMATION");
1333 if (BusLogic_Command(HostAdapter, BusLogic_InquireExtendedSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &ExtendedSetupInformation, sizeof(ExtendedSetupInformation))
1335 return BusLogic_Failure(HostAdapter, "INQUIRE EXTENDED SETUP INFORMATION");
1341 if (BusLogic_Command(HostAdapter, BusLogic_InquireFirmwareVersion3rdDigit, NULL, 0, &FirmwareVersion3rdDigit, sizeof(FirmwareVersion3rdDigit))
1343 return BusLogic_Failure(HostAdapter, "INQUIRE FIRMWARE 3RD DIGIT");
1358 if (BusLogic_Command(HostAdapter, BusLogic_InquireHostAdapterModelNumber, &RequestedReplyLength, sizeof(RequestedReplyLength), &HostAdapterModelNumber, sizeof(HostAdapterModelNumber))
1360 return BusLogic_Failure(HostAdapter, "INQUIRE HOST ADAPTER MODEL NUMBER");
1380 TargetPointer = HostAdapter->ModelName;
1394 TargetPointer = HostAdapter->FirmwareVersion;
1404 if (strcmp(HostAdapter->FirmwareVersion, "3.3") >= 0) {
1405 if (BusLogic_Command(HostAdapter, BusLogic_InquireFirmwareVersionLetter, NULL, 0, &FirmwareVersionLetter, sizeof(FirmwareVersionLetter))
1407 return BusLogic_Failure(HostAdapter, "INQUIRE FIRMWARE VERSION LETTER");
1415 HostAdapter->SCSI_ID = Configuration.HostAdapterID;
1421 HostAdapter->HostAdapterBusType = BusLogic_HostAdapterBusTypes[HostAdapter->ModelName[3] - '4'];
1422 if (HostAdapter->IRQ_Channel == 0) {
1424 HostAdapter->IRQ_Channel = 9;
1426 HostAdapter->IRQ_Channel = 10;
1428 HostAdapter->IRQ_Channel = 11;
1430 HostAdapter->IRQ_Channel = 12;
1432 HostAdapter->IRQ_Channel = 14;
1434 HostAdapter->IRQ_Channel = 15;
1436 if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus) {
1438 HostAdapter->DMA_Channel = 5;
1440 HostAdapter->DMA_Channel = 6;
1442 HostAdapter->DMA_Channel = 7;
1448 GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter);
1449 HostAdapter->ExtendedTranslationEnabled = GeometryRegister.gr.ExtendedTranslationEnabled;
1455 HostAdapter->HostAdapterScatterGatherLimit = ExtendedSetupInformation.ScatterGatherLimit;
1456 HostAdapter->DriverScatterGatherLimit = HostAdapter->HostAdapterScatterGatherLimit;
1457 if (HostAdapter->HostAdapterScatterGatherLimit > BusLogic_ScatterGatherLimit)
1458 HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit;
1460 HostAdapter->LevelSensitiveInterrupt = true;
1461 HostAdapter->HostWideSCSI = ExtendedSetupInformation.HostWideSCSI;
1462 HostAdapter->HostDifferentialSCSI = ExtendedSetupInformation.HostDifferentialSCSI;
1463 HostAdapter->HostSupportsSCAM = ExtendedSetupInformation.HostSupportsSCAM;
1464 HostAdapter->HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI;
1469 if (HostAdapter->FirmwareVersion[0] == '5' || (HostAdapter->FirmwareVersion[0] == '4' && HostAdapter->HostWideSCSI))
1470 HostAdapter->ExtendedLUNSupport = true;
1475 if (HostAdapter->FirmwareVersion[0] == '5') {
1476 if (BusLogic_Command(HostAdapter, BusLogic_InquirePCIHostAdapterInformation, NULL, 0, &PCIHostAdapterInformation, sizeof(PCIHostAdapterInformation))
1478 return BusLogic_Failure(HostAdapter, "INQUIRE PCI HOST ADAPTER INFORMATION");
1483 HostAdapter->TerminationInfoValid = true;
1484 HostAdapter->LowByteTerminated = PCIHostAdapterInformation.LowByteTerminated;
1485 HostAdapter->HighByteTerminated = PCIHostAdapterInformation.HighByteTerminated;
1492 if (HostAdapter->FirmwareVersion[0] >= '4') {
1495 if (BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIData, sizeof(AutoSCSIData))
1497 return BusLogic_Failure(HostAdapter, "FETCH HOST ADAPTER LOCAL RAM");
1502 HostAdapter->ParityCheckingEnabled = AutoSCSIData.ParityCheckingEnabled;
1503 HostAdapter->BusResetEnabled = AutoSCSIData.BusResetEnabled;
1504 if (HostAdapter->FirmwareVersion[0] == '4') {
1505 HostAdapter->TerminationInfoValid = true;
1506 HostAdapter->LowByteTerminated = AutoSCSIData.LowByteTerminated;
1507 HostAdapter->HighByteTerminated = AutoSCSIData.HighByteTerminated;
1514 HostAdapter->WidePermitted = AutoSCSIData.WidePermitted;
1515 HostAdapter->FastPermitted = AutoSCSIData.FastPermitted;
1516 HostAdapter->SynchronousPermitted = AutoSCSIData.SynchronousPermitted;
1517 HostAdapter->DisconnectPermitted = AutoSCSIData.DisconnectPermitted;
1518 if (HostAdapter->HostUltraSCSI)
1519 HostAdapter->UltraPermitted = AutoSCSIData.UltraPermitted;
1520 if (HostAdapter->HostSupportsSCAM) {
1521 HostAdapter->SCAM_Enabled = AutoSCSIData.SCAM_Enabled;
1522 HostAdapter->SCAM_Level2 = AutoSCSIData.SCAM_Level2;
1529 if (HostAdapter->FirmwareVersion[0] < '4') {
1531 HostAdapter->SynchronousPermitted = 0xFF;
1532 if (HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus) {
1534 HostAdapter->FastPermitted = 0xFF;
1535 if (strcmp(HostAdapter->ModelName, "BT-757") == 0)
1536 HostAdapter->WidePermitted = 0xFF;
1539 HostAdapter->DisconnectPermitted = 0xFF;
1540 HostAdapter->ParityCheckingEnabled = SetupInformation.ParityCheckingEnabled;
1541 HostAdapter->BusResetEnabled = true;
1547 HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8);
1548 HostAdapter->MaxLogicalUnits = (HostAdapter->ExtendedLUNSupport ? 32 : 8);
1572 if (HostAdapter->FirmwareVersion[0] == '5')
1573 HostAdapter->HostAdapterQueueDepth = 192;
1574 else if (HostAdapter->FirmwareVersion[0] == '4')
1575 HostAdapter->HostAdapterQueueDepth = (HostAdapter->HostAdapterBusType != BusLogic_ISA_Bus ? 100 : 50);
1577 HostAdapter->HostAdapterQueueDepth = 30;
1578 if (strcmp(HostAdapter->FirmwareVersion, "3.31") >= 0) {
1579 HostAdapter->StrictRoundRobinModeSupport = true;
1580 HostAdapter->MailboxCount = BusLogic_MaxMailboxes;
1582 HostAdapter->StrictRoundRobinModeSupport = false;
1583 HostAdapter->MailboxCount = 32;
1585 HostAdapter->DriverQueueDepth = HostAdapter->MailboxCount;
1586 HostAdapter->InitialCCBs = 4 * BusLogic_CCB_AllocationGroupSize;
1587 HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize;
1594 HostAdapter->TaggedQueuingPermitted = 0;
1595 switch (HostAdapter->FirmwareVersion[0]) {
1597 HostAdapter->TaggedQueuingPermitted = 0xFFFF;
1600 if (strcmp(HostAdapter->FirmwareVersion, "4.22") >= 0)
1601 HostAdapter->TaggedQueuingPermitted = 0xFFFF;
1604 if (strcmp(HostAdapter->FirmwareVersion, "3.35") >= 0)
1605 HostAdapter->TaggedQueuingPermitted = 0xFFFF;
1613 HostAdapter->BIOS_Address = ExtendedSetupInformation.BIOS_Address << 12;
1617 if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus && (void *) high_memory > (void *) MAX_DMA_ADDRESS)
1618 HostAdapter->BounceBuffersRequired = true;
1627 if (HostAdapter->BIOS_Address > 0 && strcmp(HostAdapter->ModelName, "BT-445S") == 0 && strcmp(HostAdapter->FirmwareVersion, "3.37") < 0 && (void *) high_memory > (void *) MAX_DMA_ADDRESS)
1628 HostAdapter->BounceBuffersRequired = true;
1636 strcpy(HostAdapter->FullModelName, "BusLogic ");
1637 strcat(HostAdapter->FullModelName, HostAdapter->ModelName);
1647 if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->QueueDepth[TargetID] > 0)
1648 QueueDepth = HostAdapter->DriverOptions->QueueDepth[TargetID];
1649 else if (HostAdapter->BounceBuffersRequired)
1651 HostAdapter->QueueDepth[TargetID] = QueueDepth;
1653 if (HostAdapter->BounceBuffersRequired)
1654 HostAdapter->UntaggedQueueDepth = BusLogic_UntaggedQueueDepthBB;
1656 HostAdapter->UntaggedQueueDepth = BusLogic_UntaggedQueueDepth;
1657 if (HostAdapter->DriverOptions != NULL)
1658 HostAdapter->CommonQueueDepth = HostAdapter->DriverOptions->CommonQueueDepth;
1659 if (HostAdapter->CommonQueueDepth > 0 && HostAdapter->CommonQueueDepth < HostAdapter->UntaggedQueueDepth)
1660 HostAdapter->UntaggedQueueDepth = HostAdapter->CommonQueueDepth;
1666 HostAdapter->TaggedQueuingPermitted &= HostAdapter->DisconnectPermitted;
1671 if (HostAdapter->DriverOptions != NULL)
1672 HostAdapter->TaggedQueuingPermitted =
1673 (HostAdapter->DriverOptions->TaggedQueuingPermitted & HostAdapter->DriverOptions->TaggedQueuingPermittedMask) | (HostAdapter->TaggedQueuingPermitted & ~HostAdapter->DriverOptions->TaggedQueuingPermittedMask);
1679 if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->BusSettleTime > 0)
1680 HostAdapter->BusSettleTime = HostAdapter->DriverOptions->BusSettleTime;
1682 HostAdapter->BusSettleTime = BusLogic_DefaultBusSettleTime;
1696 *HostAdapter)
1698 unsigned short AllTargetsMask = (1 << HostAdapter->MaxTargetDevices) - 1;
1713 HostAdapter, HostAdapter->ModelName,
1714 BusLogic_HostAdapterBusNames[HostAdapter->HostAdapterBusType], (HostAdapter->HostWideSCSI ? " Wide" : ""), (HostAdapter->HostDifferentialSCSI ? " Differential" : ""), (HostAdapter->HostUltraSCSI ? " Ultra" : ""));
1715 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"));
1716 if (HostAdapter->HostAdapterBusType != BusLogic_PCI_Bus) {
1717 BusLogic_Info(" DMA Channel: ", HostAdapter);
1718 if (HostAdapter->DMA_Channel > 0)
1719 BusLogic_Info("%d, ", HostAdapter, HostAdapter->DMA_Channel);
1721 BusLogic_Info("None, ", HostAdapter);
1722 if (HostAdapter->BIOS_Address > 0)
1723 BusLogic_Info("BIOS Address: 0x%X, ", HostAdapter, HostAdapter->BIOS_Address);
1725 BusLogic_Info("BIOS Address: None, ", HostAdapter);
1727 BusLogic_Info(" PCI Bus: %d, Device: %d, Address: ", HostAdapter, HostAdapter->Bus, HostAdapter->Device);
1728 if (HostAdapter->PCI_Address > 0)
1729 BusLogic_Info("0x%X, ", HostAdapter, HostAdapter->PCI_Address);
1731 BusLogic_Info("Unassigned, ", HostAdapter);
1733 BusLogic_Info("Host Adapter SCSI ID: %d\n", HostAdapter, HostAdapter->SCSI_ID);
1734 BusLogic_Info(" Parity Checking: %s, Extended Translation: %s\n", HostAdapter, (HostAdapter->ParityCheckingEnabled ? "Enabled" : "Disabled"), (HostAdapter->ExtendedTranslationEnabled ? "Enabled" : "Disabled"));
1735 AllTargetsMask &= ~(1 << HostAdapter->SCSI_ID);
1736 SynchronousPermitted = HostAdapter->SynchronousPermitted & AllTargetsMask;
1737 FastPermitted = HostAdapter->FastPermitted & AllTargetsMask;
1738 UltraPermitted = HostAdapter->UltraPermitted & AllTargetsMask;
1739 if ((BusLogic_MultiMasterHostAdapterP(HostAdapter) && (HostAdapter->FirmwareVersion[0] >= '4' || HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus)) || BusLogic_FlashPointHostAdapterP(HostAdapter)) {
1759 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1761 SynchronousString[HostAdapter->SCSI_ID] = '#';
1762 SynchronousString[HostAdapter->MaxTargetDevices] = '\0';
1766 WidePermitted = HostAdapter->WidePermitted & AllTargetsMask;
1772 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1774 WideString[HostAdapter->SCSI_ID] = '#';
1775 WideString[HostAdapter->MaxTargetDevices] = '\0';
1777 DisconnectPermitted = HostAdapter->DisconnectPermitted & AllTargetsMask;
1783 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1785 DisconnectString[HostAdapter->SCSI_ID] = '#';
1786 DisconnectString[HostAdapter->MaxTargetDevices] = '\0';
1788 TaggedQueuingPermitted = HostAdapter->TaggedQueuingPermitted & AllTargetsMask;
1794 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1796 TaggedQueuingString[HostAdapter->SCSI_ID] = '#';
1797 TaggedQueuingString[HostAdapter->MaxTargetDevices] = '\0';
1799 BusLogic_Info(" Synchronous Negotiation: %s, Wide Negotiation: %s\n", HostAdapter, SynchronousMessage, WideMessage);
1800 BusLogic_Info(" Disconnect/Reconnect: %s, Tagged Queuing: %s\n", HostAdapter, DisconnectMessage, TaggedQueuingMessage);
1801 if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) {
1802 BusLogic_Info(" Scatter/Gather Limit: %d of %d segments, " "Mailboxes: %d\n", HostAdapter, HostAdapter->DriverScatterGatherLimit, HostAdapter->HostAdapterScatterGatherLimit, HostAdapter->MailboxCount);
1803 BusLogic_Info(" Driver Queue Depth: %d, " "Host Adapter Queue Depth: %d\n", HostAdapter, HostAdapter->DriverQueueDepth, HostAdapter->HostAdapterQueueDepth);
1805 BusLogic_Info(" Driver Queue Depth: %d, " "Scatter/Gather Limit: %d segments\n", HostAdapter, HostAdapter->DriverQueueDepth, HostAdapter->DriverScatterGatherLimit);
1806 BusLogic_Info(" Tagged Queue Depth: ", HostAdapter);
1808 for (TargetID = 1; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
1809 if (HostAdapter->QueueDepth[TargetID] != HostAdapter->QueueDepth[0]) {
1814 if (HostAdapter->QueueDepth[0] > 0)
1815 BusLogic_Info("%d", HostAdapter, HostAdapter->QueueDepth[0]);
1817 BusLogic_Info("Automatic", HostAdapter);
1819 BusLogic_Info("Individual", HostAdapter);
1820 BusLogic_Info(", Untagged Queue Depth: %d\n", HostAdapter, HostAdapter->UntaggedQueueDepth);
1821 if (HostAdapter->TerminationInfoValid) {
1822 if (HostAdapter->HostWideSCSI)
1823 BusLogic_Info(" SCSI Bus Termination: %s", HostAdapter, (HostAdapter->LowByteTerminated ? (HostAdapter->HighByteTerminated ? "Both Enabled" : "Low Enabled")
1824 : (HostAdapter->HighByteTerminated ? "High Enabled" : "Both Disabled")));
1826 BusLogic_Info(" SCSI Bus Termination: %s", HostAdapter, (HostAdapter->LowByteTerminated ? "Enabled" : "Disabled"));
1827 if (HostAdapter->HostSupportsSCAM)
1828 BusLogic_Info(", SCAM: %s", HostAdapter, (HostAdapter->SCAM_Enabled ? (HostAdapter->SCAM_Level2 ? "Enabled, Level 2" : "Enabled, Level 1")
1830 BusLogic_Info("\n", HostAdapter);
1844 static bool __init BusLogic_AcquireResources(struct BusLogic_HostAdapter *HostAdapter)
1846 if (HostAdapter->IRQ_Channel == 0) {
1847 BusLogic_Error("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n", HostAdapter);
1853 if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, IRQF_SHARED, HostAdapter->FullModelName, HostAdapter) < 0) {
1854 BusLogic_Error("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->IRQ_Channel);
1857 HostAdapter->IRQ_ChannelAcquired = true;
1861 if (HostAdapter->DMA_Channel > 0) {
1862 if (request_dma(HostAdapter->DMA_Channel, HostAdapter->FullModelName) < 0) {
1863 BusLogic_Error("UNABLE TO ACQUIRE DMA CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->DMA_Channel);
1866 set_dma_mode(HostAdapter->DMA_Channel, DMA_MODE_CASCADE);
1867 enable_dma(HostAdapter->DMA_Channel);
1868 HostAdapter->DMA_ChannelAcquired = true;
1882 static void BusLogic_ReleaseResources(struct BusLogic_HostAdapter *HostAdapter)
1887 if (HostAdapter->IRQ_ChannelAcquired)
1888 free_irq(HostAdapter->IRQ_Channel, HostAdapter);
1892 if (HostAdapter->DMA_ChannelAcquired)
1893 free_dma(HostAdapter->DMA_Channel);
1897 if (HostAdapter->MailboxSpace)
1898 pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle);
1899 pci_dev_put(HostAdapter->PCI_Device);
1900 HostAdapter->MailboxSpace = NULL;
1901 HostAdapter->MailboxSpaceHandle = 0;
1902 HostAdapter->MailboxSize = 0;
1913 *HostAdapter)
1923 HostAdapter->FirstCompletedCCB = NULL;
1924 HostAdapter->LastCompletedCCB = NULL;
1930 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
1931 HostAdapter->BusDeviceResetPendingCCB[TargetID] = NULL;
1932 HostAdapter->TargetFlags[TargetID].TaggedQueuingActive = false;
1933 HostAdapter->TargetFlags[TargetID].CommandSuccessfulFlag = false;
1934 HostAdapter->ActiveCommands[TargetID] = 0;
1935 HostAdapter->CommandsSinceReset[TargetID] = 0;
1940 if (BusLogic_FlashPointHostAdapterP(HostAdapter))
1945 HostAdapter->MailboxSize = HostAdapter->MailboxCount * (sizeof(struct BusLogic_OutgoingMailbox) + sizeof(struct BusLogic_IncomingMailbox));
1946 HostAdapter->MailboxSpace = pci_alloc_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, &HostAdapter->MailboxSpaceHandle);
1947 if (HostAdapter->MailboxSpace == NULL)
1948 return BusLogic_Failure(HostAdapter, "MAILBOX ALLOCATION");
1949 HostAdapter->FirstOutgoingMailbox = (struct BusLogic_OutgoingMailbox *) HostAdapter->MailboxSpace;
1950 HostAdapter->LastOutgoingMailbox = HostAdapter->FirstOutgoingMailbox + HostAdapter->MailboxCount - 1;
1951 HostAdapter->NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox;
1952 HostAdapter->FirstIncomingMailbox = (struct BusLogic_IncomingMailbox *) (HostAdapter->LastOutgoingMailbox + 1);
1953 HostAdapter->LastIncomingMailbox = HostAdapter->FirstIncomingMailbox + HostAdapter->MailboxCount - 1;
1954 HostAdapter->NextIncomingMailbox = HostAdapter->FirstIncomingMailbox;
1959 memset(HostAdapter->FirstOutgoingMailbox, 0, HostAdapter->MailboxCount * sizeof(struct BusLogic_OutgoingMailbox));
1960 memset(HostAdapter->FirstIncomingMailbox, 0, HostAdapter->MailboxCount * sizeof(struct BusLogic_IncomingMailbox));
1964 ExtendedMailboxRequest.MailboxCount = HostAdapter->MailboxCount;
1965 ExtendedMailboxRequest.BaseMailboxAddress = (u32) HostAdapter->MailboxSpaceHandle;
1966 if (BusLogic_Command(HostAdapter, BusLogic_InitializeExtendedMailbox, &ExtendedMailboxRequest, sizeof(ExtendedMailboxRequest), NULL, 0) < 0)
1967 return BusLogic_Failure(HostAdapter, "MAILBOX INITIALIZATION");
1975 if (HostAdapter->StrictRoundRobinModeSupport) {
1977 if (BusLogic_Command(HostAdapter, BusLogic_EnableStrictRoundRobinMode, &RoundRobinModeRequest, sizeof(RoundRobinModeRequest), NULL, 0) < 0)
1978 return BusLogic_Failure(HostAdapter, "ENABLE STRICT ROUND ROBIN MODE");
1984 if (HostAdapter->ExtendedLUNSupport) {
1986 if (BusLogic_Command(HostAdapter, BusLogic_SetCCBFormat, &SetCCBFormatRequest, sizeof(SetCCBFormatRequest), NULL, 0) < 0)
1987 return BusLogic_Failure(HostAdapter, "SET CCB FORMAT");
1993 if (!HostAdapter->HostAdapterInitialized) {
1994 BusLogic_Info("*** %s Initialized Successfully ***\n", HostAdapter, HostAdapter->FullModelName);
1995 BusLogic_Info("\n", HostAdapter);
1997 BusLogic_Warning("*** %s Initialized Successfully ***\n", HostAdapter, HostAdapter->FullModelName);
1998 HostAdapter->HostAdapterInitialized = true;
2012 *HostAdapter)
2025 BusLogic_Delay(HostAdapter->BusSettleTime);
2029 if (BusLogic_FlashPointHostAdapterP(HostAdapter))
2034 if (HostAdapter->DriverOptions != NULL && HostAdapter->DriverOptions->LocalOptions.InhibitTargetInquiry)
2045 if (strcmp(HostAdapter->FirmwareVersion, "4.25") >= 0) {
2055 if (BusLogic_Command(HostAdapter, BusLogic_InquireTargetDevices, NULL, 0, &InstalledDevices, sizeof(InstalledDevices))
2057 return BusLogic_Failure(HostAdapter, "INQUIRE TARGET DEVICES");
2058 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
2059 HostAdapter->TargetFlags[TargetID].TargetExists = (InstalledDevices & (1 << TargetID) ? true : false);
2068 if (BusLogic_Command(HostAdapter, BusLogic_InquireInstalledDevicesID0to7, NULL, 0, &InstalledDevicesID0to7, sizeof(InstalledDevicesID0to7))
2070 return BusLogic_Failure(HostAdapter, "INQUIRE INSTALLED DEVICES ID 0 TO 7");
2072 HostAdapter->TargetFlags[TargetID].TargetExists = (InstalledDevicesID0to7[TargetID] != 0 ? true : false);
2078 if (BusLogic_Command(HostAdapter, BusLogic_InquireSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &SetupInformation, sizeof(SetupInformation))
2080 return BusLogic_Failure(HostAdapter, "INQUIRE SETUP INFORMATION");
2081 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
2082 HostAdapter->SynchronousOffset[TargetID] = (TargetID < 8 ? SetupInformation.SynchronousValuesID0to7[TargetID].Offset : SetupInformation.SynchronousValuesID8to15[TargetID - 8].Offset);
2083 if (strcmp(HostAdapter->FirmwareVersion, "5.06L") >= 0)
2084 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
2085 HostAdapter->TargetFlags[TargetID].WideTransfersActive = (TargetID < 8 ? (SetupInformation.WideTransfersActiveID0to7 & (1 << TargetID)
2092 if (HostAdapter->FirmwareVersion[0] >= '3') {
2100 if (BusLogic_Command(HostAdapter, BusLogic_InquireSynchronousPeriod, &RequestedReplyLength, sizeof(RequestedReplyLength), &SynchronousPeriod, sizeof(SynchronousPeriod))
2102 return BusLogic_Failure(HostAdapter, "INQUIRE SYNCHRONOUS PERIOD");
2103 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
2104 HostAdapter->SynchronousPeriod[TargetID] = SynchronousPeriod[TargetID];
2106 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
2108 HostAdapter->SynchronousPeriod[TargetID] = 20 + 5 * SetupInformation.SynchronousValuesID0to7[TargetID]
2126 *HostAdapter, struct Scsi_Host *Host)
2128 Host->max_id = HostAdapter->MaxTargetDevices;
2129 Host->max_lun = HostAdapter->MaxLogicalUnits;
2131 Host->unique_id = HostAdapter->IO_Address;
2132 Host->this_id = HostAdapter->SCSI_ID;
2133 Host->can_queue = HostAdapter->DriverQueueDepth;
2134 Host->sg_tablesize = HostAdapter->DriverScatterGatherLimit;
2135 Host->unchecked_isa_dma = HostAdapter->BounceBuffersRequired;
2136 Host->cmd_per_lun = HostAdapter->UntaggedQueueDepth;
2149 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Device->host->hostdata;
2151 int QueueDepth = HostAdapter->QueueDepth[TargetID];
2153 if (HostAdapter->TargetFlags[TargetID].TaggedQueuingSupported && (HostAdapter->TaggedQueuingPermitted & (1 << TargetID))) {
2156 HostAdapter->QueueDepth[TargetID] = QueueDepth;
2159 HostAdapter->TaggedQueuingPermitted &= ~(1 << TargetID);
2160 QueueDepth = HostAdapter->UntaggedQueueDepth;
2161 HostAdapter->QueueDepth[TargetID] = QueueDepth;
2165 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
2166 if (HostAdapter->TargetFlags[TargetID].TargetExists) {
2167 QueueDepth += HostAdapter->QueueDepth[TargetID];
2169 if (QueueDepth > HostAdapter->AllocatedCCBs)
2170 BusLogic_CreateAdditionalCCBs(HostAdapter, QueueDepth - HostAdapter->AllocatedCCBs, false);
2217 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter;
2221 memset(HostAdapter, 0, sizeof(struct BusLogic_HostAdapter));
2222 HostAdapter->HostAdapterType = ProbeInfo->HostAdapterType;
2223 HostAdapter->HostAdapterBusType = ProbeInfo->HostAdapterBusType;
2224 HostAdapter->IO_Address = ProbeInfo->IO_Address;
2225 HostAdapter->PCI_Address = ProbeInfo->PCI_Address;
2226 HostAdapter->Bus = ProbeInfo->Bus;
2227 HostAdapter->Device = ProbeInfo->Device;
2228 HostAdapter->PCI_Device = ProbeInfo->PCI_Device;
2229 HostAdapter->IRQ_Channel = ProbeInfo->IRQ_Channel;
2230 HostAdapter->AddressCount = BusLogic_HostAdapterAddressCount[HostAdapter->HostAdapterType];
2235 if (!request_region(HostAdapter->IO_Address, HostAdapter->AddressCount,
2241 if (!BusLogic_ProbeHostAdapter(HostAdapter)) {
2242 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2249 if (!BusLogic_HardwareResetHostAdapter(HostAdapter, true)) {
2250 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2256 if (!BusLogic_CheckHostAdapter(HostAdapter)) {
2257 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2264 HostAdapter->DriverOptions = &BusLogic_DriverOptions[DriverOptionsIndex++];
2269 BusLogic_AnnounceDriver(HostAdapter);
2276 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2279 HostAdapter = (struct BusLogic_HostAdapter *) Host->hostdata;
2280 memcpy(HostAdapter, PrototypeHostAdapter, sizeof(struct BusLogic_HostAdapter));
2281 HostAdapter->SCSI_Host = Host;
2282 HostAdapter->HostNumber = Host->host_no;
2287 list_add_tail(&HostAdapter->host_list, &BusLogic_host_list);
2301 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) &&
2302 BusLogic_ReportHostAdapterConfiguration(HostAdapter) &&
2303 BusLogic_AcquireResources(HostAdapter) &&
2304 BusLogic_CreateInitialCCBs(HostAdapter) &&
2305 BusLogic_InitializeHostAdapter(HostAdapter) &&
2306 BusLogic_TargetDeviceInquiry(HostAdapter)) {
2313 release_region(HostAdapter->IO_Address,
2314 HostAdapter->AddressCount);
2315 if (!request_region(HostAdapter->IO_Address,
2316 HostAdapter->AddressCount,
2317 HostAdapter->FullModelName)) {
2321 (unsigned long)HostAdapter->IO_Address);
2322 BusLogic_DestroyCCBs(HostAdapter);
2323 BusLogic_ReleaseResources(HostAdapter);
2324 list_del(&HostAdapter->host_list);
2328 BusLogic_InitializeHostStructure(HostAdapter,
2330 if (scsi_add_host(Host, HostAdapter->PCI_Device
2331 ? &HostAdapter->PCI_Device->dev
2336 BusLogic_DestroyCCBs(HostAdapter);
2337 BusLogic_ReleaseResources(HostAdapter);
2338 list_del(&HostAdapter->host_list);
2355 BusLogic_DestroyCCBs(HostAdapter);
2356 BusLogic_ReleaseResources(HostAdapter);
2357 list_del(&HostAdapter->host_list);
2375 static int __exit BusLogic_ReleaseHostAdapter(struct BusLogic_HostAdapter *HostAdapter)
2377 struct Scsi_Host *Host = HostAdapter->SCSI_Host;
2385 if (BusLogic_FlashPointHostAdapterP(HostAdapter))
2386 FlashPoint_ReleaseHostAdapter(HostAdapter->CardHandle);
2391 BusLogic_DestroyCCBs(HostAdapter);
2392 BusLogic_ReleaseResources(HostAdapter);
2396 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2400 list_del(&HostAdapter->host_list);
2413 struct BusLogic_HostAdapter *HostAdapter = CCB->HostAdapter;
2416 if (HostAdapter->FirstCompletedCCB == NULL) {
2417 HostAdapter->FirstCompletedCCB = CCB;
2418 HostAdapter->LastCompletedCCB = CCB;
2420 HostAdapter->LastCompletedCCB->Next = CCB;
2421 HostAdapter->LastCompletedCCB = CCB;
2423 HostAdapter->ActiveCommands[CCB->TargetID]--;
2432 static int BusLogic_ComputeResultCode(struct BusLogic_HostAdapter *HostAdapter, enum BusLogic_HostAdapterStatus HostAdapterStatus, enum BusLogic_TargetDeviceStatus TargetDeviceStatus)
2447 BusLogic_Warning("BusLogic Driver Protocol Error 0x%02X\n", HostAdapter, HostAdapterStatus);
2471 BusLogic_Warning("Unknown Host Adapter Status 0x%02X\n", HostAdapter, HostAdapterStatus);
2484 static void BusLogic_ScanIncomingMailboxes(struct BusLogic_HostAdapter *HostAdapter)
2498 struct BusLogic_IncomingMailbox *NextIncomingMailbox = HostAdapter->NextIncomingMailbox;
2523 BusLogic_Warning("Illegal CCB #%ld status %d in " "Incoming Mailbox\n", HostAdapter, CCB->SerialNumber, CCB->Status);
2527 if (++NextIncomingMailbox > HostAdapter->LastIncomingMailbox)
2528 NextIncomingMailbox = HostAdapter->FirstIncomingMailbox;
2530 HostAdapter->NextIncomingMailbox = NextIncomingMailbox;
2541 static void BusLogic_ProcessCompletedCCBs(struct BusLogic_HostAdapter *HostAdapter)
2543 if (HostAdapter->ProcessCompletedCCBsActive)
2545 HostAdapter->ProcessCompletedCCBsActive = true;
2546 while (HostAdapter->FirstCompletedCCB != NULL) {
2547 struct BusLogic_CCB *CCB = HostAdapter->FirstCompletedCCB;
2549 HostAdapter->FirstCompletedCCB = CCB->Next;
2550 if (HostAdapter->FirstCompletedCCB == NULL)
2551 HostAdapter->LastCompletedCCB = NULL;
2557 BusLogic_Warning("Bus Device Reset CCB #%ld to Target " "%d Completed\n", HostAdapter, CCB->SerialNumber, TargetID);
2558 BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].BusDeviceResetsCompleted);
2559 HostAdapter->TargetFlags[TargetID].TaggedQueuingActive = false;
2560 HostAdapter->CommandsSinceReset[TargetID] = 0;
2561 HostAdapter->LastResetCompleted[TargetID] = jiffies;
2570 for (CCB = HostAdapter->All_CCBs; CCB != NULL; CCB = CCB->NextAll)
2574 HostAdapter->ActiveCommands[TargetID]--;
2578 HostAdapter->BusDeviceResetPendingCCB[TargetID] = NULL;
2588 BusLogic_Warning("CCB #%ld to Target %d Impossible State\n", HostAdapter, CCB->SerialNumber, CCB->TargetID);
2591 HostAdapter->TargetStatistics[CCB->TargetID]
2593 HostAdapter->TargetFlags[CCB->TargetID]
2598 BusLogic_Warning("CCB #%ld to Target %d Aborted\n", HostAdapter, CCB->SerialNumber, CCB->TargetID);
2599 BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[CCB->TargetID]
2604 Command->result = BusLogic_ComputeResultCode(HostAdapter, CCB->HostAdapterStatus, CCB->TargetDeviceStatus);
2606 HostAdapter->TargetStatistics[CCB->TargetID]
2611 "Adapter Status %02X " "Target Status %02X\n", HostAdapter, CCB->SerialNumber, CCB->TargetID, Command->result, CCB->HostAdapterStatus, CCB->TargetDeviceStatus);
2612 BusLogic_Notice("CDB ", HostAdapter);
2614 BusLogic_Notice(" %02X", HostAdapter, CCB->CDB[i]);
2615 BusLogic_Notice("\n", HostAdapter);
2616 BusLogic_Notice("Sense ", HostAdapter);
2618 BusLogic_Notice(" %02X", HostAdapter, Command->sense_buffer[i]);
2619 BusLogic_Notice("\n", HostAdapter);
2630 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[CCB->TargetID];
2647 HostAdapter->ProcessCompletedCCBsActive = false;
2658 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) DeviceIdentifier;
2663 spin_lock_irqsave(HostAdapter->SCSI_Host->host_lock, ProcessorFlags);
2667 if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) {
2672 InterruptRegister.All = BusLogic_ReadInterruptRegister(HostAdapter);
2678 BusLogic_InterruptReset(HostAdapter);
2686 HostAdapter->HostAdapterExternalReset = true;
2688 BusLogic_ScanIncomingMailboxes(HostAdapter);
2690 HostAdapter->HostAdapterCommandCompleted = true;
2696 if (FlashPoint_InterruptPending(HostAdapter->CardHandle))
2697 switch (FlashPoint_HandleInterrupt(HostAdapter->CardHandle)) {
2701 HostAdapter->HostAdapterExternalReset = true;
2704 BusLogic_Warning("Internal FlashPoint Error detected" " - Resetting Host Adapter\n", HostAdapter);
2705 HostAdapter->HostAdapterInternalError = true;
2712 if (HostAdapter->FirstCompletedCCB != NULL)
2713 BusLogic_ProcessCompletedCCBs(HostAdapter);
2717 if (HostAdapter->HostAdapterExternalReset) {
2718 BusLogic_Warning("Resetting %s due to External SCSI Bus Reset\n", HostAdapter, HostAdapter->FullModelName);
2719 BusLogic_IncrementErrorCounter(&HostAdapter->ExternalHostAdapterResets);
2720 BusLogic_ResetHostAdapter(HostAdapter, false);
2721 HostAdapter->HostAdapterExternalReset = false;
2722 } else if (HostAdapter->HostAdapterInternalError) {
2723 BusLogic_Warning("Resetting %s due to Host Adapter Internal Error\n", HostAdapter, HostAdapter->FullModelName);
2724 BusLogic_IncrementErrorCounter(&HostAdapter->HostAdapterInternalErrors);
2725 BusLogic_ResetHostAdapter(HostAdapter, true);
2726 HostAdapter->HostAdapterInternalError = false;
2731 spin_unlock_irqrestore(HostAdapter->SCSI_Host->host_lock, ProcessorFlags);
2743 *HostAdapter, enum BusLogic_ActionCode ActionCode, struct BusLogic_CCB *CCB)
2746 NextOutgoingMailbox = HostAdapter->NextOutgoingMailbox;
2756 BusLogic_StartMailboxCommand(HostAdapter);
2757 if (++NextOutgoingMailbox > HostAdapter->LastOutgoingMailbox)
2758 NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox;
2759 HostAdapter->NextOutgoingMailbox = NextOutgoingMailbox;
2761 HostAdapter->ActiveCommands[CCB->TargetID]++;
2763 HostAdapter->TargetStatistics[CCB->TargetID].CommandsAttempted++;
2774 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) SCpnt->device->host->hostdata;
2777 struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id];
2784 rc = BusLogic_ResetHostAdapter(HostAdapter, false);
2796 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata;
2797 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id];
2798 struct BusLogic_TargetStatistics *TargetStatistics = HostAdapter->TargetStatistics;
2822 CCB = BusLogic_AllocateCCB(HostAdapter);
2824 spin_unlock_irq(HostAdapter->SCSI_Host->host_lock);
2826 spin_lock_irq(HostAdapter->SCSI_Host->host_lock);
2827 CCB = BusLogic_AllocateCCB(HostAdapter);
2846 if (BusLogic_MultiMasterHostAdapterP(HostAdapter))
2903 if (HostAdapter->CommandsSinceReset[TargetID]++ >=
2904 BusLogic_MaxTaggedQueueDepth && !TargetFlags->TaggedQueuingActive && HostAdapter->ActiveCommands[TargetID] == 0 && TargetFlags->TaggedQueuingSupported && (HostAdapter->TaggedQueuingPermitted & (1 << TargetID))) {
2906 BusLogic_Notice("Tagged Queuing now active for Target %d\n", HostAdapter, TargetID);
2923 if (HostAdapter->ActiveCommands[TargetID] == 0)
2924 HostAdapter->LastSequencePoint[TargetID] = jiffies;
2925 else if (time_after(jiffies, HostAdapter->LastSequencePoint[TargetID] + 4 * HZ)) {
2926 HostAdapter->LastSequencePoint[TargetID] = jiffies;
2929 if (HostAdapter->ExtendedLUNSupport) {
2939 CCB->SenseDataPointer = pci_map_single(HostAdapter->PCI_Device, Command->sense_buffer, CCB->SenseDataLength, PCI_DMA_FROMDEVICE);
2942 if (BusLogic_MultiMasterHostAdapterP(HostAdapter)) {
2951 if (!BusLogic_WriteOutgoingMailbox(HostAdapter, BusLogic_MailboxStartCommand, CCB)) {
2952 spin_unlock_irq(HostAdapter->SCSI_Host->host_lock);
2953 BusLogic_Warning("Unable to write Outgoing Mailbox - " "Pausing for 1 second\n", HostAdapter);
2955 spin_lock_irq(HostAdapter->SCSI_Host->host_lock);
2956 if (!BusLogic_WriteOutgoingMailbox(HostAdapter, BusLogic_MailboxStartCommand, CCB)) {
2957 BusLogic_Warning("Still unable to write Outgoing Mailbox - " "Host Adapter Dead?\n", HostAdapter);
2968 HostAdapter->ActiveCommands[TargetID]++;
2970 FlashPoint_StartCCB(HostAdapter->CardHandle, CCB);
2976 BusLogic_ProcessCompletedCCBs(HostAdapter);
2987 static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *HostAdapter, bool HardReset)
2996 if (!(BusLogic_HardwareResetHostAdapter(HostAdapter, HardReset) && BusLogic_InitializeHostAdapter(HostAdapter))) {
2997 BusLogic_Error("Resetting %s Failed\n", HostAdapter, HostAdapter->FullModelName);
3005 for (CCB = HostAdapter->All_CCBs; CCB != NULL; CCB = CCB->NextAll)
3016 spin_unlock_irq(HostAdapter->SCSI_Host->host_lock);
3017 BusLogic_Delay(HostAdapter->BusSettleTime);
3018 spin_lock_irq(HostAdapter->SCSI_Host->host_lock);
3021 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
3022 HostAdapter->LastResetAttempted[TargetID] = jiffies;
3023 HostAdapter->LastResetCompleted[TargetID] = jiffies;
3047 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) sdev->host->hostdata;
3050 if (HostAdapter->ExtendedTranslationEnabled && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */ ) {
3101 BusLogic_Warning("Adopting Geometry %d/%d from Partition Table\n", HostAdapter, DiskParameters->Heads, DiskParameters->Sectors);
3103 BusLogic_Warning("Warning: Partition Table appears to " "have Geometry %d/%d which is\n", HostAdapter, PartitionEntryEndHead + 1, PartitionEntryEndSector);
3104 BusLogic_Warning("not compatible with current BusLogic " "Host Adapter Geometry %d/%d\n", HostAdapter, DiskParameters->Heads, DiskParameters->Sectors);
3118 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata;
3123 TargetStatistics = HostAdapter->TargetStatistics;
3125 HostAdapter->ExternalHostAdapterResets = 0;
3126 HostAdapter->HostAdapterInternalErrors = 0;
3130 Buffer = HostAdapter->MessageBuffer;
3131 Length = HostAdapter->MessageBufferLength;
3134 Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs);
3140 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
3141 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
3144 Length += sprintf(&Buffer[Length], " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID)
3148 " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted);
3153 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
3154 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
3170 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
3171 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
3188 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
3189 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
3210 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
3211 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
3217 Length += sprintf(&Buffer[Length], "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets);
3218 Length += sprintf(&Buffer[Length], "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors);
3220 BusLogic_Error("Message Buffer length %d exceeds size %d\n", HostAdapter, Length, BusLogic_MessageBufferSize);
3225 memcpy(ProcBuffer, HostAdapter->MessageBuffer + Offset, Length);
3235 static void BusLogic_Message(enum BusLogic_MessageLevel MessageLevel, char *Format, struct BusLogic_HostAdapter *HostAdapter, ...)
3241 va_start(Arguments, HostAdapter);
3246 strcpy(&HostAdapter->MessageBuffer[HostAdapter->MessageBufferLength], Buffer);
3247 HostAdapter->MessageBufferLength += Length;
3251 strcpy(&HostAdapter->MessageBuffer[HostAdapter->MessageBufferLength], Buffer);
3252 HostAdapter->MessageBufferLength += Length;
3255 printk("%sscsi%d: %s", BusLogic_MessageLevelMap[MessageLevel], HostAdapter->HostNumber, Buffer);
3260 if (HostAdapter != NULL && HostAdapter->HostAdapterInitialized)
3261 printk("%sscsi%d: %s", BusLogic_MessageLevelMap[MessageLevel], HostAdapter->HostNumber, Buffer);