Lines Matching +full:- +full:viper

1 // SPDX-License-Identifier: GPL-2.0-or-later
9 * Copyright (c) 2000-2010 Adaptec, Inc.
10 * 2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
11 * 2016-2017 Microsemi Corp. (aacraid@microsemi.com)
64 "HP NetRAID-4M, IBM ServeRAID & ICP SCSI driver");
75 * become important. Check for on-board Raid first, add-in cards second.
84 { 0x1028, 0x0002, 0x1028, 0x00d1, 0, 0, 4 }, /* PERC 3/Di (Viper/PERC3DiV) */
93 { 0x9005, 0x0285, 0x9005, 0x0287, 0, 0, 13 }, /* Adaptec 2200S (Vulcan-2m) */
99 { 0x9005, 0x0285, 0x9005, 0x028a, 0, 0, 18 }, /* ASR-2020ZCR SCSI PCI-X ZCR (Skyhawk) */
100 { 0x9005, 0x0285, 0x9005, 0x028b, 0, 0, 19 }, /* ASR-2025ZCR SCSI SO-DIMM PCI-X ZCR (Terminator) */
101 { 0x9005, 0x0286, 0x9005, 0x028c, 0, 0, 20 }, /* ASR-2230S + ASR-2230SLP PCI-X (Lancer) */
102 { 0x9005, 0x0286, 0x9005, 0x028d, 0, 0, 21 }, /* ASR-2130S (Lancer) */
103 { 0x9005, 0x0286, 0x9005, 0x029b, 0, 0, 22 }, /* AAR-2820SA (Intruder) */
104 { 0x9005, 0x0286, 0x9005, 0x029c, 0, 0, 23 }, /* AAR-2620SA (Intruder) */
105 { 0x9005, 0x0286, 0x9005, 0x029d, 0, 0, 24 }, /* AAR-2420SA (Intruder) */
111 { 0x9005, 0x0285, 0x9005, 0x02a4, 0, 0, 30 }, /* ICP9085LI (Marauder-X) */
112 { 0x9005, 0x0285, 0x9005, 0x02a5, 0, 0, 31 }, /* ICP5085BR (Marauder-E) */
113 { 0x9005, 0x0286, 0x9005, 0x02a6, 0, 0, 32 }, /* ICP9067MA (Intruder-6) */
117 { 0x9005, 0x0285, 0x9005, 0x028e, 0, 0, 35 }, /* ASR-2020SA SATA PCI-X ZCR (Skyhawk) */
118 { 0x9005, 0x0285, 0x9005, 0x028f, 0, 0, 36 }, /* ASR-2025SA SATA SO-DIMM PCI-X ZCR (Terminator) */
119 { 0x9005, 0x0285, 0x9005, 0x0290, 0, 0, 37 }, /* AAR-2410SA PCI SATA 4ch (Jaguar II) */
121 { 0x9005, 0x0285, 0x9005, 0x0292, 0, 0, 39 }, /* AAR-2810SA PCI SATA 8ch (Corsair-8) */
122 { 0x9005, 0x0285, 0x9005, 0x0293, 0, 0, 40 }, /* AAR-21610SA PCI SATA 16ch (Corsair-16) */
123 { 0x9005, 0x0285, 0x9005, 0x0294, 0, 0, 41 }, /* ESD SO-DIMM PCI-X SATA ZCR (Prowler) */
124 { 0x9005, 0x0285, 0x103C, 0x3227, 0, 0, 42 }, /* AAR-2610SA PCI SATA 6ch */
125 { 0x9005, 0x0285, 0x9005, 0x0296, 0, 0, 43 }, /* ASR-2240S (SabreExpress) */
126 { 0x9005, 0x0285, 0x9005, 0x0297, 0, 0, 44 }, /* ASR-4005 */
129 { 0x9005, 0x0286, 0x1014, 0x9580, 0, 0, 46 }, /* IBM 8k/8k-l8 (Aurora) */
130 { 0x9005, 0x0286, 0x1014, 0x9540, 0, 0, 47 }, /* IBM 8k/8k-l4 (Aurora Lite) */
131 { 0x9005, 0x0285, 0x9005, 0x0298, 0, 0, 48 }, /* ASR-4000 (BlackBird) */
132 { 0x9005, 0x0285, 0x9005, 0x0299, 0, 0, 49 }, /* ASR-4800SAS (Marauder-X) */
133 { 0x9005, 0x0285, 0x9005, 0x029a, 0, 0, 50 }, /* ASR-4805SAS (Marauder-E) */
134 { 0x9005, 0x0286, 0x9005, 0x02a2, 0, 0, 51 }, /* ASR-3800 (Hurricane44) */
140 { 0x1011, 0x0046, 0x103c, 0x10c2, 0, 0, 56 }, /* HP NetRAID-4M */
155 * dmb - For now we add the number of channels to this structure.
164 … ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Viper/PERC3DiV) */
173 …00S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2200S (Vulcan-2m) */
179 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2020ZCR ", 2 }, /* ASR-2020ZCR SCSI PCI-X ZCR (Sky…
180 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2025ZCR ", 2 }, /* ASR-2025ZCR SCSI SO-DIMM PCI-X …
181 …{ aac_rkt_init, "aacraid", "ADAPTEC ", "ASR-2230S PCI-X ", 2 }, /* ASR-2230S + ASR-2230SLP PCI-X …
182 { aac_rkt_init, "aacraid", "ADAPTEC ", "ASR-2130S PCI-X ", 1 }, /* ASR-2130S (Lancer) */
183 { aac_rkt_init, "aacraid", "ADAPTEC ", "AAR-2820SA ", 1 }, /* AAR-2820SA (Intruder) */
184 { aac_rkt_init, "aacraid", "ADAPTEC ", "AAR-2620SA ", 1 }, /* AAR-2620SA (Intruder) */
185 { aac_rkt_init, "aacraid", "ADAPTEC ", "AAR-2420SA ", 1 }, /* AAR-2420SA (Intruder) */
191 { aac_rx_init, "aacraid", "ICP ", "ICP9085LI ", 1 }, /* ICP9085LI (Marauder-X) */
192 { aac_rx_init, "aacraid", "ICP ", "ICP5085BR ", 1 }, /* ICP5085BR (Marauder-E) */
193 { aac_rkt_init, "aacraid", "ICP ", "ICP9067MA ", 1 }, /* ICP9067MA (Intruder-6) */
196 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2020SA ", 1 }, /* ASR-2020SA SATA PCI-X ZCR (Sky…
197 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2025SA ", 1 }, /* ASR-2025SA SATA SO-DIMM PCI-X …
198 …{ aac_rx_init, "aacraid", "ADAPTEC ", "AAR-2410SA SATA ", 1, AAC_QUIRK_17SG }, /* AAR-2410SA PCI …
200 …ac_rx_init, "aacraid", "ADAPTEC ", "AAR-2810SA SATA ", 1, AAC_QUIRK_17SG }, /* AAR-2810SA PCI SAT…
201 …c_rx_init, "aacraid", "ADAPTEC ", "AAR-21610SA SATA", 1, AAC_QUIRK_17SG }, /* AAR-21610SA PCI SAT…
202 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2026ZCR ", 1 }, /* ESD SO-DIMM PCI-X SATA ZCR (Pro…
203 { aac_rx_init, "aacraid", "ADAPTEC ", "AAR-2610SA ", 1 }, /* SATA 6Ch (Bearcat) */
204 { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2240S ", 1 }, /* ASR-2240S (SabreExpress) */
205 { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-4005 ", 1 }, /* ASR-4005 */
207 { aac_rkt_init, "ServeRAID","IBM ", "ServeRAID 8k-l8 ", 1 }, /* IBM 8k/8k-l8 (Aurora) */
208 { aac_rkt_init, "ServeRAID","IBM ", "ServeRAID 8k-l4 ", 1 }, /* IBM 8k/8k-l4 (Aurora Lite) */
209 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-4000 ", 1 }, /* ASR-4000 (BlackBird & AvonPark)…
210 { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-4800SAS ", 1 }, /* ASR-4800SAS (Marauder-X) */
211 { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-4805SAS ", 1 }, /* ASR-4805SAS (Marauder-E) */
212 { aac_rkt_init, "aacraid", "ADAPTEC ", "ASR-3800 ", 1 }, /* ASR-3800 (Hurricane44) */
216 …{ aac_sa_init, "aacraid", "ADAPTEC ", "AAC-364 ", 4, AAC_QUIRK_34SG }, /* Adaptec 5400S (…
218 { aac_sa_init, "hpnraid", "HP ", "NetRAID ", 4, AAC_QUIRK_34SG }, /* HP NetRAID-4M */
231 * aac_queuecommand - queue a SCSI command
243 aac_priv(cmd)->owner = AAC_OWNER_LOWLEVEL; in aac_queuecommand()
249 * aac_info - Returns the host adapter name
257 struct aac_dev *dev = (struct aac_dev *)shost->hostdata; in aac_info()
258 return aac_drivers[dev->cardtype].name; in aac_info()
274 * aac_biosparm - return BIOS parameters for disk
304 * Assuming extended translation is enabled - #REVISIT# in aac_biosparm()
308 param->heads = 255; in aac_biosparm()
309 param->sectors = 63; in aac_biosparm()
311 param->heads = 128; in aac_biosparm()
312 param->sectors = 32; in aac_biosparm()
315 param->heads = 64; in aac_biosparm()
316 param->sectors = 32; in aac_biosparm()
319 param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors); in aac_biosparm()
333 int saved_cylinders = param->cylinders; in aac_biosparm()
338 end_head = entry->end_head; in aac_biosparm()
339 end_sec = entry->end_sector & 0x3f; in aac_biosparm()
342 param->heads = 64; in aac_biosparm()
343 param->sectors = 32; in aac_biosparm()
346 param->heads = 128; in aac_biosparm()
347 param->sectors = 32; in aac_biosparm()
350 param->heads = 255; in aac_biosparm()
351 param->sectors = 63; in aac_biosparm()
358 end_head = first->end_head; in aac_biosparm()
359 end_sec = first->end_sector & 0x3f; in aac_biosparm()
362 param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors); in aac_biosparm()
363 if (num < 4 && end_sec == param->sectors) { in aac_biosparm()
364 if (param->cylinders != saved_cylinders) { in aac_biosparm()
366 param->heads, param->sectors, num)); in aac_biosparm()
372 param->heads, param->sectors)); in aac_biosparm()
380 * aac_slave_configure - compute queue depths
390 struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata; in aac_slave_configure()
400 if (chn < AAC_MAX_BUSES && tid < AAC_MAX_TARGETS && aac->sa_firmware) { in aac_slave_configure()
401 devtype = aac->hba_map[chn][tid].devtype; in aac_slave_configure()
404 depth = aac->hba_map[chn][tid].qd_limit; in aac_slave_configure()
415 if (aac->jbod && (sdev->type == TYPE_DISK)) in aac_slave_configure()
416 sdev->removable = 1; in aac_slave_configure()
418 if (sdev->type == TYPE_DISK in aac_slave_configure()
420 && (!aac->jbod || sdev->inq_periph_qual) in aac_slave_configure()
421 && (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2))) { in aac_slave_configure()
424 return -ENXIO; in aac_slave_configure()
427 sdev->no_uld_attach = 1; in aac_slave_configure()
430 if (sdev->tagged_supported in aac_slave_configure()
431 && sdev->type == TYPE_DISK in aac_slave_configure()
432 && (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) in aac_slave_configure()
433 && !sdev->no_uld_attach) { in aac_slave_configure()
436 struct Scsi_Host *host = sdev->host; in aac_slave_configure()
443 for (cid = 0; cid < aac->maximum_num_containers; ++cid) in aac_slave_configure()
444 if (aac->fsa_dev[cid].valid) in aac_slave_configure()
448 if (dev->tagged_supported in aac_slave_configure()
449 && dev->type == TYPE_DISK in aac_slave_configure()
450 && (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) in aac_slave_configure()
451 && !dev->no_uld_attach) { in aac_slave_configure()
453 || !aac->fsa_dev[sdev_id(dev)].valid) { in aac_slave_configure()
464 depth = (host->can_queue - num_one) / num_lsu; in aac_slave_configure()
479 if (strncmp(sdev->vendor, "ATA", 3) == 0) in aac_slave_configure()
491 timeout = aac->sa_firmware ? AAC_SA_TIMEOUT : AAC_ARC_TIMEOUT; in aac_slave_configure()
492 blk_queue_rq_timeout(sdev->request_queue, timeout * HZ); in aac_slave_configure()
502 sdev->tagged_supported = 1; in aac_slave_configure()
508 * aac_change_queue_depth - alter queue depths
518 struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata); in aac_change_queue_depth()
524 aac->hba_map[chn][tid].devtype == AAC_DEVTYPE_NATIVE_RAW) in aac_change_queue_depth()
527 if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && in aac_change_queue_depth()
530 struct Scsi_Host *host = sdev->host; in aac_change_queue_depth()
534 if (dev->tagged_supported && (dev->type == TYPE_DISK) && in aac_change_queue_depth()
539 if (num >= host->can_queue) in aac_change_queue_depth()
540 num = host->can_queue - 1; in aac_change_queue_depth()
541 if (depth > (host->can_queue - num)) in aac_change_queue_depth()
542 depth = host->can_queue - num; in aac_change_queue_depth()
549 scsi_change_queue_depth(sdev, aac->hba_map[chn][tid].qd_limit); in aac_change_queue_depth()
553 return sdev->queue_depth; in aac_change_queue_depth()
559 struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata); in aac_show_raid_level()
561 return snprintf(buf, PAGE_SIZE, sdev->no_uld_attach in aac_show_raid_level()
563 ((aac->jbod && (sdev->type == TYPE_DISK)) ? "JBOD\n" : "")); in aac_show_raid_level()
565 get_container_type(aac->fsa_dev[sdev_id(sdev)].type)); in aac_show_raid_level()
580 struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata); in aac_show_unique_id()
586 memcpy(sn, aac->fsa_dev[sdev_id(sdev)].identifier, sizeof(sn)); in aac_show_unique_id()
618 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; in aac_ioctl()
620 return -EPERM; in aac_ioctl()
623 return -EBUSY; in aac_ioctl()
639 switch (aac_priv(scmnd)->owner) { in fib_count_iter()
641 fib_count->fwcnt++; in fib_count_iter()
644 fib_count->ehcnt++; in fib_count_iter()
647 fib_count->llcnt++; in fib_count_iter()
650 fib_count->mlcnt++; in fib_count_iter()
653 fib_count->krlcnt++; in fib_count_iter()
662 struct Scsi_Host *shost = aac->scsi_host_ptr; in get_num_of_incomplete_fibs()
668 ctrl_dev = &aac->pdev->dev; in get_num_of_incomplete_fibs()
670 dev_info(ctrl_dev, "outstanding cmd: midlevel-%d\n", fcnt.mlcnt); in get_num_of_incomplete_fibs()
671 dev_info(ctrl_dev, "outstanding cmd: lowlevel-%d\n", fcnt.llcnt); in get_num_of_incomplete_fibs()
672 dev_info(ctrl_dev, "outstanding cmd: error handler-%d\n", fcnt.ehcnt); in get_num_of_incomplete_fibs()
673 dev_info(ctrl_dev, "outstanding cmd: firmware-%d\n", fcnt.fwcnt); in get_num_of_incomplete_fibs()
674 dev_info(ctrl_dev, "outstanding cmd: kernel-%d\n", fcnt.krlcnt); in get_num_of_incomplete_fibs()
682 struct scsi_device * dev = cmd->device; in aac_eh_abort()
683 struct Scsi_Host * host = dev->host; in aac_eh_abort()
684 struct aac_dev * aac = (struct aac_dev *)host->hostdata; in aac_eh_abort()
694 if (aac->hba_map[bus][cid].devtype == AAC_DEVTYPE_NATIVE_RAW) { in aac_eh_abort()
702 host->host_no, sdev_channel(dev), sdev_id(dev), (int)dev->lun); in aac_eh_abort()
705 for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { in aac_eh_abort()
706 fib = &aac->fibs[count]; in aac_eh_abort()
707 if (*(u8 *)fib->hw_fib_va != 0 && in aac_eh_abort()
708 (fib->flags & FIB_CONTEXT_FLAG_NATIVE_HBA) && in aac_eh_abort()
709 (fib->callback_data == cmd)) { in aac_eh_abort()
722 tmf = (struct aac_hba_tm_req *)fib->hw_fib_va; in aac_eh_abort()
724 tmf->tmf = HBA_TMF_ABORT_TASK; in aac_eh_abort()
725 tmf->it_nexus = aac->hba_map[bus][cid].rmw_nexus; in aac_eh_abort()
726 tmf->lun[1] = cmd->device->lun; in aac_eh_abort()
728 address = (u64)fib->hw_error_pa; in aac_eh_abort()
729 tmf->error_ptr_hi = cpu_to_le32((u32)(address >> 32)); in aac_eh_abort()
730 tmf->error_ptr_lo = cpu_to_le32((u32)(address & 0xffffffff)); in aac_eh_abort()
731 tmf->error_length = cpu_to_le32(FW_ERROR_BUFFER_SIZE); in aac_eh_abort()
733 fib->hbacmd_size = sizeof(*tmf); in aac_eh_abort()
734 cmd_priv->sent_command = 0; in aac_eh_abort()
739 if (status != -EINPROGRESS) { in aac_eh_abort()
746 if (cmd_priv->sent_command) { in aac_eh_abort()
761 host->host_no, sdev_channel(dev), sdev_id(dev), in aac_eh_abort()
762 (int)dev->lun); in aac_eh_abort()
763 switch (cmd->cmnd[0]) { in aac_eh_abort()
765 if (!(aac->raw_io_interface) || in aac_eh_abort()
766 !(aac->raw_io_64) || in aac_eh_abort()
767 ((cmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16)) in aac_eh_abort()
777 count < (host->can_queue + AAC_NUM_MGT_FIB); in aac_eh_abort()
779 struct fib *fib = &aac->fibs[count]; in aac_eh_abort()
781 if (fib->hw_fib_va->header.XferState && in aac_eh_abort()
782 (fib->flags & FIB_CONTEXT_FLAG) && in aac_eh_abort()
783 (fib->callback_data == cmd)) { in aac_eh_abort()
784 fib->flags |= in aac_eh_abort()
786 cmd_priv->owner = in aac_eh_abort()
798 count < (host->can_queue + AAC_NUM_MGT_FIB); in aac_eh_abort()
801 struct fib *fib = &aac->fibs[count]; in aac_eh_abort()
803 command = fib->callback_data; in aac_eh_abort()
805 if ((fib->hw_fib_va->header.XferState & in aac_eh_abort()
808 (fib->flags & FIB_CONTEXT_FLAG) && in aac_eh_abort()
810 (command->device == cmd->device)) { in aac_eh_abort()
811 fib->flags |= in aac_eh_abort()
813 aac_priv(command)->owner = in aac_eh_abort()
832 tmf = (struct aac_hba_tm_req *)fib->hw_fib_va; in aac_eh_tmf_lun_reset_fib()
834 tmf->tmf = HBA_TMF_LUN_RESET; in aac_eh_tmf_lun_reset_fib()
835 tmf->it_nexus = info->rmw_nexus; in aac_eh_tmf_lun_reset_fib()
836 int_to_scsilun(tmf_lun, (struct scsi_lun *)tmf->lun); in aac_eh_tmf_lun_reset_fib()
838 address = (u64)fib->hw_error_pa; in aac_eh_tmf_lun_reset_fib()
839 tmf->error_ptr_hi = cpu_to_le32 in aac_eh_tmf_lun_reset_fib()
841 tmf->error_ptr_lo = cpu_to_le32 in aac_eh_tmf_lun_reset_fib()
843 tmf->error_length = cpu_to_le32(FW_ERROR_BUFFER_SIZE); in aac_eh_tmf_lun_reset_fib()
844 fib->hbacmd_size = sizeof(*tmf); in aac_eh_tmf_lun_reset_fib()
856 rst = (struct aac_hba_reset_req *)fib->hw_fib_va; in aac_eh_tmf_hard_reset_fib()
858 rst->it_nexus = info->rmw_nexus; in aac_eh_tmf_hard_reset_fib()
860 address = (u64)fib->hw_error_pa; in aac_eh_tmf_hard_reset_fib()
861 rst->error_ptr_hi = cpu_to_le32((u32)(address >> 32)); in aac_eh_tmf_hard_reset_fib()
862 rst->error_ptr_lo = cpu_to_le32((u32)(address & 0xffffffff)); in aac_eh_tmf_hard_reset_fib()
863 rst->error_length = cpu_to_le32(FW_ERROR_BUFFER_SIZE); in aac_eh_tmf_hard_reset_fib()
864 fib->hbacmd_size = sizeof(*rst); in aac_eh_tmf_hard_reset_fib()
872 &((struct aac_native_hba *)fibptr->hw_fib_va)->resp.err; in aac_tmf_callback()
876 switch (err->service_response) { in aac_tmf_callback()
878 res = -1; in aac_tmf_callback()
888 res = -2; in aac_tmf_callback()
893 info->reset_state = res; in aac_tmf_callback()
897 * aac_eh_dev_reset - Device reset command handling
903 struct scsi_device * dev = cmd->device; in aac_eh_dev_reset()
904 struct Scsi_Host * host = dev->host; in aac_eh_dev_reset()
905 struct aac_dev * aac = (struct aac_dev *)host->hostdata; in aac_eh_dev_reset()
920 info = &aac->hba_map[bus][cid]; in aac_eh_dev_reset()
922 if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW && in aac_eh_dev_reset()
923 !(info->reset_state > 0))) in aac_eh_dev_reset()
934 command = aac_eh_tmf_lun_reset_fib(info, fib, dev->lun); in aac_eh_dev_reset()
936 info->reset_state = 1; in aac_eh_dev_reset()
941 if (status != -EINPROGRESS) { in aac_eh_dev_reset()
942 info->reset_state = 0; in aac_eh_dev_reset()
949 if (info->reset_state == 0) { in aac_eh_dev_reset()
950 ret = info->reset_state == 0 ? SUCCESS : FAILED; in aac_eh_dev_reset()
960 * aac_eh_target_reset - Target reset command handling
966 struct scsi_device * dev = cmd->device; in aac_eh_target_reset()
967 struct Scsi_Host * host = dev->host; in aac_eh_target_reset()
968 struct aac_dev * aac = (struct aac_dev *)host->hostdata; in aac_eh_target_reset()
983 info = &aac->hba_map[bus][cid]; in aac_eh_target_reset()
985 if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW && in aac_eh_target_reset()
986 !(info->reset_state > 0))) in aac_eh_target_reset()
1000 info->reset_state = 2; in aac_eh_target_reset()
1006 if (status != -EINPROGRESS) { in aac_eh_target_reset()
1007 info->reset_state = 0; in aac_eh_target_reset()
1015 if (info->reset_state <= 0) { in aac_eh_target_reset()
1016 ret = info->reset_state == 0 ? SUCCESS : FAILED; in aac_eh_target_reset()
1026 * aac_eh_bus_reset - Bus reset command handling
1032 struct scsi_device * dev = cmd->device; in aac_eh_bus_reset()
1033 struct Scsi_Host * host = dev->host; in aac_eh_bus_reset()
1034 struct aac_dev * aac = (struct aac_dev *)host->hostdata; in aac_eh_bus_reset()
1042 for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { in aac_eh_bus_reset()
1043 struct fib *fib = &aac->fibs[count]; in aac_eh_bus_reset()
1045 if (fib->hw_fib_va->header.XferState && in aac_eh_bus_reset()
1046 (fib->flags & FIB_CONTEXT_FLAG) && in aac_eh_bus_reset()
1047 (fib->flags & FIB_CONTEXT_FLAG_SCSI_CMD)) { in aac_eh_bus_reset()
1051 cmd = (struct scsi_cmnd *)fib->callback_data; in aac_eh_bus_reset()
1056 info = &aac->hba_map[bus][cid]; in aac_eh_bus_reset()
1058 info->devtype != AAC_DEVTYPE_NATIVE_RAW) { in aac_eh_bus_reset()
1059 fib->flags |= FIB_CONTEXT_FLAG_EH_RESET; in aac_eh_bus_reset()
1060 aac_priv(cmd)->owner = AAC_OWNER_ERROR_HANDLER; in aac_eh_bus_reset()
1072 dev_err(&aac->pdev->dev, "Adapter health - %d\n", status); in aac_eh_bus_reset()
1079 * aac_eh_host_reset - Host reset command handling
1085 struct scsi_device * dev = cmd->device; in aac_eh_host_reset()
1086 struct Scsi_Host * host = dev->host; in aac_eh_host_reset()
1087 struct aac_dev * aac = (struct aac_dev *)host->hostdata; in aac_eh_host_reset()
1097 supported_options2 = aac->supplement_adapter_info.supported_options2; in aac_eh_host_reset()
1108 && (aac_check_reset != -1 || !is_ignore_reset)) { in aac_eh_host_reset()
1122 info = &aac->hba_map[bus][cid]; in aac_eh_host_reset()
1123 if (info->devtype == AAC_DEVTYPE_NATIVE_RAW) in aac_eh_host_reset()
1124 info->reset_state = 0; in aac_eh_host_reset()
1132 * aac_cfg_open - open a configuration file
1147 int err = -ENODEV; in aac_cfg_open()
1151 if (aac->id == minor_number) { in aac_cfg_open()
1152 file->private_data = aac; in aac_cfg_open()
1163 * aac_cfg_ioctl - AAC configuration request
1178 struct aac_dev *aac = (struct aac_dev *)file->private_data; in aac_cfg_ioctl()
1181 return -EPERM; in aac_cfg_ioctl()
1189 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_model()
1192 if (dev->supplement_adapter_info.adapter_type_text[0]) { in aac_show_model()
1193 char *cp = dev->supplement_adapter_info.adapter_type_text; in aac_show_model()
1201 aac_drivers[dev->cardtype].model); in aac_show_model()
1208 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_vendor()
1212 sup_adap_info = &dev->supplement_adapter_info; in aac_show_vendor()
1213 if (sup_adap_info->adapter_type_text[0]) { in aac_show_vendor()
1214 char *cp = sup_adap_info->adapter_type_text; in aac_show_vendor()
1218 (int)(cp - (char *)sup_adap_info->adapter_type_text), in aac_show_vendor()
1219 sup_adap_info->adapter_type_text); in aac_show_vendor()
1222 aac_drivers[dev->cardtype].vname); in aac_show_vendor()
1230 struct aac_dev *dev = (struct aac_dev*)class_to_shost(cdev)->hostdata; in aac_show_flags()
1235 len += scnprintf(buf + len, PAGE_SIZE - len, in aac_show_flags()
1238 if (dev->raw_io_interface && dev->raw_io_64) in aac_show_flags()
1239 len += scnprintf(buf + len, PAGE_SIZE - len, in aac_show_flags()
1241 if (dev->jbod) in aac_show_flags()
1242 len += scnprintf(buf + len, PAGE_SIZE - len, in aac_show_flags()
1244 if (dev->supplement_adapter_info.supported_options2 & in aac_show_flags()
1246 len += scnprintf(buf + len, PAGE_SIZE - len, in aac_show_flags()
1248 if (dev->msi) in aac_show_flags()
1249 len += scnprintf(buf + len, PAGE_SIZE - len, "PCI_HAS_MSI\n"); in aac_show_flags()
1257 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_kernel_version()
1260 tmp = le32_to_cpu(dev->adapter_info.kernelrev); in aac_show_kernel_version()
1261 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", in aac_show_kernel_version()
1263 le32_to_cpu(dev->adapter_info.kernelbuild)); in aac_show_kernel_version()
1271 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_monitor_version()
1274 tmp = le32_to_cpu(dev->adapter_info.monitorrev); in aac_show_monitor_version()
1275 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", in aac_show_monitor_version()
1277 le32_to_cpu(dev->adapter_info.monitorbuild)); in aac_show_monitor_version()
1285 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_bios_version()
1288 tmp = le32_to_cpu(dev->adapter_info.biosrev); in aac_show_bios_version()
1289 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", in aac_show_bios_version()
1291 le32_to_cpu(dev->adapter_info.biosbuild)); in aac_show_bios_version()
1305 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_serial_number()
1308 if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) in aac_show_serial_number()
1310 le32_to_cpu(dev->adapter_info.serial[0])); in aac_show_serial_number()
1312 !memcmp(&dev->supplement_adapter_info.mfg_pcba_serial_no[ in aac_show_serial_number()
1313 sizeof(dev->supplement_adapter_info.mfg_pcba_serial_no)-len], in aac_show_serial_number()
1314 buf, len-1)) in aac_show_serial_number()
1316 (int)sizeof(dev->supplement_adapter_info.mfg_pcba_serial_no), in aac_show_serial_number()
1317 dev->supplement_adapter_info.mfg_pcba_serial_no); in aac_show_serial_number()
1326 class_to_shost(device)->max_channel); in aac_show_max_channel()
1333 class_to_shost(device)->max_id); in aac_show_max_id()
1340 int retval = -EACCES; in aac_store_reset_adapter()
1357 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_reset_adapter()
1361 if ((tmp == 0) && dev->in_reset) in aac_show_reset_adapter()
1362 tmp = -EBUSY; in aac_show_reset_adapter()
1516 mutex_lock(&aac->ioctl_mutex); in __aac_shutdown()
1517 aac->adapter_shutdown = 1; in __aac_shutdown()
1518 mutex_unlock(&aac->ioctl_mutex); in __aac_shutdown()
1520 if (aac->aif_thread) { in __aac_shutdown()
1523 for (i = 0; i < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++) { in __aac_shutdown()
1524 struct fib *fib = &aac->fibs[i]; in __aac_shutdown()
1525 if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) && in __aac_shutdown()
1526 (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected))) in __aac_shutdown()
1527 complete(&fib->event_wait); in __aac_shutdown()
1529 kthread_stop(aac->thread); in __aac_shutdown()
1530 aac->thread = NULL; in __aac_shutdown()
1538 if (aac->max_msix > 1) { in __aac_shutdown()
1539 for (i = 0; i < aac->max_msix; i++) { in __aac_shutdown()
1540 free_irq(pci_irq_vector(aac->pdev, i), in __aac_shutdown()
1541 &(aac->aac_msix[i])); in __aac_shutdown()
1544 free_irq(aac->pdev->irq, in __aac_shutdown()
1545 &(aac->aac_msix[0])); in __aac_shutdown()
1548 free_irq(aac->pdev->irq, aac); in __aac_shutdown()
1550 if (aac->msi) in __aac_shutdown()
1551 pci_disable_msi(aac->pdev); in __aac_shutdown()
1552 else if (aac->max_msix > 1) in __aac_shutdown()
1553 pci_disable_msix(aac->pdev); in __aac_shutdown()
1578 unsigned index = id->driver_data; in aac_probe_one()
1591 if (pdev->device == PMC_DEVICE_S7) in aac_probe_one()
1592 pdev->needs_freset = 1; in aac_probe_one()
1595 if (aac->id > unique_id) in aac_probe_one()
1597 insert = &aac->entry; in aac_probe_one()
1609 error = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in aac_probe_one()
1611 dev_err(&pdev->dev, "PCI 32 BIT dma mask set failed"); in aac_probe_one()
1628 error = dma_set_coherent_mask(&pdev->dev, dmamask); in aac_probe_one()
1630 dev_err(&pdev->dev, "PCI %d B consistent dma mask set failed\n" in aac_probe_one()
1639 error = -ENOMEM; in aac_probe_one()
1643 shost->irq = pdev->irq; in aac_probe_one()
1644 shost->unique_id = unique_id; in aac_probe_one()
1645 shost->max_cmd_len = 16; in aac_probe_one()
1650 aac = (struct aac_dev *)shost->hostdata; in aac_probe_one()
1651 aac->base_start = pci_resource_start(pdev, 0); in aac_probe_one()
1652 aac->scsi_host_ptr = shost; in aac_probe_one()
1653 aac->pdev = pdev; in aac_probe_one()
1654 aac->name = aac_driver_template.name; in aac_probe_one()
1655 aac->id = shost->unique_id; in aac_probe_one()
1656 aac->cardtype = index; in aac_probe_one()
1657 INIT_LIST_HEAD(&aac->entry); in aac_probe_one()
1660 aac->init_reset = true; in aac_probe_one()
1662 aac->fibs = kcalloc(shost->can_queue + AAC_NUM_MGT_FIB, in aac_probe_one()
1665 if (!aac->fibs) { in aac_probe_one()
1666 error = -ENOMEM; in aac_probe_one()
1670 spin_lock_init(&aac->fib_lock); in aac_probe_one()
1672 mutex_init(&aac->ioctl_mutex); in aac_probe_one()
1673 mutex_init(&aac->scan_mutex); in aac_probe_one()
1675 INIT_DELAYED_WORK(&aac->safw_rescan_work, aac_safw_rescan_worker); in aac_probe_one()
1676 INIT_DELAYED_WORK(&aac->src_reinit_aif_worker, in aac_probe_one()
1681 aac->base_size = AAC_MIN_FOOTPRINT_SIZE; in aac_probe_one()
1683 error = -ENODEV; in aac_probe_one()
1687 if (aac->sync_mode) { in aac_probe_one()
1692 aac->name, in aac_probe_one()
1693 aac->id); in aac_probe_one()
1698 aac->name, in aac_probe_one()
1699 aac->id); in aac_probe_one()
1705 aac->thread = kthread_run(aac_command_thread, aac, AAC_DRIVERNAME); in aac_probe_one()
1706 if (IS_ERR(aac->thread)) { in aac_probe_one()
1708 error = PTR_ERR(aac->thread); in aac_probe_one()
1709 aac->thread = NULL; in aac_probe_one()
1713 aac->maximum_num_channels = aac_drivers[index].channels; in aac_probe_one()
1722 (shost->sg_tablesize > 34)) { in aac_probe_one()
1723 shost->sg_tablesize = 34; in aac_probe_one()
1724 shost->max_sectors = (shost->sg_tablesize * 8) + 112; in aac_probe_one()
1728 (shost->sg_tablesize > 17)) { in aac_probe_one()
1729 shost->sg_tablesize = 17; in aac_probe_one()
1730 shost->max_sectors = (shost->sg_tablesize * 8) + 112; in aac_probe_one()
1733 if (aac->adapter_info.options & AAC_OPT_NEW_COMM) in aac_probe_one()
1734 shost->max_segment_size = shost->max_sectors << 9; in aac_probe_one()
1736 shost->max_segment_size = 65536; in aac_probe_one()
1742 aac->printf_enabled = 1; in aac_probe_one()
1744 aac->printf_enabled = 0; in aac_probe_one()
1751 if (aac->nondasd_support || expose_physicals || aac->jbod) in aac_probe_one()
1752 shost->max_channel = aac->maximum_num_channels; in aac_probe_one()
1754 shost->max_channel = 0; in aac_probe_one()
1758 list_add(&aac->entry, insert); in aac_probe_one()
1760 shost->max_id = aac->maximum_num_containers; in aac_probe_one()
1761 if (shost->max_id < aac->maximum_num_physicals) in aac_probe_one()
1762 shost->max_id = aac->maximum_num_physicals; in aac_probe_one()
1763 if (shost->max_id < MAXIMUM_NUM_CONTAINERS) in aac_probe_one()
1764 shost->max_id = MAXIMUM_NUM_CONTAINERS; in aac_probe_one()
1766 shost->this_id = shost->max_id; in aac_probe_one()
1768 if (!aac->sa_firmware && aac_drivers[index].quirks & AAC_QUIRK_SRC) in aac_probe_one()
1772 * dmb - we may need to move the setting of these parms somewhere else once in aac_probe_one()
1775 shost->max_lun = AAC_MAX_LUN; in aac_probe_one()
1779 error = scsi_add_host(shost, &pdev->dev); in aac_probe_one()
1793 if (aac->comm_addr) in aac_probe_one()
1794 dma_free_coherent(&aac->pdev->dev, aac->comm_size, in aac_probe_one()
1795 aac->comm_addr, aac->comm_phys); in aac_probe_one()
1796 kfree(aac->queues); in aac_probe_one()
1798 kfree(aac->fibs); in aac_probe_one()
1799 kfree(aac->fsa_dev); in aac_probe_one()
1832 if (dev->msi_enabled) in aac_acquire_resources()
1841 * Re-assign vectors to fibs in aac_acquire_resources()
1845 if (!dev->sync_mode) { in aac_acquire_resources()
1849 dev->init->r7.no_of_msix_vectors = cpu_to_le32(dev->max_msix); in aac_acquire_resources()
1855 return -1; in aac_acquire_resources()
1862 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; in aac_suspend()
1876 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; in aac_resume()
1884 aac->adapter_shutdown = 0; in aac_resume()
1890 printk(KERN_INFO "%s%d: resume failed.\n", aac->name, aac->id); in aac_resume()
1892 return -ENODEV; in aac_resume()
1900 __aac_shutdown((struct aac_dev *)shost->hostdata); in aac_shutdown()
1906 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; in aac_remove_one()
1913 dma_free_coherent(&aac->pdev->dev, aac->comm_size, aac->comm_addr, in aac_remove_one()
1914 aac->comm_phys); in aac_remove_one()
1915 kfree(aac->queues); in aac_remove_one()
1919 kfree(aac->fibs); in aac_remove_one()
1920 kfree(aac->fsa_dev); in aac_remove_one()
1922 list_del(&aac->entry); in aac_remove_one()
1937 dev_err(&pdev->dev, "aacraid: PCI error detected %x\n", error); in aac_pci_error_detected()
1943 aac->handle_pci_error = 1; in aac_pci_error_detected()
1954 aac->handle_pci_error = 1; in aac_pci_error_detected()
1965 dev_err(&pdev->dev, "aacraid: PCI error - mmio enabled\n"); in aac_pci_mmio_enabled()
1971 dev_err(&pdev->dev, "aacraid: PCI error - slot reset\n"); in aac_pci_slot_reset()
1974 dev_warn(&pdev->dev, in aac_pci_slot_reset()
1982 dev_err(&pdev->dev, "pci_enable_device_mem failed\n"); in aac_pci_slot_reset()
1989 dev_err(&pdev->dev, "aacraid: PCI error - slot reset failed\n"); in aac_pci_slot_reset()
1999 if (aac_adapter_ioremap(aac, aac->base_size)) { in aac_pci_resume()
2001 dev_err(&pdev->dev, "aacraid: ioremap failed\n"); in aac_pci_resume()
2003 aac->comm_interface = AAC_COMM_PRODUCER; in aac_pci_resume()
2005 dev_warn(&pdev->dev, in aac_pci_resume()
2020 aac->adapter_shutdown = 0; in aac_pci_resume()
2021 aac->handle_pci_error = 0; in aac_pci_resume()
2027 dev_err(&pdev->dev, "aacraid: PCI error - resume\n"); in aac_pci_resume()
2068 if (aac_cfg_major > -1) in aac_exit()