1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

Import ACPICA 20100528.

This commit is contained in:
Jung-uk Kim 2010-05-28 18:46:48 +00:00
parent 5b663f0c69
commit f2bf96d30f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/acpica/dist/; revision=208625
svn path=/vendor-sys/acpica/20100528/; revision=208626; tag=vendor/acpica/20100528
88 changed files with 6378 additions and 1233 deletions

View File

@ -1,3 +1,90 @@
----------------------------------------
28 May 2010. Summary of changes for version 20100528:
This release is available at www.acpica.org/downloads
Note: The ACPI 4.0a specification was released on April 5, 2010 and is
available at www.acpi.info. This is primarily an errata release.
1) ACPI CA Core Subsystem:
Undefined ACPI tables: We are looking for the definitions for the following
ACPI tables that have been seen in the field: ATKG, IEIT, GSCI.
Implemented support to enable multi-byte transfers for Embedded Controller
(EC) operation regions. Previously, the maximum data size passed to the EC
operation region handler was a single byte. There are often EC Fields larger
than one byte that need to be transferred, and it is useful for the EC driver
to lock these as a single transaction. This change enables single transfers
larger than 8 bits. This effectively changes the access to the EC space from
ByteAcc to AnyAcc, and will probably require changes to the host OS Embedded
Controller driver to enable 16/32/64/256-bit transfers in addition to 8-bit
transfers. Alexey Starikovskiy, Lin Ming
Implemented a performance enhancement for namespace search and access. This
change enhances the performance of namespace searches and walks by adding a
backpointer to the parent in each namespace node. On large namespaces, this
change can improve overall ACPI performance by up to 9X. Adding a pointer to
each namespace node increases the overall size of the internal namespace by
about 5%, since each namespace entry usually consists of both a namespace
node and an ACPI operand object. However, this is the first growth of the
namespace in ten years. ACPICA bugzilla 817. Alexey Starikovskiy.
Implemented a performance optimization that reduces the number of namespace
walks. On control method exit, only walk the namespace if the method is known
to have created namespace objects outside of its local scope. Previously, the
entire namespace was traversed on each control method exit. This change can
improve overall ACPI performance by up to 3X. Alexey Starikovskiy, Bob Moore.
Added support to truncate I/O addresses to 16 bits for Windows compatibility.
Some ASL code has been seen in the field that inadvertently has bits set
above bit 15. This feature is optional and is enabled if the BIOS requests
any Windows OSI strings. It can also be enabled by the host OS. Matthew
Garrett, Bob Moore.
Added support to limit the maximum time for the ASL Sleep() operator. To
prevent accidental deep sleeps, limit the maximum time that Sleep() will
actually sleep. Configurable, the default maximum is two seconds. ACPICA
bugzilla 854.
Added run-time validation support for the _WDG and_WED Microsoft predefined
methods. These objects are defined by "Windows Instrumentation", and are not
part of the ACPI spec. ACPICA BZ 860.
Expanded all statistic counters used during namespace and device
initialization from 16 to 32 bits in order to support very large namespaces.
Replaced all instances of %d in printf format specifiers with %u since nearly
all integers in ACPICA are unsigned.
Fixed the exception namestring for AE_WAKE_ONLY_GPE. Was incorrectly returned
as AE_NO_HANDLER.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and has a
much larger code and data size.
Previous Release:
Non-Debug Version: 88.4K Code, 18.8K Data, 107.2K Total
Debug Version: 164.2K Code, 51.5K Data, 215.7K Total
Current Release:
Non-Debug Version: 88.3K Code, 18.8K Data, 107.1K Total
Debug Version: 164.1K Code, 51.5K Data, 215.6K Total
2) iASL Compiler/Disassembler and Tools:
iASL: Added compiler support for the _WDG and_WED Microsoft predefined
methods. These objects are defined by "Windows Instrumentation", and are not
part of the ACPI spec. ACPICA BZ 860.
AcpiExec: added option to disable the memory tracking mechanism. The -dt
option will disable the tracking mechanism, which improves performance
considerably.
AcpiExec: Restructured the command line options into -d (disable) and -e
(enable) options.
----------------------------------------
28 April 2010. Summary of changes for version 20100428:

View File

@ -502,7 +502,7 @@ AdAmlDisassemble (
if (AcpiDmGetExternalMethodCount ())
{
fprintf (stderr,
"\nFound %d external control methods, reparsing with new information\n",
"\nFound %u external control methods, reparsing with new information\n",
AcpiDmGetExternalMethodCount ());
/*
@ -515,10 +515,11 @@ AdAmlDisassemble (
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;
AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST;
AcpiGbl_RootNodeStruct.Flags = 0;
Status = AcpiNsRootInitialize ();
AcpiDmAddExternalsToNamespace ();
@ -706,7 +707,7 @@ AdCreateTableHeader (
/* Open the ASL definition block */
AcpiOsPrintf (
"DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
"DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
NewFilename, Table->Signature, Table->Revision,
Table->OemId, Table->OemTableId, Table->OemRevision);
@ -1018,7 +1019,7 @@ AdGetLocalTables (
* is architecture-dependent.
*/
NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize;
AcpiOsPrintf ("There are %d tables defined in the %4.4s\n\n",
AcpiOsPrintf ("There are %u tables defined in the %4.4s\n\n",
NumTables, NewTable->Signature);
/* Get the FADT */

View File

@ -537,7 +537,7 @@ AcpiDmFindOrphanDescending (
}
ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp);
AcpiOsPrintf ("/* A-CHILDREN: %d Actual %d */\n", ArgCount, AcpiDmCountChildren (Op));
AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n", ArgCount, AcpiDmCountChildren (Op));
if (ArgCount < 1)
{

View File

@ -252,7 +252,7 @@ AcpiDmNormalizeParentPrefix (
Node = Op->Common.Node;
while (Node && (*Path == (UINT8) AML_PARENT_PREFIX))
{
Node = AcpiNsGetParentNode (Node);
Node = Node->Parent;
Path++;
}
@ -629,7 +629,7 @@ AcpiDmEmitExternals (
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
{
AcpiOsPrintf (") // %d Arguments\n",
AcpiOsPrintf (") // %u Arguments\n",
AcpiGbl_ExternalList->Value);
}
else

View File

@ -549,13 +549,6 @@ AcpiDmGetResourceNode (
return (Node);
}
/* List is circular, this flag marks the end */
if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
{
return (NULL);
}
Node = Node->Peer;
}

View File

@ -117,6 +117,7 @@
#include "accommon.h"
#include "acdisasm.h"
#include "actables.h"
#include "dtcompiler.h"
/* This module used for application-level code only */
@ -125,10 +126,6 @@
/* Local Prototypes */
static ACPI_DMTABLE_DATA *
AcpiDmGetTableData (
char *Signature);
static void
AcpiDmCheckAscii (
UINT8 *Target,
@ -247,37 +244,37 @@ static const char *AcpiDmFadtProfiles[] =
static ACPI_DMTABLE_DATA AcpiDmTableData[] =
{
{ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"},
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"},
{ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, "Boot Error Record Table"},
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"},
{ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"},
{ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"},
{ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"},
{ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, "Error Injection table"},
{ACPI_SIG_ERST, NULL, AcpiDmDumpErst, "Error Record Serialization Table"},
{ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"},
{ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"},
{ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"},
{ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"},
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"},
{ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
{ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, "Management Controller Host Interface table"},
{ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, "Maximum System Characteristics Table"},
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"},
{ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"},
{ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"},
{ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"},
{ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"},
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"},
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"},
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"},
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, "UEFI Boot Optimization Table"},
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, "Windows ACPI Emulated Devices Table"},
{ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, "Watchdog Action Table"},
{ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"},
{ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"},
{NULL, NULL, NULL, NULL}
{ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, "Alert Standard Format table"},
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, "Simple Boot Flag Table"},
{ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, "Boot Error Record Table"},
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, "Corrected Platform Error Polling table"},
{ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, "Debug Port table"},
{ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, "DMA Remapping table"},
{ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, "Embedded Controller Boot Resources Table"},
{ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, "Error Injection table"},
{ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, "Error Record Serialization Table"},
{ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, "Fixed ACPI Description Table"},
{ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, "Hardware Error Source Table"},
{ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, "High Precision Event Timer table"},
{ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, "I/O Virtualization Reporting Structure"},
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, "Multiple APIC Description Table"},
{ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, "Memory Mapped Configuration table"},
{ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, "Management Controller Host Interface table"},
{ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, "Maximum System Characteristics Table"},
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, "Root System Description Table"},
{ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, "Smart Battery Specification Table"},
{ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, NULL, "Software Licensing Description Table"},
{ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, "System Locality Information Table"},
{ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, "Serial Port Console Redirection table"},
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, "Server Platform Management Interface table"},
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, "System Resource Affinity Table"},
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, "Trusted Computing Platform Alliance table"},
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, NULL, "UEFI Boot Optimization Table"},
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, "Windows ACPI Emulated Devices Table"},
{ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, "Watchdog Action Table"},
{ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, "Watchdog Resource Table"},
{ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, "Extended System Description Table"},
{NULL, NULL, NULL, NULL, NULL}
};
@ -328,7 +325,7 @@ AcpiTbGenerateChecksum (
*
******************************************************************************/
static ACPI_DMTABLE_DATA *
ACPI_DMTABLE_DATA *
AcpiDmGetTableData (
char *Signature)
{

View File

@ -1174,7 +1174,7 @@ AcpiDmDumpMcfg (
{
if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
{
AcpiOsPrintf ("Warning: there are %d invalid trailing bytes\n",
AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
return;
}

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,12 @@ SRCS= \
asltransform.c \
asltree.c \
aslutils.c \
dtcompile.c \
dtfield.c \
dtio.c \
dtsubtable.c \
dttable.c \
dtutils.c \
../common/getopt.c \
../utilities/utalloc.c \
../utilities/utcache.c \
@ -119,7 +125,7 @@ SRCS= \
../osunixxf.c
NOMAN= YES
CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include
CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include -I../compiler
#YACC= yacc
YACC= bison

View File

@ -531,7 +531,7 @@ AnGetBtype (
if (!Node)
{
DbgPrint (ASL_DEBUG_OUTPUT,
"No attached Nsnode: [%s] at line %d name [%s], ignoring typecheck\n",
"No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
Op->Asl.ParseOpName, Op->Asl.LineNumber,
Op->Asl.ExternalName);
return ACPI_UINT32_MAX;

View File

@ -127,10 +127,6 @@ static void
CmFlushSourceCode (
void);
static ACPI_STATUS
FlCheckForAscii (
ASL_FILE_INFO *FileInfo);
void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
@ -433,7 +429,7 @@ FlConsumeNewComment (
*
******************************************************************************/
static ACPI_STATUS
ACPI_STATUS
FlCheckForAscii (
ASL_FILE_INFO *FileInfo)
{
@ -543,31 +539,6 @@ CmDoCompile (
FullCompile = UtBeginEvent ("*** Total Compile time ***");
Event = UtBeginEvent ("Open input and output files");
/* Open the required input and output files */
Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename);
if (ACPI_FAILURE (Status))
{
AePrintErrorLog (ASL_FILE_STDERR);
return -1;
}
/* Check for 100% ASCII source file (comments are ignored) */
Status = FlCheckForAscii (&Gbl_Files[ASL_FILE_INPUT]);
if (ACPI_FAILURE (Status))
{
AePrintErrorLog (ASL_FILE_STDERR);
return -1;
}
Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
if (ACPI_FAILURE (Status))
{
AePrintErrorLog (ASL_FILE_STDERR);
return -1;
}
UtEndEvent (Event);
/* Build the parse tree */
@ -888,19 +859,24 @@ CmCleanupAndExit (
if (Gbl_NsLookupCount)
{
DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n");
DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Total Namespace searches",
Gbl_NsLookupCount);
DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d usec\n", "Time per search",
((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
AslGbl_Events[AslGbl_NamespaceEvent].StartTime) /
10) / Gbl_NsLookupCount);
}
DbgPrint (ASL_DEBUG_OUTPUT,
"\n\nMiscellaneous compile statistics\n\n");
DbgPrint (ASL_DEBUG_OUTPUT,
"%32s : %u\n", "Total Namespace searches",
Gbl_NsLookupCount);
DbgPrint (ASL_DEBUG_OUTPUT,
"%32s : %u usec\n", "Time per search", ((UINT32)
(AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) /
Gbl_NsLookupCount);
}
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT);
printf ("\nMaximum error count (%u) exceeded\n",
ASL_MAX_ERROR_COUNT);
}
UtDisplaySummary (ASL_FILE_STDOUT);
@ -914,9 +890,15 @@ CmCleanupAndExit (
/* Delete AML file if there are errors */
if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) &&
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
{
remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename))
{
printf ("%s: ",
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
perror ("Could not delete AML file");
}
}
/*
@ -928,8 +910,9 @@ CmCleanupAndExit (
{
if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename))
{
printf ("Could not remove SRC file, %s\n",
printf ("%s: ",
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
perror ("Could not delete SRC file");
}
}
}

View File

@ -222,6 +222,10 @@ void
CmCleanupAndExit (
void);
ACPI_STATUS
FlCheckForAscii (
ASL_FILE_INFO *FileInfo);
/*
* aslanalyze - semantic analysis
@ -425,6 +429,16 @@ CgGenerateAmlOutput (
void);
/*
* aslfile
*/
void
FlOpenFile (
UINT32 FileId,
char *Filename,
char *Mode);
/*
* asllength - calculate/adjust AML package lengths
*/
@ -1003,5 +1017,12 @@ RsDoWordBusNumberDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
/*
* Entry to data table compiler subsystem
*/
ACPI_STATUS
DtDoCompile(
void);
#endif /* __ASLCOMPILER_H */

View File

@ -725,7 +725,7 @@ InsertLineBuffer (
* Warning if we have split a long source line.
* <Probably overkill>
*/
sprintf (MsgBuffer, "Max %d", ASL_LINE_BUFFER_SIZE);
sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE);
AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
Gbl_CurrentLineOffset, Gbl_CurrentColumn,

View File

@ -3164,7 +3164,7 @@ AslLocalAllocate (unsigned int Size)
void *Mem;
DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %d\n\n", Size);
DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size);
Mem = ACPI_ALLOCATE_ZEROED (Size);
if (!Mem)

View File

@ -184,6 +184,13 @@
#define FILE_SUFFIX_C_INCLUDE "h"
/* Types for input files */
#define ASL_INPUT_TYPE_BINARY 0
#define ASL_INPUT_TYPE_ASCII_ASL 1
#define ASL_INPUT_TYPE_ASCII_DATA 2
/* Misc */
#define ASL_EXTERNAL_METHOD 255

View File

@ -525,7 +525,7 @@ AslCommonError (
Gbl_ExceptionCount[Level]++;
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT);
printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT);
Gbl_SourceLine = 0;
Gbl_NextError = Gbl_ErrorLog;

View File

@ -122,12 +122,6 @@
/* Local prototypes */
static void
FlOpenFile (
UINT32 FileId,
char *Filename,
char *Mode);
FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
@ -212,7 +206,7 @@ FlFileError (
*
******************************************************************************/
static void
void
FlOpenFile (
UINT32 FileId,
char *Filename,

View File

@ -145,7 +145,7 @@ extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
extern char *AslCompilertext;
extern char HexLookup[];
#define ASL_LINE_BUFFER_SIZE 512
#define ASL_LINE_BUFFER_SIZE 1024
#define ASL_MSG_BUFFER_SIZE 4096
#define HEX_TABLE_LINE_SIZE 8
#define HEX_LISTING_LINE_SIZE 8
@ -196,6 +196,8 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFl
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE);
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DataTableCompilerAvailable, FALSE);
#define HEX_OUTPUT_NONE 0
@ -223,6 +225,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE)
/* Statistics */
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputFieldCount, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0);
@ -247,6 +250,8 @@ ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode;
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0);

View File

@ -216,7 +216,7 @@ LsDoOneNamespaceObject (
Gbl_NumNamespaceObjects++;
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s",
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s",
Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
&Node->Name,
AcpiUtGetTypeName (Node->Type));
@ -1245,7 +1245,7 @@ LkNamespaceLocateBegin (
*/
if (PassedArgs != Node->Value)
{
sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName,
sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
Node->Value);
if (PassedArgs < Node->Value)

View File

@ -167,7 +167,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:"
#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:yz"
/*******************************************************************************
@ -268,6 +268,8 @@ HelpMessage (
printf (" -n Parse only, no output generation\n");
printf (" -ot Display compile times\n");
printf (" -x<level> Set debug level for trace output\n");
printf (" -y Temporary: Enable data table compiler\n");
printf (" -z Do not insert new compiler ID for DataTables\n");
}
@ -831,6 +833,18 @@ AslDoOptions (
break;
case 'y':
Gbl_DataTableCompilerAvailable = TRUE;
break;
case 'z':
Gbl_UseOriginalCompilerId = TRUE;
break;
default:
return (-1);

View File

@ -339,7 +339,7 @@ OptBuildShortestPath (
}
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %d",
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %u",
NumCommonSegments));
/* There must be at least 1 common NameSeg in order to optimize */

View File

@ -251,7 +251,7 @@ ApCheckForPredefinedMethod (
if (MethodInfo->NumArguments != 0)
{
sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName, 0);
sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0);
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
MsgBuffer);
@ -274,7 +274,7 @@ ApCheckForPredefinedMethod (
if ((MethodInfo->NumArguments != RequiredArgsCurrent) &&
(MethodInfo->NumArguments != RequiredArgsOld))
{
sprintf (MsgBuffer, "%4.4s requires %d",
sprintf (MsgBuffer, "%4.4s requires %u",
PredefinedNames[Index].Info.Name, RequiredArgsCurrent);
if (MethodInfo->NumArguments > RequiredArgsCurrent)
@ -731,7 +731,7 @@ ApDisplayReservedNames (
ThisName = PredefinedNames;
while (ThisName->Info.Name[0])
{
printf ("%4.4s Requires %d arguments, ",
printf ("%4.4s Requires %u arguments, ",
ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F);
if (ThisName->Info.ExpectedBtypes)

View File

@ -140,6 +140,10 @@ AsDoWildcard (
char *DirectoryPathname,
char *FileSpecifier);
UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info);
/*******************************************************************************
*
@ -167,10 +171,13 @@ AslInitializeGlobals (
Gbl_CurrentLineNumber = 1;
Gbl_LogicalLineNumber = 1;
Gbl_CurrentLineOffset = 0;
Gbl_InputFieldCount = 0;
Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
Gbl_ErrorLog = NULL;
Gbl_NextError = NULL;
Gbl_Signature = NULL;
Gbl_FileType = 0;
AslGbl_NextEvent = 0;
for (i = 0; i < ASL_NUM_REPORT_LEVELS; i++)
@ -179,6 +186,7 @@ AslInitializeGlobals (
}
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle = NULL;
}
@ -257,6 +265,77 @@ AsDoWildcard (
}
/*******************************************************************************
*
* FUNCTION: AslDetectSourceFileType
*
* PARAMETERS: Info - Name/Handle for the file (must be open)
*
* RETURN: File Type
*
* DESCRIPTION: Determine the type of the input file. Either binary (contains
* non-ASCII characters), ASL file, or an ACPI Data Table file.
*
******************************************************************************/
UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info)
{
char *FileChar;
UINT8 Type;
ACPI_STATUS Status;
/* Check for 100% ASCII source file (comments are ignored) */
Status = FlCheckForAscii (Info);
if (ACPI_FAILURE (Status))
{
printf ("Non-ascii input file - %s\n", Info->Filename);
Type = ASL_INPUT_TYPE_BINARY;
goto Cleanup;
}
/*
* File is ASCII. Determine if this is an ASL file or an ACPI data
* table file.
*/
while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Info->Handle))
{
/* Uppercase the buffer for caseless compare */
FileChar = Gbl_CurrentLineBuffer;
while (*FileChar)
{
*FileChar = (char) toupper ((int) *FileChar);
FileChar++;
}
/* Presence of "DefinitionBlock" indicates actual ASL code */
if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK"))
{
/* Appears to be an ASL file */
Type = ASL_INPUT_TYPE_ASCII_ASL;
goto Cleanup;
}
}
/* Not an ASL source file, default to a data table source file */
Type = ASL_INPUT_TYPE_ASCII_DATA;
Cleanup:
/* Must seek back to the start of the file */
fseek (Info->Handle, 0, SEEK_SET);
return (Type);
}
/*******************************************************************************
*
* FUNCTION: AslDoOneFile
@ -287,7 +366,7 @@ AslDoOneFile (
*/
if (Gbl_DisasmFlag || Gbl_GetAllTables)
{
/* ACPI CA subsystem initialization */
/* ACPICA subsystem initialization */
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
@ -330,23 +409,89 @@ AslDoOneFile (
AcpiOsPrintf ("\nCompiling \"%s\"\n",
Gbl_Files[ASL_FILE_INPUT].Filename);
}
else
{
Gbl_Files[ASL_FILE_INPUT].Filename = NULL;
return (AE_OK);
}
}
/*
* Open the input file. Here, this should be an ASCII source file,
* either an ASL file or a Data Table file
*/
Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename);
if (ACPI_FAILURE (Status))
{
AePrintErrorLog (ASL_FILE_STDERR);
return (AE_ERROR);
}
/* Determine input file type */
Gbl_FileType = AslDetectSourceFileType (&Gbl_Files[ASL_FILE_INPUT]);
if (Gbl_FileType == ASL_INPUT_TYPE_BINARY)
{
return (AE_ERROR);
}
/*
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
if (Gbl_UseDefaultAmlFilename)
{
Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename;
}
/* Open the optional output files (listings, etc.) */
Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
if (ACPI_FAILURE (Status))
{
AePrintErrorLog (ASL_FILE_STDERR);
return (AE_ERROR);
}
/*
* Compilation of ASL source versus DataTable source uses different
* compiler subsystems
*/
switch (Gbl_FileType)
{
/*
* Data Table Compilation
*/
case ASL_INPUT_TYPE_ASCII_DATA:
/*
* Require use of command-line option to enable the data table
* compiler -- for now, until development of the compiler is
* complete.
*/
if (!Gbl_DataTableCompilerAvailable)
{
printf ("Data Table Compiler is not available yet\n");
return (AE_SUPPORT);
}
Status = DtDoCompile ();
if (Gbl_Signature)
{
ACPI_FREE (Gbl_Signature);
Gbl_Signature = NULL;
}
AeClearErrorLog ();
return (Status);
/*
* ASL Compilation (Optional)
*/
if (Gbl_DoCompile)
{
/*
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
if (Gbl_UseDefaultAmlFilename)
{
Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename;
}
case ASL_INPUT_TYPE_ASCII_ASL:
/* ACPI CA subsystem initialization (Must be re-initialized) */
/* ACPICA subsystem initialization */
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
@ -367,9 +512,17 @@ AslDoOneFile (
}
AeClearErrorLog ();
}
return (AE_OK);
return (AE_OK);
case ASL_INPUT_TYPE_BINARY:
AePrintErrorLog (ASL_FILE_STDERR);
return (AE_ERROR);
default:
printf ("Unknown file type %X\n", Gbl_FileType);
return (AE_ERROR);
}
}
@ -391,7 +544,7 @@ ACPI_STATUS
AslDoOnePathname (
char *Pathname)
{
ACPI_STATUS Status;
ACPI_STATUS Status = AE_OK;
char **FileList;
char *Filename;
char *FullPathname;
@ -427,11 +580,9 @@ AslDoOnePathname (
Gbl_OutputFilenamePrefix = FullPathname;
}
Status = AslDoOneFile (FullPathname);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Save status from all compiles */
Status |= AslDoOneFile (FullPathname);
ACPI_FREE (FullPathname);
ACPI_FREE (*FileList);
@ -441,6 +592,6 @@ AslDoOnePathname (
ACPI_FREE (Gbl_DirectoryPath);
ACPI_FREE (Filename);
return (AE_OK);
return (Status);
}

View File

@ -674,7 +674,7 @@ TrDoSwitch (
{
/* Unknown peer opcode */
AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%d)\n",
AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%u)\n",
Next->Asl.ParseOpName, Next->Asl.ParseOpcode);
}
}

View File

@ -466,7 +466,7 @@ TrCreateLeafNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateLeafNode Ln/Col %d/%d NewNode %p Op %s\n\n",
"\nCreateLeafNode Ln/Col %u/%u NewNode %p Op %s\n\n",
Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode));
return Op;
@ -498,7 +498,7 @@ TrCreateValuedLeafNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateValuedLeafNode Ln/Col %d/%d NewNode %p Op %s Value %8.8X%8.8X ",
"\nCreateValuedLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),
ACPI_FORMAT_UINT64 (Value));
Op->Asl.Value.Integer = Value;
@ -575,7 +575,7 @@ TrCreateNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateNode Ln/Col %d/%d NewParent %p Child %d Op %s ",
"\nCreateNode Ln/Col %u/%u NewParent %p Child %u Op %s ",
Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode));
/* Some extra debug output based on the parse opcode */
@ -694,7 +694,7 @@ TrLinkChildren (
TrSetEndLineNumber (Op);
DbgPrint (ASL_PARSE_OUTPUT,
"\nLinkChildren Line [%d to %d] NewParent %p Child %d Op %s ",
"\nLinkChildren Line [%u to %u] NewParent %p Child %u Op %s ",
Op->Asl.LineNumber, Op->Asl.EndLine,
Op, NumChildren, UtGetOpName(Op->Asl.ParseOpcode));
@ -882,7 +882,7 @@ TrLinkPeerNodes (
DbgPrint (ASL_PARSE_OUTPUT,
"\nLinkPeerNodes: (%d) ", NumPeers);
"\nLinkPeerNodes: (%u) ", NumPeers);
va_start (ap, NumPeers);
This = va_arg (ap, ACPI_PARSE_OBJECT *);
@ -893,7 +893,7 @@ TrLinkPeerNodes (
*/
for (i = 0; i < (NumPeers -1); i++)
{
DbgPrint (ASL_PARSE_OUTPUT, "%d=%p ", (i+1), This);
DbgPrint (ASL_PARSE_OUTPUT, "%u=%p ", (i+1), This);
while (This->Asl.Next)
{

View File

@ -279,11 +279,17 @@ typedef struct asl_listing_node
/* Callback interface for a parse tree walk */
/*
* TBD - another copy of this is in adisasm.h, fix
*/
#ifndef ASL_WALK_CALLBACK_DEFINED
typedef
ACPI_STATUS (*ASL_WALK_CALLBACK) (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
#define ASL_WALK_CALLBACK_DEFINED
#endif
typedef struct asl_event_info
@ -429,14 +435,24 @@ typedef enum
ASL_MSG_INVALID_GRANULARITY,
ASL_MSG_INVALID_GRAN_FIXED,
ASL_MSG_INVALID_ACCESS_SIZE,
ASL_MSG_INVALID_ADDR_FLAGS
ASL_MSG_INVALID_ADDR_FLAGS,
ASL_MSG_INVALID_FIELD_NAME,
ASL_MSG_INTEGER_SIZE,
ASL_MSG_INVALID_HEX_INTEGER,
ASL_MSG_BUFFER_ELEMENT,
ASL_MSG_RESERVED_VALUE,
ASL_MSG_FLAG_VALUE,
ASL_MSG_ZERO_VALUE,
ASL_MSG_UNKNOWN_TABLE,
ASL_MSG_UNKNOWN_SUBTABLE,
ASL_MSG_OEM_TABLE
} ASL_MESSAGE_IDS;
#ifdef ASL_EXCEPTIONS
char *AslMessages [] = {
/* The zeroth message is resesrved */ "",
/* The zeroth message is reserved */ "",
/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric",
/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator",
/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments",
@ -558,7 +574,20 @@ char *AslMessages [] = {
/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags"
/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags",
/* These messages are used by the data table compiler only */
/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name",
/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target",
/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant",
/* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list",
/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero",
/* ASL_MSG_FLAG_VALUE */ "Flag value is too large",
/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents"
};

View File

@ -214,6 +214,8 @@ UtLocalCalloc (
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
Gbl_InputByteCount, Gbl_CurrentColumn,
Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
CmCleanupAndExit ();
exit (1);
}
@ -523,33 +525,57 @@ UtDisplaySummary (
CompilerId, (UINT32) ACPI_CA_VERSION, __DATE__);
}
/* Input/Output summary */
FlPrintFile (FileId,
"ASL Input: %s - %d lines, %d bytes, %d keywords\n",
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
Gbl_InputByteCount, TotalKeywords);
/* AML summary */
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
{
FlPrintFile (FileId,
"AML Output: %s - %d bytes, %d named objects, %d executable opcodes\n\n",
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
TotalNamedObjects, TotalExecutableOpcodes);
"Table Input: %s - %u lines, %u bytes, %u fields\n",
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
Gbl_InputByteCount, Gbl_InputFieldCount);
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
{
FlPrintFile (FileId,
"Binary Output: %s - %u bytes\n\n",
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength);
}
}
else
{
/* Input/Output summary */
FlPrintFile (FileId,
"ASL Input: %s - %u lines, %u bytes, %u keywords\n",
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
Gbl_InputByteCount, TotalKeywords);
/* AML summary */
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
{
FlPrintFile (FileId,
"AML Output: %s - %u bytes, %u named objects, %u executable opcodes\n\n",
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
TotalNamedObjects, TotalExecutableOpcodes);
}
}
/* Error summary */
FlPrintFile (FileId,
"Compilation complete. %d Errors, %d Warnings, %d Remarks, %d Optimizations\n",
"Compilation complete. %u Errors, %u Warnings, %u Remarks",
Gbl_ExceptionCount[ASL_ERROR],
Gbl_ExceptionCount[ASL_WARNING] +
Gbl_ExceptionCount[ASL_WARNING2] +
Gbl_ExceptionCount[ASL_WARNING3],
Gbl_ExceptionCount[ASL_REMARK],
Gbl_ExceptionCount[ASL_OPTIMIZATION]);
Gbl_ExceptionCount[ASL_REMARK]);
if (Gbl_FileType != ASL_INPUT_TYPE_ASCII_DATA)
{
FlPrintFile (FileId,
", %u Optimizations", Gbl_ExceptionCount[ASL_OPTIMIZATION]);
}
FlPrintFile (FileId, "\n");
}

614
compiler/dtcompile.c Normal file
View File

@ -0,0 +1,614 @@
/******************************************************************************
*
* Module Name: dtcompile.c - Front-end for data table compiler
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, 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.
*
*****************************************************************************/
#define __DTCOMPILE_C__
#define _DECLARE_DT_GLOBALS
#include "aslcompiler.h"
#include "dtcompiler.h"
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtcompile")
static char VersionString[9];
/* Local prototypes */
static void
DtInitialize (
void);
static ACPI_STATUS
DtCompileDataTable (
DT_FIELD **Field);
static void
DtInsertCompilerIds (
DT_FIELD *FieldList);
/******************************************************************************
*
* FUNCTION: DtDoCompile
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Main entry point for the data table compiler.
*
* Note: Assumes Gbl_Files[ASL_FILE_INPUT] is initialized and the file is
* open at seek offset zero.
*
*****************************************************************************/
ACPI_STATUS
DtDoCompile (
void)
{
ACPI_STATUS Status;
UINT8 Event;
DT_FIELD *FieldList;
/* Initialize globals */
DtInitialize ();
/*
* Scan the input file (file is already open) and
* build the parse tree
*/
Event = UtBeginEvent ("Scan and parse input file");
FieldList = DtScanFile (Gbl_Files[ASL_FILE_INPUT].Handle);
UtEndEvent (Event);
/* Did the parse tree get successfully constructed? */
if (!FieldList)
{
/* TBD: temporary error message. Msgs should come from function above */
DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
"Could not parse input file");
return (AE_ERROR);
}
Event = UtBeginEvent ("Compile parse tree");
/*
* Compile the parse tree
*/
Status = DtCompileDataTable (&FieldList);
UtEndEvent (Event);
DtFreeFieldList ();
if (ACPI_FAILURE (Status))
{
/* TBD: temporary error message. Msgs should come from function above */
DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
"Could not compile input file");
goto CleanupAndExit;
}
/* Create/open the binary output file */
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
if (ACPI_FAILURE (Status))
{
goto CleanupAndExit;
}
/* Write the binary, then the optional hex file */
DtOutputBinary (Gbl_RootTable);
LsDoHexOutput ();
CleanupAndExit:
CmCleanupAndExit ();
return (Status);
}
/******************************************************************************
*
* FUNCTION: DtInitialize
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Initialize data table compiler globals. Enables multiple
* compiles per invocation.
*
*****************************************************************************/
static void
DtInitialize (
void)
{
Gbl_FieldList = NULL;
Gbl_RootTable = NULL;
Gbl_SubtableStack = NULL;
sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
}
/******************************************************************************
*
* FUNCTION: DtInsertCompilerIds
*
* PARAMETERS: FieldList - Current field list pointer
*
* RETURN: None
*
* DESCRIPTION: Insert the IDs (Name, Version) of the current compiler into
* the original ACPI table header.
*
*****************************************************************************/
static void
DtInsertCompilerIds (
DT_FIELD *FieldList)
{
DT_FIELD *Next;
UINT32 i;
/*
* Don't insert current compiler ID if requested. Used for compiler
* debug/validation only.
*/
if (Gbl_UseOriginalCompilerId)
{
return;
}
/* Walk to the Compiler fields at the end of the header */
Next = FieldList;
for (i = 0; i < 7; i++)
{
Next = Next->Next;
}
Next->Value = CompilerCreatorId;
Next->Flags = DT_FIELD_NOT_ALLOCATED;
Next = Next->Next;
Next->Value = VersionString;
Next->Flags = DT_FIELD_NOT_ALLOCATED;
}
/******************************************************************************
*
* FUNCTION: DtCompileDataTable
*
* PARAMETERS: FieldList - Current field list pointer
*
* RETURN: Status
*
* DESCRIPTION: Entry point to compile one data table
*
*****************************************************************************/
static ACPI_STATUS
DtCompileDataTable (
DT_FIELD **FieldList)
{
ACPI_DMTABLE_DATA *TableData;
DT_SUBTABLE *Subtable;
char *Signature;
ACPI_TABLE_HEADER *AcpiTableHeader;
ACPI_STATUS Status;
/* Verify that we at least have a table signature and save it */
Signature = DtGetFieldValue (*FieldList, "Signature");
if (!Signature)
{
DtError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, *FieldList, NULL);
return (AE_ERROR);
}
Gbl_Signature = UtLocalCalloc (ACPI_STRLEN (Signature) + 1);
strcpy (Gbl_Signature, Signature);
/*
* Handle tables that don't use the common ACPI table header structure.
* Currently, these are the FACS and RSDP. Also check for an OEMx table,
* these tables have user-defined contents.
*/
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
{
Status = DtCompileFacs (FieldList);
if (ACPI_FAILURE (Status))
{
return (Status);
}
DtSetTableLength ();
return (Status);
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP))
{
Status = DtCompileRsdp (FieldList);
return (Status);
}
else if (!ACPI_STRNCMP (Signature, "OEM", 3))
{
DtFatal (ASL_MSG_OEM_TABLE, *FieldList, Signature);
return (AE_ERROR);
}
/*
* All other tables must use the common ACPI table header. Insert the
* current iASL IDs (name, version), and compile the header now.
*/
DtInsertCompilerIds (*FieldList);
Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader,
&Gbl_RootTable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
DtPushSubtable (Gbl_RootTable);
/* Match signature and dispatch appropriately */
TableData = AcpiDmGetTableData (Signature);
if (!TableData)
{
DtFatal (ASL_MSG_UNKNOWN_TABLE, *FieldList, Signature);
return (AE_ERROR);
}
if (TableData->CmTableHandler)
{
/* Complex table, has a handler */
Status = TableData->CmTableHandler ((void **) FieldList);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
else if (TableData->TableInfo)
{
/* Simple table, just walk the info table */
Subtable = NULL;
Status = DtCompileTable (FieldList, TableData->TableInfo,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
DtInsertSubtable (Gbl_RootTable, Subtable);
DtPopSubtable ();
}
else
{
DtFatal (ASL_MSG_COMPILER_INTERNAL, *FieldList,
"Missing table dispatch info");
return (AE_ERROR);
}
/* Set the final table length and then the checksum */
DtSetTableLength ();
AcpiTableHeader = ACPI_CAST_PTR (
ACPI_TABLE_HEADER, Gbl_RootTable->Buffer);
DtSetTableChecksum (&AcpiTableHeader->Checksum);
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: DtCompileTable
*
* PARAMETERS: Field - Current field list pointer
* Info - Info table for this ACPI table
* RetSubtable - Compile result of table
* Required - If this subtable must exist
*
* RETURN: Status
*
* DESCRIPTION: Compile a subtable
*
*****************************************************************************/
ACPI_STATUS
DtCompileTable (
DT_FIELD **Field,
ACPI_DMTABLE_INFO *Info,
DT_SUBTABLE **RetSubtable,
BOOLEAN Required)
{
DT_FIELD *LocalField;
UINT32 Length;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *InlineSubtable;
UINT32 FieldLength = 0;
UINT8 FieldType;
UINT8 *Buffer;
UINT8 *FlagBuffer = NULL;
UINT32 FlagBitPosition = 0;
ACPI_STATUS Status;
if (!Field || !*Field)
{
return (AE_BAD_PARAMETER);
}
Length = DtGetSubtableLength (*Field, Info);
Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
Subtable->Buffer = UtLocalCalloc (Length);
Subtable->Length = Length;
Subtable->TotalLength = Length;
Buffer = Subtable->Buffer;
LocalField = *Field;
/*
* Main loop walks the info table for this ACPI table or subtable
*/
for (; Info->Name; Info++)
{
if (!LocalField)
{
sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed",
Info->Name);
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
Status = AE_BAD_DATA;
goto Error;
}
/* Does input field name match what is expected? */
if (ACPI_STRCMP (LocalField->Name, Info->Name))
{
/*
* If Required = TRUE, the subtable must exist.
* If Required = FALSE, the subtable is optional
* (For example, AcpiDmTableInfoDmarScope in DMAR table is
* optional)
*/
if (Required)
{
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
LocalField, MsgBuffer);
}
else
{
Status = AE_NOT_FOUND;
goto Error;
}
}
FieldLength = DtGetFieldLength (LocalField, Info);
FieldType = DtGetFieldType (Info);
Gbl_InputFieldCount++;
switch (FieldType)
{
case DT_FIELD_TYPE_FLAGS_INTEGER:
/*
* Start of the definition of a flags field.
* This master flags integer starts at value zero, in preparation
* to compile and insert the flag fields from the individual bits
*/
LocalField = LocalField->Next;
*Field = LocalField;
FlagBitPosition = 0;
FlagBuffer = Buffer;
break;
case DT_FIELD_TYPE_FLAG:
/* Individual Flag field, can be multiple bits */
if (FlagBuffer)
{
FlagBitPosition = DtCompileFlag (FlagBuffer,
LocalField, Info, FlagBitPosition);
}
else
{
/* TBD - this is an internal error */
}
LocalField = LocalField->Next;
*Field = LocalField;
break;
case DT_FIELD_TYPE_INLINE_SUBTABLE:
/*
* Recursion (one level max): compile GAS (Generic Address)
* or Notify in-line subtable
*/
LocalField = LocalField->Next;
*Field = LocalField;
if (Info->Opcode == ACPI_DMT_GAS)
{
Status = DtCompileTable (Field, AcpiDmTableInfoGas,
&InlineSubtable, TRUE);
}
else
{
Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify,
&InlineSubtable, TRUE);
}
if (ACPI_FAILURE (Status))
{
goto Error;
}
ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength);
ACPI_FREE (InlineSubtable->Buffer);
ACPI_FREE (InlineSubtable);
LocalField = *Field;
break;
default:
/* Normal case for most field types (Integer, String, etc.) */
DtCompileOneField (Buffer, LocalField,
FieldLength, FieldType, Info->Flags);
LocalField = LocalField->Next;
if (Info->Flags & DT_LENGTH)
{
/* Field is an Integer that will contain a subtable length */
Subtable->LengthField = Buffer;
Subtable->SizeOfLengthField = FieldLength;
}
break;
}
Buffer += FieldLength;
}
*Field = LocalField;
*RetSubtable = Subtable;
return (AE_OK);
Error:
ACPI_FREE (Subtable->Buffer);
ACPI_FREE (Subtable);
return (Status);
}

455
compiler/dtcompiler.h Normal file
View File

@ -0,0 +1,455 @@
/******************************************************************************
*
* Module Name: dtcompiler.h - header for data table compiler
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, 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.
*
*****************************************************************************/
#define __DTCOMPILER_H__
#ifndef _DTCOMPILER
#define _DTCOMPILER
#include <stdio.h>
#include "acdisasm.h"
#undef DT_EXTERN
#ifdef _DECLARE_DT_GLOBALS
#define DT_EXTERN
#define DT_INIT_GLOBAL(a,b) (a)=(b)
#else
#define DT_EXTERN extern
#define DT_INIT_GLOBAL(a,b) (a)
#endif
/* Types for individual fields (one per input line) */
#define DT_FIELD_TYPE_STRING 0
#define DT_FIELD_TYPE_INTEGER 1
#define DT_FIELD_TYPE_BUFFER 2
#define DT_FIELD_TYPE_PCI_PATH 3
#define DT_FIELD_TYPE_FLAG 4
#define DT_FIELD_TYPE_FLAGS_INTEGER 5
#define DT_FIELD_TYPE_INLINE_SUBTABLE 6
/*
* Structure used for each individual field within an ACPI table
*/
typedef struct dt_field
{
char *Name;
char *Value;
struct dt_field *Next;
UINT32 Line; /* Line number for this field */
UINT32 ByteOffset; /* Offset in source file for field */
UINT32 NameColumn; /* Start column for field name */
UINT32 Column; /* Start column for field value */
UINT8 Flags;
} DT_FIELD;
/* Flags for above */
#define DT_FIELD_NOT_ALLOCATED 1
/*
* Structure used for individual subtables within an ACPI table
*/
typedef struct dt_subtable
{
struct dt_subtable *Parent;
struct dt_subtable *Child;
struct dt_subtable *Peer;
struct dt_subtable *StackTop;
UINT8 *Buffer;
UINT8 *LengthField;
UINT32 Length;
UINT32 TotalLength;
UINT32 SizeOfLengthField;
UINT8 Flags;
} DT_SUBTABLE;
/*
* Globals
*/
/* List of all field names and values from the input source */
DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_FieldList, NULL);
/* List of all compiled tables and subtables */
DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_RootTable, NULL);
/* Stack for subtables */
DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableStack, NULL);
/* dtcompiler - main module */
ACPI_STATUS
DtCompileTable (
DT_FIELD **Field,
ACPI_DMTABLE_INFO *Info,
DT_SUBTABLE **RetSubtable,
BOOLEAN Required);
/* dtio - binary and text input/output */
DT_FIELD *
DtScanFile (
FILE *Handle);
void
DtOutputBinary (
DT_SUBTABLE *RootTable);
/* dtsubtable - compile subtables */
void
DtCreateSubtable (
UINT8 *Buffer,
UINT32 Length,
DT_SUBTABLE **RetSubtable);
UINT32
DtGetSubtableLength (
DT_FIELD *Field,
ACPI_DMTABLE_INFO *Info);
void
DtSetSubtableLength (
DT_SUBTABLE *Subtable);
void
DtPushSubtable (
DT_SUBTABLE *Subtable);
void
DtPopSubtable (
void);
DT_SUBTABLE *
DtPeekSubtable (
void);
void
DtInsertSubtable (
DT_SUBTABLE *ParentTable,
DT_SUBTABLE *Subtable);
DT_SUBTABLE *
DtGetNextSubtable (
DT_SUBTABLE *ParentTable,
DT_SUBTABLE *ChildTable);
DT_SUBTABLE *
DtGetParentSubtable (
DT_SUBTABLE *Subtable);
/* dtfield - Compile individual fields within a table */
void
DtCompileOneField (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength,
UINT8 Type,
UINT8 Flags);
void
DtCompileInteger (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength,
UINT8 Flags);
UINT32
DtCompileBuffer (
UINT8 *Buffer,
char *Value,
DT_FIELD *Field,
UINT32 ByteLength);
UINT32
DtCompileFlag (
UINT8 *Buffer,
DT_FIELD *Field,
ACPI_DMTABLE_INFO *Info,
UINT32 BitPosition);
/* dtutils - Miscellaneous utilities */
typedef
void (*DT_WALK_CALLBACK) (
DT_SUBTABLE *Subtable,
void *Context,
void *ReturnValue);
void
DtWalkTableTree (
DT_SUBTABLE *StartTable,
DT_WALK_CALLBACK UserFunction,
void *Context,
void *ReturnValue);
void
DtError (
UINT8 Level,
UINT8 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage);
void
DtNameError (
UINT8 Level,
UINT8 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage);
void
DtFatal (
UINT8 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage);
ACPI_STATUS
DtStrtoul64 (
char *String,
UINT64 *ReturnInteger);
UINT32
DtGetFileSize (
FILE *Handle);
char*
DtGetFieldValue (
DT_FIELD *Field,
char *Name);
UINT8
DtGetFieldType (
ACPI_DMTABLE_INFO *Info);
UINT32
DtGetBufferLength (
char *Buffer);
UINT32
DtGetFieldLength (
DT_FIELD *Field,
ACPI_DMTABLE_INFO *Info);
void
DtSetTableChecksum (
UINT8 *ChecksumPointer);
void
DtSetTableLength(
void);
void
DtFreeFieldList (
void);
/* dttable - individual table compilation */
ACPI_STATUS
DtCompileFacs (
DT_FIELD **PFieldList);
ACPI_STATUS
DtCompileRsdp (
DT_FIELD **PFieldList);
ACPI_STATUS
DtCompileAsf (
void **PFieldList);
ACPI_STATUS
DtCompileCpep (
void **PFieldList);
ACPI_STATUS
DtCompileDmar (
void **PFieldList);
ACPI_STATUS
DtCompileEinj (
void **PFieldList);
ACPI_STATUS
DtCompileErst (
void **PFieldList);
ACPI_STATUS
DtCompileFadt (
void **PFieldList);
ACPI_STATUS
DtCompileHest (
void **PFieldList);
ACPI_STATUS
DtCompileIvrs (
void **PFieldList);
ACPI_STATUS
DtCompileMadt (
void **PFieldList);
ACPI_STATUS
DtCompileMcfg (
void **PFieldList);
ACPI_STATUS
DtCompileMsct (
void **PFieldList);
ACPI_STATUS
DtCompileRsdt (
void **PFieldList);
ACPI_STATUS
DtCompileSlit (
void **PFieldList);
ACPI_STATUS
DtCompileSrat (
void **PFieldList);
ACPI_STATUS
DtCompileWdat (
void **PFieldList);
ACPI_STATUS
DtCompileXsdt (
void **PFieldList);
/* Debug */
#define MYDEBUG printf
#endif

543
compiler/dtfield.c Normal file
View File

@ -0,0 +1,543 @@
/******************************************************************************
*
* Module Name: dtfield.c - Code generation for individual source fields
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, 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.
*
*****************************************************************************/
#define __DTFIELD_C__
#include "aslcompiler.h"
#include "dtcompiler.h"
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtfield")
/* Local prototypes */
static void
DtCompileString (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength);
static char *
DtPciPathToBuffer (
char *PciPath);
static void
DtCompilePciPath (
UINT8 *Buffer,
char *StringValue,
DT_FIELD *Field,
UINT32 ByteLength);
/******************************************************************************
*
* FUNCTION: DtCompileOneField
*
* PARAMETERS: Buffer - Output buffer
* Field - Field to be compiled
* ByteLength - Byte length of the field
* Type - Field type
*
* RETURN: None
*
* DESCRIPTION: Compile a field value to binary
*
*****************************************************************************/
void
DtCompileOneField (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength,
UINT8 Type,
UINT8 Flags)
{
switch (Type)
{
case DT_FIELD_TYPE_INTEGER:
DtCompileInteger (Buffer, Field, ByteLength, Flags);
break;
case DT_FIELD_TYPE_STRING:
DtCompileString (Buffer, Field, ByteLength);
break;
case DT_FIELD_TYPE_BUFFER:
DtCompileBuffer (Buffer, Field->Value, Field, ByteLength);
break;
case DT_FIELD_TYPE_PCI_PATH:
DtCompilePciPath (Buffer, Field->Value, Field, ByteLength);
break;
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid field type");
break;
}
}
/******************************************************************************
*
* FUNCTION: DtCompileString
*
* PARAMETERS: Buffer - Output buffer
* Field - String to be copied to buffer
* ByteLength - Maximum length of string
*
* RETURN: None
*
* DESCRIPTION: Copy string to the buffer
*
*****************************************************************************/
static void
DtCompileString (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength)
{
UINT32 Length;
Length = ACPI_STRLEN (Field->Value);
/* Check if the string is too long for the field */
if (Length > ByteLength)
{
sprintf (MsgBuffer, "Maximum %u characters", ByteLength);
DtError (ASL_ERROR, ASL_MSG_STRING_LENGTH, Field, MsgBuffer);
Length = ByteLength;
}
/* If input string is shorter than ByteLength, pad with blanks */
ACPI_MEMSET (Buffer, 0x20, ByteLength);
ACPI_MEMCPY (Buffer, Field->Value, Length);
}
/******************************************************************************
*
* FUNCTION: DtCompileInteger
*
* PARAMETERS: Buffer - Output buffer
* Field - Field obj with Integer to be compiled
* ByteLength - Byte length of the integer
*
* RETURN: None
*
* DESCRIPTION: Compile an integer
*
*****************************************************************************/
void
DtCompileInteger (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength,
UINT8 Flags)
{
UINT64 Value = 0;
UINT64 MaxValue;
UINT8 *Hex;
char *Message = NULL;
ACPI_STATUS Status;
int i;
/* Byte length must be in range 1-8 */
if ((ByteLength > 8) || (ByteLength == 0))
{
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field,
"Invalid internal Byte length");
return;
}
/* Convert string to an actual integer */
Status = DtStrtoul64 (Field->Value, &Value);
if (ACPI_FAILURE (Status))
{
if (Status == AE_LIMIT)
{
Message = "Constant larger than 64 bits";
}
else if (Status == AE_BAD_CHARACTER)
{
Message = "Invalid character in constant";
}
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
goto Exit;
}
/* Ensure that reserved fields are set to zero */
/* TBD: should we set to zero, or just make this an ERROR? */
/* TBD: Probably better to use a flag */
if (!ACPI_STRCMP (Field->Name, "Reserved") &&
(Value != 0))
{
DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field,
"Setting to zero");
Value = 0;
}
/* Check if the value must be non-zero */
if ((Value == 0) && (Flags & DT_NON_ZERO))
{
DtError (ASL_ERROR, ASL_MSG_ZERO_VALUE, Field, NULL);
}
/*
* Generate the maximum value for the data type (ByteLength)
* Note: construct chosen for maximum portability
*/
MaxValue = ((UINT64) (-1)) >> (64 - (ByteLength * 8));
/* Validate that the input value is within range of the target */
if (Value > MaxValue)
{
sprintf (MsgBuffer, "Maximum %u bytes", ByteLength);
DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
}
/*
* TBD: hard code for ASF! Capabilites field.
*
* This field is actually a buffer, not a 56-bit integer --
* so, the ordering is reversed. Something should be fixed
* so we don't need this code.
*/
if (ByteLength == 7)
{
Hex = ACPI_CAST_PTR (UINT8, &Value);
for (i = 6; i >= 0; i--)
{
Buffer[i] = *Hex;
Hex++;
}
return;
}
Exit:
ACPI_MEMCPY (Buffer, &Value, ByteLength);
return;
}
/******************************************************************************
*
* FUNCTION: DtPciPathToBuffer
*
* PARAMETERS: PciPath - DMAR "PCI Path" field
*
* RETURN: Strings of PCI path
*
* DESCRIPTION: Remove brackets and comma from DMAR "PCI Path" string, for
* example: [1D, 01] ==> 1D 01
*
*****************************************************************************/
static char *
DtPciPathToBuffer (
char *PciPath)
{
char *Buffer;
Buffer = UtLocalCalloc (6);
Buffer[0] = PciPath[1];
Buffer[1] = PciPath[2];
Buffer[2] = ' ';
Buffer[3] = PciPath[5];
Buffer[4] = PciPath[6];
return (Buffer);
}
/******************************************************************************
*
* FUNCTION: DtCompileBuffer
*
* PARAMETERS: Buffer - Output buffer
* StringValue - Integer list to be compiled
* Field - Current field object
* ByteLength - Byte length of the integer list
*
* RETURN: Count of remaining data in the input list
*
* DESCRIPTION: Compile and pack an integer list, for example
* "AA 1F 20 3B" ==> Buffer[] = {0xAA,0x1F,0x20,0x3B}
*
*****************************************************************************/
UINT32
DtCompileBuffer (
UINT8 *Buffer,
char *StringValue,
DT_FIELD *Field,
UINT32 ByteLength)
{
ACPI_STATUS Status;
char Hex[3];
UINT64 Value;
UINT32 i;
UINT32 Count;
Count = ACPI_STRLEN (StringValue) / 3 + 1;
Hex[2] = 0;
for (i = 0; i < Count; i++)
{
Hex[0] = StringValue[0];
Hex[1] = StringValue[1];
/* Convert one hex byte */
Value = 0;
Status = DtStrtoul64 (Hex, &Value);
if (ACPI_FAILURE (Status))
{
DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer);
return (ByteLength - Count);
}
Buffer[i] = (UINT8) Value;
StringValue += 3;
}
return (ByteLength - Count);
}
/******************************************************************************
*
* FUNCTION: DtCompilePciPath
*
* PARAMETERS: Buffer - Output buffer
* StringValue - DMAR pci path string
* ByteLength - Byte length of DMAR pci path string, 2
*
* RETURN: None
*
* DESCRIPTION: Compile DMAR PCI path string to binary
*
*****************************************************************************/
static void
DtCompilePciPath (
UINT8 *Buffer,
char *StringValue,
DT_FIELD *Field,
UINT32 ByteLength)
{
char *PciPathBuffer;
/* Parse path to simple hex digits, then convert to binary */
PciPathBuffer = DtPciPathToBuffer (StringValue);
DtCompileBuffer (Buffer, PciPathBuffer, Field, ByteLength);
ACPI_FREE (PciPathBuffer);
}
/******************************************************************************
*
* FUNCTION: DtCompileFlag
*
* PARAMETERS: Buffer - Output buffer
* Field - Field to be compiled
* Info - Flag info
* BitPosition - Flag bit position
*
* RETURN: Next flag bit position
*
* DESCRIPTION: Compile a flag
*
*****************************************************************************/
UINT32
DtCompileFlag (
UINT8 *Buffer,
DT_FIELD *Field,
ACPI_DMTABLE_INFO *Info,
UINT32 BitPosition)
{
UINT64 Value = 0;
UINT32 BitLength = 1;
ACPI_STATUS Status;
Status = DtStrtoul64 (Field->Value, &Value);
if (ACPI_FAILURE (Status))
{
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, NULL);
}
switch (Info->Opcode)
{
case ACPI_DMT_FLAG0:
case ACPI_DMT_FLAG1:
case ACPI_DMT_FLAG2:
case ACPI_DMT_FLAG3:
case ACPI_DMT_FLAG4:
case ACPI_DMT_FLAG5:
case ACPI_DMT_FLAG6:
case ACPI_DMT_FLAG7:
BitLength = 1;
break;
case ACPI_DMT_FLAGS0:
case ACPI_DMT_FLAGS2:
BitLength = 2;
break;
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid flag opcode");
break;
}
/* Check range of the input flag value */
if (Value >= ((UINT64) 1 << BitLength))
{
sprintf (MsgBuffer, "Maximum %u bit", BitLength);
DtError (ASL_ERROR, ASL_MSG_FLAG_VALUE, Field, MsgBuffer);
Value = 0;
}
/* Insert the flag, return next flag bit position */
Buffer += ACPI_DIV_8 (BitPosition);
*Buffer |= (UINT8) (Value << ACPI_MOD_8 (BitPosition));
return (BitPosition + BitLength);
}

512
compiler/dtio.c Normal file
View File

@ -0,0 +1,512 @@
/******************************************************************************
*
* Module Name: dtio.c - File I/O support for data table compiler
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, 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.
*
*****************************************************************************/
#define __DTIO_C__
#include "aslcompiler.h"
#include "dtcompiler.h"
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtio")
/******************************************************************************
*
* FUNCTION: DtIsComment
*
* PARAMETERS: Line - Current source code line
*
* RETURN: TRUE if comment, FALSE otherwise
*
* DESCRIPTION: Detect a comment in the source module
*
*****************************************************************************/
/* TBD: Temporary: very simple code to detect comments */
static int
DtIsComment(
char *Line)
{
if (!ACPI_STRNCMP (Line, "/*", 2) ||
!ACPI_STRNCMP (Line, " *", 2))
{
return 1;
}
return 0;
}
/******************************************************************************
*
* FUNCTION: DtTrim
*
* PARAMETERS: String - Current source code line to trim
*
* RETURN: Trimmed line. Must be freed by caller.
*
* DESCRIPTION: Trim left and right spaces
*
*****************************************************************************/
static char *
DtTrim (
char *String)
{
char *Start;
char *End;
char *ReturnString;
ACPI_SIZE Length;
/* Skip lines that start with a space */
if (!ACPI_STRCMP (String, " "))
{
ReturnString = UtLocalCalloc (1);
return (ReturnString);
}
/* Setup pointers to start and end of input string */
Start = String;
End = String + ACPI_STRLEN (String) - 1;
/* Find first non-whitespace character */
while ((Start <= End) && ((*Start == ' ') || (*Start == '\t')))
{
Start++;
}
/* Find last non-space character */
while (End >= Start)
{
if (*End == '\r' || *End == '\n')
{
End--;
continue;
}
if (*End != ' ')
{
break;
}
End--;
}
/* Remove any quotes around the string */
if (*Start == '\"')
{
Start++;
}
if (*End == '\"')
{
End--;
}
/* Create the trimmed return string */
Length = ACPI_PTR_DIFF (End, Start) + 1;
ReturnString = UtLocalCalloc (Length + 1);
if (ACPI_STRLEN (Start))
{
ACPI_STRNCPY (ReturnString, Start, Length);
}
ReturnString[Length] = 0;
return (ReturnString);
}
/******************************************************************************
*
* FUNCTION: DtLinkField
*
* PARAMETERS: Field - New field object to link
*
* RETURN: None
*
* DESCRIPTION: Link one field name and value to the list
*
*****************************************************************************/
static void
DtLinkField (
DT_FIELD *Field)
{
DT_FIELD *Prev;
DT_FIELD *Next;
Prev = Next = Gbl_FieldList;
while (Next)
{
Prev = Next;
Next = Next->Next;
}
if (Prev)
{
Prev->Next = Field;
}
else
{
Gbl_FieldList = Field;
}
}
/******************************************************************************
*
* FUNCTION: DtParseLine
*
* PARAMETERS: LineBuffer - Current source code line
* Line - Current line number in the source
* Offset - Current byte offset of the line
*
* RETURN: None
*
* DESCRIPTION: Parse one source line
*
*****************************************************************************/
static void
DtParseLine (
char *LineBuffer,
UINT32 Line,
UINT32 Offset)
{
char *Start;
char *End;
char *TmpName;
char *TmpValue;
char *Name;
char *Value;
char *Colon;
UINT32 Length;
DT_FIELD *Field;
UINT32 Column;
UINT32 NameColumn;
if (!LineBuffer || DtIsComment (LineBuffer))
{
return;
}
Colon = strchr (LineBuffer, ':');
if (!Colon || *(Colon - 1) != ' ')
{
return;
}
Start = LineBuffer;
End = Colon;
while (Start < Colon)
{
if (*Start == ' ')
{
Start++;
continue;
}
/* Found left bracket, go to the right bracket */
if (*Start == '[')
{
while (Start < Colon && *Start != ']')
{
Start++;
}
if (Start == Colon)
{
MYDEBUG ("ERROR: right bracket reaches colon position\n");
break;
}
Start++;
continue;
}
break;
}
/*
* There are two column values. One for the field name,
* and one for the field value.
*/
Column = ACPI_PTR_DIFF (Colon, LineBuffer) + 3;
NameColumn = ACPI_PTR_DIFF (Start, LineBuffer) + 1;
Length = ACPI_PTR_DIFF (End, Start);
TmpName = UtLocalCalloc (Length + 1);
ACPI_STRNCPY (TmpName, Start, Length);
Name = DtTrim (TmpName);
ACPI_FREE (TmpName);
Start = End = (Colon + 1);
while (*End)
{
/* Found left quotation, go to the right quotation and break */
if (*End == '"')
{
End++;
while (*End && *End != '"')
{
End++;
}
End++;
break;
}
if (*End == '(' ||
*End == '<' ||
*End == '/')
{
break;
}
End++;
}
Length = ACPI_PTR_DIFF (End, Start);
TmpValue = UtLocalCalloc (Length + 1);
ACPI_STRNCPY (TmpValue, Start, Length);
Value = DtTrim (TmpValue);
ACPI_FREE (TmpValue);
if (Name && Value)
{
Field = UtLocalCalloc (sizeof (DT_FIELD));
Field->Name = Name;
Field->Value = Value;
Field->Line = Line;
Field->ByteOffset = Offset;
Field->NameColumn = NameColumn;
Field->Column = Column;
DtLinkField (Field);
}
}
/******************************************************************************
*
* FUNCTION: DtScanFile
*
* PARAMETERS: Handle - Open file handle for the source file
*
* RETURN: Pointer to start of the constructed parse tree.
*
* DESCRIPTION: Scan source file, link all field name and value
* to the global parse tree: Gbl_FieldList
*
*****************************************************************************/
DT_FIELD *
DtScanFile (
FILE *Handle)
{
UINT32 Line = 0;
UINT32 Offset = 0;
/* Get the file size */
Gbl_InputByteCount = DtGetFileSize (Handle);
/* Scan line-by-line */
while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Handle))
{
Line++;
Gbl_CurrentLineNumber++;
DtParseLine (Gbl_CurrentLineBuffer, Line, Offset);
Offset = (UINT32) ftell (Handle);
}
return (Gbl_FieldList);
}
/*
* Output functions
*/
/******************************************************************************
*
* FUNCTION: DtWriteBinary
*
* PARAMETERS: DT_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Write one subtable of a binary ACPI table
*
*****************************************************************************/
static void
DtWriteBinary (
DT_SUBTABLE *Subtable,
void *Context,
void *ReturnValue)
{
FlWriteFile (ASL_FILE_AML_OUTPUT, Subtable->Buffer, Subtable->Length);
}
/******************************************************************************
*
* FUNCTION: DtOutputBinary
*
* PARAMETERS:
*
* RETURN: Status
*
* DESCRIPTION: Write entire binary ACPI table (result of compilation)
*
*****************************************************************************/
void
DtOutputBinary (
DT_SUBTABLE *RootTable)
{
if (!RootTable)
{
return;
}
/* Walk the entire parse tree, emitting the binary data */
DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL);
Gbl_TableLength = DtGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
}

400
compiler/dtsubtable.c Normal file
View File

@ -0,0 +1,400 @@
/******************************************************************************
*
* Module Name: dtsubtable.c - handling of subtables within ACPI tables
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, 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.
*
*****************************************************************************/
#define __DTSUBTABLE_C__
#include "aslcompiler.h"
#include "dtcompiler.h"
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtsubtable")
/******************************************************************************
*
* FUNCTION: DtCreateSubtable
*
* PARAMETERS: Buffer - Input buffer
* Length - Buffer length
* RetSubtable - Returned newly created subtable
*
* RETURN: None
*
* DESCRIPTION: Create a subtable that is not listed with ACPI_DMTABLE_INFO
* For example, FACS has 24 bytes reserved at the end
* and it's not listed at AcpiDmTableInfoFacs
*
*****************************************************************************/
void
DtCreateSubtable (
UINT8 *Buffer,
UINT32 Length,
DT_SUBTABLE **RetSubtable)
{
DT_SUBTABLE *Subtable;
Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
/* Create a new buffer for the subtable data */
Subtable->Buffer = UtLocalCalloc (Length);
ACPI_MEMCPY (Subtable->Buffer, Buffer, Length);
Subtable->Length = Length;
Subtable->TotalLength = Length;
*RetSubtable = Subtable;
}
/******************************************************************************
*
* FUNCTION: DtInsertSubtable
*
* PARAMETERS: ParentTable - The Parent of the new subtable
* Subtable - The new subtable to insert
*
* RETURN: None
*
* DESCRIPTION: Insert the new subtable to the parent table
*
*****************************************************************************/
void
DtInsertSubtable (
DT_SUBTABLE *ParentTable,
DT_SUBTABLE *Subtable)
{
DT_SUBTABLE *ChildTable;
Subtable->Peer = NULL;
Subtable->Parent = ParentTable;
/* Link the new entry into the child list */
if (!ParentTable->Child)
{
ParentTable->Child = Subtable;
}
else
{
/* Walk to the end of the child list */
ChildTable = ParentTable->Child;
while (ChildTable->Peer)
{
ChildTable = ChildTable->Peer;
}
/* Add new subtable at the end of the child list */
ChildTable->Peer = Subtable;
}
}
/******************************************************************************
*
* FUNCTION: DtPushSubtable
*
* PARAMETERS: Subtable - Subtable to push
*
* RETURN: None
*
* DESCRIPTION: Push a subtable onto a subtable stack
*
*****************************************************************************/
void
DtPushSubtable (
DT_SUBTABLE *Subtable)
{
Subtable->StackTop = Gbl_SubtableStack;
Gbl_SubtableStack = Subtable;
}
/******************************************************************************
*
* FUNCTION: DtPopSubtable
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Pop a subtable from a subtable stack. Uses global SubtableStack
*
*****************************************************************************/
void
DtPopSubtable (
void)
{
DT_SUBTABLE *Subtable;
Subtable = Gbl_SubtableStack;
if (Subtable)
{
Gbl_SubtableStack = Subtable->StackTop;
}
}
/******************************************************************************
*
* FUNCTION: DtPeekSubtable
*
* PARAMETERS: None
*
* RETURN: The subtable on top of stack
*
* DESCRIPTION: Get the subtable on top of stack
*
*****************************************************************************/
DT_SUBTABLE *
DtPeekSubtable (
void)
{
return (Gbl_SubtableStack);
}
/******************************************************************************
*
* FUNCTION: DtGetNextSubtable
*
* PARAMETERS: ParentTable - Parent table whose children we are
* getting
* ChildTable - Previous child that was found.
* The NEXT child will be returned
*
* RETURN: Pointer to the NEXT child or NULL if none is found.
*
* DESCRIPTION: Return the next peer subtable within the tree.
*
*****************************************************************************/
DT_SUBTABLE *
DtGetNextSubtable (
DT_SUBTABLE *ParentTable,
DT_SUBTABLE *ChildTable)
{
ACPI_FUNCTION_ENTRY ();
if (!ChildTable)
{
/* It's really the parent's _scope_ that we want */
return (ParentTable->Child);
}
/* Otherwise just return the next peer (NULL if at end-of-list) */
return (ChildTable->Peer);
}
/******************************************************************************
*
* FUNCTION: DtGetParentSubtable
*
* PARAMETERS: Subtable - Current subtable
*
* RETURN: Parent of the given subtable
*
* DESCRIPTION: Get the parent of the given subtable in the tree
*
*****************************************************************************/
DT_SUBTABLE *
DtGetParentSubtable (
DT_SUBTABLE *Subtable)
{
if (!Subtable)
{
return (NULL);
}
return (Subtable->Parent);
}
/******************************************************************************
*
* FUNCTION: DtGetSubtableLength
*
* PARAMETERS: Field - Current field list pointer
* Info - Data table info
*
* RETURN: Subtable length
*
* DESCRIPTION: Get length of bytes needed to compile the subtable
*
*****************************************************************************/
UINT32
DtGetSubtableLength (
DT_FIELD *Field,
ACPI_DMTABLE_INFO *Info)
{
UINT32 ByteLength = 0;
/* Walk entire Info table; Null name terminates */
for (; Info->Name; Info++)
{
ByteLength += DtGetFieldLength (Field, Info);
}
return (ByteLength);
}
/******************************************************************************
*
* FUNCTION: DtSetSubtableLength
*
* PARAMETERS: Subtable - Subtable
*
* RETURN: None
*
* DESCRIPTION: Set length of the subtable into its length field
*
*****************************************************************************/
void
DtSetSubtableLength (
DT_SUBTABLE *Subtable)
{
if (!Subtable->LengthField)
{
return;
}
ACPI_MEMCPY (Subtable->LengthField, &Subtable->TotalLength,
Subtable->SizeOfLengthField);
}

1399
compiler/dttable.c Normal file

File diff suppressed because it is too large Load Diff

894
compiler/dtutils.c Normal file
View File

@ -0,0 +1,894 @@
/******************************************************************************
*
* Module Name: dtutils.c - Utility routines for the data table compiler
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, 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.
*
*****************************************************************************/
#define __DTUTILS_C__
#include "aslcompiler.h"
#include "dtcompiler.h"
#include "actables.h"
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtutils")
/* Local prototypes */
static void
DtSum (
DT_SUBTABLE *Subtable,
void *Context,
void *ReturnValue);
/******************************************************************************
*
* FUNCTION: DtError
*
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
* MessageId - Index into global message buffer
* Op - Parse node where error happened
* ExtraMessage - additional error message
*
* RETURN: None
*
* DESCRIPTION: Common error interface for data table compiler
*
*****************************************************************************/
void
DtError (
UINT8 Level,
UINT8 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage)
{
switch (Level)
{
case ASL_WARNING2:
case ASL_WARNING3:
if (Gbl_WarningLevel < Level)
{
return;
}
break;
default:
break;
}
if (FieldObject)
{
AslCommonError (Level, MessageId,
FieldObject->Line,
FieldObject->Line,
FieldObject->ByteOffset,
FieldObject->Column,
Gbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage);
}
else
{
AslCommonError (Level, MessageId, 0,
0, 0, 0, 0, ExtraMessage);
}
}
/******************************************************************************
*
* FUNCTION: DtNameError
*
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
* MessageId - Index into global message buffer
* Op - Parse node where error happened
* ExtraMessage - additional error message
*
* RETURN: None
*
* DESCRIPTION: Error interface for named objects
*
*****************************************************************************/
void
DtNameError (
UINT8 Level,
UINT8 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage)
{
switch (Level)
{
case ASL_WARNING2:
case ASL_WARNING3:
if (Gbl_WarningLevel < Level)
{
return;
}
break;
default:
break;
}
if (FieldObject)
{
AslCommonError (Level, MessageId,
FieldObject->Line,
FieldObject->Line,
FieldObject->ByteOffset,
FieldObject->NameColumn,
Gbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage);
}
else
{
AslCommonError (Level, MessageId, 0,
0, 0, 0, 0, ExtraMessage);
}
}
/*******************************************************************************
*
* FUNCTION: DtFatal
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Dump the error log and abort the compiler. Used for serious
* compile or I/O errors
*
******************************************************************************/
void
DtFatal (
UINT8 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage)
{
DtError (ASL_ERROR, MessageId, FieldObject, ExtraMessage);
CmCleanupAndExit ();
exit (1);
}
/******************************************************************************
*
* FUNCTION: DtStrtoul64
*
* PARAMETERS: String - Null terminated string
* ReturnInteger - Where the converted integer is returned
*
* RETURN: Status
*
* DESCRIPTION: Simple conversion of a string hex integer constant to unsigned
* value. Assumes no leading "0x" for the constant.
*
* Portability note: The reason this function exists is because a 64-bit
* sscanf is not available in all environments.
*
*****************************************************************************/
ACPI_STATUS
DtStrtoul64 (
char *String,
UINT64 *ReturnInteger)
{
char *ThisChar = String;
UINT32 ThisDigit;
UINT64 ReturnValue = 0;
int DigitCount = 0;
/* Skip over any white space in the buffer */
while ((*ThisChar == ' ') || (*ThisChar == '\t'))
{
ThisChar++;
}
/* Skip leading zeros */
while ((*ThisChar) == '0')
{
ThisChar++;
}
/* Convert character-by-character */
while (*ThisChar)
{
if (ACPI_IS_DIGIT (*ThisChar))
{
/* Convert ASCII 0-9 to Decimal value */
ThisDigit = ((UINT8) *ThisChar) - '0';
}
else /* Letter */
{
ThisDigit = (UINT32) ACPI_TOUPPER (*ThisChar);
if (!ACPI_IS_XDIGIT ((char) ThisDigit))
{
/* Not A-F */
return (AE_BAD_CHARACTER);
}
/* Convert ASCII Hex char (A-F) to value */
ThisDigit = (ThisDigit - 'A') + 10;
}
/* Insert the 4-bit hex digit */
ReturnValue <<= 4;
ReturnValue += ThisDigit;
ThisChar++;
DigitCount++;
if (DigitCount > 16)
{
/* Value is too large (> 64 bits/8 bytes/16 hex digits) */
return (AE_LIMIT);
}
}
*ReturnInteger = ReturnValue;
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: DtGetFileSize
*
* PARAMETERS: Handle - Open file handler
*
* RETURN: Current file size
*
* DESCRIPTION: Get the current size of a file. Seek to the EOF and get the
* offset. Seek back to the original location.
*
*****************************************************************************/
UINT32
DtGetFileSize (
FILE *Handle)
{
int CurrentOffset;
int LastOffset;
CurrentOffset = ftell (Handle);
fseek (Handle, 0, SEEK_END);
LastOffset = ftell (Handle);
fseek (Handle, CurrentOffset, SEEK_SET);
return ((UINT32) LastOffset);
}
/******************************************************************************
*
* FUNCTION: DtGetFieldValue
*
* PARAMETERS: Field - Current field list pointer
* Name - Field name
*
* RETURN: Field value
*
* DESCRIPTION: Get field value
*
*****************************************************************************/
char *
DtGetFieldValue (
DT_FIELD *Field,
char *Name)
{
/* Search the field list for the name */
while (Field)
{
if (!ACPI_STRCMP (Name, Field->Name))
{
return (Field->Value);
}
Field = Field->Next;
}
return (NULL);
}
/******************************************************************************
*
* FUNCTION: DtGetFieldType
*
* PARAMETERS: Info - Data table info
*
* RETURN: Field type
*
* DESCRIPTION: Get field type
*
*****************************************************************************/
UINT8
DtGetFieldType (
ACPI_DMTABLE_INFO *Info)
{
UINT8 Type;
/* DT_FLAG means that this is the start of a block of flag bits */
/* TBD - we can make these a separate opcode later */
if (Info->Flags & DT_FLAG)
{
return (DT_FIELD_TYPE_FLAGS_INTEGER);
}
/* Type is based upon the opcode for this field in the info table */
switch (Info->Opcode)
{
case ACPI_DMT_FLAG0:
case ACPI_DMT_FLAG1:
case ACPI_DMT_FLAG2:
case ACPI_DMT_FLAG3:
case ACPI_DMT_FLAG4:
case ACPI_DMT_FLAG5:
case ACPI_DMT_FLAG6:
case ACPI_DMT_FLAG7:
case ACPI_DMT_FLAGS0:
case ACPI_DMT_FLAGS2:
Type = DT_FIELD_TYPE_FLAG;
break;
case ACPI_DMT_NAME4:
case ACPI_DMT_SIG:
case ACPI_DMT_NAME6:
case ACPI_DMT_NAME8:
case ACPI_DMT_STRING:
Type = DT_FIELD_TYPE_STRING;
break;
case ACPI_DMT_BUFFER:
case ACPI_DMT_BUF16:
Type = DT_FIELD_TYPE_BUFFER;
break;
case ACPI_DMT_PCI_PATH:
Type = DT_FIELD_TYPE_PCI_PATH;
break;
case ACPI_DMT_GAS:
case ACPI_DMT_HESTNTFY:
Type = DT_FIELD_TYPE_INLINE_SUBTABLE;
break;
default:
Type = DT_FIELD_TYPE_INTEGER;
break;
}
return (Type);
}
/******************************************************************************
*
* FUNCTION: DtGetBufferLength
*
* PARAMETERS: Buffer - List of integers,
* for example "10 3A 4F 2E"
*
* RETURN: Count of integer
*
* DESCRIPTION: Get length of bytes needed to store the integers
*
*****************************************************************************/
UINT32
DtGetBufferLength (
char *Buffer)
{
UINT32 ByteLength = 0;
while (*Buffer)
{
if (*Buffer == ' ')
{
ByteLength++;
while (*Buffer == ' ')
{
Buffer++;
}
}
Buffer++;
}
return (++ByteLength);
}
/******************************************************************************
*
* FUNCTION: DtGetFieldLength
*
* PARAMETERS: Field - Current field list pointer
* Info - Data table info
*
* RETURN: Field length
*
* DESCRIPTION: Get length of bytes needed to compile the field
*
*****************************************************************************/
UINT32
DtGetFieldLength (
DT_FIELD *Field,
ACPI_DMTABLE_INFO *Info)
{
UINT32 ByteLength = 0;
char *Value;
/* Length is based upon the opcode for this field in the info table */
switch (Info->Opcode)
{
case ACPI_DMT_FLAG0:
case ACPI_DMT_FLAG1:
case ACPI_DMT_FLAG2:
case ACPI_DMT_FLAG3:
case ACPI_DMT_FLAG4:
case ACPI_DMT_FLAG5:
case ACPI_DMT_FLAG6:
case ACPI_DMT_FLAG7:
case ACPI_DMT_FLAGS0:
case ACPI_DMT_FLAGS2:
ByteLength = 0;
break;
case ACPI_DMT_UINT8:
case ACPI_DMT_CHKSUM:
case ACPI_DMT_SPACEID:
case ACPI_DMT_MADT:
case ACPI_DMT_SRAT:
case ACPI_DMT_ASF:
case ACPI_DMT_HESTNTYP:
case ACPI_DMT_FADTPM:
case ACPI_DMT_IVRS:
ByteLength = 1;
break;
case ACPI_DMT_UINT16:
case ACPI_DMT_DMAR:
case ACPI_DMT_HEST:
case ACPI_DMT_PCI_PATH:
ByteLength = 2;
break;
case ACPI_DMT_UINT24:
ByteLength = 3;
break;
case ACPI_DMT_UINT32:
case ACPI_DMT_NAME4:
case ACPI_DMT_SIG:
ByteLength = 4;
break;
case ACPI_DMT_NAME6:
ByteLength = 6;
break;
case ACPI_DMT_UINT56:
ByteLength = 7;
break;
case ACPI_DMT_UINT64:
case ACPI_DMT_NAME8:
ByteLength = 8;
break;
case ACPI_DMT_STRING:
Value = DtGetFieldValue (Field, Info->Name);
/* TBD: error if Value is NULL? (as below?) */
ByteLength = ACPI_STRLEN (Value) + 1;
break;
case ACPI_DMT_GAS:
ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
break;
case ACPI_DMT_HESTNTFY:
ByteLength = sizeof (ACPI_HEST_NOTIFY);
break;
case ACPI_DMT_BUFFER:
Value = DtGetFieldValue (Field, Info->Name);
if (Value)
{
ByteLength = DtGetBufferLength (Value);
}
else
{ /* At this point, this is a fatal error */
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
}
break;
case ACPI_DMT_BUF16:
ByteLength = 16;
break;
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid table opcode");
break;
}
return (ByteLength);
}
/******************************************************************************
*
* FUNCTION: DtSum
*
* PARAMETERS: DT_WALK_CALLBACK:
* Subtable - Subtable
* Context - Unused
* ReturnValue - Store the checksum of subtable
*
* RETURN: Status
*
* DESCRIPTION: Get the checksum of subtable
*
*****************************************************************************/
static void
DtSum (
DT_SUBTABLE *Subtable,
void *Context,
void *ReturnValue)
{
UINT8 Checksum;
UINT8 *Sum = ReturnValue;
Checksum = AcpiTbChecksum (Subtable->Buffer, Subtable->Length);
*Sum = (UINT8) (*Sum + Checksum);
}
/******************************************************************************
*
* FUNCTION: DtSetTableChecksum
*
* PARAMETERS: ChecksumPointer - Where to return the checksum
*
* RETURN: None
*
* DESCRIPTION: Set checksum of the whole data table into the checksum field
*
*****************************************************************************/
void
DtSetTableChecksum (
UINT8 *ChecksumPointer)
{
UINT8 Checksum = 0;
UINT8 OldSum;
DtWalkTableTree (Gbl_RootTable, DtSum, NULL, &Checksum);
OldSum = *ChecksumPointer;
Checksum = (UINT8) (Checksum - OldSum);
/* Compute the final checksum */
Checksum = (UINT8) (0 - Checksum);
*ChecksumPointer = Checksum;
}
/******************************************************************************
*
* FUNCTION: DtSetTableLength
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Walk the subtables and set all the length fields
*
*****************************************************************************/
void
DtSetTableLength (
void)
{
DT_SUBTABLE *ParentTable;
DT_SUBTABLE *ChildTable;
ParentTable = Gbl_RootTable;
ChildTable = NULL;
if (!ParentTable)
{
return;
}
DtSetSubtableLength (ParentTable);
while (1)
{
ChildTable = DtGetNextSubtable (ParentTable, ChildTable);
if (ChildTable)
{
if (ChildTable->Child)
{
ParentTable = ChildTable;
ChildTable = NULL;
}
else
{
ParentTable->TotalLength += ChildTable->TotalLength;
if (ParentTable->LengthField)
{
DtSetSubtableLength (ParentTable);
}
}
}
else
{
ChildTable = ParentTable;
if (ChildTable == Gbl_RootTable)
{
break;
}
ParentTable = DtGetParentSubtable (ParentTable);
ParentTable->TotalLength += ChildTable->TotalLength;
if (ParentTable->LengthField)
{
DtSetSubtableLength (ParentTable);
}
}
}
}
/******************************************************************************
*
* FUNCTION: DtWalkTableTree
*
* PARAMETERS: StartTable - Subtable in the tree where walking begins
* UserFunction - Called during the walk
* Context - Passed to user function
* ReturnValue - The return value of UserFunction
*
* RETURN: None
*
* DESCRIPTION: Performs a depth-first walk of the subtable tree
*
*****************************************************************************/
void
DtWalkTableTree (
DT_SUBTABLE *StartTable,
DT_WALK_CALLBACK UserFunction,
void *Context,
void *ReturnValue)
{
DT_SUBTABLE *ParentTable;
DT_SUBTABLE *ChildTable;
ParentTable = StartTable;
ChildTable = NULL;
if (!ParentTable)
{
return;
}
UserFunction (ParentTable, Context, ReturnValue);
while (1)
{
ChildTable = DtGetNextSubtable (ParentTable, ChildTable);
if (ChildTable)
{
UserFunction (ChildTable, Context, ReturnValue);
if (ChildTable->Child)
{
ParentTable = ChildTable;
ChildTable = NULL;
}
}
else
{
ChildTable = ParentTable;
if (ChildTable == Gbl_RootTable)
{
break;
}
ParentTable = DtGetParentSubtable (ParentTable);
if (ChildTable->Peer == StartTable)
{
break;
}
}
}
}
/******************************************************************************
*
* FUNCTION: DtFreeFieldList
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Free the field list
*
*****************************************************************************/
void
DtFreeFieldList (
void)
{
DT_FIELD *Field = Gbl_FieldList;
DT_FIELD *NextField;
/* Walk and free entire field list */
while (Field)
{
NextField = Field->Next; /* Save link */
if (!(Field->Flags & DT_FIELD_NOT_ALLOCATED))
{
ACPI_FREE (Field->Name);
ACPI_FREE (Field->Value);
}
ACPI_FREE (Field);
Field = NextField;
}
}

View File

@ -477,7 +477,7 @@ AcpiDbCheckPredefinedNames (
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count);
AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count);
}
@ -619,7 +619,7 @@ AcpiDbBatchExecute (
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Info.Count);
AcpiOsPrintf ("Executed %u predefined names in the namespace\n", Info.Count);
}
@ -678,7 +678,7 @@ AcpiDbDisplayTableInfo (
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
TableDesc = &AcpiGbl_RootTableList.Tables[i];
AcpiOsPrintf ("%d ", i);
AcpiOsPrintf ("%u ", i);
/* Make sure that the table is mapped */
@ -1178,7 +1178,7 @@ AcpiDbSetMethodData (
if (Index > ACPI_METHOD_MAX_ARG)
{
AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index);
AcpiOsPrintf ("Arg%u - Invalid argument name\n", Index);
goto Cleanup;
}
@ -1191,7 +1191,7 @@ AcpiDbSetMethodData (
ObjDesc = WalkState->Arguments[Index].Object;
AcpiOsPrintf ("Arg%d: ", Index);
AcpiOsPrintf ("Arg%u: ", Index);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
break;
@ -1201,7 +1201,7 @@ AcpiDbSetMethodData (
if (Index > ACPI_METHOD_MAX_LOCAL)
{
AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index);
AcpiOsPrintf ("Local%u - Invalid local variable name\n", Index);
goto Cleanup;
}
@ -1214,7 +1214,7 @@ AcpiDbSetMethodData (
ObjDesc = WalkState->LocalVariables[Index].Object;
AcpiOsPrintf ("Local%d: ", Index);
AcpiOsPrintf ("Local%u: ", Index);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
break;
@ -1938,7 +1938,7 @@ AcpiDbCheckIntegrity (
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n",
AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
Info.Nodes, Info.Objects);
}

View File

@ -612,7 +612,7 @@ AcpiDbDisplayResults (
for (i = 0; i < ResultCount; i++)
{
ObjDesc = Frame->Results.ObjDesc[Index];
AcpiOsPrintf ("Result%d: ", i);
AcpiOsPrintf ("Result%u: ", i);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
if (Index == 0)
{
@ -722,7 +722,7 @@ AcpiDbDisplayObjectType (
{
for (i = 0; i < Info->CompatibleIdList.Count; i++)
{
AcpiOsPrintf ("CID %d: %s\n", i,
AcpiOsPrintf ("CID %u: %s\n", i,
Info->CompatibleIdList.Ids[i].String);
}
}
@ -854,7 +854,7 @@ AcpiDbDisplayGpes (
GpeType = "GPE Block Device";
}
AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s] - %s\n",
AcpiOsPrintf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n",
Block, GpeBlock, GpeBlock->Node, Buffer, GpeType);
AcpiOsPrintf (" Registers: %u (%u GPEs)\n",

View File

@ -602,7 +602,7 @@ AcpiDbMethodThread (
#if 0
if ((i % 100) == 0)
{
AcpiOsPrintf ("%d executions, Thread 0x%x\n", i, AcpiOsGetThreadId ());
AcpiOsPrintf ("%u executions, Thread 0x%x\n", i, AcpiOsGetThreadId ());
}
if (ReturnObj.Length)

View File

@ -289,7 +289,7 @@ AcpiDbCheckTextModeCorruption (
* meaning that we cannot simply replace CR/LF pairs with LFs.
*/
AcpiOsPrintf ("Table has been corrupted by text mode conversion\n");
AcpiOsPrintf ("All LFs (%d) were changed to CR/LF pairs\n", Pairs);
AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs);
AcpiOsPrintf ("Table cannot be repaired!\n");
return (AE_BAD_VALUE);
}

View File

@ -284,7 +284,7 @@ AcpiDbGetFromHistory (
}
}
AcpiOsPrintf ("Invalid history number: %d\n", HistoryIndex);
AcpiOsPrintf ("Invalid history number: %u\n", HistoryIndex);
return (NULL);
}

View File

@ -613,7 +613,7 @@ AcpiDbCommandDispatch (
if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
{
AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n",
AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n",
ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
AcpiGbl_DbCommands[CommandIndex].MinArgs);

View File

@ -291,7 +291,7 @@ AcpiDbDumpExternalObject (
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("[Package] Contains %d Elements:\n",
AcpiOsPrintf ("[Package] Contains %u Elements:\n",
ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)

View File

@ -289,7 +289,7 @@ AcpiDmDecodeInternalObject (
case ACPI_TYPE_STRING:
AcpiOsPrintf ("(%d) \"%.24s",
AcpiOsPrintf ("(%u) \"%.24s",
ObjDesc->String.Length, ObjDesc->String.Pointer);
if (ObjDesc->String.Length > 24)
@ -305,7 +305,7 @@ AcpiDmDecodeInternalObject (
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length);
AcpiOsPrintf ("(%u)", ObjDesc->Buffer.Length);
for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
{
AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
@ -651,7 +651,7 @@ AcpiDmDisplayArguments (
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
{
ObjDesc = WalkState->Arguments[i].Object;
AcpiOsPrintf (" Arg%d: ", i);
AcpiOsPrintf (" Arg%u: ", i);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
}
}

View File

@ -163,7 +163,7 @@ AcpiDmMethodFlags (
/* 1) Method argument count */
AcpiOsPrintf (", %d, ", Args);
AcpiOsPrintf (", %u, ", Args);
/* 2) Serialize rule */
@ -178,7 +178,7 @@ AcpiDmMethodFlags (
if (Flags & 0xF0)
{
AcpiOsPrintf (", %d", Flags >> 4);
AcpiOsPrintf (", %u", Flags >> 4);
}
}
@ -550,7 +550,7 @@ AcpiDmDisassembleOneOp (
case AML_INT_NAMEDFIELD_OP:
Length = AcpiDmDumpName (Op->Named.Name);
AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ",
AcpiOsPrintf (",%*.s %u", (unsigned) (5 - Length), " ",
(UINT32) Op->Common.Value.Integer);
AcpiDmCommaIfFieldMember (Op);
@ -571,7 +571,7 @@ AcpiDmDisassembleOneOp (
}
else
{
AcpiOsPrintf (" , %d", Offset);
AcpiOsPrintf (" , %u", Offset);
}
AcpiDmCommaIfFieldMember (Op);

View File

@ -290,7 +290,7 @@ AcpiDmBitList (
AcpiOsPrintf (",");
}
Previous = TRUE;
AcpiOsPrintf ("%d", i);
AcpiOsPrintf ("%u", i);
}
Mask >>= 1;

View File

@ -263,12 +263,12 @@ AcpiDsInitializeObjects (
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
Info.MethodCount = 0;
Info.OpRegionCount = 0;
Info.ObjectCount = 0;
Info.DeviceCount = 0;
Info.TableIndex = TableIndex;
Info.OwnerId = OwnerId;
/* Set all init info to zero */
ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
Info.OwnerId = OwnerId;
Info.TableIndex = TableIndex;
/* Walk entire namespace from the supplied root */
@ -297,12 +297,12 @@ AcpiDsInitializeObjects (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
"\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n",
Table->Signature, OwnerId, Info.ObjectCount,
Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Methods, %hd Regions\n", Info.MethodCount, Info.OpRegionCount));
"%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount));
return_ACPI_STATUS (AE_OK);
}

View File

@ -700,7 +700,18 @@ AcpiDsTerminateControlMethod (
*/
if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL))
{
AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
/* Delete any direct children of (created by) this method */
AcpiNsDeleteNamespaceSubtree (WalkState->MethodNode);
/*
* Delete any objects that were created by this method
* elsewhere in the namespace (if any were created).
*/
if (MethodDesc->Method.Flags & AOPOBJ_MODIFIED_NAMESPACE)
{
AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
}
}
}
@ -725,7 +736,7 @@ AcpiDsTerminateControlMethod (
* we immediately reuse it for the next thread executing this method
*/
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"*** Completed execution of one thread, %d threads remaining\n",
"*** Completed execution of one thread, %u threads remaining\n",
MethodDesc->Method.ThreadCount));
}
else

View File

@ -188,8 +188,7 @@ AcpiDsMethodDataInit (
WalkState->Arguments[i].Name.Integer |= (i << 24);
WalkState->Arguments[i].DescriptorType = ACPI_DESC_TYPE_NAMED;
WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
WalkState->Arguments[i].Flags =
ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
WalkState->Arguments[i].Flags = ANOBJ_METHOD_ARG;
}
/* Init the method locals */
@ -201,8 +200,7 @@ AcpiDsMethodDataInit (
WalkState->LocalVariables[i].Name.Integer |= (i << 24);
WalkState->LocalVariables[i].DescriptorType = ACPI_DESC_TYPE_NAMED;
WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
WalkState->LocalVariables[i].Flags =
ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
WalkState->LocalVariables[i].Flags = ANOBJ_METHOD_LOCAL;
}
return_VOID;
@ -238,7 +236,7 @@ AcpiDsMethodDataDeleteAll (
{
if (WalkState->LocalVariables[Index].Object)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%u=%p\n",
Index, WalkState->LocalVariables[Index].Object));
/* Detach object (if present) and remove a reference */
@ -253,7 +251,7 @@ AcpiDsMethodDataDeleteAll (
{
if (WalkState->Arguments[Index].Object)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%u=%p\n",
Index, WalkState->Arguments[Index].Object));
/* Detach object (if present) and remove a reference */
@ -322,7 +320,7 @@ AcpiDsMethodDataInitArgs (
Index++;
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", Index));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%u args passed to method\n", Index));
return_ACPI_STATUS (AE_OK);
}
@ -429,7 +427,7 @@ AcpiDsMethodDataSetValue (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"NewObj %p Type %2.2X, Refs=%d [%s]\n", Object,
"NewObj %p Type %2.2X, Refs=%u [%s]\n", Object,
Type, Object->Common.ReferenceCount,
AcpiUtGetTypeName (Object->Common.Type)));
@ -667,7 +665,7 @@ AcpiDsStoreObjectToLocal (
ACPI_FUNCTION_TRACE (DsStoreObjectToLocal);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%u Obj=%p\n",
Type, Index, ObjDesc));
/* Parameter validation */

View File

@ -307,7 +307,7 @@ AcpiDsGetBufferFieldArguments (
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
Status = AcpiDsExecuteArguments (Node, Node->Parent,
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
@ -354,7 +354,7 @@ AcpiDsGetBankFieldArguments (
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
Status = AcpiDsExecuteArguments (Node, Node->Parent,
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
@ -505,7 +505,7 @@ AcpiDsGetRegionArguments (
/* Execute the argument AML */
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
Status = AcpiDsExecuteArguments (Node, Node->Parent,
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}

View File

@ -875,7 +875,7 @@ AcpiDsCreateOperands (
Index--;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%u (%p) done, Arg1=%p\n",
Index, Arg, FirstArg));
}
@ -890,7 +890,7 @@ AcpiDsCreateOperands (
*/
AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index));
ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %u", Index));
return_ACPI_STATUS (Status);
}

View File

@ -114,7 +114,6 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"

View File

@ -294,7 +294,7 @@ AcpiEvPciConfigRegionSetup (
return_ACPI_STATUS (Status);
}
ParentNode = AcpiNsGetParentNode (RegionObj->Region.Node);
ParentNode = RegionObj->Region.Node->Parent;
/*
* Get the _SEG and _BBN values from the device upon which the handler
@ -348,7 +348,7 @@ AcpiEvPciConfigRegionSetup (
break;
}
PciRootNode = AcpiNsGetParentNode (PciRootNode);
PciRootNode = PciRootNode->Parent;
}
/* PCI root bridge not found, use namespace root node */
@ -385,7 +385,7 @@ AcpiEvPciConfigRegionSetup (
PciDeviceNode = RegionObj->Region.Node;
while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE))
{
PciDeviceNode = AcpiNsGetParentNode (PciDeviceNode);
PciDeviceNode = PciDeviceNode->Parent;
}
if (!PciDeviceNode)
@ -661,7 +661,7 @@ AcpiEvInitializeRegion (
return_ACPI_STATUS (AE_NOT_EXIST);
}
Node = AcpiNsGetParentNode (RegionObj->Region.Node);
Node = RegionObj->Region.Node->Parent;
SpaceId = RegionObj->Region.SpaceId;
/* Setup defaults */
@ -785,7 +785,7 @@ AcpiEvInitializeRegion (
/* This node does not have the handler we need; Pop up one level */
Node = AcpiNsGetParentNode (Node);
Node = Node->Parent;
}
/* If we get here, there is no handler for this region */

View File

@ -864,7 +864,7 @@ AcpiExDumpOperands (
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"**** Start operand dump for opcode [%s], %d operands\n",
"**** Start operand dump for opcode [%s], %u operands\n",
OpcodeName, NumOperands));
if (NumOperands == 0)
@ -948,7 +948,7 @@ AcpiExDumpNamespaceNode (
AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
AcpiExOutPointer ("Parent", Node->Parent);
AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
AcpiExDumpNode);
@ -1096,7 +1096,7 @@ AcpiExDumpPackageObj (
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("[Package] Contains %d Elements:\n",
AcpiOsPrintf ("[Package] Contains %u Elements:\n",
ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)

View File

@ -202,8 +202,8 @@ AcpiExSetupRegion (
}
/*
* Exit now for SMBus or IPMI address space, it has a non-linear address space
* and the request cannot be directly validated
* Exit now for SMBus or IPMI address space, it has a non-linear
* address space and the request cannot be directly validated
*/
if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI)
@ -233,8 +233,7 @@ AcpiExSetupRegion (
* (Region length is specified in bytes)
*/
if (RgnDesc->Region.Length <
(ObjDesc->CommonField.BaseByteOffset +
FieldDatumByteOffset +
(ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset +
ObjDesc->CommonField.AccessByteWidth))
{
if (AcpiGbl_EnableInterpreterSlack)
@ -644,14 +643,14 @@ AcpiExFieldDatumIo (
if (ReadWrite == ACPI_READ)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Value Read %8.8X%8.8X, Width %d\n",
"Value Read %8.8X%8.8X, Width %u\n",
ACPI_FORMAT_UINT64 (*Value),
ObjDesc->CommonField.AccessByteWidth));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Value Written %8.8X%8.8X, Width %d\n",
"Value Written %8.8X%8.8X, Width %u\n",
ACPI_FORMAT_UINT64 (*Value),
ObjDesc->CommonField.AccessByteWidth));
}
@ -794,6 +793,7 @@ AcpiExExtractFromField (
UINT32 BufferTailBits;
UINT32 DatumCount;
UINT32 FieldDatumCount;
UINT32 AccessBitWidth;
UINT32 i;
@ -803,7 +803,7 @@ AcpiExExtractFromField (
/* Validate target buffer and clear it */
if (BufferLength <
ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
{
ACPI_ERROR ((AE_INFO,
"Field size %u (bits) is too large for buffer (%u)",
@ -811,17 +811,37 @@ AcpiExExtractFromField (
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
ACPI_MEMSET (Buffer, 0, BufferLength);
AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
/* Handle the simple case here */
if ((ObjDesc->CommonField.StartFieldBitOffset == 0) &&
(ObjDesc->CommonField.BitLength == AccessBitWidth))
{
Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ);
return_ACPI_STATUS (Status);
}
/* TBD: Move to common setup code */
/* Field algorithm is limited to sizeof(UINT64), truncate if needed */
if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64))
{
ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64);
AccessBitWidth = sizeof (UINT64) * 8;
}
/* Compute the number of datums (access width data items) */
DatumCount = ACPI_ROUND_UP_TO (
ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.AccessBitWidth);
ObjDesc->CommonField.BitLength, AccessBitWidth);
FieldDatumCount = ACPI_ROUND_UP_TO (
ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.AccessBitWidth);
ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset, AccessBitWidth);
/* Priming read from the field */
@ -854,12 +874,11 @@ AcpiExExtractFromField (
* This avoids the differences in behavior between different compilers
* concerning shift values larger than the target data width.
*/
if ((ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
if (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset <
ACPI_INTEGER_BIT_SIZE)
{
MergedDatum |= RawDatum <<
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
(AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
}
if (i == DatumCount)
@ -879,8 +898,7 @@ AcpiExExtractFromField (
/* Mask off any extra bits in the last datum */
BufferTailBits = ObjDesc->CommonField.BitLength %
ObjDesc->CommonField.AccessBitWidth;
BufferTailBits = ObjDesc->CommonField.BitLength % AccessBitWidth;
if (BufferTailBits)
{
MergedDatum &= ACPI_MASK_BITS_ABOVE (BufferTailBits);
@ -916,6 +934,7 @@ AcpiExInsertIntoField (
void *Buffer,
UINT32 BufferLength)
{
void *NewBuffer;
ACPI_STATUS Status;
UINT64 Mask;
UINT64 WidthMask;
@ -926,9 +945,9 @@ AcpiExInsertIntoField (
UINT32 BufferTailBits;
UINT32 DatumCount;
UINT32 FieldDatumCount;
UINT32 i;
UINT32 AccessBitWidth;
UINT32 RequiredLength;
void *NewBuffer;
UINT32 i;
ACPI_FUNCTION_TRACE (ExInsertIntoField);
@ -965,31 +984,41 @@ AcpiExInsertIntoField (
BufferLength = RequiredLength;
}
/* TBD: Move to common setup code */
/* Algo is limited to sizeof(UINT64), so cut the AccessByteWidth */
if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64))
{
ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64);
}
AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
/*
* Create the bitmasks used for bit insertion.
* Note: This if/else is used to bypass compiler differences with the
* shift operator
*/
if (ObjDesc->CommonField.AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
if (AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
{
WidthMask = ACPI_UINT64_MAX;
}
else
{
WidthMask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.AccessBitWidth);
WidthMask = ACPI_MASK_BITS_ABOVE (AccessBitWidth);
}
Mask = WidthMask &
ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
/* Compute the number of datums (access width data items) */
DatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.AccessBitWidth);
AccessBitWidth);
FieldDatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.AccessBitWidth);
ObjDesc->CommonField.StartFieldBitOffset,
AccessBitWidth);
/* Get initial Datum from the input buffer */
@ -1024,12 +1053,11 @@ AcpiExInsertIntoField (
* This avoids the differences in behavior between different compilers
* concerning shift values larger than the target data width.
*/
if ((ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
if ((AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset) <
ACPI_INTEGER_BIT_SIZE)
{
MergedDatum = RawDatum >>
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
(AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
}
else
{
@ -1048,15 +1076,15 @@ AcpiExInsertIntoField (
BufferOffset += ObjDesc->CommonField.AccessByteWidth;
ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
BufferLength - BufferOffset));
MergedDatum |= RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
}
/* Mask off any extra bits in the last datum */
BufferTailBits = (ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset) %
ObjDesc->CommonField.AccessBitWidth;
ObjDesc->CommonField.StartFieldBitOffset) % AccessBitWidth;
if (BufferTailBits)
{
Mask &= ACPI_MASK_BITS_ABOVE (BufferTailBits);

View File

@ -193,12 +193,12 @@ AcpiExGenerateAccess (
FieldByteLength = FieldByteEndOffset - FieldByteOffset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Bit length %d, Bit offset %d\n",
FieldBitLength, FieldBitOffset));
"Bit length %u, Bit offset %u\n",
FieldBitLength, FieldBitOffset));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Byte Length %d, Byte Offset %d, End Offset %d\n",
FieldByteLength, FieldByteOffset, FieldByteEndOffset));
"Byte Length %u, Byte Offset %u, End Offset %u\n",
FieldByteLength, FieldByteOffset, FieldByteEndOffset));
/*
* Iterative search for the maximum access width that is both aligned
@ -228,18 +228,18 @@ AcpiExGenerateAccess (
Accesses = FieldEndOffset - FieldStartOffset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"AccessWidth %d end is within region\n", AccessByteWidth));
"AccessWidth %u end is within region\n", AccessByteWidth));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field Start %d, Field End %d -- requires %d accesses\n",
FieldStartOffset, FieldEndOffset, Accesses));
"Field Start %u, Field End %u -- requires %u accesses\n",
FieldStartOffset, FieldEndOffset, Accesses));
/* Single access is optimal */
if (Accesses <= 1)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Entire field can be accessed with one operation of size %d\n",
"Entire field can be accessed with one operation of size %u\n",
AccessByteWidth));
return_VALUE (AccessByteWidth);
}
@ -257,11 +257,11 @@ AcpiExGenerateAccess (
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"AccessWidth %d end is NOT within region\n", AccessByteWidth));
"AccessWidth %u end is NOT within region\n", AccessByteWidth));
if (AccessByteWidth == 1)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field goes beyond end-of-region!\n"));
"Field goes beyond end-of-region!\n"));
/* Field does not fit in the region at all */
@ -273,8 +273,8 @@ AcpiExGenerateAccess (
* previous access
*/
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Backing off to previous optimal access width of %d\n",
MinimumAccessWidth));
"Backing off to previous optimal access width of %u\n",
MinimumAccessWidth));
return_VALUE (MinimumAccessWidth);
}
}
@ -284,7 +284,7 @@ AcpiExGenerateAccess (
* just use max access width
*/
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Cannot access field in one operation, using width 8\n"));
"Cannot access field in one operation, using width 8\n"));
return_VALUE (8);
}
#endif /* ACPI_UNDER_DEVELOPMENT */
@ -444,18 +444,16 @@ AcpiExPrepCommonFieldObject (
* the same (equivalent) as the ByteAlignment.
*/
AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags,
&ByteAlignment);
&ByteAlignment);
if (!AccessBitWidth)
{
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
/* Setup width (access granularity) fields */
/* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */
ObjDesc->CommonField.AccessByteWidth = (UINT8)
ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth;
ACPI_DIV_8 (AccessBitWidth);
/*
* BaseByteOffset is the address of the start of the field within the
@ -468,9 +466,9 @@ AcpiExPrepCommonFieldObject (
* region or buffer.
*/
NearestByteAddress =
ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
ObjDesc->CommonField.BaseByteOffset = (UINT32)
ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
/*
* StartFieldBitOffset is the offset of the first bit of the field within
@ -479,16 +477,6 @@ AcpiExPrepCommonFieldObject (
ObjDesc->CommonField.StartFieldBitOffset = (UINT8)
(FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
/*
* Does the entire field fit within a single field access element? (datum)
* (i.e., without crossing a datum boundary)
*/
if ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) <=
(UINT16) AccessBitWidth)
{
ObjDesc->Common.Flags |= AOPOBJ_SINGLE_DATUM;
}
return_ACPI_STATUS (AE_OK);
}
@ -512,8 +500,9 @@ AcpiExPrepFieldValue (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *SecondDesc = NULL;
UINT32 Type;
ACPI_STATUS Status;
UINT32 AccessByteWidth;
UINT32 Type;
ACPI_FUNCTION_TRACE (ExPrepFieldValue);
@ -532,8 +521,7 @@ AcpiExPrepFieldValue (
Type = AcpiNsGetType (Info->RegionNode);
if (Type != ACPI_TYPE_REGION)
{
ACPI_ERROR ((AE_INFO,
"Needed Region, found type 0x%X (%s)",
ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)",
Type, AcpiUtGetTypeName (Type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@ -551,8 +539,9 @@ AcpiExPrepFieldValue (
/* Initialize areas of the object that are common to all fields */
ObjDesc->CommonField.Node = Info->FieldNode;
Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags,
Info->Attribute, Info->FieldBitPosition, Info->FieldBitLength);
Status = AcpiExPrepCommonFieldObject (ObjDesc,
Info->FieldFlags, Info->Attribute,
Info->FieldBitPosition, Info->FieldBitLength);
if (ACPI_FAILURE (Status))
{
AcpiUtDeleteObjectDesc (ObjDesc);
@ -567,6 +556,22 @@ AcpiExPrepFieldValue (
ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
/* Allow full data read from EC address space */
if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
(ObjDesc->CommonField.BitLength > 8))
{
AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES (
ObjDesc->CommonField.BitLength);
/* Maximum byte width supported is 255 */
if (AccessByteWidth < 256)
{
ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth;
}
}
/* An additional reference for the container */
AcpiUtAddReference (ObjDesc->Field.RegionObj);
@ -580,11 +585,11 @@ AcpiExPrepFieldValue (
case ACPI_TYPE_LOCAL_BANK_FIELD:
ObjDesc->BankField.Value = Info->BankValue;
ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (
Info->RegionNode);
ObjDesc->BankField.BankObj = AcpiNsGetAttachedObject (
Info->RegisterNode);
ObjDesc->BankField.Value = Info->BankValue;
ObjDesc->BankField.RegionObj =
AcpiNsGetAttachedObject (Info->RegionNode);
ObjDesc->BankField.BankObj =
AcpiNsGetAttachedObject (Info->RegisterNode);
/* An additional reference for the attached objects */
@ -604,9 +609,11 @@ AcpiExPrepFieldValue (
* opcode and operands -- since the BankValue
* operands must be evaluated.
*/
SecondDesc = ObjDesc->Common.NextObject;
SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Data;
SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Length;
SecondDesc = ObjDesc->Common.NextObject;
SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
Info->DataRegisterNode)->Named.Data;
SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
Info->DataRegisterNode)->Named.Length;
break;
@ -615,10 +622,10 @@ AcpiExPrepFieldValue (
/* Get the Index and Data registers */
ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (
Info->RegisterNode);
ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (
Info->DataRegisterNode);
ObjDesc->IndexField.IndexObj =
AcpiNsGetAttachedObject (Info->RegisterNode);
ObjDesc->IndexField.DataObj =
AcpiNsGetAttachedObject (Info->DataRegisterNode);
if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
{
@ -673,10 +680,10 @@ AcpiExPrepFieldValue (
* preserving the current type of that NamedObj.
*/
Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc,
AcpiNsGetType (Info->FieldNode));
AcpiNsGetType (Info->FieldNode));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n",
Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc));
Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc));
/* Remove local reference to the object */

View File

@ -285,7 +285,7 @@ AcpiExSystemMemorySpaceHandler (
((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
"System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
/*
@ -395,7 +395,7 @@ AcpiExSystemIoSpaceHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
"System-IO (width %u) R/W %u Address=%8.8X%8.8X\n",
BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
/* Decode the function parameter */
@ -475,7 +475,7 @@ AcpiExPciConfigSpaceHandler (
PciRegister = (UINT16) (UINT32) Address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
"Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device,
PciId->Function, PciRegister));

View File

@ -302,6 +302,15 @@ AcpiExSystemDoSleep (
AcpiExRelinquishInterpreter ();
/*
* For compatibility with other ACPI implementations and to prevent
* accidental deep sleeps, limit the sleep time to something reasonable.
*/
if (HowLong > ACPI_MAX_SLEEP)
{
HowLong = ACPI_MAX_SLEEP;
}
AcpiOsSleep (HowLong);
/* And now we must get the interpreter again */

View File

@ -396,7 +396,7 @@ AcpiEnterSleepState (
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Entering sleep state [S%d]\n", SleepState));
"Entering sleep state [S%u]\n", SleepState));
/* Clear the SLP_EN and SLP_TYP fields */

View File

@ -316,6 +316,13 @@ AcpiHwReadPort (
UINT32 i;
/* Truncate address to 16 bits if requested */
if (AcpiGbl_TruncateIoAddresses)
{
Address &= ACPI_UINT16_MAX;
}
/* Validate the entire request and perform the I/O */
Status = AcpiHwValidateIoRequest (Address, Width);
@ -383,6 +390,13 @@ AcpiHwWritePort (
UINT32 i;
/* Truncate address to 16 bits if requested */
if (AcpiGbl_TruncateIoAddresses)
{
Address &= ACPI_UINT16_MAX;
}
/* Validate the entire request and perform the I/O */
Status = AcpiHwValidateIoRequest (Address, Width);

View File

@ -193,6 +193,10 @@
#define ACPI_MAX_LOOP_ITERATIONS 0xFFFF
/* Maximum sleep allowed via Sleep() operator */
#define ACPI_MAX_SLEEP 20000 /* Two seconds */
/******************************************************************************
*

View File

@ -131,9 +131,19 @@ typedef const struct acpi_dmtable_info
UINT8 Opcode;
UINT8 Offset;
char *Name;
UINT8 Flags;
} ACPI_DMTABLE_INFO;
#define DT_LENGTH 0x01 /* Field is a subtable length */
#define DT_FLAG 0x02 /* Field is a flag value */
#define DT_NON_ZERO 0x04 /* Field must be non-zero */
/* TBD: Not used at this time */
#define DT_OPTIONAL 0x08
#define DT_COUNT 0x10
/*
* Values for Opcode above.
* Note: 0-7 must not change, used as a flag shift value
@ -173,17 +183,24 @@ typedef const struct acpi_dmtable_info
#define ACPI_DMT_FADTPM 32
#define ACPI_DMT_BUF16 33
#define ACPI_DMT_IVRS 34
#define ACPI_DMT_BUFFER 35
#define ACPI_DMT_PCI_PATH 36
typedef
void (*ACPI_DMTABLE_HANDLER) (
ACPI_TABLE_HEADER *Table);
typedef
ACPI_STATUS (*ACPI_CMTABLE_HANDLER) (
void **PFieldList);
typedef struct acpi_dmtable_data
{
char *Signature;
ACPI_DMTABLE_INFO *TableInfo;
ACPI_DMTABLE_HANDLER TableHandler;
ACPI_CMTABLE_HANDLER CmTableHandler;
char *Name;
} ACPI_DMTABLE_DATA;
@ -200,11 +217,18 @@ typedef struct acpi_op_walk_info
} ACPI_OP_WALK_INFO;
/*
* TBD - another copy of this is in asltypes.h, fix
*/
#ifndef ASL_WALK_CALLBACK_DEFINED
typedef
ACPI_STATUS (*ASL_WALK_CALLBACK) (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
#define ASL_WALK_CALLBACK_DEFINED
#endif
typedef struct acpi_resource_tag
{
@ -312,6 +336,11 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[];
/*
* dmtable
*/
ACPI_DMTABLE_DATA *
AcpiDmGetTableData (
char *Signature);
void
AcpiDmDumpDataTable (
ACPI_TABLE_HEADER *Table);

View File

@ -293,7 +293,7 @@ char const *AcpiGbl_ExceptionNames_Env[] =
"AE_NO_GLOBAL_LOCK",
"AE_ABORT_METHOD",
"AE_SAME_HANDLER",
"AE_WAKE_ONLY_GPE",
"AE_NO_HANDLER",
"AE_OWNER_ID_LIMIT"
};

View File

@ -199,6 +199,14 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE);
*/
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE);
/*
* Optionally truncate I/O addresses to 16 bits. Provides compatibility
* with other ACPI implementations. NOTE: During ACPICA initialization,
* this value is set to TRUE if any Windows OSI strings have been
* requested by the BIOS.
*/
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE);
/* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */
@ -355,6 +363,7 @@ extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_
ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList;
ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList;
ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats;
ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking;
#endif

View File

@ -275,8 +275,9 @@ typedef struct acpi_namespace_node
UINT8 Flags; /* Miscellaneous flags */
ACPI_OWNER_ID OwnerId; /* Node creator */
ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
struct acpi_namespace_node *Parent; /* Parent node */
struct acpi_namespace_node *Child; /* First child */
struct acpi_namespace_node *Peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
struct acpi_namespace_node *Peer; /* First peer */
/*
* The following fields are used by the ASL compiler and disassembler only
@ -292,7 +293,7 @@ typedef struct acpi_namespace_node
/* Namespace Node flags */
#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
#define ANOBJ_RESERVED 0x01 /* Available for use */
#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */

View File

@ -562,13 +562,4 @@ void
AcpiNsTerminate (
void);
ACPI_NAMESPACE_NODE *
AcpiNsGetParentNode (
ACPI_NAMESPACE_NODE *Node);
ACPI_NAMESPACE_NODE *
AcpiNsGetNextValidNode (
ACPI_NAMESPACE_NODE *Node);
#endif /* __ACNAMESP_H__ */

View File

@ -164,13 +164,14 @@
/* Values for Flag byte above */
#define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02
#define AOPOBJ_DATA_VALID 0x04
#define AOPOBJ_OBJECT_INITIALIZED 0x08
#define AOPOBJ_SETUP_COMPLETE 0x10
#define AOPOBJ_SINGLE_DATUM 0x20
#define AOPOBJ_MODULE_LEVEL 0x40
#define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */
#define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */
#define AOPOBJ_DATA_VALID 0x04 /* Object is intialized and data is valid */
#define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */
#define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */
#define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */
#define AOPOBJ_MODULE_LEVEL 0x40 /* Method is actually module-level code */
#define AOPOBJ_MODIFIED_NAMESPACE 0x80 /* Method modified the namespace */
/******************************************************************************
@ -385,7 +386,6 @@ typedef struct acpi_object_thermal_zone
UINT32 BaseByteOffset; /* Byte offset within containing object */\
UINT32 Value; /* Value to store into the Bank or Index register */\
UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
UINT8 AccessBitWidth; /* Read/Write size in bits (8-64) */
typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */

View File

@ -120,7 +120,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20100428
#define ACPI_CA_VERSION 0x20100528
#include "actypes.h"
#include "actbl.h"
@ -147,6 +147,7 @@ extern ACPI_NAME AcpiGbl_TraceMethodName;
extern UINT32 AcpiGbl_TraceFlags;
extern UINT8 AcpiGbl_EnableAmlDebugObject;
extern UINT8 AcpiGbl_CopyDsdtLocally;
extern UINT8 AcpiGbl_TruncateIoAddresses;
/*

View File

@ -577,14 +577,15 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
{{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */
/* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */
{{"_WDG", 0, ACPI_RTYPE_BUFFER}},
{{"_WED", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}},
{{{0,0,0,0}, 0,0}} /* Table terminator */
};
#if 0
/* Not implemented */
{{"_WDG", 0, ACPI_RTYPE_BUFFER}}, /* MS Extension */
{{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */
/* This is an internally implemented control method, no need to check */
{{"_OSI", 1, ACPI_RTYPE_INTEGER}},

View File

@ -204,23 +204,23 @@ typedef struct acpi_walk_state
} ACPI_WALK_STATE;
/* Info used by AcpiPsInitObjects */
/* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */
typedef struct acpi_init_walk_info
{
UINT16 MethodCount;
UINT16 DeviceCount;
UINT16 OpRegionCount;
UINT16 FieldCount;
UINT16 BufferCount;
UINT16 PackageCount;
UINT16 OpRegionInit;
UINT16 FieldInit;
UINT16 BufferInit;
UINT16 PackageInit;
UINT16 ObjectCount;
ACPI_OWNER_ID OwnerId;
UINT32 TableIndex;
UINT32 ObjectCount;
UINT32 MethodCount;
UINT32 DeviceCount;
UINT32 OpRegionCount;
UINT32 FieldCount;
UINT32 BufferCount;
UINT32 PackageCount;
UINT32 OpRegionInit;
UINT32 FieldInit;
UINT32 BufferInit;
UINT32 PackageInit;
ACPI_OWNER_ID OwnerId;
} ACPI_INIT_WALK_INFO;
@ -294,11 +294,11 @@ typedef struct acpi_evaluate_info
typedef struct acpi_device_walk_info
{
UINT16 DeviceCount;
UINT16 Num_STA;
UINT16 Num_INI;
ACPI_TABLE_DESC *TableDesc;
ACPI_EVALUATE_INFO *EvaluateInfo;
UINT32 DeviceCount;
UINT32 Num_STA;
UINT32 Num_INI;
} ACPI_DEVICE_WALK_INFO;

View File

@ -153,6 +153,14 @@
#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
#ifdef ACPI_UNDEFINED_TABLES
/*
* These tables have been seen in the field, but no definition has been found
*/
#define ACPI_SIG_ATKG "ATKG"
#define ACPI_SIG_GSCI "GSCI" /* GMCH SCI table */
#define ACPI_SIG_IEIT "IEIT"
#endif
/*
* All tables must be byte-packed to match the ACPI specification, since

View File

@ -435,7 +435,7 @@ AcpiNsLookup (
while (!AcpiNsOpensScope (PrefixNode->Type) &&
PrefixNode->Type != ACPI_TYPE_ANY)
{
PrefixNode = AcpiNsGetParentNode (PrefixNode);
PrefixNode = PrefixNode->Parent;
}
}
}
@ -516,7 +516,7 @@ AcpiNsLookup (
/* Backup to the parent node */
NumCarats++;
ThisNode = AcpiNsGetParentNode (ThisNode);
ThisNode = ThisNode->Parent;
if (!ThisNode)
{
/* Current scope has no parent scope */
@ -531,7 +531,7 @@ AcpiNsLookup (
if (SearchParentFlag == ACPI_NS_NO_UPSEARCH)
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Search scope is [%4.4s], path has %d carat(s)\n",
"Search scope is [%4.4s], path has %u carat(s)\n",
AcpiUtGetNodeName (ThisNode), NumCarats));
}
}
@ -592,7 +592,7 @@ AcpiNsLookup (
Path++;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Multi Pathname (%d Segments, Flags=%X)\n",
"Multi Pathname (%u Segments, Flags=%X)\n",
NumSegments, Flags));
break;

View File

@ -255,7 +255,7 @@ AcpiNsRemoveNode (
ACPI_FUNCTION_TRACE_PTR (NsRemoveNode, Node);
ParentNode = AcpiNsGetParentNode (Node);
ParentNode = Node->Parent;
PrevNode = NULL;
NextNode = ParentNode->Child;
@ -265,34 +265,22 @@ AcpiNsRemoveNode (
while (NextNode != Node)
{
PrevNode = NextNode;
NextNode = PrevNode->Peer;
NextNode = NextNode->Peer;
}
if (PrevNode)
{
/* Node is not first child, unlink it */
PrevNode->Peer = NextNode->Peer;
if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
{
PrevNode->Flags |= ANOBJ_END_OF_PEER_LIST;
}
PrevNode->Peer = Node->Peer;
}
else
{
/* Node is first child (has no previous peer) */
if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
{
/* No peers at all */
ParentNode->Child = NULL;
}
else
{ /* Link peer list to parent */
ParentNode->Child = NextNode->Peer;
}
/*
* Node is first child (has no previous peer).
* Link peer list to parent
*/
ParentNode->Child = Node->Peer;
}
/* Delete the node and any attached objects */
@ -336,38 +324,47 @@ AcpiNsInstallNode (
ACPI_FUNCTION_TRACE (NsInstallNode);
/*
* Get the owner ID from the Walk state. The owner ID is used to track
* table deletion and deletion of objects created by methods.
*/
if (WalkState)
{
/*
* Get the owner ID from the Walk state. The owner ID is used to
* track table deletion and deletion of objects created by methods.
*/
OwnerId = WalkState->OwnerId;
if ((WalkState->MethodDesc) &&
(ParentNode != WalkState->MethodNode))
{
/*
* A method is creating a new node that is not a child of the
* method (it is non-local). Mark the executing method as having
* modified the namespace. This is used for cleanup when the
* method exits.
*/
WalkState->MethodDesc->Method.Flags |= AOPOBJ_MODIFIED_NAMESPACE;
}
}
/* Link the new entry into the parent and existing children */
Node->Peer = NULL;
Node->Parent = ParentNode;
ChildNode = ParentNode->Child;
if (!ChildNode)
{
ParentNode->Child = Node;
Node->Flags |= ANOBJ_END_OF_PEER_LIST;
Node->Peer = ParentNode;
}
else
{
while (!(ChildNode->Flags & ANOBJ_END_OF_PEER_LIST))
/* Add node to the end of the peer list */
while (ChildNode->Peer)
{
ChildNode = ChildNode->Peer;
}
ChildNode->Peer = Node;
/* Clear end-of-list flag */
ChildNode->Flags &= ~ANOBJ_END_OF_PEER_LIST;
Node->Flags |= ANOBJ_END_OF_PEER_LIST;
Node->Peer = ParentNode;
}
/* Init the new entry */
@ -402,9 +399,8 @@ void
AcpiNsDeleteChildren (
ACPI_NAMESPACE_NODE *ParentNode)
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *NextNode;
UINT8 Flags;
ACPI_NAMESPACE_NODE *NodeToDelete;
ACPI_FUNCTION_TRACE_PTR (NsDeleteChildren, ParentNode);
@ -415,39 +411,27 @@ AcpiNsDeleteChildren (
return_VOID;
}
/* If no children, all done! */
ChildNode = ParentNode->Child;
if (!ChildNode)
{
return_VOID;
}
/* Deallocate all children at this level */
do
NextNode = ParentNode->Child;
while (NextNode)
{
/* Get the things we need */
NextNode = ChildNode->Peer;
Flags = ChildNode->Flags;
/* Grandchildren should have all been deleted already */
if (ChildNode->Child)
if (NextNode->Child)
{
ACPI_ERROR ((AE_INFO, "Found a grandchild! P=%p C=%p",
ParentNode, ChildNode));
ParentNode, NextNode));
}
/*
* Delete this child node and move on to the next child in the list.
* No need to unlink the node since we are deleting the entire branch.
*/
AcpiNsDeleteNode (ChildNode);
ChildNode = NextNode;
} while (!(Flags & ANOBJ_END_OF_PEER_LIST));
NodeToDelete = NextNode;
NextNode = NextNode->Peer;
AcpiNsDeleteNode (NodeToDelete);
};
/* Clear the parent's child pointer */
@ -533,7 +517,7 @@ AcpiNsDeleteNamespaceSubtree (
/* Move up the tree to the grandparent */
ParentNode = AcpiNsGetParentNode (ParentNode);
ParentNode = ParentNode->Parent;
}
}
@ -655,7 +639,7 @@ AcpiNsDeleteNamespaceByOwner (
/* Move up the tree to the grandparent */
ParentNode = AcpiNsGetParentNode (ParentNode);
ParentNode = ParentNode->Parent;
}
}

View File

@ -537,7 +537,7 @@ AcpiNsDumpOneObject (
return (AE_OK);
}
AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount);
AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
switch (Type)
{

View File

@ -185,25 +185,25 @@ AcpiNsInitializeObjects (
/* Walk entire namespace from the supplied root */
Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
&Info, NULL);
ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
&Info, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd "
"Buffers %hd/%hd Packages (%hd nodes)\n",
"\nInitialized %u/%u Regions %u/%u Fields %u/%u "
"Buffers %u/%u Packages (%u nodes)\n",
Info.OpRegionInit, Info.OpRegionCount,
Info.FieldInit, Info.FieldCount,
Info.BufferInit, Info.BufferCount,
Info.PackageInit, Info.PackageCount, Info.ObjectCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Control Methods found\n", Info.MethodCount));
"%u Control Methods found\n", Info.MethodCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Op Regions found\n", Info.OpRegionCount));
"%u Op Regions found\n", Info.OpRegionCount));
return_ACPI_STATUS (AE_OK);
}
@ -285,6 +285,16 @@ AcpiNsInitializeDevices (
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL);
/*
* Any _OSI requests should be completed by now. If the BIOS has
* requested any Windows OSI strings, we will always truncate
* I/O addresses to 16 bits -- for Windows compatibility.
*/
if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000)
{
AcpiGbl_TruncateIoAddresses = TRUE;
}
ACPI_FREE (Info.EvaluateInfo);
if (ACPI_FAILURE (Status))
{
@ -292,8 +302,8 @@ AcpiNsInitializeDevices (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nExecuted %hd _INI methods requiring %hd _STA executions "
"(examined %hd objects)\n",
"\nExecuted %u _INI methods requiring %u _STA executions "
"(examined %u objects)\n",
Info.Num_INI, Info.Num_STA, Info.DeviceCount));
return_ACPI_STATUS (Status);
@ -510,7 +520,7 @@ AcpiNsFindIniMethods (
* The only _INI methods that we care about are those that are
* present under Device, Processor, and Thermal objects.
*/
ParentNode = AcpiNsGetParentNode (Node);
ParentNode = Node->Parent;
switch (ParentNode->Type)
{
case ACPI_TYPE_DEVICE:
@ -522,7 +532,7 @@ AcpiNsFindIniMethods (
while (ParentNode)
{
ParentNode->Flags |= ANOBJ_SUBTREE_HAS_INI;
ParentNode = AcpiNsGetParentNode (ParentNode);
ParentNode = ParentNode->Parent;
}
break;

View File

@ -176,7 +176,7 @@ AcpiNsBuildExternalPath (
/* Put the name into the buffer */
ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name);
ParentNode = AcpiNsGetParentNode (ParentNode);
ParentNode = ParentNode->Parent;
/* Prefix name with the path separator */
@ -298,7 +298,7 @@ AcpiNsGetPathnameLength (
return 0;
}
Size += ACPI_PATH_SEGMENT_LENGTH;
NextNode = AcpiNsGetParentNode (NextNode);
NextNode = NextNode->Parent;
}
if (!Size)

View File

@ -223,7 +223,7 @@ AcpiNsOneCompleteParse (
/* Parse the AML */
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber));
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", PassNumber));
Status = AcpiPsParseAml (WalkState);
Cleanup:

View File

@ -200,6 +200,13 @@ AcpiNsSortList (
* _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
* _PSS: Sort the list descending by Power
* _TSS: Sort the list descending by Power
*
* Names that must be packages, but cannot be sorted:
*
* _BCL: Values are tied to the Package index where they appear, and cannot
* be moved or sorted. These index values are used for _BQC and _BCM.
* However, we can fix the case where a buffer is returned, by converting
* it to a Package of integers.
*/
static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] =
{

View File

@ -229,17 +229,6 @@ AcpiNsSearchOneScope (
return_ACPI_STATUS (AE_OK);
}
/*
* The last entry in the list points back to the parent,
* so a flag is used to indicate the end-of-list
*/
if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
{
/* Searched entire list, we are done */
break;
}
/* Didn't match name, move on to the next peer object */
Node = Node->Peer;
@ -296,7 +285,7 @@ AcpiNsSearchParentTree (
ACPI_FUNCTION_TRACE (NsSearchParentTree);
ParentNode = AcpiNsGetParentNode (Node);
ParentNode = Node->Parent;
/*
* If there is no parent (i.e., we are at the root) or type is "local",
@ -341,7 +330,7 @@ AcpiNsSearchParentTree (
/* Not found here, go up another level (until we reach the root) */
ParentNode = AcpiNsGetParentNode (ParentNode);
ParentNode = ParentNode->Parent;
}
/* Not found in parent tree */

View File

@ -1057,128 +1057,3 @@ AcpiNsGetNode (
ACPI_FREE (InternalPath);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetParentNode
*
* PARAMETERS: Node - Current table entry
*
* RETURN: Parent entry of the given entry
*
* DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
*
******************************************************************************/
ACPI_NAMESPACE_NODE *
AcpiNsGetParentNode (
ACPI_NAMESPACE_NODE *Node)
{
ACPI_FUNCTION_ENTRY ();
if (!Node)
{
return (NULL);
}
/*
* Walk to the end of this peer list. The last entry is marked with a flag
* and the peer pointer is really a pointer back to the parent. This saves
* putting a parent back pointer in each and every named object!
*/
while (!(Node->Flags & ANOBJ_END_OF_PEER_LIST))
{
Node = Node->Peer;
}
return (Node->Peer);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetNextValidNode
*
* PARAMETERS: Node - Current table entry
*
* RETURN: Next valid Node in the linked node list. NULL if no more valid
* nodes.
*
* DESCRIPTION: Find the next valid node within a name table.
* Useful for implementing NULL-end-of-list loops.
*
******************************************************************************/
ACPI_NAMESPACE_NODE *
AcpiNsGetNextValidNode (
ACPI_NAMESPACE_NODE *Node)
{
/* If we are at the end of this peer list, return NULL */
if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
{
return NULL;
}
/* Otherwise just return the next peer */
return (Node->Peer);
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AcpiNsFindParentName
*
* PARAMETERS: *ChildNode - Named Obj whose name is to be found
*
* RETURN: The ACPI name
*
* DESCRIPTION: Search for the given obj in its parent scope and return the
* name segment, or "????" if the parent name can't be found
* (which "should not happen").
*
******************************************************************************/
ACPI_NAME
AcpiNsFindParentName (
ACPI_NAMESPACE_NODE *ChildNode)
{
ACPI_NAMESPACE_NODE *ParentNode;
ACPI_FUNCTION_TRACE (NsFindParentName);
if (ChildNode)
{
/* Valid entry. Get the parent Node */
ParentNode = AcpiNsGetParentNode (ChildNode);
if (ParentNode)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Parent of %p [%4.4s] is %p [%4.4s]\n",
ChildNode, AcpiUtGetNodeName (ChildNode),
ParentNode, AcpiUtGetNodeName (ParentNode)));
if (ParentNode->Name.Integer)
{
return_VALUE ((ACPI_NAME) ParentNode->Name.Integer);
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Unable to find parent of %p (%4.4s)\n",
ChildNode, AcpiUtGetNodeName (ChildNode)));
}
return_VALUE (ACPI_UNKNOWN_NAME);
}
#endif

View File

@ -158,16 +158,6 @@ AcpiNsGetNextNode (
return (ParentNode->Child);
}
/*
* Get the next node.
*
* If we are at the end of this peer list, return NULL
*/
if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST)
{
return NULL;
}
/* Otherwise just return the next peer */
return (ChildNode->Peer);
@ -227,9 +217,9 @@ AcpiNsGetNextNodeTyped (
return (NextNode);
}
/* Otherwise, move on to the next node */
/* Otherwise, move on to the next peer node */
NextNode = AcpiNsGetNextValidNode (NextNode);
NextNode = NextNode->Peer;
}
/* Not found */
@ -454,7 +444,7 @@ AcpiNsWalkNamespace (
*/
Level--;
ChildNode = ParentNode;
ParentNode = AcpiNsGetParentNode (ParentNode);
ParentNode = ParentNode->Parent;
NodePreviouslyVisited = TRUE;
}

View File

@ -242,7 +242,7 @@ AcpiGetParent (
/* Get the parent entry */
ParentNode = AcpiNsGetParentNode (Node);
ParentNode = Node->Parent;
*RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, ParentNode);
/* Return exception if parent is null */

View File

@ -336,7 +336,7 @@ AcpiOsTableOverride (
*NewTable = OsGetTable (TableName);
if (*NewTable)
{
AcpiOsPrintf ("Table [%s] obtained from registry, %d bytes\n",
AcpiOsPrintf ("Table [%s] obtained from registry, %u bytes\n",
TableName, (*NewTable)->Length);
}
else
@ -744,7 +744,7 @@ AcpiOsCreateSemaphore (
AcpiGbl_Semaphores[i].CurrentUnits = (UINT16) InitialUnits;
AcpiGbl_Semaphores[i].OsHandle = Mutex;
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Handle=%d, Max=%d, Current=%d, OsHandle=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Handle=%u, Max=%u, Current=%u, OsHandle=%p\n",
i, MaxUnits, InitialUnits, Mutex));
*OutHandle = (void *) i;
@ -827,7 +827,7 @@ AcpiOsWaitSemaphore (
if (Units > 1)
{
printf ("WaitSemaphore: Attempt to receive %d units\n", Units);
printf ("WaitSemaphore: Attempt to receive %u units\n", Units);
return AE_NOT_IMPLEMENTED;
}
@ -915,7 +915,7 @@ AcpiOsSignalSemaphore (
if (Units > 1)
{
printf ("SignalSemaphore: Attempt to signal %d units, Index %2.2X\n", Units, Index);
printf ("SignalSemaphore: Attempt to signal %u units, Index %2.2X\n", Units, Index);
return AE_NOT_IMPLEMENTED;
}

View File

@ -182,7 +182,7 @@ AeCtrlCHandler (
signal (SIGINT, SIG_IGN);
SigintCount++;
AcpiOsPrintf ("Caught a ctrl-c (#%d)\n\n", SigintCount);
AcpiOsPrintf ("Caught a ctrl-c (#%u)\n\n", SigintCount);
if (AcpiGbl_MethodExecuting)
{
@ -618,7 +618,7 @@ AeInstallHandlers (void)
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%d)",
"Could not install an OpRegion handler for %s space(%u)",
AcpiUtGetRegionName((UINT8) SpaceId[i]), SpaceId[i]));
return (Status);
}

View File

@ -135,7 +135,7 @@ char *FileList[ASL_MAX_FILES];
int FileCount;
#define AE_SUPPORTED_OPTIONS "?ab:de^f:ghimo:rstvx:z"
#define AE_SUPPORTED_OPTIONS "?b:d:e:f:gm^ovx:"
/******************************************************************************
@ -157,19 +157,25 @@ usage (void)
printf ("Where:\n");
printf (" -? Display this message\n");
printf (" -a Do not abort methods on error\n");
printf (" -b <CommandLine> Batch mode command execution\n");
printf (" -e [Method] Batch mode method execution\n");
printf (" -f <Value> Specify OpRegion initialization fill value\n");
printf (" -i Do not run STA/INI methods during init\n");
printf (" -m Display final memory use statistics\n");
printf (" -o <OutputFile> Send output to this file\n");
printf (" -r Disable OpRegion address simulation\n");
printf (" -s Enable Interpreter Slack Mode\n");
printf (" -t Enable Interpreter Serialized Mode\n");
printf (" -v Verbose init output\n");
printf (" -x <DebugLevel> Specify debug output level\n");
printf (" -z Enable debug semaphore timeout\n");
printf (" -m [Method] Batch mode method execution. Default=MAIN\n");
printf ("\n");
printf (" -da Disable method abort on error\n");
printf (" -di Disable execution of STA/INI methods during init\n");
printf (" -do Disable Operation Region address simulation\n");
printf (" -dt Disable allocation tracking (performance)\n");
printf ("\n");
printf (" -ef Enable display of final memory statistics\n");
printf (" -em Enable Interpreter Serialized Mode\n");
printf (" -es Enable Interpreter Slack Mode\n");
printf (" -et Enable debug semaphore timeout\n");
printf ("\n");
printf (" -f <Value> Operation Region initialization fill value\n");
printf (" -v Verbose initialization output\n");
printf (" -x <DebugLevel> Debug output level\n");
}
@ -471,10 +477,6 @@ main (
while ((j = AcpiGetopt (argc, argv, AE_SUPPORTED_OPTIONS)) != EOF) switch(j)
{
case 'a':
AcpiGbl_IgnoreErrors = TRUE;
break;
case 'b':
if (strlen (AcpiGbl_Optarg) > 127)
{
@ -487,20 +489,58 @@ main (
break;
case 'd':
AcpiGbl_DbOpt_disasm = TRUE;
AcpiGbl_DbOpt_stats = TRUE;
switch (AcpiGbl_Optarg[0])
{
case 'a':
AcpiGbl_IgnoreErrors = TRUE;
break;
case 'i':
AcpiGbl_DbOpt_ini_methods = FALSE;
break;
case 'o':
AcpiGbl_DbOpt_NoRegionSupport = TRUE;
break;
case 't':
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiGbl_DisableMemTracking = TRUE;
#endif
break;
default:
printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
return (-1);
}
break;
case 'e':
AcpiGbl_BatchMode = 2;
switch (AcpiGbl_Optarg[0])
{
case '^':
strcpy (BatchBuffer, "MAIN");
case 'f':
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiGbl_DisplayFinalMemStats = TRUE;
#endif
break;
case 'm':
AcpiGbl_AllMethodsSerialized = TRUE;
printf ("Enabling AML Interpreter serialized mode\n");
break;
case 's':
AcpiGbl_EnableInterpreterSlack = TRUE;
printf ("Enabling AML Interpreter slack mode\n");
break;
case 't':
AcpiGbl_DebugTimeout = TRUE;
break;
default:
strcpy (BatchBuffer, AcpiGbl_Optarg);
break;
printf ("Unknown option: -e%s\n", AcpiGbl_Optarg);
return (-1);
}
break;
@ -513,32 +553,23 @@ main (
AcpiGbl_DbFilename = NULL;
break;
case 'i':
AcpiGbl_DbOpt_ini_methods = FALSE;
break;
case 'm':
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiGbl_DisplayFinalMemStats = TRUE;
#endif
AcpiGbl_BatchMode = 2;
switch (AcpiGbl_Optarg[0])
{
case '^':
strcpy (BatchBuffer, "MAIN");
break;
default:
strcpy (BatchBuffer, AcpiGbl_Optarg);
break;
}
break;
case 'o':
printf ("O option is not implemented\n");
break;
case 'r':
AcpiGbl_DbOpt_NoRegionSupport = TRUE;
break;
case 's':
AcpiGbl_EnableInterpreterSlack = TRUE;
printf ("Enabling AML Interpreter slack mode\n");
break;
case 't':
AcpiGbl_AllMethodsSerialized = TRUE;
printf ("Enabling AML Interpreter serialized mode\n");
AcpiGbl_DbOpt_disasm = TRUE;
AcpiGbl_DbOpt_stats = TRUE;
break;
case 'v':
@ -551,10 +582,6 @@ main (
printf ("Debug Level: 0x%8.8X\n", AcpiDbgLevel);
break;
case 'z':
AcpiGbl_DebugTimeout = TRUE;
break;
case '?':
case 'h':
default:

View File

@ -298,7 +298,7 @@ AsCheckForBraces (
if (!Gbl_QuietMode)
{
printf ("Missing braces for <if>, line %d: %s\n", TotalLines, Filename);
printf ("Missing braces for <if>, line %u: %s\n", TotalLines, Filename);
}
}
}
@ -317,7 +317,7 @@ AsCheckForBraces (
if (!Gbl_QuietMode)
{
printf ("Missing braces for <if>, line %d: %s\n", TotalLines, Filename);
printf ("Missing braces for <if>, line %u: %s\n", TotalLines, Filename);
}
}
}
@ -336,7 +336,7 @@ AsCheckForBraces (
if (!Gbl_QuietMode)
{
printf ("Missing braces for <else>, line %d: %s\n", TotalLines, Filename);
printf ("Missing braces for <else>, line %u: %s\n", TotalLines, Filename);
}
}
}
@ -1126,7 +1126,7 @@ AsCountLines (
if (LongLineCount)
{
VERBOSE_PRINT (("%d Lines longer than 80 found in %s\n", LongLineCount, Filename));
VERBOSE_PRINT (("%u Lines longer than 80 found in %s\n", LongLineCount, Filename));
Gbl_LongLines += LongLineCount;
}
@ -1293,7 +1293,7 @@ AsCountSourceLines (
Gbl_WhiteLines += WhiteCount;
Gbl_CommentLines += CommentCount;
VERBOSE_PRINT (("%d Comment %d White %d Code %d Lines in %s\n",
VERBOSE_PRINT (("%u Comment %u White %u Code %u Lines in %s\n",
CommentCount, WhiteCount, LineCount, LineCount+WhiteCount+CommentCount, Filename));
}

View File

@ -341,13 +341,13 @@ AsDetectLoneLineFeeds (
{
if (!Gbl_IgnoreLoneLineFeeds)
{
printf ("%s: ****File has UNIX format**** (LF only, not CR/LF) %d lines\n",
printf ("%s: ****File has UNIX format**** (LF only, not CR/LF) %u lines\n",
Filename, LfCount);
}
}
else
{
printf ("%s: %d lone linefeeds in file\n", Filename, LfCount);
printf ("%s: %u lone linefeeds in file\n", Filename, LfCount);
}
return TRUE;
}
@ -795,7 +795,7 @@ AsGetFile (
Buffer = calloc (Size * 2, 1);
if (!Buffer)
{
printf ("Could not allocate buffer of size %d\n", Size * 2);
printf ("Could not allocate buffer of size %u\n", Size * 2);
goto ErrorExit;
}

View File

@ -793,7 +793,7 @@ ListTables (
TableHeader->AslCompilerId, TableHeader->AslCompilerRevision);
}
printf ("\nFound %d ACPI tables [%8.8X]\n", TableCount, VERSION);
printf ("\nFound %u ACPI tables [%8.8X]\n", TableCount, VERSION);
fclose (InputFile);
return (0);
}

View File

@ -944,10 +944,10 @@ AcpiUtInitGlobals (
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;
AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST;
#ifdef ACPI_DISASSEMBLER
@ -960,6 +960,7 @@ AcpiUtInitGlobals (
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiGbl_DisplayFinalMemStats = FALSE;
AcpiGbl_DisableMemTracking = FALSE;
#endif
return_ACPI_STATUS (AE_OK);

View File

@ -436,6 +436,11 @@ AcpiUtTrackAllocation (
ACPI_FUNCTION_TRACE_PTR (UtTrackAllocation, Allocation);
if (AcpiGbl_DisableMemTracking)
{
return_ACPI_STATUS (AE_OK);
}
MemList = AcpiGbl_GlobalList;
Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
if (ACPI_FAILURE (Status))
@ -518,6 +523,11 @@ AcpiUtRemoveAllocation (
ACPI_FUNCTION_TRACE (UtRemoveAllocation);
if (AcpiGbl_DisableMemTracking)
{
return_ACPI_STATUS (AE_OK);
}
MemList = AcpiGbl_GlobalList;
if (NULL == MemList->ListHead)
{
@ -650,6 +660,11 @@ AcpiUtDumpAllocations (
ACPI_FUNCTION_TRACE (UtDumpAllocations);
if (AcpiGbl_DisableMemTracking)
{
return;
}
/*
* Walk the allocation list.
*/
@ -668,7 +683,7 @@ AcpiUtDumpAllocations (
if (Element->Size < sizeof (ACPI_COMMON_DESCRIPTOR))
{
AcpiOsPrintf ("%p Length 0x%04X %9.9s-%d "
AcpiOsPrintf ("%p Length 0x%04X %9.9s-%u "
"[Not a Descriptor - too small]\n",
Descriptor, Element->Size, Element->Module,
Element->Line);
@ -679,7 +694,7 @@ AcpiUtDumpAllocations (
if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED)
{
AcpiOsPrintf ("%p Length 0x%04X %9.9s-%d [%s] ",
AcpiOsPrintf ("%p Length 0x%04X %9.9s-%u [%s] ",
Descriptor, Element->Size, Element->Module,
Element->Line, AcpiUtGetDescriptorName (Descriptor));
@ -757,7 +772,7 @@ AcpiUtDumpAllocations (
}
else
{
ACPI_ERROR ((AE_INFO, "%d(0x%X) Outstanding allocations",
ACPI_ERROR ((AE_INFO, "%u(0x%X) Outstanding allocations",
NumOutstanding, NumOutstanding));
}