acpisrc: Add LPIT table conversions.

The following commit hasn't correctly updated acpisrc, which breaks Linux
builds after the linuxized result has been merged by Linux kernel.
  Commit: 6d8ce6539f40de7b6259ca882d8b4fbcfac65708
  Subject: Add support for LPIT table.
This patch fixes this issue.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Executer: Fix buffer allocation issue for GenericSerialBus region field accesses.

The size of the buffer allocated for GenericSerialBus region access
is not correct.  This patch introduces AcpiExGetSerialAccessLength()
to be invoked to obtain correct data buffer length.  Reported by
Lan Tianyu, Fixed by Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Merge pull request #29 from zetalog/acpica-201404

Merge from Lv Zheng's Acpica 201404 tree.
Debugger: free Pathname on error return path

Fix a memory leak on Pathname on an error return path.
bugs.acpica.org, bug #1086.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Utilities: Fix memory leak in AcpiUtCopyIobjectToIobject

Adds return status check on copy routines to delete the allocated destination
object if either copy fails. Reported by Colin Ian King on bugs.acpica.org,
Bug 1087.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
acpidump: Fix repetitive table dump in -n mode.

In "-n" mode, reserved tables (RSDP/RSDT/XSDT/DSDT/FACS) are dumped
multiple times due a missing instance check in OslGetBiosTable().
This patch fixes this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
acpidump: Add support for ACPI 1.0 GUID in Linux

For older EFI platforms, searches for the RSDP using ACPI 1.0 GUID if the
2.0 GUID search fails.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Utilities: Fix an issue with non-native ACPI_IS_PRINT()

An error was found in the ACPICA provided non-native ACPI_IS_PRINT() causing the
following difference with the native isprint() implementation:
  The GNU libc isprint('\n') test result:
   isprint(0x20) is FALSE
  The Linux kernel isprint('\n') test result:
   ACPI: isprint(0x20) is FALSE
  The _acpi_ctype isprint('\n') test result:
   isprint(0x20) is TRUE

The ACPI_IS_PRINT() macro generated for _acpi_ctype is wrong. It should use
_ACPI_XS instead of _ACPI_SP.  _ACPI_XS is white space only. Other space
characters should be non printable.

This patch fixes this issue. For OSPMs that are using native standard
isprint() implementations, this patch is a no-op. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Utilities: Allow use of non-native string API AcpiUtStrchr().

This patch enables non-native ACPI_STRCHR(). For OSPMs that are using
native standard implementations, this patch is a no-op. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Cleanup AcpiOsAllocateZeroed() stubs.

This patch implements AcpiOsAllocateZeroed() in generic OSL for the
applicatiions that have USE_NATIVE_ALLOCATED_ZEROED enabled.

Some utilities may include only osunixxf.c/oswinxf.c without including
utalloc.c, the default AcpiOsAllocateZeroed() is useful in such case to
link a default implementation. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Cleanup AcpiOsGetThreadId()/AcpiOsExecute() stubs.

This patch cleans up single threaded application stubs,
AcpiOsGetThreadId()/AcpiOsExecute() can have generic stub implementations
in generic OSL layer when ACPI_SINGLE_THREADED is defined. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Cleanup AcpiOsGetRootPointer() stubs.

This patch cleans up AcpiOsGetRootPointer() by deleting the
AeLocalGetRootPointer() and adding ACPI_USE_NATIVE_RSDP_POINTER.

The AeLocalGetRootPointer() referenced by osunixxf.c/oswinxf.c is
preventing portable applications that do not have this function implemented
to directly link the useful generic OSL.

This patch changes the way to achieve a default empty
AcpiOsGetRootPointer() by deleting all AeLocalGetRootPointer(). If a
utility wants to have a specific and functioning AcpiOsGetRootPointer(), it
now should define ACPI_USE_NATIVE_RSDP_POINTER and implement its own
AcpiOsGetRootPointer(). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Utilities: Cleanup ACPI_DEBUGGER by converting AcpiDbReadTableFromFile() to AcpiUtReadTableFromFile().

This patch is mainly for acpinames, which defines ACPI_DEBUGGER in order to
link AcpiDbReadTableFromFile(). Actually it doesn't require debugger to be
compiled. This patch also cleans up ACPI_DEBUGGER for acpihelp.
This patch splits this function from debugger to be a generic utilities API
so that ACPI_DEBUGGER can no longer be defined for acpinames. Note that
acpinames need to access dump functions so it need to define
ACPI_DEBUG_OUTPUT, and AcpiDbgLevel need to be tuned to keep behavior
consistency.
This patch is required for removing anstubs.c. Without doing this first,
removing anstubs.c will lead to many link requirements to all debugger and
disassembler objects for acpinames. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
acpiexamples: Cleanup exstub.c file by defining ACPI_REDUCED_HARDWARE.

The stub file of exstub.c is generated in the age that
ACPI_REDUCED_HARDWARE is not introduced. Now it's deprecated if we can
utilize this new stub facility.

This patch removes exstub.c by defining ACPI_REDUCED_HARDWARE for
acpiexamples. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
acpinames: Cleanup anstub.c file by defining ACPI_REDUCED_HARDWARE.

The stub file of anstub.c is generated in the age that
ACPI_REDUCED_HARDWARE is not introduced. Now it's deprecated if we can
utilize this new stub facility.

This patch removes anstub.c by defining ACPI_REDUCED_HARDWARE for
acpinames. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Utilities: Cleanup DEFINE_ACPI_GLOBALS by moving AcpiUtInitGlobal() from utglobal.c to utinit.c.

The utglobal.c is used to define and initialize global variables.  It makes
sense if just adding utglobal.o to applications that are using such
variables. But AcpiUtInitGlobals() is preventing us from doing so as this
initialization function references other components' initializations code,
which leads to the requirement that many files should also get linked if
one wants to link utglobal.o.

By eliminating the stubs for acpiexamples, acpinames, iasl, now it is
possible to just move AcpiUtInitGlobal() to utinit.c for applications that
require this function to link.

By linking utglobal.o, we can stop defining DEFINE_ACPI_GLOBALS for
applications (currently only acpidump is affected). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Cleanup AcpiOsMapMemory()/AcpiOsUnmapMemory() stubs.

This patch introduces new compilation environment
ACPI_USE_NATIVE_MEMORY_MAPPING.

In order to convert acpidump to be a portable applicatiion, acpidump need
to link osPLATxf.c, then there will be 2 instances of
AcpiOsMapMemory()/AcpiOsUnmapMemory() linked by acpidump, one is only used
by acpidump to perform file mapping, the other is a generic memory mapping
implementation for other applications. It thus requires a mechanism for
acpidump to exclude the generic one. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Cleanup AcpiOsPrintf()/AcpiOsVprintf() stubs.

This patch is mainly for acpidump where there are redundant
AcpiOsPrintf()/AcpiOsVprintf() stubs implemented. This patch cleans up such
specific implementation by linking acpidump to osunixxf.c/oswinxf.c.

To make AcpiOsPrintf() exported by osunixxf.c/oswinxf.c to behave as the
old acpidump specific ones, applications need to:
1. Initialize AcpiGbl_DbOutputFlags to ACPI_DB_CONSOLE_OUTPUT.
   This is automatically done by ACPI_INIT_GLOBAL(), applications need to
   link utglobal.o to utilize this mechanism.
2. Initialize AcpiGbl_OutputFile to stdout.
   For GCC, assigning stdout to AcpiGbl_OutputFile using ACPI_INIT_GLOBAL()
   is not possible as stdout is not a constant in GCC environment. As an
   alternative solution, stdout assignment is put into AcpiOsInitialize().
   Thus AcpiOsInitialize() need to be invoked very early by the
   applications to initialize the default output of AcpiOsPrintf().

Note that acpidump has been released to Linux kernel, after adding
osunixxf.c to generate/unix/acpidump/Makefile, libacpica.sh also need to be
updated to release osunixxf.c to Linux kernel. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>