OSL: Export variables of AcpiOsPrintf() and AcpiOsVprintf() to improve portability of generic OSL.

This patch exports global variable used in AcpiOsVprintf() and
AcpiOsPrintf() for ACPICA applications to improve the portability of the
generic OSL.

This patch is useful for acpidump which can use generic
AcpiOsVprintf()/AcpiOsPrintf() instead of the specific ones implemented in
apdump.c. By forcing acpidump to use generic
AcpiOsVprintf()/AcpiOsPrintf(), it is possible to implement generic
portable usage macros/functions for all ACPICA utilities. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Add ACPI_USE_NATIVE_MEMORY_MAPPING to improve portability of generic OSL.

This patch adds new compilation environment ACPI_USE_NATIVE_MEMORY_MAPPING
to improve the portability of the generic OSL.

This patch also adds ACPI_USE_NATIVE_MEMORY_MAPPING usage for acpidump as
this utility is using a specific implmentation to perform file mapping.

There are 2 instances of AcpiOsMapMemory()/AcpiOsUnmapMemory(), one is only
used by acpidump to perform file mapping. By excluding the other for
acpidump, it is possible for acpidump to utilize OSL functions implemented
in osunixxf.c/oswinxf.c. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Add AcpiOsAllocateZeroed() to improve portability of generic OSL.

This patch implements AcpiOsAllocateZeroed() in generic OSL for the build
that having USE_NATIVE_ALLOCATED_ZEROED enabled. This can help to improve
the portability of the generic OSL.

Some utilities may include only osunixxf.c/oswinxf.c without including
utalloc.c in early porting stage, the default AcpiOsAllocateZeroed() is
useful in such case to link a default implementation so that the porting
effort can be reduced. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Cleanup AcpiOsGetRootPointer() to improve portability of generic OSL.

This patch cleans up AcpiOsGetRootPointer() by deleting the
AeLocalGetRootPointer() and adding ACPI_USE_NATIVE_RSDP_POINTER.  This can
help to improve the portability of the generic OSL.

The AeLocalGetRootPointer() referenced by osunixxf.c/oswinxf.c is
preventing utilites 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 AcpiOsGetRootPointer(), it now should
define ACPI_USE_NATIVE_RSDP_POINTER and implemente its own
AcpiOsGetRootPointer(). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Add file IO and AcpiLogError() to improve portability of generic OSL.

This patch adds file IO to generic OSL and a wrapper AcpiLogError() to use
it logging to the stderr. The new interfaces can be used by applications
and can be replaced with platform specific implementations. Thus they can
improve the portability of the generic OSL.

Invocations like fprintf(stderr) and perror are not portable, futher patch
should convert such non-portable stuff into this new API which allows OSL
to define a portable file IO layer.

Some utilities are already referencing utdebug.c, they now need to build
utlibcfs.c as well. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Application: Enhance ACPI_USAGE_xxx/ACPI_OPTION with AcpiOsPrintf() to improve portability.

This patch enhances ACPI_USAGE_xxx/ACPI_OPTION macros to use portable
AcpiOsPrintf() so that their usage functions will no longer rely on the
printf() API.

AcpiOsInitialize() need to be invoked very early by these utilities to
initialize the default output of AcpiOsPrintf() to stdout. This cannot be
done by ACPI_INIT_GLOBAL() due to a gcc bug - stdout cannot be used as a
constant value.

The global variables used in AcpiOsPrintf() need to be exported for the
applications that have osunixxf.c newly added to their makefile, this is
done by defining EXPORT_ACPI_GLOBALS for them. Lv Zheng.

Note:
1. acpiexec/acpinames have already invoked AcpiInitializeSubsystem() very
   early, thus no need to add AcpiOsInitialize() for them.
2. acpidump has been released to Linux kernel, thus libacpica.sh is also
   changed to release osunixxf.c to Linux.
3. acpidump has its own AcpiOsPrintf() implementation, this is not needed
   after applying this patch to use generic OSL.
4. acpiexamples is not using usage macros.
5. msvc9/msvc project files are not updated in this patch, it can be done
   by follow up commits.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Common: Enhance CmGetFileSize() to improve portability.

This patch uses AcpiOsXXXFileXXX() and AcpiLogError() APIs to enhance
CmGetFileSize() so that applications that invoke this API could have
portability improved. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Common: Enhance AcpiGetopt() to improve portability.

This patch enhances AcpiGetopt() by converting the libc invocations into
portable ACPI string APIs and AcpiLogError() to improve portability.
Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
acpidump: Add memory/string OSL usage to improve portability.

This patch adds code to use generic OSL for acpidump to improve the
portability of this tool. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
acpidump: Remove exit() from generic layer to improve portability.

This patch removes exit() from generic acpidump code to improve the
portability of this tool. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
acpidump: Replace file IOs with new APIs to improve portability.

The new APIs are enabled to offer a portable layer to access files:
1. AcpiOsXXXFileXXX: Wrapper of fopen/fclose/fread/fwrite
2. AcpiOsPrintf: Wrapper of printf
3. ACPI_OPTION: Wrapper of AcpiOsPrintf
4. AcpiLogError: Wrapper of fprintf(stderr)

This patch deploys such mechanisms to acpidump to improve the portability
of this tool. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
acpidump: Reduce freopen() invocations to improve portability.

This patch reduces the requirement of invoking freopen() in acpidump in order
to reduce the porting effort of acpidump.

This patch achieves this by turning all AcpiOsPrintf(stdout) into
AcpiOsFilePrintf(Gbl_OutputFile). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
OSL: Introduce printf() like APIs to improve portability.

This patch introduces ACPICA specific printf() like functions to improve
the portability of the generic OSL.

This patch also replaces sprintf() invocation in acpidump with the new API.
This can improve the portability of acpidump. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
EFI: Add build environment support for GNU EFI development.

This patch adds build environment for GNU EFI shell development.

Note that only the Makefiles used by EFI development are created in this
patch, actual OSL is not implemented and ACPICA tool is enabled in this
patch. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
EFI: Adds generic OSL support for GNU EFI development.

This patch adds generic OSL for GNU EFI shell development.

The following files are enhanced with GNU EFI builds:
1. os_specific/service_layers/osefixf.c
2. include/platform/acefi.h

ACPICA EFI tools will have efi_main() entry points.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
EFI: Add build environment support for acpidump.

This patch enables acpidump build for EFI. Lv Zheng.

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