Print this page
hg changesets 607a5b46a793..b706c96317c3
Fix ncpus for early boot config
Purge the ack to the interrupt before exiting mptsas_intr()
Changes from code review
Change some obvious references sas -> sas3.
Changes to enable driver to compile.
Header paths, object lists, etc.


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.

  25  */
  26 /*
  27  * This file contains SM-HBA support for MPT SAS driver
  28  */
  29 
  30 #if defined(lint) || defined(DEBUG)
  31 #define MPTSAS_DEBUG
  32 #endif
  33 
  34 /*
  35  * standard header files
  36  */
  37 #include <sys/note.h>
  38 #include <sys/scsi/scsi.h>
  39 #include <sys/pci.h>
  40 #include <sys/scsi/generic/sas.h>
  41 #include <sys/scsi/impl/scsi_sas.h>
  42 
  43 #pragma pack(1)
  44 #include <sys/scsi/adapters/mpt_sas/mpi/mpi2_type.h>
  45 #include <sys/scsi/adapters/mpt_sas/mpi/mpi2.h>
  46 #include <sys/scsi/adapters/mpt_sas/mpi/mpi2_cnfg.h>
  47 #include <sys/scsi/adapters/mpt_sas/mpi/mpi2_init.h>
  48 #include <sys/scsi/adapters/mpt_sas/mpi/mpi2_ioc.h>
  49 #include <sys/scsi/adapters/mpt_sas/mpi/mpi2_sas.h>
  50 #pragma pack()
  51 
  52 /*
  53  * private header files.
  54  */
  55 #include <sys/scsi/adapters/mpt_sas/mptsas_var.h>
  56 #include <sys/scsi/adapters/mpt_sas/mptsas_smhba.h>
  57 
  58 /*
  59  * SM - HBA statics
  60  */
  61 extern char *mptsas_driver_rev;
  62 
  63 static void mptsas_smhba_create_phy_props(nvlist_t **, smhba_info_t *, uint8_t,
  64     uint16_t *);
  65 static void mptsas_smhba_update_phy_props(mptsas_t *, dev_info_t *, nvlist_t **,
  66     uint8_t);
  67 
  68 static void
  69 mptsas_smhba_add_hba_prop(mptsas_t *mpt, data_type_t dt,
  70     char *prop_name, void *prop_val);
  71 
  72 void
  73 mptsas_smhba_show_phy_info(mptsas_t *mpt);
  74 
  75 static void
  76 mptsas_smhba_add_hba_prop(mptsas_t *mpt, data_type_t dt,


 314                 bzero(phymask, sizeof (phymask));
 315                 (void) sprintf(phymask, "%x", mpt->m_phy_info[i].phy_mask);
 316                 if (strcmp(phymask, iport) == 0) {
 317 
 318                         phyp = &mpt->m_phy_info[i].smhba_info;
 319                         mutex_enter(&phyp->phy_mutex);
 320 
 321                         if (phyp->phy_stats != NULL) {
 322                                 mutex_exit(&phyp->phy_mutex);
 323                                 /* We've already created this kstat instance */
 324                                 continue;
 325                         }
 326 
 327                         ndata = (sizeof (sas_phy_stats_t)/
 328                             sizeof (kstat_named_t));
 329                         (void) snprintf(ks_name, sizeof (ks_name),
 330                             "%s.%llx.%d.%d", ddi_driver_name(dip),
 331                             (longlong_t)mpt->un.m_base_wwid,
 332                             ddi_get_instance(dip), i);
 333 
 334                         phyp->phy_stats = kstat_create("mptsas",
 335                             ddi_get_instance(dip), ks_name, KSTAT_SAS_PHY_CLASS,
 336                             KSTAT_TYPE_NAMED, ndata, 0);
 337 
 338                         if (phyp->phy_stats == NULL) {
 339                                 mutex_exit(&phyp->phy_mutex);
 340                                 mptsas_log(mpt, CE_WARN,
 341                                     "%s: Failed to create %s kstats", __func__,
 342                                     ks_name);
 343                                 continue;
 344                         }
 345 
 346                         ps = (sas_phy_stats_t *)phyp->phy_stats->ks_data;
 347 
 348                         kstat_named_init(&ps->seconds_since_last_reset,
 349                             "SecondsSinceLastReset", KSTAT_DATA_ULONGLONG);
 350                         kstat_named_init(&ps->tx_frames,
 351                             "TxFrames", KSTAT_DATA_ULONGLONG);
 352                         kstat_named_init(&ps->rx_frames,
 353                             "RxFrames", KSTAT_DATA_ULONGLONG);
 354                         kstat_named_init(&ps->tx_words,




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright (c) 2014, Tegile Systems Inc. All rights reserved.
  26  */
  27 /*
  28  * This file contains SM-HBA support for MPT SAS3 driver
  29  */
  30 
  31 #if defined(lint) || defined(DEBUG)
  32 #define MPTSAS_DEBUG
  33 #endif
  34 
  35 /*
  36  * standard header files
  37  */
  38 #include <sys/note.h>
  39 #include <sys/scsi/scsi.h>
  40 #include <sys/pci.h>
  41 #include <sys/scsi/generic/sas.h>
  42 #include <sys/scsi/impl/scsi_sas.h>
  43 
  44 #pragma pack(1)
  45 #include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_type.h>
  46 #include <sys/scsi/adapters/mpt_sas3/mpi/mpi2.h>
  47 #include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_cnfg.h>
  48 #include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_init.h>
  49 #include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_ioc.h>
  50 #include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_sas.h>
  51 #pragma pack()
  52 
  53 /*
  54  * private header files.
  55  */
  56 #include <sys/scsi/adapters/mpt_sas3/mptsas3_var.h>
  57 #include <sys/scsi/adapters/mpt_sas3/mptsas3_smhba.h>
  58 
  59 /*
  60  * SM - HBA statics
  61  */
  62 extern char *mptsas_driver_rev;
  63 
  64 static void mptsas_smhba_create_phy_props(nvlist_t **, smhba_info_t *, uint8_t,
  65     uint16_t *);
  66 static void mptsas_smhba_update_phy_props(mptsas_t *, dev_info_t *, nvlist_t **,
  67     uint8_t);
  68 
  69 static void
  70 mptsas_smhba_add_hba_prop(mptsas_t *mpt, data_type_t dt,
  71     char *prop_name, void *prop_val);
  72 
  73 void
  74 mptsas_smhba_show_phy_info(mptsas_t *mpt);
  75 
  76 static void
  77 mptsas_smhba_add_hba_prop(mptsas_t *mpt, data_type_t dt,


 315                 bzero(phymask, sizeof (phymask));
 316                 (void) sprintf(phymask, "%x", mpt->m_phy_info[i].phy_mask);
 317                 if (strcmp(phymask, iport) == 0) {
 318 
 319                         phyp = &mpt->m_phy_info[i].smhba_info;
 320                         mutex_enter(&phyp->phy_mutex);
 321 
 322                         if (phyp->phy_stats != NULL) {
 323                                 mutex_exit(&phyp->phy_mutex);
 324                                 /* We've already created this kstat instance */
 325                                 continue;
 326                         }
 327 
 328                         ndata = (sizeof (sas_phy_stats_t)/
 329                             sizeof (kstat_named_t));
 330                         (void) snprintf(ks_name, sizeof (ks_name),
 331                             "%s.%llx.%d.%d", ddi_driver_name(dip),
 332                             (longlong_t)mpt->un.m_base_wwid,
 333                             ddi_get_instance(dip), i);
 334 
 335                         phyp->phy_stats = kstat_create("mptsas3",
 336                             ddi_get_instance(dip), ks_name, KSTAT_SAS_PHY_CLASS,
 337                             KSTAT_TYPE_NAMED, ndata, 0);
 338 
 339                         if (phyp->phy_stats == NULL) {
 340                                 mutex_exit(&phyp->phy_mutex);
 341                                 mptsas_log(mpt, CE_WARN,
 342                                     "%s: Failed to create %s kstats", __func__,
 343                                     ks_name);
 344                                 continue;
 345                         }
 346 
 347                         ps = (sas_phy_stats_t *)phyp->phy_stats->ks_data;
 348 
 349                         kstat_named_init(&ps->seconds_since_last_reset,
 350                             "SecondsSinceLastReset", KSTAT_DATA_ULONGLONG);
 351                         kstat_named_init(&ps->tx_frames,
 352                             "TxFrames", KSTAT_DATA_ULONGLONG);
 353                         kstat_named_init(&ps->rx_frames,
 354                             "RxFrames", KSTAT_DATA_ULONGLONG);
 355                         kstat_named_init(&ps->tx_words,