Print this page
4786 emlxs shouldn't abuse ddi_get_time(9f)


   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 2010 Emulex.  All rights reserved.
  24  * Use is subject to license terms.
  25  * Copyright (c) 2011 Bayard G. Bell. All rights reserved.

  26  */
  27 
  28 
  29 #define DEF_ICFG        1
  30 
  31 #include <emlxs.h>
  32 #include <emlxs_version.h>
  33 
  34 
  35 char emlxs_revision[] = EMLXS_REVISION;
  36 char emlxs_version[] = EMLXS_VERSION;
  37 char emlxs_name[] = EMLXS_NAME;
  38 char emlxs_label[] = EMLXS_LABEL;
  39 
  40 /* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
  41 EMLXS_MSG_DEF(EMLXS_SOLARIS_C);
  42 
  43 #ifdef MENLO_SUPPORT
  44 static int32_t  emlxs_send_menlo(emlxs_port_t *port, emlxs_buf_t *sbp);
  45 #endif /* MENLO_SUPPORT */


1080 int
1081 _init(void)
1082 {
1083         int ret;
1084         char buf[64];
1085 
1086         /*
1087          * First init call for this driver,
1088          * so initialize the emlxs_dev_ctl structure.
1089          */
1090         bzero(&emlxs_device, sizeof (emlxs_device));
1091 
1092 #ifdef MODSYM_SUPPORT
1093         bzero(&emlxs_modsym, sizeof (emlxs_modsym_t));
1094 #endif /* MODSYM_SUPPORT */
1095 
1096         (void) sprintf(buf, "%s_device mutex", DRIVER_NAME);
1097         mutex_init(&emlxs_device.lock, buf, MUTEX_DRIVER, NULL);
1098 
1099         (void) drv_getparm(LBOLT, &emlxs_device.log_timestamp);
1100         emlxs_device.drv_timestamp = ddi_get_time();
1101 
1102         for (ret = 0; ret < MAX_FC_BRDS; ret++) {
1103                 emlxs_instance[ret] = (uint32_t)-1;
1104         }
1105 
1106         /*
1107          * Provide for one ddiinst of the emlxs_dev_ctl structure
1108          * for each possible board in the system.
1109          */
1110         if ((ret = ddi_soft_state_init(&emlxs_soft_state,
1111             sizeof (emlxs_hba_t), MAX_FC_BRDS)) != 0) {
1112                 cmn_err(CE_WARN,
1113                     "?%s: _init: ddi_soft_state_init failed. rval=%x",
1114                     DRIVER_NAME, ret);
1115 
1116                 return (ret);
1117         }
1118 
1119 #ifdef MODSYM_SUPPORT
1120         /* Open SFS */




   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 2010 Emulex.  All rights reserved.
  24  * Use is subject to license terms.
  25  * Copyright (c) 2011 Bayard G. Bell. All rights reserved.
  26  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  27  */
  28 
  29 
  30 #define DEF_ICFG        1
  31 
  32 #include <emlxs.h>
  33 #include <emlxs_version.h>
  34 
  35 
  36 char emlxs_revision[] = EMLXS_REVISION;
  37 char emlxs_version[] = EMLXS_VERSION;
  38 char emlxs_name[] = EMLXS_NAME;
  39 char emlxs_label[] = EMLXS_LABEL;
  40 
  41 /* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
  42 EMLXS_MSG_DEF(EMLXS_SOLARIS_C);
  43 
  44 #ifdef MENLO_SUPPORT
  45 static int32_t  emlxs_send_menlo(emlxs_port_t *port, emlxs_buf_t *sbp);
  46 #endif /* MENLO_SUPPORT */


1081 int
1082 _init(void)
1083 {
1084         int ret;
1085         char buf[64];
1086 
1087         /*
1088          * First init call for this driver,
1089          * so initialize the emlxs_dev_ctl structure.
1090          */
1091         bzero(&emlxs_device, sizeof (emlxs_device));
1092 
1093 #ifdef MODSYM_SUPPORT
1094         bzero(&emlxs_modsym, sizeof (emlxs_modsym_t));
1095 #endif /* MODSYM_SUPPORT */
1096 
1097         (void) sprintf(buf, "%s_device mutex", DRIVER_NAME);
1098         mutex_init(&emlxs_device.lock, buf, MUTEX_DRIVER, NULL);
1099 
1100         (void) drv_getparm(LBOLT, &emlxs_device.log_timestamp);
1101         emlxs_device.drv_timestamp = gethrtime();
1102 
1103         for (ret = 0; ret < MAX_FC_BRDS; ret++) {
1104                 emlxs_instance[ret] = (uint32_t)-1;
1105         }
1106 
1107         /*
1108          * Provide for one ddiinst of the emlxs_dev_ctl structure
1109          * for each possible board in the system.
1110          */
1111         if ((ret = ddi_soft_state_init(&emlxs_soft_state,
1112             sizeof (emlxs_hba_t), MAX_FC_BRDS)) != 0) {
1113                 cmn_err(CE_WARN,
1114                     "?%s: _init: ddi_soft_state_init failed. rval=%x",
1115                     DRIVER_NAME, ret);
1116 
1117                 return (ret);
1118         }
1119 
1120 #ifdef MODSYM_SUPPORT
1121         /* Open SFS */