Lines Matching +full:host +full:- +full:command

1 // SPDX-License-Identifier: GPL-2.0-only
5 Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
7 Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
13 Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
37 #include <linux/dma-mapping.h>
54 #define FAILURE (-1)
61 Options specifications provided via the Linux Kernel Command Line or via
70 BusLogic Driver Options specifications provided via the Linux Kernel Command
90 all BusLogic Host Adapters.
98 all BusLogic Host Adapters.
114 to be checked for potential BusLogic Host Adapters. It is initialized by
124 call to blogic_cmd failed. It is only non-NULL when blogic_cmd
138 blogic_announce("Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>\n", adapter); in blogic_announce_drvr()
143 blogic_drvr_info returns the Host Adapter Name to identify this SCSI
144 Driver and Host Adapter.
147 static const char *blogic_drvr_info(struct Scsi_Host *host) in blogic_drvr_info() argument
150 (struct blogic_adapter *) host->hostdata; in blogic_drvr_info()
151 return adapter->full_model; in blogic_drvr_info()
155 blogic_init_ccbs initializes a group of Command Control Blocks (CCBs)
156 for Host Adapter from the blk_size bytes located at blk_pointer. The newly
157 created CCBs are added to Host Adapter's free list.
166 ccb->allocgrp_head = blkp; in blogic_init_ccbs()
167 ccb->allocgrp_size = blk_size; in blogic_init_ccbs()
168 while ((blk_size -= sizeof(struct blogic_ccb)) >= 0) { in blogic_init_ccbs()
169 ccb->status = BLOGIC_CCB_FREE; in blogic_init_ccbs()
170 ccb->adapter = adapter; in blogic_init_ccbs()
171 ccb->dma_handle = (u32) blkp + offset; in blogic_init_ccbs()
173 ccb->callback = blogic_qcompleted_ccb; in blogic_init_ccbs()
174 ccb->base_addr = adapter->fpinfo.base_addr; in blogic_init_ccbs()
176 ccb->next = adapter->free_ccbs; in blogic_init_ccbs()
177 ccb->next_all = adapter->all_ccbs; in blogic_init_ccbs()
178 adapter->free_ccbs = ccb; in blogic_init_ccbs()
179 adapter->all_ccbs = ccb; in blogic_init_ccbs()
180 adapter->alloc_ccbs++; in blogic_init_ccbs()
188 blogic_create_initccbs allocates the initial CCBs for Host Adapter.
197 while (adapter->alloc_ccbs < adapter->initccbs) { in blogic_create_initccbs()
198 blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev, in blogic_create_initccbs()
201 blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n", in blogic_create_initccbs()
212 blogic_destroy_ccbs deallocates the CCBs for Host Adapter.
217 struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL; in blogic_destroy_ccbs()
218 adapter->all_ccbs = NULL; in blogic_destroy_ccbs()
219 adapter->free_ccbs = NULL; in blogic_destroy_ccbs()
221 next_ccb = ccb->next_all; in blogic_destroy_ccbs()
222 if (ccb->allocgrp_head) { in blogic_destroy_ccbs()
224 dma_free_coherent(&adapter->pci_device->dev, in blogic_destroy_ccbs()
225 lastccb->allocgrp_size, lastccb, in blogic_destroy_ccbs()
226 lastccb->allocgrp_head); in blogic_destroy_ccbs()
231 dma_free_coherent(&adapter->pci_device->dev, in blogic_destroy_ccbs()
232 lastccb->allocgrp_size, lastccb, in blogic_destroy_ccbs()
233 lastccb->allocgrp_head); in blogic_destroy_ccbs()
238 blogic_create_addlccbs allocates Additional CCBs for Host Adapter. If
241 multiple host adapters share the same IRQ Channel.
248 int prev_alloc = adapter->alloc_ccbs; in blogic_create_addlccbs()
253 while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) { in blogic_create_addlccbs()
254 blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev, in blogic_create_addlccbs()
260 if (adapter->alloc_ccbs > prev_alloc) { in blogic_create_addlccbs()
262 …ated %d additional CCBs (total now %d)\n", adapter, adapter->alloc_ccbs - prev_alloc, adapter->all… in blogic_create_addlccbs()
266 if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) { in blogic_create_addlccbs()
267 adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count; in blogic_create_addlccbs()
268 adapter->scsi_host->can_queue = adapter->drvr_qdepth; in blogic_create_addlccbs()
273 blogic_alloc_ccb allocates a CCB from Host Adapter's free list,
274 allocating more memory from the Kernel if necessary. The Host Adapter's
282 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
284 ccb->serial = ++serial; in blogic_alloc_ccb()
285 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
286 ccb->next = NULL; in blogic_alloc_ccb()
287 if (adapter->free_ccbs == NULL) in blogic_alloc_ccb()
288 blogic_create_addlccbs(adapter, adapter->inc_ccbs, in blogic_alloc_ccb()
292 blogic_create_addlccbs(adapter, adapter->inc_ccbs, true); in blogic_alloc_ccb()
293 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
296 ccb->serial = ++serial; in blogic_alloc_ccb()
297 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
298 ccb->next = NULL; in blogic_alloc_ccb()
304 blogic_dealloc_ccb deallocates a CCB, returning it to the Host Adapter's
305 free list. The Host Adapter's Lock should already have been acquired by the
311 struct blogic_adapter *adapter = ccb->adapter; in blogic_dealloc_ccb()
313 if (ccb->command != NULL) in blogic_dealloc_ccb()
314 scsi_dma_unmap(ccb->command); in blogic_dealloc_ccb()
316 dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata, in blogic_dealloc_ccb()
317 ccb->sense_datalen, DMA_FROM_DEVICE); in blogic_dealloc_ccb()
319 ccb->command = NULL; in blogic_dealloc_ccb()
320 ccb->status = BLOGIC_CCB_FREE; in blogic_dealloc_ccb()
321 ccb->next = adapter->free_ccbs; in blogic_dealloc_ccb()
322 adapter->free_ccbs = ccb; in blogic_dealloc_ccb()
327 blogic_cmd sends the command opcode to adapter, optionally
333 the Host Adapter (including any discarded data); on failure, it returns
334 -1 if the command was invalid, or -2 if a timeout occurred.
336 blogic_cmd is called exclusively during host adapter detection and
338 access to the Host Adapter hardware is assumed. Once the host adapter and
339 driver are initialized, the only Host Adapter command that is issued is the
340 single byte Execute Mailbox Command operation code, which does not require
341 waiting for the Host Adapter Ready bit to be set in the Status Register.
361 must be disabled while issuing host adapter commands since a in blogic_cmd()
362 Command Complete interrupt could occur if the IRQ Channel was in blogic_cmd()
363 previously enabled by another BusLogic Host Adapter or another in blogic_cmd()
366 if (!adapter->irq_acquired) in blogic_cmd()
369 Wait for the Host Adapter Ready bit to be set and the in blogic_cmd()
370 Command/Parameter Register Busy bit to be reset in the Status in blogic_cmd()
374 while (--timeout >= 0) { in blogic_cmd()
382 "Timeout waiting for Host Adapter Ready"; in blogic_cmd()
383 result = -2; in blogic_cmd()
387 Write the opcode to the Command/Parameter Register. in blogic_cmd()
389 adapter->adapter_cmd_complete = false; in blogic_cmd()
395 while (paramlen > 0 && --timeout >= 0) { in blogic_cmd()
397 Wait 100 microseconds to give the Host Adapter enough in blogic_cmd()
399 Command/Parameter Register was valid or not. If the in blogic_cmd()
400 Command Complete bit is set in the Interrupt Register, in blogic_cmd()
401 then the Command Invalid bit in the Status Register will in blogic_cmd()
403 and the command has completed, or set if the Operation in blogic_cmd()
407 back from the Host Adapter. Otherwise, wait for the in blogic_cmd()
408 Command/Parameter Register Busy bit in the Status in blogic_cmd()
416 if (adapter->adapter_cmd_complete) in blogic_cmd()
423 paramlen--; in blogic_cmd()
428 result = -2; in blogic_cmd()
432 The Modify I/O Address command does not cause a Command Complete in blogic_cmd()
440 result = -1; in blogic_cmd()
449 Select an appropriate timeout value for awaiting command completion. in blogic_cmd()
464 Receive any Reply Bytes, waiting for either the Command in blogic_cmd()
466 Interrupt Handler to set the Host Adapter Command Completed in blogic_cmd()
467 bit in the Host Adapter structure. in blogic_cmd()
469 while (--timeout >= 0) { in blogic_cmd()
474 if (adapter->adapter_cmd_complete) in blogic_cmd()
489 "Timeout waiting for Command Complete"; in blogic_cmd()
490 result = -2; in blogic_cmd()
494 Clear any pending Command Complete Interrupt. in blogic_cmd()
513 Process Command Invalid conditions. in blogic_cmd()
517 Some early BusLogic Host Adapters may not recover in blogic_cmd()
518 properly from a Command Invalid condition, so if this in blogic_cmd()
520 Host Adapter. Potentially invalid commands are never in blogic_cmd()
522 so there should be no Host Adapter state lost by a in blogic_cmd()
523 Soft Reset in response to a Command Invalid condition. in blogic_cmd()
537 blogic_cmd_failure_reason = "Command Invalid"; in blogic_cmd()
538 result = -1; in blogic_cmd()
546 result = -1; in blogic_cmd()
550 Indicate the command completed successfully. in blogic_cmd()
558 if (!adapter->irq_acquired) in blogic_cmd()
572 int last_exchange = probeinfo_cnt - 1, bound, j; in blogic_sort_probeinfo()
582 if (probeinfo1->bus > probeinfo2->bus || in blogic_sort_probeinfo()
583 (probeinfo1->bus == probeinfo2->bus && in blogic_sort_probeinfo()
584 (probeinfo1->dev > probeinfo2->dev))) { in blogic_sort_probeinfo()
603 SCSI Host Adapters by interrogating the PCI Configuration Space on PCI
605 I/O Addresses. It returns the number of PCI MultiMaster Host Adapters found.
622 Iterate over the MultiMaster PCI Host Adapters. For each in blogic_init_mm_probeinfo()
623 enumerated host adapter, determine whether its ISA Compatible in blogic_init_mm_probeinfo()
625 Primary I/O Address. A host adapter that is assigned the in blogic_init_mm_probeinfo()
627 The MultiMaster BIOS will first recognize a host adapter at in blogic_init_mm_probeinfo()
628 the Primary I/O Address, then any other PCI host adapters, in blogic_init_mm_probeinfo()
629 and finally any host adapters located at the remaining in blogic_init_mm_probeinfo()
630 standard ISA I/O Addresses. When a PCI host adapter is found in blogic_init_mm_probeinfo()
631 with its ISA Compatible I/O Port enabled, a command is issued in blogic_init_mm_probeinfo()
635 pr_probeinfo->io_addr = 0; in blogic_init_mm_probeinfo()
653 if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32))) in blogic_init_mm_probeinfo()
656 bus = pci_device->bus->number; in blogic_init_mm_probeinfo()
657 device = pci_device->devfn >> 3; in blogic_init_mm_probeinfo()
658 irq_ch = pci_device->irq; in blogic_init_mm_probeinfo()
663 …blogic_err("BusLogic: Base Address0 0x%lX not I/O for MultiMaster Host Adapter\n", NULL, base_addr… in blogic_init_mm_probeinfo()
668 …blogic_err("BusLogic: Base Address1 0x%lX not Memory for MultiMaster Host Adapter\n", NULL, base_a… in blogic_init_mm_probeinfo()
673 blogic_err("BusLogic: IRQ Channel %d invalid for MultiMaster Host Adapter\n", NULL, irq_ch); in blogic_init_mm_probeinfo()
678 blogic_notice("BusLogic: PCI MultiMaster Host Adapter detected at\n", NULL); in blogic_init_mm_probeinfo()
682 Issue the Inquire PCI Host Adapter Information command to determine in blogic_init_mm_probeinfo()
687 host_adapter->io_addr = io_addr; in blogic_init_mm_probeinfo()
694 Issue the Modify I/O Address command to disable the in blogic_init_mm_probeinfo()
695 ISA Compatible I/O Port. On PCI Host Adapters, the in blogic_init_mm_probeinfo()
696 Modify I/O Address command allows modification of the in blogic_init_mm_probeinfo()
697 ISA compatible I/O Address that the Host Adapter in blogic_init_mm_probeinfo()
705 For the first MultiMaster Host Adapter enumerated, in blogic_init_mm_probeinfo()
706 issue the Fetch Host Adapter Local RAM command to read in blogic_init_mm_probeinfo()
709 Issue the Inquire Board ID command since this option is in blogic_init_mm_probeinfo()
710 only valid for the BT-948/958/958D. in blogic_init_mm_probeinfo()
731 Determine whether this MultiMaster Host Adapter has its in blogic_init_mm_probeinfo()
734 MultiMaster Host Adapter and must be recognized first. in blogic_init_mm_probeinfo()
736 after any Primary MultiMaster Host Adapter is probed. in blogic_init_mm_probeinfo()
739 pr_probeinfo->adapter_type = BLOGIC_MULTIMASTER; in blogic_init_mm_probeinfo()
740 pr_probeinfo->adapter_bus_type = BLOGIC_PCI_BUS; in blogic_init_mm_probeinfo()
741 pr_probeinfo->io_addr = io_addr; in blogic_init_mm_probeinfo()
742 pr_probeinfo->pci_addr = pci_addr; in blogic_init_mm_probeinfo()
743 pr_probeinfo->bus = bus; in blogic_init_mm_probeinfo()
744 pr_probeinfo->dev = device; in blogic_init_mm_probeinfo()
745 pr_probeinfo->irq_ch = irq_ch; in blogic_init_mm_probeinfo()
746 pr_probeinfo->pci_device = pci_dev_get(pci_device); in blogic_init_mm_probeinfo()
751 probeinfo->adapter_type = BLOGIC_MULTIMASTER; in blogic_init_mm_probeinfo()
752 probeinfo->adapter_bus_type = BLOGIC_PCI_BUS; in blogic_init_mm_probeinfo()
753 probeinfo->io_addr = io_addr; in blogic_init_mm_probeinfo()
754 probeinfo->pci_addr = pci_addr; in blogic_init_mm_probeinfo()
755 probeinfo->bus = bus; in blogic_init_mm_probeinfo()
756 probeinfo->dev = device; in blogic_init_mm_probeinfo()
757 probeinfo->irq_ch = irq_ch; in blogic_init_mm_probeinfo()
758 probeinfo->pci_device = pci_dev_get(pci_device); in blogic_init_mm_probeinfo()
762 blogic_warn("BusLogic: Too many Host Adapters detected\n", NULL); in blogic_init_mm_probeinfo()
766 option is ON for the first enumerated MultiMaster Host Adapter, in blogic_init_mm_probeinfo()
767 and if that host adapter is a BT-948/958/958D, then the in blogic_init_mm_probeinfo()
768 MultiMaster BIOS will recognize MultiMaster Host Adapters in in blogic_init_mm_probeinfo()
772 MultiMaster Host Adapters in the order they are enumerated by in blogic_init_mm_probeinfo()
779 Iterate over the older non-compliant MultiMaster PCI Host Adapters, in blogic_init_mm_probeinfo()
794 if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32))) in blogic_init_mm_probeinfo()
797 bus = pci_device->bus->number; in blogic_init_mm_probeinfo()
798 device = pci_device->devfn >> 3; in blogic_init_mm_probeinfo()
799 irq_ch = pci_device->irq; in blogic_init_mm_probeinfo()
807 if (probeinfo->io_addr == io_addr && in blogic_init_mm_probeinfo()
808 probeinfo->adapter_type == BLOGIC_MULTIMASTER) { in blogic_init_mm_probeinfo()
809 probeinfo->adapter_bus_type = BLOGIC_PCI_BUS; in blogic_init_mm_probeinfo()
810 probeinfo->pci_addr = 0; in blogic_init_mm_probeinfo()
811 probeinfo->bus = bus; in blogic_init_mm_probeinfo()
812 probeinfo->dev = device; in blogic_init_mm_probeinfo()
813 probeinfo->irq_ch = irq_ch; in blogic_init_mm_probeinfo()
814 probeinfo->pci_device = pci_dev_get(pci_device); in blogic_init_mm_probeinfo()
826 Host Adapters by interrogating the PCI Configuration Space. It returns the
827 number of FlashPoint Host Adapters found.
835 Interrogate PCI Configuration Space for any FlashPoint Host Adapters. in blogic_init_fp_probeinfo()
851 if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32))) in blogic_init_fp_probeinfo()
854 bus = pci_device->bus->number; in blogic_init_fp_probeinfo()
855 device = pci_device->devfn >> 3; in blogic_init_fp_probeinfo()
856 irq_ch = pci_device->irq; in blogic_init_fp_probeinfo()
861 …blogic_err("BusLogic: Base Address0 0x%lX not I/O for FlashPoint Host Adapter\n", NULL, base_addr0… in blogic_init_fp_probeinfo()
866 …blogic_err("BusLogic: Base Address1 0x%lX not Memory for FlashPoint Host Adapter\n", NULL, base_ad… in blogic_init_fp_probeinfo()
871 blogic_err("BusLogic: IRQ Channel %d invalid for FlashPoint Host Adapter\n", NULL, irq_ch); in blogic_init_fp_probeinfo()
876 blogic_notice("BusLogic: FlashPoint Host Adapter detected at\n", NULL); in blogic_init_fp_probeinfo()
882 probeinfo->adapter_type = BLOGIC_FLASHPOINT; in blogic_init_fp_probeinfo()
883 probeinfo->adapter_bus_type = BLOGIC_PCI_BUS; in blogic_init_fp_probeinfo()
884 probeinfo->io_addr = io_addr; in blogic_init_fp_probeinfo()
885 probeinfo->pci_addr = pci_addr; in blogic_init_fp_probeinfo()
886 probeinfo->bus = bus; in blogic_init_fp_probeinfo()
887 probeinfo->dev = device; in blogic_init_fp_probeinfo()
888 probeinfo->irq_ch = irq_ch; in blogic_init_fp_probeinfo()
889 probeinfo->pci_device = pci_dev_get(pci_device); in blogic_init_fp_probeinfo()
892 blogic_warn("BusLogic: Too many Host Adapters detected\n", NULL); in blogic_init_fp_probeinfo()
894 …blogic_err("BusLogic: FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", NULL, bus, devi… in blogic_init_fp_probeinfo()
900 The FlashPoint BIOS will scan for FlashPoint Host Adapters in the order of in blogic_init_fp_probeinfo()
911 Probe Information to be checked for potential BusLogic SCSI Host Adapters by
914 FlashPoint and PCI MultiMaster Host Adapters are present, this driver will
915 probe for FlashPoint Host Adapters first unless the BIOS primary disk is
916 controlled by the first PCI MultiMaster Host Adapter, in which case
917 MultiMaster Host Adapters will be probed first. The BusLogic Driver Options
926 FlashPoint Host Adapters; otherwise, default to the standard in blogic_init_probeinfo_list()
946 while (probeinfo->adapter_bus_type != in blogic_init_probeinfo_list()
949 myadapter->io_addr = probeinfo->io_addr; in blogic_init_probeinfo_list()
961 PCI MultiMaster Host Adapter, then reverse in blogic_init_probeinfo_list()
962 the probe order so that MultiMaster Host in blogic_init_probeinfo_list()
963 Adapters are probed before FlashPoint Host in blogic_init_probeinfo_list()
968 int mmcount = blogic_probeinfo_count - fpcount; in blogic_init_probeinfo_list()
993 if (adapter->adapter_bus_type == BLOGIC_PCI_BUS) { in blogic_failure()
994 blogic_err("While configuring BusLogic PCI Host Adapter at\n", in blogic_failure()
996 …Address 0x%lX PCI Address 0x%lX:\n", adapter, adapter->bus, adapter->dev, adapter->io_addr, adapte… in blogic_failure()
998 …blogic_err("While configuring BusLogic Host Adapter at I/O Address 0x%lX:\n", adapter, adapter->io… in blogic_failure()
999 blogic_err("%s FAILED - DETACHING\n", adapter, msg); in blogic_failure()
1001 blogic_err("ADDITIONAL FAILURE INFO - %s\n", adapter, in blogic_failure()
1008 blogic_probe probes for a BusLogic Host Adapter.
1017 FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager. in blogic_probe()
1020 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_probe()
1021 fpinfo->base_addr = (u32) adapter->io_addr; in blogic_probe()
1022 fpinfo->irq_ch = adapter->irq_ch; in blogic_probe()
1023 fpinfo->present = false; in blogic_probe()
1025 fpinfo->present)) { in blogic_probe()
1026 …blogic_err("BusLogic: FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", adapter, adapte… in blogic_probe()
1027 … Address 0x%lX PCI Address 0x%lX, but FlashPoint\n", adapter, adapter->io_addr, adapter->pci_addr); in blogic_probe()
1032 blogic_notice("BusLogic_Probe(0x%lX): FlashPoint Found\n", adapter, adapter->io_addr); in blogic_probe()
1034 Indicate the Host Adapter Probe completed successfully. in blogic_probe()
1041 BusLogic Host Adapter. A nonexistent I/O port will return 0xFF, in which in blogic_probe()
1042 case there is definitely no BusLogic Host Adapter at this base I/O Address. in blogic_probe()
1043 The test here is a subset of that used by the BusLogic Host Adapter BIOS. in blogic_probe()
1049 …x%lX): Status 0x%02X, Interrupt 0x%02X, Geometry 0x%02X\n", adapter, adapter->io_addr, statusreg.a… in blogic_probe()
1056 an I/O port that responded. Adaptec Host Adapters do not in blogic_probe()
1061 later when the Inquire Extended Setup Information command is in blogic_probe()
1062 issued in blogic_checkadapter. The AMI FastDisk Host Adapter in blogic_probe()
1064 earlier BusLogic Host Adapters, including the undocumented in blogic_probe()
1073 Indicate the Host Adapter Probe completed successfully. in blogic_probe()
1080 blogic_hwreset issues a Hardware Reset to the Host Adapter
1081 and waits for Host Adapter Diagnostics to complete. If hard_reset is true, a
1083 Soft Reset is performed which only resets the Host Adapter without forcing a
1092 FlashPoint Host Adapters are Hard Reset by the FlashPoint in blogic_hwreset()
1096 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_hwreset()
1097 fpinfo->softreset = !hard_reset; in blogic_hwreset()
1098 fpinfo->report_underrun = true; in blogic_hwreset()
1099 adapter->cardhandle = in blogic_hwreset()
1101 if (adapter->cardhandle == (void *)FPOINT_BADCARD_HANDLE) in blogic_hwreset()
1104 Indicate the Host Adapter Hard Reset completed successfully. in blogic_hwreset()
1109 Issue a Hard Reset or Soft Reset Command to the Host Adapter. in blogic_hwreset()
1110 The Host Adapter should respond by setting Diagnostic Active in in blogic_hwreset()
1121 while (--timeout >= 0) { in blogic_hwreset()
1128 …_HardwareReset(0x%lX): Diagnostic Active, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.a… in blogic_hwreset()
1141 while (--timeout >= 0) { in blogic_hwreset()
1148 …rdwareReset(0x%lX): Diagnostic Completed, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.a… in blogic_hwreset()
1152 Wait until at least one of the Diagnostic Failure, Host Adapter in blogic_hwreset()
1156 while (--timeout >= 0) { in blogic_hwreset()
1164 …blogic_notice("BusLogic_HardwareReset(0x%lX): Host Adapter Ready, Status 0x%02X\n", adapter, adapt… in blogic_hwreset()
1168 If Diagnostic Failure is set or Host Adapter Ready is reset, in blogic_hwreset()
1169 then an error occurred during the Host Adapter diagnostics. in blogic_hwreset()
1176 blogic_err("HOST ADAPTER STATUS REGISTER = %02X\n", adapter, in blogic_hwreset()
1179 blogic_err("HOST ADAPTER ERROR CODE = %d\n", adapter, in blogic_hwreset()
1184 Indicate the Host Adapter Hard Reset completed successfully. in blogic_hwreset()
1192 Host Adapter.
1201 FlashPoint Host Adapters do not require this protection. in blogic_checkadapter()
1206 Issue the Inquire Extended Setup Information command. Only genuine in blogic_checkadapter()
1207 BusLogic Host Adapters and true clones support this command. in blogic_checkadapter()
1208 Adaptec 1542C series Host Adapters that respond to the Geometry in blogic_checkadapter()
1209 Register I/O port will fail this command. in blogic_checkadapter()
1221 adapter->io_addr, in blogic_checkadapter()
1229 from Host Adapter and initializes the Host Adapter structure.
1249 Configuration Information for FlashPoint Host Adapters is in blogic_rdconfig()
1252 Host Adapter structure from the fpoint_info structure. in blogic_rdconfig()
1255 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_rdconfig()
1256 tgt = adapter->model; in blogic_rdconfig()
1259 *tgt++ = '-'; in blogic_rdconfig()
1260 for (i = 0; i < sizeof(fpinfo->model); i++) in blogic_rdconfig()
1261 *tgt++ = fpinfo->model[i]; in blogic_rdconfig()
1263 strcpy(adapter->fw_ver, FLASHPOINT_FW_VER); in blogic_rdconfig()
1264 adapter->scsi_id = fpinfo->scsi_id; in blogic_rdconfig()
1265 adapter->ext_trans_enable = fpinfo->ext_trans_enable; in blogic_rdconfig()
1266 adapter->parity = fpinfo->parity; in blogic_rdconfig()
1267 adapter->reset_enabled = !fpinfo->softreset; in blogic_rdconfig()
1268 adapter->level_int = true; in blogic_rdconfig()
1269 adapter->wide = fpinfo->wide; in blogic_rdconfig()
1270 adapter->differential = false; in blogic_rdconfig()
1271 adapter->scam = true; in blogic_rdconfig()
1272 adapter->ultra = true; in blogic_rdconfig()
1273 adapter->ext_lun = true; in blogic_rdconfig()
1274 adapter->terminfo_valid = true; in blogic_rdconfig()
1275 adapter->low_term = fpinfo->low_term; in blogic_rdconfig()
1276 adapter->high_term = fpinfo->high_term; in blogic_rdconfig()
1277 adapter->scam_enabled = fpinfo->scam_enabled; in blogic_rdconfig()
1278 adapter->scam_lev2 = fpinfo->scam_lev2; in blogic_rdconfig()
1279 adapter->drvr_sglimit = BLOGIC_SG_LIMIT; in blogic_rdconfig()
1280 adapter->maxdev = (adapter->wide ? 16 : 8); in blogic_rdconfig()
1281 adapter->maxlun = 32; in blogic_rdconfig()
1282 adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1283 adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1284 adapter->drvr_qdepth = 255; in blogic_rdconfig()
1285 adapter->adapter_qdepth = adapter->drvr_qdepth; in blogic_rdconfig()
1286 adapter->sync_ok = fpinfo->sync_ok; in blogic_rdconfig()
1287 adapter->fast_ok = fpinfo->fast_ok; in blogic_rdconfig()
1288 adapter->ultra_ok = fpinfo->ultra_ok; in blogic_rdconfig()
1289 adapter->wide_ok = fpinfo->wide_ok; in blogic_rdconfig()
1290 adapter->discon_ok = fpinfo->discon_ok; in blogic_rdconfig()
1291 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1295 Issue the Inquire Board ID command. in blogic_rdconfig()
1301 Issue the Inquire Configuration command. in blogic_rdconfig()
1308 Issue the Inquire Setup Information command. in blogic_rdconfig()
1316 Issue the Inquire Extended Setup Information command. in blogic_rdconfig()
1325 Issue the Inquire Firmware Version 3rd Digit command. in blogic_rdconfig()
1335 Issue the Inquire Host Adapter Model Number command. in blogic_rdconfig()
1338 /* BusLogic BT-542B ISA 2.xx */ in blogic_rdconfig()
1343 /* BusLogic BT-742A EISA 2.1x or 2.20 */ in blogic_rdconfig()
1354 "INQUIRE HOST ADAPTER MODEL NUMBER"); in blogic_rdconfig()
1357 BusLogic MultiMaster Host Adapters can be identified by their in blogic_rdconfig()
1361 5.xx BusLogic "W" Series Host Adapters: in blogic_rdconfig()
1362 BT-948/958/958D in blogic_rdconfig()
1363 4.xx BusLogic "C" Series Host Adapters: in blogic_rdconfig()
1364 BT-946C/956C/956CD/747C/757C/757CD/445C/545C/540CF in blogic_rdconfig()
1365 3.xx BusLogic "S" Series Host Adapters: in blogic_rdconfig()
1366 BT-747S/747D/757S/757D/445S/545S/542D in blogic_rdconfig()
1367 BT-542B/742A (revision H) in blogic_rdconfig()
1368 2.xx BusLogic "A" Series Host Adapters: in blogic_rdconfig()
1369 BT-542B/742A (revision G and below) in blogic_rdconfig()
1370 0.xx AMI FastDisk VLB/EISA BusLogic Clone Host Adapter in blogic_rdconfig()
1373 Save the Model Name and Host Adapter Name in the Host Adapter in blogic_rdconfig()
1376 tgt = adapter->model; in blogic_rdconfig()
1379 *tgt++ = '-'; in blogic_rdconfig()
1388 Save the Firmware Version in the Host Adapter structure. in blogic_rdconfig()
1390 tgt = adapter->fw_ver; in blogic_rdconfig()
1398 Issue the Inquire Firmware Version Letter command. in blogic_rdconfig()
1400 if (strcmp(adapter->fw_ver, "3.3") >= 0) { in blogic_rdconfig()
1411 Save the Host Adapter SCSI ID in the Host Adapter structure. in blogic_rdconfig()
1413 adapter->scsi_id = config.id; in blogic_rdconfig()
1415 Determine the Bus Type and save it in the Host Adapter structure, in blogic_rdconfig()
1417 and save the DMA Channel for ISA Host Adapters. in blogic_rdconfig()
1419 adapter->adapter_bus_type = in blogic_rdconfig()
1420 blogic_adater_bus_types[adapter->model[3] - '4']; in blogic_rdconfig()
1421 if (adapter->irq_ch == 0) { in blogic_rdconfig()
1423 adapter->irq_ch = 9; in blogic_rdconfig()
1425 adapter->irq_ch = 10; in blogic_rdconfig()
1427 adapter->irq_ch = 11; in blogic_rdconfig()
1429 adapter->irq_ch = 12; in blogic_rdconfig()
1431 adapter->irq_ch = 14; in blogic_rdconfig()
1433 adapter->irq_ch = 15; in blogic_rdconfig()
1437 the Host Adapter structure. in blogic_rdconfig()
1440 adapter->ext_trans_enable = georeg.gr.ext_trans_enable; in blogic_rdconfig()
1444 Ultra SCSI flag in the Host Adapter structure. in blogic_rdconfig()
1446 adapter->adapter_sglimit = ext_setupinfo.sg_limit; in blogic_rdconfig()
1447 adapter->drvr_sglimit = adapter->adapter_sglimit; in blogic_rdconfig()
1448 if (adapter->adapter_sglimit > BLOGIC_SG_LIMIT) in blogic_rdconfig()
1449 adapter->drvr_sglimit = BLOGIC_SG_LIMIT; in blogic_rdconfig()
1451 adapter->level_int = true; in blogic_rdconfig()
1452 adapter->wide = ext_setupinfo.wide; in blogic_rdconfig()
1453 adapter->differential = ext_setupinfo.differential; in blogic_rdconfig()
1454 adapter->scam = ext_setupinfo.scam; in blogic_rdconfig()
1455 adapter->ultra = ext_setupinfo.ultra; in blogic_rdconfig()
1458 information in the Host Adapter structure. in blogic_rdconfig()
1460 if (adapter->fw_ver[0] == '5' || (adapter->fw_ver[0] == '4' && in blogic_rdconfig()
1461 adapter->wide)) in blogic_rdconfig()
1462 adapter->ext_lun = true; in blogic_rdconfig()
1464 Issue the Inquire PCI Host Adapter Information command to read the in blogic_rdconfig()
1465 Termination Information from "W" series MultiMaster Host Adapters. in blogic_rdconfig()
1467 if (adapter->fw_ver[0] == '5') { in blogic_rdconfig()
1472 "INQUIRE PCI HOST ADAPTER INFORMATION"); in blogic_rdconfig()
1474 Save the Termination Information in the Host Adapter in blogic_rdconfig()
1478 adapter->terminfo_valid = true; in blogic_rdconfig()
1479 adapter->low_term = adapter_info.low_term; in blogic_rdconfig()
1480 adapter->high_term = adapter_info.high_term; in blogic_rdconfig()
1484 Issue the Fetch Host Adapter Local RAM command to read the in blogic_rdconfig()
1485 AutoSCSI data from "W" and "C" series MultiMaster Host Adapters. in blogic_rdconfig()
1487 if (adapter->fw_ver[0] >= '4') { in blogic_rdconfig()
1494 "FETCH HOST ADAPTER LOCAL RAM"); in blogic_rdconfig()
1497 and Termination Information in the Host Adapter structure. in blogic_rdconfig()
1499 adapter->parity = autoscsi.parity; in blogic_rdconfig()
1500 adapter->reset_enabled = autoscsi.reset_enabled; in blogic_rdconfig()
1501 if (adapter->fw_ver[0] == '4') { in blogic_rdconfig()
1502 adapter->terminfo_valid = true; in blogic_rdconfig()
1503 adapter->low_term = autoscsi.low_term; in blogic_rdconfig()
1504 adapter->high_term = autoscsi.high_term; in blogic_rdconfig()
1509 SCAM Information in the Host Adapter structure. in blogic_rdconfig()
1511 adapter->wide_ok = autoscsi.wide_ok; in blogic_rdconfig()
1512 adapter->fast_ok = autoscsi.fast_ok; in blogic_rdconfig()
1513 adapter->sync_ok = autoscsi.sync_ok; in blogic_rdconfig()
1514 adapter->discon_ok = autoscsi.discon_ok; in blogic_rdconfig()
1515 if (adapter->ultra) in blogic_rdconfig()
1516 adapter->ultra_ok = autoscsi.ultra_ok; in blogic_rdconfig()
1517 if (adapter->scam) { in blogic_rdconfig()
1518 adapter->scam_enabled = autoscsi.scam_enabled; in blogic_rdconfig()
1519 adapter->scam_lev2 = autoscsi.scam_lev2; in blogic_rdconfig()
1523 Initialize fields in the Host Adapter structure for "S" and "A" in blogic_rdconfig()
1524 series MultiMaster Host Adapters. in blogic_rdconfig()
1526 if (adapter->fw_ver[0] < '4') { in blogic_rdconfig()
1528 adapter->sync_ok = 0xFF; in blogic_rdconfig()
1529 if (adapter->adapter_bus_type == BLOGIC_EISA_BUS) { in blogic_rdconfig()
1531 adapter->fast_ok = 0xFF; in blogic_rdconfig()
1532 if (strcmp(adapter->model, "BT-757") == 0) in blogic_rdconfig()
1533 adapter->wide_ok = 0xFF; in blogic_rdconfig()
1536 adapter->discon_ok = 0xFF; in blogic_rdconfig()
1537 adapter->parity = setupinfo.parity; in blogic_rdconfig()
1538 adapter->reset_enabled = true; in blogic_rdconfig()
1542 supported by this driver for Wide and Narrow Host Adapters. in blogic_rdconfig()
1544 adapter->maxdev = (adapter->wide ? 16 : 8); in blogic_rdconfig()
1545 adapter->maxlun = (adapter->ext_lun ? 32 : 8); in blogic_rdconfig()
1554 not supported, then the Host Adapter must scan all the Outgoing in blogic_rdconfig()
1556 cause a substantial performance penalty. The host adapters in blogic_rdconfig()
1561 set to the Mailbox Count, rather than the Host Adapter Queue in blogic_rdconfig()
1566 192 BT-948/958/958D in blogic_rdconfig()
1567 100 BT-946C/956C/956CD/747C/757C/757CD/445C in blogic_rdconfig()
1568 50 BT-545C/540CF in blogic_rdconfig()
1569 30 BT-747S/747D/757S/757D/445S/545S/542D/542B/742A in blogic_rdconfig()
1571 if (adapter->fw_ver[0] == '5') in blogic_rdconfig()
1572 adapter->adapter_qdepth = 192; in blogic_rdconfig()
1573 else if (adapter->fw_ver[0] == '4') in blogic_rdconfig()
1574 adapter->adapter_qdepth = 100; in blogic_rdconfig()
1576 adapter->adapter_qdepth = 30; in blogic_rdconfig()
1577 if (strcmp(adapter->fw_ver, "3.31") >= 0) { in blogic_rdconfig()
1578 adapter->strict_rr = true; in blogic_rdconfig()
1579 adapter->mbox_count = BLOGIC_MAX_MAILBOX; in blogic_rdconfig()
1581 adapter->strict_rr = false; in blogic_rdconfig()
1582 adapter->mbox_count = 32; in blogic_rdconfig()
1584 adapter->drvr_qdepth = adapter->mbox_count; in blogic_rdconfig()
1585 adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1586 adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1589 all "W" series MultiMaster Host Adapters, on "C" series in blogic_rdconfig()
1590 MultiMaster Host Adapters with firmware version 4.22 and above, in blogic_rdconfig()
1591 and on "S" series MultiMaster Host Adapters with firmware version in blogic_rdconfig()
1594 adapter->tagq_ok = 0; in blogic_rdconfig()
1595 switch (adapter->fw_ver[0]) { in blogic_rdconfig()
1597 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1600 if (strcmp(adapter->fw_ver, "4.22") >= 0) in blogic_rdconfig()
1601 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1604 if (strcmp(adapter->fw_ver, "3.35") >= 0) in blogic_rdconfig()
1605 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1609 Determine the Host Adapter BIOS Address if the BIOS is enabled and in blogic_rdconfig()
1610 save it in the Host Adapter structure. The BIOS is disabled if the in blogic_rdconfig()
1613 adapter->bios_addr = ext_setupinfo.bios_addr << 12; in blogic_rdconfig()
1615 BusLogic BT-445S Host Adapters prior to board revision E have a in blogic_rdconfig()
1618 incorrectly. Only properly functioning BT-445S Host Adapters in blogic_rdconfig()
1621 if (adapter->bios_addr > 0 && in blogic_rdconfig()
1622 strcmp(adapter->model, "BT-445S") == 0 && in blogic_rdconfig()
1623 strcmp(adapter->fw_ver, "3.37") < 0) in blogic_rdconfig()
1627 Host Adapters. in blogic_rdconfig()
1631 Initialize the Host Adapter Full Model Name from the Model Name. in blogic_rdconfig()
1633 strcpy(adapter->full_model, "BusLogic "); in blogic_rdconfig()
1634 strcat(adapter->full_model, adapter->model); in blogic_rdconfig()
1637 BusLogic Driver Options specification, or based on whether this Host in blogic_rdconfig()
1644 if (adapter->drvr_opts != NULL && in blogic_rdconfig()
1645 adapter->drvr_opts->qdepth[tgt_id] > 0) in blogic_rdconfig()
1646 qdepth = adapter->drvr_opts->qdepth[tgt_id]; in blogic_rdconfig()
1647 adapter->qdepth[tgt_id] = qdepth; in blogic_rdconfig()
1649 adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH; in blogic_rdconfig()
1650 if (adapter->drvr_opts != NULL) in blogic_rdconfig()
1651 adapter->common_qdepth = adapter->drvr_opts->common_qdepth; in blogic_rdconfig()
1652 if (adapter->common_qdepth > 0 && in blogic_rdconfig()
1653 adapter->common_qdepth < adapter->untag_qdepth) in blogic_rdconfig()
1654 adapter->untag_qdepth = adapter->common_qdepth; in blogic_rdconfig()
1660 adapter->tagq_ok &= adapter->discon_ok; in blogic_rdconfig()
1665 if (adapter->drvr_opts != NULL) in blogic_rdconfig()
1666 adapter->tagq_ok = (adapter->drvr_opts->tagq_ok & in blogic_rdconfig()
1667 adapter->drvr_opts->tagq_ok_mask) | in blogic_rdconfig()
1668 (adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask); in blogic_rdconfig()
1675 if (adapter->drvr_opts != NULL && in blogic_rdconfig()
1676 adapter->drvr_opts->bus_settle_time > 0) in blogic_rdconfig()
1677 adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time; in blogic_rdconfig()
1679 adapter->bus_settle_time = BLOGIC_BUS_SETTLE_TIME; in blogic_rdconfig()
1681 Indicate reading the Host Adapter Configuration completed in blogic_rdconfig()
1689 blogic_reportconfig reports the configuration of Host Adapter.
1694 unsigned short alltgt_mask = (1 << adapter->maxdev) - 1; in blogic_reportconfig()
1709Host Adapter\n", adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (ada… in blogic_reportconfig()
1710 …s: 0x%lX, IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq_ch, (ada… in blogic_reportconfig()
1711 if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) { in blogic_reportconfig()
1713 if (adapter->bios_addr > 0) in blogic_reportconfig()
1715 adapter->bios_addr); in blogic_reportconfig()
1720 adapter->bus, adapter->dev); in blogic_reportconfig()
1721 if (adapter->pci_addr > 0) in blogic_reportconfig()
1722 blogic_info("0x%lX, ", adapter, adapter->pci_addr); in blogic_reportconfig()
1726 blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id); in blogic_reportconfig()
1728 adapter, (adapter->parity ? "Enabled" : "Disabled"), in blogic_reportconfig()
1729 (adapter->ext_trans_enable ? "Enabled" : "Disabled")); in blogic_reportconfig()
1730 alltgt_mask &= ~(1 << adapter->scsi_id); in blogic_reportconfig()
1731 sync_ok = adapter->sync_ok & alltgt_mask; in blogic_reportconfig()
1732 fast_ok = adapter->fast_ok & alltgt_mask; in blogic_reportconfig()
1733 ultra_ok = adapter->ultra_ok & alltgt_mask; in blogic_reportconfig()
1735 (adapter->fw_ver[0] >= '4' || in blogic_reportconfig()
1736 adapter->adapter_bus_type == BLOGIC_EISA_BUS)) || in blogic_reportconfig()
1757 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1759 syncstr[adapter->scsi_id] = '#'; in blogic_reportconfig()
1760 syncstr[adapter->maxdev] = '\0'; in blogic_reportconfig()
1764 wide_ok = adapter->wide_ok & alltgt_mask; in blogic_reportconfig()
1770 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1772 widestr[adapter->scsi_id] = '#'; in blogic_reportconfig()
1773 widestr[adapter->maxdev] = '\0'; in blogic_reportconfig()
1775 discon_ok = adapter->discon_ok & alltgt_mask; in blogic_reportconfig()
1781 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1783 discon_str[adapter->scsi_id] = '#'; in blogic_reportconfig()
1784 discon_str[adapter->maxdev] = '\0'; in blogic_reportconfig()
1786 tagq_ok = adapter->tagq_ok & alltgt_mask; in blogic_reportconfig()
1792 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1794 tagq_str[adapter->scsi_id] = '#'; in blogic_reportconfig()
1795 tagq_str[adapter->maxdev] = '\0'; in blogic_reportconfig()
1802 … of %d segments, Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglimit, adapt… in blogic_reportconfig()
1803 …blogic_info(" Driver Queue Depth: %d, Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qde… in blogic_reportconfig()
1805 …Depth: %d, Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->drvr_sgli… in blogic_reportconfig()
1808 for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1809 if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) { in blogic_reportconfig()
1814 if (adapter->qdepth[0] > 0) in blogic_reportconfig()
1815 blogic_info("%d", adapter, adapter->qdepth[0]); in blogic_reportconfig()
1821 adapter->untag_qdepth); in blogic_reportconfig()
1822 if (adapter->terminfo_valid) { in blogic_reportconfig()
1823 if (adapter->wide) in blogic_reportconfig()
1825 …(adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ?… in blogic_reportconfig()
1828 (adapter->low_term ? "Enabled" : "Disabled")); in blogic_reportconfig()
1829 if (adapter->scam) in blogic_reportconfig()
1831 …(adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disable… in blogic_reportconfig()
1835 Indicate reporting the Host Adapter configuration completed in blogic_reportconfig()
1844 Host Adapter.
1849 if (adapter->irq_ch == 0) { in blogic_getres()
1850 blogic_err("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n", in blogic_getres()
1857 if (request_irq(adapter->irq_ch, blogic_inthandler, IRQF_SHARED, in blogic_getres()
1858 adapter->full_model, adapter) < 0) { in blogic_getres()
1859 blogic_err("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", in blogic_getres()
1860 adapter, adapter->irq_ch); in blogic_getres()
1863 adapter->irq_acquired = true; in blogic_getres()
1881 if (adapter->irq_acquired) in blogic_relres()
1882 free_irq(adapter->irq_ch, adapter); in blogic_relres()
1886 if (adapter->mbox_space) in blogic_relres()
1887 dma_free_coherent(&adapter->pci_device->dev, adapter->mbox_sz, in blogic_relres()
1888 adapter->mbox_space, adapter->mbox_space_handle); in blogic_relres()
1889 pci_dev_put(adapter->pci_device); in blogic_relres()
1890 adapter->mbox_space = NULL; in blogic_relres()
1891 adapter->mbox_space_handle = 0; in blogic_relres()
1892 adapter->mbox_sz = 0; in blogic_relres()
1897 blogic_initadapter initializes Host Adapter. This is the only
1898 function called during SCSI Host Adapter detection which modifies the state
1899 of the Host Adapter from its initial power on or hard reset state.
1913 adapter->firstccb = NULL; in blogic_initadapter()
1914 adapter->lastccb = NULL; in blogic_initadapter()
1918 Command Successful Flag, Active Commands, and Commands Since Reset in blogic_initadapter()
1921 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) { in blogic_initadapter()
1922 adapter->bdr_pend[tgt_id] = NULL; in blogic_initadapter()
1923 adapter->tgt_flags[tgt_id].tagq_active = false; in blogic_initadapter()
1924 adapter->tgt_flags[tgt_id].cmd_good = false; in blogic_initadapter()
1925 adapter->active_cmds[tgt_id] = 0; in blogic_initadapter()
1926 adapter->cmds_since_rst[tgt_id] = 0; in blogic_initadapter()
1930 FlashPoint Host Adapters do not use Outgoing and Incoming Mailboxes. in blogic_initadapter()
1938 …adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbo… in blogic_initadapter()
1939 adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev, in blogic_initadapter()
1940 adapter->mbox_sz, &adapter->mbox_space_handle, in blogic_initadapter()
1942 if (adapter->mbox_space == NULL) in blogic_initadapter()
1944 adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space; in blogic_initadapter()
1945 adapter->last_outbox = adapter->first_outbox + adapter->mbox_count - 1; in blogic_initadapter()
1946 adapter->next_outbox = adapter->first_outbox; in blogic_initadapter()
1947 adapter->first_inbox = (struct blogic_inbox *) (adapter->last_outbox + 1); in blogic_initadapter()
1948 adapter->last_inbox = adapter->first_inbox + adapter->mbox_count - 1; in blogic_initadapter()
1949 adapter->next_inbox = adapter->first_inbox; in blogic_initadapter()
1954 memset(adapter->first_outbox, 0, in blogic_initadapter()
1955 adapter->mbox_count * sizeof(struct blogic_outbox)); in blogic_initadapter()
1956 memset(adapter->first_inbox, 0, in blogic_initadapter()
1957 adapter->mbox_count * sizeof(struct blogic_inbox)); in blogic_initadapter()
1960 Initialize the Host Adapter's Pointer to the Outgoing/Incoming in blogic_initadapter()
1963 extmbox_req.mbox_count = adapter->mbox_count; in blogic_initadapter()
1964 extmbox_req.base_mbox_addr = (u32) adapter->mbox_space_handle; in blogic_initadapter()
1969 Enable Strict Round Robin Mode if supported by the Host Adapter. In in blogic_initadapter()
1970 Strict Round Robin Mode, the Host Adapter only looks at the next in blogic_initadapter()
1971 Outgoing Mailbox for each new command, rather than scanning in blogic_initadapter()
1976 if (adapter->strict_rr) { in blogic_initadapter()
1985 For Host Adapters that support Extended LUN Format CCBs, issue the in blogic_initadapter()
1986 Set CCB Format command to allow 32 Logical Units per Target Device. in blogic_initadapter()
1988 if (adapter->ext_lun) { in blogic_initadapter()
1999 if (!adapter->adapter_initd) { in blogic_initadapter()
2001 adapter->full_model); in blogic_initadapter()
2005 adapter->full_model); in blogic_initadapter()
2006 adapter->adapter_initd = true; in blogic_initadapter()
2009 Indicate the Host Adapter Initialization completed successfully. in blogic_initadapter()
2017 through Host Adapter.
2030 Wait a few seconds between the Host Adapter Hard Reset which in blogic_inquiry()
2035 blogic_delay(adapter->bus_settle_time); in blogic_inquiry()
2037 FlashPoint Host Adapters do not provide for Target Device Inquiry. in blogic_inquiry()
2044 if (adapter->drvr_opts != NULL && adapter->drvr_opts->stop_tgt_inquiry) in blogic_inquiry()
2047 Issue the Inquire Target Devices command for host adapters with in blogic_inquiry()
2049 ID 0 to 7 command for older host adapters. This is necessary to in blogic_inquiry()
2052 valid data. The Inquire Target Devices command is preferable to in blogic_inquiry()
2056 if (strcmp(adapter->fw_ver, "4.25") >= 0) { in blogic_inquiry()
2059 Issue a Inquire Target Devices command. Inquire Target in blogic_inquiry()
2062 Logical Units 0 - 7. Two bytes are returned, where byte in blogic_inquiry()
2070 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2071 adapter->tgt_flags[tgt_id].tgt_exists = in blogic_inquiry()
2076 Issue an Inquire Installed Devices command. For each in blogic_inquiry()
2088 adapter->tgt_flags[tgt_id].tgt_exists = in blogic_inquiry()
2092 Issue the Inquire Setup Information command. in blogic_inquiry()
2099 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2100 …adapter->sync_offset[tgt_id] = (tgt_id < 8 ? setupinfo.sync0to7[tgt_id].offset : setupinfo.sync8to… in blogic_inquiry()
2101 if (strcmp(adapter->fw_ver, "5.06L") >= 0) in blogic_inquiry()
2102 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2103->tgt_flags[tgt_id].wide_active = (tgt_id < 8 ? (setupinfo.wide_tx_active0to7 & (1 << tgt_id) ? tr… in blogic_inquiry()
2105 Issue the Inquire Synchronous Period command. in blogic_inquiry()
2107 if (adapter->fw_ver[0] >= '3') { in blogic_inquiry()
2109 /* Issue a Inquire Synchronous Period command. For each in blogic_inquiry()
2120 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2121 adapter->sync_period[tgt_id] = sync_period[tgt_id]; in blogic_inquiry()
2123 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2125 adapter->sync_period[tgt_id] = 20 + 5 * setupinfo.sync0to7[tgt_id].tx_period; in blogic_inquiry()
2133 blogic_inithoststruct initializes the fields in the SCSI Host
2135 SCSI Host structure are intentionally left uninitialized, as this driver
2137 ensuring exclusive access to the Host Adapter hardware and data structures
2138 through explicit acquisition and release of the Host Adapter's Lock.
2142 struct Scsi_Host *host) in blogic_inithoststruct() argument
2144 host->max_id = adapter->maxdev; in blogic_inithoststruct()
2145 host->max_lun = adapter->maxlun; in blogic_inithoststruct()
2146 host->max_channel = 0; in blogic_inithoststruct()
2147 host->unique_id = adapter->io_addr; in blogic_inithoststruct()
2148 host->this_id = adapter->scsi_id; in blogic_inithoststruct()
2149 host->can_queue = adapter->drvr_qdepth; in blogic_inithoststruct()
2150 host->sg_tablesize = adapter->drvr_sglimit; in blogic_inithoststruct()
2151 host->cmd_per_lun = adapter->untag_qdepth; in blogic_inithoststruct()
2165 (struct blogic_adapter *) dev->host->hostdata; in blogic_slaveconfig()
2166 int tgt_id = dev->id; in blogic_slaveconfig()
2167 int qdepth = adapter->qdepth[tgt_id]; in blogic_slaveconfig()
2169 if (adapter->tgt_flags[tgt_id].tagq_ok && in blogic_slaveconfig()
2170 (adapter->tagq_ok & (1 << tgt_id))) { in blogic_slaveconfig()
2173 adapter->qdepth[tgt_id] = qdepth; in blogic_slaveconfig()
2176 adapter->tagq_ok &= ~(1 << tgt_id); in blogic_slaveconfig()
2177 qdepth = adapter->untag_qdepth; in blogic_slaveconfig()
2178 adapter->qdepth[tgt_id] = qdepth; in blogic_slaveconfig()
2182 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_slaveconfig()
2183 if (adapter->tgt_flags[tgt_id].tgt_exists) in blogic_slaveconfig()
2184 qdepth += adapter->qdepth[tgt_id]; in blogic_slaveconfig()
2185 if (qdepth > adapter->alloc_ccbs) in blogic_slaveconfig()
2186 blogic_create_addlccbs(adapter, qdepth - adapter->alloc_ccbs, in blogic_slaveconfig()
2192 blogic_init probes for BusLogic Host Adapters at the standard
2194 reporting the configuration of each BusLogic Host Adapter it finds. It
2195 returns the number of BusLogic Host Adapters successfully initialized and
2211 return -ENODEV; in blogic_init()
2218 return -ENOMEM; in blogic_init()
2224 blogic_err("BusLogic: Unable to allocate Prototype Host Adapter\n", NULL); in blogic_init()
2225 return -ENOMEM; in blogic_init()
2237 struct Scsi_Host *host; in blogic_init() local
2239 if (probeinfo->io_addr == 0) in blogic_init()
2242 myadapter->adapter_type = probeinfo->adapter_type; in blogic_init()
2243 myadapter->adapter_bus_type = probeinfo->adapter_bus_type; in blogic_init()
2244 myadapter->io_addr = probeinfo->io_addr; in blogic_init()
2245 myadapter->pci_addr = probeinfo->pci_addr; in blogic_init()
2246 myadapter->bus = probeinfo->bus; in blogic_init()
2247 myadapter->dev = probeinfo->dev; in blogic_init()
2248 myadapter->pci_device = probeinfo->pci_device; in blogic_init()
2249 myadapter->irq_ch = probeinfo->irq_ch; in blogic_init()
2250 myadapter->addr_count = in blogic_init()
2251 blogic_adapter_addr_count[myadapter->adapter_type]; in blogic_init()
2256 if (!request_region(myadapter->io_addr, myadapter->addr_count, in blogic_init()
2260 Probe the Host Adapter. If unsuccessful, abort further in blogic_init()
2264 release_region(myadapter->io_addr, in blogic_init()
2265 myadapter->addr_count); in blogic_init()
2269 Hard Reset the Host Adapter. If unsuccessful, abort further in blogic_init()
2273 release_region(myadapter->io_addr, in blogic_init()
2274 myadapter->addr_count); in blogic_init()
2278 Check the Host Adapter. If unsuccessful, abort further in blogic_init()
2282 release_region(myadapter->io_addr, in blogic_init()
2283 myadapter->addr_count); in blogic_init()
2290 myadapter->drvr_opts = in blogic_init()
2298 Register the SCSI Host structure. in blogic_init()
2301 host = scsi_host_alloc(&blogic_template, in blogic_init()
2303 if (host == NULL) { in blogic_init()
2304 release_region(myadapter->io_addr, in blogic_init()
2305 myadapter->addr_count); in blogic_init()
2308 myadapter = (struct blogic_adapter *) host->hostdata; in blogic_init()
2310 myadapter->scsi_host = host; in blogic_init()
2311 myadapter->host_no = host->host_no; in blogic_init()
2313 Add Host Adapter to the end of the list of registered in blogic_init()
2314 BusLogic Host Adapters. in blogic_init()
2316 list_add_tail(&myadapter->host_list, &blogic_host_list); in blogic_init()
2319 Read the Host Adapter Configuration, Configure the Host in blogic_init()
2321 the Host Adapter, then Create the Initial CCBs, Initialize in blogic_init()
2322 the Host Adapter, and finally perform Target Device in blogic_init()
2324 assumed to be due to a problem with the Host Adapter, in blogic_init()
2326 as belonging to a BusLogic Host Adapter. The I/O Address in blogic_init()
2328 being incorrectly identified as any other type of Host in blogic_init()
2339 Release and re-register usage of the I/O Address in blogic_init()
2340 range so that the Model Name of the Host Adapter in blogic_init()
2341 will appear, and initialize the SCSI Host structure. in blogic_init()
2343 release_region(myadapter->io_addr, in blogic_init()
2344 myadapter->addr_count); in blogic_init()
2345 if (!request_region(myadapter->io_addr, in blogic_init()
2346 myadapter->addr_count, in blogic_init()
2347 myadapter->full_model)) { in blogic_init()
2349 "BusLogic: Release and re-register of " in blogic_init()
2351 (unsigned long)myadapter->io_addr); in blogic_init()
2354 list_del(&myadapter->host_list); in blogic_init()
2355 scsi_host_put(host); in blogic_init()
2356 ret = -ENOMEM; in blogic_init()
2359 host); in blogic_init()
2360 if (scsi_add_host(host, myadapter->pci_device in blogic_init()
2361 ? &myadapter->pci_device->dev in blogic_init()
2368 list_del(&myadapter->host_list); in blogic_init()
2369 scsi_host_put(host); in blogic_init()
2370 ret = -ENODEV; in blogic_init()
2372 scsi_scan_host(host); in blogic_init()
2378 An error occurred during Host Adapter Configuration in blogic_init()
2379 Querying, Host Adapter Configuration, Resource in blogic_init()
2380 Acquisition, CCB Creation, Host Adapter in blogic_init()
2382 remove Host Adapter from the list of registered in blogic_init()
2383 BusLogic Host Adapters, destroy the CCBs, Release in blogic_init()
2385 Host. in blogic_init()
2389 list_del(&myadapter->host_list); in blogic_init()
2390 scsi_host_put(host); in blogic_init()
2391 ret = -ENODEV; in blogic_init()
2403 support a specific Host Adapter, including the I/O Address range, and
2404 unregisters the BusLogic Host Adapter.
2409 struct Scsi_Host *host = adapter->scsi_host; in blogic_deladapter() local
2411 scsi_remove_host(host); in blogic_deladapter()
2414 FlashPoint Host Adapters must first be released by the FlashPoint in blogic_deladapter()
2418 FlashPoint_ReleaseHostAdapter(adapter->cardhandle); in blogic_deladapter()
2421 support Host Adapter. in blogic_deladapter()
2428 release_region(adapter->io_addr, adapter->addr_count); in blogic_deladapter()
2430 Remove Host Adapter from the list of registered BusLogic in blogic_deladapter()
2431 Host Adapters. in blogic_deladapter()
2433 list_del(&adapter->host_list); in blogic_deladapter()
2435 scsi_host_put(host); in blogic_deladapter()
2446 struct blogic_adapter *adapter = ccb->adapter; in blogic_qcompleted_ccb()
2448 ccb->status = BLOGIC_CCB_COMPLETE; in blogic_qcompleted_ccb()
2449 ccb->next = NULL; in blogic_qcompleted_ccb()
2450 if (adapter->firstccb == NULL) { in blogic_qcompleted_ccb()
2451 adapter->firstccb = ccb; in blogic_qcompleted_ccb()
2452 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2454 adapter->lastccb->next = ccb; in blogic_qcompleted_ccb()
2455 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2457 adapter->active_cmds[ccb->tgt_id]--; in blogic_qcompleted_ccb()
2463 the Host Adapter Status and Target Device Status.
2510 blogic_warn("Unknown Host Adapter Status 0x%02X\n", adapter, in blogic_resultcode()
2529 is essential that for each CCB and SCSI Command issued, command in blogic_scan_inbox()
2531 only Incoming Mailboxes with completion code Command Completed in blogic_scan_inbox()
2532 Without Error, Command Completed With Error, or Command Aborted in blogic_scan_inbox()
2533 At Host Request are saved for completion processing. When an in blogic_scan_inbox()
2534 Incoming Mailbox has a completion code of Aborted Command Not in blogic_scan_inbox()
2539 struct blogic_inbox *next_inbox = adapter->next_inbox; in blogic_scan_inbox()
2542 while ((comp_code = next_inbox->comp_code) != BLOGIC_INBOX_FREE) { in blogic_scan_inbox()
2552 (struct blogic_ccb *) bus_to_virt(next_inbox->ccb); in blogic_scan_inbox()
2554 if (ccb->status == BLOGIC_CCB_ACTIVE || in blogic_scan_inbox()
2555 ccb->status == BLOGIC_CCB_RESET) { in blogic_scan_inbox()
2560 ccb->comp_code = comp_code; in blogic_scan_inbox()
2567 the Host Adapter firmware. in blogic_scan_inbox()
2569 …blogic_warn("Illegal CCB #%ld status %d in Incoming Mailbox\n", adapter, ccb->serial, ccb->status); in blogic_scan_inbox()
2572 next_inbox->comp_code = BLOGIC_INBOX_FREE; in blogic_scan_inbox()
2573 if (++next_inbox > adapter->last_inbox) in blogic_scan_inbox()
2574 next_inbox = adapter->first_inbox; in blogic_scan_inbox()
2576 adapter->next_inbox = next_inbox; in blogic_scan_inbox()
2581 blogic_process_ccbs iterates over the completed CCBs for Host
2582 Adapter setting the SCSI Command Result Codes, deallocating the CCBs, and
2583 calling the SCSI Subsystem Completion Routines. The Host Adapter's Lock
2589 if (adapter->processing_ccbs) in blogic_process_ccbs()
2591 adapter->processing_ccbs = true; in blogic_process_ccbs()
2592 while (adapter->firstccb != NULL) { in blogic_process_ccbs()
2593 struct blogic_ccb *ccb = adapter->firstccb; in blogic_process_ccbs()
2594 struct scsi_cmnd *command = ccb->command; in blogic_process_ccbs() local
2595 adapter->firstccb = ccb->next; in blogic_process_ccbs()
2596 if (adapter->firstccb == NULL) in blogic_process_ccbs()
2597 adapter->lastccb = NULL; in blogic_process_ccbs()
2601 if (ccb->opcode == BLOGIC_BDR) { in blogic_process_ccbs()
2602 int tgt_id = ccb->tgt_id; in blogic_process_ccbs()
2604 blogic_warn("Bus Device Reset CCB #%ld to Target %d Completed\n", adapter, ccb->serial, tgt_id); in blogic_process_ccbs()
2605 blogic_inc_count(&adapter->tgt_stats[tgt_id].bdr_done); in blogic_process_ccbs()
2606 adapter->tgt_flags[tgt_id].tagq_active = false; in blogic_process_ccbs()
2607 adapter->cmds_since_rst[tgt_id] = 0; in blogic_process_ccbs()
2608 adapter->last_resetdone[tgt_id] = jiffies; in blogic_process_ccbs()
2610 Place CCB back on the Host Adapter's free list. in blogic_process_ccbs()
2615 Bus Device Reset CCBs have the command field in blogic_process_ccbs()
2616 non-NULL only when a Bus Device Reset was requested in blogic_process_ccbs()
2617 for a command that did not have a currently active in blogic_process_ccbs()
2618 CCB in the Host Adapter (i.e., a Synchronous Bus in blogic_process_ccbs()
2622 while (command != NULL) { in blogic_process_ccbs()
2624 command->reset_chain; in blogic_process_ccbs()
2625 command->reset_chain = NULL; in blogic_process_ccbs()
2626 command->result = DID_RESET << 16; in blogic_process_ccbs()
2627 command->scsi_done(command); in blogic_process_ccbs()
2628 command = nxt_cmd; in blogic_process_ccbs()
2632 Iterate over the CCBs for this Host Adapter in blogic_process_ccbs()
2636 for (ccb = adapter->all_ccbs; ccb != NULL; in blogic_process_ccbs()
2637 ccb = ccb->next_all) in blogic_process_ccbs()
2638 if (ccb->status == BLOGIC_CCB_RESET && in blogic_process_ccbs()
2639 ccb->tgt_id == tgt_id) { in blogic_process_ccbs()
2640 command = ccb->command; in blogic_process_ccbs()
2642 adapter->active_cmds[tgt_id]--; in blogic_process_ccbs()
2643 command->result = DID_RESET << 16; in blogic_process_ccbs()
2644 command->scsi_done(command); in blogic_process_ccbs()
2646 adapter->bdr_pend[tgt_id] = NULL; in blogic_process_ccbs()
2649 Translate the Completion Code, Host Adapter Status, in blogic_process_ccbs()
2653 switch (ccb->comp_code) { in blogic_process_ccbs()
2657 blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2660 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2662 adapter->tgt_flags[ccb->tgt_id] in blogic_process_ccbs()
2664 command->result = DID_OK << 16; in blogic_process_ccbs()
2668 adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2669 blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done); in blogic_process_ccbs()
2670 command->result = DID_ABORT << 16; in blogic_process_ccbs()
2673 command->result = blogic_resultcode(adapter, in blogic_process_ccbs()
2674 ccb->adapter_status, ccb->tgt_status); in blogic_process_ccbs()
2675 if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) { in blogic_process_ccbs()
2676 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2680 blogic_notice("CCB #%ld Target %d: Result %X Host " in blogic_process_ccbs()
2681 …tus %02X Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter_s… in blogic_process_ccbs()
2683 for (i = 0; i < ccb->cdblen; i++) in blogic_process_ccbs()
2684 blogic_notice(" %02X", adapter, ccb->cdb[i]); in blogic_process_ccbs()
2687 for (i = 0; i < ccb->sense_datalen; i++) in blogic_process_ccbs()
2688 blogic_notice(" %02X", adapter, command->sense_buffer[i]); in blogic_process_ccbs()
2695 When an INQUIRY command completes normally, save the in blogic_process_ccbs()
2699 if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 && in blogic_process_ccbs()
2700 ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) { in blogic_process_ccbs()
2702 &adapter->tgt_flags[ccb->tgt_id]; in blogic_process_ccbs()
2704 (struct scsi_inquiry *) scsi_sglist(command); in blogic_process_ccbs()
2705 tgt_flags->tgt_exists = true; in blogic_process_ccbs()
2706 tgt_flags->tagq_ok = inquiry->CmdQue; in blogic_process_ccbs()
2707 tgt_flags->wide_ok = inquiry->WBus16; in blogic_process_ccbs()
2710 Place CCB back on the Host Adapter's free list. in blogic_process_ccbs()
2714 Call the SCSI Command Completion Routine. in blogic_process_ccbs()
2716 command->scsi_done(command); in blogic_process_ccbs()
2719 adapter->processing_ccbs = false; in blogic_process_ccbs()
2724 blogic_inthandler handles hardware interrupts from BusLogic Host
2733 Acquire exclusive access to Host Adapter. in blogic_inthandler()
2735 spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag); in blogic_inthandler()
2737 Handle Interrupts appropriately for each Host Adapter type. in blogic_inthandler()
2742 Read the Host Adapter Interrupt Register. in blogic_inthandler()
2747 Acknowledge the interrupt and reset the Host Adapter in blogic_inthandler()
2753 Mailbox Loaded Interrupts. Command Complete in blogic_inthandler()
2758 adapter->adapter_extreset = true; in blogic_inthandler()
2762 adapter->adapter_cmd_complete = true; in blogic_inthandler()
2766 Check if there is a pending interrupt for this Host Adapter. in blogic_inthandler()
2768 if (FlashPoint_InterruptPending(adapter->cardhandle)) in blogic_inthandler()
2769 switch (FlashPoint_HandleInterrupt(adapter->cardhandle)) { in blogic_inthandler()
2773 adapter->adapter_extreset = true; in blogic_inthandler()
2776 blogic_warn("Internal FlashPoint Error detected - Resetting Host Adapter\n", adapter); in blogic_inthandler()
2777 adapter->adapter_intern_err = true; in blogic_inthandler()
2784 if (adapter->firstccb != NULL) in blogic_inthandler()
2787 Reset the Host Adapter if requested. in blogic_inthandler()
2789 if (adapter->adapter_extreset) { in blogic_inthandler()
2790 blogic_warn("Resetting %s due to External SCSI Bus Reset\n", adapter, adapter->full_model); in blogic_inthandler()
2791 blogic_inc_count(&adapter->ext_resets); in blogic_inthandler()
2793 adapter->adapter_extreset = false; in blogic_inthandler()
2794 } else if (adapter->adapter_intern_err) { in blogic_inthandler()
2795 blogic_warn("Resetting %s due to Host Adapter Internal Error\n", adapter, adapter->full_model); in blogic_inthandler()
2796 blogic_inc_count(&adapter->adapter_intern_errors); in blogic_inthandler()
2798 adapter->adapter_intern_err = false; in blogic_inthandler()
2801 Release exclusive access to Host Adapter. in blogic_inthandler()
2803 spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag); in blogic_inthandler()
2810 Mailbox for execution by Host Adapter. The Host Adapter's Lock should
2819 next_outbox = adapter->next_outbox; in blogic_write_outbox()
2820 if (next_outbox->action == BLOGIC_OUTBOX_FREE) { in blogic_write_outbox()
2821 ccb->status = BLOGIC_CCB_ACTIVE; in blogic_write_outbox()
2824 since the Host Adapter is operating asynchronously and the in blogic_write_outbox()
2826 by the Host Adapter. in blogic_write_outbox()
2828 next_outbox->ccb = ccb->dma_handle; in blogic_write_outbox()
2829 next_outbox->action = action; in blogic_write_outbox()
2831 if (++next_outbox > adapter->last_outbox) in blogic_write_outbox()
2832 next_outbox = adapter->first_outbox; in blogic_write_outbox()
2833 adapter->next_outbox = next_outbox; in blogic_write_outbox()
2835 adapter->active_cmds[ccb->tgt_id]++; in blogic_write_outbox()
2836 if (ccb->opcode != BLOGIC_BDR) in blogic_write_outbox()
2837 adapter->tgt_stats[ccb->tgt_id].cmds_tried++; in blogic_write_outbox()
2849 (struct blogic_adapter *) SCpnt->device->host->hostdata; in blogic_hostreset()
2851 unsigned int id = SCpnt->device->id; in blogic_hostreset()
2852 struct blogic_tgt_stats *stats = &adapter->tgt_stats[id]; in blogic_hostreset()
2855 spin_lock_irq(SCpnt->device->host->host_lock); in blogic_hostreset()
2857 blogic_inc_count(&stats->adapter_reset_req); in blogic_hostreset()
2860 spin_unlock_irq(SCpnt->device->host->host_lock); in blogic_hostreset()
2865 blogic_qcmd creates a CCB for Command and places it into an
2866 Outgoing Mailbox for execution by the associated Host Adapter.
2869 static int blogic_qcmd_lck(struct scsi_cmnd *command, in blogic_qcmd_lck() argument
2873 (struct blogic_adapter *) command->device->host->hostdata; in blogic_qcmd_lck()
2875 &adapter->tgt_flags[command->device->id]; in blogic_qcmd_lck()
2876 struct blogic_tgt_stats *tgt_stats = adapter->tgt_stats; in blogic_qcmd_lck()
2877 unsigned char *cdb = command->cmnd; in blogic_qcmd_lck()
2878 int cdblen = command->cmd_len; in blogic_qcmd_lck()
2879 int tgt_id = command->device->id; in blogic_qcmd_lck()
2880 int lun = command->device->lun; in blogic_qcmd_lck()
2881 int buflen = scsi_bufflen(command); in blogic_qcmd_lck()
2888 Host Adapter for any errors, so they should not be executed in blogic_qcmd_lck()
2892 if (cdb[0] == REQUEST_SENSE && command->sense_buffer[0] != 0) { in blogic_qcmd_lck()
2893 command->result = DID_OK << 16; in blogic_qcmd_lck()
2894 comp_cb(command); in blogic_qcmd_lck()
2898 Allocate a CCB from the Host Adapter's free list. In the unlikely in blogic_qcmd_lck()
2900 wait 1 second and try again. If that fails, the Host Adapter is in blogic_qcmd_lck()
2901 probably hung so signal an error as a Host Adapter Hard Reset in blogic_qcmd_lck()
2906 spin_unlock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
2908 spin_lock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
2911 command->result = DID_ERROR << 16; in blogic_qcmd_lck()
2912 comp_cb(command); in blogic_qcmd_lck()
2918 Initialize the fields in the BusLogic Command Control Block (CCB). in blogic_qcmd_lck()
2920 count = scsi_dma_map(command); in blogic_qcmd_lck()
2926 ccb->opcode = BLOGIC_INITIATOR_CCB_SG; in blogic_qcmd_lck()
2927 ccb->datalen = count * sizeof(struct blogic_sg_seg); in blogic_qcmd_lck()
2929 ccb->data = (unsigned int) ccb->dma_handle + in blogic_qcmd_lck()
2930 ((unsigned long) &ccb->sglist - in blogic_qcmd_lck()
2933 ccb->data = virt_to_32bit_virt(ccb->sglist); in blogic_qcmd_lck()
2935 scsi_for_each_sg(command, sg, count, i) { in blogic_qcmd_lck()
2936 ccb->sglist[i].segbytes = sg_dma_len(sg); in blogic_qcmd_lck()
2937 ccb->sglist[i].segdata = sg_dma_address(sg); in blogic_qcmd_lck()
2940 ccb->opcode = BLOGIC_INITIATOR_CCB; in blogic_qcmd_lck()
2941 ccb->datalen = buflen; in blogic_qcmd_lck()
2942 ccb->data = 0; in blogic_qcmd_lck()
2948 ccb->datadir = BLOGIC_DATAIN_CHECKED; in blogic_qcmd_lck()
2955 ccb->datadir = BLOGIC_DATAOUT_CHECKED; in blogic_qcmd_lck()
2961 ccb->datadir = BLOGIC_UNCHECKED_TX; in blogic_qcmd_lck()
2964 ccb->cdblen = cdblen; in blogic_qcmd_lck()
2965 ccb->adapter_status = 0; in blogic_qcmd_lck()
2966 ccb->tgt_status = 0; in blogic_qcmd_lck()
2967 ccb->tgt_id = tgt_id; in blogic_qcmd_lck()
2968 ccb->lun = lun; in blogic_qcmd_lck()
2969 ccb->tag_enable = false; in blogic_qcmd_lck()
2970 ccb->legacytag_enable = false; in blogic_qcmd_lck()
2974 Tagged Queue fashion so that the Host Adapter and Target Device in blogic_qcmd_lck()
2983 from non-tagged to tagged commands, so it is necessary to wait in blogic_qcmd_lck()
2987 if (adapter->cmds_since_rst[tgt_id]++ >= BLOGIC_MAX_TAG_DEPTH && in blogic_qcmd_lck()
2988 !tgt_flags->tagq_active && in blogic_qcmd_lck()
2989 adapter->active_cmds[tgt_id] == 0 in blogic_qcmd_lck()
2990 && tgt_flags->tagq_ok && in blogic_qcmd_lck()
2991 (adapter->tagq_ok & (1 << tgt_id))) { in blogic_qcmd_lck()
2992 tgt_flags->tagq_active = true; in blogic_qcmd_lck()
2996 if (tgt_flags->tagq_active) { in blogic_qcmd_lck()
3001 a queued command will not remain in a disconnected state in blogic_qcmd_lck()
3008 last sequence point, this command will be issued with an in blogic_qcmd_lck()
3011 queued commands before this command may be executed. in blogic_qcmd_lck()
3013 if (adapter->active_cmds[tgt_id] == 0) in blogic_qcmd_lck()
3014 adapter->last_seqpoint[tgt_id] = jiffies; in blogic_qcmd_lck()
3016 adapter->last_seqpoint[tgt_id] + 4 * HZ)) { in blogic_qcmd_lck()
3017 adapter->last_seqpoint[tgt_id] = jiffies; in blogic_qcmd_lck()
3020 if (adapter->ext_lun) { in blogic_qcmd_lck()
3021 ccb->tag_enable = true; in blogic_qcmd_lck()
3022 ccb->queuetag = queuetag; in blogic_qcmd_lck()
3024 ccb->legacytag_enable = true; in blogic_qcmd_lck()
3025 ccb->legacy_tag = queuetag; in blogic_qcmd_lck()
3028 memcpy(ccb->cdb, cdb, cdblen); in blogic_qcmd_lck()
3029 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE; in blogic_qcmd_lck()
3030 ccb->command = command; in blogic_qcmd_lck()
3031 sense_buf = dma_map_single(&adapter->pci_device->dev, in blogic_qcmd_lck()
3032 command->sense_buffer, ccb->sense_datalen, in blogic_qcmd_lck()
3034 if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) { in blogic_qcmd_lck()
3040 ccb->sensedata = sense_buf; in blogic_qcmd_lck()
3041 command->scsi_done = comp_cb; in blogic_qcmd_lck()
3049 again. If that fails, the Host Adapter is probably hung in blogic_qcmd_lck()
3050 so signal an error as a Host Adapter Hard Reset should in blogic_qcmd_lck()
3054 spin_unlock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
3055 blogic_warn("Unable to write Outgoing Mailbox - Pausing for 1 second\n", adapter); in blogic_qcmd_lck()
3057 spin_lock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
3060 blogic_warn("Still unable to write Outgoing Mailbox - Host Adapter Dead?\n", adapter); in blogic_qcmd_lck()
3062 command->result = DID_ERROR << 16; in blogic_qcmd_lck()
3063 command->scsi_done(command); in blogic_qcmd_lck()
3071 ccb->status = BLOGIC_CCB_ACTIVE; in blogic_qcmd_lck()
3072 adapter->active_cmds[tgt_id]++; in blogic_qcmd_lck()
3074 FlashPoint_StartCCB(adapter->cardhandle, ccb); in blogic_qcmd_lck()
3076 The Command may have already completed and in blogic_qcmd_lck()
3080 if (ccb->status == BLOGIC_CCB_COMPLETE) in blogic_qcmd_lck()
3090 blogic_abort aborts Command if possible. in DEF_SCSI_QCMD()
3093 static int blogic_abort(struct scsi_cmnd *command) in DEF_SCSI_QCMD()
3096 (struct blogic_adapter *) command->device->host->hostdata; in DEF_SCSI_QCMD()
3098 int tgt_id = command->device->id; in DEF_SCSI_QCMD()
3100 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_request); in DEF_SCSI_QCMD()
3103 Attempt to find an Active CCB for this Command. If no Active in DEF_SCSI_QCMD()
3104 CCB for this Command is found, then no Abort is necessary. in DEF_SCSI_QCMD()
3106 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all) in DEF_SCSI_QCMD()
3107 if (ccb->command == command) in DEF_SCSI_QCMD()
3110 blogic_warn("Unable to Abort Command to Target %d - No CCB Found\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3112 } else if (ccb->status == BLOGIC_CCB_COMPLETE) { in DEF_SCSI_QCMD()
3113 blogic_warn("Unable to Abort Command to Target %d - CCB Completed\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3115 } else if (ccb->status == BLOGIC_CCB_RESET) { in DEF_SCSI_QCMD()
3116 blogic_warn("Unable to Abort Command to Target %d - CCB Reset\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3123 generate the non-tagged Abort message. Since non-tagged in DEF_SCSI_QCMD()
3124 commands are not sent by the Host Adapter until the queue in DEF_SCSI_QCMD()
3126 Abort message is treated as a non-tagged command, it is in DEF_SCSI_QCMD()
3132 if (adapter->tgt_flags[tgt_id].tagq_active && in DEF_SCSI_QCMD()
3133 adapter->fw_ver[0] < '5') { in DEF_SCSI_QCMD()
3134 …blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->ser… in DEF_SCSI_QCMD()
3139 adapter, ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3140 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried); in DEF_SCSI_QCMD()
3143 …blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->seria… in DEF_SCSI_QCMD()
3152 ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3153 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried); in DEF_SCSI_QCMD()
3154 FlashPoint_AbortCCB(adapter->cardhandle, ccb); in DEF_SCSI_QCMD()
3160 if (ccb->status == BLOGIC_CCB_COMPLETE) in DEF_SCSI_QCMD()
3169 blogic_resetadapter resets Host Adapter if possible, marking all
3179 * Attempt to Reset and Reinitialize the Host Adapter.
3185 adapter->full_model);
3193 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3194 if (ccb->status == BLOGIC_CCB_ACTIVE)
3197 * Wait a few seconds between the Host Adapter Hard Reset which
3204 spin_unlock_irq(adapter->scsi_host->host_lock);
3205 blogic_delay(adapter->bus_settle_time);
3206 spin_lock_irq(adapter->scsi_host->host_lock);
3209 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
3210 adapter->last_resettried[tgt_id] = jiffies;
3211 adapter->last_resetdone[tgt_id] = jiffies;
3222 may be enabled in AutoSCSI on FlashPoint Host Adapters and on "W" and "C"
3223 series MultiMaster Host Adapters, or by a dip switch setting on "S" and "A"
3224 series MultiMaster Host Adapters. With Extended Translation enabled, drives
3237 (struct blogic_adapter *) sdev->host->hostdata; in blogic_diskparam()
3241 if (adapter->ext_trans_enable && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */) { in blogic_diskparam()
3243 diskparam->heads = 255; in blogic_diskparam()
3244 diskparam->sectors = 63; in blogic_diskparam()
3246 diskparam->heads = 128; in blogic_diskparam()
3247 diskparam->sectors = 32; in blogic_diskparam()
3250 diskparam->heads = 64; in blogic_diskparam()
3251 diskparam->sectors = 32; in blogic_diskparam()
3253 diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors); in blogic_diskparam()
3266 int saved_cyl = diskparam->cylinders, part_no; in blogic_diskparam()
3270 part_end_head = part_entry->end_head; in blogic_diskparam()
3271 part_end_sector = part_entry->end_sector & 0x3F; in blogic_diskparam()
3272 if (part_end_head == 64 - 1) { in blogic_diskparam()
3273 diskparam->heads = 64; in blogic_diskparam()
3274 diskparam->sectors = 32; in blogic_diskparam()
3276 } else if (part_end_head == 128 - 1) { in blogic_diskparam()
3277 diskparam->heads = 128; in blogic_diskparam()
3278 diskparam->sectors = 32; in blogic_diskparam()
3280 } else if (part_end_head == 255 - 1) { in blogic_diskparam()
3281 diskparam->heads = 255; in blogic_diskparam()
3282 diskparam->sectors = 63; in blogic_diskparam()
3288 part_end_head = part1_entry->end_head; in blogic_diskparam()
3289 part_end_sector = part1_entry->end_sector & 0x3F; in blogic_diskparam()
3291 diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors); in blogic_diskparam()
3292 if (part_no < 4 && part_end_sector == diskparam->sectors) { in blogic_diskparam()
3293 if (diskparam->cylinders != saved_cyl) in blogic_diskparam()
3294 …n("Adopting Geometry %d/%d from Partition Table\n", adapter, diskparam->heads, diskparam->sectors); in blogic_diskparam()
3297 …arn("not compatible with current BusLogic Host Adapter Geometry %d/%d\n", adapter, diskparam->head… in blogic_diskparam()
3313 (struct blogic_adapter *) shost->hostdata; in blogic_write_info()
3316 tgt_stats = adapter->tgt_stats; in blogic_write_info()
3317 adapter->ext_resets = 0; in blogic_write_info()
3318 adapter->adapter_intern_errors = 0; in blogic_write_info()
3325 struct blogic_adapter *adapter = (struct blogic_adapter *) shost->hostdata; in blogic_show_info()
3329 tgt_stats = adapter->tgt_stats; in blogic_show_info()
3330 seq_write(m, adapter->msgbuf, adapter->msgbuflen); in blogic_show_info()
3333 Currently Allocated CCBs: %d\n", adapter->drvr_qdepth, adapter->alloc_ccbs); in blogic_show_info()
3339 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3340 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3341 if (!tgt_flags->tgt_exists) in blogic_show_info()
3343 …seq_printf(m, " %2d %s", tgt, (tgt_flags->tagq_ok ? (tgt_flags->tagq_active ? " Active" : (ada… in blogic_show_info()
3347 …" %3d %3u %9u %9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt]… in blogic_show_info()
3352 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3353 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3354 if (!tgt_flags->tgt_exists) in blogic_show_info()
3367 Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ in blogic_show_info()
3369 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3370 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3371 if (!tgt_flags->tgt_exists) in blogic_show_info()
3383 Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ in blogic_show_info()
3385 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3386 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3387 if (!tgt_flags->tgt_exists) in blogic_show_info()
3401 Command Aborts Bus Device Resets Host Adapter Resets\n\ in blogic_show_info()
3405 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3406 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3407 if (!tgt_flags->tgt_exists) in blogic_show_info()
3420 seq_printf(m, "\nExternal Host Adapter Resets: %d\n", adapter->ext_resets); in blogic_show_info()
3421 seq_printf(m, "Host Adapter Internal Errors: %d\n", adapter->adapter_intern_errors); in blogic_show_info()
3443 strcpy(&adapter->msgbuf[adapter->msgbuflen], buf); in blogic_msg()
3444 adapter->msgbuflen += len; in blogic_msg()
3448 strcpy(&adapter->msgbuf[adapter->msgbuflen], buf); in blogic_msg()
3449 adapter->msgbuflen += len; in blogic_msg()
3452 printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); in blogic_msg()
3457 if (adapter != NULL && adapter->adapter_initd) in blogic_msg()
3458 printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); in blogic_msg()
3464 begin = (buf[len - 1] == '\n'); in blogic_msg()
3480 strch += 'a' - 'Z'; in blogic_parse()
3482 keywordch += 'a' - 'Z'; in blogic_parse()
3495 BusLogic Driver Options may be specified either via the Linux Kernel Command
3497 for multiple host adapters may be specified either by separating the option
3499 command line. Individual option specifications for a single host adapter are
3500 separated by commas. The Probing and Debugging Options apply to all host
3502 selected host adapter.
3536 drvr_opts->qdepth[tgt_id] = qdepth; in blogic_parseopts()
3558 drvr_opts->common_qdepth = qdepth; in blogic_parseopts()
3560 drvr_opts->qdepth[tgt_id] = qdepth; in blogic_parseopts()
3564 drvr_opts->tagq_ok = 0x0000; in blogic_parseopts()
3565 drvr_opts->tagq_ok_mask = 0x0000; in blogic_parseopts()
3567 drvr_opts->tagq_ok = 0xFFFF; in blogic_parseopts()
3568 drvr_opts->tagq_ok_mask = 0xFFFF; in blogic_parseopts()
3570 drvr_opts->tagq_ok = 0x0000; in blogic_parseopts()
3571 drvr_opts->tagq_ok_mask = 0xFFFF; in blogic_parseopts()
3579 drvr_opts->tagq_ok |= tgt_bit; in blogic_parseopts()
3580 drvr_opts->tagq_ok_mask |= tgt_bit; in blogic_parseopts()
3583 drvr_opts->tagq_ok &= ~tgt_bit; in blogic_parseopts()
3584 drvr_opts->tagq_ok_mask |= tgt_bit; in blogic_parseopts()
3589 options--; in blogic_parseopts()
3604 drvr_opts->bus_settle_time = bus_settle_time; in blogic_parseopts()
3607 drvr_opts->stop_tgt_inquiry = true; in blogic_parseopts()
3641 if (drvr_opts->qdepth[tgt_id] == 1) { in blogic_parseopts()
3643 drvr_opts->tagq_ok &= ~tgt_bit; in blogic_parseopts()
3644 drvr_opts->tagq_ok_mask |= tgt_bit; in blogic_parseopts()
3676 blogic_setup handles processing of Kernel Command Line Arguments.
3686 blogic_err("BusLogic: Obsolete Command Line Entry Format Ignored\n", NULL); in blogic_setup()