Print this page
4782 usba shouldn't abuse ddi_get_time(9f)
Reviewed by: Robert Mustacchi <rm@joyent.com>


   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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */



  25 
  26 #ifndef _SYS_USB_HUBDVAR_H
  27 #define _SYS_USB_HUBDVAR_H
  28 
  29 
  30 #ifdef  __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 #include <sys/sunndi.h>
  35 #include <sys/ndi_impldefs.h>
  36 #include <sys/usb/usba/usba_types.h>
  37 #include <sys/callb.h>
  38 
  39 /*
  40  * HUB USB device state management :
  41  *
  42  *                          CHILD PWRLVL---1>--------+
  43  *                               ^                   |
  44  *                               8                   |


  74  *
  75  */
  76 
  77 #define HUBD_INITIAL_SOFT_SPACE 4
  78 
  79 typedef struct hub_power_struct {
  80         void            *hubp_hubd;     /* points back to hubd_t */
  81 
  82         uint8_t         hubp_wakeup_enabled;    /* remote wakeup enabled? */
  83 
  84         /* this is the bit mask of the power states that device has */
  85         uint8_t         hubp_pwr_states;
  86 
  87         int             hubp_busy_pm;   /* device busy accounting */
  88 
  89         /* wakeup and power transition capabilities of an interface */
  90         uint8_t         hubp_pm_capabilities;
  91 
  92         uint8_t         hubp_current_power;     /* current power level */
  93 
  94         time_t          hubp_time_at_full_power;        /* timestamp 0->3 */
  95 
  96         uint8_t         hubp_min_pm_threshold;          /* in seconds */
  97 
  98         /* power state of all children are tracked here */
  99         uint8_t         *hubp_child_pwrstate;
 100 
 101         /* pm-components properties are stored here */
 102         char            *hubp_pmcomp[5];
 103 
 104         usba_cfg_pwr_descr_t    hubp_confpwr_descr; /* config pwr descr */
 105 } hub_power_t;
 106 
 107 /* warlock directives, stable data */
 108 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_hubd))
 109 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_wakeup_enabled))
 110 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pwr_states))
 111 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_time_at_full_power))
 112 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_min_pm_threshold))
 113 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pm_capabilities))
 114 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pmcomp))
 115 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_confpwr_descr))
 116 




   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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  27  */
  28 
  29 #ifndef _SYS_USB_HUBDVAR_H
  30 #define _SYS_USB_HUBDVAR_H
  31 
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 #include <sys/sunndi.h>
  38 #include <sys/ndi_impldefs.h>
  39 #include <sys/usb/usba/usba_types.h>
  40 #include <sys/callb.h>
  41 
  42 /*
  43  * HUB USB device state management :
  44  *
  45  *                          CHILD PWRLVL---1>--------+
  46  *                               ^                   |
  47  *                               8                   |


  77  *
  78  */
  79 
  80 #define HUBD_INITIAL_SOFT_SPACE 4
  81 
  82 typedef struct hub_power_struct {
  83         void            *hubp_hubd;     /* points back to hubd_t */
  84 
  85         uint8_t         hubp_wakeup_enabled;    /* remote wakeup enabled? */
  86 
  87         /* this is the bit mask of the power states that device has */
  88         uint8_t         hubp_pwr_states;
  89 
  90         int             hubp_busy_pm;   /* device busy accounting */
  91 
  92         /* wakeup and power transition capabilities of an interface */
  93         uint8_t         hubp_pm_capabilities;
  94 
  95         uint8_t         hubp_current_power;     /* current power level */
  96 
  97         hrtime_t        hubp_time_at_full_power;        /* timestamp 0->3 */
  98 
  99         hrtime_t        hubp_min_pm_threshold;          /* in nanoseconds */
 100 
 101         /* power state of all children are tracked here */
 102         uint8_t         *hubp_child_pwrstate;
 103 
 104         /* pm-components properties are stored here */
 105         char            *hubp_pmcomp[5];
 106 
 107         usba_cfg_pwr_descr_t    hubp_confpwr_descr; /* config pwr descr */
 108 } hub_power_t;
 109 
 110 /* warlock directives, stable data */
 111 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_hubd))
 112 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_wakeup_enabled))
 113 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pwr_states))
 114 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_time_at_full_power))
 115 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_min_pm_threshold))
 116 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pm_capabilities))
 117 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pmcomp))
 118 _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_confpwr_descr))
 119