1. 15 10月, 2011 1 次提交
    • R
      PCI / PM: Extend PME polling to all PCI devices · 379021d5
      Rafael J. Wysocki 提交于
      The land of PCI power management is a land of sorrow and ugliness,
      especially in the area of signaling events by devices.  There are
      devices that set their PME Status bits, but don't really bother
      to send a PME message or assert PME#.  There are hardware vendors
      who don't connect PME# lines to the system core logic (they know
      who they are).  There are PCI Express Root Ports that don't bother
      to trigger interrupts when they receive PME messages from the devices
      below.  There are ACPI BIOSes that forget to provide _PRW methods for
      devices capable of signaling wakeup.  Finally, there are BIOSes that
      do provide _PRW methods for such devices, but then don't bother to
      call Notify() for those devices from the corresponding _Lxx/_Exx
      GPE-handling methods.  In all of these cases the kernel doesn't have
      a chance to receive a proper notification that it should wake up a
      device, so devices stay in low-power states forever.  Worse yet, in
      some cases they continuously send PME Messages that are silently
      ignored, because the kernel simply doesn't know that it should clear
      the device's PME Status bit.
      
      This problem was first observed for "parallel" (non-Express) PCI
      devices on add-on cards and Matthew Garrett addressed it by adding
      code that polls PME Status bits of such devices, if they are enabled
      to signal PME, to the kernel.  Recently, however, it has turned out
      that PCI Express devices are also affected by this issue and that it
      is not limited to add-on devices, so it seems necessary to extend
      the PME polling to all PCI devices, including PCI Express and planar
      ones.  Still, it would be wasteful to poll the PME Status bits of
      devices that are known to receive proper PME notifications, so make
      the kernel (1) poll the PME Status bits of all PCI and PCIe devices
      enabled to signal PME and (2) disable the PME Status polling for
      devices for which correct PME notifications are received.
      Tested-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      379021d5
  2. 29 5月, 2011 1 次提交
  3. 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
  4. 15 1月, 2011 1 次提交
  5. 24 12月, 2010 1 次提交
    • M
      PCI: Disable ASPM if BIOS asks us to · 2f671e2d
      Matthew Garrett 提交于
      We currently refuse to touch the ASPM registers if the BIOS tells us that
      ASPM isn't supported. This can cause problems if the BIOS has (for any
      reason) enabled ASPM on some devices anyway. Change the code such that we
      explicitly clear ASPM if the FADT indicates that ASPM isn't supported,
      and make sure we tidy up appropriately on device removal in order to deal
      with the hotplug case. If ASPM is disabled because the BIOS doesn't hand
      over control then we won't touch the registers.
      Signed-off-by: NMatthew Garrett <mjg@redhat.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      2f671e2d
  6. 19 7月, 2010 1 次提交
    • R
      PM: Make it possible to avoid races between wakeup and system sleep · c125e96f
      Rafael J. Wysocki 提交于
      One of the arguments during the suspend blockers discussion was that
      the mainline kernel didn't contain any mechanisms making it possible
      to avoid races between wakeup and system suspend.
      
      Generally, there are two problems in that area.  First, if a wakeup
      event occurs exactly when /sys/power/state is being written to, it
      may be delivered to user space right before the freezer kicks in, so
      the user space consumer of the event may not be able to process it
      before the system is suspended.  Second, if a wakeup event occurs
      after user space has been frozen, it is not generally guaranteed that
      the ongoing transition of the system into a sleep state will be
      aborted.
      
      To address these issues introduce a new global sysfs attribute,
      /sys/power/wakeup_count, associated with a running counter of wakeup
      events and three helper functions, pm_stay_awake(), pm_relax(), and
      pm_wakeup_event(), that may be used by kernel subsystems to control
      the behavior of this attribute and to request the PM core to abort
      system transitions into a sleep state already in progress.
      
      The /sys/power/wakeup_count file may be read from or written to by
      user space.  Reads will always succeed (unless interrupted by a
      signal) and return the current value of the wakeup events counter.
      Writes, however, will only succeed if the written number is equal to
      the current value of the wakeup events counter.  If a write is
      successful, it will cause the kernel to save the current value of the
      wakeup events counter and to abort the subsequent system transition
      into a sleep state if any wakeup events are reported after the write
      has returned.
      
      [The assumption is that before writing to /sys/power/state user space
      will first read from /sys/power/wakeup_count.  Next, user space
      consumers of wakeup events will have a chance to acknowledge or
      veto the upcoming system transition to a sleep state.  Finally, if
      the transition is allowed to proceed, /sys/power/wakeup_count will
      be written to and if that succeeds, /sys/power/state will be written
      to as well.  Still, if any wakeup events are reported to the PM core
      by kernel subsystems after that point, the transition will be
      aborted.]
      
      Additionally, put a wakeup events counter into struct dev_pm_info and
      make these per-device wakeup event counters available via sysfs,
      so that it's possible to check the activity of various wakeup event
      sources within the kernel.
      
      To illustrate how subsystems can use pm_wakeup_event(), make the
      low-level PCI runtime PM wakeup-handling code use it.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Acked-by: Nmarkgross <markgross@thegnar.org>
      Reviewed-by: NAlan Stern <stern@rowland.harvard.edu>
      c125e96f
  7. 07 7月, 2010 1 次提交
  8. 23 2月, 2010 1 次提交
    • 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
  9. 28 1月, 2010 1 次提交
  10. 17 12月, 2009 1 次提交
    • R
      PCI/PM: Propagate wake-up enable for PCIe devices too · dc1a94ae
      Rafael J. Wysocki 提交于
      Having read the PM part of the PCIe 2.0 specification more carefully
      I think that it was a mistake to restrict the wake-up enable
      propagation to non-PCIe devices, because if we do not request
      control of the root ports' PME registers via OSC, PCIe PME is
      supposed to be handled by the platform, just like the non-PCIe PME.
      Even if we do that, the wake-up propagation is done to allow the
      devices to wake up the system from sleep states which involves the
      platform anyway, so it won't hurt.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      dc1a94ae
  11. 25 11月, 2009 1 次提交
  12. 10 9月, 2009 3 次提交
  13. 27 3月, 2009 1 次提交
  14. 20 3月, 2009 1 次提交
  15. 08 1月, 2009 6 次提交
  16. 31 12月, 2008 1 次提交
  17. 12 11月, 2008 1 次提交
    • K
      PCI: ignore bit0 of _OSC return code · 2485b867
      Kenji Kaneshige 提交于
      Currently acpi_run_osc() checks all the bits in _OSC result code (the
      first DWORD in the capabilities buffer) to see error condition. But the
      bit 0, which doesn't indicate any error, must be ignored.
      
      The bit 0 is used as the query flag at _OSC invocation time. Some
      platforms clear it during _OSC evaluation, but the others don't. On
      latter platforms, current acpi_run_osc() mis-detects error when _OSC is
      evaluated with query flag set because it doesn't ignore the bit 0.
      Because of this, the __acpi_query_osc() always fails on such platforms.
      
      And this is the cause of the problem that pci_osc_control_set() doesn't
      work since the commit 4e39432f which
      changed pci_osc_control_set() to use __acpi_query_osc().
      Tested-by: N"Tomasz Czernecki <czernecki@gmail.com>
      Signed-off-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      2485b867
  18. 25 10月, 2008 1 次提交
  19. 23 10月, 2008 4 次提交
  20. 29 7月, 2008 1 次提交
  21. 17 7月, 2008 2 次提交
  22. 08 7月, 2008 3 次提交
    • R
      PCI ACPI: Rework PCI handling of wake-up · eb9d0fe4
      Rafael J. Wysocki 提交于
      * Introduce function acpi_pm_device_sleep_wake() for enabling and
        disabling the system wake-up capability of devices that are power
        manageable by ACPI.
      
      * Introduce function acpi_bus_can_wakeup() allowing other (dependent)
        subsystems to check if ACPI is able to enable the system wake-up
        capability of given device.
      
      * Introduce callback .sleep_wake() in struct pci_platform_pm_ops and
        for the ACPI PCI 'driver' make it use acpi_pm_device_sleep_wake().
      
      * Introduce callback .can_wakeup() in struct pci_platform_pm_ops and
        for the ACPI 'driver' make it use acpi_bus_can_wakeup().
      
      * Move the PME# handlig code out of pci_enable_wake() and split it
        into two functions, pci_pme_capable() and pci_pme_active(),
        allowing the caller to check if given device is capable of
        generating PME# from given power state and to enable/disable the
        device's PME# functionality, respectively.
      
      * Modify pci_enable_wake() to use the new ACPI callbacks and the new
        PME#-related functions.
      
      * Drop the generic .platform_enable_wakeup() callback that is not
        used any more.
      
      * Introduce device_set_wakeup_capable() that will set the
        power.can_wakeup flag of given device.
      
      * Rework PCI device PM initialization so that, if given device is
        capable of generating wake-up events, either natively through the
        PME# mechanism, or with the help of the platform, its
        power.can_wakeup flag is set and its power.should_wakeup flag is
        unset as appropriate.
      
      * Make ACPI set the power.can_wakeup flag for devices found to be
        wake-up capable by it.
      
      * Make the ACPI wake-up code enable/disable GPEs for devices that
        have the wakeup.flags.prepared flag set (which means that their
        wake-up power has been enabled).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      eb9d0fe4
    • R
      PCI: rework pci_set_power_state function to call platform first · 44e4e66e
      Rafael J. Wysocki 提交于
      Rework pci_set_power_state() so that the platform callback is
      invoked before the native mechanism, if necessary.  Also, make
      the function check if the device is power manageable by the
      platform before invoking the platform callback.
      
      This may matter if the device dependent on additional power
      resources controlled by the platform is being put into D0, in which
      case those power resources must be turned on before we attempt to
      handle the device itself.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@suse.cz>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      44e4e66e
    • R
      PCI: Introduce platform_pci_power_manageable function · 961d9120
      Rafael J. Wysocki 提交于
      Introduce function pointer platform_pci_power_manageable to be used
      by the platform-related code to point to a function allowing us to
      check if given device is power manageable by the platform.
      
      Introduce acpi_pci_power_manageable() playing that role for ACPI.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      961d9120
  23. 28 6月, 2008 1 次提交
    • T
      Fix forcedeth hibernate/wake-on-lan problems · f5ccbcfa
      Tobias Diedrich 提交于
      This patch is the minimal amount of code needed to support
      wake-on-lan in platform mode properly (i.e. "ethtool -s eth0 wol g"
      is sufficient, no additional magic needed) for me.
      
      This is derived from David Brownells patch
      (http://lists.laptop.org/pipermail/devel/2007-April/004691.html).
      However I decided to move the hook into pci-acpi.c since the other
      two pci hooks also live there and pci and acpi are the only users of
      the platform_enable_wakeup-hook.
      
      As a 'side-effect' this also makes wake on usb activity work for me
      and I had to disable usb wakeup (which is enabled by default) using
      the power/wakeup sysfs functionality ("echo disabled >
      ${sysfs_path_to_device}/power/wakeup").
      
      (BTW I first thought the 'immediate reboot because of usb wake' effect is
      caused by the optical mouse generating a wake event, but it rather
      seems to be a problem with a flaky secondary usb host controller,
      which sees a connected device where nothing is attached)
      Signed-off-by: NTobias Diedrich <ranma+kernel@tdiedrich.de>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f5ccbcfa
  24. 12 6月, 2008 2 次提交
  25. 11 6月, 2008 2 次提交