Print this page
Code review comments
        
*** 213,223 ****
          .issue_cmd_in_poll_mode = issue_cmd_in_poll_mode_ppc,
          .enable_intr = enable_intr_ppc,
          .disable_intr = disable_intr_ppc,
          .intr_ack = intr_ack_ppc,
          .init_adapter = mrsas_init_adapter_ppc
- /*      .reset_adapter = mrsas_reset_adapter_ppc */
  };
  
  
  static struct mrsas_function_template mrsas_function_template_fusion = {
          .read_fw_status_reg = tbolt_read_fw_status_reg,
--- 213,222 ----
*** 301,311 ****
  #ifdef __sparc
          ddi_quiesce_not_needed
  #else   /* __sparc */
          mrsas_quiesce   /* quiesce */
  #endif  /* __sparc */
- 
  };
  
  static struct modldrv modldrv = {
          &mod_driverops,         /* module type - driver */
          MRSAS_VERSION,
--- 300,309 ----
*** 323,333 ****
          DDI_STRUCTURE_LE_ACC,
          DDI_STRICTORDER_ACC,
          DDI_DEFAULT_ACC
  };
  
! 
  unsigned int enable_fp = 1;
  
  
  /*
   * ************************************************************************** *
--- 321,331 ----
          DDI_STRUCTURE_LE_ACC,
          DDI_STRICTORDER_ACC,
          DDI_DEFAULT_ACC
  };
  
! /* Use the LSI Fast Path for the 2208 (tbolt) commands. */
  unsigned int enable_fp = 1;
  
  
  /*
   * ************************************************************************** *
*** 511,522 ****
                              "mr_sas%d: Bad soft state", instance_no);
                          ddi_soft_state_free(mrsas_state, instance_no);
                          return (DDI_FAILURE);
                  }
  
-                 bzero(instance, sizeof (struct mrsas_instance));
- 
                  instance->unroll.softs  = 1;
  
                  /* Setup the PCI configuration space handles */
                  if (pci_config_setup(dip, &instance->pci_handle) !=
                      DDI_SUCCESS) {
--- 509,518 ----
*** 525,544 ****
                              instance_no);
  
                          ddi_soft_state_free(mrsas_state, instance_no);
                          return (DDI_FAILURE);
                  }
-                 if (instance->pci_handle == NULL) {
-                         cmn_err(CE_WARN,
-                             "mr_sas%d: pci config setup failed ",
-                             instance_no);
-                         ddi_soft_state_free(mrsas_state, instance_no);
-                         return (DDI_FAILURE);
-                 }
  
- 
- 
                  if (ddi_dev_nregs(dip, &nregs) != DDI_SUCCESS) {
                          cmn_err(CE_WARN,
                              "mr_sas: failed to get registers.");
  
                          pci_config_teardown(&instance->pci_handle);
--- 521,531 ----
*** 652,666 ****
                      != DDI_SUCCESS) {
                          cmn_err(CE_WARN,
                              "mr_sas: couldn't map control registers");
                          goto fail_attach;
                  }
-                 if (instance->regmap_handle == NULL) {
-                         cmn_err(CE_WARN,
-                             "mr_sas: couldn't map control registers");
-                         goto fail_attach;
-                 }
  
                  instance->unroll.regs = 1;
  
                  /*
                   * Disable Interrupt Now.
--- 639,648 ----
*** 1243,1253 ****
                          cmn_err(CE_WARN, "mrsas_detach: "
                              "failed to abort prevous AEN command");
  
                  instance->unroll.aenPend = 0;
                  con_log(CL_ANN1, (CE_CONT, "aen cmd aborted, done."));
!                 /* This means the controller is fully initialzed and running */
                  /* Shutdown should be a last command to controller. */
                  /* shutdown_controller(); */
          }
  
  
--- 1225,1235 ----
                          cmn_err(CE_WARN, "mrsas_detach: "
                              "failed to abort prevous AEN command");
  
                  instance->unroll.aenPend = 0;
                  con_log(CL_ANN1, (CE_CONT, "aen cmd aborted, done."));
!                 /* This means the controller is fully initialized and running */
                  /* Shutdown should be a last command to controller. */
                  /* shutdown_controller(); */
          }
  
  
*** 1472,1482 ****
              KM_SLEEP);
          if (ioctl == NULL) {
                  /* Failed to allocate memory for ioctl  */
                  con_log(CL_ANN, (CE_WARN, "mr_sas_ioctl: "
                      "failed to allocate memory for ioctl"));
!                 return (ENXIO);
          }
  
          switch ((uint_t)cmd) {
                  case MRSAS_IOCTL_FIRMWARE:
                          if (ddi_copyin((void *)arg, ioctl,
--- 1454,1464 ----
              KM_SLEEP);
          if (ioctl == NULL) {
                  /* Failed to allocate memory for ioctl  */
                  con_log(CL_ANN, (CE_WARN, "mr_sas_ioctl: "
                      "failed to allocate memory for ioctl"));
!                 return (ENOMEM);
          }
  
          switch ((uint_t)cmd) {
                  case MRSAS_IOCTL_FIRMWARE:
                          if (ddi_copyin((void *)arg, ioctl,
*** 2546,2556 ****
  {
          mlist_t                 *head = &instance->cmd_pool_list;
          struct mrsas_cmd        *cmd = NULL;
  
          mutex_enter(&instance->cmd_pool_mtx);
-         ASSERT(mutex_owned(&instance->cmd_pool_mtx));
  
          if (!mlist_empty(head)) {
                  cmd = mlist_entry(head->next, struct mrsas_cmd, list);
                  mlist_del_init(head->next);
          }
--- 2528,2537 ----
*** 2570,2580 ****
  {
          mlist_t                         *head = &instance->app_cmd_pool_list;
          struct mrsas_cmd        *cmd = NULL;
  
          mutex_enter(&instance->app_cmd_pool_mtx);
-         ASSERT(mutex_owned(&instance->app_cmd_pool_mtx));
  
          if (!mlist_empty(head)) {
                  cmd = mlist_entry(head->next, struct mrsas_cmd, list);
                  mlist_del_init(head->next);
          }
--- 2551,2560 ----
*** 2593,2603 ****
   */
  static void
  return_mfi_pkt(struct mrsas_instance *instance, struct mrsas_cmd *cmd)
  {
          mutex_enter(&instance->cmd_pool_mtx);
-         ASSERT(mutex_owned(&instance->cmd_pool_mtx));
          /* use mlist_add_tail for debug assistance */
          mlist_add_tail(&cmd->list, &instance->cmd_pool_list);
  
          mutex_exit(&instance->cmd_pool_mtx);
  }
--- 2573,2582 ----
*** 2604,2614 ****
  
  static void
  return_mfi_app_pkt(struct mrsas_instance *instance, struct mrsas_cmd *cmd)
  {
          mutex_enter(&instance->app_cmd_pool_mtx);
-         ASSERT(mutex_owned(&instance->app_cmd_pool_mtx));
  
          mlist_add(&cmd->list, &instance->app_cmd_pool_list);
  
          mutex_exit(&instance->app_cmd_pool_mtx);
  }
--- 2583,2592 ----
*** 2617,2627 ****
  {
          struct scsi_pkt *pkt;
          struct mrsas_header     *hdr;
          con_log(CL_DLEVEL2, (CE_NOTE, "push_pending_pkt(): Called\n"));
          mutex_enter(&instance->cmd_pend_mtx);
-         ASSERT(mutex_owned(&instance->cmd_pend_mtx));
          mlist_del_init(&cmd->list);
          mlist_add_tail(&cmd->list, &instance->cmd_pend_list);
          if (cmd->sync_cmd == MRSAS_TRUE) {
                  hdr = (struct mrsas_header *)&cmd->frame->hdr;
                  if (hdr) {
--- 2595,2604 ----
*** 2676,2686 ****
          unsigned int            flag = 1;
          struct scsi_pkt *pkt;
          int saved_level;
          int cmd_count = 0;
  
- 
          saved_level = debug_level_g;
          debug_level_g = CL_ANN1;
  
          cmn_err(CE_NOTE, "mrsas_print_pending_cmds(): Called\n");
  
--- 2653,2662 ----
*** 3682,3692 ****
                  goto fail_fw_init;
          }
  
          if (mrsas_common_check(instance, cmd) != DDI_SUCCESS)
                  goto fail_fw_init;
!         /* return_mfi_pkt(instance, cmd); */ /* XXX KEBE ASKS, inherit? */
  
          if (ctio_enable &&
              (instance->func_ptr->read_fw_status_reg(instance) & 0x04000000)) {
                  con_log(CL_ANN, (CE_NOTE, "mr_sas: IEEE SGL's supported"));
                  instance->flag_ieee = 1;
--- 3658,3668 ----
                  goto fail_fw_init;
          }
  
          if (mrsas_common_check(instance, cmd) != DDI_SUCCESS)
                  goto fail_fw_init;
!         return_mfi_pkt(instance, cmd);
  
          if (ctio_enable &&
              (instance->func_ptr->read_fw_status_reg(instance) & 0x04000000)) {
                  con_log(CL_ANN, (CE_NOTE, "mr_sas: IEEE SGL's supported"));
                  instance->flag_ieee = 1;
*** 4882,4896 ****
  
                  con_log(CL_ANN, (CE_WARN, "Failed : ddi_dma_mem_alloc"));
  
                  return (-1);
          }
-         if (obj->dma_handle == NULL) {
-                 /* XXX KEBE ASKS --> fm_service_impact()? */
-                 con_log(CL_ANN, (CE_WARN, "Failed : ddi_dma_mem_alloc"));
-                 return (-1);
-         }
  
          if (ddi_dma_addr_bind_handle(obj->dma_handle, NULL, obj->buffer,
              obj->size, DDI_DMA_RDWR | DDI_DMA_STREAMING, DDI_DMA_SLEEP,
              NULL, &obj->dma_cookie[0], &cookie_cnt) != DDI_SUCCESS) {
  
--- 4858,4867 ----
*** 4899,4917 ****
  
                  con_log(CL_ANN, (CE_WARN, "Failed : ddi_dma_addr_bind_handle"));
  
                  return (-1);
          }
-         if (obj->acc_handle == NULL) {
-                 /* XXX KEBE ASKS --> fm_service_impact()? */
-                 ddi_dma_mem_free(&obj->acc_handle);
-                 ddi_dma_free_handle(&obj->dma_handle);
  
-                 con_log(CL_ANN, (CE_WARN, "Failed : ddi_dma_addr_bind_handle"));
-                 return (-1);
-         }
- 
          if (mrsas_check_dma_handle(obj->dma_handle) != DDI_SUCCESS) {
                  ddi_fm_service_impact(instance->dip, DDI_SERVICE_LOST);
                  return (-1);
          }
  
--- 4870,4880 ----
*** 6845,6855 ****
                      "ISSUED CMD TO FW : called : cmd : %p, instance: %p"
                      "(NO PKT)\n", gethrtime(), (void *)cmd, (void *)instance));
          }
  
          mutex_enter(&instance->reg_write_mtx);
-         ASSERT(mutex_owned(&instance->reg_write_mtx));
          /* Issue the command to the FW */
          WR_IB_QPORT((cmd->frame_phys_addr) |
              (((cmd->frame_count - 1) << 1) | 1), instance);
          mutex_exit(&instance->reg_write_mtx);
  
--- 6808,6817 ----
*** 6886,6896 ****
          }
  
          cmd->cmd_status = ENODATA;
  
          mutex_enter(&instance->reg_write_mtx);
-         ASSERT(mutex_owned(&instance->reg_write_mtx));
          /* Issue the command to the FW */
          WR_IB_QPORT((cmd->frame_phys_addr) |
              (((cmd->frame_count - 1) << 1) | 1), instance);
          mutex_exit(&instance->reg_write_mtx);
  
--- 6848,6857 ----