1. 10 6月, 2021 2 次提交
    • E
      ACPI: Add \_SB._OSC bit for PRM · 60faa8f1
      Erik Kaneda 提交于
      Signed-off-by: NErik Kaneda <erik.kaneda@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      60faa8f1
    • E
      ACPI: PRM: implement OperationRegion handler for the PlatformRtMechanism subtype · cefc7ca4
      Erik Kaneda 提交于
      Platform Runtime Mechanism (PRM) is a firmware interface that exposes
      a set of binary executables that can either be called from the AML
      interpreter or device drivers by bypassing the AML interpreter.
      This change implements the AML interpreter path.
      
      According to the specification [1], PRM services are listed in an
      ACPI table called the PRMT. This patch parses module and handler
      information listed in the PRMT and registers the PlatformRtMechanism
      OpRegion handler before ACPI tables are loaded.
      
      Each service is defined by a 16-byte GUID and called from writing a
      26-byte ASL buffer containing the identifier to a FieldUnit object
      defined inside a PlatformRtMechanism OperationRegion.
      
          OperationRegion (PRMR, PlatformRtMechanism, 0, 26)
          Field (PRMR, BufferAcc, NoLock, Preserve)
          {
              PRMF, 208 // Write to this field to invoke the OperationRegion Handler
          }
      
      The 26-byte ASL buffer is defined as the following:
      
      Byte Offset   Byte Length    Description
      =============================================================
           0             1         PRM OperationRegion handler status
           1             8         PRM service status
           9             1         PRM command
          10            16         PRM handler GUID
      
      The ASL caller fills out a 26-byte buffer containing the PRM command
      and the PRM handler GUID like so:
      
          /* Local0 is the PRM data buffer */
          Local0 = buffer (26){}
      
          /* Create byte fields over the buffer */
          CreateByteField (Local0, 0x9, CMD)
          CreateField (Local0, 0x50, 0x80, GUID)
      
          /* Fill in the command and data fields of the data buffer */
          CMD = 0 // run command
          GUID = ToUUID("xxxx-xx-xxx-xxxx")
      
          /*
           * Invoke PRM service with an ID that matches GUID and save the
           * result.
           */
          Local0 = (\_SB.PRMT.PRMF = Local0)
      
      Byte offset 0 - 8 are written by the handler as a status passed back to AML
      and used by ASL like so:
      
          /* Create byte fields over the buffer */
          CreateByteField (Local0, 0x0, PSTA)
          CreateQWordField (Local0, 0x1, USTA)
      
      In this ASL code, PSTA contains a status from the OperationRegion and
      USTA contains a status from the PRM service.
      
      The 26-byte buffer is recieved by acpi_platformrt_space_handler. This
      handler will look at the command value and the handler guid and take
      the approperiate actions.
      
      Command value    Action
      =====================================================================
          0            Run the PRM service indicated by the PRM handler
                       GUID (bytes 10-26)
      
          1            Prevent PRM runtime updates from happening to the
                       service's parent module
      
          2            Allow PRM updates from happening to the service's parent module
      
      This patch enables command value 0.
      
      Link: https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf # [1]
      Signed-off-by: NErik Kaneda <erik.kaneda@intel.com>
      [ rjw: Subject and changelog edits ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cefc7ca4
  2. 05 2月, 2021 1 次提交
    • R
      ACPI: bus: Clean up printing messages · ee98460b
      Rafael J. Wysocki 提交于
      Replace all of the ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() instances
      in bus.c with pr_debug() and pr_info(), respectively, drop the
      _COMPONENT and ACPI_MODULE_NAME() definitions that are not used any
      more and replace direct printk() invocations with the matching
      pr_*() calls (with a couple of exceptions where the log level is
      decreased).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ee98460b
  3. 04 2月, 2021 2 次提交
    • M
      ACPI: Add support for native USB4 control _OSC · 5a6a2c0f
      Mika Westerberg 提交于
      ACPI 6.4 introduced a new _OSC capability that is used negotiate native
      connection manager support. Connection manager is the entity that is
      responsible for tunneling over the USB4 fabric. If the platform rejects
      the native access then firmware based connection manager is used.
      
      The new _OSC also includes a set of bits that can be used to disable
      certain tunnel types such as PCIe for security reasons for instance.
      
      This implements the new USB4 _OSC so that we try to negotiate native
      USB4 support if the Thunderbolt/USB4 (CONFIG_USB4) driver is enabled.
      Drivers can determine what was negotiated by checking two new variables
      exposed in this patch.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5a6a2c0f
    • M
      ACPI: Execute platform _OSC also with query bit clear · 719e1f56
      Mario Limonciello 提交于
      The platform _OSC can change the hardware state when query bit is not
      set. According to ACPI spec it is recommended that the OS runs _OSC with
      query bit set until the platform does not mask any of the capabilities.
      Then it should run it with query bit clear in order to actually commit
      the changes. Linux has not been doing this for the reasons that there
      has not been anything to commit, until now.
      
      The ACPI 6.4 introduced _OSC for USB4 to allow the OS to negotiate
      native control over USB4 tunneling. The platform might implement this so
      that it only activates the software connection manager path when the OS
      calls the _OSC with the query bit clear. Otherwise it may default to the
      firmware connection manager, for instance.
      
      For this reason modify the _OSC support so that we first execute it with
      query bit set, then use the returned value as base of the features we
      want to control and run the _OSC again with query bit clear. This also
      follows what Windows is doing.
      
      Also rename the function to better match what it does.
      Signed-off-by: NMario Limonciello <mario.limonciello@dell.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      719e1f56
  4. 03 10月, 2020 1 次提交
  5. 03 9月, 2020 1 次提交
  6. 29 11月, 2019 1 次提交
    • V
      ACPI: bus: Fix NULL pointer check in acpi_bus_get_private_data() · 627ead72
      Vamshi K Sthambamkadi 提交于
      kmemleak reported backtrace:
          [<bbee0454>] kmem_cache_alloc_trace+0x128/0x260
          [<6677f215>] i2c_acpi_install_space_handler+0x4b/0xe0
          [<1180f4fc>] i2c_register_adapter+0x186/0x400
          [<6083baf7>] i2c_add_adapter+0x4e/0x70
          [<a3ddf966>] intel_gmbus_setup+0x1a2/0x2c0 [i915]
          [<84cb69ae>] i915_driver_probe+0x8d8/0x13a0 [i915]
          [<81911d4b>] i915_pci_probe+0x48/0x160 [i915]
          [<4b159af1>] pci_device_probe+0xdc/0x160
          [<b3c64704>] really_probe+0x1ee/0x450
          [<bc029f5a>] driver_probe_device+0x142/0x1b0
          [<d8829d20>] device_driver_attach+0x49/0x50
          [<de71f045>] __driver_attach+0xc9/0x150
          [<df33ac83>] bus_for_each_dev+0x56/0xa0
          [<80089bba>] driver_attach+0x19/0x20
          [<cc73f583>] bus_add_driver+0x177/0x220
          [<7b29d8c7>] driver_register+0x56/0xf0
      
      In i2c_acpi_remove_space_handler(), a leak occurs whenever the
      "data" parameter is initialized to 0 before being passed to
      acpi_bus_get_private_data().
      
      This is because the NULL pointer check in acpi_bus_get_private_data()
      (condition->if(!*data)) returns EINVAL and, in consequence, memory is
      never freed in i2c_acpi_remove_space_handler().
      
      Fix the NULL pointer check in acpi_bus_get_private_data() to follow
      the analogous check in acpi_get_data_full().
      Signed-off-by: NVamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
      [ rjw: Subject & changelog ]
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      627ead72
  7. 31 5月, 2019 1 次提交
    • T
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 · c942fddf
      Thomas Gleixner 提交于
      Based on 3 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [kishon] [vijay] [abraham]
        [i] [kishon]@[ti] [com] this program is distributed in the hope that
        it will be useful but without any warranty without even the implied
        warranty of merchantability or fitness for a particular purpose see
        the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [graeme] [gregory]
        [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
        [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
        [hk] [hemahk]@[ti] [com] this program is distributed in the hope
        that it will be useful but without any warranty without even the
        implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 1105 file(s).
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NAllison Randal <allison@lohutok.net>
      Reviewed-by: NRichard Fontana <rfontana@redhat.com>
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c942fddf
  8. 25 3月, 2019 1 次提交
  9. 27 2月, 2019 1 次提交
  10. 07 2月, 2019 1 次提交
  11. 16 1月, 2019 1 次提交
    • R
      ACPI: EC: Look for ECDT EC after calling acpi_load_tables() · b1c03308
      Rafael J. Wysocki 提交于
      Some systems have had functional issues since commit 5a8361f7
      (ACPICA: Integrate package handling with module-level code) that,
      among other things, changed the initial values of the
      acpi_gbl_group_module_level_code and acpi_gbl_parse_table_as_term_list
      global flags in ACPICA which implicitly caused acpi_ec_ecdt_probe() to
      be called before acpi_load_tables() on the vast majority of platforms.
      
      Namely, before commit 5a8361f7, acpi_load_tables() was called from
      acpi_early_init() if acpi_gbl_parse_table_as_term_list was FALSE and
      acpi_gbl_group_module_level_code was TRUE, which almost always was
      the case as FALSE and TRUE were their initial values, respectively.
      The acpi_gbl_parse_table_as_term_list value would be changed to TRUE
      for a couple of platforms in acpi_quirks_dmi_table[], but it remained
      FALSE in the vast majority of cases.
      
      After commit 5a8361f7, the initial values of the two flags have
      been reversed, so in effect acpi_load_tables() has not been called
      from acpi_early_init() any more.  That, in turn, affects
      acpi_ec_ecdt_probe() which is invoked before acpi_load_tables() now
      and it is not possible to evaluate the _REG method for the EC address
      space handler installed by it.  That effectively causes the EC address
      space to be inaccessible to AML on platforms with an ECDT matching the
      EC device definition in the DSDT and functional problems ensue in
      there.
      
      Because the default behavior before commit 5a8361f7 was to call
      acpi_ec_ecdt_probe() after acpi_load_tables(), it should be safe to
      do that again.  Moreover, the EC address space handler installed by
      acpi_ec_ecdt_probe() is only needed for AML to be able to access the
      EC address space and the only AML that can run during acpi_load_tables()
      is module-level code which only is allowed to access address spaces
      with default handlers (memory, I/O and PCI config space).
      
      For this reason, move the acpi_ec_ecdt_probe() invocation back to
      acpi_bus_init(), from where it was taken away by commit d737f333
      (ACPI: probe ECDT before loading AML tables regardless of module-level
      code flag), and put it after the invocation of acpi_load_tables() to
      restore the original code ordering from before commit 5a8361f7.
      
      Fixes: 5a8361f7 ("ACPICA: Integrate package handling with module-level code")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=199981Reported-by: Nstep-ali <sunmooon15@gmail.com>
      Reported-by: NCharles Stanhope <charles.stanhope@gmail.com>
      Tested-by: NCharles Stanhope <charles.stanhope@gmail.com>
      Reported-by: NPaulo Nascimento <paulo.ulusu@googlemail.com>
      Reported-by: NDavid Purton <dcpurton@marshwiggle.net>
      Reported-by: NAdam Harvey <adam@adamharvey.name>
      Reported-by: NZhang Rui <rui.zhang@intel.com>
      Tested-by: NZhang Rui <rui.zhang@intel.com>
      Tested-by: NJean-Marc Lenoir <archlinux@jihemel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b1c03308
  12. 27 11月, 2018 1 次提交
  13. 18 10月, 2018 1 次提交
  14. 06 9月, 2018 1 次提交
    • J
      ACPI / bus: Only call dmi_check_system() on X86 · 5d128fbd
      Jean Delvare 提交于
      Calling dmi_check_system() early only works on X86. Other
      architectures initialize the DMI subsystem later so it's not
      ready yet when ACPI itself gets initialized.
      
      In the best case it results in a useless call to a function which
      will do nothing. But depending on the dmi implementation, it could
      also result in warnings. Best is to not call the function when it
      can't work and isn't needed.
      
      Additionally, if anyone ever needs to add non-x86 quirks, it would
      surprisingly not work, so document the limitation to avoid confusion.
      Signed-off-by: NJean Delvare <jdelvare@suse.de>
      Fixes: cce4f632 (ACPI: fix early DSDT dmi check warnings on ia64)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5d128fbd
  15. 09 8月, 2018 1 次提交
  16. 20 7月, 2018 1 次提交
  17. 19 3月, 2018 1 次提交
  18. 12 2月, 2018 4 次提交
  19. 07 2月, 2018 1 次提交
  20. 04 2月, 2018 2 次提交
  21. 13 12月, 2017 1 次提交
  22. 14 9月, 2017 1 次提交
  23. 20 7月, 2017 1 次提交
  24. 05 7月, 2017 1 次提交
  25. 07 6月, 2017 1 次提交
  26. 06 6月, 2017 1 次提交
  27. 27 4月, 2017 1 次提交
    • H
      ACPI / bus: Introduce a list of ids for "always present" devices · b7ecf663
      Hans de Goede 提交于
      Several Bay / Cherry Trail devices (all of which ship with Windows 10) hide
      the LPSS PWM controller in ACPI, typically the _STA method looks like this:
      
          Method (_STA, 0, NotSerialized)  // _STA: Status
          {
              If (OSID == One)
              {
                  Return (Zero)
              }
      
              Return (0x0F)
          }
      
      Where OSID is some dark magic seen in all Cherry Trail ACPI tables making
      the machine behave differently depending on which OS it *thinks* it is
      booting, this gets set in a number of ways which we cannot control, on
      some newer machines it simple hardcoded to "One" aka win10.
      
      This causes the PWM controller to get hidden, which means Linux cannot
      control the backlight level on cht based tablets / laptops.
      
      Since loading the driver for this does no harm (the only in kernel user
      of it is the i915 driver, which will only uses it when it needs it), this
      commit makes acpi_bus_get_status() always set status to ACPI_STA_DEFAULT
      for the LPSS PWM device, fixing the lack of backlight control.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      [ rjw: Rename the new file to utils.c ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b7ecf663
  28. 11 3月, 2017 1 次提交
  29. 07 2月, 2017 1 次提交
  30. 21 12月, 2016 1 次提交
  31. 30 11月, 2016 1 次提交
  32. 25 11月, 2016 2 次提交
  33. 26 9月, 2016 1 次提交