Commit graph

800 commits

Author SHA1 Message Date
Bob Moore cd64bbf8ce ACPICA: Debugger: Update mutexes used for multithreaded debugger
ACPICA commit 6b2701f619040e803313363f516b200e362a9100

Make these mutex objects independent of the deadlock detection mechanism.
This mechanism caused failures with the multithread debugger.

This patch doesn't affect Linux kernel as debugger is currently not fully
functioning in the Linux kernel. And the further debugger cleanups will
take care of handling debugger command signalling correctly instead of
using such kind of mutexes. So it is safe to leave this patch as it is.

Link: https://github.com/acpica/acpica/commit/6b2701f6
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-10-22 02:01:12 +02:00
Bob Moore 92dc96196e ACPICA: Update exception code for "file not found" error
ACPICA commit ac1564c26d239348ef13455f61d5616f3961ff43

Used by the ACPICA applications.

This patch is a bit broken due to non-portable <errno.h> inclusion as on
some platforms, there is no such a header file for their lib-c exports.
Fortunately, Linux doesn't compile utfileio.c for either the kernel
space ACPICA core (drivers/acpi/acpica) or the userspace ACPICA tools
(tools/power/acpi) for now, so it's safe to leave this patch as it is.

Link: https://github.com/acpica/acpica/commit/ac1564c2
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-10-22 02:01:12 +02:00
Bob Moore 69058ddf28 ACPICA: iASL: Add symbolic operator support for Index() operator
ACPICA commit fbe67c46830f10c839941f8512cac5bddcb86bd3

Index (XXXX, 2) is now supported by XXXX [2]

This patch doesn't affect Linux kernel.

Link: https://github.com/acpica/acpica/commit/fbe67c46
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-10-22 02:01:12 +02:00
Bob Moore 93556118c0 ACPICA: Remove unnecessary conditional compilation
ACPICA commit eea1f0e561893b6d6417913b2d224082fe3a0a5e

Remove use of ACPI_DEBUGGER and ACPI_DISASSEMBLER where these
defines are used around entire modules.

Note: This type of code also causes problems with IDEs.

Link: https://github.com/acpica/acpica/commit/eea1f0e5
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-10-22 02:01:11 +02:00
Lv Zheng 62fcce9104 ACPICA: Tables: Fix FADT dependency regression
Some logics actually relying on the existence of FADT, currently relies on
the number of loaded tables. This false dependency can easily trigger
regressions. One of them has been introduced by commit 8ec3f45907
(ACPICA: Tables: Fix global table list issues by removing fixed table).

The commit changing the fixed table indexes results in the change of FADT
table index, originally, it was 3 (thus the installed table count should be
greater than 4), while currently it is 0 (and the installed table count may
be 3).

This patch fixes this regression by cleaning up the code. Lv Zheng.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=105351
Fixes: 8ec3f45907 (ACPICA: Tables: Fix global table list issues by removing fixed table)
Reported-and-tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-10-14 22:48:13 +02:00
Lv Zheng 2e5321cb62 ACPICA: Debugger: Cleanup debugging outputs to dump name path without trailing underscores
ACPICA commit 51a49c2fb4a73f302a6df2b8ddc1350dd261684d

It is better to use unified ASL path name to interact with the developers.

There are following acpi_ns_build_normalized_pathname() users invoking it for
debugging purposes (acpiexec test results are attached):

 1. acpi_ut_display_init_pathname (acpi_ns_handle_to_pathname):
     ---------------------------------------------
      Initializing Region        \_SB.H_EC.ECF2
     ---------------------------------------------
 2. acpi_ns_print_node_pathname (acpi_ns_handle_to_pathname):
     ---------------------------------------------
     - ex \_SB.H_EC._STA
     Evaluating \_SB.H_EC._STA
     ---------------------------------------------
 3. acpi_ds_print_node_pathname (acpi_ns_handle_to_pathname):
     ---------------------------------------------
     - level 211b console
     - execute \M1
     ...
     **** Exception AE_AML_UNINITIALIZED_ARG during execution of method [\M1] (Node 009CB6B8)
     ---------------------------------------------
 4. acpi_ex_dump_reference_obj (acpi_ns_handle_to_pathname):
     ---------------------------------------------
     - dump \_TZ.FAN4._PR0
     ...
     [00] 00835E98 [Object Reference] Type [Named Object] 05 00828878 \_TZ.FN04
     ---------------------------------------------
 5. acpi_db_bus_walk (acpi_ns_handle_to_pathname):
     ---------------------------------------------
     - businfo
     \_SB.PCI0                        Type 6
     ...
     ---------------------------------------------
 6. acpi_db_walk_and_match_name (acpi_ns_handle_to_pathname):
     ---------------------------------------------
     - find _PR0
                       \_TZ.FAN4._PR0 Package      002D8DF8 01 Elements 01
     ---------------------------------------------
 7. acpi_db_walk_for_specific_objects (acpi_ns_handle_to_pathname):
     ---------------------------------------------
     - methods
     ...
                       \_SB.PCI0._PRT Method       0026D918 01 Args 0 Len 0005 Aml 0026B199
     ...
     ---------------------------------------------
 8. acpi_db_decode_and_dispaly_object (acpi_get_name):
     ---------------------------------------------
     - gpes
     Block 0 - Info 003AC7B0  device_node 003A0E08 [\_GPE] - FADT-defined GPE block
     ...
     ---------------------------------------------
 9. acpi_db_display_gpes (acpi_get_name):
     ---------------------------------------------
     - dump \_GPE
     Object (003A0E08) Pathname:  \_GPE
     ---------------------------------------------
 10.ae_miscellaneous_tests (acpi_get_name):
     No output available

This patch cleans up all of the above usages. ACPICA BZ 1178, Lv Zheng.

Linux kernel's ACPICA debugging messages may also be changed.

Link: https://github.com/acpica/acpica/commit/51a49c2f
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>
2015-08-25 23:11:33 +02:00
Lv Zheng a2352db584 ACPICA: Disassembler: Cleanup acpi_gbl_db_opt_verbose acpiexec usage
ACPICA commit 42d7ad7bfb1cfb95183c1386c77509f2036f521d

When acpi_gbl_db_opt_verbose is used in acpi_dm_descending_op() (invoked by
acpi_dm_disassemble()), it is actually exported by the disassembler but used
by the debugger to distinguish the output of the disassembler for different
debugger commands. It is by default TRUE but is set to FALSE for control
method disassembly command - "disassemble". So it's initialization should
be a part of the ACPI_DISASSEMBLER conditioned code. This patch uses
ACPI_INIT_GLOBAL to achieve a clean manner so that when ACPI_DISASSEMBLER
is not defined, ACPI_DEBUGGER conditioned code needn't link to this option.
Since it is a disassembler exported variable, it is renamed to
acpi_gbl_dm_opt_Verbose in this patch.

As VERBOSE_PRINT() macro has only one user, this patch also removes the
definition of this macro. Lv Zheng.

This patch doesn't affect Linux kernel.

Link: https://github.com/acpica/acpica/commit/42d7ad7b
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>
2015-08-25 23:11:33 +02:00
Lv Zheng 1bdc63bf05 ACPICA: Disassembler: Cleanup acpi_gbl_db_opt_disasm
ACPICA commit 969989cf7f85e2a2a0cd048cd25fc706246a48a2

This patch cleans up the following global variable - acpi_gbl_db_opt_disasm:
The setting is used to control the full disassembly feature for iasl. ACPI
debugger (acpiexec) shall have nothing to do with it. Actually, acpiexec
never links to ad_aml_disassemble().

This patch thus renames this global option to acpi_gbl_dm_opt_disasm and
removes all acpiexec and debugger references on it. Lv Zheng.

This patch doesn't affect Linux kernel.

Link: https://github.com/acpica/acpica/commit/969989cf
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>
2015-08-25 23:11:33 +02:00
Lv Zheng f8fb4c383e ACPICA: Debugger: Split debugger initialization/termination APIs
ACPICA commit 7a3f22baab000b186779dac64ad71d9776b8f432

It is likely that the debugger is enabled only when a userspace program
explicitly tells a kernel to do so, so it shouldn't be initialized as
early as current implementation.

The only tool requiring ACPI_DEBUGGER is acpiexec, so acpiexec need to call
the new APIs by itself. And BSD developers may also get notified to invoke
the APIs for DDB enabling. Lv Zheng.

This patch doesn't affect Linux kernel as debugger is currently not enabled
in the Linux kernel.

Link: https://github.com/acpica/acpica/commit/7a3f22ba
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>
2015-08-25 23:11:33 +02:00
Bob Moore 47cdf8c692 ACPICA: Make the max-number-of-loops runtime configurable
ACPICA commit a9d9c2d0c2d077bb3175ec9c252cf0e5da3efd45

Was previously compile-time only.
Add support option for acpiexec.

Link: https://github.com/acpica/acpica/commit/a9d9c2d0
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-08-25 23:11:32 +02:00
Bob Moore e69ab9a99e ACPICA: Debugger: Add option to display namespace summary/counts
ACPICA commit bba222c15c2ce79076eb3a5e9d4d5f7120db8a00

If "Objects" command is invoked with no arguments, the counts
for each object type are displayed.

Linux kernel is not affected by this commit as currently debugger is
not enabled in the Linux kernel.

Link: https://github.com/acpica/acpica/commit/bba222c1
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-08-25 23:11:32 +02:00
Bob Moore 25823e784a ACPICA: Add additional debug info/statements
ACPICA commit 74094ca9f51e2652a9b5f01722d8640a653cc75a

For _REG methods and module-level code blocks.
For acpiexec, add deletion of module-level blocks in case
of an early abort.

Link: https://github.com/acpica/acpica/commit/74094ca9
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-08-25 23:11:32 +02:00
Bob Moore 3c0503dd28 ACPICA: Table handling: Cleanup and update debug output for tools
ACPICA commit 93862bd7a227543bc617d822ef5c4f8a5d68b519

Add output of table OEM ID along with signature to support lots
of SSDTs.

Cleanup use of table pointers.

Link: https://github.com/acpica/acpica/commit/93862bd7
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-08-25 23:11:32 +02:00
Bob Moore 93cdafa071 ACPICA: acpiexec/acpinames: Support very large number of ACPI tables
ACPICA commit ca3bd4c5cdc39a9009280032adbbc20f34e94c47

Fix a couple of issues with >40 ACPI tables.
Return exit error for acpinames to enable use with BIOS builds.

The new exported function is used by acpinames. For Linux kernel, this
change is a no-op.

Link: https://github.com/acpica/acpica/commit/ca3bd4c5
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-08-25 23:11:31 +02:00
Bob Moore 17dd4dcfad ACPICA: acpinames: Add new options and wildcard support
ACPICA commit 0ecf5b5a41c3d2e09af48f0fdbc9ae784f631788

 - Add wilcard support for input filenames.
 - Add -l option to load tables and exit, no display. This is
   useful for validation of the namespace during BIOS generation.
 - Add -x option for specifying debug level.

Linux kernel is not affected by this commit.

Link: https://github.com/acpica/acpica/commit/0ecf5b5a
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-08-25 23:11:31 +02:00
Lv Zheng 7484619bff ACPICA: Tables: Cleanup to reduce FACS globals
ACPICA commit 3f42ba76e2a0453976d3108296d5f656fdf2bd6e

In this patch, FACS table mapping is also tuned a bit so that only the
selected FACS table will be mapped by the OSPM (mapped on demand) and the
FACS related global variables can be reduced. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/3f42ba76
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>
2015-08-25 23:11:31 +02:00
Lv Zheng 8ec3f45907 ACPICA: Tables: Fix global table list issues by removing fixed table indexes
ACPICA commit c0b38b4c3982c2336ee92a2a14716107248bd941

The fixed table indexes leave holes in the global table list:
 1. One hole can be seen when there is only 1 FACS provided by the BIOS.
 2. Tow holes can be seen when it is a reduced hardware platform.
The holes do not break OSPMs but have broken ACPI debugger "tables"
command.

Also the "fixed table indexes" mechanism may make the descriptors of the
standard tables installed earlier than DSDT to be overwritten by the
descriptors of the fixed tables. For example, FACP disappears from the
global table list after DSDT is installed.

This patch fixes all above issues by removing the "fixed table indexes"
mechanism which is too complicated to be maintained in a regression safe
manner. After removal, the table loader will determine the indexes of the
fixed tables. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/c0b38b4c
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>
2015-08-25 23:11:31 +02:00
Bob Moore 92b21a9502 ACPICA: Update info messages during ACPICA init
ACPICA commit 4ccf8a1cc499ec8f00345f662a5887483980e1dd

Small cleanup of messages.

Link: https://github.com/acpica/acpica/commit/4ccf8a1c
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-08-25 23:11:31 +02:00
Bob Moore 2aabfad7c6 ACPICA: Disassembler: Update for new listing mode
ACPICA commit 2ed09bb7619d25f5a5c065c33a8a775a6db3a856
ACPICA commit 2fefacf73825b0ec96bbfc4f70a256735b715d6c

This mode emits AML code along with the ASL code.
A new global was needed to ensure the listing mode is
completely separate from the debugger verbose mode.

Emits the correct AML offset for the AML code.
The -l option now works for both the compiler and disassembler.

Linux kernel is not affected by this commit.

Link: https://github.com/acpica/acpica/commit/2fefacf7
Link: https://github.com/acpica/acpica/commit/2ed09bb7
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-08-25 23:11:31 +02:00
Bob Moore 9f41fd8a17 ACPICA: Update parameter validation for data_table_region and load_table
ACPICA commit 51ab555e60b4a3de3cc4a846e86d0de255be441a

Add additional validation for the table signature and
the OEM strings. Eliminates buffer read overrun in data_table_region.
ACPICA BZ 1184.

Link: https://bugs.acpica.org/show_bug.cgi?id=1184
Link: https://github.com/acpica/acpica/commit/51ab555e
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-08-25 23:11:31 +02:00
Bob Moore 3534969721 ACPICA: Disassembler: Remove duplicate code in _PLD processing.
ACPICA commit 6d9c827b540837b6e54059e17756a06985e4a196

ACPICA BZ 1176.

Link: https://bugs.acpica.org/show_bug.cgi?id=1176
Link: https://github.com/acpica/acpica/commit/6d9c827b
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-08-25 23:11:30 +02:00
Bob Moore 4712f71b60 ACPICA: Correctly cleanup after a ACPI table load failure
ACPICA commit ed7769e832de6c7ba90615480d916c85fd100422

If a table load fails, delete all namespace objects created by the
table, otherwise these objects will be uninitialized, causing
problems later. This appears to be a very rare problem.
Also handle the unitialized node problem to prevent possible
faults. ACPICA BZ 1185.

Link: https://github.com/acpica/acpica/commit/ed7769e8
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-08-25 23:11:30 +02:00
Bob Moore 6d9be0a5c4 ACPICA: iASL/Disassembler: Add prototype verbose mode
ACPICA commit add72dca18ab5d02f1bf9b08027570e58da520e8

This mode will emit AML byte code after each ASL statement.
This is a prototype only and requires additional development.

This patch only affects ACPICA disassembler which is not in the kernel
source tree.

Link: https://github.com/acpica/acpica/commit/add72dca
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-07-23 23:09:08 +02:00
Lv Zheng fdd8d831cf ACPICA: Debugger: Move debugger specific APIs to debugger component
ACPICA commit 2164923d60429eea7cd5a4a8629b607af7325afa

Some disassembler APIs should rather be debugger APIs. This patch moves
them to the debugger folder to be ready for debugger porting.

Since there is no in-kernel ACPICA debugger in the kernel source tree, this
patch doesn't affect the Linux kernel.

Link: https://github.com/acpica/acpica/commit/2164923d
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>
2015-07-23 23:09:08 +02:00
Lv Zheng 02ca26bef8 ACPICA: Debugger: Reduce structure size for debugger
ACPICA commit 310e0ae1c4730f4dadc80125125099ab76851499

arg_types in struct acpi_db_method_info is only referenced by ACPI_DEBUGGER.

This patch only affects ACPICA debugger which is only used by a non-kernel
tool - acpiexec, so Linux kernel is currently not affected by this patch.

Link: https://github.com/acpica/acpica/commit/310e0ae1
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>
2015-07-23 23:09:08 +02:00
Bob Moore 88606a2b90 ACPICA: Cleanup use of NEGATIVE and POSITIVE defines
ACPICA commit f88814201e01043a4f8caa69a69b799af11c44a3

These were defined in two places. Changed to ACPI_SIGN* names
and define them once in acmacros.h

This patch doesn't affect Linux kernel.

Link: https://github.com/acpica/acpica/commit/f8881420
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-07-23 23:09:08 +02:00
Bob Moore 276291962e ACPICA: Cleanup use of all non-ANSI local C library functions
ACPICA commit 7c490c28a18b435c543c6b410e7e7c2131fccc78

ACPICA implements all non-ANSI functions locally. However, there
are sometimes two or more versions of the same function throughout
the ACPICA code. This change fixes this.

Adds a new file, utilities/utnonansi.c

Link: https://github.com/acpica/acpica/commit/7c490c28
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-07-23 23:09:08 +02:00
Bob Moore 53d9edce56 ACPICA: iASL: Add new warnings for method local_x and arg_x variables
ACPICA commit eb9f8cb9fd65f1149dd335d05944c31cbca41af3

1) Warn if a Local is set but never used
2) Warn if a arg_x is never used (for non-predefined method names)
3) Warn if a arg_x that is used as a local is never used

This patch only affects iASL which is not in the kernel source tree.

Link: https://github.com/acpica/acpica/commit/eb9f8cb9
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-07-23 23:09:08 +02:00
Markus Elfring dc67d0fa86 ACPICA: Remove extraneous check for null walk_state
ACPICA commit f9fd6e8bad0f16ce2b436c5cda36ced0c2d85302

Reported by Markus Elfring.

Link: https://github.com/acpica/acpica/commit/f9fd6e8b
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>
2015-07-23 23:09:08 +02:00
Lv Zheng ec4252a66b ACPICA: Parser: Remove redundant opcode execution debugging output
ACPICA commit c832b0a9263c560b3ae3ae31d7298ef33988f8d5

This patch removes one redundant debugging output of opcode execution which
has already been covered by acpi_ex_start_trace_opcode(). Lv Zheng.

Link: https://github.com/acpica/acpica/commit/c832b0a9
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>
2015-07-23 23:09:07 +02:00
Lv Zheng fb18e8fd08 ACPICA: Executer: Add option to bypass opcode tracing
ACPICA commit 61e9e20aadfaa03184d0959fbdc1fa5cdfea2551

This patch adds option to bypass opcode tracing. The option can be used to
reduce the trace message output. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/61e9e20a
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>
2015-07-23 23:09:07 +02:00
Lv Zheng bab0482418 ACPICA: Executer: Add OSL trace hook support
ACPICA commit e8e4a9b19d0b72a7b165398bdc961fc2f6f502ec

This patch adds OSL trace hook support.

OSPMs are encouraged to use acpi_os_trace_point() with
ACPI_USE_SYSTEM_TRACER defined to implement platform specific trace
facility. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/e8e4a9b1
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>
2015-07-23 23:09:07 +02:00
Lv Zheng ab6c573320 ACPICA: Executer: Add interpreter tracing mode for method tracing facility
ACPICA commit 07fffd02607685b655ed92ee15c160e6a810b60b

The acpi_debug_trace() is the mechanism known as ACPI method tracing that is
used by Linux as ACPICA debugging message reducer. This facility can be
controlled through Linux ACPI subsystem - /sys/module/acpi/parameters.
This facility requires CONFIG_ACPI_DEBUG to be enabled to see ACPICA trace
logs in the kernel dmesg output.

This patch enhances acpi_debug_trace() to make it not only a message reducer,
but a real tracer to trace AML interpreter execution. Note that in addition
to the AML tracer enabling, this patch also updates the facility with the
following enhancements:
1. Allow a full path to be specified by the acpi_debug_trace() API.
2. Allow any method rather than just the entrance of acpi_evaluate_object()
   to be traced.
3. All interpreter ACPI_LV_TRACE_POINT messages are collected for
   ACPI_EXECUTER layer.

The Makefile of drivers/acpi/acpica is also updated to include exdebug.o
and the duplicated stubs are removed after that.

Note that since this patch has enhanced the method tracing facility, Linux
need also be updated after applying this patch. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/07fffd02
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>
2015-07-23 23:09:07 +02:00
Lv Zheng a616dc2fe5 ACPICA: Dispatcher: Add trace support for interpreter
ACPICA commit 71299ec8b49054daace0df50268e8e055654ca37

This patch adds trace point at the following point:
 1. Begin/end of a control method execution;
 2. Begin/end of an opcode execution.

The trace point feature can be enabled by defining ACPI_DEBUG_OUTPUT
and specifying a debug level that includes ACPI_LV_TRACDE_POINT and the
debug layers that include ACPI_PARSER and ACPI_DISPACTCHER.

In order to make aml_op_name of union acpi_parse_object usable for tracer, it is
enabled for ACPI_DEBUG_OUTPUT in this patch. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/71299ec8
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>
2015-07-23 23:09:07 +02:00
Lv Zheng 0bac429552 ACPICA: Dispatcher: Move stack traversal code to dispatcher
ACPICA commit c8275e243b58fd4adfc0362bd704af41ed14bc75

This patch moves parts of acpi_dm_dump_method_info() to the dispatcher
component.

This patch also makes the new function dependent on ACPI_DEBUG_OUTPUT
compile-stage definition so that it can be used by the trace facility.

acpi_dm_dump_method_info() traverses method stack when an exception is
encountered. Such traversal is needed to support method tracing for the
exceptions. When an exception is encountered, the end indications of the
aborted methods should be logged in order not to break the user space
analysis tool. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/c8275e24
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>
2015-07-23 23:09:06 +02:00
Lv Zheng d1e7ffe50b ACPICA: Namespace: Add function to directly return normalized full path
ACPICA commit 6e0229bb156d71675f2e07dc7960adb7ec0a60ea

This patch adds functions to return normalized full path instead of
"external path". The external path contains trailing "_" for each
name segment while the normalized full path doesn't contain the
trailing "_".

Currently this function is used by the method tracing users to specify a
none trailing "_" attached name path. Lv Zheng.

Note that we need to validate and switch all Linux kernel acpi_get_name()
users to use the new name type before removing the old name type from
ACPICA.

Link: https://github.com/acpica/acpica/commit/6e0229bb
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Reviewed-by: Ruiyi Zhang <ruiyi_zhang@hotmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-07-23 23:09:06 +02:00
Lv Zheng 07b9c91225 ACPICA: Executer: Add back pointing reference of method operand
ACPICA commit 9dcd124e914e87495fbd1786d9484b962e0823e0

This patch adds back pointing reference of the namespace node for a method
operand. The namespace node then can be used in
acpi_ds_terminate_control_method() to obtain method full path to be used by
tracing facilities. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/9dcd124e
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>
2015-07-23 23:09:06 +02:00
Lv Zheng 62eb935b77 ACPICA: Dispatcher: Cleanup union acpi_operand_object's AML address assignments
ACPICA commit afb52611dbe7403551f93504d3798534f5c343f4

This patch cleans up the code of assigning the AML address to the
union acpi_operand_object.

The idea behind this cleanup is:
The AML address of the union acpi_operand_object should always be determined at
the point where the object is encountered. It should be started from the
first byte of the object. For example, the opcode of the object, the name
string of the user_term object, or the first byte of the packaged object
(where a pkg_length is prefixed). So it's not cleaner to have it assigned
here and there in the entire ACPICA source tree.

There are some special cases for the internal opcodes, before cleaning up
the internal opcodes, we should also determine the rules for the AML
addresses of the internal opcodes:
1. INT_NAMEPATH_OP: the address of the first byte for the name_string.
2. INT_METHODCALL_OP: the address of the first byte for the name_string.
3. INT_BYTELIST_OP: the address of the first byte for the byte_data list.
4. INT_EVAL_SUBTREE_OP: the address of the first byte for the
                        Region/Package/Buffer/bank_field/Field arguments.
5. INT_NAMEDFIELD_OP: the address to the name_seg.
6. INT_RESERVEDFIELD_OP: the address to the 0x00 prefix.
7. INT_ACCESSFIELD_OP: the address to the 0x01 prefix.
8. INT_CONNECTION_OP: the address to the 0x02 prefix.
9: INT_EXTACCESSFIELD_OP: the address to the 0x03 prefix.
10.INT_RETURN_VALUE_OP: the address of the replaced operand.
11.computational_data: the address to the
                      Byte/Word/Dword/Qword/string_prefix.

Before cleaning up the internal root scope of the aml_walk, turning it into
the term_list, we need to remember the aml_start address as the "Aml"
attribute for the union acpi_operand_object created by acpi_ps_create_scope_op().

Finally, we can delete some redundant AML address assignment in psloop.c.

Link: https://github.com/acpica/acpica/commit/afb52611
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>
2015-07-23 23:09:06 +02:00
Lv Zheng 950a429cd2 ACPICA: Parser: Cleanup aml_offset in union acpi_operand_object
ACPICA commit 61b360074fde2bb8282722579410f5d1fb12f84d

This patch converts aml_offset in union acpi_operand_object to AML address.

AML offset is actually only used by the debugger, using AML address is more
direct and efficient during the parsing stage so that we don't need to
calculate the offset during the parsing stage and will not have
difficulities in converting it into other offset attributes.

Sometimes, aml_offset is not an indication of the offset from the table
header but the offset from the entry of a list of terms, which requires
additional efforts to convert it into an offset from the table header. By
using AML address directly, there is no such difficulty.
Thus this patch also deletes a logic in disassembler that is trying to
convert the aml_offset from
  "offset from the start address of Method/Package/Buffer"
into the
  "offset from the start address of the ACPI table"
(Sample code deletion can be seen in acpi_dm_deferred_parse(), but the
function is not in the Linux kernel). Lv Zheng.

Link: https://github.com/acpica/acpica/commit/61b36007
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>
2015-07-23 23:09:06 +02:00
Lv Zheng 83482f758b ACPICA: Parser: Cleanup aml_offset in struct acpi_walk_state
ACPICA commit d254405814495058276c0c2f9d96794d15a6c91c

This patch converts aml_offset in struct acpi_walk_state to AML address.

AML offset is actually only used by the debugger, using AML address is more
direct and efficient during the parsing stage so that we don't need to
calculate it during the parsing stage.

On the other hand, we can see several issues in the current parser logic
around the aml_offset:
1. union acpi_operand_object.Common.aml_offset is redundantly assigned in
   acpi_ps_parse_loop().
2. aml_offset is not an indication of the offset from the table header but
   the offset from the entry of a list of objects. Sometimes, it indicates
   an entry for a Method/Package/Buffer, which makes it difficult to be
   reversely calculated to a table header offset.
3. When being used with method tracers (for example, Linux function trace),
   it's better to have AML address logged instead of the AML offset because
   the address is the only attribute that can uniquely identify the opcode.
This patch is required to solve the above issues. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/d2544058
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>
2015-07-23 23:09:06 +02:00
Lv Zheng eb87a05223 ACPICA: Parser: Reduce parser/namespace divergences for tracer support
This patch reduces divergences in parser/namespace components so that the
follow-up linuxized ACPICA upstream commits can be directly merged.
Including the fix to an indent issue reported and fixed by Zhouyi Zhou.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-07-23 23:09:05 +02:00
Rafael J. Wysocki ea7d521569 Revert 'Revert "ACPICA: Permanently set _REV to the value '2'."'
Revert commit ff284f37fc (Revert "ACPICA: Permanently set _REV to
the value '2'.) as the regression introduced by commit b1ef297258
reverted by it is now addressed via a blacklist entry.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-07-03 01:06:04 +02:00
gongzg 3d2967b5b5 ACPICA: Comment update, no functional change
ACPICA commit 1a8ec7b83d55c7b957247d685bd1c73f6a012f1e

Remove redundant comment in nseval.c

Link: https://github.com/acpica/acpica/commit/1a8ec7b8
Signed-off-by: gongzg <gongzhaogang@inspur.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-07-01 23:17:56 +02:00
Bob Moore 747ef1b1ce ACPICA: Split C library prototypes to new header
ACPICA commit f51bf8497889a94046820639537165bbd7ccdee6

Adds acclib.h

This patch doesn't affect the Linux kernel.

Link: https://github.com/acpica/acpica/commit/f51bf849
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-07-01 23:17:56 +02:00
Bob Moore 4fa4616e27 ACPICA: De-macroize calls to standard C library functions
ACPICA commit 3b1026e0bdd3c32eb6d5d313f3ba0b1fee7597b4
ACPICA commit 00f0dc83f5cfca53b27a3213ae0d7719b88c2d6b
ACPICA commit 47d22a738d0e19fd241ffe4e3e9d4e198e4afc69

Across all of ACPICA. Replace C library macros such as ACPI_STRLEN with the
standard names such as strlen. The original purpose for these macros is
long since obsolete.
Also cast various invocations as necessary. Bob Moore, Jung-uk Kim, Lv Zheng.

Link: https://github.com/acpica/acpica/commit/3b1026e0
Link: https://github.com/acpica/acpica/commit/00f0dc83
Link: https://github.com/acpica/acpica/commit/47d22a73
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-07-01 23:17:55 +02:00
Bob Moore fde175e385 ACPICA: Cleanup output for the ASL Debug object
ACPICA commit d4a53a396fe5d384425251b0257f8d125bbed617

Especially for use of the Index operator. For buffers and strings,
only output the actual byte pointed to by the index. For packages,
only print the package element decoded by the index.

Link: https://github.com/acpica/acpica/commit/d4a53a39
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-07-01 23:17:55 +02:00
Zhang Rui dc00203b6c ACPICA: Update for acpi_install_table memory types
ACPICA commit 3f78b7fb3f98f35d62f532c1891deb748ad196c9

Physical/virtual address flags were reversed.

Link: https://github.com/acpica/acpica/commit/3f78b7fb
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
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>
2015-07-01 23:17:54 +02:00
Bob Moore 8ea9865577 ACPICA: Namespace: Change namespace override to avoid node deletion
ACPICA commit c0ce529e1fbb8ec47d2522a3aa10f3ab77e16e41

There is no reference counting implemented for struct acpi_namespace_node, so it
is currently not removable during runtime.
This patch changes the namespace override code to keep the old
struct acpi_namespace_node undeleted so that the override mechanism can happen
during runtime. Bob Moore.

Link: https://github.com/acpica/acpica/commit/c0ce529e
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>
2015-07-01 23:17:54 +02:00
Bob Moore fe536995f2 ACPICA: Namespace: Add support of OSDT table
ACPICA commit 27415c82fcecf467446f66d1007a0691cc5f3709

This patch adds OSDT (Override System Definition Table) support.
When OSDT is loaded, conflict namespace objects will be overridden
by the AML interpreter. Bob Moore, Lv Zheng.

Link: https://github.com/acpica/acpica/commit/27415c82
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>
2015-07-01 23:17:54 +02:00
Lv Zheng 8f6f036104 ACPICA: Namespace: Add support to allow overriding objects
ACPICA commit 6084e34e44565c6293f446c0202b5e59b055e351

This patch adds an "NamespaceOverride" flag in struct acpi_walk_state, and allows
namespace objects to be overridden when this flag is set. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/6084e34e
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>
2015-07-01 23:17:54 +02:00