1. 07 2月, 2017 1 次提交
  2. 29 11月, 2016 1 次提交
    • L
      ACPI: Implement acpi_dma_configure · d760a1ba
      Lorenzo Pieralisi 提交于
      On DT based systems, the of_dma_configure() API implements DMA
      configuration for a given device. On ACPI systems an API equivalent to
      of_dma_configure() is missing which implies that it is currently not
      possible to set-up DMA operations for devices through the ACPI generic
      kernel layer.
      
      This patch fills the gap by introducing acpi_dma_configure/deconfigure()
      calls that for now are just wrappers around arch_setup_dma_ops() and
      arch_teardown_dma_ops() and also updates ACPI and PCI core code to use
      the newly introduced acpi_dma_configure/acpi_dma_deconfigure functions.
      
      Since acpi_dma_configure() is used to configure DMA operations, the
      function initializes the dma/coherent_dma masks to sane default values
      if the current masks are uninitialized (also to keep the default values
      consistent with DT systems) to make sure the device has a complete
      default DMA set-up.
      
      The DMA range size passed to arch_setup_dma_ops() is sized according
      to the device coherent_dma_mask (starting at address 0x0), mirroring the
      DT probing path behaviour when a dma-ranges property is not provided
      for the device being probed; this changes the current arch_setup_dma_ops()
      call parameters in the ACPI probing case, but since arch_setup_dma_ops()
      is a NOP on all architectures but ARM/ARM64 this patch does not change
      the current kernel behaviour on them.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: Bjorn Helgaas <bhelgaas@google.com> [pci]
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NTomasz Nowicki <tn@semihalf.com>
      Tested-by: NHanjun Guo <hanjun.guo@linaro.org>
      Tested-by: NTomasz Nowicki <tn@semihalf.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Tomasz Nowicki <tn@semihalf.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      d760a1ba
  3. 26 6月, 2016 1 次提交
  4. 28 4月, 2016 1 次提交
  5. 12 4月, 2016 1 次提交
  6. 09 4月, 2016 1 次提交
    • L
      ACPI / utils: Rename acpi_dev_present() · c68ae33e
      Lukas Wunner 提交于
      acpi_dev_present() was originally named after pci_dev_present()
      to signify the similarity of the two functions.
      
      However Rafael J. Wysocki pointed out that the exported function
      acpi_dev_present() is easily confused with the non-exported
      acpi_device_is_present(). Additionally in ACPI parlance the term
      "present" usually refers to the "device is present" bit returned
      by the _STA control method, yet acpi_dev_present() merely checks
      presence in the namespace. It does not invoke _STA at all, let
      alone check the "device is present" bit.
      
      As suggested by Rafael, rename the function to acpi_dev_found()
      and adjust all existing call sites.
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c68ae33e
  7. 10 12月, 2015 1 次提交
  8. 09 12月, 2015 1 次提交
  9. 07 11月, 2015 3 次提交
  10. 15 9月, 2015 5 次提交
    • R
      ACPI / scan: constify struct acpi_hardware_id::id · 844142c3
      Rasmus Villemoes 提交于
      This is preparation for using kstrdup_const to initialize that member.
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      844142c3
    • R
      ACPI / scan: constify first argument of struct acpi_scan_handler::match · 636c19d3
      Rasmus Villemoes 提交于
      One wouldn't expect a "match" function modify the string it searches
      for, and indeed the only instance of the struct
      acpi_scan_handler::match callback, acpi_pnp_match, can easily be
      changed. While there, update its helper matching_id().
      
      This is also preparation for constifying struct acpi_hardware_id::id.
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      636c19d3
    • R
      ACPI / property: Extend fwnode_property_* to data-only subnodes · 3a7a2ab8
      Rafael J. Wysocki 提交于
      Modify is_acpi_node() to return "true" for ACPI data-only subnodes as
      well as for ACPI device objects and change the name of to_acpi_node()
      to to_acpi_device_node() so it is clear that it covers ACPI device
      objects only.  Accordingly, introduce to_acpi_data_node() to cover
      data-only subnodes in an analogous way.
      
      With that, make the fwnode_property_* family of functions work with
      ACPI data-only subnodes introduced previously.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      3a7a2ab8
    • R
      ACPI / property: Expose data-only subnodes via sysfs · 263b4c1a
      Rafael J. Wysocki 提交于
      Add infrastructure needed to expose data-only subnodes of ACPI
      device objects introduced previously via sysfs.
      
      Each data-only subnode is represented as a sysfs directory under
      the directory corresponding to its parent object (a device or a
      data-only subnode).  Each of them has a "path" attribute (containing
      the full ACPI namespace path to the object the subnode data come from)
      at this time.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      263b4c1a
    • R
      ACPI / property: Add support for data-only subnodes · 445b0eb0
      Rafael J. Wysocki 提交于
      In some cases, the information expressed via device properties is
      hierarchical by nature.  For example, the properties of a composite
      device consisting of multiple semi-dependent components may need
      to be represented in the form of a tree of property data sets
      corresponding to specific components of the device.
      
      Unfortunately, using ACPI device objects for this purpose turns out
      to be problematic, mostly due to the assumption made by some operating
      systems (that platform firmware generally needs to work with) that
      each device object in the ACPI namespace represents a device requiring
      a separate driver.  That assumption leads to complications which
      reportedly are impractically difficult to overcome and a different
      approach is needed for the sake of interoperability.
      
      The approach implemented here is based on extending _DSD via pointers
      (links) to additional ACPI objects returning data packages formatted
      in accordance with the _DSD formatting rules defined by Section 6.2.5
      of ACPI 6.  Those additional objects are referred to as data-only
      subnodes of the device object containing the _DSD pointing to them.
      
      The links to them need to be located in a separate section of the
      _DSD data package following UUID dbb8e3e6-5886-4ba6-8795-1319f52a966b
      referred to as the Hierarchical Data Extension UUID as defined in [1].
      Each of them is represented by a package of two strings.  The first
      string in that package (the key) is regarded as the name of the
      data-only subnode pointed to by the link.  The second string in it
      (the target) is expected to hold the ACPI namespace path (possibly
      utilizing the usual ACPI namespace search rules) of an ACPI object
      evaluating to a data package extending the _DSD.
      
      The device properties initialization code follows those links,
      creates a struct acpi_data_node object for each of them to store
      the data returned by the ACPI object pointed to by it and processes
      those data recursively (which may lead to the creation of more
      struct acpi_data_node objects if the returned data package contains
      the Hierarchical Data Extension UUID section with more links in it).
      
      All of the struct acpi_data_node objects are present until the the
      ACPI device object containing the _DSD with links to them is deleted
      and they are deleted along with that object.
      
      [1]: http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.pdfSigned-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      445b0eb0
  11. 08 7月, 2015 1 次提交
  12. 25 6月, 2015 1 次提交
  13. 15 6月, 2015 1 次提交
  14. 16 5月, 2015 1 次提交
    • R
      ACPI / PM: Rework device power management to follow ACPI 6 · 20dacb71
      Rafael J. Wysocki 提交于
      The ACPI 6 specification has made some changes in the device power
      management area.  In particular:
      
       * The D3hot power state is now supposed to be always available
         (instead of D3cold) and D3cold is only regarded as valid if the
         _PR3 object is present for the given device.
      
       * The required ordering of transitions into power states deeper than
         D0 is now such that for a transition into state Dx the _PSx method
         is supposed to be executed first, if present, and the states of
         the power resources the device depends on are supposed to be
         changed after that.
      
       * It is now explicitly forbidden to transition devices from
         lower-power (deeper) into higher-power (shallower) power states
         other than D0.
      
      Those changes have been made so the specification reflects the
      Windows' device power management code that the vast majority of
      systems using ACPI is validated against.
      
      To avoid artificial differences in ACPI device power management
      between Windows and Linux, modify the ACPI device power management
      code to follow the new specification.  Add comments explaining the
      code flow in some unclear places.
      
      This only may affect some real corner cases in which the OS behavior
      expected by the firmware is different from the Windows one, but that's
      quite unlikely.  The transition ordering change affects transitions
      to D1 and D2 which are rarely used (if at all) and into D3hot and
      D3cold for devices actually having _PR3, but those are likely to
      be validated against Windows anyway.  The other changes may affect
      code calling acpi_device_get_power() or acpi_device_update_power()
      where ACPI_STATE_D3_HOT may be returned instead of ACPI_STATE_D3_COLD
      (that's why the ACPI fan driver needs to be updated too) and since
      transitions into ACPI_STATE_D3_HOT may remove power now, it is better
      to avoid this one in acpi_pm_device_sleep_state() if the "no power
      off" PM QoS flag is set.
      
      The only existing user of acpi_device_can_poweroff() really cares
      about the case when _PR3 is present, so the change in that function
      should not cause any problems to happen too.
      
      A plus is that PCI_D3hot can be mapped to ACPI_STATE_D3_HOT
      now and the compatibility with older systems should be covered
      automatically.
      
      In any case, if any real problems result from this, it still will
      be better to follow the Windows' behavior (which now is reflected
      by the specification too) in general and handle the cases when it
      doesn't work via quirks.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      20dacb71
  15. 05 5月, 2015 1 次提交
    • R
      ACPI / property: Refine consistency check for PRP0001 · 5c53b262
      Rafael J. Wysocki 提交于
      Refine the check for the presence of the "compatible" property
      if the PRP0001 device ID is present in the device's list of
      ACPI/PNP IDs to also print the message if _DSD is missing
      entirely or the format of it is incorrect.
      
      One special case to take into accout is that the "compatible"
      property need not be provided for devices having the PRP0001
      device ID in their lists of ACPI/PNP IDs if they are ancestors
      of PRP0001 devices with the "compatible" property present.
      This is to cover heriarchies of device objects where the kernel
      is only supposed to use a struct device representation for the
      topmost one and the others represent, for example, functional
      blocks of a composite device.
      
      While at it, reduce the log level of the message to "info"
      and reduce the log level of the "broken _DSD" message to
      "debug" (noise reduction).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      5c53b262
  16. 18 3月, 2015 1 次提交
  17. 17 3月, 2015 1 次提交
  18. 13 12月, 2014 1 次提交
  19. 04 12月, 2014 1 次提交
  20. 24 11月, 2014 1 次提交
  21. 05 11月, 2014 4 次提交
    • R
      ACPI / GPIO: Driver GPIO mappings for ACPI GPIOs · f028d524
      Rafael J. Wysocki 提交于
      Provide a way for device drivers using GPIOs described by ACPI
      GpioIo resources in _CRS to tell the GPIO subsystem what names
      (connection IDs) to associate with specific GPIO pins defined
      in there.
      
      To do that, a driver needs to define a mapping table as a
      NULL-terminated array of struct acpi_gpio_mapping objects
      that each contain a name, a pointer to an array of line data
      (struct acpi_gpio_params) objects and the size of that array.
      
      Each struct acpi_gpio_params object consists of three fields,
      crs_entry_index, line_index, active_low, representing the index of
      the target GpioIo()/GpioInt() resource in _CRS starting from zero,
      the index of the target line in that resource starting from zero,
      and the active-low flag for that line, respectively.
      
      Next, the mapping table needs to be passed as the second
      argument to acpi_dev_add_driver_gpios() that will register it with
      the ACPI device object pointed to by its first argument.  That
      should be done in the driver's .probe() routine.
      
      On removal, the driver should unregister its GPIO mapping table
      by calling acpi_dev_remove_driver_gpios() on the ACPI device
      object where that table was previously registered.
      
      Included are fixes from Mika Westerberg.
      Acked-by: NAlexandre Courbot <acourbot@nvidia.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f028d524
    • R
      Driver core: Unified interface for firmware node properties · 8a0662d9
      Rafael J. Wysocki 提交于
      Add new generic routines are provided for retrieving properties from
      device description objects in the platform firmware in case there are
      no struct device objects for them (either those objects have not been
      created yet or they do not exist at all).
      
      The following functions are provided:
      
      fwnode_property_present()
      fwnode_property_read_u8()
      fwnode_property_read_u16()
      fwnode_property_read_u32()
      fwnode_property_read_u64()
      fwnode_property_read_string()
      fwnode_property_read_u8_array()
      fwnode_property_read_u16_array()
      fwnode_property_read_u32_array()
      fwnode_property_read_u64_array()
      fwnode_property_read_string_array()
      
      in analogy with the corresponding functions for struct device added
      previously.  For all of them, the first argument is a pointer to struct
      fwnode_handle (new type) that allows a device description object
      (depending on what platform firmware interface is in use) to be
      obtained.
      
      Add a new macro device_for_each_child_node() for iterating over the
      children of the device description object associated with a given
      device and a new function device_get_child_node_count() returning the
      number of a given device's child nodes.
      
      The interface covers both ACPI and Device Trees.
      Suggested-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8a0662d9
    • M
      ACPI: Allow drivers to match using Device Tree compatible property · 733e6251
      Mika Westerberg 提交于
      We have lots of existing Device Tree enabled drivers and allocating
      separate _HID for each is not feasible. Instead we allocate special _HID
      "PRP0001" that means that the match should be done using Device Tree
      compatible property using driver's .of_match_table instead if the driver
      is missing .acpi_match_table.
      
      If there is a need to distinguish from where the device is enumerated
      (DT/ACPI) driver can check dev->of_node or ACPI_COMPATION(dev).
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      733e6251
    • M
      ACPI: Add support for device specific properties · ffdcd955
      Mika Westerberg 提交于
      Device Tree is used in many embedded systems to describe the system
      configuration to the OS. It supports attaching properties or name-value
      pairs to the devices it describe. With these properties one can pass
      additional information to the drivers that would not be available
      otherwise.
      
      ACPI is another configuration mechanism (among other things) typically
      seen, but not limited to, x86 machines. ACPI allows passing arbitrary
      data from methods but there has not been mechanism equivalent to Device
      Tree until the introduction of _DSD in the recent publication of the
      ACPI 5.1 specification.
      
      In order to facilitate ACPI usage in systems where Device Tree is
      typically used, it would be beneficial to standardize a way to retrieve
      Device Tree style properties from ACPI devices, which is what we do in
      this patch.
      
      If a given device described in ACPI namespace wants to export properties it
      must implement _DSD method (Device Specific Data, introduced with ACPI 5.1)
      that returns the properties in a package of packages. For example:
      
      	Name (_DSD, Package () {
      		ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
      		Package () {
      			Package () {"name1", <VALUE1>},
      			Package () {"name2", <VALUE2>},
      			...
      		}
      	})
      
      The UUID reserved for properties is daffd814-6eba-4d8c-8a91-bc9bbf4aa301
      and is documented in the ACPI 5.1 companion document called "_DSD
      Implementation Guide" [1], [2].
      
      We add several helper functions that can be used to extract these
      properties and convert them to different Linux data types.
      
      The ultimate goal is that we only have one device property API that
      retrieves the requested properties from Device Tree or from ACPI
      transparent to the caller.
      
      [1] http://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel.htm
      [2] http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdfReviewed-by: NHanjun Guo <hanjun.guo@linaro.org>
      Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
      Reviewed-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ffdcd955
  22. 10 10月, 2014 1 次提交
  23. 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
  24. 16 9月, 2014 1 次提交
  25. 04 9月, 2014 1 次提交
  26. 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
  27. 16 7月, 2014 1 次提交
  28. 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
  29. 30 5月, 2014 2 次提交