summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2016-06-15 10:33:47 -0700
committerGitHub <noreply@github.com>2016-06-15 10:33:47 -0700
commit8aac0be3c840747a032b63e7365c99190e2a0ba9 (patch)
treec667316883055dd53603d5343436465a14283f10
parentf78ce8644e4b13f7d092348ff33e3bf9d36eeffa (diff)
parentcc7c7ebe27537840b6e0109d8ef1435c306669bc (diff)
downloadacpica-8aac0be3c840747a032b63e7365c99190e2a0ba9.tar.gz
Merge pull request #143 from zetalog/efi-edk2
Efi edk2
-rw-r--r--AcpiPkg.dec25
-rw-r--r--AcpiPkg.dsc47
-rw-r--r--generate/efi/Makefile.config9
-rw-r--r--generate/efi/acpidump/Makefile5
-rw-r--r--generate/efi/acpiexec/Makefile255
-rw-r--r--generate/unix/acpibin/Makefile1
-rw-r--r--generate/unix/acpidump/Makefile1
-rw-r--r--generate/unix/acpiexamples/Makefile1
-rw-r--r--generate/unix/acpiexec/Makefile1
-rw-r--r--generate/unix/acpihelp/Makefile1
-rw-r--r--generate/unix/acpinames/Makefile1
-rw-r--r--generate/unix/acpisrc/Makefile5
-rw-r--r--generate/unix/acpixtract/Makefile1
-rw-r--r--generate/unix/iasl/Makefile1
-rw-r--r--source/acpidump.inf59
-rw-r--r--source/acpiexec.inf234
-rw-r--r--source/common/acfileio.c7
-rw-r--r--source/common/acgetline.c2
-rw-r--r--source/common/cmfsize.c13
-rw-r--r--source/common/getopt.c2
-rw-r--r--source/components/debugger/dbfileio.c1
-rw-r--r--source/components/utilities/utbuffer.c26
-rw-r--r--source/components/utilities/utclib.c146
-rw-r--r--source/components/utilities/utdebug.c30
-rw-r--r--source/components/utilities/utpredef.c2
-rw-r--r--source/components/utilities/utprint.c124
-rw-r--r--source/components/utilities/utxfinit.c4
-rw-r--r--source/include/acapps.h12
-rw-r--r--source/include/acclib.h156
-rw-r--r--source/include/accommon.h4
-rw-r--r--source/include/acpiosxf.h67
-rw-r--r--source/include/acpixf.h9
-rw-r--r--source/include/actypes.h10
-rw-r--r--source/include/acutils.h42
-rw-r--r--source/include/platform/acefi.h91
-rw-r--r--source/include/platform/acefiex.h998
-rw-r--r--source/include/platform/acenv.h65
-rw-r--r--source/include/platform/acgcc.h4
-rw-r--r--source/include/platform/aclinux.h6
-rw-r--r--source/include/platform/acmsvc.h9
-rw-r--r--source/os_specific/service_layers/oseficlib.c1268
-rw-r--r--source/os_specific/service_layers/osefitbl.c86
-rw-r--r--source/os_specific/service_layers/osefixf.c1099
-rw-r--r--source/os_specific/service_layers/oslibcfs.c330
-rw-r--r--source/os_specific/service_layers/osunixxf.c3
-rw-r--r--source/os_specific/service_layers/oswinxf.c3
-rw-r--r--source/tools/acpidump/acpidump.h12
-rw-r--r--source/tools/acpidump/apdump.c28
-rw-r--r--source/tools/acpidump/apfiles.c42
-rw-r--r--source/tools/acpidump/apmain.c15
-rw-r--r--source/tools/acpiexec/aecommon.h7
-rw-r--r--source/tools/acpiexec/aehandlers.c5
-rw-r--r--source/tools/acpiexec/aeinitfile.c7
-rw-r--r--source/tools/acpiexec/aemain.c15
54 files changed, 3643 insertions, 1754 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/generate/efi/Makefile.config b/generate/efi/Makefile.config
index d7872c8ac..1f3aa74d4 100644
--- a/generate/efi/Makefile.config
+++ b/generate/efi/Makefile.config
@@ -47,7 +47,7 @@
#
# Common defines
#
-PROGS = acpidump
+PROGS = acpidump acpiexec
HOST = $(shell uname -m | sed s,i[3456789]86,ia32,)
TARGET = $(shell uname -m | sed s,i[3456789]86,ia32,)
SHARED ?= true
@@ -79,6 +79,7 @@ ACPICA_UTILITIES = $(ACPICA_CORE)/utilities
# ACPICA tool and utility source directories
#
ACPIDUMP = $(ACPICA_TOOLS)/acpidump
+ACPIEXEC = $(ACPICA_TOOLS)/acpiexec
#
# Common ACPICA header files
@@ -95,17 +96,23 @@ LD = ld
OBJCOPY = objcopy
CFLAGS = \
+ --save-temps\
+ -nostdinc\
+ -nostdlib\
-std=c99\
-U__linux__\
-U_LINUX\
-D_GNU_EFI\
-D_GNU_SOURCE\
+ -fno-builtin\
+ -iwithprefix include\
-fno-stack-protector\
-fno-strict-aliasing\
-fpic\
-fshort-wchar\
-I$(ACPICA_INCLUDE)
LDFLAGS = \
+ -nostdinc\
-nostdlib\
-znocombreloc\
-Bsymbolic
diff --git a/generate/efi/acpidump/Makefile b/generate/efi/acpidump/Makefile
index 16bd52a81..39fa364d0 100644
--- a/generate/efi/acpidump/Makefile
+++ b/generate/efi/acpidump/Makefile
@@ -32,16 +32,19 @@ OBJECTS = \
$(OBJDIR)/apmain.o\
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/getopt.o\
+ $(OBJDIR)/oseficlib.o\
$(OBJDIR)/osefitbl.o\
$(OBJDIR)/osefixf.o\
$(OBJDIR)/tbprint.o\
$(OBJDIR)/tbxfroot.o\
+ $(OBJDIR)/utascii.o\
$(OBJDIR)/utbuffer.o\
- $(OBJDIR)/utdebug.o\
$(OBJDIR)/utclib.o\
+ $(OBJDIR)/utdebug.o\
$(OBJDIR)/utexcep.o\
$(OBJDIR)/utglobal.o\
$(OBJDIR)/utmath.o\
+ $(OBJDIR)/utnonansi.o\
$(OBJDIR)/utprint.o\
$(OBJDIR)/utstring.o\
$(OBJDIR)/utxferror.o
diff --git a/generate/efi/acpiexec/Makefile b/generate/efi/acpiexec/Makefile
new file mode 100644
index 000000000..aedcb6b14
--- /dev/null
+++ b/generate/efi/acpiexec/Makefile
@@ -0,0 +1,255 @@
+
+#
+# acpiexec: ACPI execution simulator. Runs ACPICA code in user
+# space. Loads ACPI tables, displays the namespace, and allows
+# execution of control methods.
+#
+
+#
+# Note: This makefile is intended to be used from within the native
+# ACPICA directory structure, from under generate/unix. It specifically
+# places all object files in a generate/unix subdirectory, not within
+# the various ACPICA source directories. This prevents collisions
+# between different compilations of the same source file with different
+# compile options, and prevents pollution of the source code.
+#
+include ../Makefile.config
+FINAL_PROG = ../$(BINDIR)/acpiexec
+PROG = $(OBJDIR)/acpiexec
+
+#
+# Search paths for source files
+#
+vpath %.c \
+ $(ACPIEXEC)\
+ $(ACPICA_DEBUGGER)\
+ $(ACPICA_DISASSEMBLER)\
+ $(ACPICA_DISPATCHER)\
+ $(ACPICA_EVENTS)\
+ $(ACPICA_EXECUTER)\
+ $(ACPICA_HARDWARE)\
+ $(ACPICA_NAMESPACE)\
+ $(ACPICA_PARSER)\
+ $(ACPICA_RESOURCES)\
+ $(ACPICA_TABLES)\
+ $(ACPICA_UTILITIES)\
+ $(ACPICA_COMMON)\
+ $(ACPICA_OSL)
+
+HEADERS = \
+ $(wildcard $(ACPIEXEC)/*.h)
+
+OBJECTS = \
+ $(OBJDIR)/acfileio.o\
+ $(OBJDIR)/acgetline.o\
+ $(OBJDIR)/aeexec.o\
+ $(OBJDIR)/aehandlers.o\
+ $(OBJDIR)/aeinitfile.o\
+ $(OBJDIR)/aemain.o\
+ $(OBJDIR)/aeregion.o\
+ $(OBJDIR)/aetables.o\
+ $(OBJDIR)/ahids.o\
+ $(OBJDIR)/ahuuids.o\
+ $(OBJDIR)/cmfsize.o\
+ $(OBJDIR)/dbcmds.o\
+ $(OBJDIR)/dbconvert.o\
+ $(OBJDIR)/dbdisply.o\
+ $(OBJDIR)/dbexec.o\
+ $(OBJDIR)/dbfileio.o\
+ $(OBJDIR)/dbhistry.o\
+ $(OBJDIR)/dbinput.o\
+ $(OBJDIR)/dbmethod.o\
+ $(OBJDIR)/dbnames.o\
+ $(OBJDIR)/dbobject.o\
+ $(OBJDIR)/dbstats.o\
+ $(OBJDIR)/dbtest.o\
+ $(OBJDIR)/dbutils.o\
+ $(OBJDIR)/dbxface.o\
+ $(OBJDIR)/dmbuffer.o\
+ $(OBJDIR)/dmcstyle.o\
+ $(OBJDIR)/dmdeferred.o\
+ $(OBJDIR)/dmnames.o\
+ $(OBJDIR)/dmopcode.o\
+ $(OBJDIR)/dmresrc.o\
+ $(OBJDIR)/dmresrcl.o\
+ $(OBJDIR)/dmresrcl2.o\
+ $(OBJDIR)/dmresrcs.o\
+ $(OBJDIR)/dmutils.o\
+ $(OBJDIR)/dmwalk.o\
+ $(OBJDIR)/dsargs.o\
+ $(OBJDIR)/dscontrol.o\
+ $(OBJDIR)/dsdebug.o\
+ $(OBJDIR)/dsfield.o\
+ $(OBJDIR)/dsinit.o\
+ $(OBJDIR)/dsmethod.o\
+ $(OBJDIR)/dsmthdat.o\
+ $(OBJDIR)/dsobject.o\
+ $(OBJDIR)/dsopcode.o\
+ $(OBJDIR)/dsutils.o\
+ $(OBJDIR)/dswexec.o\
+ $(OBJDIR)/dswload.o\
+ $(OBJDIR)/dswload2.o\
+ $(OBJDIR)/dswscope.o\
+ $(OBJDIR)/dswstate.o\
+ $(OBJDIR)/evevent.o\
+ $(OBJDIR)/evglock.o\
+ $(OBJDIR)/evgpe.o\
+ $(OBJDIR)/evgpeblk.o\
+ $(OBJDIR)/evgpeinit.o\
+ $(OBJDIR)/evgpeutil.o\
+ $(OBJDIR)/evhandler.o\
+ $(OBJDIR)/evmisc.o\
+ $(OBJDIR)/evregion.o\
+ $(OBJDIR)/evrgnini.o\
+ $(OBJDIR)/evsci.o\
+ $(OBJDIR)/evxface.o\
+ $(OBJDIR)/evxfevnt.o\
+ $(OBJDIR)/evxfgpe.o\
+ $(OBJDIR)/evxfregn.o\
+ $(OBJDIR)/exconcat.o\
+ $(OBJDIR)/exconfig.o\
+ $(OBJDIR)/exconvrt.o\
+ $(OBJDIR)/excreate.o\
+ $(OBJDIR)/exdebug.o\
+ $(OBJDIR)/exdump.o\
+ $(OBJDIR)/exfield.o\
+ $(OBJDIR)/exfldio.o\
+ $(OBJDIR)/exmisc.o\
+ $(OBJDIR)/exmutex.o\
+ $(OBJDIR)/exnames.o\
+ $(OBJDIR)/exoparg1.o\
+ $(OBJDIR)/exoparg2.o\
+ $(OBJDIR)/exoparg3.o\
+ $(OBJDIR)/exoparg6.o\
+ $(OBJDIR)/exprep.o\
+ $(OBJDIR)/exregion.o\
+ $(OBJDIR)/exresnte.o\
+ $(OBJDIR)/exresolv.o\
+ $(OBJDIR)/exresop.o\
+ $(OBJDIR)/exstore.o\
+ $(OBJDIR)/exstoren.o\
+ $(OBJDIR)/exstorob.o\
+ $(OBJDIR)/exsystem.o\
+ $(OBJDIR)/extrace.o\
+ $(OBJDIR)/exutils.o\
+ $(OBJDIR)/getopt.o\
+ $(OBJDIR)/hwacpi.o\
+ $(OBJDIR)/hwesleep.o\
+ $(OBJDIR)/hwgpe.o\
+ $(OBJDIR)/hwpci.o\
+ $(OBJDIR)/hwregs.o\
+ $(OBJDIR)/hwsleep.o\
+ $(OBJDIR)/hwvalid.o\
+ $(OBJDIR)/hwxface.o\
+ $(OBJDIR)/hwxfsleep.o\
+ $(OBJDIR)/nsaccess.o\
+ $(OBJDIR)/nsalloc.o\
+ $(OBJDIR)/nsarguments.o\
+ $(OBJDIR)/nsconvert.o\
+ $(OBJDIR)/nsdump.o\
+ $(OBJDIR)/nsdumpdv.o\
+ $(OBJDIR)/nseval.o\
+ $(OBJDIR)/nsinit.o\
+ $(OBJDIR)/nsload.o\
+ $(OBJDIR)/nsnames.o\
+ $(OBJDIR)/nsobject.o\
+ $(OBJDIR)/nsparse.o\
+ $(OBJDIR)/nspredef.o\
+ $(OBJDIR)/nsprepkg.o\
+ $(OBJDIR)/nsrepair.o\
+ $(OBJDIR)/nsrepair2.o\
+ $(OBJDIR)/nssearch.o\
+ $(OBJDIR)/nsutils.o\
+ $(OBJDIR)/nswalk.o\
+ $(OBJDIR)/nsxfeval.o\
+ $(OBJDIR)/nsxfname.o\
+ $(OBJDIR)/nsxfobj.o\
+ $(OBJDIR)/psargs.o\
+ $(OBJDIR)/psloop.o\
+ $(OBJDIR)/psobject.o\
+ $(OBJDIR)/psopcode.o\
+ $(OBJDIR)/psopinfo.o\
+ $(OBJDIR)/psparse.o\
+ $(OBJDIR)/psscope.o\
+ $(OBJDIR)/pstree.o\
+ $(OBJDIR)/psutils.o\
+ $(OBJDIR)/pswalk.o\
+ $(OBJDIR)/psxface.o\
+ $(OBJDIR)/rsaddr.o\
+ $(OBJDIR)/rscalc.o\
+ $(OBJDIR)/rscreate.o\
+ $(OBJDIR)/rsdump.o\
+ $(OBJDIR)/rsdumpinfo.o\
+ $(OBJDIR)/rsinfo.o\
+ $(OBJDIR)/rsio.o\
+ $(OBJDIR)/rsirq.o\
+ $(OBJDIR)/rslist.o\
+ $(OBJDIR)/rsmemory.o\
+ $(OBJDIR)/rsmisc.o\
+ $(OBJDIR)/rsserial.o\
+ $(OBJDIR)/rsutils.o\
+ $(OBJDIR)/rsxface.o\
+ $(OBJDIR)/tbdata.o\
+ $(OBJDIR)/tbfadt.o\
+ $(OBJDIR)/tbfind.o\
+ $(OBJDIR)/tbinstal.o\
+ $(OBJDIR)/tbprint.o\
+ $(OBJDIR)/tbutils.o\
+ $(OBJDIR)/tbxface.o\
+ $(OBJDIR)/tbxfload.o\
+ $(OBJDIR)/tbxfroot.o\
+ $(OBJDIR)/utaddress.o\
+ $(OBJDIR)/utalloc.o\
+ $(OBJDIR)/utascii.o\
+ $(OBJDIR)/utbuffer.o\
+ $(OBJDIR)/utcache.o\
+ $(OBJDIR)/utclib.o\
+ $(OBJDIR)/utcopy.o\
+ $(OBJDIR)/utdebug.o\
+ $(OBJDIR)/utdecode.o\
+ $(OBJDIR)/utdelete.o\
+ $(OBJDIR)/uterror.o\
+ $(OBJDIR)/uteval.o\
+ $(OBJDIR)/utexcep.o\
+ $(OBJDIR)/utglobal.o\
+ $(OBJDIR)/uthex.o\
+ $(OBJDIR)/utids.o\
+ $(OBJDIR)/utinit.o\
+ $(OBJDIR)/utlock.o\
+ $(OBJDIR)/utmath.o\
+ $(OBJDIR)/utmisc.o\
+ $(OBJDIR)/utmutex.o\
+ $(OBJDIR)/utnonansi.o\
+ $(OBJDIR)/utobject.o\
+ $(OBJDIR)/utosi.o\
+ $(OBJDIR)/utownerid.o\
+ $(OBJDIR)/utpredef.o\
+ $(OBJDIR)/utprint.o\
+ $(OBJDIR)/utresrc.o\
+ $(OBJDIR)/utstate.o\
+ $(OBJDIR)/utstring.o\
+ $(OBJDIR)/uttrack.o\
+ $(OBJDIR)/utuuid.o\
+ $(OBJDIR)/utxface.o\
+ $(OBJDIR)/utxferror.o\
+ $(OBJDIR)/utxfinit.o\
+ $(OBJDIR)/oseficlib.o\
+ $(OBJDIR)/osefixf.o\
+ $(OBJDIR)/utxfmutex.o
+
+#
+# Flags specific to acpiexec utility
+#
+CFLAGS += \
+ -DACPI_EXEC_APP\
+ -I$(ACPIEXEC)
+
+ifeq ($(ASLTS),TRUE)
+CFLAGS += \
+ -DACPI_CHECKSUM_ABORT=TRUE
+endif
+
+#
+# Common Rules
+#
+include ../Makefile.rules
diff --git a/generate/unix/acpibin/Makefile b/generate/unix/acpibin/Makefile
index e856499a5..511d71091 100644
--- a/generate/unix/acpibin/Makefile
+++ b/generate/unix/acpibin/Makefile
@@ -47,7 +47,6 @@ OBJECTS = \
$(OBJDIR)/utstate.o\
$(OBJDIR)/utstring.o\
$(OBJDIR)/utxferror.o\
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/osunixxf.o
#
diff --git a/generate/unix/acpidump/Makefile b/generate/unix/acpidump/Makefile
index d6e19644c..bc3430613 100644
--- a/generate/unix/acpidump/Makefile
+++ b/generate/unix/acpidump/Makefile
@@ -33,7 +33,6 @@ OBJECTS = \
$(OBJDIR)/apmain.o\
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/getopt.o\
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/osunixdir.o\
$(OBJDIR)/osunixmap.o\
$(OBJDIR)/osunixxf.o\
diff --git a/generate/unix/acpiexamples/Makefile b/generate/unix/acpiexamples/Makefile
index 54d74739e..b22b84883 100644
--- a/generate/unix/acpiexamples/Makefile
+++ b/generate/unix/acpiexamples/Makefile
@@ -107,7 +107,6 @@ OBJECTS = \
$(OBJDIR)/nsxfeval.o\
$(OBJDIR)/nsxfname.o\
$(OBJDIR)/nsxfobj.o\
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/osunixxf.o\
$(OBJDIR)/psargs.o\
$(OBJDIR)/psloop.o\
diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile
index 7f8befabb..33e516caf 100644
--- a/generate/unix/acpiexec/Makefile
+++ b/generate/unix/acpiexec/Makefile
@@ -163,7 +163,6 @@ OBJECTS = \
$(OBJDIR)/nsxfeval.o\
$(OBJDIR)/nsxfname.o\
$(OBJDIR)/nsxfobj.o\
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/osunixxf.o\
$(OBJDIR)/psargs.o\
$(OBJDIR)/psloop.o\
diff --git a/generate/unix/acpihelp/Makefile b/generate/unix/acpihelp/Makefile
index d50e416c8..4290a153f 100644
--- a/generate/unix/acpihelp/Makefile
+++ b/generate/unix/acpihelp/Makefile
@@ -38,7 +38,6 @@ OBJECTS = \
$(OBJDIR)/ahtable.o\
$(OBJDIR)/ahuuids.o\
$(OBJDIR)/getopt.o\
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/osunixxf.o\
$(OBJDIR)/utdebug.o\
$(OBJDIR)/utexcep.o\
diff --git a/generate/unix/acpinames/Makefile b/generate/unix/acpinames/Makefile
index 4ff5558f0..a7dd6a9ee 100644
--- a/generate/unix/acpinames/Makefile
+++ b/generate/unix/acpinames/Makefile
@@ -72,7 +72,6 @@ OBJECTS = \
$(OBJDIR)/nsxfeval.o\
$(OBJDIR)/nsxfname.o\
$(OBJDIR)/nsxfobj.o\
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/osunixxf.o\
$(OBJDIR)/psargs.o\
$(OBJDIR)/psloop.o\
diff --git a/generate/unix/acpisrc/Makefile b/generate/unix/acpisrc/Makefile
index 93a9868cf..931b33d71 100644
--- a/generate/unix/acpisrc/Makefile
+++ b/generate/unix/acpisrc/Makefile
@@ -36,15 +36,14 @@ OBJECTS = \
$(OBJDIR)/asutils.o\
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/getopt.o \
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/osunixdir.o\
$(OBJDIR)/osunixxf.o\
- $(OBJDIR)/utascii.o\
+ $(OBJDIR)/utascii.o\
$(OBJDIR)/utdebug.o\
$(OBJDIR)/utexcep.o\
$(OBJDIR)/utglobal.o\
$(OBJDIR)/utmath.o\
- $(OBJDIR)/utnonansi.o\
+ $(OBJDIR)/utnonansi.o\
$(OBJDIR)/utprint.o\
$(OBJDIR)/utstring.o\
$(OBJDIR)/utxferror.o
diff --git a/generate/unix/acpixtract/Makefile b/generate/unix/acpixtract/Makefile
index 272cbd091..22b3294ee 100644
--- a/generate/unix/acpixtract/Makefile
+++ b/generate/unix/acpixtract/Makefile
@@ -31,7 +31,6 @@ OBJECTS = \
$(OBJDIR)/axmain.o\
$(OBJDIR)/axutils.o\
$(OBJDIR)/getopt.o\
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/osunixxf.o\
$(OBJDIR)/utascii.o\
$(OBJDIR)/utdebug.o\
diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile
index a3759cc85..949dd180a 100644
--- a/generate/unix/iasl/Makefile
+++ b/generate/unix/iasl/Makefile
@@ -177,7 +177,6 @@ OBJECTS = \
$(OBJDIR)/nswalk.o\
$(OBJDIR)/nsxfobj.o\
$(OBJDIR)/osunixxf.o\
- $(OBJDIR)/oslibcfs.o\
$(OBJDIR)/prexpress.o\
$(OBJDIR)/prmacros.o\
$(OBJDIR)/prscan.o\
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/common/acfileio.c b/source/common/acfileio.c
index c00580fc7..e53b825a7 100644
--- a/source/common/acfileio.c
+++ b/source/common/acfileio.c
@@ -118,7 +118,6 @@
#include "acapps.h"
#include "actables.h"
#include "acutils.h"
-#include <errno.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("acfileio")
@@ -170,7 +169,7 @@ AcGetAllTablesFromFile (
File = fopen (Filename, "rb");
if (!File)
{
- perror ("Could not open input file");
+ fprintf (stderr, "Could not open input file: %s\n", Filename);
if (errno == ENOENT)
{
return (AE_NOT_EXIST);
@@ -352,7 +351,7 @@ AcGetOneTableFromFile (
/* Allocate a buffer for the entire table */
- Table = AcpiOsAllocate ((size_t) TableHeader.Length);
+ Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
if (!Table)
{
return (AE_NO_MEMORY);
@@ -460,7 +459,7 @@ AcValidateTableHeader (
long TableOffset)
{
ACPI_TABLE_HEADER TableHeader;
- size_t Actual;
+ ACPI_SIZE Actual;
long OriginalOffset;
UINT32 FileSize;
UINT32 i;
diff --git a/source/common/acgetline.c b/source/common/acgetline.c
index dfc065389..a28aaf78d 100644
--- a/source/common/acgetline.c
+++ b/source/common/acgetline.c
@@ -119,8 +119,6 @@
#include "acparser.h"
#include "acdebug.h"
-#include <stdio.h>
-
/*
* This is an os-independent implementation of line-editing services needed
* by the AcpiExec utility. It uses getchar() and putchar() and the existing
diff --git a/source/common/cmfsize.c b/source/common/cmfsize.c
index accdf225b..2139e4b26 100644
--- a/source/common/cmfsize.c
+++ b/source/common/cmfsize.c
@@ -116,7 +116,6 @@
#include "acpi.h"
#include "accommon.h"
#include "acapps.h"
-#include <stdio.h>
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("cmfsize")
@@ -146,19 +145,19 @@ CmGetFileSize (
/* Save the current file pointer, seek to EOF to obtain file size */
- CurrentOffset = AcpiOsGetFileOffset (File);
+ CurrentOffset = ftell (File);
if (CurrentOffset < 0)
{
goto OffsetError;
}
- Status = AcpiOsSetFileOffset (File, 0, ACPI_FILE_END);
+ Status = fseek (File, 0, SEEK_END);
if (ACPI_FAILURE (Status))
{
goto SeekError;
}
- FileSize = AcpiOsGetFileOffset (File);
+ FileSize = ftell (File);
if (FileSize < 0)
{
goto OffsetError;
@@ -166,7 +165,7 @@ CmGetFileSize (
/* Restore original file pointer */
- Status = AcpiOsSetFileOffset (File, CurrentOffset, ACPI_FILE_BEGIN);
+ Status = fseek (File, CurrentOffset, SEEK_SET);
if (ACPI_FAILURE (Status))
{
goto SeekError;
@@ -176,10 +175,10 @@ CmGetFileSize (
OffsetError:
- AcpiLogError ("Could not get file offset");
+ fprintf (stderr, "Could not get file offset\n");
return (ACPI_UINT32_MAX);
SeekError:
- AcpiLogError ("Could not set file offset");
+ fprintf (stderr, "Could not set file offset\n");
return (ACPI_UINT32_MAX);
}
diff --git a/source/common/getopt.c b/source/common/getopt.c
index 07e98a92e..d309789c3 100644
--- a/source/common/getopt.c
+++ b/source/common/getopt.c
@@ -129,7 +129,7 @@
#include "acapps.h"
#define ACPI_OPTION_ERROR(msg, badchar) \
- if (AcpiGbl_Opterr) {AcpiLogError ("%s%c\n", msg, badchar);}
+ if (AcpiGbl_Opterr) {fprintf (stderr, "%s%c\n", msg, badchar);}
int AcpiGbl_Opterr = 1;
diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c
index d7942b745..78e06eb86 100644
--- a/source/components/debugger/dbfileio.c
+++ b/source/components/debugger/dbfileio.c
@@ -118,7 +118,6 @@
#include "accommon.h"
#include "acdebug.h"
#include "actables.h"
-#include <stdio.h>
#ifdef ACPI_APPLICATION
#include "acapps.h"
#endif
diff --git a/source/components/utilities/utbuffer.c b/source/components/utilities/utbuffer.c
index 4a50e9e06..fe5c7d505 100644
--- a/source/components/utilities/utbuffer.c
+++ b/source/components/utilities/utbuffer.c
@@ -336,7 +336,7 @@ AcpiUtDumpBufferToFile (
if (!Buffer)
{
- AcpiUtFilePrintf (File, "Null Buffer Pointer in DumpBuffer!\n");
+ fprintf (File, "Null Buffer Pointer in DumpBuffer!\n");
return;
}
@@ -351,7 +351,7 @@ AcpiUtDumpBufferToFile (
{
/* Print current offset */
- AcpiUtFilePrintf (File, "%6.4X: ", (BaseOffset + i));
+ fprintf (File, "%6.4X: ", (BaseOffset + i));
/* Print 16 hex chars */
@@ -361,7 +361,7 @@ AcpiUtDumpBufferToFile (
{
/* Dump fill spaces */
- AcpiUtFilePrintf (File, "%*s", ((Display * 2) + 1), " ");
+ fprintf (File, "%*s", ((Display * 2) + 1), " ");
j += Display;
continue;
}
@@ -371,28 +371,28 @@ AcpiUtDumpBufferToFile (
case DB_BYTE_DISPLAY:
default: /* Default is BYTE display */
- AcpiUtFilePrintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]);
+ fprintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]);
break;
case DB_WORD_DISPLAY:
ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
- AcpiUtFilePrintf (File, "%04X ", Temp32);
+ fprintf (File, "%04X ", Temp32);
break;
case DB_DWORD_DISPLAY:
ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
- AcpiUtFilePrintf (File, "%08X ", Temp32);
+ fprintf (File, "%08X ", Temp32);
break;
case DB_QWORD_DISPLAY:
ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
- AcpiUtFilePrintf (File, "%08X", Temp32);
+ fprintf (File, "%08X", Temp32);
ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]);
- AcpiUtFilePrintf (File, "%08X ", Temp32);
+ fprintf (File, "%08X ", Temp32);
break;
}
@@ -403,29 +403,29 @@ AcpiUtDumpBufferToFile (
* Print the ASCII equivalent characters but watch out for the bad
* unprintable ones (printable chars are 0x20 through 0x7E)
*/
- AcpiUtFilePrintf (File, " ");
+ fprintf (File, " ");
for (j = 0; j < 16; j++)
{
if (i + j >= Count)
{
- AcpiUtFilePrintf (File, "\n");
+ fprintf (File, "\n");
return;
}
BufChar = Buffer[(ACPI_SIZE) i + j];
if (isprint (BufChar))
{
- AcpiUtFilePrintf (File, "%c", BufChar);
+ fprintf (File, "%c", BufChar);
}
else
{
- AcpiUtFilePrintf (File, ".");
+ fprintf (File, ".");
}
}
/* Done with that line. */
- AcpiUtFilePrintf (File, "\n");
+ fprintf (File, "\n");
i += 16;
}
diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c
index 26fbaf958..2f4f4ffdb 100644
--- a/source/components/utilities/utclib.c
+++ b/source/components/utilities/utclib.c
@@ -163,7 +163,7 @@
ACPI_MODULE_NAME ("utclib")
-#ifndef ACPI_USE_SYSTEM_CLIBRARY /* Entire module */
+#if defined(ACPI_USE_SYSTEM_CLIBRARY) && !defined(ACPI_USE_STANDARD_HEADERS)
/*******************************************************************************
@@ -201,6 +201,61 @@ memcmp (
/*******************************************************************************
*
+ * FUNCTION: memmove
+ *
+ * PARAMETERS: Dest - Target of the copy
+ * Src - Source buffer to copy
+ * Count - Number of bytes to copy
+ *
+ * RETURN: Dest
+ *
+ * DESCRIPTION: Copy arbitrary bytes of memory with respect to the overlapping
+ *
+ ******************************************************************************/
+
+void *
+memmove (
+ void *Dest,
+ const void *Src,
+ ACPI_SIZE Count)
+{
+ char *New = (char *) Dest;
+ char *Old = (char *) Src;
+
+
+ if (Old > New)
+ {
+ /* Copy from the beginning */
+
+ while (Count)
+ {
+ *New = *Old;
+ New++;
+ Old++;
+ Count--;
+ }
+ }
+ else if (Old < New)
+ {
+ /* Copy from the end */
+
+ New = New + Count - 1;
+ Old = Old + Count - 1;
+ while (Count)
+ {
+ *New = *Old;
+ New--;
+ Old--;
+ Count--;
+ }
+ }
+
+ return (Dest);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: memcpy
*
* PARAMETERS: Dest - Target of the copy
@@ -303,6 +358,93 @@ strlen (
/*******************************************************************************
*
+ * FUNCTION: strpbrk
+ *
+ * PARAMETERS: String - Null terminated string
+ * Delimiters - Delimiters to match
+ *
+ * RETURN: The first occurance in the string of any of the bytes in the
+ * delimiters
+ *
+ * DESCRIPTION: Search a string for any of a set of the delimiters
+ *
+ ******************************************************************************/
+
+char *
+strpbrk (
+ const char *String,
+ const char *Delimiters)
+{
+ const char *Delimiter;
+
+
+ for ( ; *String != '\0'; ++String)
+ {
+ for (Delimiter = Delimiters; *Delimiter != '\0'; Delimiter++)
+ {
+ if (*String == *Delimiter)
+ {
+ return (ACPI_CAST_PTR (char, String));
+ }
+ }
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strtok
+ *
+ * PARAMETERS: String - Null terminated string
+ * Delimiters - Delimiters to match
+ *
+ * RETURN: Pointer to the next token
+ *
+ * DESCRIPTION: Split string into tokens
+ *
+ ******************************************************************************/
+
+char*
+strtok (
+ char *String,
+ const char *Delimiters)
+{
+ char *Begin = String;
+ static char *SavedPtr;
+
+
+ if (Begin == NULL)
+ {
+ if (SavedPtr == NULL)
+ {
+ return (NULL);
+ }
+ Begin = SavedPtr;
+ }
+
+ SavedPtr = strpbrk (Begin, Delimiters);
+ while (SavedPtr == Begin)
+ {
+ *Begin++ = '\0';
+ SavedPtr = strpbrk (Begin, Delimiters);
+ }
+
+ if (SavedPtr)
+ {
+ *SavedPtr++ = '\0';
+ return (Begin);
+ }
+ else
+ {
+ return (NULL);
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: strcpy
*
* PARAMETERS: DstString - Target of the copy
@@ -987,4 +1129,4 @@ const UINT8 AcpiGbl_Ctypes[257] = {
};
-#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+#endif /* ACPI_USE_SYSTEM_CLIBRARY && !ACPI_USE_STANDARD_HEADERS */
diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c
index 4d2b306a0..995d45cc3 100644
--- a/source/components/utilities/utdebug.c
+++ b/source/components/utilities/utdebug.c
@@ -780,33 +780,3 @@ AcpiTracePoint (
ACPI_EXPORT_SYMBOL (AcpiTracePoint)
#endif
-
-
-#ifdef ACPI_APPLICATION
-/*******************************************************************************
- *
- * FUNCTION: AcpiLogError
- *
- * PARAMETERS: Format - Printf format field
- * ... - Optional printf arguments
- *
- * RETURN: None
- *
- * DESCRIPTION: Print error message to the console, used by applications.
- *
- ******************************************************************************/
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiLogError (
- const char *Format,
- ...)
-{
- va_list Args;
-
- va_start (Args, Format);
- (void) AcpiUtFileVprintf (ACPI_FILE_ERR, Format, Args);
- va_end (Args);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiLogError)
-#endif
diff --git a/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c
index 01196bb03..a97064c7a 100644
--- a/source/components/utilities/utpredef.c
+++ b/source/components/utilities/utpredef.c
@@ -268,8 +268,6 @@ AcpiUtGetExpectedReturnTypes (
******************************************************************************/
#if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
-#include <stdio.h>
-#include <string.h>
/* Local prototypes */
diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c
index 5ca859ec4..ee52453fd 100644
--- a/source/components/utilities/utprint.c
+++ b/source/components/utilities/utprint.c
@@ -120,6 +120,8 @@
ACPI_MODULE_NAME ("utprint")
+#if defined(ACPI_USE_SYSTEM_CLIBRARY) && !defined(ACPI_USE_STANDARD_HEADERS)
+
#define ACPI_FORMAT_SIGN 0x01
#define ACPI_FORMAT_SIGN_PLUS 0x02
#define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04
@@ -488,7 +490,7 @@ AcpiUtFormatNumber (
/*******************************************************************************
*
- * FUNCTION: AcpiUtVsnprintf
+ * FUNCTION: vsnprintf
*
* PARAMETERS: String - String with boundary
* Size - Boundary of the string
@@ -502,7 +504,7 @@ AcpiUtFormatNumber (
******************************************************************************/
int
-AcpiUtVsnprintf (
+vsnprintf (
char *String,
ACPI_SIZE Size,
const char *Format,
@@ -785,7 +787,7 @@ AcpiUtVsnprintf (
/*******************************************************************************
*
- * FUNCTION: AcpiUtSnprintf
+ * FUNCTION: snprintf
*
* PARAMETERS: String - String with boundary
* Size - Boundary of the string
@@ -798,7 +800,7 @@ AcpiUtVsnprintf (
******************************************************************************/
int
-AcpiUtSnprintf (
+snprintf (
char *String,
ACPI_SIZE Size,
const char *Format,
@@ -809,7 +811,38 @@ AcpiUtSnprintf (
va_start (Args, Format);
- Length = AcpiUtVsnprintf (String, Size, Format, Args);
+ Length = vsnprintf (String, Size, Format, Args);
+ va_end (Args);
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: sprintf
+ *
+ * PARAMETERS: String - String with boundary
+ * Format, ... - Standard printf format
+ *
+ * RETURN: Number of bytes actually written.
+ *
+ * DESCRIPTION: Formatted output to a string.
+ *
+ ******************************************************************************/
+
+int
+sprintf (
+ char *String,
+ const char *Format,
+ ...)
+{
+ va_list Args;
+ int Length;
+
+
+ va_start (Args, Format);
+ Length = vsnprintf (String, ACPI_UINT32_MAX, Format, Args);
va_end (Args);
return (Length);
@@ -819,7 +852,69 @@ AcpiUtSnprintf (
#ifdef ACPI_APPLICATION
/*******************************************************************************
*
- * FUNCTION: AcpiUtFileVprintf
+ * FUNCTION: vprintf
+ *
+ * PARAMETERS: Format - Standard printf format
+ * Args - Argument list
+ *
+ * RETURN: Number of bytes actually written.
+ *
+ * DESCRIPTION: Formatted output to stdout using argument list pointer.
+ *
+ ******************************************************************************/
+
+int
+vprintf (
+ const char *Format,
+ va_list Args)
+{
+ ACPI_CPU_FLAGS Flags;
+ int Length;
+
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock);
+ Length = vsnprintf (AcpiGbl_PrintBuffer,
+ sizeof (AcpiGbl_PrintBuffer), Format, Args);
+
+ (void) fwrite (AcpiGbl_PrintBuffer, Length, 1, ACPI_FILE_OUT);
+ AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags);
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: printf
+ *
+ * PARAMETERS: Format, ... - Standard printf format
+ *
+ * RETURN: Number of bytes actually written.
+ *
+ * DESCRIPTION: Formatted output to stdout.
+ *
+ ******************************************************************************/
+
+int
+printf (
+ const char *Format,
+ ...)
+{
+ va_list Args;
+ int Length;
+
+
+ va_start (Args, Format);
+ Length = vprintf (Format, Args);
+ va_end (Args);
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: vfprintf
*
* PARAMETERS: File - File descriptor
* Format - Standard printf format
@@ -832,8 +927,8 @@ AcpiUtSnprintf (
******************************************************************************/
int
-AcpiUtFileVprintf (
- ACPI_FILE File,
+vfprintf (
+ FILE *File,
const char *Format,
va_list Args)
{
@@ -842,10 +937,10 @@ AcpiUtFileVprintf (
Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock);
- Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer,
+ Length = vsnprintf (AcpiGbl_PrintBuffer,
sizeof (AcpiGbl_PrintBuffer), Format, Args);
- (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1);
+ (void) fwrite (AcpiGbl_PrintBuffer, Length, 1, File);
AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags);
return (Length);
@@ -854,7 +949,7 @@ AcpiUtFileVprintf (
/*******************************************************************************
*
- * FUNCTION: AcpiUtFilePrintf
+ * FUNCTION: fprintf
*
* PARAMETERS: File - File descriptor
* Format, ... - Standard printf format
@@ -866,8 +961,8 @@ AcpiUtFileVprintf (
******************************************************************************/
int
-AcpiUtFilePrintf (
- ACPI_FILE File,
+fprintf (
+ FILE *File,
const char *Format,
...)
{
@@ -876,9 +971,10 @@ AcpiUtFilePrintf (
va_start (Args, Format);
- Length = AcpiUtFileVprintf (File, Format, Args);
+ Length = vfprintf (File, Format, Args);
va_end (Args);
return (Length);
}
#endif
+#endif /* ACPI_USE_SYSTEM_CLIBRARY && !ACPI_USE_STANDARD_HEADERS */
diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c
index c6a26d992..66834ac77 100644
--- a/source/components/utilities/utxfinit.c
+++ b/source/components/utilities/utxfinit.c
@@ -126,9 +126,11 @@
ACPI_MODULE_NAME ("utxfinit")
/* For AcpiExec only */
+#ifndef ACPI_DISABLE_OBJECT_OVERRIDE
void
AeDoObjectOverrides (
void);
+#endif
/*******************************************************************************
@@ -346,12 +348,14 @@ AcpiInitializeObjects (
#ifdef ACPI_EXEC_APP
+#ifndef ACPI_DISABLE_OBJECT_OVERRIDE
/*
* This call implements the "initialization file" option for AcpiExec.
* This is the precise point that we want to perform the overrides.
*/
AeDoObjectOverrides ();
#endif
+#endif
/*
* Execute any module-level code that was detected during the table load
diff --git a/source/include/acapps.h b/source/include/acapps.h
index b8ab5a3c6..f8b7bd0b3 100644
--- a/source/include/acapps.h
+++ b/source/include/acapps.h
@@ -116,12 +116,6 @@
#ifndef _ACAPPS
#define _ACAPPS
-#include <stdio.h>
-
-#ifdef _MSC_VER /* disable some level-4 warnings */
-#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
-#endif
-
/* Common info for tool signons */
#define ACPICA_NAME "Intel ACPI Component Architecture"
@@ -157,13 +151,13 @@
/* Macros for usage messages */
#define ACPI_USAGE_HEADER(Usage) \
- AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage);
+ printf ("Usage: %s\nOptions:\n", Usage);
#define ACPI_USAGE_TEXT(Description) \
- AcpiOsPrintf (Description);
+ printf (Description);
#define ACPI_OPTION(Name, Description) \
- AcpiOsPrintf (" %-20s%s\n", Name, Description);
+ printf (" %-20s%s\n", Name, Description);
/* Check for unexpected exceptions */
diff --git a/source/include/acclib.h b/source/include/acclib.h
index 267c73d25..bf32373dc 100644
--- a/source/include/acclib.h
+++ b/source/include/acclib.h
@@ -145,6 +145,23 @@ extern const UINT8 AcpiGbl_Ctypes[];
#define isprint(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
#define isalpha(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
+/* Error code */
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define EBADF 9 /* Bad file number */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define ENODEV 19 /* No such device */
+#define EINVAL 22 /* Invalid argument */
+#define EPIPE 32 /* Broken pipe */
+#define ERANGE 34 /* Math result not representable */
/* Strings */
@@ -159,6 +176,16 @@ strchr (
int ch);
char *
+strpbrk (
+ const char *String,
+ const char *Delimiters);
+
+char *
+strtok (
+ char *String,
+ const char *Delimiters);
+
+char *
strcpy (
char *DstString,
const char *SrcString);
@@ -220,6 +247,12 @@ memcpy (
ACPI_SIZE Count);
void *
+memmove (
+ void *Dest,
+ const void *Src,
+ ACPI_SIZE Count);
+
+void *
memset (
void *Dest,
int Value,
@@ -236,4 +269,127 @@ int
toupper (
int c);
+/*
+ * utprint - printf/vprintf output functions
+ */
+const char *
+AcpiUtScanNumber (
+ const char *String,
+ UINT64 *NumberPtr);
+
+const char *
+AcpiUtPrintNumber (
+ char *String,
+ UINT64 Number);
+
+int
+vsnprintf (
+ char *String,
+ ACPI_SIZE Size,
+ const char *Format,
+ va_list Args);
+
+int
+snprintf (
+ char *String,
+ ACPI_SIZE Size,
+ const char *Format,
+ ...);
+
+int
+sprintf (
+ char *String,
+ const char *Format,
+ ...);
+
+#ifdef ACPI_APPLICATION
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+/*
+ * NOTE: Currently we only need to update errno for file IOs. Other
+ * Clibrary invocations in ACPICA do not make descisions according to
+ * the errno.
+ */
+extern int errno;
+
+#ifndef EOF
+#define EOF (-1)
+#endif
+
+#define putchar(c) fputc(stdout, c)
+#define getchar(c) fgetc(stdin)
+
+int
+vprintf (
+ const char *Format,
+ va_list Args);
+
+int
+printf (
+ const char *Format,
+ ...);
+
+int
+vfprintf (
+ FILE *File,
+ const char *Format,
+ va_list Args);
+
+int
+fprintf (
+ FILE *File,
+ const char *Format,
+ ...);
+
+FILE *
+fopen (
+ const char *Path,
+ const char *Modes);
+
+void
+fclose (
+ FILE *File);
+
+int
+fread (
+ void *Buffer,
+ ACPI_SIZE Size,
+ ACPI_SIZE Count,
+ FILE *File);
+
+int
+fwrite (
+ void *Buffer,
+ ACPI_SIZE Size,
+ ACPI_SIZE Count,
+ FILE *File);
+
+int
+fseek (
+ FILE *File,
+ long Offset,
+ int From);
+
+long
+ftell (
+ FILE *File);
+
+int
+fgetc (
+ FILE *File);
+
+int
+fputc (
+ FILE *File,
+ char c);
+
+char *
+fgets (
+ char *s,
+ ACPI_SIZE Size,
+ FILE *File);
+#endif
+
#endif /* _ACCLIB_H */
diff --git a/source/include/accommon.h b/source/include/accommon.h
index 76f76d62f..7e398b590 100644
--- a/source/include/accommon.h
+++ b/source/include/accommon.h
@@ -131,9 +131,9 @@
#include "acglobal.h" /* All global variables */
#include "achware.h" /* Hardware defines and interfaces */
#include "acutils.h" /* Utility interfaces */
-#ifndef ACPI_USE_SYSTEM_CLIBRARY
+#if defined(ACPI_USE_SYSTEM_CLIBRARY) && !defined(ACPI_USE_STANDARD_HEADERS)
#include "acclib.h" /* C library interfaces */
-#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
+#endif /* ACPI_USE_SYSTEM_CLIBRARY && !ACPI_USE_STANDARD_HEADERS */
#endif /* __ACCOMMON_H__ */
diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h
index 550e264bd..60d61f119 100644
--- a/source/include/acpiosxf.h
+++ b/source/include/acpiosxf.h
@@ -564,6 +564,15 @@ AcpiOsGetLine (
UINT32 *BytesRead);
#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint
+void
+AcpiOsTracePoint (
+ ACPI_TRACE_EVENT_TYPE Type,
+ BOOLEAN Begin,
+ UINT8 *Aml,
+ char *Pathname);
+#endif
+
/*
* Obtain ACPI table(s)
@@ -624,62 +633,4 @@ AcpiOsCloseDirectory (
#endif
-/*
- * File I/O and related support
- */
-#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenFile
-ACPI_FILE
-AcpiOsOpenFile (
- const char *Path,
- UINT8 Modes);
-#endif
-
-#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseFile
-void
-AcpiOsCloseFile (
- ACPI_FILE File);
-#endif
-
-#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadFile
-int
-AcpiOsReadFile (
- ACPI_FILE File,
- void *Buffer,
- ACPI_SIZE Size,
- ACPI_SIZE Count);
-#endif
-
-#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteFile
-int
-AcpiOsWriteFile (
- ACPI_FILE File,
- void *Buffer,
- ACPI_SIZE Size,
- ACPI_SIZE Count);
-#endif
-
-#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetFileOffset
-long
-AcpiOsGetFileOffset (
- ACPI_FILE File);
-#endif
-
-#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSetFileOffset
-ACPI_STATUS
-AcpiOsSetFileOffset (
- ACPI_FILE File,
- long Offset,
- UINT8 From);
-#endif
-
-#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint
-void
-AcpiOsTracePoint (
- ACPI_TRACE_EVENT_TYPE Type,
- BOOLEAN Begin,
- UINT8 *Aml,
- char *Pathname);
-#endif
-
-
#endif /* __ACPIOSXF_H__ */
diff --git a/source/include/acpixf.h b/source/include/acpixf.h
index 2f939b1f5..a641c4e2c 100644
--- a/source/include/acpixf.h
+++ b/source/include/acpixf.h
@@ -357,6 +357,8 @@ ACPI_GLOBAL (ACPI_TABLE_FADT, AcpiGbl_FADT);
ACPI_GLOBAL (UINT32, AcpiCurrentGpeCount);
ACPI_GLOBAL (BOOLEAN, AcpiGbl_SystemAwakeAndRunning);
+ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugTimeout, FALSE);
+
/*****************************************************************************
*
@@ -1304,13 +1306,6 @@ AcpiTracePoint (
UINT8 *Aml,
char *Pathname))
-ACPI_APP_DEPENDENT_RETURN_VOID (
-ACPI_PRINTF_LIKE(1)
-void ACPI_INTERNAL_VAR_XFACE
-AcpiLogError (
- const char *Format,
- ...))
-
ACPI_STATUS
AcpiInitializeDebugger (
void);
diff --git a/source/include/actypes.h b/source/include/actypes.h
index 039d71a5a..abc4f7b4c 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -1459,16 +1459,6 @@ typedef enum
#define ACPI_OSI_WIN_10 0x0D
-/* Definitions of file IO */
-
-#define ACPI_FILE_READING 0x01
-#define ACPI_FILE_WRITING 0x02
-#define ACPI_FILE_BINARY 0x04
-
-#define ACPI_FILE_BEGIN 0x01
-#define ACPI_FILE_END 0x02
-
-
/* Definitions of getopt */
#define ACPI_OPT_END -1
diff --git a/source/include/acutils.h b/source/include/acutils.h
index 3fdca4599..358d1c8b7 100644
--- a/source/include/acutils.h
+++ b/source/include/acutils.h
@@ -1140,48 +1140,6 @@ AcpiAhMatchUuid (
/*
- * utprint - printf/vprintf output functions
- */
-const char *
-AcpiUtScanNumber (
- const char *String,
- UINT64 *NumberPtr);
-
-const char *
-AcpiUtPrintNumber (
- char *String,
- UINT64 Number);
-
-int
-AcpiUtVsnprintf (
- char *String,
- ACPI_SIZE Size,
- const char *Format,
- va_list Args);
-
-int
-AcpiUtSnprintf (
- char *String,
- ACPI_SIZE Size,
- const char *Format,
- ...);
-
-#ifdef ACPI_APPLICATION
-int
-AcpiUtFileVprintf (
- ACPI_FILE File,
- const char *Format,
- va_list Args);
-
-int
-AcpiUtFilePrintf (
- ACPI_FILE File,
- const char *Format,
- ...);
-#endif
-
-
-/*
* utuuid -- UUID support functions
*/
#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP)
diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h
index a252b2cd9..4de3607b8 100644
--- a/source/include/platform/acefi.h
+++ b/source/include/platform/acefi.h
@@ -116,10 +116,12 @@
#ifndef __ACEFI_H__
#define __ACEFI_H__
-#include <stdarg.h>
-#if defined(_GNU_EFI)
-#include <stdint.h>
-#include <unistd.h>
+#ifdef __GNUC__
+#include "acgcc.h"
+#endif
+
+#ifdef _MSC_VER
+#include "acmsvc.h"
#endif
#if defined(__x86_64__)
@@ -129,23 +131,13 @@
#endif
#ifdef _MSC_EXTENSIONS
-#define EFIAPI __cdecl
+#define ACPI_EFI_API __cdecl
#elif USE_MS_ABI
-#define EFIAPI __attribute__((ms_abi))
+#define ACPI_EFI_API __attribute__((ms_abi))
#else
-#define EFIAPI
+#define ACPI_EFI_API
#endif
-typedef uint8_t UINT8;
-typedef uint16_t UINT16;
-typedef int16_t INT16;
-typedef uint32_t UINT32;
-typedef int32_t INT32;
-typedef uint64_t UINT64;
-typedef int64_t INT64;
-typedef uint8_t BOOLEAN;
-typedef uint16_t CHAR16;
-
#define VOID void
#if defined(__ia64__) || defined(__x86_64__)
@@ -166,23 +158,24 @@ typedef uint16_t CHAR16;
#endif
-typedef uint64_t UINTN;
-typedef int64_t INTN;
+#define UINTN uint64_t
+#define INTN int64_t
-#define EFIERR(a) (0x8000000000000000 | a)
+#define ACPI_EFI_ERR(a) (0x8000000000000000 | a)
#else
#define ACPI_MACHINE_WIDTH 32
#define ACPI_USE_NATIVE_DIVIDE
-typedef uint32_t UINTN;
-typedef int32_t INTN;
+#define UINTN uint32_t
+#define INTN int32_t
-#define EFIERR(a) (0x80000000 | a)
+#define ACPI_EFI_ERR(a) (0x80000000 | a)
#endif
+#define CHAR16 uint16_t
#ifdef USE_EFI_FUNCTION_WRAPPER
#define __VA_NARG__(...) \
@@ -269,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)
@@ -302,14 +305,21 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
#if defined(_GNU_EFI)
-/* Using GCC for GNU EFI */
+#ifdef DEBUGGER_THREADING
+#undef DEBUGGER_THREADING
+#endif /* DEBUGGER_THREADING */
-#include "acgcc.h"
+#define DEBUGGER_THREADING 0 /* integrated with DDB */
-#undef ACPI_USE_SYSTEM_CLIBRARY
#undef ACPI_USE_STANDARD_HEADERS
#undef ACPI_USE_NATIVE_DIVIDE
-#define ACPI_USE_SYSTEM_INTTYPES
+#undef ACPI_USE_SYSTEM_INTTYPES
+
+/* AcpiExec configuration */
+
+#ifdef ACPI_EXEC_APP
+#define ACPI_DISABLE_OBJECT_OVERRIDE
+#endif
/*
* Math helpers
@@ -330,18 +340,23 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
#endif
-struct _SIMPLE_TEXT_OUTPUT_INTERFACE;
-struct _SIMPLE_INPUT_INTERFACE;
-struct _EFI_FILE_IO_INTERFACE;
-struct _EFI_FILE_HANDLE;
-struct _EFI_BOOT_SERVICES;
-struct _EFI_SYSTEM_TABLE;
+struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE;
+struct _ACPI_SIMPLE_INPUT_INTERFACE;
+struct _ACPI_EFI_FILE_IO_INTERFACE;
+struct _ACPI_EFI_FILE_HANDLE;
+struct _ACPI_EFI_BOOT_SERVICES;
+struct _ACPI_EFI_RUNTIME_SERVICES;
+struct _ACPI_EFI_SYSTEM_TABLE;
+
+extern struct _ACPI_EFI_SYSTEM_TABLE *ST;
+extern struct _ACPI_EFI_BOOT_SERVICES *BS;
+extern struct _ACPI_EFI_RUNTIME_SERVICES *RT;
-extern struct _EFI_SYSTEM_TABLE *ST;
-extern struct _EFI_BOOT_SERVICES *BS;
+typedef union acpi_efi_file ACPI_EFI_FILE;
-#define ACPI_FILE struct _SIMPLE_TEXT_OUTPUT_INTERFACE *
-#define ACPI_FILE_OUT ST->ConOut
-#define ACPI_FILE_ERR ST->ConOut
+#define FILE ACPI_EFI_FILE
+#define stdout ((FILE *) (ST)->ConOut)
+#define stderr ((FILE *) (ST)->ConOut)
+#define stdin ((FILE *) (ST)->ConIn)
#endif /* __ACEFI_H__ */
diff --git a/source/include/platform/acefiex.h b/source/include/platform/acefiex.h
index 1fc58f752..aecb38e6c 100644
--- a/source/include/platform/acefiex.h
+++ b/source/include/platform/acefiex.h
@@ -117,177 +117,191 @@
#define __ACEFIEX_H__
-#define EFI_ERROR(a) (((INTN) a) < 0)
-#define EFI_SUCCESS 0
-#define EFI_LOAD_ERROR EFIERR(1)
-#define EFI_INVALID_PARAMETER EFIERR(2)
-#define EFI_UNSUPPORTED EFIERR(3)
-#define EFI_BAD_BUFFER_SIZE EFIERR(4)
-#define EFI_BUFFER_TOO_SMALL EFIERR(5)
-#define EFI_NOT_READY EFIERR(6)
-#define EFI_DEVICE_ERROR EFIERR(7)
-#define EFI_WRITE_PROTECTED EFIERR(8)
-#define EFI_OUT_OF_RESOURCES EFIERR(9)
-#define EFI_VOLUME_CORRUPTED EFIERR(10)
-#define EFI_VOLUME_FULL EFIERR(11)
-#define EFI_NO_MEDIA EFIERR(12)
-#define EFI_MEDIA_CHANGED EFIERR(13)
-#define EFI_NOT_FOUND EFIERR(14)
-#define EFI_ACCESS_DENIED EFIERR(15)
-#define EFI_NO_RESPONSE EFIERR(16)
-#define EFI_NO_MAPPING EFIERR(17)
-#define EFI_TIMEOUT EFIERR(18)
-#define EFI_NOT_STARTED EFIERR(19)
-#define EFI_ALREADY_STARTED EFIERR(20)
-#define EFI_ABORTED EFIERR(21)
-#define EFI_PROTOCOL_ERROR EFIERR(24)
-
-
-typedef UINTN EFI_STATUS;
-typedef VOID *EFI_HANDLE;
-typedef VOID *EFI_EVENT;
+#define ACPI_EFI_ERROR(a) (((INTN) a) < 0)
+#define ACPI_EFI_SUCCESS 0
+#define ACPI_EFI_LOAD_ERROR ACPI_EFI_ERR(1)
+#define ACPI_EFI_INVALID_PARAMETER ACPI_EFI_ERR(2)
+#define ACPI_EFI_UNSUPPORTED ACPI_EFI_ERR(3)
+#define ACPI_EFI_BAD_BUFFER_SIZE ACPI_EFI_ERR(4)
+#define ACPI_EFI_BUFFER_TOO_SMALL ACPI_EFI_ERR(5)
+#define ACPI_EFI_NOT_READY ACPI_EFI_ERR(6)
+#define ACPI_EFI_DEVICE_ERROR ACPI_EFI_ERR(7)
+#define ACPI_EFI_WRITE_PROTECTED ACPI_EFI_ERR(8)
+#define ACPI_EFI_OUT_OF_RESOURCES ACPI_EFI_ERR(9)
+#define ACPI_EFI_VOLUME_CORRUPTED ACPI_EFI_ERR(10)
+#define ACPI_EFI_VOLUME_FULL ACPI_EFI_ERR(11)
+#define ACPI_EFI_NO_MEDIA ACPI_EFI_ERR(12)
+#define ACPI_EFI_MEDIA_CHANGED ACPI_EFI_ERR(13)
+#define ACPI_EFI_NOT_FOUND ACPI_EFI_ERR(14)
+#define ACPI_EFI_ACCESS_DENIED ACPI_EFI_ERR(15)
+#define ACPI_EFI_NO_RESPONSE ACPI_EFI_ERR(16)
+#define ACPI_EFI_NO_MAPPING ACPI_EFI_ERR(17)
+#define ACPI_EFI_TIMEOUT ACPI_EFI_ERR(18)
+#define ACPI_EFI_NOT_STARTED ACPI_EFI_ERR(19)
+#define ACPI_EFI_ALREADY_STARTED ACPI_EFI_ERR(20)
+#define ACPI_EFI_ABORTED ACPI_EFI_ERR(21)
+#define ACPI_EFI_PROTOCOL_ERROR ACPI_EFI_ERR(24)
+
+
+typedef UINTN ACPI_EFI_STATUS;
+typedef VOID *ACPI_EFI_HANDLE;
+typedef VOID *ACPI_EFI_EVENT;
typedef struct {
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
UINT8 Data4[8];
-} EFI_GUID;
+} ACPI_EFI_GUID;
-typedef struct _EFI_DEVICE_PATH {
+typedef struct {
+ UINT16 Year; /* 1998 - 20XX */
+ UINT8 Month; /* 1 - 12 */
+ UINT8 Day; /* 1 - 31 */
+ UINT8 Hour; /* 0 - 23 */
+ UINT8 Minute; /* 0 - 59 */
+ UINT8 Second; /* 0 - 59 */
+ UINT8 Pad1;
+ UINT32 Nanosecond; /* 0 - 999,999,999 */
+ INT16 TimeZone; /* -1440 to 1440 or 2047 */
+ UINT8 Daylight;
+ UINT8 Pad2;
+} ACPI_EFI_TIME;
+
+typedef struct _ACPI_EFI_DEVICE_PATH {
UINT8 Type;
UINT8 SubType;
UINT8 Length[2];
-} EFI_DEVICE_PATH;
+} ACPI_EFI_DEVICE_PATH;
-typedef UINT64 EFI_PHYSICAL_ADDRESS;
-typedef UINT64 EFI_VIRTUAL_ADDRESS;
+typedef UINT64 ACPI_EFI_PHYSICAL_ADDRESS;
+typedef UINT64 ACPI_EFI_VIRTUAL_ADDRESS;
typedef enum {
- AllocateAnyPages,
- AllocateMaxAddress,
- AllocateAddress,
- MaxAllocateType
-} EFI_ALLOCATE_TYPE;
+ AcpiEfiAllocateAnyPages,
+ AcpiEfiAllocateMaxAddress,
+ AcpiEfiAllocateAddress,
+ AcpiEfiMaxAllocateType
+} ACPI_EFI_ALLOCATE_TYPE;
typedef enum {
- EfiReservedMemoryType,
- EfiLoaderCode,
- EfiLoaderData,
- EfiBootServicesCode,
- EfiBootServicesData,
- EfiRuntimeServicesCode,
- EfiRuntimeServicesData,
- EfiConventionalMemory,
- EfiUnusableMemory,
- EfiACPIReclaimMemory,
- EfiACPIMemoryNVS,
- EfiMemoryMappedIO,
- EfiMemoryMappedIOPortSpace,
- EfiPalCode,
- EfiMaxMemoryType
-} EFI_MEMORY_TYPE;
+ AcpiEfiReservedMemoryType,
+ AcpiEfiLoaderCode,
+ AcpiEfiLoaderData,
+ AcpiEfiBootServicesCode,
+ AcpiEfiBootServicesData,
+ AcpiEfiRuntimeServicesCode,
+ AcpiEfiRuntimeServicesData,
+ AcpiEfiConventionalMemory,
+ AcpiEfiUnusableMemory,
+ AcpiEfiACPIReclaimMemory,
+ AcpiEfiACPIMemoryNVS,
+ AcpiEfiMemoryMappedIO,
+ AcpiEfiMemoryMappedIOPortSpace,
+ AcpiEfiPalCode,
+ AcpiEfiMaxMemoryType
+} ACPI_EFI_MEMORY_TYPE;
/* possible caching types for the memory range */
-#define EFI_MEMORY_UC 0x0000000000000001
-#define EFI_MEMORY_WC 0x0000000000000002
-#define EFI_MEMORY_WT 0x0000000000000004
-#define EFI_MEMORY_WB 0x0000000000000008
-#define EFI_MEMORY_UCE 0x0000000000000010
+#define ACPI_EFI_MEMORY_UC 0x0000000000000001
+#define ACPI_EFI_MEMORY_WC 0x0000000000000002
+#define ACPI_EFI_MEMORY_WT 0x0000000000000004
+#define ACPI_EFI_MEMORY_WB 0x0000000000000008
+#define ACPI_EFI_MEMORY_UCE 0x0000000000000010
/* physical memory protection on range */
-#define EFI_MEMORY_WP 0x0000000000001000
-#define EFI_MEMORY_RP 0x0000000000002000
-#define EFI_MEMORY_XP 0x0000000000004000
+#define ACPI_EFI_MEMORY_WP 0x0000000000001000
+#define ACPI_EFI_MEMORY_RP 0x0000000000002000
+#define ACPI_EFI_MEMORY_XP 0x0000000000004000
/* range requires a runtime mapping */
-#define EFI_MEMORY_RUNTIME 0x8000000000000000
+#define ACPI_EFI_MEMORY_RUNTIME 0x8000000000000000
-#define EFI_MEMORY_DESCRIPTOR_VERSION 1
+#define ACPI_EFI_MEMORY_DESCRIPTOR_VERSION 1
typedef struct {
UINT32 Type;
UINT32 Pad;
- EFI_PHYSICAL_ADDRESS PhysicalStart;
- EFI_VIRTUAL_ADDRESS VirtualStart;
+ ACPI_EFI_PHYSICAL_ADDRESS PhysicalStart;
+ ACPI_EFI_VIRTUAL_ADDRESS VirtualStart;
UINT64 NumberOfPages;
UINT64 Attribute;
-} EFI_MEMORY_DESCRIPTOR;
+} ACPI_EFI_MEMORY_DESCRIPTOR;
-typedef struct _EFI_TABLE_HEARDER {
+typedef struct _ACPI_EFI_TABLE_HEARDER {
UINT64 Signature;
UINT32 Revision;
UINT32 HeaderSize;
UINT32 CRC32;
UINT32 Reserved;
-} EFI_TABLE_HEADER;
+} ACPI_EFI_TABLE_HEADER;
typedef
-EFI_STATUS
-(EFIAPI *EFI_UNKNOWN_INTERFACE) (
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_UNKNOWN_INTERFACE) (
void);
/*
* Text output protocol
*/
-#define SIMPLE_TEXT_OUTPUT_PROTOCOL \
+#define ACPI_SIMPLE_TEXT_OUTPUT_PROTOCOL \
{ 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_RESET) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
- BOOLEAN ExtendedVerification);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_RESET) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This,
+ BOOLEAN ExtendedVerification);
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_OUTPUT_STRING) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
- CHAR16 *String);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_OUTPUT_STRING) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This,
+ CHAR16 *String);
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_TEST_STRING) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
- CHAR16 *String);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_TEST_STRING) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This,
+ CHAR16 *String);
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_QUERY_MODE) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
- UINTN ModeNumber,
- UINTN *Columns,
- UINTN *Rows);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_QUERY_MODE) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This,
+ UINTN ModeNumber,
+ UINTN *Columns,
+ UINTN *Rows);
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_SET_MODE) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
- UINTN ModeNumber);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_SET_MODE) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This,
+ UINTN ModeNumber);
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
- UINTN Attribute);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_SET_ATTRIBUTE) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This,
+ UINTN Attribute);
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_CLEAR_SCREEN) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_CLEAR_SCREEN) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This);
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
- UINTN Column,
- UINTN Row);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_SET_CURSOR_POSITION) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This,
+ UINTN Column,
+ UINTN Row);
typedef
-EFI_STATUS
-(EFIAPI *EFI_TEXT_ENABLE_CURSOR) (
- struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
- BOOLEAN Enable);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_TEXT_ENABLE_CURSOR) (
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This,
+ BOOLEAN Enable);
typedef struct {
INT32 MaxMode;
@@ -296,35 +310,35 @@ typedef struct {
INT32 CursorColumn;
INT32 CursorRow;
BOOLEAN CursorVisible;
-} SIMPLE_TEXT_OUTPUT_MODE;
+} ACPI_SIMPLE_TEXT_OUTPUT_MODE;
-typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE {
- EFI_TEXT_RESET Reset;
+typedef struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE {
+ ACPI_EFI_TEXT_RESET Reset;
- EFI_TEXT_OUTPUT_STRING OutputString;
- EFI_TEXT_TEST_STRING TestString;
+ ACPI_EFI_TEXT_OUTPUT_STRING OutputString;
+ ACPI_EFI_TEXT_TEST_STRING TestString;
- EFI_TEXT_QUERY_MODE QueryMode;
- EFI_TEXT_SET_MODE SetMode;
- EFI_TEXT_SET_ATTRIBUTE SetAttribute;
+ ACPI_EFI_TEXT_QUERY_MODE QueryMode;
+ ACPI_EFI_TEXT_SET_MODE SetMode;
+ ACPI_EFI_TEXT_SET_ATTRIBUTE SetAttribute;
- EFI_TEXT_CLEAR_SCREEN ClearScreen;
- EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
- EFI_TEXT_ENABLE_CURSOR EnableCursor;
+ ACPI_EFI_TEXT_CLEAR_SCREEN ClearScreen;
+ ACPI_EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
+ ACPI_EFI_TEXT_ENABLE_CURSOR EnableCursor;
- SIMPLE_TEXT_OUTPUT_MODE *Mode;
-} SIMPLE_TEXT_OUTPUT_INTERFACE;
+ ACPI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
+} ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE;
/*
* Text input protocol
*/
-#define SIMPLE_TEXT_INPUT_PROTOCOL \
+#define ACPI_SIMPLE_TEXT_INPUT_PROTOCOL \
{ 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
typedef struct {
UINT16 ScanCode;
CHAR16 UnicodeChar;
-} EFI_INPUT_KEY;
+} ACPI_EFI_INPUT_KEY;
/*
* Baseline unicode control chars
@@ -336,411 +350,463 @@ typedef struct {
#define CHAR_CARRIAGE_RETURN 0x000D
typedef
-EFI_STATUS
-(EFIAPI *EFI_INPUT_RESET) (
- struct _SIMPLE_INPUT_INTERFACE *This,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_INPUT_RESET) (
+ struct _ACPI_SIMPLE_INPUT_INTERFACE *This,
BOOLEAN ExtendedVerification);
typedef
-EFI_STATUS
-(EFIAPI *EFI_INPUT_READ_KEY) (
- struct _SIMPLE_INPUT_INTERFACE *This,
- EFI_INPUT_KEY *Key);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_INPUT_READ_KEY) (
+ struct _ACPI_SIMPLE_INPUT_INTERFACE *This,
+ ACPI_EFI_INPUT_KEY *Key);
-typedef struct _SIMPLE_INPUT_INTERFACE {
- EFI_INPUT_RESET Reset;
- EFI_INPUT_READ_KEY ReadKeyStroke;
- EFI_EVENT WaitForKey;
-} SIMPLE_INPUT_INTERFACE;
+typedef struct _ACPI_SIMPLE_INPUT_INTERFACE {
+ ACPI_EFI_INPUT_RESET Reset;
+ ACPI_EFI_INPUT_READ_KEY ReadKeyStroke;
+ ACPI_EFI_EVENT WaitForKey;
+} ACPI_SIMPLE_INPUT_INTERFACE;
/*
* Simple file system protocol
*/
-#define SIMPLE_FILE_SYSTEM_PROTOCOL \
+#define ACPI_SIMPLE_FILE_SYSTEM_PROTOCOL \
{ 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
typedef
-EFI_STATUS
-(EFIAPI *EFI_VOLUME_OPEN) (
- struct _EFI_FILE_IO_INTERFACE *This,
- struct _EFI_FILE_HANDLE **Root);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_VOLUME_OPEN) (
+ struct _ACPI_EFI_FILE_IO_INTERFACE *This,
+ struct _ACPI_EFI_FILE_HANDLE **Root);
-#define EFI_FILE_IO_INTERFACE_REVISION 0x00010000
+#define ACPI_EFI_FILE_IO_INTERFACE_REVISION 0x00010000
-typedef struct _EFI_FILE_IO_INTERFACE {
+typedef struct _ACPI_EFI_FILE_IO_INTERFACE {
UINT64 Revision;
- EFI_VOLUME_OPEN OpenVolume;
-} EFI_FILE_IO_INTERFACE;
+ ACPI_EFI_VOLUME_OPEN OpenVolume;
+} ACPI_EFI_FILE_IO_INTERFACE;
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_OPEN) (
- struct _EFI_FILE_HANDLE *File,
- struct _EFI_FILE_HANDLE **NewHandle,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_OPEN) (
+ struct _ACPI_EFI_FILE_HANDLE *File,
+ struct _ACPI_EFI_FILE_HANDLE **NewHandle,
CHAR16 *FileName,
UINT64 OpenMode,
UINT64 Attributes);
/* Values for OpenMode used above */
-#define EFI_FILE_MODE_READ 0x0000000000000001
-#define EFI_FILE_MODE_WRITE 0x0000000000000002
-#define EFI_FILE_MODE_CREATE 0x8000000000000000
+#define ACPI_EFI_FILE_MODE_READ 0x0000000000000001
+#define ACPI_EFI_FILE_MODE_WRITE 0x0000000000000002
+#define ACPI_EFI_FILE_MODE_CREATE 0x8000000000000000
/* Values for Attribute used above */
-#define EFI_FILE_READ_ONLY 0x0000000000000001
-#define EFI_FILE_HIDDEN 0x0000000000000002
-#define EFI_FILE_SYSTEM 0x0000000000000004
-#define EFI_FILE_RESERVIED 0x0000000000000008
-#define EFI_FILE_DIRECTORY 0x0000000000000010
-#define EFI_FILE_ARCHIVE 0x0000000000000020
-#define EFI_FILE_VALID_ATTR 0x0000000000000037
+#define ACPI_EFI_FILE_READ_ONLY 0x0000000000000001
+#define ACPI_EFI_FILE_HIDDEN 0x0000000000000002
+#define ACPI_EFI_FILE_SYSTEM 0x0000000000000004
+#define ACPI_EFI_FILE_RESERVIED 0x0000000000000008
+#define ACPI_EFI_FILE_DIRECTORY 0x0000000000000010
+#define ACPI_EFI_FILE_ARCHIVE 0x0000000000000020
+#define ACPI_EFI_FILE_VALID_ATTR 0x0000000000000037
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_CLOSE) (
- struct _EFI_FILE_HANDLE *File);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_CLOSE) (
+ struct _ACPI_EFI_FILE_HANDLE *File);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_DELETE) (
- struct _EFI_FILE_HANDLE *File);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_DELETE) (
+ struct _ACPI_EFI_FILE_HANDLE *File);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_READ) (
- struct _EFI_FILE_HANDLE *File,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_READ) (
+ struct _ACPI_EFI_FILE_HANDLE *File,
UINTN *BufferSize,
VOID *Buffer);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_WRITE) (
- struct _EFI_FILE_HANDLE *File,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_WRITE) (
+ struct _ACPI_EFI_FILE_HANDLE *File,
UINTN *BufferSize,
VOID *Buffer);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_SET_POSITION) (
- struct _EFI_FILE_HANDLE *File,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_SET_POSITION) (
+ struct _ACPI_EFI_FILE_HANDLE *File,
UINT64 Position);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_GET_POSITION) (
- struct _EFI_FILE_HANDLE *File,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_GET_POSITION) (
+ struct _ACPI_EFI_FILE_HANDLE *File,
UINT64 *Position);
+#define ACPI_EFI_FILE_INFO_ID \
+ { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
+
+typedef struct {
+ UINT64 Size;
+ UINT64 FileSize;
+ UINT64 PhysicalSize;
+ ACPI_EFI_TIME CreateTime;
+ ACPI_EFI_TIME LastAccessTime;
+ ACPI_EFI_TIME ModificationTime;
+ UINT64 Attribute;
+ CHAR16 FileName[1];
+} ACPI_EFI_FILE_INFO;
+
+#define ACPI_EFI_FILE_INFO_SIZE \
+ ACPI_OFFSET(ACPI_EFI_FILE_INFO, FileName)
+
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_GET_INFO) (
- struct _EFI_FILE_HANDLE *File,
- EFI_GUID *InformationType,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_GET_INFO) (
+ struct _ACPI_EFI_FILE_HANDLE *File,
+ ACPI_EFI_GUID *InformationType,
UINTN *BufferSize,
VOID *Buffer);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_SET_INFO) (
- struct _EFI_FILE_HANDLE *File,
- EFI_GUID *InformationType,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_SET_INFO) (
+ struct _ACPI_EFI_FILE_HANDLE *File,
+ ACPI_EFI_GUID *InformationType,
UINTN BufferSize,
VOID *Buffer);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FILE_FLUSH) (
- struct _EFI_FILE_HANDLE *File);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FILE_FLUSH) (
+ struct _ACPI_EFI_FILE_HANDLE *File);
-#define EFI_FILE_HANDLE_REVISION 0x00010000
+#define ACPI_EFI_FILE_HANDLE_REVISION 0x00010000
-typedef struct _EFI_FILE_HANDLE {
- UINT64 Revision;
- EFI_FILE_OPEN Open;
- EFI_FILE_CLOSE Close;
- EFI_FILE_DELETE Delete;
- EFI_FILE_READ Read;
- EFI_FILE_WRITE Write;
- EFI_FILE_GET_POSITION GetPosition;
- EFI_FILE_SET_POSITION SetPosition;
- EFI_FILE_GET_INFO GetInfo;
- EFI_FILE_SET_INFO SetInfo;
- EFI_FILE_FLUSH Flush;
-} EFI_FILE, *EFI_FILE_HANDLE;
+typedef struct _ACPI_EFI_FILE_HANDLE {
+ UINT64 Revision;
+ ACPI_EFI_FILE_OPEN Open;
+ ACPI_EFI_FILE_CLOSE Close;
+ ACPI_EFI_FILE_DELETE Delete;
+ ACPI_EFI_FILE_READ Read;
+ ACPI_EFI_FILE_WRITE Write;
+ ACPI_EFI_FILE_GET_POSITION GetPosition;
+ ACPI_EFI_FILE_SET_POSITION SetPosition;
+ ACPI_EFI_FILE_GET_INFO GetInfo;
+ ACPI_EFI_FILE_SET_INFO SetInfo;
+ ACPI_EFI_FILE_FLUSH Flush;
+} ACPI_EFI_FILE_STRUCT, *ACPI_EFI_FILE_HANDLE;
/*
* Loaded image protocol
*/
-#define LOADED_IMAGE_PROTOCOL \
+#define ACPI_EFI_LOADED_IMAGE_PROTOCOL \
{ 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
typedef
-EFI_STATUS
-(EFIAPI *EFI_IMAGE_ENTRY_POINT) (
- EFI_HANDLE ImageHandle,
- struct _EFI_SYSTEM_TABLE *SystemTable);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_IMAGE_ENTRY_POINT) (
+ ACPI_EFI_HANDLE ImageHandle,
+ struct _ACPI_EFI_SYSTEM_TABLE *SystemTable);
typedef
-EFI_STATUS
-(EFIAPI *EFI_IMAGE_LOAD) (
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_IMAGE_LOAD) (
BOOLEAN BootPolicy,
- EFI_HANDLE ParentImageHandle,
- EFI_DEVICE_PATH *FilePath,
+ ACPI_EFI_HANDLE ParentImageHandle,
+ ACPI_EFI_DEVICE_PATH *FilePath,
VOID *SourceBuffer,
UINTN SourceSize,
- EFI_HANDLE *ImageHandle);
+ ACPI_EFI_HANDLE *ImageHandle);
typedef
-EFI_STATUS
-(EFIAPI *EFI_IMAGE_START) (
- EFI_HANDLE ImageHandle,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_IMAGE_START) (
+ ACPI_EFI_HANDLE ImageHandle,
UINTN *ExitDataSize,
CHAR16 **ExitData);
typedef
-EFI_STATUS
-(EFIAPI *EFI_EXIT) (
- EFI_HANDLE ImageHandle,
- EFI_STATUS ExitStatus,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_EXIT) (
+ ACPI_EFI_HANDLE ImageHandle,
+ ACPI_EFI_STATUS ExitStatus,
UINTN ExitDataSize,
CHAR16 *ExitData);
typedef
-EFI_STATUS
-(EFIAPI *EFI_IMAGE_UNLOAD) (
- EFI_HANDLE ImageHandle);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_IMAGE_UNLOAD) (
+ ACPI_EFI_HANDLE ImageHandle);
+
+
+typedef
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_STALL) (
+ UINTN Microseconds);
+
+typedef
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_SET_WATCHDOG_TIMER) (
+ UINTN Timeout,
+ UINT64 WatchdogCode,
+ UINTN DataSize,
+ CHAR16 *WatchdogData);
#define EFI_IMAGE_INFORMATION_REVISION 0x1000
typedef struct {
UINT32 Revision;
- EFI_HANDLE ParentHandle;
- struct _EFI_SYSTEM_TABLE *SystemTable;
- EFI_HANDLE DeviceHandle;
- EFI_DEVICE_PATH *FilePath;
+ ACPI_EFI_HANDLE ParentHandle;
+ struct _ACPI_EFI_SYSTEM_TABLE *SystemTable;
+ ACPI_EFI_HANDLE DeviceHandle;
+ ACPI_EFI_DEVICE_PATH *FilePath;
VOID *Reserved;
UINT32 LoadOptionsSize;
VOID *LoadOptions;
VOID *ImageBase;
UINT64 ImageSize;
- EFI_MEMORY_TYPE ImageCodeType;
- EFI_MEMORY_TYPE ImageDataType;
- EFI_IMAGE_UNLOAD Unload;
+ ACPI_EFI_MEMORY_TYPE ImageCodeType;
+ ACPI_EFI_MEMORY_TYPE ImageDataType;
+ ACPI_EFI_IMAGE_UNLOAD Unload;
-} EFI_LOADED_IMAGE;
+} ACPI_EFI_LOADED_IMAGE;
/*
* EFI Memory
*/
typedef
-EFI_STATUS
-(EFIAPI *EFI_ALLOCATE_PAGES) (
- EFI_ALLOCATE_TYPE Type,
- EFI_MEMORY_TYPE MemoryType,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_ALLOCATE_PAGES) (
+ ACPI_EFI_ALLOCATE_TYPE Type,
+ ACPI_EFI_MEMORY_TYPE MemoryType,
UINTN NoPages,
- EFI_PHYSICAL_ADDRESS *Memory);
+ ACPI_EFI_PHYSICAL_ADDRESS *Memory);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FREE_PAGES) (
- EFI_PHYSICAL_ADDRESS Memory,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FREE_PAGES) (
+ ACPI_EFI_PHYSICAL_ADDRESS Memory,
UINTN NoPages);
typedef
-EFI_STATUS
-(EFIAPI *EFI_GET_MEMORY_MAP) (
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_GET_MEMORY_MAP) (
UINTN *MemoryMapSize,
- EFI_MEMORY_DESCRIPTOR *MemoryMap,
+ ACPI_EFI_MEMORY_DESCRIPTOR *MemoryMap,
UINTN *MapKey,
UINTN *DescriptorSize,
UINT32 *DescriptorVersion);
-#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
+#define NextMemoryDescriptor(Ptr,Size) ((ACPI_EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
typedef
-EFI_STATUS
-(EFIAPI *EFI_ALLOCATE_POOL) (
- EFI_MEMORY_TYPE PoolType,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_ALLOCATE_POOL) (
+ ACPI_EFI_MEMORY_TYPE PoolType,
UINTN Size,
VOID **Buffer);
typedef
-EFI_STATUS
-(EFIAPI *EFI_FREE_POOL) (
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_FREE_POOL) (
VOID *Buffer);
/*
+ * EFI Time
+ */
+typedef struct {
+ UINT32 Resolution;
+ UINT32 Accuracy;
+ BOOLEAN SetsToZero;
+} ACPI_EFI_TIME_CAPABILITIES;
+
+typedef
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_GET_TIME) (
+ ACPI_EFI_TIME *Time,
+ ACPI_EFI_TIME_CAPABILITIES *Capabilities);
+
+typedef
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_SET_TIME) (
+ ACPI_EFI_TIME *Time);
+
+
+/*
* Protocol handler functions
*/
typedef enum {
- EFI_NATIVE_INTERFACE,
- EFI_PCODE_INTERFACE
-} EFI_INTERFACE_TYPE;
+ ACPI_EFI_NATIVE_INTERFACE,
+ ACPI_EFI_PCODE_INTERFACE
+} ACPI_EFI_INTERFACE_TYPE;
typedef enum {
- AllHandles,
- ByRegisterNotify,
- ByProtocol
-} EFI_LOCATE_SEARCH_TYPE;
+ AcpiEfiAllHandles,
+ AcpiEfiByRegisterNotify,
+ AcpiEfiByProtocol
+} ACPI_EFI_LOCATE_SEARCH_TYPE;
typedef
-EFI_STATUS
-(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
- EFI_HANDLE *Handle,
- EFI_GUID *Protocol,
- EFI_INTERFACE_TYPE InterfaceType,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_INSTALL_PROTOCOL_INTERFACE) (
+ ACPI_EFI_HANDLE *Handle,
+ ACPI_EFI_GUID *Protocol,
+ ACPI_EFI_INTERFACE_TYPE InterfaceType,
VOID *Interface);
typedef
-EFI_STATUS
-(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
- EFI_HANDLE Handle,
- EFI_GUID *Protocol,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE) (
+ ACPI_EFI_HANDLE Handle,
+ ACPI_EFI_GUID *Protocol,
VOID *OldInterface,
VOID *NewInterface);
typedef
-EFI_STATUS
-(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
- EFI_HANDLE Handle,
- EFI_GUID *Protocol,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE) (
+ ACPI_EFI_HANDLE Handle,
+ ACPI_EFI_GUID *Protocol,
VOID *Interface);
typedef
-EFI_STATUS
-(EFIAPI *EFI_HANDLE_PROTOCOL) (
- EFI_HANDLE Handle,
- EFI_GUID *Protocol,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_HANDLE_PROTOCOL) (
+ ACPI_EFI_HANDLE Handle,
+ ACPI_EFI_GUID *Protocol,
VOID **Interface);
typedef
-EFI_STATUS
-(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
- EFI_GUID *Protocol,
- EFI_EVENT Event,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_REGISTER_PROTOCOL_NOTIFY) (
+ ACPI_EFI_GUID *Protocol,
+ ACPI_EFI_EVENT Event,
VOID **Registration);
typedef
-EFI_STATUS
-(EFIAPI *EFI_LOCATE_HANDLE) (
- EFI_LOCATE_SEARCH_TYPE SearchType,
- EFI_GUID *Protocol,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE) (
+ ACPI_EFI_LOCATE_SEARCH_TYPE SearchType,
+ ACPI_EFI_GUID *Protocol,
VOID *SearchKey,
UINTN *BufferSize,
- EFI_HANDLE *Buffer);
+ ACPI_EFI_HANDLE *Buffer);
typedef
-EFI_STATUS
-(EFIAPI *EFI_LOCATE_DEVICE_PATH) (
- EFI_GUID *Protocol,
- EFI_DEVICE_PATH **DevicePath,
- EFI_HANDLE *Device);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_LOCATE_DEVICE_PATH) (
+ ACPI_EFI_GUID *Protocol,
+ ACPI_EFI_DEVICE_PATH **DevicePath,
+ ACPI_EFI_HANDLE *Device);
typedef
-EFI_STATUS
-(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
- EFI_GUID *Guid,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_INSTALL_CONFIGURATION_TABLE) (
+ ACPI_EFI_GUID *Guid,
VOID *Table);
-#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
-#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
-#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
-#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
-#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
-#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
+#define ACPI_EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
+#define ACPI_EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
+#define ACPI_EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
+#define ACPI_EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
+#define ACPI_EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
+#define ACPI_EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
typedef
-EFI_STATUS
-(EFIAPI *EFI_OPEN_PROTOCOL) (
- EFI_HANDLE Handle,
- EFI_GUID *Protocol,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL) (
+ ACPI_EFI_HANDLE Handle,
+ ACPI_EFI_GUID *Protocol,
VOID **Interface,
- EFI_HANDLE AgentHandle,
- EFI_HANDLE ControllerHandle,
+ ACPI_EFI_HANDLE AgentHandle,
+ ACPI_EFI_HANDLE ControllerHandle,
UINT32 Attributes);
typedef
-EFI_STATUS
-(EFIAPI *EFI_CLOSE_PROTOCOL) (
- EFI_HANDLE Handle,
- EFI_GUID *Protocol,
- EFI_HANDLE AgentHandle,
- EFI_HANDLE ControllerHandle);
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_CLOSE_PROTOCOL) (
+ ACPI_EFI_HANDLE Handle,
+ ACPI_EFI_GUID *Protocol,
+ ACPI_EFI_HANDLE AgentHandle,
+ ACPI_EFI_HANDLE ControllerHandle);
typedef struct {
- EFI_HANDLE AgentHandle;
- EFI_HANDLE ControllerHandle;
- UINT32 Attributes;
- UINT32 OpenCount;
-} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
- EFI_HANDLE Handle,
- EFI_GUID *Protocol,
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
+ ACPI_EFI_HANDLE AgentHandle;
+ ACPI_EFI_HANDLE ControllerHandle;
+ UINT32 Attributes;
+ UINT32 OpenCount;
+} ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
+
+typedef
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL_INFORMATION) (
+ ACPI_EFI_HANDLE Handle,
+ ACPI_EFI_GUID *Protocol,
+ ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
UINTN *EntryCount);
typedef
-EFI_STATUS
-(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
- EFI_HANDLE Handle,
- EFI_GUID ***ProtocolBuffer,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_PROTOCOLS_PER_HANDLE) (
+ ACPI_EFI_HANDLE Handle,
+ ACPI_EFI_GUID ***ProtocolBuffer,
UINTN *ProtocolBufferCount);
typedef
-EFI_STATUS
-(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
- EFI_LOCATE_SEARCH_TYPE SearchType,
- EFI_GUID *Protocol,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE_BUFFER) (
+ ACPI_EFI_LOCATE_SEARCH_TYPE SearchType,
+ ACPI_EFI_GUID *Protocol,
VOID *SearchKey,
UINTN *NoHandles,
- EFI_HANDLE **Buffer);
+ ACPI_EFI_HANDLE **Buffer);
typedef
-EFI_STATUS
-(EFIAPI *EFI_LOCATE_PROTOCOL) (
- EFI_GUID *Protocol,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_LOCATE_PROTOCOL) (
+ ACPI_EFI_GUID *Protocol,
VOID *Registration,
VOID **Interface);
typedef
-EFI_STATUS
-(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
- EFI_HANDLE *Handle,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
+ ACPI_EFI_HANDLE *Handle,
...);
typedef
-EFI_STATUS
-(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
- EFI_HANDLE Handle,
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
+ ACPI_EFI_HANDLE Handle,
...);
typedef
-EFI_STATUS
-(EFIAPI *EFI_CALCULATE_CRC32) (
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_CALCULATE_CRC32) (
VOID *Data,
UINTN DataSize,
UINT32 *Crc32);
typedef
VOID
-(EFIAPI *EFI_COPY_MEM) (
+(ACPI_EFI_API *ACPI_EFI_COPY_MEM) (
VOID *Destination,
VOID *Source,
UINTN Length);
typedef
VOID
-(EFIAPI *EFI_SET_MEM) (
+(ACPI_EFI_API *ACPI_EFI_SET_MEM) (
VOID *Buffer,
UINTN Size,
UINT8 Value);
@@ -748,97 +814,143 @@ VOID
/*
* EFI Boot Services Table
*/
-#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
-#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
+#define ACPI_EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
+#define ACPI_EFI_BOOT_SERVICES_REVISION (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION)
-typedef struct _EFI_BOOT_SERVICES {
- EFI_TABLE_HEADER Hdr;
+typedef struct _ACPI_EFI_BOOT_SERVICES {
+ ACPI_EFI_TABLE_HEADER Hdr;
#if 0
- EFI_RAISE_TPL RaiseTPL;
- EFI_RESTORE_TPL RestoreTPL;
+ ACPI_EFI_RAISE_TPL RaiseTPL;
+ ACPI_EFI_RESTORE_TPL RestoreTPL;
#else
- EFI_UNKNOWN_INTERFACE RaiseTPL;
- EFI_UNKNOWN_INTERFACE RestoreTPL;
+ ACPI_EFI_UNKNOWN_INTERFACE RaiseTPL;
+ ACPI_EFI_UNKNOWN_INTERFACE RestoreTPL;
#endif
- EFI_ALLOCATE_PAGES AllocatePages;
- EFI_FREE_PAGES FreePages;
- EFI_GET_MEMORY_MAP GetMemoryMap;
- EFI_ALLOCATE_POOL AllocatePool;
- EFI_FREE_POOL FreePool;
+ ACPI_EFI_ALLOCATE_PAGES AllocatePages;
+ ACPI_EFI_FREE_PAGES FreePages;
+ ACPI_EFI_GET_MEMORY_MAP GetMemoryMap;
+ ACPI_EFI_ALLOCATE_POOL AllocatePool;
+ ACPI_EFI_FREE_POOL FreePool;
#if 0
- EFI_CREATE_EVENT CreateEvent;
- EFI_SET_TIMER SetTimer;
- EFI_WAIT_FOR_EVENT WaitForEvent;
- EFI_SIGNAL_EVENT SignalEvent;
- EFI_CLOSE_EVENT CloseEvent;
- EFI_CHECK_EVENT CheckEvent;
+ ACPI_EFI_CREATE_EVENT CreateEvent;
+ ACPI_EFI_SET_TIMER SetTimer;
+ ACPI_EFI_WAIT_FOR_EVENT WaitForEvent;
+ ACPI_EFI_SIGNAL_EVENT SignalEvent;
+ ACPI_EFI_CLOSE_EVENT CloseEvent;
+ ACPI_EFI_CHECK_EVENT CheckEvent;
#else
- EFI_UNKNOWN_INTERFACE CreateEvent;
- EFI_UNKNOWN_INTERFACE SetTimer;
- EFI_UNKNOWN_INTERFACE WaitForEvent;
- EFI_UNKNOWN_INTERFACE SignalEvent;
- EFI_UNKNOWN_INTERFACE CloseEvent;
- EFI_UNKNOWN_INTERFACE CheckEvent;
+ ACPI_EFI_UNKNOWN_INTERFACE CreateEvent;
+ ACPI_EFI_UNKNOWN_INTERFACE SetTimer;
+ ACPI_EFI_UNKNOWN_INTERFACE WaitForEvent;
+ ACPI_EFI_UNKNOWN_INTERFACE SignalEvent;
+ ACPI_EFI_UNKNOWN_INTERFACE CloseEvent;
+ ACPI_EFI_UNKNOWN_INTERFACE CheckEvent;
#endif
- EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
- EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
- EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
- EFI_HANDLE_PROTOCOL HandleProtocol;
- EFI_HANDLE_PROTOCOL PCHandleProtocol;
- EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
- EFI_LOCATE_HANDLE LocateHandle;
- EFI_LOCATE_DEVICE_PATH LocateDevicePath;
- EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
-
- EFI_IMAGE_LOAD LoadImage;
- EFI_IMAGE_START StartImage;
- EFI_EXIT Exit;
- EFI_IMAGE_UNLOAD UnloadImage;
+ ACPI_EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
+ ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
+ ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
+ ACPI_EFI_HANDLE_PROTOCOL HandleProtocol;
+ ACPI_EFI_HANDLE_PROTOCOL PCHandleProtocol;
+ ACPI_EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
+ ACPI_EFI_LOCATE_HANDLE LocateHandle;
+ ACPI_EFI_LOCATE_DEVICE_PATH LocateDevicePath;
+ ACPI_EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
+
+ ACPI_EFI_IMAGE_LOAD LoadImage;
+ ACPI_EFI_IMAGE_START StartImage;
+ ACPI_EFI_EXIT Exit;
+ ACPI_EFI_IMAGE_UNLOAD UnloadImage;
#if 0
- EFI_EXIT_BOOT_SERVICES ExitBootServices;
- EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
- EFI_STALL Stall;
- EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
+ ACPI_EFI_EXIT_BOOT_SERVICES ExitBootServices;
+ ACPI_EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
#else
- EFI_UNKNOWN_INTERFACE ExitBootServices;
- EFI_UNKNOWN_INTERFACE GetNextMonotonicCount;
- EFI_UNKNOWN_INTERFACE Stall;
- EFI_UNKNOWN_INTERFACE SetWatchdogTimer;
+ ACPI_EFI_UNKNOWN_INTERFACE ExitBootServices;
+ ACPI_EFI_UNKNOWN_INTERFACE GetNextMonotonicCount;
#endif
+ ACPI_EFI_STALL Stall;
+ ACPI_EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
#if 0
- EFI_CONNECT_CONTROLLER ConnectController;
- EFI_DISCONNECT_CONTROLLER DisconnectController;
+ ACPI_EFI_CONNECT_CONTROLLER ConnectController;
+ ACPI_EFI_DISCONNECT_CONTROLLER DisconnectController;
#else
- EFI_UNKNOWN_INTERFACE ConnectController;
- EFI_UNKNOWN_INTERFACE DisconnectController;
+ ACPI_EFI_UNKNOWN_INTERFACE ConnectController;
+ ACPI_EFI_UNKNOWN_INTERFACE DisconnectController;
#endif
- EFI_OPEN_PROTOCOL OpenProtocol;
- EFI_CLOSE_PROTOCOL CloseProtocol;
- EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
- EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
- EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
- EFI_LOCATE_PROTOCOL LocateProtocol;
- EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
- EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
+ ACPI_EFI_OPEN_PROTOCOL OpenProtocol;
+ ACPI_EFI_CLOSE_PROTOCOL CloseProtocol;
+ ACPI_EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
+ ACPI_EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
+ ACPI_EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
+ ACPI_EFI_LOCATE_PROTOCOL LocateProtocol;
+ ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
+ ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
- EFI_CALCULATE_CRC32 CalculateCrc32;
+ ACPI_EFI_CALCULATE_CRC32 CalculateCrc32;
- EFI_COPY_MEM CopyMem;
- EFI_SET_MEM SetMem;
+ ACPI_EFI_COPY_MEM CopyMem;
+ ACPI_EFI_SET_MEM SetMem;
#if 0
- EFI_CREATE_EVENT_EX CreateEventEx;
+ ACPI_EFI_CREATE_EVENT_EX CreateEventEx;
#else
- EFI_UNKNOWN_INTERFACE CreateEventEx;
+ ACPI_EFI_UNKNOWN_INTERFACE CreateEventEx;
#endif
-} EFI_BOOT_SERVICES;
+} ACPI_EFI_BOOT_SERVICES;
+
+
+/*
+ * EFI Runtime Services Table
+ */
+#define ACPI_EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
+#define ACPI_EFI_RUNTIME_SERVICES_REVISION (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION)
+
+typedef struct _ACPI_EFI_RUNTIME_SERVICES {
+ ACPI_EFI_TABLE_HEADER Hdr;
+
+ ACPI_EFI_GET_TIME GetTime;
+ ACPI_EFI_SET_TIME SetTime;
+#if 0
+ ACPI_EFI_GET_WAKEUP_TIME GetWakeupTime;
+ ACPI_EFI_SET_WAKEUP_TIME SetWakeupTime;
+#else
+ ACPI_EFI_UNKNOWN_INTERFACE GetWakeupTime;
+ ACPI_EFI_UNKNOWN_INTERFACE SetWakeupTime;
+#endif
+
+#if 0
+ ACPI_EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
+ ACPI_EFI_CONVERT_POINTER ConvertPointer;
+#else
+ ACPI_EFI_UNKNOWN_INTERFACE SetVirtualAddressMap;
+ ACPI_EFI_UNKNOWN_INTERFACE ConvertPointer;
+#endif
+
+#if 0
+ ACPI_EFI_GET_VARIABLE GetVariable;
+ ACPI_EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
+ ACPI_EFI_SET_VARIABLE SetVariable;
+#else
+ ACPI_EFI_UNKNOWN_INTERFACE GetVariable;
+ ACPI_EFI_UNKNOWN_INTERFACE GetNextVariableName;
+ ACPI_EFI_UNKNOWN_INTERFACE SetVariable;
+#endif
+
+#if 0
+ ACPI_EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
+ ACPI_EFI_RESET_SYSTEM ResetSystem;
+#else
+ ACPI_EFI_UNKNOWN_INTERFACE GetNextHighMonotonicCount;
+ ACPI_EFI_UNKNOWN_INTERFACE ResetSystem;
+#endif
+
+} ACPI_EFI_RUNTIME_SERVICES;
/*
@@ -848,46 +960,51 @@ typedef struct _EFI_BOOT_SERVICES {
/*
* EFI Configuration Table and GUID definitions
*/
-#define ACPI_TABLE_GUID \
+#define ACPI_TABLE_GUID \
{ 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
-#define ACPI_20_TABLE_GUID \
+#define ACPI_20_TABLE_GUID \
{ 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
-typedef struct _EFI_CONFIGURATION_TABLE {
- EFI_GUID VendorGuid;
+typedef struct _ACPI_EFI_CONFIGURATION_TABLE {
+ ACPI_EFI_GUID VendorGuid;
VOID *VendorTable;
-} EFI_CONFIGURATION_TABLE;
+} ACPI_EFI_CONFIGURATION_TABLE;
-#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
-#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
+#define ACPI_EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
+#define ACPI_EFI_SYSTEM_TABLE_REVISION (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION)
-typedef struct _EFI_SYSTEM_TABLE {
- EFI_TABLE_HEADER Hdr;
+typedef struct _ACPI_EFI_SYSTEM_TABLE {
+ ACPI_EFI_TABLE_HEADER Hdr;
- CHAR16 *FirmwareVendor;
- UINT32 FirmwareRevision;
+ CHAR16 *FirmwareVendor;
+ UINT32 FirmwareRevision;
- EFI_HANDLE ConsoleInHandle;
- SIMPLE_INPUT_INTERFACE *ConIn;
+ ACPI_EFI_HANDLE ConsoleInHandle;
+ ACPI_SIMPLE_INPUT_INTERFACE *ConIn;
- EFI_HANDLE ConsoleOutHandle;
- SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut;
+ ACPI_EFI_HANDLE ConsoleOutHandle;
+ ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut;
- EFI_HANDLE StandardErrorHandle;
- SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
+ ACPI_EFI_HANDLE StandardErrorHandle;
+ ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
+
+ ACPI_EFI_RUNTIME_SERVICES *RuntimeServices;
+ ACPI_EFI_BOOT_SERVICES *BootServices;
+
+ UINTN NumberOfTableEntries;
+ ACPI_EFI_CONFIGURATION_TABLE *ConfigurationTable;
+
+} ACPI_EFI_SYSTEM_TABLE;
-#if 0
- EFI_RUNTIME_SERVICES *RuntimeServices;
-#else
- EFI_HANDLE *RuntimeServices;
-#endif
- EFI_BOOT_SERVICES *BootServices;
- UINTN NumberOfTableEntries;
- EFI_CONFIGURATION_TABLE *ConfigurationTable;
+/* FILE abstraction */
-} EFI_SYSTEM_TABLE;
+union acpi_efi_file {
+ struct _ACPI_EFI_FILE_IO_INTERFACE File;
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE ConOut;
+ struct _ACPI_SIMPLE_INPUT_INTERFACE ConIn;
+};
/* GNU EFI definitions */
@@ -906,10 +1023,10 @@ DivU64x32 (
/*
* EFI specific prototypes
*/
-EFI_STATUS
+ACPI_EFI_STATUS
efi_main (
- EFI_HANDLE Image,
- EFI_SYSTEM_TABLE *SystemTab);
+ ACPI_EFI_HANDLE Image,
+ ACPI_EFI_SYSTEM_TABLE *SystemTab);
int
acpi_main (
@@ -919,9 +1036,10 @@ acpi_main (
#endif
-extern EFI_GUID AcpiGbl_LoadedImageProtocol;
-extern EFI_GUID AcpiGbl_TextInProtocol;
-extern EFI_GUID AcpiGbl_TextOutProtocol;
-extern EFI_GUID AcpiGbl_FileSystemProtocol;
+extern ACPI_EFI_GUID AcpiGbl_LoadedImageProtocol;
+extern ACPI_EFI_GUID AcpiGbl_TextInProtocol;
+extern ACPI_EFI_GUID AcpiGbl_TextOutProtocol;
+extern ACPI_EFI_GUID AcpiGbl_FileSystemProtocol;
+extern ACPI_EFI_GUID AcpiGbl_GenericFileInfo;
#endif /* __ACEFIEX_H__ */
diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h
index 7a7245624..b5268b4e6 100644
--- a/source/include/platform/acenv.h
+++ b/source/include/platform/acenv.h
@@ -151,6 +151,7 @@
(defined ACPI_EXAMPLE_APP)
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
+#define USE_NATIVE_ALLOCATE_ZEROED
#endif
/* iASL configuration */
@@ -197,7 +198,6 @@
#ifdef ACPI_DUMP_APP
#define ACPI_USE_NATIVE_MEMORY_MAPPING
-#define USE_NATIVE_ALLOCATE_ZEROED
#endif
/* AcpiNames/Example configuration. Hardware disabled */
@@ -288,6 +288,9 @@
#elif defined(_GNU_EFI)
#include "acefi.h"
+#elif defined(_EDK2_EFI)
+#include "acefi.h"
+
#elif defined(__HAIKU__)
#include "achaiku.h"
@@ -422,12 +425,48 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#ifdef ACPI_APPLICATION
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/stat.h>
+#endif
-#endif /* ACPI_USE_STANDARD_HEADERS */
+#else /* ACPI_USE_STANDARD_HEADERS */
-/* We will be linking to the standard Clib functions */
+#ifdef ACPI_USE_COMPILER_VA
-#else
+/*
+ * We will be linking to the standard Clib functions, but stdarg.h is
+ * compiler specific, this works for linux kernel.
+ */
+#include <stdarg.h>
+
+#else /* ACPI_USE_COMPILER_VA */
+
+#ifndef va_arg
+
+#ifndef _VALIST
+#define _VALIST
+typedef char *va_list;
+#endif /* _VALIST */
+
+/* Storage alignment properties */
+
+#define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1)
+#define _ADNBND (sizeof (ACPI_NATIVE_INT) - 1)
+
+/* Variable argument list macro definitions */
+
+#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
+#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
+#define va_end(ap) (ap = (va_list) NULL)
+#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND))))
+
+#endif /* va_arg */
+
+#endif /* ACPI_USE_COMPILER_VA */
/******************************************************************************
*
@@ -435,6 +474,19 @@
*
*****************************************************************************/
+typedef signed char int8_t;
+typedef short int int16_t;
+typedef int int32_t;
+typedef unsigned char uint8_t;
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
+typedef COMPILER_DEPENDENT_INT64 int64_t;
+typedef COMPILER_DEPENDENT_UINT64 uint64_t;
+
+#endif /* ACPI_USE_STANDARD_HEADERS */
+
+#else /* ACPI_USE_SYSTEM_CLIBRARY */
+
/*
* Use local definitions of C library macros and functions. These function
* implementations may not be as efficient as an inline or assembly code
@@ -466,17 +518,16 @@ typedef char *va_list;
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
-#ifndef ACPI_FILE
#ifdef ACPI_APPLICATION
-#include <stdio.h>
#define ACPI_FILE FILE *
#define ACPI_FILE_OUT stdout
#define ACPI_FILE_ERR stderr
+#define ACPI_FILE_IN stdin
#else
#define ACPI_FILE void *
#define ACPI_FILE_OUT NULL
#define ACPI_FILE_ERR NULL
+#define ACPI_FILE_IN NULL
#endif /* ACPI_APPLICATION */
-#endif /* ACPI_FILE */
#endif /* __ACENV_H__ */
diff --git a/source/include/platform/acgcc.h b/source/include/platform/acgcc.h
index 3d36a38a3..773bd8959 100644
--- a/source/include/platform/acgcc.h
+++ b/source/include/platform/acgcc.h
@@ -116,6 +116,10 @@
#ifndef __ACGCC_H__
#define __ACGCC_H__
+/* Allow inclusion of stdarg.h */
+
+#define ACPI_USE_COMPILER_VA
+
#define ACPI_INLINE __inline__
/* Function name is used for debug output. Non-ANSI, compiler-dependent */
diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index 912773593..c948f6900 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -245,11 +245,9 @@
#else /* !__KERNEL__ */
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
#include <unistd.h>
+#define ACPI_USE_SYSTEM_CLIBRARY
+#define ACPI_USE_STANDARD_HEADERS
/* Define/disable kernel-specific declarators */
diff --git a/source/include/platform/acmsvc.h b/source/include/platform/acmsvc.h
index 133f449ef..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)
@@ -225,6 +230,10 @@
#pragma warning( disable : 4295 ) /* needed for acpredef.h array */
#endif
+#ifdef _MSC_VER /* disable some level-4 warnings */
+#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
+#endif
+
/* Debug support. */
diff --git a/source/os_specific/service_layers/oseficlib.c b/source/os_specific/service_layers/oseficlib.c
new file mode 100644
index 000000000..acc5f7b8d
--- /dev/null
+++ b/source/os_specific/service_layers/oseficlib.c
@@ -0,0 +1,1268 @@
+/******************************************************************************
+ *
+ * Module Name: oseficlib - EFI specific CLibrary interfaces
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acapps.h"
+
+#define _COMPONENT ACPI_OS_SERVICES
+ ACPI_MODULE_NAME ("oseficlib")
+
+
+/* Local definitions */
+
+#define ACPI_EFI_PRINT_LENGTH 256
+
+#define ACPI_EFI_KEY_ESC 0x0000
+#define ACPI_EFI_KEY_BACKSPACE 0x0008
+#define ACPI_EFI_KEY_ENTER 0x000D
+#define ACPI_EFI_KEY_CTRL_C 0x0003
+
+#define ACPI_EFI_ASCII_NULL 0x00
+#define ACPI_EFI_ASCII_DEL 0x7F
+#define ACPI_EFI_ASCII_ESC 0x1B
+#define ACPI_EFI_ASCII_CR '\r'
+#define ACPI_EFI_ASCII_NL '\n'
+
+
+/* Local prototypes */
+
+static int
+AcpiEfiArgify (
+ char *String,
+ int *ArgcPtr,
+ char ***ArgvPtr);
+
+static int
+AcpiEfiConvertArgcv (
+ CHAR16 *LoadOpt,
+ UINT32 LoadOptSize,
+ int *ArgcPtr,
+ char ***ArgvPtr,
+ char **BufferPtr);
+
+static int
+AcpiEfiGetFileInfo (
+ FILE *File,
+ ACPI_EFI_FILE_INFO **InfoPtr);
+
+static CHAR16 *
+AcpiEfiFlushFile (
+ FILE *File,
+ CHAR16 *Begin,
+ CHAR16 *End,
+ CHAR16 *Pos,
+ BOOLEAN FlushAll);
+
+
+/* Local variables */
+
+static ACPI_EFI_FILE_HANDLE AcpiGbl_EfiCurrentVolume = NULL;
+ACPI_EFI_GUID AcpiGbl_LoadedImageProtocol = ACPI_EFI_LOADED_IMAGE_PROTOCOL;
+ACPI_EFI_GUID AcpiGbl_TextInProtocol = ACPI_SIMPLE_TEXT_INPUT_PROTOCOL;
+ACPI_EFI_GUID AcpiGbl_TextOutProtocol = ACPI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
+ACPI_EFI_GUID AcpiGbl_FileSystemProtocol = ACPI_SIMPLE_FILE_SYSTEM_PROTOCOL;
+ACPI_EFI_GUID AcpiGbl_GenericFileInfo = ACPI_EFI_FILE_INFO_ID;
+
+int errno = 0;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: fopen
+ *
+ * PARAMETERS: Path - File path
+ * Modes - File operation type
+ *
+ * RETURN: File descriptor
+ *
+ * DESCRIPTION: Open a file for reading or/and writing.
+ *
+ ******************************************************************************/
+
+FILE *
+fopen (
+ const char *Path,
+ const char *Modes)
+{
+ ACPI_EFI_STATUS EfiStatus = ACPI_EFI_SUCCESS;
+ UINT64 OpenModes;
+ ACPI_EFI_FILE_HANDLE EfiFile = NULL;
+ CHAR16 *Path16 = NULL;
+ CHAR16 *Pos16;
+ const char *Pos;
+ INTN Count, i;
+ BOOLEAN IsAppend = FALSE;
+ FILE *File = NULL;
+
+
+ if (!Path)
+ {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ /*
+ * Convert modes, EFI says the only 2 read/write modes are read-only,
+ * read+write. Thus set default mode as read-only.
+ */
+ OpenModes = ACPI_EFI_FILE_MODE_READ;
+ switch (*Modes++)
+ {
+ case 'r':
+
+ break;
+
+ case 'w':
+
+ OpenModes |= (ACPI_EFI_FILE_MODE_WRITE | ACPI_EFI_FILE_MODE_CREATE);
+ break;
+
+ case 'a':
+
+ OpenModes |= (ACPI_EFI_FILE_MODE_WRITE | ACPI_EFI_FILE_MODE_CREATE);
+ IsAppend = TRUE;
+ break;
+
+ default:
+
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ for (; *Modes; Modes++)
+ {
+ switch (*Modes)
+ {
+ case '+':
+
+ OpenModes |= (ACPI_EFI_FILE_MODE_WRITE | ACPI_EFI_FILE_MODE_CREATE);
+ break;
+
+ case 'b':
+ case 't':
+
+ break;
+
+ case 'f':
+ default:
+
+ break;
+ }
+ }
+
+ /* Allocate path buffer */
+
+ Count = strlen (Path);
+ Path16 = ACPI_ALLOCATE_ZEROED ((Count + 1) * sizeof (CHAR16));
+ if (!Path16)
+ {
+ EfiStatus = ACPI_EFI_BAD_BUFFER_SIZE;
+ errno = ENOMEM;
+ goto ErrorExit;
+ }
+ Pos = Path;
+ Pos16 = Path16;
+ while (*Pos == '/' || *Pos == '\\')
+ {
+ Pos++;
+ Count--;
+ }
+ for (i = 0; i < Count; i++)
+ {
+ if (*Pos == '/')
+ {
+ *Pos16++ = '\\';
+ Pos++;
+ }
+ else
+ {
+ *Pos16++ = *Pos++;
+ }
+ }
+ *Pos16 = '\0';
+
+ EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Open, 5,
+ AcpiGbl_EfiCurrentVolume, &EfiFile, Path16, OpenModes, 0);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ fprintf (stderr, "EFI_FILE_HANDLE->Open() failure.\n");
+ errno = ENOENT;
+ goto ErrorExit;
+ }
+
+ File = (FILE *) EfiFile;
+ if (IsAppend)
+ {
+ fseek (File, 0, SEEK_END);
+ }
+
+ErrorExit:
+
+ if (Path16)
+ {
+ ACPI_FREE (Path16);
+ }
+
+ return (File);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: fclose
+ *
+ * PARAMETERS: File - File descriptor
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Close a file.
+ *
+ ******************************************************************************/
+
+void
+fclose (
+ FILE *File)
+{
+ ACPI_EFI_FILE_HANDLE EfiFile;
+
+
+ if (File == stdin || File == stdout ||
+ File == stderr)
+ {
+ return;
+ }
+ EfiFile = (ACPI_EFI_FILE_HANDLE) File;
+ (void) uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Close, 1, EfiFile);
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: fgetc
+ *
+ * PARAMETERS: File - File descriptor
+ *
+ * RETURN: The character read or EOF on the end of the file or error
+ *
+ * DESCRIPTION: Read a character from the file.
+ *
+ ******************************************************************************/
+
+int
+fgetc (
+ FILE *File)
+{
+ UINT8 Byte;
+ int Length;
+
+
+ Length = fread (ACPI_CAST_PTR (void, &Byte), 1, 1, File);
+ if (Length == 0)
+ {
+ Length = EOF;
+ }
+ else if (Length == 1)
+ {
+ Length = (int) Byte;
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: fputc
+ *
+ * PARAMETERS: File - File descriptor
+ * c - Character byte
+ *
+ * RETURN: The character written or EOF on the end of the file or error
+ *
+ * DESCRIPTION: Write a character to the file.
+ *
+ ******************************************************************************/
+
+int
+fputc (
+ FILE *File,
+ char c)
+{
+ UINT8 Byte = (UINT8) c;
+ int Length;
+
+
+ Length = fwrite (ACPI_CAST_PTR (void, &Byte), 1, 1, File);
+ if (Length == 0)
+ {
+ Length = EOF;
+ }
+ else if (Length == 1)
+ {
+ Length = (int) Byte;
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: fgets
+ *
+ * PARAMETERS: File - File descriptor
+ *
+ * RETURN: The string read
+ *
+ * DESCRIPTION: Read a string from the file.
+ *
+ ******************************************************************************/
+
+char *
+fgets (
+ char *s,
+ ACPI_SIZE Size,
+ FILE *File)
+{
+ ACPI_SIZE ReadBytes = 0;
+ int Ret;
+
+
+ if (Size <= 1)
+ {
+ errno = EINVAL;
+ return (NULL);
+ }
+ while (ReadBytes < (Size - 1))
+ {
+ Ret = fgetc (File);
+ if (Ret == EOF)
+ {
+ if (ReadBytes == 0)
+ {
+ return (NULL);
+ }
+ break;
+ }
+ else if (Ret < 0)
+ {
+ errno = EIO;
+ return (NULL);
+ }
+ else if (Ret == '\n')
+ {
+ s[ReadBytes++] = (char) Ret;
+ break;
+ }
+ else
+ {
+ s[ReadBytes++] = (char) Ret;
+ }
+ }
+
+ s[ReadBytes] = '\0';
+ return (s);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: fread
+ *
+ * PARAMETERS: Buffer - Data buffer
+ * Size - Data block size
+ * Count - Number of data blocks
+ * File - File descriptor
+ *
+ * RETURN: Size of successfully read buffer
+ *
+ * DESCRIPTION: Read from a file.
+ *
+ ******************************************************************************/
+
+int
+fread (
+ void *Buffer,
+ ACPI_SIZE Size,
+ ACPI_SIZE Count,
+ FILE *File)
+{
+ int Length = -EINVAL;
+ ACPI_EFI_FILE_HANDLE EfiFile;
+ ACPI_SIMPLE_INPUT_INTERFACE *In;
+ UINTN ReadSize;
+ ACPI_EFI_STATUS EfiStatus;
+ ACPI_EFI_INPUT_KEY Key;
+ ACPI_SIZE Pos = 0;
+
+
+ if (!Buffer)
+ {
+ errno = EINVAL;
+ goto ErrorExit;
+ }
+
+ ReadSize = Size * Count;
+
+ if (File == stdout || File == stderr)
+ {
+ /* Do not support read operations on output console */
+ }
+ else if (File == stdin)
+ {
+ In = ACPI_CAST_PTR (ACPI_SIMPLE_INPUT_INTERFACE, File);
+
+ while (Pos < ReadSize)
+ {
+WaitKey:
+ EfiStatus = uefi_call_wrapper (In->ReadKeyStroke, 2, In, &Key);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ if (EfiStatus == ACPI_EFI_NOT_READY)
+ {
+ goto WaitKey;
+ }
+ errno = EIO;
+ Length = -EIO;
+ fprintf (stderr,
+ "SIMPLE_INPUT_INTERFACE->ReadKeyStroke() failure.\n");
+ goto ErrorExit;
+ }
+
+ switch (Key.UnicodeChar)
+ {
+ case ACPI_EFI_KEY_CTRL_C:
+
+ break;
+
+ case ACPI_EFI_KEY_ENTER:
+
+ *(ACPI_ADD_PTR (UINT8, Buffer, Pos)) = (UINT8) ACPI_EFI_ASCII_CR;
+ if (Pos < ReadSize - 1)
+ {
+ /* Drop CR in case we don't have sufficient buffer */
+
+ Pos++;
+ }
+ *(ACPI_ADD_PTR (UINT8, Buffer, Pos)) = (UINT8) ACPI_EFI_ASCII_NL;
+ Pos++;
+ break;
+
+ case ACPI_EFI_KEY_BACKSPACE:
+
+ *(ACPI_ADD_PTR (UINT8, Buffer, Pos)) = (UINT8) ACPI_EFI_ASCII_DEL;
+ Pos++;
+ break;
+
+ case ACPI_EFI_KEY_ESC:
+
+ *(ACPI_ADD_PTR (UINT8, Buffer, Pos)) = (UINT8) ACPI_EFI_ASCII_ESC;
+ Pos++;
+ break;
+
+ default:
+
+ *(ACPI_ADD_PTR (UINT8, Buffer, Pos)) = (UINT8) Key.UnicodeChar;
+ Pos++;
+ break;
+ }
+ }
+ Length = Pos;
+ }
+ else
+ {
+ EfiFile = (ACPI_EFI_FILE_HANDLE) File;
+ if (!EfiFile)
+ {
+ errno = EINVAL;
+ goto ErrorExit;
+ }
+
+ EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Read, 3,
+ EfiFile, &ReadSize, Buffer);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ fprintf (stderr, "EFI_FILE_HANDLE->Read() failure.\n");
+ errno = EIO;
+ Length = -EIO;
+ goto ErrorExit;
+ }
+ Length = ReadSize;
+ }
+
+ErrorExit:
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEfiFlushFile
+ *
+ * PARAMETERS: File - File descriptor
+ * Begin - String with boundary
+ * End - Boundary of the string
+ * Pos - Current position
+ * FlushAll - Whether checking boundary before flushing
+ *
+ * RETURN: Updated position
+ *
+ * DESCRIPTION: Flush cached buffer to the file.
+ *
+ ******************************************************************************/
+
+static CHAR16 *
+AcpiEfiFlushFile (
+ FILE *File,
+ CHAR16 *Begin,
+ CHAR16 *End,
+ CHAR16 *Pos,
+ BOOLEAN FlushAll)
+{
+ ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *Out;
+
+
+ if (File == stdout || File == stderr)
+ {
+ Out = ACPI_CAST_PTR (ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE, File);
+
+ if (FlushAll || Pos >= (End - 1))
+ {
+ *Pos = 0;
+ uefi_call_wrapper (Out->OutputString, 2, Out, Begin);
+ Pos = Begin;
+ }
+ }
+
+ return (Pos);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: fwrite
+ *
+ * PARAMETERS: Buffer - Data buffer
+ * Size - Data block size
+ * Count - Number of data blocks
+ * File - File descriptor
+ *
+ * RETURN: Size of successfully written buffer
+ *
+ * DESCRIPTION: Write to a file.
+ *
+ ******************************************************************************/
+
+int
+fwrite (
+ void *Buffer,
+ ACPI_SIZE Size,
+ ACPI_SIZE Count,
+ FILE *File)
+{
+ int Length = -EINVAL;
+ CHAR16 String[ACPI_EFI_PRINT_LENGTH];
+ const char *Ascii;
+ CHAR16 *End;
+ CHAR16 *Pos;
+ int i, j;
+ ACPI_EFI_FILE_HANDLE EfiFile;
+ UINTN WriteSize;
+ ACPI_EFI_STATUS EfiStatus;
+
+
+ if (File == stdin)
+ {
+ /* Do not support write operations on input console */
+ }
+ else if (File == stdout || File == stderr)
+ {
+ Pos = String;
+ End = String + ACPI_EFI_PRINT_LENGTH - 1;
+ Ascii = ACPI_CAST_PTR (const char, Buffer);
+ Length = 0;
+
+ for (j = 0; j < Count; j++)
+ {
+ for (i = 0; i < Size; i++)
+ {
+ if (*Ascii == '\n')
+ {
+ *Pos++ = '\r';
+ Pos = AcpiEfiFlushFile (File, String,
+ End, Pos, FALSE);
+ }
+ *Pos++ = *Ascii++;
+ Length++;
+ Pos = AcpiEfiFlushFile (File, String,
+ End, Pos, FALSE);
+ }
+ }
+ Pos = AcpiEfiFlushFile (File, String, End, Pos, TRUE);
+ }
+ else
+ {
+ EfiFile = (ACPI_EFI_FILE_HANDLE) File;
+ if (!EfiFile)
+ {
+ errno = EINVAL;
+ goto ErrorExit;
+ }
+ WriteSize = Size * Count;
+
+ EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Write, 3,
+ EfiFile, &WriteSize, Buffer);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ fprintf (stderr, "EFI_FILE_HANDLE->Write() failure.\n");
+ errno = EIO;
+ goto ErrorExit;
+ }
+ Length = WriteSize;
+ }
+
+ErrorExit:
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEfiGetFileInfo
+ *
+ * PARAMETERS: File - File descriptor
+ * InfoPtr - Pointer to contain file information
+ *
+ * RETURN: Clibrary error code
+ *
+ * DESCRIPTION: Get file information.
+ *
+ ******************************************************************************/
+
+static int
+AcpiEfiGetFileInfo (
+ FILE *File,
+ ACPI_EFI_FILE_INFO **InfoPtr)
+{
+ ACPI_EFI_STATUS EfiStatus = ACPI_EFI_BUFFER_TOO_SMALL;
+ ACPI_EFI_FILE_INFO *Buffer = NULL;
+ UINTN BufferSize = ACPI_EFI_FILE_INFO_SIZE + 200;
+ ACPI_EFI_FILE_HANDLE EfiFile;
+
+
+ if (!InfoPtr)
+ {
+ errno = EINVAL;
+ return (-EINVAL);
+ }
+
+ while (EfiStatus == ACPI_EFI_BUFFER_TOO_SMALL)
+ {
+ EfiFile = ACPI_CAST_PTR (ACPI_EFI_FILE_STRUCT, File);
+ Buffer = AcpiOsAllocate (BufferSize);
+ if (!Buffer)
+ {
+ errno = ENOMEM;
+ return (-ENOMEM);
+ }
+ EfiStatus = uefi_call_wrapper (EfiFile->GetInfo, 4, EfiFile,
+ &AcpiGbl_GenericFileInfo, &BufferSize, Buffer);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ AcpiOsFree (Buffer);
+ if (EfiStatus != ACPI_EFI_BUFFER_TOO_SMALL)
+ {
+ errno = EIO;
+ return (-EIO);
+ }
+ }
+ }
+
+ *InfoPtr = Buffer;
+ return (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: ftell
+ *
+ * PARAMETERS: File - File descriptor
+ *
+ * RETURN: current position
+ *
+ * DESCRIPTION: Get current file offset.
+ *
+ ******************************************************************************/
+
+long
+ftell (
+ FILE *File)
+{
+ long Offset = -1;
+ UINT64 Current;
+ ACPI_EFI_STATUS EfiStatus;
+ ACPI_EFI_FILE_HANDLE EfiFile;
+
+
+ if (File == stdin || File == stdout || File == stderr)
+ {
+ Offset = 0;
+ }
+ else
+ {
+ EfiFile = ACPI_CAST_PTR (ACPI_EFI_FILE_STRUCT, File);
+
+ EfiStatus = uefi_call_wrapper (EfiFile->GetPosition, 2,
+ EfiFile, &Current);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ Offset = (long) Current;
+ }
+ }
+
+ErrorExit:
+ return (Offset);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: fseek
+ *
+ * PARAMETERS: File - File descriptor
+ * Offset - File offset
+ * From - From begin/end of file
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Set current file offset.
+ *
+ ******************************************************************************/
+
+int
+fseek (
+ FILE *File,
+ long Offset,
+ int From)
+{
+ ACPI_EFI_FILE_INFO *Info;
+ int Error;
+ ACPI_SIZE Size;
+ UINT64 Current;
+ ACPI_EFI_STATUS EfiStatus;
+ ACPI_EFI_FILE_HANDLE EfiFile;
+
+
+ if (File == stdin || File == stdout || File == stderr)
+ {
+ return (0);
+ }
+ else
+ {
+ EfiFile = ACPI_CAST_PTR (ACPI_EFI_FILE_STRUCT, File);
+ Error = AcpiEfiGetFileInfo (File, &Info);
+ if (Error)
+ {
+ return (Error);
+ }
+ Size = Info->FileSize;
+ AcpiOsFree (Info);
+
+ if (From == SEEK_CUR)
+ {
+ EfiStatus = uefi_call_wrapper (EfiFile->GetPosition, 2,
+ EfiFile, &Current);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ errno = ERANGE;
+ return (-ERANGE);
+ }
+ Current += Offset;
+ }
+ else if (From == SEEK_END)
+ {
+ Current = Size - Offset;
+ }
+ else
+ {
+ Current = Offset;
+ }
+
+ EfiStatus = uefi_call_wrapper (EfiFile->SetPosition, 2,
+ EfiFile, Current);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ errno = ERANGE;
+ return (-ERANGE);
+ }
+ }
+
+ return (0);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEfiArgify
+ *
+ * PARAMETERS: String - Pointer to command line argument strings
+ * which are seperated with spaces
+ * ArgcPtr - Return number of the arguments
+ * ArgvPtr - Return vector of the arguments
+ *
+ * RETURN: Clibraray error code
+ * -EINVAL: invalid parameter
+ * EAGAIN: try again
+ *
+ * DESCRIPTION: Convert EFI arguments into C arguments.
+ *
+ *****************************************************************************/
+
+static int
+AcpiEfiArgify (
+ char *String,
+ int *ArgcPtr,
+ char ***ArgvPtr)
+{
+ char *CopyBuffer;
+ int MaxArgc = *ArgcPtr;
+ int Argc = 0;
+ char **Argv = *ArgvPtr;
+ char *Arg;
+ BOOLEAN IsSingleQuote = FALSE;
+ BOOLEAN IsDoubleQuote = FALSE;
+ BOOLEAN IsEscape = FALSE;
+
+
+ if (String == NULL)
+ {
+ errno = EINVAL;
+ return (-EINVAL);
+ }
+
+ CopyBuffer = String;
+
+ while (*String != '\0')
+ {
+ while (isspace (*String))
+ {
+ *String++ = '\0';
+ }
+ Arg = CopyBuffer;
+ while (*String != '\0')
+ {
+ if (isspace (*String) &&
+ !IsSingleQuote && !IsDoubleQuote && !IsEscape)
+ {
+ *Arg++ = '\0';
+ String++;
+ break;
+ }
+ if (IsEscape)
+ {
+ IsEscape = FALSE;
+ *Arg++ = *String;
+ }
+ else if (*String == '\\')
+ {
+ IsEscape = TRUE;
+ }
+ else if (IsSingleQuote)
+ {
+ if (*String == '\'')
+ {
+ IsSingleQuote = FALSE;
+ *Arg++ = '\0';
+ }
+ else
+ {
+ *Arg++ = *String;
+ }
+ }
+ else if (IsDoubleQuote)
+ {
+ if (*String == '"')
+ {
+ IsDoubleQuote = FALSE;
+ *Arg = '\0';
+ }
+ else
+ {
+ *Arg++ = *String;
+ }
+ }
+ else
+ {
+ if (*String == '\'')
+ {
+ IsSingleQuote = TRUE;
+ }
+ else if (*String == '"')
+ {
+ IsDoubleQuote = TRUE;
+ }
+ else
+ {
+ *Arg++ = *String;
+ }
+ }
+ String++;
+ }
+ if (Argv && Argc < MaxArgc)
+ {
+ Argv[Argc] = CopyBuffer;
+ }
+ Argc++;
+ CopyBuffer = Arg;
+ }
+ if (Argv && Argc < MaxArgc)
+ {
+ Argv[Argc] = NULL;
+ }
+
+ *ArgcPtr = Argc;
+ *ArgvPtr = Argv;
+
+ if (MaxArgc < Argc)
+ {
+ errno = EAGAIN;
+ return (-ENOMEM);
+ }
+ return (0);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEfiConvertArgcv
+ *
+ * PARAMETERS: LoadOptions - Pointer to the EFI options buffer, which
+ * is NULL terminated
+ * LoadOptionsSize - Size of the EFI options buffer
+ * ArgcPtr - Return number of the arguments
+ * ArgvPtr - Return vector of the arguments
+ * BufferPtr - Buffer to contain the argument strings
+ *
+ * RETURN: Clibrary error code
+ *
+ * DESCRIPTION: Convert EFI arguments into C arguments.
+ *
+ *****************************************************************************/
+
+static int
+AcpiEfiConvertArgcv (
+ CHAR16 *LoadOptions,
+ UINT32 LoadOptionsSize,
+ int *ArgcPtr,
+ char ***ArgvPtr,
+ char **BufferPtr)
+{
+ int Error = 0;
+ UINT32 Count = LoadOptionsSize / sizeof (CHAR16);
+ UINT32 i;
+ CHAR16 *From;
+ char *To;
+ int Argc = 0;
+ char **Argv = NULL;
+ char *Buffer;
+
+
+ /* Prepare a buffer to contain the argument strings */
+
+ Buffer = ACPI_ALLOCATE_ZEROED (Count);
+ if (!Buffer)
+ {
+ errno = ENOMEM;
+ Error = -ENOMEM;
+ goto ErrorExit;
+ }
+
+TryAgain:
+
+ /* Extend the argument vector */
+
+ if (Argv)
+ {
+ ACPI_FREE (Argv);
+ Argv = NULL;
+ }
+ if (Argc > 0)
+ {
+ Argv = ACPI_ALLOCATE_ZEROED (sizeof (char *) * (Argc + 1));
+ if (!Argv)
+ {
+ errno = ENOMEM;
+ Error = -ENOMEM;
+ goto ErrorExit;
+ }
+ }
+
+ /*
+ * Note: As AcpiEfiArgify() will modify the content of the buffer, so
+ * we need to restore it each time before invoking
+ * AcpiEfiArgify().
+ */
+ From = LoadOptions;
+ To = ACPI_CAST_PTR (char, Buffer);
+ for (i = 0; i < Count; i++)
+ {
+ *To++ = (char) *From++;
+ }
+
+ /*
+ * The "Buffer" will contain NULL terminated strings after invoking
+ * AcpiEfiArgify(). The number of the strings are saved in Argc and the
+ * pointers of the strings are saved in Argv.
+ */
+ Error = AcpiEfiArgify (Buffer, &Argc, &Argv);
+ if (Error && errno == EAGAIN)
+ {
+ goto TryAgain;
+ }
+
+ErrorExit:
+
+ if (Error)
+ {
+ ACPI_FREE (Buffer);
+ ACPI_FREE (Argv);
+ }
+ else
+ {
+ *ArgcPtr = Argc;
+ *ArgvPtr = Argv;
+ *BufferPtr = Buffer;
+ }
+ return (Error);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: efi_main
+ *
+ * PARAMETERS: Image - EFI image handle
+ * SystemTab - EFI system table
+ *
+ * RETURN: EFI Status
+ *
+ * DESCRIPTION: Entry point of EFI executable
+ *
+ *****************************************************************************/
+
+ACPI_EFI_STATUS
+efi_main (
+ ACPI_EFI_HANDLE Image,
+ ACPI_EFI_SYSTEM_TABLE *SystemTab)
+{
+ ACPI_EFI_LOADED_IMAGE *Info;
+ ACPI_EFI_STATUS EfiStatus = ACPI_EFI_SUCCESS;
+ int Error;
+ int argc;
+ char **argv = NULL;
+ char *OptBuffer = NULL;
+ ACPI_EFI_FILE_IO_INTERFACE *Volume = NULL;
+
+
+ /* Initialize global variables */
+
+ ST = SystemTab;
+ BS = SystemTab->BootServices;
+ RT = SystemTab->RuntimeServices;
+
+ /* Disable the platform watchdog timer if we go interactive */
+
+ uefi_call_wrapper(BS->SetWatchdogTimer, 4, 0, 0x0, 0, NULL);
+
+ /* Retrieve image information */
+
+ EfiStatus = uefi_call_wrapper (BS->HandleProtocol, 3,
+ Image, &AcpiGbl_LoadedImageProtocol, ACPI_CAST_PTR (VOID, &Info));
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ fprintf (stderr,
+ "EFI_BOOT_SERVICES->HandleProtocol(LoadedImageProtocol) failure.\n");
+ return (EfiStatus);
+ }
+
+ EfiStatus = uefi_call_wrapper (BS->HandleProtocol, 3,
+ Info->DeviceHandle, &AcpiGbl_FileSystemProtocol, (void **) &Volume);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ fprintf (stderr,
+ "EFI_BOOT_SERVICES->HandleProtocol(FileSystemProtocol) failure.\n");
+ return (EfiStatus);
+ }
+ EfiStatus = uefi_call_wrapper (Volume->OpenVolume, 2,
+ Volume, &AcpiGbl_EfiCurrentVolume);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ fprintf (stderr, "EFI_FILE_IO_INTERFACE->OpenVolume() failure.\n");
+ return (EfiStatus);
+ }
+
+ Error = AcpiEfiConvertArgcv (Info->LoadOptions,
+ Info->LoadOptionsSize, &argc, &argv, &OptBuffer);
+ if (Error)
+ {
+ EfiStatus = ACPI_EFI_DEVICE_ERROR;
+ goto ErrorAlloc;
+ }
+
+ acpi_main (argc, argv);
+
+ErrorAlloc:
+
+ if (argv)
+ {
+ ACPI_FREE (argv);
+ }
+ if (OptBuffer)
+ {
+ ACPI_FREE (OptBuffer);
+ }
+
+ 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
diff --git a/source/os_specific/service_layers/osefitbl.c b/source/os_specific/service_layers/osefitbl.c
index ec2161915..81bbdc76b 100644
--- a/source/os_specific/service_layers/osefitbl.c
+++ b/source/os_specific/service_layers/osefitbl.c
@@ -305,18 +305,7 @@ AcpiOsGetTableByName (
/* Not a main ACPI table, attempt to extract it from the RSDT/XSDT */
- if (!Gbl_DumpCustomizedTables)
- {
- /* Attempt to get the table from the memory */
-
- Status = OslGetTable (Signature, Instance, Table, Address);
- }
- else
- {
- /* Attempt to get the table from the static directory */
-
- Status = AE_SUPPORT;
- }
+ Status = OslGetTable (Signature, Instance, Table, Address);
return (Status);
}
@@ -389,7 +378,7 @@ OslAddTableToList (
{
if (Instance)
{
- AcpiLogError (
+ fprintf (stderr,
"%4.4s: Warning unmatched table instance %d, expected %d\n",
Signature, Instance, NextInstance);
}
@@ -650,56 +639,47 @@ OslTableInitialize (
return (Status);
}
- if (!Gbl_DumpCustomizedTables)
+ /* Add mandatory tables to global table list first */
+
+ Status = OslAddTableToList (ACPI_RSDP_NAME, 0);
+ if (ACPI_FAILURE (Status))
{
- /* Add mandatory tables to global table list first */
+ return (Status);
+ }
- Status = OslAddTableToList (ACPI_RSDP_NAME, 0);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ Status = OslAddTableToList (ACPI_SIG_RSDT, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- Status = OslAddTableToList (ACPI_SIG_RSDT, 0);
+ if (Gbl_Revision == 2)
+ {
+ Status = OslAddTableToList (ACPI_SIG_XSDT, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
}
+ }
- if (Gbl_Revision == 2)
- {
- Status = OslAddTableToList (ACPI_SIG_XSDT, 0);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
-
- Status = OslAddTableToList (ACPI_SIG_DSDT, 0);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ Status = OslAddTableToList (ACPI_SIG_DSDT, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- Status = OslAddTableToList (ACPI_SIG_FACS, 0);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ Status = OslAddTableToList (ACPI_SIG_FACS, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- /* Add all tables found in the memory */
+ /* Add all tables found in the memory */
- Status = OslListTables ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
- else
+ Status = OslListTables ();
+ if (ACPI_FAILURE (Status))
{
- /* Add all tables found in the static directory */
-
- Status = AE_SUPPORT;
+ return (Status);
}
Gbl_TableListInitialized = TRUE;
@@ -1034,7 +1014,7 @@ OslMapTable (
MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
if (!MappedTable)
{
- AcpiLogError ("Could not map table header at 0x%8.8X%8.8X\n",
+ fprintf (stderr, "Could not map table header at 0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Address));
return (AE_BAD_ADDRESS);
}
@@ -1070,7 +1050,7 @@ OslMapTable (
MappedTable = AcpiOsMapMemory (Address, Length);
if (!MappedTable)
{
- AcpiLogError ("Could not map table at 0x%8.8X%8.8X length %8.8X\n",
+ fprintf (stderr, "Could not map table at 0x%8.8X%8.8X length %8.8X\n",
ACPI_FORMAT_UINT64 (Address), Length);
return (AE_INVALID_TABLE_LENGTH);
}
diff --git a/source/os_specific/service_layers/osefixf.c b/source/os_specific/service_layers/osefixf.c
index fa111b508..bc6c99f85 100644
--- a/source/os_specific/service_layers/osefixf.c
+++ b/source/os_specific/service_layers/osefixf.c
@@ -121,52 +121,25 @@
ACPI_MODULE_NAME ("osefixf")
-/* Local definitions */
-
-#define ACPI_EFI_PRINT_LENGTH 256
+/* Upcalls to AcpiExec */
+void
+AeTableOverride (
+ ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_TABLE_HEADER **NewTable);
/* Local prototypes */
-static ACPI_STATUS
-AcpiEfiArgify (
- char *String,
- int *ArgcPtr,
- char ***ArgvPtr);
+#ifndef ACPI_USE_NATIVE_RSDP_POINTER
static BOOLEAN
AcpiEfiCompareGuid (
- EFI_GUID *Guid1,
- EFI_GUID *Guid2);
-
-static ACPI_STATUS
-AcpiEfiConvertArgcv (
- CHAR16 *LoadOpt,
- UINT32 LoadOptSize,
- int *ArgcPtr,
- char ***ArgvPtr,
- char **BufferPtr);
+ ACPI_EFI_GUID *Guid1,
+ ACPI_EFI_GUID *Guid2);
static ACPI_PHYSICAL_ADDRESS
AcpiEfiGetRsdpViaGuid (
- EFI_GUID *Guid);
-
-static CHAR16 *
-AcpiEfiFlushFile (
- ACPI_FILE File,
- CHAR16 *Begin,
- CHAR16 *End,
- CHAR16 *Pos,
- BOOLEAN FlushAll);
-
-
-/* Local variables */
-
-static EFI_FILE_HANDLE AcpiGbl_EfiCurrentVolume = NULL;
-EFI_GUID AcpiGbl_LoadedImageProtocol = LOADED_IMAGE_PROTOCOL;
-EFI_GUID AcpiGbl_TextInProtocol = SIMPLE_TEXT_INPUT_PROTOCOL;
-EFI_GUID AcpiGbl_TextOutProtocol = SIMPLE_TEXT_OUTPUT_PROTOCOL;
-EFI_GUID AcpiGbl_FileSystemProtocol = SIMPLE_FILE_SYSTEM_PROTOCOL;
+ ACPI_EFI_GUID *Guid);
/******************************************************************************
@@ -184,8 +157,8 @@ EFI_GUID AcpiGbl_FileSystemProtocol = SIMPLE_FILE_SYSTEM_PROT
static BOOLEAN
AcpiEfiCompareGuid (
- EFI_GUID *Guid1,
- EFI_GUID *Guid2)
+ ACPI_EFI_GUID *Guid1,
+ ACPI_EFI_GUID *Guid2)
{
INT32 *g1;
INT32 *g2;
@@ -218,7 +191,7 @@ AcpiEfiCompareGuid (
static ACPI_PHYSICAL_ADDRESS
AcpiEfiGetRsdpViaGuid (
- EFI_GUID *Guid)
+ ACPI_EFI_GUID *Guid)
{
ACPI_PHYSICAL_ADDRESS Address = 0;
int i;
@@ -255,8 +228,8 @@ AcpiOsGetRootPointer (
void)
{
ACPI_PHYSICAL_ADDRESS Address;
- EFI_GUID Guid10 = ACPI_TABLE_GUID;
- EFI_GUID Guid20 = ACPI_20_TABLE_GUID;
+ ACPI_EFI_GUID Guid10 = ACPI_TABLE_GUID;
+ ACPI_EFI_GUID Guid20 = ACPI_20_TABLE_GUID;
Address = AcpiEfiGetRsdpViaGuid (&Guid20);
@@ -268,6 +241,104 @@ AcpiOsGetRootPointer (
return (Address);
}
+#endif
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsTableOverride
+ *
+ * PARAMETERS: ExistingTable - Header of current table (probably
+ * firmware)
+ * NewTable - Where an entire new table is returned.
+ *
+ * RETURN: Status, pointer to new table. Null pointer returned if no
+ * table is available to override
+ *
+ * DESCRIPTION: Return a different version of a table if one is available
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsTableOverride (
+ ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_TABLE_HEADER **NewTable)
+{
+
+ if (!ExistingTable || !NewTable)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ *NewTable = NULL;
+
+#ifdef ACPI_EXEC_APP
+
+ AeTableOverride (ExistingTable, NewTable);
+ return (AE_OK);
+#else
+
+ return (AE_NO_ACPI_TABLES);
+#endif
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsPhysicalTableOverride
+ *
+ * PARAMETERS: ExistingTable - Header of current table (probably firmware)
+ * NewAddress - Where new table address is returned
+ * (Physical address)
+ * NewTableLength - Where new table length is returned
+ *
+ * RETURN: Status, address/length of new table. Null pointer returned
+ * if no table is available to override.
+ *
+ * DESCRIPTION: Returns AE_SUPPORT, function not used in user space.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsPhysicalTableOverride (
+ ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_PHYSICAL_ADDRESS *NewAddress,
+ UINT32 *NewTableLength)
+{
+
+ return (AE_SUPPORT);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsPredefinedOverride
+ *
+ * PARAMETERS: InitVal - Initial value of the predefined object
+ * NewVal - The new value for the object
+ *
+ * RETURN: Status, pointer to value. Null pointer returned if not
+ * overriding.
+ *
+ * DESCRIPTION: Allow the OS to override predefined names
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsPredefinedOverride (
+ const ACPI_PREDEFINED_NAMES *InitVal,
+ ACPI_STRING *NewVal)
+{
+
+ if (!InitVal || !NewVal)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ *NewVal = NULL;
+ return (AE_OK);
+}
+
/******************************************************************************
*
@@ -318,7 +389,7 @@ AcpiOsUnmapMemory (
/******************************************************************************
*
- * FUNCTION: Spinlock interfaces
+ * FUNCTION: Single threaded stub interfaces
*
* DESCRIPTION: No-op on single threaded BIOS
*
@@ -351,434 +422,493 @@ AcpiOsReleaseLock (
{
}
+ACPI_STATUS
+AcpiOsCreateSemaphore (
+ UINT32 MaxUnits,
+ UINT32 InitialUnits,
+ ACPI_HANDLE *OutHandle)
+{
+ *OutHandle = (ACPI_HANDLE) 1;
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiOsDeleteSemaphore (
+ ACPI_HANDLE Handle)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiOsWaitSemaphore (
+ ACPI_HANDLE Handle,
+ UINT32 Units,
+ UINT16 Timeout)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiOsSignalSemaphore (
+ ACPI_HANDLE Handle,
+ UINT32 Units)
+{
+ return (AE_OK);
+}
+
+ACPI_THREAD_ID
+AcpiOsGetThreadId (
+ void)
+{
+ return (1);
+}
+
+ACPI_STATUS
+AcpiOsExecute (
+ ACPI_EXECUTE_TYPE Type,
+ ACPI_OSD_EXEC_CALLBACK Function,
+ void *Context)
+{
+ return (AE_OK);
+}
+
+void
+AcpiOsWaitEventsComplete (
+ void)
+{
+ return;
+}
+
/******************************************************************************
*
- * FUNCTION: AcpiOsAllocate
+ * FUNCTION: AcpiOsInstallInterruptHandler
*
- * PARAMETERS: Size - Amount to allocate, in bytes
+ * PARAMETERS: InterruptNumber - Level handler should respond to.
+ * ServiceRoutine - Address of the ACPI interrupt handler
+ * Context - Where status is returned
*
- * RETURN: Pointer to the new allocation. Null on error.
+ * RETURN: Handle to the newly installed handler.
*
- * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
+ * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
+ * OS-independent handler.
*
*****************************************************************************/
-void *
-AcpiOsAllocate (
- ACPI_SIZE Size)
+UINT32
+AcpiOsInstallInterruptHandler (
+ UINT32 InterruptNumber,
+ ACPI_OSD_HANDLER ServiceRoutine,
+ void *Context)
{
- EFI_STATUS EfiStatus;
- void *Mem;
-
- EfiStatus = uefi_call_wrapper (BS->AllocatePool, 3,
- EfiLoaderData, Size, &Mem);
- if (EFI_ERROR (EfiStatus))
- {
- AcpiLogError ("EFI_BOOT_SERVICES->AllocatePool(EfiLoaderData) failure.\n");
- return (NULL);
- }
-
- return (Mem);
+ return (AE_OK);
}
-#ifdef USE_NATIVE_ALLOCATE_ZEROED
/******************************************************************************
*
- * FUNCTION: AcpiOsAllocateZeroed
+ * FUNCTION: AcpiOsRemoveInterruptHandler
*
- * PARAMETERS: Size - Amount to allocate, in bytes
+ * PARAMETERS: InterruptNumber - Level handler should respond to.
+ * ServiceRoutine - Address of the ACPI interrupt handler
*
- * RETURN: Pointer to the new allocation. Null on error.
+ * RETURN: Status
*
- * DESCRIPTION: Allocate and zero memory. Algorithm is dependent on the OS.
+ * DESCRIPTION: Uninstalls an interrupt handler.
*
*****************************************************************************/
-void *
-AcpiOsAllocateZeroed (
- ACPI_SIZE Size)
+ACPI_STATUS
+AcpiOsRemoveInterruptHandler (
+ UINT32 InterruptNumber,
+ ACPI_OSD_HANDLER ServiceRoutine)
{
- void *Mem;
+ return (AE_OK);
+}
- Mem = AcpiOsAllocate (Size);
- if (Mem)
- {
- memset (Mem, 0, Size);
- }
- return (Mem);
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsReadPciConfiguration
+ *
+ * PARAMETERS: PciId - Seg/Bus/Dev
+ * PciRegister - Device Register
+ * Value - Buffer where value is placed
+ * Width - Number of bits
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Read data from PCI configuration space
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadPciConfiguration (
+ ACPI_PCI_ID *PciId,
+ UINT32 PciRegister,
+ UINT64 *Value,
+ UINT32 Width)
+{
+
+ *Value = 0;
+ return (AE_OK);
}
-#endif
/******************************************************************************
*
- * FUNCTION: AcpiOsFree
+ * FUNCTION: AcpiOsWritePciConfiguration
*
- * PARAMETERS: Mem - Pointer to previously allocated memory
+ * PARAMETERS: PciId - Seg/Bus/Dev
+ * PciRegister - Device Register
+ * Value - Value to be written
+ * Width - Number of bits
*
- * RETURN: None
+ * RETURN: Status.
*
- * DESCRIPTION: Free memory allocated via AcpiOsAllocate
+ * DESCRIPTION: Write data to PCI configuration space
*
*****************************************************************************/
-void
-AcpiOsFree (
- void *Mem)
+ACPI_STATUS
+AcpiOsWritePciConfiguration (
+ ACPI_PCI_ID *PciId,
+ UINT32 PciRegister,
+ UINT64 Value,
+ UINT32 Width)
{
- uefi_call_wrapper (BS->FreePool, 1, Mem);
+ return (AE_OK);
}
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiOsOpenFile
+ * FUNCTION: AcpiOsReadPort
*
- * PARAMETERS: Path - File path
- * Modes - File operation type
+ * PARAMETERS: Address - Address of I/O port/register to read
+ * Value - Where value is placed
+ * Width - Number of bits
*
- * RETURN: File descriptor
+ * RETURN: Value read from port
*
- * DESCRIPTION: Open a file for reading (ACPI_FILE_READING) or/and writing
- * (ACPI_FILE_WRITING).
+ * DESCRIPTION: Read data from an I/O port or register
*
- ******************************************************************************/
+ *****************************************************************************/
-ACPI_FILE
-AcpiOsOpenFile (
- const char *Path,
- UINT8 Modes)
+ACPI_STATUS
+AcpiOsReadPort (
+ ACPI_IO_ADDRESS Address,
+ UINT32 *Value,
+ UINT32 Width)
{
- EFI_STATUS EfiStatus = EFI_SUCCESS;
- UINT64 OpenModes;
- EFI_FILE_HANDLE EfiFile = NULL;
- CHAR16 *Path16 = NULL;
- CHAR16 *Pos16;
- const char *Pos;
- INTN Count, i;
-
- if (!Path)
+ switch (Width)
{
- return (NULL);
- }
+ case 8:
- /* Convert modes */
+ *Value = 0xFF;
+ break;
- OpenModes = EFI_FILE_MODE_READ;
- if (Modes & ACPI_FILE_WRITING)
- {
- OpenModes |= (EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE);
- }
+ case 16:
- /* Allocate path buffer */
+ *Value = 0xFFFF;
+ break;
- Count = strlen (Path);
- Path16 = ACPI_ALLOCATE_ZEROED ((Count + 1) * sizeof (CHAR16));
- if (!Path16)
- {
- EfiStatus = EFI_BAD_BUFFER_SIZE;
- goto ErrorExit;
- }
- Pos = Path;
- Pos16 = Path16;
- while (*Pos == '/' || *Pos == '\\')
- {
- Pos++;
- Count--;
- }
- for (i = 0; i < Count; i++)
- {
- if (*Pos == '/')
- {
- *Pos16++ = '\\';
- Pos++;
- }
- else
- {
- *Pos16++ = *Pos++;
- }
- }
- *Pos16 = '\0';
+ case 32:
- EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Open, 5,
- AcpiGbl_EfiCurrentVolume, &EfiFile, Path16, OpenModes, 0);
- if (EFI_ERROR (EfiStatus))
- {
- AcpiLogError ("EFI_FILE_HANDLE->Open() failure.\n");
- goto ErrorExit;
- }
+ *Value = 0xFFFFFFFF;
+ break;
-ErrorExit:
+ default:
- if (Path16)
- {
- ACPI_FREE (Path16);
+ return (AE_BAD_PARAMETER);
}
- return ((ACPI_FILE) EfiFile);
+ return (AE_OK);
}
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiOsCloseFile
+ * FUNCTION: AcpiOsWritePort
*
- * PARAMETERS: File - File descriptor
+ * PARAMETERS: Address - Address of I/O port/register to write
+ * Value - Value to write
+ * Width - Number of bits
*
- * RETURN: None.
+ * RETURN: None
*
- * DESCRIPTION: Close a file.
+ * DESCRIPTION: Write data to an I/O port or register
*
- ******************************************************************************/
+ *****************************************************************************/
-void
-AcpiOsCloseFile (
- ACPI_FILE File)
+ACPI_STATUS
+AcpiOsWritePort (
+ ACPI_IO_ADDRESS Address,
+ UINT32 Value,
+ UINT32 Width)
{
- EFI_FILE_HANDLE EfiFile;
+
+ return (AE_OK);
+}
- if (File == ACPI_FILE_OUT ||
- File == ACPI_FILE_ERR)
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsReadMemory
+ *
+ * PARAMETERS: Address - Physical Memory Address to read
+ * Value - Where value is placed
+ * Width - Number of bits (8,16,32, or 64)
+ *
+ * RETURN: Value read from physical memory address. Always returned
+ * as a 64-bit integer, regardless of the read width.
+ *
+ * DESCRIPTION: Read data from a physical memory address
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsReadMemory (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 *Value,
+ UINT32 Width)
+{
+
+ switch (Width)
{
- return;
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+
+ *Value = 0;
+ break;
+
+ default:
+
+ return (AE_BAD_PARAMETER);
}
- EfiFile = (EFI_FILE_HANDLE) File;
- (void) uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Close, 1, EfiFile);
+ return (AE_OK);
+}
- return;
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWriteMemory
+ *
+ * PARAMETERS: Address - Physical Memory Address to write
+ * Value - Value to write
+ * Width - Number of bits (8,16,32, or 64)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write data to a physical memory address
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWriteMemory (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT64 Value,
+ UINT32 Width)
+{
+
+ return (AE_OK);
}
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiOsReadFile
+ * FUNCTION: AcpiOsGetTimer
*
- * PARAMETERS: File - File descriptor
- * Buffer - Data buffer
- * Size - Data block size
- * Count - Number of data blocks
+ * PARAMETERS: None
*
- * RETURN: Size of successfully read buffer
+ * RETURN: Current time in 100 nanosecond units
*
- * DESCRIPTION: Read from a file.
+ * DESCRIPTION: Get the current system time
*
- ******************************************************************************/
+ *****************************************************************************/
-int
-AcpiOsReadFile (
- ACPI_FILE File,
- void *Buffer,
- ACPI_SIZE Size,
- ACPI_SIZE Count)
+UINT64
+AcpiOsGetTimer (
+ void)
{
- int Length = -1;
- EFI_FILE_HANDLE EfiFile;
- UINTN ReadSize;
- EFI_STATUS EfiStatus;
+ ACPI_EFI_STATUS EfiStatus;
+ ACPI_EFI_TIME EfiTime;
+ int Year, Month, Day;
+ int Hour, Minute, Second;
+ UINT64 Timer;
- if (File == ACPI_FILE_OUT ||
- File == ACPI_FILE_ERR)
+ EfiStatus = uefi_call_wrapper (RT->GetTime, 2, &EfiTime, NULL);
+ if (ACPI_EFI_ERROR (EfiStatus))
{
+ return (-1);
}
- else
+
+ Year = EfiTime.Year;
+ Month = EfiTime.Month;
+ Day = EfiTime.Day;
+ Hour = EfiTime.Hour;
+ Minute = EfiTime.Minute;
+ Second = EfiTime.Second;
+
+ /* 1..12 -> 11,12,1..10 */
+
+ if (0 >= (int) (Month -= 2))
{
- EfiFile = (EFI_FILE_HANDLE) File;
- if (!EfiFile)
- {
- goto ErrorExit;
- }
- ReadSize = Size * Count;
+ /* Feb has leap days */
- EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Read, 3,
- EfiFile, &ReadSize, Buffer);
- if (EFI_ERROR (EfiStatus))
- {
- AcpiLogError ("EFI_FILE_HANDLE->Read() failure.\n");
- goto ErrorExit;
- }
- Length = ReadSize;
+ Month += 12;
+ Year -= 1;
}
-ErrorExit:
+ /* Calculate days */
+
+ Timer = ((UINT64) (Year/4 - Year/100 + Year/400 + 367*Month/12 + Day) +
+ Year*365 - 719499);
- return (Length);
+ /* Calculate seconds */
+
+ Timer = ((Timer*24 + Hour) * 60 + Minute) * 60 + Second;
+
+ /* Calculate 100 nanoseconds */
+
+ return ((Timer * ACPI_100NSEC_PER_SEC) + (EfiTime.Nanosecond / 100));
}
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiEfiFlushFile
+ * FUNCTION: AcpiOsStall
*
- * PARAMETERS: File - File descriptor
- * Begin - String with boundary
- * End - Boundary of the string
- * Pos - Current position
- * FlushAll - Whether checking boundary before flushing
+ * PARAMETERS: microseconds - Time to sleep
*
- * RETURN: Updated position
+ * RETURN: Blocks until sleep is completed.
*
- * DESCRIPTION: Flush cached buffer to the file.
+ * DESCRIPTION: Sleep at microsecond granularity
*
- ******************************************************************************/
+ *****************************************************************************/
-static CHAR16 *
-AcpiEfiFlushFile (
- ACPI_FILE File,
- CHAR16 *Begin,
- CHAR16 *End,
- CHAR16 *Pos,
- BOOLEAN FlushAll)
+void
+AcpiOsStall (
+ UINT32 microseconds)
{
- if (FlushAll || Pos >= (End - 1))
+ if (microseconds)
{
- *Pos = 0;
- uefi_call_wrapper (File->OutputString, 2, File, Begin);
- Pos = Begin;
+ uefi_call_wrapper (BS->Stall, 1, microseconds);
}
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsSleep
+ *
+ * PARAMETERS: milliseconds - Time to sleep
+ *
+ * RETURN: Blocks until sleep is completed.
+ *
+ * DESCRIPTION: Sleep at millisecond granularity
+ *
+ *****************************************************************************/
+
+void
+AcpiOsSleep (
+ UINT64 milliseconds)
+{
- return (Pos);
+ AcpiOsStall (milliseconds * ACPI_USEC_PER_MSEC);
}
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiOsWriteFile
+ * FUNCTION: AcpiOsAllocate
*
- * PARAMETERS: File - File descriptor
- * Buffer - Data buffer
- * Size - Data block size
- * Count - Number of data blocks
+ * PARAMETERS: Size - Amount to allocate, in bytes
*
- * RETURN: Size of successfully written buffer
+ * RETURN: Pointer to the new allocation. Null on error.
*
- * DESCRIPTION: Write to a file.
+ * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
*
- ******************************************************************************/
+ *****************************************************************************/
-int
-AcpiOsWriteFile (
- ACPI_FILE File,
- void *Buffer,
- ACPI_SIZE Size,
- ACPI_SIZE Count)
+void *
+AcpiOsAllocate (
+ ACPI_SIZE Size)
{
- int Length = -1;
- CHAR16 String[ACPI_EFI_PRINT_LENGTH];
- const char *Ascii;
- CHAR16 *End;
- CHAR16 *Pos;
- int i, j;
- EFI_FILE_HANDLE EfiFile;
- UINTN WriteSize;
- EFI_STATUS EfiStatus;
-
-
- if (File == ACPI_FILE_OUT ||
- File == ACPI_FILE_ERR)
- {
- Pos = String;
- End = String + ACPI_EFI_PRINT_LENGTH - 1;
- Ascii = ACPI_CAST_PTR (const char, Buffer);
- Length = 0;
+ ACPI_EFI_STATUS EfiStatus;
+ void *Mem;
- for (j = 0; j < Count; j++)
- {
- for (i = 0; i < Size; i++)
- {
- if (*Ascii == '\n')
- {
- *Pos++ = '\r';
- Pos = AcpiEfiFlushFile (File, String,
- End, Pos, FALSE);
- }
- *Pos++ = *Ascii++;
- Length++;
- Pos = AcpiEfiFlushFile (File, String,
- End, Pos, FALSE);
- }
- }
- Pos = AcpiEfiFlushFile (File, String, End, Pos, TRUE);
- }
- else
- {
- EfiFile = (EFI_FILE_HANDLE) File;
- if (!EfiFile)
- {
- goto ErrorExit;
- }
- WriteSize = Size * Count;
- EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Write, 3,
- EfiFile, &WriteSize, Buffer);
- if (EFI_ERROR (EfiStatus))
- {
- AcpiLogError ("EFI_FILE_HANDLE->Write() failure.\n");
- goto ErrorExit;
- }
- Length = WriteSize;
+ EfiStatus = uefi_call_wrapper (BS->AllocatePool, 3,
+ AcpiEfiLoaderData, Size, &Mem);
+ if (ACPI_EFI_ERROR (EfiStatus))
+ {
+ fprintf (stderr,
+ "EFI_BOOT_SERVICES->AllocatePool(EfiLoaderData) failure.\n");
+ return (NULL);
}
-ErrorExit:
-
- return (Length);
+ return (Mem);
}
-/*******************************************************************************
+#ifdef USE_NATIVE_ALLOCATE_ZEROED
+/******************************************************************************
*
- * FUNCTION: AcpiOsGetFileOffset
+ * FUNCTION: AcpiOsAllocateZeroed
*
- * PARAMETERS: File - File descriptor
+ * PARAMETERS: Size - Amount to allocate, in bytes
*
- * RETURN: Size of current position
+ * RETURN: Pointer to the new allocation. Null on error.
*
- * DESCRIPTION: Get current file offset.
+ * DESCRIPTION: Allocate and zero memory. Algorithm is dependent on the OS.
*
- ******************************************************************************/
+ *****************************************************************************/
-long
-AcpiOsGetFileOffset (
- ACPI_FILE File)
+void *
+AcpiOsAllocateZeroed (
+ ACPI_SIZE Size)
{
- long Offset = -1;
+ void *Mem;
- return (Offset);
+ Mem = AcpiOsAllocate (Size);
+ if (Mem)
+ {
+ memset (Mem, 0, Size);
+ }
+
+ return (Mem);
}
+#endif
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiOsSetFileOffset
+ * FUNCTION: AcpiOsFree
*
- * PARAMETERS: File - File descriptor
- * Offset - File offset
- * From - From begin/end of file
+ * PARAMETERS: Mem - Pointer to previously allocated memory
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Set current file offset.
+ * DESCRIPTION: Free memory allocated via AcpiOsAllocate
*
- ******************************************************************************/
+ *****************************************************************************/
-ACPI_STATUS
-AcpiOsSetFileOffset (
- ACPI_FILE File,
- long Offset,
- UINT8 From)
+void
+AcpiOsFree (
+ void *Mem)
{
- return (AE_SUPPORT);
+ uefi_call_wrapper (BS->FreePool, 1, Mem);
}
@@ -827,19 +957,19 @@ AcpiOsVprintf (
va_list Args)
{
- (void) AcpiUtFileVprintf (ACPI_FILE_OUT, Format, Args);
+ (void) vfprintf (ACPI_FILE_OUT, Format, Args);
}
/******************************************************************************
*
- * FUNCTION: AcpiOsInitialize
+ * FUNCTION: AcpiOsInitialize, AcpiOsTerminate
*
* PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Initialize this module.
+ * DESCRIPTION: Initialize/terminate this module.
*
*****************************************************************************/
@@ -851,313 +981,94 @@ AcpiOsInitialize (
return (AE_OK);
}
+ACPI_STATUS
+AcpiOsTerminate (
+ void)
+{
+
+ return (AE_OK);
+}
+
/******************************************************************************
*
- * FUNCTION: AcpiEfiArgify
+ * FUNCTION: AcpiOsSignal
*
- * PARAMETERS: String - Pointer to command line argument strings
- * which are seperated with spaces
- * ArgcPtr - Return number of the arguments
- * ArgvPtr - Return vector of the arguments
+ * PARAMETERS: Function - ACPI A signal function code
+ * Info - Pointer to function-dependent structure
*
* RETURN: Status
*
- * DESCRIPTION: Convert EFI arguments into C arguments.
+ * DESCRIPTION: Miscellaneous functions. Example implementation only.
*
*****************************************************************************/
-static ACPI_STATUS
-AcpiEfiArgify (
- char *String,
- int *ArgcPtr,
- char ***ArgvPtr)
+ACPI_STATUS
+AcpiOsSignal (
+ UINT32 Function,
+ void *Info)
{
- char *CopyBuffer;
- int MaxArgc = *ArgcPtr;
- int Argc = 0;
- char **Argv = *ArgvPtr;
- char *Arg;
- BOOLEAN IsSingleQuote = FALSE;
- BOOLEAN IsDoubleQuote = FALSE;
- BOOLEAN IsEscape = FALSE;
-
- if (String == NULL)
+ switch (Function)
{
- return (AE_BAD_PARAMETER);
- }
+ case ACPI_SIGNAL_FATAL:
- CopyBuffer = String;
+ break;
- while (*String != '\0')
- {
- while (isspace (*String))
- {
- *String++ = '\0';
- }
- Arg = CopyBuffer;
- while (*String != '\0')
- {
- if (isspace (*String) &&
- !IsSingleQuote && !IsDoubleQuote && !IsEscape)
- {
- *Arg++ = '\0';
- String++;
- break;
- }
- if (IsEscape)
- {
- IsEscape = FALSE;
- *Arg++ = *String;
- }
- else if (*String == '\\')
- {
- IsEscape = TRUE;
- }
- else if (IsSingleQuote)
- {
- if (*String == '\'')
- {
- IsSingleQuote = FALSE;
- *Arg++ = '\0';
- }
- else
- {
- *Arg++ = *String;
- }
- }
- else if (IsDoubleQuote)
- {
- if (*String == '"')
- {
- IsDoubleQuote = FALSE;
- *Arg = '\0';
- }
- else
- {
- *Arg++ = *String;
- }
- }
- else
- {
- if (*String == '\'')
- {
- IsSingleQuote = TRUE;
- }
- else if (*String == '"')
- {
- IsDoubleQuote = TRUE;
- }
- else
- {
- *Arg++ = *String;
- }
- }
- String++;
- }
- if (Argv && Argc < MaxArgc)
- {
- Argv[Argc] = CopyBuffer;
- }
- Argc++;
- CopyBuffer = Arg;
- }
- if (Argv && Argc < MaxArgc)
- {
- Argv[Argc] = NULL;
- }
+ case ACPI_SIGNAL_BREAKPOINT:
- *ArgcPtr = Argc;
- *ArgvPtr = Argv;
+ break;
- return ((MaxArgc < Argc) ? AE_NO_MEMORY : AE_OK);
+ default:
+
+ break;
+ }
+
+ return (AE_OK);
}
/******************************************************************************
*
- * FUNCTION: AcpiEfiConvertArgcv
+ * FUNCTION: AcpiOsReadable
*
- * PARAMETERS: LoadOptions - Pointer to the EFI options buffer, which
- * is NULL terminated
- * LoadOptionsSize - Size of the EFI options buffer
- * ArgcPtr - Return number of the arguments
- * ArgvPtr - Return vector of the arguments
- * BufferPtr - Buffer to contain the argument strings
+ * PARAMETERS: Pointer - Area to be verified
+ * Length - Size of area
*
- * RETURN: Status
+ * RETURN: TRUE if readable for entire length
*
- * DESCRIPTION: Convert EFI arguments into C arguments.
+ * DESCRIPTION: Verify that a pointer is valid for reading
*
*****************************************************************************/
-static ACPI_STATUS
-AcpiEfiConvertArgcv (
- CHAR16 *LoadOptions,
- UINT32 LoadOptionsSize,
- int *ArgcPtr,
- char ***ArgvPtr,
- char **BufferPtr)
+BOOLEAN
+AcpiOsReadable (
+ void *Pointer,
+ ACPI_SIZE Length)
{
- ACPI_STATUS Status = AE_OK;
- UINT32 Count = LoadOptionsSize / sizeof (CHAR16);
- UINT32 i;
- CHAR16 *From;
- char *To;
- int Argc = 0;
- char **Argv = NULL;
- char *Buffer;
-
- /* Prepare a buffer to contain the argument strings */
-
- Buffer = ACPI_ALLOCATE_ZEROED (Count);
- if (!Buffer)
- {
- Status = AE_NO_MEMORY;
- goto ErrorExit;
- }
-
-TryAgain:
-
- /* Extend the argument vector */
-
- if (Argv)
- {
- ACPI_FREE (Argv);
- Argv = NULL;
- }
- if (Argc > 0)
- {
- Argv = ACPI_ALLOCATE_ZEROED (sizeof (char *) * (Argc + 1));
- if (!Argv)
- {
- Status = AE_NO_MEMORY;
- goto ErrorExit;
- }
- }
-
- /*
- * Note: As AcpiEfiArgify() will modify the content of the buffer, so
- * we need to restore it each time before invoking
- * AcpiEfiArgify().
- */
- From = LoadOptions;
- To = ACPI_CAST_PTR (char, Buffer);
- for (i = 0; i < Count; i++)
- {
- *To++ = (char) *From++;
- }
-
- /*
- * The "Buffer" will contain NULL terminated strings after invoking
- * AcpiEfiArgify(). The number of the strings are saved in Argc and the
- * pointers of the strings are saved in Argv.
- */
- Status = AcpiEfiArgify (Buffer, &Argc, &Argv);
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_NO_MEMORY)
- {
- goto TryAgain;
- }
- }
-
-ErrorExit:
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_FREE (Buffer);
- ACPI_FREE (Argv);
- }
- else
- {
- *ArgcPtr = Argc;
- *ArgvPtr = Argv;
- *BufferPtr = Buffer;
- }
- return (Status);
+ return (TRUE);
}
/******************************************************************************
*
- * FUNCTION: efi_main
+ * FUNCTION: AcpiOsWritable
*
- * PARAMETERS: Image - EFI image handle
- * SystemTab - EFI system table
+ * PARAMETERS: Pointer - Area to be verified
+ * Length - Size of area
*
- * RETURN: EFI Status
+ * RETURN: TRUE if writable for entire length
*
- * DESCRIPTION: Entry point of EFI executable
+ * DESCRIPTION: Verify that a pointer is valid for writing
*
*****************************************************************************/
-EFI_STATUS
-efi_main (
- EFI_HANDLE Image,
- EFI_SYSTEM_TABLE *SystemTab)
+BOOLEAN
+AcpiOsWritable (
+ void *Pointer,
+ ACPI_SIZE Length)
{
- EFI_LOADED_IMAGE *Info;
- EFI_STATUS EfiStatus = EFI_SUCCESS;
- ACPI_STATUS Status;
- int argc;
- char **argv = NULL;
- char *OptBuffer = NULL;
- EFI_FILE_IO_INTERFACE *Volume = NULL;
-
-
- /* Initialize global variables */
-
- ST = SystemTab;
- BS = SystemTab->BootServices;
-
- /* Retrieve image information */
-
- EfiStatus = uefi_call_wrapper (BS->HandleProtocol, 3,
- Image, &AcpiGbl_LoadedImageProtocol, ACPI_CAST_PTR (VOID, &Info));
- if (EFI_ERROR (EfiStatus))
- {
- AcpiLogError ("EFI_BOOT_SERVICES->HandleProtocol(LoadedImageProtocol) failure.\n");
- return (EfiStatus);
- }
-
- EfiStatus = uefi_call_wrapper (BS->HandleProtocol, 3,
- Info->DeviceHandle, &AcpiGbl_FileSystemProtocol, (void **) &Volume);
- if (EFI_ERROR (EfiStatus))
- {
- AcpiLogError ("EFI_BOOT_SERVICES->HandleProtocol(FileSystemProtocol) failure.\n");
- return (EfiStatus);
- }
- EfiStatus = uefi_call_wrapper (Volume->OpenVolume, 2,
- Volume, &AcpiGbl_EfiCurrentVolume);
- if (EFI_ERROR (EfiStatus))
- {
- AcpiLogError ("EFI_FILE_IO_INTERFACE->OpenVolume() failure.\n");
- return (EfiStatus);
- }
-
- Status = AcpiEfiConvertArgcv (Info->LoadOptions,
- Info->LoadOptionsSize, &argc, &argv, &OptBuffer);
- if (ACPI_FAILURE (Status))
- {
- EfiStatus = EFI_DEVICE_ERROR;
- goto ErrorAlloc;
- }
-
- acpi_main (argc, argv);
-
-ErrorAlloc:
-
- if (argv)
- {
- ACPI_FREE (argv);
- }
- if (OptBuffer)
- {
- ACPI_FREE (OptBuffer);
- }
- return (EfiStatus);
+ return (TRUE);
}
diff --git a/source/os_specific/service_layers/oslibcfs.c b/source/os_specific/service_layers/oslibcfs.c
deleted file mode 100644
index 26c1a8fed..000000000
--- a/source/os_specific/service_layers/oslibcfs.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/******************************************************************************
- *
- * Module Name: oslibcfs - C library OSL for file I/O
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#include "acpi.h"
-#include <stdio.h>
-#include <stdarg.h>
-
-#define _COMPONENT ACPI_OS_SERVICES
- ACPI_MODULE_NAME ("oslibcfs")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiOsOpenFile
- *
- * PARAMETERS: Path - File path
- * Modes - File operation type
- *
- * RETURN: File descriptor.
- *
- * DESCRIPTION: Open a file for reading (ACPI_FILE_READING) or/and writing
- * (ACPI_FILE_WRITING).
- *
- ******************************************************************************/
-
-ACPI_FILE
-AcpiOsOpenFile (
- const char *Path,
- UINT8 Modes)
-{
- ACPI_FILE File;
- UINT32 i = 0;
- char ModesStr[4];
-
-
- if (Modes & ACPI_FILE_READING)
- {
- ModesStr[i++] = 'r';
- }
- if (Modes & ACPI_FILE_WRITING)
- {
- ModesStr[i++] = 'w';
- }
-
- if (Modes & ACPI_FILE_BINARY)
- {
- ModesStr[i++] = 'b';
- }
-
- ModesStr[i++] = '\0';
-
- File = fopen (Path, ModesStr);
- if (!File)
- {
- perror ("Could not open file");
- }
-
- return (File);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiOsCloseFile
- *
- * PARAMETERS: File - An open file descriptor
- *
- * RETURN: None.
- *
- * DESCRIPTION: Close a file opened via AcpiOsOpenFile.
- *
- ******************************************************************************/
-
-void
-AcpiOsCloseFile (
- ACPI_FILE File)
-{
-
- fclose (File);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiOsReadFile
- *
- * PARAMETERS: File - An open file descriptor
- * Buffer - Data buffer
- * Size - Data block size
- * Count - Number of data blocks
- *
- * RETURN: Number of bytes actually read.
- *
- * DESCRIPTION: Read from a file.
- *
- ******************************************************************************/
-
-int
-AcpiOsReadFile (
- ACPI_FILE File,
- void *Buffer,
- ACPI_SIZE Size,
- ACPI_SIZE Count)
-{
- int Length;
-
-
- Length = fread (Buffer, Size, Count, File);
- if (Length < 0)
- {
- perror ("Error reading file");
- }
-
- return (Length);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiOsWriteFile
- *
- * PARAMETERS: File - An open file descriptor
- * Buffer - Data buffer
- * Size - Data block size
- * Count - Number of data blocks
- *
- * RETURN: Number of bytes actually written.
- *
- * DESCRIPTION: Write to a file.
- *
- ******************************************************************************/
-
-int
-AcpiOsWriteFile (
- ACPI_FILE File,
- void *Buffer,
- ACPI_SIZE Size,
- ACPI_SIZE Count)
-{
- int Length;
-
-
- Length = fwrite (Buffer, Size, Count, File);
- if (Length < 0)
- {
- perror ("Error writing file");
- }
-
- return (Length);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiOsGetFileOffset
- *
- * PARAMETERS: File - An open file descriptor
- *
- * RETURN: Current file pointer position.
- *
- * DESCRIPTION: Get current file offset.
- *
- ******************************************************************************/
-
-long
-AcpiOsGetFileOffset (
- ACPI_FILE File)
-{
- long Offset;
-
-
- Offset = ftell (File);
- return (Offset);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiOsSetFileOffset
- *
- * PARAMETERS: File - An open file descriptor
- * Offset - New file offset
- * From - From begin/end of file
- *
- * RETURN: Status
- *
- * DESCRIPTION: Set current file offset.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiOsSetFileOffset (
- ACPI_FILE File,
- long Offset,
- UINT8 From)
-{
- int Ret = 0;
-
-
- if (From == ACPI_FILE_BEGIN)
- {
- Ret = fseek (File, Offset, SEEK_SET);
- }
-
- if (From == ACPI_FILE_END)
- {
- Ret = fseek (File, Offset, SEEK_END);
- }
-
- if (Ret < 0)
- {
- return (AE_ERROR);
- }
- else
- {
- return (AE_OK);
- }
-}
diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index c3a66d7b3..f04b59e65 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -136,9 +136,6 @@
ACPI_MODULE_NAME ("osunixxf")
-BOOLEAN AcpiGbl_DebugTimeout = FALSE;
-
-
/* Upcalls to AcpiExec */
void
diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c
index 78a0526c4..07f284492 100644
--- a/source/os_specific/service_layers/oswinxf.c
+++ b/source/os_specific/service_layers/oswinxf.c
@@ -172,9 +172,6 @@ ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES];
#endif /* ACPI_SINGLE_THREADED */
-BOOLEAN AcpiGbl_DebugTimeout = FALSE;
-
-
/******************************************************************************
*
* FUNCTION: AcpiOsTerminate
diff --git a/source/tools/acpidump/acpidump.h b/source/tools/acpidump/acpidump.h
index 76843da28..5d6ed795c 100644
--- a/source/tools/acpidump/acpidump.h
+++ b/source/tools/acpidump/acpidump.h
@@ -128,12 +128,6 @@
#include "accommon.h"
#include "actables.h"
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-
/* Globals */
EXTERN BOOLEAN INIT_GLOBAL (Gbl_SummaryMode, FALSE);
@@ -145,12 +139,6 @@ EXTERN ACPI_FILE INIT_GLOBAL (Gbl_OutputFile, NULL);
EXTERN char INIT_GLOBAL (*Gbl_OutputFilename, NULL);
EXTERN UINT64 INIT_GLOBAL (Gbl_RsdpBase, 0);
-/* Globals required for use with ACPICA modules */
-
-#ifdef _DECLARE_GLOBALS
-UINT8 AcpiGbl_IntegerByteWidth = 8;
-#endif
-
/* Action table used to defer requested options */
typedef struct ap_dump_action
diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c
index 783060080..68065d733 100644
--- a/source/tools/acpidump/apdump.c
+++ b/source/tools/acpidump/apdump.c
@@ -148,7 +148,7 @@ ApIsValidHeader (
if (!AcpiUtValidNameseg (Table->Signature))
{
- AcpiLogError ("Table signature (0x%8.8X) is invalid\n",
+ fprintf (stderr, "Table signature (0x%8.8X) is invalid\n",
*(UINT32 *) Table->Signature);
return (FALSE);
}
@@ -157,7 +157,7 @@ ApIsValidHeader (
if (Table->Length < sizeof (ACPI_TABLE_HEADER))
{
- AcpiLogError ("Table length (0x%8.8X) is invalid\n",
+ fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
Table->Length);
return (FALSE);
}
@@ -203,7 +203,7 @@ ApIsValidChecksum (
if (ACPI_FAILURE (Status))
{
- AcpiLogError ("%4.4s: Warning: wrong checksum in table\n",
+ fprintf (stderr, "%4.4s: Warning: wrong checksum in table\n",
Table->Signature);
}
@@ -295,13 +295,13 @@ ApDumpTableBuffer (
* Note: simplest to just always emit a 64-bit address. AcpiXtract
* utility can handle this.
*/
- AcpiUtFilePrintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n",
+ fprintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n",
Table->Signature, ACPI_FORMAT_UINT64 (Address));
AcpiUtDumpBufferToFile (Gbl_OutputFile,
ACPI_CAST_PTR (UINT8, Table), TableLength,
DB_BYTE_DISPLAY, 0);
- AcpiUtFilePrintf (Gbl_OutputFile, "\n");
+ fprintf (Gbl_OutputFile, "\n");
return (0);
}
@@ -346,13 +346,13 @@ ApDumpAllTables (
}
else if (i == 0)
{
- AcpiLogError ("Could not get ACPI tables, %s\n",
+ fprintf (stderr, "Could not get ACPI tables, %s\n",
AcpiFormatException (Status));
return (-1);
}
else
{
- AcpiLogError ("Could not get ACPI table at index %u, %s\n",
+ fprintf (stderr, "Could not get ACPI table at index %u, %s\n",
i, AcpiFormatException (Status));
continue;
}
@@ -402,7 +402,7 @@ ApDumpTableByAddress (
ACPI_MAX64_BYTE_WIDTH, &LongAddress);
if (ACPI_FAILURE (Status))
{
- AcpiLogError ("%s: Could not convert to a physical address\n",
+ fprintf (stderr, "%s: Could not convert to a physical address\n",
AsciiAddress);
return (-1);
}
@@ -411,7 +411,7 @@ ApDumpTableByAddress (
Status = AcpiOsGetTableByAddress (Address, &Table);
if (ACPI_FAILURE (Status))
{
- AcpiLogError ("Could not get table at 0x%8.8X%8.8X, %s\n",
+ fprintf (stderr, "Could not get table at 0x%8.8X%8.8X, %s\n",
ACPI_FORMAT_UINT64 (Address),
AcpiFormatException (Status));
return (-1);
@@ -450,7 +450,7 @@ ApDumpTableByName (
if (strlen (Signature) != ACPI_NAME_SIZE)
{
- AcpiLogError (
+ fprintf (stderr,
"Invalid table signature [%s]: must be exactly 4 characters\n",
Signature);
return (-1);
@@ -487,7 +487,7 @@ ApDumpTableByName (
return (0);
}
- AcpiLogError (
+ fprintf (stderr,
"Could not get ACPI table with signature [%s], %s\n",
LocalSignature, AcpiFormatException (Status));
return (-1);
@@ -539,7 +539,7 @@ ApDumpTableFromFile (
if (!AcpiUtValidNameseg (Table->Signature))
{
- AcpiLogError (
+ fprintf (stderr,
"No valid ACPI signature was found in input file %s\n",
Pathname);
}
@@ -548,7 +548,7 @@ ApDumpTableFromFile (
if (Table->Length > FileSize)
{
- AcpiLogError (
+ fprintf (stderr,
"Table length (0x%X) is too large for input file (0x%X) %s\n",
Table->Length, FileSize, Pathname);
goto Exit;
@@ -556,7 +556,7 @@ ApDumpTableFromFile (
if (Gbl_VerboseMode)
{
- AcpiLogError (
+ fprintf (stderr,
"Input file: %s contains table [%4.4s], 0x%X (%u) bytes\n",
Pathname, Table->Signature, FileSize, FileSize);
}
diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c
index 9394e98cf..ad02f6d03 100644
--- a/source/tools/acpidump/apfiles.c
+++ b/source/tools/acpidump/apfiles.c
@@ -146,7 +146,7 @@ ApIsExistingFile (
if (!stat (Pathname, &StatInfo))
{
- AcpiLogError ("Target path already exists, overwrite? [y|n] ");
+ fprintf (stderr, "Target path already exists, overwrite? [y|n] ");
if (getchar () != 'y')
{
@@ -188,10 +188,10 @@ ApOpenOutputFile (
/* Point stdout to the file */
- File = AcpiOsOpenFile (Pathname, ACPI_FILE_WRITING);
+ File = fopen (Pathname, "w");
if (!File)
{
- AcpiLogError ("Could not open output file: %s\n", Pathname);
+ fprintf (stderr, "Could not open output file: %s\n", Pathname);
return (-1);
}
@@ -225,7 +225,7 @@ ApWriteToBinaryFile (
char Filename[ACPI_NAME_SIZE + 16];
char InstanceStr [16];
ACPI_FILE File;
- size_t Actual;
+ ACPI_SIZE Actual;
UINT32 TableLength;
@@ -254,7 +254,7 @@ ApWriteToBinaryFile (
if (Instance > 0)
{
- AcpiUtSnprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance);
+ snprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance);
strcat (Filename, InstanceStr);
}
@@ -262,30 +262,29 @@ ApWriteToBinaryFile (
if (Gbl_VerboseMode)
{
- AcpiLogError (
+ fprintf (stderr,
"Writing [%4.4s] to binary file: %s 0x%X (%u) bytes\n",
Table->Signature, Filename, Table->Length, Table->Length);
}
/* Open the file and dump the entire table in binary mode */
- File = AcpiOsOpenFile (Filename,
- ACPI_FILE_WRITING | ACPI_FILE_BINARY);
+ File = fopen (Filename, "wb");
if (!File)
{
- AcpiLogError ("Could not open output file: %s\n", Filename);
+ fprintf (stderr, "Could not open output file: %s\n", Filename);
return (-1);
}
- Actual = AcpiOsWriteFile (File, Table, 1, TableLength);
+ Actual = fwrite (Table, 1, TableLength, File);
if (Actual != TableLength)
{
- AcpiLogError ("Error writing binary output file: %s\n", Filename);
- AcpiOsCloseFile (File);
+ fprintf (stderr, "Error writing binary output file: %s\n", Filename);
+ fclose (File);
return (-1);
}
- AcpiOsCloseFile (File);
+ fclose (File);
return (0);
}
@@ -311,15 +310,15 @@ ApGetTableFromFile (
ACPI_TABLE_HEADER *Buffer = NULL;
ACPI_FILE File;
UINT32 FileSize;
- size_t Actual;
+ ACPI_SIZE Actual;
/* Must use binary mode */
- File = AcpiOsOpenFile (Pathname, ACPI_FILE_READING | ACPI_FILE_BINARY);
+ File = fopen (Pathname, "rb");
if (!File)
{
- AcpiLogError ("Could not open input file: %s\n", Pathname);
+ fprintf (stderr, "Could not open input file: %s\n", Pathname);
return (NULL);
}
@@ -328,7 +327,7 @@ ApGetTableFromFile (
FileSize = CmGetFileSize (File);
if (FileSize == ACPI_UINT32_MAX)
{
- AcpiLogError (
+ fprintf (stderr,
"Could not get input file size: %s\n", Pathname);
goto Cleanup;
}
@@ -338,18 +337,17 @@ ApGetTableFromFile (
Buffer = ACPI_ALLOCATE_ZEROED (FileSize);
if (!Buffer)
{
- AcpiLogError (
+ fprintf (stderr,
"Could not allocate file buffer of size: %u\n", FileSize);
goto Cleanup;
}
/* Read the entire file */
- Actual = AcpiOsReadFile (File, Buffer, 1, FileSize);
+ Actual = fread (Buffer, 1, FileSize, File);
if (Actual != FileSize)
{
- AcpiLogError (
- "Could not read input file: %s\n", Pathname);
+ fprintf (stderr, "Could not read input file: %s\n", Pathname);
ACPI_FREE (Buffer);
Buffer = NULL;
goto Cleanup;
@@ -358,6 +356,6 @@ ApGetTableFromFile (
*OutFileSize = FileSize;
Cleanup:
- AcpiOsCloseFile (File);
+ fclose (File);
return (Buffer);
}
diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c
index cfe0c3261..0e0e5b218 100644
--- a/source/tools/acpidump/apmain.c
+++ b/source/tools/acpidump/apmain.c
@@ -233,7 +233,7 @@ ApInsertAction (
CurrentAction++;
if (CurrentAction > AP_MAX_ACTIONS)
{
- AcpiLogError ("Too many table options (max %u)\n", AP_MAX_ACTIONS);
+ fprintf (stderr, "Too many table options (max %u)\n", AP_MAX_ACTIONS);
return (-1);
}
@@ -287,7 +287,7 @@ ApDoOptions (
}
else
{
- AcpiLogError ("%s: Cannot handle this switch, please use on|off\n",
+ fprintf (stderr, "%s: Cannot handle this switch, please use on|off\n",
AcpiGbl_Optarg);
return (-1);
}
@@ -313,7 +313,7 @@ ApDoOptions (
ACPI_MAX64_BYTE_WIDTH, &Gbl_RsdpBase);
if (ACPI_FAILURE (Status))
{
- AcpiLogError ("%s: Could not convert to a physical address\n",
+ fprintf (stderr, "%s: Could not convert to a physical address\n",
AcpiGbl_Optarg);
return (-1);
}
@@ -344,7 +344,7 @@ ApDoOptions (
case 'z': /* Verbose mode */
Gbl_VerboseMode = TRUE;
- AcpiLogError (ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
+ fprintf (stderr, ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
continue;
/*
@@ -427,6 +427,7 @@ acpi_main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
AcpiOsInitialize ();
Gbl_OutputFile = ACPI_FILE_OUT;
+ AcpiGbl_IntegerByteWidth = 8;
/* Process command line options */
@@ -469,7 +470,7 @@ acpi_main (
default:
- AcpiLogError ("Internal error, invalid action: 0x%X\n",
+ fprintf (stderr, "Internal error, invalid action: 0x%X\n",
Action->ToBeDone);
return (-1);
}
@@ -487,11 +488,11 @@ acpi_main (
/* Summary for the output file */
FileSize = CmGetFileSize (Gbl_OutputFile);
- AcpiLogError ("Output file %s contains 0x%X (%u) bytes\n\n",
+ fprintf (stderr, "Output file %s contains 0x%X (%u) bytes\n\n",
Gbl_OutputFilename, FileSize, FileSize);
}
- AcpiOsCloseFile (Gbl_OutputFile);
+ fclose (Gbl_OutputFile);
}
return (Status);
diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h
index 12199b04c..aaa7f9099 100644
--- a/source/tools/acpiexec/aecommon.h
+++ b/source/tools/acpiexec/aecommon.h
@@ -131,11 +131,6 @@
#include "amlresrc.h"
#include "acapps.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
/*
* Debug Regions
@@ -173,9 +168,11 @@ extern ACPI_CONNECTION_INFO AeMyContext;
#define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\
AcpiOsPrintf PARAM_LIST(fp);}
+#ifndef _GNU_EFI
void ACPI_SYSTEM_XFACE
AeCtrlCHandler (
int Sig);
+#endif
ACPI_STATUS
AeBuildLocalTables (
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index f08ffbe8e..c3d0a7db8 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -192,10 +192,12 @@ static char *TableEvents[] =
#endif /* !ACPI_REDUCED_HARDWARE */
-static UINT32 SigintCount = 0;
static AE_DEBUG_REGIONS AeRegions;
+#ifndef _GNU_EFI
+static UINT32 SigintCount = 0;
+
/******************************************************************************
*
* FUNCTION: AeCtrlCHandler
@@ -232,6 +234,7 @@ AeCtrlCHandler (
(void) AcpiOsTerminate ();
exit (0);
}
+#endif
/******************************************************************************
diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c
index 57c20dce0..996cc8e9c 100644
--- a/source/tools/acpiexec/aeinitfile.c
+++ b/source/tools/acpiexec/aeinitfile.c
@@ -122,6 +122,8 @@
/* Local prototypes */
+#ifndef ACPI_DISABLE_OBJECT_OVERRIDE
+
static void
AeDoOneOverride (
char *Pathname,
@@ -158,7 +160,8 @@ AeOpenInitializationFile (
InitFile = fopen (Filename, "r");
if (!InitFile)
{
- perror ("Could not open initialization file");
+ fprintf (stderr,
+ "Could not open initialization file: %s\n", Filename);
return (-1);
}
@@ -303,3 +306,5 @@ AeDoOneOverride (
AcpiOsPrintf ("New value: 0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Value));
}
+
+#endif
diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c
index a645ffa27..b153121fe 100644
--- a/source/tools/acpiexec/aemain.c
+++ b/source/tools/acpiexec/aemain.c
@@ -114,7 +114,6 @@
*****************************************************************************/
#include "aecommon.h"
-#include "errno.h"
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("aemain")
@@ -131,7 +130,6 @@
* Windows: The setargv.obj module must be linked in to automatically
* expand wildcards.
*/
-extern BOOLEAN AcpiGbl_DebugTimeout;
/* Local prototypes */
@@ -398,10 +396,12 @@ AeDoOptions (
return (-1);
}
+#ifndef ACPI_DISABLE_OBJECT_OVERRIDE
if (AeOpenInitializationFile (AcpiGbl_Optarg))
{
return (-1);
}
+#endif
break;
default:
@@ -519,10 +519,17 @@ AeDoOptions (
*
*****************************************************************************/
+#ifndef _GNU_EFI
int ACPI_SYSTEM_XFACE
main (
int argc,
- char **argv)
+ char *argv[])
+#else
+int ACPI_SYSTEM_XFACE
+acpi_main (
+ int argc,
+ char *argv[])
+#endif
{
ACPI_NEW_TABLE_DESC *ListHead = NULL;
ACPI_STATUS Status;
@@ -531,7 +538,9 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
+#ifndef _GNU_EFI
signal (SIGINT, AeCtrlCHandler);
+#endif
/* Init debug globals */