1. 18 5月, 2012 1 次提交
    • R
      ACPI / PCI / PM: Fix device PM regression related to D3hot/D3cold · 5c7dd710
      Rafael J. Wysocki 提交于
      Commit 1cc0c998 ("ACPI: Fix D3hot v D3cold confusion") introduced a
      bug in __acpi_bus_set_power() and changed the behavior of
      acpi_pci_set_power_state() in such a way that it generally doesn't work
      as expected if PCI_D3hot is passed to it as the second argument.
      
      First off, if ACPI_STATE_D3 (equal to ACPI_STATE_D3_COLD) is passed to
      __acpi_bus_set_power() and the explicit_set flag is set for the D3cold
      state, the function will try to execute AML method called "_PS4", which
      doesn't exist.
      
      Fix this by adding a check to ensure that the name of the AML method
      to execute for transitions to ACPI_STATE_D3_COLD is correct in
      __acpi_bus_set_power().  Also make sure that the explicit_set flag
      for ACPI_STATE_D3_COLD will be set if _PS3 is present and modify
      acpi_power_transition() to avoid accessing power resources for
      ACPI_STATE_D3_COLD, because they don't exist.
      
      Second, if PCI_D3hot is passed to acpi_pci_set_power_state() as the
      target state, the function will request a transition to
      ACPI_STATE_D3_HOT instead of ACPI_STATE_D3.  However,
      ACPI_STATE_D3_HOT is now only marked as supported if the _PR3 AML
      method is defined for the given device, which is rare.  This causes
      problems to happen on systems where devices were successfully put
      into ACPI D3 by pci_set_power_state(PCI_D3hot) which doesn't work
      now.  In particular, some unused graphics adapters are not turned
      off as a result.
      
      To fix this issue restore the old behavior of
      acpi_pci_set_power_state(), which is to request a transition to
      ACPI_STATE_D3 (equal to ACPI_STATE_D3_COLD) if either PCI_D3hot or
      PCI_D3cold is passed to it as the argument.
      
      This approach is not ideal, because generally power should not
      be removed from devices if PCI_D3hot is the target power state,
      but since this behavior is relied on, we have no choice but to
      restore it at the moment and spend more time on designing a
      better solution in the future.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=43228Reported-by: Nrocko <rockorequin@hotmail.com>
      Reported-by: NCristian Rodríguez <crrodriguez@opensuse.org>
      Reported-and-tested-by: NPeter <lekensteyn@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5c7dd710
  2. 05 5月, 2012 1 次提交
    • L
      ACPI: Fix D3hot v D3cold confusion · 1cc0c998
      Lin Ming 提交于
      Before this patch, ACPI_STATE_D3 incorrectly referenced D3hot
      in some places, but D3cold in other places.
      
      After this patch, ACPI_STATE_D3 always means ACPI_STATE_D3_COLD;
      and all references to D3hot use ACPI_STATE_D3_HOT.
      
      ACPI's _PR3 method is used to enter both D3hot and D3cold states.
      What distinguishes D3hot from D3cold is the presence _PR3
      (Power Resources for D3hot)  If these resources are all ON,
      then the state is D3hot.  If _PR3 is not present,
      or all _PR0 resources for the devices are OFF,
      then the state is D3cold.
      
      This patch applies after Linux-3.4-rc1.
      A future syntax cleanup may remove ACPI_STATE_D3
      to emphasize that it always means ACPI_STATE_D3_COLD.
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NAaron Lu <aaron.lu@amd.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      1cc0c998
  3. 30 3月, 2012 2 次提交
  4. 07 11月, 2011 1 次提交
  5. 26 4月, 2011 1 次提交
  6. 25 2月, 2011 1 次提交
    • R
      ACPI: Remove the wakeup.run_wake_count device field · 51907267
      Rafael J. Wysocki 提交于
      The wakeup.run_wake_count ACPI device field is only used by the PCI
      runtime PM code to "protect" devices from being prepared for
      generating wakeup signals more than once in a row.  However, it
      really doesn't provide any protection, because (1) all of the
      functions it is supposed to protect use their own reference counters
      effectively ensuring that the device will be set up for generating
      wakeup signals just once and (2) the PCI runtime PM code uses
      wakeup.run_wake_count in a racy way, since nothing prevents
      acpi_dev_run_wake() from being called concurrently from two different
      threads for the same device.
      
      Remove the wakeup.run_wake_count ACPI device field which is
      unnecessary, confusing and used in a wrong way.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      51907267
  7. 12 1月, 2011 7 次提交
    • R
      ACPI: Drop device flag wake_capable · d57d09a4
      Rafael J. Wysocki 提交于
      The wake_capable ACPI device flag is not necessary, because it is
      only used in scan.c for recording the information that _PRW is
      present for the given device.  That information is only used by
      acpi_add_single_object() to decide whether or not to call
      acpi_bus_get_wakeup_device_flags(), so the flag may be dropped
      if the _PRW check is moved to acpi_bus_get_wakeup_device_flags().
      Moreover, acpi_bus_get_wakeup_device_flags() always returns 0,
      so it really should be void.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      d57d09a4
    • R
      ACPI: Always check if _PRW is present before trying to evaluate it · 86e4e20e
      Rafael J. Wysocki 提交于
      Before evaluating _PRW for devices that are reported as inactive or
      not present by their _STA control methods we should check if those
      methods are actually present (otherwise the evaulation of _PRW will
      obviously fail and a scary message will be printed unnecessarily).
      Reported-by: NAndreas Mohr <andi@lisas.de>
      Reported-by: NMaciej Rutecki <maciej.rutecki@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      86e4e20e
    • R
      ACPI / PM: Register power resource devices as soon as they are needed · bf325f95
      Rafael J. Wysocki 提交于
      Depending on the organization of the ACPI namespace, power resource
      device objects may generally be scanned after the "regular" device
      objects that they are referred from through _PRn.  This, in turn, may
      cause acpi_bus_get_power_flags() to attempt to access them through
      acpi_bus_init_power() before they are registered (and initialized by
      acpi_power_driver).  [This is not a theoretical issue, it actually
      happens for one PnP device on my testbed HP nx6325.]
      
      To fix this problem, make acpi_bus_get_power_flags() attempt to
      register power resource devices as soon as they have been found in
      the _PRn output for any other devices.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      bf325f95
    • R
      ACPI / PM: Register acpi_power_driver early · 97d9a9e9
      Rafael J. Wysocki 提交于
      The ACPI device driver used for handling power resources,
      acpi_power_driver, creates a struct acpi_power_resource object for
      each ACPI device representing a power resource.  These objects are
      then used when setting and reading the power states of devices using
      the corresponding power resources.  Unfortunately, acpi_power_driver
      is registered after acpi_scan_init() that may add devices using the
      power resources before acpi_power_driver has a chance to create
      struct acpi_power_resource objects for them (specifically, the power
      resources may be referred to during the scanning process through
      acpi_bus_get_power() before they have been initialized).
      
      As the first step towards fixing this issue, move the registration
      of acpi_power_driver into acpi_scan_init() so that power resource
      devices can be initialized by it as soon as they have been found in
      the namespace.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      97d9a9e9
    • R
      ACPI / PM: Add function for device power state initialization · ade3e7fe
      Rafael J. Wysocki 提交于
      Add function acpi_bus_init_power() for getting the initial power
      state of an ACPI device and reference counting its power resources
      as appropriate.
      
      Make acpi_bus_get_power_flags() use the new function instead of
      acpi_bus_get_power() that updates device->power.state without
      reference counting the device's power resources.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      ade3e7fe
    • L
      ACPICA: Implicit notify support · bba63a29
      Lin Ming 提交于
      This feature provides an automatic device notification for wake devices
      when a wakeup GPE occurs and there is no corresponding GPE method or
      handler. Rather than ignoring such a GPE, an implicit AML Notify
      operation is performed on the parent device object.
      This feature is not part of the ACPI specification and is provided for
      Windows compatibility only.
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      bba63a29
    • L
      ACPICA: Rename some function and variable names · 3a37898d
      Lin Ming 提交于
      Some function and variable names are renamed to be consistent with
      ACPICA code base.
      
      acpi_raw_enable_gpe -> acpi_ev_add_gpe_reference
      acpi_raw_disable_gpe -> acpi_ev_remove_gpe_reference
      acpi_gpe_can_wake -> acpi_setup_gpe_for_wake
      acpi_gpe_wakeup -> acpi_set_gpe_wake_mask
      acpi_update_gpes -> acpi_update_all_gpes
      acpi_all_gpes_initialized -> acpi_gbl_all_gpes_initialized
      acpi_handler_info -> acpi_gpe_handler_info
      ...
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      3a37898d
  8. 07 1月, 2011 1 次提交
    • R
      ACPI / PM: Use device wakeup flags for handling ACPI wakeup devices · f2b56bc8
      Rafael J. Wysocki 提交于
      There are ACPI devices (buttons and the laptop lid) that can wake up
      the system from sleep states and have no "physical" companion
      devices.  The ACPI subsystem uses two flags, wakeup.state.enabled and
      wakeup.flags.always_enabled, for handling those devices, but they
      are not accessible through the standard device wakeup infrastructure.
      User space can only control them via the /proc/acpi/wakeup interface
      that is not really convenient (e.g. the way in which devices are
      enabled to wake up the system is not portable between different
      systems, because it requires one to know the devices' "names" used in
      the system's ACPI tables).
      
      To address this problem, use standard device wakeup flags instead of
      the special ACPI flags for handling those devices.  In particular,
      use device_set_wakeup_capable() to mark the ACPI wakeup devices
      during initialization and use device_set_wakeup_enable() to allow
      or disallow them to wake up the system from sleep states.  Rework
      the /proc/acpi/wakeup interface to take these changes into account.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      f2b56bc8
  9. 18 12月, 2010 1 次提交
    • R
      ACPI: Execute _PRW for devices reported as inactive or not present · b581a7f9
      Rafael J. Wysocki 提交于
      If a device is reported as inactive or not present by its _STA
      control method, acpi_bus_check_add() skips it without evaluating its
      _PRW method.  This leads to a problem when the device's _PRW method
      points to a GPE, because in that case the GPE may be enabled by
      ACPICA during the subsequent acpi_update_gpes() call which, in
      turn, may cause a GPE storm to appear.
      
      To avoid this issue, make acpi_bus_check_add() evaluate _PRW for
      inactive or not present devices and register the wakeup GPE
      information returned by them, so that acpi_update_gpes() does not
      enable their GPEs unnecessarily.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reported-by: NMatthew Garrett <mjg@redhat.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      b581a7f9
  10. 02 10月, 2010 2 次提交
  11. 25 9月, 2010 1 次提交
    • R
      ACPI / ACPICA: Defer enabling of runtime GPEs (v3) · a2100801
      Rafael J. Wysocki 提交于
      The current ACPI GPEs initialization code has a problem that it
      enables some GPEs pointed to by device _PRW methods, generally
      intended for signaling wakeup events (system or device wakeup).
      These GPEs are then almost immediately disabled by the ACPI namespace
      scanning code with the help of acpi_gpe_can_wake(), but it would be
      better not to enable them at all until really necessary.
      
      Modify the initialization of GPEs so that the ones that have
      associated _Lxx or _Exx methods and are not pointed to by any _PRW
      methods will be enabled after the namespace scan is complete.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      a2100801
  12. 13 7月, 2010 2 次提交
    • R
      ACPI / ACPICA: Do not execute _PRW methods during initialization · 9874647b
      Rafael J. Wysocki 提交于
      Currently, during initialization ACPICA walks the entire ACPI
      namespace in search of any device objects with assciated _PRW
      methods.  All of the _PRW methods found are executed in the process
      to extract the GPE information returned by them, so that the GPEs in
      question can be marked as "able to wakeup" (more precisely, the
      ACPI_GPE_CAN_WAKE flag is set for them).  The only purpose of this
      exercise is to avoid enabling the CAN_WAKE GPEs automatically, even
      if there are _Lxx/_Exx methods associated with them.  However, it is
      both costly and unnecessary, because the host OS has to execute the
      _PRW methods anyway to check which devices can wake up the system
      from sleep states.  Moreover, it then uses full information
      returned by _PRW, including the GPE information, so it can take care
      of disabling the GPEs if necessary.
      
      Remove the code that walks the namespace and executes _PRW from
      ACPICA and modify comments to reflect that change.  Make
      acpi_bus_set_run_wake_flags() disable GPEs for wakeup devices
      so that they don't cause spurious wakeup events to be signaled.
      This not only reduces the complexity of the ACPICA initialization
      code, but in some cases it should reduce the kernel boot time as
      well.
      
      Unfortunately, for this purpose we need a new ACPICA function,
      acpi_gpe_can_wake(), to be called by the host OS in order to disable
      the GPEs that can wake up the system and were previously enabled by
      acpi_ev_initialize_gpe_block() or acpi_ev_update_gpes() (such a GPE
      should be disabled only once, because the initialization code enables
      it only once, but it may be pointed to by _PRW for multiple devices
      and that's why the additional function is necessary).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      9874647b
    • R
      ACPI: Fix bogus GPE test in acpi_bus_set_run_wake_flags() · e8e18c95
      Rafael J. Wysocki 提交于
      When we check if a GPE can be used for runtime signaling, we only
      search the FADT GPE blocks, which is incorrect, becuase the GPE
      may be located elsewhere.  We really should be using the GPE device
      information previously returned by _PRW here, so make that happen.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      e8e18c95
  13. 20 4月, 2010 1 次提交
  14. 04 4月, 2010 1 次提交
  15. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  16. 24 3月, 2010 1 次提交
    • D
      acpi: Support IBM SMBus CMI devices · 222e82ac
      Darrick J. Wong 提交于
      On some old IBM workstations and desktop computers, the BIOS presents in the
      DSDT an SMBus object that is missing the HID identifier that the i2c-scmi
      driver looks for.  Modify the ACPI device scan code to insert the missing HID
      if it finds an IBM system with such an object.
      
      Affected machines: IntelliStation Z20/Z30.  Note that the i2c-i801 driver no
      longer works on these machines because of ACPI resource conflicts.
      Signed-off-by: NDarrick J. Wong <djwong@us.ibm.com>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      222e82ac
  17. 23 2月, 2010 2 次提交
    • R
      PCI / ACPI / PM: Platform support for PCI PME wake-up · b67ea761
      Rafael J. Wysocki 提交于
      Although the majority of PCI devices can generate PMEs that in
      principle may be used to wake up devices suspended at run time,
      platform support is generally necessary to convert PMEs into wake-up
      events that can be delivered to the kernel.  If ACPI is used for this
      purpose, PME signals generated by a PCI device will trigger the ACPI
      GPE associated with the device to generate an ACPI wake-up event that
      we can set up a handler for, provided that everything is configured
      correctly.
      
      Unfortunately, the subset of PCI devices that have GPEs associated
      with them is quite limited.  The devices without dedicated GPEs have
      to rely on the GPEs associated with other devices (in the majority of
      cases their upstream bridges and, possibly, the root bridge) to
      generate ACPI wake-up events in response to PME signals from them.
      
      Add ACPI platform support for PCI PME wake-up:
      o Add a framework making is possible to use ACPI system notify
        handlers for run-time PM.
      o Add new PCI platform callback ->run_wake() to struct
        pci_platform_pm_ops allowing us to enable/disable the platform to
        generate wake-up events for given device.  Implemet this callback
        for the ACPI platform.
      o Define ACPI wake-up handlers for PCI devices and PCI root buses and
        make the PCI-ACPI binding code register wake-up notifiers for all
        PCI devices present in the ACPI tables.
      o Add function pci_dev_run_wake() which can be used by PCI drivers to
        check if given device is capable of generating wake-up events at
        run time.
      
      Developed in cooperation with Matthew Garrett <mjg@redhat.com>.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      b67ea761
    • R
      ACPI / PM: Add more run-time wake-up fields · f517709d
      Rafael J. Wysocki 提交于
      Use the run_wake flag to mark all devices for which run-time wake-up
      events may be generated by the platform.  Introduce a new wake-up
      flag, always_enabled, for marking devices that should be permanently
      enabled to generate run-time events.  Also, introduce a reference
      counter for run-wake devices and a function that will initialize all
      of the run-time wake-up fields for given device.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NLen Brown <len.brown@intel.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      f517709d
  18. 01 2月, 2010 2 次提交
  19. 25 11月, 2009 1 次提交
  20. 02 10月, 2009 1 次提交
  21. 26 9月, 2009 9 次提交