Lines Matching refs:ipr_cmd
585 static void ipr_trc_hook(struct ipr_cmnd *ipr_cmd, in ipr_trc_hook() argument
589 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_trc_hook()
595 trace_entry->op_code = ipr_cmd->ioarcb.cmd_pkt.cdb[0]; in ipr_trc_hook()
597 trace_entry->cmd_index = ipr_cmd->cmd_index & 0xff; in ipr_trc_hook()
598 trace_entry->res_handle = ipr_cmd->ioarcb.res_handle; in ipr_trc_hook()
603 #define ipr_trc_hook(ipr_cmd, type, add_data) do { } while (0) argument
613 static void ipr_lock_and_done(struct ipr_cmnd *ipr_cmd) in ipr_lock_and_done() argument
616 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_lock_and_done()
619 ipr_cmd->done(ipr_cmd); in ipr_lock_and_done()
630 static void ipr_reinit_ipr_cmnd(struct ipr_cmnd *ipr_cmd) in ipr_reinit_ipr_cmnd() argument
632 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_reinit_ipr_cmnd()
633 struct ipr_ioasa *ioasa = &ipr_cmd->s.ioasa; in ipr_reinit_ipr_cmnd()
634 dma_addr_t dma_addr = ipr_cmd->dma_addr; in ipr_reinit_ipr_cmnd()
645 if (ipr_cmd->ioa_cfg->sis64) { in ipr_reinit_ipr_cmnd()
656 ipr_cmd->scsi_cmd = NULL; in ipr_reinit_ipr_cmnd()
657 ipr_cmd->sense_buffer[0] = 0; in ipr_reinit_ipr_cmnd()
658 ipr_cmd->dma_use_sg = 0; in ipr_reinit_ipr_cmnd()
669 static void ipr_init_ipr_cmnd(struct ipr_cmnd *ipr_cmd, in ipr_init_ipr_cmnd() argument
672 ipr_reinit_ipr_cmnd(ipr_cmd); in ipr_init_ipr_cmnd()
673 ipr_cmd->u.scratch = 0; in ipr_init_ipr_cmnd()
674 ipr_cmd->sibling = NULL; in ipr_init_ipr_cmnd()
675 ipr_cmd->eh_comp = NULL; in ipr_init_ipr_cmnd()
676 ipr_cmd->fast_done = fast_done; in ipr_init_ipr_cmnd()
677 timer_setup(&ipr_cmd->timer, NULL, 0); in ipr_init_ipr_cmnd()
690 struct ipr_cmnd *ipr_cmd = NULL; in __ipr_get_free_ipr_cmnd() local
693 ipr_cmd = list_entry(hrrq->hrrq_free_q.next, in __ipr_get_free_ipr_cmnd()
695 list_del(&ipr_cmd->queue); in __ipr_get_free_ipr_cmnd()
699 return ipr_cmd; in __ipr_get_free_ipr_cmnd()
712 struct ipr_cmnd *ipr_cmd = in ipr_get_free_ipr_cmnd() local
714 ipr_init_ipr_cmnd(ipr_cmd, ipr_lock_and_done); in ipr_get_free_ipr_cmnd()
715 return ipr_cmd; in ipr_get_free_ipr_cmnd()
811 static void __ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd) in __ipr_scsi_eh_done() argument
813 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; in __ipr_scsi_eh_done()
817 scsi_dma_unmap(ipr_cmd->scsi_cmd); in __ipr_scsi_eh_done()
819 if (ipr_cmd->eh_comp) in __ipr_scsi_eh_done()
820 complete(ipr_cmd->eh_comp); in __ipr_scsi_eh_done()
821 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in __ipr_scsi_eh_done()
834 static void ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd) in ipr_scsi_eh_done() argument
837 struct ipr_hrr_queue *hrrq = ipr_cmd->hrrq; in ipr_scsi_eh_done()
840 __ipr_scsi_eh_done(ipr_cmd); in ipr_scsi_eh_done()
855 struct ipr_cmnd *ipr_cmd, *temp; in ipr_fail_all_ops() local
861 list_for_each_entry_safe(ipr_cmd, in ipr_fail_all_ops()
863 list_del(&ipr_cmd->queue); in ipr_fail_all_ops()
865 ipr_cmd->s.ioasa.hdr.ioasc = in ipr_fail_all_ops()
867 ipr_cmd->s.ioasa.hdr.ilid = in ipr_fail_all_ops()
870 if (ipr_cmd->scsi_cmd) in ipr_fail_all_ops()
871 ipr_cmd->done = __ipr_scsi_eh_done; in ipr_fail_all_ops()
873 ipr_trc_hook(ipr_cmd, IPR_TRACE_FINISH, in ipr_fail_all_ops()
875 del_timer(&ipr_cmd->timer); in ipr_fail_all_ops()
876 ipr_cmd->done(ipr_cmd); in ipr_fail_all_ops()
894 static void ipr_send_command(struct ipr_cmnd *ipr_cmd) in ipr_send_command() argument
896 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_send_command()
897 dma_addr_t send_dma_addr = ipr_cmd->dma_addr; in ipr_send_command()
905 if (ipr_cmd->dma_use_sg * sizeof(struct ipr_ioadl64_desc) > 128 ) in ipr_send_command()
925 static void ipr_do_req(struct ipr_cmnd *ipr_cmd, in ipr_do_req() argument
929 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); in ipr_do_req()
931 ipr_cmd->done = done; in ipr_do_req()
933 ipr_cmd->timer.expires = jiffies + timeout; in ipr_do_req()
934 ipr_cmd->timer.function = timeout_func; in ipr_do_req()
936 add_timer(&ipr_cmd->timer); in ipr_do_req()
938 ipr_trc_hook(ipr_cmd, IPR_TRACE_START, 0); in ipr_do_req()
940 ipr_send_command(ipr_cmd); in ipr_do_req()
953 static void ipr_internal_cmd_done(struct ipr_cmnd *ipr_cmd) in ipr_internal_cmd_done() argument
955 if (ipr_cmd->sibling) in ipr_internal_cmd_done()
956 ipr_cmd->sibling = NULL; in ipr_internal_cmd_done()
958 complete(&ipr_cmd->completion); in ipr_internal_cmd_done()
974 static void ipr_init_ioadl(struct ipr_cmnd *ipr_cmd, dma_addr_t dma_addr, in ipr_init_ioadl() argument
977 struct ipr_ioadl_desc *ioadl = ipr_cmd->i.ioadl; in ipr_init_ioadl()
978 struct ipr_ioadl64_desc *ioadl64 = ipr_cmd->i.ioadl64; in ipr_init_ioadl()
980 ipr_cmd->dma_use_sg = 1; in ipr_init_ioadl()
982 if (ipr_cmd->ioa_cfg->sis64) { in ipr_init_ioadl()
987 ipr_cmd->ioarcb.ioadl_len = in ipr_init_ioadl()
989 ipr_cmd->ioarcb.data_transfer_length = cpu_to_be32(len); in ipr_init_ioadl()
995 ipr_cmd->ioarcb.read_ioadl_len = in ipr_init_ioadl()
997 ipr_cmd->ioarcb.read_data_transfer_length = cpu_to_be32(len); in ipr_init_ioadl()
999 ipr_cmd->ioarcb.ioadl_len = in ipr_init_ioadl()
1001 ipr_cmd->ioarcb.data_transfer_length = cpu_to_be32(len); in ipr_init_ioadl()
1015 static void ipr_send_blocking_cmd(struct ipr_cmnd *ipr_cmd, in ipr_send_blocking_cmd() argument
1019 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_send_blocking_cmd()
1021 init_completion(&ipr_cmd->completion); in ipr_send_blocking_cmd()
1022 ipr_do_req(ipr_cmd, ipr_internal_cmd_done, timeout_func, timeout); in ipr_send_blocking_cmd()
1025 wait_for_completion(&ipr_cmd->completion); in ipr_send_blocking_cmd()
1058 struct ipr_cmnd *ipr_cmd; in ipr_send_hcam() local
1062 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg); in ipr_send_hcam()
1063 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); in ipr_send_hcam()
1066 ipr_cmd->u.hostrcb = hostrcb; in ipr_send_hcam()
1067 ioarcb = &ipr_cmd->ioarcb; in ipr_send_hcam()
1076 ipr_init_ioadl(ipr_cmd, hostrcb->hostrcb_dma, in ipr_send_hcam()
1080 ipr_cmd->done = ipr_process_ccn; in ipr_send_hcam()
1082 ipr_cmd->done = ipr_process_error; in ipr_send_hcam()
1084 ipr_trc_hook(ipr_cmd, IPR_TRACE_START, IPR_IOA_RES_ADDR); in ipr_send_hcam()
1086 ipr_send_command(ipr_cmd); in ipr_send_hcam()
1408 static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd) in ipr_process_ccn() argument
1410 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_process_ccn()
1411 struct ipr_hostrcb *hostrcb = ipr_cmd->u.hostrcb; in ipr_process_ccn()
1412 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_process_ccn()
1415 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_process_ccn()
2547 static void ipr_process_error(struct ipr_cmnd *ipr_cmd) in ipr_process_error() argument
2549 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_process_error()
2550 struct ipr_hostrcb *hostrcb = ipr_cmd->u.hostrcb; in ipr_process_error()
2551 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_process_error()
2560 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_process_error()
2591 struct ipr_cmnd *ipr_cmd = from_timer(ipr_cmd, t, timer); in ipr_timeout() local
2593 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_timeout()
2605 if (!ioa_cfg->in_reset_reload || ioa_cfg->reset_cmd == ipr_cmd) in ipr_timeout()
2624 struct ipr_cmnd *ipr_cmd = from_timer(ipr_cmd, t, timer); in ipr_oper_timeout() local
2626 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_oper_timeout()
2638 if (!ioa_cfg->in_reset_reload || ioa_cfg->reset_cmd == ipr_cmd) { in ipr_oper_timeout()
3867 static void ipr_build_ucode_ioadl64(struct ipr_cmnd *ipr_cmd, in ipr_build_ucode_ioadl64() argument
3870 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_build_ucode_ioadl64()
3871 struct ipr_ioadl64_desc *ioadl64 = ipr_cmd->i.ioadl64; in ipr_build_ucode_ioadl64()
3876 ipr_cmd->dma_use_sg = sglist->num_dma_sg; in ipr_build_ucode_ioadl64()
3881 cpu_to_be32(sizeof(struct ipr_ioadl64_desc) * ipr_cmd->dma_use_sg); in ipr_build_ucode_ioadl64()
3882 for_each_sg(scatterlist, sg, ipr_cmd->dma_use_sg, i) { in ipr_build_ucode_ioadl64()
3899 static void ipr_build_ucode_ioadl(struct ipr_cmnd *ipr_cmd, in ipr_build_ucode_ioadl() argument
3902 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_build_ucode_ioadl()
3903 struct ipr_ioadl_desc *ioadl = ipr_cmd->i.ioadl; in ipr_build_ucode_ioadl()
3908 ipr_cmd->dma_use_sg = sglist->num_dma_sg; in ipr_build_ucode_ioadl()
3913 cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg); in ipr_build_ucode_ioadl()
3915 for_each_sg(scatterlist, sg, ipr_cmd->dma_use_sg, i) { in ipr_build_ucode_ioadl()
4867 static int ipr_match_lun(struct ipr_cmnd *ipr_cmd, void *device) in ipr_match_lun() argument
4869 if (ipr_cmd->scsi_cmd && ipr_cmd->scsi_cmd->device == device) in ipr_match_lun()
4881 static bool ipr_cmnd_is_free(struct ipr_cmnd *ipr_cmd) in ipr_cmnd_is_free() argument
4885 list_for_each_entry(loop_cmd, &ipr_cmd->hrrq->hrrq_free_q, queue) { in ipr_cmnd_is_free()
4886 if (loop_cmd == ipr_cmd) in ipr_cmnd_is_free()
4905 struct ipr_cmnd *ipr_cmd; in ipr_wait_for_ops() local
4919 ipr_cmd = ioa_cfg->ipr_cmnd_list[i]; in ipr_wait_for_ops()
4920 if (!ipr_cmnd_is_free(ipr_cmd)) { in ipr_wait_for_ops()
4921 if (match(ipr_cmd, device)) { in ipr_wait_for_ops()
4922 ipr_cmd->eh_comp = ∁ in ipr_wait_for_ops()
4939 ipr_cmd = ioa_cfg->ipr_cmnd_list[i]; in ipr_wait_for_ops()
4940 if (!ipr_cmnd_is_free(ipr_cmd)) { in ipr_wait_for_ops()
4941 if (match(ipr_cmd, device)) { in ipr_wait_for_ops()
4942 ipr_cmd->eh_comp = NULL; in ipr_wait_for_ops()
5013 struct ipr_cmnd *ipr_cmd; in ipr_device_reset() local
5019 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg); in ipr_device_reset()
5020 ioarcb = &ipr_cmd->ioarcb; in ipr_device_reset()
5023 if (ipr_cmd->ioa_cfg->sis64) in ipr_device_reset()
5030 ipr_send_blocking_cmd(ipr_cmd, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT); in ipr_device_reset()
5031 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_device_reset()
5032 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_device_reset()
5111 static void ipr_bus_reset_done(struct ipr_cmnd *ipr_cmd) in ipr_bus_reset_done() argument
5113 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_bus_reset_done()
5119 if (res->res_handle == ipr_cmd->ioarcb.res_handle) { in ipr_bus_reset_done()
5129 if (ipr_cmd->sibling->sibling) in ipr_bus_reset_done()
5130 ipr_cmd->sibling->sibling = NULL; in ipr_bus_reset_done()
5132 ipr_cmd->sibling->done(ipr_cmd->sibling); in ipr_bus_reset_done()
5134 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_bus_reset_done()
5151 struct ipr_cmnd *ipr_cmd = from_timer(ipr_cmd, t, timer); in ipr_abort_timeout() local
5153 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_abort_timeout()
5159 if (ipr_cmd->completion.done || ioa_cfg->in_reset_reload) { in ipr_abort_timeout()
5164 sdev_printk(KERN_ERR, ipr_cmd->u.sdev, "Abort timed out. Resetting bus.\n"); in ipr_abort_timeout()
5166 ipr_cmd->sibling = reset_cmd; in ipr_abort_timeout()
5167 reset_cmd->sibling = ipr_cmd; in ipr_abort_timeout()
5168 reset_cmd->ioarcb.res_handle = ipr_cmd->ioarcb.res_handle; in ipr_abort_timeout()
5190 struct ipr_cmnd *ipr_cmd; in ipr_cancel_op() local
5238 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg); in ipr_cancel_op()
5239 ipr_cmd->ioarcb.res_handle = res->res_handle; in ipr_cancel_op()
5240 cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt; in ipr_cancel_op()
5243 ipr_cmd->u.sdev = scsi_cmd->device; in ipr_cancel_op()
5247 ipr_send_blocking_cmd(ipr_cmd, ipr_abort_timeout, IPR_CANCEL_ALL_TIMEOUT); in ipr_cancel_op()
5248 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_cancel_op()
5259 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_cancel_op()
5418 struct ipr_cmnd *ipr_cmd; in ipr_process_hrrq() local
5441 ipr_cmd = ioa_cfg->ipr_cmnd_list[cmd_index]; in ipr_process_hrrq()
5442 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_process_hrrq()
5444 ipr_trc_hook(ipr_cmd, IPR_TRACE_FINISH, ioasc); in ipr_process_hrrq()
5446 list_move_tail(&ipr_cmd->queue, doneq); in ipr_process_hrrq()
5465 struct ipr_cmnd *ipr_cmd, *temp; in ipr_iopoll() local
5479 list_for_each_entry_safe(ipr_cmd, temp, &doneq, queue) { in ipr_iopoll()
5480 list_del(&ipr_cmd->queue); in ipr_iopoll()
5481 del_timer(&ipr_cmd->timer); in ipr_iopoll()
5482 ipr_cmd->fast_done(ipr_cmd); in ipr_iopoll()
5504 struct ipr_cmnd *ipr_cmd, *temp; in ipr_isr() local
5548 list_for_each_entry_safe(ipr_cmd, temp, &doneq, queue) { in ipr_isr()
5549 list_del(&ipr_cmd->queue); in ipr_isr()
5550 del_timer(&ipr_cmd->timer); in ipr_isr()
5551 ipr_cmd->fast_done(ipr_cmd); in ipr_isr()
5569 struct ipr_cmnd *ipr_cmd, *temp; in ipr_isr_mhrrq() local
5598 list_for_each_entry_safe(ipr_cmd, temp, &doneq, queue) { in ipr_isr_mhrrq()
5599 list_del(&ipr_cmd->queue); in ipr_isr_mhrrq()
5600 del_timer(&ipr_cmd->timer); in ipr_isr_mhrrq()
5601 ipr_cmd->fast_done(ipr_cmd); in ipr_isr_mhrrq()
5615 struct ipr_cmnd *ipr_cmd) in ipr_build_ioadl64() argument
5621 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; in ipr_build_ioadl64()
5622 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_build_ioadl64()
5623 struct ipr_ioadl64_desc *ioadl64 = ipr_cmd->i.ioadl64; in ipr_build_ioadl64()
5636 ipr_cmd->dma_use_sg = nseg; in ipr_build_ioadl64()
5640 cpu_to_be32(sizeof(struct ipr_ioadl64_desc) * ipr_cmd->dma_use_sg); in ipr_build_ioadl64()
5648 scsi_for_each_sg(scsi_cmd, sg, ipr_cmd->dma_use_sg, i) { in ipr_build_ioadl64()
5667 struct ipr_cmnd *ipr_cmd) in ipr_build_ioadl() argument
5673 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; in ipr_build_ioadl()
5674 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_build_ioadl()
5675 struct ipr_ioadl_desc *ioadl = ipr_cmd->i.ioadl; in ipr_build_ioadl()
5687 ipr_cmd->dma_use_sg = nseg; in ipr_build_ioadl()
5694 cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg); in ipr_build_ioadl()
5699 cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg); in ipr_build_ioadl()
5702 if (ipr_cmd->dma_use_sg <= ARRAY_SIZE(ioarcb->u.add_data.u.ioadl)) { in ipr_build_ioadl()
5704 ioarcb->write_ioadl_addr = cpu_to_be32((ipr_cmd->dma_addr) + in ipr_build_ioadl()
5709 scsi_for_each_sg(scsi_cmd, sg, ipr_cmd->dma_use_sg, i) { in ipr_build_ioadl()
5729 static void __ipr_erp_done(struct ipr_cmnd *ipr_cmd) in __ipr_erp_done() argument
5731 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; in __ipr_erp_done()
5733 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in __ipr_erp_done()
5740 memcpy(scsi_cmd->sense_buffer, ipr_cmd->sense_buffer, in __ipr_erp_done()
5749 scsi_dma_unmap(ipr_cmd->scsi_cmd); in __ipr_erp_done()
5751 if (ipr_cmd->eh_comp) in __ipr_erp_done()
5752 complete(ipr_cmd->eh_comp); in __ipr_erp_done()
5753 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in __ipr_erp_done()
5766 static void ipr_erp_done(struct ipr_cmnd *ipr_cmd) in ipr_erp_done() argument
5768 struct ipr_hrr_queue *hrrq = ipr_cmd->hrrq; in ipr_erp_done()
5772 __ipr_erp_done(ipr_cmd); in ipr_erp_done()
5783 static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd) in ipr_reinit_ipr_cmnd_for_erp() argument
5785 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_reinit_ipr_cmnd_for_erp()
5786 struct ipr_ioasa *ioasa = &ipr_cmd->s.ioasa; in ipr_reinit_ipr_cmnd_for_erp()
5787 dma_addr_t dma_addr = ipr_cmd->dma_addr; in ipr_reinit_ipr_cmnd_for_erp()
5797 if (ipr_cmd->ioa_cfg->sis64) in ipr_reinit_ipr_cmnd_for_erp()
5817 static void __ipr_erp_request_sense(struct ipr_cmnd *ipr_cmd) in __ipr_erp_request_sense() argument
5819 struct ipr_cmd_pkt *cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt; in __ipr_erp_request_sense()
5820 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in __ipr_erp_request_sense()
5823 __ipr_erp_done(ipr_cmd); in __ipr_erp_request_sense()
5827 ipr_reinit_ipr_cmnd_for_erp(ipr_cmd); in __ipr_erp_request_sense()
5836 ipr_init_ioadl(ipr_cmd, ipr_cmd->sense_buffer_dma, in __ipr_erp_request_sense()
5839 ipr_do_req(ipr_cmd, ipr_erp_done, ipr_timeout, in __ipr_erp_request_sense()
5853 static void ipr_erp_request_sense(struct ipr_cmnd *ipr_cmd) in ipr_erp_request_sense() argument
5855 struct ipr_hrr_queue *hrrq = ipr_cmd->hrrq; in ipr_erp_request_sense()
5859 __ipr_erp_request_sense(ipr_cmd); in ipr_erp_request_sense()
5875 static void ipr_erp_cancel_all(struct ipr_cmnd *ipr_cmd) in ipr_erp_cancel_all() argument
5877 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; in ipr_erp_cancel_all()
5883 ipr_reinit_ipr_cmnd_for_erp(ipr_cmd); in ipr_erp_cancel_all()
5886 __ipr_erp_request_sense(ipr_cmd); in ipr_erp_cancel_all()
5890 cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt; in ipr_erp_cancel_all()
5894 ipr_do_req(ipr_cmd, ipr_erp_request_sense, ipr_timeout, in ipr_erp_cancel_all()
5912 struct ipr_cmnd *ipr_cmd, struct ipr_resource_entry *res) in ipr_dump_ioasa() argument
5917 struct ipr_ioasa *ioasa = &ipr_cmd->s.ioasa; in ipr_dump_ioasa()
5973 static void ipr_gen_sense(struct ipr_cmnd *ipr_cmd) in ipr_gen_sense() argument
5976 u8 *sense_buf = ipr_cmd->scsi_cmd->sense_buffer; in ipr_gen_sense()
5977 struct ipr_resource_entry *res = ipr_cmd->scsi_cmd->device->hostdata; in ipr_gen_sense()
5978 struct ipr_ioasa *ioasa = &ipr_cmd->s.ioasa; in ipr_gen_sense()
5986 ipr_cmd->scsi_cmd->result = SAM_STAT_CHECK_CONDITION; in ipr_gen_sense()
6066 static int ipr_get_autosense(struct ipr_cmnd *ipr_cmd) in ipr_get_autosense() argument
6068 struct ipr_ioasa *ioasa = &ipr_cmd->s.ioasa; in ipr_get_autosense()
6069 struct ipr_ioasa64 *ioasa64 = &ipr_cmd->s.ioasa64; in ipr_get_autosense()
6074 if (ipr_cmd->ioa_cfg->sis64) in ipr_get_autosense()
6075 memcpy(ipr_cmd->scsi_cmd->sense_buffer, ioasa64->auto_sense.data, in ipr_get_autosense()
6079 memcpy(ipr_cmd->scsi_cmd->sense_buffer, ioasa->auto_sense.data, in ipr_get_autosense()
6097 struct ipr_cmnd *ipr_cmd) in ipr_erp_start() argument
6099 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; in ipr_erp_start()
6101 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_erp_start()
6105 __ipr_scsi_eh_done(ipr_cmd); in ipr_erp_start()
6110 ipr_gen_sense(ipr_cmd); in ipr_erp_start()
6112 ipr_dump_ioasa(ioa_cfg, ipr_cmd, res); in ipr_erp_start()
6159 if (!ipr_get_autosense(ipr_cmd)) { in ipr_erp_start()
6161 ipr_erp_cancel_all(ipr_cmd); in ipr_erp_start()
6186 scsi_dma_unmap(ipr_cmd->scsi_cmd); in ipr_erp_start()
6188 if (ipr_cmd->eh_comp) in ipr_erp_start()
6189 complete(ipr_cmd->eh_comp); in ipr_erp_start()
6190 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_erp_start()
6203 static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) in ipr_scsi_done() argument
6205 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_scsi_done()
6206 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; in ipr_scsi_done()
6207 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_scsi_done()
6210 scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len)); in ipr_scsi_done()
6215 spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags); in ipr_scsi_done()
6217 if (ipr_cmd->eh_comp) in ipr_scsi_done()
6218 complete(ipr_cmd->eh_comp); in ipr_scsi_done()
6219 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_scsi_done()
6220 spin_unlock_irqrestore(ipr_cmd->hrrq->lock, lock_flags); in ipr_scsi_done()
6223 spin_lock(&ipr_cmd->hrrq->_lock); in ipr_scsi_done()
6224 ipr_erp_start(ioa_cfg, ipr_cmd); in ipr_scsi_done()
6225 spin_unlock(&ipr_cmd->hrrq->_lock); in ipr_scsi_done()
6248 struct ipr_cmnd *ipr_cmd; in ipr_queuecommand() local
6282 ipr_cmd = __ipr_get_free_ipr_cmnd(hrrq); in ipr_queuecommand()
6283 if (ipr_cmd == NULL) { in ipr_queuecommand()
6289 ipr_init_ipr_cmnd(ipr_cmd, ipr_scsi_done); in ipr_queuecommand()
6290 ioarcb = &ipr_cmd->ioarcb; in ipr_queuecommand()
6293 ipr_cmd->scsi_cmd = scsi_cmd; in ipr_queuecommand()
6294 ipr_cmd->done = ipr_scsi_eh_done; in ipr_queuecommand()
6328 rc = ipr_build_ioadl64(ioa_cfg, ipr_cmd); in ipr_queuecommand()
6330 rc = ipr_build_ioadl(ioa_cfg, ipr_cmd); in ipr_queuecommand()
6334 list_add_tail(&ipr_cmd->queue, &hrrq->hrrq_free_q); in ipr_queuecommand()
6342 list_add_tail(&ipr_cmd->queue, &hrrq->hrrq_free_q); in ipr_queuecommand()
6353 list_add_tail(&ipr_cmd->queue, &hrrq->hrrq_pending_q); in ipr_queuecommand()
6354 ipr_trc_hook(ipr_cmd, IPR_TRACE_START, IPR_GET_RES_PHYS_LOC(res)); in ipr_queuecommand()
6355 ipr_send_command(ipr_cmd); in ipr_queuecommand()
6464 static int ipr_ioa_bringdown_done(struct ipr_cmnd *ipr_cmd) in ipr_ioa_bringdown_done() argument
6466 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioa_bringdown_done()
6485 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_ioa_bringdown_done()
6503 static int ipr_ioa_reset_done(struct ipr_cmnd *ipr_cmd) in ipr_ioa_reset_done() argument
6505 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioa_reset_done()
6544 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_ioa_reset_done()
6581 static int ipr_set_supported_devs(struct ipr_cmnd *ipr_cmd) in ipr_set_supported_devs() argument
6583 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_set_supported_devs()
6585 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_set_supported_devs()
6586 struct ipr_resource_entry *res = ipr_cmd->u.res; in ipr_set_supported_devs()
6588 ipr_cmd->job_step = ipr_ioa_reset_done; in ipr_set_supported_devs()
6594 ipr_cmd->u.res = res; in ipr_set_supported_devs()
6606 ipr_init_ioadl(ipr_cmd, in ipr_set_supported_devs()
6612 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, in ipr_set_supported_devs()
6616 ipr_cmd->job_step = ipr_set_supported_devs; in ipr_set_supported_devs()
6782 static void ipr_build_mode_select(struct ipr_cmnd *ipr_cmd, in ipr_build_mode_select() argument
6786 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_build_mode_select()
6795 ipr_init_ioadl(ipr_cmd, dma_addr, xfer_len, IPR_IOADL_FLAGS_WRITE_LAST); in ipr_build_mode_select()
6808 static int ipr_ioafp_mode_select_page28(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_mode_select_page28() argument
6810 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_mode_select_page28()
6821 ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11, in ipr_ioafp_mode_select_page28()
6825 ipr_cmd->job_step = ipr_set_supported_devs; in ipr_ioafp_mode_select_page28()
6826 ipr_cmd->u.res = list_entry(ioa_cfg->used_res_q.next, in ipr_ioafp_mode_select_page28()
6828 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); in ipr_ioafp_mode_select_page28()
6845 static void ipr_build_mode_sense(struct ipr_cmnd *ipr_cmd, in ipr_build_mode_sense() argument
6849 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_build_mode_sense()
6857 ipr_init_ioadl(ipr_cmd, dma_addr, xfer_len, IPR_IOADL_FLAGS_READ_LAST); in ipr_build_mode_sense()
6869 static int ipr_reset_cmd_failed(struct ipr_cmnd *ipr_cmd) in ipr_reset_cmd_failed() argument
6871 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_cmd_failed()
6872 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_reset_cmd_failed()
6876 ipr_cmd->ioarcb.cmd_pkt.cdb[0], ioasc); in ipr_reset_cmd_failed()
6879 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_reset_cmd_failed()
6893 static int ipr_reset_mode_sense_failed(struct ipr_cmnd *ipr_cmd) in ipr_reset_mode_sense_failed() argument
6895 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_mode_sense_failed()
6896 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_reset_mode_sense_failed()
6899 ipr_cmd->job_step = ipr_set_supported_devs; in ipr_reset_mode_sense_failed()
6900 ipr_cmd->u.res = list_entry(ioa_cfg->used_res_q.next, in ipr_reset_mode_sense_failed()
6905 return ipr_reset_cmd_failed(ipr_cmd); in ipr_reset_mode_sense_failed()
6918 static int ipr_ioafp_mode_sense_page28(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_mode_sense_page28() argument
6920 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_mode_sense_page28()
6923 ipr_build_mode_sense(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), in ipr_ioafp_mode_sense_page28()
6928 ipr_cmd->job_step = ipr_ioafp_mode_select_page28; in ipr_ioafp_mode_sense_page28()
6929 ipr_cmd->job_step_failed = ipr_reset_mode_sense_failed; in ipr_ioafp_mode_sense_page28()
6931 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); in ipr_ioafp_mode_sense_page28()
6946 static int ipr_ioafp_mode_select_page24(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_mode_select_page24() argument
6948 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_mode_select_page24()
6963 ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11, in ipr_ioafp_mode_select_page24()
6967 ipr_cmd->job_step = ipr_ioafp_mode_sense_page28; in ipr_ioafp_mode_select_page24()
6968 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); in ipr_ioafp_mode_select_page24()
6984 static int ipr_reset_mode_sense_page24_failed(struct ipr_cmnd *ipr_cmd) in ipr_reset_mode_sense_page24_failed() argument
6986 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_reset_mode_sense_page24_failed()
6989 ipr_cmd->job_step = ipr_ioafp_mode_sense_page28; in ipr_reset_mode_sense_page24_failed()
6993 return ipr_reset_cmd_failed(ipr_cmd); in ipr_reset_mode_sense_page24_failed()
7006 static int ipr_ioafp_mode_sense_page24(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_mode_sense_page24() argument
7008 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_mode_sense_page24()
7011 ipr_build_mode_sense(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), in ipr_ioafp_mode_sense_page24()
7016 ipr_cmd->job_step = ipr_ioafp_mode_select_page24; in ipr_ioafp_mode_sense_page24()
7017 ipr_cmd->job_step_failed = ipr_reset_mode_sense_page24_failed; in ipr_ioafp_mode_sense_page24()
7019 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); in ipr_ioafp_mode_sense_page24()
7037 static int ipr_init_res_table(struct ipr_cmnd *ipr_cmd) in ipr_init_res_table() argument
7039 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_init_res_table()
7110 ipr_cmd->job_step = ipr_ioafp_mode_sense_page24; in ipr_init_res_table()
7112 ipr_cmd->job_step = ipr_ioafp_mode_sense_page28; in ipr_init_res_table()
7128 static int ipr_ioafp_query_ioa_cfg(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_query_ioa_cfg() argument
7130 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_query_ioa_cfg()
7131 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_ioafp_query_ioa_cfg()
7149 ipr_init_ioadl(ipr_cmd, ioa_cfg->cfg_table_dma, ioa_cfg->cfg_table_size, in ipr_ioafp_query_ioa_cfg()
7152 ipr_cmd->job_step = ipr_init_res_table; in ipr_ioafp_query_ioa_cfg()
7154 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); in ipr_ioafp_query_ioa_cfg()
7160 static int ipr_ioa_service_action_failed(struct ipr_cmnd *ipr_cmd) in ipr_ioa_service_action_failed() argument
7162 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_ioa_service_action_failed()
7167 return ipr_reset_cmd_failed(ipr_cmd); in ipr_ioa_service_action_failed()
7170 static void ipr_build_ioa_service_action(struct ipr_cmnd *ipr_cmd, in ipr_build_ioa_service_action() argument
7173 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_build_ioa_service_action()
7189 static int ipr_ioafp_set_caching_parameters(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_set_caching_parameters() argument
7191 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_ioafp_set_caching_parameters()
7192 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_set_caching_parameters()
7197 ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg; in ipr_ioafp_set_caching_parameters()
7200 ipr_build_ioa_service_action(ipr_cmd, in ipr_ioafp_set_caching_parameters()
7206 ipr_cmd->job_step_failed = ipr_ioa_service_action_failed; in ipr_ioafp_set_caching_parameters()
7207 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, in ipr_ioafp_set_caching_parameters()
7231 static void ipr_ioafp_inquiry(struct ipr_cmnd *ipr_cmd, u8 flags, u8 page, in ipr_ioafp_inquiry() argument
7234 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_ioafp_inquiry()
7245 ipr_init_ioadl(ipr_cmd, dma_addr, xfer_len, IPR_IOADL_FLAGS_READ_LAST); in ipr_ioafp_inquiry()
7247 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); in ipr_ioafp_inquiry()
7282 static int ipr_ioafp_pageC4_inquiry(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_pageC4_inquiry() argument
7284 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_pageC4_inquiry()
7289 ipr_cmd->job_step = ipr_ioafp_set_caching_parameters; in ipr_ioafp_pageC4_inquiry()
7293 ipr_ioafp_inquiry(ipr_cmd, 1, 0xC4, in ipr_ioafp_pageC4_inquiry()
7315 static int ipr_ioafp_cap_inquiry(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_cap_inquiry() argument
7317 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_cap_inquiry()
7322 ipr_cmd->job_step = ipr_ioafp_pageC4_inquiry; in ipr_ioafp_cap_inquiry()
7326 ipr_ioafp_inquiry(ipr_cmd, 1, 0xD0, in ipr_ioafp_cap_inquiry()
7346 static int ipr_ioafp_page3_inquiry(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_page3_inquiry() argument
7348 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_page3_inquiry()
7352 ipr_cmd->job_step = ipr_ioafp_cap_inquiry; in ipr_ioafp_page3_inquiry()
7354 ipr_ioafp_inquiry(ipr_cmd, 1, 3, in ipr_ioafp_page3_inquiry()
7372 static int ipr_ioafp_page0_inquiry(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_page0_inquiry() argument
7374 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_page0_inquiry()
7391 list_add_tail(&ipr_cmd->queue, in ipr_ioafp_page0_inquiry()
7397 ipr_cmd->job_step = ipr_ioafp_page3_inquiry; in ipr_ioafp_page0_inquiry()
7399 ipr_ioafp_inquiry(ipr_cmd, 1, 0, in ipr_ioafp_page0_inquiry()
7416 static int ipr_ioafp_std_inquiry(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_std_inquiry() argument
7418 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_std_inquiry()
7421 ipr_cmd->job_step = ipr_ioafp_page0_inquiry; in ipr_ioafp_std_inquiry()
7423 ipr_ioafp_inquiry(ipr_cmd, 0, 0, in ipr_ioafp_std_inquiry()
7441 static int ipr_ioafp_identify_hrrq(struct ipr_cmnd *ipr_cmd) in ipr_ioafp_identify_hrrq() argument
7443 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_ioafp_identify_hrrq()
7444 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; in ipr_ioafp_identify_hrrq()
7448 ipr_cmd->job_step = ipr_ioafp_std_inquiry; in ipr_ioafp_identify_hrrq()
7499 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, in ipr_ioafp_identify_hrrq()
7503 ipr_cmd->job_step = ipr_ioafp_identify_hrrq; in ipr_ioafp_identify_hrrq()
7528 struct ipr_cmnd *ipr_cmd = from_timer(ipr_cmd, t, timer); in ipr_reset_timer_done() local
7529 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_timer_done()
7534 if (ioa_cfg->reset_cmd == ipr_cmd) { in ipr_reset_timer_done()
7535 list_del(&ipr_cmd->queue); in ipr_reset_timer_done()
7536 ipr_cmd->done(ipr_cmd); in ipr_reset_timer_done()
7556 static void ipr_reset_start_timer(struct ipr_cmnd *ipr_cmd, in ipr_reset_start_timer() argument
7561 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); in ipr_reset_start_timer()
7562 ipr_cmd->done = ipr_reset_ioa_job; in ipr_reset_start_timer()
7564 ipr_cmd->timer.expires = jiffies + timeout; in ipr_reset_start_timer()
7565 ipr_cmd->timer.function = ipr_reset_timer_done; in ipr_reset_start_timer()
7566 add_timer(&ipr_cmd->timer); in ipr_reset_start_timer()
7610 static int ipr_reset_next_stage(struct ipr_cmnd *ipr_cmd) in ipr_reset_next_stage() argument
7615 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_next_stage()
7636 ipr_cmd->job_step = ipr_ioafp_identify_hrrq; in ipr_reset_next_stage()
7640 ipr_cmd->job_step = ipr_ioafp_identify_hrrq; in ipr_reset_next_stage()
7649 ipr_cmd->timer.expires = jiffies + stage_time * HZ; in ipr_reset_next_stage()
7650 ipr_cmd->timer.function = ipr_oper_timeout; in ipr_reset_next_stage()
7651 ipr_cmd->done = ipr_reset_ioa_job; in ipr_reset_next_stage()
7652 add_timer(&ipr_cmd->timer); in ipr_reset_next_stage()
7654 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); in ipr_reset_next_stage()
7669 static int ipr_reset_enable_ioa(struct ipr_cmnd *ipr_cmd) in ipr_reset_enable_ioa() argument
7671 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_enable_ioa()
7677 ipr_cmd->job_step = ipr_ioafp_identify_hrrq; in ipr_reset_enable_ioa()
7715 ipr_cmd->job_step = ipr_reset_next_stage; in ipr_reset_enable_ioa()
7719 ipr_cmd->timer.expires = jiffies + (ioa_cfg->transop_timeout * HZ); in ipr_reset_enable_ioa()
7720 ipr_cmd->timer.function = ipr_oper_timeout; in ipr_reset_enable_ioa()
7721 ipr_cmd->done = ipr_reset_ioa_job; in ipr_reset_enable_ioa()
7722 add_timer(&ipr_cmd->timer); in ipr_reset_enable_ioa()
7723 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); in ipr_reset_enable_ioa()
7739 static int ipr_reset_wait_for_dump(struct ipr_cmnd *ipr_cmd) in ipr_reset_wait_for_dump() argument
7741 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_wait_for_dump()
7749 ipr_cmd->job_step = ipr_reset_alert; in ipr_reset_wait_for_dump()
7845 static int ipr_reset_get_unit_check_job(struct ipr_cmnd *ipr_cmd) in ipr_reset_get_unit_check_job() argument
7847 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_get_unit_check_job()
7852 ipr_cmd->job_step = ipr_reset_alert; in ipr_reset_get_unit_check_job()
7853 ipr_reset_start_timer(ipr_cmd, 0); in ipr_reset_get_unit_check_job()
7859 static int ipr_dump_mailbox_wait(struct ipr_cmnd *ipr_cmd) in ipr_dump_mailbox_wait() argument
7861 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_dump_mailbox_wait()
7868 if (!ioa_cfg->sis64 || !ipr_cmd->u.time_left || in ipr_dump_mailbox_wait()
7872 if (!ipr_cmd->u.time_left) in ipr_dump_mailbox_wait()
7879 ipr_reset_start_timer(ipr_cmd, IPR_SIS64_DUMP_TIMEOUT); in ipr_dump_mailbox_wait()
7881 ipr_reset_start_timer(ipr_cmd, IPR_SIS32_DUMP_TIMEOUT); in ipr_dump_mailbox_wait()
7882 ipr_cmd->job_step = ipr_reset_wait_for_dump; in ipr_dump_mailbox_wait()
7886 ipr_cmd->u.time_left -= IPR_CHECK_FOR_RESET_TIMEOUT; in ipr_dump_mailbox_wait()
7887 ipr_reset_start_timer(ipr_cmd, in ipr_dump_mailbox_wait()
7906 static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd) in ipr_reset_restore_cfg_space() argument
7908 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_restore_cfg_space()
7915 ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR); in ipr_reset_restore_cfg_space()
7929 ipr_cmd->job_step = ipr_reset_get_unit_check_job; in ipr_reset_restore_cfg_space()
7930 ipr_reset_start_timer(ipr_cmd, IPR_DUMP_DELAY_TIMEOUT); in ipr_reset_restore_cfg_space()
7935 ipr_cmd->job_step = ipr_reset_alert; in ipr_reset_restore_cfg_space()
7936 ipr_reset_start_timer(ipr_cmd, 0); in ipr_reset_restore_cfg_space()
7942 ipr_cmd->job_step = ipr_ioa_bringdown_done; in ipr_reset_restore_cfg_space()
7944 ipr_cmd->job_step = ipr_dump_mailbox_wait; in ipr_reset_restore_cfg_space()
7945 ipr_cmd->u.time_left = IPR_WAIT_FOR_MAILBOX; in ipr_reset_restore_cfg_space()
7947 ipr_cmd->job_step = ipr_reset_enable_ioa; in ipr_reset_restore_cfg_space()
7963 static int ipr_reset_bist_done(struct ipr_cmnd *ipr_cmd) in ipr_reset_bist_done() argument
7965 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_bist_done()
7971 ipr_cmd->job_step = ipr_reset_restore_cfg_space; in ipr_reset_bist_done()
7985 static int ipr_reset_start_bist(struct ipr_cmnd *ipr_cmd) in ipr_reset_start_bist() argument
7987 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_start_bist()
7998 ipr_cmd->job_step = ipr_reset_bist_done; in ipr_reset_start_bist()
7999 ipr_reset_start_timer(ipr_cmd, IPR_WAIT_FOR_BIST_TIMEOUT); in ipr_reset_start_bist()
8003 pci_cfg_access_unlock(ipr_cmd->ioa_cfg->pdev); in ipr_reset_start_bist()
8005 ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR); in ipr_reset_start_bist()
8022 static int ipr_reset_slot_reset_done(struct ipr_cmnd *ipr_cmd) in ipr_reset_slot_reset_done() argument
8025 ipr_cmd->job_step = ipr_reset_bist_done; in ipr_reset_slot_reset_done()
8026 ipr_reset_start_timer(ipr_cmd, IPR_WAIT_FOR_BIST_TIMEOUT); in ipr_reset_slot_reset_done()
8040 struct ipr_cmnd *ipr_cmd = container_of(work, struct ipr_cmnd, work); in ipr_reset_reset_work() local
8041 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_reset_work()
8051 if (ioa_cfg->reset_cmd == ipr_cmd) in ipr_reset_reset_work()
8052 ipr_reset_ioa_job(ipr_cmd); in ipr_reset_reset_work()
8066 static int ipr_reset_slot_reset(struct ipr_cmnd *ipr_cmd) in ipr_reset_slot_reset() argument
8068 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_slot_reset()
8071 INIT_WORK(&ipr_cmd->work, ipr_reset_reset_work); in ipr_reset_slot_reset()
8072 queue_work(ioa_cfg->reset_work_q, &ipr_cmd->work); in ipr_reset_slot_reset()
8073 ipr_cmd->job_step = ipr_reset_slot_reset_done; in ipr_reset_slot_reset()
8087 static int ipr_reset_block_config_access_wait(struct ipr_cmnd *ipr_cmd) in ipr_reset_block_config_access_wait() argument
8089 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_block_config_access_wait()
8094 ipr_cmd->job_step = ioa_cfg->reset; in ipr_reset_block_config_access_wait()
8096 if (ipr_cmd->u.time_left) { in ipr_reset_block_config_access_wait()
8098 ipr_cmd->u.time_left -= IPR_CHECK_FOR_RESET_TIMEOUT; in ipr_reset_block_config_access_wait()
8099 ipr_reset_start_timer(ipr_cmd, in ipr_reset_block_config_access_wait()
8102 ipr_cmd->job_step = ioa_cfg->reset; in ipr_reset_block_config_access_wait()
8120 static int ipr_reset_block_config_access(struct ipr_cmnd *ipr_cmd) in ipr_reset_block_config_access() argument
8122 ipr_cmd->ioa_cfg->cfg_locked = 0; in ipr_reset_block_config_access()
8123 ipr_cmd->job_step = ipr_reset_block_config_access_wait; in ipr_reset_block_config_access()
8124 ipr_cmd->u.time_left = IPR_WAIT_FOR_RESET_TIMEOUT; in ipr_reset_block_config_access()
8158 static int ipr_reset_wait_to_start_bist(struct ipr_cmnd *ipr_cmd) in ipr_reset_wait_to_start_bist() argument
8160 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_wait_to_start_bist()
8163 if (!ipr_reset_allowed(ioa_cfg) && ipr_cmd->u.time_left) { in ipr_reset_wait_to_start_bist()
8164 ipr_cmd->u.time_left -= IPR_CHECK_FOR_RESET_TIMEOUT; in ipr_reset_wait_to_start_bist()
8165 ipr_reset_start_timer(ipr_cmd, IPR_CHECK_FOR_RESET_TIMEOUT); in ipr_reset_wait_to_start_bist()
8167 ipr_cmd->job_step = ipr_reset_block_config_access; in ipr_reset_wait_to_start_bist()
8186 static int ipr_reset_alert(struct ipr_cmnd *ipr_cmd) in ipr_reset_alert() argument
8188 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_alert()
8198 ipr_cmd->job_step = ipr_reset_wait_to_start_bist; in ipr_reset_alert()
8200 ipr_cmd->job_step = ipr_reset_block_config_access; in ipr_reset_alert()
8203 ipr_cmd->u.time_left = IPR_WAIT_FOR_RESET_TIMEOUT; in ipr_reset_alert()
8204 ipr_reset_start_timer(ipr_cmd, IPR_CHECK_FOR_RESET_TIMEOUT); in ipr_reset_alert()
8219 static int ipr_reset_quiesce_done(struct ipr_cmnd *ipr_cmd) in ipr_reset_quiesce_done() argument
8221 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_quiesce_done()
8224 ipr_cmd->job_step = ipr_ioa_bringdown_done; in ipr_reset_quiesce_done()
8240 static int ipr_reset_cancel_hcam_done(struct ipr_cmnd *ipr_cmd) in ipr_reset_cancel_hcam_done() argument
8242 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_cancel_hcam_done()
8249 ipr_cmd->job_step = ipr_reset_quiesce_done; in ipr_reset_cancel_hcam_done()
8256 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_reset_cancel_hcam_done()
8279 static int ipr_reset_cancel_hcam(struct ipr_cmnd *ipr_cmd) in ipr_reset_cancel_hcam() argument
8281 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_cancel_hcam()
8288 ipr_cmd->job_step = ipr_reset_cancel_hcam_done; in ipr_reset_cancel_hcam()
8296 ipr_cmd->ioarcb.res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE); in ipr_reset_cancel_hcam()
8297 ipr_cmd->ioarcb.cmd_pkt.request_type = IPR_RQTYPE_IOACMD; in ipr_reset_cancel_hcam()
8298 cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt; in ipr_reset_cancel_hcam()
8311 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, in ipr_reset_cancel_hcam()
8315 ipr_cmd->job_step = ipr_reset_cancel_hcam; in ipr_reset_cancel_hcam()
8320 ipr_cmd->job_step = ipr_reset_alert; in ipr_reset_cancel_hcam()
8335 static int ipr_reset_ucode_download_done(struct ipr_cmnd *ipr_cmd) in ipr_reset_ucode_download_done() argument
8337 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_ucode_download_done()
8343 ipr_cmd->job_step = ipr_reset_alert; in ipr_reset_ucode_download_done()
8357 static int ipr_reset_ucode_download(struct ipr_cmnd *ipr_cmd) in ipr_reset_ucode_download() argument
8359 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_ucode_download()
8363 ipr_cmd->job_step = ipr_reset_alert; in ipr_reset_ucode_download()
8368 ipr_cmd->ioarcb.res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE); in ipr_reset_ucode_download()
8369 ipr_cmd->ioarcb.cmd_pkt.request_type = IPR_RQTYPE_SCSICDB; in ipr_reset_ucode_download()
8370 ipr_cmd->ioarcb.cmd_pkt.cdb[0] = WRITE_BUFFER; in ipr_reset_ucode_download()
8371 ipr_cmd->ioarcb.cmd_pkt.cdb[1] = IPR_WR_BUF_DOWNLOAD_AND_SAVE; in ipr_reset_ucode_download()
8372 ipr_cmd->ioarcb.cmd_pkt.cdb[6] = (sglist->buffer_len & 0xff0000) >> 16; in ipr_reset_ucode_download()
8373 ipr_cmd->ioarcb.cmd_pkt.cdb[7] = (sglist->buffer_len & 0x00ff00) >> 8; in ipr_reset_ucode_download()
8374 ipr_cmd->ioarcb.cmd_pkt.cdb[8] = sglist->buffer_len & 0x0000ff; in ipr_reset_ucode_download()
8377 ipr_build_ucode_ioadl64(ipr_cmd, sglist); in ipr_reset_ucode_download()
8379 ipr_build_ucode_ioadl(ipr_cmd, sglist); in ipr_reset_ucode_download()
8380 ipr_cmd->job_step = ipr_reset_ucode_download_done; in ipr_reset_ucode_download()
8382 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, in ipr_reset_ucode_download()
8400 static int ipr_reset_shutdown_ioa(struct ipr_cmnd *ipr_cmd) in ipr_reset_shutdown_ioa() argument
8402 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_shutdown_ioa()
8403 enum ipr_shutdown_type shutdown_type = ipr_cmd->u.shutdown_type; in ipr_reset_shutdown_ioa()
8409 ipr_cmd->job_step = ipr_reset_cancel_hcam; in ipr_reset_shutdown_ioa()
8412 ipr_cmd->ioarcb.res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE); in ipr_reset_shutdown_ioa()
8413 ipr_cmd->ioarcb.cmd_pkt.request_type = IPR_RQTYPE_IOACMD; in ipr_reset_shutdown_ioa()
8414 ipr_cmd->ioarcb.cmd_pkt.cdb[0] = IPR_IOA_SHUTDOWN; in ipr_reset_shutdown_ioa()
8415 ipr_cmd->ioarcb.cmd_pkt.cdb[1] = shutdown_type; in ipr_reset_shutdown_ioa()
8426 ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, timeout); in ipr_reset_shutdown_ioa()
8429 ipr_cmd->job_step = ipr_reset_ucode_download; in ipr_reset_shutdown_ioa()
8431 ipr_cmd->job_step = ipr_reset_alert; in ipr_reset_shutdown_ioa()
8446 static void ipr_reset_ioa_job(struct ipr_cmnd *ipr_cmd) in ipr_reset_ioa_job() argument
8449 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_ioa_job()
8452 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); in ipr_reset_ioa_job()
8454 if (ioa_cfg->reset_cmd != ipr_cmd) { in ipr_reset_ioa_job()
8459 list_add_tail(&ipr_cmd->queue, in ipr_reset_ioa_job()
8460 &ipr_cmd->hrrq->hrrq_free_q); in ipr_reset_ioa_job()
8465 rc = ipr_cmd->job_step_failed(ipr_cmd); in ipr_reset_ioa_job()
8470 ipr_reinit_ipr_cmnd(ipr_cmd); in ipr_reset_ioa_job()
8471 ipr_cmd->job_step_failed = ipr_reset_cmd_failed; in ipr_reset_ioa_job()
8472 rc = ipr_cmd->job_step(ipr_cmd); in ipr_reset_ioa_job()
8494 struct ipr_cmnd *ipr_cmd; in _ipr_initiate_ioa_reset() local
8510 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg); in _ipr_initiate_ioa_reset()
8511 ioa_cfg->reset_cmd = ipr_cmd; in _ipr_initiate_ioa_reset()
8512 ipr_cmd->job_step = job_step; in _ipr_initiate_ioa_reset()
8513 ipr_cmd->u.shutdown_type = shutdown_type; in _ipr_initiate_ioa_reset()
8515 ipr_reset_ioa_job(ipr_cmd); in _ipr_initiate_ioa_reset()
8586 static int ipr_reset_freeze(struct ipr_cmnd *ipr_cmd) in ipr_reset_freeze() argument
8588 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; in ipr_reset_freeze()
8598 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q); in ipr_reset_freeze()
8599 ipr_cmd->done = ipr_reset_ioa_job; in ipr_reset_freeze()
8875 struct ipr_cmnd *ipr_cmd; in ipr_alloc_cmd_blks() local
8930 ipr_cmd = dma_pool_zalloc(ioa_cfg->ipr_cmd_pool, in ipr_alloc_cmd_blks()
8933 if (!ipr_cmd) { in ipr_alloc_cmd_blks()
8938 ioa_cfg->ipr_cmnd_list[i] = ipr_cmd; in ipr_alloc_cmd_blks()
8941 ioarcb = &ipr_cmd->ioarcb; in ipr_alloc_cmd_blks()
8942 ipr_cmd->dma_addr = dma_addr; in ipr_alloc_cmd_blks()
8962 ipr_cmd->cmd_index = i; in ipr_alloc_cmd_blks()
8963 ipr_cmd->ioa_cfg = ioa_cfg; in ipr_alloc_cmd_blks()
8964 ipr_cmd->sense_buffer_dma = dma_addr + in ipr_alloc_cmd_blks()
8967 ipr_cmd->ioarcb.cmd_pkt.hrrq_id = hrrq_id; in ipr_alloc_cmd_blks()
8968 ipr_cmd->hrrq = &ioa_cfg->hrrq[hrrq_id]; in ipr_alloc_cmd_blks()
8969 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_alloc_cmd_blks()
10032 static void ipr_halt_done(struct ipr_cmnd *ipr_cmd) in ipr_halt_done() argument
10034 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); in ipr_halt_done()
10048 struct ipr_cmnd *ipr_cmd; in ipr_halt() local
10065 ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg); in ipr_halt()
10066 ipr_cmd->ioarcb.res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE); in ipr_halt()
10067 ipr_cmd->ioarcb.cmd_pkt.request_type = IPR_RQTYPE_IOACMD; in ipr_halt()
10068 ipr_cmd->ioarcb.cmd_pkt.cdb[0] = IPR_IOA_SHUTDOWN; in ipr_halt()
10069 ipr_cmd->ioarcb.cmd_pkt.cdb[1] = IPR_SHUTDOWN_PREPARE_FOR_NORMAL; in ipr_halt()
10071 ipr_do_req(ipr_cmd, ipr_halt_done, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT); in ipr_halt()