ACPICA: Debug output: Fix a couple of small output issues.

1) Fix utcache to use the proper return macros in order to maintain
the function nesting level.

2) Enable the function nesting level for all ACPI applications instead
of just acpiexec.

Linux kernel behaviour is not affected by this patch as Linux doesn't
use ACPICA object cache mechanism currently.

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>
ACPICA: Disassembler: Improve pathname support for emitted External() statements.

This change adds full pathname support for external names that have been
resolved internally by the inclusion of additional ACPI tables (via the
iASL -e option). Without this change, the disassembler can emit multiple
externals for the same object, or it become confused when the Scope()
operator is used on an external object.

Linux kernel behaviour is not affected as the structure changes and the
new invocations are only used by compiler and disassembler which are
not shipped in the kernel currently.

Reported-by: Michael Tsirkin <mst@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>
ACPICA: Remove unused ACPI_FREE_BUFFER macro. No functional change.

This macro is no longer used by ACPICA and it is not public.
Also update comments related to the use of ACPI_ALLOCATE_BUFFER and
the use of acpi_os_free (kfree is equivalent and prefered in the
kernel) to free the buffer.

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>
ACPICA: Linux Header: Remove unused OSL prototypes.

This patch removes 2 useless OSL prototypes as they are not used by Linux now.

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>
ACPICA: Back port and refine validation of the XSDT root table.

Some platforms contain an XSDT that is ill-formed or otherwise invalid
(such as containing some or all entries that are NULL pointers).
This change adds a new function to validate the XSDT before actually
using it. If the XSDT is found to be invalid, ACPICA will now fall
back to using the RSDT instead.

This feature is already in the Linux kernel.  When it is back ported to
ACPICA, code is refined to follow ACPICA coding style and this patch
is the generation of the integration.

Original-by: Zhao Yakui <yakui.zhao@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>
ACPICA: Cleanup the option of forcing the use of the RSDT.

This change adds a runtime option that will force ACPICA to use the
RSDT instead of the XSDT. Although the ACPI spec requires that an XSDT
be used instead of the RSDT, the XSDT has been found to be corrupt or
ill-formed on some machines.

This option is already in the Linux kernel.  When it is back ported to
ACPICA, code is re-written to follow ACPICA coding style.  This patch
is the generation of the integration.

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>
ACPICA: Add option to favor 32-bit FADT addresses.

This change adds an option to favor 32-bit FADT addresses when there
is a conflict between the 32-bit and 64-bit versions of the same
address. The default behavior is to use the 64-bit version in accordance
with the ACPI specification. This can now be overridden via the
AcpiGbl_Use32BitFadtAddresses flag. Lv Zheng.

Also, the "Convert FADT" and "Verify FADT" functions have been merged to
simplify the code, make it easier to understand, and make it easier to
maintain. Bob Moore.

References: https://bugs.acpica.org/show_bug.cgi?id=885
References: https://bugs.acpica.org/show_bug.cgi?id=993
Original-by: Lv Zheng <lv.zheng@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>
ACPICA: Tables: Add full support for the DBG2 table.

Updates the DBG2 (Debug Port 2) table definition in the actbl2.h header.

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>
ACPICA: Tables: Add full support for the PCCT table, update table definition.

Updates the PCCT table definition in the actbl3.h header.

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>
ACPICA: Add helper macros to extract bus/segment numbers from HEST table.

This change adds two macros to extract the encoded bus and segment
numbers from the HEST Bus field.

Signed-off-by: Betty Dall <betty.dall@hp.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>
ACPICA: Improve exception handling for GPE block installation.

1) Return an actual status value from acpi_ev_get_gpe_xrupt_block.
2) Don't clobber the status when exiting acpi_ev_install_gpe_block.

References: https://bugs.acpica.org/show_bug.cgi?id=1019
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>
ACPICA: Update several debug statements - no functional change.

Update the format and information emitted from several
debug output statements.

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>
ACPICA: Enhance ACPI warning for memory/IO address conflicts.

This change improves the warning message when a system address
conflicts with an existing operation region. It now emits the region
address range in addition to the input (system) address range.

Reported-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>
ACPICA: Parser: Updates/fixes for debug output.

Major changes in this patch are made to improve the debug output mode of
the compiler.

Linux kernel behaviour is not affected as the change only applies to
the compiler which is not shipped in the Linux kernel.

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>
ACPICA: Conditionally define a local variable that is used for debug only.

This patch improves the relationship between the opcode debugging
information and CONFIG_ACPI_DEBUG enablement.

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>
ACPICA: Add an error message if the Debugger fails initialization.

Previously, only status was returned.

Linux kernel behaviour is not affected as the changes only apply to the
debugger which is currently not shipped in the kernel.

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>
ACPICA: Update ACPI example code to make it an actual working program.

Previously, the example code (tools/examples) showed the ACPICA
init code, but was not an actual working program. Added ACPI tables
to make it actually function.

Linux kernel behaviour is not affected as the change only applies
to the ACPICA userspace utilities which are not shipped in the
kernel currently.

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>
ACPICA: Interpreter: Add additional debug info for an error case.

Emit the name of the namespace node for the error case when
there is no subobject attached to the node.

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>
ACPICA: Linuxize: Cleanup spaces after special macro invocations.

This patch reflects the improvment of a cleanup step which is performed in
the release process.

There are still spaces in the "linuxized" ACPICA files after special macro
invocations.  This is because indent treats comments and pre-processor
directives as spaces, thus we need to skip them.

Before applying this patch, cleanup code will search from keyword back to
end of line and wipe spaces between them.

After applying this patch, cleanup code will search to the end of the macro
invocations, skip "empty lines", "comments" and "pre-processor directives",
then wipe the spaces between the new line and the first non-spaces
characters.

Following improvements are thus achieved in the release automation by this
commit which are originally maintained manually:
 - acpi_status acpi_ev_remove_global_lock_handler(void);
 +acpi_status acpi_ev_remove_global_lock_handler(void);
 - acpi_status
 +acpi_status
  acpi_ev_match_gpe_method(acpi_handle obj_handle,
 - acpi_status acpi_subsystem_status(void);
 +acpi_status acpi_subsystem_status(void);
 - acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type,
 +acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type,
 - acpi_status
 +acpi_status
  acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout);
 - acpi_status
 +acpi_status
  acpi_get_sleep_type_data(u8 sleep_state, u8 *slp_typ_a, u8 *slp_typ_b);
 - acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
 +acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
Some empty lines are restored by this commit due to the change of the
removal implementation.

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>
ACPICA: Utilities: Cleanup declarations of the acpi_gbl_debug_file global.

This global is acting as an OSL global variable, implemented in the
oswinxf.c and osunixxf.c.

This patch cleans up the definition of this variable so that new utilities
do not need to define it in order to link.

Linux kernel behaviour is not affected as the changes only applies to the
ACPICA userspace utilities which are not shipped in the kernel currently.

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>