Documentation/power/notifers.txt

来源:互联网 发布:linux db2 创建实例 编辑:程序博客网 时间:2024/06/03 14:52
Chinese translated version of Documentation/power/notifers.txt


If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.


Chinese maintainer: keyingjing <342311642@qq.com>
---------------------------------------------------------------------
Documentation/power/notifers.txt 的中文翻译


如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。


中文版维护者: 柯莹璟  <342311642@qq.com>
中文版翻译者: 柯莹璟  <342311642@qq.com>
中文版校译者: 柯莹璟  <342311642@qq.com>




Suspend notifiers
          (C) 2007-2011 Rafael J. Wysocki <rjw@sisk.pl>, GPL
There are some operations that subsystems or drivers may want to carry out before 
hibernation/suspend or after restore/resume, but they require the system to be fully 
functional, so the drivers' and subsystems' .suspend() and .resume()or even .
prepare() and .complete() callbacks are not suitable for this purpose.
For example, device drivers may want to upload firmware to their devices after
resume/restore, but they cannot do it by calling request_firmware() from their
.resume() or .complete() routines (user land processes are frozen at these
points).  The solution may be to load the firmware into memory before processes
are frozen and upload it from there in the .resume() routine.
A suspend/hibernation notifier may be used for this purpose.


暂停通知
(C) 2007-2011 Rafael J. Wysocki <rjw@sisk.pl>, GPL
有些操作子系统或驱动器可能再进行休眠/挂起前或者还原/恢复后要求系统更功能齐全,因此
驱动器和子系统的.suspend()函数和.resume()函数,甚至.prepare()函数和.complete()函数
回调不适用于此目的。
例如,设备驱动器可能在还原/恢复后上传固件到设备,但是他们无法做到仅从.resume()和 
.complete()例程中通过调用函数request_firmware()(此处的用户区域被冻结)。在.resume()
例程中,该解决方案可能在进程被冻结前把固件负载到内存中并上传。
挂起/休眠通知器可能被用于此目的。

The subsystems or drivers having such needs can register suspend notifiers that
will be called upon the following events by the PM core:
有下列事件需求的子系统或驱动程序将被PM核心要求注册暂停通知器:
  
  PM_HIBERNATION_PREPARE  The system is going to hibernate, tasks will be frozen
                          immediately. This is different from PM_SUSPEND_PREPARE
                          below because here we do additional work between notifiers
                          and drivers freezing.

  PM_HIBERNATION_PREPARE  系统准备休眠时,任务将立即被冻结。与下文PM_SUSPEND_PREPARE
                          不同的是因为此处我们在通知器和冻结驱动程序之间做了额外工作。
  
  PM_POST_HIBERNATION     The system memory state has been restored from a
                          hibernation image or an error occurred during
                          hibernation.  Device drivers' restore callbacks have
                          been executed and tasks have been thawed.

  PM_POST_HIBERNATION     系统内存状态已经从休眠图像或休眠过程里发生的错误中
                          得到恢复。设备驱动程序恢复回调任务已经解冻并执行。

  
  PM_RESTORE_PREPARE      The system is going to restore a hibernation image.
                         If all goes well, the restored kernel will issue a
                          PM_POST_HIBERNATION notification.
 
  PM_RESTORE_PREPARE 系统将恢复休眠图像。如果一切顺利,恢复的内核会发出 
PM_POST_HIBERNA通知。
 
  PM_POST_RESTORE         An error occurred during restore from hibernation.
                          Device drivers' restore callbacks have been executed
                          and tasks have been thawed.
 
  PM_POST_RESTORE  在恢复休眠时发生错误。设备驱动程序恢复回调任务已经
                          解冻并执行。  
  
  PM_SUSPEND_PREPARE      The system is preparing for suspend.
  
  PM_SUSPEND_PREPARE      该系统准备挂起。
  
  PM_POST_SUSPEND         The system has just resumed or an error occurred during
                          suspend.  Device drivers' resume callbacks have been
                          executed and tasks have been thawed.
 
  PM_POST_SUSPEND  系统刚刚恢复或休眠期间发生错误。设备驱动程序恢复回调
                          任务已经解冻并执行。  
  
   It is generally assumed that whatever the notifiers do for
  PM_HIBERNATION_PREPARE, should be undone for PM_POST_HIBERNATION. Analogously,
  operations performed for PM_SUSPEND_PREPARE should be reversed for
  PM_POST_SUSPEND. Additionally, all of the notifiers are called for
  PM_POST_HIBERNATION if one of them fails for PM_HIBERNATION_PREPARE, and
  all of the notifiers are called for PM_POST_SUSPEND if one of them fails for
  PM_SUSPEND_PREPARE.
  
       人们普遍认为,无论通知器为PM_HIBERNATION_PREPARE做什么,都应撤销
PM_POST_HIBERNATION。类似地,执行PM_SUSPEND_PREPARE操作应扭转为PM_POST_SUSPEND。
此外,如果PM_HIBERNATION_PREPARE其中之一出现故障,所有的通知器被PM_POST_HIBERNATION
调用,如果PM_SUSPEND_PREPARE其中之一出现故障,所有的通知器被PM_POST_SUSPEND调用。


  The hibernation and suspend notifiers are called with pm_mutex held.  They are
  defined in the usual way, but their last argument is meaningless (it is always
  NULL).  To register and/or unregister a suspend notifier use the functions
  register_pm_notifier() and unregister_pm_notifier(), respectively, defined in
  include/linux/suspend.h .  If you don't need to unregister the notifier, you can
  also use the pm_notifier() macro defined in include/linux/suspend.h .
   
      休眠和挂起通知器同pm_mutex一起被挂起调用。他们以通常方式定义,但是他们的最后
一个参数是没有意义的(它通常为空)。要注册和/或注销休眠通知器需分别使用定义在/linux/suspend.h
中的函数register_pm_notifier()和unregister_pm_notifier()。如果你不需要注销通知器,
你也可以使用在/linux/suspend.h 中宏定义的pm_notifier()函数。
原创粉丝点击