パワーManagement interface for Solaris device driver


Please refer tohttp://blogs.sun.com/randyf/entry/more_パワーto_for original post.
More Power to You
Typeically、I wonder if my posts are more more snippits of tidbits(ahh、Kibles and Bits!!!!)、but here is a bit more.
The Solaris operatentenvironment supports various aspects of power management、including Suspend Resumve(a.k.a.CheckPoint Resume、or CPR)、and so so so will Solaris on x 86(much of whihihich thethethetheregogogogogogogogotttttttgogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogottttttttttttttttttttttttttttttttttttttttttttttmanagement interfaces:
  • DDI_SUSPEND(a flags passed to detatch(9 e))
  • DDI_RESUME
  • パワー(9 e)
  • Musch on these interfaces can be found at http://docs.sun.com、or on the relevant man pages for the atch(9 e)、detatch(9 e)、and power(9 d)man pages.
    But in a nutshell,DDI_SUSPEND and DDI_RESUME cases shuted handle the saving and restoring of handware state before a device is shutdown or restored after a shutdown.And power(9 e)isthe procedure that Power Management frame Frame functions will will atwork protement atwork protement atwork protement atwork
    the power(9 e)entry point also works in conjunction with:
  • pm_lower.パワー(9 f)-Lower power on a component
  • pm_レイセ.パワー(9 f)-Raise power on a component
  • pm_busy_component(9 f)-Indicate that the component is busy
  • pm_idle_component(9 f)-Indicate that the component is idle
  • pm_クリアードcomponents(9 f)-Create mage ble components
  • pm_デストロイcomponents(9 f)-Destroy managerble components
  • So are you writing a driver,and expect it to work with Solaris Power Management.Well,the first and most import part of this equasion is that you Must implement the DDISUSPEND and DDI_RESUME command the atch and detach routines.And in this section of the code,it is impotant to taken from the hardware,and save it into neker memory
    xxx_detach() [
    switch (cmd) {
    case DDI_SUSPEND:
    /* Save hardware state */
    if (OK)
    return (DDI_SUCCESS);
    else
    return (DDI_FAILURE);
    break;
    case DDI_DETACH:
    /* Do attach processing */
    if (OK)
    return (DDI_SUCCESS);
    else
    return (DDI_FAILURE);
    break;
    default:
    /* Shouldn't be here */
    return (DDI_VAILURE);
    }
    xxxattach() {
    case DDI_RESUME:
    /* Restore hardware state */
    /* See the return related information in detach */
    break;
    case DDI_DETACH:
    /* Do attach processing */
    default:
    /* Shouldn't be here */
    return (DDI_FAILURE);
    }
    Of course,the relevent hadware information need to save and/or restore the driver after a suspend/reume needes to be put inside the DDI_SUSPEND/DDI_RESUME case,and cannot really be presented here.However,if a the driver is written well,it can very well have a drv_。suspend()function、アンドthe atch/detach routines become very to manage.
    And shoud your driver be able to handle various powers states、say a laptop frame ebuffer that allows for the backligh to be atch lower intens、or a disk driver that allows for the drive spinment the mantroutines above(gotta register the components、and let the Solaris power management frameew know when the y are idle)
    But alas、this may be a lot of thinking for a day、so maybe it is time for a California Pale Ale!オーケー、there really isn't a category fora California Pale Ale、but one of the classic Pale Ales from California、isthe Sierra Nevada Pale Ale.Light and crisp、with a hit of Hop fright iness.A great ale for fine.A.da.fane.
    And sometime later、I will add some more details to Power Mangement Do ou have some questions or suggaestions、just add a comment、I will happily elabort more!