pm_power_has_changed man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

PM_POWER_HAS_CHANGED(9F)			      PM_POWER_HAS_CHANGED(9F)

NAME
       pm_power_has_changed  - Notify Power Management framework of autonomous
       power level change

SYNOPSIS
       #include <sys/ddi.h>
       #include <sys/sunddi.h>

       int pm_power_has_changed(dev_info_t *dip, int component, int level);

INTERFACE LEVEL
       Solaris DDI specific (Solaris DDI)

PARAMETERS
       dip
	      Pointer to the device dev_info structure

       component
		    Number of the component that has changed power level

       level
		Power level to which the indicated component has changed

DESCRIPTION
       The pm_power_has_changed(9)  function  notifies	the  Power  Management
       framework  that	the  power  level  of component of dip	has changed to
       level.

       Normally power level changes are	 initiated  by	the  Power  Management
       framework due to device idleness, or through a request to the framework
       from the driver via pm_raise_power(9F) or pm_lower_power(9F), but  some
       devices	may  change  power  levels  on their own. For the framework to
       track the power level of the  device  under  these  circumstances,  the
       framework  must be notified of autonomous power level changes by a call
       to pm_power_has_changed().

       Because of the asynchronous nature of these events, the	Power  Manage‐
       ment framework might have called power(9E) between the device's autono‐
       mous power level change and the driver calling  pm_power_has_changed(),
       or the framework may be in the process of changing the power level when
       pm_power_has_changed() is called. To handle these situations correctly,
       the  driver should verify that the device is indeed at the level or set
       the device to the level if it doesn't support inquirying of power  lev‐
       els,  before  calling  pm_power_has_changed().  In addition, the driver
       should prevent a power(9E) entry point from running  in	parallel  with
       pm_power_has_changed().

       Note -

	 If  this  function  is	 called as a result of entry into the driver's
	 attach(9E), detach(9E) or power(9E) entry point, this	function  must
	 be  called  from the same thread which entered attach(9E), detach(9E)
	 or power(9E).

RETURN VALUES
       The pm_power_has_changed() function returns:

       DDI_SUCCESS
		      The power level of component was successfully updated to
		      level.

       DDI_FAILURE
		      Invalid component component or power level level.

CONTEXT
       This  function can be called from user or kernel context. This function
       can also be called from interrupt context, providing that it is not the
       first Power Management function called by the driver.

EXAMPLES
       A   hypothetical	  driver   might   include   this   code   to	handle
       pm_power_has_changed(9):

	 static int
	 xxusb_intr(struct buf *bp)
	 {

	      ...

	      /*
	       * At this point the device has informed us that it has
	       * changed power level on its own. Inform this to framework.
	       * We need to take care of the case when framework has
	       * already called power() entry point and changed power level
	       * before we were able to inform framework of this change.
		  * Handle this by comparing the informed power level with
	       * the actual power level and only doing the call if they
	       * are same. In addition, make sure that power() doesn't get
	       * run in parallel with this code by holding the mutex.
	       */
		 ASSERT(mutex_owned(&xsp->lock));
	      if (level_informed == *(xsp->level_reg_addr)) {
		   if (pm_power_has_changed(xsp->dip, XXUSB_COMPONENT,
		       level_informed) != DDI_SUCCESS) {
			mutex_exit( &xsp->lock);
			return(DDI_INTR_UNCLAIMED);
		   }
		 }

	      ....

	 }

	 xxdisk_power(dev_info *dip, int comp, int level)
	 {
	      mutex_enter( xsp->lock);

	      ...

	      ...

	 }

ATTRIBUTES
       See attributes(5) for a description of the following attributes:

       ┌────────────────────┬─────────────────┐
       │  ATTRIBUTE TYPE    │ ATTRIBUTE VALUE │
       ├────────────────────┼─────────────────┤
       │Interface Stability │ Committed	      │
       └────────────────────┴─────────────────┘

SEE ALSO
       power.conf(4), pm(7D), attach(9E), detach(9E), power(9E),  pm_busy_com‐
       ponent(9F),	    pm_idle_component(9F),	   pm_raise_power(9F),
       pm_lower_power(9F), pm(9P), pm-components(9P)

       Writing Device Drivers

				 Jul 22, 2004	      PM_POWER_HAS_CHANGED(9F)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net