1. 05 11月, 2014 3 次提交
  2. 10 10月, 2014 1 次提交
  3. 21 9月, 2014 1 次提交
    • R
      ACPI / hotplug: Generate online uevents for ACPI containers · 8ab17fc9
      Rafael J. Wysocki 提交于
      Commit 46394fd0 (ACPI / hotplug: Move container-specific code out of
      the core) removed the generation of "online" uevents for containers,
      because "add" uevents are now generated for them automatically when
      container system devices are registered.  However, there are user
      space tools that need to be notified when the container and all of
      its children have been enumerated, which doesn't happen any more.
      
      For this reason, add a mechanism allowing "online" uevents to be
      generated for ACPI containers after enumerating the container along
      with all of its children.
      
      Fixes: 46394fd0 (ACPI / hotplug: Move container-specific code out of the core)
      Reported-and-tested-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: 3.14+ <stable@vger.kernel.org> # 3.14+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8ab17fc9
  4. 16 9月, 2014 1 次提交
  5. 04 9月, 2014 1 次提交
  6. 23 7月, 2014 2 次提交
    • R
      ACPI / PM: Always enable wakeup GPEs when enabling device wakeup · f35cec25
      Rafael J. Wysocki 提交于
      Wakeup GPEs are currently only enabled when setting up devices for
      remote wakeup at run time.  During system-wide transitions they are
      enabled by ACPICA at the very last stage of suspend (before asking
      the BIOS to take over).  Of course, that only works for system
      sleep states supported by ACPI, so in particular it doesn't work
      for the "freeze" sleep state.
      
      For this reason, modify the ACPI core device PM code to enable wakeup
      GPEs for devices when setting them up for wakeup regardless of whether
      that is remote wakeup at runtime or system wakeup.  That allows the
      same device wakeup setup routine to be used for both runtime PM and
      system-wide PM and makes it possible to reduce code size quite a bit.
      
      This make ACPI-based PCI Wake-on-LAN work with the "freeze" sleep
      state on my venerable Toshiba Portege R500 and should help other
      systems too.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f35cec25
    • R
      ACPI / PM: Revork the handling of ACPI device wakeup notifications · c072530f
      Rafael J. Wysocki 提交于
      Since ACPI wakeup GPEs are going to be enabled during system suspend
      as well as for runtime wakeup by a subsequent patch and the same
      notify handlers will be used in both cases, rework the ACPI device
      wakeup notification framework so that the part specific to physical
      devices is always run asynchronously from the PM workqueue.  This
      prevents runtime resume callbacks for those devices from being
      run during system suspend and resume which may not be appropriate,
      among other things.
      
      Also make ACPI device wakeup notification handling a bit more robust
      agaist subsequent removal of ACPI device objects, whould that ever
      happen, and create a wakeup source object for each ACPI device
      configured for wakeup so that wakeup notifications for those
      devices can wake up the system from the "freeze" sleep state.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c072530f
  7. 16 7月, 2014 1 次提交
  8. 07 7月, 2014 1 次提交
    • Z
      ACPI / PNP: do ACPI binding directly · f1b1dc84
      Zhang Rui 提交于
      PNPACPI uses acpi_bus_type to do ACPI binding for the PNPACPI devices.
      
      This is overkill because PNPACPI code already knows which ACPI
      device object to bind during PNPACPI device enumeration.
      
      This patch removes acpi_pnp_bus and does the binding by invoking
      acpi_bind_one() directly after device enumerated.
      
      This also fixes a bug in the previous code that some PNPACPI devices failed
      to be bound because
       1. the ACPI device _HID is not pnpid, e.g. "MSFT0001", but its _CID is,
          e.g. "PNP0303", thus ACPI _CID is used as the pnp device device id.
       2. device is bound only if the pnp device id matches the ACPI device _HID.
      Tested-by: NPrigent Christophe <christophe.prigent@intel.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f1b1dc84
  9. 30 5月, 2014 2 次提交
  10. 27 5月, 2014 1 次提交
  11. 20 5月, 2014 1 次提交
  12. 05 3月, 2014 1 次提交
  13. 22 2月, 2014 2 次提交
  14. 21 2月, 2014 3 次提交
  15. 16 2月, 2014 1 次提交
    • R
      ACPI / dock: Dispatch dock notifications from the global notify handler · 1e2380cd
      Rafael J. Wysocki 提交于
      The ACPI dock station code carries out an extra namespace scan
      before the main one in order to find and register all of the dock
      device objects.  Then, it registers a notify handler for each of
      them for handling dock events.
      
      However, dock device objects need not be scanned for upfront.  They
      very well can be enumerated and registered during the first phase
      of the main namespace scan, before attaching scan handlers and ACPI
      drivers to ACPI device objects.  Then, the dependent devices can be
      added to the in the second phase.  That makes it possible to drop
      the extra namespace scan, so do it.
      
      Moreover, it is not necessary to register notify handlers for all
      of the dock stations' namespace nodes, becuase notifications may
      be dispatched from the global notify handler for them.  Do that and
      drop two functions used for dock notify handling, acpi_dock_deferred_cb()
      and dock_notify_handler(), that aren't necessary any more.
      
      Finally, some dock station objects have _HID objects matching the
      ACPI container scan handler which causes it to claim those objects
      and try to handle their hotplug, but that is not a good idea,
      because those objects have their own special hotplug handling anyway.
      For this reason, the hotplug_notify flag should not be set for ACPI
      device objects representing dock stations and the container scan
      handler should be made ignore those objects, so make that happen.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1e2380cd
  16. 11 2月, 2014 1 次提交
    • R
      ACPI / scan: Add bind/unbind callbacks to struct acpi_scan_handler · 9cb32acf
      Rafael J. Wysocki 提交于
      In some cases it may be necessary to perform certain setup/cleanup
      operations on a device object representing a physical device after
      it has been associated with an ACPI companion by acpi_bind_one() or
      before disassociating it from that companion by acpi_unbind_one(),
      respectively.  If there is a struct acpi_bus_type object for the
      given device's bus type, the .setup()/.cleanup() callbacks from there
      are executed for these purposes.  However, an analogous mechanism will
      be necessary for devices whose bus types don't have corresponding
      struct acpi_bus_type objects and that have specific ACPI scan handlers.
      
      For those devices, add new .bind() and .unbind() callbacks to struct
      acpi_scan_handler that will be executed by acpi_platform_notify()
      right after the given device has been associated with an ACPI
      comapnion and by acpi_platform_notify_remove() right before calling
      acpi_unbind_one() for that device, respectively.
      
      To make that work for scan handlers registering new devices in their
      .attach() callbacks, modify acpi_scan_attach_handler() to set the
      ACPI device object's handler field before calling .attach() from the
      scan handler at hand.
      
      This changeset includes a fix from Mika Westerberg.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9cb32acf
  17. 07 2月, 2014 3 次提交
    • R
      ACPI / hotplug / PCI: Hotplug notifications from acpi_bus_notify() · 1a699476
      Rafael J. Wysocki 提交于
      Since acpi_bus_notify() is executed on all notifications for all
      devices anyway, make it execute acpi_device_hotplug() for all
      hotplug events instead of installing notify handlers pointing to
      the same function for all hotplug devices.
      
      This change reduces both the size and complexity of ACPI-based device
      hotplug code.  Moreover, since acpi_device_hotplug() only does
      significant things for devices that have either an ACPI scan handler,
      or a hotplug context with .eject() defined, and those devices
      had notify handlers pointing to acpi_hotplug_notify_cb() installed
      before anyway, this modification shouldn't change functionality.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1a699476
    • R
      ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler() · 5e6f236c
      Rafael J. Wysocki 提交于
      Since acpi_hotplug_notify_cb() does not use its data argument any
      more, the second argument of acpi_install_hotplug_notify_handler()
      can be dropped, so do that and update its callers accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5e6f236c
    • R
      ACPI / hotplug / PCI: Consolidate ACPIPHP with ACPI core hotplug · 3c2cc7ff
      Rafael J. Wysocki 提交于
      The ACPI-based PCI hotplug (ACPIPHP) code currently attaches its
      hotplug context objects directly to ACPI namespace nodes representing
      hotplug devices.  However, after recent changes causing struct
      acpi_device to be created for every namespace node representing a
      device (regardless of its status), that is not necessary any more.
      Moreover, it's vulnerable to the theoretical issue that the ACPI
      handle passed in the context between handle_hotplug_event() and
      hotplug_event_work() may become invalid in the meantime (as a
      result of a concurrent table unload).
      
      In principle, this issue might be addressed by adding a non-empty
      release handler for ACPIPHP hotplug context objects analogous to
      acpi_scan_drop_device(), but that would duplicate the code in that
      function and in acpi_device_del_work_fn().  For this reason, it's
      better to modify ACPIPHP to attach its device hotplug contexts to
      struct device objects representing hotplug devices and make it
      use acpi_hotplug_notify_cb() as its notify handler.  At the same
      time, acpi_device_hotplug() can be modified to dispatch the new
      .hp.event() callback pointing to acpiphp_hotplug_event() from ACPI
      device objects associated with PCI devices or use the generic
      ACPI device hotplug code for device objects with matching scan
      handlers.
      
      This allows the existing code duplication between ACPIPHP and the
      ACPI core to be reduced too and makes further ACPI-based device
      hotplug consolidation possible.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3c2cc7ff
  18. 06 2月, 2014 2 次提交
    • R
      ACPI / hotplug / PCI: Define hotplug context lock in the core · e525506f
      Rafael J. Wysocki 提交于
      Subsequent changes will require the ACPI core to acquire the lock
      protecting the ACPIPHP hotplug contexts, so move the definition of
      the lock to the core and change its name to be more generic.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      e525506f
    • R
      ACPI / hotplug: Fix potential race in acpi_bus_notify() · 78ea4639
      Rafael J. Wysocki 提交于
      There is a slight possibility for the ACPI device object pointed to
      by adev in acpi_hotplug_notify_cb() to become invalid between the
      acpi_bus_get_device() that it comes from and the subsequent dereference
      of that pointer under get_device().  Namely, if acpi_scan_drop_device()
      runs in parallel with acpi_hotplug_notify_cb(), acpi_device_del_work_fn()
      queued up by it may delete the device object in question right after
      a successful execution of acpi_bus_get_device() in acpi_bus_notify().
      
      An analogous problem is present in acpi_bus_notify() where the device
      pointer coming from acpi_bus_get_device() may become invalid before
      it subsequent dereference in the "if" block.
      
      To prevent that from happening, introduce a new function,
      acpi_bus_get_acpi_device(), working analogously to acpi_bus_get_device()
      except that it will grab a reference to the ACPI device object returned
      by it and it will do that under the ACPICA's namespace mutex.  Then,
      make both acpi_hotplug_notify_cb() and acpi_bus_notify() use
      acpi_bus_get_acpi_device() instead of acpi_bus_get_device() so as to
      ensure that the pointers used by them will not become stale at one
      point.
      
      In addition to that, introduce acpi_bus_put_acpi_device() as a wrapper
      around put_device() to be used along with acpi_bus_get_acpi_device()
      and make the (new) users of the latter use acpi_bus_put_acpi_device()
      too.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      78ea4639
  19. 05 1月, 2014 1 次提交
  20. 31 12月, 2013 1 次提交
    • R
      ACPIPHP / radeon / nouveau: Fix VGA switcheroo problem related to hotplug · f244d8b6
      Rafael J. Wysocki 提交于
      The changes in the ACPI-based PCI hotplug (ACPIPHP) subsystem made
      during the 3.12 development cycle uncovered a problem with VGA
      switcheroo that on some systems, when the device-specific method
      (ATPX in the radeon case, _DSM in the nouveau case) is used to turn
      off the discrete graphics, the BIOS generates ACPI hotplug events for
      that device and those events cause ACPIPHP to attempt to remove the
      device from the system (they are events for a device that was present
      previously and is not present any more, so that's what should be done
      according to the spec).  Then, the system stops functioning correctly.
      
      Since the hotplug events in question were simply silently ignored
      previously, the least intrusive way to address that problem is to
      make ACPIPHP ignore them again.  For this purpose, introduce a new
      ACPI device flag, no_hotplug, and modify ACPIPHP to ignore hotplug
      events for PCI devices whose ACPI companions have that flag set.
      Next, make the radeon and nouveau switcheroo detection code set the
      no_hotplug flag for the discrete graphics' ACPI companion.
      
      Fixes: bbd34fcd (ACPI / hotplug / PCI: Register all devices under the given bridge)
      References: https://bugzilla.kernel.org/show_bug.cgi?id=61891
      References: https://bugzilla.kernel.org/show_bug.cgi?id=64891Reported-and-tested-by: NMike Lothian <mike@fireburn.co.uk>
      Reported-and-tested-by: <madcatx@atlas.cz>
      Reported-and-tested-by: NJoaquín Aramendía <samsagax@gmail.com>
      Cc: Alex Deucher <alexdeucher@gmail.com>
      Cc: Dave Airlie <airlied@linux.ie>
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: 3.12+ <stable@vger.kernel.org> # 3.12+
      f244d8b6
  21. 29 12月, 2013 1 次提交
    • R
      ACPI / hotplug: Add demand_offline hotplug profile flag · d22ddcbc
      Rafael J. Wysocki 提交于
      Add a new ACPI hotplug profile flag, demand_offline, such that if
      set for the given ACPI device object's scan handler, it will cause
      acpi_scan_hot_remove() to check if that device object's physical
      companions are offline upfront and fail the hot removal if that
      is not the case.
      
      That flag will be useful to overcome a problem with containers on
      some system where they can only be hot-removed after some cleanup
      operations carried out by user space, which needs to be notified
      of the container hot-removal before the kernel attempts to offline
      devices in the container.  In those cases the current implementation
      of acpi_scan_hot_remove() is not sufficient, because it first tries
      to offline the devices in the container and only if that is
      suffcessful it tries to offline the container itself.  As a result,
      the container hot-removal notification is not delivered to user space
      at the right time.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d22ddcbc
  22. 07 12月, 2013 6 次提交
    • R
      ACPI / bind: Move acpi_get_child() to drivers/ide/ide-acpi.c · bfecc2b3
      Rafael J. Wysocki 提交于
      Since drivers/ide/ide-acpi.c is the only remaining user of
      acpi_get_child(), move that function into that file as a static
      routine.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bfecc2b3
    • R
      ACPI / bind: Rework struct acpi_bus_type · e3f02c52
      Rafael J. Wysocki 提交于
      Replace the .find_device function pointer in struct acpi_bus_type
      with a new one, .find_companion, that is supposed to point to a
      function returning struct acpi_device pointer (instead of an int)
      and takes one argument (instead of two).  This way the role of
      this callback is more clear and the implementation of it can
      be more straightforward.
      
      Update all of the users of struct acpi_bus_type (PCI, PNP/ACPI and
      USB) to reflect the structure change.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: Lan Tianyu <tianyu.lan@intel.com> # for USB/ACPI
      e3f02c52
    • R
      ACPI / bind: Redefine acpi_preset_companion() · 9c5ad36d
      Rafael J. Wysocki 提交于
      Modify acpi_preset_companion() to take a struct acpi_device pointer
      instead of an ACPI handle as its second argument and redefine it as
      a static inline wrapper around ACPI_COMPANION_SET() passing the
      return value of acpi_find_child_device() directly as the second
      argument to it.  Update its users to pass struct acpi_device
      pointers instead of ACPI handles to it.
      
      This allows some unnecessary acpi_bus_get_device() calls to be
      avoided.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NAaron Lu <aaron.lu@intel.com>
      Tested-by: Aaron Lu <aaron.lu@intel.com> # for ATA binding
      9c5ad36d
    • R
      ACPI / bind: Redefine acpi_get_child() · 11dcc75d
      Rafael J. Wysocki 提交于
      Since acpi_get_child() is the only user of acpi_find_child() now,
      drop the static inline definition of the former and redefine the
      latter as new acpi_get_child().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NAaron Lu <aaron.lu@intel.com>
      Tested-by: Aaron Lu <aaron.lu@intel.com> # for ATA binding
      11dcc75d
    • R
      ACPI / bind: Simplify child device lookups · d9fef0c4
      Rafael J. Wysocki 提交于
      Now that we create a struct acpi_device object for every ACPI
      namespace node representing a device, it is not necessary to
      use acpi_walk_namespace() for child device lookup in
      acpi_find_child() any more.  Instead, we can simply walk the
      list of children of the given struct acpi_device object and
      return the matching one (or the one which is the best match if
      there are more of them).  The checks done during the matching
      loop can be simplified too so that the secondary namespace walks
      in find_child_checks() are not necessary any more.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NAaron Lu <aaron.lu@intel.com>
      d9fef0c4
    • L
      ACPI: Clean up inclusions of ACPI header files · 8b48463f
      Lv Zheng 提交于
      Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and
      <acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h>
      inclusions and remove some inclusions of those files that aren't
      necessary.
      
      First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>
      should not be included directly from any files that are built for
      CONFIG_ACPI unset, because that generally leads to build warnings about
      undefined symbols in !CONFIG_ACPI builds.  For CONFIG_ACPI set,
      <linux/acpi.h> includes those files and for CONFIG_ACPI unset it
      provides stub ACPI symbols to be used in that case.
      
      Second, there are ordering dependencies between those files that always
      have to be met.  Namely, it is required that <acpi/acpi_bus.h> be included
      prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the
      latter depends on are always there.  And <acpi/acpi.h> which provides
      basic ACPICA type declarations should always be included prior to any other
      ACPI headers in CONFIG_ACPI builds.  That also is taken care of including
      <linux/acpi.h> as appropriate.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff)
      Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8b48463f
  23. 23 11月, 2013 3 次提交