summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2016-06-06 09:39:20 +0800
committerLv Zheng <lv.zheng@intel.com>2016-06-12 14:15:05 +0800
commitcc7c7ebe27537840b6e0109d8ef1435c306669bc (patch)
tree8b0e788b3a002bc2d0e2dd34b93baa931cdf877d
parent904347fbea8281411d8defd761e4015c61a008d6 (diff)
downloadacpica-cc7c7ebe27537840b6e0109d8ef1435c306669bc.tar.gz
EFI: Port acpiexec/acpidump to EDK2 environment
This patch adds necessary build files for EDK2 environment to build ACPICA tools. The command steps of building edk2 binaries are (if you are using gcc4.7): # cd edk2 # . ./edksetup.sh # ln -s <path to acpica> AcpiPkg # build -p AcpiPkg/AcpiPkg.dsc -t GCC47 -a X64 -a IA32 Note the above test was done in Linux, and the Windows hasn't been tested when this patch is generated. For building edk2 binaries in the MSVC environment, you need to modify acpidump.inf/acpiexec.inf, adding necessary options when they cannot pass the build in the following configure items: MSFT:*_*_IA32_CC_FLAGS/MSFT:*_*_X64_CC_FLAGS. Lv Zheng. Signed-off-by: Lv Zheng <lv.zheng@intel.com>
-rw-r--r--AcpiPkg.dec25
-rw-r--r--AcpiPkg.dsc47
-rw-r--r--source/acpidump.inf59
-rw-r--r--source/acpiexec.inf234
-rw-r--r--source/include/platform/acefi.h22
-rw-r--r--source/include/platform/acenv.h3
-rw-r--r--source/include/platform/acmsvc.h5
-rw-r--r--source/os_specific/service_layers/oseficlib.c20
8 files changed, 411 insertions, 4 deletions
diff --git a/AcpiPkg.dec b/AcpiPkg.dec
new file mode 100644
index 000000000..13cf1029c
--- /dev/null
+++ b/AcpiPkg.dec
@@ -0,0 +1,25 @@
+## @file
+# Build description file to ACPICA applications.
+#
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+ PACKAGE_NAME = AcpiPkg
+ PACKAGE_GUID = 3ee43d98-2941-11e6-a597-0024e8c6d30e
+ PACKAGE_VERSION = 0.01
+ DEC_SPECIFICATION = 0x00010005
+
+[Includes]
+ source/include
+
+[Guids]
+ gAcpiPkgTokenSpaceGuid = { 0x81c5af5c, 0x2941, 0x11e6, { 0xa5, 0x3d, 0x00, 0x24, 0xe8, 0xc6, 0xd3, 0x0e }}
diff --git a/AcpiPkg.dsc b/AcpiPkg.dsc
new file mode 100644
index 000000000..24f4aa135
--- /dev/null
+++ b/AcpiPkg.dsc
@@ -0,0 +1,47 @@
+#/** @file
+# Build discription file to generate ACPICA applications.
+#
+# Copyright (c) 2009 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# **/
+
+[Defines]
+ PLATFORM_NAME = Acpi
+ PLATFORM_GUID = b03fdec4-2942-11e6-a416-0024e8c6d30e
+ PLATFORM_VERSION = 1.0
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/Acpi
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE
+ SKUID_IDENTIFIER = DEFAULT
+
+[LibraryClasses]
+ #
+ # Entry Point Libraries
+ #
+ UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+ #
+ # Common Libraries
+ #
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ !if $(DEBUG_ENABLE_OUTPUT)
+ DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
+ DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
+ !else ## DEBUG_ENABLE_OUTPUT
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ !endif ## DEBUG_ENABLE_OUTPUT
+
+[Components.common]
+ AcpiPkg/source/acpidump.inf
+ AcpiPkg/source/acpiexec.inf
diff --git a/source/acpidump.inf b/source/acpidump.inf
new file mode 100644
index 000000000..499d1999b
--- /dev/null
+++ b/source/acpidump.inf
@@ -0,0 +1,59 @@
+## @file
+# acpidump.inf
+#
+# Copyright (c) 2016, Intel Corporation. All rights reserved.
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = acpidump
+ FILE_GUID = bf942c9a-2942-11e6-9a64-0024e8c6d30e
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = UefiMain
+
+[Sources]
+ tools/acpidump/apdump.c
+ tools/acpidump/apfiles.c
+ tools/acpidump/apmain.c
+ common/cmfsize.c
+ common/getopt.c
+ os_specific/service_layers/oseficlib.c
+ os_specific/service_layers/osefitbl.c
+ os_specific/service_layers/osefixf.c
+ components/tables/tbprint.c
+ components/tables/tbxfroot.c
+ components/utilities/utascii.c
+ components/utilities/utbuffer.c
+ components/utilities/utclib.c
+ components/utilities/utdebug.c
+ components/utilities/utexcep.c
+ components/utilities/utglobal.c
+ components/utilities/utmath.c
+ components/utilities/utnonansi.c
+ components/utilities/utprint.c
+ components/utilities/utstring.c
+ components/utilities/utxferror.c
+
+[Packages]
+ AcpiPkg/AcpiPkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ UefiApplicationEntryPoint
+ BaseLib
+
+[BuildOptions]
+ MSFT:*_*_IA32_CC_FLAGS = /Oi- /WX- /D_EDK2_EFI /DACPI_DUMP_APP
+ MSFT:*_*_X64_CC_FLAGS = /Oi- /WX- /D_EDK2_EFI /DACPI_DUMP_APP
+ GCC:*_*_IA32_CC_FLAGS = -U__linux__ -U_LINUX -D_EDK2_EFI -DACPI_DUMP_APP -fno-builtin -iwithprefix include
+ GCC:*_*_X64_CC_FLAGS = -U__linux__ -U_LINUX -D_EDK2_EFI -DACPI_DUMP_APP -fno-builtin -iwithprefix include
diff --git a/source/acpiexec.inf b/source/acpiexec.inf
new file mode 100644
index 000000000..a6566e7bb
--- /dev/null
+++ b/source/acpiexec.inf
@@ -0,0 +1,234 @@
+## @file
+# acpiexec.inf
+#
+# Copyright (c) 2016, Intel Corporation. All rights reserved.
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = acpiexec
+ FILE_GUID = 485464fc-2946-11e6-85c7-0024e8c6d30e
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = UefiMain
+
+[Sources]
+ tools/acpiexec/aeexec.c
+ tools/acpiexec/aehandlers.c
+ tools/acpiexec/aeinitfile.c
+ tools/acpiexec/aemain.c
+ tools/acpiexec/aeregion.c
+ tools/acpiexec/aetables.c
+ common/acfileio.c
+ common/acgetline.c
+ common/ahids.c
+ common/ahuuids.c
+ common/cmfsize.c
+ common/getopt.c
+ components/debugger/dbcmds.c
+ components/debugger/dbconvert.c
+ components/debugger/dbdisply.c
+ components/debugger/dbexec.c
+ components/debugger/dbfileio.c
+ components/debugger/dbhistry.c
+ components/debugger/dbinput.c
+ components/debugger/dbmethod.c
+ components/debugger/dbnames.c
+ components/debugger/dbobject.c
+ components/debugger/dbstats.c
+ components/debugger/dbtest.c
+ components/debugger/dbutils.c
+ components/debugger/dbxface.c
+ components/disassembler/dmbuffer.c
+ components/disassembler/dmcstyle.c
+ components/disassembler/dmdeferred.c
+ components/disassembler/dmnames.c
+ components/disassembler/dmopcode.c
+ components/disassembler/dmresrc.c
+ components/disassembler/dmresrcl.c
+ components/disassembler/dmresrcl2.c
+ components/disassembler/dmresrcs.c
+ components/disassembler/dmutils.c
+ components/disassembler/dmwalk.c
+ components/dispatcher/dsargs.c
+ components/dispatcher/dscontrol.c
+ components/dispatcher/dsdebug.c
+ components/dispatcher/dsfield.c
+ components/dispatcher/dsinit.c
+ components/dispatcher/dsmethod.c
+ components/dispatcher/dsmthdat.c
+ components/dispatcher/dsobject.c
+ components/dispatcher/dsopcode.c
+ components/dispatcher/dsutils.c
+ components/dispatcher/dswexec.c
+ components/dispatcher/dswload.c
+ components/dispatcher/dswload2.c
+ components/dispatcher/dswscope.c
+ components/dispatcher/dswstate.c
+ components/events/evevent.c
+ components/events/evglock.c
+ components/events/evgpe.c
+ components/events/evgpeblk.c
+ components/events/evgpeinit.c
+ components/events/evgpeutil.c
+ components/events/evhandler.c
+ components/events/evmisc.c
+ components/events/evregion.c
+ components/events/evrgnini.c
+ components/events/evsci.c
+ components/events/evxface.c
+ components/events/evxfevnt.c
+ components/events/evxfgpe.c
+ components/events/evxfregn.c
+ components/executer/exconcat.c
+ components/executer/exconfig.c
+ components/executer/exconvrt.c
+ components/executer/excreate.c
+ components/executer/exdebug.c
+ components/executer/exdump.c
+ components/executer/exfield.c
+ components/executer/exfldio.c
+ components/executer/exmisc.c
+ components/executer/exmutex.c
+ components/executer/exnames.c
+ components/executer/exoparg1.c
+ components/executer/exoparg2.c
+ components/executer/exoparg3.c
+ components/executer/exoparg6.c
+ components/executer/exprep.c
+ components/executer/exregion.c
+ components/executer/exresnte.c
+ components/executer/exresolv.c
+ components/executer/exresop.c
+ components/executer/exstore.c
+ components/executer/exstoren.c
+ components/executer/exstorob.c
+ components/executer/exsystem.c
+ components/executer/extrace.c
+ components/executer/exutils.c
+ components/hardware/hwacpi.c
+ components/hardware/hwesleep.c
+ components/hardware/hwgpe.c
+ components/hardware/hwpci.c
+ components/hardware/hwregs.c
+ components/hardware/hwsleep.c
+ components/hardware/hwvalid.c
+ components/hardware/hwxface.c
+ components/hardware/hwxfsleep.c
+ components/namespace/nsaccess.c
+ components/namespace/nsalloc.c
+ components/namespace/nsarguments.c
+ components/namespace/nsconvert.c
+ components/namespace/nsdump.c
+ components/namespace/nsdumpdv.c
+ components/namespace/nseval.c
+ components/namespace/nsinit.c
+ components/namespace/nsload.c
+ components/namespace/nsnames.c
+ components/namespace/nsobject.c
+ components/namespace/nsparse.c
+ components/namespace/nspredef.c
+ components/namespace/nsprepkg.c
+ components/namespace/nsrepair.c
+ components/namespace/nsrepair2.c
+ components/namespace/nssearch.c
+ components/namespace/nsutils.c
+ components/namespace/nswalk.c
+ components/namespace/nsxfeval.c
+ components/namespace/nsxfname.c
+ components/namespace/nsxfobj.c
+ components/parser/psargs.c
+ components/parser/psloop.c
+ components/parser/psobject.c
+ components/parser/psopcode.c
+ components/parser/psopinfo.c
+ components/parser/psparse.c
+ components/parser/psscope.c
+ components/parser/pstree.c
+ components/parser/psutils.c
+ components/parser/pswalk.c
+ components/parser/psxface.c
+ components/resources/rsaddr.c
+ components/resources/rscalc.c
+ components/resources/rscreate.c
+ components/resources/rsdump.c
+ components/resources/rsdumpinfo.c
+ components/resources/rsinfo.c
+ components/resources/rsio.c
+ components/resources/rsirq.c
+ components/resources/rslist.c
+ components/resources/rsmemory.c
+ components/resources/rsmisc.c
+ components/resources/rsserial.c
+ components/resources/rsutils.c
+ components/resources/rsxface.c
+ components/tables/tbdata.c
+ components/tables/tbfadt.c
+ components/tables/tbfind.c
+ components/tables/tbinstal.c
+ components/tables/tbprint.c
+ components/tables/tbutils.c
+ components/tables/tbxface.c
+ components/tables/tbxfload.c
+ components/tables/tbxfroot.c
+ components/utilities/utaddress.c
+ components/utilities/utalloc.c
+ components/utilities/utascii.c
+ components/utilities/utbuffer.c
+ components/utilities/utcache.c
+ components/utilities/utclib.c
+ components/utilities/utcopy.c
+ components/utilities/utdebug.c
+ components/utilities/utdecode.c
+ components/utilities/utdelete.c
+ components/utilities/uterror.c
+ components/utilities/uteval.c
+ components/utilities/utexcep.c
+ components/utilities/utglobal.c
+ components/utilities/uthex.c
+ components/utilities/utids.c
+ components/utilities/utinit.c
+ components/utilities/utlock.c
+ components/utilities/utmath.c
+ components/utilities/utmisc.c
+ components/utilities/utmutex.c
+ components/utilities/utnonansi.c
+ components/utilities/utobject.c
+ components/utilities/utosi.c
+ components/utilities/utownerid.c
+ components/utilities/utpredef.c
+ components/utilities/utprint.c
+ components/utilities/utresrc.c
+ components/utilities/utstate.c
+ components/utilities/utstring.c
+ components/utilities/uttrack.c
+ components/utilities/utuuid.c
+ components/utilities/utxface.c
+ components/utilities/utxferror.c
+ components/utilities/utxfinit.c
+ components/utilities/utxfmutex.c
+ os_specific/service_layers/oseficlib.c
+ os_specific/service_layers/osefixf.c
+
+[Packages]
+ AcpiPkg/AcpiPkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ UefiApplicationEntryPoint
+ BaseLib
+
+[BuildOptions]
+ MSFT:*_*_IA32_CC_FLAGS = /Oi- /WX- /D_EDK2_EFI /DACPI_EXEC_APP
+ MSFT:*_*_X64_CC_FLAGS = /Oi- /WX- /D_EDK2_EFI /DACPI_EXEC_APP
+ GCC:*_*_IA32_CC_FLAGS = -U__linux__ -U_LINUX -D_EDK2_EFI -DACPI_EXEC_APP -fno-builtin -iwithprefix include
+ GCC:*_*_X64_CC_FLAGS = -U__linux__ -U_LINUX -D_EDK2_EFI -DACPI_EXEC_APP -fno-builtin -iwithprefix include
diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h
index 859e7554d..4de3607b8 100644
--- a/source/include/platform/acefi.h
+++ b/source/include/platform/acefi.h
@@ -116,6 +116,14 @@
#ifndef __ACEFI_H__
#define __ACEFI_H__
+#ifdef __GNUC__
+#include "acgcc.h"
+#endif
+
+#ifdef _MSC_VER
+#include "acmsvc.h"
+#endif
+
#if defined(__x86_64__)
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
#define USE_MS_ABI 1
@@ -254,6 +262,16 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
#endif
+
+/* EDK2 EFI definitions */
+
+#if defined(_EDK2_EFI)
+
+#define _GNU_EFI
+
+#endif
+
+
/* AED EFI definitions */
#if defined(_AED_EFI)
@@ -287,10 +305,6 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
#if defined(_GNU_EFI)
-/* Using GCC for GNU EFI */
-
-#include "acgcc.h"
-
#ifdef DEBUGGER_THREADING
#undef DEBUGGER_THREADING
#endif /* DEBUGGER_THREADING */
diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h
index 723979ff7..b5268b4e6 100644
--- a/source/include/platform/acenv.h
+++ b/source/include/platform/acenv.h
@@ -288,6 +288,9 @@
#elif defined(_GNU_EFI)
#include "acefi.h"
+#elif defined(_EDK2_EFI)
+#include "acefi.h"
+
#elif defined(__HAIKU__)
#include "achaiku.h"
diff --git a/source/include/platform/acmsvc.h b/source/include/platform/acmsvc.h
index c7cf21bc7..a154c6745 100644
--- a/source/include/platform/acmsvc.h
+++ b/source/include/platform/acmsvc.h
@@ -174,6 +174,10 @@
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE __cdecl
+
+/* Do not maintain the architecture specific stuffs for the EFI ports */
+
+#if !defined(_EDK2_EFI) && !defined(_GNU_EFI)
#ifndef _LINT
/*
* Math helper functions
@@ -208,6 +212,7 @@
n_lo >>= 1; \
}
#endif
+#endif
/* warn C4100: unreferenced formal parameter */
#pragma warning(disable:4100)
diff --git a/source/os_specific/service_layers/oseficlib.c b/source/os_specific/service_layers/oseficlib.c
index 43337c838..acc5f7b8d 100644
--- a/source/os_specific/service_layers/oseficlib.c
+++ b/source/os_specific/service_layers/oseficlib.c
@@ -1246,3 +1246,23 @@ ErrorAlloc:
return (EfiStatus);
}
+
+#ifdef _EDK2_EFI
+struct _ACPI_EFI_SYSTEM_TABLE *ST;
+struct _ACPI_EFI_BOOT_SERVICES *BS;
+struct _ACPI_EFI_RUNTIME_SERVICES *RT;
+
+EFI_STATUS
+EFIAPI
+UefiMain (
+ EFI_HANDLE Image,
+ EFI_SYSTEM_TABLE *SystemTab)
+{
+ EFI_STATUS EfiStatus;
+
+
+ EfiStatus = (EFI_STATUS) efi_main (
+ (ACPI_EFI_HANDLE) Image, (ACPI_EFI_SYSTEM_TABLE *) SystemTab);
+ return (EfiStatus);
+}
+#endif