Commit graph

1238 commits

Author SHA1 Message Date
Rafael J. Wysocki
63fb962342 ACPI: PM: s2idle: Check fixed wakeup events in acpi_s2idle_wake()
Commit fdde0ff859 ("ACPI: PM: s2idle: Prevent spurious SCIs from
waking up the system") overlooked the fact that fixed events can wake
up the system too and broke RTC wakeup from suspend-to-idle as a
result.

Fix this issue by checking the fixed events in acpi_s2idle_wake() in
addition to checking wakeup GPEs and break out of the suspend-to-idle
loop if the status bits of any enabled fixed events are set then.

Fixes: fdde0ff859 ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system")
Reported-and-tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-02-21 10:01:25 -08:00
Rafael J. Wysocki
ea128834dd ACPICA: Introduce acpi_any_gpe_status_set()
Introduce a new helper function, acpi_any_gpe_status_set(), for
checking the status bits of all enabled GPEs in one go.

It is needed to distinguish spurious SCIs from genuine ones when
deciding whether or not to wake up the system from suspend-to-idle.

Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-02-11 23:26:15 +01:00
Bob Moore
800ba7c5ea ACPICA: All acpica: Update copyrights to 2020 Including tool signons.
ACPICA commit 8b9c69d0984067051ffbe8526f871448ead6a26b

Link: https://github.com/acpica/acpica/commit/8b9c69d0
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-01-13 11:52:48 +01:00
Maximilian Luz
6d232b29cf ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator
ACPICA commit 79a466b64e6af36cc83102f05915e56cb7dd89ab

According to table 19-419 of the ACPI 6.3 specification, buffer_fields
created using the ASL create_field() Operator have been treated as
integers if the buffer_field is small enough to fit inside of an ASL
integer (32-bits or 64-bits depending on the definition block
revision). If they are larger, buffer fields are treated as ASL
Buffer objects. However, this is not true for other AML interpreter
implementations.

It has been discovered that other AML interpreters always treat
buffer fields created by create_field() as a buffer regardless of the
length of the buffer field.

More specifically, the Microsoft AML interpreter always treats buffer
fields created by the create_field() operator as buffer. ACPICA
currently does this only when the field size is larger than the
maximum integer width. This causes problems with AML code shipped in
Microsoft Surface devices.

More details:

The control methods in these devices determine the success of an ASL
control method execution by examining the type resulting from storing
a buffer field created by a create_field() operator. On success, a
Buffer object is expected, on failure an Integer containing an error
code. This buffer object is created with a dynamic size via the
create_field() operator. Due to the difference in behavior, Buffer
values of small size are however converted to Integers and thus
interpreted by the control method as having failed, whereas in
reality it succeeded. Below is an example of a control method called
TEST that illustrates this behavior.

Method (CBUF) // Create a Buffer field
{
    /*
     * Depending on the value of RAND, ACPICA interpreter will treat
     * BF00 as an integer or buffer.
     */
    create_field (BUFF, 0, RAND, BF00)
    return (BF00)
}

Method (TEST)
{
    /*
     * Storing the value returned by CBUF to local0 will result in
     * implicit type conversion outlined in the ACPI specification.
     *
     * ACPICA will treat local0 like an ASL integer if RAND is less
     * than or equal to 64 or 32 (depending on the definition_block
     * revision). If RAND is greater, it will be treated like an ASL
     * buffer. Other implementations treat local0 like an ASL buffer
     * regardless of the value of RAND.
     */
    local0 = CBUF()

    /*
     * object_type of 0x03 represents an ASL Buffer
     */
    if (object_type (Local0) != 0x03)
    {
        // Error on ACPICA if RAND is small enough
    }
    else
    {
        /*
         * Success on APICA if RAND is large enough
         * Other implementations always take this path because local0
         * is always treated as a buffer.
         */
    }
}

This change prohibits the previously mentioned integer conversion to
match other AML interpreter implementations (Microsoft) that do not
conform to the ACPI specification.

Link: https://github.com/acpica/acpica/commit/79a466b6
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-12-19 23:04:21 +01:00
Erik Kaneda
5ddbd77181 ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1
ACPICA commit 29cc8dbc5463a93625bed87d7550a8bed8913bf4

create_buffer_field is a deferred op that is typically processed in
load pass 2. However, disassembly of control method contents walk the
parse tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are
processed in a later walk. This is a problem when there is a control
method that has the same name as the AML_CREATE object. In this case,
any use of the name segment will be detected as a method call rather
than a reference to a buffer field. If this is detected as a method
call, it can result in a mal-formed parse tree if the control methods
have parameters.

This change in processing AML_CREATE ops earlier solves this issue by
inserting the named object in the ACPI namespace so that references
to this name would be detected as a name string rather than a method
call.

Link: https://github.com/acpica/acpica/commit/29cc8dbc
Reported-by: Elia Geretto <elia.f.geretto@gmail.com>
Tested-by: Elia Geretto <elia.f.geretto@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-12-19 23:04:21 +01:00
Colin Ian King
22e38ca735 ACPICA: debugger: fix spelling mistake "adress" -> "address"
ACPICA commit 7aa72c5fdf75c5b80adf758980e06bcafb7f8670

There is a spelling mistake in an error message. Fix it.

Link: https://github.com/acpica/acpica/commit/7aa72c5f
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-12-19 23:04:21 +01:00
Erik Schmauss
45abdc9903 ACPICA: debugger: remove leading whitespaces when converting a string to a buffer
ACPICA commit 1b7228072f254a5b02625586ff7d561757b7fc2d

By removing leading whitespaces, the conversion computes the
correct number of elements in a given buffer or field encoding
that contains leading whitespaces.

Link: https://github.com/acpica/acpica/commit/1b722807
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Erik Schmauss
02b04f10b8 ACPICA: acpiexec: initialize all simple types and field units from user input
ACPICA commit 367b363edc5fa1f93bbc14e4a1e05f34fef765a2

acpiexec allows a user to provide a file that indicates values to
initialize named objects during table load with the -fi option. This
can provide more accurate simulation by setting named objects to
values found during OS runtime.

Previously, this option only supported integer objects. This change
adds user initialization support for field units, strings, buffers,
and packages.

Link: https://github.com/acpica/acpica/commit/367b363e
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Erik Schmauss
7609350642 ACPICA: debugger: add field unit support for acpi_db_get_next_token
ACPICA commit d509afa88e9415f13a3283c38ce9ee034634ae24

Since field unit data output from the debugger are now surrounded by
braces '{', support has been added to acpi_db_get_next_token to recognize
strings beginning with this character as a ACPI_TYPE_FIELD_UNIT.

Link: https://github.com/acpica/acpica/commit/d509afa8
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Erik Schmauss
20d93fce00 ACPICA: debugger: surround field unit output with braces '{'
ACPICA commit 76ca57291d007d33087982a4b28cd1ee9bcd37a6

This helps differentiate the type of named objects between field
units and buffers. In other words, without this symbol, it would be
difficult to tell whether a particular named object is a buffer or a
field unit.

Link: https://github.com/acpica/acpica/commit/76ca5729
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Erik Schmauss
5fd033288a ACPICA: debugger: add command to dump all fields of particular subtype
In acpiexec, this can be invoked by typing "fields" followed by a
number representing the address space ID of that field.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Erik Schmauss
efcf9456c8 ACPICA: utilities: add flag to only display data when dumping buffers
ACPICA commit fb18935fcf940c5854a055975c6b9ee31f0e1a5a

Link: https://github.com/acpica/acpica/commit/fb18935f
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Nikolaus Voss
1770093c5b ACPICA: make acpi_load_table() return table index
ACPICA commit d1716a829d19be23277d9157c575a03b9abb7457

For unloading an ACPI table, it is necessary to provide the index of
the table. The method intended for dynamically loading or hotplug
addition of tables, acpi_load_table(), should provide this information
via an optional pointer to the loaded table index.

This patch fixes the table unload function of acpi_configfs.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Fixes: d06c47e3dd ("ACPI: configfs: Resolve objects on host-directed table loads")
Link: https://github.com/acpica/acpica/commit/d1716a82
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Bob Moore
42d939fadb ACPICA: Add new external interface, acpi_unload_table()
ACPICA commit c69369cd9cf0134e1aac516e97d612947daa8dc2

Unload a table via the table_index.

Link: https://github.com/acpica/acpica/commit/c69369cd
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Bob Moore
aaf7566f33 ACPICA: More Clang changes
ACPICA commit 54b3aefb5de860306951c8c3339b1c37dcdf1b39

V8.0.1: Fixed all "dead assignment" warnings.

Link: https://github.com/acpica/acpica/commit/54b3aefb
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Bob Moore
197aba2090 ACPICA: Win OSL: Replace get_tick_count with get_tick_count64
ACPICA commit 7bc16c650317001bc82d4bae227b888a49c51f5e

Avoid possible overflow from get_tick_count. Also, cast math
using ACPI_100NSEC_PER_MSEC to uint64.

Link: https://github.com/acpica/acpica/commit/7bc16c65
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Bob Moore
edc5935ec7 ACPICA: Results from Clang
ACPICA commit 1f08279b3eb13f17004159c28c391a390cd68feb

Changes/fixes From Clang V5.0.1.  Mostly "set but never read"
warnings.

Link: https://github.com/acpica/acpica/commit/1f08279b
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Linus Torvalds
d2aaa49e28 ACPI updates for 5.4-rc1
- Update the ACPICA code in the kernel to upstream revision 20190816
    including:
    * Internal limits change to support larger systems (Bob Moore).
    * Macros clean up (Bob Moore).
    * printf format string fixes (Bob Moore).
    * Full deployment of the ACPI_PRINTF_LIKE macro (Bob Moore).
    * Tools improvements (Bob Moore, Colin Ian King).
    * Windows _OSI support fixes (Jung-uk Kim).
 
  - Improve memory hot-add support in the ACPI HMAT handling code (Dan
    Williams, Keith Busch).
 
  - Fix the ACPI LPSS (Low-Power Subsystem) driver for Intel SoCs to
    save and restore private registers during system-wide suspend and
    resume on systems with the Lynxpoint PCH (Jarkko Nikula).
 
  - Convert the ACPI documentation related to LEDs to ReST (Sakari
    Ailus).
 
  - Fix assorted issues and make assorted minor improvements in the
    ACPI-related code (Al Stone, Andy Shevchenko, Jiri Slaby, Kelsey
    Skunberg, Krzysztof Wilczynski, Liguang Zhang, Wenwen Wang,
    YueHaibing).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl2ArjwSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxTwIP/1z6g8tO8B8pFSjp1C7+Mw6hxfVIONtp
 gzO0FRwopeUI0pD6frdfDAXLATFk/qEOWVEA+iGHm79BhuVIl6EbEnPbDaMeHE2L
 27OhUw+0URukFbWdHvw5pykgs5EYJPXPYewTYyOVGR7v+7EZLMw7dHqs9yJgGCpN
 nTr1eE6zAstujEwLKed0zqs2g7nIariTCxxwvY85lEpnn8aFSqrMA6f9Xg539YUs
 O1jevdpFAJFreRaXfq2ip1sOJq1uGGzieG1wHM1g7UR9g2lHdPioAz0jDb5Bvuxo
 VF+Hu5V6S7VtCrYFZVsVNVbVfoGynasP4T/Cz0ERzeaGYqP7nVkpaegd/19P9nyZ
 ySQUyObL248ZJVHvIrgrBNVwXj0b4ukLhvu+X/Yymlt+TGgokswQSOiwYqu41jIQ
 ieCVCnIju62IsrhTKxEl8xFA4UfhNylOYGK1fPKYqHz7cstuoiU5n+SBiMJW2T0y
 DKbuQ5mSZ167vGjbCw1XrkZlL5eW2BYBg53SE4ol+YESFLkACxN8z7THQsQe+wdr
 AiUw3aNnawRZG5z+qhsHJEEC+5XRSn1OnHG5TKyPZnmpYvwc8gv/DEss3PDWuSjA
 ychgJvfFVgvkNXjDPgNlyau9WYAeITJO+Hoe+D+nhj/klefU9AcJSbDrvK1rORmk
 Tm9yuxh9PiJW
 =2Tf0
 -----END PGP SIGNATURE-----

Merge tag 'acpi-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
 "These include an ACPICA update (to upstream revision 20190816),
  improvements of support for memory hot-add in the HMAT handling code
  and some assorted fixes and cleanups.

  Specifics:

   - Update the ACPICA code in the kernel to upstream revision 20190816
     including:
      * Internal limits change to support larger systems (Bob Moore).
      * Macros clean up (Bob Moore).
      * printf format string fixes (Bob Moore).
      * Full deployment of the ACPI_PRINTF_LIKE macro (Bob Moore).
      * Tools improvements (Bob Moore, Colin Ian King).
      * Windows _OSI support fixes (Jung-uk Kim).

   - Improve memory hot-add support in the ACPI HMAT handling code (Dan
     Williams, Keith Busch).

   - Fix the ACPI LPSS (Low-Power Subsystem) driver for Intel SoCs to
     save and restore private registers during system-wide suspend and
     resume on systems with the Lynxpoint PCH (Jarkko Nikula).

   - Convert the ACPI documentation related to LEDs to ReST (Sakari
     Ailus).

   - Fix assorted issues and make assorted minor improvements in the
     ACPI-related code (Al Stone, Andy Shevchenko, Jiri Slaby, Kelsey
     Skunberg, Krzysztof Wilczynski, Liguang Zhang, Wenwen Wang,
     YueHaibing)"

* tag 'acpi-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (23 commits)
  ACPI / PCI: fix acpi_pci_irq_enable() memory leak
  ACPI: custom_method: fix memory leaks
  ACPI: thermal: Remove redundant acpi_has_method() calls
  ACPI / CPPC: do not require the _PSD method
  ACPI: SBS: remove unused const variable 'SMBUS_PEC'
  ACPI / LPSS: Save/restore LPSS private registers also on Lynxpoint
  ACPI/PCI: Remove surplus parentheses from a return statement
  ACPICA: Update version to 20190816.
  ACPICA: Add "Windows 2019" string to _OSI support.
  ACPICA: Differentiate Windows 8.1 from Windows 8.
  ACPICA: Fully deploy ACPI_PRINTF_LIKE macro
  ACPICA: iASL,acpi_dump: Improve y/n query
  ACPICA: Fix issues with arg types within printf format strings
  ACPICA: Macros: remove pointer math on a null pointer
  ACPICA: Increase total number of possible Owner IDs
  ACPICA: Debugger: remove redundant assignment on obj_desc
  Documentation: ACPI: DSD: Convert LED documentation to ReST
  ACPI / APEI: Release resources if gen_pool_add() fails
  HMAT: Skip publishing target info for nodes with no online memory
  HMAT: Register attributes for memory hot add
  ...
2019-09-17 19:31:36 -07:00
Jung-uk Kim
8696beed34 ACPICA: Add "Windows 2019" string to _OSI support.
ACPICA commit 32fffb242800b0202986e86d9b0e16f88a23de66

Link: https://github.com/acpica/acpica/commit/32fffb24
Signed-off-by: Jung-uk Kim <jkim@free_BSD.org>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-08-21 00:00:37 +02:00
Jung-uk Kim
be0381cf2d ACPICA: Differentiate Windows 8.1 from Windows 8.
ACPICA commit 66db7b38f61e63f11e48a0ea993d92b12e0a17ca

Link: https://github.com/acpica/acpica/commit/66db7b38
Signed-off-by: Jung-uk Kim <jkim@free_BSD.org>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-08-21 00:00:37 +02:00
Bob Moore
36056d0cd6 ACPICA: Fully deploy ACPI_PRINTF_LIKE macro
ACPICA commit d06def132a8852d02c9c7fee60f17b2011066e8e

Macro was not being used across all "printf-like" functions.

Also, clean up all calls to such functions now that they are
analyzed by the compiler (gcc). Both in 32-bit mode and 64-bit
mode.

Link: https://github.com/acpica/acpica/commit/d06def13
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-08-21 00:00:37 +02:00
Bob Moore
231ec06e79 ACPICA: Fix issues with arg types within printf format strings
ACPICA commit db2638ccaac84b61e92f34d60c3630ff5217f852

Link: https://github.com/acpica/acpica/commit/db2638cc
Link: https://github.com/acpica/acpica/commit/634c3085
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-08-21 00:00:36 +02:00
Bob Moore
67a72420a3 ACPICA: Increase total number of possible Owner IDs
ACPICA commit 1f1652dad88b9d767767bc1f7eb4f7d99e6b5324

From 255 to 4095 possible IDs.

Link: https://github.com/acpica/acpica/commit/1f1652da
Reported-by: Hedi Berriche <hedi.berriche @hpe.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-08-21 00:00:36 +02:00
Colin Ian King
189c7213f4 ACPICA: Debugger: remove redundant assignment on obj_desc
ACPICA commit f530f1acb3128136ad97c715fdaebbbeff283ee2

Pointer obj_desc is being initialized with a value that is never
read and it is being updated later with a new value. The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")

Link: https://github.com/acpica/acpica/commit/f530f1ac
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-08-21 00:00:36 +02:00
Rafael J. Wysocki
6921de898b ACPICA: Return u32 from acpi_dispatch_gpe()
In some cases it is useful to know whether or not the
acpi_ev_detect_gpe() called by acpi_dispatch_gpe() has found
the GPE to be active, so return the return value of it (whose
data type is u32) from latter.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
2019-07-23 09:46:13 +02:00
Erik Schmauss
d1fb5b2f62 ACPICA: Update table load object initialization
ACPICA commit c7ef9f3526765bed8930825dda1eed1a274b9668

Use the common internal "initialize objects" interface
Affects:
Load()
load_table()
acpi_load_table

Link: https://github.com/acpica/acpica/commit/c7ef9f35
Tested-by: Rong Chen <rong.a.chen@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-07-11 22:38:42 +02:00
Rafael J. Wysocki
6cf7fb5a95 Revert "ACPICA: Update table load object initialization"
Revert commit c522ad0637 ("ACPICA: Update table load object
initialization") as it causes systems to hang on attempts to load
OEM ACPI tables.

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-07-10 11:52:50 +02:00
Erik Schmauss
c522ad0637 ACPICA: Update table load object initialization
ACPICA commit c7ef9f3526765bed8930825dda1eed1a274b9668

Use the common internal "initialize objects" interface
Affects:
 Load()
 load_table()
 acpi_load_table

Link: https://github.com/acpica/acpica/commit/c7ef9f35
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-07-04 00:59:43 +02:00
Bob Moore
86a33cf3b6 ACPICA: Update for object initialization sequence
ACPICA commit 106c72a97f5ca972f29956e5e9a0429b8c4a2723

 1) Do not allow the objects to be initialized twice
 2) Only package objects require a deferred initialization
 3) Cleanup initialization output

Link: https://github.com/acpica/acpica/commit/106c72a9
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-07-04 00:59:43 +02:00
Erik Schmauss
8894f52a14 ACPICA: remove legacy module-level code due to deprecation
ACPICA commit 1ca34b1a7b960ef321eae5dcddfff77707c88aef

There have been several places that have been calling functions
regarding module level code blocks. This change removes all old
vestiges in the codebase. This is dead code.

Link: https://github.com/acpica/acpica/commit/1ca34b1a
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-07-04 00:59:43 +02:00
Bob Moore
f79c8e4136 ACPICA: Namespace: simplify creation of the initial/default namespace
ACPICA commit 76658f55d8cc498a763bdb92f8e0d934822a129c

For the objects that are created by default (_GPE, _SB_, etc)
there is no need to use the heavyweight ns_lookup function.
Instead, simply create each object and link it in as the namespace
is built.

Link: https://github.com/acpica/acpica/commit/76658f55
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-07-04 00:59:43 +02:00
Rafael J. Wysocki
d4ca763eed Merge ACPI tables handling changes for v5.3. 2019-07-04 00:59:15 +02:00
Rafael J. Wysocki
44758bafa5 ACPICA: Clear status of GPEs on first direct enable
ACPI GPEs (other than the EC one) can be enabled in two situations.
First, the GPEs with existing _Lxx and _Exx methods are enabled
implicitly by ACPICA during system initialization.  Second, the
GPEs without these methods (like GPEs listed by _PRW objects for
wakeup devices) need to be enabled directly by the code that is
going to use them (e.g. ACPI power management or device drivers).

In the former case, if the status of a given GPE is set to start
with, its handler method (either _Lxx or _Exx) needs to be invoked
to take care of the events (possibly) signaled before the GPE was
enabled.  In the latter case, however, the first caller of
acpi_enable_gpe() for a given GPE should not be expected to care
about any events that might be signaled through it earlier.  In
that case, it is better to clear the status of the GPE before
enabling it, to prevent stale events from triggering unwanted
actions (like spurious system resume, for example).

For this reason, modify acpi_ev_add_gpe_reference() to take an
additional boolean argument indicating whether or not the GPE
status needs to be cleared when its reference counter changes from
zero to one and make acpi_enable_gpe() pass TRUE to it through
that new argument.

Fixes: 18996f2db9 ("ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume")
Reported-by: Furquan Shaikh <furquan@google.com>
Tested-by: Furquan Shaikh <furquan@google.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-06-19 11:46:21 +02:00
Nikolaus Voss
d06c47e3dd ACPI: configfs: Resolve objects on host-directed table loads
If an ACPI SSDT overlay is loaded after built-in tables
have been loaded e.g. via configfs or efivar_ssdt_load()
it is necessary to rewalk the namespace to resolve
references. Without this, relative and absolute paths
like ^PCI0.SBUS or \_SB.PCI0.SBUS are not resolved
correctly.

Make configfs loads use the same method as efivar_ssdt_load().

Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-06-14 11:39:42 +02:00
Rafael J. Wysocki
317e2cac45 Merge branch 'acpica'
* acpica:
  ACPICA: Update version to 20190405
  ACPICA: Namespace: add check to avoid null pointer dereference
  ACPICA: Update version to 20190329
  ACPICA: utilities: fix spelling of PCC to platform_comm_channel
  ACPICA: Rename nameseg length macro/define for clarity
  ACPICA: Rename nameseg compare macro for clarity
  ACPICA: Rename nameseg copy macro for clarity
2019-05-06 10:49:01 +02:00
Rafael J. Wysocki
2c2a2fb1e2 Revert "ACPICA: Clear status of GPEs before enabling them"
Revert commit c8b1917c89 ("ACPICA: Clear status of GPEs before
enabling them") that causes problems with Thunderbolt controllers
to occur if a dock device is connected at init time (the xhci_hcd
and thunderbolt modules crash which prevents peripherals connected
through them from working).

Commit c8b1917c89 effectively causes commit ecc1165b8b ("ACPICA:
Dispatch active GPEs at init time") to get undone, so the problem
addressed by commit ecc1165b8b appears again as a result of it.

Fixes: c8b1917c89 ("ACPICA: Clear status of GPEs before enabling them")
Link: https://lore.kernel.org/lkml/s5hy33siofw.wl-tiwai@suse.de/T/#u
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1132943
Reported-by: Michael Hirmke <opensuse@mike.franken.de>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: 4.17+ <stable@vger.kernel.org> # 4.17+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-30 20:03:44 +02:00
Rafael J. Wysocki
f456277ee1 Merge back ACPICA changes for v5.2. 2019-04-12 09:59:56 +02:00
Erik Schmauss
df9271d69f ACPICA: Namespace: add check to avoid null pointer dereference
ACPICA commit 7586a625f9c34c3169efd88470192bf63119e31a

Some ACPICA userspace tools call acpi_ut_subsystem_shutdown() during
cleanup and dereference a null pointer when cleaning up the
namespace.

Link: https://github.com/acpica/acpica/commit/7586a625
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-09 11:25:27 +02:00
Erik Schmauss
f49c90e895 ACPICA: utilities: fix spelling of PCC to platform_comm_channel
ACPICA commit 5e5c349e73982aea5d9f74416c0b2eea1b0767a1

Link: https://github.com/acpica/acpica/commit/5e5c349e
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-09 11:25:26 +02:00
Bob Moore
3278675567 ACPICA: Rename nameseg length macro/define for clarity
ACPICA commit 24870bd9e73d71e2a1ff0a1e94519f8f8409e57d

ACPI_NAME_SIZE changed to ACPI_NAMESEG_SIZE
This clarifies that this is the length of an individual
nameseg, not the length of a generic namestring/namepath.
Improves understanding of the code.

Link: https://github.com/acpica/acpica/commit/24870bd9
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-09 11:24:48 +02:00
Bob Moore
5599fb6935 ACPICA: Rename nameseg compare macro for clarity
ACPICA commit 92ec0935f27e217dff0b176fca02c2ec3d782bb5

ACPI_COMPARE_NAME changed to ACPI_COMPARE_NAMESEG
This clarifies (1) this is a compare on 4-byte namesegs, not
a generic compare. Improves understanding of the code.

Link: https://github.com/acpica/acpica/commit/92ec0935
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-09 10:08:28 +02:00
Bob Moore
a3ce7a8e0d ACPICA: Rename nameseg copy macro for clarity
ACPICA commit 19c18d3157945d1b8b64a826f0a8e848b7dbb127

ACPI_MOVE_NAME changed to ACPI_COPY_NAMESEG
This clarifies (1) this is a copy operation, and
(2) it operates on ACPI name_segs.
Improves understanding of the code.

Link: https://github.com/acpica/acpica/commit/19c18d31
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-09 10:08:28 +02:00
Erik Schmauss
c5781ffbbd ACPICA: Namespace: remove address node from global list after method termination
ACPICA commit b233720031a480abd438f2e9c643080929d144c3

ASL operation_regions declare a range of addresses that it uses. In a
perfect world, the range of addresses should be used exclusively by
the AML interpreter. The OS can use this information to decide which
drivers to load so that the AML interpreter and device drivers use
different regions of memory.

During table load, the address information is added to a global
address range list. Each node in this list contains an address range
as well as a namespace node of the operation_region. This list is
deleted at ACPI shutdown.

Unfortunately, ASL operation_regions can be declared inside of control
methods. Although this is not recommended, modern firmware contains
such code. New module level code changes unintentionally removed the
functionality of adding and removing nodes to the global address
range list.

A few months ago, support for adding addresses has been re-
implemented. However, the removal of the address range list was
missed and resulted in some systems to crash due to the address list
containing bogus namespace nodes from operation_regions declared in
control methods. In order to fix the crash, this change removes
dynamic operation_regions after control method termination.

Link: https://github.com/acpica/acpica/commit/b2337200
Link: https://bugzilla.kernel.org/show_bug.cgi?id=202475
Fixes: 4abb951b73 ("ACPICA: AML interpreter: add region addresses in global list during initialization")
Reported-by: Michael J Gruber <mjg@fedoraproject.org>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Cc: 4.20+ <stable@vger.kernel.org> # 4.20+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-09 10:05:11 +02:00
Furquan Shaikh
c8b1917c89 ACPICA: Clear status of GPEs before enabling them
Commit 18996f2db9 ("ACPICA: Events: Stop unconditionally clearing
ACPI IRQs during suspend/resume") was added to stop clearing event
status bits unconditionally in the system-wide suspend and resume
paths. This was done because of an issue with a laptop lid appaering
to be closed even when it was used to wake up the system from suspend
(see https://bugzilla.kernel.org/show_bug.cgi?id=196249), which
happened because event status bits were cleared unconditionally on
system resume. Though this change fixed the issue in the resume path,
it introduced regressions in a few suspend paths.

First regression was reported and fixed in the S5 entry path by commit
fa85015c0d ("ACPICA: Clear status of all events when entering S5").
Next regression was reported and fixed for all legacy sleep paths by
commit f317c7dc12 ("ACPICA: Clear status of all events when entering
sleep states").  However, there still is a suspend-to-idle regression,
since suspend-to-idle does not follow the legacy sleep paths.

In the suspend-to-idle case, wakeup is enabled as part of device
suspend.  If the status bits of wakeup GPEs are set when they are
enabled, it causes a premature system wakeup to occur.

To address that problem, partially revert commit 18996f2db9 to
restore GPE status bits clearing before the GPE is enabled in
acpi_ev_enable_gpe().

Fixes: 18996f2db9 ("ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume")
Signed-off-by: Furquan Shaikh <furquan@google.com>
Cc: 4.17+ <stable@vger.kernel.org> # 4.17+
[ rjw: Subject & changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-03-28 10:27:02 +01:00
Erik Schmauss
c163f90cc8 ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-24 21:12:01 +01:00
Erik Schmauss
ddcfd66c1d ACPICA: ACPI 6.3: add Error Disconnect Recover Notification value
ACPICA commit 205ac8fc721073f1e609df963b14ef2237aeba73

Link: https://github.com/acpica/acpica/commit/205ac8fc
Reviewed-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-24 21:11:59 +01:00
Erik Schmauss
aa6ec56b57 ACPICA: ACPI 6.3: add PCC operation region support for AML interpreter
ACPICA commit a4849944e80f97970e99843f4975850753584a4e

This change adds PCC operation region support in the AML interpreter
and a default handler for acpiexec. According to the specification,
the PCC operation region performs a transaction when the COMD field
is written. This allows ASL to write data to other fields before
sending the data.

In order to accommodate this protocol, a temorary buffer is added
to the regionfield object to accumulate writes. If any offset that
spans COMD is written, the temporary buffer is sent to the PCC
operation region handler to be processed.

This change also renames the PCC keyword to platform_comm_channel.

Link: https://github.com/acpica/acpica/commit/a4849944
Reviewed-by: Kyle Pelton <kyle.d.pelton@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-24 21:11:20 +01:00
Erik Schmauss
a3fbd67bd1 ACPICA: ACPI 6.3: Adding predefined methods _NBS, _NCH, _NIC, _NIH, and _NIG
ACPICA commit 0015e2491bda996ddb9d56bfa4ee39644acbb22b

Link: https://github.com/acpica/acpica/commit/0015e249
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-18 11:21:11 +01:00
Bob Moore
991371e0dd ACPICA: Update/clarify messages for control method failures
ACPICA commit 2efd616e5b1c960f407763e6782f7dc259ea55df

Attempting to improve error messages to clarify that errors
are bubbled up from the original error, possibly across nested
methods.

Link: https://github.com/acpica/acpica/commit/2efd616e
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-18 11:21:10 +01:00
Bob Moore
90791fbbd2 ACPICA: Debugger: Fix possible fault with the "test objects" command
ACPICA commit 349dd29335d6928f883bc95c614a0edd033141bb

 - Fault on Field Units
 - Some restructuring
 - General cleanup of dbtest module

Link: https://github.com/acpica/acpica/commit/349dd293
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-18 11:21:10 +01:00