Print this page
Code review comments


 534             (instance->request_desc_dma_obj.buffer);
 535 
 536         instance->request_message_pool_phy =
 537             (uint32_t)instance->request_desc_dma_obj.dma_cookie[0].dmac_address;
 538 
 539         return (DDI_SUCCESS);
 540 
 541 fail_undo_reply_queue:
 542         if (instance->reply_desc_dma_obj.status == DMA_OBJ_ALLOCATED) {
 543                 (void) mrsas_free_dma_obj(instance,
 544                     instance->reply_desc_dma_obj);
 545                 instance->reply_desc_dma_obj.status = DMA_OBJ_FREED;
 546         }
 547 
 548         return (DDI_FAILURE);
 549 }
 550 
 551 /*
 552  * mrsas_alloc_cmd_pool_tbolt
 553  *
 554  * TODO: merge tbolt-specific codee into mrsas_alloc_cmd_pool() to have single
 555  * routine
 556  */
 557 int
 558 mrsas_alloc_cmd_pool_tbolt(struct mrsas_instance *instance)
 559 {
 560         int             i;
 561         int             count;
 562         uint32_t        max_cmd;
 563         uint32_t        reserve_cmd;
 564         size_t          sz;
 565 
 566         struct mrsas_cmd        *cmd;
 567 
 568         max_cmd = instance->max_fw_cmds;
 569         con_log(CL_ANN1, (CE_NOTE, "mrsas_alloc_cmd_pool: "
 570             "max_cmd %x", max_cmd));
 571 
 572 
 573         sz = sizeof (struct mrsas_cmd *) * max_cmd;
 574 


2782                                 if (hdr) {
2783                                         con_log(CL_ANN1, (CE_NOTE, "mr_sas_"
2784                                             "tbolt_process_outstanding_cmd:"
2785                                             " mlist_del_init(&cmd->list).\n"));
2786                                         mlist_del_init(&cmd->list);
2787                                 }
2788                         } else {
2789                                 pkt = cmd->pkt;
2790                                 if (pkt) {
2791                                         con_log(CL_ANN1, (CE_NOTE, "mr_sas_"
2792                                             "tbolt_process_outstanding_cmd:"
2793                                             "mlist_del_init(&cmd->list).\n"));
2794                                         mlist_del_init(&cmd->list);
2795                                 }
2796                         }
2797 
2798                         mutex_exit(&instance->cmd_pend_mtx);
2799 
2800                         tbolt_complete_cmd(instance, cmd);
2801                 }
2802                 /* set it back to all 0xfffffffff. */
2803                 desc->Words = (uint64_t)~0;
2804 
2805                 instance->reply_read_index++;
2806 
2807                 if (instance->reply_read_index >= (instance->reply_q_depth)) {
2808                         con_log(CL_ANN1, (CE_NOTE, "wrap around"));
2809                         instance->reply_read_index = 0;
2810                 }
2811 
2812                 /* Get the next reply descriptor */
2813                 if (!instance->reply_read_index)
2814                         desc = instance->reply_frame_pool;
2815                 else
2816                         desc++;
2817 
2818                 replyDesc = (MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR *)desc;
2819 
2820                 d_val.word = desc->Words;
2821 
2822                 con_log(CL_ANN1, (CE_NOTE,
2823                     "Next Reply Desc  = %p Words = %" PRIx64 "\n",




 534             (instance->request_desc_dma_obj.buffer);
 535 
 536         instance->request_message_pool_phy =
 537             (uint32_t)instance->request_desc_dma_obj.dma_cookie[0].dmac_address;
 538 
 539         return (DDI_SUCCESS);
 540 
 541 fail_undo_reply_queue:
 542         if (instance->reply_desc_dma_obj.status == DMA_OBJ_ALLOCATED) {
 543                 (void) mrsas_free_dma_obj(instance,
 544                     instance->reply_desc_dma_obj);
 545                 instance->reply_desc_dma_obj.status = DMA_OBJ_FREED;
 546         }
 547 
 548         return (DDI_FAILURE);
 549 }
 550 
 551 /*
 552  * mrsas_alloc_cmd_pool_tbolt
 553  *
 554  * TODO: merge tbolt-specific code into mrsas_alloc_cmd_pool() to have single
 555  * routine
 556  */
 557 int
 558 mrsas_alloc_cmd_pool_tbolt(struct mrsas_instance *instance)
 559 {
 560         int             i;
 561         int             count;
 562         uint32_t        max_cmd;
 563         uint32_t        reserve_cmd;
 564         size_t          sz;
 565 
 566         struct mrsas_cmd        *cmd;
 567 
 568         max_cmd = instance->max_fw_cmds;
 569         con_log(CL_ANN1, (CE_NOTE, "mrsas_alloc_cmd_pool: "
 570             "max_cmd %x", max_cmd));
 571 
 572 
 573         sz = sizeof (struct mrsas_cmd *) * max_cmd;
 574 


2782                                 if (hdr) {
2783                                         con_log(CL_ANN1, (CE_NOTE, "mr_sas_"
2784                                             "tbolt_process_outstanding_cmd:"
2785                                             " mlist_del_init(&cmd->list).\n"));
2786                                         mlist_del_init(&cmd->list);
2787                                 }
2788                         } else {
2789                                 pkt = cmd->pkt;
2790                                 if (pkt) {
2791                                         con_log(CL_ANN1, (CE_NOTE, "mr_sas_"
2792                                             "tbolt_process_outstanding_cmd:"
2793                                             "mlist_del_init(&cmd->list).\n"));
2794                                         mlist_del_init(&cmd->list);
2795                                 }
2796                         }
2797 
2798                         mutex_exit(&instance->cmd_pend_mtx);
2799 
2800                         tbolt_complete_cmd(instance, cmd);
2801                 }
2802                 /* set it back to all 1s. */
2803                 desc->Words = -1LL;
2804 
2805                 instance->reply_read_index++;
2806 
2807                 if (instance->reply_read_index >= (instance->reply_q_depth)) {
2808                         con_log(CL_ANN1, (CE_NOTE, "wrap around"));
2809                         instance->reply_read_index = 0;
2810                 }
2811 
2812                 /* Get the next reply descriptor */
2813                 if (!instance->reply_read_index)
2814                         desc = instance->reply_frame_pool;
2815                 else
2816                         desc++;
2817 
2818                 replyDesc = (MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR *)desc;
2819 
2820                 d_val.word = desc->Words;
2821 
2822                 con_log(CL_ANN1, (CE_NOTE,
2823                     "Next Reply Desc  = %p Words = %" PRIx64 "\n",