Lines Matching refs:cmd

288 megasas_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)  in megasas_attach()  argument
327 switch (cmd) { in megasas_attach()
696 "megasas: invalid attach cmd=%x", cmd)); in megasas_attach()
760 megasas_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **resultp) in megasas_getinfo() argument
769 switch (cmd) { in megasas_getinfo()
809 megasas_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) in megasas_detach() argument
838 switch (cmd) { in megasas_detach()
891 "invalid detach command:0x%x", cmd)); in megasas_detach()
992 megasas_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, in megasas_ioctl() argument
1011 switch ((uint_t)cmd) { in megasas_ioctl()
1053 rval = scsi_hba_ioctl(dev, cmd, arg, in megasas_ioctl()
1079 megasas_reset(dev_info_t *dip, ddi_reset_cmd_t cmd) in megasas_reset() argument
1251 struct megasas_cmd *cmd; in megasas_tran_start() local
1259 cmd = build_cmd(instance, ap, pkt, &cmd_done); in megasas_tran_start()
1277 if (cmd == NULL) { in megasas_tran_start()
1284 return_mfi_pkt(instance, cmd); in megasas_tran_start()
1289 (void) ddi_dma_sync(cmd->frame_dma_obj.dma_handle, 0, 0, in megasas_tran_start()
1292 instance->func_ptr->issue_cmd(cmd, instance); in megasas_tran_start()
1295 struct megasas_header *hdr = &cmd->frame->hdr; in megasas_tran_start()
1297 cmd->sync_cmd = MEGASAS_TRUE; in megasas_tran_start()
1299 instance->func_ptr-> issue_cmd_in_poll_mode(instance, cmd); in megasas_tran_start()
1327 return_mfi_pkt(instance, cmd); in megasas_tran_start()
1328 (void) megasas_common_check(instance, cmd); in megasas_tran_start()
1695 struct megasas_cmd *cmd; in megasas_isr() local
1724 cmd = instance->cmd_list[context]; in megasas_isr()
1725 mlist_add_tail(&cmd->list, &instance->completed_pool_list); in megasas_isr()
1775 struct megasas_cmd *cmd = NULL; in get_mfi_pkt() local
1781 cmd = mlist_entry(head->next, struct megasas_cmd, list); in get_mfi_pkt()
1784 if (cmd != NULL) in get_mfi_pkt()
1785 cmd->pkt = NULL; in get_mfi_pkt()
1788 return (cmd); in get_mfi_pkt()
1795 return_mfi_pkt(struct megasas_instance *instance, struct megasas_cmd *cmd) in return_mfi_pkt() argument
1800 mlist_add(&cmd->list, &instance->cmd_pool_list); in return_mfi_pkt()
1814 struct megasas_cmd *cmd; in destroy_mfi_frame_pool() local
1819 cmd = instance->cmd_list[i]; in destroy_mfi_frame_pool()
1821 if (cmd->frame_dma_obj_status == DMA_OBJ_ALLOCATED) in destroy_mfi_frame_pool()
1822 (void) mega_free_dma_obj(instance, cmd->frame_dma_obj); in destroy_mfi_frame_pool()
1824 cmd->frame_dma_obj_status = DMA_OBJ_FREED; in destroy_mfi_frame_pool()
1842 struct megasas_cmd *cmd; in create_mfi_frame_pool() local
1856 cmd = instance->cmd_list[i]; in create_mfi_frame_pool()
1858 cmd->frame_dma_obj.size = tot_frame_size; in create_mfi_frame_pool()
1859 cmd->frame_dma_obj.dma_attr = megasas_generic_dma_attr; in create_mfi_frame_pool()
1860 cmd->frame_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU; in create_mfi_frame_pool()
1861 cmd->frame_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU; in create_mfi_frame_pool()
1862 cmd->frame_dma_obj.dma_attr.dma_attr_sgllen = 1; in create_mfi_frame_pool()
1863 cmd->frame_dma_obj.dma_attr.dma_attr_align = 64; in create_mfi_frame_pool()
1866 cookie_cnt = mega_alloc_dma_obj(instance, &cmd->frame_dma_obj); in create_mfi_frame_pool()
1874 bzero(cmd->frame_dma_obj.buffer, tot_frame_size); in create_mfi_frame_pool()
1876 cmd->frame_dma_obj_status = DMA_OBJ_ALLOCATED; in create_mfi_frame_pool()
1877 cmd->frame = (union megasas_frame *)cmd->frame_dma_obj.buffer; in create_mfi_frame_pool()
1878 cmd->frame_phys_addr = in create_mfi_frame_pool()
1879 cmd->frame_dma_obj.dma_cookie[0].dmac_address; in create_mfi_frame_pool()
1881 cmd->sense = (uint8_t *)(((unsigned long) in create_mfi_frame_pool()
1882 cmd->frame_dma_obj.buffer) + in create_mfi_frame_pool()
1884 cmd->sense_phys_addr = in create_mfi_frame_pool()
1885 cmd->frame_dma_obj.dma_cookie[0].dmac_address + in create_mfi_frame_pool()
1888 if (!cmd->frame || !cmd->sense) { in create_mfi_frame_pool()
1895 cmd->frame->io.context = cmd->index; in create_mfi_frame_pool()
1899 cmd->frame->io.context, cmd->frame_phys_addr)); in create_mfi_frame_pool()
2035 struct megasas_cmd *cmd; in alloc_space_for_mfi() local
2058 cmd = instance->cmd_list[i]; in alloc_space_for_mfi()
2059 cmd->index = i; in alloc_space_for_mfi()
2061 mlist_add_tail(&cmd->list, &instance->cmd_pool_list); in alloc_space_for_mfi()
2088 struct megasas_cmd *cmd; in get_ctrl_info() local
2092 cmd = get_mfi_pkt(instance); in get_ctrl_info()
2094 if (!cmd) { in get_ctrl_info()
2100 dcmd = &cmd->frame->dcmd; in get_ctrl_info()
2107 return_mfi_pkt(instance, cmd); in get_ctrl_info()
2116 dcmd->cmd = MFI_CMD_OP_DCMD; in get_ctrl_info()
2126 cmd->frame_count = 1; in get_ctrl_info()
2128 if (!instance->func_ptr->issue_cmd_in_poll_mode(instance, cmd)) { in get_ctrl_info()
2136 return_mfi_pkt(instance, cmd); in get_ctrl_info()
2137 if (megasas_common_check(instance, cmd) != DDI_SUCCESS) { in get_ctrl_info()
2153 struct megasas_cmd *cmd; in abort_aen_cmd() local
2156 cmd = get_mfi_pkt(instance); in abort_aen_cmd()
2158 if (!cmd) { in abort_aen_cmd()
2164 abort_fr = &cmd->frame->abort; in abort_aen_cmd()
2167 abort_fr->cmd = MFI_CMD_OP_ABORT; in abort_aen_cmd()
2176 cmd->sync_cmd = MEGASAS_TRUE; in abort_aen_cmd()
2177 cmd->frame_count = 1; in abort_aen_cmd()
2179 if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) { in abort_aen_cmd()
2190 return_mfi_pkt(instance, cmd); in abort_aen_cmd()
2191 (void) megasas_common_check(instance, cmd); in abort_aen_cmd()
2203 struct megasas_cmd *cmd; in init_mfi() local
2264 cmd = get_mfi_pkt(instance); in init_mfi()
2266 init_frame = (struct megasas_init_frame *)cmd->frame; in init_mfi()
2289 init_frame->cmd = MFI_CMD_OP_INIT; in init_mfi()
2293 cmd->frame_phys_addr + 64; in init_mfi()
2298 cmd->frame_count = 1; in init_mfi()
2301 if (instance->func_ptr->issue_cmd_in_poll_mode(instance, cmd)) { in init_mfi()
2306 return_mfi_pkt(instance, cmd); in init_mfi()
2307 if (megasas_common_check(instance, cmd) != DDI_SUCCESS) { in init_mfi()
2492 struct megasas_cmd *cmd; in get_seq_num() local
2495 cmd = get_mfi_pkt(instance); in get_seq_num()
2497 if (!cmd) { in get_seq_num()
2502 dcmd = &cmd->frame->dcmd; in get_seq_num()
2523 dcmd->cmd = MFI_CMD_OP_DCMD; in get_seq_num()
2533 cmd->sync_cmd = MEGASAS_TRUE; in get_seq_num()
2534 cmd->frame_count = 1; in get_seq_num()
2536 if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) { in get_seq_num()
2550 return_mfi_pkt(instance, cmd); in get_seq_num()
2551 if (megasas_common_check(instance, cmd) != DDI_SUCCESS) { in get_seq_num()
2598 struct megasas_cmd *cmd; in flush_cache() local
2601 if (!(cmd = get_mfi_pkt(instance))) in flush_cache()
2604 dcmd = &cmd->frame->dcmd; in flush_cache()
2608 dcmd->cmd = MFI_CMD_OP_DCMD; in flush_cache()
2617 cmd->frame_count = 1; in flush_cache()
2619 if (instance->func_ptr->issue_cmd_in_poll_mode(instance, cmd)) { in flush_cache()
2624 return_mfi_pkt(instance, cmd); in flush_cache()
2625 (void) megasas_common_check(instance, cmd); in flush_cache()
2635 service_mfi_aen(struct megasas_instance *instance, struct megasas_cmd *cmd) in service_mfi_aen() argument
2641 cmd->cmd_status = cmd->frame->io.cmd_status; in service_mfi_aen()
2643 if (cmd->cmd_status == ENODATA) { in service_mfi_aen()
2644 cmd->cmd_status = 0; in service_mfi_aen()
2664 cmd->frame->dcmd.cmd_status = 0x0; in service_mfi_aen()
2665 cmd->frame->dcmd.mbox.w[0] = seq_num; in service_mfi_aen()
2669 cmd->frame_count = 1; in service_mfi_aen()
2672 instance->func_ptr->issue_cmd(cmd, instance); in service_mfi_aen()
2686 struct megasas_cmd *cmd) in complete_cmd_in_sync_mode() argument
2688 cmd->cmd_status = cmd->frame->io.cmd_status; in complete_cmd_in_sync_mode()
2690 cmd->sync_cmd = MEGASAS_FALSE; in complete_cmd_in_sync_mode()
2692 if (cmd->cmd_status == ENODATA) { in complete_cmd_in_sync_mode()
2693 cmd->cmd_status = 0; in complete_cmd_in_sync_mode()
2711 struct megasas_cmd *cmd; in megasas_softintr() local
2737 cmd = mlist_entry(pos, struct megasas_cmd, list); in megasas_softintr()
2740 (void) ddi_dma_sync(cmd->frame_dma_obj.dma_handle, in megasas_softintr()
2743 if (megasas_check_dma_handle(cmd->frame_dma_obj.dma_handle) != in megasas_softintr()
2750 hdr = &cmd->frame->hdr; in megasas_softintr()
2753 mlist_del_init(&cmd->list); in megasas_softintr()
2755 switch (hdr->cmd) { in megasas_softintr()
2766 if (cmd->sync_cmd == MEGASAS_TRUE) { in megasas_softintr()
2767 complete_cmd_in_sync_mode(instance, cmd); in megasas_softintr()
2772 acmd = cmd->cmd; in megasas_softintr()
2861 bcopy(cmd->sense, in megasas_softintr()
2914 return_mfi_pkt(instance, cmd); in megasas_softintr()
2916 (void) megasas_common_check(instance, cmd); in megasas_softintr()
2936 complete_cmd_in_sync_mode(instance, cmd); in megasas_softintr()
2940 if (cmd->frame->dcmd.opcode == in megasas_softintr()
2942 if ((instance->aen_cmd == cmd) && in megasas_softintr()
2948 service_mfi_aen(instance, cmd); in megasas_softintr()
2954 complete_cmd_in_sync_mode(instance, cmd); in megasas_softintr()
2964 complete_cmd_in_sync_mode(instance, cmd); in megasas_softintr()
2970 if (cmd->pkt != NULL) { in megasas_softintr()
2971 pkt = cmd->pkt; in megasas_softintr()
3312 struct megasas_cmd *cmd; in build_cmd() local
3324 if (!(cmd = get_mfi_pkt(instance))) { in build_cmd()
3328 cmd->pkt = pkt; in build_cmd()
3329 cmd->cmd = acmd; in build_cmd()
3370 ldio = (struct megasas_io_frame *)cmd->frame; in build_cmd()
3376 ldio->cmd = (pkt->pkt_cdbp[0] & 0x02) ? in build_cmd()
3387 bzero(cmd->sense, SENSE_LENGTH); in build_cmd()
3390 ldio->sense_buf_phys_addr_lo = cmd->sense_phys_addr; in build_cmd()
3454 pthru = (struct megasas_pthru_frame *)cmd->frame; in build_cmd()
3457 pthru->cmd = (acmd->islogical) ? in build_cmd()
3470 bzero(cmd->sense, SENSE_LENGTH); in build_cmd()
3473 pthru->sense_buf_phys_addr_lo = cmd->sense_phys_addr; in build_cmd()
3489 cmd->frame_count = (sge_bytes / MEGAMFI_FRAME_SIZE) + in build_cmd()
3492 if (cmd->frame_count >= 8) { in build_cmd()
3493 cmd->frame_count = 8; in build_cmd()
3496 return (cmd); in build_cmd()
3535 struct megasas_cmd *cmd, int mode) in issue_mfi_pthru() argument
3546 pthru = &cmd->frame->pthru; in issue_mfi_pthru()
3601 pthru->cmd = kpthru->cmd; in issue_mfi_pthru()
3622 cmd->sync_cmd = MEGASAS_TRUE; in issue_mfi_pthru()
3623 cmd->frame_count = 1; in issue_mfi_pthru()
3625 if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) { in issue_mfi_pthru()
3660 struct megasas_cmd *cmd, int mode) in issue_mfi_dcmd() argument
3670 dcmd = &cmd->frame->dcmd; in issue_mfi_dcmd()
3726 dcmd->cmd = kdcmd->cmd; in issue_mfi_dcmd()
3739 cmd->sync_cmd = MEGASAS_TRUE; in issue_mfi_dcmd()
3740 cmd->frame_count = 1; in issue_mfi_dcmd()
3742 if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) { in issue_mfi_dcmd()
3772 struct megasas_cmd *cmd, int mode) in issue_mfi_smp() argument
3788 smp = &cmd->frame->smp; in issue_mfi_smp()
3891 smp->cmd = ksmp->cmd; in issue_mfi_smp()
3944 cmd->sync_cmd = MEGASAS_TRUE; in issue_mfi_smp()
3945 cmd->frame_count = 1; in issue_mfi_smp()
3947 if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) { in issue_mfi_smp()
3999 struct megasas_cmd *cmd, int mode) in issue_mfi_stp() argument
4011 stp = &cmd->frame->stp; in issue_mfi_stp()
4107 stp->cmd = kstp->cmd; in issue_mfi_stp()
4125 cmd->sync_cmd = MEGASAS_TRUE; in issue_mfi_stp()
4126 cmd->frame_count = 1; in issue_mfi_stp()
4128 if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) { in issue_mfi_stp()
4309 struct megasas_cmd *cmd; in handle_mfi_ioctl() local
4311 cmd = get_mfi_pkt(instance); in handle_mfi_ioctl()
4313 if (!cmd) { in handle_mfi_ioctl()
4321 switch (hdr->cmd) { in handle_mfi_ioctl()
4323 rval = issue_mfi_dcmd(instance, ioctl, cmd, mode); in handle_mfi_ioctl()
4326 rval = issue_mfi_smp(instance, ioctl, cmd, mode); in handle_mfi_ioctl()
4329 rval = issue_mfi_stp(instance, ioctl, cmd, mode); in handle_mfi_ioctl()
4333 rval = issue_mfi_pthru(instance, ioctl, cmd, mode); in handle_mfi_ioctl()
4337 "invalid mfi ioctl hdr->cmd = %d\n", hdr->cmd)); in handle_mfi_ioctl()
4343 return_mfi_pkt(instance, cmd); in handle_mfi_ioctl()
4344 if (megasas_common_check(instance, cmd) != DDI_SUCCESS) in handle_mfi_ioctl()
4371 struct megasas_cmd *cmd; in register_mfi_aen() local
4432 cmd = get_mfi_pkt(instance); in register_mfi_aen()
4434 if (!cmd) in register_mfi_aen()
4437 dcmd = &cmd->frame->dcmd; in register_mfi_aen()
4446 dcmd->cmd = MFI_CMD_OP_DCMD; in register_mfi_aen()
4466 instance->aen_cmd = cmd; in register_mfi_aen()
4468 cmd->frame_count = 1; in register_mfi_aen()
4472 instance->func_ptr->issue_cmd(cmd, instance); in register_mfi_aen()
4559 issue_cmd_xscale(struct megasas_cmd *cmd, struct megasas_instance *instance) in issue_cmd_xscale() argument
4564 WR_IB_QPORT((host_to_le32(cmd->frame_phys_addr) >> 3) | in issue_cmd_xscale()
4565 (cmd->frame_count - 1), instance); in issue_cmd_xscale()
4569 issue_cmd_ppc(struct megasas_cmd *cmd, struct megasas_instance *instance) in issue_cmd_ppc() argument
4574 WR_IB_QPORT((host_to_le32(cmd->frame_phys_addr)) | in issue_cmd_ppc()
4575 (((cmd->frame_count - 1) << 1) | 1), instance); in issue_cmd_ppc()
4583 struct megasas_cmd *cmd) in issue_cmd_in_sync_mode_xscale() argument
4588 cmd->cmd_status = ENODATA; in issue_cmd_in_sync_mode_xscale()
4590 WR_IB_QPORT((host_to_le32(cmd->frame_phys_addr) >> 3) | in issue_cmd_in_sync_mode_xscale()
4591 (cmd->frame_count - 1), instance); in issue_cmd_in_sync_mode_xscale()
4595 for (i = 0; i < msecs && (cmd->cmd_status == ENODATA); i++) { in issue_cmd_in_sync_mode_xscale()
4610 struct megasas_cmd *cmd) in issue_cmd_in_sync_mode_ppc() argument
4617 cmd->cmd_status = ENODATA; in issue_cmd_in_sync_mode_ppc()
4619 WR_IB_QPORT((host_to_le32(cmd->frame_phys_addr)) | in issue_cmd_in_sync_mode_ppc()
4620 (((cmd->frame_count - 1) << 1) | 1), instance); in issue_cmd_in_sync_mode_ppc()
4624 for (i = 0; i < msecs && (cmd->cmd_status == ENODATA); i++) { in issue_cmd_in_sync_mode_ppc()
4644 struct megasas_cmd *cmd) in issue_cmd_in_poll_mode_xscale() argument
4650 frame_hdr = (struct megasas_header *)cmd->frame; in issue_cmd_in_poll_mode_xscale()
4655 WR_IB_QPORT((host_to_le32(cmd->frame_phys_addr) >> 3) | in issue_cmd_in_poll_mode_xscale()
4656 (cmd->frame_count - 1), instance); in issue_cmd_in_poll_mode_xscale()
4675 struct megasas_cmd *cmd) in issue_cmd_in_poll_mode_ppc() argument
4683 frame_hdr = (struct megasas_header *)cmd->frame; in issue_cmd_in_poll_mode_ppc()
4688 WR_IB_QPORT((host_to_le32(cmd->frame_phys_addr)) | in issue_cmd_in_poll_mode_ppc()
4689 (((cmd->frame_count - 1) << 1) | 1), instance); in issue_cmd_in_poll_mode_ppc()
4811 struct megasas_cmd *cmd) in megasas_common_check() argument
4815 if (megasas_check_dma_handle(cmd->frame_dma_obj.dma_handle) != in megasas_common_check()
4818 if (cmd->pkt != NULL) { in megasas_common_check()
4819 cmd->pkt->pkt_reason = CMD_TRAN_ERR; in megasas_common_check()
4820 cmd->pkt->pkt_statistics = 0; in megasas_common_check()
4827 if (cmd->pkt != NULL) { in megasas_common_check()
4828 cmd->pkt->pkt_reason = CMD_TRAN_ERR; in megasas_common_check()
4829 cmd->pkt->pkt_statistics = 0; in megasas_common_check()
4836 if (cmd->pkt != NULL) { in megasas_common_check()
4837 cmd->pkt->pkt_reason = CMD_TRAN_ERR; in megasas_common_check()
4838 cmd->pkt->pkt_statistics = 0; in megasas_common_check()
4845 if (cmd->pkt != NULL) { in megasas_common_check()
4846 cmd->pkt->pkt_reason = CMD_TRAN_ERR; in megasas_common_check()
4847 cmd->pkt->pkt_statistics = 0; in megasas_common_check()