Print this page
re #7364 rb2201 "hddisco" hangs after unplugging both cables from JBOD (and NMS too)
re #8346 rb2639 KT disk failures
re #8346 rb2639 KT disk failures
re #10443 rb3479 3.1.3 crash: BAD TRAP: type=e (#pf Page fault)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c
          +++ new/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c
↓ open down ↓ 229 lines elided ↑ open up ↑
 230  230      pMpi2ReplyDescriptorsUnion_t reply_desc);
 231  231  static void mptsas_handle_address_reply(mptsas_t *mpt,
 232  232      pMpi2ReplyDescriptorsUnion_t reply_desc);
 233  233  static int mptsas_wait_intr(mptsas_t *mpt, int polltime);
 234  234  static void mptsas_sge_setup(mptsas_t *mpt, mptsas_cmd_t *cmd,
 235  235      uint32_t *control, pMpi2SCSIIORequest_t frame, ddi_acc_handle_t acc_hdl);
 236  236  
 237  237  static void mptsas_watch(void *arg);
 238  238  static void mptsas_watchsubr(mptsas_t *mpt);
 239  239  static void mptsas_cmd_timeout(mptsas_t *mpt, uint16_t devhdl);
      240 +static void mptsas_kill_target(mptsas_t *mpt, mptsas_target_t *ptgt);
 240  241  
 241  242  static void mptsas_start_passthru(mptsas_t *mpt, mptsas_cmd_t *cmd);
 242  243  static int mptsas_do_passthru(mptsas_t *mpt, uint8_t *request, uint8_t *reply,
 243  244      uint8_t *data, uint32_t request_size, uint32_t reply_size,
 244  245      uint32_t data_size, uint32_t direction, uint8_t *dataout,
 245  246      uint32_t dataout_size, short timeout, int mode);
 246  247  static int mptsas_free_devhdl(mptsas_t *mpt, uint16_t devhdl);
 247  248  
 248  249  static uint8_t mptsas_get_fw_diag_buffer_number(mptsas_t *mpt,
 249  250      uint32_t unique_id);
↓ open down ↓ 90 lines elided ↑ open up ↑
 340  341  static mptsas_smp_t *mptsas_wwid_to_psmp(mptsas_t *mpt, int phymask,
 341  342      uint64_t wwid);
 342  343  
 343  344  static int mptsas_inquiry(mptsas_t *mpt, mptsas_target_t *ptgt, int lun,
 344  345      uchar_t page, unsigned char *buf, int len, int *rlen, uchar_t evpd);
 345  346  
 346  347  static int mptsas_get_target_device_info(mptsas_t *mpt, uint32_t page_address,
 347  348      uint16_t *handle, mptsas_target_t **pptgt);
 348  349  static void mptsas_update_phymask(mptsas_t *mpt);
 349  350  
 350      -static int mptsas_send_sep(mptsas_t *mpt, mptsas_target_t *ptgt,
 351      -    uint32_t *status, uint8_t cmd);
 352  351  static dev_info_t *mptsas_get_dip_from_dev(dev_t dev,
 353  352      mptsas_phymask_t *phymask);
 354  353  static mptsas_target_t *mptsas_addr_to_ptgt(mptsas_t *mpt, char *addr,
 355  354      mptsas_phymask_t phymask);
 356      -static int mptsas_set_led_status(mptsas_t *mpt, mptsas_target_t *ptgt,
 357      -    uint32_t slotstatus);
 358  355  
 359  356  
 360  357  /*
 361  358   * Enumeration / DR functions
 362  359   */
 363  360  static void mptsas_config_all(dev_info_t *pdip);
 364  361  static int mptsas_config_one_addr(dev_info_t *pdip, uint64_t sasaddr, int lun,
 365  362      dev_info_t **lundip);
 366  363  static int mptsas_config_one_phy(dev_info_t *pdip, uint8_t phy, int lun,
 367  364      dev_info_t **lundip);
↓ open down ↓ 90 lines elided ↑ open up ↑
 458  455   * under this device that the paths to a physical device are created when
 459  456   * MPxIO is used.
 460  457   */
 461  458  extern dev_info_t       *scsi_vhci_dip;
 462  459  
 463  460  /*
 464  461   * Tunable timeout value for Inquiry VPD page 0x83
 465  462   * By default the value is 30 seconds.
 466  463   */
 467  464  int mptsas_inq83_retry_timeout = 30;
      465 +/*
      466 + * Maximum number of command timeouts (0 - 255) considered acceptable.
      467 + */
      468 +int mptsas_timeout_threshold = 2;
      469 +/*
      470 + * Timeouts exceeding threshold within this period are considered excessive.
      471 + */
      472 +int mptsas_timeout_interval = 30;
 468  473  
 469  474  /*
 470  475   * This is used to allocate memory for message frame storage, not for
 471  476   * data I/O DMA. All message frames must be stored in the first 4G of
 472  477   * physical memory.
 473  478   */
 474  479  ddi_dma_attr_t mptsas_dma_attrs = {
 475  480          DMA_ATTR_V0,    /* attribute layout version             */
 476  481          0x0ull,         /* address low - should be 0 (longlong) */
 477  482          0xffffffffull,  /* address high - 32-bit max range      */
↓ open down ↓ 2133 lines elided ↑ open up ↑
2611 2616           * Clear the reply post queue memory.
2612 2617           */
2613 2618          bzero(mpt->m_post_queue, mem_size);
2614 2619  
2615 2620          return (DDI_SUCCESS);
2616 2621  }
2617 2622  
2618 2623  static void
2619 2624  mptsas_alloc_reply_args(mptsas_t *mpt)
2620 2625  {
2621      -        if (mpt->m_replyh_args != NULL) {
2622      -                kmem_free(mpt->m_replyh_args, sizeof (m_replyh_arg_t)
2623      -                    * mpt->m_max_replies);
2624      -                mpt->m_replyh_args = NULL;
     2626 +        if (mpt->m_replyh_args == NULL) {
     2627 +                mpt->m_replyh_args = kmem_zalloc(sizeof (m_replyh_arg_t) *
     2628 +                    mpt->m_max_replies, KM_SLEEP);
2625 2629          }
2626      -        mpt->m_replyh_args = kmem_zalloc(sizeof (m_replyh_arg_t) *
2627      -            mpt->m_max_replies, KM_SLEEP);
2628 2630  }
2629 2631  
2630 2632  static int
2631 2633  mptsas_alloc_extra_sgl_frame(mptsas_t *mpt, mptsas_cmd_t *cmd)
2632 2634  {
2633 2635          mptsas_cache_frames_t   *frames = NULL;
2634 2636          if (cmd->cmd_extra_frames == NULL) {
2635 2637                  frames = kmem_cache_alloc(mpt->m_cache_frames, KM_NOSLEEP);
2636 2638                  if (frames == NULL) {
2637 2639                          return (DDI_FAILURE);
↓ open down ↓ 2181 lines elided ↑ open up ↑
4819 4821                   * NOT_RESPONDING/ADDED only now
4820 4822                   */
4821 4823                  if (mptsas_handle_event_sync(args) == DDI_SUCCESS) {
4822 4824                          /*
4823 4825                           * Would not return main process,
4824 4826                           * just let taskq resolve ack action
4825 4827                           * and ack would be sent in taskq thread
4826 4828                           */
4827 4829                          NDBG20(("send mptsas_handle_event_sync success"));
4828 4830                  }
     4831 +
     4832 +                if (mpt->m_in_reset) {
     4833 +                        NDBG20(("dropping event received during reset"));
     4834 +                        return;
     4835 +                }
     4836 +
4829 4837                  if ((ddi_taskq_dispatch(mpt->m_event_taskq, mptsas_handle_event,
4830 4838                      (void *)args, DDI_NOSLEEP)) != DDI_SUCCESS) {
4831 4839                          mptsas_log(mpt, CE_WARN, "No memory available"
4832 4840                          "for dispatch taskq");
4833 4841                          /*
4834 4842                           * Return the reply frame to the free queue.
4835 4843                           */
4836 4844                          ddi_put32(mpt->m_acc_free_queue_hdl,
4837 4845                              &((uint32_t *)(void *)
4838 4846                              mpt->m_free_queue)[mpt->m_free_index], reply_addr);
↓ open down ↓ 917 lines elided ↑ open up ↑
5756 5764                                  mptsas_log(mpt, CE_WARN, "Failed to find an "
5757 5765                                      "iport, should not happen!");
5758 5766                                  goto out;
5759 5767                          }
5760 5768  
5761 5769                  }
5762 5770                  ASSERT(parent);
5763 5771  handle_topo_change:
5764 5772  
5765 5773                  mutex_enter(&mpt->m_mutex);
5766      -
5767      -                mptsas_handle_topo_change(topo_node, parent);
     5774 +                /*
     5775 +                 * If HBA is being reset, don't perform operations depending
     5776 +                 * on the IOC. We must free the topo list, however.
     5777 +                 */
     5778 +                if (!mpt->m_in_reset)
     5779 +                        mptsas_handle_topo_change(topo_node, parent);
     5780 +                else
     5781 +                        NDBG20(("skipping topo change received during reset"));
5768 5782                  save_node = topo_node;
5769 5783                  topo_node = topo_node->next;
5770 5784                  ASSERT(save_node);
5771 5785                  kmem_free(save_node, sizeof (mptsas_topo_change_list_t));
5772 5786                  mutex_exit(&mpt->m_mutex);
5773 5787  
5774 5788                  if ((flags == MPTSAS_TOPO_FLAG_DIRECT_ATTACHED_DEVICE) ||
5775 5789                      (flags == MPTSAS_TOPO_FLAG_RAID_PHYSDRV_ASSOCIATED) ||
5776 5790                      (flags == MPTSAS_TOPO_FLAG_RAID_ASSOCIATED)) {
5777 5791                          /*
↓ open down ↓ 269 lines elided ↑ open up ↑
6047 6061                              DDI_PROP_SUCCESS) {
6048 6062                                  (void) ddi_prop_remove(DDI_DEV_T_NONE, parent,
6049 6063                                      MPTSAS_VIRTUAL_PORT);
6050 6064                                  mptsas_log(mpt, CE_WARN, "mptsas virtual port "
6051 6065                                      "prop update failed");
6052 6066                                  break;
6053 6067                          }
6054 6068                  }
6055 6069  
6056 6070                  mutex_enter(&mpt->m_mutex);
6057      -                if (mptsas_set_led_status(mpt, ptgt, 0) != DDI_SUCCESS) {
6058      -                        NDBG14(("mptsas: clear LED for tgt %x failed",
6059      -                            ptgt->m_slot_num));
6060      -                }
6061 6071                  if (rval == DDI_SUCCESS) {
6062 6072                          mptsas_tgt_free(&mpt->m_active->m_tgttbl,
6063 6073                              ptgt->m_sas_wwn, ptgt->m_phymask);
6064 6074                          ptgt = NULL;
6065 6075                  } else {
6066 6076                          /*
6067 6077                           * clean DR_INTRANSITION flag to allow I/O down to
6068 6078                           * PHCI driver since failover finished.
6069 6079                           * Invalidate the devhdl
6070 6080                           */
↓ open down ↓ 912 lines elided ↑ open up ↑
6983 6993          uint32_t                        status;
6984 6994          uint8_t                         port;
6985 6995          mptsas_t                        *mpt;
6986 6996          uint_t                          iocstatus;
6987 6997  
6988 6998          replyh_arg = (m_replyh_arg_t *)args;
6989 6999          rfm = replyh_arg->rfm;
6990 7000          mpt = replyh_arg->mpt;
6991 7001  
6992 7002          mutex_enter(&mpt->m_mutex);
     7003 +        /*
     7004 +         * If HBA is being reset, drop incoming event.
     7005 +         */
     7006 +        if (mpt->m_in_reset) {
     7007 +                NDBG20(("dropping event received prior to reset"));
     7008 +                mutex_exit(&mpt->m_mutex);
     7009 +                return;
     7010 +        }
6993 7011  
6994 7012          eventreply = (pMpi2EventNotificationReply_t)
6995 7013              (mpt->m_reply_frame + (rfm - mpt->m_reply_frame_dma_addr));
6996 7014          event = ddi_get16(mpt->m_acc_reply_frame_hdl, &eventreply->Event);
6997 7015  
6998 7016          if (iocstatus = ddi_get16(mpt->m_acc_reply_frame_hdl,
6999 7017              &eventreply->IOCStatus)) {
7000 7018                  if (iocstatus == MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) {
7001 7019                          mptsas_log(mpt, CE_WARN,
7002 7020                              "!mptsas_handle_event: IOCStatus=0x%x, "
↓ open down ↓ 1507 lines elided ↑ open up ↑
8510 8528           * Account for TM requests, which use the last SMID.
8511 8529           */
8512 8530          for (slot = 0; slot <= mpt->m_active->m_n_slots; slot++) {
8513 8531                  if ((cmd = slots->m_slot[slot]) == NULL)
8514 8532                          continue;
8515 8533                  reason = CMD_RESET;
8516 8534                  stat = STAT_DEV_RESET;
8517 8535                  switch (tasktype) {
8518 8536                  case MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET:
8519 8537                          if (Tgt(cmd) == target) {
     8538 +                                if (cmd->cmd_tgt_addr->m_timeout < 0) {
     8539 +                                        /*
     8540 +                                         * When timeout requested, propagate
     8541 +                                         * proper reason and statistics to
     8542 +                                         * target drivers.
     8543 +                                         */
     8544 +                                        reason = CMD_TIMEOUT;
     8545 +                                        stat |= STAT_TIMEOUT;
     8546 +                                }
     8547 +                                
8520 8548                                  NDBG25(("mptsas_flush_target discovered non-"
8521 8549                                      "NULL cmd in slot %d, tasktype 0x%x", slot,
8522 8550                                      tasktype));
8523 8551                                  mptsas_dump_cmd(mpt, cmd);
8524 8552                                  mptsas_remove_cmd(mpt, cmd);
8525 8553                                  mptsas_set_pkt_reason(mpt, cmd, reason, stat);
8526 8554                                  mptsas_doneq_add(mpt, cmd);
8527 8555                          }
8528 8556                          break;
8529 8557                  case MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET:
↓ open down ↓ 167 lines elided ↑ open up ↑
8697 8725           * Flush the tx_waitq
8698 8726           */
8699 8727          mutex_enter(&mpt->m_tx_waitq_mutex);
8700 8728          while ((cmd = mptsas_tx_waitq_rm(mpt)) != NULL) {
8701 8729                  mutex_exit(&mpt->m_tx_waitq_mutex);
8702 8730                  mptsas_set_pkt_reason(mpt, cmd, CMD_RESET, STAT_BUS_RESET);
8703 8731                  mptsas_doneq_add(mpt, cmd);
8704 8732                  mutex_enter(&mpt->m_tx_waitq_mutex);
8705 8733          }
8706 8734          mutex_exit(&mpt->m_tx_waitq_mutex);
     8735 +
     8736 +        /*
     8737 +         * Drain the taskqs prior to reallocating resources.
     8738 +         */
     8739 +        mutex_exit(&mpt->m_mutex);
     8740 +        ddi_taskq_wait(mpt->m_event_taskq);
     8741 +        ddi_taskq_wait(mpt->m_dr_taskq);
     8742 +        mutex_enter(&mpt->m_mutex);
8707 8743  }
8708 8744  
8709 8745  /*
8710 8746   * set pkt_reason and OR in pkt_statistics flag
8711 8747   */
8712 8748  static void
8713 8749  mptsas_set_pkt_reason(mptsas_t *mpt, mptsas_cmd_t *cmd, uchar_t reason,
8714 8750      uint_t stat)
8715 8751  {
8716 8752  #ifndef __lock_lint
↓ open down ↓ 660 lines elided ↑ open up ↑
9377 9413                              mptsas_scsi_watchdog_tick) {
9378 9414                                  ptgt->m_timebase +=
9379 9415                                      mptsas_scsi_watchdog_tick;
9380 9416                                  ptgt = (mptsas_target_t *)mptsas_hash_traverse(
9381 9417                                      &mpt->m_active->m_tgttbl, MPTSAS_HASH_NEXT);
9382 9418                                  continue;
9383 9419                          }
9384 9420  
9385 9421                          ptgt->m_timeout -= mptsas_scsi_watchdog_tick;
9386 9422  
     9423 +                        if (ptgt->m_timeout_count > 0) {
     9424 +                                ptgt->m_timeout_interval +=
     9425 +                                    mptsas_scsi_watchdog_tick;
     9426 +                        }
     9427 +                        if (ptgt->m_timeout_interval > mptsas_timeout_interval) {
     9428 +                                ptgt->m_timeout_interval = 0;
     9429 +                                ptgt->m_timeout_count = 0;
     9430 +                        }
     9431 +
9387 9432                          if (ptgt->m_timeout < 0) {
9388      -                                mptsas_cmd_timeout(mpt, ptgt->m_devhdl);
     9433 +                                ptgt->m_timeout_count++;
     9434 +                                if (ptgt->m_timeout_count >
     9435 +                                    mptsas_timeout_threshold) {
     9436 +                                        ptgt->m_timeout_count = 0;
     9437 +                                        mptsas_kill_target(mpt, ptgt);
     9438 +                                } else {
     9439 +                                        mptsas_cmd_timeout(mpt, ptgt->m_devhdl);
     9440 +                                }
9389 9441                                  ptgt = (mptsas_target_t *)mptsas_hash_traverse(
9390 9442                                      &mpt->m_active->m_tgttbl, MPTSAS_HASH_NEXT);
9391 9443                                  continue;
9392 9444                          }
9393 9445  
9394 9446                          if ((ptgt->m_timeout) <=
9395 9447                              mptsas_scsi_watchdog_tick) {
9396 9448                                  NDBG23(("pending timeout"));
9397 9449                                  mptsas_set_throttle(mpt, ptgt,
9398 9450                                      DRAIN_THROTTLE);
↓ open down ↓ 21 lines elided ↑ open up ↑
9420 9472           * try to reset that target.
9421 9473           */
9422 9474          NDBG29(("mptsas_cmd_timeout: device reset"));
9423 9475          if (mptsas_do_scsi_reset(mpt, devhdl) != TRUE) {
9424 9476                  mptsas_log(mpt, CE_WARN, "Target %d reset for command timeout "
9425 9477                      "recovery failed!", devhdl);
9426 9478          }
9427 9479  }
9428 9480  
9429 9481  /*
     9482 + * target causing too many timeouts
     9483 + */
     9484 +static void
     9485 +mptsas_kill_target(mptsas_t *mpt, mptsas_target_t *ptgt)
     9486 +{
     9487 +        mptsas_topo_change_list_t       *topo_node = NULL;
     9488 +
     9489 +        NDBG29(("mptsas_tgt_kill: target=%d", ptgt->m_devhdl));
     9490 +        mptsas_log(mpt, CE_WARN, "timeout threshold exceeded for "
     9491 +            "Target %d", ptgt->m_devhdl);
     9492 +
     9493 +        topo_node = kmem_zalloc(sizeof (mptsas_topo_change_list_t), KM_SLEEP);
     9494 +        topo_node->mpt = mpt;
     9495 +        topo_node->un.phymask = ptgt->m_phymask;
     9496 +        topo_node->event = MPTSAS_DR_EVENT_OFFLINE_TARGET;
     9497 +        topo_node->devhdl = ptgt->m_devhdl;
     9498 +        if (ptgt->m_deviceinfo & DEVINFO_DIRECT_ATTACHED)
     9499 +                topo_node->flags = MPTSAS_TOPO_FLAG_DIRECT_ATTACHED_DEVICE;
     9500 +        else
     9501 +                topo_node->flags = MPTSAS_TOPO_FLAG_EXPANDER_ATTACHED_DEVICE;
     9502 +        topo_node->object = NULL;
     9503 +
     9504 +        /*
     9505 +         * Launch DR taskq to fake topology change
     9506 +         */
     9507 +        if ((ddi_taskq_dispatch(mpt->m_dr_taskq,
     9508 +            mptsas_handle_dr, (void *)topo_node,
     9509 +            DDI_NOSLEEP)) != DDI_SUCCESS) {
     9510 +                mptsas_log(mpt, CE_NOTE, "mptsas start taskq "
     9511 +                    "for fake offline event failed. \n");
     9512 +        }
     9513 +}
     9514 +
     9515 +/*
9430 9516   * Device / Hotplug control
9431 9517   */
9432 9518  static int
9433 9519  mptsas_scsi_quiesce(dev_info_t *dip)
9434 9520  {
9435 9521          mptsas_t        *mpt;
9436 9522          scsi_hba_tran_t *tran;
9437 9523  
9438 9524          tran = ddi_get_driver_private(dip);
9439 9525          if (tran == NULL || (mpt = TRAN2MPT(tran)) == NULL)
↓ open down ↓ 1879 lines elided ↑ open up ↑
11319 11405                          }
11320 11406                  } else {
11321 11407                          mutex_exit(&mpt->m_mutex);
11322 11408                  }
11323 11409          } else {
11324 11410                  mutex_exit(&mpt->m_mutex);
11325 11411          }
11326 11412  
11327 11413          if (iport_flag) {
11328 11414                  status = scsi_hba_ioctl(dev, cmd, data, mode, credp, rval);
11329      -                if (status != 0) {
11330      -                        goto out;
11331      -                }
11332      -                /*
11333      -                 * The following code control the OK2RM LED, it doesn't affect
11334      -                 * the ioctl return status.
11335      -                 */
11336      -                if ((cmd == DEVCTL_DEVICE_ONLINE) ||
11337      -                    (cmd == DEVCTL_DEVICE_OFFLINE)) {
11338      -                        if (ndi_dc_allochdl((void *)data, &dcp) !=
11339      -                            NDI_SUCCESS) {
11340      -                                goto out;
11341      -                        }
11342      -                        addr = ndi_dc_getaddr(dcp);
11343      -                        ptgt = mptsas_addr_to_ptgt(mpt, addr, phymask);
11344      -                        if (ptgt == NULL) {
11345      -                                NDBG14(("mptsas_ioctl led control: tgt %s not "
11346      -                                    "found", addr));
11347      -                                ndi_dc_freehdl(dcp);
11348      -                                goto out;
11349      -                        }
11350      -                        mutex_enter(&mpt->m_mutex);
11351      -                        if (cmd == DEVCTL_DEVICE_ONLINE) {
11352      -                                ptgt->m_tgt_unconfigured = 0;
11353      -                        } else if (cmd == DEVCTL_DEVICE_OFFLINE) {
11354      -                                ptgt->m_tgt_unconfigured = 1;
11355      -                        }
11356      -                        slotstatus = 0;
11357      -#ifdef MPTSAS_GET_LED
11358      -                        /*
11359      -                         * The get led status can't get a valid/reasonable
11360      -                         * state, so ignore the get led status, and write the
11361      -                         * required value directly
11362      -                         */
11363      -                        if (mptsas_get_led_status(mpt, ptgt, &slotstatus) !=
11364      -                            DDI_SUCCESS) {
11365      -                                NDBG14(("mptsas_ioctl: get LED for tgt %s "
11366      -                                    "failed %x", addr, slotstatus));
11367      -                                slotstatus = 0;
11368      -                        }
11369      -                        NDBG14(("mptsas_ioctl: LED status %x for %s",
11370      -                            slotstatus, addr));
11371      -#endif
11372      -                        if (cmd == DEVCTL_DEVICE_OFFLINE) {
11373      -                                slotstatus |=
11374      -                                    MPI2_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE;
11375      -                        } else {
11376      -                                slotstatus &=
11377      -                                    ~MPI2_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE;
11378      -                        }
11379      -                        if (mptsas_set_led_status(mpt, ptgt, slotstatus) !=
11380      -                            DDI_SUCCESS) {
11381      -                                NDBG14(("mptsas_ioctl: set LED for tgt %s "
11382      -                                    "failed %x", addr, slotstatus));
11383      -                        }
11384      -                        mutex_exit(&mpt->m_mutex);
11385      -                        ndi_dc_freehdl(dcp);
11386      -                }
11387 11415                  goto out;
11388 11416          }
11389 11417          switch (cmd) {
11390 11418                  case MPTIOCTL_UPDATE_FLASH:
11391 11419                          if (ddi_copyin((void *)data, &flashdata,
11392 11420                                  sizeof (struct mptsas_update_flash), mode)) {
11393 11421                                  status = EFAULT;
11394 11422                                  break;
11395 11423                          }
11396 11424  
↓ open down ↓ 2434 lines elided ↑ open up ↑
13831 13859                      MDI_CLIENT_GUID_PROP, &old_guid) == DDI_SUCCESS) {
13832 13860                          if (strncmp(guid, old_guid, strlen(guid)) == 0) {
13833 13861                                  /*
13834 13862                                   * Same path back online again.
13835 13863                                   */
13836 13864                                  (void) ddi_prop_free(old_guid);
13837 13865                                  if ((!MDI_PI_IS_ONLINE(*pip)) &&
13838 13866                                      (!MDI_PI_IS_STANDBY(*pip)) &&
13839 13867                                      (ptgt->m_tgt_unconfigured == 0)) {
13840 13868                                          rval = mdi_pi_online(*pip, 0);
13841      -                                        mutex_enter(&mpt->m_mutex);
13842      -                                        (void) mptsas_set_led_status(mpt, ptgt,
13843      -                                            0);
13844      -                                        mutex_exit(&mpt->m_mutex);
13845 13869                                  } else {
13846 13870                                          rval = DDI_SUCCESS;
13847 13871                                  }
13848 13872                                  if (rval != DDI_SUCCESS) {
13849 13873                                          mptsas_log(mpt, CE_WARN, "path:target: "
13850 13874                                              "%x, lun:%x online failed!", target,
13851 13875                                              lun);
13852 13876                                          *pip = NULL;
13853 13877                                          *lun_dip = NULL;
13854 13878                                  }
↓ open down ↓ 233 lines elided ↑ open up ↑
14088 14112                  if (mdi_prop_update_int(*pip, "phy-num",
14089 14113                      ptgt->m_phynum) != DDI_SUCCESS) {
14090 14114                          mptsas_log(mpt, CE_WARN, "mptsas driver unable to "
14091 14115                              "create phy-num property for target %d lun %d",
14092 14116                              target, lun);
14093 14117                          mdi_rtn = MDI_FAILURE;
14094 14118                          goto virt_create_done;
14095 14119                  }
14096 14120                  NDBG20(("new path:%s onlining,", MDI_PI(*pip)->pi_addr));
14097 14121                  mdi_rtn = mdi_pi_online(*pip, 0);
14098      -                if (mdi_rtn == MDI_SUCCESS) {
14099      -                        mutex_enter(&mpt->m_mutex);
14100      -                        if (mptsas_set_led_status(mpt, ptgt, 0) !=
14101      -                            DDI_SUCCESS) {
14102      -                                NDBG14(("mptsas: clear LED for slot %x "
14103      -                                    "failed", ptgt->m_slot_num));
14104      -                        }
14105      -                        mutex_exit(&mpt->m_mutex);
14106      -                }
14107 14122                  if (mdi_rtn == MDI_NOT_SUPPORTED) {
14108 14123                          mdi_rtn = MDI_FAILURE;
14109 14124                  }
14110 14125  virt_create_done:
14111 14126                  if (*pip && mdi_rtn != MDI_SUCCESS) {
14112 14127                          (void) mdi_pi_free(*pip, 0);
14113 14128                          *pip = NULL;
14114 14129                          *lun_dip = NULL;
14115 14130                  }
14116 14131          }
↓ open down ↓ 333 lines elided ↑ open up ↑
14450 14465  phys_create_done:
14451 14466                  /*
14452 14467                   * If props were setup ok, online the lun
14453 14468                   */
14454 14469                  if (ndi_rtn == NDI_SUCCESS) {
14455 14470                          /*
14456 14471                           * Try to online the new node
14457 14472                           */
14458 14473                          ndi_rtn = ndi_devi_online(*lun_dip, NDI_ONLINE_ATTACH);
14459 14474                  }
14460      -                if (ndi_rtn == NDI_SUCCESS) {
14461      -                        mutex_enter(&mpt->m_mutex);
14462      -                        if (mptsas_set_led_status(mpt, ptgt, 0) !=
14463      -                            DDI_SUCCESS) {
14464      -                                NDBG14(("mptsas: clear LED for tgt %x "
14465      -                                    "failed", ptgt->m_slot_num));
14466      -                        }
14467      -                        mutex_exit(&mpt->m_mutex);
14468      -                }
14469 14475  
14470 14476                  /*
14471 14477                   * If success set rtn flag, else unwire alloc'd lun
14472 14478                   */
14473 14479                  if (ndi_rtn != NDI_SUCCESS) {
14474 14480                          NDBG12(("mptsas driver unable to online "
14475 14481                              "target %d lun %d", target, lun));
14476 14482                          ndi_prop_remove_all(*lun_dip);
14477 14483                          (void) ndi_devi_free(*lun_dip);
14478 14484                          *lun_dip = NULL;
↓ open down ↓ 872 lines elided ↑ open up ↑
15351 15357                  return (NULL);
15352 15358          }
15353 15359          if (addr[0] == 'w') {
15354 15360                  ptgt = mptsas_wwid_to_ptgt(mpt, (int)phymask, wwn);
15355 15361          } else {
15356 15362                  ptgt = mptsas_phy_to_tgt(mpt, (int)phymask, phynum);
15357 15363          }
15358 15364          return (ptgt);
15359 15365  }
15360 15366  
15361      -#ifdef MPTSAS_GET_LED
15362      -static int
15363      -mptsas_get_led_status(mptsas_t *mpt, mptsas_target_t *ptgt,
15364      -    uint32_t *slotstatus)
15365      -{
15366      -        return (mptsas_send_sep(mpt, ptgt, slotstatus,
15367      -            MPI2_SEP_REQ_ACTION_READ_STATUS));
15368      -}
15369      -#endif
15370      -static int
15371      -mptsas_set_led_status(mptsas_t *mpt, mptsas_target_t *ptgt, uint32_t slotstatus)
15372      -{
15373      -        NDBG14(("mptsas_ioctl: set LED status %x for slot %x",
15374      -            slotstatus, ptgt->m_slot_num));
15375      -        return (mptsas_send_sep(mpt, ptgt, &slotstatus,
15376      -            MPI2_SEP_REQ_ACTION_WRITE_STATUS));
15377      -}
15378      -/*
15379      - *  send sep request, use enclosure/slot addressing
15380      - */
15381      -static int mptsas_send_sep(mptsas_t *mpt, mptsas_target_t *ptgt,
15382      -    uint32_t *status, uint8_t act)
15383      -{
15384      -        Mpi2SepRequest_t        req;
15385      -        Mpi2SepReply_t          rep;
15386      -        int                     ret;
15387      -
15388      -        ASSERT(mutex_owned(&mpt->m_mutex));
15389      -
15390      -        bzero(&req, sizeof (req));
15391      -        bzero(&rep, sizeof (rep));
15392      -
15393      -        /* Do nothing for RAID volumes */
15394      -        if (ptgt->m_phymask == 0) {
15395      -                NDBG14(("mptsas_send_sep: Skip RAID volumes"));
15396      -                return (DDI_FAILURE);
15397      -        }
15398      -
15399      -        req.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
15400      -        req.Action = act;
15401      -        req.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
15402      -        req.EnclosureHandle = LE_16(ptgt->m_enclosure);
15403      -        req.Slot = LE_16(ptgt->m_slot_num);
15404      -        if (act == MPI2_SEP_REQ_ACTION_WRITE_STATUS) {
15405      -                req.SlotStatus = LE_32(*status);
15406      -        }
15407      -        ret = mptsas_do_passthru(mpt, (uint8_t *)&req, (uint8_t *)&rep, NULL,
15408      -            sizeof (req), sizeof (rep), NULL, 0, NULL, 0, 60, FKIOCTL);
15409      -        if (ret != 0) {
15410      -                mptsas_log(mpt, CE_NOTE, "mptsas_send_sep: passthru SEP "
15411      -                    "Processor Request message error %d", ret);
15412      -                return (DDI_FAILURE);
15413      -        }
15414      -        /* do passthrough success, check the ioc status */
15415      -        if (LE_16(rep.IOCStatus) != MPI2_IOCSTATUS_SUCCESS) {
15416      -                if ((LE_16(rep.IOCStatus) & MPI2_IOCSTATUS_MASK) ==
15417      -                    MPI2_IOCSTATUS_INVALID_FIELD) {
15418      -                        mptsas_log(mpt, CE_NOTE, "send sep act %x: Not "
15419      -                            "supported action, loginfo %x", act,
15420      -                            LE_32(rep.IOCLogInfo));
15421      -                        return (DDI_FAILURE);
15422      -                }
15423      -                mptsas_log(mpt, CE_NOTE, "send_sep act %x: ioc "
15424      -                    "status:%x", act, LE_16(rep.IOCStatus));
15425      -                return (DDI_FAILURE);
15426      -        }
15427      -        if (act != MPI2_SEP_REQ_ACTION_WRITE_STATUS) {
15428      -                *status = LE_32(rep.SlotStatus);
15429      -        }
15430      -
15431      -        return (DDI_SUCCESS);
15432      -}
15433      -
15434 15367  int
15435 15368  mptsas_dma_addr_create(mptsas_t *mpt, ddi_dma_attr_t dma_attr,
15436 15369      ddi_dma_handle_t *dma_hdp, ddi_acc_handle_t *acc_hdp, caddr_t *dma_memp,
15437 15370      uint32_t alloc_size, ddi_dma_cookie_t *cookiep)
15438 15371  {
15439 15372          ddi_dma_cookie_t        new_cookie;
15440 15373          size_t                  alloc_len;
15441 15374          uint_t                  ncookie;
15442 15375  
15443 15376          if (cookiep == NULL)
↓ open down ↓ 39 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX