Lines Matching refs:mrioc

14 mpi3mr_issue_reset(struct mpi3mr_ioc *mrioc, u16 reset_type, u32 reset_reason);
15 static int mpi3mr_setup_admin_qpair(struct mpi3mr_ioc *mrioc);
16 static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
18 static void mpi3mr_pel_wait_complete(struct mpi3mr_ioc *mrioc,
56 static void mpi3mr_sync_irqs(struct mpi3mr_ioc *mrioc) in mpi3mr_sync_irqs() argument
60 max_vectors = mrioc->intr_info_count; in mpi3mr_sync_irqs()
63 synchronize_irq(pci_irq_vector(mrioc->pdev, i)); in mpi3mr_sync_irqs()
66 void mpi3mr_ioc_disable_intr(struct mpi3mr_ioc *mrioc) in mpi3mr_ioc_disable_intr() argument
68 mrioc->intr_enabled = 0; in mpi3mr_ioc_disable_intr()
69 mpi3mr_sync_irqs(mrioc); in mpi3mr_ioc_disable_intr()
72 void mpi3mr_ioc_enable_intr(struct mpi3mr_ioc *mrioc) in mpi3mr_ioc_enable_intr() argument
74 mrioc->intr_enabled = 1; in mpi3mr_ioc_enable_intr()
77 static void mpi3mr_cleanup_isr(struct mpi3mr_ioc *mrioc) in mpi3mr_cleanup_isr() argument
81 mpi3mr_ioc_disable_intr(mrioc); in mpi3mr_cleanup_isr()
83 if (!mrioc->intr_info) in mpi3mr_cleanup_isr()
86 for (i = 0; i < mrioc->intr_info_count; i++) in mpi3mr_cleanup_isr()
87 free_irq(pci_irq_vector(mrioc->pdev, i), in mpi3mr_cleanup_isr()
88 (mrioc->intr_info + i)); in mpi3mr_cleanup_isr()
90 kfree(mrioc->intr_info); in mpi3mr_cleanup_isr()
91 mrioc->intr_info = NULL; in mpi3mr_cleanup_isr()
92 mrioc->intr_info_count = 0; in mpi3mr_cleanup_isr()
93 mrioc->is_intr_info_set = false; in mpi3mr_cleanup_isr()
94 pci_free_irq_vectors(mrioc->pdev); in mpi3mr_cleanup_isr()
114 void *mpi3mr_get_reply_virt_addr(struct mpi3mr_ioc *mrioc, in mpi3mr_get_reply_virt_addr() argument
120 if ((phys_addr < mrioc->reply_buf_dma) || in mpi3mr_get_reply_virt_addr()
121 (phys_addr > mrioc->reply_buf_dma_max_address)) in mpi3mr_get_reply_virt_addr()
124 return mrioc->reply_buf + (phys_addr - mrioc->reply_buf_dma); in mpi3mr_get_reply_virt_addr()
127 void *mpi3mr_get_sensebuf_virt_addr(struct mpi3mr_ioc *mrioc, in mpi3mr_get_sensebuf_virt_addr() argument
133 return mrioc->sense_buf + (phys_addr - mrioc->sense_buf_dma); in mpi3mr_get_sensebuf_virt_addr()
136 static void mpi3mr_repost_reply_buf(struct mpi3mr_ioc *mrioc, in mpi3mr_repost_reply_buf() argument
142 spin_lock_irqsave(&mrioc->reply_free_queue_lock, flags); in mpi3mr_repost_reply_buf()
143 old_idx = mrioc->reply_free_queue_host_index; in mpi3mr_repost_reply_buf()
144 mrioc->reply_free_queue_host_index = ( in mpi3mr_repost_reply_buf()
145 (mrioc->reply_free_queue_host_index == in mpi3mr_repost_reply_buf()
146 (mrioc->reply_free_qsz - 1)) ? 0 : in mpi3mr_repost_reply_buf()
147 (mrioc->reply_free_queue_host_index + 1)); in mpi3mr_repost_reply_buf()
148 mrioc->reply_free_q[old_idx] = cpu_to_le64(reply_dma); in mpi3mr_repost_reply_buf()
149 writel(mrioc->reply_free_queue_host_index, in mpi3mr_repost_reply_buf()
150 &mrioc->sysif_regs->reply_free_host_index); in mpi3mr_repost_reply_buf()
151 spin_unlock_irqrestore(&mrioc->reply_free_queue_lock, flags); in mpi3mr_repost_reply_buf()
154 void mpi3mr_repost_sense_buf(struct mpi3mr_ioc *mrioc, in mpi3mr_repost_sense_buf() argument
160 spin_lock_irqsave(&mrioc->sbq_lock, flags); in mpi3mr_repost_sense_buf()
161 old_idx = mrioc->sbq_host_index; in mpi3mr_repost_sense_buf()
162 mrioc->sbq_host_index = ((mrioc->sbq_host_index == in mpi3mr_repost_sense_buf()
163 (mrioc->sense_buf_q_sz - 1)) ? 0 : in mpi3mr_repost_sense_buf()
164 (mrioc->sbq_host_index + 1)); in mpi3mr_repost_sense_buf()
165 mrioc->sense_buf_q[old_idx] = cpu_to_le64(sense_buf_dma); in mpi3mr_repost_sense_buf()
166 writel(mrioc->sbq_host_index, in mpi3mr_repost_sense_buf()
167 &mrioc->sysif_regs->sense_buffer_free_host_index); in mpi3mr_repost_sense_buf()
168 spin_unlock_irqrestore(&mrioc->sbq_lock, flags); in mpi3mr_repost_sense_buf()
171 static void mpi3mr_print_event_data(struct mpi3mr_ioc *mrioc, in mpi3mr_print_event_data() argument
199 ioc_info(mrioc, "Device Added: dev=0x%04x Form=0x%x\n", in mpi3mr_print_event_data()
207 ioc_info(mrioc, "Device Info Changed: dev=0x%04x Form=0x%x\n", in mpi3mr_print_event_data()
215 ioc_info(mrioc, "Device status Change: dev=0x%04x RC=0x%x\n", in mpi3mr_print_event_data()
223 ioc_info(mrioc, "SAS Discovery: (%s) status (0x%08x)\n", in mpi3mr_print_event_data()
266 ioc_info(mrioc, "PCIE Enumeration: (%s)", in mpi3mr_print_event_data()
270 ioc_info(mrioc, "enumeration_status(0x%08x)\n", in mpi3mr_print_event_data()
282 ioc_info(mrioc, "%s\n", desc); in mpi3mr_print_event_data()
285 static void mpi3mr_handle_events(struct mpi3mr_ioc *mrioc, in mpi3mr_handle_events() argument
291 mrioc->change_count = le16_to_cpu(event_reply->ioc_change_count); in mpi3mr_handle_events()
292 mpi3mr_print_event_data(mrioc, event_reply); in mpi3mr_handle_events()
293 mpi3mr_os_handle_events(mrioc, event_reply); in mpi3mr_handle_events()
297 mpi3mr_get_drv_cmd(struct mpi3mr_ioc *mrioc, u16 host_tag, in mpi3mr_get_drv_cmd() argument
304 return &mrioc->init_cmds; in mpi3mr_get_drv_cmd()
306 return &mrioc->cfg_cmds; in mpi3mr_get_drv_cmd()
308 return &mrioc->bsg_cmds; in mpi3mr_get_drv_cmd()
310 return &mrioc->host_tm_cmds; in mpi3mr_get_drv_cmd()
312 return &mrioc->pel_abort_cmd; in mpi3mr_get_drv_cmd()
314 return &mrioc->pel_cmds; in mpi3mr_get_drv_cmd()
316 return &mrioc->transport_cmds; in mpi3mr_get_drv_cmd()
320 mpi3mr_handle_events(mrioc, def_reply); in mpi3mr_get_drv_cmd()
328 return &mrioc->dev_rmhs_cmds[idx]; in mpi3mr_get_drv_cmd()
334 return &mrioc->evtack_cmds[idx]; in mpi3mr_get_drv_cmd()
340 static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc, in mpi3mr_process_admin_reply_desc() argument
370 def_reply = mpi3mr_get_reply_virt_addr(mrioc, *reply_dma); in mpi3mr_process_admin_reply_desc()
381 sense_buf = mpi3mr_get_sensebuf_virt_addr(mrioc, in mpi3mr_process_admin_reply_desc()
393 cmdptr = mpi3mr_get_drv_cmd(mrioc, host_tag, def_reply); in mpi3mr_process_admin_reply_desc()
403 mrioc->reply_sz); in mpi3mr_process_admin_reply_desc()
414 cmdptr->callback(mrioc, cmdptr); in mpi3mr_process_admin_reply_desc()
419 mpi3mr_repost_sense_buf(mrioc, in mpi3mr_process_admin_reply_desc()
423 int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc) in mpi3mr_process_admin_reply_q() argument
425 u32 exp_phase = mrioc->admin_reply_ephase; in mpi3mr_process_admin_reply_q()
426 u32 admin_reply_ci = mrioc->admin_reply_ci; in mpi3mr_process_admin_reply_q()
431 if (!atomic_add_unless(&mrioc->admin_reply_q_in_use, 1, 1)) in mpi3mr_process_admin_reply_q()
434 reply_desc = (struct mpi3_default_reply_descriptor *)mrioc->admin_reply_base + in mpi3mr_process_admin_reply_q()
439 atomic_dec(&mrioc->admin_reply_q_in_use); in mpi3mr_process_admin_reply_q()
444 if (mrioc->unrecoverable) in mpi3mr_process_admin_reply_q()
447 mrioc->admin_req_ci = le16_to_cpu(reply_desc->request_queue_ci); in mpi3mr_process_admin_reply_q()
448 mpi3mr_process_admin_reply_desc(mrioc, reply_desc, &reply_dma); in mpi3mr_process_admin_reply_q()
450 mpi3mr_repost_reply_buf(mrioc, reply_dma); in mpi3mr_process_admin_reply_q()
452 if (++admin_reply_ci == mrioc->num_admin_replies) { in mpi3mr_process_admin_reply_q()
457 (struct mpi3_default_reply_descriptor *)mrioc->admin_reply_base + in mpi3mr_process_admin_reply_q()
464 writel(admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci); in mpi3mr_process_admin_reply_q()
465 mrioc->admin_reply_ci = admin_reply_ci; in mpi3mr_process_admin_reply_q()
466 mrioc->admin_reply_ephase = exp_phase; in mpi3mr_process_admin_reply_q()
467 atomic_dec(&mrioc->admin_reply_q_in_use); in mpi3mr_process_admin_reply_q()
506 int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc, in mpi3mr_process_op_reply_q() argument
533 if (mrioc->unrecoverable) in mpi3mr_process_op_reply_q()
537 op_req_q = &mrioc->req_qinfo[req_q_idx]; in mpi3mr_process_op_reply_q()
540 mpi3mr_process_op_reply_desc(mrioc, reply_desc, &reply_dma, in mpi3mr_process_op_reply_q()
544 mpi3mr_repost_reply_buf(mrioc, reply_dma); in mpi3mr_process_op_reply_q()
562 if (num_op_reply > mrioc->max_host_ios) { in mpi3mr_process_op_reply_q()
570 &mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index); in mpi3mr_process_op_reply_q()
593 struct mpi3mr_ioc *mrioc; in mpi3mr_blk_mq_poll() local
595 mrioc = (struct mpi3mr_ioc *)shost->hostdata; in mpi3mr_blk_mq_poll()
597 if ((mrioc->reset_in_progress || mrioc->prepare_for_reset || in mpi3mr_blk_mq_poll()
598 mrioc->unrecoverable)) in mpi3mr_blk_mq_poll()
601 num_entries = mpi3mr_process_op_reply_q(mrioc, in mpi3mr_blk_mq_poll()
602 &mrioc->op_reply_qinfo[queue_num]); in mpi3mr_blk_mq_poll()
610 struct mpi3mr_ioc *mrioc; in mpi3mr_isr_primary() local
617 mrioc = intr_info->mrioc; in mpi3mr_isr_primary()
619 if (!mrioc->intr_enabled) in mpi3mr_isr_primary()
625 num_admin_replies = mpi3mr_process_admin_reply_q(mrioc); in mpi3mr_isr_primary()
627 num_op_reply = mpi3mr_process_op_reply_q(mrioc, in mpi3mr_isr_primary()
678 struct mpi3mr_ioc *mrioc; in mpi3mr_isr_poll() local
685 mrioc = intr_info->mrioc; in mpi3mr_isr_poll()
690 if (!mrioc->intr_enabled || mrioc->unrecoverable) in mpi3mr_isr_poll()
694 mpi3mr_process_admin_reply_q(mrioc); in mpi3mr_isr_poll()
697 mpi3mr_process_op_reply_q(mrioc, in mpi3mr_isr_poll()
703 (num_op_reply < mrioc->max_host_ios)); in mpi3mr_isr_poll()
722 static inline int mpi3mr_request_irq(struct mpi3mr_ioc *mrioc, u16 index) in mpi3mr_request_irq() argument
724 struct pci_dev *pdev = mrioc->pdev; in mpi3mr_request_irq()
725 struct mpi3mr_intr_info *intr_info = mrioc->intr_info + index; in mpi3mr_request_irq()
728 intr_info->mrioc = mrioc; in mpi3mr_request_irq()
733 mrioc->driver_name, mrioc->id, index); in mpi3mr_request_irq()
743 ioc_err(mrioc, "%s: Unable to allocate interrupt %d!\n", in mpi3mr_request_irq()
752 static void mpi3mr_calc_poll_queues(struct mpi3mr_ioc *mrioc, u16 max_vectors) in mpi3mr_calc_poll_queues() argument
754 if (!mrioc->requested_poll_qcount) in mpi3mr_calc_poll_queues()
759 (mrioc->requested_poll_qcount < max_vectors - 2)) { in mpi3mr_calc_poll_queues()
760 ioc_info(mrioc, in mpi3mr_calc_poll_queues()
762 mrioc->requested_poll_qcount, max_vectors); in mpi3mr_calc_poll_queues()
764 ioc_info(mrioc, in mpi3mr_calc_poll_queues()
766 mrioc->requested_poll_qcount, max_vectors); in mpi3mr_calc_poll_queues()
767 mrioc->requested_poll_qcount = 0; in mpi3mr_calc_poll_queues()
780 static int mpi3mr_setup_isr(struct mpi3mr_ioc *mrioc, u8 setup_one) in mpi3mr_setup_isr() argument
788 if (mrioc->is_intr_info_set) in mpi3mr_setup_isr()
791 mpi3mr_cleanup_isr(mrioc); in mpi3mr_setup_isr()
795 retval = pci_alloc_irq_vectors(mrioc->pdev, in mpi3mr_setup_isr()
798 ioc_err(mrioc, "cannot allocate irq vectors, ret %d\n", in mpi3mr_setup_isr()
804 min_t(int, mrioc->cpu_count + 1 + in mpi3mr_setup_isr()
805 mrioc->requested_poll_qcount, mrioc->msix_count); in mpi3mr_setup_isr()
807 mpi3mr_calc_poll_queues(mrioc, max_vectors); in mpi3mr_setup_isr()
809 ioc_info(mrioc, in mpi3mr_setup_isr()
811 mrioc->msix_count, mrioc->cpu_count); in mpi3mr_setup_isr()
812 ioc_info(mrioc, in mpi3mr_setup_isr()
814 max_vectors, mrioc->requested_poll_qcount); in mpi3mr_setup_isr()
816 desc.post_vectors = mrioc->requested_poll_qcount; in mpi3mr_setup_isr()
820 retval = pci_alloc_irq_vectors_affinity(mrioc->pdev, in mpi3mr_setup_isr()
824 ioc_err(mrioc, "cannot allocate irq vectors, ret %d\n", in mpi3mr_setup_isr()
835 mrioc->op_reply_q_offset = 0; in mpi3mr_setup_isr()
837 ioc_info(mrioc, in mpi3mr_setup_isr()
843 mrioc->op_reply_q_offset = (max_vectors > 1) ? 1 : 0; in mpi3mr_setup_isr()
845 mpi3mr_calc_poll_queues(mrioc, max_vectors); in mpi3mr_setup_isr()
849 mrioc->intr_info = kzalloc(sizeof(struct mpi3mr_intr_info) * max_vectors, in mpi3mr_setup_isr()
851 if (!mrioc->intr_info) { in mpi3mr_setup_isr()
853 pci_free_irq_vectors(mrioc->pdev); in mpi3mr_setup_isr()
857 retval = mpi3mr_request_irq(mrioc, i); in mpi3mr_setup_isr()
859 mrioc->intr_info_count = i; in mpi3mr_setup_isr()
864 mrioc->is_intr_info_set = true; in mpi3mr_setup_isr()
865 mrioc->intr_info_count = max_vectors; in mpi3mr_setup_isr()
866 mpi3mr_ioc_enable_intr(mrioc); in mpi3mr_setup_isr()
870 mpi3mr_cleanup_isr(mrioc); in mpi3mr_setup_isr()
1008 void mpi3mr_print_fault_info(struct mpi3mr_ioc *mrioc) in mpi3mr_print_fault_info() argument
1012 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_print_fault_info()
1015 code = readl(&mrioc->sysif_regs->fault); in mpi3mr_print_fault_info()
1016 code1 = readl(&mrioc->sysif_regs->fault_info[0]); in mpi3mr_print_fault_info()
1017 code2 = readl(&mrioc->sysif_regs->fault_info[1]); in mpi3mr_print_fault_info()
1018 code3 = readl(&mrioc->sysif_regs->fault_info[2]); in mpi3mr_print_fault_info()
1020 ioc_info(mrioc, in mpi3mr_print_fault_info()
1035 enum mpi3mr_iocstate mpi3mr_get_iocstate(struct mpi3mr_ioc *mrioc) in mpi3mr_get_iocstate() argument
1040 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_get_iocstate()
1041 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_get_iocstate()
1043 if (mrioc->unrecoverable) in mpi3mr_get_iocstate()
1070 static inline void mpi3mr_clear_reset_history(struct mpi3mr_ioc *mrioc) in mpi3mr_clear_reset_history() argument
1074 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_clear_reset_history()
1076 writel(ioc_status, &mrioc->sysif_regs->ioc_status); in mpi3mr_clear_reset_history()
1089 static int mpi3mr_issue_and_process_mur(struct mpi3mr_ioc *mrioc, in mpi3mr_issue_and_process_mur() argument
1095 ioc_info(mrioc, "Issuing Message unit Reset(MUR)\n"); in mpi3mr_issue_and_process_mur()
1096 if (mrioc->unrecoverable) { in mpi3mr_issue_and_process_mur()
1097 ioc_info(mrioc, "IOC is unrecoverable MUR not issued\n"); in mpi3mr_issue_and_process_mur()
1100 mpi3mr_clear_reset_history(mrioc); in mpi3mr_issue_and_process_mur()
1101 writel(reset_reason, &mrioc->sysif_regs->scratchpad[0]); in mpi3mr_issue_and_process_mur()
1102 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_issue_and_process_mur()
1104 writel(ioc_config, &mrioc->sysif_regs->ioc_configuration); in mpi3mr_issue_and_process_mur()
1108 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_issue_and_process_mur()
1110 mpi3mr_clear_reset_history(mrioc); in mpi3mr_issue_and_process_mur()
1114 mpi3mr_print_fault_info(mrioc); in mpi3mr_issue_and_process_mur()
1120 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_issue_and_process_mur()
1126 ioc_info(mrioc, "Base IOC Sts/Config after %s MUR is (0x%x)/(0x%x)\n", in mpi3mr_issue_and_process_mur()
1140 mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc) in mpi3mr_revalidate_factsdata() argument
1144 if (mrioc->facts.reply_sz > mrioc->reply_sz) { in mpi3mr_revalidate_factsdata()
1145 ioc_err(mrioc, in mpi3mr_revalidate_factsdata()
1147 mrioc->reply_sz, mrioc->facts.reply_sz); in mpi3mr_revalidate_factsdata()
1151 if (mrioc->facts.max_op_reply_q < mrioc->num_op_reply_q) { in mpi3mr_revalidate_factsdata()
1152 ioc_err(mrioc, in mpi3mr_revalidate_factsdata()
1154 mrioc->num_op_reply_q, in mpi3mr_revalidate_factsdata()
1155 mrioc->facts.max_op_reply_q); in mpi3mr_revalidate_factsdata()
1159 if (mrioc->facts.max_op_req_q < mrioc->num_op_req_q) { in mpi3mr_revalidate_factsdata()
1160 ioc_err(mrioc, in mpi3mr_revalidate_factsdata()
1162 mrioc->num_op_req_q, mrioc->facts.max_op_req_q); in mpi3mr_revalidate_factsdata()
1166 if (mrioc->shost->max_sectors != (mrioc->facts.max_data_length / 512)) in mpi3mr_revalidate_factsdata()
1167 ioc_err(mrioc, "Warning: The maximum data transfer length\n" in mpi3mr_revalidate_factsdata()
1170 mrioc->shost->max_sectors * 512, mrioc->facts.max_data_length); in mpi3mr_revalidate_factsdata()
1172 if ((mrioc->sas_transport_enabled) && (mrioc->facts.ioc_capabilities & in mpi3mr_revalidate_factsdata()
1174 ioc_err(mrioc, in mpi3mr_revalidate_factsdata()
1179 if (mrioc->facts.max_devhandle > mrioc->dev_handle_bitmap_bits) { in mpi3mr_revalidate_factsdata()
1180 removepend_bitmap = bitmap_zalloc(mrioc->facts.max_devhandle, in mpi3mr_revalidate_factsdata()
1183 ioc_err(mrioc, in mpi3mr_revalidate_factsdata()
1185 mrioc->dev_handle_bitmap_bits, in mpi3mr_revalidate_factsdata()
1186 mrioc->facts.max_devhandle); in mpi3mr_revalidate_factsdata()
1189 bitmap_free(mrioc->removepend_bitmap); in mpi3mr_revalidate_factsdata()
1190 mrioc->removepend_bitmap = removepend_bitmap; in mpi3mr_revalidate_factsdata()
1191 ioc_info(mrioc, in mpi3mr_revalidate_factsdata()
1193 mrioc->dev_handle_bitmap_bits, in mpi3mr_revalidate_factsdata()
1194 mrioc->facts.max_devhandle); in mpi3mr_revalidate_factsdata()
1195 mrioc->dev_handle_bitmap_bits = mrioc->facts.max_devhandle; in mpi3mr_revalidate_factsdata()
1210 static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc) in mpi3mr_bring_ioc_ready() argument
1217 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_bring_ioc_ready()
1218 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_bring_ioc_ready()
1219 base_info = lo_hi_readq(&mrioc->sysif_regs->ioc_information); in mpi3mr_bring_ioc_ready()
1220 ioc_info(mrioc, "ioc_status(0x%08x), ioc_config(0x%08x), ioc_info(0x%016llx) at the bringup\n", in mpi3mr_bring_ioc_ready()
1224 mrioc->ready_timeout = in mpi3mr_bring_ioc_ready()
1228 ioc_info(mrioc, "ready timeout: %d seconds\n", mrioc->ready_timeout); in mpi3mr_bring_ioc_ready()
1230 ioc_state = mpi3mr_get_iocstate(mrioc); in mpi3mr_bring_ioc_ready()
1231 ioc_info(mrioc, "controller is in %s state during detection\n", in mpi3mr_bring_ioc_ready()
1236 timeout = mrioc->ready_timeout * 10; in mpi3mr_bring_ioc_ready()
1241 if (!pci_device_is_present(mrioc->pdev)) { in mpi3mr_bring_ioc_ready()
1242 mrioc->unrecoverable = 1; in mpi3mr_bring_ioc_ready()
1243 ioc_err(mrioc, in mpi3mr_bring_ioc_ready()
1249 ioc_state = mpi3mr_get_iocstate(mrioc); in mpi3mr_bring_ioc_ready()
1250 ioc_info(mrioc, in mpi3mr_bring_ioc_ready()
1256 ioc_info(mrioc, "issuing message unit reset (MUR) to bring to reset state\n"); in mpi3mr_bring_ioc_ready()
1257 retval = mpi3mr_issue_and_process_mur(mrioc, in mpi3mr_bring_ioc_ready()
1259 ioc_state = mpi3mr_get_iocstate(mrioc); in mpi3mr_bring_ioc_ready()
1261 ioc_err(mrioc, in mpi3mr_bring_ioc_ready()
1268 mpi3mr_print_fault_info(mrioc); in mpi3mr_bring_ioc_ready()
1271 readl(&mrioc->sysif_regs->host_diagnostic); in mpi3mr_bring_ioc_ready()
1275 if (!pci_device_is_present(mrioc->pdev)) { in mpi3mr_bring_ioc_ready()
1276 mrioc->unrecoverable = 1; in mpi3mr_bring_ioc_ready()
1277 ioc_err(mrioc, "controller is not present at the bringup\n"); in mpi3mr_bring_ioc_ready()
1283 mpi3mr_print_fault_info(mrioc); in mpi3mr_bring_ioc_ready()
1284 ioc_info(mrioc, "issuing soft reset to bring to reset state\n"); in mpi3mr_bring_ioc_ready()
1285 retval = mpi3mr_issue_reset(mrioc, in mpi3mr_bring_ioc_ready()
1289 ioc_err(mrioc, in mpi3mr_bring_ioc_ready()
1294 ioc_state = mpi3mr_get_iocstate(mrioc); in mpi3mr_bring_ioc_ready()
1296 ioc_err(mrioc, in mpi3mr_bring_ioc_ready()
1301 mpi3mr_clear_reset_history(mrioc); in mpi3mr_bring_ioc_ready()
1302 retval = mpi3mr_setup_admin_qpair(mrioc); in mpi3mr_bring_ioc_ready()
1304 ioc_err(mrioc, "failed to setup admin queues: error %d\n", in mpi3mr_bring_ioc_ready()
1309 ioc_info(mrioc, "bringing controller to ready state\n"); in mpi3mr_bring_ioc_ready()
1310 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_bring_ioc_ready()
1312 writel(ioc_config, &mrioc->sysif_regs->ioc_configuration); in mpi3mr_bring_ioc_ready()
1314 timeout = mrioc->ready_timeout * 10; in mpi3mr_bring_ioc_ready()
1316 ioc_state = mpi3mr_get_iocstate(mrioc); in mpi3mr_bring_ioc_ready()
1318 ioc_info(mrioc, in mpi3mr_bring_ioc_ready()
1323 if (!pci_device_is_present(mrioc->pdev)) { in mpi3mr_bring_ioc_ready()
1324 mrioc->unrecoverable = 1; in mpi3mr_bring_ioc_ready()
1325 ioc_err(mrioc, in mpi3mr_bring_ioc_ready()
1334 ioc_state = mpi3mr_get_iocstate(mrioc); in mpi3mr_bring_ioc_ready()
1335 ioc_err(mrioc, in mpi3mr_bring_ioc_ready()
1370 static inline bool mpi3mr_diagfault_success(struct mpi3mr_ioc *mrioc, in mpi3mr_diagfault_success() argument
1377 fault = readl(&mrioc->sysif_regs->fault) & MPI3_SYSIF_FAULT_CODE_MASK; in mpi3mr_diagfault_success()
1379 mpi3mr_print_fault_info(mrioc); in mpi3mr_diagfault_success()
1394 static inline void mpi3mr_set_diagsave(struct mpi3mr_ioc *mrioc) in mpi3mr_set_diagsave() argument
1398 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_set_diagsave()
1400 writel(ioc_config, &mrioc->sysif_regs->ioc_configuration); in mpi3mr_set_diagsave()
1416 static int mpi3mr_issue_reset(struct mpi3mr_ioc *mrioc, u16 reset_type, in mpi3mr_issue_reset() argument
1427 if (mrioc->unrecoverable) in mpi3mr_issue_reset()
1434 ioc_info(mrioc, "%s reset due to %s(0x%x)\n", in mpi3mr_issue_reset()
1438 mpi3mr_clear_reset_history(mrioc); in mpi3mr_issue_reset()
1440 ioc_info(mrioc, in mpi3mr_issue_reset()
1444 ioc_err(mrioc, in mpi3mr_issue_reset()
1448 mrioc->unrecoverable = 1; in mpi3mr_issue_reset()
1453 &mrioc->sysif_regs->write_sequence); in mpi3mr_issue_reset()
1455 &mrioc->sysif_regs->write_sequence); in mpi3mr_issue_reset()
1457 &mrioc->sysif_regs->write_sequence); in mpi3mr_issue_reset()
1459 &mrioc->sysif_regs->write_sequence); in mpi3mr_issue_reset()
1461 &mrioc->sysif_regs->write_sequence); in mpi3mr_issue_reset()
1463 &mrioc->sysif_regs->write_sequence); in mpi3mr_issue_reset()
1465 &mrioc->sysif_regs->write_sequence); in mpi3mr_issue_reset()
1467 host_diagnostic = readl(&mrioc->sysif_regs->host_diagnostic); in mpi3mr_issue_reset()
1468 ioc_info(mrioc, in mpi3mr_issue_reset()
1473 writel(reset_reason, &mrioc->sysif_regs->scratchpad[0]); in mpi3mr_issue_reset()
1475 &mrioc->sysif_regs->host_diagnostic); in mpi3mr_issue_reset()
1479 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_issue_reset()
1481 readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_issue_reset()
1485 mpi3mr_clear_reset_history(mrioc); in mpi3mr_issue_reset()
1491 mpi3mr_print_fault_info(mrioc); in mpi3mr_issue_reset()
1495 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_issue_reset()
1496 if (mpi3mr_diagfault_success(mrioc, ioc_status)) { in mpi3mr_issue_reset()
1508 &mrioc->sysif_regs->write_sequence); in mpi3mr_issue_reset()
1510 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_issue_reset()
1511 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_issue_reset()
1512 ioc_info(mrioc, in mpi3mr_issue_reset()
1517 mrioc->unrecoverable = 1; in mpi3mr_issue_reset()
1534 int mpi3mr_admin_request_post(struct mpi3mr_ioc *mrioc, void *admin_req, in mpi3mr_admin_request_post() argument
1542 if (mrioc->unrecoverable) { in mpi3mr_admin_request_post()
1543 ioc_err(mrioc, "%s : Unrecoverable controller\n", __func__); in mpi3mr_admin_request_post()
1547 spin_lock_irqsave(&mrioc->admin_req_lock, flags); in mpi3mr_admin_request_post()
1548 areq_pi = mrioc->admin_req_pi; in mpi3mr_admin_request_post()
1549 areq_ci = mrioc->admin_req_ci; in mpi3mr_admin_request_post()
1550 max_entries = mrioc->num_admin_req; in mpi3mr_admin_request_post()
1553 ioc_err(mrioc, "AdminReqQ full condition detected\n"); in mpi3mr_admin_request_post()
1557 if (!ignore_reset && mrioc->reset_in_progress) { in mpi3mr_admin_request_post()
1558 ioc_err(mrioc, "AdminReqQ submit reset in progress\n"); in mpi3mr_admin_request_post()
1562 areq_entry = (u8 *)mrioc->admin_req_base + in mpi3mr_admin_request_post()
1569 mrioc->admin_req_pi = areq_pi; in mpi3mr_admin_request_post()
1571 writel(mrioc->admin_req_pi, &mrioc->sysif_regs->admin_request_queue_pi); in mpi3mr_admin_request_post()
1574 spin_unlock_irqrestore(&mrioc->admin_req_lock, flags); in mpi3mr_admin_request_post()
1588 static void mpi3mr_free_op_req_q_segments(struct mpi3mr_ioc *mrioc, u16 q_idx) in mpi3mr_free_op_req_q_segments() argument
1594 segments = mrioc->req_qinfo[q_idx].q_segments; in mpi3mr_free_op_req_q_segments()
1598 if (mrioc->enable_segqueue) { in mpi3mr_free_op_req_q_segments()
1600 if (mrioc->req_qinfo[q_idx].q_segment_list) { in mpi3mr_free_op_req_q_segments()
1601 dma_free_coherent(&mrioc->pdev->dev, in mpi3mr_free_op_req_q_segments()
1603 mrioc->req_qinfo[q_idx].q_segment_list, in mpi3mr_free_op_req_q_segments()
1604 mrioc->req_qinfo[q_idx].q_segment_list_dma); in mpi3mr_free_op_req_q_segments()
1605 mrioc->req_qinfo[q_idx].q_segment_list = NULL; in mpi3mr_free_op_req_q_segments()
1608 size = mrioc->req_qinfo[q_idx].segment_qd * in mpi3mr_free_op_req_q_segments()
1609 mrioc->facts.op_req_sz; in mpi3mr_free_op_req_q_segments()
1611 for (j = 0; j < mrioc->req_qinfo[q_idx].num_segments; j++) { in mpi3mr_free_op_req_q_segments()
1614 dma_free_coherent(&mrioc->pdev->dev, in mpi3mr_free_op_req_q_segments()
1618 kfree(mrioc->req_qinfo[q_idx].q_segments); in mpi3mr_free_op_req_q_segments()
1619 mrioc->req_qinfo[q_idx].q_segments = NULL; in mpi3mr_free_op_req_q_segments()
1620 mrioc->req_qinfo[q_idx].qid = 0; in mpi3mr_free_op_req_q_segments()
1632 static void mpi3mr_free_op_reply_q_segments(struct mpi3mr_ioc *mrioc, u16 q_idx) in mpi3mr_free_op_reply_q_segments() argument
1638 segments = mrioc->op_reply_qinfo[q_idx].q_segments; in mpi3mr_free_op_reply_q_segments()
1642 if (mrioc->enable_segqueue) { in mpi3mr_free_op_reply_q_segments()
1644 if (mrioc->op_reply_qinfo[q_idx].q_segment_list) { in mpi3mr_free_op_reply_q_segments()
1645 dma_free_coherent(&mrioc->pdev->dev, in mpi3mr_free_op_reply_q_segments()
1647 mrioc->op_reply_qinfo[q_idx].q_segment_list, in mpi3mr_free_op_reply_q_segments()
1648 mrioc->op_reply_qinfo[q_idx].q_segment_list_dma); in mpi3mr_free_op_reply_q_segments()
1649 mrioc->op_reply_qinfo[q_idx].q_segment_list = NULL; in mpi3mr_free_op_reply_q_segments()
1652 size = mrioc->op_reply_qinfo[q_idx].segment_qd * in mpi3mr_free_op_reply_q_segments()
1653 mrioc->op_reply_desc_sz; in mpi3mr_free_op_reply_q_segments()
1655 for (j = 0; j < mrioc->op_reply_qinfo[q_idx].num_segments; j++) { in mpi3mr_free_op_reply_q_segments()
1658 dma_free_coherent(&mrioc->pdev->dev, in mpi3mr_free_op_reply_q_segments()
1663 kfree(mrioc->op_reply_qinfo[q_idx].q_segments); in mpi3mr_free_op_reply_q_segments()
1664 mrioc->op_reply_qinfo[q_idx].q_segments = NULL; in mpi3mr_free_op_reply_q_segments()
1665 mrioc->op_reply_qinfo[q_idx].qid = 0; in mpi3mr_free_op_reply_q_segments()
1678 static int mpi3mr_delete_op_reply_q(struct mpi3mr_ioc *mrioc, u16 qidx) in mpi3mr_delete_op_reply_q() argument
1681 struct op_reply_qinfo *op_reply_q = mrioc->op_reply_qinfo + qidx; in mpi3mr_delete_op_reply_q()
1687 midx = REPLY_QUEUE_IDX_TO_MSIX_IDX(qidx, mrioc->op_reply_q_offset); in mpi3mr_delete_op_reply_q()
1691 ioc_err(mrioc, "Issue DelRepQ: called with invalid ReqQID\n"); in mpi3mr_delete_op_reply_q()
1695 (op_reply_q->qtype == MPI3MR_DEFAULT_QUEUE) ? mrioc->default_qcount-- : in mpi3mr_delete_op_reply_q()
1696 mrioc->active_poll_qcount--; in mpi3mr_delete_op_reply_q()
1699 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_delete_op_reply_q()
1700 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_delete_op_reply_q()
1702 ioc_err(mrioc, "Issue DelRepQ: Init command is in use\n"); in mpi3mr_delete_op_reply_q()
1703 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_delete_op_reply_q()
1706 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_delete_op_reply_q()
1707 mrioc->init_cmds.is_waiting = 1; in mpi3mr_delete_op_reply_q()
1708 mrioc->init_cmds.callback = NULL; in mpi3mr_delete_op_reply_q()
1713 init_completion(&mrioc->init_cmds.done); in mpi3mr_delete_op_reply_q()
1714 retval = mpi3mr_admin_request_post(mrioc, &delq_req, sizeof(delq_req), in mpi3mr_delete_op_reply_q()
1717 ioc_err(mrioc, "Issue DelRepQ: Admin Post failed\n"); in mpi3mr_delete_op_reply_q()
1720 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_delete_op_reply_q()
1722 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_delete_op_reply_q()
1723 ioc_err(mrioc, "delete reply queue timed out\n"); in mpi3mr_delete_op_reply_q()
1724 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_delete_op_reply_q()
1729 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_delete_op_reply_q()
1731 ioc_err(mrioc, in mpi3mr_delete_op_reply_q()
1733 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK), in mpi3mr_delete_op_reply_q()
1734 mrioc->init_cmds.ioc_loginfo); in mpi3mr_delete_op_reply_q()
1738 mrioc->intr_info[midx].op_reply_q = NULL; in mpi3mr_delete_op_reply_q()
1740 mpi3mr_free_op_reply_q_segments(mrioc, qidx); in mpi3mr_delete_op_reply_q()
1742 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_delete_op_reply_q()
1743 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_delete_op_reply_q()
1759 static int mpi3mr_alloc_op_reply_q_segments(struct mpi3mr_ioc *mrioc, u16 qidx) in mpi3mr_alloc_op_reply_q_segments() argument
1761 struct op_reply_qinfo *op_reply_q = mrioc->op_reply_qinfo + qidx; in mpi3mr_alloc_op_reply_q_segments()
1766 if (mrioc->enable_segqueue) { in mpi3mr_alloc_op_reply_q_segments()
1768 MPI3MR_OP_REP_Q_SEG_SIZE / mrioc->op_reply_desc_sz; in mpi3mr_alloc_op_reply_q_segments()
1772 op_reply_q->q_segment_list = dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_alloc_op_reply_q_segments()
1780 size = op_reply_q->num_replies * mrioc->op_reply_desc_sz; in mpi3mr_alloc_op_reply_q_segments()
1794 dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_alloc_op_reply_q_segments()
1798 if (mrioc->enable_segqueue) in mpi3mr_alloc_op_reply_q_segments()
1816 static int mpi3mr_alloc_op_req_q_segments(struct mpi3mr_ioc *mrioc, u16 qidx) in mpi3mr_alloc_op_req_q_segments() argument
1818 struct op_req_qinfo *op_req_q = mrioc->req_qinfo + qidx; in mpi3mr_alloc_op_req_q_segments()
1823 if (mrioc->enable_segqueue) { in mpi3mr_alloc_op_req_q_segments()
1825 MPI3MR_OP_REQ_Q_SEG_SIZE / mrioc->facts.op_req_sz; in mpi3mr_alloc_op_req_q_segments()
1829 op_req_q->q_segment_list = dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_alloc_op_req_q_segments()
1838 size = op_req_q->num_requests * mrioc->facts.op_req_sz; in mpi3mr_alloc_op_req_q_segments()
1852 dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_alloc_op_req_q_segments()
1856 if (mrioc->enable_segqueue) in mpi3mr_alloc_op_req_q_segments()
1874 static int mpi3mr_create_op_reply_q(struct mpi3mr_ioc *mrioc, u16 qidx) in mpi3mr_create_op_reply_q() argument
1877 struct op_reply_qinfo *op_reply_q = mrioc->op_reply_qinfo + qidx; in mpi3mr_create_op_reply_q()
1883 midx = REPLY_QUEUE_IDX_TO_MSIX_IDX(qidx, mrioc->op_reply_q_offset); in mpi3mr_create_op_reply_q()
1887 ioc_err(mrioc, "CreateRepQ: called for duplicate qid %d\n", in mpi3mr_create_op_reply_q()
1895 if (!mrioc->pdev->revision) in mpi3mr_create_op_reply_q()
1904 retval = mpi3mr_alloc_op_reply_q_segments(mrioc, qidx); in mpi3mr_create_op_reply_q()
1906 mpi3mr_free_op_reply_q_segments(mrioc, qidx); in mpi3mr_create_op_reply_q()
1912 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_create_op_reply_q()
1913 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_create_op_reply_q()
1915 ioc_err(mrioc, "CreateRepQ: Init command is in use\n"); in mpi3mr_create_op_reply_q()
1918 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_create_op_reply_q()
1919 mrioc->init_cmds.is_waiting = 1; in mpi3mr_create_op_reply_q()
1920 mrioc->init_cmds.callback = NULL; in mpi3mr_create_op_reply_q()
1925 if (midx < (mrioc->intr_info_count - mrioc->requested_poll_qcount)) in mpi3mr_create_op_reply_q()
1934 cpu_to_le16(mrioc->intr_info[midx].msix_index); in mpi3mr_create_op_reply_q()
1936 create_req.msix_index = cpu_to_le16(mrioc->intr_info_count - 1); in mpi3mr_create_op_reply_q()
1937 ioc_info(mrioc, "create reply queue(polled): for qid(%d), midx(%d)\n", in mpi3mr_create_op_reply_q()
1939 if (!mrioc->active_poll_qcount) in mpi3mr_create_op_reply_q()
1940 disable_irq_nosync(pci_irq_vector(mrioc->pdev, in mpi3mr_create_op_reply_q()
1941 mrioc->intr_info_count - 1)); in mpi3mr_create_op_reply_q()
1944 if (mrioc->enable_segqueue) { in mpi3mr_create_op_reply_q()
1955 init_completion(&mrioc->init_cmds.done); in mpi3mr_create_op_reply_q()
1956 retval = mpi3mr_admin_request_post(mrioc, &create_req, in mpi3mr_create_op_reply_q()
1959 ioc_err(mrioc, "CreateRepQ: Admin Post failed\n"); in mpi3mr_create_op_reply_q()
1962 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_create_op_reply_q()
1964 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_create_op_reply_q()
1965 ioc_err(mrioc, "create reply queue timed out\n"); in mpi3mr_create_op_reply_q()
1966 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_create_op_reply_q()
1971 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_create_op_reply_q()
1973 ioc_err(mrioc, in mpi3mr_create_op_reply_q()
1975 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK), in mpi3mr_create_op_reply_q()
1976 mrioc->init_cmds.ioc_loginfo); in mpi3mr_create_op_reply_q()
1981 if (midx < mrioc->intr_info_count) in mpi3mr_create_op_reply_q()
1982 mrioc->intr_info[midx].op_reply_q = op_reply_q; in mpi3mr_create_op_reply_q()
1984 (op_reply_q->qtype == MPI3MR_DEFAULT_QUEUE) ? mrioc->default_qcount++ : in mpi3mr_create_op_reply_q()
1985 mrioc->active_poll_qcount++; in mpi3mr_create_op_reply_q()
1988 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_create_op_reply_q()
1989 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_create_op_reply_q()
2006 static int mpi3mr_create_op_req_q(struct mpi3mr_ioc *mrioc, u16 idx, in mpi3mr_create_op_req_q() argument
2010 struct op_req_qinfo *op_req_q = mrioc->req_qinfo + idx; in mpi3mr_create_op_req_q()
2018 ioc_err(mrioc, "CreateReqQ: called for duplicate qid %d\n", in mpi3mr_create_op_req_q()
2032 retval = mpi3mr_alloc_op_req_q_segments(mrioc, idx); in mpi3mr_create_op_req_q()
2034 mpi3mr_free_op_req_q_segments(mrioc, idx); in mpi3mr_create_op_req_q()
2040 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_create_op_req_q()
2041 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_create_op_req_q()
2043 ioc_err(mrioc, "CreateReqQ: Init command is in use\n"); in mpi3mr_create_op_req_q()
2046 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_create_op_req_q()
2047 mrioc->init_cmds.is_waiting = 1; in mpi3mr_create_op_req_q()
2048 mrioc->init_cmds.callback = NULL; in mpi3mr_create_op_req_q()
2052 if (mrioc->enable_segqueue) { in mpi3mr_create_op_req_q()
2063 init_completion(&mrioc->init_cmds.done); in mpi3mr_create_op_req_q()
2064 retval = mpi3mr_admin_request_post(mrioc, &create_req, in mpi3mr_create_op_req_q()
2067 ioc_err(mrioc, "CreateReqQ: Admin Post failed\n"); in mpi3mr_create_op_req_q()
2070 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_create_op_req_q()
2072 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_create_op_req_q()
2073 ioc_err(mrioc, "create request queue timed out\n"); in mpi3mr_create_op_req_q()
2074 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_create_op_req_q()
2079 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_create_op_req_q()
2081 ioc_err(mrioc, in mpi3mr_create_op_req_q()
2083 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK), in mpi3mr_create_op_req_q()
2084 mrioc->init_cmds.ioc_loginfo); in mpi3mr_create_op_req_q()
2091 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_create_op_req_q()
2092 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_create_op_req_q()
2107 static int mpi3mr_create_op_queues(struct mpi3mr_ioc *mrioc) in mpi3mr_create_op_queues() argument
2112 num_queues = min_t(int, mrioc->facts.max_op_reply_q, in mpi3mr_create_op_queues()
2113 mrioc->facts.max_op_req_q); in mpi3mr_create_op_queues()
2116 mrioc->intr_info_count - mrioc->op_reply_q_offset; in mpi3mr_create_op_queues()
2117 if (!mrioc->num_queues) in mpi3mr_create_op_queues()
2118 mrioc->num_queues = min_t(int, num_queues, msix_count_op_q); in mpi3mr_create_op_queues()
2123 num_queues = mrioc->num_op_reply_q ? in mpi3mr_create_op_queues()
2124 mrioc->num_op_reply_q : mrioc->num_queues; in mpi3mr_create_op_queues()
2125 ioc_info(mrioc, "trying to create %d operational queue pairs\n", in mpi3mr_create_op_queues()
2128 if (!mrioc->req_qinfo) { in mpi3mr_create_op_queues()
2129 mrioc->req_qinfo = kcalloc(num_queues, in mpi3mr_create_op_queues()
2131 if (!mrioc->req_qinfo) { in mpi3mr_create_op_queues()
2136 mrioc->op_reply_qinfo = kzalloc(sizeof(struct op_reply_qinfo) * in mpi3mr_create_op_queues()
2138 if (!mrioc->op_reply_qinfo) { in mpi3mr_create_op_queues()
2144 if (mrioc->enable_segqueue) in mpi3mr_create_op_queues()
2145 ioc_info(mrioc, in mpi3mr_create_op_queues()
2149 if (mpi3mr_create_op_reply_q(mrioc, i)) { in mpi3mr_create_op_queues()
2150 ioc_err(mrioc, "Cannot create OP RepQ %d\n", i); in mpi3mr_create_op_queues()
2153 if (mpi3mr_create_op_req_q(mrioc, i, in mpi3mr_create_op_queues()
2154 mrioc->op_reply_qinfo[i].qid)) { in mpi3mr_create_op_queues()
2155 ioc_err(mrioc, "Cannot create OP ReqQ %d\n", i); in mpi3mr_create_op_queues()
2156 mpi3mr_delete_op_reply_q(mrioc, i); in mpi3mr_create_op_queues()
2166 mrioc->num_op_reply_q = mrioc->num_op_req_q = i; in mpi3mr_create_op_queues()
2167 ioc_info(mrioc, in mpi3mr_create_op_queues()
2169 mrioc->num_op_reply_q, mrioc->default_qcount, in mpi3mr_create_op_queues()
2170 mrioc->active_poll_qcount); in mpi3mr_create_op_queues()
2174 kfree(mrioc->req_qinfo); in mpi3mr_create_op_queues()
2175 mrioc->req_qinfo = NULL; in mpi3mr_create_op_queues()
2177 kfree(mrioc->op_reply_qinfo); in mpi3mr_create_op_queues()
2178 mrioc->op_reply_qinfo = NULL; in mpi3mr_create_op_queues()
2195 int mpi3mr_op_request_post(struct mpi3mr_ioc *mrioc, in mpi3mr_op_request_post() argument
2203 u16 req_sz = mrioc->facts.op_req_sz; in mpi3mr_op_request_post()
2208 if (mrioc->unrecoverable) in mpi3mr_op_request_post()
2217 reply_qidx, mrioc->op_reply_q_offset); in mpi3mr_op_request_post()
2218 mpi3mr_process_op_reply_q(mrioc, mrioc->intr_info[midx].op_reply_q); in mpi3mr_op_request_post()
2226 if (mrioc->reset_in_progress) { in mpi3mr_op_request_post()
2227 ioc_err(mrioc, "OpReqQ submit reset in progress\n"); in mpi3mr_op_request_post()
2244 if (atomic_inc_return(&mrioc->op_reply_qinfo[reply_qidx].pend_ios) in mpi3mr_op_request_post()
2246 mrioc->op_reply_qinfo[reply_qidx].enable_irq_poll = true; in mpi3mr_op_request_post()
2248 atomic_inc_return(&mrioc->op_reply_qinfo[reply_qidx].pend_ios); in mpi3mr_op_request_post()
2252 &mrioc->sysif_regs->oper_queue_indexes[reply_qidx].producer_index); in mpi3mr_op_request_post()
2273 void mpi3mr_check_rh_fault_ioc(struct mpi3mr_ioc *mrioc, u32 reason_code) in mpi3mr_check_rh_fault_ioc() argument
2277 if (mrioc->unrecoverable) { in mpi3mr_check_rh_fault_ioc()
2278 ioc_err(mrioc, "controller is unrecoverable\n"); in mpi3mr_check_rh_fault_ioc()
2282 if (!pci_device_is_present(mrioc->pdev)) { in mpi3mr_check_rh_fault_ioc()
2283 mrioc->unrecoverable = 1; in mpi3mr_check_rh_fault_ioc()
2284 ioc_err(mrioc, "controller is not present\n"); in mpi3mr_check_rh_fault_ioc()
2288 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_check_rh_fault_ioc()
2291 mpi3mr_print_fault_info(mrioc); in mpi3mr_check_rh_fault_ioc()
2294 mpi3mr_set_diagsave(mrioc); in mpi3mr_check_rh_fault_ioc()
2295 mpi3mr_issue_reset(mrioc, MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT, in mpi3mr_check_rh_fault_ioc()
2299 host_diagnostic = readl(&mrioc->sysif_regs->host_diagnostic); in mpi3mr_check_rh_fault_ioc()
2315 static int mpi3mr_sync_timestamp(struct mpi3mr_ioc *mrioc) in mpi3mr_sync_timestamp() argument
2322 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_sync_timestamp()
2323 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_sync_timestamp()
2325 ioc_err(mrioc, "Issue IOUCTL time_stamp: command is in use\n"); in mpi3mr_sync_timestamp()
2326 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_sync_timestamp()
2329 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_sync_timestamp()
2330 mrioc->init_cmds.is_waiting = 1; in mpi3mr_sync_timestamp()
2331 mrioc->init_cmds.callback = NULL; in mpi3mr_sync_timestamp()
2338 init_completion(&mrioc->init_cmds.done); in mpi3mr_sync_timestamp()
2339 retval = mpi3mr_admin_request_post(mrioc, &iou_ctrl, in mpi3mr_sync_timestamp()
2342 ioc_err(mrioc, "Issue IOUCTL time_stamp: Admin Post failed\n"); in mpi3mr_sync_timestamp()
2346 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_sync_timestamp()
2348 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_sync_timestamp()
2349 ioc_err(mrioc, "Issue IOUCTL time_stamp: command timed out\n"); in mpi3mr_sync_timestamp()
2350 mrioc->init_cmds.is_waiting = 0; in mpi3mr_sync_timestamp()
2351 if (!(mrioc->init_cmds.state & MPI3MR_CMD_RESET)) in mpi3mr_sync_timestamp()
2352 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_sync_timestamp()
2357 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_sync_timestamp()
2359 ioc_err(mrioc, in mpi3mr_sync_timestamp()
2361 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK), in mpi3mr_sync_timestamp()
2362 mrioc->init_cmds.ioc_loginfo); in mpi3mr_sync_timestamp()
2368 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_sync_timestamp()
2369 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_sync_timestamp()
2384 static int mpi3mr_print_pkg_ver(struct mpi3mr_ioc *mrioc) in mpi3mr_print_pkg_ver() argument
2394 data = dma_alloc_coherent(&mrioc->pdev->dev, data_len, &data_dma, in mpi3mr_print_pkg_ver()
2400 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_print_pkg_ver()
2401 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_print_pkg_ver()
2402 ioc_err(mrioc, "sending get package version failed due to command in use\n"); in mpi3mr_print_pkg_ver()
2403 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_print_pkg_ver()
2406 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_print_pkg_ver()
2407 mrioc->init_cmds.is_waiting = 1; in mpi3mr_print_pkg_ver()
2408 mrioc->init_cmds.callback = NULL; in mpi3mr_print_pkg_ver()
2418 init_completion(&mrioc->init_cmds.done); in mpi3mr_print_pkg_ver()
2419 retval = mpi3mr_admin_request_post(mrioc, &ci_upload, in mpi3mr_print_pkg_ver()
2422 ioc_err(mrioc, "posting get package version failed\n"); in mpi3mr_print_pkg_ver()
2425 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_print_pkg_ver()
2427 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_print_pkg_ver()
2428 ioc_err(mrioc, "get package version timed out\n"); in mpi3mr_print_pkg_ver()
2429 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_print_pkg_ver()
2434 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_print_pkg_ver()
2438 ioc_info(mrioc, in mpi3mr_print_pkg_ver()
2450 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_print_pkg_ver()
2451 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_print_pkg_ver()
2455 dma_free_coherent(&mrioc->pdev->dev, data_len, data, in mpi3mr_print_pkg_ver()
2472 struct mpi3mr_ioc *mrioc = in mpi3mr_watchdog_work() local
2479 if (mrioc->reset_in_progress) in mpi3mr_watchdog_work()
2482 if (!mrioc->unrecoverable && !pci_device_is_present(mrioc->pdev)) { in mpi3mr_watchdog_work()
2483 ioc_err(mrioc, "watchdog could not detect the controller\n"); in mpi3mr_watchdog_work()
2484 mrioc->unrecoverable = 1; in mpi3mr_watchdog_work()
2487 if (mrioc->unrecoverable) { in mpi3mr_watchdog_work()
2488 ioc_err(mrioc, in mpi3mr_watchdog_work()
2490 mpi3mr_flush_cmds_for_unrecovered_controller(mrioc); in mpi3mr_watchdog_work()
2494 if (mrioc->ts_update_counter++ >= MPI3MR_TSUPDATE_INTERVAL) { in mpi3mr_watchdog_work()
2495 mrioc->ts_update_counter = 0; in mpi3mr_watchdog_work()
2496 mpi3mr_sync_timestamp(mrioc); in mpi3mr_watchdog_work()
2499 if ((mrioc->prepare_for_reset) && in mpi3mr_watchdog_work()
2500 ((mrioc->prepare_for_reset_timeout_counter++) >= in mpi3mr_watchdog_work()
2502 mpi3mr_soft_reset_handler(mrioc, in mpi3mr_watchdog_work()
2507 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_watchdog_work()
2509 mpi3mr_soft_reset_handler(mrioc, MPI3MR_RESET_FROM_FIRMWARE, 0); in mpi3mr_watchdog_work()
2514 ioc_state = mpi3mr_get_iocstate(mrioc); in mpi3mr_watchdog_work()
2518 fault = readl(&mrioc->sysif_regs->fault) & MPI3_SYSIF_FAULT_CODE_MASK; in mpi3mr_watchdog_work()
2519 host_diagnostic = readl(&mrioc->sysif_regs->host_diagnostic); in mpi3mr_watchdog_work()
2521 if (!mrioc->diagsave_timeout) { in mpi3mr_watchdog_work()
2522 mpi3mr_print_fault_info(mrioc); in mpi3mr_watchdog_work()
2523 ioc_warn(mrioc, "diag save in progress\n"); in mpi3mr_watchdog_work()
2525 if ((mrioc->diagsave_timeout++) <= MPI3_SYSIF_DIAG_SAVE_TIMEOUT) in mpi3mr_watchdog_work()
2529 mpi3mr_print_fault_info(mrioc); in mpi3mr_watchdog_work()
2530 mrioc->diagsave_timeout = 0; in mpi3mr_watchdog_work()
2535 ioc_warn(mrioc, in mpi3mr_watchdog_work()
2537 mrioc->unrecoverable = 1; in mpi3mr_watchdog_work()
2547 mpi3mr_soft_reset_handler(mrioc, reset_reason, 0); in mpi3mr_watchdog_work()
2551 spin_lock_irqsave(&mrioc->watchdog_lock, flags); in mpi3mr_watchdog_work()
2552 if (mrioc->watchdog_work_q) in mpi3mr_watchdog_work()
2553 queue_delayed_work(mrioc->watchdog_work_q, in mpi3mr_watchdog_work()
2554 &mrioc->watchdog_work, in mpi3mr_watchdog_work()
2556 spin_unlock_irqrestore(&mrioc->watchdog_lock, flags); in mpi3mr_watchdog_work()
2569 void mpi3mr_start_watchdog(struct mpi3mr_ioc *mrioc) in mpi3mr_start_watchdog() argument
2571 if (mrioc->watchdog_work_q) in mpi3mr_start_watchdog()
2574 INIT_DELAYED_WORK(&mrioc->watchdog_work, mpi3mr_watchdog_work); in mpi3mr_start_watchdog()
2575 snprintf(mrioc->watchdog_work_q_name, in mpi3mr_start_watchdog()
2576 sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name, in mpi3mr_start_watchdog()
2577 mrioc->id); in mpi3mr_start_watchdog()
2578 mrioc->watchdog_work_q = in mpi3mr_start_watchdog()
2579 create_singlethread_workqueue(mrioc->watchdog_work_q_name); in mpi3mr_start_watchdog()
2580 if (!mrioc->watchdog_work_q) { in mpi3mr_start_watchdog()
2581 ioc_err(mrioc, "%s: failed (line=%d)\n", __func__, __LINE__); in mpi3mr_start_watchdog()
2585 if (mrioc->watchdog_work_q) in mpi3mr_start_watchdog()
2586 queue_delayed_work(mrioc->watchdog_work_q, in mpi3mr_start_watchdog()
2587 &mrioc->watchdog_work, in mpi3mr_start_watchdog()
2600 void mpi3mr_stop_watchdog(struct mpi3mr_ioc *mrioc) in mpi3mr_stop_watchdog() argument
2605 spin_lock_irqsave(&mrioc->watchdog_lock, flags); in mpi3mr_stop_watchdog()
2606 wq = mrioc->watchdog_work_q; in mpi3mr_stop_watchdog()
2607 mrioc->watchdog_work_q = NULL; in mpi3mr_stop_watchdog()
2608 spin_unlock_irqrestore(&mrioc->watchdog_lock, flags); in mpi3mr_stop_watchdog()
2610 if (!cancel_delayed_work_sync(&mrioc->watchdog_work)) in mpi3mr_stop_watchdog()
2625 static int mpi3mr_setup_admin_qpair(struct mpi3mr_ioc *mrioc) in mpi3mr_setup_admin_qpair() argument
2630 mrioc->admin_req_q_sz = MPI3MR_ADMIN_REQ_Q_SIZE; in mpi3mr_setup_admin_qpair()
2631 mrioc->num_admin_req = mrioc->admin_req_q_sz / in mpi3mr_setup_admin_qpair()
2633 mrioc->admin_req_ci = mrioc->admin_req_pi = 0; in mpi3mr_setup_admin_qpair()
2635 mrioc->admin_reply_q_sz = MPI3MR_ADMIN_REPLY_Q_SIZE; in mpi3mr_setup_admin_qpair()
2636 mrioc->num_admin_replies = mrioc->admin_reply_q_sz / in mpi3mr_setup_admin_qpair()
2638 mrioc->admin_reply_ci = 0; in mpi3mr_setup_admin_qpair()
2639 mrioc->admin_reply_ephase = 1; in mpi3mr_setup_admin_qpair()
2640 atomic_set(&mrioc->admin_reply_q_in_use, 0); in mpi3mr_setup_admin_qpair()
2642 if (!mrioc->admin_req_base) { in mpi3mr_setup_admin_qpair()
2643 mrioc->admin_req_base = dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_setup_admin_qpair()
2644 mrioc->admin_req_q_sz, &mrioc->admin_req_dma, GFP_KERNEL); in mpi3mr_setup_admin_qpair()
2646 if (!mrioc->admin_req_base) { in mpi3mr_setup_admin_qpair()
2651 mrioc->admin_reply_base = dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_setup_admin_qpair()
2652 mrioc->admin_reply_q_sz, &mrioc->admin_reply_dma, in mpi3mr_setup_admin_qpair()
2655 if (!mrioc->admin_reply_base) { in mpi3mr_setup_admin_qpair()
2661 num_admin_entries = (mrioc->num_admin_replies << 16) | in mpi3mr_setup_admin_qpair()
2662 (mrioc->num_admin_req); in mpi3mr_setup_admin_qpair()
2663 writel(num_admin_entries, &mrioc->sysif_regs->admin_queue_num_entries); in mpi3mr_setup_admin_qpair()
2664 mpi3mr_writeq(mrioc->admin_req_dma, in mpi3mr_setup_admin_qpair()
2665 &mrioc->sysif_regs->admin_request_queue_address); in mpi3mr_setup_admin_qpair()
2666 mpi3mr_writeq(mrioc->admin_reply_dma, in mpi3mr_setup_admin_qpair()
2667 &mrioc->sysif_regs->admin_reply_queue_address); in mpi3mr_setup_admin_qpair()
2668 writel(mrioc->admin_req_pi, &mrioc->sysif_regs->admin_request_queue_pi); in mpi3mr_setup_admin_qpair()
2669 writel(mrioc->admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci); in mpi3mr_setup_admin_qpair()
2674 if (mrioc->admin_reply_base) { in mpi3mr_setup_admin_qpair()
2675 dma_free_coherent(&mrioc->pdev->dev, mrioc->admin_reply_q_sz, in mpi3mr_setup_admin_qpair()
2676 mrioc->admin_reply_base, mrioc->admin_reply_dma); in mpi3mr_setup_admin_qpair()
2677 mrioc->admin_reply_base = NULL; in mpi3mr_setup_admin_qpair()
2679 if (mrioc->admin_req_base) { in mpi3mr_setup_admin_qpair()
2680 dma_free_coherent(&mrioc->pdev->dev, mrioc->admin_req_q_sz, in mpi3mr_setup_admin_qpair()
2681 mrioc->admin_req_base, mrioc->admin_req_dma); in mpi3mr_setup_admin_qpair()
2682 mrioc->admin_req_base = NULL; in mpi3mr_setup_admin_qpair()
2697 static int mpi3mr_issue_iocfacts(struct mpi3mr_ioc *mrioc, in mpi3mr_issue_iocfacts() argument
2707 data = dma_alloc_coherent(&mrioc->pdev->dev, data_len, &data_dma, in mpi3mr_issue_iocfacts()
2716 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_issue_iocfacts()
2717 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_issue_iocfacts()
2719 ioc_err(mrioc, "Issue IOCFacts: Init command is in use\n"); in mpi3mr_issue_iocfacts()
2720 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_iocfacts()
2723 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_issue_iocfacts()
2724 mrioc->init_cmds.is_waiting = 1; in mpi3mr_issue_iocfacts()
2725 mrioc->init_cmds.callback = NULL; in mpi3mr_issue_iocfacts()
2732 init_completion(&mrioc->init_cmds.done); in mpi3mr_issue_iocfacts()
2733 retval = mpi3mr_admin_request_post(mrioc, &iocfacts_req, in mpi3mr_issue_iocfacts()
2736 ioc_err(mrioc, "Issue IOCFacts: Admin Post failed\n"); in mpi3mr_issue_iocfacts()
2739 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_issue_iocfacts()
2741 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_issue_iocfacts()
2742 ioc_err(mrioc, "ioc_facts timed out\n"); in mpi3mr_issue_iocfacts()
2743 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_issue_iocfacts()
2748 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_issue_iocfacts()
2750 ioc_err(mrioc, in mpi3mr_issue_iocfacts()
2752 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK), in mpi3mr_issue_iocfacts()
2753 mrioc->init_cmds.ioc_loginfo); in mpi3mr_issue_iocfacts()
2758 mpi3mr_process_factsdata(mrioc, facts_data); in mpi3mr_issue_iocfacts()
2760 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_issue_iocfacts()
2761 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_iocfacts()
2765 dma_free_coherent(&mrioc->pdev->dev, data_len, data, data_dma); in mpi3mr_issue_iocfacts()
2779 static inline int mpi3mr_check_reset_dma_mask(struct mpi3mr_ioc *mrioc) in mpi3mr_check_reset_dma_mask() argument
2781 struct pci_dev *pdev = mrioc->pdev; in mpi3mr_check_reset_dma_mask()
2783 u64 facts_dma_mask = DMA_BIT_MASK(mrioc->facts.dma_mask); in mpi3mr_check_reset_dma_mask()
2785 if (!mrioc->facts.dma_mask || (mrioc->dma_mask <= facts_dma_mask)) in mpi3mr_check_reset_dma_mask()
2788 ioc_info(mrioc, "Changing DMA mask from 0x%016llx to 0x%016llx\n", in mpi3mr_check_reset_dma_mask()
2789 mrioc->dma_mask, facts_dma_mask); in mpi3mr_check_reset_dma_mask()
2793 ioc_err(mrioc, "Setting DMA mask to 0x%016llx failed: %d\n", in mpi3mr_check_reset_dma_mask()
2797 mrioc->dma_mask = facts_dma_mask; in mpi3mr_check_reset_dma_mask()
2811 static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc, in mpi3mr_process_factsdata() argument
2818 ioc_warn(mrioc, in mpi3mr_process_factsdata()
2824 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_process_factsdata()
2828 ioc_err(mrioc, in mpi3mr_process_factsdata()
2833 memset(&mrioc->facts, 0, sizeof(mrioc->facts)); in mpi3mr_process_factsdata()
2836 mrioc->facts.op_req_sz = req_sz; in mpi3mr_process_factsdata()
2837 mrioc->op_reply_desc_sz = 1 << ((ioc_config & in mpi3mr_process_factsdata()
2841 mrioc->facts.ioc_num = facts_data->ioc_number; in mpi3mr_process_factsdata()
2842 mrioc->facts.who_init = facts_data->who_init; in mpi3mr_process_factsdata()
2843 mrioc->facts.max_msix_vectors = le16_to_cpu(facts_data->max_msix_vectors); in mpi3mr_process_factsdata()
2844 mrioc->facts.personality = (facts_flags & in mpi3mr_process_factsdata()
2846 mrioc->facts.dma_mask = (facts_flags & in mpi3mr_process_factsdata()
2849 mrioc->facts.protocol_flags = facts_data->protocol_flags; in mpi3mr_process_factsdata()
2850 mrioc->facts.mpi_version = le32_to_cpu(facts_data->mpi_version.word); in mpi3mr_process_factsdata()
2851 mrioc->facts.max_reqs = le16_to_cpu(facts_data->max_outstanding_requests); in mpi3mr_process_factsdata()
2852 mrioc->facts.product_id = le16_to_cpu(facts_data->product_id); in mpi3mr_process_factsdata()
2853 mrioc->facts.reply_sz = le16_to_cpu(facts_data->reply_frame_size) * 4; in mpi3mr_process_factsdata()
2854 mrioc->facts.exceptions = le16_to_cpu(facts_data->ioc_exceptions); in mpi3mr_process_factsdata()
2855 mrioc->facts.max_perids = le16_to_cpu(facts_data->max_persistent_id); in mpi3mr_process_factsdata()
2856 mrioc->facts.max_vds = le16_to_cpu(facts_data->max_vds); in mpi3mr_process_factsdata()
2857 mrioc->facts.max_hpds = le16_to_cpu(facts_data->max_host_pds); in mpi3mr_process_factsdata()
2858 mrioc->facts.max_advhpds = le16_to_cpu(facts_data->max_adv_host_pds); in mpi3mr_process_factsdata()
2859 mrioc->facts.max_raid_pds = le16_to_cpu(facts_data->max_raid_pds); in mpi3mr_process_factsdata()
2860 mrioc->facts.max_nvme = le16_to_cpu(facts_data->max_nvme); in mpi3mr_process_factsdata()
2861 mrioc->facts.max_pcie_switches = in mpi3mr_process_factsdata()
2863 mrioc->facts.max_sasexpanders = in mpi3mr_process_factsdata()
2865 mrioc->facts.max_data_length = le16_to_cpu(facts_data->max_data_length); in mpi3mr_process_factsdata()
2866 mrioc->facts.max_sasinitiators = in mpi3mr_process_factsdata()
2868 mrioc->facts.max_enclosures = le16_to_cpu(facts_data->max_enclosures); in mpi3mr_process_factsdata()
2869 mrioc->facts.min_devhandle = le16_to_cpu(facts_data->min_dev_handle); in mpi3mr_process_factsdata()
2870 mrioc->facts.max_devhandle = le16_to_cpu(facts_data->max_dev_handle); in mpi3mr_process_factsdata()
2871 mrioc->facts.max_op_req_q = in mpi3mr_process_factsdata()
2873 mrioc->facts.max_op_reply_q = in mpi3mr_process_factsdata()
2875 mrioc->facts.ioc_capabilities = in mpi3mr_process_factsdata()
2877 mrioc->facts.fw_ver.build_num = in mpi3mr_process_factsdata()
2879 mrioc->facts.fw_ver.cust_id = in mpi3mr_process_factsdata()
2881 mrioc->facts.fw_ver.ph_minor = facts_data->fw_version.phase_minor; in mpi3mr_process_factsdata()
2882 mrioc->facts.fw_ver.ph_major = facts_data->fw_version.phase_major; in mpi3mr_process_factsdata()
2883 mrioc->facts.fw_ver.gen_minor = facts_data->fw_version.gen_minor; in mpi3mr_process_factsdata()
2884 mrioc->facts.fw_ver.gen_major = facts_data->fw_version.gen_major; in mpi3mr_process_factsdata()
2885 mrioc->msix_count = min_t(int, mrioc->msix_count, in mpi3mr_process_factsdata()
2886 mrioc->facts.max_msix_vectors); in mpi3mr_process_factsdata()
2887 mrioc->facts.sge_mod_mask = facts_data->sge_modifier_mask; in mpi3mr_process_factsdata()
2888 mrioc->facts.sge_mod_value = facts_data->sge_modifier_value; in mpi3mr_process_factsdata()
2889 mrioc->facts.sge_mod_shift = facts_data->sge_modifier_shift; in mpi3mr_process_factsdata()
2890 mrioc->facts.shutdown_timeout = in mpi3mr_process_factsdata()
2893 mrioc->facts.max_dev_per_tg = in mpi3mr_process_factsdata()
2895 mrioc->facts.io_throttle_data_length = in mpi3mr_process_factsdata()
2897 mrioc->facts.max_io_throttle_group = in mpi3mr_process_factsdata()
2899 mrioc->facts.io_throttle_low = le16_to_cpu(facts_data->io_throttle_low); in mpi3mr_process_factsdata()
2900 mrioc->facts.io_throttle_high = in mpi3mr_process_factsdata()
2903 if (mrioc->facts.max_data_length == in mpi3mr_process_factsdata()
2905 mrioc->facts.max_data_length = MPI3MR_DEFAULT_MAX_IO_SIZE; in mpi3mr_process_factsdata()
2907 mrioc->facts.max_data_length *= MPI3MR_PAGE_SIZE_4K; in mpi3mr_process_factsdata()
2909 if (mrioc->facts.io_throttle_data_length) in mpi3mr_process_factsdata()
2910 mrioc->io_throttle_data_length = in mpi3mr_process_factsdata()
2911 (mrioc->facts.io_throttle_data_length * 2 * 4); in mpi3mr_process_factsdata()
2914 mrioc->io_throttle_data_length = (mrioc->facts.max_data_length / 512) + 2; in mpi3mr_process_factsdata()
2916 mrioc->io_throttle_high = (mrioc->facts.io_throttle_high * 2 * 1024); in mpi3mr_process_factsdata()
2917 mrioc->io_throttle_low = (mrioc->facts.io_throttle_low * 2 * 1024); in mpi3mr_process_factsdata()
2919 ioc_info(mrioc, "ioc_num(%d), maxopQ(%d), maxopRepQ(%d), maxdh(%d),", in mpi3mr_process_factsdata()
2920 mrioc->facts.ioc_num, mrioc->facts.max_op_req_q, in mpi3mr_process_factsdata()
2921 mrioc->facts.max_op_reply_q, mrioc->facts.max_devhandle); in mpi3mr_process_factsdata()
2922 ioc_info(mrioc, in mpi3mr_process_factsdata()
2924 mrioc->facts.max_reqs, mrioc->facts.min_devhandle, in mpi3mr_process_factsdata()
2925 mrioc->facts.max_msix_vectors, mrioc->facts.max_perids); in mpi3mr_process_factsdata()
2926 ioc_info(mrioc, "SGEModMask 0x%x SGEModVal 0x%x SGEModShift 0x%x ", in mpi3mr_process_factsdata()
2927 mrioc->facts.sge_mod_mask, mrioc->facts.sge_mod_value, in mpi3mr_process_factsdata()
2928 mrioc->facts.sge_mod_shift); in mpi3mr_process_factsdata()
2929 ioc_info(mrioc, "DMA mask %d InitialPE status 0x%x max_data_len (%d)\n", in mpi3mr_process_factsdata()
2930 mrioc->facts.dma_mask, (facts_flags & in mpi3mr_process_factsdata()
2931 MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK), mrioc->facts.max_data_length); in mpi3mr_process_factsdata()
2932 ioc_info(mrioc, in mpi3mr_process_factsdata()
2934 mrioc->facts.max_dev_per_tg, mrioc->facts.max_io_throttle_group); in mpi3mr_process_factsdata()
2935 ioc_info(mrioc, in mpi3mr_process_factsdata()
2937 mrioc->facts.io_throttle_data_length * 4, in mpi3mr_process_factsdata()
2938 mrioc->facts.io_throttle_high, mrioc->facts.io_throttle_low); in mpi3mr_process_factsdata()
2950 static int mpi3mr_alloc_reply_sense_bufs(struct mpi3mr_ioc *mrioc) in mpi3mr_alloc_reply_sense_bufs() argument
2955 if (mrioc->init_cmds.reply) in mpi3mr_alloc_reply_sense_bufs()
2958 mrioc->init_cmds.reply = kzalloc(mrioc->reply_sz, GFP_KERNEL); in mpi3mr_alloc_reply_sense_bufs()
2959 if (!mrioc->init_cmds.reply) in mpi3mr_alloc_reply_sense_bufs()
2962 mrioc->bsg_cmds.reply = kzalloc(mrioc->reply_sz, GFP_KERNEL); in mpi3mr_alloc_reply_sense_bufs()
2963 if (!mrioc->bsg_cmds.reply) in mpi3mr_alloc_reply_sense_bufs()
2966 mrioc->transport_cmds.reply = kzalloc(mrioc->reply_sz, GFP_KERNEL); in mpi3mr_alloc_reply_sense_bufs()
2967 if (!mrioc->transport_cmds.reply) in mpi3mr_alloc_reply_sense_bufs()
2971 mrioc->dev_rmhs_cmds[i].reply = kzalloc(mrioc->reply_sz, in mpi3mr_alloc_reply_sense_bufs()
2973 if (!mrioc->dev_rmhs_cmds[i].reply) in mpi3mr_alloc_reply_sense_bufs()
2978 mrioc->evtack_cmds[i].reply = kzalloc(mrioc->reply_sz, in mpi3mr_alloc_reply_sense_bufs()
2980 if (!mrioc->evtack_cmds[i].reply) in mpi3mr_alloc_reply_sense_bufs()
2984 mrioc->host_tm_cmds.reply = kzalloc(mrioc->reply_sz, GFP_KERNEL); in mpi3mr_alloc_reply_sense_bufs()
2985 if (!mrioc->host_tm_cmds.reply) in mpi3mr_alloc_reply_sense_bufs()
2988 mrioc->pel_cmds.reply = kzalloc(mrioc->reply_sz, GFP_KERNEL); in mpi3mr_alloc_reply_sense_bufs()
2989 if (!mrioc->pel_cmds.reply) in mpi3mr_alloc_reply_sense_bufs()
2992 mrioc->pel_abort_cmd.reply = kzalloc(mrioc->reply_sz, GFP_KERNEL); in mpi3mr_alloc_reply_sense_bufs()
2993 if (!mrioc->pel_abort_cmd.reply) in mpi3mr_alloc_reply_sense_bufs()
2996 mrioc->dev_handle_bitmap_bits = mrioc->facts.max_devhandle; in mpi3mr_alloc_reply_sense_bufs()
2997 mrioc->removepend_bitmap = bitmap_zalloc(mrioc->dev_handle_bitmap_bits, in mpi3mr_alloc_reply_sense_bufs()
2999 if (!mrioc->removepend_bitmap) in mpi3mr_alloc_reply_sense_bufs()
3002 mrioc->devrem_bitmap = bitmap_zalloc(MPI3MR_NUM_DEVRMCMD, GFP_KERNEL); in mpi3mr_alloc_reply_sense_bufs()
3003 if (!mrioc->devrem_bitmap) in mpi3mr_alloc_reply_sense_bufs()
3006 mrioc->evtack_cmds_bitmap = bitmap_zalloc(MPI3MR_NUM_EVTACKCMD, in mpi3mr_alloc_reply_sense_bufs()
3008 if (!mrioc->evtack_cmds_bitmap) in mpi3mr_alloc_reply_sense_bufs()
3011 mrioc->num_reply_bufs = mrioc->facts.max_reqs + MPI3MR_NUM_EVT_REPLIES; in mpi3mr_alloc_reply_sense_bufs()
3012 mrioc->reply_free_qsz = mrioc->num_reply_bufs + 1; in mpi3mr_alloc_reply_sense_bufs()
3013 mrioc->num_sense_bufs = mrioc->facts.max_reqs / MPI3MR_SENSEBUF_FACTOR; in mpi3mr_alloc_reply_sense_bufs()
3014 mrioc->sense_buf_q_sz = mrioc->num_sense_bufs + 1; in mpi3mr_alloc_reply_sense_bufs()
3017 sz = mrioc->num_reply_bufs * mrioc->reply_sz; in mpi3mr_alloc_reply_sense_bufs()
3018 mrioc->reply_buf_pool = dma_pool_create("reply_buf pool", in mpi3mr_alloc_reply_sense_bufs()
3019 &mrioc->pdev->dev, sz, 16, 0); in mpi3mr_alloc_reply_sense_bufs()
3020 if (!mrioc->reply_buf_pool) { in mpi3mr_alloc_reply_sense_bufs()
3021 ioc_err(mrioc, "reply buf pool: dma_pool_create failed\n"); in mpi3mr_alloc_reply_sense_bufs()
3025 mrioc->reply_buf = dma_pool_zalloc(mrioc->reply_buf_pool, GFP_KERNEL, in mpi3mr_alloc_reply_sense_bufs()
3026 &mrioc->reply_buf_dma); in mpi3mr_alloc_reply_sense_bufs()
3027 if (!mrioc->reply_buf) in mpi3mr_alloc_reply_sense_bufs()
3030 mrioc->reply_buf_dma_max_address = mrioc->reply_buf_dma + sz; in mpi3mr_alloc_reply_sense_bufs()
3033 sz = mrioc->reply_free_qsz * 8; in mpi3mr_alloc_reply_sense_bufs()
3034 mrioc->reply_free_q_pool = dma_pool_create("reply_free_q pool", in mpi3mr_alloc_reply_sense_bufs()
3035 &mrioc->pdev->dev, sz, 8, 0); in mpi3mr_alloc_reply_sense_bufs()
3036 if (!mrioc->reply_free_q_pool) { in mpi3mr_alloc_reply_sense_bufs()
3037 ioc_err(mrioc, "reply_free_q pool: dma_pool_create failed\n"); in mpi3mr_alloc_reply_sense_bufs()
3040 mrioc->reply_free_q = dma_pool_zalloc(mrioc->reply_free_q_pool, in mpi3mr_alloc_reply_sense_bufs()
3041 GFP_KERNEL, &mrioc->reply_free_q_dma); in mpi3mr_alloc_reply_sense_bufs()
3042 if (!mrioc->reply_free_q) in mpi3mr_alloc_reply_sense_bufs()
3046 sz = mrioc->num_sense_bufs * MPI3MR_SENSE_BUF_SZ; in mpi3mr_alloc_reply_sense_bufs()
3047 mrioc->sense_buf_pool = dma_pool_create("sense_buf pool", in mpi3mr_alloc_reply_sense_bufs()
3048 &mrioc->pdev->dev, sz, 4, 0); in mpi3mr_alloc_reply_sense_bufs()
3049 if (!mrioc->sense_buf_pool) { in mpi3mr_alloc_reply_sense_bufs()
3050 ioc_err(mrioc, "sense_buf pool: dma_pool_create failed\n"); in mpi3mr_alloc_reply_sense_bufs()
3053 mrioc->sense_buf = dma_pool_zalloc(mrioc->sense_buf_pool, GFP_KERNEL, in mpi3mr_alloc_reply_sense_bufs()
3054 &mrioc->sense_buf_dma); in mpi3mr_alloc_reply_sense_bufs()
3055 if (!mrioc->sense_buf) in mpi3mr_alloc_reply_sense_bufs()
3059 sz = mrioc->sense_buf_q_sz * 8; in mpi3mr_alloc_reply_sense_bufs()
3060 mrioc->sense_buf_q_pool = dma_pool_create("sense_buf_q pool", in mpi3mr_alloc_reply_sense_bufs()
3061 &mrioc->pdev->dev, sz, 8, 0); in mpi3mr_alloc_reply_sense_bufs()
3062 if (!mrioc->sense_buf_q_pool) { in mpi3mr_alloc_reply_sense_bufs()
3063 ioc_err(mrioc, "sense_buf_q pool: dma_pool_create failed\n"); in mpi3mr_alloc_reply_sense_bufs()
3066 mrioc->sense_buf_q = dma_pool_zalloc(mrioc->sense_buf_q_pool, in mpi3mr_alloc_reply_sense_bufs()
3067 GFP_KERNEL, &mrioc->sense_buf_q_dma); in mpi3mr_alloc_reply_sense_bufs()
3068 if (!mrioc->sense_buf_q) in mpi3mr_alloc_reply_sense_bufs()
3088 static void mpimr_initialize_reply_sbuf_queues(struct mpi3mr_ioc *mrioc) in mpimr_initialize_reply_sbuf_queues() argument
3093 sz = mrioc->num_reply_bufs * mrioc->reply_sz; in mpimr_initialize_reply_sbuf_queues()
3094 ioc_info(mrioc, in mpimr_initialize_reply_sbuf_queues()
3096 mrioc->reply_buf, mrioc->num_reply_bufs, mrioc->reply_sz, in mpimr_initialize_reply_sbuf_queues()
3097 (sz / 1024), (unsigned long long)mrioc->reply_buf_dma); in mpimr_initialize_reply_sbuf_queues()
3098 sz = mrioc->reply_free_qsz * 8; in mpimr_initialize_reply_sbuf_queues()
3099 ioc_info(mrioc, in mpimr_initialize_reply_sbuf_queues()
3101 mrioc->reply_free_q, mrioc->reply_free_qsz, 8, (sz / 1024), in mpimr_initialize_reply_sbuf_queues()
3102 (unsigned long long)mrioc->reply_free_q_dma); in mpimr_initialize_reply_sbuf_queues()
3103 sz = mrioc->num_sense_bufs * MPI3MR_SENSE_BUF_SZ; in mpimr_initialize_reply_sbuf_queues()
3104 ioc_info(mrioc, in mpimr_initialize_reply_sbuf_queues()
3106 mrioc->sense_buf, mrioc->num_sense_bufs, MPI3MR_SENSE_BUF_SZ, in mpimr_initialize_reply_sbuf_queues()
3107 (sz / 1024), (unsigned long long)mrioc->sense_buf_dma); in mpimr_initialize_reply_sbuf_queues()
3108 sz = mrioc->sense_buf_q_sz * 8; in mpimr_initialize_reply_sbuf_queues()
3109 ioc_info(mrioc, in mpimr_initialize_reply_sbuf_queues()
3111 mrioc->sense_buf_q, mrioc->sense_buf_q_sz, 8, (sz / 1024), in mpimr_initialize_reply_sbuf_queues()
3112 (unsigned long long)mrioc->sense_buf_q_dma); in mpimr_initialize_reply_sbuf_queues()
3115 for (i = 0, phy_addr = mrioc->reply_buf_dma; in mpimr_initialize_reply_sbuf_queues()
3116 i < mrioc->num_reply_bufs; i++, phy_addr += mrioc->reply_sz) in mpimr_initialize_reply_sbuf_queues()
3117 mrioc->reply_free_q[i] = cpu_to_le64(phy_addr); in mpimr_initialize_reply_sbuf_queues()
3118 mrioc->reply_free_q[i] = cpu_to_le64(0); in mpimr_initialize_reply_sbuf_queues()
3121 for (i = 0, phy_addr = mrioc->sense_buf_dma; in mpimr_initialize_reply_sbuf_queues()
3122 i < mrioc->num_sense_bufs; i++, phy_addr += MPI3MR_SENSE_BUF_SZ) in mpimr_initialize_reply_sbuf_queues()
3123 mrioc->sense_buf_q[i] = cpu_to_le64(phy_addr); in mpimr_initialize_reply_sbuf_queues()
3124 mrioc->sense_buf_q[i] = cpu_to_le64(0); in mpimr_initialize_reply_sbuf_queues()
3136 static int mpi3mr_issue_iocinit(struct mpi3mr_ioc *mrioc) in mpi3mr_issue_iocinit() argument
3145 drv_info = dma_alloc_coherent(&mrioc->pdev->dev, data_len, &data_dma, in mpi3mr_issue_iocinit()
3151 mpimr_initialize_reply_sbuf_queues(mrioc); in mpi3mr_issue_iocinit()
3162 memcpy((u8 *)&mrioc->driver_info, (u8 *)drv_info, in mpi3mr_issue_iocinit()
3163 sizeof(mrioc->driver_info)); in mpi3mr_issue_iocinit()
3166 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_issue_iocinit()
3167 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_issue_iocinit()
3169 ioc_err(mrioc, "Issue IOCInit: Init command is in use\n"); in mpi3mr_issue_iocinit()
3170 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_iocinit()
3173 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_issue_iocinit()
3174 mrioc->init_cmds.is_waiting = 1; in mpi3mr_issue_iocinit()
3175 mrioc->init_cmds.callback = NULL; in mpi3mr_issue_iocinit()
3183 iocinit_req.reply_free_queue_depth = cpu_to_le16(mrioc->reply_free_qsz); in mpi3mr_issue_iocinit()
3185 cpu_to_le64(mrioc->reply_free_q_dma); in mpi3mr_issue_iocinit()
3188 cpu_to_le16(mrioc->sense_buf_q_sz); in mpi3mr_issue_iocinit()
3190 cpu_to_le64(mrioc->sense_buf_q_dma); in mpi3mr_issue_iocinit()
3196 init_completion(&mrioc->init_cmds.done); in mpi3mr_issue_iocinit()
3197 retval = mpi3mr_admin_request_post(mrioc, &iocinit_req, in mpi3mr_issue_iocinit()
3200 ioc_err(mrioc, "Issue IOCInit: Admin Post failed\n"); in mpi3mr_issue_iocinit()
3203 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_issue_iocinit()
3205 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_issue_iocinit()
3206 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_issue_iocinit()
3208 ioc_err(mrioc, "ioc_init timed out\n"); in mpi3mr_issue_iocinit()
3212 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_issue_iocinit()
3214 ioc_err(mrioc, in mpi3mr_issue_iocinit()
3216 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK), in mpi3mr_issue_iocinit()
3217 mrioc->init_cmds.ioc_loginfo); in mpi3mr_issue_iocinit()
3222 mrioc->reply_free_queue_host_index = mrioc->num_reply_bufs; in mpi3mr_issue_iocinit()
3223 writel(mrioc->reply_free_queue_host_index, in mpi3mr_issue_iocinit()
3224 &mrioc->sysif_regs->reply_free_host_index); in mpi3mr_issue_iocinit()
3226 mrioc->sbq_host_index = mrioc->num_sense_bufs; in mpi3mr_issue_iocinit()
3227 writel(mrioc->sbq_host_index, in mpi3mr_issue_iocinit()
3228 &mrioc->sysif_regs->sense_buffer_free_host_index); in mpi3mr_issue_iocinit()
3230 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_issue_iocinit()
3231 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_iocinit()
3235 dma_free_coherent(&mrioc->pdev->dev, data_len, drv_info, in mpi3mr_issue_iocinit()
3251 static void mpi3mr_unmask_events(struct mpi3mr_ioc *mrioc, u16 event) in mpi3mr_unmask_events() argument
3262 mrioc->event_masks[word] &= ~desired_event; in mpi3mr_unmask_events()
3274 static int mpi3mr_issue_event_notification(struct mpi3mr_ioc *mrioc) in mpi3mr_issue_event_notification() argument
3281 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_issue_event_notification()
3282 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_issue_event_notification()
3284 ioc_err(mrioc, "Issue EvtNotify: Init command is in use\n"); in mpi3mr_issue_event_notification()
3285 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_event_notification()
3288 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_issue_event_notification()
3289 mrioc->init_cmds.is_waiting = 1; in mpi3mr_issue_event_notification()
3290 mrioc->init_cmds.callback = NULL; in mpi3mr_issue_event_notification()
3295 cpu_to_le32(mrioc->event_masks[i]); in mpi3mr_issue_event_notification()
3296 init_completion(&mrioc->init_cmds.done); in mpi3mr_issue_event_notification()
3297 retval = mpi3mr_admin_request_post(mrioc, &evtnotify_req, in mpi3mr_issue_event_notification()
3300 ioc_err(mrioc, "Issue EvtNotify: Admin Post failed\n"); in mpi3mr_issue_event_notification()
3303 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_issue_event_notification()
3305 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_issue_event_notification()
3306 ioc_err(mrioc, "event notification timed out\n"); in mpi3mr_issue_event_notification()
3307 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_issue_event_notification()
3312 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_issue_event_notification()
3314 ioc_err(mrioc, in mpi3mr_issue_event_notification()
3316 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK), in mpi3mr_issue_event_notification()
3317 mrioc->init_cmds.ioc_loginfo); in mpi3mr_issue_event_notification()
3323 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_issue_event_notification()
3324 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_event_notification()
3340 int mpi3mr_process_event_ack(struct mpi3mr_ioc *mrioc, u8 event, in mpi3mr_process_event_ack() argument
3347 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_process_event_ack()
3348 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_process_event_ack()
3350 ioc_err(mrioc, "Send EvtAck: Init command is in use\n"); in mpi3mr_process_event_ack()
3351 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_process_event_ack()
3354 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_process_event_ack()
3355 mrioc->init_cmds.is_waiting = 1; in mpi3mr_process_event_ack()
3356 mrioc->init_cmds.callback = NULL; in mpi3mr_process_event_ack()
3362 init_completion(&mrioc->init_cmds.done); in mpi3mr_process_event_ack()
3363 retval = mpi3mr_admin_request_post(mrioc, &evtack_req, in mpi3mr_process_event_ack()
3366 ioc_err(mrioc, "Send EvtAck: Admin Post failed\n"); in mpi3mr_process_event_ack()
3369 wait_for_completion_timeout(&mrioc->init_cmds.done, in mpi3mr_process_event_ack()
3371 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_process_event_ack()
3372 ioc_err(mrioc, "Issue EvtNotify: command timed out\n"); in mpi3mr_process_event_ack()
3373 if (!(mrioc->init_cmds.state & MPI3MR_CMD_RESET)) in mpi3mr_process_event_ack()
3374 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_process_event_ack()
3379 if ((mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK) in mpi3mr_process_event_ack()
3381 ioc_err(mrioc, in mpi3mr_process_event_ack()
3383 (mrioc->init_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK), in mpi3mr_process_event_ack()
3384 mrioc->init_cmds.ioc_loginfo); in mpi3mr_process_event_ack()
3390 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_process_event_ack()
3391 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_process_event_ack()
3406 static int mpi3mr_alloc_chain_bufs(struct mpi3mr_ioc *mrioc) in mpi3mr_alloc_chain_bufs() argument
3412 if (mrioc->chain_sgl_list) in mpi3mr_alloc_chain_bufs()
3415 num_chains = mrioc->max_host_ios / MPI3MR_CHAINBUF_FACTOR; in mpi3mr_alloc_chain_bufs()
3423 mrioc->chain_buf_count = num_chains; in mpi3mr_alloc_chain_bufs()
3425 mrioc->chain_sgl_list = kzalloc(sz, GFP_KERNEL); in mpi3mr_alloc_chain_bufs()
3426 if (!mrioc->chain_sgl_list) in mpi3mr_alloc_chain_bufs()
3429 if (mrioc->max_sgl_entries > (mrioc->facts.max_data_length / in mpi3mr_alloc_chain_bufs()
3431 mrioc->max_sgl_entries = mrioc->facts.max_data_length / in mpi3mr_alloc_chain_bufs()
3433 sz = mrioc->max_sgl_entries * sizeof(struct mpi3_sge_common); in mpi3mr_alloc_chain_bufs()
3434 ioc_info(mrioc, "number of sgl entries=%d chain buffer size=%dKB\n", in mpi3mr_alloc_chain_bufs()
3435 mrioc->max_sgl_entries, sz/1024); in mpi3mr_alloc_chain_bufs()
3437 mrioc->chain_buf_pool = dma_pool_create("chain_buf pool", in mpi3mr_alloc_chain_bufs()
3438 &mrioc->pdev->dev, sz, 16, 0); in mpi3mr_alloc_chain_bufs()
3439 if (!mrioc->chain_buf_pool) { in mpi3mr_alloc_chain_bufs()
3440 ioc_err(mrioc, "chain buf pool: dma_pool_create failed\n"); in mpi3mr_alloc_chain_bufs()
3445 mrioc->chain_sgl_list[i].addr = in mpi3mr_alloc_chain_bufs()
3446 dma_pool_zalloc(mrioc->chain_buf_pool, GFP_KERNEL, in mpi3mr_alloc_chain_bufs()
3447 &mrioc->chain_sgl_list[i].dma_addr); in mpi3mr_alloc_chain_bufs()
3449 if (!mrioc->chain_sgl_list[i].addr) in mpi3mr_alloc_chain_bufs()
3452 mrioc->chain_bitmap = bitmap_zalloc(num_chains, GFP_KERNEL); in mpi3mr_alloc_chain_bufs()
3453 if (!mrioc->chain_bitmap) in mpi3mr_alloc_chain_bufs()
3471 static void mpi3mr_port_enable_complete(struct mpi3mr_ioc *mrioc, in mpi3mr_port_enable_complete() argument
3475 mrioc->scan_started = 0; in mpi3mr_port_enable_complete()
3477 mrioc->scan_failed = MPI3_IOCSTATUS_INTERNAL_ERROR; in mpi3mr_port_enable_complete()
3479 mrioc->scan_failed = drv_cmd->ioc_status; in mpi3mr_port_enable_complete()
3494 int mpi3mr_issue_port_enable(struct mpi3mr_ioc *mrioc, u8 async) in mpi3mr_issue_port_enable() argument
3501 mutex_lock(&mrioc->init_cmds.mutex); in mpi3mr_issue_port_enable()
3502 if (mrioc->init_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_issue_port_enable()
3504 ioc_err(mrioc, "Issue PortEnable: Init command is in use\n"); in mpi3mr_issue_port_enable()
3505 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_port_enable()
3508 mrioc->init_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_issue_port_enable()
3510 mrioc->init_cmds.is_waiting = 0; in mpi3mr_issue_port_enable()
3511 mrioc->init_cmds.callback = mpi3mr_port_enable_complete; in mpi3mr_issue_port_enable()
3513 mrioc->init_cmds.is_waiting = 1; in mpi3mr_issue_port_enable()
3514 mrioc->init_cmds.callback = NULL; in mpi3mr_issue_port_enable()
3515 init_completion(&mrioc->init_cmds.done); in mpi3mr_issue_port_enable()
3520 retval = mpi3mr_admin_request_post(mrioc, &pe_req, sizeof(pe_req), 1); in mpi3mr_issue_port_enable()
3522 ioc_err(mrioc, "Issue PortEnable: Admin Post failed\n"); in mpi3mr_issue_port_enable()
3526 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_port_enable()
3530 wait_for_completion_timeout(&mrioc->init_cmds.done, (pe_timeout * HZ)); in mpi3mr_issue_port_enable()
3531 if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_issue_port_enable()
3532 ioc_err(mrioc, "port enable timed out\n"); in mpi3mr_issue_port_enable()
3534 mpi3mr_check_rh_fault_ioc(mrioc, MPI3MR_RESET_FROM_PE_TIMEOUT); in mpi3mr_issue_port_enable()
3537 mpi3mr_port_enable_complete(mrioc, &mrioc->init_cmds); in mpi3mr_issue_port_enable()
3540 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_issue_port_enable()
3541 mutex_unlock(&mrioc->init_cmds.mutex); in mpi3mr_issue_port_enable()
3575 mpi3mr_print_ioc_info(struct mpi3mr_ioc *mrioc) in mpi3mr_print_ioc_info() argument
3581 struct mpi3mr_compimg_ver *fwver = &mrioc->facts.fw_ver; in mpi3mr_print_ioc_info()
3583 switch (mrioc->facts.personality) { in mpi3mr_print_ioc_info()
3595 ioc_info(mrioc, "Running in %s Personality", personality); in mpi3mr_print_ioc_info()
3597 ioc_info(mrioc, "FW version(%d.%d.%d.%d.%d.%d)\n", in mpi3mr_print_ioc_info()
3602 if (mrioc->facts.protocol_flags & in mpi3mr_print_ioc_info()
3613 if (mrioc->facts.protocol_flags & in mpi3mr_print_ioc_info()
3622 ioc_info(mrioc, "Protocol=(%s), Capabilities=(%s)\n", in mpi3mr_print_ioc_info()
3634 void mpi3mr_cleanup_resources(struct mpi3mr_ioc *mrioc) in mpi3mr_cleanup_resources() argument
3636 struct pci_dev *pdev = mrioc->pdev; in mpi3mr_cleanup_resources()
3638 mpi3mr_cleanup_isr(mrioc); in mpi3mr_cleanup_resources()
3640 if (mrioc->sysif_regs) { in mpi3mr_cleanup_resources()
3641 iounmap((void __iomem *)mrioc->sysif_regs); in mpi3mr_cleanup_resources()
3642 mrioc->sysif_regs = NULL; in mpi3mr_cleanup_resources()
3646 if (mrioc->bars) in mpi3mr_cleanup_resources()
3647 pci_release_selected_regions(pdev, mrioc->bars); in mpi3mr_cleanup_resources()
3660 int mpi3mr_setup_resources(struct mpi3mr_ioc *mrioc) in mpi3mr_setup_resources() argument
3662 struct pci_dev *pdev = mrioc->pdev; in mpi3mr_setup_resources()
3666 u64 dma_mask = mrioc->dma_mask ? mrioc->dma_mask : in mpi3mr_setup_resources()
3670 ioc_err(mrioc, "pci_enable_device_mem: failed\n"); in mpi3mr_setup_resources()
3677 ioc_err(mrioc, "Unable to find MSI-X Capabilities\n"); in mpi3mr_setup_resources()
3681 mrioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); in mpi3mr_setup_resources()
3683 if (pci_request_selected_regions(pdev, mrioc->bars, in mpi3mr_setup_resources()
3684 mrioc->driver_name)) { in mpi3mr_setup_resources()
3685 ioc_err(mrioc, "pci_request_selected_regions: failed\n"); in mpi3mr_setup_resources()
3692 mrioc->sysif_regs_phys = pci_resource_start(pdev, i); in mpi3mr_setup_resources()
3694 mrioc->sysif_regs = in mpi3mr_setup_resources()
3695 ioremap(mrioc->sysif_regs_phys, memap_sz); in mpi3mr_setup_resources()
3705 ioc_warn(mrioc, "Setting 64 bit DMA mask failed\n"); in mpi3mr_setup_resources()
3711 mrioc->dma_mask = 0; in mpi3mr_setup_resources()
3712 ioc_err(mrioc, "Setting 32 bit DMA mask also failed\n"); in mpi3mr_setup_resources()
3716 mrioc->dma_mask = dma_mask; in mpi3mr_setup_resources()
3718 if (!mrioc->sysif_regs) { in mpi3mr_setup_resources()
3719 ioc_err(mrioc, in mpi3mr_setup_resources()
3726 mrioc->msix_count = (message_control & 0x3FF) + 1; in mpi3mr_setup_resources()
3730 pci_set_drvdata(pdev, mrioc->shost); in mpi3mr_setup_resources()
3732 mpi3mr_ioc_disable_intr(mrioc); in mpi3mr_setup_resources()
3734 ioc_info(mrioc, "iomem(0x%016llx), mapped(0x%p), size(%d)\n", in mpi3mr_setup_resources()
3735 (unsigned long long)mrioc->sysif_regs_phys, in mpi3mr_setup_resources()
3736 mrioc->sysif_regs, memap_sz); in mpi3mr_setup_resources()
3737 ioc_info(mrioc, "Number of MSI-X vectors found in capabilities: (%d)\n", in mpi3mr_setup_resources()
3738 mrioc->msix_count); in mpi3mr_setup_resources()
3741 mrioc->requested_poll_qcount = min_t(int, poll_queues, in mpi3mr_setup_resources()
3742 mrioc->msix_count - 2); in mpi3mr_setup_resources()
3746 mpi3mr_cleanup_resources(mrioc); in mpi3mr_setup_resources()
3760 static int mpi3mr_enable_events(struct mpi3mr_ioc *mrioc) in mpi3mr_enable_events() argument
3766 mrioc->event_masks[i] = -1; in mpi3mr_enable_events()
3768 mpi3mr_unmask_events(mrioc, MPI3_EVENT_DEVICE_ADDED); in mpi3mr_enable_events()
3769 mpi3mr_unmask_events(mrioc, MPI3_EVENT_DEVICE_INFO_CHANGED); in mpi3mr_enable_events()
3770 mpi3mr_unmask_events(mrioc, MPI3_EVENT_DEVICE_STATUS_CHANGE); in mpi3mr_enable_events()
3771 mpi3mr_unmask_events(mrioc, MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE); in mpi3mr_enable_events()
3772 mpi3mr_unmask_events(mrioc, MPI3_EVENT_ENCL_DEVICE_ADDED); in mpi3mr_enable_events()
3773 mpi3mr_unmask_events(mrioc, MPI3_EVENT_SAS_TOPOLOGY_CHANGE_LIST); in mpi3mr_enable_events()
3774 mpi3mr_unmask_events(mrioc, MPI3_EVENT_SAS_DISCOVERY); in mpi3mr_enable_events()
3775 mpi3mr_unmask_events(mrioc, MPI3_EVENT_SAS_DEVICE_DISCOVERY_ERROR); in mpi3mr_enable_events()
3776 mpi3mr_unmask_events(mrioc, MPI3_EVENT_SAS_BROADCAST_PRIMITIVE); in mpi3mr_enable_events()
3777 mpi3mr_unmask_events(mrioc, MPI3_EVENT_PCIE_TOPOLOGY_CHANGE_LIST); in mpi3mr_enable_events()
3778 mpi3mr_unmask_events(mrioc, MPI3_EVENT_PCIE_ENUMERATION); in mpi3mr_enable_events()
3779 mpi3mr_unmask_events(mrioc, MPI3_EVENT_PREPARE_FOR_RESET); in mpi3mr_enable_events()
3780 mpi3mr_unmask_events(mrioc, MPI3_EVENT_CABLE_MGMT); in mpi3mr_enable_events()
3781 mpi3mr_unmask_events(mrioc, MPI3_EVENT_ENERGY_PACK_CHANGE); in mpi3mr_enable_events()
3783 retval = mpi3mr_issue_event_notification(mrioc); in mpi3mr_enable_events()
3785 ioc_err(mrioc, "failed to issue event notification %d\n", in mpi3mr_enable_events()
3805 int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) in mpi3mr_init_ioc() argument
3813 retval = mpi3mr_bring_ioc_ready(mrioc); in mpi3mr_init_ioc()
3815 ioc_err(mrioc, "Failed to bring ioc ready: error %d\n", in mpi3mr_init_ioc()
3820 retval = mpi3mr_setup_isr(mrioc, 1); in mpi3mr_init_ioc()
3822 ioc_err(mrioc, "Failed to setup ISR error %d\n", in mpi3mr_init_ioc()
3827 retval = mpi3mr_issue_iocfacts(mrioc, &facts_data); in mpi3mr_init_ioc()
3829 ioc_err(mrioc, "Failed to Issue IOC Facts %d\n", in mpi3mr_init_ioc()
3834 mrioc->max_host_ios = mrioc->facts.max_reqs - MPI3MR_INTERNAL_CMDS_RESVD; in mpi3mr_init_ioc()
3835 mrioc->shost->max_sectors = mrioc->facts.max_data_length / 512; in mpi3mr_init_ioc()
3836 mrioc->num_io_throttle_group = mrioc->facts.max_io_throttle_group; in mpi3mr_init_ioc()
3837 atomic_set(&mrioc->pend_large_data_sz, 0); in mpi3mr_init_ioc()
3840 mrioc->max_host_ios = min_t(int, mrioc->max_host_ios, in mpi3mr_init_ioc()
3843 if (!(mrioc->facts.ioc_capabilities & in mpi3mr_init_ioc()
3845 mrioc->sas_transport_enabled = 1; in mpi3mr_init_ioc()
3846 mrioc->scsi_device_channel = 1; in mpi3mr_init_ioc()
3847 mrioc->shost->max_channel = 1; in mpi3mr_init_ioc()
3848 mrioc->shost->transportt = mpi3mr_transport_template; in mpi3mr_init_ioc()
3851 mrioc->reply_sz = mrioc->facts.reply_sz; in mpi3mr_init_ioc()
3853 retval = mpi3mr_check_reset_dma_mask(mrioc); in mpi3mr_init_ioc()
3855 ioc_err(mrioc, "Resetting dma mask failed %d\n", in mpi3mr_init_ioc()
3860 mpi3mr_print_ioc_info(mrioc); in mpi3mr_init_ioc()
3862 if (!mrioc->cfg_page) { in mpi3mr_init_ioc()
3863 dprint_init(mrioc, "allocating config page buffers\n"); in mpi3mr_init_ioc()
3864 mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ; in mpi3mr_init_ioc()
3865 mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_init_ioc()
3866 mrioc->cfg_page_sz, &mrioc->cfg_page_dma, GFP_KERNEL); in mpi3mr_init_ioc()
3867 if (!mrioc->cfg_page) { in mpi3mr_init_ioc()
3873 if (!mrioc->init_cmds.reply) { in mpi3mr_init_ioc()
3874 retval = mpi3mr_alloc_reply_sense_bufs(mrioc); in mpi3mr_init_ioc()
3876 ioc_err(mrioc, in mpi3mr_init_ioc()
3883 if (!mrioc->chain_sgl_list) { in mpi3mr_init_ioc()
3884 retval = mpi3mr_alloc_chain_bufs(mrioc); in mpi3mr_init_ioc()
3886 ioc_err(mrioc, "Failed to allocated chain buffers %d\n", in mpi3mr_init_ioc()
3892 retval = mpi3mr_issue_iocinit(mrioc); in mpi3mr_init_ioc()
3894 ioc_err(mrioc, "Failed to Issue IOC Init %d\n", in mpi3mr_init_ioc()
3899 retval = mpi3mr_print_pkg_ver(mrioc); in mpi3mr_init_ioc()
3901 ioc_err(mrioc, "failed to get package version\n"); in mpi3mr_init_ioc()
3905 retval = mpi3mr_setup_isr(mrioc, 0); in mpi3mr_init_ioc()
3907 ioc_err(mrioc, "Failed to re-setup ISR, error %d\n", in mpi3mr_init_ioc()
3912 retval = mpi3mr_create_op_queues(mrioc); in mpi3mr_init_ioc()
3914 ioc_err(mrioc, "Failed to create OpQueues error %d\n", in mpi3mr_init_ioc()
3919 if (!mrioc->pel_seqnum_virt) { in mpi3mr_init_ioc()
3920 dprint_init(mrioc, "allocating memory for pel_seqnum_virt\n"); in mpi3mr_init_ioc()
3921 mrioc->pel_seqnum_sz = sizeof(struct mpi3_pel_seq); in mpi3mr_init_ioc()
3922 mrioc->pel_seqnum_virt = dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_init_ioc()
3923 mrioc->pel_seqnum_sz, &mrioc->pel_seqnum_dma, in mpi3mr_init_ioc()
3925 if (!mrioc->pel_seqnum_virt) { in mpi3mr_init_ioc()
3931 if (!mrioc->throttle_groups && mrioc->num_io_throttle_group) { in mpi3mr_init_ioc()
3932 dprint_init(mrioc, "allocating memory for throttle groups\n"); in mpi3mr_init_ioc()
3934 mrioc->throttle_groups = kcalloc(mrioc->num_io_throttle_group, sz, GFP_KERNEL); in mpi3mr_init_ioc()
3935 if (!mrioc->throttle_groups) { in mpi3mr_init_ioc()
3941 retval = mpi3mr_enable_events(mrioc); in mpi3mr_init_ioc()
3943 ioc_err(mrioc, "failed to enable events %d\n", in mpi3mr_init_ioc()
3948 ioc_info(mrioc, "controller initialization completed successfully\n"); in mpi3mr_init_ioc()
3953 ioc_warn(mrioc, "retrying controller initialization, retry_count:%d\n", in mpi3mr_init_ioc()
3955 mpi3mr_memset_buffers(mrioc); in mpi3mr_init_ioc()
3960 ioc_err(mrioc, "controller initialization failed\n"); in mpi3mr_init_ioc()
3961 mpi3mr_issue_reset(mrioc, MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT, in mpi3mr_init_ioc()
3963 mrioc->unrecoverable = 1; in mpi3mr_init_ioc()
3981 int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume) in mpi3mr_reinit_ioc() argument
3992 dprint_reset(mrioc, "bringing up the controller to ready state\n"); in mpi3mr_reinit_ioc()
3993 retval = mpi3mr_bring_ioc_ready(mrioc); in mpi3mr_reinit_ioc()
3995 ioc_err(mrioc, "failed to bring to ready state\n"); in mpi3mr_reinit_ioc()
4000 dprint_reset(mrioc, "setting up single ISR\n"); in mpi3mr_reinit_ioc()
4001 retval = mpi3mr_setup_isr(mrioc, 1); in mpi3mr_reinit_ioc()
4003 ioc_err(mrioc, "failed to setup ISR\n"); in mpi3mr_reinit_ioc()
4007 mpi3mr_ioc_enable_intr(mrioc); in mpi3mr_reinit_ioc()
4009 dprint_reset(mrioc, "getting ioc_facts\n"); in mpi3mr_reinit_ioc()
4010 retval = mpi3mr_issue_iocfacts(mrioc, &facts_data); in mpi3mr_reinit_ioc()
4012 ioc_err(mrioc, "failed to get ioc_facts\n"); in mpi3mr_reinit_ioc()
4016 dprint_reset(mrioc, "validating ioc_facts\n"); in mpi3mr_reinit_ioc()
4017 retval = mpi3mr_revalidate_factsdata(mrioc); in mpi3mr_reinit_ioc()
4019 ioc_err(mrioc, "failed to revalidate ioc_facts data\n"); in mpi3mr_reinit_ioc()
4023 mpi3mr_print_ioc_info(mrioc); in mpi3mr_reinit_ioc()
4025 dprint_reset(mrioc, "sending ioc_init\n"); in mpi3mr_reinit_ioc()
4026 retval = mpi3mr_issue_iocinit(mrioc); in mpi3mr_reinit_ioc()
4028 ioc_err(mrioc, "failed to send ioc_init\n"); in mpi3mr_reinit_ioc()
4032 dprint_reset(mrioc, "getting package version\n"); in mpi3mr_reinit_ioc()
4033 retval = mpi3mr_print_pkg_ver(mrioc); in mpi3mr_reinit_ioc()
4035 ioc_err(mrioc, "failed to get package version\n"); in mpi3mr_reinit_ioc()
4040 dprint_reset(mrioc, "setting up multiple ISR\n"); in mpi3mr_reinit_ioc()
4041 retval = mpi3mr_setup_isr(mrioc, 0); in mpi3mr_reinit_ioc()
4043 ioc_err(mrioc, "failed to re-setup ISR\n"); in mpi3mr_reinit_ioc()
4048 dprint_reset(mrioc, "creating operational queue pairs\n"); in mpi3mr_reinit_ioc()
4049 retval = mpi3mr_create_op_queues(mrioc); in mpi3mr_reinit_ioc()
4051 ioc_err(mrioc, "failed to create operational queue pairs\n"); in mpi3mr_reinit_ioc()
4055 if (!mrioc->pel_seqnum_virt) { in mpi3mr_reinit_ioc()
4056 dprint_reset(mrioc, "allocating memory for pel_seqnum_virt\n"); in mpi3mr_reinit_ioc()
4057 mrioc->pel_seqnum_sz = sizeof(struct mpi3_pel_seq); in mpi3mr_reinit_ioc()
4058 mrioc->pel_seqnum_virt = dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_reinit_ioc()
4059 mrioc->pel_seqnum_sz, &mrioc->pel_seqnum_dma, in mpi3mr_reinit_ioc()
4061 if (!mrioc->pel_seqnum_virt) { in mpi3mr_reinit_ioc()
4067 if (mrioc->shost->nr_hw_queues > mrioc->num_op_reply_q) { in mpi3mr_reinit_ioc()
4068 ioc_err(mrioc, in mpi3mr_reinit_ioc()
4070 mrioc->shost->nr_hw_queues, mrioc->num_op_reply_q); in mpi3mr_reinit_ioc()
4075 dprint_reset(mrioc, "enabling events\n"); in mpi3mr_reinit_ioc()
4076 retval = mpi3mr_enable_events(mrioc); in mpi3mr_reinit_ioc()
4078 ioc_err(mrioc, "failed to enable events\n"); in mpi3mr_reinit_ioc()
4082 mrioc->device_refresh_on = 1; in mpi3mr_reinit_ioc()
4083 mpi3mr_add_event_wait_for_device_refresh(mrioc); in mpi3mr_reinit_ioc()
4085 ioc_info(mrioc, "sending port enable\n"); in mpi3mr_reinit_ioc()
4086 retval = mpi3mr_issue_port_enable(mrioc, 1); in mpi3mr_reinit_ioc()
4088 ioc_err(mrioc, "failed to issue port enable\n"); in mpi3mr_reinit_ioc()
4093 if (mrioc->init_cmds.state == MPI3MR_CMD_NOTUSED) in mpi3mr_reinit_ioc()
4095 if (!pci_device_is_present(mrioc->pdev)) in mpi3mr_reinit_ioc()
4096 mrioc->unrecoverable = 1; in mpi3mr_reinit_ioc()
4097 if (mrioc->unrecoverable) { in mpi3mr_reinit_ioc()
4101 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_reinit_ioc()
4104 mpi3mr_print_fault_info(mrioc); in mpi3mr_reinit_ioc()
4105 mrioc->init_cmds.is_waiting = 0; in mpi3mr_reinit_ioc()
4106 mrioc->init_cmds.callback = NULL; in mpi3mr_reinit_ioc()
4107 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_reinit_ioc()
4113 ioc_err(mrioc, "port enable timed out\n"); in mpi3mr_reinit_ioc()
4114 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_reinit_ioc()
4116 mrioc->init_cmds.is_waiting = 0; in mpi3mr_reinit_ioc()
4117 mrioc->init_cmds.callback = NULL; in mpi3mr_reinit_ioc()
4118 mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_reinit_ioc()
4120 } else if (mrioc->scan_failed) { in mpi3mr_reinit_ioc()
4121 ioc_err(mrioc, in mpi3mr_reinit_ioc()
4123 mrioc->scan_failed); in mpi3mr_reinit_ioc()
4125 ioc_info(mrioc, "port enable completed successfully\n"); in mpi3mr_reinit_ioc()
4127 ioc_info(mrioc, "controller %s completed successfully\n", in mpi3mr_reinit_ioc()
4133 ioc_warn(mrioc, "retrying controller %s, retry_count:%d\n", in mpi3mr_reinit_ioc()
4135 mpi3mr_memset_buffers(mrioc); in mpi3mr_reinit_ioc()
4140 ioc_err(mrioc, "controller %s is failed\n", in mpi3mr_reinit_ioc()
4142 mpi3mr_issue_reset(mrioc, MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT, in mpi3mr_reinit_ioc()
4144 mrioc->unrecoverable = 1; in mpi3mr_reinit_ioc()
4156 static void mpi3mr_memset_op_reply_q_buffers(struct mpi3mr_ioc *mrioc, u16 qidx) in mpi3mr_memset_op_reply_q_buffers() argument
4158 struct op_reply_qinfo *op_reply_q = mrioc->op_reply_qinfo + qidx; in mpi3mr_memset_op_reply_q_buffers()
4165 size = op_reply_q->segment_qd * mrioc->op_reply_desc_sz; in mpi3mr_memset_op_reply_q_buffers()
4179 static void mpi3mr_memset_op_req_q_buffers(struct mpi3mr_ioc *mrioc, u16 qidx) in mpi3mr_memset_op_req_q_buffers() argument
4181 struct op_req_qinfo *op_req_q = mrioc->req_qinfo + qidx; in mpi3mr_memset_op_req_q_buffers()
4188 size = op_req_q->segment_qd * mrioc->facts.op_req_sz; in mpi3mr_memset_op_req_q_buffers()
4204 void mpi3mr_memset_buffers(struct mpi3mr_ioc *mrioc) in mpi3mr_memset_buffers() argument
4209 mrioc->change_count = 0; in mpi3mr_memset_buffers()
4210 mrioc->active_poll_qcount = 0; in mpi3mr_memset_buffers()
4211 mrioc->default_qcount = 0; in mpi3mr_memset_buffers()
4212 if (mrioc->admin_req_base) in mpi3mr_memset_buffers()
4213 memset(mrioc->admin_req_base, 0, mrioc->admin_req_q_sz); in mpi3mr_memset_buffers()
4214 if (mrioc->admin_reply_base) in mpi3mr_memset_buffers()
4215 memset(mrioc->admin_reply_base, 0, mrioc->admin_reply_q_sz); in mpi3mr_memset_buffers()
4216 atomic_set(&mrioc->admin_reply_q_in_use, 0); in mpi3mr_memset_buffers()
4218 if (mrioc->init_cmds.reply) { in mpi3mr_memset_buffers()
4219 memset(mrioc->init_cmds.reply, 0, sizeof(*mrioc->init_cmds.reply)); in mpi3mr_memset_buffers()
4220 memset(mrioc->bsg_cmds.reply, 0, in mpi3mr_memset_buffers()
4221 sizeof(*mrioc->bsg_cmds.reply)); in mpi3mr_memset_buffers()
4222 memset(mrioc->host_tm_cmds.reply, 0, in mpi3mr_memset_buffers()
4223 sizeof(*mrioc->host_tm_cmds.reply)); in mpi3mr_memset_buffers()
4224 memset(mrioc->pel_cmds.reply, 0, in mpi3mr_memset_buffers()
4225 sizeof(*mrioc->pel_cmds.reply)); in mpi3mr_memset_buffers()
4226 memset(mrioc->pel_abort_cmd.reply, 0, in mpi3mr_memset_buffers()
4227 sizeof(*mrioc->pel_abort_cmd.reply)); in mpi3mr_memset_buffers()
4228 memset(mrioc->transport_cmds.reply, 0, in mpi3mr_memset_buffers()
4229 sizeof(*mrioc->transport_cmds.reply)); in mpi3mr_memset_buffers()
4231 memset(mrioc->dev_rmhs_cmds[i].reply, 0, in mpi3mr_memset_buffers()
4232 sizeof(*mrioc->dev_rmhs_cmds[i].reply)); in mpi3mr_memset_buffers()
4234 memset(mrioc->evtack_cmds[i].reply, 0, in mpi3mr_memset_buffers()
4235 sizeof(*mrioc->evtack_cmds[i].reply)); in mpi3mr_memset_buffers()
4236 bitmap_clear(mrioc->removepend_bitmap, 0, in mpi3mr_memset_buffers()
4237 mrioc->dev_handle_bitmap_bits); in mpi3mr_memset_buffers()
4238 bitmap_clear(mrioc->devrem_bitmap, 0, MPI3MR_NUM_DEVRMCMD); in mpi3mr_memset_buffers()
4239 bitmap_clear(mrioc->evtack_cmds_bitmap, 0, in mpi3mr_memset_buffers()
4243 for (i = 0; i < mrioc->num_queues; i++) { in mpi3mr_memset_buffers()
4244 mrioc->op_reply_qinfo[i].qid = 0; in mpi3mr_memset_buffers()
4245 mrioc->op_reply_qinfo[i].ci = 0; in mpi3mr_memset_buffers()
4246 mrioc->op_reply_qinfo[i].num_replies = 0; in mpi3mr_memset_buffers()
4247 mrioc->op_reply_qinfo[i].ephase = 0; in mpi3mr_memset_buffers()
4248 atomic_set(&mrioc->op_reply_qinfo[i].pend_ios, 0); in mpi3mr_memset_buffers()
4249 atomic_set(&mrioc->op_reply_qinfo[i].in_use, 0); in mpi3mr_memset_buffers()
4250 mpi3mr_memset_op_reply_q_buffers(mrioc, i); in mpi3mr_memset_buffers()
4252 mrioc->req_qinfo[i].ci = 0; in mpi3mr_memset_buffers()
4253 mrioc->req_qinfo[i].pi = 0; in mpi3mr_memset_buffers()
4254 mrioc->req_qinfo[i].num_requests = 0; in mpi3mr_memset_buffers()
4255 mrioc->req_qinfo[i].qid = 0; in mpi3mr_memset_buffers()
4256 mrioc->req_qinfo[i].reply_qid = 0; in mpi3mr_memset_buffers()
4257 spin_lock_init(&mrioc->req_qinfo[i].q_lock); in mpi3mr_memset_buffers()
4258 mpi3mr_memset_op_req_q_buffers(mrioc, i); in mpi3mr_memset_buffers()
4261 atomic_set(&mrioc->pend_large_data_sz, 0); in mpi3mr_memset_buffers()
4262 if (mrioc->throttle_groups) { in mpi3mr_memset_buffers()
4263 tg = mrioc->throttle_groups; in mpi3mr_memset_buffers()
4264 for (i = 0; i < mrioc->num_io_throttle_group; i++, tg++) { in mpi3mr_memset_buffers()
4286 void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc) in mpi3mr_free_mem() argument
4291 mpi3mr_free_enclosure_list(mrioc); in mpi3mr_free_mem()
4293 if (mrioc->sense_buf_pool) { in mpi3mr_free_mem()
4294 if (mrioc->sense_buf) in mpi3mr_free_mem()
4295 dma_pool_free(mrioc->sense_buf_pool, mrioc->sense_buf, in mpi3mr_free_mem()
4296 mrioc->sense_buf_dma); in mpi3mr_free_mem()
4297 dma_pool_destroy(mrioc->sense_buf_pool); in mpi3mr_free_mem()
4298 mrioc->sense_buf = NULL; in mpi3mr_free_mem()
4299 mrioc->sense_buf_pool = NULL; in mpi3mr_free_mem()
4301 if (mrioc->sense_buf_q_pool) { in mpi3mr_free_mem()
4302 if (mrioc->sense_buf_q) in mpi3mr_free_mem()
4303 dma_pool_free(mrioc->sense_buf_q_pool, in mpi3mr_free_mem()
4304 mrioc->sense_buf_q, mrioc->sense_buf_q_dma); in mpi3mr_free_mem()
4305 dma_pool_destroy(mrioc->sense_buf_q_pool); in mpi3mr_free_mem()
4306 mrioc->sense_buf_q = NULL; in mpi3mr_free_mem()
4307 mrioc->sense_buf_q_pool = NULL; in mpi3mr_free_mem()
4310 if (mrioc->reply_buf_pool) { in mpi3mr_free_mem()
4311 if (mrioc->reply_buf) in mpi3mr_free_mem()
4312 dma_pool_free(mrioc->reply_buf_pool, mrioc->reply_buf, in mpi3mr_free_mem()
4313 mrioc->reply_buf_dma); in mpi3mr_free_mem()
4314 dma_pool_destroy(mrioc->reply_buf_pool); in mpi3mr_free_mem()
4315 mrioc->reply_buf = NULL; in mpi3mr_free_mem()
4316 mrioc->reply_buf_pool = NULL; in mpi3mr_free_mem()
4318 if (mrioc->reply_free_q_pool) { in mpi3mr_free_mem()
4319 if (mrioc->reply_free_q) in mpi3mr_free_mem()
4320 dma_pool_free(mrioc->reply_free_q_pool, in mpi3mr_free_mem()
4321 mrioc->reply_free_q, mrioc->reply_free_q_dma); in mpi3mr_free_mem()
4322 dma_pool_destroy(mrioc->reply_free_q_pool); in mpi3mr_free_mem()
4323 mrioc->reply_free_q = NULL; in mpi3mr_free_mem()
4324 mrioc->reply_free_q_pool = NULL; in mpi3mr_free_mem()
4327 for (i = 0; i < mrioc->num_op_req_q; i++) in mpi3mr_free_mem()
4328 mpi3mr_free_op_req_q_segments(mrioc, i); in mpi3mr_free_mem()
4330 for (i = 0; i < mrioc->num_op_reply_q; i++) in mpi3mr_free_mem()
4331 mpi3mr_free_op_reply_q_segments(mrioc, i); in mpi3mr_free_mem()
4333 for (i = 0; i < mrioc->intr_info_count; i++) { in mpi3mr_free_mem()
4334 intr_info = mrioc->intr_info + i; in mpi3mr_free_mem()
4338 kfree(mrioc->req_qinfo); in mpi3mr_free_mem()
4339 mrioc->req_qinfo = NULL; in mpi3mr_free_mem()
4340 mrioc->num_op_req_q = 0; in mpi3mr_free_mem()
4342 kfree(mrioc->op_reply_qinfo); in mpi3mr_free_mem()
4343 mrioc->op_reply_qinfo = NULL; in mpi3mr_free_mem()
4344 mrioc->num_op_reply_q = 0; in mpi3mr_free_mem()
4346 kfree(mrioc->init_cmds.reply); in mpi3mr_free_mem()
4347 mrioc->init_cmds.reply = NULL; in mpi3mr_free_mem()
4349 kfree(mrioc->bsg_cmds.reply); in mpi3mr_free_mem()
4350 mrioc->bsg_cmds.reply = NULL; in mpi3mr_free_mem()
4352 kfree(mrioc->host_tm_cmds.reply); in mpi3mr_free_mem()
4353 mrioc->host_tm_cmds.reply = NULL; in mpi3mr_free_mem()
4355 kfree(mrioc->pel_cmds.reply); in mpi3mr_free_mem()
4356 mrioc->pel_cmds.reply = NULL; in mpi3mr_free_mem()
4358 kfree(mrioc->pel_abort_cmd.reply); in mpi3mr_free_mem()
4359 mrioc->pel_abort_cmd.reply = NULL; in mpi3mr_free_mem()
4362 kfree(mrioc->evtack_cmds[i].reply); in mpi3mr_free_mem()
4363 mrioc->evtack_cmds[i].reply = NULL; in mpi3mr_free_mem()
4366 bitmap_free(mrioc->removepend_bitmap); in mpi3mr_free_mem()
4367 mrioc->removepend_bitmap = NULL; in mpi3mr_free_mem()
4369 bitmap_free(mrioc->devrem_bitmap); in mpi3mr_free_mem()
4370 mrioc->devrem_bitmap = NULL; in mpi3mr_free_mem()
4372 bitmap_free(mrioc->evtack_cmds_bitmap); in mpi3mr_free_mem()
4373 mrioc->evtack_cmds_bitmap = NULL; in mpi3mr_free_mem()
4375 bitmap_free(mrioc->chain_bitmap); in mpi3mr_free_mem()
4376 mrioc->chain_bitmap = NULL; in mpi3mr_free_mem()
4378 kfree(mrioc->transport_cmds.reply); in mpi3mr_free_mem()
4379 mrioc->transport_cmds.reply = NULL; in mpi3mr_free_mem()
4382 kfree(mrioc->dev_rmhs_cmds[i].reply); in mpi3mr_free_mem()
4383 mrioc->dev_rmhs_cmds[i].reply = NULL; in mpi3mr_free_mem()
4386 if (mrioc->chain_buf_pool) { in mpi3mr_free_mem()
4387 for (i = 0; i < mrioc->chain_buf_count; i++) { in mpi3mr_free_mem()
4388 if (mrioc->chain_sgl_list[i].addr) { in mpi3mr_free_mem()
4389 dma_pool_free(mrioc->chain_buf_pool, in mpi3mr_free_mem()
4390 mrioc->chain_sgl_list[i].addr, in mpi3mr_free_mem()
4391 mrioc->chain_sgl_list[i].dma_addr); in mpi3mr_free_mem()
4392 mrioc->chain_sgl_list[i].addr = NULL; in mpi3mr_free_mem()
4395 dma_pool_destroy(mrioc->chain_buf_pool); in mpi3mr_free_mem()
4396 mrioc->chain_buf_pool = NULL; in mpi3mr_free_mem()
4399 kfree(mrioc->chain_sgl_list); in mpi3mr_free_mem()
4400 mrioc->chain_sgl_list = NULL; in mpi3mr_free_mem()
4402 if (mrioc->admin_reply_base) { in mpi3mr_free_mem()
4403 dma_free_coherent(&mrioc->pdev->dev, mrioc->admin_reply_q_sz, in mpi3mr_free_mem()
4404 mrioc->admin_reply_base, mrioc->admin_reply_dma); in mpi3mr_free_mem()
4405 mrioc->admin_reply_base = NULL; in mpi3mr_free_mem()
4407 if (mrioc->admin_req_base) { in mpi3mr_free_mem()
4408 dma_free_coherent(&mrioc->pdev->dev, mrioc->admin_req_q_sz, in mpi3mr_free_mem()
4409 mrioc->admin_req_base, mrioc->admin_req_dma); in mpi3mr_free_mem()
4410 mrioc->admin_req_base = NULL; in mpi3mr_free_mem()
4412 if (mrioc->cfg_page) { in mpi3mr_free_mem()
4413 dma_free_coherent(&mrioc->pdev->dev, mrioc->cfg_page_sz, in mpi3mr_free_mem()
4414 mrioc->cfg_page, mrioc->cfg_page_dma); in mpi3mr_free_mem()
4415 mrioc->cfg_page = NULL; in mpi3mr_free_mem()
4417 if (mrioc->pel_seqnum_virt) { in mpi3mr_free_mem()
4418 dma_free_coherent(&mrioc->pdev->dev, mrioc->pel_seqnum_sz, in mpi3mr_free_mem()
4419 mrioc->pel_seqnum_virt, mrioc->pel_seqnum_dma); in mpi3mr_free_mem()
4420 mrioc->pel_seqnum_virt = NULL; in mpi3mr_free_mem()
4423 kfree(mrioc->throttle_groups); in mpi3mr_free_mem()
4424 mrioc->throttle_groups = NULL; in mpi3mr_free_mem()
4426 kfree(mrioc->logdata_buf); in mpi3mr_free_mem()
4427 mrioc->logdata_buf = NULL; in mpi3mr_free_mem()
4440 static void mpi3mr_issue_ioc_shutdown(struct mpi3mr_ioc *mrioc) in mpi3mr_issue_ioc_shutdown() argument
4446 ioc_info(mrioc, "Issuing shutdown Notification\n"); in mpi3mr_issue_ioc_shutdown()
4447 if (mrioc->unrecoverable) { in mpi3mr_issue_ioc_shutdown()
4448 ioc_warn(mrioc, in mpi3mr_issue_ioc_shutdown()
4452 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_issue_ioc_shutdown()
4455 ioc_info(mrioc, "shutdown already in progress\n"); in mpi3mr_issue_ioc_shutdown()
4459 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_issue_ioc_shutdown()
4463 writel(ioc_config, &mrioc->sysif_regs->ioc_configuration); in mpi3mr_issue_ioc_shutdown()
4465 if (mrioc->facts.shutdown_timeout) in mpi3mr_issue_ioc_shutdown()
4466 timeout = mrioc->facts.shutdown_timeout * 10; in mpi3mr_issue_ioc_shutdown()
4469 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_issue_ioc_shutdown()
4478 ioc_status = readl(&mrioc->sysif_regs->ioc_status); in mpi3mr_issue_ioc_shutdown()
4479 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); in mpi3mr_issue_ioc_shutdown()
4484 ioc_warn(mrioc, in mpi3mr_issue_ioc_shutdown()
4488 ioc_info(mrioc, in mpi3mr_issue_ioc_shutdown()
4503 void mpi3mr_cleanup_ioc(struct mpi3mr_ioc *mrioc) in mpi3mr_cleanup_ioc() argument
4507 dprint_exit(mrioc, "cleaning up the controller\n"); in mpi3mr_cleanup_ioc()
4508 mpi3mr_ioc_disable_intr(mrioc); in mpi3mr_cleanup_ioc()
4510 ioc_state = mpi3mr_get_iocstate(mrioc); in mpi3mr_cleanup_ioc()
4512 if ((!mrioc->unrecoverable) && (!mrioc->reset_in_progress) && in mpi3mr_cleanup_ioc()
4514 if (mpi3mr_issue_and_process_mur(mrioc, in mpi3mr_cleanup_ioc()
4516 mpi3mr_issue_reset(mrioc, in mpi3mr_cleanup_ioc()
4519 mpi3mr_issue_ioc_shutdown(mrioc); in mpi3mr_cleanup_ioc()
4521 dprint_exit(mrioc, "controller cleanup completed\n"); in mpi3mr_cleanup_ioc()
4534 static inline void mpi3mr_drv_cmd_comp_reset(struct mpi3mr_ioc *mrioc, in mpi3mr_drv_cmd_comp_reset() argument
4544 cmdptr->callback(mrioc, cmdptr); in mpi3mr_drv_cmd_comp_reset()
4556 void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc) in mpi3mr_flush_drv_cmds() argument
4561 cmdptr = &mrioc->init_cmds; in mpi3mr_flush_drv_cmds()
4562 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4564 cmdptr = &mrioc->cfg_cmds; in mpi3mr_flush_drv_cmds()
4565 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4567 cmdptr = &mrioc->bsg_cmds; in mpi3mr_flush_drv_cmds()
4568 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4569 cmdptr = &mrioc->host_tm_cmds; in mpi3mr_flush_drv_cmds()
4570 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4573 cmdptr = &mrioc->dev_rmhs_cmds[i]; in mpi3mr_flush_drv_cmds()
4574 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4578 cmdptr = &mrioc->evtack_cmds[i]; in mpi3mr_flush_drv_cmds()
4579 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4582 cmdptr = &mrioc->pel_cmds; in mpi3mr_flush_drv_cmds()
4583 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4585 cmdptr = &mrioc->pel_abort_cmd; in mpi3mr_flush_drv_cmds()
4586 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4588 cmdptr = &mrioc->transport_cmds; in mpi3mr_flush_drv_cmds()
4589 mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); in mpi3mr_flush_drv_cmds()
4601 static void mpi3mr_pel_wait_post(struct mpi3mr_ioc *mrioc, in mpi3mr_pel_wait_post() argument
4606 mrioc->pel_abort_requested = false; in mpi3mr_pel_wait_post()
4617 pel_wait.starting_sequence_number = cpu_to_le32(mrioc->pel_newest_seqnum); in mpi3mr_pel_wait_post()
4618 pel_wait.locale = cpu_to_le16(mrioc->pel_locale); in mpi3mr_pel_wait_post()
4619 pel_wait.class = cpu_to_le16(mrioc->pel_class); in mpi3mr_pel_wait_post()
4621 dprint_bsg_info(mrioc, "sending pel_wait seqnum(%d), class(%d), locale(0x%08x)\n", in mpi3mr_pel_wait_post()
4622 mrioc->pel_newest_seqnum, mrioc->pel_class, mrioc->pel_locale); in mpi3mr_pel_wait_post()
4624 if (mpi3mr_admin_request_post(mrioc, &pel_wait, sizeof(pel_wait), 0)) { in mpi3mr_pel_wait_post()
4625 dprint_bsg_err(mrioc, in mpi3mr_pel_wait_post()
4630 mrioc->pel_enabled = false; in mpi3mr_pel_wait_post()
4644 int mpi3mr_pel_get_seqnum_post(struct mpi3mr_ioc *mrioc, in mpi3mr_pel_get_seqnum_post() argument
4652 mrioc->pel_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_pel_get_seqnum_post()
4653 mrioc->pel_cmds.is_waiting = 0; in mpi3mr_pel_get_seqnum_post()
4654 mrioc->pel_cmds.ioc_status = 0; in mpi3mr_pel_get_seqnum_post()
4655 mrioc->pel_cmds.ioc_loginfo = 0; in mpi3mr_pel_get_seqnum_post()
4656 mrioc->pel_cmds.callback = mpi3mr_pel_get_seqnum_complete; in mpi3mr_pel_get_seqnum_post()
4661 mrioc->pel_seqnum_sz, mrioc->pel_seqnum_dma); in mpi3mr_pel_get_seqnum_post()
4663 retval = mpi3mr_admin_request_post(mrioc, &pel_getseq_req, in mpi3mr_pel_get_seqnum_post()
4671 mrioc->pel_enabled = false; in mpi3mr_pel_get_seqnum_post()
4690 static void mpi3mr_pel_wait_complete(struct mpi3mr_ioc *mrioc, in mpi3mr_pel_wait_complete() argument
4702 ioc_err(mrioc, "%s: Failed ioc_status(0x%04x) Loginfo(0x%08x)\n", in mpi3mr_pel_wait_complete()
4704 dprint_bsg_err(mrioc, in mpi3mr_pel_wait_complete()
4714 dprint_bsg_err(mrioc, in mpi3mr_pel_wait_complete()
4722 ioc_err(mrioc, "%s: Failed pe_log_status(0x%04x)\n", in mpi3mr_pel_wait_complete()
4724 dprint_bsg_err(mrioc, in mpi3mr_pel_wait_complete()
4733 dprint_bsg_err(mrioc, "pel_wait: retrying(%d)\n", in mpi3mr_pel_wait_complete()
4735 mpi3mr_pel_wait_post(mrioc, drv_cmd); in mpi3mr_pel_wait_complete()
4738 dprint_bsg_err(mrioc, in mpi3mr_pel_wait_complete()
4744 if (!mrioc->pel_abort_requested) { in mpi3mr_pel_wait_complete()
4745 mrioc->pel_cmds.retry_count = 0; in mpi3mr_pel_wait_complete()
4746 mpi3mr_pel_get_seqnum_post(mrioc, &mrioc->pel_cmds); in mpi3mr_pel_wait_complete()
4751 mrioc->pel_enabled = false; in mpi3mr_pel_wait_complete()
4769 void mpi3mr_pel_get_seqnum_complete(struct mpi3mr_ioc *mrioc, in mpi3mr_pel_get_seqnum_complete() argument
4777 pel_seqnum_virt = (struct mpi3_pel_seq *)mrioc->pel_seqnum_virt; in mpi3mr_pel_get_seqnum_complete()
4784 dprint_bsg_err(mrioc, in mpi3mr_pel_get_seqnum_complete()
4793 dprint_bsg_err(mrioc, in mpi3mr_pel_get_seqnum_complete()
4799 dprint_bsg_err(mrioc, in mpi3mr_pel_get_seqnum_complete()
4808 dprint_bsg_err(mrioc, in mpi3mr_pel_get_seqnum_complete()
4811 mpi3mr_pel_get_seqnum_post(mrioc, drv_cmd); in mpi3mr_pel_get_seqnum_complete()
4815 dprint_bsg_err(mrioc, in mpi3mr_pel_get_seqnum_complete()
4820 mrioc->pel_newest_seqnum = le32_to_cpu(pel_seqnum_virt->newest) + 1; in mpi3mr_pel_get_seqnum_complete()
4822 mpi3mr_pel_wait_post(mrioc, drv_cmd); in mpi3mr_pel_get_seqnum_complete()
4826 mrioc->pel_enabled = false; in mpi3mr_pel_get_seqnum_complete()
4854 int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc, in mpi3mr_soft_reset_handler() argument
4862 dprint_reset(mrioc, in mpi3mr_soft_reset_handler()
4864 mrioc->diagsave_timeout); in mpi3mr_soft_reset_handler()
4865 while (mrioc->diagsave_timeout) in mpi3mr_soft_reset_handler()
4871 dprint_reset(mrioc, "soft_reset_handler: acquiring reset_mutex\n"); in mpi3mr_soft_reset_handler()
4872 if (!mutex_trylock(&mrioc->reset_mutex)) { in mpi3mr_soft_reset_handler()
4873 ioc_info(mrioc, in mpi3mr_soft_reset_handler()
4878 } while (mrioc->reset_in_progress == 1); in mpi3mr_soft_reset_handler()
4879 ioc_info(mrioc, in mpi3mr_soft_reset_handler()
4881 mrioc->prev_reset_result, in mpi3mr_soft_reset_handler()
4883 return mrioc->prev_reset_result; in mpi3mr_soft_reset_handler()
4885 ioc_info(mrioc, "controller reset is triggered by %s\n", in mpi3mr_soft_reset_handler()
4888 mrioc->device_refresh_on = 0; in mpi3mr_soft_reset_handler()
4889 mrioc->reset_in_progress = 1; in mpi3mr_soft_reset_handler()
4890 mrioc->stop_bsgs = 1; in mpi3mr_soft_reset_handler()
4891 mrioc->prev_reset_result = -1; in mpi3mr_soft_reset_handler()
4897 mrioc->event_masks[i] = -1; in mpi3mr_soft_reset_handler()
4899 dprint_reset(mrioc, "soft_reset_handler: masking events\n"); in mpi3mr_soft_reset_handler()
4900 mpi3mr_issue_event_notification(mrioc); in mpi3mr_soft_reset_handler()
4903 mpi3mr_wait_for_host_io(mrioc, MPI3MR_RESET_HOST_IOWAIT_TIMEOUT); in mpi3mr_soft_reset_handler()
4905 mpi3mr_ioc_disable_intr(mrioc); in mpi3mr_soft_reset_handler()
4908 mpi3mr_set_diagsave(mrioc); in mpi3mr_soft_reset_handler()
4909 retval = mpi3mr_issue_reset(mrioc, in mpi3mr_soft_reset_handler()
4914 readl(&mrioc->sysif_regs->host_diagnostic); in mpi3mr_soft_reset_handler()
4923 retval = mpi3mr_issue_reset(mrioc, in mpi3mr_soft_reset_handler()
4926 ioc_err(mrioc, "Failed to issue soft reset to the ioc\n"); in mpi3mr_soft_reset_handler()
4929 if (mrioc->num_io_throttle_group != in mpi3mr_soft_reset_handler()
4930 mrioc->facts.max_io_throttle_group) { in mpi3mr_soft_reset_handler()
4931 ioc_err(mrioc, in mpi3mr_soft_reset_handler()
4933 mrioc->num_io_throttle_group, in mpi3mr_soft_reset_handler()
4934 mrioc->facts.max_io_throttle_group); in mpi3mr_soft_reset_handler()
4939 mpi3mr_flush_delayed_cmd_lists(mrioc); in mpi3mr_soft_reset_handler()
4940 mpi3mr_flush_drv_cmds(mrioc); in mpi3mr_soft_reset_handler()
4941 bitmap_clear(mrioc->devrem_bitmap, 0, MPI3MR_NUM_DEVRMCMD); in mpi3mr_soft_reset_handler()
4942 bitmap_clear(mrioc->removepend_bitmap, 0, in mpi3mr_soft_reset_handler()
4943 mrioc->dev_handle_bitmap_bits); in mpi3mr_soft_reset_handler()
4944 bitmap_clear(mrioc->evtack_cmds_bitmap, 0, MPI3MR_NUM_EVTACKCMD); in mpi3mr_soft_reset_handler()
4945 mpi3mr_flush_host_io(mrioc); in mpi3mr_soft_reset_handler()
4946 mpi3mr_cleanup_fwevt_list(mrioc); in mpi3mr_soft_reset_handler()
4947 mpi3mr_invalidate_devhandles(mrioc); in mpi3mr_soft_reset_handler()
4948 mpi3mr_free_enclosure_list(mrioc); in mpi3mr_soft_reset_handler()
4950 if (mrioc->prepare_for_reset) { in mpi3mr_soft_reset_handler()
4951 mrioc->prepare_for_reset = 0; in mpi3mr_soft_reset_handler()
4952 mrioc->prepare_for_reset_timeout_counter = 0; in mpi3mr_soft_reset_handler()
4954 mpi3mr_memset_buffers(mrioc); in mpi3mr_soft_reset_handler()
4955 retval = mpi3mr_reinit_ioc(mrioc, 0); in mpi3mr_soft_reset_handler()
4958 mrioc->name, reset_reason); in mpi3mr_soft_reset_handler()
4965 mrioc->diagsave_timeout = 0; in mpi3mr_soft_reset_handler()
4966 mrioc->reset_in_progress = 0; in mpi3mr_soft_reset_handler()
4967 mrioc->pel_abort_requested = 0; in mpi3mr_soft_reset_handler()
4968 if (mrioc->pel_enabled) { in mpi3mr_soft_reset_handler()
4969 mrioc->pel_cmds.retry_count = 0; in mpi3mr_soft_reset_handler()
4970 mpi3mr_pel_wait_post(mrioc, &mrioc->pel_cmds); in mpi3mr_soft_reset_handler()
4973 mrioc->device_refresh_on = 0; in mpi3mr_soft_reset_handler()
4975 mrioc->ts_update_counter = 0; in mpi3mr_soft_reset_handler()
4976 spin_lock_irqsave(&mrioc->watchdog_lock, flags); in mpi3mr_soft_reset_handler()
4977 if (mrioc->watchdog_work_q) in mpi3mr_soft_reset_handler()
4978 queue_delayed_work(mrioc->watchdog_work_q, in mpi3mr_soft_reset_handler()
4979 &mrioc->watchdog_work, in mpi3mr_soft_reset_handler()
4981 spin_unlock_irqrestore(&mrioc->watchdog_lock, flags); in mpi3mr_soft_reset_handler()
4982 mrioc->stop_bsgs = 0; in mpi3mr_soft_reset_handler()
4983 if (mrioc->pel_enabled) in mpi3mr_soft_reset_handler()
4986 mpi3mr_issue_reset(mrioc, in mpi3mr_soft_reset_handler()
4988 mrioc->device_refresh_on = 0; in mpi3mr_soft_reset_handler()
4989 mrioc->unrecoverable = 1; in mpi3mr_soft_reset_handler()
4990 mrioc->reset_in_progress = 0; in mpi3mr_soft_reset_handler()
4992 mpi3mr_flush_cmds_for_unrecovered_controller(mrioc); in mpi3mr_soft_reset_handler()
4994 mrioc->prev_reset_result = retval; in mpi3mr_soft_reset_handler()
4995 mutex_unlock(&mrioc->reset_mutex); in mpi3mr_soft_reset_handler()
4996 ioc_info(mrioc, "controller reset is %s\n", in mpi3mr_soft_reset_handler()
5013 static void mpi3mr_free_config_dma_memory(struct mpi3mr_ioc *mrioc, in mpi3mr_free_config_dma_memory() argument
5016 if ((mem_desc->size > mrioc->cfg_page_sz) && mem_desc->addr) { in mpi3mr_free_config_dma_memory()
5017 dma_free_coherent(&mrioc->pdev->dev, mem_desc->size, in mpi3mr_free_config_dma_memory()
5034 static int mpi3mr_alloc_config_dma_memory(struct mpi3mr_ioc *mrioc, in mpi3mr_alloc_config_dma_memory() argument
5037 if (mem_desc->size > mrioc->cfg_page_sz) { in mpi3mr_alloc_config_dma_memory()
5038 mem_desc->addr = dma_alloc_coherent(&mrioc->pdev->dev, in mpi3mr_alloc_config_dma_memory()
5043 mem_desc->addr = mrioc->cfg_page; in mpi3mr_alloc_config_dma_memory()
5044 mem_desc->dma_addr = mrioc->cfg_page_dma; in mpi3mr_alloc_config_dma_memory()
5045 memset(mem_desc->addr, 0, mrioc->cfg_page_sz); in mpi3mr_alloc_config_dma_memory()
5067 static int mpi3mr_post_cfg_req(struct mpi3mr_ioc *mrioc, in mpi3mr_post_cfg_req() argument
5072 mutex_lock(&mrioc->cfg_cmds.mutex); in mpi3mr_post_cfg_req()
5073 if (mrioc->cfg_cmds.state & MPI3MR_CMD_PENDING) { in mpi3mr_post_cfg_req()
5075 ioc_err(mrioc, "sending config request failed due to command in use\n"); in mpi3mr_post_cfg_req()
5076 mutex_unlock(&mrioc->cfg_cmds.mutex); in mpi3mr_post_cfg_req()
5079 mrioc->cfg_cmds.state = MPI3MR_CMD_PENDING; in mpi3mr_post_cfg_req()
5080 mrioc->cfg_cmds.is_waiting = 1; in mpi3mr_post_cfg_req()
5081 mrioc->cfg_cmds.callback = NULL; in mpi3mr_post_cfg_req()
5082 mrioc->cfg_cmds.ioc_status = 0; in mpi3mr_post_cfg_req()
5083 mrioc->cfg_cmds.ioc_loginfo = 0; in mpi3mr_post_cfg_req()
5088 init_completion(&mrioc->cfg_cmds.done); in mpi3mr_post_cfg_req()
5089 dprint_cfg_info(mrioc, "posting config request\n"); in mpi3mr_post_cfg_req()
5090 if (mrioc->logging_level & MPI3_DEBUG_CFG_INFO) in mpi3mr_post_cfg_req()
5093 retval = mpi3mr_admin_request_post(mrioc, cfg_req, sizeof(*cfg_req), 1); in mpi3mr_post_cfg_req()
5095 ioc_err(mrioc, "posting config request failed\n"); in mpi3mr_post_cfg_req()
5098 wait_for_completion_timeout(&mrioc->cfg_cmds.done, (timeout * HZ)); in mpi3mr_post_cfg_req()
5099 if (!(mrioc->cfg_cmds.state & MPI3MR_CMD_COMPLETE)) { in mpi3mr_post_cfg_req()
5100 mpi3mr_check_rh_fault_ioc(mrioc, in mpi3mr_post_cfg_req()
5102 ioc_err(mrioc, "config request timed out\n"); in mpi3mr_post_cfg_req()
5106 *ioc_status = mrioc->cfg_cmds.ioc_status & MPI3_IOCSTATUS_STATUS_MASK; in mpi3mr_post_cfg_req()
5108 dprint_cfg_err(mrioc, in mpi3mr_post_cfg_req()
5110 *ioc_status, mrioc->cfg_cmds.ioc_loginfo); in mpi3mr_post_cfg_req()
5113 mrioc->cfg_cmds.state = MPI3MR_CMD_NOTUSED; in mpi3mr_post_cfg_req()
5114 mutex_unlock(&mrioc->cfg_cmds.mutex); in mpi3mr_post_cfg_req()
5156 static int mpi3mr_process_cfg_req(struct mpi3mr_ioc *mrioc, in mpi3mr_process_cfg_req() argument
5172 …ioc_err(mrioc, "null config header passed for config action(%d), page_type(0x%02x), page_num(%d)\n… in mpi3mr_process_cfg_req()
5195 ioc_err(mrioc, in mpi3mr_process_cfg_req()
5205 if (mpi3mr_alloc_config_dma_memory(mrioc, &mem_desc)) in mpi3mr_process_cfg_req()
5215 dprint_cfg_info(mrioc, "config buffer to be written\n"); in mpi3mr_process_cfg_req()
5216 if (mrioc->logging_level & MPI3_DEBUG_CFG_INFO) in mpi3mr_process_cfg_req()
5220 if (mpi3mr_post_cfg_req(mrioc, cfg_req, timeout, ioc_status)) in mpi3mr_process_cfg_req()
5229 dprint_cfg_info(mrioc, "config buffer read\n"); in mpi3mr_process_cfg_req()
5230 if (mrioc->logging_level & MPI3_DEBUG_CFG_INFO) in mpi3mr_process_cfg_req()
5235 mpi3mr_free_config_dma_memory(mrioc, &mem_desc); in mpi3mr_process_cfg_req()
5256 int mpi3mr_cfg_get_dev_pg0(struct mpi3mr_ioc *mrioc, u16 *ioc_status, in mpi3mr_cfg_get_dev_pg0() argument
5273 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_dev_pg0()
5275 ioc_err(mrioc, "device page0 header read failed\n"); in mpi3mr_cfg_get_dev_pg0()
5279 ioc_err(mrioc, "device page0 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_dev_pg0()
5287 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_dev_pg0()
5289 ioc_err(mrioc, "device page0 read failed\n"); in mpi3mr_cfg_get_dev_pg0()
5315 int mpi3mr_cfg_get_sas_phy_pg0(struct mpi3mr_ioc *mrioc, u16 *ioc_status, in mpi3mr_cfg_get_sas_phy_pg0() argument
5333 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_sas_phy_pg0()
5335 ioc_err(mrioc, "sas phy page0 header read failed\n"); in mpi3mr_cfg_get_sas_phy_pg0()
5339 ioc_err(mrioc, "sas phy page0 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_sas_phy_pg0()
5347 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_sas_phy_pg0()
5349 ioc_err(mrioc, "sas phy page0 read failed\n"); in mpi3mr_cfg_get_sas_phy_pg0()
5374 int mpi3mr_cfg_get_sas_phy_pg1(struct mpi3mr_ioc *mrioc, u16 *ioc_status, in mpi3mr_cfg_get_sas_phy_pg1() argument
5392 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_sas_phy_pg1()
5394 ioc_err(mrioc, "sas phy page1 header read failed\n"); in mpi3mr_cfg_get_sas_phy_pg1()
5398 ioc_err(mrioc, "sas phy page1 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_sas_phy_pg1()
5406 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_sas_phy_pg1()
5408 ioc_err(mrioc, "sas phy page1 read failed\n"); in mpi3mr_cfg_get_sas_phy_pg1()
5434 int mpi3mr_cfg_get_sas_exp_pg0(struct mpi3mr_ioc *mrioc, u16 *ioc_status, in mpi3mr_cfg_get_sas_exp_pg0() argument
5452 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_sas_exp_pg0()
5454 ioc_err(mrioc, "expander page0 header read failed\n"); in mpi3mr_cfg_get_sas_exp_pg0()
5458 ioc_err(mrioc, "expander page0 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_sas_exp_pg0()
5467 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_sas_exp_pg0()
5469 ioc_err(mrioc, "expander page0 read failed\n"); in mpi3mr_cfg_get_sas_exp_pg0()
5494 int mpi3mr_cfg_get_sas_exp_pg1(struct mpi3mr_ioc *mrioc, u16 *ioc_status, in mpi3mr_cfg_get_sas_exp_pg1() argument
5512 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_sas_exp_pg1()
5514 ioc_err(mrioc, "expander page1 header read failed\n"); in mpi3mr_cfg_get_sas_exp_pg1()
5518 ioc_err(mrioc, "expander page1 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_sas_exp_pg1()
5527 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_sas_exp_pg1()
5529 ioc_err(mrioc, "expander page1 read failed\n"); in mpi3mr_cfg_get_sas_exp_pg1()
5554 int mpi3mr_cfg_get_enclosure_pg0(struct mpi3mr_ioc *mrioc, u16 *ioc_status, in mpi3mr_cfg_get_enclosure_pg0() argument
5572 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_enclosure_pg0()
5574 ioc_err(mrioc, "enclosure page0 header read failed\n"); in mpi3mr_cfg_get_enclosure_pg0()
5578 ioc_err(mrioc, "enclosure page0 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_enclosure_pg0()
5586 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_enclosure_pg0()
5588 ioc_err(mrioc, "enclosure page0 read failed\n"); in mpi3mr_cfg_get_enclosure_pg0()
5609 int mpi3mr_cfg_get_sas_io_unit_pg0(struct mpi3mr_ioc *mrioc, in mpi3mr_cfg_get_sas_io_unit_pg0() argument
5626 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_sas_io_unit_pg0()
5628 ioc_err(mrioc, "sas io unit page0 header read failed\n"); in mpi3mr_cfg_get_sas_io_unit_pg0()
5632 ioc_err(mrioc, "sas io unit page0 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_sas_io_unit_pg0()
5638 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_sas_io_unit_pg0()
5640 ioc_err(mrioc, "sas io unit page0 read failed\n"); in mpi3mr_cfg_get_sas_io_unit_pg0()
5644 ioc_err(mrioc, "sas io unit page0 read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_sas_io_unit_pg0()
5665 int mpi3mr_cfg_get_sas_io_unit_pg1(struct mpi3mr_ioc *mrioc, in mpi3mr_cfg_get_sas_io_unit_pg1() argument
5682 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_sas_io_unit_pg1()
5684 ioc_err(mrioc, "sas io unit page1 header read failed\n"); in mpi3mr_cfg_get_sas_io_unit_pg1()
5688 ioc_err(mrioc, "sas io unit page1 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_sas_io_unit_pg1()
5694 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_sas_io_unit_pg1()
5696 ioc_err(mrioc, "sas io unit page1 read failed\n"); in mpi3mr_cfg_get_sas_io_unit_pg1()
5700 ioc_err(mrioc, "sas io unit page1 read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_sas_io_unit_pg1()
5722 int mpi3mr_cfg_set_sas_io_unit_pg1(struct mpi3mr_ioc *mrioc, in mpi3mr_cfg_set_sas_io_unit_pg1() argument
5738 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_set_sas_io_unit_pg1()
5740 ioc_err(mrioc, "sas io unit page1 header read failed\n"); in mpi3mr_cfg_set_sas_io_unit_pg1()
5744 ioc_err(mrioc, "sas io unit page1 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_set_sas_io_unit_pg1()
5750 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_set_sas_io_unit_pg1()
5752 ioc_err(mrioc, "sas io unit page1 write current failed\n"); in mpi3mr_cfg_set_sas_io_unit_pg1()
5756 ioc_err(mrioc, "sas io unit page1 write current failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_set_sas_io_unit_pg1()
5763 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_set_sas_io_unit_pg1()
5765 ioc_err(mrioc, "sas io unit page1 write persistent failed\n"); in mpi3mr_cfg_set_sas_io_unit_pg1()
5769 ioc_err(mrioc, "sas io unit page1 write persistent failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_set_sas_io_unit_pg1()
5790 int mpi3mr_cfg_get_driver_pg1(struct mpi3mr_ioc *mrioc, in mpi3mr_cfg_get_driver_pg1() argument
5807 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, NULL, in mpi3mr_cfg_get_driver_pg1()
5809 ioc_err(mrioc, "driver page1 header read failed\n"); in mpi3mr_cfg_get_driver_pg1()
5813 ioc_err(mrioc, "driver page1 header read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_driver_pg1()
5819 if (mpi3mr_process_cfg_req(mrioc, &cfg_req, &cfg_hdr, in mpi3mr_cfg_get_driver_pg1()
5821 ioc_err(mrioc, "driver page1 read failed\n"); in mpi3mr_cfg_get_driver_pg1()
5825 ioc_err(mrioc, "driver page1 read failed with ioc_status(0x%04x)\n", in mpi3mr_cfg_get_driver_pg1()