1. 02 6月, 2013 2 次提交
  2. 12 5月, 2013 2 次提交
    • R
      ACPI / processor: Use common hotplug infrastructure · ac212b69
      Rafael J. Wysocki 提交于
      Split the ACPI processor driver into two parts, one that is
      non-modular, resides in the ACPI core and handles the enumeration
      and hotplug of processors and one that implements the rest of the
      existing processor driver functionality.
      
      The non-modular part uses an ACPI scan handler object to enumerate
      processors on the basis of information provided by the ACPI namespace
      and to hook up with the common ACPI hotplug infrastructure.  It also
      populates the ACPI handle of each processor device having a
      corresponding object in the ACPI namespace, which allows the driver
      proper to bind to those devices, and makes the driver bind to them
      if it is readily available (i.e. loaded) when the scan handler's
      .attach() routine is running.
      
      There are a few reasons to make this change.
      
      First, switching the ACPI processor driver to using the common ACPI
      hotplug infrastructure reduces code duplication and size considerably,
      even though a new file is created along with a header comment etc.
      
      Second, since the common hotplug code attempts to offline devices
      before starting the (non-reversible) removal procedure, it will abort
      (and possibly roll back) hot-remove operations involving processors
      if cpu_down() returns an error code for one of them instead of
      continuing them blindly (if /sys/firmware/acpi/hotplug/force_remove
      is unset).  That is a more desirable behavior than what the current
      code does.
      
      Finally, the separation of the scan/hotplug part from the driver
      proper makes it possible to simplify the driver's .remove() routine,
      because it doesn't need to worry about the possible cleanup related
      to processor removal any more (the scan/hotplug part is responsible
      for that now) and can handle device removal and driver removal
      symmetricaly (i.e. as appropriate).
      
      Some user-visible changes in sysfs are made (for example, the
      'sysdev' link from the ACPI device node to the processor device's
      directory is gone and a 'physical_node' link is present instead
      and a corresponding 'firmware_node' is present in the processor
      device's directory, the processor driver is now visible under
      /sys/bus/cpu/drivers/ and bound to the processor device), but
      that shouldn't affect the functionality that users care about
      (frequency scaling, C-states and thermal management).
      
      Tested on my venerable Toshiba Portege R500.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      ac212b69
    • R
      ACPI / hotplug: Use device offline/online for graceful hot-removal · 683058e3
      Rafael J. Wysocki 提交于
      Modify the generic ACPI hotplug code to be able to check if devices
      scheduled for hot-removal may be gracefully removed from the system
      using the device offline/online mechanism introduced previously.
      
      Namely, make acpi_scan_hot_remove() handling device hot-removal call
      device_offline() for all physical companions of the ACPI device nodes
      involved in the operation and check the results.  If any of the
      device_offline() calls fails, the function will not progress to the
      removal phase (which cannot be aborted), unless its (new) force
      argument is set (in case of a failing offline it will put the devices
      offlined by it back online).
      
      In support of 'forced' device hot-removal, add a new sysfs attribute
      'force_remove' that will reside under /sys/firmware/acpi/hotplug/.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      683058e3
  3. 13 4月, 2013 1 次提交
  4. 25 3月, 2013 5 次提交
    • T
      ACPI: Verify device status after eject · 882fd12e
      Toshi Kani 提交于
      ACPI spec states that the OS evaluates _STA after calling _EJ0
      in order to verify if eject was successful.  Added a check to
      verify if the enabled bit of the status value is cleared after
      _EJ0.
      
      Note, the present bit is not checked since some FW implementations
      do not clear the present bit until the hardware is physically
      removed.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      882fd12e
    • T
      ACPI: Update _OST handling for notify · 2cbb14fb
      Toshi Kani 提交于
      When the kernel calls _OSC with OSC_SB_HOTPLUG_OST_SUPPORT bit
      set at boot-time, the OS is responsible for calling _OST for
      ACPI hotplug events.  However, when hotplug.enabled attribute
      is unset for ACPI scan drivers, their notify handlers are removed
      and _OST is not called for ACPI hotplug events as a result.
      
      This patch keeps the notify handler of ACPI scan drivers,
      acpi_hotplug_notify_cb(), installed regardless of the state of
      hotplug.enabled.  The notify handler then checks if hotplug.enabled
      is set for the associated scan handler.  If unset, the notify
      handler calls _OST with a proper error code.  The patch also
      eliminates ACPI namespace walk when hotplug.enabled is changed
      via sysfs.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2cbb14fb
    • T
      ACPI: Update PNPID match handling for notify · 6b772e8f
      Toshi Kani 提交于
      When installing/removing a notify handler to/from an ACPI device
      object, ACPI core tries to match its associated scan handler to
      see if it supports hotplug.  However, the matching logic of the
      notify handler is different from the matching logic of attaching
      a scan handler to an ACPI device object.  This patch updates the
      matching logic of the notify handlers to be consistent with the
      attach handling.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6b772e8f
    • T
      ACPI: Update PNPID set/free interfaces · c0af4175
      Toshi Kani 提交于
      This patch introduces acpi_set_pnp_ids() and acpi_free_pnp_ids(),
      which are updated from acpi_device_set_id() and acpi_free_ids(),
      to setup and free acpi_device_pnp for a given acpi_handle.  They
      can be called without acpi_device.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c0af4175
    • T
      ACPI: Remove acpi_device dependency in acpi_device_set_id() · d4e1a692
      Toshi Kani 提交于
      This patch updates the internal operations of acpi_device_set_id()
      to setup acpi_device_pnp without using acpi_device.  There is no
      functional change to acpi_device_set_id() in this patch.
      
      acpi_pnp_type is added to acpi_device_pnp, so that PNPID type is
      self-contained within acpi_device_pnp.  acpi_add_id(), acpi_bay_match(),
      acpi_dock_match(), acpi_ibm_smbus_match() and acpi_is_video_device()
      are changed to take acpi_handle as an argument, instead of acpi_device.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d4e1a692
  5. 22 3月, 2013 1 次提交
    • R
      ACPI / scan: Add special handler for Intel Lynxpoint LPSS devices · f58b082a
      Rafael J. Wysocki 提交于
      Devices on the Intel Lynxpoint Low Power Subsystem (LPSS) have some
      common features that aren't shared with any other platform devices,
      including the clock and LTR (Latency Tolerance Reporting) registers.
      It is better to handle those features in common code than to bother
      device drivers with doing that (I/O functionality-wise the LPSS
      devices are generally compatible with other devices that don't
      have those special registers and may be handled by the same drivers).
      
      The clock registers of the LPSS devices are now taken care of by
      the special clk-x86-lpss driver, but the MMIO mappings used for
      accessing those registers can also be used for accessing the LTR
      registers on those devices (LTR support for the Lynxpoint LPSS is
      going to be added by a subsequent patch).  Thus it is convenient
      to add a special ACPI scan handler for the Lynxpoint LPSS devices
      that will create the MMIO mappings for accessing the clock (and
      LTR in the future) registers and will register the LPSS devices'
      clocks, so the clk-x86-lpss driver will only need to take care of
      the main Lynxpoint LPSS clock.
      
      Introduce a special ACPI scan handler for Intel Lynxpoint LPSS
      devices as described above.  This also reduces overhead related to
      browsing the ACPI namespace in search of the LPSS devices before the
      registration of their clocks, removes some LPSS-specific (and
      somewhat ugly) code from acpi_platform.c and shrinks the overall code
      size slightly.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NMike Turquette <mturquette@linaro.org>
      f58b082a
  6. 04 3月, 2013 5 次提交
  7. 24 2月, 2013 1 次提交
    • R
      ACPI / PM: Take unusual configurations of power resources into account · b5d667eb
      Rafael J. Wysocki 提交于
      Commit d2e5f0c1 (ACPI / PCI: Rework the setup and cleanup of device
      wakeup) moved the initial disabling of system wakeup for PCI devices
      into a place where it can actually work and that exposed a hidden old
      issue with crap^Wunusual system designs where the same power
      resources are used for both wakeup power and device power control at
      run time.
      
      Namely, say there is one power resource such that the ACPI power
      state D0 of a PCI device depends on that power resource (i.e. the
      device is in D0 when that power resource is "on") and it is used
      as a wakeup power resource for the same device.  Then, calling
      acpi_pci_sleep_wake(pci_dev, false) for the device in question will
      cause the reference counter of that power resource to drop to 0,
      which in turn will cause it to be turned off.  As a result, the
      device will go into D3cold at that point, although it should have
      stayed in D0.
      
      As it turns out, that happens to USB controllers on some laptops
      and USB becomes unusable on those machines as a result, which is
      a major regression from v3.8.
      
      To fix this problem, (1) increment the reference counters of wakup
      power resources during their initialization if they are "on"
      initially, (2) prevent acpi_disable_wakeup_device_power() from
      decrementing the reference counters of wakeup power resources that
      were not enabled for wakeup power previously, and (3) prevent
      acpi_enable_wakeup_device_power() from incrementing the reference
      counters of wakeup power resources that already are enabled for
      wakeup power.
      
      In addition to that, if it is impossible to determine the initial
      states of wakeup power resources, avoid enabling wakeup for devices
      whose wakeup power depends on those power resources.
      Reported-by: NDave Jones <davej@redhat.com>
      Reported-by: NFabio Baltieri <fabio.baltieri@linaro.org>
      Tested-by: NFabio Baltieri <fabio.baltieri@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b5d667eb
  8. 16 2月, 2013 1 次提交
  9. 13 2月, 2013 8 次提交
    • R
      ACPI / hotplug: Fix concurrency issues and memory leaks · 3757b948
      Rafael J. Wysocki 提交于
      This changeset is aimed at fixing a few different but related
      problems in the ACPI hotplug infrastructure.
      
      First of all, since notify handlers may be run in parallel with
      acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
      and some of them are installed for ACPI handles that have no struct
      acpi_device objects attached (i.e. before those objects are created),
      those notify handlers have to take acpi_scan_lock to prevent races
      from taking place (e.g. a struct acpi_device is found to be present
      for the given ACPI handle, but right after that it is removed by
      acpi_bus_trim() running in parallel to the given notify handler).
      Moreover, since some of them call acpi_bus_scan() and
      acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
      should be acquired by the callers of these two funtions rather by
      these functions themselves.
      
      For these reasons, make all notify handlers that can handle device
      addition and eject events take acpi_scan_lock and remove the
      acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
      Accordingly, update all of their users to make sure that they
      are always called under acpi_scan_lock.
      
      Furthermore, since eject operations are carried out asynchronously
      with respect to the notify events that trigger them, with the help
      of acpi_bus_hot_remove_device(), even if notify handlers take the
      ACPI scan lock, it still is possible that, for example,
      acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
      the notify handler that scheduled its execution and that
      acpi_bus_trim() will remove the device node passed to
      acpi_bus_hot_remove_device() for ejection.  In that case, the struct
      acpi_device object obtained by acpi_bus_hot_remove_device() will be
      invalid and not-so-funny things will ensue.  To protect agaist that,
      make the users of acpi_bus_hot_remove_device() run get_device() on
      ACPI device node objects that are about to be passed to it and make
      acpi_bus_hot_remove_device() run put_device() on them and check if
      their ACPI handles are not NULL (make acpi_device_unregister() clear
      the device nodes' ACPI handles for that check to work).
      
      Finally, observe that acpi_os_hotplug_execute() actually can fail,
      in which case its caller ought to free memory allocated for the
      context object to prevent leaks from happening.  It also needs to
      run put_device() on the device node that it ran get_device() on
      previously in that case.  Modify the code accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      3757b948
    • R
      ACPI / scan: Full transition to D3cold in acpi_device_unregister() · 0aa120a0
      Rafael J. Wysocki 提交于
      In order to drop reference counts of all power resources used by an
      ACPI device node being removed, acpi_device_unregister() calls
      acpi_power_transition(device, ACPI_STATE_D3_COLD), which effectively
      transitions the device node into D3cold if it uses any power
      resources.  However, for some device nodes it may not be appropriate
      to remove power from them entirely before putting them into D3hot
      before.  On the other hand, executing _PS3 for devices that don't
      use power resources before removing them shouldn't really hurt.
      In fact, that is done by acpi_bus_hot_remove_device(), but this is
      not the right place to do it, because the bus trimming may have
      caused power to be removed from the device node in question already
      before.
      
      For these reasons, make acpi_device_unregister() carry out full
      power-off transition for all device nodes supporting that and remove
      the direct evaluation of _PS3 from acpi_bus_hot_remove_device().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0aa120a0
    • R
      ACPI / scan: Make acpi_bus_hot_remove_device() acquire the scan lock · f058cdf4
      Rafael J. Wysocki 提交于
      The ACPI scan lock has been introduced to prevent acpi_bus_scan()
      and acpi_bus_trim() from running in parallel with each other for
      overlapping ACPI namespace scopes.  However, it is not sufficient
      to do that, because if acpi_bus_scan() is run (for an overlapping
      namespace scope) right after the acpi_bus_trim() in
      acpi_bus_hot_remove_device(), the subsequent eject will remove
      devices without removing the corresponding struct acpi_device
      objects (and possibly companion "physical" device objects).
      Therefore acpi_bus_hot_remove_device() has to acquire the scan
      lock before carrying out the bus trimming and hold it through
      the evaluation of _EJ0, so make that happen.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      f058cdf4
    • R
      ACPI / scan: Make container driver use struct acpi_scan_handler · 737f1a9f
      Rafael J. Wysocki 提交于
      Make the ACPI container driver use struct acpi_scan_handler for
      representing the object used to initialize ACPI containers and remove
      the ACPI driver structure used previously and the data structures
      created by it, since in fact they were not used for any purpose.
      
      This simplifies the code and reduces the kernel's memory footprint by
      avoiding the registration of a struct device_driver object with the
      driver core and creation of its sysfs directory which is unnecessary.
      
      In addition to that, make the namespace walk callback used for
      installing the notify handlers for ACPI containers more
      straightforward.
      
      This change includes fixes from Toshi Kani.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Tested-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      737f1a9f
    • R
      ACPI / scan: Remove useless #ifndef from acpi_eject_store() · 38475b3b
      Rafael J. Wysocki 提交于
      Since the FORCE_EJECT symbol is never defined, the
      #ifndef FORCE_EJECT in acpi_eject_store() is always true, so drop it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Tested-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      38475b3b
    • T
      ACPI: Unbind ACPI drv when probe failed · 5f27ee8e
      Toshi Kani 提交于
      When acpi_device_install_notify_handler() failed in acpi_device_probe(),
      it calls acpi_drv->ops.remove() and fails the probe.  However, the ACPI
      driver is left bound to the acpi_device.  Fix it by clearing the driver
      and driver_data fields.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5f27ee8e
    • T
      ACPI: sysfs eject support for ACPI scan handlers · ce7685ad
      Toshi Kani 提交于
      Changed sysfs eject, acpi_eject_store(), so that it doesn't return
      error codes for devices nodes with ACPI scan handlers attached and
      no ACPI drivers.
      
      [rjw: Changelog]
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ce7685ad
    • R
      ACPI / scan: Follow priorities of IDs when matching scan handlers · 87b85b3c
      Rafael J. Wysocki 提交于
      The IDs of ACPI device nodes stored in their pnp.ids member arrays
      are sorted by decreasing priority (i.e. the highest-priority ID is
      the first entry).  This means that when matching scan handlers to
      device nodes, the namespace scanning code should walk the list of
      scan handlers for each device node ID instead of walking the list
      of device node IDs for each handler (the latter causes the first
      handler matching any of the device node IDs to be chosen, although
      there may be another handler matching an ID of a higher priority
      which should be preferred).  Make the code follow this observation.
      
      This change has been suggested and justified by Toshi Kani.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      87b85b3c
  10. 02 2月, 2013 1 次提交
    • R
      ACPI / PM: Do not power manage devices in unknown initial states · b3785492
      Rafael J. Wysocki 提交于
      In general, for ACPI device power management to work, the initial
      power states of devices must be known (otherwise, we wouldn't be able
      to keep track of power resources, for example).  Hence, if it is
      impossible to determine the initial ACPI power states of some
      devices, they can't be regarded as power-manageable using ACPI.
      
      For this reason, modify acpi_bus_get_power_flags() to clear the
      power_manageable flag if acpi_bus_init_power() fails and add some
      extra fallback code to acpi_bus_init_power() to cover broken
      BIOSes that provide _PS0/_PS3 without _PSC for some devices.
      
      Verified to work on my HP nx6325 that has this problem.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NPeter Wu <lekensteyn@gmail.com>
      b3785492
  11. 01 2月, 2013 2 次提交
  12. 30 1月, 2013 3 次提交
  13. 29 1月, 2013 1 次提交
  14. 28 1月, 2013 1 次提交
  15. 26 1月, 2013 3 次提交
  16. 24 1月, 2013 3 次提交