[prev in list] [next in list] [prev in thread] [next in thread]
List: fwts-devel
Subject: [PATCH 1/3] acpica: update to version 20140627 (LP: #1335280)
From: Colin King <colin.king () canonical ! com>
Date: 2014-06-27 19:17:42
Message-ID: 1403896664-29777-2-git-send-email-colin.king () canonical ! com
[Download RAW message or body]
From: Colin Ian King <colin.king@canonical.com>
For the specific ACPICA changes please refer to:
https://lists.acpica.org/pipermail/devel/2014-June/000656.html
This update also addresses 7 issues found by Coverity Scan.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
src/acpica/Makefile.am | 3 +
src/acpica/fwts_acpica.c | 4 +-
src/acpica/source/common/ahpredef.c | 1 -
src/acpica/source/common/cmfsize.c | 20 +-
src/acpica/source/compiler/aslanalyze.c | 48 --
src/acpica/source/compiler/aslcompiler.h | 9 -
src/acpica/source/compiler/aslmain.c | 1 +
src/acpica/source/compiler/aslmessages.c | 1 -
src/acpica/source/compiler/aslmessages.h | 1 -
src/acpica/source/compiler/aslmethod.c | 20 -
src/acpica/source/compiler/aslstubs.c | 25 -
src/acpica/source/components/debugger/dbfileio.c | 316 +-------
src/acpica/source/components/debugger/dbtest.c | 1 +
.../source/components/disassembler/dmbuffer.c | 72 +-
src/acpica/source/components/disassembler/dmwalk.c | 28 +-
src/acpica/source/components/executer/exfield.c | 103 ++-
src/acpica/source/components/hardware/hwregs.c | 8 +-
src/acpica/source/components/namespace/nsobject.c | 11 +
src/acpica/source/components/tables/tbdata.c | 65 +-
src/acpica/source/components/tables/tbinstal.c | 8 +-
src/acpica/source/components/tables/tbutils.c | 4 -
src/acpica/source/components/utilities/utbuffer.c | 135 ++++
src/acpica/source/components/utilities/utcopy.c | 7 +
src/acpica/source/components/utilities/utdebug.c | 30 +
src/acpica/source/components/utilities/utfileio.c | 435 +++++++++++
src/acpica/source/components/utilities/utglobal.c | 157 ----
src/acpica/source/components/utilities/utinit.c | 156 ++++
src/acpica/source/components/utilities/utprint.c | 868 +++++++++++++++++++++
src/acpica/source/include/acapps.h | 9 +-
src/acpica/source/include/acdebug.h | 5 -
src/acpica/source/include/acglobal.h | 8 +-
src/acpica/source/include/acnames.h | 1 -
src/acpica/source/include/acpi.h | 4 +-
src/acpica/source/include/acpiosxf.h | 49 ++
src/acpica/source/include/acpixf.h | 36 +-
src/acpica/source/include/acpredef.h | 6 -
src/acpica/source/include/actables.h | 14 +-
src/acpica/source/include/actypes.h | 16 +
src/acpica/source/include/acutils.h | 70 +-
src/acpica/source/include/platform/acenv.h | 53 +-
src/acpica/source/include/platform/acenvex.h | 135 ++++
src/acpica/source/include/platform/aclinux.h | 194 +----
src/acpica/source/include/platform/aclinuxex.h | 209 +++++
.../source/os_specific/service_layers/oslibcfs.c | 323 ++++++++
.../source/os_specific/service_layers/osunixxf.c | 66 +-
src/acpica/source/tools/acpiexec/aehandlers.c | 16 +-
46 files changed, 2908 insertions(+), 843 deletions(-)
create mode 100644 src/acpica/source/components/utilities/utfileio.c
create mode 100644 src/acpica/source/components/utilities/utprint.c
create mode 100644 src/acpica/source/include/platform/acenvex.h
create mode 100644 src/acpica/source/include/platform/aclinuxex.h
create mode 100644 src/acpica/source/os_specific/service_layers/oslibcfs.c
diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
index 2204669..b2dd752 100644
--- a/src/acpica/Makefile.am
+++ b/src/acpica/Makefile.am
@@ -65,6 +65,7 @@ libfwtsacpica_la_SOURCES = \
fwts_acpica.c \
osunixxf_munged.c \
dscontrol_munged.c \
+ source/os_specific/service_layers/oslibcfs.c \
source/components/debugger/dbcmds.c \
source/components/debugger/dbdisply.c \
source/components/debugger/dbexec.c \
@@ -213,6 +214,7 @@ libfwtsacpica_la_SOURCES = \
source/components/utilities/utdebug.c \
source/components/utilities/utdelete.c \
source/components/utilities/uteval.c \
+ source/components/utilities/utfileio.c \
source/components/utilities/utglobal.c \
source/components/utilities/utids.c \
source/components/utilities/utinit.c \
@@ -230,6 +232,7 @@ libfwtsacpica_la_SOURCES = \
source/components/utilities/utdecode.c \
source/components/utilities/utexcep.c \
source/components/utilities/utpredef.c \
+ source/components/utilities/utprint.c \
source/components/utilities/utstring.c \
source/components/utilities/utownerid.c \
source/components/utilities/utxfinit.c \
diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
index cc691c3..ce6600f 100644
--- a/src/acpica/fwts_acpica.c
+++ b/src/acpica/fwts_acpica.c
@@ -385,10 +385,10 @@ static ACPI_STATUS fwts_region_handler(
}
/*
- * AeLocalGetRootPointer()
+ * AcpiOsGetRootPointer()
* override ACPICA AeLocalGetRootPointer to return a local copy of the RSDP
*/
-ACPI_PHYSICAL_ADDRESS AeLocalGetRootPointer(void)
+ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer(void)
{
return (ACPI_PHYSICAL_ADDRESS)fwts_acpica_RSDP;
}
diff --git a/src/acpica/source/common/ahpredef.c \
b/src/acpica/source/common/ahpredef.c index 21038ab..525c7bb 100644
--- a/src/acpica/source/common/ahpredef.c
+++ b/src/acpica/source/common/ahpredef.c
@@ -289,7 +289,6 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] =
AH_PREDEF ("_PR3", "Power Resources for D3hot", "Returns a list of dependent \
power resources to enter state D3hot"),
AH_PREDEF ("_PRE", "Power Resources for Enumeration", "Returns a list of \
dependent power resources to enumerate devices on a bus"),
AH_PREDEF ("_PRL", "Power Source Redundancy List", "Returns a list of power \
source devices in the same redundancy grouping"),
- AH_PREDEF ("_PRP", "Device Properties", "Returns a list of device property \
information"),
AH_PREDEF ("_PRS", "Possible Resource Settings", "Returns a list of a \
device's possible resource settings"),
AH_PREDEF ("_PRT", "PCI Routing Table", "Returns a list of PCI interrupt \
mappings"),
AH_PREDEF ("_PRW", "Power Resources for Wake", "Returns a list of dependent \
power resources for waking"),
diff --git a/src/acpica/source/common/cmfsize.c b/src/acpica/source/common/cmfsize.c
index 1bb3fba..1511683 100755
--- a/src/acpica/source/common/cmfsize.c
+++ b/src/acpica/source/common/cmfsize.c
@@ -131,33 +131,34 @@
* RETURN: File Size. On error, -1 (ACPI_UINT32_MAX)
*
* DESCRIPTION: Get the size of a file. Uses seek-to-EOF. File must be open.
- * Does not disturb the current file pointer. Uses perror for
- * error messages.
+ * Does not disturb the current file pointer.
*
******************************************************************************/
UINT32
CmGetFileSize (
- FILE *File)
+ ACPI_FILE File)
{
long FileSize;
long CurrentOffset;
+ ACPI_STATUS Status;
/* Save the current file pointer, seek to EOF to obtain file size */
- CurrentOffset = ftell (File);
+ CurrentOffset = AcpiOsGetFileOffset (File);
if (CurrentOffset < 0)
{
goto OffsetError;
}
- if (fseek (File, 0, SEEK_END))
+ Status = AcpiOsSetFileOffset (File, 0, ACPI_FILE_END);
+ if (ACPI_FAILURE (Status))
{
goto SeekError;
}
- FileSize = ftell (File);
+ FileSize = AcpiOsGetFileOffset (File);
if (FileSize < 0)
{
goto OffsetError;
@@ -165,7 +166,8 @@ CmGetFileSize (
/* Restore original file pointer */
- if (fseek (File, CurrentOffset, SEEK_SET))
+ Status = AcpiOsSetFileOffset (File, CurrentOffset, ACPI_FILE_BEGIN);
+ if (ACPI_FAILURE (Status))
{
goto SeekError;
}
@@ -174,10 +176,10 @@ CmGetFileSize (
OffsetError:
- perror ("Could not get file offset");
+ AcpiLogError ("Could not get file offset");
return (ACPI_UINT32_MAX);
SeekError:
- perror ("Could not seek file");
+ AcpiLogError ("Could not set file offset");
return (ACPI_UINT32_MAX);
}
diff --git a/src/acpica/source/compiler/aslanalyze.c \
b/src/acpica/source/compiler/aslanalyze.c index 8bfc9ac..16e28d3 100644
--- a/src/acpica/source/compiler/aslanalyze.c
+++ b/src/acpica/source/compiler/aslanalyze.c
@@ -641,51 +641,3 @@ ApCheckRegMethod (
AslError (ASL_WARNING, ASL_MSG_NO_REGION, Op, NULL);
}
-
-
-/*******************************************************************************
- *
- * FUNCTION: ApFindNameInScope
- *
- * PARAMETERS: Name - Name to search for
- * Op - Current parse op
- *
- * RETURN: TRUE if name found in the same scope as Op.
- *
- * DESCRIPTION: Determine if a name appears in the same scope as Op, as either
- * a Method() or a Name().
- *
- ******************************************************************************/
-
-BOOLEAN
-ApFindNameInScope (
- char *Name,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_PARSE_OBJECT *Next;
- ACPI_PARSE_OBJECT *Parent;
-
-
- /* Get the start of the current scope */
-
- Parent = Op->Asl.Parent;
- Next = Parent->Asl.Child;
-
- /* Search entire scope for a match to the name */
-
- while (Next)
- {
- if ((Next->Asl.ParseOpcode == PARSEOP_METHOD) ||
- (Next->Asl.ParseOpcode == PARSEOP_NAME))
- {
- if (ACPI_COMPARE_NAME (Name, Next->Asl.NameSeg))
- {
- return (TRUE);
- }
- }
-
- Next = Next->Asl.Next;
- }
-
- return (FALSE);
-}
diff --git a/src/acpica/source/compiler/aslcompiler.h \
b/src/acpica/source/compiler/aslcompiler.h index c7692ca..6e59b0f 100644
--- a/src/acpica/source/compiler/aslcompiler.h
+++ b/src/acpica/source/compiler/aslcompiler.h
@@ -347,11 +347,6 @@ void
ApCheckRegMethod (
ACPI_PARSE_OBJECT *Op);
-BOOLEAN
-ApFindNameInScope (
- char *Name,
- ACPI_PARSE_OBJECT *Op);
-
/*
* aslerror - error handling/reporting
@@ -422,10 +417,6 @@ void
AeClearErrorLog (
void);
-ACPI_PHYSICAL_ADDRESS
-AeLocalGetRootPointer (
- void);
-
/*
* asllisting - generate all "listing" type files
diff --git a/src/acpica/source/compiler/aslmain.c \
b/src/acpica/source/compiler/aslmain.c index 1dfbc0a..10f64bd 100644
--- a/src/acpica/source/compiler/aslmain.c
+++ b/src/acpica/source/compiler/aslmain.c
@@ -413,6 +413,7 @@ main (
return (-1);
}
+ AcpiOsInitialize ();
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
/* Initialize preprocessor and compiler before command line processing */
diff --git a/src/acpica/source/compiler/aslmessages.c \
b/src/acpica/source/compiler/aslmessages.c index 11b5d57..5b271d3 100644
--- a/src/acpica/source/compiler/aslmessages.c
+++ b/src/acpica/source/compiler/aslmessages.c
@@ -305,7 +305,6 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_WRITE */ "Could not write file",
/* ASL_MSG_RANGE */ "Constant out of range",
/* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer",
-/* ASL_MSG_MISSING_DEPENDENCY */ "Missing dependency"
};
/* Table compiler */
diff --git a/src/acpica/source/compiler/aslmessages.h \
b/src/acpica/source/compiler/aslmessages.h index 5743075..150425c 100644
--- a/src/acpica/source/compiler/aslmessages.h
+++ b/src/acpica/source/compiler/aslmessages.h
@@ -307,7 +307,6 @@ typedef enum
ASL_MSG_WRITE,
ASL_MSG_RANGE,
ASL_MSG_BUFFER_ALLOCATION,
- ASL_MSG_MISSING_DEPENDENCY,
/* These messages are used by the Data Table compiler only */
diff --git a/src/acpica/source/compiler/aslmethod.c \
b/src/acpica/source/compiler/aslmethod.c index 7aca8f6..edf2fa4 100644
--- a/src/acpica/source/compiler/aslmethod.c
+++ b/src/acpica/source/compiler/aslmethod.c
@@ -180,17 +180,6 @@ MtMethodAnalysisWalkBegin (
WalkInfo->MethodStack = MethodInfo;
- /* Special handling for _PRP, must have a _HID also */
-
- if (!ACPI_STRCMP (METHOD_NAME__PRP, Op->Asl.NameSeg))
- {
- if (!ApFindNameInScope (METHOD_NAME__HID, Op))
- {
- AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op,
- "_PRP requires _HID in same scope");
- }
- }
-
/* Get the name node */
Next = Op->Asl.Child;
@@ -496,15 +485,6 @@ MtMethodAnalysisWalkBegin (
}
}
- else if (!ACPI_STRCMP (METHOD_NAME__PRP, Op->Asl.NameSeg))
- {
- if (!ApFindNameInScope (METHOD_NAME__HID, Op))
- {
- AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op,
- "_PRP requires _HID in same scope");
- }
- }
-
break;
default:
diff --git a/src/acpica/source/compiler/aslstubs.c \
b/src/acpica/source/compiler/aslstubs.c index 9e43a0d..a57c4f4 100644
--- a/src/acpica/source/compiler/aslstubs.c
+++ b/src/acpica/source/compiler/aslstubs.c
@@ -129,13 +129,6 @@
* Things like Events, Global Lock, etc. are not used
* by the compiler, so they are stubbed out here.
*/
-ACPI_PHYSICAL_ADDRESS
-AeLocalGetRootPointer (
- void)
-{
- return (0);
-}
-
void
AcpiNsExecModuleCodeList (
void)
@@ -304,21 +297,3 @@ AcpiTbFindTable (
{
return (AE_SUPPORT);
}
-
-/* OSL interfaces */
-
-ACPI_THREAD_ID
-AcpiOsGetThreadId (
- void)
-{
- return (1);
-}
-
-ACPI_STATUS
-AcpiOsExecute (
- ACPI_EXECUTE_TYPE Type,
- ACPI_OSD_EXEC_CALLBACK Function,
- void *Context)
-{
- return (AE_SUPPORT);
-}
diff --git a/src/acpica/source/components/debugger/dbfileio.c \
b/src/acpica/source/components/debugger/dbfileio.c index 3d456e5..3581d83 100644
--- a/src/acpica/source/components/debugger/dbfileio.c
+++ b/src/acpica/source/components/debugger/dbfileio.c
@@ -118,14 +118,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
-
-#ifdef ACPI_APPLICATION
#include "actables.h"
-#endif
-
-#ifdef ACPI_ASL_COMPILER
-#include "aslcompiler.h"
-#endif
#if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER)
@@ -134,18 +127,6 @@
#ifdef ACPI_DEBUGGER
-/* Local prototypes */
-
-#ifdef ACPI_APPLICATION
-
-static ACPI_STATUS
-AcpiDbCheckTextModeCorruption (
- UINT8 *Table,
- UINT32 TableLength,
- UINT32 FileLength);
-
-#endif
-
/*******************************************************************************
*
* FUNCTION: AcpiDbCloseDebugFile
@@ -218,245 +199,6 @@ AcpiDbOpenDebugFile (
/*******************************************************************************
*
- * FUNCTION: AcpiDbCheckTextModeCorruption
- *
- * PARAMETERS: Table - Table buffer
- * TableLength - Length of table from the table header
- * FileLength - Length of the file that contains the table
- *
- * RETURN: Status
- *
- * DESCRIPTION: Check table for text mode file corruption where all linefeed
- * characters (LF) have been replaced by carriage return linefeed
- * pairs (CR/LF).
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbCheckTextModeCorruption (
- UINT8 *Table,
- UINT32 TableLength,
- UINT32 FileLength)
-{
- UINT32 i;
- UINT32 Pairs = 0;
-
-
- if (TableLength != FileLength)
- {
- ACPI_WARNING ((AE_INFO,
- "File length (0x%X) is not the same as the table length (0x%X)",
- FileLength, TableLength));
- }
-
- /* Scan entire table to determine if each LF has been prefixed with a CR */
-
- for (i = 1; i < FileLength; i++)
- {
- if (Table[i] == 0x0A)
- {
- if (Table[i - 1] != 0x0D)
- {
- /* The LF does not have a preceding CR, table not corrupted */
-
- return (AE_OK);
- }
- else
- {
- /* Found a CR/LF pair */
-
- Pairs++;
- }
- i++;
- }
- }
-
- if (!Pairs)
- {
- return (AE_OK);
- }
-
- /*
- * Entire table scanned, each CR is part of a CR/LF pair --
- * meaning that the table was treated as a text file somewhere.
- *
- * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the
- * original table are left untouched by the text conversion process --
- * meaning that we cannot simply replace CR/LF pairs with LFs.
- */
- AcpiOsPrintf ("Table has been corrupted by text mode conversion\n");
- AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs);
- AcpiOsPrintf ("Table cannot be repaired!\n");
- return (AE_BAD_VALUE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbReadTable
- *
- * PARAMETERS: fp - File that contains table
- * Table - Return value, buffer with table
- * TableLength - Return value, length of table
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load the DSDT from the file pointer
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbReadTable (
- FILE *fp,
- ACPI_TABLE_HEADER **Table,
- UINT32 *TableLength)
-{
- ACPI_TABLE_HEADER TableHeader;
- UINT32 Actual;
- ACPI_STATUS Status;
- UINT32 FileSize;
- BOOLEAN StandardHeader = TRUE;
-
-
- /* Get the file size */
-
- FileSize = CmGetFileSize (fp);
- if (FileSize == ACPI_UINT32_MAX)
- {
- return (AE_ERROR);
- }
-
- if (FileSize < 4)
- {
- return (AE_BAD_HEADER);
- }
-
- /* Read the signature */
-
- if (fread (&TableHeader, 1, 4, fp) != 4)
- {
- AcpiOsPrintf ("Could not read the table signature\n");
- return (AE_BAD_HEADER);
- }
-
- fseek (fp, 0, SEEK_SET);
-
- /* The RSDP table does not have standard ACPI header */
-
- if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD "))
- {
- *TableLength = FileSize;
- StandardHeader = FALSE;
- }
- else
- {
- /* Read the table header */
-
- if (fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp) !=
- sizeof (ACPI_TABLE_HEADER))
- {
- AcpiOsPrintf ("Could not read the table header\n");
- return (AE_BAD_HEADER);
- }
-
-#if 0
- /* Validate the table header/length */
-
- Status = AcpiTbValidateTableHeader (&TableHeader);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Table header is invalid!\n");
- return (Status);
- }
-#endif
-
- /* File size must be at least as long as the Header-specified length */
-
- if (TableHeader.Length > FileSize)
- {
- AcpiOsPrintf (
- "TableHeader length [0x%X] greater than the input file size \
[0x%X]\n",
- TableHeader.Length, FileSize);
-
-#ifdef ACPI_ASL_COMPILER
- Status = FlCheckForAscii (fp, NULL, FALSE);
- if (ACPI_SUCCESS (Status))
- {
- AcpiOsPrintf ("File appears to be ASCII only, must be binary\n",
- TableHeader.Length, FileSize);
- }
-#endif
- return (AE_BAD_HEADER);
- }
-
-#ifdef ACPI_OBSOLETE_CODE
- /* We only support a limited number of table types */
-
- if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) &&
- !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) &&
- !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT))
- {
- AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n",
- (char *) TableHeader.Signature);
- ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
- return (AE_ERROR);
- }
-#endif
-
- *TableLength = TableHeader.Length;
- }
-
- /* Allocate a buffer for the table */
-
- *Table = AcpiOsAllocate ((size_t) FileSize);
- if (!*Table)
- {
- AcpiOsPrintf (
- "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n",
- TableHeader.Signature, *TableLength);
- return (AE_NO_MEMORY);
- }
-
- /* Get the rest of the table */
-
- fseek (fp, 0, SEEK_SET);
- Actual = fread (*Table, 1, (size_t) FileSize, fp);
- if (Actual == FileSize)
- {
- if (StandardHeader)
- {
- /* Now validate the checksum */
-
- Status = AcpiTbVerifyChecksum ((void *) *Table,
- ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length);
-
- if (Status == AE_BAD_CHECKSUM)
- {
- Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
- FileSize, (*Table)->Length);
- return (Status);
- }
- }
- return (AE_OK);
- }
-
- if (Actual > 0)
- {
- AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n",
- FileSize, Actual);
- return (AE_OK);
- }
-
- AcpiOsPrintf ("Error - could not read the table file\n");
- AcpiOsFree (*Table);
- *Table = NULL;
- *TableLength = 0;
- return (AE_ERROR);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AeLocalLoadTable
*
* PARAMETERS: Table - pointer to a buffer containing the entire
@@ -528,62 +270,6 @@ AeLocalLoadTable (
return_ACPI_STATUS (Status);
}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbReadTableFromFile
- *
- * PARAMETERS: Filename - File where table is located
- * Table - Where a pointer to the table is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Get an ACPI table from a file
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDbReadTableFromFile (
- char *Filename,
- ACPI_TABLE_HEADER **Table)
-{
- FILE *File;
- UINT32 FileSize;
- UINT32 TableLength;
- ACPI_STATUS Status = AE_ERROR;
-
-
- /* Open the file, get current size */
-
- File = fopen (Filename, "rb");
- if (!File)
- {
- perror ("Could not open input file");
- return (Status);
- }
-
- FileSize = CmGetFileSize (File);
- if (FileSize == ACPI_UINT32_MAX)
- {
- goto Exit;
- }
-
- /* Get the entire file */
-
- fprintf (stderr, "Loading Acpi table from file %10s - Length %.8u (%06X)\n",
- Filename, FileSize, FileSize);
-
- Status = AcpiDbReadTable (File, Table, &TableLength);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not get table from the file\n");
- }
-
-Exit:
- fclose(File);
- return (Status);
- }
#endif
@@ -611,7 +297,7 @@ AcpiDbGetTableFromFile (
BOOLEAN IsAmlTable = TRUE;
- Status = AcpiDbReadTableFromFile (Filename, &Table);
+ Status = AcpiUtReadTableFromFile (Filename, &Table);
if (ACPI_FAILURE (Status))
{
return (Status);
diff --git a/src/acpica/source/components/debugger/dbtest.c \
b/src/acpica/source/components/debugger/dbtest.c index 34ccdac..fd7201a 100755
--- a/src/acpica/source/components/debugger/dbtest.c
+++ b/src/acpica/source/components/debugger/dbtest.c
@@ -1114,6 +1114,7 @@ AcpiDbEvaluateOnePredefinedName (
Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
if (ACPI_FAILURE (Status))
{
+ ACPI_FREE (Pathname);
return (Status);
}
diff --git a/src/acpica/source/components/disassembler/dmbuffer.c \
b/src/acpica/source/components/disassembler/dmbuffer.c index cfdf33b..70d28e3 100644
--- a/src/acpica/source/components/disassembler/dmbuffer.c
+++ b/src/acpica/source/components/disassembler/dmbuffer.c
@@ -143,6 +143,8 @@ AcpiDmPldBuffer (
UINT8 *ByteData,
UINT32 ByteCount);
+#define ACPI_BUFFER_BYTES_PER_LINE 8
+
/*******************************************************************************
*
@@ -166,6 +168,9 @@ AcpiDmDisasmByteList (
UINT32 ByteCount)
{
UINT32 i;
+ UINT32 j;
+ UINT32 CurrentIndex;
+ UINT8 BufChar;
if (!ByteCount)
@@ -173,39 +178,68 @@ AcpiDmDisasmByteList (
return;
}
- /* Dump the byte list */
-
- for (i = 0; i < ByteCount; i++)
+ for (i = 0; i < ByteCount; i += ACPI_BUFFER_BYTES_PER_LINE)
{
- /* New line every 8 bytes */
+ /* Line indent and offset prefix for each new line */
+
+ AcpiDmIndent (Level);
+ if (ByteCount > ACPI_BUFFER_BYTES_PER_LINE)
+ {
+ AcpiOsPrintf ("/* %04X */ ", i);
+ }
+
+ /* Dump the actual hex values */
- if (((i % 8) == 0) && (i < ByteCount))
+ for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++)
{
- if (i > 0)
+ CurrentIndex = i + j;
+ if (CurrentIndex >= ByteCount)
{
- AcpiOsPrintf ("\n");
+ /* Dump fill spaces */
+
+ AcpiOsPrintf (" ");
+ continue;
}
- AcpiDmIndent (Level);
- if (ByteCount > 8)
+ AcpiOsPrintf (" 0x%2.2X", ByteData[CurrentIndex]);
+
+ /* Add comma if there are more bytes to display */
+
+ if (CurrentIndex < (ByteCount - 1))
{
- AcpiOsPrintf ("/* %04X */ ", i);
+ AcpiOsPrintf (",");
+ }
+ else
+ {
+ AcpiOsPrintf (" ");
}
}
- AcpiOsPrintf (" 0x%2.2X", (UINT32) ByteData[i]);
-
- /* Add comma if there are more bytes to display */
+ /* Dump the ASCII equivalents within a comment */
- if (i < (ByteCount -1))
+ AcpiOsPrintf (" /* ");
+ for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++)
{
- AcpiOsPrintf (",");
+ CurrentIndex = i + j;
+ if (CurrentIndex >= ByteCount)
+ {
+ break;
+ }
+
+ BufChar = ByteData[CurrentIndex];
+ if (ACPI_IS_PRINT (BufChar))
+ {
+ AcpiOsPrintf ("%c", BufChar);
+ }
+ else
+ {
+ AcpiOsPrintf (".");
+ }
}
- }
- if (Level)
- {
- AcpiOsPrintf ("\n");
+ /* Finished with this line */
+
+ AcpiOsPrintf (" */\n");
}
}
diff --git a/src/acpica/source/components/disassembler/dmwalk.c \
b/src/acpica/source/components/disassembler/dmwalk.c index ff72620..8c877ae 100644
--- a/src/acpica/source/components/disassembler/dmwalk.c
+++ b/src/acpica/source/components/disassembler/dmwalk.c
@@ -1030,6 +1030,13 @@ AcpiDmAscendingOp (
}
/*
+ * The parent Op is guaranteed to be valid because of the flag
+ * ACPI_PARSEOP_PARAMLIST -- which means that this op is part of
+ * a parameter list and thus has a valid parent.
+ */
+ ParentOp = Op->Common.Parent;
+
+ /*
* Just completed a parameter node for something like "Buffer (param)".
* Close the paren and open up the term list block with a brace
*/
@@ -1037,25 +1044,24 @@ AcpiDmAscendingOp (
{
AcpiOsPrintf (")");
- /* Emit description comment for Name() with a predefined ACPI name */
-
- ParentOp = Op->Common.Parent;
- if (ParentOp)
+ /*
+ * Emit a description comment for a Name() operator that is a
+ * predefined ACPI name. Must check the grandparent.
+ */
+ ParentOp = ParentOp->Common.Parent;
+ if (ParentOp &&
+ (ParentOp->Asl.AmlOpcode == AML_NAME_OP))
{
- ParentOp = ParentOp->Common.Parent;
- if (ParentOp && ParentOp->Asl.AmlOpcode == AML_NAME_OP)
- {
- AcpiDmPredefinedDescription (ParentOp);
- }
+ AcpiDmPredefinedDescription (ParentOp);
}
+
AcpiOsPrintf ("\n");
AcpiDmIndent (Level - 1);
AcpiOsPrintf ("{\n");
}
else
{
- Op->Common.Parent->Common.DisasmFlags |=
- ACPI_PARSEOP_EMPTY_TERMLIST;
+ ParentOp->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
AcpiOsPrintf (") {");
}
}
diff --git a/src/acpica/source/components/executer/exfield.c \
b/src/acpica/source/components/executer/exfield.c index 3cb1b12..e8ddec8 100644
--- a/src/acpica/source/components/executer/exfield.c
+++ b/src/acpica/source/components/executer/exfield.c
@@ -120,11 +120,80 @@
#include "accommon.h"
#include "acdispat.h"
#include "acinterp.h"
+#include "amlcode.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exfield")
+/* Local prototypes */
+
+static UINT32
+AcpiExGetSerialAccessLength (
+ UINT32 AccessorType,
+ UINT32 AccessLength);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExGetSerialAccessLength
+ *
+ * PARAMETERS: AccessorType - The type of the protocol indicated by region
+ * field access attributes
+ * AccessLength - The access length of the region field
+ *
+ * RETURN: Decoded access length
+ *
+ * DESCRIPTION: This routine returns the length of the GenericSerialBus
+ * protocol bytes
+ *
+ ******************************************************************************/
+
+static UINT32
+AcpiExGetSerialAccessLength (
+ UINT32 AccessorType,
+ UINT32 AccessLength)
+{
+ UINT32 Length;
+
+
+ switch (AccessorType)
+ {
+ case AML_FIELD_ATTRIB_QUICK:
+
+ Length = 0;
+ break;
+
+ case AML_FIELD_ATTRIB_SEND_RCV:
+ case AML_FIELD_ATTRIB_BYTE:
+
+ Length = 1;
+ break;
+
+ case AML_FIELD_ATTRIB_WORD:
+ case AML_FIELD_ATTRIB_WORD_CALL:
+
+ Length = 2;
+ break;
+
+ case AML_FIELD_ATTRIB_MULTIBYTE:
+ case AML_FIELD_ATTRIB_RAW_BYTES:
+ case AML_FIELD_ATTRIB_RAW_PROCESS:
+
+ Length = AccessLength;
+ break;
+
+ case AML_FIELD_ATTRIB_BLOCK:
+ case AML_FIELD_ATTRIB_BLOCK_CALL:
+ default:
+
+ Length = ACPI_GSBUS_BUFFER_SIZE - 2;
+ break;
+ }
+
+ return (Length);
+}
+
/*******************************************************************************
*
@@ -152,6 +221,7 @@ AcpiExReadDataFromField (
ACPI_SIZE Length;
void *Buffer;
UINT32 Function;
+ UINT16 AccessorType;
ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc);
@@ -201,8 +271,20 @@ AcpiExReadDataFromField (
}
else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS)
{
- Length = ACPI_GSBUS_BUFFER_SIZE;
- Function = ACPI_READ | (ObjDesc->Field.Attribute << 16);
+ AccessorType = ObjDesc->Field.Attribute;
+ Length = AcpiExGetSerialAccessLength (AccessorType,
+ ObjDesc->Field.AccessLength);
+
+ /*
+ * Add additional 2 bytes for modeled GenericSerialBus data buffer:
+ * typedef struct {
+ * BYTEStatus; // Byte 0 of the data buffer
+ * BYTELength; // Byte 1 of the data buffer
+ * BYTE[x-1]Data; // Bytes 2-x of the arbitrary length data buffer,
+ * }
+ */
+ Length += 2;
+ Function = ACPI_READ | (AccessorType << 16);
}
else /* IPMI */
{
@@ -323,6 +405,7 @@ AcpiExWriteDataToField (
void *Buffer;
ACPI_OPERAND_OBJECT *BufferDesc;
UINT32 Function;
+ UINT16 AccessorType;
ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc);
@@ -382,8 +465,20 @@ AcpiExWriteDataToField (
}
else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS)
{
- Length = ACPI_GSBUS_BUFFER_SIZE;
- Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16);
+ AccessorType = ObjDesc->Field.Attribute;
+ Length = AcpiExGetSerialAccessLength (AccessorType,
+ ObjDesc->Field.AccessLength);
+
+ /*
+ * Add additional 2 bytes for modeled GenericSerialBus data buffer:
+ * typedef struct {
+ * BYTEStatus; // Byte 0 of the data buffer
+ * BYTELength; // Byte 1 of the data buffer
+ * BYTE[x-1]Data; // Bytes 2-x of the arbitrary length data buffer,
+ * }
+ */
+ Length += 2;
+ Function = ACPI_WRITE | (AccessorType << 16);
}
else /* IPMI */
{
diff --git a/src/acpica/source/components/hardware/hwregs.c \
b/src/acpica/source/components/hardware/hwregs.c index 9950579..24b4cf4 100644
--- a/src/acpica/source/components/hardware/hwregs.c
+++ b/src/acpica/source/components/hardware/hwregs.c
@@ -382,17 +382,19 @@ AcpiHwClearAcpiStatus (
Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS,
ACPI_BITMASK_ALL_FIXED_STATUS);
+
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
+
if (ACPI_FAILURE (Status))
{
- goto UnlockAndExit;
+ goto Exit;
}
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
-UnlockAndExit:
- AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
+Exit:
return_ACPI_STATUS (Status);
}
diff --git a/src/acpica/source/components/namespace/nsobject.c \
b/src/acpica/source/components/namespace/nsobject.c index 7981e62..060157b 100644
--- a/src/acpica/source/components/namespace/nsobject.c
+++ b/src/acpica/source/components/namespace/nsobject.c
@@ -337,6 +337,17 @@ AcpiNsDetachObject (
}
}
+ /*
+ * Detach the object from any data objects (which are still held by
+ * the namespace node)
+ */
+
+ if (ObjDesc->Common.NextObject &&
+ ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
+ {
+ ObjDesc->Common.NextObject = NULL;
+ }
+
/* Reset the node type to untyped */
Node->Type = ACPI_TYPE_ANY;
diff --git a/src/acpica/source/components/tables/tbdata.c \
b/src/acpica/source/components/tables/tbdata.c index 818637e..1e4cbcd 100755
--- a/src/acpica/source/components/tables/tbdata.c
+++ b/src/acpica/source/components/tables/tbdata.c
@@ -424,7 +424,43 @@ AcpiTbInvalidateTable (
/******************************************************************************
*
- * FUNCTION: AcpiTbVerifyTable
+ * FUNCTION: AcpiTbValidateTempTable
+ *
+ * PARAMETERS: TableDesc - Table descriptor
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to validate the table, the returned
+ * table descriptor is in "VALIDATED" state.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiTbValidateTempTable (
+ ACPI_TABLE_DESC *TableDesc)
+{
+
+ if (!TableDesc->Pointer && !AcpiGbl_VerifyTableChecksum)
+ {
+ /*
+ * Only validates the header of the table.
+ * Note that Length contains the size of the mapping after invoking
+ * this work around, this value is required by
+ * AcpiTbReleaseTempTable().
+ * We can do this because in AcpiInitTableDescriptor(), the Length
+ * field of the installed descriptor is filled with the actual
+ * table length obtaining from the table header.
+ */
+ TableDesc->Length = sizeof (ACPI_TABLE_HEADER);
+ }
+
+ return (AcpiTbValidateTable (TableDesc));
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiTbVerifyTempTable
*
* PARAMETERS: TableDesc - Table descriptor
* Signature - Table signature to verify
@@ -437,19 +473,19 @@ AcpiTbInvalidateTable (
*****************************************************************************/
ACPI_STATUS
-AcpiTbVerifyTable (
+AcpiTbVerifyTempTable (
ACPI_TABLE_DESC *TableDesc,
char *Signature)
{
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE (TbVerifyTable);
+ ACPI_FUNCTION_TRACE (TbVerifyTempTable);
/* Validate the table */
- Status = AcpiTbValidateTable (TableDesc);
+ Status = AcpiTbValidateTempTable (TableDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -469,16 +505,19 @@ AcpiTbVerifyTable (
/* Verify the checksum */
- Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
- if (ACPI_FAILURE (Status))
+ if (AcpiGbl_VerifyTableChecksum)
{
- ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
- "%4.4s " ACPI_PRINTF_UINT
- " Attempted table install failed",
- AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ?
- TableDesc->Signature.Ascii : "????",
- ACPI_FORMAT_TO_UINT (TableDesc->Address)));
- goto InvalidateAndExit;
+ Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
+ "%4.4s " ACPI_PRINTF_UINT
+ " Attempted table install failed",
+ AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ?
+ TableDesc->Signature.Ascii : "????",
+ ACPI_FORMAT_TO_UINT (TableDesc->Address)));
+ goto InvalidateAndExit;
+ }
}
return_ACPI_STATUS (AE_OK);
diff --git a/src/acpica/source/components/tables/tbinstal.c \
b/src/acpica/source/components/tables/tbinstal.c index 4560d0f..ab0e879 100644
--- a/src/acpica/source/components/tables/tbinstal.c
+++ b/src/acpica/source/components/tables/tbinstal.c
@@ -282,7 +282,7 @@ AcpiTbInstallFixedTable (
/* Validate and verify a table before installation */
- Status = AcpiTbVerifyTable (&NewTableDesc, Signature);
+ Status = AcpiTbVerifyTempTable (&NewTableDesc, Signature);
if (ACPI_FAILURE (Status))
{
goto ReleaseAndExit;
@@ -362,7 +362,7 @@ AcpiTbInstallStandardTable (
/* Validate and verify a table before installation */
- Status = AcpiTbVerifyTable (&NewTableDesc, NULL);
+ Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL);
if (ACPI_FAILURE (Status))
{
goto ReleaseAndExit;
@@ -527,7 +527,7 @@ FinishOverride:
/* Validate and verify a table before overriding */
- Status = AcpiTbVerifyTable (&NewTableDesc, NULL);
+ Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL);
if (ACPI_FAILURE (Status))
{
return;
@@ -549,7 +549,7 @@ FinishOverride:
*/
AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address,
NewTableDesc.Flags, NewTableDesc.Pointer);
- AcpiTbValidateTable (OldTableDesc);
+ AcpiTbValidateTempTable (OldTableDesc);
/* Release the temporary table descriptor */
diff --git a/src/acpica/source/components/tables/tbutils.c \
b/src/acpica/source/components/tables/tbutils.c index 7cac46a..438f92f 100644
--- a/src/acpica/source/components/tables/tbutils.c
+++ b/src/acpica/source/components/tables/tbutils.c
@@ -499,10 +499,6 @@ NextTable:
TableEntry += TableEntrySize;
}
- /*
- * It is not possible to map more than one entry in some environments,
- * so unmap the root table here before mapping other tables
- */
AcpiOsUnmapMemory (Table, Length);
return_ACPI_STATUS (AE_OK);
diff --git a/src/acpica/source/components/utilities/utbuffer.c \
b/src/acpica/source/components/utilities/utbuffer.c index c241f7d..608e8d4 100644
--- a/src/acpica/source/components/utilities/utbuffer.c
+++ b/src/acpica/source/components/utilities/utbuffer.c
@@ -290,3 +290,138 @@ AcpiUtDebugDumpBuffer (
AcpiUtDumpBuffer (Buffer, Count, Display, 0);
}
+
+
+#ifdef ACPI_APPLICATION
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpBufferToFile
+ *
+ * PARAMETERS: File - File descriptor
+ * Buffer - Buffer to dump
+ * Count - Amount to dump, in bytes
+ * Display - BYTE, WORD, DWORD, or QWORD display:
+ * DB_BYTE_DISPLAY
+ * DB_WORD_DISPLAY
+ * DB_DWORD_DISPLAY
+ * DB_QWORD_DISPLAY
+ * BaseOffset - Beginning buffer offset (display only)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii to a file.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDumpBufferToFile (
+ ACPI_FILE File,
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 BaseOffset)
+{
+ UINT32 i = 0;
+ UINT32 j;
+ UINT32 Temp32;
+ UINT8 BufChar;
+
+
+ if (!Buffer)
+ {
+ AcpiUtFilePrintf (File, "Null Buffer Pointer in DumpBuffer!\n");
+ return;
+ }
+
+ if ((Count < 4) || (Count & 0x01))
+ {
+ Display = DB_BYTE_DISPLAY;
+ }
+
+ /* Nasty little dump buffer routine! */
+
+ while (i < Count)
+ {
+ /* Print current offset */
+
+ AcpiUtFilePrintf (File, "%6.4X: ", (BaseOffset + i));
+
+ /* Print 16 hex chars */
+
+ for (j = 0; j < 16;)
+ {
+ if (i + j >= Count)
+ {
+ /* Dump fill spaces */
+
+ AcpiUtFilePrintf (File, "%*s", ((Display * 2) + 1), " ");
+ j += Display;
+ continue;
+ }
+
+ switch (Display)
+ {
+ case DB_BYTE_DISPLAY:
+ default: /* Default is BYTE display */
+
+ AcpiUtFilePrintf (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);
+ break;
+
+ case DB_DWORD_DISPLAY:
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
+ AcpiUtFilePrintf (File, "%08X ", Temp32);
+ break;
+
+ case DB_QWORD_DISPLAY:
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
+ AcpiUtFilePrintf (File, "%08X", Temp32);
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]);
+ AcpiUtFilePrintf (File, "%08X ", Temp32);
+ break;
+ }
+
+ j += Display;
+ }
+
+ /*
+ * Print the ASCII equivalent characters but watch out for the bad
+ * unprintable ones (printable chars are 0x20 through 0x7E)
+ */
+ AcpiUtFilePrintf (File, " ");
+ for (j = 0; j < 16; j++)
+ {
+ if (i + j >= Count)
+ {
+ AcpiUtFilePrintf (File, "\n");
+ return;
+ }
+
+ BufChar = Buffer[(ACPI_SIZE) i + j];
+ if (ACPI_IS_PRINT (BufChar))
+ {
+ AcpiUtFilePrintf (File, "%c", BufChar);
+ }
+ else
+ {
+ AcpiUtFilePrintf (File, ".");
+ }
+ }
+
+ /* Done with that line. */
+
+ AcpiUtFilePrintf (File, "\n");
+ i += 16;
+ }
+
+ return;
+}
+#endif
diff --git a/src/acpica/source/components/utilities/utcopy.c \
b/src/acpica/source/components/utilities/utcopy.c index 4ca33bc..e6a71a7 100644
--- a/src/acpica/source/components/utilities/utcopy.c
+++ b/src/acpica/source/components/utilities/utcopy.c
@@ -1135,5 +1135,12 @@ AcpiUtCopyIobjectToIobject (
Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
}
+ /* Delete the allocated object if copy failed */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference(*DestDesc);
+ }
+
return_ACPI_STATUS (Status);
}
diff --git a/src/acpica/source/components/utilities/utdebug.c \
b/src/acpica/source/components/utilities/utdebug.c index 5a1f981..ddc0c38 100644
--- a/src/acpica/source/components/utilities/utdebug.c
+++ b/src/acpica/source/components/utilities/utdebug.c
@@ -708,3 +708,33 @@ AcpiUtPtrExit (
}
#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/src/acpica/source/components/utilities/utfileio.c \
b/src/acpica/source/components/utilities/utfileio.c new file mode 100644
index 0000000..78807f2
--- /dev/null
+++ b/src/acpica/source/components/utilities/utfileio.c
@@ -0,0 +1,435 @@
+/*******************************************************************************
+ *
+ * Module Name: utfileio - simple file I/O routines
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2014, 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 "actables.h"
+#include "acapps.h"
+
+#ifdef ACPI_ASL_COMPILER
+#include "aslcompiler.h"
+#endif
+
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("utfileio")
+
+
+#ifdef ACPI_APPLICATION
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiUtCheckTextModeCorruption (
+ UINT8 *Table,
+ UINT32 TableLength,
+ UINT32 FileLength);
+
+static ACPI_STATUS
+AcpiUtReadTable (
+ FILE *fp,
+ ACPI_TABLE_HEADER **Table,
+ UINT32 *TableLength);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCheckTextModeCorruption
+ *
+ * PARAMETERS: Table - Table buffer
+ * TableLength - Length of table from the table header
+ * FileLength - Length of the file that contains the table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check table for text mode file corruption where all linefeed
+ * characters (LF) have been replaced by carriage return linefeed
+ * pairs (CR/LF).
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtCheckTextModeCorruption (
+ UINT8 *Table,
+ UINT32 TableLength,
+ UINT32 FileLength)
+{
+ UINT32 i;
+ UINT32 Pairs = 0;
+
+
+ if (TableLength != FileLength)
+ {
+ ACPI_WARNING ((AE_INFO,
+ "File length (0x%X) is not the same as the table length (0x%X)",
+ FileLength, TableLength));
+ }
+
+ /* Scan entire table to determine if each LF has been prefixed with a CR */
+
+ for (i = 1; i < FileLength; i++)
+ {
+ if (Table[i] == 0x0A)
+ {
+ if (Table[i - 1] != 0x0D)
+ {
+ /* The LF does not have a preceding CR, table not corrupted */
+
+ return (AE_OK);
+ }
+ else
+ {
+ /* Found a CR/LF pair */
+
+ Pairs++;
+ }
+ i++;
+ }
+ }
+
+ if (!Pairs)
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * Entire table scanned, each CR is part of a CR/LF pair --
+ * meaning that the table was treated as a text file somewhere.
+ *
+ * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the
+ * original table are left untouched by the text conversion process --
+ * meaning that we cannot simply replace CR/LF pairs with LFs.
+ */
+ AcpiOsPrintf ("Table has been corrupted by text mode conversion\n");
+ AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs);
+ AcpiOsPrintf ("Table cannot be repaired!\n");
+ return (AE_BAD_VALUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReadTable
+ *
+ * PARAMETERS: fp - File that contains table
+ * Table - Return value, buffer with table
+ * TableLength - Return value, length of table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load the DSDT from the file pointer
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtReadTable (
+ FILE *fp,
+ ACPI_TABLE_HEADER **Table,
+ UINT32 *TableLength)
+{
+ ACPI_TABLE_HEADER TableHeader;
+ UINT32 Actual;
+ ACPI_STATUS Status;
+ UINT32 FileSize;
+ BOOLEAN StandardHeader = TRUE;
+ INT32 Count;
+
+ /* Get the file size */
+
+ FileSize = CmGetFileSize (fp);
+ if (FileSize == ACPI_UINT32_MAX)
+ {
+ return (AE_ERROR);
+ }
+
+ if (FileSize < 4)
+ {
+ return (AE_BAD_HEADER);
+ }
+
+ /* Read the signature */
+
+ fseek (fp, 0, SEEK_SET);
+
+ Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp);
+ if (Count != sizeof (ACPI_TABLE_HEADER))
+ {
+ AcpiOsPrintf ("Could not read the table header\n");
+ return (AE_BAD_HEADER);
+ }
+
+ /* The RSDP table does not have standard ACPI header */
+
+ if (ACPI_VALIDATE_RSDP_SIG (TableHeader.Signature))
+ {
+ *TableLength = FileSize;
+ StandardHeader = FALSE;
+ }
+ else
+ {
+
+#if 0
+ /* Validate the table header/length */
+
+ Status = AcpiTbValidateTableHeader (&TableHeader);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Table header is invalid!\n");
+ return (Status);
+ }
+#endif
+
+ /* File size must be at least as long as the Header-specified length */
+
+ if (TableHeader.Length > FileSize)
+ {
+ AcpiOsPrintf (
+ "TableHeader length [0x%X] greater than the input file size \
[0x%X]\n", + TableHeader.Length, FileSize);
+
+#ifdef ACPI_ASL_COMPILER
+ Status = FlCheckForAscii (fp, NULL, FALSE);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf ("File appears to be ASCII only, must be binary\n",
+ TableHeader.Length, FileSize);
+ }
+#endif
+ return (AE_BAD_HEADER);
+ }
+
+#ifdef ACPI_OBSOLETE_CODE
+ /* We only support a limited number of table types */
+
+ if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) &&
+ !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) &&
+ !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT))
+ {
+ AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n",
+ (char *) TableHeader.Signature);
+ ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
+ return (AE_ERROR);
+ }
+#endif
+
+ *TableLength = TableHeader.Length;
+ }
+
+ /* Allocate a buffer for the table */
+
+ *Table = AcpiOsAllocate ((size_t) FileSize);
+ if (!*Table)
+ {
+ AcpiOsPrintf (
+ "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n",
+ TableHeader.Signature, *TableLength);
+ return (AE_NO_MEMORY);
+ }
+
+ /* Get the rest of the table */
+
+ fseek (fp, 0, SEEK_SET);
+ Actual = fread (*Table, 1, (size_t) FileSize, fp);
+ if (Actual == FileSize)
+ {
+ if (StandardHeader)
+ {
+ /* Now validate the checksum */
+
+ Status = AcpiTbVerifyChecksum ((void *) *Table,
+ ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length);
+
+ if (Status == AE_BAD_CHECKSUM)
+ {
+ Status = AcpiUtCheckTextModeCorruption ((UINT8 *) *Table,
+ FileSize, (*Table)->Length);
+ return (Status);
+ }
+ }
+ return (AE_OK);
+ }
+
+ if (Actual > 0)
+ {
+ AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n",
+ FileSize, Actual);
+ return (AE_OK);
+ }
+
+ AcpiOsPrintf ("Error - could not read the table file\n");
+ AcpiOsFree (*Table);
+ *Table = NULL;
+ *TableLength = 0;
+ return (AE_ERROR);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReadTableFromFile
+ *
+ * PARAMETERS: Filename - File where table is located
+ * Table - Where a pointer to the table is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get an ACPI table from a file
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtReadTableFromFile (
+ char *Filename,
+ ACPI_TABLE_HEADER **Table)
+{
+ FILE *File;
+ UINT32 FileSize;
+ UINT32 TableLength;
+ ACPI_STATUS Status = AE_ERROR;
+
+
+ /* Open the file, get current size */
+
+ File = fopen (Filename, "rb");
+ if (!File)
+ {
+ perror ("Could not open input file");
+ return (Status);
+ }
+
+ FileSize = CmGetFileSize (File);
+ if (FileSize == ACPI_UINT32_MAX)
+ {
+ goto Exit;
+ }
+
+ /* Get the entire file */
+
+ fprintf (stderr, "Loading Acpi table from file %10s - Length %.8u (%06X)\n",
+ Filename, FileSize, FileSize);
+
+ Status = AcpiUtReadTable (File, Table, &TableLength);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not get table from the file\n");
+ }
+
+Exit:
+ fclose(File);
+ return (Status);
+}
+
+#endif
diff --git a/src/acpica/source/components/utilities/utglobal.c \
b/src/acpica/source/components/utilities/utglobal.c index a24abfc..be14ea2 100644
--- a/src/acpica/source/components/utilities/utglobal.c
+++ b/src/acpica/source/components/utilities/utglobal.c
@@ -245,163 +245,6 @@ ACPI_FIXED_EVENT_INFO \
AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = };
#endif /* !ACPI_REDUCED_HARDWARE */
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtInitGlobals
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
- * initialization should be initialized here. This allows for
- * a warm restart.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtInitGlobals (
- void)
-{
- ACPI_STATUS Status;
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE (UtInitGlobals);
-
-
- /* Create all memory caches */
-
- Status = AcpiUtCreateCaches ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Address Range lists */
-
- for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
- {
- AcpiGbl_AddressRangeList[i] = NULL;
- }
-
- /* Mutex locked flags */
-
- for (i = 0; i < ACPI_NUM_MUTEX; i++)
- {
- AcpiGbl_MutexInfo[i].Mutex = NULL;
- AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
- AcpiGbl_MutexInfo[i].UseCount = 0;
- }
-
- for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
- {
- AcpiGbl_OwnerIdMask[i] = 0;
- }
-
- /* Last OwnerID is never valid */
-
- AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
-
- /* Event counters */
-
- AcpiMethodCount = 0;
- AcpiSciCount = 0;
- AcpiGpeCount = 0;
-
- for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
- {
- AcpiFixedEventCount[i] = 0;
- }
-
-#if (!ACPI_REDUCED_HARDWARE)
-
- /* GPE/SCI support */
-
- AcpiGbl_AllGpesInitialized = FALSE;
- AcpiGbl_GpeXruptListHead = NULL;
- AcpiGbl_GpeFadtBlocks[0] = NULL;
- AcpiGbl_GpeFadtBlocks[1] = NULL;
- AcpiCurrentGpeCount = 0;
-
- AcpiGbl_GlobalEventHandler = NULL;
- AcpiGbl_SciHandlerList = NULL;
-
-#endif /* !ACPI_REDUCED_HARDWARE */
-
- /* Global handlers */
-
- AcpiGbl_GlobalNotify[0].Handler = NULL;
- AcpiGbl_GlobalNotify[1].Handler = NULL;
- AcpiGbl_ExceptionHandler = NULL;
- AcpiGbl_InitHandler = NULL;
- AcpiGbl_TableHandler = NULL;
- AcpiGbl_InterfaceHandler = NULL;
-
- /* Global Lock support */
-
- AcpiGbl_GlobalLockSemaphore = NULL;
- AcpiGbl_GlobalLockMutex = NULL;
- AcpiGbl_GlobalLockAcquired = FALSE;
- AcpiGbl_GlobalLockHandle = 0;
- AcpiGbl_GlobalLockPresent = FALSE;
-
- /* Miscellaneous variables */
-
- AcpiGbl_DSDT = NULL;
- AcpiGbl_CmSingleStep = FALSE;
- AcpiGbl_Shutdown = FALSE;
- AcpiGbl_NsLookupCount = 0;
- AcpiGbl_PsFindCount = 0;
- AcpiGbl_AcpiHardwarePresent = TRUE;
- AcpiGbl_LastOwnerIdIndex = 0;
- AcpiGbl_NextOwnerIdOffset = 0;
- AcpiGbl_TraceDbgLevel = 0;
- AcpiGbl_TraceDbgLayer = 0;
- AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
- AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
- AcpiGbl_OsiMutex = NULL;
- AcpiGbl_RegMethodsExecuted = FALSE;
-
- /* Hardware oriented */
-
- AcpiGbl_EventsInitialized = FALSE;
- AcpiGbl_SystemAwakeAndRunning = TRUE;
-
- /* Namespace */
-
- AcpiGbl_ModuleCodeList = NULL;
- AcpiGbl_RootNode = NULL;
- AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
- AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
- AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
- AcpiGbl_RootNodeStruct.Parent = NULL;
- AcpiGbl_RootNodeStruct.Child = NULL;
- AcpiGbl_RootNodeStruct.Peer = NULL;
- AcpiGbl_RootNodeStruct.Object = NULL;
-
-
-#ifdef ACPI_DISASSEMBLER
- AcpiGbl_ExternalList = NULL;
- AcpiGbl_NumExternalMethods = 0;
- AcpiGbl_ResolvedExternalMethods = 0;
-#endif
-
-#ifdef ACPI_DEBUG_OUTPUT
- AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX);
-#endif
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- AcpiGbl_DisplayFinalMemStats = FALSE;
- AcpiGbl_DisableMemTracking = FALSE;
-#endif
-
- ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = FALSE);
-
- return_ACPI_STATUS (AE_OK);
-}
-
/* Public globals */
ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
diff --git a/src/acpica/source/components/utilities/utinit.c \
b/src/acpica/source/components/utilities/utinit.c index 46df0ab..8df0277 100644
--- a/src/acpica/source/components/utilities/utinit.c
+++ b/src/acpica/source/components/utilities/utinit.c
@@ -188,6 +188,162 @@ AcpiUtFreeGpeLists (
#endif /* !ACPI_REDUCED_HARDWARE */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtInitGlobals
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
+ * initialization should be initialized here. This allows for
+ * a warm restart.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtInitGlobals (
+ void)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE (UtInitGlobals);
+
+
+ /* Create all memory caches */
+
+ Status = AcpiUtCreateCaches ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Address Range lists */
+
+ for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
+ {
+ AcpiGbl_AddressRangeList[i] = NULL;
+ }
+
+ /* Mutex locked flags */
+
+ for (i = 0; i < ACPI_NUM_MUTEX; i++)
+ {
+ AcpiGbl_MutexInfo[i].Mutex = NULL;
+ AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[i].UseCount = 0;
+ }
+
+ for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
+ {
+ AcpiGbl_OwnerIdMask[i] = 0;
+ }
+
+ /* Last OwnerID is never valid */
+
+ AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
+
+ /* Event counters */
+
+ AcpiMethodCount = 0;
+ AcpiSciCount = 0;
+ AcpiGpeCount = 0;
+
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
+ {
+ AcpiFixedEventCount[i] = 0;
+ }
+
+#if (!ACPI_REDUCED_HARDWARE)
+
+ /* GPE/SCI support */
+
+ AcpiGbl_AllGpesInitialized = FALSE;
+ AcpiGbl_GpeXruptListHead = NULL;
+ AcpiGbl_GpeFadtBlocks[0] = NULL;
+ AcpiGbl_GpeFadtBlocks[1] = NULL;
+ AcpiCurrentGpeCount = 0;
+
+ AcpiGbl_GlobalEventHandler = NULL;
+ AcpiGbl_SciHandlerList = NULL;
+
+#endif /* !ACPI_REDUCED_HARDWARE */
+
+ /* Global handlers */
+
+ AcpiGbl_GlobalNotify[0].Handler = NULL;
+ AcpiGbl_GlobalNotify[1].Handler = NULL;
+ AcpiGbl_ExceptionHandler = NULL;
+ AcpiGbl_InitHandler = NULL;
+ AcpiGbl_TableHandler = NULL;
+ AcpiGbl_InterfaceHandler = NULL;
+
+ /* Global Lock support */
+
+ AcpiGbl_GlobalLockSemaphore = NULL;
+ AcpiGbl_GlobalLockMutex = NULL;
+ AcpiGbl_GlobalLockAcquired = FALSE;
+ AcpiGbl_GlobalLockHandle = 0;
+ AcpiGbl_GlobalLockPresent = FALSE;
+
+ /* Miscellaneous variables */
+
+ AcpiGbl_DSDT = NULL;
+ AcpiGbl_CmSingleStep = FALSE;
+ AcpiGbl_Shutdown = FALSE;
+ AcpiGbl_NsLookupCount = 0;
+ AcpiGbl_PsFindCount = 0;
+ AcpiGbl_AcpiHardwarePresent = TRUE;
+ AcpiGbl_LastOwnerIdIndex = 0;
+ AcpiGbl_NextOwnerIdOffset = 0;
+ AcpiGbl_TraceDbgLevel = 0;
+ AcpiGbl_TraceDbgLayer = 0;
+ AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
+ AcpiGbl_OsiMutex = NULL;
+ AcpiGbl_RegMethodsExecuted = FALSE;
+
+ /* Hardware oriented */
+
+ AcpiGbl_EventsInitialized = FALSE;
+ AcpiGbl_SystemAwakeAndRunning = TRUE;
+
+ /* Namespace */
+
+ AcpiGbl_ModuleCodeList = NULL;
+ AcpiGbl_RootNode = NULL;
+ AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
+ AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
+ AcpiGbl_RootNodeStruct.Parent = NULL;
+ AcpiGbl_RootNodeStruct.Child = NULL;
+ AcpiGbl_RootNodeStruct.Peer = NULL;
+ AcpiGbl_RootNodeStruct.Object = NULL;
+
+
+#ifdef ACPI_DISASSEMBLER
+ AcpiGbl_ExternalList = NULL;
+ AcpiGbl_NumExternalMethods = 0;
+ AcpiGbl_ResolvedExternalMethods = 0;
+#endif
+
+#ifdef ACPI_DEBUG_OUTPUT
+ AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX);
+#endif
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ AcpiGbl_DisplayFinalMemStats = FALSE;
+ AcpiGbl_DisableMemTracking = FALSE;
+#endif
+
+ ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = FALSE);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiUtTerminate
diff --git a/src/acpica/source/components/utilities/utprint.c \
b/src/acpica/source/components/utilities/utprint.c new file mode 100644
index 0000000..d1bcccf
--- /dev/null
+++ b/src/acpica/source/components/utilities/utprint.c
@@ -0,0 +1,868 @@
+/******************************************************************************
+ *
+ * Module Name: utprint - Formatted printing routines
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2014, 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"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utprint")
+
+
+#define ACPI_FORMAT_SIGN 0x01
+#define ACPI_FORMAT_SIGN_PLUS 0x02
+#define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04
+#define ACPI_FORMAT_ZERO 0x08
+#define ACPI_FORMAT_LEFT 0x10
+#define ACPI_FORMAT_UPPER 0x20
+#define ACPI_FORMAT_PREFIX 0x40
+
+
+/* Local prototypes */
+
+static ACPI_SIZE
+AcpiUtBoundStringLength (
+ const char *String,
+ ACPI_SIZE Count);
+
+static char *
+AcpiUtBoundStringOutput (
+ char *String,
+ const char *End,
+ char c);
+
+static char *
+AcpiUtFormatNumber (
+ char *String,
+ char *End,
+ UINT64 Number,
+ UINT8 Base,
+ INT32 Width,
+ INT32 Precision,
+ UINT8 Type);
+
+static char *
+AcpiUtPutNumber (
+ char *String,
+ UINT64 Number,
+ UINT8 Base,
+ BOOLEAN Upper);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtBoundStringLength
+ *
+ * PARAMETERS: String - String with boundary
+ * Count - Boundary of the string
+ *
+ * RETURN: Length of the string.
+ *
+ * DESCRIPTION: Calculate the length of a string with boundary.
+ *
+ ******************************************************************************/
+
+static ACPI_SIZE
+AcpiUtBoundStringLength (
+ const char *String,
+ ACPI_SIZE Count)
+{
+ UINT32 Length = 0;
+
+
+ while (*String && Count)
+ {
+ Length++;
+ String++;
+ Count--;
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtBoundStringOutput
+ *
+ * PARAMETERS: String - String with boundary
+ * End - Boundary of the string
+ * c - Character to be output to the string
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Output a character into a string with boundary check.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiUtBoundStringOutput (
+ char *String,
+ const char *End,
+ char c)
+{
+
+ if (String < End)
+ {
+ *String = c;
+ }
+ ++String;
+
+ return (String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPutNumber
+ *
+ * PARAMETERS: String - Buffer to hold reverse-ordered string
+ * Number - Integer to be converted
+ * Base - Base of the integer
+ * Upper - Whether or not using upper cased digits
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Convert an integer into a string, note that, the string holds a
+ * reversed ordered number without the trailing zero.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiUtPutNumber (
+ char *String,
+ UINT64 Number,
+ UINT8 Base,
+ BOOLEAN Upper)
+{
+ const char LowerDigits[] = "0123456789abcdef";
+ const char UpperDigits[] = "0123456789ABCDEF";
+ const char *Digits;
+ UINT64 DigitIndex;
+ char *Pos;
+
+
+ Pos = String;
+ Digits = Upper ? UpperDigits : LowerDigits;
+
+ if (Number == 0)
+ {
+ *(Pos++) = '0';
+ }
+ else
+ {
+ while (Number)
+ {
+ (void) AcpiUtDivide (Number, Base, &Number, &DigitIndex);
+ *(Pos++) = Digits[DigitIndex];
+ }
+ }
+ /* *(Pos++) = '0'; */
+
+ return (Pos);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtScanNumber
+ *
+ * PARAMETERS: String - String buffer
+ * NumberPtr - Where the number is returned
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Scan a string for a decimal integer.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiUtScanNumber (
+ const char *String,
+ UINT64 *NumberPtr)
+{
+ UINT64 Number = 0;
+
+
+ while (ACPI_IS_DIGIT (*String))
+ {
+ Number *= 10;
+ Number += *(String++) - '0';
+ }
+ *NumberPtr = Number;
+
+ return (String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPrintNumber
+ *
+ * PARAMETERS: String - String buffer
+ * Number - The number to be converted
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Print a decimal integer into a string.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiUtPrintNumber (
+ char *String,
+ UINT64 Number)
+{
+ char AsciiString[20];
+ const char *Pos1;
+ char *Pos2;
+
+
+ Pos1 = AcpiUtPutNumber (AsciiString, Number, 10, FALSE);
+ Pos2 = String;
+
+ while (Pos1 != AsciiString)
+ {
+ *(Pos2++) = *(--Pos1);
+ }
+ *Pos2 = 0;
+
+ return (String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFormatNumber
+ *
+ * PARAMETERS: String - String buffer with boundary
+ * End - Boundary of the string
+ * Number - The number to be converted
+ * Base - Base of the integer
+ * Width - Field width
+ * Precision - Precision of the integer
+ * Type - Special printing flags
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Print an integer into a string with any base and any precision.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiUtFormatNumber (
+ char *String,
+ char *End,
+ UINT64 Number,
+ UINT8 Base,
+ INT32 Width,
+ INT32 Precision,
+ UINT8 Type)
+{
+ char Sign;
+ char Zero;
+ BOOLEAN NeedPrefix;
+ BOOLEAN Upper;
+ INT32 i;
+ char ReversedString[66];
+
+
+ /* Perform sanity checks */
+
+ if (Base < 2 || Base > 16)
+ {
+ return NULL;
+ }
+ if (Type & ACPI_FORMAT_LEFT)
+ {
+ Type &= ~ACPI_FORMAT_ZERO;
+ }
+
+ NeedPrefix = ((Type & ACPI_FORMAT_PREFIX) && Base != 10) ? TRUE : FALSE;
+ Upper = (Type & ACPI_FORMAT_UPPER) ? TRUE : FALSE;
+ Zero = (Type & ACPI_FORMAT_ZERO) ? '0' : ' ';
+
+ /* Calculate size according to sign and prefix */
+
+ Sign = '\0';
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ if ((INT64) Number < 0)
+ {
+ Sign = '-';
+ Number = - (INT64) Number;
+ Width--;
+ }
+ else if (Type & ACPI_FORMAT_SIGN_PLUS)
+ {
+ Sign = '+';
+ Width--;
+ }
+ else if (Type & ACPI_FORMAT_SIGN_PLUS_SPACE)
+ {
+ Sign = ' ';
+ Width--;
+ }
+ }
+ if (NeedPrefix)
+ {
+ Width--;
+ if (Base == 16)
+ {
+ Width--;
+ }
+ }
+
+ /* Generate full string in reverse order */
+
+ i = ACPI_PTR_DIFF (
+ AcpiUtPutNumber (ReversedString, Number, Base, Upper),
+ ReversedString);
+
+ /* Printing 100 using %2d gives "100", not "00" */
+
+ if (i > Precision)
+ {
+ Precision = i;
+ }
+ Width -= Precision;
+
+ /* Output the string */
+
+ if (!(Type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT)))
+ {
+ while (--Width >= 0)
+ {
+ String = AcpiUtBoundStringOutput (String, End, ' ');
+ }
+ }
+ if (Sign)
+ {
+ String = AcpiUtBoundStringOutput (String, End, Sign);
+ }
+ if (NeedPrefix)
+ {
+ String = AcpiUtBoundStringOutput (String, End, '0');
+ if (Base == 16)
+ {
+ String = AcpiUtBoundStringOutput (String, End,
+ Upper ? 'X' : 'x');
+ }
+ }
+ if (!(Type & ACPI_FORMAT_LEFT))
+ {
+ while (--Width >= 0)
+ {
+ String = AcpiUtBoundStringOutput (String, End, Zero);
+ }
+ }
+ while (i <= --Precision)
+ {
+ String = AcpiUtBoundStringOutput (String, End, '0');
+ }
+ while (--i >= 0)
+ {
+ String = AcpiUtBoundStringOutput (String, End,
+ ReversedString[i]);
+ }
+ while (--Width >= 0)
+ {
+ String = AcpiUtBoundStringOutput (String, End, ' ');
+ }
+
+ return (String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtVsnprintf
+ *
+ * PARAMETERS: String - String with boundary
+ * Size - Boundary of the string
+ * Format - Standard printf format
+ * Args - Argument list
+ *
+ * RETURN: Size of successfully output bytes
+ *
+ * DESCRIPTION: Formatted output to a string using argument list pointer.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtVsnprintf (
+ char *String,
+ ACPI_SIZE Size,
+ const char *Format,
+ va_list Args)
+{
+ UINT8 Base = 10;
+ UINT8 Type = 0;
+ INT32 Width = -1;
+ INT32 Precision = -1;
+ char Qualifier = 0;
+ UINT64 Number;
+ char *Pos;
+ char *End;
+ char c;
+ const char *s;
+ const void *p;
+ INT32 Length;
+ int i;
+
+
+ Pos = String;
+ End = String + Size;
+
+ for (; *Format ; ++Format)
+ {
+ if (*Format != '%')
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, *Format);
+ continue;
+ }
+
+ /* Process sign */
+
+ do
+ {
+ ++Format;
+ if (*Format == '#')
+ {
+ Type |= ACPI_FORMAT_PREFIX;
+ }
+ else if (*Format == '0')
+ {
+ Type |= ACPI_FORMAT_ZERO;
+ }
+ else if (*Format == '+')
+ {
+ Type |= ACPI_FORMAT_SIGN_PLUS;
+ }
+ else if (*Format == ' ')
+ {
+ Type |= ACPI_FORMAT_SIGN_PLUS_SPACE;
+ }
+ else if (*Format == '-')
+ {
+ Type |= ACPI_FORMAT_LEFT;
+ }
+ else
+ {
+ break;
+ }
+ } while (1);
+
+ /* Process width */
+
+ if (ACPI_IS_DIGIT (*Format))
+ {
+ Format = AcpiUtScanNumber (Format, &Number);
+ Width = (INT32) Number;
+ }
+ else if (*Format == '*')
+ {
+ ++Format;
+ Width = va_arg(Args, int);
+ if (Width < 0)
+ {
+ Width = -Width;
+ Type |= ACPI_FORMAT_LEFT;
+ }
+ }
+
+ /* Process precision */
+
+ if (*Format == '.')
+ {
+ ++Format;
+ if (ACPI_IS_DIGIT(*Format))
+ {
+ Format = AcpiUtScanNumber (Format, &Number);
+ Precision = (INT32) Number;
+ }
+ else if (*Format == '*')
+ {
+ ++Format;
+ Precision = va_arg(Args, int);
+ }
+ if (Precision < 0)
+ {
+ Precision = 0;
+ }
+ }
+
+ /* Process qualifier */
+
+ if (*Format == 'h' || *Format == 'l' || *Format == 'L')
+ {
+ Qualifier = *Format;
+ ++Format;
+ if (Qualifier == 'l' && *Format == 'l')
+ {
+ Qualifier = 'L';
+ ++Format;
+ }
+ }
+
+ switch (*Format)
+ {
+ case '%':
+
+ Pos = AcpiUtBoundStringOutput (Pos, End, '%');
+ continue;
+
+ case 'c':
+
+ if (!(Type & ACPI_FORMAT_LEFT))
+ {
+ while (--Width > 0)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, ' ');
+ }
+ }
+ c = (char) va_arg (Args, int);
+ Pos = AcpiUtBoundStringOutput (Pos, End, c);
+ while (--Width > 0)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, ' ');
+ }
+ continue;
+
+ case 's':
+
+ s = va_arg (Args, char *);
+ if (!s)
+ {
+ s = "<NULL>";
+ }
+ Length = AcpiUtBoundStringLength (s, Precision);
+ if (!(Type & ACPI_FORMAT_LEFT))
+ {
+ while (Length < Width--)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, ' ');
+ }
+ }
+ for (i = 0; i < Length; ++i)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, *s);
+ ++s;
+ }
+ while (Length < Width--)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, ' ');
+ }
+ continue;
+
+ case 'o':
+
+ Base = 8;
+ break;
+
+ case 'X':
+
+ Type |= ACPI_FORMAT_UPPER;
+
+ case 'x':
+
+ Base = 16;
+ break;
+
+ case 'd':
+ case 'i':
+
+ Type |= ACPI_FORMAT_SIGN;
+
+ case 'u':
+
+ break;
+
+ case 'p':
+
+ if (Width == -1)
+ {
+ Width = 2 * sizeof (void *);
+ Type |= ACPI_FORMAT_ZERO;
+ }
+ p = va_arg (Args, void *);
+ Pos = AcpiUtFormatNumber (Pos, End,
+ ACPI_TO_INTEGER (p),
+ 16, Width, Precision, Type);
+ continue;
+
+ default:
+
+ Pos = AcpiUtBoundStringOutput (Pos, End, '%');
+ if (*Format)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, *Format);
+ }
+ else
+ {
+ --Format;
+ }
+ continue;
+ }
+
+ if (Qualifier == 'L')
+ {
+ Number = va_arg (Args, UINT64);
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ Number = (INT64) Number;
+ }
+ }
+ else if (Qualifier == 'l')
+ {
+ Number = va_arg (Args, unsigned long);
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ Number = (INT32) Number;
+ }
+ }
+ else if (Qualifier == 'h')
+ {
+ Number = (UINT16) va_arg (Args, int);
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ Number = (INT16) Number;
+ }
+ }
+ else
+ {
+ Number = va_arg (Args, unsigned int);
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ Number = (signed int) Number;
+ }
+ }
+ Pos = AcpiUtFormatNumber(Pos, End, Number, Base,
+ Width, Precision, Type);
+ }
+
+ if (Size > 0)
+ {
+ if (Pos < End)
+ {
+ *Pos = '\0';
+ }
+ else
+ {
+ End[-1] = '\0';
+ }
+ }
+
+ return (ACPI_PTR_DIFF (Pos, String));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtSnprintf
+ *
+ * PARAMETERS: String - String with boundary
+ * Size - Boundary of the string
+ * Format, ... - Standard printf format
+ *
+ * RETURN: Size of successfully output bytes
+ *
+ * DESCRIPTION: Formatted output to a string.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtSnprintf (
+ char *String,
+ ACPI_SIZE Size,
+ const char *Format,
+ ...)
+{
+ va_list Args;
+ int Length;
+
+
+ va_start (Args, Format);
+ Length = AcpiUtVsnprintf (String, Size, Format, Args);
+ va_end (Args);
+
+ return (Length);
+}
+
+
+#ifdef ACPI_APPLICATION
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFileVprintf
+ *
+ * PARAMETERS: File - File descriptor
+ * Format - Standard printf format
+ * Args - Argument list
+ *
+ * RETURN: Size of successfully output bytes
+ *
+ * DESCRIPTION: Formatted output to a file using argument list pointer.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtFileVprintf (
+ ACPI_FILE File,
+ const char *Format,
+ va_list Args)
+{
+ ACPI_CPU_FLAGS Flags;
+ int Length;
+
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock);
+ Length = AcpiUtVsnprintf(AcpiGbl_PrintBuffer,
+ sizeof (AcpiGbl_PrintBuffer), Format, Args);
+ (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1);
+ AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags);
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFilePrintf
+ *
+ * PARAMETERS: File - File descriptor
+ * Format, ... - Standard printf format
+ *
+ * RETURN: Size of successfully output bytes
+ *
+ * DESCRIPTION: Formatted output to a file.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtFilePrintf (
+ ACPI_FILE File,
+ const char *Format,
+ ...)
+{
+ va_list Args;
+ int Length;
+
+
+ va_start (Args, Format);
+ Length = AcpiUtFileVprintf (File, Format, Args);
+ va_end (Args);
+
+ return (Length);
+}
+#endif
diff --git a/src/acpica/source/include/acapps.h b/src/acpica/source/include/acapps.h
index 63f879e..6536048 100644
--- a/src/acpica/source/include/acapps.h
+++ b/src/acpica/source/include/acapps.h
@@ -156,10 +156,13 @@
/* Macros for usage messages */
#define ACPI_USAGE_HEADER(Usage) \
- printf ("Usage: %s\nOptions:\n", Usage);
+ AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage);
+
+#define ACPI_USAGE_TEXT(Description) \
+ AcpiOsPrintf (Description);
#define ACPI_OPTION(Name, Description) \
- printf (" %-18s%s\n", Name, Description);
+ AcpiOsPrintf (" %-18s%s\n", Name, Description);
#define FILE_SUFFIX_DISASSEMBLY "dsl"
@@ -191,7 +194,7 @@ extern char *AcpiGbl_Optarg;
*/
UINT32
CmGetFileSize (
- FILE *File);
+ ACPI_FILE File);
#ifndef ACPI_DUMP_APP
diff --git a/src/acpica/source/include/acdebug.h \
b/src/acpica/source/include/acdebug.h index 1807c31..b6105c2 100644
--- a/src/acpica/source/include/acdebug.h
+++ b/src/acpica/source/include/acdebug.h
@@ -449,11 +449,6 @@ AcpiDbGetTableFromFile (
char *Filename,
ACPI_TABLE_HEADER **Table);
-ACPI_STATUS
-AcpiDbReadTableFromFile (
- char *Filename,
- ACPI_TABLE_HEADER **Table);
-
/*
* dbhistry - debugger HISTORY command
diff --git a/src/acpica/source/include/acglobal.h \
b/src/acpica/source/include/acglobal.h index d16a23d..a3783a4 100644
--- a/src/acpica/source/include/acglobal.h
+++ b/src/acpica/source/include/acglobal.h
@@ -373,7 +373,7 @@ ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer);
*
****************************************************************************/
-ACPI_GLOBAL (UINT8, AcpiGbl_DbOutputFlags);
+ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, \
ACPI_DB_CONSOLE_OUTPUT);
#ifdef ACPI_DISASSEMBLER
@@ -439,6 +439,12 @@ ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects);
#ifdef ACPI_APPLICATION
ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL);
+ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL);
+
+/* Print buffer */
+
+ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_PrintLock); /* For print buffer \
*/ +ACPI_GLOBAL (char, AcpiGbl_PrintBuffer[1024]);
#endif /* ACPI_APPLICATION */
diff --git a/src/acpica/source/include/acnames.h \
b/src/acpica/source/include/acnames.h index 107c6c1..bde34f5 100644
--- a/src/acpica/source/include/acnames.h
+++ b/src/acpica/source/include/acnames.h
@@ -127,7 +127,6 @@
#define METHOD_NAME__HID "_HID"
#define METHOD_NAME__INI "_INI"
#define METHOD_NAME__PLD "_PLD"
-#define METHOD_NAME__PRP "_PRP"
#define METHOD_NAME__PRS "_PRS"
#define METHOD_NAME__PRT "_PRT"
#define METHOD_NAME__PRW "_PRW"
diff --git a/src/acpica/source/include/acpi.h b/src/acpica/source/include/acpi.h
index 9c8bc8d..3f39932 100644
--- a/src/acpica/source/include/acpi.h
+++ b/src/acpica/source/include/acpi.h
@@ -134,8 +134,6 @@
#include "acrestyp.h" /* Resource Descriptor structs */
#include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */
#include "acpixf.h" /* ACPI core subsystem external interfaces */
-#ifdef ACPI_NATIVE_INTERFACE_HEADER
-#include ACPI_NATIVE_INTERFACE_HEADER
-#endif
+#include "platform/acenvex.h" /* Extra environment-specific items */
#endif /* __ACPI_H__ */
diff --git a/src/acpica/source/include/acpiosxf.h \
b/src/acpica/source/include/acpiosxf.h index 00922c7..21e6ed9 100644
--- a/src/acpica/source/include/acpiosxf.h
+++ b/src/acpica/source/include/acpiosxf.h
@@ -623,4 +623,53 @@ 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
+
+
#endif /* __ACPIOSXF_H__ */
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index ecb0442..ef85424 100644
--- a/src/acpica/source/include/acpixf.h
+++ b/src/acpica/source/include/acpixf.h
@@ -118,7 +118,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20140424
+#define ACPI_CA_VERSION 0x20140627
#include "acconfig.h"
#include "actypes.h"
@@ -234,6 +234,15 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CreateOsiMethod, \
TRUE); ACPI_INIT_GLOBAL (UINT8, AcpiGbl_UseDefaultRegisterWidths, TRUE);
/*
+ * Whether or not to verify the table checksum before installation. Set
+ * this to TRUE to verify the table checksum before install it to the table
+ * manager. Note that enabling this option causes errors to happen in some
+ * OSPMs during early initialization stages. Default behavior is to do such
+ * verification.
+ */
+ACPI_INIT_GLOBAL (UINT8, AcpiGbl_VerifyTableChecksum, TRUE);
+
+/*
* Optionally enable output from the AML Debug Object.
*/
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableAmlDebugObject, FALSE);
@@ -406,6 +415,24 @@ ACPI_GLOBAL (BOOLEAN, \
AcpiGbl_SystemAwakeAndRunning); #endif /* ACPI_DEBUG_OUTPUT */
+/*
+ * Application prototypes
+ *
+ * All interfaces used by application will be configured
+ * out of the ACPICA build unless the ACPI_APPLICATION
+ * flag is defined.
+ */
+#ifdef ACPI_APPLICATION
+#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \
+ Prototype;
+
+#else
+#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \
+ static ACPI_INLINE Prototype {return;}
+
+#endif /* ACPI_APPLICATION */
+
+
/*****************************************************************************
*
* ACPICA public interface prototypes
@@ -1208,4 +1235,11 @@ AcpiDebugPrintRaw (
const char *Format,
...))
+ACPI_APP_DEPENDENT_RETURN_VOID (
+ACPI_PRINTF_LIKE(1)
+void ACPI_INTERNAL_VAR_XFACE
+AcpiLogError (
+ const char *Format,
+ ...))
+
#endif /* __ACXFACE_H__ */
diff --git a/src/acpica/source/include/acpredef.h \
b/src/acpica/source/include/acpredef.h index 81ade10..1d42f1d 100644
--- a/src/acpica/source/include/acpredef.h
+++ b/src/acpica/source/include/acpredef.h
@@ -760,12 +760,6 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] \
=
METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0),
- {{"_PRP", METHOD_0ARGS,
- METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) \
each: 1 Str, 1 Int/Str/Pkg */
- PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_STRING, 1,
- ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING |
- ACPI_RTYPE_PACKAGE | ACPI_RTYPE_REFERENCE, 1,0),
-
{{"_PRS", METHOD_0ARGS,
METHOD_RETURNS (ACPI_RTYPE_BUFFER)}},
diff --git a/src/acpica/source/include/actables.h \
b/src/acpica/source/include/actables.h index 3bcfd94..b95dd28 100644
--- a/src/acpica/source/include/actables.h
+++ b/src/acpica/source/include/actables.h
@@ -158,6 +158,15 @@ void
AcpiTbReleaseTempTable (
ACPI_TABLE_DESC *TableDesc);
+ACPI_STATUS
+AcpiTbValidateTempTable (
+ ACPI_TABLE_DESC *TableDesc);
+
+ACPI_STATUS
+AcpiTbVerifyTempTable (
+ ACPI_TABLE_DESC *TableDesc,
+ char *Signature);
+
BOOLEAN
AcpiTbIsTableLoaded (
UINT32 TableIndex);
@@ -207,11 +216,6 @@ void
AcpiTbInvalidateTable (
ACPI_TABLE_DESC *TableDesc);
-ACPI_STATUS
-AcpiTbVerifyTable (
- ACPI_TABLE_DESC *TableDesc,
- char *Signature);
-
void
AcpiTbOverrideTable (
ACPI_TABLE_DESC *OldTableDesc);
diff --git a/src/acpica/source/include/actypes.h \
b/src/acpica/source/include/actypes.h index 60613de..6ffb2ce 100644
--- a/src/acpica/source/include/actypes.h
+++ b/src/acpica/source/include/actypes.h
@@ -199,6 +199,7 @@
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
+typedef short INT16;
typedef COMPILER_DEPENDENT_UINT64 UINT64;
typedef COMPILER_DEPENDENT_INT64 INT64;
@@ -1408,4 +1409,19 @@ typedef struct acpi_memory_list
#define ACPI_OSI_WIN_8 0x0C
+/* 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
+
+
#endif /* __ACTYPES_H__ */
diff --git a/src/acpica/source/include/acutils.h \
b/src/acpica/source/include/acutils.h index b1c512b..bac5fd8 100644
--- a/src/acpica/source/include/acutils.h
+++ b/src/acpica/source/include/acutils.h
@@ -168,7 +168,6 @@ extern const char *AcpiGbl_PtDecode[];
#ifdef ACPI_ASL_COMPILER
#include <stdio.h>
-extern FILE *AcpiGbl_OutputFile;
#define ACPI_MSG_REDIRECT_BEGIN \
FILE *OutputFile = AcpiGbl_OutputFile; \
@@ -325,6 +324,11 @@ AcpiUtStrlen (
const char *String);
char *
+AcpiUtStrchr (
+ const char *String,
+ int ch);
+
+char *
AcpiUtStrcpy (
char *DstString,
const char *SrcString);
@@ -412,7 +416,7 @@ extern const UINT8 _acpi_ctype[];
#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
-#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | \
_ACPI_DI | _ACPI_SP | _ACPI_PU)) +#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned \
char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) #define \
ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
@@ -554,6 +558,16 @@ AcpiUtDumpBuffer (
UINT32 Display,
UINT32 Offset);
+#ifdef ACPI_APPLICATION
+void
+AcpiUtDumpBufferToFile (
+ ACPI_FILE File,
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 BaseOffset);
+#endif
+
void
AcpiUtReportError (
char *ModuleName,
@@ -623,6 +637,17 @@ AcpiUtExecutePowerMethods (
/*
+ * utfileio - file operations
+ */
+#ifdef ACPI_APPLICATION
+ACPI_STATUS
+AcpiUtReadTableFromFile (
+ char *Filename,
+ ACPI_TABLE_HEADER **Table);
+#endif
+
+
+/*
* utids - device ID support
*/
ACPI_STATUS
@@ -1182,4 +1207,45 @@ const AH_DEVICE_ID *
AcpiAhMatchHardwareId (
char *Hid);
+/*
+ * 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
+
#endif /* _ACUTILS_H */
diff --git a/src/acpica/source/include/platform/acenv.h \
b/src/acpica/source/include/platform/acenv.h index 1696079..80038c8 100644
--- a/src/acpica/source/include/platform/acenv.h
+++ b/src/acpica/source/include/platform/acenv.h
@@ -160,20 +160,14 @@
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
-/* AcpiNames configuration. Single threaded with debugger output enabled. */
-
-#ifdef ACPI_NAMES_APP
-#define ACPI_DEBUGGER
-#define ACPI_APPLICATION
-#define ACPI_SINGLE_THREADED
-#endif
-
/*
- * AcpiBin/AcpiDump/AcpiSrc/AcpiXtract/Example configuration. All single
- * threaded, with no debug output.
+ * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example configuration.
+ * All single threaded.
*/
#if (defined ACPI_BIN_APP) || \
(defined ACPI_DUMP_APP) || \
+ (defined ACPI_HELP_APP) || \
+ (defined ACPI_NAMES_APP) || \
(defined ACPI_SRC_APP) || \
(defined ACPI_XTRACT_APP) || \
(defined ACPI_EXAMPLE_APP)
@@ -181,12 +175,40 @@
#define ACPI_SINGLE_THREADED
#endif
+/* AcpiHelp configuration. Error messages disabled. */
+
#ifdef ACPI_HELP_APP
-#define ACPI_APPLICATION
-#define ACPI_SINGLE_THREADED
#define ACPI_NO_ERROR_MESSAGES
#endif
+/* AcpiNames configuration. Debug output enabled. */
+
+#ifdef ACPI_NAMES_APP
+#define ACPI_DEBUG_OUTPUT
+#endif
+
+/* AcpiExec/AcpiNames/Example configuration. Native RSDP used. */
+
+#if (defined ACPI_EXEC_APP) || \
+ (defined ACPI_EXAMPLE_APP) || \
+ (defined ACPI_NAMES_APP)
+#define ACPI_USE_NATIVE_RSDP_POINTER
+#endif
+
+/* AcpiDump configuration. Native mapping used if provied by OSPMs */
+
+#ifdef ACPI_DUMP_APP
+#define ACPI_USE_NATIVE_MEMORY_MAPPING
+#define USE_NATIVE_ALLOCATE_ZEROED
+#endif
+
+/* AcpiNames/Example configuration. Hardware disabled */
+
+#if (defined ACPI_EXAMPLE_APP) || \
+ (defined ACPI_NAMES_APP)
+#define ACPI_REDUCED_HARDWARE 1
+#endif
+
/* Linkable ACPICA library */
#ifdef ACPI_LIBRARY
@@ -257,6 +279,9 @@
#elif defined(_AED_EFI)
#include "acefi.h"
+#elif defined(_GNU_EFI)
+#include "acefi.h"
+
#elif defined(__HAIKU__)
#include "achaiku.h"
@@ -473,8 +498,12 @@ typedef char *va_list;
#ifdef ACPI_APPLICATION
#include <stdio.h>
#define ACPI_FILE FILE *
+#define ACPI_FILE_OUT stdout
+#define ACPI_FILE_ERR stderr
#else
#define ACPI_FILE void *
+#define ACPI_FILE_OUT NULL
+#define ACPI_FILE_ERR NULL
#endif /* ACPI_APPLICATION */
#endif /* ACPI_FILE */
diff --git a/src/acpica/source/include/platform/acenvex.h \
b/src/acpica/source/include/platform/acenvex.h new file mode 100644
index 0000000..2c50162
--- /dev/null
+++ b/src/acpica/source/include/platform/acenvex.h
@@ -0,0 +1,135 @@
+/******************************************************************************
+ *
+ * Name: acenvex.h - Extra host and compiler configuration
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2014, 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.
+ *
+ *****************************************************************************/
+
+#ifndef __ACENVEX_H__
+#define __ACENVEX_H__
+
+/*! [Begin] no source code translation */
+
+/******************************************************************************
+ *
+ * Extra host configuration files. All ACPICA headers are included before
+ * including these files.
+ *
+ *****************************************************************************/
+
+#if defined(_LINUX) || defined(__linux__)
+#include "aclinuxex.h"
+
+#endif
+
+/*! [End] no source code translation !*/
+
+#endif /* __ACENVEX_H__ */
diff --git a/src/acpica/source/include/platform/aclinux.h \
b/src/acpica/source/include/platform/aclinux.h index 229aa84..1f1d7c1 100644
--- a/src/acpica/source/include/platform/aclinux.h
+++ b/src/acpica/source/include/platform/aclinux.h
@@ -120,13 +120,18 @@
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
#ifdef __KERNEL__
#define ACPI_USE_SYSTEM_INTTYPES
+/* Compile for reduced hardware mode only with this kernel config */
+
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
+#define ACPI_REDUCED_HARDWARE 1
+#endif
+
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
@@ -138,7 +143,7 @@
#ifdef EXPORT_ACPI_INTERFACES
#include <linux/export.h>
#endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
#ifndef CONFIG_ACPI
@@ -181,6 +186,42 @@
#define ACPI_SPINLOCK spinlock_t *
#define ACPI_CPU_FLAGS unsigned long
+/* Use native linux version of AcpiOsAllocateZeroed */
+
+#define USE_NATIVE_ALLOCATE_ZEROED
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory
+
+/*
+ * OSL interfaces used by debugger/disassembler
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
+
+/*
+ * OSL interfaces used by utilities
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory
+
#else /* !__KERNEL__ */
#include <stdarg.h>
@@ -226,153 +267,4 @@
#include "acgcc.h"
-
-#ifdef __KERNEL__
-
-/*
- * FIXME: Inclusion of actypes.h
- * Linux kernel need this before defining inline OSL interfaces as
- * actypes.h need to be included to find ACPICA type definitions.
- * Since from ACPICA's perspective, the actypes.h should be included after
- * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
- */
-#include <acpi/actypes.h>
-
-/*
- * Overrides for in-kernel ACPICA
- */
-ACPI_STATUS __init AcpiOsInitialize (
- void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize
-
-ACPI_STATUS AcpiOsTerminate (
- void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate
-
-/*
- * Memory allocation/deallocation
- */
-
-/*
- * The irqs_disabled() check is for resume from RAM.
- * Interrupts are off during resume, just like they are for boot.
- * However, boot has (system_state != SYSTEM_RUNNING)
- * to quiet __might_sleep() in kmalloc() and resume does not.
- */
-static inline void *
-AcpiOsAllocate (
- ACPI_SIZE Size)
-{
- return kmalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
-}
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate
-
-/* Use native linux version of AcpiOsAllocateZeroed */
-
-static inline void *
-AcpiOsAllocateZeroed (
- ACPI_SIZE Size)
-{
- return kzalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
-}
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed
-#define USE_NATIVE_ALLOCATE_ZEROED
-
-static inline void
-AcpiOsFree (
- void *Memory)
-{
- kfree (Memory);
-}
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree
-
-static inline void *
-AcpiOsAcquireObject (
- ACPI_CACHE_T *Cache)
-{
- return kmem_cache_zalloc (Cache,
- irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
-}
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject
-
-static inline ACPI_THREAD_ID
-AcpiOsGetThreadId (
- void)
-{
- return (ACPI_THREAD_ID) (unsigned long) current;
-}
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId
-
-#ifndef CONFIG_PREEMPT
-
-/*
- * Used within ACPICA to show where it is safe to preempt execution
- * when CONFIG_PREEMPT=n
- */
-#define ACPI_PREEMPTION_POINT() \
- do { \
- if (!irqs_disabled()) \
- cond_resched(); \
- } while (0)
-
-#endif
-
-/*
- * When lockdep is enabled, the spin_lock_init() macro stringifies it's
- * argument and uses that as a name for the lock in debugging.
- * By executing spin_lock_init() in a macro the key changes from "lock" for
- * all locks to the name of the argument of acpi_os_create_lock(), which
- * prevents lockdep from reporting false positives for ACPICA locks.
- */
-#define AcpiOsCreateLock(__Handle) \
- ({ \
- spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \
- if (Lock) { \
- *(__Handle) = Lock; \
- spin_lock_init(*(__Handle)); \
- } \
- Lock ? AE_OK : AE_NO_MEMORY; \
- })
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock
-
-void __iomem *
-AcpiOsMapMemory (
- ACPI_PHYSICAL_ADDRESS Where,
- ACPI_SIZE Length);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory
-
-void
-AcpiOsUnmapMemory (
- void __iomem *LogicalAddress,
- ACPI_SIZE Size);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory
-
-/*
- * OSL interfaces used by debugger/disassembler
- */
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
-
-/*
- * OSL interfaces used by utilities
- */
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename
-#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory
-
-/*
- * OSL interfaces added by Linux
- */
-void
-EarlyAcpiOsUnmapMemory (
- void __iomem *Virt,
- ACPI_SIZE Size);
-
-#endif /* __KERNEL__ */
-
#endif /* __ACLINUX_H__ */
diff --git a/src/acpica/source/include/platform/aclinuxex.h \
b/src/acpica/source/include/platform/aclinuxex.h new file mode 100644
index 0000000..67e42ab
--- /dev/null
+++ b/src/acpica/source/include/platform/aclinuxex.h
@@ -0,0 +1,209 @@
+/******************************************************************************
+ *
+ * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2014, 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.
+ *
+ *****************************************************************************/
+
+#ifndef __ACLINUXEX_H__
+#define __ACLINUXEX_H__
+
+#ifdef __KERNEL__
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+ACPI_STATUS __init AcpiOsInitialize (
+ void);
+
+ACPI_STATUS AcpiOsTerminate (
+ void);
+
+/*
+ * The irqs_disabled() check is for resume from RAM.
+ * Interrupts are off during resume, just like they are for boot.
+ * However, boot has (system_state != SYSTEM_RUNNING)
+ * to quiet __might_sleep() in kmalloc() and resume does not.
+ */
+static inline void *
+AcpiOsAllocate (
+ ACPI_SIZE Size)
+{
+ return kmalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void *
+AcpiOsAllocateZeroed (
+ ACPI_SIZE Size)
+{
+ return kzalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void
+AcpiOsFree (
+ void *Memory)
+{
+ kfree (Memory);
+}
+
+static inline void *
+AcpiOsAcquireObject (
+ ACPI_CACHE_T *Cache)
+{
+ return kmem_cache_zalloc (Cache,
+ irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline ACPI_THREAD_ID
+AcpiOsGetThreadId (
+ void)
+{
+ return (ACPI_THREAD_ID) (unsigned long) current;
+}
+
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#define AcpiOsCreateLock(__Handle) \
+ ({ \
+ spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \
+ if (Lock) { \
+ *(__Handle) = Lock; \
+ spin_lock_init(*(__Handle)); \
+ } \
+ Lock ? AE_OK : AE_NO_MEMORY; \
+ })
+
+void __iomem *
+AcpiOsMapMemory (
+ ACPI_PHYSICAL_ADDRESS Where,
+ ACPI_SIZE Length);
+
+void
+AcpiOsUnmapMemory (
+ void __iomem *LogicalAddress,
+ ACPI_SIZE Size);
+
+/*
+ * OSL interfaces added by Linux
+ */
+void
+EarlyAcpiOsUnmapMemory (
+ void __iomem *Virt,
+ ACPI_SIZE Size);
+
+#endif /* __KERNEL__ */
+
+#endif /* __ACLINUXEX_H__ */
diff --git a/src/acpica/source/os_specific/service_layers/oslibcfs.c \
b/src/acpica/source/os_specific/service_layers/oslibcfs.c new file mode 100644
index 0000000..3343a0c
--- /dev/null
+++ b/src/acpica/source/os_specific/service_layers/oslibcfs.c
@@ -0,0 +1,323 @@
+/******************************************************************************
+ *
+ * Module Name: oslibcfs - C library OSL for file IO
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2014, 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;
+ char ModesStr[4];
+ UINT32 i = 0;
+
+ 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 - File descriptor
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Close a file.
+ *
+ ******************************************************************************/
+
+void
+AcpiOsCloseFile (
+ ACPI_FILE File)
+{
+ fclose (File);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsReadFile
+ *
+ * PARAMETERS: File - File descriptor
+ * Buffer - Data buffer
+ * Size - Data block size
+ * Count - Number of data blocks
+ *
+ * RETURN: Size of successfully read buffer.
+ *
+ * DESCRIPTION: Read 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 - File descriptor
+ * Buffer - Data buffer
+ * Size - Data block size
+ * Count - Number of data blocks
+ *
+ * RETURN: Size of successfully written buffer.
+ *
+ * DESCRIPTION: Write 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 - File descriptor
+ *
+ * RETURN: Size of current position.
+ *
+ * DESCRIPTION: Get current file offset.
+ *
+ ******************************************************************************/
+
+long
+AcpiOsGetFileOffset (
+ ACPI_FILE File)
+{
+ long Offset;
+
+ Offset = ftell (File);
+
+ return (Offset);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsSetFileOffset
+ *
+ * PARAMETERS: File - File descriptor
+ * Offset - 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/src/acpica/source/os_specific/service_layers/osunixxf.c \
b/src/acpica/source/os_specific/service_layers/osunixxf.c index 4d4fea2..c237ac2 \
100644
--- a/src/acpica/source/os_specific/service_layers/osunixxf.c
+++ b/src/acpica/source/os_specific/service_layers/osunixxf.c
@@ -137,16 +137,11 @@
ACPI_MODULE_NAME ("osunixxf")
-FILE *AcpiGbl_OutputFile;
BOOLEAN AcpiGbl_DebugTimeout = FALSE;
/* Upcalls to AcpiExec */
-ACPI_PHYSICAL_ADDRESS
-AeLocalGetRootPointer (
- void);
-
void
AeTableOverride (
ACPI_TABLE_HEADER *ExistingTable,
@@ -286,10 +281,19 @@ ACPI_STATUS
AcpiOsInitialize (
void)
{
+ ACPI_STATUS Status;
+
AcpiGbl_OutputFile = stdout;
OsEnterLineEditMode ();
+
+ Status = AcpiOsCreateLock (&AcpiGbl_PrintLock);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
return (AE_OK);
}
@@ -303,6 +307,7 @@ AcpiOsTerminate (
}
+#ifndef ACPI_USE_NATIVE_RSDP_POINTER
/******************************************************************************
*
* FUNCTION: AcpiOsGetRootPointer
@@ -320,8 +325,9 @@ AcpiOsGetRootPointer (
void)
{
- return (AeLocalGetRootPointer ());
+ return (0);
}
+#endif
/******************************************************************************
@@ -620,6 +626,7 @@ AcpiOsGetLine (
#endif
+#ifndef ACPI_USE_NATIVE_MEMORY_MAPPING
/******************************************************************************
*
* FUNCTION: AcpiOsMapMemory
@@ -665,6 +672,7 @@ AcpiOsUnmapMemory (
return;
}
+#endif
/******************************************************************************
@@ -691,6 +699,32 @@ AcpiOsAllocate (
}
+#ifdef USE_NATIVE_ALLOCATE_ZEROED
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsAllocateZeroed
+ *
+ * PARAMETERS: Size - Amount to allocate, in bytes
+ *
+ * RETURN: Pointer to the new allocation. Null on error.
+ *
+ * DESCRIPTION: Allocate and zero memory. Algorithm is dependent on the OS.
+ *
+ *****************************************************************************/
+
+void *
+AcpiOsAllocateZeroed (
+ ACPI_SIZE size)
+{
+ void *Mem;
+
+
+ Mem = (void *) calloc (1, (size_t) size);
+ return (Mem);
+}
+#endif
+
+
/******************************************************************************
*
* FUNCTION: AcpiOsFree
@@ -1526,6 +1560,26 @@ AcpiOsExecute (
return (0);
}
+#else /* ACPI_SINGLE_THREADED */
+ACPI_THREAD_ID
+AcpiOsGetThreadId (
+ void)
+{
+ return (1);
+}
+
+ACPI_STATUS
+AcpiOsExecute (
+ ACPI_EXECUTE_TYPE Type,
+ ACPI_OSD_EXEC_CALLBACK Function,
+ void *Context)
+{
+
+ Function (Context);
+
+ return (AE_OK);
+}
+
#endif /* ACPI_SINGLE_THREADED */
diff --git a/src/acpica/source/tools/acpiexec/aehandlers.c \
b/src/acpica/source/tools/acpiexec/aehandlers.c index 7fd63e2..06283f4 100644
--- a/src/acpica/source/tools/acpiexec/aehandlers.c
+++ b/src/acpica/source/tools/acpiexec/aehandlers.c
@@ -1127,11 +1127,21 @@ AeInstallEarlyHandlers (
Status = AcpiDetachData (Handle, AeAttachedDataHandler);
AE_CHECK_OK (AcpiDetachData, Status);
- Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
+ /* Test attach data at the root object */
+
+ Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler,
+ AcpiGbl_RootNode);
+ AE_CHECK_OK (AcpiAttachData, Status);
+
+ Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler2,
+ AcpiGbl_RootNode);
AE_CHECK_OK (AcpiAttachData, Status);
/* Test support for multiple attaches */
+ Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
+ AE_CHECK_OK (AcpiAttachData, Status);
+
Status = AcpiAttachData (Handle, AeAttachedDataHandler2, Handle);
AE_CHECK_OK (AcpiAttachData, Status);
}
@@ -1377,6 +1387,10 @@ AeRegionHandler (
switch (Function >> 16)
{
case AML_FIELD_ATTRIB_QUICK:
+
+ Length = 0;
+ break;
+
case AML_FIELD_ATTRIB_SEND_RCV:
case AML_FIELD_ATTRIB_BYTE:
--
2.0.0
--
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: \
https://lists.ubuntu.com/mailman/listinfo/fwts-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic