Print this page
9048 mpt_sas should not require targets to send SEP messages
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Approved by: Gordon Ross <gwr@nexenta.com>
NEX-17006 backport mpt_sas tri-mode parts support change
9044 Need support for mpt_sas tri-mode parts
9045 Clean up mpt_sas compiler warnings
9046 mptsas_handle_topo_change can return without its locks held
9047 workaround SAS3408 firmware issue
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Reviewed by: Albert Lee <trisk@forkgnu.org>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
NEX-16174 scsi error messages should go to system log only
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-14838 Support 24 port version of SAS adapters
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-1774 mptsas error stats are always zero
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
NEX-2103 12G mpt_sas needs additional minor enhancements
NEX-2157 mpt_sas firmware update minor regression
NEX-1889 mpt_sas should support 12G HBAs
4500 mptsas_hash_traverse() is unsafe, leads to missing devices
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Approved by: Albert Lee <trisk@nexenta.com>
backout 4500 mptsas_hash_traverse() is unsafe, leads to missing devices
4403 mpt_sas panic when pulling a drive
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Reviewed by: Andy Giles <illumos@ang.homedns.org>
Approved by: Robert Mustacchi <rm@joyent.com>
4500 mptsas_hash_traverse() is unsafe, leads to missing devices
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Approved by: Albert Lee <trisk@nexenta.com>
re #9636 rb2836 - mpt_sas should attempt an MUR reset at attach time.
--HG--
branch : stable-4.0
re #9636 rb2836 - mpt_sas should attempt an MUR reset at attach time.
re #6530 mpt_sas crash when more than 1 Initiator involved - ie HA

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas_impl.c
          +++ new/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas_impl.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24      - * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
       24 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
  25   25   * Copyright 2014 OmniTI Computer Consulting, Inc. All rights reserved.
  26   26   * Copyright (c) 2014, Tegile Systems Inc. All rights reserved.
  27   27   * Copyright (c) 2017, Joyent, Inc.
  28   28   */
  29   29  
  30   30  /*
  31   31   * Copyright (c) 2000 to 2010, LSI Corporation.
  32   32   * All rights reserved.
  33   33   *
  34   34   * Redistribution and use in source and binary forms of all code within
↓ open down ↓ 503 lines elided ↑ open up ↑
 538  538                      DDI_DMA_SYNC_FORCPU);
 539  539                  reply = (pMpi2ConfigReply_t)(mpt->m_reply_frame + (cmd->cmd_rfm
 540  540                      - (mpt->m_reply_frame_dma_addr & 0xffffffffu)));
 541  541                  iocstatus = ddi_get16(mpt->m_acc_reply_frame_hdl,
 542  542                      &reply->IOCStatus);
 543  543                  iocstatus = MPTSAS_IOCSTATUS(iocstatus);
 544  544                  iocloginfo = ddi_get32(mpt->m_acc_reply_frame_hdl,
 545  545                      &reply->IOCLogInfo);
 546  546          }
 547  547  
 548      -        if (callback(mpt, page_memp, accessp, iocstatus, iocloginfo, ap)) {
      548 +        if (callback(mpt, page_memp, accessp, iocstatus, iocloginfo, ap)
      549 +            != DDI_SUCCESS) {
 549  550                  rval = DDI_FAILURE;
 550  551                  goto page_done;
 551  552          }
 552  553  
 553  554          mptsas_fma_check(mpt, cmd);
 554  555          /*
 555  556           * Check the DMA/ACC handles and then free the DMA buffer.
 556  557           */
 557  558          if ((mptsas_check_dma_handle(cmd->cmd_dmahandle) != DDI_SUCCESS) ||
 558  559              (mptsas_check_acc_handle(accessp) != DDI_SUCCESS)) {
↓ open down ↓ 543 lines elided ↑ open up ↑
1102 1103          struct scsi_pkt                         *pkt;
1103 1104          mptsas_slots_t                          *slots = mpt->m_active;
1104 1105          uint64_t                                request_desc, i;
1105 1106          pMPI2DefaultReply_t                     reply_msg;
1106 1107  
1107 1108          /*
1108 1109           * Can't start another task management routine.
1109 1110           */
1110 1111          if (slots->m_slot[MPTSAS_TM_SLOT(mpt)] != NULL) {
1111 1112                  mptsas_log(mpt, CE_WARN, "Can only start 1 task management"
1112      -                    " command at a time\n");
     1113 +                    " command at a time");
1113 1114                  return (FALSE);
1114 1115          }
1115 1116  
1116 1117          cmd = &(mpt->m_event_task_mgmt.m_event_cmd);
1117 1118          pkt = &(mpt->m_event_task_mgmt.m_event_pkt);
1118 1119  
1119 1120          bzero((caddr_t)cmd, sizeof (*cmd));
1120 1121          bzero((caddr_t)pkt, scsi_pkt_size());
1121 1122  
1122 1123          pkt->pkt_cdbp           = (opaque_t)&cmd->cmd_cdb[0];
↓ open down ↓ 190 lines elided ↑ open up ↑
1313 1314          int                     rvalue = 0;
1314 1315          uint64_t                request_desc;
1315 1316  
1316 1317          if (mpt->m_MPI25 && !mptsas_enable_mpi25_flashupdate) {
1317 1318                  /*
1318 1319                   * The code is there but not tested yet.
1319 1320                   * User has to know there are risks here.
1320 1321                   */
1321 1322                  mptsas_log(mpt, CE_WARN, "mptsas_update_flash(): "
1322 1323                      "Updating firmware through MPI 2.5 has not been "
1323      -                    "tested yet!\n"
1324      -                    "To enable set mptsas_enable_mpi25_flashupdate to 1\n");
     1324 +                    "tested yet!  "
     1325 +                    "To enable set mptsas_enable_mpi25_flashupdate to 1.");
1325 1326                  return (-1);
1326 1327          } /* Otherwise, you pay your money and you take your chances. */
1327 1328  
1328 1329          if ((rvalue = (mptsas_request_from_pool(mpt, &cmd, &pkt))) == -1) {
1329 1330                  mptsas_log(mpt, CE_WARN, "mptsas_update_flash(): allocation "
1330      -                    "failed. event ack command pool is full\n");
     1331 +                    "failed. event ack command pool is full");
1331 1332                  return (rvalue);
1332 1333          }
1333 1334  
1334 1335          bzero((caddr_t)cmd, sizeof (*cmd));
1335 1336          bzero((caddr_t)pkt, scsi_pkt_size());
1336 1337          cmd->ioc_cmd_slot = (uint32_t)rvalue;
1337 1338  
1338 1339          /*
1339 1340           * dynamically create a customized dma attribute structure
1340 1341           * that describes the flash file.
↓ open down ↓ 359 lines elided ↑ open up ↑
1700 1701          }
1701 1702          readpage1 = va_arg(ap, uint32_t *);
1702 1703          retrypage0 = va_arg(ap, uint32_t *);
1703 1704  
1704 1705          sasioupage0 = (pMpi2SasIOUnitPage0_t)page_memp;
1705 1706  
1706 1707          num_phys = ddi_get8(accessp, &sasioupage0->NumPhys);
1707 1708          /*
1708 1709           * ASSERT that the num_phys value in SAS IO Unit Page 0 is the same as
1709 1710           * was initially set.  This should never change throughout the life of
1710      -         * the driver.
     1711 +         * the driver.  Note, due to cases where we've seen page zero have more
     1712 +         * phys than the reported manufacturing information, we limit the number
     1713 +         * of phys here to what we got from the manufacturing information.
1711 1714           */
1712      -        ASSERT(num_phys == mpt->m_num_phys);
     1715 +        ASSERT3U(num_phys, >=, mpt->m_num_phys);
     1716 +        num_phys = mpt->m_num_phys;
1713 1717          for (i = 0; i < num_phys; i++) {
1714 1718                  cpdi[i] = ddi_get32(accessp,
1715 1719                      &sasioupage0->PhyData[i].
1716 1720                      ControllerPhyDeviceInfo);
1717 1721                  port_flags = ddi_get8(accessp,
1718 1722                      &sasioupage0->PhyData[i].PortFlags);
1719 1723                  mpt->m_phy_info[i].port_num =
1720 1724                      ddi_get8(accessp,
1721 1725                      &sasioupage0->PhyData[i].Port);
1722 1726                  mpt->m_phy_info[i].ctrl_devhdl =
↓ open down ↓ 41 lines elided ↑ open up ↑
1764 1768                  mptsas_log(mpt, CE_WARN, "mptsas_get_sas_io_unit_page1 "
1765 1769                      "config: IOCStatus=0x%x, IOCLogInfo=0x%x",
1766 1770                      iocstatus, iocloginfo);
1767 1771                  rval = DDI_FAILURE;
1768 1772                  return (rval);
1769 1773          }
1770 1774  
1771 1775          sasioupage1 = (pMpi2SasIOUnitPage1_t)page_memp;
1772 1776          num_phys = ddi_get8(accessp, &sasioupage1->NumPhys);
1773 1777          /*
1774      -         * ASSERT that the num_phys value in SAS IO Unit Page 1 is the same as
     1778 +         * ASSERT that the num_phys value in SAS IO Unit Page 0 is the same as
1775 1779           * was initially set.  This should never change throughout the life of
1776      -         * the driver.
     1780 +         * the driver.  Note, due to cases where we've seen page zero have more
     1781 +         * phys than the reported manufacturing information, we limit the number
     1782 +         * of phys here to what we got from the manufacturing information.
1777 1783           */
1778      -        ASSERT(num_phys == mpt->m_num_phys);
     1784 +        ASSERT3U(num_phys, >=, mpt->m_num_phys);
     1785 +        num_phys = mpt->m_num_phys;
1779 1786          for (i = 0; i < num_phys; i++) {
1780 1787                  cpdi[i] = ddi_get32(accessp, &sasioupage1->PhyData[i].
1781 1788                      ControllerPhyDeviceInfo);
1782 1789                  port_flags = ddi_get8(accessp,
1783 1790                      &sasioupage1->PhyData[i].PortFlags);
1784 1791                  mpt->m_phy_info[i].port_num =
1785 1792                      ddi_get8(accessp,
1786 1793                      &sasioupage1->PhyData[i].Port);
1787 1794                  mpt->m_phy_info[i].port_flags = port_flags;
1788 1795                  mpt->m_phy_info[i].phy_device_type = cpdi[i];
↓ open down ↓ 136 lines elided ↑ open up ↑
1925 1932  {
1926 1933          ddi_dma_attr_t          recv_dma_attrs, page_dma_attrs;
1927 1934          ddi_dma_cookie_t        page_cookie;
1928 1935          ddi_dma_handle_t        recv_dma_handle, page_dma_handle;
1929 1936          ddi_acc_handle_t        recv_accessp, page_accessp;
1930 1937          pMpi2ConfigReply_t      configreply;
1931 1938          pMpi2SasIOUnitPage0_t   sasioupage0;
1932 1939          pMpi2SasIOUnitPage1_t   sasioupage1;
1933 1940          int                     recv_numbytes;
1934 1941          caddr_t                 recv_memp, page_memp;
1935      -        int                     i, num_phys, start_phy = 0;
     1942 +        uint_t                  i, num_phys, start_phy = 0;
1936 1943          int                     page0_size =
1937 1944              sizeof (MPI2_CONFIG_PAGE_SASIOUNIT_0) +
1938 1945              (sizeof (MPI2_SAS_IO_UNIT0_PHY_DATA) * (MPTSAS_MAX_PHYS - 1));
1939 1946          int                     page1_size =
1940 1947              sizeof (MPI2_CONFIG_PAGE_SASIOUNIT_1) +
1941 1948              (sizeof (MPI2_SAS_IO_UNIT1_PHY_DATA) * (MPTSAS_MAX_PHYS - 1));
1942 1949          uint32_t                flags_length;
1943 1950          uint32_t                cpdi[MPTSAS_MAX_PHYS];
1944 1951          uint32_t                readpage1 = 0, retrypage0 = 0;
1945 1952          uint16_t                iocstatus;
↓ open down ↓ 159 lines elided ↑ open up ↑
2105 2112  
2106 2113                  switch (state) {
2107 2114                  case IOUC_READ_PAGE0:
2108 2115                          if ((ddi_dma_sync(page_dma_handle, 0, 0,
2109 2116                              DDI_DMA_SYNC_FORCPU)) != DDI_SUCCESS) {
2110 2117                                  goto cleanup;
2111 2118                          }
2112 2119  
2113 2120                          num_phys = ddi_get8(page_accessp,
2114 2121                              &sasioupage0->NumPhys);
2115      -                        ASSERT(num_phys == mpt->m_num_phys);
2116 2122                          if (num_phys > MPTSAS_MAX_PHYS) {
2117 2123                                  mptsas_log(mpt, CE_WARN, "Number of phys "
2118 2124                                      "supported by HBA (%d) is more than max "
2119 2125                                      "supported by driver (%d).  Driver will "
2120 2126                                      "not attach.", num_phys,
2121 2127                                      MPTSAS_MAX_PHYS);
2122 2128                                  rval = DDI_FAILURE;
2123 2129                                  goto cleanup;
2124 2130                          }
     2131 +                        if (num_phys > mpt->m_num_phys) {
     2132 +                                mptsas_log(mpt, CE_WARN, "Number of phys "
     2133 +                                    "reported by HBA SAS IO Unit Page 0 (%u) "
     2134 +                                    "is greater than that reported by the "
     2135 +                                    "manufacturing information (%u). Driver "
     2136 +                                    "phy count limited to %u. Please contact "
     2137 +                                    "the firmware vendor about this.", num_phys,
     2138 +                                    mpt->m_num_phys, mpt->m_num_phys);
     2139 +                                num_phys = mpt->m_num_phys;
     2140 +                        } else if (num_phys < mpt->m_num_phys) {
     2141 +                                mptsas_log(mpt, CE_WARN, "Number of phys "
     2142 +                                    "reported by HBA SAS IO Unit Page 0 (%u) "
     2143 +                                    "is less than that reported by the "
     2144 +                                    "manufacturing information (%u). Driver "
     2145 +                                    "will not attach. Please contact the "
     2146 +                                    "firmware vendor about this.", num_phys,
     2147 +                                    mpt->m_num_phys);
     2148 +                                rval = DDI_FAILURE;
     2149 +                                goto cleanup;
     2150 +                        }
2125 2151                          for (i = start_phy; i < num_phys; i++, start_phy = i) {
2126 2152                                  cpdi[i] = ddi_get32(page_accessp,
2127 2153                                      &sasioupage0->PhyData[i].
2128 2154                                      ControllerPhyDeviceInfo);
2129 2155                                  port_flags = ddi_get8(page_accessp,
2130 2156                                      &sasioupage0->PhyData[i].PortFlags);
2131 2157  
2132 2158                                  mpt->m_phy_info[i].port_num =
2133 2159                                      ddi_get8(page_accessp,
2134 2160                                      &sasioupage0->PhyData[i].Port);
↓ open down ↓ 51 lines elided ↑ open up ↑
2186 2212                          break;
2187 2213  
2188 2214                  case IOUC_READ_PAGE1:
2189 2215                          if ((ddi_dma_sync(page_dma_handle, 0, 0,
2190 2216                              DDI_DMA_SYNC_FORCPU)) != DDI_SUCCESS) {
2191 2217                                  goto cleanup;
2192 2218                          }
2193 2219  
2194 2220                          num_phys = ddi_get8(page_accessp,
2195 2221                              &sasioupage1->NumPhys);
2196      -                        ASSERT(num_phys == mpt->m_num_phys);
2197 2222                          if (num_phys > MPTSAS_MAX_PHYS) {
2198 2223                                  mptsas_log(mpt, CE_WARN, "Number of phys "
2199 2224                                      "supported by HBA (%d) is more than max "
2200 2225                                      "supported by driver (%d).  Driver will "
2201 2226                                      "not attach.", num_phys,
2202 2227                                      MPTSAS_MAX_PHYS);
2203 2228                                  rval = DDI_FAILURE;
2204 2229                                  goto cleanup;
2205 2230                          }
     2231 +                        if (num_phys > mpt->m_num_phys) {
     2232 +                                mptsas_log(mpt, CE_WARN, "Number of phys "
     2233 +                                    "reported by HBA SAS IO Unit Page 1 (%u) "
     2234 +                                    "is greater than that reported by the "
     2235 +                                    "manufacturing information (%u). Limiting "
     2236 +                                    "phy count to %u. Please contact the "
     2237 +                                    "firmware vendor about this.", num_phys,
     2238 +                                    mpt->m_num_phys, mpt->m_num_phys);
     2239 +                                num_phys = mpt->m_num_phys;
     2240 +                        } else if (num_phys < mpt->m_num_phys) {
     2241 +                                mptsas_log(mpt, CE_WARN, "Number of phys "
     2242 +                                    "reported by HBA SAS IO Unit Page 1 (%u) "
     2243 +                                    "is less than that reported by the "
     2244 +                                    "manufacturing information (%u). Driver "
     2245 +                                    "will not attach. Please contact the "
     2246 +                                    "firmware vendor about this.", num_phys,
     2247 +                                    mpt->m_num_phys);
     2248 +                                rval = DDI_FAILURE;
     2249 +                                goto cleanup;
     2250 +                        }
2206 2251                          for (i = 0; i < num_phys; i++) {
2207 2252                                  cpdi[i] = ddi_get32(page_accessp,
2208 2253                                      &sasioupage1->PhyData[i].
2209 2254                                      ControllerPhyDeviceInfo);
2210 2255                                  port_flags = ddi_get8(page_accessp,
2211 2256                                      &sasioupage1->PhyData[i].PortFlags);
2212 2257                                  mpt->m_phy_info[i].port_num =
2213 2258                                      ddi_get8(page_accessp,
2214 2259                                      &sasioupage1->PhyData[i].Port);
2215 2260                                  mpt->m_phy_info[i].port_flags = port_flags;
↓ open down ↓ 84 lines elided ↑ open up ↑
2300 2345  
2301 2346          /*
2302 2347           * get config reply message
2303 2348           */
2304 2349          if (mptsas_get_handshake_msg(mpt, recv_memp, recv_numbytes,
2305 2350              recv_accessp)) {
2306 2351                  rval = DDI_FAILURE;
2307 2352                  goto done;
2308 2353          }
2309 2354  
2310      -        if (iocstatus = ddi_get16(recv_accessp, &configreply->IOCStatus)) {
     2355 +        if ((iocstatus = ddi_get16(recv_accessp, &configreply->IOCStatus)) !=
     2356 +            0) {
2311 2357                  mptsas_log(mpt, CE_WARN, "mptsas_get_manufacture_page5 update: "
2312 2358                      "IOCStatus=0x%x, IOCLogInfo=0x%x", iocstatus,
2313 2359                      ddi_get32(recv_accessp, &configreply->IOCLogInfo));
2314 2360                  goto done;
2315 2361          }
2316 2362  
2317 2363          /*
2318 2364           * dynamically create a customized dma attribute structure
2319 2365           * that describes the MPT's config page structure.
2320 2366           */
↓ open down ↓ 39 lines elided ↑ open up ↑
2360 2406  
2361 2407          /*
2362 2408           * get reply view handshake
2363 2409           */
2364 2410          if (mptsas_get_handshake_msg(mpt, recv_memp, recv_numbytes,
2365 2411              recv_accessp)) {
2366 2412                  rval = DDI_FAILURE;
2367 2413                  goto done;
2368 2414          }
2369 2415  
2370      -        if (iocstatus = ddi_get16(recv_accessp, &configreply->IOCStatus)) {
     2416 +        if ((iocstatus = ddi_get16(recv_accessp, &configreply->IOCStatus)) !=
     2417 +            0) {
2371 2418                  mptsas_log(mpt, CE_WARN, "mptsas_get_manufacture_page5 config: "
2372 2419                      "IOCStatus=0x%x, IOCLogInfo=0x%x", iocstatus,
2373 2420                      ddi_get32(recv_accessp, &configreply->IOCLogInfo));
2374 2421                  goto done;
2375 2422          }
2376 2423  
2377 2424          (void) ddi_dma_sync(page_dma_handle, 0, 0, DDI_DMA_SYNC_FORCPU);
2378 2425  
2379 2426          /*
2380 2427           * Fusion-MPT stores fields in little-endian format.  This is
↓ open down ↓ 14 lines elided ↑ open up ↑
2395 2442           * Set the number of PHYs present.
2396 2443           */
2397 2444          mpt->m_num_phys = ddi_get8(page_accessp, (uint8_t *)&m5->NumPhys);
2398 2445  
2399 2446          if (ddi_prop_update_int(DDI_DEV_T_NONE, mpt->m_dip,
2400 2447              "num-phys", mpt->m_num_phys) != DDI_PROP_SUCCESS) {
2401 2448                  NDBG2(("%s%d: failed to create num-phys property",
2402 2449                      ddi_driver_name(mpt->m_dip), ddi_get_instance(mpt->m_dip)));
2403 2450          }
2404 2451  
2405      -        mptsas_log(mpt, CE_NOTE, "!mpt%d: Initiator WWNs: 0x%016llx-0x%016llx",
2406      -            mpt->m_instance, (unsigned long long)mpt->un.m_base_wwid,
     2452 +        mptsas_log(mpt, CE_NOTE, "Initiator WWNs: 0x%016llx-0x%016llx",
     2453 +            (unsigned long long)mpt->un.m_base_wwid,
2407 2454              (unsigned long long)mpt->un.m_base_wwid + mpt->m_num_phys - 1);
2408 2455  
2409 2456          if ((mptsas_check_dma_handle(recv_dma_handle) != DDI_SUCCESS) ||
2410 2457              (mptsas_check_dma_handle(page_dma_handle) != DDI_SUCCESS)) {
2411 2458                  ddi_fm_service_impact(mpt->m_dip, DDI_SERVICE_UNAFFECTED);
2412 2459                  rval = DDI_FAILURE;
2413 2460                  goto done;
2414 2461          }
2415 2462          if ((mptsas_check_acc_handle(recv_accessp) != DDI_SUCCESS) ||
2416 2463              (mptsas_check_acc_handle(page_accessp) != DDI_SUCCESS)) {
↓ open down ↓ 130 lines elided ↑ open up ↑
2547 2594          int                     rval = DDI_SUCCESS;
2548 2595  
2549 2596          uint32_t                *invalid_dword_count;
2550 2597          uint32_t                *running_disparity_error_count;
2551 2598          uint32_t                *loss_of_dword_sync_count;
2552 2599          uint32_t                *phy_reset_problem_count;
2553 2600          uint32_t                page_address;
2554 2601  
2555 2602          if ((iocstatus != MPI2_IOCSTATUS_SUCCESS) &&
2556 2603              (iocstatus != MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)) {
2557      -                mptsas_log(mpt, CE_WARN, "mptsas_get_sas_expander_page1 "
     2604 +                mptsas_log(mpt, CE_WARN, "%s "
2558 2605                      "config: IOCStatus=0x%x, IOCLogInfo=0x%x",
2559      -                    iocstatus, iocloginfo);
     2606 +                    __func__, iocstatus, iocloginfo);
2560 2607                  rval = DDI_FAILURE;
2561 2608                  return (rval);
2562 2609          }
2563 2610          page_address = va_arg(ap, uint32_t);
2564 2611          /*
2565 2612           * The INVALID_PAGE status is normal if using GET_NEXT_HANDLE and there
2566 2613           * are no more pages.  If everything is OK up to this point but the
2567 2614           * status is INVALID_PAGE, change rval to FAILURE and quit.  Also,
2568 2615           * signal that device traversal is complete.
2569 2616           */
↓ open down ↓ 108 lines elided ↑ open up ↑
2678 2725  
2679 2726          /*
2680 2727           * get config reply message
2681 2728           */
2682 2729          if (mptsas_get_handshake_msg(mpt, recv_memp, recv_numbytes,
2683 2730              recv_accessp)) {
2684 2731                  rval = DDI_FAILURE;
2685 2732                  goto done;
2686 2733          }
2687 2734  
2688      -        if (iocstatus = ddi_get16(recv_accessp, &configreply->IOCStatus)) {
     2735 +        if ((iocstatus = ddi_get16(recv_accessp, &configreply->IOCStatus)) !=
     2736 +            0) {
2689 2737                  mptsas_log(mpt, CE_WARN, "mptsas_get_manufacture_page5 update: "
2690 2738                      "IOCStatus=0x%x, IOCLogInfo=0x%x", iocstatus,
2691 2739                      ddi_get32(recv_accessp, &configreply->IOCLogInfo));
2692 2740                  goto done;
2693 2741          }
2694 2742  
2695 2743          /*
2696 2744           * dynamically create a customized dma attribute structure
2697 2745           * that describes the MPT's config page structure.
2698 2746           */
↓ open down ↓ 37 lines elided ↑ open up ↑
2736 2784  
2737 2785          /*
2738 2786           * get reply view handshake
2739 2787           */
2740 2788          if (mptsas_get_handshake_msg(mpt, recv_memp, recv_numbytes,
2741 2789              recv_accessp)) {
2742 2790                  rval = DDI_FAILURE;
2743 2791                  goto done;
2744 2792          }
2745 2793  
2746      -        if (iocstatus = ddi_get16(recv_accessp, &configreply->IOCStatus)) {
     2794 +        if ((iocstatus = ddi_get16(recv_accessp, &configreply->IOCStatus)) !=
     2795 +            0) {
2747 2796                  mptsas_log(mpt, CE_WARN, "mptsas_get_manufacture_page0 config: "
2748 2797                      "IOCStatus=0x%x, IOCLogInfo=0x%x", iocstatus,
2749 2798                      ddi_get32(recv_accessp, &configreply->IOCLogInfo));
2750 2799                  goto done;
2751 2800          }
2752 2801  
2753 2802          (void) ddi_dma_sync(page_dma_handle, 0, 0, DDI_DMA_SYNC_FORCPU);
2754 2803  
2755 2804          /*
2756 2805           * Fusion-MPT stores fields in little-endian format.  This is
↓ open down ↓ 126 lines elided ↑ open up ↑
2883 2932  
2884 2933          bzero(&encpage, sizeof (encpage));
2885 2934          rval = mptsas_access_config_page(mpt,
2886 2935              MPI2_CONFIG_ACTION_PAGE_READ_CURRENT,
2887 2936              MPI2_CONFIG_EXTPAGETYPE_ENCLOSURE, 0, page_address,
2888 2937              mptsas_enclosurepage_0_cb, page_address, &encpage);
2889 2938  
2890 2939          if (rval == DDI_SUCCESS) {
2891 2940                  mep->me_enchdl = encpage.EnclosureHandle;
2892 2941                  mep->me_flags = encpage.Flags;
     2942 +                mep->me_nslots = encpage.NumSlots;
     2943 +                mep->me_fslot = encpage.StartSlot;
     2944 +                mep->me_slotleds = NULL;
2893 2945          }
2894 2946  
2895 2947          return (rval);
2896 2948  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX