Lines Matching +full:aac +full:- +full:mode
2 * Adaptec AAC series RAID controller driver
8 * Copyright (c) 2000-2010 Adaptec, Inc.
9 * 2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
10 * 2016-2017 Microsemi Corp. (aacraid@microsemi.com)
43 #include <linux/pci-aspm.h>
78 "HP NetRAID-4M, IBM ServeRAID & ICP SCSI driver");
89 * become important. Check for on-board Raid first, add-in cards second.
107 { 0x9005, 0x0285, 0x9005, 0x0287, 0, 0, 13 }, /* Adaptec 2200S (Vulcan-2m) */
113 { 0x9005, 0x0285, 0x9005, 0x028a, 0, 0, 18 }, /* ASR-2020ZCR SCSI PCI-X ZCR (Skyhawk) */
114 { 0x9005, 0x0285, 0x9005, 0x028b, 0, 0, 19 }, /* ASR-2025ZCR SCSI SO-DIMM PCI-X ZCR (Terminator) */
115 { 0x9005, 0x0286, 0x9005, 0x028c, 0, 0, 20 }, /* ASR-2230S + ASR-2230SLP PCI-X (Lancer) */
116 { 0x9005, 0x0286, 0x9005, 0x028d, 0, 0, 21 }, /* ASR-2130S (Lancer) */
117 { 0x9005, 0x0286, 0x9005, 0x029b, 0, 0, 22 }, /* AAR-2820SA (Intruder) */
118 { 0x9005, 0x0286, 0x9005, 0x029c, 0, 0, 23 }, /* AAR-2620SA (Intruder) */
119 { 0x9005, 0x0286, 0x9005, 0x029d, 0, 0, 24 }, /* AAR-2420SA (Intruder) */
125 { 0x9005, 0x0285, 0x9005, 0x02a4, 0, 0, 30 }, /* ICP9085LI (Marauder-X) */
126 { 0x9005, 0x0285, 0x9005, 0x02a5, 0, 0, 31 }, /* ICP5085BR (Marauder-E) */
127 { 0x9005, 0x0286, 0x9005, 0x02a6, 0, 0, 32 }, /* ICP9067MA (Intruder-6) */
131 { 0x9005, 0x0285, 0x9005, 0x028e, 0, 0, 35 }, /* ASR-2020SA SATA PCI-X ZCR (Skyhawk) */
132 { 0x9005, 0x0285, 0x9005, 0x028f, 0, 0, 36 }, /* ASR-2025SA SATA SO-DIMM PCI-X ZCR (Terminator) */
133 { 0x9005, 0x0285, 0x9005, 0x0290, 0, 0, 37 }, /* AAR-2410SA PCI SATA 4ch (Jaguar II) */
135 { 0x9005, 0x0285, 0x9005, 0x0292, 0, 0, 39 }, /* AAR-2810SA PCI SATA 8ch (Corsair-8) */
136 { 0x9005, 0x0285, 0x9005, 0x0293, 0, 0, 40 }, /* AAR-21610SA PCI SATA 16ch (Corsair-16) */
137 { 0x9005, 0x0285, 0x9005, 0x0294, 0, 0, 41 }, /* ESD SO-DIMM PCI-X SATA ZCR (Prowler) */
138 { 0x9005, 0x0285, 0x103C, 0x3227, 0, 0, 42 }, /* AAR-2610SA PCI SATA 6ch */
139 { 0x9005, 0x0285, 0x9005, 0x0296, 0, 0, 43 }, /* ASR-2240S (SabreExpress) */
140 { 0x9005, 0x0285, 0x9005, 0x0297, 0, 0, 44 }, /* ASR-4005 */
143 { 0x9005, 0x0286, 0x1014, 0x9580, 0, 0, 46 }, /* IBM 8k/8k-l8 (Aurora) */
144 { 0x9005, 0x0286, 0x1014, 0x9540, 0, 0, 47 }, /* IBM 8k/8k-l4 (Aurora Lite) */
145 { 0x9005, 0x0285, 0x9005, 0x0298, 0, 0, 48 }, /* ASR-4000 (BlackBird) */
146 { 0x9005, 0x0285, 0x9005, 0x0299, 0, 0, 49 }, /* ASR-4800SAS (Marauder-X) */
147 { 0x9005, 0x0285, 0x9005, 0x029a, 0, 0, 50 }, /* ASR-4805SAS (Marauder-E) */
148 { 0x9005, 0x0286, 0x9005, 0x02a2, 0, 0, 51 }, /* ASR-3800 (Hurricane44) */
154 { 0x1011, 0x0046, 0x103c, 0x10c2, 0, 0, 56 }, /* HP NetRAID-4M */
169 * dmb - For now we add the number of channels to this structure.
187 …00S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2200S (Vulcan-2m) */
193 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2020ZCR ", 2 }, /* ASR-2020ZCR SCSI PCI-X ZCR (Sky…
194 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2025ZCR ", 2 }, /* ASR-2025ZCR SCSI SO-DIMM PCI-X …
195 …{ aac_rkt_init, "aacraid", "ADAPTEC ", "ASR-2230S PCI-X ", 2 }, /* ASR-2230S + ASR-2230SLP PCI-X …
196 { aac_rkt_init, "aacraid", "ADAPTEC ", "ASR-2130S PCI-X ", 1 }, /* ASR-2130S (Lancer) */
197 { aac_rkt_init, "aacraid", "ADAPTEC ", "AAR-2820SA ", 1 }, /* AAR-2820SA (Intruder) */
198 { aac_rkt_init, "aacraid", "ADAPTEC ", "AAR-2620SA ", 1 }, /* AAR-2620SA (Intruder) */
199 { aac_rkt_init, "aacraid", "ADAPTEC ", "AAR-2420SA ", 1 }, /* AAR-2420SA (Intruder) */
205 { aac_rx_init, "aacraid", "ICP ", "ICP9085LI ", 1 }, /* ICP9085LI (Marauder-X) */
206 { aac_rx_init, "aacraid", "ICP ", "ICP5085BR ", 1 }, /* ICP5085BR (Marauder-E) */
207 { aac_rkt_init, "aacraid", "ICP ", "ICP9067MA ", 1 }, /* ICP9067MA (Intruder-6) */
210 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2020SA ", 1 }, /* ASR-2020SA SATA PCI-X ZCR (Sky…
211 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2025SA ", 1 }, /* ASR-2025SA SATA SO-DIMM PCI-X …
212 …{ aac_rx_init, "aacraid", "ADAPTEC ", "AAR-2410SA SATA ", 1, AAC_QUIRK_17SG }, /* AAR-2410SA PCI …
214 …ac_rx_init, "aacraid", "ADAPTEC ", "AAR-2810SA SATA ", 1, AAC_QUIRK_17SG }, /* AAR-2810SA PCI SAT…
215 …c_rx_init, "aacraid", "ADAPTEC ", "AAR-21610SA SATA", 1, AAC_QUIRK_17SG }, /* AAR-21610SA PCI SAT…
216 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2026ZCR ", 1 }, /* ESD SO-DIMM PCI-X SATA ZCR (Pro…
217 { aac_rx_init, "aacraid", "ADAPTEC ", "AAR-2610SA ", 1 }, /* SATA 6Ch (Bearcat) */
218 { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2240S ", 1 }, /* ASR-2240S (SabreExpress) */
219 { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-4005 ", 1 }, /* ASR-4005 */
221 { aac_rkt_init, "ServeRAID","IBM ", "ServeRAID 8k-l8 ", 1 }, /* IBM 8k/8k-l8 (Aurora) */
222 { aac_rkt_init, "ServeRAID","IBM ", "ServeRAID 8k-l4 ", 1 }, /* IBM 8k/8k-l4 (Aurora Lite) */
223 …{ aac_rx_init, "aacraid", "ADAPTEC ", "ASR-4000 ", 1 }, /* ASR-4000 (BlackBird & AvonPark)…
224 { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-4800SAS ", 1 }, /* ASR-4800SAS (Marauder-X) */
225 { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-4805SAS ", 1 }, /* ASR-4805SAS (Marauder-E) */
226 { aac_rkt_init, "aacraid", "ADAPTEC ", "ASR-3800 ", 1 }, /* ASR-3800 (Hurricane44) */
230 …{ aac_sa_init, "aacraid", "ADAPTEC ", "AAC-364 ", 4, AAC_QUIRK_34SG }, /* Adaptec 5400S (…
232 { aac_sa_init, "hpnraid", "HP ", "NetRAID ", 4, AAC_QUIRK_34SG }, /* HP NetRAID-4M */
245 * aac_queuecommand - queue a SCSI command
258 cmd->SCp.phase = AAC_OWNER_LOWLEVEL; in aac_queuecommand()
264 * aac_info - Returns the host adapter name
272 struct aac_dev *dev = (struct aac_dev *)shost->hostdata; in aac_info()
273 return aac_drivers[dev->cardtype].name; in aac_info()
289 * aac_biosparm - return BIOS parameters for disk
319 * Assuming extended translation is enabled - #REVISIT# in aac_biosparm()
323 param->heads = 255; in aac_biosparm()
324 param->sectors = 63; in aac_biosparm()
326 param->heads = 128; in aac_biosparm()
327 param->sectors = 32; in aac_biosparm()
330 param->heads = 64; in aac_biosparm()
331 param->sectors = 32; in aac_biosparm()
334 param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors); in aac_biosparm()
348 int saved_cylinders = param->cylinders; in aac_biosparm()
353 end_head = entry->end_head; in aac_biosparm()
354 end_sec = entry->end_sector & 0x3f; in aac_biosparm()
357 param->heads = 64; in aac_biosparm()
358 param->sectors = 32; in aac_biosparm()
361 param->heads = 128; in aac_biosparm()
362 param->sectors = 32; in aac_biosparm()
365 param->heads = 255; in aac_biosparm()
366 param->sectors = 63; in aac_biosparm()
373 end_head = first->end_head; in aac_biosparm()
374 end_sec = first->end_sector & 0x3f; in aac_biosparm()
377 param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors); in aac_biosparm()
378 if (num < 4 && end_sec == param->sectors) { in aac_biosparm()
379 if (param->cylinders != saved_cylinders) in aac_biosparm()
381 param->heads, param->sectors, num)); in aac_biosparm()
386 param->heads, param->sectors)); in aac_biosparm()
394 * aac_slave_configure - compute queue depths
404 struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata; in aac_slave_configure() local
413 if (chn < AAC_MAX_BUSES && tid < AAC_MAX_TARGETS && aac->sa_firmware) { in aac_slave_configure()
414 devtype = aac->hba_map[chn][tid].devtype; in aac_slave_configure()
417 depth = aac->hba_map[chn][tid].qd_limit; in aac_slave_configure()
428 if (aac->jbod && (sdev->type == TYPE_DISK)) in aac_slave_configure()
429 sdev->removable = 1; in aac_slave_configure()
431 if (sdev->type == TYPE_DISK in aac_slave_configure()
433 && (!aac->jbod || sdev->inq_periph_qual) in aac_slave_configure()
434 && (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2))) { in aac_slave_configure()
437 return -ENXIO; in aac_slave_configure()
440 sdev->no_uld_attach = 1; in aac_slave_configure()
443 if (sdev->tagged_supported in aac_slave_configure()
444 && sdev->type == TYPE_DISK in aac_slave_configure()
445 && (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) in aac_slave_configure()
446 && !sdev->no_uld_attach) { in aac_slave_configure()
449 struct Scsi_Host *host = sdev->host; in aac_slave_configure()
456 for (cid = 0; cid < aac->maximum_num_containers; ++cid) in aac_slave_configure()
457 if (aac->fsa_dev[cid].valid) in aac_slave_configure()
461 if (dev->tagged_supported in aac_slave_configure()
462 && dev->type == TYPE_DISK in aac_slave_configure()
463 && (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) in aac_slave_configure()
464 && !dev->no_uld_attach) { in aac_slave_configure()
466 || !aac->fsa_dev[sdev_id(dev)].valid) { in aac_slave_configure()
477 depth = (host->can_queue - num_one) / num_lsu; in aac_slave_configure()
492 if (strncmp(sdev->vendor, "ATA", 3) == 0) in aac_slave_configure()
502 if (set_timeout && sdev->request_queue->rq_timeout < (45 * HZ)) in aac_slave_configure()
503 blk_queue_rq_timeout(sdev->request_queue, 45*HZ); in aac_slave_configure()
512 sdev->tagged_supported = 1; in aac_slave_configure()
518 * aac_change_queue_depth - alter queue depths
528 struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata); in aac_change_queue_depth() local
534 aac->hba_map[chn][tid].devtype == AAC_DEVTYPE_NATIVE_RAW) in aac_change_queue_depth()
537 if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && in aac_change_queue_depth()
540 struct Scsi_Host *host = sdev->host; in aac_change_queue_depth()
544 if (dev->tagged_supported && (dev->type == TYPE_DISK) && in aac_change_queue_depth()
549 if (num >= host->can_queue) in aac_change_queue_depth()
550 num = host->can_queue - 1; in aac_change_queue_depth()
551 if (depth > (host->can_queue - num)) in aac_change_queue_depth()
552 depth = host->can_queue - num; in aac_change_queue_depth()
559 scsi_change_queue_depth(sdev, aac->hba_map[chn][tid].qd_limit); in aac_change_queue_depth()
563 return sdev->queue_depth; in aac_change_queue_depth()
569 struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata); in aac_show_raid_level() local
571 return snprintf(buf, PAGE_SIZE, sdev->no_uld_attach in aac_show_raid_level()
573 ((aac->jbod && (sdev->type == TYPE_DISK)) ? "JBOD\n" : "")); in aac_show_raid_level()
575 get_container_type(aac->fsa_dev[sdev_id(sdev)].type)); in aac_show_raid_level()
581 .mode = S_IRUGO,
590 struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata); in aac_show_unique_id() local
596 memcpy(sn, aac->fsa_dev[sdev_id(sdev)].identifier, sizeof(sn)); in aac_show_unique_id()
609 .mode = 0444,
624 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; in aac_ioctl()
626 return -EPERM; in aac_ioctl()
630 static int get_num_of_incomplete_fibs(struct aac_dev *aac) in get_num_of_incomplete_fibs() argument
635 struct Scsi_Host *shost = aac->scsi_host_ptr; in get_num_of_incomplete_fibs()
646 spin_lock_irqsave(&sdev->list_lock, flags); in get_num_of_incomplete_fibs()
647 list_for_each_entry(scmnd, &sdev->cmd_list, list) { in get_num_of_incomplete_fibs()
648 switch (scmnd->SCp.phase) { in get_num_of_incomplete_fibs()
666 spin_unlock_irqrestore(&sdev->list_lock, flags); in get_num_of_incomplete_fibs()
669 ctrl_dev = &aac->pdev->dev; in get_num_of_incomplete_fibs()
671 dev_info(ctrl_dev, "outstanding cmd: midlevel-%d\n", mlcnt); in get_num_of_incomplete_fibs()
672 dev_info(ctrl_dev, "outstanding cmd: lowlevel-%d\n", llcnt); in get_num_of_incomplete_fibs()
673 dev_info(ctrl_dev, "outstanding cmd: error handler-%d\n", ehcnt); in get_num_of_incomplete_fibs()
674 dev_info(ctrl_dev, "outstanding cmd: firmware-%d\n", fwcnt); in get_num_of_incomplete_fibs()
675 dev_info(ctrl_dev, "outstanding cmd: kernel-%d\n", 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() local
689 if (aac_adapter_check_health(aac)) 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()
718 fib = aac_fib_alloc(aac); 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->SCp.sent_command = 0; in aac_eh_abort()
739 if (status != -EINPROGRESS) { in aac_eh_abort()
746 if (cmd->SCp.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()
776 count < (host->can_queue + AAC_NUM_MGT_FIB); in aac_eh_abort()
778 struct fib *fib = &aac->fibs[count]; in aac_eh_abort()
780 if (fib->hw_fib_va->header.XferState && in aac_eh_abort()
781 (fib->flags & FIB_CONTEXT_FLAG) && in aac_eh_abort()
782 (fib->callback_data == cmd)) { in aac_eh_abort()
783 fib->flags |= in aac_eh_abort()
785 cmd->SCp.phase = in aac_eh_abort()
797 count < (host->can_queue + AAC_NUM_MGT_FIB); in aac_eh_abort()
800 struct fib *fib = &aac->fibs[count]; in aac_eh_abort()
802 command = fib->callback_data; in aac_eh_abort()
804 if ((fib->hw_fib_va->header.XferState & in aac_eh_abort()
807 (fib->flags & FIB_CONTEXT_FLAG) && in aac_eh_abort()
809 (command->device == cmd->device)) { in aac_eh_abort()
810 fib->flags |= in aac_eh_abort()
812 command->SCp.phase = in aac_eh_abort()
831 tmf = (struct aac_hba_tm_req *)fib->hw_fib_va; in aac_eh_tmf_lun_reset_fib()
833 tmf->tmf = HBA_TMF_LUN_RESET; in aac_eh_tmf_lun_reset_fib()
834 tmf->it_nexus = info->rmw_nexus; in aac_eh_tmf_lun_reset_fib()
835 int_to_scsilun(tmf_lun, (struct scsi_lun *)tmf->lun); in aac_eh_tmf_lun_reset_fib()
837 address = (u64)fib->hw_error_pa; in aac_eh_tmf_lun_reset_fib()
838 tmf->error_ptr_hi = cpu_to_le32 in aac_eh_tmf_lun_reset_fib()
840 tmf->error_ptr_lo = cpu_to_le32 in aac_eh_tmf_lun_reset_fib()
842 tmf->error_length = cpu_to_le32(FW_ERROR_BUFFER_SIZE); in aac_eh_tmf_lun_reset_fib()
843 fib->hbacmd_size = sizeof(*tmf); in aac_eh_tmf_lun_reset_fib()
855 rst = (struct aac_hba_reset_req *)fib->hw_fib_va; in aac_eh_tmf_hard_reset_fib()
857 rst->it_nexus = info->rmw_nexus; in aac_eh_tmf_hard_reset_fib()
859 address = (u64)fib->hw_error_pa; in aac_eh_tmf_hard_reset_fib()
860 rst->error_ptr_hi = cpu_to_le32((u32)(address >> 32)); in aac_eh_tmf_hard_reset_fib()
861 rst->error_ptr_lo = cpu_to_le32 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() local
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()
929 fib = aac_fib_alloc(aac); 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() local
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()
992 fib = aac_fib_alloc(aac); 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() local
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 cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; in aac_eh_bus_reset()
1070 status = aac_adapter_check_health(aac); in aac_eh_bus_reset()
1072 dev_err(&aac->pdev->dev, "Adapter health - %d\n", status); in aac_eh_bus_reset()
1074 count = get_num_of_incomplete_fibs(aac); 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() local
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()
1110 if (aac_reset_adapter(aac, 2, IOP_HWSOFT_RESET) == 0) 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
1145 struct aac_dev *aac; in aac_cfg_open() local
1147 int err = -ENODEV; in aac_cfg_open()
1150 list_for_each_entry(aac, &aac_devices, entry) { 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
1179 struct aac_dev *aac = (struct aac_dev *)file->private_data; in aac_cfg_ioctl() local
1182 return -EPERM; in aac_cfg_ioctl()
1184 return aac_do_ioctl(aac, cmd, (void __user *)arg); in aac_cfg_ioctl()
1212 ret = -EFAULT; in aac_compat_do_ioctl()
1213 if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32))) in aac_compat_do_ioctl()
1214 ret = -EFAULT; in aac_compat_do_ioctl()
1221 ret = -ENOIOCTLCMD; in aac_compat_do_ioctl()
1229 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; in aac_compat_ioctl()
1231 return -EPERM; in aac_compat_ioctl()
1238 return -EPERM; in aac_compat_cfg_ioctl()
1239 return aac_compat_do_ioctl(file->private_data, cmd, arg); in aac_compat_cfg_ioctl()
1246 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_model()
1249 if (dev->supplement_adapter_info.adapter_type_text[0]) { in aac_show_model()
1250 char *cp = dev->supplement_adapter_info.adapter_type_text; in aac_show_model()
1258 aac_drivers[dev->cardtype].model); in aac_show_model()
1265 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_vendor()
1269 sup_adap_info = &dev->supplement_adapter_info; in aac_show_vendor()
1270 if (sup_adap_info->adapter_type_text[0]) { in aac_show_vendor()
1271 char *cp = sup_adap_info->adapter_type_text; in aac_show_vendor()
1275 (int)(cp - (char *)sup_adap_info->adapter_type_text), in aac_show_vendor()
1276 sup_adap_info->adapter_type_text); in aac_show_vendor()
1279 aac_drivers[dev->cardtype].vname); in aac_show_vendor()
1287 struct aac_dev *dev = (struct aac_dev*)class_to_shost(cdev)->hostdata; in aac_show_flags()
1292 len += snprintf(buf + len, PAGE_SIZE - len, in aac_show_flags()
1295 if (dev->raw_io_interface && dev->raw_io_64) in aac_show_flags()
1296 len += snprintf(buf + len, PAGE_SIZE - len, in aac_show_flags()
1298 if (dev->jbod) in aac_show_flags()
1299 len += snprintf(buf + len, PAGE_SIZE - len, "SUPPORTED_JBOD\n"); in aac_show_flags()
1300 if (dev->supplement_adapter_info.supported_options2 & in aac_show_flags()
1302 len += snprintf(buf + len, PAGE_SIZE - len, in aac_show_flags()
1304 if (dev->msi) in aac_show_flags()
1305 len += snprintf(buf + len, PAGE_SIZE - len, "PCI_HAS_MSI\n"); in aac_show_flags()
1313 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_kernel_version()
1316 tmp = le32_to_cpu(dev->adapter_info.kernelrev); in aac_show_kernel_version()
1317 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", in aac_show_kernel_version()
1319 le32_to_cpu(dev->adapter_info.kernelbuild)); in aac_show_kernel_version()
1327 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_monitor_version()
1330 tmp = le32_to_cpu(dev->adapter_info.monitorrev); in aac_show_monitor_version()
1331 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", in aac_show_monitor_version()
1333 le32_to_cpu(dev->adapter_info.monitorbuild)); in aac_show_monitor_version()
1341 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_bios_version()
1344 tmp = le32_to_cpu(dev->adapter_info.biosrev); in aac_show_bios_version()
1345 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", in aac_show_bios_version()
1347 le32_to_cpu(dev->adapter_info.biosbuild)); in aac_show_bios_version()
1361 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_serial_number()
1364 if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) in aac_show_serial_number()
1366 le32_to_cpu(dev->adapter_info.serial[0])); in aac_show_serial_number()
1368 !memcmp(&dev->supplement_adapter_info.mfg_pcba_serial_no[ in aac_show_serial_number()
1369 sizeof(dev->supplement_adapter_info.mfg_pcba_serial_no)-len], in aac_show_serial_number()
1370 buf, len-1)) in aac_show_serial_number()
1372 (int)sizeof(dev->supplement_adapter_info.mfg_pcba_serial_no), in aac_show_serial_number()
1373 dev->supplement_adapter_info.mfg_pcba_serial_no); in aac_show_serial_number()
1382 class_to_shost(device)->max_channel); in aac_show_max_channel()
1389 class_to_shost(device)->max_id); in aac_show_max_id()
1396 int retval = -EACCES; in aac_store_reset_adapter()
1413 struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; in aac_show_reset_adapter()
1417 if ((tmp == 0) && dev->in_reset) in aac_show_reset_adapter()
1418 tmp = -EBUSY; in aac_show_reset_adapter()
1426 .mode = S_IRUGO,
1433 .mode = S_IRUGO,
1440 .mode = S_IRUGO,
1447 .mode = S_IRUGO,
1454 .mode = S_IRUGO,
1461 .mode = S_IRUGO,
1468 .mode = 0444,
1475 .mode = S_IRUGO,
1482 .mode = S_IRUGO,
1489 .mode = S_IRUGO,
1496 .mode = S_IWUSR|S_IRUGO,
1534 .name = "AAC",
1566 static void __aac_shutdown(struct aac_dev * aac) in __aac_shutdown() argument
1570 mutex_lock(&aac->ioctl_mutex); in __aac_shutdown()
1571 aac->adapter_shutdown = 1; in __aac_shutdown()
1572 mutex_unlock(&aac->ioctl_mutex); in __aac_shutdown()
1574 if (aac->aif_thread) { in __aac_shutdown()
1577 for (i = 0; i < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++) { in __aac_shutdown()
1578 struct fib *fib = &aac->fibs[i]; in __aac_shutdown()
1579 if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) && in __aac_shutdown()
1580 (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected))) in __aac_shutdown()
1581 up(&fib->event_wait); in __aac_shutdown()
1583 kthread_stop(aac->thread); in __aac_shutdown()
1584 aac->thread = NULL; in __aac_shutdown()
1587 aac_send_shutdown(aac); in __aac_shutdown()
1589 aac_adapter_disable_int(aac); in __aac_shutdown()
1591 if (aac_is_src(aac)) { in __aac_shutdown()
1592 if (aac->max_msix > 1) { in __aac_shutdown()
1593 for (i = 0; i < aac->max_msix; i++) { in __aac_shutdown()
1594 free_irq(pci_irq_vector(aac->pdev, i), in __aac_shutdown()
1595 &(aac->aac_msix[i])); in __aac_shutdown()
1598 free_irq(aac->pdev->irq, in __aac_shutdown()
1599 &(aac->aac_msix[0])); in __aac_shutdown()
1602 free_irq(aac->pdev->irq, aac); in __aac_shutdown()
1604 if (aac->msi) in __aac_shutdown()
1605 pci_disable_msi(aac->pdev); in __aac_shutdown()
1606 else if (aac->max_msix > 1) in __aac_shutdown()
1607 pci_disable_msix(aac->pdev); in __aac_shutdown()
1611 aac_cfg_major = register_chrdev(0, "aac", &aac_cfg_fops); in aac_init_char()
1613 pr_err("aacraid: unable to register \"aac\" device.\n"); in aac_init_char()
1619 unsigned index = id->driver_data; in aac_probe_one()
1621 struct aac_dev *aac; in aac_probe_one() local
1632 if (pdev->device == PMC_DEVICE_S7) in aac_probe_one()
1633 pdev->needs_freset = 1; in aac_probe_one()
1635 list_for_each_entry(aac, &aac_devices, entry) { in aac_probe_one()
1636 if (aac->id > unique_id) in aac_probe_one()
1638 insert = &aac->entry; in aac_probe_one()
1652 dev_err(&pdev->dev, "PCI 32 BIT dma mask set failed"); in aac_probe_one()
1671 dev_err(&pdev->dev, "PCI %d B consistent dma mask set failed\n" in aac_probe_one()
1680 error = -ENOMEM; in aac_probe_one()
1684 shost->irq = pdev->irq; in aac_probe_one()
1685 shost->unique_id = unique_id; in aac_probe_one()
1686 shost->max_cmd_len = 16; in aac_probe_one()
1687 shost->use_cmd_list = 1; in aac_probe_one()
1692 aac = (struct aac_dev *)shost->hostdata; in aac_probe_one()
1693 aac->base_start = pci_resource_start(pdev, 0); in aac_probe_one()
1694 aac->scsi_host_ptr = shost; in aac_probe_one()
1695 aac->pdev = pdev; in aac_probe_one()
1696 aac->name = aac_driver_template.name; in aac_probe_one()
1697 aac->id = shost->unique_id; in aac_probe_one()
1698 aac->cardtype = index; in aac_probe_one()
1699 INIT_LIST_HEAD(&aac->entry); in aac_probe_one()
1702 aac->init_reset = true; in aac_probe_one()
1704 aac->fibs = kcalloc(shost->can_queue + AAC_NUM_MGT_FIB, in aac_probe_one()
1707 if (!aac->fibs) { in aac_probe_one()
1708 error = -ENOMEM; in aac_probe_one()
1712 spin_lock_init(&aac->fib_lock); in aac_probe_one()
1714 mutex_init(&aac->ioctl_mutex); in aac_probe_one()
1715 mutex_init(&aac->scan_mutex); in aac_probe_one()
1717 INIT_DELAYED_WORK(&aac->safw_rescan_work, aac_safw_rescan_worker); in aac_probe_one()
1721 aac->base_size = AAC_MIN_FOOTPRINT_SIZE; in aac_probe_one()
1722 if ((*aac_drivers[index].init)(aac)) { in aac_probe_one()
1723 error = -ENODEV; in aac_probe_one()
1727 if (aac->sync_mode) { in aac_probe_one()
1729 printk(KERN_INFO "%s%d: Sync. mode enforced " in aac_probe_one()
1732 aac->name, in aac_probe_one()
1733 aac->id); in aac_probe_one()
1735 printk(KERN_INFO "%s%d: Async. mode not supported " in aac_probe_one()
1736 "by current driver, sync. mode enforced." in aac_probe_one()
1738 aac->name, in aac_probe_one()
1739 aac->id); in aac_probe_one()
1745 aac->thread = kthread_run(aac_command_thread, aac, AAC_DRIVERNAME); in aac_probe_one()
1746 if (IS_ERR(aac->thread)) { in aac_probe_one()
1748 error = PTR_ERR(aac->thread); in aac_probe_one()
1749 aac->thread = NULL; in aac_probe_one()
1753 aac->maximum_num_channels = aac_drivers[index].channels; in aac_probe_one()
1754 error = aac_get_adapter_info(aac); in aac_probe_one()
1762 (shost->sg_tablesize > 34)) { in aac_probe_one()
1763 shost->sg_tablesize = 34; in aac_probe_one()
1764 shost->max_sectors = (shost->sg_tablesize * 8) + 112; in aac_probe_one()
1768 (shost->sg_tablesize > 17)) { in aac_probe_one()
1769 shost->sg_tablesize = 17; in aac_probe_one()
1770 shost->max_sectors = (shost->sg_tablesize * 8) + 112; in aac_probe_one()
1774 (aac->adapter_info.options & AAC_OPT_NEW_COMM) ? in aac_probe_one()
1775 (shost->max_sectors << 9) : 65536); in aac_probe_one()
1783 aac->printf_enabled = 1; in aac_probe_one()
1785 aac->printf_enabled = 0; in aac_probe_one()
1792 if (aac->nondasd_support || expose_physicals || aac->jbod) in aac_probe_one()
1793 shost->max_channel = aac->maximum_num_channels; in aac_probe_one()
1795 shost->max_channel = 0; in aac_probe_one()
1797 aac_get_config_status(aac, 0); in aac_probe_one()
1798 aac_get_containers(aac); in aac_probe_one()
1799 list_add(&aac->entry, insert); in aac_probe_one()
1801 shost->max_id = aac->maximum_num_containers; in aac_probe_one()
1802 if (shost->max_id < aac->maximum_num_physicals) in aac_probe_one()
1803 shost->max_id = aac->maximum_num_physicals; in aac_probe_one()
1804 if (shost->max_id < MAXIMUM_NUM_CONTAINERS) in aac_probe_one()
1805 shost->max_id = MAXIMUM_NUM_CONTAINERS; in aac_probe_one()
1807 shost->this_id = shost->max_id; in aac_probe_one()
1809 if (!aac->sa_firmware && aac_drivers[index].quirks & AAC_QUIRK_SRC) in aac_probe_one()
1810 aac_intr_normal(aac, 0, 2, 0, NULL); in aac_probe_one()
1813 * dmb - we may need to move the setting of these parms somewhere else once in aac_probe_one()
1816 shost->max_lun = AAC_MAX_LUN; in aac_probe_one()
1820 error = scsi_add_host(shost, &pdev->dev); in aac_probe_one()
1824 aac_scan_host(aac); in aac_probe_one()
1832 __aac_shutdown(aac); in aac_probe_one()
1834 aac_fib_map_free(aac); in aac_probe_one()
1835 if (aac->comm_addr) in aac_probe_one()
1836 dma_free_coherent(&aac->pdev->dev, aac->comm_size, in aac_probe_one()
1837 aac->comm_addr, aac->comm_phys); in aac_probe_one()
1838 kfree(aac->queues); in aac_probe_one()
1839 aac_adapter_ioremap(aac, 0); in aac_probe_one()
1840 kfree(aac->fibs); in aac_probe_one()
1841 kfree(aac->fsa_dev); in aac_probe_one()
1850 static void aac_release_resources(struct aac_dev *aac) in aac_release_resources() argument
1852 aac_adapter_disable_int(aac); in aac_release_resources()
1853 aac_free_irq(aac); in aac_release_resources()
1874 if (dev->msi_enabled) in aac_acquire_resources()
1883 * Re-assign vectors to fibs in aac_acquire_resources()
1887 if (!dev->sync_mode) { in aac_acquire_resources()
1891 dev->init->r7.no_of_msix_vectors = cpu_to_le32(dev->max_msix); in aac_acquire_resources()
1897 return -1; in aac_acquire_resources()
1906 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; in aac_suspend() local
1909 aac_cancel_safw_rescan_worker(aac); in aac_suspend()
1910 aac_send_shutdown(aac); in aac_suspend()
1912 aac_release_resources(aac); in aac_suspend()
1925 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; in aac_resume() local
1937 if (aac_acquire_resources(aac)) in aac_resume()
1943 aac->adapter_shutdown = 0; in aac_resume()
1949 printk(KERN_INFO "%s%d: resume failed.\n", aac->name, aac->id); in aac_resume()
1952 return -ENODEV; in aac_resume()
1960 __aac_shutdown((struct aac_dev *)shost->hostdata); in aac_shutdown()
1966 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; in aac_remove_one() local
1968 aac_cancel_safw_rescan_worker(aac); in aac_remove_one()
1971 __aac_shutdown(aac); in aac_remove_one()
1972 aac_fib_map_free(aac); in aac_remove_one()
1973 dma_free_coherent(&aac->pdev->dev, aac->comm_size, aac->comm_addr, in aac_remove_one()
1974 aac->comm_phys); in aac_remove_one()
1975 kfree(aac->queues); in aac_remove_one()
1977 aac_adapter_ioremap(aac, 0); in aac_remove_one()
1979 kfree(aac->fibs); in aac_remove_one()
1980 kfree(aac->fsa_dev); in aac_remove_one()
1982 list_del(&aac->entry); in aac_remove_one()
1986 unregister_chrdev(aac_cfg_major, "aac"); in aac_remove_one()
1991 static void aac_flush_ios(struct aac_dev *aac) in aac_flush_ios() argument
1996 for (i = 0; i < aac->scsi_host_ptr->can_queue; i++) { in aac_flush_ios()
1997 cmd = (struct scsi_cmnd *)aac->fibs[i].callback_data; in aac_flush_ios()
1998 if (cmd && (cmd->SCp.phase == AAC_OWNER_FIRMWARE)) { in aac_flush_ios()
2001 if (aac->handle_pci_error) in aac_flush_ios()
2002 cmd->result = DID_NO_CONNECT << 16; in aac_flush_ios()
2004 cmd->result = DID_RESET << 16; in aac_flush_ios()
2006 cmd->scsi_done(cmd); in aac_flush_ios()
2015 struct aac_dev *aac = shost_priv(shost); in aac_pci_error_detected() local
2017 dev_err(&pdev->dev, "aacraid: PCI error detected %x\n", error); in aac_pci_error_detected()
2023 aac->handle_pci_error = 1; in aac_pci_error_detected()
2025 scsi_block_requests(aac->scsi_host_ptr); in aac_pci_error_detected()
2026 aac_cancel_safw_rescan_worker(aac); in aac_pci_error_detected()
2027 aac_flush_ios(aac); in aac_pci_error_detected()
2028 aac_release_resources(aac); in aac_pci_error_detected()
2031 aac_adapter_ioremap(aac, 0); in aac_pci_error_detected()
2035 aac->handle_pci_error = 1; in aac_pci_error_detected()
2037 aac_flush_ios(aac); in aac_pci_error_detected()
2046 dev_err(&pdev->dev, "aacraid: PCI error - mmio enabled\n"); in aac_pci_mmio_enabled()
2052 dev_err(&pdev->dev, "aacraid: PCI error - slot reset\n"); in aac_pci_slot_reset()
2055 dev_warn(&pdev->dev, in aac_pci_slot_reset()
2063 dev_err(&pdev->dev, "pci_enable_device_mem failed\n"); in aac_pci_slot_reset()
2070 dev_err(&pdev->dev, "aacraid: PCI error - slot reset failed\n"); in aac_pci_slot_reset()
2079 struct aac_dev *aac = (struct aac_dev *)shost_priv(shost); in aac_pci_resume() local
2083 if (aac_adapter_ioremap(aac, aac->base_size)) { in aac_pci_resume()
2085 dev_err(&pdev->dev, "aacraid: ioremap failed\n"); in aac_pci_resume()
2087 aac->comm_interface = AAC_COMM_PRODUCER; in aac_pci_resume()
2088 if (aac_adapter_ioremap(aac, AAC_MIN_FOOTPRINT_SIZE)) { in aac_pci_resume()
2089 dev_warn(&pdev->dev, in aac_pci_resume()
2098 aac_acquire_resources(aac); in aac_pci_resume()
2104 aac->adapter_shutdown = 0; in aac_pci_resume()
2105 aac->handle_pci_error = 0; in aac_pci_resume()
2108 if (sdev->sdev_state == SDEV_OFFLINE) in aac_pci_resume()
2109 sdev->sdev_state = SDEV_RUNNING; in aac_pci_resume()
2110 scsi_unblock_requests(aac->scsi_host_ptr); in aac_pci_resume()
2111 aac_scan_host(aac); in aac_pci_resume()
2114 dev_err(&pdev->dev, "aacraid: PCI error - resume\n"); in aac_pci_resume()
2156 if (aac_cfg_major > -1) in aac_exit()
2157 unregister_chrdev(aac_cfg_major, "aac"); in aac_exit()