Print this page
XXXX don't fail device detach when it's physically removed

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 ↓ 6175 lines elided ↑ open up ↑
6176 6176  {
6177 6177          int                     rval;
6178 6178          uint16_t                dev_hdl;
6179 6179          uint16_t                pdev_hdl;
6180 6180          uint64_t                dev_sas_wwn;
6181 6181          uint8_t                 physport;
6182 6182          uint8_t                 phy_id;
6183 6183          uint32_t                page_address;
6184 6184          uint16_t                bay_num, enclosure, io_flags;
6185 6185          uint32_t                dev_info;
6186      -        char                    uabuf[SCSI_WWN_BUFLEN];
     6186 +        char                    uabuf[SCSI_WWN_BUFLEN];
6187 6187          dev_info_t              *dip;
6188 6188          mdi_pathinfo_t          *pip;
6189 6189  
6190 6190          mutex_enter(&mpt->m_mutex);
6191 6191          page_address = (MPI2_SAS_DEVICE_PGAD_FORM_HANDLE &
6192 6192              MPI2_SAS_DEVICE_PGAD_FORM_MASK) | (uint32_t)ptgt->m_devhdl;
6193 6193          rval = mptsas_get_sas_device_page0(mpt, page_address, &dev_hdl,
6194 6194              &dev_sas_wwn, &dev_info, &physport, &phy_id, &pdev_hdl, &bay_num,
6195 6195              &enclosure, &io_flags);
6196 6196          mutex_exit(&mpt->m_mutex);
↓ open down ↓ 8853 lines elided ↑ open up ↑
15050 15050           * similiar to i_ddi_node_state(cdip) >=
15051 15051           * DS_ATTACHED.
15052 15052           */
15053 15053          if (i_ddi_devi_attached(cdip)) {
15054 15054  
15055 15055                  /* Get full devname */
15056 15056                  devname = kmem_alloc(MAXNAMELEN + 1, KM_SLEEP);
15057 15057                  (void) ddi_deviname(cdip, devname);
15058 15058                  /* Clean cache */
15059 15059                  (void) devfs_clean(parent, devname + 1,
15060      -                    DV_CLEAN_FORCE);
     15060 +                    DV_CLEAN_FORCE|DV_DEVI_GONE);
15061 15061                  kmem_free(devname, MAXNAMELEN + 1);
15062 15062          }
15063 15063          if (rpip != NULL) {
15064 15064                  if (MDI_PI_IS_OFFLINE(rpip)) {
15065 15065                          rval = DDI_SUCCESS;
15066 15066                  } else {
15067 15067                          rval = mdi_pi_offline(rpip, 0);
15068 15068                  }
15069 15069          } else {
15070 15070                  rval = ndi_devi_offline(cdip, flags);
↓ open down ↓ 49 lines elided ↑ open up ↑
15120 15120           * similiar to i_ddi_node_state(cdip) >=
15121 15121           * DS_ATTACHED.
15122 15122           */
15123 15123          if (i_ddi_devi_attached(cdip)) {
15124 15124  
15125 15125                  /* Get full devname */
15126 15126                  devname = kmem_alloc(MAXNAMELEN + 1, KM_SLEEP);
15127 15127                  (void) ddi_deviname(cdip, devname);
15128 15128                  /* Clean cache */
15129 15129                  (void) devfs_clean(pdip, devname + 1,
15130      -                    DV_CLEAN_FORCE);
     15130 +                    DV_CLEAN_FORCE|DV_DEVI_GONE);
15131 15131                  kmem_free(devname, MAXNAMELEN + 1);
15132 15132          }
15133 15133  
15134 15134          rval = ndi_devi_offline(cdip, flags);
15135 15135  
15136 15136          return (rval);
15137 15137  }
15138 15138  
15139 15139  static dev_info_t *
15140 15140  mptsas_find_child(dev_info_t *pdip, char *name)
↓ open down ↓ 1672 lines elided ↑ open up ↑
16813 16813   *  send sep request, use enclosure/slot addressing
16814 16814   */
16815 16815  static int
16816 16816  mptsas_send_sep(mptsas_t *mpt, mptsas_target_t *ptgt,
16817 16817      uint32_t *status, uint8_t act)
16818 16818  {
16819 16819          Mpi2SepRequest_t        req;
16820 16820          Mpi2SepReply_t          rep;
16821 16821          int                     ret;
16822 16822          mptsas_enclosure_t      *mep;
16823      -        uint16_t                enctype;
     16823 +        uint16_t                enctype;
16824 16824  
16825 16825          ASSERT(mutex_owned(&mpt->m_mutex));
16826 16826  
16827 16827          /*
16828 16828           * We only support SEP control of directly-attached targets, in which
16829 16829           * case the "SEP" we're talking to is a virtual one contained within
16830 16830           * the HBA itself.  This is necessary because DA targets typically have
16831 16831           * no other mechanism for LED control.  Targets for which a separate
16832 16832           * enclosure service processor exists should be controlled via ses(7d)
16833 16833           * or sgen(7d).  Furthermore, since such requests can time out, they
↓ open down ↓ 127 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX