Commit graph

5505 commits

Author SHA1 Message Date
Lv Zheng 1d65d9a7b6 ACPICA: Events: Fix an issue that region object is re-attached to another scope when it is already attached
ACPICA commit 6ebcb24d3225b6c7715a3ce061c327b4c3a6b76e

The logic in acpi_ev_attach_region() is not correct, it can break address
space handler link. This patch fixes this problem. But be aware that this
fix must be applied along with a region object race issue fix. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/6ebcb24d
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:38 +01:00
Lv Zheng 2e1beaf6a9 ACPICA: Utilities: Reorder initialization code
ACPICA commit 3894fa9d071343e6ebc7ea480255fa4f27a290be

This patch re-orders initialization code in acpi_enable_subsystem()
so that all hardware reduced stuffs can be collected together.

Note this patch contains code from the following 2 ACPICA upstream commits
so that the changes can be made clearer for the reviewers:
 https://github.com/acpica/acpica/commit/071eff73
 https://github.com/acpica/acpica/commit/3894fa9d
And additional change to remove the global variable and unused code
fragments due to the test result. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/3894fa9d
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:38 +01:00
Lv Zheng aa6abd2be1 ACPICA: Events: Uses common_notify for address space handlers
ACPICA commit 5ea0fb75fdf1aa7c0aba067dfa4d5dc3a9279461

The address space handlers can be attached to not only Device but also
Processor/thermal_zone objects, so it is better to use their common
class 'CommonNotify' instead. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/5ea0fb75
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Lv Zheng f31a99cefd ACPICA: Events: Deploys acpi_ev_find_region_handler()
ACPICA commit b916a0a0ae9e81db1a85523c63ec6aa32d5c70c8

There are code fragments that can be substituted by
acpi_ev_find_region_handler().

This patch cleans up these code fragments. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/b916a0a0
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Bob Moore 7b73806485 ACPICA: Cleanup code related to the per-table module level improvement
ACPICA commit 071eff738c59eda1792ac24b3b688b61691d7e7c

This patch collects cleanups from per-table module level improvement. By
splitting this patch from that commit, we can make per-table module level
improvement clearer for the revewers. This is a no-op change.

Link: https://github.com/acpica/acpica/commit/071eff73
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Bob Moore 3c5d3d2543 ACPICA: Update for CondRefOf and RefOf operators
ACPICA commit 725c094f1a7a2ae28e623ee77be400af1c36b180

The SuperName parameters for these operators were incorrect. This
represents two problems in the ACPI specification itself.

Link: https://github.com/acpica/acpica/commit/725c094f
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Bob Moore f70008d368 ACPICA: Update internal #defines for ObjectType operator. No functional change
ACPICA commit 5923a9be36b8cb1b62afa89fe217783c04c92ad3

To improve readability. Rename all *_TYPE_* defines related to
ObjectType to *_OBJECT_TYPE_*

Link: https://github.com/acpica/acpica/commit/5923a9be
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Bob Moore cca7a6ea0b ACPICA: Update parameter type for ObjectType operator
ACPICA commit 67953304a34944548f2fa53a4b0786a5db0ca2ea

The grammar for this operator changed in ACPI 5.0A, but it was
not necessary to update the interpreter/parser until now.

The UserTerm (method invocation) element was removed. Previously
a SuperName, the lone argument now requires a new ARGP_ type.

Link: https://github.com/acpica/acpica/commit/67953304
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Bob Moore ae90fbf562 ACPICA: Parser: Fix for SuperName method invocation
ACPICA commit 4b86d1046d06e462dae83ebcd5a66cc132a08f8f

SuperName parameters that are in fact control method invocations were
not handled correctly by the parser. This change fixes the problem
by identifying these properly as method invocations. This affects
about 14 different ASL operators that contain SuperName parameters.
ACPICA BZ 1002.

Link: https://github.com/acpica/acpica/commit/4b86d104
Link: https://bugs.acpica.org/show_bug.cgi?id=1002
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Bob Moore 89438f96f2 ACPICA: Parser: Add constants for internal namepath function
ACPICA commit b216e39fe85feee955d29fe0a7190dd811e181ea

Add true/false constants for the "PossibleMethodCall" parameter
for acpi_ps_get_next_namepath.

Link: https://github.com/acpica/acpica/commit/b216e39f
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Bob Moore 8d0b5b788f ACPICA: iasl/Disassembler: Support ASL ElseIf operator
ACPICA commit 918a840d27d620942e0ecb69de320bb71ea86c5a

ElseIf is a macro that resolves to an Else..If in the AML byte code.
This support merges an Else followed immediately by an If to an
ASL ElseIf operator. Simplifies decoded ASL, especially for large
Switch statements.

This patch only applies to iasl, and is no-op for Linux kernel.

Link: https://github.com/acpica/acpica/commit/918a840d
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:37 +01:00
Colin Ian King adeb79dd6e ACPICA: Tools: Add spacing and missing options in acpibin tool
ACPICA commit e7c8ffbbef3f7ce340e012ae4db63ea16cd09714

The -e option is missing from the acpibin help options, so add
this.  Also, there should be spaces between the filenames for the
-c and -d optios, so add this and expand the field size from 18
to 20 characters in the ACPI_OPTION macro.

Link: https://github.com/acpica/acpica/commit/e7c8ffbb
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:36 +01:00
Lv Zheng ee387409ca ACPICA: Namespace: Add String -> ObjectReference conversion support
ACPICA commit 80e60d72959bb51c5d08c8500d978607a42ed81d

BIOS developers may accidently put the quotes around the name strings,
which converts the object references in the packages indicated by the name
strings into the data objects (strings). Such kind of error has been seen
in _DEP control methods on some platforms. This patch implements a
workaround to correct it. Reported by Bastien Nocera. Fixed by Lv Zheng.

Link: https://github.com/acpica/acpica/commit/80e60d72
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=106231
Reported-and-tested-by: Bastien Nocera <bugzilla@hadess.net>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:36 +01:00
Lv Zheng 4debda539a ACPICA: Namespace: Add scope information to the simple object repair mechanism
ACPICA commit 51cbd324420ca5e381cb2c57ce95139053518a35

The acpi_object_converter callbacks are lack in scope information to
convert name_string. This patch fixes this issue by passing the evaluation
method/object node to the converter callbacks. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/51cbd324
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:36 +01:00
Bob Moore 50da9851d0 ACPICA: Update for output of the Debug Object
ACPICA commit b01414f5a822d0879aa9eba91541a21e7e501142

Improve output for the case of an Index() that refers to a
Package element that has not been initialized.

Link: https://github.com/acpica/acpica/commit/b01414f5
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:36 +01:00
Bob Moore 973da57282 ACPICA: Debug object: Fix output for a NULL object
ACPICA commit e4414f067c726ef746dac990c0bae7f433045843

Was broken by addition of "null string" feature to emit
simple blank lines.

Link: https://github.com/acpica/acpica/commit/e4414f06
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:36 +01:00
Bob Moore 5e568304a2 ACPICA: Debug Object: Cleanup output
ACPICA commit 05492c4a7d1e106eb871a5e1357ed564d25740e5

1) Make the timer value output optional
2) Allow empty lines via null string or simple newline
3) No need for the object type name for strings and integers
4) Miscellaneous cleanup of output

Link: https://github.com/acpica/acpica/commit/05492c4a
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:35 +01:00
Bob Moore 7910617efb ACPICA: Concatenate operator: Add extensions to support all ACPI objects
ACPICA commit 3420c1f5e6c6dd4fe51be4d98da69b3197d608df

Emits strings for all the object types besides int/str/buf.
This simplifies and extends the usefulness of the Printf macros.

Link: https://github.com/acpica/acpica/commit/3420c1f5
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:35 +01:00
Bob Moore 3727ec2a03 ACPICA: acpiexec/acpinames: Update for error checking macros
ACPICA commit 5bdfb4f43f4d315d23b31b39bac5a0b1ca420c2b

Standardize naming, deploy in common header.

Link: https://github.com/acpica/acpica/commit/5bdfb4f4
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:35 +01:00
Bob Moore c6c6069cad ACPICA: Add comment explaining _SUB removal
ACPICA commit 81a89968f83bfc3b1d0f0f80f2da08ea69646053

Adds a lengthy comment to acpi_get_object_info explaining the removal
of _SUB and why no complex methods can be added ever to this
interface.

Link: https://github.com/acpica/acpica/commit/81a89968
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:35 +01:00
Bob Moore 07cb390f43 ACPICA: Revert "acpi_get_object_info: Add support for ACPI 5.0 _SUB method."
ACPICA commit e4743959b59ad93eab7310adf756adc930be0ddb

This reverts commit 8e7a8753827660c3dd1f571f3185610402b756f0.

The _SUB method was found to be problematic for this interface
because some implementations use control methods. Therefore,
it is being removed.

Operations cannot be used because this interface is called
during the device discovery scan and the region handlers are
not fully installed at that time.

Link: https://github.com/acpica/acpica/commit/e4743959
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:35 +01:00
Markus Elfring 4d16ca1748 ACPICA: Debugger: Remove some unecessary NULL checks
ACPICA commit 36fcc1b98def3fb6e20cf5e877ffc3c1592d0140

Local strupr function already checks for NULL pointers.

Original linux patch submitted by:
Markus Elfring <elfring@users.sourceforge.net>

Link: https://github.com/acpica/acpica/commit/36fcc1b9
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:35 +01:00
Bob Moore 395ec73196 ACPICA: iasl/acpiexec: Update input file handling and verification
ACPICA commit 3a6f2a516dd35a4daacbc5b5144d1db763ff2cb0

Improve and cleanup verification of ACPI tables within input files.
Share more code between the disassembler and acpiexec.

This patch only affects application debugger commands, thus it is a
no-op chage for Linux kernel.

Link: https://github.com/acpica/acpica/commit/3a6f2a51
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:34 +01:00
Bob Moore 2ba7379b5a ACPICA: Disassembler/tools: Support for multiple ACPI tables in one file
ACPICA commit 5be7dc4d0d69b2953d156f5bc4d3e8a65a390837

Matches the support in iASL and acpi_exec.

Link: https://github.com/acpica/acpica/commit/5be7dc4d
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:34 +01:00
Bob Moore 675dfa0af8 ACPICA: acpiexec: Add support for AML files containing multiple tables
ACPICA commit 301f16e4037275888f65b88aec7231c1cd64339f

Add support for multi-AML-table files that originate from
either acpixtract or iASL.

Link: https://github.com/acpica/acpica/commit/301f16e4
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:34 +01:00
Bob Moore 5df2e3ed04 ACPICA: Split interpreter tracing functions to a new file
ACPICA commit a3f85a7d26a52ee0d9103feb4fbec8d7b6ba4c11

Split out functions from exdebug.c to extrace.c

Link: https://github.com/acpica/acpica/commit/a3f85a7d
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:47:34 +01:00
Bob Moore 1fad87385e ACPICA: Core: Major update for code formatting, no functional changes
ACPICA commit dfa394471f6c01b2ee9433dbc143ec70cb9bca72

Mostly indentation inconsistencies across the code. Split
some long lines, etc.

Link: https://github.com/acpica/acpica/commit/dfa39447
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:36:53 +01:00
Bob Moore cd162b35a2 ACPICA: exmutex: General cleanup, restructured some code
ACPICA commit c2a7d000b6be34313b1c50c8a718df16113f0f32

Should be no functional change.

Link: https://github.com/acpica/acpica/commit/c2a7d000
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:26:45 +01:00
LABBE Corentin c118abc554 ACPICA: Add "const" to some functions that return fixed strings
ACPICA commit 28645f8a113f346c8db103a4f7565fcba88c746f

Most of the "get_name" - style functions can return "const char *"
with no ill side-effects. Original linux patch from
LABBE Corentin <clabbe.montjoie@gmail.com> and backported to
ACPICA.

Link: https://github.com/acpica/acpica/commit/28645f8a
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:26:45 +01:00
David E. Box 33d3a2abbd ACPICA: Fix SyncLevel support interaction with method auto-serialization
ACPICA commit 253e3c03efc1a495d2aa61eee09ab1d0842a3dce

The control method auto-serialization can interfere with existing
ASL code that makes use of Mutex/Method SyncLevel support. This
change makes the auto-serialization transparent to the SyncLevel
support and management. David Box.

Link: https://github.com/acpica/acpica/commit/253e3c03
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:26:45 +01:00
Lv Zheng 0e166e4f67 ACPICA: Debugger: reduce old external path format
ACPICA commit 75c0da9e796bdf9bdd46d75f028a3e1779903214

In the error logs and debugger outputs, use new external path format that
does not contain a trailing underscore.

This patch takes care of acpi_ns_get_external_pathname() invocations, chaning
them into acpi_ns_get_normalized_pathname(TRUE) where possible. Along with some
error log fixes, the following debugger commands are fixed: resources,
handlers, paths. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/75c0da9e
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:26:45 +01:00
Lv Zheng ac9b64a046 ACPICA: Namespace: Fix wrong error log
ACPICA commit 20228e39e125d92f9d80c6e07d3767b225d0536e

The Info->Node in acpi_ns_init_one_device() may not be initialized. Even it is
initialized, the redundant "._INI" can be seen for this log entry. This
patch fixes this issue by using device_node instead. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/20228e39
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:26:44 +01:00
Prarit Bhargava a59b679ab8 ACPICA: acpi_get_sleep_type_data: Reduce warnings
ACPICA commit 7bb77313091e52a846df4c9c2bea90be31bfb9d8

Eliminate warnings for "not found" _Sx errors, since these
are optional. Original NOT_FOUND status is still returned.

Original changes by Prarit Bhargava.
ACPICA BZ 1208.

Link: https://github.com/acpica/acpica/commit/7bb77313
Link: https://bugs.acpica.org/show_bug.cgi?id=1208
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:26:44 +01:00
Lv Zheng 5431b6543f ACPICA: Linuxize: reduce divergences for 20151218 release
The patch reduces source code differences between the Linux kernel and the
ACPICA upstream so that the linuxized ACPICA 20151218 release can be
applied with reduced human intervention.

The pscode.c has already been out of sync for months, and it becomes more
and more difficult to merge pscode.c changes, so instead of update the
affected lines of pscode.c, this patch synchronizes entire pscode.c file.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-01-01 03:26:44 +01:00
Rafael J. Wysocki b17629dbf7 Merge branch 'acpi-debug' into acpica 2016-01-01 03:26:26 +01:00
Lv Zheng 59adb3988e ACPI / debugger: Fix a redundant mutex unlock issue in acpi_aml_open()
Fix a double mutex_unlock() issue where acpi_initialize_debugger() is
called with the mutex already unlocked.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-28 01:29:41 +01:00
Dan Carpenter ec74765d9f ACPI / debugger: copy_to_user doesn't return errors
The copy_to/from_user() functions don't return error codes, they return
the number of bytes remaining.  We had intended to return -EFUALT here.
We actually have already checked access_ok() in an earlier function so
I don't think these functions will fail but let's fix it anyway.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-28 01:29:41 +01:00
Dan Carpenter 436db5ce0d ACPI / debugger: remove some unneeded conditions
"count" is unsigned so checking for less than zero here causes a static
checker warning.  And really it's better to let the access_ok() check
fail if the user passes in a NULL "buf" pointer because -EFAULT is the
correct error code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-28 01:29:40 +01:00
Lv Zheng 73af2d590a ACPI / debugger: Fix an issue a flag is modified without locking
There is one line of code, executed out of locking due to rebase mistakes.
This patch fixes this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-28 01:29:40 +01:00
Srinivas Pandruvada ce360db703 ACPI / processor: Fix thermal cooling device regression
The processor cooling device is no longer present for passive thermal
control.

Commit 239708a3af ("ACPI: Split out ACPI PSS from ACPI Processor driver")
moved the processing to a new function acpi_pss_perf_init(), but
missed "return 0" after successful creation.  This causes the error
handling functions to be called, which will delete the previously
created processor cooling device.

Fixes: 239708a3af (ACPI: Split out ACPI PSS from ACPI Processor driver)
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: 4.3+ <stable@vger.kernel.org> # 4.3+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-21 03:41:49 +01:00
Lv Zheng 836d083018 ACPI / debugger: Add module support for ACPI debugger
This patch converts AML debugger into a loadable module.

Note that, it implements driver unloading at the level dependent on the
module reference count. Which means if ACPI debugger is being used by a
userspace program, "rmmod acpi_dbg" should result in failure.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-15 00:17:44 +01:00
Lv Zheng 8cfb0cdf07 ACPI / debugger: Add IO interface to access debugger functionalities
This patch adds /sys/kernel/debug/acpi/acpidbg, which can be used by
userspace programs to access ACPICA debugger functionalities.

Known issue:
1. IO flush support
   acpi_os_notify_command_complete() and acpi_os_wait_command_ready() can
   be used by acpi_dbg module to implement .flush() filesystem operation.
   While this patch doesn't go that far. It then becomes userspace tool's
   duty now to flush old commands before executing new batch mode commands.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-15 00:17:44 +01:00
Lv Zheng 8a2a2501a8 ACPICA: Debugger: Fix runtime stub issues of ACPI_DEBUGGER_EXEC using different stub mechanism
ACPICA commit 11522d6b894054fc4d62dd4f9863ec151296b386

The ACPI_DEBUGGER_EXEC is a problem now when the debugger code is compiled
but runtime disabled. They actually will get executed in this situation.
Although such executions are harmless if we can correctly make
acpi_db_single_step() a runtime stub, users may still do not want to see the
debugger print messages logged into OSPMs' kernel logs when a debugger
driver is not loaded to enable the debugger during runtime.

This patch fixes this issue by introducing new stub mechanism instead of
ACPI_DEBUGGER_EXEC. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/11522d6b
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-15 00:17:44 +01:00
Lv Zheng f8d3148962 ACPICA: Debugger: Convert some mechanisms to OSPM specific
The following mechanisms are OSPM specific:
1. Redirect output destination to console: no file redirection will be
   needed by an in-kernel debugger, there is even no file can be accessed
   when the debugger is running in the kernel mode.
2. Output command prompts: programs other than acpiexec can have different
   prompt characters and the prompt characters may be implemented as a
   special character sequence to form a char device IO protocol.
3. Command ready/complete handshake: OSPM debugger may wait more conditions
   to implement OSPM specific semantics (for example, FIFO full/empty
   conditions for O_NONBLOCK or IO open/close conditions).
Leaving such OSPM specific stuffs in the ACPICA debugger core blocks
Linux debugger IO driver implementation.

Several new OSL APIs are provided by this patch:
1. acpi_os_initialize_command_signals: initialize command handshake mechanism
   or any other OSPM specific stuffs.
2. acpi_os_terminate_command_signals: reversal of
   acpi_os_initialize_command_signals.
3. acpi_os_wait_command_ready: putting debugger task into wait state when a
   command is not ready. OSPMs can terminate command loop by returning
   AE_CTRL_TERMINATE from this API. Normally, wait_event() or
   wait_for_multiple_object() may be used to implement this API.
4. acpi_os_notify_command_complete: putting user task into running state when a
   command has been completed. OSPMs can terminate command loop by
   returning AE_CTRL_TERMINATE from this API. Normally, wake_up() or
   set_event() may be used to implement this API.
This patch also converts current command signaling implementation into a
generic debugger layer (osgendbg.c) to be used by the existing OSPMs or
acpiexec, in return, Linux can have chance to implement its own command
handshake mechanism. This patch also implements acpiexec batch mode in a
multi-threading mode comaptible style as a demo (this can be confirmed by
configuring acpiexec into DEBUGGER_MULTI_THREADED mode where the batch mode
is still working). Lv Zheng.

Note that the OSPM specific command handshake mechanism is required by
Linux kernel because:
1. Linux kernel trends to use wait queue to synchronize two threads, using
   mutexes to achieve that will cause false "dead lock" warnings.
2. The command handshake mechanism implemented by ACPICA is implemented in
   this way because of a design issue in debugger IO streaming. Debugger IO
   outputs are simply cached using a giant buffer, this should be tuned by
   Linux in the future.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-15 00:17:43 +01:00
Colin Ian King 96889231fb ACPICA: Debugger: Remove unnecessary status check
ACPICA commit f9d5c6c9a25e9f5ac05458bfcd8b381e21bb2ba5

ACPICA BZ 1205. Colin Ian King.

Link: https://bugs.acpica.org/show_bug.cgi?id=1205
Link: https://github.com/acpica/acpica/commit/f9d5c6c9
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-15 00:17:43 +01:00
Alexey Khoroshilov d91e892825 nfit: acpi_nfit_notify(): Do not leave device locked
Even if dev->driver is null because we are being removed,
it is safer to not leave device locked.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2015-12-11 14:24:26 -08:00
Linus Torvalds fb39cbda14 Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams:

 - NFIT parsing regression fixes from Linda.  The nvdimm hot-add
   implementation merged in 4.4-rc1 interpreted the specification in a
   way that breaks actual HPE platforms.  We are also closing the loop
   with the ACPI Working Group to get this clarification added to the
   spec.

 - Andy pointed out that his laptop without nvdimm resources is loading
   the e820-nvdimm module by default, fix that up to only load the
   module when an e820-type-12 range is present.

* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  nfit: Adjust for different _FIT and NFIT headers
  nfit: Fix the check for a successful NFIT merge
  nfit: Account for table size length variation
  libnvdimm, e820: skip module loading when no type-12
2015-12-04 11:30:45 -08:00
Rafael J. Wysocki 3e5050e60e Merge branches 'acpica', 'acpi-video' and 'device-properties'
* acpica:
  ACPI: Better describe ACPI_DEBUGGER

* acpi-video:
  MAINTAINERS: ACPI / video: update a file name in drivers/acpi/

* device-properties:
  ACPI / property: fix compile error for acpi_node_get_property_reference() when CONFIG_ACPI=n
2015-12-04 14:01:17 +01:00
Rafael J. Wysocki c09c9dd2e9 Merge branches 'acpi-pci' and 'pm-pci'
* acpi-pci:
  x86/PCI/ACPI: Fix regression caused by commit 4d6b4e69a2

* pm-pci:
  PCI / PM: Tune down retryable runtime suspend error messages
2015-12-04 14:01:02 +01:00
Liu Jiang 727ae8be30 x86/PCI/ACPI: Fix regression caused by commit 4d6b4e69a2
Commit 4d6b4e69a2 ("x86/PCI/ACPI: Use common interface to support
PCI host bridge") converted x86 to use the common interface
acpi_pci_root_create, but the conversion missed on code piece in
arch/x86/pci/bus_numa.c, which causes regression on some legacy
AMD platforms as reported by Arthur Marsh <arthur.marsh@internode.on.net>.
The root causes is that acpi_pci_root_create() fails to insert
host bridge resources into iomem_resource/ioport_resource because
x86_pci_root_bus_resources() has already inserted those resources.
So change x86_pci_root_bus_resources() to not insert resources into
iomem_resource/ioport_resource.

Fixes: 4d6b4e69a2 ("x86/PCI/ACPI: Use common interface to support PCI host bridge")
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Reported-and-tested-by: Arthur Marsh <arthur.marsh@internode.on.net>
Reported-and-tested-by: Krzysztof Kolasa <kkolasa@winsoft.pl>
Reported-and-tested-by: Keith Busch <keith.busch@intel.com>
Reported-and-tested-by: Hans de Bruin <jmdebruin@xmsnet.nl>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-02 02:30:15 +01:00