diff options
95 files changed, 2590 insertions, 2494 deletions
diff --git a/generate/msvc9/AcpiExec.vcproj b/generate/msvc9/AcpiExec.vcproj index 1ed75a642..82ec867c5 100755 --- a/generate/msvc9/AcpiExec.vcproj +++ b/generate/msvc9/AcpiExec.vcproj @@ -936,6 +936,10 @@ > </File> <File + RelativePath="..\..\source\components\executer\exserial.c" + > + </File> + <File RelativePath="..\..\source\components\executer\exstore.c" > </File> diff --git a/generate/msvc9/AcpiSubsystem.vcproj b/generate/msvc9/AcpiSubsystem.vcproj index ab8e2cd3d..6b2cfd3e1 100755 --- a/generate/msvc9/AcpiSubsystem.vcproj +++ b/generate/msvc9/AcpiSubsystem.vcproj @@ -917,6 +917,10 @@ > </File> <File + RelativePath="..\..\source\components\executer\exserial.c" + > + </File> + <File RelativePath="..\..\source\components\executer\exstore.c" > </File> diff --git a/generate/msvc9/Examples.vcproj b/generate/msvc9/Examples.vcproj index e7361d5d1..45fa716a5 100755 --- a/generate/msvc9/Examples.vcproj +++ b/generate/msvc9/Examples.vcproj @@ -646,6 +646,10 @@ > </File> <File + RelativePath="..\..\source\components\executer\exserial.c" + > + </File> + <File RelativePath="..\..\source\components\executer\exstore.c" > </File> diff --git a/generate/unix/acpiexamples/Makefile b/generate/unix/acpiexamples/Makefile index 1689de1bd..0f23c88de 100644 --- a/generate/unix/acpiexamples/Makefile +++ b/generate/unix/acpiexamples/Makefile @@ -80,6 +80,7 @@ OBJECTS = \ $(OBJDIR)/exresnte.o\ $(OBJDIR)/exresolv.o\ $(OBJDIR)/exresop.o\ + $(OBJDIR)/exserial.o\ $(OBJDIR)/exstore.o\ $(OBJDIR)/exstoren.o\ $(OBJDIR)/exstorob.o\ diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 9118397d5..9faf31214 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -129,6 +129,7 @@ OBJECTS = \ $(OBJDIR)/exresnte.o\ $(OBJDIR)/exresolv.o\ $(OBJDIR)/exresop.o\ + $(OBJDIR)/exserial.o\ $(OBJDIR)/exstore.o\ $(OBJDIR)/exstoren.o\ $(OBJDIR)/exstorob.o\ diff --git a/source/common/adisasm.c b/source/common/adisasm.c index 883039a41..70f7932b5 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -576,11 +576,11 @@ AdDisassembleOneTable ( DisasmFilename, CmGetFileSize (File)); } - if (Gbl_MapfileFlag) + if (AslGbl_MapfileFlag) { fprintf (stderr, "%14s %s - %u bytes\n", - Gbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription, - Gbl_Files[ASL_FILE_MAP_OUTPUT].Filename, + AslGbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription, + AslGbl_Files[ASL_FILE_MAP_OUTPUT].Filename, FlGetFileSize (ASL_FILE_MAP_OUTPUT)); } } diff --git a/source/common/ahtable.c b/source/common/ahtable.c index 740ab538b..7d5833e58 100644 --- a/source/common/ahtable.c +++ b/source/common/ahtable.c @@ -159,7 +159,7 @@ const AH_TABLE * AcpiAhGetTableInfo ( char *Signature); -extern const AH_TABLE Gbl_AcpiSupportedTables[]; +extern const AH_TABLE AcpiGbl_SupportedTables[]; /******************************************************************************* @@ -181,7 +181,7 @@ AcpiAhGetTableInfo ( const AH_TABLE *Info; - for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++) + for (Info = AcpiGbl_SupportedTables; Info->Signature; Info++) { if (ACPI_COMPARE_NAME (Signature, Info->Signature)) { @@ -197,7 +197,7 @@ AcpiAhGetTableInfo ( * Note: Any tables added here should be duplicated within AcpiDmTableData * in the file common/dmtable.c */ -const AH_TABLE Gbl_AcpiSupportedTables[] = +const AH_TABLE AcpiGbl_SupportedTables[] = { {ACPI_SIG_ASF, "Alert Standard Format table"}, {ACPI_SIG_BERT, "Boot Error Record Table"}, diff --git a/source/common/dmextern.c b/source/common/dmextern.c index df0e1b97e..3ab428dff 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -520,27 +520,27 @@ AcpiDmGetExternalsFromFile ( UINT32 ImportCount = 0; - if (!Gbl_ExternalRefFilename) + if (!AslGbl_ExternalRefFilename) { return; } /* Open the file */ - ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r"); + ExternalRefFile = fopen (AslGbl_ExternalRefFilename, "r"); if (!ExternalRefFile) { fprintf (stderr, "Could not open external reference file \"%s\"\n", - Gbl_ExternalRefFilename); + AslGbl_ExternalRefFilename); AslAbort (); return; } /* Each line defines a method */ - while (fgets (StringBuffer, ASL_STRING_BUFFER_SIZE, ExternalRefFile)) + while (fgets (AslGbl_StringBuffer, ASL_STRING_BUFFER_SIZE, ExternalRefFile)) { - Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */ + Token = strtok (AslGbl_StringBuffer, METHOD_SEPARATORS); /* "External" */ if (!Token) { continue; @@ -593,7 +593,7 @@ AcpiDmGetExternalsFromFile ( /* Add this external to the global list */ AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n", - Gbl_ExternalRefFilename, ArgCount, MethodName); + AslGbl_ExternalRefFilename, ArgCount, MethodName); AcpiDmAddPathToExternalList (MethodName, ACPI_TYPE_METHOD, ArgCount, (ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_FILE)); @@ -604,7 +604,7 @@ AcpiDmGetExternalsFromFile ( { fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n", - Gbl_ExternalRefFilename); + AslGbl_ExternalRefFilename); } else { @@ -613,7 +613,7 @@ AcpiDmGetExternalsFromFile ( AcpiDmAddExternalListToNamespace (); AcpiOsPrintf ("%s: Imported %u external method definitions\n", - Gbl_ExternalRefFilename, ImportCount); + AslGbl_ExternalRefFilename, ImportCount); } fclose (ExternalRefFile); @@ -1394,12 +1394,12 @@ AcpiDmEmitExternals ( AcpiDmUnresolvedWarning (1); - if (Gbl_ExternalRefFilename) + if (AslGbl_ExternalRefFilename) { AcpiOsPrintf ( " /*\n * External declarations were imported from\n" " * a reference file -- %s\n */\n\n", - Gbl_ExternalRefFilename); + AslGbl_ExternalRefFilename); } /* diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 07df5d32c..5bdf47805 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -637,7 +637,7 @@ AcpiDmDumpDataTable ( if (AcpiUtIsAmlTable (Table)) { - if (Gbl_VerboseTemplates) + if (AslGbl_VerboseTemplates) { /* Dump the raw table data */ @@ -732,7 +732,7 @@ AcpiDmDumpDataTable ( } } - if (!Gbl_DoTemplates || Gbl_VerboseTemplates) + if (!AslGbl_DoTemplates || AslGbl_VerboseTemplates) { /* Dump the raw table data */ @@ -774,7 +774,7 @@ AcpiDmLineHeader ( Name = ""; } - if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ + if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */ { if (ByteLength) { @@ -821,7 +821,7 @@ AcpiDmLineHeader2 ( UINT32 Value) { - if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ + if (AslGbl_DoTemplates && !AslGbl_VerboseTemplates) /* Terse template */ { if (ByteLength) { @@ -1232,9 +1232,9 @@ AcpiDmDumpTable ( /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */ - (void) AuConvertUuidToString ((char *) Target, MsgBuffer); + (void) AuConvertUuidToString ((char *) Target, AslGbl_MsgBuffer); - AcpiOsPrintf ("%s\n", MsgBuffer); + AcpiOsPrintf ("%s\n", AslGbl_MsgBuffer); break; case ACPI_DMT_STRING: diff --git a/source/compiler/aslallocate.c b/source/compiler/aslallocate.c index 49d22b7e7..bf67626c8 100644 --- a/source/compiler/aslallocate.c +++ b/source/compiler/aslallocate.c @@ -186,16 +186,16 @@ UtLocalCalloc ( if (!Allocated) { AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_InputByteCount, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); CmCleanupAndExit (); exit (1); } - TotalAllocations++; - TotalAllocated += Size; + AslGbl_TotalAllocations++; + AslGbl_TotalAllocated += Size; return (Allocated); } @@ -209,7 +209,7 @@ UtLocalCalloc ( * RETURN: None. Reallocates the global line buffers * * DESCRIPTION: Called if the current line buffer becomes filled. Reallocates - * all global line buffers and updates Gbl_LineBufferSize. NOTE: + * all global line buffers and updates AslGbl_LineBufferSize. NOTE: * Also used for the initial allocation of the buffers, when * all of the buffer pointers are NULL. Initial allocations are * of size ASL_DEFAULT_LINE_BUFFER_SIZE @@ -225,21 +225,21 @@ UtExpandLineBuffers ( /* Attempt to double the size of all line buffers */ - NewSize = Gbl_LineBufferSize * 2; - if (Gbl_CurrentLineBuffer) + NewSize = AslGbl_LineBufferSize * 2; + if (AslGbl_CurrentLineBuffer) { DbgPrint (ASL_DEBUG_OUTPUT, "Increasing line buffer size from %u to %u\n", - Gbl_LineBufferSize, NewSize); + AslGbl_LineBufferSize, NewSize); } - UtReallocLineBuffers (&Gbl_CurrentLineBuffer, Gbl_LineBufferSize, NewSize); - UtReallocLineBuffers (&Gbl_MainTokenBuffer, Gbl_LineBufferSize, NewSize); - UtReallocLineBuffers (&Gbl_MacroTokenBuffer, Gbl_LineBufferSize, NewSize); - UtReallocLineBuffers (&Gbl_ExpressionTokenBuffer, Gbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&AslGbl_CurrentLineBuffer, AslGbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&AslGbl_MainTokenBuffer, AslGbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&AslGbl_MacroTokenBuffer, AslGbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&AslGbl_ExpressionTokenBuffer, AslGbl_LineBufferSize, NewSize); - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; - Gbl_LineBufferSize = NewSize; + AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer; + AslGbl_LineBufferSize = NewSize; } @@ -296,8 +296,8 @@ UtFreeLineBuffers ( void) { - free (Gbl_CurrentLineBuffer); - free (Gbl_MainTokenBuffer); - free (Gbl_MacroTokenBuffer); - free (Gbl_ExpressionTokenBuffer); + free (AslGbl_CurrentLineBuffer); + free (AslGbl_MainTokenBuffer); + free (AslGbl_MacroTokenBuffer); + free (AslGbl_ExpressionTokenBuffer); } diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c index 82e76eb92..1fd742cce 100644 --- a/source/compiler/aslanalyze.c +++ b/source/compiler/aslanalyze.c @@ -452,8 +452,8 @@ AnCheckMethodReturnValue ( { /* Method returns a value, but the type is wrong */ - AnFormatBtype (StringBuffer, ThisNodeBtype); - AnFormatBtype (StringBuffer2, RequiredBtypes); + AnFormatBtype (AslGbl_StringBuffer, ThisNodeBtype); + AnFormatBtype (AslGbl_StringBuffer2, RequiredBtypes); /* * The case where the method does not return any value at all @@ -463,11 +463,11 @@ AnCheckMethodReturnValue ( */ if (ThisNodeBtype != 0) { - sprintf (MsgBuffer, + sprintf (AslGbl_MsgBuffer, "Method returns [%s], %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); + AslGbl_StringBuffer, OpInfo->Name, AslGbl_StringBuffer2); - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer); } } } diff --git a/source/compiler/aslcache.c b/source/compiler/aslcache.c index 1d6971a1e..103193b38 100644 --- a/source/compiler/aslcache.c +++ b/source/compiler/aslcache.c @@ -187,25 +187,25 @@ UtLocalCacheCalloc ( { CacheSize = Length; - if (Gbl_StringCacheList) + if (AslGbl_StringCacheList) { Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize); /* Link new cache buffer just following head of list */ - Cache->Next = Gbl_StringCacheList->Next; - Gbl_StringCacheList->Next = Cache; + Cache->Next = AslGbl_StringCacheList->Next; + AslGbl_StringCacheList->Next = Cache; /* Leave cache management pointers alone as they pertain to head */ - Gbl_StringCount++; - Gbl_StringSize += Length; + AslGbl_StringCount++; + AslGbl_StringSize += Length; return (Cache->Buffer); } } - if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast) + if ((AslGbl_StringCacheNext + Length) >= AslGbl_StringCacheLast) { /* Allocate a new buffer */ @@ -213,20 +213,20 @@ UtLocalCacheCalloc ( /* Link new cache buffer to head of list */ - Cache->Next = Gbl_StringCacheList; - Gbl_StringCacheList = Cache; + Cache->Next = AslGbl_StringCacheList; + AslGbl_StringCacheList = Cache; /* Setup cache management pointers */ - Gbl_StringCacheNext = Cache->Buffer; - Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize; + AslGbl_StringCacheNext = Cache->Buffer; + AslGbl_StringCacheLast = AslGbl_StringCacheNext + CacheSize; } - Gbl_StringCount++; - Gbl_StringSize += Length; + AslGbl_StringCount++; + AslGbl_StringSize += Length; - Buffer = Gbl_StringCacheNext; - Gbl_StringCacheNext += Length; + Buffer = AslGbl_StringCacheNext; + AslGbl_StringCacheNext += Length; return (Buffer); } @@ -252,7 +252,7 @@ UtParseOpCacheCalloc ( ASL_CACHE_INFO *Cache; - if (Gbl_ParseOpCacheNext >= Gbl_ParseOpCacheLast) + if (AslGbl_ParseOpCacheNext >= AslGbl_ParseOpCacheLast) { /* Allocate a new buffer */ @@ -261,17 +261,17 @@ UtParseOpCacheCalloc ( /* Link new cache buffer to head of list */ - Cache->Next = Gbl_ParseOpCacheList; - Gbl_ParseOpCacheList = Cache; + Cache->Next = AslGbl_ParseOpCacheList; + AslGbl_ParseOpCacheList = Cache; /* Setup cache management pointers */ - Gbl_ParseOpCacheNext = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Cache->Buffer); - Gbl_ParseOpCacheLast = Gbl_ParseOpCacheNext + ASL_PARSEOP_CACHE_SIZE; + AslGbl_ParseOpCacheNext = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Cache->Buffer); + AslGbl_ParseOpCacheLast = AslGbl_ParseOpCacheNext + ASL_PARSEOP_CACHE_SIZE; } - Gbl_ParseOpCount++; - return (Gbl_ParseOpCacheNext++); + AslGbl_ParseOpCount++; + return (AslGbl_ParseOpCacheNext++); } @@ -296,7 +296,7 @@ UtSubtableCacheCalloc ( ASL_CACHE_INFO *Cache; - if (Gbl_SubtableCacheNext >= Gbl_SubtableCacheLast) + if (AslGbl_SubtableCacheNext >= AslGbl_SubtableCacheLast) { /* Allocate a new buffer */ @@ -305,17 +305,17 @@ UtSubtableCacheCalloc ( /* Link new cache buffer to head of list */ - Cache->Next = Gbl_SubtableCacheList; - Gbl_SubtableCacheList = Cache; + Cache->Next = AslGbl_SubtableCacheList; + AslGbl_SubtableCacheList = Cache; /* Setup cache management pointers */ - Gbl_SubtableCacheNext = ACPI_CAST_PTR (DT_SUBTABLE, Cache->Buffer); - Gbl_SubtableCacheLast = Gbl_SubtableCacheNext + ASL_SUBTABLE_CACHE_SIZE; + AslGbl_SubtableCacheNext = ACPI_CAST_PTR (DT_SUBTABLE, Cache->Buffer); + AslGbl_SubtableCacheLast = AslGbl_SubtableCacheNext + ASL_SUBTABLE_CACHE_SIZE; } - Gbl_SubtableCount++; - return (Gbl_SubtableCacheNext++); + AslGbl_SubtableCount++; + return (AslGbl_SubtableCacheNext++); } @@ -340,7 +340,7 @@ UtFieldCacheCalloc ( ASL_CACHE_INFO *Cache; - if (Gbl_FieldCacheNext >= Gbl_FieldCacheLast) + if (AslGbl_FieldCacheNext >= AslGbl_FieldCacheLast) { /* Allocate a new buffer */ @@ -349,17 +349,17 @@ UtFieldCacheCalloc ( /* Link new cache buffer to head of list */ - Cache->Next = Gbl_FieldCacheList; - Gbl_FieldCacheList = Cache; + Cache->Next = AslGbl_FieldCacheList; + AslGbl_FieldCacheList = Cache; /* Setup cache management pointers */ - Gbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer); - Gbl_FieldCacheLast = Gbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE; + AslGbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer); + AslGbl_FieldCacheLast =AslGbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE; } - Gbl_FieldCount++; - return (Gbl_FieldCacheNext++); + AslGbl_FieldCount++; + return (AslGbl_FieldCacheNext++); } @@ -387,95 +387,92 @@ UtDeleteLocalCaches ( * Generic cache, arbitrary size allocations */ BufferCount = 0; - while (Gbl_StringCacheList) + while (AslGbl_StringCacheList) { - Next = Gbl_StringCacheList->Next; - ACPI_FREE (Gbl_StringCacheList); - Gbl_StringCacheList = Next; + Next = AslGbl_StringCacheList->Next; + ACPI_FREE (AslGbl_StringCacheList); + AslGbl_StringCacheList = Next; BufferCount++; } DbgPrint (ASL_DEBUG_OUTPUT, "%u Strings (%u bytes), Buffer size: %u bytes, %u Buffers\n", - Gbl_StringCount, Gbl_StringSize, ASL_STRING_CACHE_SIZE, BufferCount); + AslGbl_StringCount, AslGbl_StringSize, ASL_STRING_CACHE_SIZE, BufferCount); /* Reset cache globals */ - Gbl_StringSize = 0; - Gbl_StringCount = 0; - Gbl_StringCacheNext = NULL; - Gbl_StringCacheLast = NULL; - + AslGbl_StringSize = 0; + AslGbl_StringCount = 0; + AslGbl_StringCacheNext = NULL; + AslGbl_StringCacheLast = NULL; /* * Parse Op cache */ BufferCount = 0; - while (Gbl_ParseOpCacheList) + while (AslGbl_ParseOpCacheList) { - Next = Gbl_ParseOpCacheList->Next; - ACPI_FREE (Gbl_ParseOpCacheList); - Gbl_ParseOpCacheList = Next; + Next = AslGbl_ParseOpCacheList->Next; + ACPI_FREE (AslGbl_ParseOpCacheList); + AslGbl_ParseOpCacheList = Next; BufferCount++; } DbgPrint (ASL_DEBUG_OUTPUT, "%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n", - Gbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE, + AslGbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE, (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount); /* Reset cache globals */ - Gbl_ParseOpCount = 0; - Gbl_ParseOpCacheNext = NULL; - Gbl_ParseOpCacheLast = NULL; - Gbl_ParseTreeRoot = NULL; - + AslGbl_ParseOpCount = 0; + AslGbl_ParseOpCacheNext = NULL; + AslGbl_ParseOpCacheLast = NULL; + AslGbl_ParseTreeRoot = NULL; /* * Table Compiler - Field cache */ BufferCount = 0; - while (Gbl_FieldCacheList) + while (AslGbl_FieldCacheList) { - Next = Gbl_FieldCacheList->Next; - ACPI_FREE (Gbl_FieldCacheList); - Gbl_FieldCacheList = Next; + Next = AslGbl_FieldCacheList->Next; + ACPI_FREE (AslGbl_FieldCacheList); + AslGbl_FieldCacheList = Next; BufferCount++; } DbgPrint (ASL_DEBUG_OUTPUT, "%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n", - Gbl_FieldCount, ASL_FIELD_CACHE_SIZE, + AslGbl_FieldCount, ASL_FIELD_CACHE_SIZE, (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount); /* Reset cache globals */ - Gbl_FieldCount = 0; - Gbl_FieldCacheNext = NULL; - Gbl_FieldCacheLast = NULL; - + AslGbl_FieldCount = 0; + AslGbl_FieldCacheNext = NULL; + AslGbl_FieldCacheLast = NULL; /* * Table Compiler - Subtable cache */ BufferCount = 0; - while (Gbl_SubtableCacheList) + while (AslGbl_SubtableCacheList) { - Next = Gbl_SubtableCacheList->Next; - ACPI_FREE (Gbl_SubtableCacheList); - Gbl_SubtableCacheList = Next; + Next = AslGbl_SubtableCacheList->Next; + ACPI_FREE (AslGbl_SubtableCacheList); + AslGbl_SubtableCacheList = Next; BufferCount++; } DbgPrint (ASL_DEBUG_OUTPUT, "%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n", - Gbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE, + AslGbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE, (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount); /* Reset cache globals */ - Gbl_SubtableCount = 0; - Gbl_SubtableCacheNext = NULL; - Gbl_SubtableCacheLast = NULL; + AslGbl_SubtableCount = 0; + AslGbl_SubtableCacheNext = NULL; + AslGbl_SubtableCacheLast = NULL; } diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index a6a8f7ad0..7b2e3e5ce 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -203,10 +203,10 @@ CgGenerateAmlOutput ( /* Generate the AML output file */ FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; + AslGbl_SourceLine = 0; + AslGbl_NextError = AslGbl_ErrorLog; - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, CgAmlWriteWalk, NULL, NULL); DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2); @@ -237,7 +237,7 @@ CgAmlWriteWalk ( CgWriteNode (Op); - if (!Gbl_DebugFlag) + if (!AslGbl_DebugFlag) { return (AE_OK); } @@ -556,46 +556,46 @@ CgWriteTableHeader ( Child->Asl.Value.String = ACPI_SIG_XXXX; } - strncpy (TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE); + strncpy (AslGbl_TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE); /* Revision */ Child = Child->Asl.Next; - TableHeader.Revision = (UINT8) Child->Asl.Value.Integer; + AslGbl_TableHeader.Revision = (UINT8) Child->Asl.Value.Integer; /* Command-line Revision override */ - if (Gbl_RevisionOverride) + if (AslGbl_RevisionOverride) { - TableHeader.Revision = Gbl_RevisionOverride; + AslGbl_TableHeader.Revision = AslGbl_RevisionOverride; } /* OEMID */ Child = Child->Asl.Next; - strncpy (TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE); + strncpy (AslGbl_TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE); /* OEM TableID */ Child = Child->Asl.Next; - strncpy (TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE); + strncpy (AslGbl_TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE); /* OEM Revision */ Child = Child->Asl.Next; - TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer; + AslGbl_TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer; /* Compiler ID */ - ACPI_MOVE_NAME (TableHeader.AslCompilerId, ASL_CREATOR_ID); + ACPI_MOVE_NAME (AslGbl_TableHeader.AslCompilerId, ASL_CREATOR_ID); /* Compiler version */ - TableHeader.AslCompilerRevision = ACPI_CA_VERSION; + AslGbl_TableHeader.AslCompilerRevision = ACPI_CA_VERSION; /* Table length. Checksum zero for now, will rewrite later */ - TableHeader.Length = sizeof (ACPI_TABLE_HEADER) + + AslGbl_TableHeader.Length = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength; /* Calculate the comment lengths for this definition block parseOp */ @@ -609,12 +609,14 @@ CgWriteTableHeader ( * Take the filename without extensions, add 3 for the new extension * and another 3 for the a908 bytecode and null terminator. */ - TableHeader.Length += strrchr (Gbl_ParseTreeRoot->Asl.Filename, '.') - - Gbl_ParseTreeRoot->Asl.Filename + 1 + 3 + 3; + AslGbl_TableHeader.Length += strrchr (AslGbl_ParseTreeRoot->Asl.Filename, '.') + - AslGbl_ParseTreeRoot->Asl.Filename + 1 + 3 + 3; + Op->Asl.AmlSubtreeLength += - strlen (Gbl_ParseTreeRoot->Asl.Filename) + 3; - CvDbgPrint (" Length: %lu\n", - strlen (Gbl_ParseTreeRoot->Asl.Filename) + 3); + strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3; + + CvDbgPrint (" Length: %lu\n", + strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3); if (Op->Asl.CommentList) { @@ -624,10 +626,10 @@ CgWriteTableHeader ( CommentLength = strlen (Current->Comment)+3; CvDbgPrint ("Length of standard comment): %d\n", CommentLength); CvDbgPrint (" Comment string: %s\n\n", Current->Comment); - TableHeader.Length += CommentLength; + AslGbl_TableHeader.Length += CommentLength; Op->Asl.AmlSubtreeLength += CommentLength; Current = Current->Next; - CvDbgPrint (" Length: %u\n", CommentLength); + CvDbgPrint (" Length: %u\n", CommentLength); } } if (Op->Asl.CloseBraceComment) @@ -635,20 +637,19 @@ CgWriteTableHeader ( CommentLength = strlen (Op->Asl.CloseBraceComment)+3; CvDbgPrint ("Length of inline comment +3: %d\n", CommentLength); CvDbgPrint (" Comment string: %s\n\n", Op->Asl.CloseBraceComment); - TableHeader.Length += CommentLength; + AslGbl_TableHeader.Length += CommentLength; Op->Asl.AmlSubtreeLength += CommentLength; - CvDbgPrint (" Length: %u\n", CommentLength); + CvDbgPrint (" Length: %u\n", CommentLength); } } - TableHeader.Checksum = 0; - - Op->Asl.FinalAmlOffset = ftell (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); + AslGbl_TableHeader.Checksum = 0; + Op->Asl.FinalAmlOffset = ftell (AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle); /* Write entire header and clear the table header global */ - CgLocalWriteAmlData (Op, &TableHeader, sizeof (ACPI_TABLE_HEADER)); - memset (&TableHeader, 0, sizeof (ACPI_TABLE_HEADER)); + CgLocalWriteAmlData (Op, &AslGbl_TableHeader, sizeof (ACPI_TABLE_HEADER)); + memset (&AslGbl_TableHeader, 0, sizeof (ACPI_TABLE_HEADER)); } @@ -727,7 +728,7 @@ CgCloseTable ( /* Process all definition blocks */ - Op = Gbl_ParseTreeRoot->Asl.Child; + Op = AslGbl_ParseTreeRoot->Asl.Child; while (Op) { CgUpdateHeader (Op); @@ -773,7 +774,7 @@ CgWriteNode ( } if ((Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && - Gbl_DoExternals == FALSE) + AslGbl_DoExternals == FALSE) { return; } diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index b0a06e6be..e08442e06 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -205,7 +205,7 @@ CmDoCompile ( UtEndEvent (Event); Event = UtBeginEvent ("Preprocess input file"); - if (Gbl_PreprocessFlag) + if (AslGbl_PreprocessFlag) { /* Enter compiler name as a #define */ @@ -214,10 +214,10 @@ CmDoCompile ( /* Preprocessor */ PrDoPreprocess (); - Gbl_CurrentLineNumber = 1; - Gbl_LogicalLineNumber = 1; + AslGbl_CurrentLineNumber = 1; + AslGbl_LogicalLineNumber = 1; - if (Gbl_PreprocessOnly) + if (AslGbl_PreprocessOnly) { UtEndEvent (Event); CmCleanupAndExit (); @@ -235,7 +235,7 @@ CmDoCompile ( /* Check for parser-detected syntax errors */ - if (Gbl_SyntaxError) + if (AslGbl_SyntaxError) { fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n"); @@ -245,7 +245,7 @@ CmDoCompile ( /* Did the parse tree get successfully constructed? */ - if (!Gbl_ParseTreeRoot) + if (!AslGbl_ParseTreeRoot) { /* * If there are no errors, then we have some sort of @@ -264,23 +264,23 @@ CmDoCompile ( /* Prune the parse tree if requested (debug purposes only) */ - if (Gbl_PruneParseTree) + if (AslGbl_PruneParseTree) { - AslPruneParseTree (Gbl_PruneDepth, Gbl_PruneType); + AslPruneParseTree (AslGbl_PruneDepth, AslGbl_PruneType); } /* Optional parse tree dump, compiler debug output only */ LsDumpParseTree (); - OpcGetIntegerWidth (Gbl_ParseTreeRoot->Asl.Child); + OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child); UtEndEvent (Event); /* Pre-process parse tree for any operator transforms */ Event = UtBeginEvent ("Parse tree transforms"); DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL); UtEndEvent (Event); @@ -288,7 +288,7 @@ CmDoCompile ( Event = UtBeginEvent ("Generate AML opcodes"); DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlOpcodeWalk, NULL); UtEndEvent (Event); @@ -298,7 +298,7 @@ CmDoCompile ( * descriptor within the input file. */ Event = UtBeginEvent ("Open AML output file"); - Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); + Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix); UtEndEvent (Event); if (ACPI_FAILURE (Status)) { @@ -312,9 +312,9 @@ CmDoCompile ( DbgPrint (ASL_DEBUG_OUTPUT, "Interpreting compile-time constant expressions\n\n"); - if (Gbl_FoldConstants) + if (AslGbl_FoldConstants) { - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlConstantWalk, NULL); } else @@ -328,7 +328,7 @@ CmDoCompile ( Event = UtBeginEvent ("Updating AML opcodes after constant folding"); DbgPrint (ASL_DEBUG_OUTPUT, "Updating AML opcodes after constant folding\n\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlOpcodeUpdateWalk, NULL); UtEndEvent (Event); @@ -336,15 +336,15 @@ CmDoCompile ( Event = UtBeginEvent ("Generate AML package lengths"); DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL); UtEndEvent (Event); - if (Gbl_ParseOnlyFlag) + if (AslGbl_ParseOnlyFlag) { AePrintErrorLog (ASL_FILE_STDERR); UtDisplaySummary (ASL_FILE_STDERR); - if (Gbl_DebugFlag) + if (AslGbl_DebugFlag) { /* Print error summary to the stdout also */ @@ -363,7 +363,7 @@ CmDoCompile ( Event = UtBeginEvent ("Create ACPI Namespace"); DbgPrint (ASL_DEBUG_OUTPUT, "Creating ACPI Namespace\n\n"); - Status = LdLoadNamespace (Gbl_ParseTreeRoot); + Status = LdLoadNamespace (AslGbl_ParseTreeRoot); UtEndEvent (Event); if (ACPI_FAILURE (Status)) { @@ -388,19 +388,19 @@ CmDoCompile ( /* Resolve External Declarations */ - if (Gbl_DoExternals) + if (AslGbl_DoExternals) { Event = UtBeginEvent ("Resolve all Externals"); DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n"); - if (Gbl_DoExternalsInPlace) + if (AslGbl_DoExternalsInPlace) { - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, ExAmlExternalWalkBegin, NULL, NULL); } else { - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL); } UtEndEvent (Event); @@ -413,19 +413,19 @@ CmDoCompile ( * part one - check control methods */ Event = UtBeginEvent ("Analyze control method return types"); - AnalysisWalkInfo.MethodStack = NULL; + AslGbl_AnalysisWalkInfo.MethodStack = NULL; DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method analysis\n\n"); - if (Gbl_CrossReferenceOutput) + if (AslGbl_CrossReferenceOutput) { OtPrintHeaders ("Part 1: Object Reference Map " "(Object references from within each control method)"); } - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, MtMethodAnalysisWalkBegin, - MtMethodAnalysisWalkEnd, &AnalysisWalkInfo); + MtMethodAnalysisWalkEnd, &AslGbl_AnalysisWalkInfo); UtEndEvent (Event); /* Generate the object cross-reference file if requested */ @@ -438,7 +438,7 @@ CmDoCompile ( Event = UtBeginEvent ("Determine object types returned by methods"); DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method typing\n\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, AnMethodTypingWalkEnd, NULL); UtEndEvent (Event); @@ -447,10 +447,10 @@ CmDoCompile ( Event = UtBeginEvent ("Analyze AML operand types"); DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Operand type checking\n\n"); - if (Gbl_DoTypechecking) + if (AslGbl_DoTypechecking) { - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, - NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, + NULL, AnOperandTypecheckWalkEnd, &AslGbl_AnalysisWalkInfo); } UtEndEvent (Event); @@ -458,9 +458,9 @@ CmDoCompile ( Event = UtBeginEvent ("Miscellaneous analysis"); DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - miscellaneous\n\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, AnOtherSemanticAnalysisWalkBegin, - NULL, &AnalysisWalkInfo); + NULL, &AslGbl_AnalysisWalkInfo); UtEndEvent (Event); /* @@ -471,17 +471,17 @@ CmDoCompile ( */ if (AcpiGbl_CaptureComments) { - AcpiGbl_LastListHead = Gbl_ParseTreeRoot->Asl.CommentList; - Gbl_ParseTreeRoot->Asl.CommentList = NULL; + AcpiGbl_LastListHead = AslGbl_ParseTreeRoot->Asl.CommentList; + AslGbl_ParseTreeRoot->Asl.CommentList = NULL; } /* Calculate all AML package lengths */ Event = UtBeginEvent ("Finish AML package length generation"); DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, LnInitLengthsWalk, NULL); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL); UtEndEvent (Event); @@ -539,12 +539,12 @@ AslCompilerSignon ( case ASL_FILE_HEX_OUTPUT: - if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) + if (AslGbl_HexOutputFlag == HEX_OUTPUT_ASM) { Prefix = "; "; } - else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || - (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) + else if ((AslGbl_HexOutputFlag == HEX_OUTPUT_C) || + (AslGbl_HexOutputFlag == HEX_OUTPUT_ASL)) { FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n"); Prefix = " * "; @@ -616,12 +616,12 @@ AslCompilerFileHeader ( case ASL_FILE_HEX_OUTPUT: - if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) + if (AslGbl_HexOutputFlag == HEX_OUTPUT_ASM) { Prefix = "; "; } - else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || - (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) + else if ((AslGbl_HexOutputFlag == HEX_OUTPUT_C) || + (AslGbl_HexOutputFlag == HEX_OUTPUT_ASL)) { Prefix = " * "; } @@ -648,7 +648,7 @@ AslCompilerFileHeader ( FlPrintFile (FileId, "%sCompilation of \"%s\" - %s%s\n", - Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), + Prefix, AslGbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), Prefix); switch (FileId) @@ -756,7 +756,7 @@ CmDumpAllEvents ( Event = AslGbl_Events; DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); - if (Gbl_CompileTimesFlag) + if (AslGbl_CompileTimesFlag) { printf ("\nElapsed time for major events\n\n"); } @@ -782,7 +782,7 @@ CmDumpAllEvents ( DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", MicroSeconds, MilliSeconds, Event->EventName); - if (Gbl_CompileTimesFlag) + if (AslGbl_CompileTimesFlag) { printf ("%8u usec %8u msec - %s\n", MicroSeconds, MilliSeconds, Event->EventName); @@ -816,7 +816,7 @@ CmCleanupAndExit ( AslCheckExpectedExceptions (); AePrintErrorLog (ASL_FILE_STDERR); - if (Gbl_DebugFlag) + if (AslGbl_DebugFlag) { /* Print error summary to stdout also */ @@ -827,36 +827,36 @@ CmCleanupAndExit ( CmDumpAllEvents (); - if (Gbl_CompileTimesFlag) + if (AslGbl_CompileTimesFlag) { printf ("\nMiscellaneous compile statistics\n\n"); - printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); - printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); - printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); - printf ("%11u : %s\n", TotalMethods, "Control methods"); - printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); - printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); - printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); + printf ("%11u : %s\n", AslGbl_TotalParseNodes, "Parse nodes"); + printf ("%11u : %s\n", AslGbl_NsLookupCount, "Namespace searches"); + printf ("%11u : %s\n", AslGbl_TotalNamedObjects, "Named objects"); + printf ("%11u : %s\n", AslGbl_TotalMethods, "Control methods"); + printf ("%11u : %s\n", AslGbl_TotalAllocations, "Memory Allocations"); + printf ("%11u : %s\n", AslGbl_TotalAllocated, "Total allocated memory"); + printf ("%11u : %s\n", AslGbl_TotalFolds, "Constant subtrees folded"); printf ("\n"); } - if (Gbl_NsLookupCount) + if (AslGbl_NsLookupCount) { DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n"); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u\n", "Total Namespace searches", - Gbl_NsLookupCount); + AslGbl_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); + AslGbl_NsLookupCount); } - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) + if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT); @@ -868,9 +868,9 @@ CmCleanupAndExit ( * We will delete the AML file if there are errors and the * force AML output option has not been used. */ - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && - (!Gbl_IgnoreErrors) && - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) + if ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && + (!AslGbl_IgnoreErrors) && + AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle) { DeleteAmlFile = TRUE; } @@ -883,10 +883,10 @@ CmCleanupAndExit ( * or aborted. Prevent attempt to close the same file twice in * loop below. */ - if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle == - Gbl_Files[ASL_FILE_INPUT].Handle) + if (AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle == + AslGbl_Files[ASL_FILE_INPUT].Handle) { - Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; + AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; } /* Close the standard I/O files */ @@ -905,7 +905,7 @@ CmCleanupAndExit ( /* Delete the preprocessor temp file unless full debug was specified */ - if (Gbl_PreprocessFlag && !Gbl_KeepPreprocessorTempFile) + if (AslGbl_PreprocessFlag && !AslGbl_KeepPreprocessorTempFile) { FlDeleteFile (ASL_FILE_PREPROCESSOR); } @@ -922,16 +922,15 @@ CmCleanupAndExit ( * filename instead, to determine if the .SRC file was actually * created. */ - if (!Gbl_SourceOutputFlag) + if (!AslGbl_SourceOutputFlag) { FlDeleteFile (ASL_FILE_SOURCE_OUTPUT); } /* Final cleanup after compiling one file */ - if (!Gbl_DoAslConversion) + if (!AslGbl_DoAslConversion) { UtDeleteLocalCaches (); } - } diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index 88c0617ba..8ee931d80 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -566,7 +566,7 @@ NamePathTail [.]{NameSeg} /* ExtendedAttribKeyword: Bus attributes, AccessAs operator (ACPI 5.0) */ -"AttribBytes" { count (0); return (PARSEOP_ACCESSATTRIB_MULTIBYTE); } +"AttribBytes" { count (0); return (PARSEOP_ACCESSATTRIB_BYTES); } "AttribRawBytes" { count (0); return (PARSEOP_ACCESSATTRIB_RAW_BYTES); } "AttribRawProcessBytes" { count (0); return (PARSEOP_ACCESSATTRIB_RAW_PROCESS); } @@ -836,17 +836,17 @@ NamePathTail [.]{NameSeg} . { count (1); if (isprint ((int) *AslCompilertext)) { - sprintf (MsgBuffer, + sprintf (AslGbl_MsgBuffer, "Invalid character (%c), expecting ASL keyword or name", *AslCompilertext); } else { - sprintf (MsgBuffer, + sprintf (AslGbl_MsgBuffer, "Invalid character (0x%2.2X), expecting ASL keyword or name", *AslCompilertext); } - AslCompilererror (MsgBuffer);} + AslCompilererror (AslGbl_MsgBuffer);} <<EOF>> { if (AslPopInputFileStack ()) {yyterminate();} diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 8d5f4bad6..0283b209f 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -295,8 +295,8 @@ /* * Macros for ASL/ASL+ converter */ -#define COMMENT_CAPTURE_ON Gbl_CommentState.CaptureComments = TRUE; -#define COMMENT_CAPTURE_OFF Gbl_CommentState.CaptureComments = FALSE; +#define COMMENT_CAPTURE_ON AslGbl_CommentState.CaptureComments = TRUE; +#define COMMENT_CAPTURE_OFF AslGbl_CommentState.CaptureComments = FALSE; #endif /* ASLDEFINE.H */ diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 39297a4c5..6d45cd400 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -221,7 +221,7 @@ AslAbort ( { AePrintErrorLog (ASL_FILE_STDERR); - if (Gbl_DebugFlag) + if (AslGbl_DebugFlag) { /* Print error summary to stdout also */ @@ -248,7 +248,7 @@ void AeClearErrorLog ( void) { - ASL_ERROR_MSG *Enode = Gbl_ErrorLog; + ASL_ERROR_MSG *Enode = AslGbl_ErrorLog; ASL_ERROR_MSG *Next; @@ -261,7 +261,7 @@ AeClearErrorLog ( Enode = Next; } - Gbl_ErrorLog = NULL; + AslGbl_ErrorLog = NULL; } @@ -289,9 +289,9 @@ AeAddToErrorLog ( /* If Gbl_ErrorLog is null, this is the first error node */ - if (!Gbl_ErrorLog) + if (!AslGbl_ErrorLog) { - Gbl_ErrorLog = Enode; + AslGbl_ErrorLog = Enode; return; } @@ -300,7 +300,7 @@ AeAddToErrorLog ( * List is sorted according to line number. */ Prev = NULL; - Next = Gbl_ErrorLog; + Next = AslGbl_ErrorLog; while ((Next) && (Next->LogicalLineNumber <= Enode->LogicalLineNumber)) { @@ -318,7 +318,7 @@ AeAddToErrorLog ( } else { - Gbl_ErrorLog = Enode; + AslGbl_ErrorLog = Enode; } } @@ -382,7 +382,7 @@ AeDecodeErrorMessageId ( ExtraMessage = NULL; } - if (Gbl_VerboseErrors && !PrematureEOF) + if (AslGbl_VerboseErrors && !PrematureEOF) { if (Total >= 256) { @@ -426,7 +426,7 @@ AeDecodeErrorMessageId ( } fprintf (OutputFile, "\n"); - if (Gbl_VerboseErrors && !Enode->SubError) + if (AslGbl_VerboseErrors && !Enode->SubError) { fprintf (OutputFile, "\n"); } @@ -469,10 +469,10 @@ AePrintErrorSourceLine ( * Use the merged header/source file if present, otherwise * use input file */ - SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; + SourceFile = AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; if (!SourceFile) { - SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle; + SourceFile = AslGbl_Files[ASL_FILE_INPUT].Handle; } if (SourceFile) @@ -497,7 +497,7 @@ AePrintErrorSourceLine ( /* Print filename and line number if present and valid */ - if (Gbl_VerboseErrors) + if (AslGbl_VerboseErrors) { fprintf (OutputFile, "%-8s", Enode->Filename); @@ -530,7 +530,7 @@ AePrintErrorSourceLine ( { fprintf (OutputFile, "[*** iASL: Seek error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); fprintf (OutputFile, "\n"); return AE_OK; @@ -540,7 +540,7 @@ AePrintErrorSourceLine ( { fprintf (OutputFile, "[*** iASL: Read error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); return AE_IO_ERROR; } /* Read/write the source line, up to the maximum line length */ @@ -569,7 +569,7 @@ AePrintErrorSourceLine ( { fprintf (OutputFile, "[*** iASL: Read error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); return AE_IO_ERROR; } @@ -629,7 +629,7 @@ AePrintException ( ASL_ERROR_MSG *Child = Enode->SubError; - if (Gbl_NoErrors) + if (AslGbl_NoErrors) { return; } @@ -648,7 +648,7 @@ AePrintException ( case ASL_WARNING2: case ASL_WARNING3: - if (!Gbl_DisplayWarnings) + if (!AslGbl_DisplayWarnings) { return; } @@ -656,7 +656,7 @@ AePrintException ( case ASL_REMARK: - if (!Gbl_DisplayRemarks) + if (!AslGbl_DisplayRemarks) { return; } @@ -664,7 +664,7 @@ AePrintException ( case ASL_OPTIMIZATION: - if (!Gbl_DisplayOptimizations) + if (!AslGbl_DisplayOptimizations) { return; } @@ -678,7 +678,7 @@ AePrintException ( /* Get the various required file handles */ - OutputFile = Gbl_Files[FileId].Handle; + OutputFile = AslGbl_Files[FileId].Handle; if (Header) { @@ -764,7 +764,7 @@ void AePrintErrorLog ( UINT32 FileId) { - ASL_ERROR_MSG *Enode = Gbl_ErrorLog; + ASL_ERROR_MSG *Enode = AslGbl_ErrorLog; /* Walk the error node list */ @@ -978,20 +978,20 @@ AslLogNewError ( AeAddToErrorLog (Enode); - if (Gbl_DebugFlag) + if (AslGbl_DebugFlag) { /* stderr is a file, send error to it immediately */ AePrintException (ASL_FILE_STDERR, Enode, NULL); } - Gbl_ExceptionCount[Level]++; - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) + AslGbl_ExceptionCount[Level]++; + if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT); - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; + AslGbl_SourceLine = 0; + AslGbl_NextError = AslGbl_ErrorLog; CmCleanupAndExit (); exit(1); } @@ -1026,7 +1026,7 @@ AslIsExceptionIgnored ( ExceptionIgnored = AslIsExceptionDisabled (Level, MessageId); ExceptionIgnored |= AslIsExceptionExpected (Level, MessageId); - return (Gbl_AllExceptionsDisabled || ExceptionIgnored); + return (AslGbl_AllExceptionsDisabled || ExceptionIgnored); } @@ -1050,12 +1050,12 @@ AslCheckExpectedExceptions ( UINT8 i; - for (i = 0; i < Gbl_ExpectedMessagesIndex; ++i) + for (i = 0; i < AslGbl_ExpectedMessagesIndex; ++i) { - if (!Gbl_ExpectedMessages[i].MessageReceived) + if (!AslGbl_ExpectedMessages[i].MessageReceived) { AslError (ASL_ERROR, ASL_MSG_EXCEPTION_NOT_RECEIVED, NULL, - Gbl_ExpectedMessages[i].MessageIdStr); + AslGbl_ExpectedMessages[i].MessageIdStr); } } } @@ -1095,17 +1095,17 @@ AslExpectException ( /* Insert value into the global expected message array */ - if (Gbl_ExpectedMessagesIndex >= ASL_MAX_EXPECTED_MESSAGES) + if (AslGbl_ExpectedMessagesIndex >= ASL_MAX_EXPECTED_MESSAGES) { printf ("Too many messages have been registered as expected (max %u)\n", ASL_MAX_DISABLED_MESSAGES); return (AE_LIMIT); } - Gbl_ExpectedMessages[Gbl_ExpectedMessagesIndex].MessageId = MessageId; - Gbl_ExpectedMessages[Gbl_ExpectedMessagesIndex].MessageIdStr = MessageIdString; - Gbl_ExpectedMessages[Gbl_ExpectedMessagesIndex].MessageReceived = FALSE; - Gbl_ExpectedMessagesIndex++; + AslGbl_ExpectedMessages[AslGbl_ExpectedMessagesIndex].MessageId = MessageId; + AslGbl_ExpectedMessages[AslGbl_ExpectedMessagesIndex].MessageIdStr = MessageIdString; + AslGbl_ExpectedMessages[AslGbl_ExpectedMessagesIndex].MessageReceived = FALSE; + AslGbl_ExpectedMessagesIndex++; return (AE_OK); } @@ -1142,15 +1142,15 @@ AslDisableException ( /* Insert value into the global disabled message array */ - if (Gbl_DisabledMessagesIndex >= ASL_MAX_DISABLED_MESSAGES) + if (AslGbl_DisabledMessagesIndex >= ASL_MAX_DISABLED_MESSAGES) { printf ("Too many messages have been disabled (max %u)\n", ASL_MAX_DISABLED_MESSAGES); return (AE_LIMIT); } - Gbl_DisabledMessages[Gbl_DisabledMessagesIndex] = MessageId; - Gbl_DisabledMessagesIndex++; + AslGbl_DisabledMessages[AslGbl_DisabledMessagesIndex] = MessageId; + AslGbl_DisabledMessagesIndex++; return (AE_OK); } @@ -1181,13 +1181,13 @@ AslIsExceptionExpected ( /* Mark this exception as received */ EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId); - for (i = 0; i < Gbl_ExpectedMessagesIndex; i++) + for (i = 0; i < AslGbl_ExpectedMessagesIndex; i++) { /* Simple implementation via fixed array */ - if (EncodedMessageId == Gbl_ExpectedMessages[i].MessageId) + if (EncodedMessageId == AslGbl_ExpectedMessages[i].MessageId) { - return (Gbl_ExpectedMessages[i].MessageReceived = TRUE); + return (AslGbl_ExpectedMessages[i].MessageReceived = TRUE); } } @@ -1225,7 +1225,7 @@ AslIsExceptionDisabled ( /* Check for global disable via -w1/-w2/-w3 options */ - if (Level > Gbl_WarningLevel) + if (Level > AslGbl_WarningLevel) { return (TRUE); } @@ -1239,11 +1239,11 @@ AslIsExceptionDisabled ( * the user (-vw option) */ EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId); - for (i = 0; i < Gbl_DisabledMessagesIndex; i++) + for (i = 0; i < AslGbl_DisabledMessagesIndex; i++) { /* Simple implementation via fixed array */ - if (EncodedMessageId == Gbl_DisabledMessages[i]) + if (EncodedMessageId == AslGbl_DisabledMessages[i]) { return (TRUE); } @@ -1376,7 +1376,7 @@ AslCoreSubsystemError ( BOOLEAN Abort) { - sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage); + sprintf (AslGbl_MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage); if (Op) { @@ -1385,12 +1385,12 @@ AslCoreSubsystemError ( Op->Asl.LogicalLineNumber, Op->Asl.LogicalByteOffset, Op->Asl.Column, - Op->Asl.Filename, MsgBuffer); + Op->Asl.Filename, AslGbl_MsgBuffer); } else { AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, - 0, 0, 0, 0, NULL, MsgBuffer); + 0, 0, 0, 0, NULL, AslGbl_MsgBuffer); } if (Abort) @@ -1419,11 +1419,11 @@ AslCompilererror ( const char *CompilerMessage) { - Gbl_SyntaxError++; + AslGbl_SyntaxError++; - AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, - Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, - Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, + AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, AslGbl_CurrentLineNumber, + AslGbl_LogicalLineNumber, AslGbl_CurrentLineOffset, + AslGbl_CurrentColumn, AslGbl_Files[ASL_FILE_INPUT].Filename, ACPI_CAST_PTR (char, CompilerMessage)); return (0); diff --git a/source/compiler/aslexternal.c b/source/compiler/aslexternal.c index b3e536932..6212a2898 100644 --- a/source/compiler/aslexternal.c +++ b/source/compiler/aslexternal.c @@ -209,11 +209,11 @@ ExDoExternal ( ListOp->Asl.Child = Op; ListOp->Asl.Next = NULL; - if (Gbl_ExternalsListHead) + if (AslGbl_ExternalsListHead) { /* Link new External to end of list */ - Prev = Gbl_ExternalsListHead; + Prev = AslGbl_ExternalsListHead; Next = Prev; while (Next) { @@ -225,7 +225,7 @@ ExDoExternal ( } else { - Gbl_ExternalsListHead = ListOp; + AslGbl_ExternalsListHead = ListOp; } } @@ -259,7 +259,7 @@ ExInsertArgCount ( CallName = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE); - Next = Gbl_ExternalsListHead; + Next = AslGbl_ExternalsListHead; while (Next) { ArgCount = 0; @@ -344,10 +344,10 @@ ExAmlExternalWalkBegin ( if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) { - Gbl_ExternalsListHead = Op->Asl.Value.Arg; + AslGbl_ExternalsListHead = Op->Asl.Value.Arg; } - if (!Gbl_ExternalsListHead) + if (!AslGbl_ExternalsListHead) { return (AE_OK); } @@ -401,7 +401,7 @@ ExAmlExternalWalkEnd ( * multiple definition blocks in a single file/compile) */ ExMoveExternals (Op); - Gbl_ExternalsListHead = NULL; + AslGbl_ExternalsListHead = NULL; } return (AE_OK); @@ -439,14 +439,14 @@ ExMoveExternals ( UINT32 i; - if (!Gbl_ExternalsListHead) + if (!AslGbl_ExternalsListHead) { return; } /* Remove the External nodes from the tree */ - NextOp = Gbl_ExternalsListHead; + NextOp = AslGbl_ExternalsListHead; while (NextOp) { /* @@ -520,7 +520,7 @@ ExMoveExternals ( Prev->Asl.Next = ExternalOp->Asl.Next; ExternalOp->Asl.Next = NULL; - ExternalOp->Asl.Parent = Gbl_ExternalsListHead; + ExternalOp->Asl.Parent = AslGbl_ExternalsListHead; /* Point the External to the next in the list */ @@ -536,7 +536,7 @@ ExMoveExternals ( * Loop again to remove MethodObj Externals for which * a MethodCall was not found (dead external reference) */ - Prev = Gbl_ExternalsListHead->Asl.Child; + Prev = AslGbl_ExternalsListHead->Asl.Child; Next = Prev; while (Next) { @@ -548,9 +548,9 @@ ExMoveExternals ( { if (Next == Prev) { - Gbl_ExternalsListHead->Asl.Child = Next->Asl.Next; + AslGbl_ExternalsListHead->Asl.Child = Next->Asl.Next; Next->Asl.Next = NULL; - Prev = Gbl_ExternalsListHead->Asl.Child; + Prev = AslGbl_ExternalsListHead->Asl.Child; Next = Prev; continue; } @@ -569,32 +569,32 @@ ExMoveExternals ( /* If list is now empty, don't bother to make If (0) block */ - if (!Gbl_ExternalsListHead->Asl.Child) + if (!AslGbl_ExternalsListHead->Asl.Child) { return; } /* Convert Gbl_ExternalsListHead parent to If(). */ - Gbl_ExternalsListHead->Asl.ParseOpcode = PARSEOP_IF; - Gbl_ExternalsListHead->Asl.AmlOpcode = AML_IF_OP; - Gbl_ExternalsListHead->Asl.CompileFlags = OP_AML_PACKAGE; - UtSetParseOpName (Gbl_ExternalsListHead); + AslGbl_ExternalsListHead->Asl.ParseOpcode = PARSEOP_IF; + AslGbl_ExternalsListHead->Asl.AmlOpcode = AML_IF_OP; + AslGbl_ExternalsListHead->Asl.CompileFlags = OP_AML_PACKAGE; + UtSetParseOpName (AslGbl_ExternalsListHead); /* Create a Zero op for the If predicate */ PredicateOp = TrAllocateOp (PARSEOP_ZERO); PredicateOp->Asl.AmlOpcode = AML_ZERO_OP; - PredicateOp->Asl.Parent = Gbl_ExternalsListHead; + PredicateOp->Asl.Parent = AslGbl_ExternalsListHead; PredicateOp->Asl.Child = NULL; - PredicateOp->Asl.Next = Gbl_ExternalsListHead->Asl.Child; - Gbl_ExternalsListHead->Asl.Child = PredicateOp; + PredicateOp->Asl.Next = AslGbl_ExternalsListHead->Asl.Child; + AslGbl_ExternalsListHead->Asl.Child = PredicateOp; /* Set line numbers (for listings, etc.) */ - Gbl_ExternalsListHead->Asl.LineNumber = 0; - Gbl_ExternalsListHead->Asl.LogicalLineNumber = 0; + AslGbl_ExternalsListHead->Asl.LineNumber = 0; + AslGbl_ExternalsListHead->Asl.LogicalLineNumber = 0; PredicateOp->Asl.LineNumber = 0; PredicateOp->Asl.LogicalLineNumber = 0; @@ -616,15 +616,15 @@ ExMoveExternals ( { /* Definition Block is not empty */ - Gbl_ExternalsListHead->Asl.Next = Next; + AslGbl_ExternalsListHead->Asl.Next = Next; } else { /* Definition Block is empty. */ - Gbl_ExternalsListHead->Asl.Next = NULL; + AslGbl_ExternalsListHead->Asl.Next = NULL; } - Prev->Asl.Next = Gbl_ExternalsListHead; - Gbl_ExternalsListHead->Asl.Parent = Prev->Asl.Parent; + Prev->Asl.Next = AslGbl_ExternalsListHead; + AslGbl_ExternalsListHead->Asl.Parent = Prev->Asl.Parent; } diff --git a/source/compiler/aslfileio.c b/source/compiler/aslfileio.c index eafebd658..54e7d9a69 100644 --- a/source/compiler/aslfileio.c +++ b/source/compiler/aslfileio.c @@ -176,10 +176,10 @@ FlFileError ( UINT8 ErrorId) { - sprintf (MsgBuffer, "\"%s\" (%s) - %s", Gbl_Files[FileId].Filename, - Gbl_Files[FileId].Description, strerror (errno)); + sprintf (AslGbl_MsgBuffer, "\"%s\" (%s) - %s", AslGbl_Files[FileId].Filename, + AslGbl_Files[FileId].Description, strerror (errno)); - AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer); + AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, AslGbl_MsgBuffer); } @@ -207,8 +207,8 @@ FlOpenFile ( FILE *File; - Gbl_Files[FileId].Filename = Filename; - Gbl_Files[FileId].Handle = NULL; + AslGbl_Files[FileId].Filename = Filename; + AslGbl_Files[FileId].Handle = NULL; File = fopen (Filename, Mode); if (!File) @@ -217,7 +217,7 @@ FlOpenFile ( AslAbort (); } - Gbl_Files[FileId].Handle = File; + AslGbl_Files[FileId].Handle = File; } @@ -241,7 +241,7 @@ FlGetFileSize ( UINT32 FileSize; - FileSize = CmGetFileSize (Gbl_Files[FileId].Handle); + FileSize = CmGetFileSize (AslGbl_Files[FileId].Handle); if (FileSize == ACPI_UINT32_MAX) { AslAbort(); @@ -277,10 +277,10 @@ FlReadFile ( /* Read and check for error */ - Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle); + Actual = fread (Buffer, 1, Length, AslGbl_Files[FileId].Handle); if (Actual < Length) { - if (feof (Gbl_Files[FileId].Handle)) + if (feof (AslGbl_Files[FileId].Handle)) { /* End-of-file, just return error */ @@ -321,19 +321,19 @@ FlWriteFile ( /* Write and check for error */ - Actual = fwrite ((char *) Buffer, 1, Length, Gbl_Files[FileId].Handle); + Actual = fwrite ((char *) Buffer, 1, Length, AslGbl_Files[FileId].Handle); if (Actual != Length) { FlFileError (FileId, ASL_MSG_WRITE); AslAbort (); } - if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag) + if ((FileId == ASL_FILE_PREPROCESSOR) && AslGbl_PreprocessorOutputFlag) { /* Duplicate the output to the user preprocessor (.i) file */ Actual = fwrite ((char *) Buffer, 1, Length, - Gbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle); + AslGbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle); if (Actual != Length) { FlFileError (FileId, ASL_MSG_WRITE); @@ -369,7 +369,7 @@ FlPrintFile ( va_start (Args, Format); - Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args); + Actual = vfprintf (AslGbl_Files[FileId].Handle, Format, Args); va_end (Args); if (Actual == -1) @@ -379,7 +379,7 @@ FlPrintFile ( } if ((FileId == ASL_FILE_PREPROCESSOR) && - Gbl_PreprocessorOutputFlag) + AslGbl_PreprocessorOutputFlag) { /* * Duplicate the output to the user preprocessor (.i) file, @@ -391,7 +391,7 @@ FlPrintFile ( } va_start (Args, Format); - Actual = vfprintf (Gbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle, + Actual = vfprintf (AslGbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle, Format, Args); va_end (Args); @@ -426,7 +426,7 @@ FlSeekFile ( int Error; - Error = fseek (Gbl_Files[FileId].Handle, Offset, SEEK_SET); + Error = fseek (AslGbl_Files[FileId].Handle, Offset, SEEK_SET); if (Error) { FlFileError (FileId, ASL_MSG_SEEK); @@ -454,12 +454,12 @@ FlCloseFile ( int Error; - if (!Gbl_Files[FileId].Handle) + if (!AslGbl_Files[FileId].Handle) { return; } - Error = fclose (Gbl_Files[FileId].Handle); + Error = fclose (AslGbl_Files[FileId].Handle); if (Error) { FlFileError (FileId, ASL_MSG_CLOSE); @@ -468,7 +468,7 @@ FlCloseFile ( /* Do not clear/free the filename string */ - Gbl_Files[FileId].Handle = NULL; + AslGbl_Files[FileId].Handle = NULL; return; } @@ -489,7 +489,7 @@ void FlDeleteFile ( UINT32 FileId) { - ASL_FILE_INFO *Info = &Gbl_Files[FileId]; + ASL_FILE_INFO *Info = &AslGbl_Files[FileId]; if (!Info->Filename) diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index cc6aaf826..e6a6e25ea 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -188,9 +188,9 @@ FlSetLineNumber ( { DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New line number %u (old %u)\n", - LineNumber, Gbl_LogicalLineNumber); + LineNumber, AslGbl_LogicalLineNumber); - Gbl_CurrentLineNumber = LineNumber; + AslGbl_CurrentLineNumber = LineNumber; } @@ -212,11 +212,11 @@ FlSetFilename ( { DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New filename %s (old %s)\n", - Filename, Gbl_Files[ASL_FILE_INPUT].Filename); + Filename, AslGbl_Files[ASL_FILE_INPUT].Filename); /* No need to free any existing filename */ - Gbl_Files[ASL_FILE_INPUT].Filename = Filename; + AslGbl_Files[ASL_FILE_INPUT].Filename = Filename; } @@ -257,8 +257,9 @@ FlAddIncludeDirectory ( NeedsSeparator = 1; } - NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR)); - NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator); + NewDir = ACPI_CAST_PTR (ASL_INCLUDE_DIR, + UtLocalCacheCalloc (sizeof (ASL_INCLUDE_DIR))); + NewDir->Dir = UtLocalCacheCalloc (DirLength + 1 + NeedsSeparator); strcpy (NewDir->Dir, Dir); if (NeedsSeparator) { @@ -269,7 +270,7 @@ FlAddIncludeDirectory ( * Preserve command line ordering of -I options by adding new elements * at the end of the list */ - NextDir = Gbl_IncludeDirList; + NextDir = AslGbl_IncludeDirList; while (NextDir) { PrevDir = NextDir; @@ -282,7 +283,7 @@ FlAddIncludeDirectory ( } else { - Gbl_IncludeDirList = NewDir; + AslGbl_IncludeDirList = NewDir; } } @@ -441,19 +442,19 @@ FlOpenIncludeWithPrefix ( * Note: DtGetNextLine strips/ignores comments. * Save current line number since DtGetNextLine modifies it. */ - Gbl_CurrentLineNumber--; - OriginalLineNumber = Gbl_CurrentLineNumber; + AslGbl_CurrentLineNumber--; + OriginalLineNumber = AslGbl_CurrentLineNumber; while (DtGetNextLine (IncludeFile, DT_ALLOW_MULTILINE_QUOTES) != ASL_EOF) { - if (Gbl_CurrentLineBuffer[0] == '#') + if (AslGbl_CurrentLineBuffer[0] == '#') { AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE, Op, "use #include instead"); } } - Gbl_CurrentLineNumber = OriginalLineNumber; + AslGbl_CurrentLineNumber = OriginalLineNumber; /* Must seek back to the start of the file */ @@ -491,9 +492,9 @@ FlOpenIncludeFile ( if (!Op) { AslCommonError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node"); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_InputByteCount, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node"); return; } @@ -504,7 +505,7 @@ FlOpenIncludeFile ( */ AslResetCurrentLineBuffer (); FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); - Gbl_CurrentLineOffset++; + AslGbl_CurrentLineOffset++; /* Attempt to open the include file */ @@ -532,7 +533,7 @@ FlOpenIncludeFile ( * Construct the file pathname from the global directory name. */ IncludeFile = FlOpenIncludeWithPrefix ( - Gbl_DirectoryPath, Op, Op->Asl.Value.String); + AslGbl_DirectoryPath, Op, Op->Asl.Value.String); if (IncludeFile) { return; @@ -542,7 +543,7 @@ FlOpenIncludeFile ( * Second, search for the file within the (possibly multiple) directories * specified by the -I option on the command line. */ - NextDir = Gbl_IncludeDirList; + NextDir = AslGbl_IncludeDirList; while (NextDir) { IncludeFile = FlOpenIncludeWithPrefix ( @@ -558,8 +559,8 @@ FlOpenIncludeFile ( /* We could not open the include file after trying very hard */ ErrorExit: - sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); - AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); + sprintf (AslGbl_MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); + AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, AslGbl_MsgBuffer); } @@ -586,7 +587,7 @@ FlOpenInputFile ( /* Open the input ASL file, text mode */ FlOpenFile (ASL_FILE_INPUT, InputFilename, "rt"); - AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; + AslCompilerin = AslGbl_Files[ASL_FILE_INPUT].Handle; return (AE_OK); } @@ -614,7 +615,7 @@ FlOpenAmlOutputFile ( /* Output filename usually comes from the ASL itself */ - Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename; + Filename = AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename; if (!Filename) { /* Create the output AML filename */ @@ -633,7 +634,7 @@ FlOpenAmlOutputFile ( return (AE_ERROR); } - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = Filename; + AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename = Filename; } /* Open the output AML file in binary mode */ @@ -665,7 +666,7 @@ FlOpenMiscOutputFiles ( /* Create/Open a map file if requested */ - if (Gbl_MapfileFlag) + if (AslGbl_MapfileFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_MAP); if (!Filename) @@ -685,14 +686,14 @@ FlOpenMiscOutputFiles ( /* All done for disassembler */ - if (Gbl_FileType == ASL_INPUT_TYPE_BINARY_ACPI_TABLE) + if (AslGbl_FileType == ASL_INPUT_TYPE_BINARY_ACPI_TABLE) { return (AE_OK); } /* Create/Open a hex output file if asked */ - if (Gbl_HexOutputFlag) + if (AslGbl_HexOutputFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP); if (!Filename) @@ -712,7 +713,7 @@ FlOpenMiscOutputFiles ( /* Create/Open a debug output file if asked */ - if (Gbl_DebugFlag) + if (AslGbl_DebugFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG); if (!Filename) @@ -724,11 +725,11 @@ FlOpenMiscOutputFiles ( /* Open the debug file as STDERR, text mode */ - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename; - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = + AslGbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename; + AslGbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = freopen (Filename, "w+t", stderr); - if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) + if (!AslGbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) { /* * A problem with freopen is that on error, we no longer @@ -748,7 +749,7 @@ FlOpenMiscOutputFiles ( /* Create/Open a cross-reference output file if asked */ - if (Gbl_CrossReferenceOutput) + if (AslGbl_CrossReferenceOutput) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_XREF); if (!Filename) @@ -766,7 +767,7 @@ FlOpenMiscOutputFiles ( /* Create/Open a listing output file if asked */ - if (Gbl_ListingFlag) + if (AslGbl_ListingFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_LISTING); if (!Filename) @@ -786,7 +787,7 @@ FlOpenMiscOutputFiles ( /* Create the preprocessor output temp file if preprocessor enabled */ - if (Gbl_PreprocessFlag) + if (AslGbl_PreprocessFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR); if (!Filename) @@ -803,7 +804,7 @@ FlOpenMiscOutputFiles ( * Create the "user" preprocessor output file if -li flag set. * Note, this file contains no embedded #line directives. */ - if (Gbl_PreprocessorOutputFlag) + if (AslGbl_PreprocessorOutputFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROC_USER); if (!Filename) @@ -818,7 +819,7 @@ FlOpenMiscOutputFiles ( /* All done for data table compiler */ - if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) + if (AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) { return (AE_OK); } @@ -842,11 +843,11 @@ FlOpenMiscOutputFiles ( /* // TBD: TEMP -// AslCompilerin = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; +// AslCompilerin = AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; */ /* Create/Open a assembly code source output file if asked */ - if (Gbl_AsmOutputFlag) + if (AslGbl_AsmOutputFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_SOURCE); if (!Filename) @@ -866,7 +867,7 @@ FlOpenMiscOutputFiles ( /* Create/Open a C code source output file if asked */ - if (Gbl_C_OutputFlag) + if (AslGbl_C_OutputFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_SOURCE); if (!Filename) @@ -887,7 +888,7 @@ FlOpenMiscOutputFiles ( /* Create/Open a C code source output file for the offset table if asked */ - if (Gbl_C_OffsetTableFlag) + if (AslGbl_C_OffsetTableFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_OFFSET); if (!Filename) @@ -908,7 +909,7 @@ FlOpenMiscOutputFiles ( /* Create/Open a assembly include output file if asked */ - if (Gbl_AsmIncludeOutputFlag) + if (AslGbl_AsmIncludeOutputFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_INCLUDE); if (!Filename) @@ -928,7 +929,7 @@ FlOpenMiscOutputFiles ( /* Create/Open a C include output file if asked */ - if (Gbl_C_IncludeOutputFlag) + if (AslGbl_C_IncludeOutputFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_INCLUDE); if (!Filename) @@ -949,7 +950,7 @@ FlOpenMiscOutputFiles ( /* Create a namespace output file if asked */ - if (Gbl_NsOutputFlag) + if (AslGbl_NsOutputFlag) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_NAMESPACE); if (!Filename) @@ -986,7 +987,7 @@ FlOpenMiscOutputFiles ( AslCompilerSignon (ASL_FILE_CONV_DEBUG_OUTPUT); AslCompilerFileHeader (ASL_FILE_CONV_DEBUG_OUTPUT); - AcpiGbl_ConvDebugFile = Gbl_Files[ASL_FILE_CONV_DEBUG_OUTPUT].Handle; + AcpiGbl_ConvDebugFile = AslGbl_Files[ASL_FILE_CONV_DEBUG_OUTPUT].Handle; } return (AE_OK); @@ -1023,40 +1024,40 @@ FlParseInputPathname ( /* Get the path to the input filename's directory */ - Gbl_DirectoryPath = strdup (InputFilename); - if (!Gbl_DirectoryPath) + AslGbl_DirectoryPath = strdup (InputFilename); + if (!AslGbl_DirectoryPath) { return (AE_NO_MEMORY); } - Substring = strrchr (Gbl_DirectoryPath, '\\'); + Substring = strrchr (AslGbl_DirectoryPath, '\\'); if (!Substring) { - Substring = strrchr (Gbl_DirectoryPath, '/'); + Substring = strrchr (AslGbl_DirectoryPath, '/'); if (!Substring) { - Substring = strrchr (Gbl_DirectoryPath, ':'); + Substring = strrchr (AslGbl_DirectoryPath, ':'); } } if (!Substring) { - Gbl_DirectoryPath[0] = 0; - if (Gbl_UseDefaultAmlFilename) + AslGbl_DirectoryPath[0] = 0; + if (AslGbl_UseDefaultAmlFilename) { - Gbl_OutputFilenamePrefix = strdup (InputFilename); + AslGbl_OutputFilenamePrefix = strdup (InputFilename); } } else { - if (Gbl_UseDefaultAmlFilename) + if (AslGbl_UseDefaultAmlFilename) { - Gbl_OutputFilenamePrefix = strdup (Substring + 1); + AslGbl_OutputFilenamePrefix = strdup (Substring + 1); } *(Substring+1) = 0; } - UtConvertBackslashes (Gbl_OutputFilenamePrefix); + UtConvertBackslashes (AslGbl_OutputFilenamePrefix); return (AE_OK); } #endif diff --git a/source/compiler/aslfold.c b/source/compiler/aslfold.c index 7957c149e..b2af9ffa7 100644 --- a/source/compiler/aslfold.c +++ b/source/compiler/aslfold.c @@ -795,7 +795,7 @@ TrInstallReducedConstant ( ACPI_PARSE_OBJECT *DataOp; - TotalFolds++; + AslGbl_TotalFolds++; AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, Op->Asl.ParseOpName); diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index e22f476fc..c3e69cbbd 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -169,11 +169,11 @@ #ifdef _DECLARE_GLOBALS -UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; +UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; /* Table below must match ASL_FILE_TYPES in asltypes.h */ -ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] = +ASL_FILE_INFO AslGbl_Files [ASL_NUM_FILES] = { {NULL, NULL, "stdout: ", "Standard Output"}, {NULL, NULL, "stderr: ", "Standard Error"}, @@ -198,7 +198,7 @@ ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] = /* Table below must match the defines with the same names in actypes.h */ -const char *Gbl_OpFlagNames[ACPI_NUM_OP_FLAGS] = +const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS] = { "OP_VISITED", "OP_AML_PACKAGE", @@ -225,9 +225,9 @@ const char *Gbl_OpFlagNames[ACPI_NUM_OP_FLAGS] = }; #else -extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; -extern ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; -extern const char *Gbl_OpFlagNames[ACPI_NUM_OP_FLAGS]; +extern UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; +extern ASL_FILE_INFO AslGbl_Files [ASL_NUM_FILES]; +extern const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS]; #endif @@ -261,69 +261,68 @@ extern int AslCompilerdebug; /* Source code buffers and pointers for error reporting */ -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_CurrentLineBuffer, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, NULL); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LineBufferSize, ASL_DEFAULT_LINE_BUFFER_SIZE); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_OriginalInputFileSize, 0); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_SyntaxError, 0); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_CurrentLineBuffer, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_LineBufPtr, NULL); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_LineBufferSize, ASL_DEFAULT_LINE_BUFFER_SIZE); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_CurrentColumn, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_CurrentLineNumber, 1); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_LogicalLineNumber, 1); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_CurrentLineOffset, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_OriginalInputFileSize, 0); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (AslGbl_SyntaxError, 0); /* Exception reporting */ -ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL); -ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL); +ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*AslGbl_ErrorLog,NULL); +ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*AslGbl_NextError,NULL); /* Option flags */ -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessOnly, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE); - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_MapfileFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_KeepPreprocessorTempFile, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CrossReferenceOutput, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OffsetTableFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_WarningsAsErrors, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayWarnings, 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_VerboseTemplates, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTypechecking, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_EnableReferenceTypechecking, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoExternals, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoExternalsInPlace, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoAslConversion, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_OptimizeTrivialParseNodes, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DoCompile, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DoSignon, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_PreprocessOnly, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_PreprocessFlag, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DisassembleAll, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_UseDefaultAmlFilename, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_MapfileFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_NsOutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_PreprocessorOutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_KeepPreprocessorTempFile, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DebugFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_CrossReferenceOutput, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_AsmOutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_C_OutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_C_OffsetTableFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_AsmIncludeOutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_C_IncludeOutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_ListingFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_IgnoreErrors, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_SourceOutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_ParseOnlyFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_CompileTimesFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_FoldConstants, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_VerboseErrors, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_NoErrors, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_WarningsAsErrors, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_NoResourceChecking, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_IntegerOptimizationFlag, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_ReferenceOptimizationFlag, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DisplayRemarks, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DisplayWarnings, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DisplayOptimizations, FALSE); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (AslGbl_WarningLevel, ASL_WARNING); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_UseOriginalCompilerId, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_VerboseTemplates, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DoTemplates, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_CompileGeneric, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_AllExceptionsDisabled, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_PruneParseTree, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DoTypechecking, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_EnableReferenceTypechecking, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DoExternals, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DoExternalsInPlace, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_DoAslConversion, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_OptimizeTrivialParseNodes, TRUE); #define HEX_OUTPUT_NONE 0 @@ -331,102 +330,95 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_OptimizeTrivialParseNod #define HEX_OUTPUT_ASM 2 #define HEX_OUTPUT_ASL 3 -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_HexOutputFlag, HEX_OUTPUT_NONE); /* Files */ -ASL_EXTERN char *Gbl_DirectoryPath; -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); -ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); -ASL_EXTERN char *Gbl_CurrentInputFilename; -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_PreviousIncludeFilename, NULL); - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); - +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (AslGbl_HasIncludeFiles, FALSE); +ASL_EXTERN char *AslGbl_DirectoryPath; +ASL_EXTERN char *AslGbl_CurrentInputFilename; +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_IncludeFilename, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_OutputFilenamePrefix, NULL); +ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*AslGbl_IncludeDirList, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_ExternalRefFilename, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_PreviousIncludeFilename, NULL); /* 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); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalExecutableOpcodes, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalParseNodes, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalMethods, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocations, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocated, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalFolds, 0); - +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_InputByteCount, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_InputFieldCount, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_NsLookupCount, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TotalKeywords, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TotalNamedObjects, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TotalExecutableOpcodes, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TotalParseNodes, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TotalMethods, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TotalAllocations, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TotalAllocated, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TotalFolds, 0); /* Local caches */ -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ParseOpCount, 0); -ASL_EXTERN ASL_CACHE_INFO ASL_INIT_GLOBAL (*Gbl_ParseOpCacheList, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_ParseOpCacheNext, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_ParseOpCacheLast, NULL); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_ParseOpCount, 0); +ASL_EXTERN ASL_CACHE_INFO ASL_INIT_GLOBAL (*AslGbl_ParseOpCacheList, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*AslGbl_ParseOpCacheNext, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*AslGbl_ParseOpCacheLast, NULL); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_StringCount, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_StringSize, 0); -ASL_EXTERN ASL_CACHE_INFO ASL_INIT_GLOBAL (*Gbl_StringCacheList, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_StringCount, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_StringSize, 0); +ASL_EXTERN ASL_CACHE_INFO ASL_INIT_GLOBAL (*AslGbl_StringCacheList, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_StringCacheNext, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_StringCacheLast, NULL); /* Map file */ -ASL_EXTERN ACPI_GPIO_INFO ASL_INIT_GLOBAL (*Gbl_GpioList, NULL); -ASL_EXTERN ACPI_SERIAL_INFO ASL_INIT_GLOBAL (*Gbl_SerialList, NULL); - +ASL_EXTERN ACPI_GPIO_INFO ASL_INIT_GLOBAL (*AslGbl_GpioList, NULL); +ASL_EXTERN ACPI_SERIAL_INFO ASL_INIT_GLOBAL (*AslGbl_SerialList, NULL); /* Misc */ -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_TempCount, 0); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_ParseTreeRoot, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_ExternalsListHead, NULL); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0); -ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL); - -ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode; - -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_DisabledMessagesIndex, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ExpectedMessagesIndex, 0); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG"); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID"); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_PruneDepth, 0); -ASL_EXTERN UINT16 ASL_INIT_GLOBAL (Gbl_PruneType, 0); - -ASL_EXTERN ASL_FILE_NODE ASL_INIT_GLOBAL (*Gbl_IncludeFileStack, NULL); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (AslGbl_RevisionOverride, 0); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (AslGbl_TempCount, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_TableLength, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_SourceLine, 0); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (AslGbl_FileType, 0); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_Signature, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*AslGbl_ParseTreeRoot, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*AslGbl_ExternalsListHead, NULL); +ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*AslGbl_ListingNode, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT *AslGbl_FirstLevelInsertionNode; + +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_CurrentHexColumn, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_CurrentAmlOffset, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_CurrentLine, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_DisabledMessagesIndex, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_ExpectedMessagesIndex, 0); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (AslGbl_HexBytesWereWritten, FALSE); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_NumNamespaceObjects, 0); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_ReservedMethods, 0); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (AslGbl_PruneDepth, 0); +ASL_EXTERN UINT16 ASL_INIT_GLOBAL (AslGbl_PruneType, 0); +ASL_EXTERN ASL_FILE_NODE ASL_INIT_GLOBAL (*AslGbl_IncludeFileStack, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_TableSignature, "NO_SIG"); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_TableId, "NO_ID"); /* Specific to the -q option */ -ASL_EXTERN ASL_COMMENT_STATE Gbl_CommentState; - +ASL_EXTERN ASL_COMMENT_STATE AslGbl_CommentState; /* * Determines if an inline comment should be saved in the InlineComment or NodeEndComment * field of ACPI_PARSE_OBJECT. */ -ASL_EXTERN ACPI_COMMENT_NODE ASL_INIT_GLOBAL (*Gbl_CommentListHead, NULL); -ASL_EXTERN ACPI_COMMENT_NODE ASL_INIT_GLOBAL (*Gbl_CommentListTail, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_InlineCommentBuffer, NULL); +ASL_EXTERN ACPI_COMMENT_NODE ASL_INIT_GLOBAL (*AslGbl_CommentListHead, NULL); +ASL_EXTERN ACPI_COMMENT_NODE ASL_INIT_GLOBAL (*AslGbl_CommentListTail, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_InlineCommentBuffer, NULL); /* Static structures */ -ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; -ASL_EXTERN ACPI_TABLE_HEADER TableHeader; +ASL_EXTERN ASL_ANALYSIS_WALK_INFO AslGbl_AnalysisWalkInfo; +ASL_EXTERN ACPI_TABLE_HEADER AslGbl_TableHeader; /* Event timing */ @@ -437,12 +429,12 @@ ASL_EXTERN UINT8 AslGbl_NamespaceEvent; /* Scratch buffers */ -ASL_EXTERN UINT8 Gbl_AmlBuffer[HEX_LISTING_LINE_SIZE]; -ASL_EXTERN char MsgBuffer[ASL_MSG_BUFFER_SIZE]; -ASL_EXTERN char StringBuffer[ASL_STRING_BUFFER_SIZE]; -ASL_EXTERN char StringBuffer2[ASL_STRING_BUFFER_SIZE]; -ASL_EXTERN UINT32 Gbl_DisabledMessages[ASL_MAX_DISABLED_MESSAGES]; -ASL_EXTERN ASL_EXPECTED_MESSAGE Gbl_ExpectedMessages[ASL_MAX_EXPECTED_MESSAGES]; +ASL_EXTERN UINT8 AslGbl_AmlBuffer[HEX_LISTING_LINE_SIZE]; +ASL_EXTERN char AslGbl_MsgBuffer[ASL_MSG_BUFFER_SIZE]; +ASL_EXTERN char AslGbl_StringBuffer[ASL_STRING_BUFFER_SIZE]; +ASL_EXTERN char AslGbl_StringBuffer2[ASL_STRING_BUFFER_SIZE]; +ASL_EXTERN UINT32 AslGbl_DisabledMessages[ASL_MAX_DISABLED_MESSAGES]; +ASL_EXTERN ASL_EXPECTED_MESSAGE AslGbl_ExpectedMessages[ASL_MAX_EXPECTED_MESSAGES]; #endif /* __ASLGLOBAL_H */ diff --git a/source/compiler/aslhex.c b/source/compiler/aslhex.c index c1e3c7619..3e261627f 100644 --- a/source/compiler/aslhex.c +++ b/source/compiler/aslhex.c @@ -196,7 +196,7 @@ HxDoHexOutput ( void) { - switch (Gbl_HexOutputFlag) + switch (AslGbl_HexOutputFlag) { case HEX_OUTPUT_C: @@ -242,9 +242,9 @@ HxReadAmlOutputFile ( Actual = fread (Buffer, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); + AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle); - if (ferror (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)) + if (ferror (AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)) { FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ); AslAbort (); @@ -285,7 +285,7 @@ HxDoHexOutputC ( /* Obtain the file basename (filename with no extension) */ - FileBasename = FlGetFileBasename (Gbl_Files [ASL_FILE_HEX_OUTPUT].Filename); + FileBasename = FlGetFileBasename (AslGbl_Files [ASL_FILE_HEX_OUTPUT].Filename); /* Get AML size, seek back to start */ diff --git a/source/compiler/aslkeywords.y b/source/compiler/aslkeywords.y index 6da600834..9f31d85d2 100644 --- a/source/compiler/aslkeywords.y +++ b/source/compiler/aslkeywords.y @@ -166,8 +166,8 @@ AccessAttribKeyword | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_SND_RCV);} | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_WORD);} | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_WORD_CALL);} - | PARSEOP_ACCESSATTRIB_MULTIBYTE - PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_MULTIBYTE);} + | PARSEOP_ACCESSATTRIB_BYTES + PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_BYTES);} ByteConst PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($<n>3,1,$4);} | PARSEOP_ACCESSATTRIB_RAW_BYTES diff --git a/source/compiler/asllength.c b/source/compiler/asllength.c index 1d4c9d0a9..696dc2424 100644 --- a/source/compiler/asllength.c +++ b/source/compiler/asllength.c @@ -446,7 +446,7 @@ CgGenerateAmlLengths ( { case PARSEOP_DEFINITION_BLOCK: - Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength; + AslGbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength; break; case PARSEOP_NAMESEG: @@ -519,7 +519,7 @@ CgGenerateAmlLengths ( case PARSEOP_EXTERNAL: - if (Gbl_DoExternals == TRUE) + if (AslGbl_DoExternals == TRUE) { CgGenerateAmlOpcodeLength (Op); } @@ -568,6 +568,6 @@ LnAdjustLengthToRoot ( /* Adjust the global table length */ - Gbl_TableLength -= LengthDelta; + AslGbl_TableLength -= LengthDelta; } #endif diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c index 9c35ff338..d573700b1 100644 --- a/source/compiler/asllisting.c +++ b/source/compiler/asllisting.c @@ -205,32 +205,32 @@ LsDoListings ( void) { - if (Gbl_C_OutputFlag) + if (AslGbl_C_OutputFlag) { LsGenerateListing (ASL_FILE_C_SOURCE_OUTPUT); } - if (Gbl_ListingFlag) + if (AslGbl_ListingFlag) { LsGenerateListing (ASL_FILE_LISTING_OUTPUT); } - if (Gbl_AsmOutputFlag) + if (AslGbl_AsmOutputFlag) { LsGenerateListing (ASL_FILE_ASM_SOURCE_OUTPUT); } - if (Gbl_C_IncludeOutputFlag) + if (AslGbl_C_IncludeOutputFlag) { LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT); } - if (Gbl_AsmIncludeOutputFlag) + if (AslGbl_AsmIncludeOutputFlag) { LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT); } - if (Gbl_C_OffsetTableFlag) + if (AslGbl_C_OffsetTableFlag) { LsGenerateListing (ASL_FILE_C_OFFSET_OUTPUT); } @@ -259,19 +259,19 @@ LsGenerateListing ( FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_CurrentHexColumn = 0; - LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename); + AslGbl_SourceLine = 0; + AslGbl_CurrentHexColumn = 0; + LsPushNode (AslGbl_Files[ASL_FILE_INPUT].Filename); if (FileId == ASL_FILE_C_OFFSET_OUTPUT) { - Gbl_CurrentAmlOffset = 0; + AslGbl_CurrentAmlOffset = 0; /* Offset table file has a special header and footer */ LsDoOffsetTableHeader (FileId); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, LsAmlOffsetWalk, NULL, (void *) ACPI_TO_POINTER (FileId)); LsDoOffsetTableFooter (FileId); return; @@ -279,7 +279,7 @@ LsGenerateListing ( /* Process all parse nodes */ - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, NULL, (void *) ACPI_TO_POINTER (FileId)); /* Final processing */ @@ -360,7 +360,7 @@ LsDumpParseTree ( void) { - if (!Gbl_DebugFlag) + if (!AslGbl_DebugFlag) { return; } @@ -368,7 +368,7 @@ LsDumpParseTree ( DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n"); DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, LsTreeWriteWalk, NULL, NULL); DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1); @@ -539,7 +539,7 @@ LsWriteNodeToListing ( /* Always start a definition block at AML offset zero */ - Gbl_CurrentAmlOffset = 0; + AslGbl_CurrentAmlOffset = 0; LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId); /* Use the table Signature and TableId to build a unique name */ @@ -550,28 +550,28 @@ LsWriteNodeToListing ( FlPrintFile (FileId, "%s_%s_Header \\\n", - Gbl_TableSignature, Gbl_TableId); + AslGbl_TableSignature, AslGbl_TableId); break; case ASL_FILE_C_SOURCE_OUTPUT: FlPrintFile (FileId, " unsigned char %s_%s_Header [] =\n {\n", - Gbl_TableSignature, Gbl_TableId); + AslGbl_TableSignature, AslGbl_TableId); break; case ASL_FILE_ASM_INCLUDE_OUTPUT: FlPrintFile (FileId, "extrn %s_%s_Header : byte\n", - Gbl_TableSignature, Gbl_TableId); + AslGbl_TableSignature, AslGbl_TableId); break; case ASL_FILE_C_INCLUDE_OUTPUT: FlPrintFile (FileId, "extern unsigned char %s_%s_Header [];\n", - Gbl_TableSignature, Gbl_TableId); + AslGbl_TableSignature, AslGbl_TableId); break; default: @@ -732,28 +732,28 @@ LsWriteNodeToListing ( FlPrintFile (FileId, "%s_%s_%s \\\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); + AslGbl_TableSignature, AslGbl_TableId, &Pathname[1]); break; case ASL_FILE_C_SOURCE_OUTPUT: FlPrintFile (FileId, " unsigned char %s_%s_%s [] =\n {\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); + AslGbl_TableSignature, AslGbl_TableId, &Pathname[1]); break; case ASL_FILE_ASM_INCLUDE_OUTPUT: FlPrintFile (FileId, "extrn %s_%s_%s : byte\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); + AslGbl_TableSignature, AslGbl_TableId, &Pathname[1]); break; case ASL_FILE_C_INCLUDE_OUTPUT: FlPrintFile (FileId, "extern unsigned char %s_%s_%s [];\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); + AslGbl_TableSignature, AslGbl_TableId, &Pathname[1]); break; default: @@ -821,7 +821,7 @@ LsFinishSourceListing ( } LsFlushListingBuffer (FileId); - Gbl_CurrentAmlOffset = 0; + AslGbl_CurrentAmlOffset = 0; /* Flush any remaining text in the source file */ diff --git a/source/compiler/asllistsup.c b/source/compiler/asllistsup.c index 2e329fe64..50811b048 100644 --- a/source/compiler/asllistsup.c +++ b/source/compiler/asllistsup.c @@ -269,7 +269,7 @@ LsDumpAsciiInComment ( * * DESCRIPTION: Check if there is an exception for this line, and if there is, * put it in the listing immediately. Handles multiple errors - * per line. Gbl_NextError points to the next error in the + * per line. AslGbl_NextError points to the next error in the * sorted (by line #) list of compile errors/warnings. * ******************************************************************************/ @@ -280,8 +280,8 @@ LsCheckException ( UINT32 FileId) { - if ((!Gbl_NextError) || - (LineNumber < Gbl_NextError->LogicalLineNumber )) + if ((!AslGbl_NextError) || + (LineNumber < AslGbl_NextError->LogicalLineNumber )) { return; } @@ -290,11 +290,11 @@ LsCheckException ( if (FileId == ASL_FILE_LISTING_OUTPUT) { - while (Gbl_NextError && - (LineNumber >= Gbl_NextError->LogicalLineNumber)) + while (AslGbl_NextError && + (LineNumber >= AslGbl_NextError->LogicalLineNumber)) { - AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n"); - Gbl_NextError = Gbl_NextError->Next; + AePrintException (FileId, AslGbl_NextError, "\n[****iasl****]\n"); + AslGbl_NextError = AslGbl_NextError->Next; } FlPrintFile (FileId, "\n"); @@ -333,9 +333,9 @@ LsWriteListingHexBytes ( { /* Print line header when buffer is empty */ - if (Gbl_CurrentHexColumn == 0) + if (AslGbl_CurrentHexColumn == 0) { - if (Gbl_HasIncludeFiles) + if (AslGbl_HasIncludeFiles) { FlPrintFile (FileId, "%*s", 10, " "); } @@ -344,7 +344,7 @@ LsWriteListingHexBytes ( { case ASL_FILE_LISTING_OUTPUT: - FlPrintFile (FileId, "%8.8X%s", Gbl_CurrentAmlOffset, + FlPrintFile (FileId, "%8.8X%s", AslGbl_CurrentAmlOffset, ASL_LISTING_LINE_PREFIX); break; @@ -368,14 +368,14 @@ LsWriteListingHexBytes ( /* Transfer AML byte and update counts */ - Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i]; + AslGbl_AmlBuffer[AslGbl_CurrentHexColumn] = Buffer[i]; - Gbl_CurrentHexColumn++; - Gbl_CurrentAmlOffset++; + AslGbl_CurrentHexColumn++; + AslGbl_CurrentAmlOffset++; /* Flush buffer when it is full */ - if (Gbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE) + if (AslGbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE) { LsFlushListingBuffer (FileId); } @@ -416,7 +416,7 @@ LsWriteSourceLines ( return; } - Gbl_CurrentLine = ToLogicalLineNumber; + AslGbl_CurrentLine = ToLogicalLineNumber; /* Flush any hex bytes remaining from the last opcode */ @@ -424,16 +424,16 @@ LsWriteSourceLines ( /* Read lines and write them as long as we are not caught up */ - if (Gbl_SourceLine < Gbl_CurrentLine) + if (AslGbl_SourceLine < AslGbl_CurrentLine) { /* * If we just completed writing some AML hex bytes, output a linefeed * to add some whitespace for readability. */ - if (Gbl_HexBytesWereWritten) + if (AslGbl_HexBytesWereWritten) { FlPrintFile (FileId, "\n"); - Gbl_HexBytesWereWritten = FALSE; + AslGbl_HexBytesWereWritten = FALSE; } if (FileId == ASL_FILE_C_SOURCE_OUTPUT) @@ -443,7 +443,7 @@ LsWriteSourceLines ( /* Write one line at a time until we have reached the target line # */ - while ((Gbl_SourceLine < Gbl_CurrentLine) && + while ((AslGbl_SourceLine < AslGbl_CurrentLine) && LsWriteOneSourceLine (FileId)) { ; } @@ -482,8 +482,8 @@ LsWriteOneSourceLine ( BOOLEAN ProcessLongLine = FALSE; - Gbl_SourceLine++; - Gbl_ListingNode->LineNumber++; + AslGbl_SourceLine++; + AslGbl_ListingNode->LineNumber++; /* Ignore lines that are completely blank (but count the line above) */ @@ -512,21 +512,21 @@ LsWriteOneSourceLine ( FlPrintFile (FileId, "; "); } - if (Gbl_HasIncludeFiles) + if (AslGbl_HasIncludeFiles) { /* * This file contains "include" statements, print the current * filename and line number within the current file */ FlPrintFile (FileId, "%12s %5d%s", - Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber, + AslGbl_ListingNode->Filename, AslGbl_ListingNode->LineNumber, ASL_LISTING_LINE_PREFIX); } else { /* No include files, just print the line number */ - FlPrintFile (FileId, "%8u%s", Gbl_SourceLine, + FlPrintFile (FileId, "%8u%s", AslGbl_SourceLine, ASL_LISTING_LINE_PREFIX); } @@ -601,7 +601,7 @@ WriteByte: * Check if an error occurred on this source line during the compile. * If so, we print the error message after the source line. */ - LsCheckException (Gbl_SourceLine, FileId); + LsCheckException (AslGbl_SourceLine, FileId); return (1); } } @@ -615,7 +615,7 @@ WriteByte: * Check if an error occurred on this source line during the compile. * If so, we print the error message after the source line. */ - LsCheckException (Gbl_SourceLine, FileId); + LsCheckException (AslGbl_SourceLine, FileId); return (1); } } @@ -649,7 +649,7 @@ LsFlushListingBuffer ( UINT32 i; - if (Gbl_CurrentHexColumn == 0) + if (AslGbl_CurrentHexColumn == 0) { return; } @@ -660,58 +660,58 @@ LsFlushListingBuffer ( { case ASL_FILE_LISTING_OUTPUT: - for (i = 0; i < Gbl_CurrentHexColumn; i++) + for (i = 0; i < AslGbl_CurrentHexColumn; i++) { - FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]); + FlPrintFile (FileId, "%2.2X ", AslGbl_AmlBuffer[i]); } - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 3); i++) + for (i = 0; i < ((HEX_LISTING_LINE_SIZE - AslGbl_CurrentHexColumn) * 3); i++) { FlWriteFile (FileId, ".", 1); } /* Write the ASCII character associated with each of the bytes */ - LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); + LsDumpAscii (FileId, AslGbl_CurrentHexColumn, AslGbl_AmlBuffer); break; case ASL_FILE_ASM_SOURCE_OUTPUT: - for (i = 0; i < Gbl_CurrentHexColumn; i++) + for (i = 0; i < AslGbl_CurrentHexColumn; i++) { if (i > 0) { FlPrintFile (FileId, ","); } - FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]); + FlPrintFile (FileId, "0%2.2Xh", AslGbl_AmlBuffer[i]); } - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) + for (i = 0; i < ((HEX_LISTING_LINE_SIZE - AslGbl_CurrentHexColumn) * 5); i++) { FlWriteFile (FileId, " ", 1); } FlPrintFile (FileId, " ;%8.8X", - Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); + AslGbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); /* Write the ASCII character associated with each of the bytes */ - LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); + LsDumpAscii (FileId, AslGbl_CurrentHexColumn, AslGbl_AmlBuffer); break; case ASL_FILE_C_SOURCE_OUTPUT: - for (i = 0; i < Gbl_CurrentHexColumn; i++) + for (i = 0; i < AslGbl_CurrentHexColumn; i++) { - FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]); + FlPrintFile (FileId, "0x%2.2X,", AslGbl_AmlBuffer[i]); } /* Pad hex output with spaces if line is shorter than max line size */ - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) + for (i = 0; i < ((HEX_LISTING_LINE_SIZE - AslGbl_CurrentHexColumn) * 5); i++) { FlWriteFile (FileId, " ", 1); } @@ -719,11 +719,11 @@ LsFlushListingBuffer ( /* AML offset for the start of the line */ FlPrintFile (FileId, " /* %8.8X", - Gbl_CurrentAmlOffset - Gbl_CurrentHexColumn); + AslGbl_CurrentAmlOffset - AslGbl_CurrentHexColumn); /* Write the ASCII character associated with each of the bytes */ - LsDumpAsciiInComment (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); + LsDumpAsciiInComment (FileId, AslGbl_CurrentHexColumn, AslGbl_AmlBuffer); FlPrintFile (FileId, " */"); break; @@ -736,8 +736,8 @@ LsFlushListingBuffer ( FlPrintFile (FileId, "\n"); - Gbl_CurrentHexColumn = 0; - Gbl_HexBytesWereWritten = TRUE; + AslGbl_CurrentHexColumn = 0; + AslGbl_HexBytesWereWritten = TRUE; } @@ -774,8 +774,8 @@ LsPushNode ( /* Link (push) */ - Lnode->Next = Gbl_ListingNode; - Gbl_ListingNode = Lnode; + Lnode->Next = AslGbl_ListingNode; + AslGbl_ListingNode = Lnode; } @@ -801,19 +801,19 @@ LsPopNode ( /* Just grab the node at the head of the list */ - Lnode = Gbl_ListingNode; + Lnode = AslGbl_ListingNode; if ((!Lnode) || (!Lnode->Next)) { AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, "Could not pop empty listing stack"); - return (Gbl_ListingNode); + return (AslGbl_ListingNode); } - Gbl_ListingNode = Lnode->Next; + AslGbl_ListingNode = Lnode->Next; ACPI_FREE (Lnode); /* New "Current" node is the new head */ - return (Gbl_ListingNode); + return (AslGbl_ListingNode); } diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index 95fea9cd0..5bb0a8515 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -731,7 +731,7 @@ LdNamespace1Begin ( * 10/2015. */ if ((Node->Flags & ANOBJ_IS_EXTERNAL) && - (ACPI_COMPARE_NAME (Gbl_TableSignature, "DSDT"))) + (ACPI_COMPARE_NAME (AslGbl_TableSignature, "DSDT"))) { /* However, allowed if the reference is within a method */ @@ -777,9 +777,9 @@ LdNamespace1Begin ( * Which is used to workaround the fact that the MS interpreter * does not allow Scope() forward references. */ - sprintf (MsgBuffer, "%s [%s], changing type to [Scope]", + sprintf (AslGbl_MsgBuffer, "%s [%s], changing type to [Scope]", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); + AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer); /* Switch the type to scope, open the new scope */ @@ -796,9 +796,9 @@ LdNamespace1Begin ( /* All other types are an error */ - sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName, + sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer); /* * However, switch the type to be an actual scope so @@ -899,9 +899,9 @@ LdNamespace1Begin ( } else { - sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName, + sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer); return_ACPI_STATUS (AE_OK); } } diff --git a/source/compiler/asllookup.c b/source/compiler/asllookup.c index a1c0d7fc0..16203c81e 100644 --- a/source/compiler/asllookup.c +++ b/source/compiler/asllookup.c @@ -252,9 +252,9 @@ LkIsObjectUsed ( if ((MethodLocals[i].Flags & ASL_LOCAL_INITIALIZED) && (!(MethodLocals[i].Flags & ASL_LOCAL_REFERENCED))) { - sprintf (MsgBuffer, "Local%u", i); + sprintf (AslGbl_MsgBuffer, "Local%u", i); AslError (ASL_WARNING, ASL_MSG_LOCAL_NOT_USED, - MethodLocals[i].Op, MsgBuffer); + MethodLocals[i].Op, AslGbl_MsgBuffer); } } @@ -271,9 +271,9 @@ LkIsObjectUsed ( if ((MethodArgs[i].Flags & ASL_ARG_INITIALIZED) && (!(MethodArgs[i].Flags & ASL_ARG_REFERENCED))) { - sprintf (MsgBuffer, "Arg%u", i); + sprintf (AslGbl_MsgBuffer, "Arg%u", i); AslError (ASL_WARNING, ASL_MSG_ARG_AS_LOCAL_NOT_USED, - MethodArgs[i].Op, MsgBuffer); + MethodArgs[i].Op, AslGbl_MsgBuffer); } } else @@ -286,9 +286,9 @@ LkIsObjectUsed ( if ((Node->Name.Ascii[0] != '_') && (!(MethodArgs[i].Flags & ASL_ARG_REFERENCED))) { - sprintf (MsgBuffer, "Arg%u", i); + sprintf (AslGbl_MsgBuffer, "Arg%u", i); AslError (ASL_REMARK, ASL_MSG_ARG_NOT_USED, - MethodArgs[i].Op, MsgBuffer); + MethodArgs[i].Op, AslGbl_MsgBuffer); } } } @@ -336,10 +336,10 @@ LkIsObjectUsed ( * Issue a remark even if it is a reserved name (starts * with an underscore). */ - sprintf (MsgBuffer, "Name [%4.4s] is within a method [%4.4s]", + sprintf (AslGbl_MsgBuffer, "Name [%4.4s] is within a method [%4.4s]", Node->Name.Ascii, Next->Name.Ascii); AslError (ASL_REMARK, ASL_MSG_NOT_REFERENCED, - LkGetNameOp (Node->Op), MsgBuffer); + LkGetNameOp (Node->Op), AslGbl_MsgBuffer); return (AE_OK); } diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 227e6f316..4f24bb3e9 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -236,12 +236,12 @@ main ( /* Allocate the line buffer(s), must be after command line */ - Gbl_LineBufferSize /= 2; + AslGbl_LineBufferSize /= 2; UtExpandLineBuffers (); /* Perform global actions first/only */ - if (Gbl_DisassembleAll) + if (AslGbl_DisassembleAll) { while (argv[Index1]) { @@ -264,10 +264,10 @@ main ( * If -p not specified, we will use the input filename as the * output filename prefix */ - if (Gbl_UseDefaultAmlFilename) + if (AslGbl_UseDefaultAmlFilename) { - Gbl_OutputFilenamePrefix = argv[Index2]; - UtConvertBackslashes (Gbl_OutputFilenamePrefix); + AslGbl_OutputFilenamePrefix = argv[Index2]; + UtConvertBackslashes (AslGbl_OutputFilenamePrefix); } Status = AslDoOneFile (argv[Index2]); @@ -337,7 +337,7 @@ AslSignalHandler ( * Close all open files * Note: the .pre file is the same as the input source file */ - Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; + AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { @@ -385,13 +385,13 @@ AslInitialize ( for (i = 0; i < ASL_NUM_FILES; i++) { - Gbl_Files[i].Handle = NULL; - Gbl_Files[i].Filename = NULL; + AslGbl_Files[i].Handle = NULL; + AslGbl_Files[i].Filename = NULL; } - Gbl_Files[ASL_FILE_STDOUT].Handle = stdout; - Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; + AslGbl_Files[ASL_FILE_STDOUT].Handle = stdout; + AslGbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; - Gbl_Files[ASL_FILE_STDERR].Handle = stderr; - Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; + AslGbl_Files[ASL_FILE_STDERR].Handle = stderr; + AslGbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; } diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index 0b6e08826..6bc81c7cd 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -233,17 +233,18 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* AML Opcode Value Flags Btype */ -/* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0), -/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK, 0, 0), -/* ACCESSATTRIB_BLOCK_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK_CALL, 0, 0), -/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BYTE, 0, 0), -/* ACCESSATTRIB_MULTIBYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_MULTIBYTE, 0, 0), -/* ACCESSATTRIB_QUICK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_QUICK, 0, 0), -/* ACCESSATTRIB_RAW_BYTES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_RAW_BYTES, 0, 0), -/* ACCESSATTRIB_RAW_PROCESS */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_RAW_PROCESS, 0, 0), -/* ACCESSATTRIB_SND_RCV */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SEND_RCV, 0, 0), -/* ACCESSATTRIB_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_WORD, 0, 0), -/* ACCESSATTRIB_WORD_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_WORD_CALL, 0, 0), +/* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0), +/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK, 0, 0), +/* ACCESSATTRIB_BLOCK_PROCESS_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK_PROCESS_CALL, 0, 0), +/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BYTE, 0, 0), +/* ACCESSATTRIB_BYTES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BYTES, 0, 0), +/* ACCESSATTRIB_QUICK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_QUICK, 0, 0), +/* ACCESSATTRIB_RAW_BYTES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_RAW_BYTES, 0, 0), +/* ACCESSATTRIB_RAW_PROCESS_BYTES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_RAW_PROCESS_BYTES, 0, 0), +/* ACCESSATTRIB_SEND_RECEIVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SEND_RECEIVE, 0, 0), +/* ACCESSATTRIB_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_WORD, 0, 0), +/* ACCESSATTRIB_PROCESS_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_PROCESS_CALL, 0, 0), + /* ACCESSTYPE_ANY */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_ANY, 0, 0), /* ACCESSTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BUFFER, 0, 0), /* ACCESSTYPE_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BYTE, 0, 0), diff --git a/source/compiler/aslmapenter.c b/source/compiler/aslmapenter.c index 4643b7b3c..c7f443b5b 100644 --- a/source/compiler/aslmapenter.c +++ b/source/compiler/aslmapenter.c @@ -204,7 +204,7 @@ MpSaveGpioInfo ( /* Mapfile option enabled? */ - if (!Gbl_MapfileFlag) + if (!AslGbl_MapfileFlag) { return; } @@ -255,7 +255,7 @@ MpSaveSerialInfo ( /* Mapfile option enabled? */ - if (!Gbl_MapfileFlag) + if (!AslGbl_MapfileFlag) { return; } @@ -335,11 +335,11 @@ MpCreateGpioInfo ( Buffer = UtLocalCacheCalloc (sizeof (ACPI_GPIO_INFO)); Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Buffer); - NextGpio = Gbl_GpioList; + NextGpio = AslGbl_GpioList; PrevGpio = NULL; - if (!Gbl_GpioList) + if (!AslGbl_GpioList) { - Gbl_GpioList = Info; + AslGbl_GpioList = Info; Info->Next = NULL; return (Info); } @@ -371,7 +371,7 @@ MpCreateGpioInfo ( } else { - Gbl_GpioList = Info; + AslGbl_GpioList = Info; } Info->Next = NextGpio; @@ -412,11 +412,11 @@ MpCreateSerialInfo ( Buffer = UtLocalCacheCalloc (sizeof (ACPI_SERIAL_INFO)); Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO, Buffer); - NextSerial = Gbl_SerialList; + NextSerial = AslGbl_SerialList; PrevSerial = NULL; - if (!Gbl_SerialList) + if (!AslGbl_SerialList) { - Gbl_SerialList = Info; + AslGbl_SerialList = Info; Info->Next = NULL; return (Info); } @@ -448,7 +448,7 @@ MpCreateSerialInfo ( } else { - Gbl_SerialList = Info; + AslGbl_SerialList = Info; } Info->Next = NextSerial; diff --git a/source/compiler/aslmapoutput.c b/source/compiler/aslmapoutput.c index 715634da7..baa2f6245 100644 --- a/source/compiler/aslmapoutput.c +++ b/source/compiler/aslmapoutput.c @@ -237,24 +237,24 @@ MpEmitMappingInfo ( /* Mapfile option enabled? */ - if (!Gbl_MapfileFlag) + if (!AslGbl_MapfileFlag) { return; } - if (!Gbl_GpioList) + if (!AslGbl_GpioList) { FlPrintFile (ASL_FILE_MAP_OUTPUT, "\nNo GPIO devices found\n"); } - if (!Gbl_SerialList) + if (!AslGbl_SerialList) { FlPrintFile (ASL_FILE_MAP_OUTPUT, "\nNo Serial devices found (I2C/SPI/UART)\n"); } - if (!Gbl_GpioList && !Gbl_SerialList) + if (!AslGbl_GpioList && !AslGbl_SerialList) { return; } @@ -272,8 +272,8 @@ MpEmitMappingInfo ( /* Clear the lists - no need to free memory here */ - Gbl_SerialList = NULL; - Gbl_GpioList = NULL; + AslGbl_SerialList = NULL; + AslGbl_GpioList = NULL; } @@ -307,7 +307,7 @@ MpEmitGpioInfo ( /* Walk the GPIO descriptor list */ - Info = Gbl_GpioList; + Info = AslGbl_GpioList; while (Info) { HidString = MpGetHidViaNamestring (Info->DeviceName); @@ -440,7 +440,7 @@ MpEmitSerialInfo ( /* Walk the constructed serial descriptor list */ - Info = Gbl_SerialList; + Info = AslGbl_SerialList; while (Info) { Resource = Info->Resource; @@ -641,7 +641,7 @@ MpXrefDevices ( /* Walk the entire parse tree */ - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, MpNamespaceXrefBegin, NULL, Info); if (!Info->References) diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index 25f7b0628..efa58cb50 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -496,7 +496,7 @@ AeDecodeExceptionLevel ( /* Differentiate the string type to be used (IDE is all lower case) */ - if (Gbl_VerboseErrors) + if (AslGbl_VerboseErrors) { return (AslErrorLevel[Level]); } diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c index e032348fd..ba4204d8f 100644 --- a/source/compiler/aslmethod.c +++ b/source/compiler/aslmethod.c @@ -203,7 +203,7 @@ MtMethodAnalysisWalkBegin ( /* Build cross-reference output file if requested */ - if (Gbl_CrossReferenceOutput) + if (AslGbl_CrossReferenceOutput) { OtXrefWalkPart1 (Op, Level, MethodInfo); } @@ -212,7 +212,7 @@ MtMethodAnalysisWalkBegin ( { case PARSEOP_METHOD: - TotalMethods++; + AslGbl_TotalMethods++; /* Create and init method info */ @@ -249,11 +249,11 @@ MtMethodAnalysisWalkBegin ( if (!ApFindNameInScope (METHOD_NAME__PS0, Op)) { - sprintf (MsgBuffer, + sprintf (AslGbl_MsgBuffer, "%4.4s requires _PS0 in same scope", Op->Asl.NameSeg); AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - MsgBuffer); + AslGbl_MsgBuffer); } } diff --git a/source/compiler/aslnamesp.c b/source/compiler/aslnamesp.c index ccaf4fbf9..291820c2c 100644 --- a/source/compiler/aslnamesp.c +++ b/source/compiler/aslnamesp.c @@ -191,8 +191,8 @@ NsSetupNamespaceListing ( void *Handle) { - Gbl_NsOutputFlag = TRUE; - Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle; + AslGbl_NsOutputFlag = TRUE; + AslGbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle; } @@ -217,12 +217,12 @@ NsDisplayNamespace ( ACPI_STATUS Status; - if (!Gbl_NsOutputFlag) + if (!AslGbl_NsOutputFlag) { return (AE_OK); } - Gbl_NumNamespaceObjects = 0; + AslGbl_NumNamespaceObjects = 0; /* File header */ @@ -272,10 +272,10 @@ NsDoOneNamespaceObject ( ACPI_PARSE_OBJECT *Op; - Gbl_NumNamespaceObjects++; + AslGbl_NumNamespaceObjects++; FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s", - Gbl_NumNamespaceObjects, Level, (Level * 3), " ", + AslGbl_NumNamespaceObjects, Level, (Level * 3), " ", &Node->Name, AcpiUtGetTypeName (Node->Type)); Op = Node->Op; diff --git a/source/compiler/asloffset.c b/source/compiler/asloffset.c index c98a9efd6..d108f17da 100644 --- a/source/compiler/asloffset.c +++ b/source/compiler/asloffset.c @@ -221,7 +221,7 @@ LsAmlOffsetWalk ( Node = Op->Asl.Node; if (!Node) { - Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength; + AslGbl_CurrentAmlOffset += Op->Asl.FinalAmlLength; return (AE_OK); } @@ -230,10 +230,10 @@ LsAmlOffsetWalk ( if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE) && (Op->Asl.CompileFlags & OP_IS_RESOURCE_DESC)) { - LsEmitOffsetTableEntry (FileId, Node, 0, Gbl_CurrentAmlOffset, + LsEmitOffsetTableEntry (FileId, Node, 0, AslGbl_CurrentAmlOffset, Op->Asl.ParseOpName, 0, Op->Asl.Extra, AML_BUFFER_OP); - Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength; + AslGbl_CurrentAmlOffset += Op->Asl.FinalAmlLength; return (AE_OK); } @@ -245,7 +245,7 @@ LsAmlOffsetWalk ( if (!Op->Asl.Child) { - FlPrintFile (FileId, "%s NO CHILD!\n", MsgBuffer); + FlPrintFile (FileId, "%s NO CHILD!\n", AslGbl_MsgBuffer); return (AE_OK); } @@ -257,10 +257,10 @@ LsAmlOffsetWalk ( /* Get offset of last nameseg and the actual data */ - NamepathOffset = Gbl_CurrentAmlOffset + Length + + NamepathOffset = AslGbl_CurrentAmlOffset + Length + (Op->Asl.FinalAmlLength - ACPI_NAME_SIZE); - DataOffset = Gbl_CurrentAmlOffset + Length + + DataOffset = AslGbl_CurrentAmlOffset + Length + Op->Asl.FinalAmlLength; /* Get actual value associated with the name */ @@ -307,7 +307,7 @@ LsAmlOffsetWalk ( break; } - Gbl_CurrentAmlOffset += Length; + AslGbl_CurrentAmlOffset += Length; return (AE_OK); case AML_REGION_OP: @@ -322,10 +322,10 @@ LsAmlOffsetWalk ( /* Get offset of last nameseg and the actual data */ - NamepathOffset = Gbl_CurrentAmlOffset + Length + + NamepathOffset = AslGbl_CurrentAmlOffset + Length + (NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE); - DataOffset = Gbl_CurrentAmlOffset + Length + + DataOffset = AslGbl_CurrentAmlOffset + Length + (NextOp->Asl.FinalAmlLength + 1); /* Get the SpaceId node, then the Offset (address) node */ @@ -349,7 +349,7 @@ LsAmlOffsetWalk ( Op->Asl.ParseOpName, NextOp->Asl.Value.Integer, (UINT8) NextOp->Asl.AmlOpcode, AML_REGION_OP); - Gbl_CurrentAmlOffset += Length; + AslGbl_CurrentAmlOffset += Length; return (AE_OK); default: @@ -369,10 +369,10 @@ LsAmlOffsetWalk ( /* Get offset of last nameseg and the actual data (flags byte) */ - NamepathOffset = Gbl_CurrentAmlOffset + Length + + NamepathOffset = AslGbl_CurrentAmlOffset + Length + (NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE); - DataOffset = Gbl_CurrentAmlOffset + Length + + DataOffset = AslGbl_CurrentAmlOffset + Length + NextOp->Asl.FinalAmlLength; /* Get the flags byte Op */ @@ -393,10 +393,10 @@ LsAmlOffsetWalk ( /* Get offset of last nameseg and the actual data (PBlock address) */ - NamepathOffset = Gbl_CurrentAmlOffset + Length + + NamepathOffset = AslGbl_CurrentAmlOffset + Length + (NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE); - DataOffset = Gbl_CurrentAmlOffset + Length + + DataOffset = AslGbl_CurrentAmlOffset + Length + (NextOp->Asl.FinalAmlLength + 1); NextOp = NextOp->Asl.Next; /* Get ProcessorID (BYTE) */ @@ -418,7 +418,7 @@ LsAmlOffsetWalk ( /* Get offset of last nameseg */ - NamepathOffset = Gbl_CurrentAmlOffset + Length + + NamepathOffset = AslGbl_CurrentAmlOffset + Length + (NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE); LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, 0, @@ -429,7 +429,7 @@ LsAmlOffsetWalk ( break; } - Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength; + AslGbl_CurrentAmlOffset += Op->Asl.FinalAmlLength; return (AE_OK); } @@ -478,9 +478,9 @@ LsEmitOffsetTableEntry ( /* [1] - Skip the opening backslash for the path */ - strcpy (MsgBuffer, "\""); - strcat (MsgBuffer, &((char *) TargetPath.Pointer)[1]); - strcat (MsgBuffer, "\","); + strcpy (AslGbl_MsgBuffer, "\""); + strcat (AslGbl_MsgBuffer, &((char *) TargetPath.Pointer)[1]); + strcat (AslGbl_MsgBuffer, "\","); ACPI_FREE (TargetPath.Pointer); /* @@ -489,7 +489,7 @@ LsEmitOffsetTableEntry ( */ FlPrintFile (FileId, " {%-29s 0x%4.4X, 0x%8.8X, 0x%2.2X, 0x%8.8X, 0x%8.8X%8.8X}, /* %s */\n", - MsgBuffer, ParentOpcode, NamepathOffset, AmlOpcode, + AslGbl_MsgBuffer, ParentOpcode, NamepathOffset, AmlOpcode, Offset, ACPI_FORMAT_UINT64 (Value), OpName); } @@ -564,7 +564,7 @@ LsDoOffsetTableHeader ( FlPrintFile (FileId, "AML_OFFSET_TABLE_ENTRY %s_%s_OffsetTable[] =\n{\n", - Gbl_TableSignature, Gbl_TableId); + AslGbl_TableSignature, AslGbl_TableId); } @@ -575,5 +575,5 @@ LsDoOffsetTableFooter ( FlPrintFile (FileId, " {NULL,0,0,0,0,0} /* Table terminator */\n};\n\n"); - Gbl_CurrentAmlOffset = 0; + AslGbl_CurrentAmlOffset = 0; } diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index cfcb5e7c1..218223b83 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -239,7 +239,7 @@ OpcAmlOpcodeWalk ( void *Context) { - TotalParseNodes++; + AslGbl_TotalParseNodes++; OpcGenerateAmlOpcode (Op); OpnGenerateAmlOperands (Op); @@ -271,9 +271,9 @@ OpcGetIntegerWidth ( return; } - if (Gbl_RevisionOverride) + if (AslGbl_RevisionOverride) { - AcpiUtSetIntegerWidth (Gbl_RevisionOverride); + AcpiUtSetIntegerWidth (AslGbl_RevisionOverride); } else { @@ -328,7 +328,7 @@ OpcSetOptimalIntegerSize ( * * This optimization is optional. */ - if (Gbl_IntegerOptimizationFlag) + if (AslGbl_IntegerOptimizationFlag) { switch (Op->Asl.Value.Integer) { @@ -404,7 +404,7 @@ OpcSetOptimalIntegerSize ( AslError (ASL_WARNING, ASL_MSG_INTEGER_LENGTH, Op, NULL); - if (!Gbl_IgnoreErrors) + if (!AslGbl_IgnoreErrors) { /* Truncate the integer to 32-bit */ @@ -466,9 +466,9 @@ OpcDoAccessAs ( /* Only a few AccessAttributes support AccessLength */ Attribute = (UINT8) AttribOp->Asl.Value.Integer; - if ((Attribute != AML_FIELD_ATTRIB_MULTIBYTE) && + if ((Attribute != AML_FIELD_ATTRIB_BYTES) && (Attribute != AML_FIELD_ATTRIB_RAW_BYTES) && - (Attribute != AML_FIELD_ATTRIB_RAW_PROCESS)) + (Attribute != AML_FIELD_ATTRIB_RAW_PROCESS_BYTES)) { return; } @@ -924,12 +924,12 @@ OpcGenerateAmlOpcode ( case PARSEOP_INCLUDE: - Gbl_HasIncludeFiles = TRUE; + AslGbl_HasIncludeFiles = TRUE; break; case PARSEOP_EXTERNAL: - if (Gbl_DoExternals == FALSE) + if (AslGbl_DoExternals == FALSE) { Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c index 5bfba4e82..d46d9ff22 100644 --- a/source/compiler/asloperands.c +++ b/source/compiler/asloperands.c @@ -434,11 +434,11 @@ OpnDoFieldCommon ( /* * This Offset() operator is redundant and not needed, * because the offset value is the same as the current - * offset within the field. + * offset. */ AslError (ASL_REMARK, ASL_MSG_OFFSET, PkgLengthNode, NULL); - if (Gbl_OptimizeTrivialParseNodes) + if (AslGbl_OptimizeTrivialParseNodes) { /* * Optimize this Offset() operator by removing/ignoring @@ -450,6 +450,14 @@ OpnDoFieldCommon ( AslError (ASL_OPTIMIZATION, ASL_MSG_OFFSET, PkgLengthNode, "Optimizer has removed statement"); } + else + { + /* Optimization is disabled, treat as a valid Offset */ + + PkgLengthNode->Asl.Value.Integer = + NewBitOffset - CurrentBitOffset; + CurrentBitOffset = NewBitOffset; + } } else { @@ -474,7 +482,7 @@ OpnDoFieldCommon ( if ((NewBitOffset == 0) && (Next->Asl.ParseOpcode == PARSEOP_RESERVED_BYTES) && - Gbl_OptimizeTrivialParseNodes) + AslGbl_OptimizeTrivialParseNodes) { /* * Unnamed field with a bit length of zero. We can @@ -1044,22 +1052,22 @@ OpnDoDefinitionBlock ( Child = Op->Asl.Child; if (Child->Asl.Value.Buffer && *Child->Asl.Value.Buffer && - (Gbl_UseDefaultAmlFilename)) + (AslGbl_UseDefaultAmlFilename)) { /* * We will use the AML filename that is embedded in the source file * for the output filename. */ - Filename = UtLocalCacheCalloc (strlen (Gbl_DirectoryPath) + + Filename = UtLocalCacheCalloc (strlen (AslGbl_DirectoryPath) + strlen ((char *) Child->Asl.Value.Buffer) + 1); /* Prepend the current directory path */ - strcpy (Filename, Gbl_DirectoryPath); + strcpy (Filename, AslGbl_DirectoryPath); strcat (Filename, (char *) Child->Asl.Value.Buffer); - Gbl_OutputFilenamePrefix = Filename; - UtConvertBackslashes (Gbl_OutputFilenamePrefix); + AslGbl_OutputFilenamePrefix = Filename; + UtConvertBackslashes (AslGbl_OutputFilenamePrefix); } Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; @@ -1070,8 +1078,8 @@ OpnDoDefinitionBlock ( Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; if (Child->Asl.Value.String) { - Gbl_TableSignature = Child->Asl.Value.String; - if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE) + AslGbl_TableSignature = Child->Asl.Value.String; + if (strlen (AslGbl_TableSignature) != ACPI_NAME_SIZE) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Length must be exactly 4 characters"); @@ -1079,7 +1087,7 @@ OpnDoDefinitionBlock ( for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (!isalnum ((int) Gbl_TableSignature[i])) + if (!isalnum ((int) AslGbl_TableSignature[i])) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Contains non-alphanumeric characters"); @@ -1120,8 +1128,8 @@ OpnDoDefinitionBlock ( "Length cannot exceed 8 characters"); } - Gbl_TableId = UtLocalCacheCalloc (Length + 1); - strcpy (Gbl_TableId, Child->Asl.Value.String); + AslGbl_TableId = UtLocalCacheCalloc (Length + 1); + strcpy (AslGbl_TableId, Child->Asl.Value.String); /* * Convert anything non-alphanumeric to an underscore. This @@ -1129,9 +1137,9 @@ OpnDoDefinitionBlock ( */ for (i = 0; i < Length; i++) { - if (!isalnum ((int) Gbl_TableId[i])) + if (!isalnum ((int) AslGbl_TableId[i])) { - Gbl_TableId[i] = '_'; + AslGbl_TableId[i] = '_'; } } } diff --git a/source/compiler/aslopt.c b/source/compiler/aslopt.c index 57be9c8cc..4e53a4b0a 100644 --- a/source/compiler/aslopt.c +++ b/source/compiler/aslopt.c @@ -406,7 +406,7 @@ OptBuildShortestPath ( * Construct a new target string */ NewPathExternal = - ACPI_ALLOCATE_ZEROED (TargetPath->Length + NumCarats + 1); + UtLocalCacheCalloc (TargetPath->Length + NumCarats + 1); /* Insert the Carats into the Target string */ @@ -679,7 +679,7 @@ OptOptimizeNamePath ( /* This is an optional optimization */ - if (!Gbl_ReferenceOptimizationFlag) + if (!AslGbl_ReferenceOptimizationFlag) { return_VOID; } diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 0f575c8ab..15519634a 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -212,7 +212,7 @@ AslCommandLine ( BadCommandLine = AslDoOptions (argc, argv, FALSE); - if (Gbl_DoTemplates) + if (AslGbl_DoTemplates) { Status = DtCreateTemplates (argv); if (ACPI_FAILURE (Status)) @@ -231,10 +231,10 @@ AslCommandLine ( BadCommandLine = TRUE; } - if (Gbl_DoSignon) + if (AslGbl_DoSignon) { printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); - if (Gbl_IgnoreErrors) + if (AslGbl_IgnoreErrors) { printf ("Ignoring all errors, forcing AML file generation\n\n"); } @@ -297,7 +297,7 @@ AslDoOptions ( { case 'r': - Gbl_EnableReferenceTypechecking = TRUE; + AslGbl_EnableReferenceTypechecking = TRUE; break; default: @@ -318,16 +318,16 @@ AslDoOptions ( printf ("Debug ASL to ASL+ conversion\n"); - Gbl_DoAslConversion = TRUE; - Gbl_FoldConstants = FALSE; - Gbl_IntegerOptimizationFlag = FALSE; - Gbl_ReferenceOptimizationFlag = FALSE; - Gbl_OptimizeTrivialParseNodes = FALSE; + AslGbl_DoAslConversion = TRUE; + AslGbl_FoldConstants = FALSE; + AslGbl_IntegerOptimizationFlag = FALSE; + AslGbl_ReferenceOptimizationFlag = FALSE; + AslGbl_OptimizeTrivialParseNodes = FALSE; AcpiGbl_CaptureComments = TRUE; AcpiGbl_DoDisassemblerOptimizations = FALSE; AcpiGbl_DebugAslConversion = TRUE; AcpiGbl_DmEmitExternalOpcodes = TRUE; - Gbl_DoExternalsInPlace = TRUE; + AslGbl_DoExternalsInPlace = TRUE; return (0); @@ -336,8 +336,8 @@ AslDoOptions ( AslCompilerdebug = 1; /* same as yydebug */ DtParserdebug = 1; PrParserdebug = 1; - Gbl_DebugFlag = TRUE; - Gbl_KeepPreprocessorTempFile = TRUE; + AslGbl_DebugFlag = TRUE; + AslGbl_KeepPreprocessorTempFile = TRUE; break; case 'p': /* Prune ASL parse tree */ @@ -349,13 +349,13 @@ AslDoOptions ( return (-1); } - Gbl_PruneParseTree = TRUE; - Gbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); + AslGbl_PruneParseTree = TRUE; + AslGbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); break; case 's': - Gbl_DebugFlag = TRUE; + AslGbl_DebugFlag = TRUE; break; case 't': @@ -367,7 +367,7 @@ AslDoOptions ( return (-1); } - Gbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); + AslGbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); break; default: @@ -386,21 +386,21 @@ AslDoOptions ( case 'a': printf ("Convert ASL to ASL+ with comments\n"); - Gbl_DoAslConversion = TRUE; - Gbl_FoldConstants = FALSE; - Gbl_IntegerOptimizationFlag = FALSE; - Gbl_ReferenceOptimizationFlag = FALSE; - Gbl_OptimizeTrivialParseNodes = FALSE; + AslGbl_DoAslConversion = TRUE; + AslGbl_FoldConstants = FALSE; + AslGbl_IntegerOptimizationFlag = FALSE; + AslGbl_ReferenceOptimizationFlag = FALSE; + AslGbl_OptimizeTrivialParseNodes = FALSE; AcpiGbl_CaptureComments = TRUE; AcpiGbl_DoDisassemblerOptimizations = FALSE; AcpiGbl_DmEmitExternalOpcodes = TRUE; - Gbl_DoExternalsInPlace = TRUE; + AslGbl_DoExternalsInPlace = TRUE; return (0); case 'r': - Gbl_NoResourceChecking = TRUE; + AslGbl_NoResourceChecking = TRUE; break; default: @@ -416,13 +416,13 @@ AslDoOptions ( { case '^': - Gbl_DoCompile = FALSE; + AslGbl_DoCompile = FALSE; break; case 'a': - Gbl_DoCompile = FALSE; - Gbl_DisassembleAll = TRUE; + AslGbl_DoCompile = FALSE; + AslGbl_DisassembleAll = TRUE; break; case 'b': /* Do not convert buffers to resource descriptors */ @@ -441,7 +441,7 @@ AslDoOptions ( case 'l': /* Use legacy ASL code (not ASL+) for disassembly */ - Gbl_DoCompile = FALSE; + AslGbl_DoCompile = FALSE; AcpiGbl_CstyleDisassembly = FALSE; break; @@ -487,7 +487,7 @@ AslDoOptions ( { case '^': /* Ignore errors and force creation of aml file */ - Gbl_IgnoreErrors = TRUE; + AslGbl_IgnoreErrors = TRUE; break; case 'e': /* Disassembler: Get external declaration file */ @@ -497,7 +497,7 @@ AslDoOptions ( return (-1); } - Gbl_ExternalRefFilename = AcpiGbl_Optarg; + AslGbl_ExternalRefFilename = AcpiGbl_Optarg; break; default: @@ -509,7 +509,7 @@ AslDoOptions ( case 'G': - Gbl_CompileGeneric = TRUE; + AslGbl_CompileGeneric = TRUE; break; case 'g': /* Get all ACPI tables */ @@ -572,14 +572,14 @@ AslDoOptions ( /* Produce assembly code include file */ - Gbl_AsmIncludeOutputFlag = TRUE; + AslGbl_AsmIncludeOutputFlag = TRUE; break; case 'c': /* Produce C include file */ - Gbl_C_IncludeOutputFlag = TRUE; + AslGbl_C_IncludeOutputFlag = TRUE; break; case 'n': @@ -604,7 +604,7 @@ AslDoOptions ( /* Produce listing file (Mixed source/aml) */ - Gbl_ListingFlag = TRUE; + AslGbl_ListingFlag = TRUE; AcpiGbl_DmOpt_Listing = TRUE; break; @@ -612,35 +612,35 @@ AslDoOptions ( /* Produce preprocessor output file */ - Gbl_PreprocessorOutputFlag = TRUE; + AslGbl_PreprocessorOutputFlag = TRUE; break; case 'm': /* Produce hardware map summary file */ - Gbl_MapfileFlag = TRUE; + AslGbl_MapfileFlag = TRUE; break; case 'n': /* Produce namespace file */ - Gbl_NsOutputFlag = TRUE; + AslGbl_NsOutputFlag = TRUE; break; case 's': /* Produce combined source file */ - Gbl_SourceOutputFlag = TRUE; + AslGbl_SourceOutputFlag = TRUE; break; case 'x': /* Produce cross-reference file */ - Gbl_CrossReferenceOutput = TRUE; + AslGbl_CrossReferenceOutput = TRUE; break; default: @@ -652,17 +652,17 @@ AslDoOptions ( case 'm': /* Set line buffer size */ - Gbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024; - if (Gbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE) + AslGbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024; + if (AslGbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE) { - Gbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE; + AslGbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE; } - printf ("Line Buffer Size: %u\n", Gbl_LineBufferSize); + printf ("Line Buffer Size: %u\n", AslGbl_LineBufferSize); break; case 'n': /* Parse only */ - Gbl_ParseOnlyFlag = TRUE; + AslGbl_ParseOnlyFlag = TRUE; break; case 'o': /* Control compiler AML optimizations */ @@ -673,10 +673,10 @@ AslDoOptions ( /* Disable all optimizations */ - Gbl_FoldConstants = FALSE; - Gbl_IntegerOptimizationFlag = FALSE; - Gbl_ReferenceOptimizationFlag = FALSE; - Gbl_OptimizeTrivialParseNodes = FALSE; + AslGbl_FoldConstants = FALSE; + AslGbl_IntegerOptimizationFlag = FALSE; + AslGbl_ReferenceOptimizationFlag = FALSE; + AslGbl_OptimizeTrivialParseNodes = FALSE; break; @@ -684,7 +684,7 @@ AslDoOptions ( /* Display compile time(s) */ - Gbl_CompileTimesFlag = TRUE; + AslGbl_CompileTimesFlag = TRUE; break; case 'd': @@ -708,35 +708,35 @@ AslDoOptions ( * No affect if Gbl_DoExternals is false. */ - Gbl_DoExternalsInPlace = TRUE; + AslGbl_DoExternalsInPlace = TRUE; break; case 'f': /* Disable folding on "normal" expressions */ - Gbl_FoldConstants = FALSE; + AslGbl_FoldConstants = FALSE; break; case 'i': /* Disable integer optimization to constants */ - Gbl_IntegerOptimizationFlag = FALSE; + AslGbl_IntegerOptimizationFlag = FALSE; break; case 'n': /* Disable named reference optimization */ - Gbl_ReferenceOptimizationFlag = FALSE; + AslGbl_ReferenceOptimizationFlag = FALSE; break; case 't': /* Disable heavy typechecking */ - Gbl_DoTypechecking = FALSE; + AslGbl_DoTypechecking = FALSE; break; default: @@ -752,13 +752,13 @@ AslDoOptions ( { case '^': /* Proprocess only, emit (.i) file */ - Gbl_PreprocessOnly = TRUE; - Gbl_PreprocessorOutputFlag = TRUE; + AslGbl_PreprocessOnly = TRUE; + AslGbl_PreprocessorOutputFlag = TRUE; break; case 'n': /* Disable preprocessor */ - Gbl_PreprocessFlag = FALSE; + AslGbl_PreprocessFlag = FALSE; break; default: @@ -770,25 +770,25 @@ AslDoOptions ( case 'p': /* Override default AML output filename */ - Gbl_OutputFilenamePrefix = AcpiGbl_Optarg; - UtConvertBackslashes (Gbl_OutputFilenamePrefix); - Gbl_UseDefaultAmlFilename = FALSE; + AslGbl_OutputFilenamePrefix = AcpiGbl_Optarg; + UtConvertBackslashes (AslGbl_OutputFilenamePrefix); + AslGbl_UseDefaultAmlFilename = FALSE; break; case 'q': /* ASL/ASl+ converter: compile only and leave badaml. */ printf ("Convert ASL to ASL+ with comments\n"); - Gbl_FoldConstants = FALSE; - Gbl_IntegerOptimizationFlag = FALSE; - Gbl_ReferenceOptimizationFlag = FALSE; - Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_DoExternalsInPlace = TRUE; + AslGbl_FoldConstants = FALSE; + AslGbl_IntegerOptimizationFlag = FALSE; + AslGbl_ReferenceOptimizationFlag = FALSE; + AslGbl_OptimizeTrivialParseNodes = FALSE; + AslGbl_DoExternalsInPlace = TRUE; AcpiGbl_CaptureComments = TRUE; return (0); case 'r': /* Override revision found in table header */ - Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); + AslGbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); break; case 's': /* Create AML in a source code file */ @@ -799,21 +799,21 @@ AslDoOptions ( /* Produce assembly code output file */ - Gbl_AsmOutputFlag = TRUE; + AslGbl_AsmOutputFlag = TRUE; break; case 'c': /* Produce C hex output file */ - Gbl_C_OutputFlag = TRUE; + AslGbl_C_OutputFlag = TRUE; break; case 'o': /* Produce AML offset table in C */ - Gbl_C_OffsetTableFlag = TRUE; + AslGbl_C_OffsetTableFlag = TRUE; break; default: @@ -829,17 +829,17 @@ AslDoOptions ( { case 'a': - Gbl_HexOutputFlag = HEX_OUTPUT_ASM; + AslGbl_HexOutputFlag = HEX_OUTPUT_ASM; break; case 'c': - Gbl_HexOutputFlag = HEX_OUTPUT_C; + AslGbl_HexOutputFlag = HEX_OUTPUT_C; break; case 's': - Gbl_HexOutputFlag = HEX_OUTPUT_ASL; + AslGbl_HexOutputFlag = HEX_OUTPUT_ASL; break; default: @@ -851,7 +851,7 @@ AslDoOptions ( case 'T': /* Create a ACPI table template file */ - Gbl_DoTemplates = TRUE; + AslGbl_DoTemplates = TRUE; break; case 'v': /* Version and verbosity settings */ @@ -867,7 +867,7 @@ AslDoOptions ( /* Disable all error/warning/remark messages */ - Gbl_NoErrors = TRUE; + AslGbl_NoErrors = TRUE; break; case 'd': @@ -880,8 +880,8 @@ AslDoOptions ( /* Disable all warning/remark messages (errors only) */ - Gbl_DisplayRemarks = FALSE; - Gbl_DisplayWarnings = FALSE; + AslGbl_DisplayRemarks = FALSE; + AslGbl_DisplayWarnings = FALSE; break; case 'i': @@ -894,29 +894,29 @@ AslDoOptions ( * 4) Error/warning messages are formatted appropriately to * be recognized by MS Visual Studio */ - Gbl_VerboseErrors = FALSE; - Gbl_DoSignon = FALSE; - Gbl_Files[ASL_FILE_STDERR].Handle = stdout; + AslGbl_VerboseErrors = FALSE; + AslGbl_DoSignon = FALSE; + AslGbl_Files[ASL_FILE_STDERR].Handle = stdout; break; case 'o': - Gbl_DisplayOptimizations = TRUE; + AslGbl_DisplayOptimizations = TRUE; break; case 'r': - Gbl_DisplayRemarks = FALSE; + AslGbl_DisplayRemarks = FALSE; break; case 's': - Gbl_DoSignon = FALSE; + AslGbl_DoSignon = FALSE; break; case 't': - Gbl_VerboseTemplates = TRUE; + AslGbl_VerboseTemplates = TRUE; break; case 'w': @@ -964,22 +964,22 @@ AslDoOptions ( { case '1': - Gbl_WarningLevel = ASL_WARNING; + AslGbl_WarningLevel = ASL_WARNING; break; case '2': - Gbl_WarningLevel = ASL_WARNING2; + AslGbl_WarningLevel = ASL_WARNING2; break; case '3': - Gbl_WarningLevel = ASL_WARNING3; + AslGbl_WarningLevel = ASL_WARNING3; break; case 'e': - Gbl_WarningsAsErrors = TRUE; + AslGbl_WarningsAsErrors = TRUE; break; default: @@ -996,7 +996,7 @@ AslDoOptions ( case 'z': - Gbl_UseOriginalCompilerId = TRUE; + AslGbl_UseOriginalCompilerId = TRUE; break; default: @@ -1056,7 +1056,7 @@ static int AslDoResponseFile ( char *Filename) { - char *argv = StringBuffer2; + char *argv = AslGbl_StringBuffer2; FILE *ResponseFile; int OptStatus = 0; int Opterr; @@ -1080,11 +1080,11 @@ AslDoResponseFile ( * Process all lines in the response file. There must be one complete * option per line */ - while (fgets (StringBuffer, ASL_STRING_BUFFER_SIZE, ResponseFile)) + while (fgets (AslGbl_StringBuffer, ASL_STRING_BUFFER_SIZE, ResponseFile)) { /* Compress all tokens, allowing us to use a single argv entry */ - AslMergeOptionTokens (StringBuffer, StringBuffer2); + AslMergeOptionTokens (AslGbl_StringBuffer, AslGbl_StringBuffer2); /* Process the option */ @@ -1095,7 +1095,7 @@ AslDoResponseFile ( if (OptStatus) { printf ("Invalid option in command file %s: %s\n", - Filename, StringBuffer); + Filename, AslGbl_StringBuffer); break; } } diff --git a/source/compiler/aslparseop.c b/source/compiler/aslparseop.c index 9585e565e..ce5e268ea 100644 --- a/source/compiler/aslparseop.c +++ b/source/compiler/aslparseop.c @@ -205,7 +205,7 @@ TrCreateOp ( { case PARSEOP_ASL_CODE: - Gbl_ParseTreeRoot = Op; + AslGbl_ParseTreeRoot = Op; Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->"); break; @@ -784,11 +784,11 @@ TrAllocateOp ( Op = UtParseOpCacheCalloc (); Op->Asl.ParseOpcode = (UINT16) ParseOpcode; - Op->Asl.Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - Op->Asl.LineNumber = Gbl_CurrentLineNumber; - Op->Asl.LogicalLineNumber = Gbl_LogicalLineNumber; - Op->Asl.LogicalByteOffset = Gbl_CurrentLineOffset; - Op->Asl.Column = Gbl_CurrentColumn; + Op->Asl.Filename = AslGbl_Files[ASL_FILE_INPUT].Filename; + Op->Asl.LineNumber = AslGbl_CurrentLineNumber; + Op->Asl.LogicalLineNumber = AslGbl_LogicalLineNumber; + Op->Asl.LogicalByteOffset = AslGbl_CurrentLineOffset; + Op->Asl.Column = AslGbl_CurrentColumn; UtSetParseOpName (Op); @@ -796,7 +796,7 @@ TrAllocateOp ( if (AcpiGbl_CaptureComments) { - LatestOp = Gbl_CommentState.LatestParseOp; + LatestOp = AslGbl_CommentState.LatestParseOp; Op->Asl.InlineComment = NULL; Op->Asl.EndNodeComment = NULL; Op->Asl.CommentList = NULL; @@ -813,9 +813,9 @@ TrAllocateOp ( { CvDbgPrint ("latest op: %s\n", LatestOp->Asl.ParseOpName); Op->Asl.FileChanged = TRUE; - if (Gbl_IncludeFileStack) + if (AslGbl_IncludeFileStack) { - Op->Asl.ParentFilename = Gbl_IncludeFileStack->Filename; + Op->Asl.ParentFilename = AslGbl_IncludeFileStack->Filename; } else { @@ -823,10 +823,10 @@ TrAllocateOp ( } } - Gbl_CommentState.LatestParseOp = Op; + AslGbl_CommentState.LatestParseOp = Op; CvDbgPrint ("TrAllocateOp=Set latest parse op to this op.\n"); CvDbgPrint (" Op->Asl.ParseOpName = %s\n", - Gbl_CommentState.LatestParseOp->Asl.ParseOpName); + AslGbl_CommentState.LatestParseOp->Asl.ParseOpName); CvDbgPrint (" Op->Asl.ParseOpcode = 0x%x\n", ParseOpcode); if (Op->Asl.FileChanged) @@ -843,23 +843,23 @@ TrAllocateOp ( (ParseOpcode != PARSEOP_DEFINITION_BLOCK)) { CvDbgPrint ("Parsing paren/Brace op now!\n"); - Gbl_CommentState.ParsingParenBraceNode = Op; + AslGbl_CommentState.ParsingParenBraceNode = Op; } - if (Gbl_CommentListHead) + if (AslGbl_CommentListHead) { CvDbgPrint ("Transferring...\n"); - Op->Asl.CommentList = Gbl_CommentListHead; - Gbl_CommentListHead = NULL; - Gbl_CommentListTail = NULL; + Op->Asl.CommentList = AslGbl_CommentListHead; + AslGbl_CommentListHead = NULL; + AslGbl_CommentListTail = NULL; CvDbgPrint (" Transferred current comment list to this op.\n"); CvDbgPrint (" %s\n", Op->Asl.CommentList->Comment); } - if (Gbl_InlineCommentBuffer) + if (AslGbl_InlineCommentBuffer) { - Op->Asl.InlineComment = Gbl_InlineCommentBuffer; - Gbl_InlineCommentBuffer = NULL; + Op->Asl.InlineComment = AslGbl_InlineCommentBuffer; + AslGbl_InlineCommentBuffer = NULL; CvDbgPrint ("Transferred current inline comment list to this op.\n"); } } @@ -894,7 +894,7 @@ TrPrintOpFlags ( { if (Flags & FlagBit) { - DbgPrint (OutputLevel, " %s", Gbl_OpFlagNames[i]); + DbgPrint (OutputLevel, " %s", AslGbl_OpFlagNames[i]); } FlagBit <<= 1; diff --git a/source/compiler/aslpld.c b/source/compiler/aslpld.c index ef87017e8..e9b49ac36 100644 --- a/source/compiler/aslpld.c +++ b/source/compiler/aslpld.c @@ -728,11 +728,7 @@ OpcEncodePldBuffer ( UINT32 Dword; - Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE); - if (!Buffer) - { - return (NULL); - } + Buffer = ACPI_CAST_PTR (UINT32, UtLocalCacheCalloc (ACPI_PLD_BUFFER_SIZE)); /* First 32 bits */ diff --git a/source/compiler/aslpredef.c b/source/compiler/aslpredef.c index ce1814c24..bc30fe910 100644 --- a/source/compiler/aslpredef.c +++ b/source/compiler/aslpredef.c @@ -216,16 +216,16 @@ ApCheckForPredefinedMethod ( case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */ - Gbl_ReservedMethods++; + AslGbl_ReservedMethods++; /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */ if (MethodInfo->NumArguments != 0) { - sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0); + sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0); AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, - MsgBuffer); + AslGbl_MsgBuffer); } break; @@ -238,25 +238,25 @@ ApCheckForPredefinedMethod ( * Some methods are allowed to have a "minimum" number of args * (_SCP) because their definition in ACPI has changed over time. */ - Gbl_ReservedMethods++; + AslGbl_ReservedMethods++; ThisName = &AcpiGbl_PredefinedMethods[Index]; RequiredArgCount = METHOD_GET_ARG_COUNT (ThisName->Info.ArgumentList); if (MethodInfo->NumArguments != RequiredArgCount) { - sprintf (MsgBuffer, "%4.4s requires %u", + sprintf (AslGbl_MsgBuffer, "%4.4s requires %u", ThisName->Info.Name, RequiredArgCount); if (MethodInfo->NumArguments < RequiredArgCount) { AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, - MsgBuffer); + AslGbl_MsgBuffer); } else if ((MethodInfo->NumArguments > RequiredArgCount) && !(ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) { AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, - MsgBuffer); + AslGbl_MsgBuffer); } } @@ -267,14 +267,14 @@ ApCheckForPredefinedMethod ( if (MethodInfo->NumReturnNoValue && ThisName->Info.ExpectedBtypes) { - AcpiUtGetExpectedReturnTypes (StringBuffer, + AcpiUtGetExpectedReturnTypes (AslGbl_StringBuffer, ThisName->Info.ExpectedBtypes); - sprintf (MsgBuffer, "%s required for %4.4s", - StringBuffer, ThisName->Info.Name); + sprintf (AslGbl_MsgBuffer, "%s required for %4.4s", + AslGbl_StringBuffer, ThisName->Info.Name); AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, - MsgBuffer); + AslGbl_MsgBuffer); } break; } @@ -365,10 +365,10 @@ ApCheckPredefinedReturnValue ( * Note: Disable compiler errors/warnings because any errors will be * caught when analyzing the parent method. Eliminates duplicate errors. */ - Gbl_AllExceptionsDisabled = TRUE; + AslGbl_AllExceptionsDisabled = TRUE; Index = ApCheckForPredefinedName (MethodInfo->Op, MethodInfo->Op->Asl.NameSeg); - Gbl_AllExceptionsDisabled = FALSE; + AslGbl_AllExceptionsDisabled = FALSE; switch (Index) { @@ -804,20 +804,20 @@ TypeErrorExit: /* Format the expected types and emit an error message */ - AcpiUtGetExpectedReturnTypes (StringBuffer, ExpectedBtypes); + AcpiUtGetExpectedReturnTypes (AslGbl_StringBuffer, ExpectedBtypes); if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT) { - sprintf (MsgBuffer, "%4.4s: found %s, %s required", - PredefinedName, TypeName, StringBuffer); + sprintf (AslGbl_MsgBuffer, "%4.4s: found %s, %s required", + PredefinedName, TypeName, AslGbl_StringBuffer); } else { - sprintf (MsgBuffer, "%4.4s: found %s at index %u, %s required", - PredefinedName, TypeName, PackageIndex, StringBuffer); + sprintf (AslGbl_MsgBuffer, "%4.4s: found %s at index %u, %s required", + PredefinedName, TypeName, PackageIndex, AslGbl_StringBuffer); } - AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, AslGbl_MsgBuffer); return (AE_TYPE); } @@ -853,7 +853,7 @@ ApDisplayReservedNames ( ThisName = AcpiGbl_PredefinedMethods; while (ThisName->Info.Name[0]) { - AcpiUtDisplayPredefinedMethod (MsgBuffer, ThisName, FALSE); + AcpiUtDisplayPredefinedMethod (AslGbl_MsgBuffer, ThisName, FALSE); Count++; ThisName = AcpiUtGetNextPredefinedMethod (ThisName); } @@ -869,11 +869,11 @@ ApDisplayReservedNames ( ThisName = AcpiGbl_ResourceNames; while (ThisName->Info.Name[0]) { - NumTypes = AcpiUtGetResourceBitWidth (MsgBuffer, + NumTypes = AcpiUtGetResourceBitWidth (AslGbl_MsgBuffer, ThisName->Info.ArgumentList); printf ("%4.4s Field is %s bits wide%s\n", - ThisName->Info.Name, MsgBuffer, + ThisName->Info.Name, AslGbl_MsgBuffer, (NumTypes > 1) ? " (depending on descriptor type)" : ""); Count++; diff --git a/source/compiler/aslprepkg.c b/source/compiler/aslprepkg.c index 68fdd8f7a..590cb95bf 100644 --- a/source/compiler/aslprepkg.c +++ b/source/compiler/aslprepkg.c @@ -417,11 +417,11 @@ ApCheckPackage ( if (Count & 1) { - sprintf (MsgBuffer, "%4.4s: Package length, %d, must be even.", + sprintf (AslGbl_MsgBuffer, "%4.4s: Package length, %d, must be even.", Predefined->Info.Name, Count); AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, - ParentOp->Asl.Child, MsgBuffer); + ParentOp->Asl.Child, AslGbl_MsgBuffer); } /* Validate the alternating types */ @@ -538,7 +538,7 @@ ApCustomPackage ( Version = (UINT32) Op->Asl.Value.Integer; if (Op->Asl.ParseOpcode != PARSEOP_INTEGER) { - AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, AslGbl_MsgBuffer); return; } @@ -917,10 +917,10 @@ ApPackageTooSmall ( UINT32 ExpectedCount) { - sprintf (MsgBuffer, "%s: length %u, required minimum is %u", + sprintf (AslGbl_MsgBuffer, "%s: length %u, required minimum is %u", PredefinedName, Count, ExpectedCount); - AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer); } @@ -946,9 +946,9 @@ ApZeroLengthPackage ( ACPI_PARSE_OBJECT *Op) { - sprintf (MsgBuffer, "%s: length is zero", PredefinedName); + sprintf (AslGbl_MsgBuffer, "%s: length is zero", PredefinedName); - AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer); } @@ -975,8 +975,8 @@ ApPackageTooLarge ( UINT32 ExpectedCount) { - sprintf (MsgBuffer, "%s: length is %u, only %u required", + sprintf (AslGbl_MsgBuffer, "%s: length is %u, only %u required", PredefinedName, Count, ExpectedCount); - AslError (ASL_REMARK, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer); + AslError (ASL_REMARK, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer); } diff --git a/source/compiler/aslprune.c b/source/compiler/aslprune.c index ba60e509a..3b043bb4b 100644 --- a/source/compiler/aslprune.c +++ b/source/compiler/aslprune.c @@ -230,7 +230,7 @@ AslPruneParseTree ( AcpiOsPrintf ("\nRemoving Objects:\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, PrTreePruneWalk, NULL, ACPI_CAST_PTR (void, &PruneObj)); AcpiOsPrintf ("\n%u Total Objects Removed\n", PruneObj.Count); diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c index 6984fc931..2f10a28c4 100644 --- a/source/compiler/aslresource.c +++ b/source/compiler/aslresource.c @@ -197,7 +197,7 @@ RsSmallAddressCheck ( ACPI_PARSE_OBJECT *Op) { - if (Gbl_NoResourceChecking) + if (AslGbl_NoResourceChecking) { return; } @@ -329,7 +329,7 @@ RsLargeAddressCheck ( ACPI_PARSE_OBJECT *Op) { - if (Gbl_NoResourceChecking) + if (AslGbl_NoResourceChecking) { return; } diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index 7369fef7e..10a61b6b5 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -197,49 +197,49 @@ AslInitializeGlobals ( /* Init compiler globals */ - Gbl_SyntaxError = 0; - Gbl_CurrentColumn = 0; - Gbl_CurrentLineNumber = 1; - Gbl_LogicalLineNumber = 1; - Gbl_CurrentLineOffset = 0; - Gbl_InputFieldCount = 0; - Gbl_InputByteCount = 0; - Gbl_NsLookupCount = 0; - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; - - Gbl_ErrorLog = NULL; - Gbl_NextError = NULL; - Gbl_Signature = NULL; - Gbl_FileType = 0; - - TotalExecutableOpcodes = 0; - TotalNamedObjects = 0; - TotalKeywords = 0; - TotalParseNodes = 0; - TotalMethods = 0; - TotalAllocations = 0; - TotalAllocated = 0; - TotalFolds = 0; + AslGbl_SyntaxError = 0; + AslGbl_CurrentColumn = 0; + AslGbl_CurrentLineNumber = 1; + AslGbl_LogicalLineNumber = 1; + AslGbl_CurrentLineOffset = 0; + AslGbl_InputFieldCount = 0; + AslGbl_InputByteCount = 0; + AslGbl_NsLookupCount = 0; + AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer; + + AslGbl_ErrorLog = NULL; + AslGbl_NextError = NULL; + AslGbl_Signature = NULL; + AslGbl_FileType = 0; + + AslGbl_TotalExecutableOpcodes = 0; + AslGbl_TotalNamedObjects = 0; + AslGbl_TotalKeywords = 0; + AslGbl_TotalParseNodes = 0; + AslGbl_TotalMethods = 0; + AslGbl_TotalAllocations = 0; + AslGbl_TotalAllocated = 0; + AslGbl_TotalFolds = 0; AslGbl_NextEvent = 0; for (i = 0; i < ASL_NUM_REPORT_LEVELS; i++) { - Gbl_ExceptionCount[i] = 0; + AslGbl_ExceptionCount[i] = 0; } for (i = ASL_FILE_INPUT; i <= ASL_MAX_FILE_TYPE; i++) { - Gbl_Files[i].Handle = NULL; - Gbl_Files[i].Filename = NULL; + AslGbl_Files[i].Handle = NULL; + AslGbl_Files[i].Filename = NULL; } if (AcpiGbl_CaptureComments) { - Gbl_CommentState.SpacesBefore = 0; - Gbl_CommentState.CommentType = 1; - Gbl_CommentState.LatestParseOp = NULL; - Gbl_CommentState.ParsingParenBraceNode = NULL; - Gbl_CommentState.CaptureComments = TRUE; + AslGbl_CommentState.SpacesBefore = 0; + AslGbl_CommentState.CommentType = 1; + AslGbl_CommentState.LatestParseOp = NULL; + AslGbl_CommentState.ParsingParenBraceNode = NULL; + AslGbl_CommentState.CaptureComments = TRUE; } } @@ -275,11 +275,11 @@ AslDetectSourceFileType ( * File contains ASCII source code. Determine if this is an ASL * file or an ACPI data table file. */ - while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, Info->Handle)) + while (fgets (AslGbl_CurrentLineBuffer, AslGbl_LineBufferSize, Info->Handle)) { /* Uppercase the buffer for caseless compare */ - FileChar = Gbl_CurrentLineBuffer; + FileChar = AslGbl_CurrentLineBuffer; while (*FileChar) { *FileChar = (char) toupper ((int) *FileChar); @@ -288,7 +288,7 @@ AslDetectSourceFileType ( /* Presence of "DefinitionBlock" indicates actual ASL code */ - if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK")) + if (strstr (AslGbl_CurrentLineBuffer, "DEFINITIONBLOCK")) { /* Appears to be an ASL file */ @@ -372,15 +372,15 @@ AslDoDisassembly ( /* Handle additional output files for disassembler */ - Gbl_FileType = ASL_INPUT_TYPE_BINARY_ACPI_TABLE; - Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); + AslGbl_FileType = ASL_INPUT_TYPE_BINARY_ACPI_TABLE; + Status = FlOpenMiscOutputFiles (AslGbl_OutputFilenamePrefix); /* This is where the disassembly happens */ AcpiGbl_DmOpt_Disasm = TRUE; Status = AdAmlDisassemble (AslToFile, - Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_OutputFilenamePrefix, - &Gbl_Files[ASL_FILE_INPUT].Filename); + AslGbl_Files[ASL_FILE_INPUT].Filename, AslGbl_OutputFilenamePrefix, + &AslGbl_Files[ASL_FILE_INPUT].Filename); if (ACPI_FAILURE (Status)) { return (Status); @@ -396,19 +396,19 @@ AslDoDisassembly ( (void) AcpiTerminate (); /* - * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the + * AslGbl_Files[ASL_FILE_INPUT].Filename was replaced with the * .DSL disassembly file, which can now be compiled if requested */ - if (Gbl_DoCompile) + if (AslGbl_DoCompile) { AcpiOsPrintf ("\nCompiling \"%s\"\n", - Gbl_Files[ASL_FILE_INPUT].Filename); + AslGbl_Files[ASL_FILE_INPUT].Filename); return (AE_CTRL_CONTINUE); } /* No need to free the filename string */ - Gbl_Files[ASL_FILE_INPUT].Filename = NULL; + AslGbl_Files[ASL_FILE_INPUT].Filename = NULL; UtDeleteLocalCaches (); return (AE_OK); @@ -444,7 +444,7 @@ AslDoOneFile ( * files and the optional AML filename embedded in the input file * DefinitionBlock declaration. */ - Status = FlSplitInputPathname (Filename, &Gbl_DirectoryPath, NULL); + Status = FlSplitInputPathname (Filename, &AslGbl_DirectoryPath, NULL); if (ACPI_FAILURE (Status)) { return (Status); @@ -452,11 +452,11 @@ AslDoOneFile ( /* Take a copy of the input filename, convert any backslashes */ - Gbl_Files[ASL_FILE_INPUT].Filename = + AslGbl_Files[ASL_FILE_INPUT].Filename = UtLocalCacheCalloc (strlen (Filename) + 1); - strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename); - UtConvertBackslashes (Gbl_Files[ASL_FILE_INPUT].Filename); + strcpy (AslGbl_Files[ASL_FILE_INPUT].Filename, Filename); + UtConvertBackslashes (AslGbl_Files[ASL_FILE_INPUT].Filename); /* * AML Disassembly (Optional) @@ -474,19 +474,19 @@ AslDoOneFile ( * 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); + Status = FlOpenInputFile (AslGbl_Files[ASL_FILE_INPUT].Filename); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); } - Gbl_OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT); + AslGbl_OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT); /* Determine input file type */ - Gbl_FileType = AslDetectSourceFileType (&Gbl_Files[ASL_FILE_INPUT]); - if (Gbl_FileType == ASL_INPUT_TYPE_BINARY) + AslGbl_FileType = AslDetectSourceFileType (&AslGbl_Files[ASL_FILE_INPUT]); + if (AslGbl_FileType == ASL_INPUT_TYPE_BINARY) { return (AE_ERROR); } @@ -495,14 +495,14 @@ AslDoOneFile ( * If -p not specified, we will use the input filename as the * output filename prefix */ - if (Gbl_UseDefaultAmlFilename) + if (AslGbl_UseDefaultAmlFilename) { - Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename; + AslGbl_OutputFilenamePrefix = AslGbl_Files[ASL_FILE_INPUT].Filename; } /* Open the optional output files (listings, etc.) */ - Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); + Status = FlOpenMiscOutputFiles (AslGbl_OutputFilenamePrefix); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); @@ -513,7 +513,7 @@ AslDoOneFile ( * Compilation of ASL source versus DataTable source uses different * compiler subsystems */ - switch (Gbl_FileType) + switch (AslGbl_FileType) { /* * Data Table Compilation @@ -526,9 +526,9 @@ AslDoOneFile ( return (Status); } - if (Gbl_Signature) + if (AslGbl_Signature) { - Gbl_Signature = NULL; + AslGbl_Signature = NULL; } /* Check if any errors occurred during compile */ @@ -576,16 +576,16 @@ AslDoOneFile ( /* ASL-to-ASL+ conversion - Perform immediate disassembly */ - if (Gbl_DoAslConversion) + if (AslGbl_DoAslConversion) { /* * New input file is the output AML file from above. * New output is from the input ASL file from above. */ - Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename; - CvDbgPrint ("OUTPUTFILENAME: %s\n", Gbl_OutputFilenamePrefix); - Gbl_Files[ASL_FILE_INPUT].Filename = - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename; + AslGbl_OutputFilenamePrefix = AslGbl_Files[ASL_FILE_INPUT].Filename; + CvDbgPrint ("OUTPUTFILENAME: %s\n", AslGbl_OutputFilenamePrefix); + AslGbl_Files[ASL_FILE_INPUT].Filename = + AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename; AcpiGbl_DisasmFlag = TRUE; fprintf (stderr, "\n"); AslDoDisassembly (); @@ -605,7 +605,7 @@ AslDoOneFile ( /* We have what appears to be an ACPI table, disassemble it */ FlCloseFile (ASL_FILE_INPUT); - Gbl_DoCompile = FALSE; + AslGbl_DoCompile = FALSE; AcpiGbl_DisasmFlag = TRUE; Status = AslDoDisassembly (); return (Status); @@ -619,7 +619,7 @@ AslDoOneFile ( default: - printf ("Unknown file type %X\n", Gbl_FileType); + printf ("Unknown file type %X\n", AslGbl_FileType); return (AE_ERROR); } } @@ -646,20 +646,20 @@ AslCheckForErrorExit ( * Return non-zero exit code if there have been errors, unless the * global ignore error flag has been set */ - if (!Gbl_IgnoreErrors) + if (!AslGbl_IgnoreErrors) { - if (Gbl_ExceptionCount[ASL_ERROR] > 0) + if (AslGbl_ExceptionCount[ASL_ERROR] > 0) { return (AE_ERROR); } /* Optionally treat warnings as errors */ - if (Gbl_WarningsAsErrors) + if (AslGbl_WarningsAsErrors) { - if ((Gbl_ExceptionCount[ASL_WARNING] > 0) || - (Gbl_ExceptionCount[ASL_WARNING2] > 0) || - (Gbl_ExceptionCount[ASL_WARNING3] > 0)) + if ((AslGbl_ExceptionCount[ASL_WARNING] > 0) || + (AslGbl_ExceptionCount[ASL_WARNING2] > 0) || + (AslGbl_ExceptionCount[ASL_WARNING3] > 0)) { return (AE_ERROR); } diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 406f2d547..8e3b5b22f 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -212,22 +212,22 @@ AslDoLineDirective ( char *Filename; UINT32 i; - Gbl_HasIncludeFiles = TRUE; + AslGbl_HasIncludeFiles = TRUE; /* Eat the entire line that contains the #line directive */ - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer; while ((c = input()) != '\n' && c != EOF) { - *Gbl_LineBufPtr = c; - Gbl_LineBufPtr++; + *AslGbl_LineBufPtr = c; + AslGbl_LineBufPtr++; } - *Gbl_LineBufPtr = 0; + *AslGbl_LineBufPtr = 0; /* First argument is the actual line number */ - Token = strtok (Gbl_CurrentLineBuffer, " "); + Token = strtok (AslGbl_CurrentLineBuffer, " "); if (!Token) { goto ResetAndExit; @@ -239,13 +239,13 @@ AslDoLineDirective ( /* Emit the appropriate number of newlines */ - Gbl_CurrentColumn = 0; - if (LineNumber > Gbl_CurrentLineNumber) + AslGbl_CurrentColumn = 0; + if (LineNumber > AslGbl_CurrentLineNumber) { - for (i = 0; i < (LineNumber - Gbl_CurrentLineNumber); i++) + for (i = 0; i < (LineNumber - AslGbl_CurrentLineNumber); i++) { FlWriteFile (ASL_FILE_SOURCE_OUTPUT, "\n", 1); - Gbl_CurrentColumn++; + AslGbl_CurrentColumn++; } } @@ -256,7 +256,7 @@ AslDoLineDirective ( Token = strtok (NULL, " \""); if (Token) { - Filename = ACPI_ALLOCATE_ZEROED (strlen (Token) + 1); + Filename = UtLocalCacheCalloc (strlen (Token) + 1); strcpy (Filename, Token); FlSetFilename (Filename); } @@ -267,9 +267,9 @@ ResetAndExit: /* Reset globals for a new line */ - Gbl_CurrentLineOffset += Gbl_CurrentColumn; - Gbl_CurrentColumn = 0; - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + AslGbl_CurrentLineOffset += AslGbl_CurrentColumn; + AslGbl_CurrentColumn = 0; + AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer; } @@ -295,13 +295,13 @@ AslPopInputFileStack ( ASL_FILE_NODE *Fnode; - Gbl_PreviousIncludeFilename = Gbl_Files[ASL_FILE_INPUT].Filename; - Fnode = Gbl_IncludeFileStack; + AslGbl_PreviousIncludeFilename = AslGbl_Files[ASL_FILE_INPUT].Filename; + Fnode = AslGbl_IncludeFileStack; DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n", Fnode); DbgPrint (ASL_PARSE_OUTPUT, - "Include: Closing \"%s\"\n\n", Gbl_Files[ASL_FILE_INPUT].Filename); + "Include: Closing \"%s\"\n\n", AslGbl_Files[ASL_FILE_INPUT].Filename); if (!Fnode) { @@ -314,12 +314,12 @@ AslPopInputFileStack ( /* Update the top-of-stack */ - Gbl_IncludeFileStack = Fnode->Next; + AslGbl_IncludeFileStack = Fnode->Next; /* Reset global line counter and filename */ - Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename; - Gbl_CurrentLineNumber = Fnode->CurrentLineNumber; + AslGbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename; + AslGbl_CurrentLineNumber = Fnode->CurrentLineNumber; /* Point the parser to the popped file */ @@ -362,14 +362,14 @@ AslPushInputFileStack ( Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE)); Fnode->File = yyin; - Fnode->Next = Gbl_IncludeFileStack; + Fnode->Next = AslGbl_IncludeFileStack; Fnode->State = YY_CURRENT_BUFFER; - Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; + Fnode->Filename = AslGbl_Files[ASL_FILE_INPUT].Filename; + Fnode->CurrentLineNumber = AslGbl_CurrentLineNumber; /* Push it on the stack */ - Gbl_IncludeFileStack = Fnode; + AslGbl_IncludeFileStack = Fnode; /* Point the parser to this file */ @@ -381,17 +381,17 @@ AslPushInputFileStack ( /* Reset the global line count and filename */ - Gbl_Files[ASL_FILE_INPUT].Filename = + AslGbl_Files[ASL_FILE_INPUT].Filename = UtLocalCacheCalloc (strlen (Filename) + 1); - strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename); + strcpy (AslGbl_Files[ASL_FILE_INPUT].Filename, Filename); - Gbl_CurrentLineNumber = 1; + AslGbl_CurrentLineNumber = 1; yyin = InputFile; /* converter: reset the comment state to STANDARD_COMMENT */ - Gbl_CommentState.CommentType = STANDARD_COMMENT; + AslGbl_CommentState.CommentType = STANDARD_COMMENT; } @@ -412,18 +412,18 @@ AslResetCurrentLineBuffer ( void) { - if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle) + if (AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle) { - FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer, - Gbl_LineBufPtr - Gbl_CurrentLineBuffer); + FlWriteFile (ASL_FILE_SOURCE_OUTPUT, AslGbl_CurrentLineBuffer, + AslGbl_LineBufPtr - AslGbl_CurrentLineBuffer); } - Gbl_CurrentLineOffset += Gbl_CurrentColumn; - Gbl_CurrentColumn = 0; + AslGbl_CurrentLineOffset += AslGbl_CurrentColumn; + AslGbl_CurrentColumn = 0; - Gbl_CurrentLineNumber++; - Gbl_LogicalLineNumber++; - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + AslGbl_CurrentLineNumber++; + AslGbl_LogicalLineNumber++; + AslGbl_LineBufPtr = AslGbl_CurrentLineBuffer; } @@ -452,7 +452,7 @@ AslInsertLineBuffer ( return; } - Gbl_InputByteCount++; + AslGbl_InputByteCount++; /* Handle tabs. Convert to spaces */ @@ -460,31 +460,31 @@ AslInsertLineBuffer ( { SourceChar = ' '; Count = ASL_SPACES_PER_TAB - - (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1)); + (AslGbl_CurrentColumn & (ASL_SPACES_PER_TAB-1)); } for (i = 0; i < Count; i++) { - Gbl_CurrentColumn++; + AslGbl_CurrentColumn++; /* Insert the character into the line buffer */ - *Gbl_LineBufPtr = (UINT8) SourceChar; - Gbl_LineBufPtr++; + *AslGbl_LineBufPtr = (UINT8) SourceChar; + AslGbl_LineBufPtr++; - if (Gbl_LineBufPtr > - (Gbl_CurrentLineBuffer + (Gbl_LineBufferSize - 1))) + if (AslGbl_LineBufPtr > + (AslGbl_CurrentLineBuffer + (AslGbl_LineBufferSize - 1))) { #if 0 /* * Warning if we have split a long source line. * <Probably overkill> */ - sprintf (MsgBuffer, "Max %u", Gbl_LineBufferSize); + sprintf (MsgBuffer, "Max %u", AslGbl_LineBufferSize); AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); #endif AslResetCurrentLineBuffer (); @@ -532,14 +532,14 @@ count ( { case 2: - TotalKeywords++; - TotalNamedObjects++; + AslGbl_TotalKeywords++; + AslGbl_TotalNamedObjects++; break; case 3: - TotalKeywords++; - TotalExecutableOpcodes++; + AslGbl_TotalKeywords++; + AslGbl_TotalExecutableOpcodes++; break; default: @@ -550,7 +550,7 @@ count ( for (p = yytext; *p != '\0'; p++) { AslInsertLineBuffer (*p); - *Gbl_LineBufPtr = 0; + *AslGbl_LineBufPtr = 0; } } @@ -573,9 +573,9 @@ AslDoComment ( { int c; int c1 = 0; - char *StringBuffer = MsgBuffer; - char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; - ASL_COMMENT_STATE CurrentState = Gbl_CommentState; /* to reference later on */ + char *StringBuffer = AslGbl_MsgBuffer; + char *EndBuffer = AslGbl_MsgBuffer + ASL_MSG_BUFFER_SIZE; + ASL_COMMENT_STATE CurrentState = AslGbl_CommentState; /* to reference later on */ AslInsertLineBuffer ('/'); @@ -615,9 +615,9 @@ loop: if ((c1 == '/') && (c == '*')) { AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_InputByteCount, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); } /* Comment is closed only if the NEXT character is a slash */ @@ -654,9 +654,9 @@ EarlyEOF: * Premature End-Of-File */ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); return (FALSE); @@ -665,9 +665,9 @@ BufferOverflow: /* Comment was too long */ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); return (FALSE); } @@ -691,9 +691,9 @@ AslDoCommentType2 ( void) { int c; - char *StringBuffer = MsgBuffer; - char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; - ASL_COMMENT_STATE CurrentState = Gbl_CommentState; + char *StringBuffer = AslGbl_MsgBuffer; + char *EndBuffer = AslGbl_MsgBuffer + ASL_MSG_BUFFER_SIZE; + ASL_COMMENT_STATE CurrentState = AslGbl_CommentState; AslInsertLineBuffer ('/'); @@ -743,9 +743,9 @@ BufferOverflow: /* Comment was too long */ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); return (FALSE); } @@ -767,8 +767,8 @@ static char AslDoStringLiteral ( void) { - char *StringBuffer = MsgBuffer; - char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; + char *StringBuffer = AslGbl_MsgBuffer; + char *EndBuffer = AslGbl_MsgBuffer + ASL_MSG_BUFFER_SIZE; char *CleanString; int StringChar; UINT32 State = ASL_NORMAL_CHAR; @@ -882,9 +882,9 @@ DoCharacter: /* Unknown escape sequence issue warning, but use the character */ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); break; } break; @@ -909,9 +909,9 @@ DoCharacter: if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) { AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); } else { @@ -953,9 +953,9 @@ DoCharacter: if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) { AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); } else { @@ -997,9 +997,9 @@ DoCharacter: * Premature End-Of-File */ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); return (FALSE); @@ -1009,8 +1009,8 @@ CompletedString: */ *StringBuffer = 0; - CleanString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1); - strcpy (CleanString, MsgBuffer); + CleanString = UtLocalCacheCalloc (strlen (AslGbl_MsgBuffer) + 1); + strcpy (CleanString, AslGbl_MsgBuffer); AslCompilerlval.s = CleanString; return (TRUE); @@ -1020,8 +1020,8 @@ BufferOverflow: /* Literal was too long */ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_CurrentLineOffset, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); return (FALSE); } diff --git a/source/compiler/aslsupport.y b/source/compiler/aslsupport.y index 2e1a978f4..575f5688c 100644 --- a/source/compiler/aslsupport.y +++ b/source/compiler/aslsupport.y @@ -181,9 +181,9 @@ AslLocalAllocate ( if (!Mem) { AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_InputByteCount, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); exit (1); } diff --git a/source/compiler/asltokens.y b/source/compiler/asltokens.y index ee2e25c0e..935ca3059 100644 --- a/source/compiler/asltokens.y +++ b/source/compiler/asltokens.y @@ -175,7 +175,7 @@ NoEcho(' %token <i> PARSEOP_ACCESSATTRIB_BLOCK %token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL %token <i> PARSEOP_ACCESSATTRIB_BYTE -%token <i> PARSEOP_ACCESSATTRIB_MULTIBYTE +%token <i> PARSEOP_ACCESSATTRIB_BYTES %token <i> PARSEOP_ACCESSATTRIB_QUICK %token <i> PARSEOP_ACCESSATTRIB_RAW_BYTES %token <i> PARSEOP_ACCESSATTRIB_RAW_PROCESS diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c index 559b4f8f8..3249e3679 100644 --- a/source/compiler/asltransform.c +++ b/source/compiler/asltransform.c @@ -404,8 +404,8 @@ TrAmlTransformWalkEnd ( if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) { - Op->Asl.Value.Arg = Gbl_ExternalsListHead; - Gbl_ExternalsListHead = NULL; + Op->Asl.Value.Arg = AslGbl_ExternalsListHead; + AslGbl_ExternalsListHead = NULL; } return (AE_OK); @@ -455,12 +455,12 @@ TrTransformSubtree ( * TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global, * however */ - Gbl_TempCount = 0; + AslGbl_TempCount = 0; break; case PARSEOP_EXTERNAL: - if (Gbl_DoExternals == TRUE) + if (AslGbl_DoExternals == TRUE) { ExDoExternal (Op); } @@ -534,7 +534,7 @@ TrDoDefinitionBlock ( /* Reset external list when starting a definition block */ - Gbl_ExternalsListHead = NULL; + AslGbl_ExternalsListHead = NULL; Next = Op->Asl.Child; for (i = 0; i < 5; i++) @@ -549,12 +549,12 @@ TrDoDefinitionBlock ( */ if (!ACPI_COMPARE_NAME (Next->Asl.Value.String, ACPI_SIG_DSDT)) { - Gbl_ReferenceOptimizationFlag = FALSE; + AslGbl_ReferenceOptimizationFlag = FALSE; } } } - Gbl_FirstLevelInsertionNode = Next; + AslGbl_FirstLevelInsertionNode = Next; } @@ -600,7 +600,7 @@ TrDoSwitch ( /* Create a new temp name of the form _T_x */ - PredicateValueName = TrAmlGetNextTempName (StartNode, &Gbl_TempCount); + PredicateValueName = TrAmlGetNextTempName (StartNode, &AslGbl_TempCount); if (!PredicateValueName) { return; diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 3f6269872..fc019b9b1 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -256,7 +256,7 @@ TrSetOpIntegerValue ( if (AcpiGbl_CaptureComments && (ParseOpcode == PARSEOP_METHODCALL)) { - Gbl_CommentState.CaptureComments = FALSE; + AslGbl_CommentState.CaptureComments = FALSE; } return (Op); @@ -372,7 +372,7 @@ TrSetOpCurrentFilename ( ACPI_PARSE_OBJECT *Op) { - Op->Asl.Filename = Gbl_PreviousIncludeFilename; + Op->Asl.Filename = AslGbl_PreviousIncludeFilename; } @@ -398,9 +398,9 @@ TrSetOpIntegerWidth ( /* Handle command-line version override */ - if (Gbl_RevisionOverride) + if (AslGbl_RevisionOverride) { - AcpiUtSetIntegerWidth (Gbl_RevisionOverride); + AcpiUtSetIntegerWidth (AslGbl_RevisionOverride); } else { @@ -434,8 +434,8 @@ TrSetOpEndLineNumber ( return; } - Op->Asl.EndLine = Gbl_CurrentLineNumber; - Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber; + Op->Asl.EndLine = AslGbl_CurrentLineNumber; + Op->Asl.EndLogicalLine = AslGbl_LogicalLineNumber; } @@ -480,7 +480,7 @@ TrLinkOpChildren ( { case PARSEOP_ASL_CODE: - Gbl_ParseTreeRoot = Op; + AslGbl_ParseTreeRoot = Op; Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->"); break; @@ -516,13 +516,13 @@ TrLinkOpChildren ( * then is an endBlk comment. Categorize it as so and distribute * all regular comments to this parse op. */ - if (Gbl_CommentListHead) + if (AslGbl_CommentListHead) { - Op->Asl.EndBlkComment = Gbl_CommentListHead; + Op->Asl.EndBlkComment = AslGbl_CommentListHead; CvDbgPrint ("EndBlk Comment for %s: %s", - Op->Asl.ParseOpName, Gbl_CommentListHead->Comment); - Gbl_CommentListHead = NULL; - Gbl_CommentListTail = NULL; + Op->Asl.ParseOpName, AslGbl_CommentListHead->Comment); + AslGbl_CommentListHead = NULL; + AslGbl_CommentListTail = NULL; } } @@ -592,7 +592,7 @@ TrLinkOpChildren ( if (AcpiGbl_CaptureComments) { - Gbl_CommentState.LatestParseOp = Op; + AslGbl_CommentState.LatestParseOp = Op; CvDbgPrint ("TrLinkOpChildren=====Set latest parse op to this op.\n"); } @@ -772,9 +772,9 @@ TrLinkChildOp ( { if (Op1->Asl.ParseOpcode == PARSEOP_METHODCALL) { - Gbl_CommentState.CaptureComments = TRUE; + AslGbl_CommentState.CaptureComments = TRUE; } - Gbl_CommentState.LatestParseOp = Op1; + AslGbl_CommentState.LatestParseOp = Op1; } if (!Op1 || !Op2) @@ -827,7 +827,7 @@ TrWalkParseTree ( ACPI_STATUS Status; - if (!Gbl_ParseTreeRoot) + if (!AslGbl_ParseTreeRoot) { return (AE_OK); } diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 16ef1f478..d98760f1d 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -354,7 +354,7 @@ UtDisplaySupportedTables ( /* All ACPI tables with the common table header */ printf ("\n Supported ACPI tables:\n"); - for (TableData = Gbl_AcpiSupportedTables, i = 1; + for (TableData = AcpiGbl_SupportedTables, i = 1; TableData->Signature; TableData++, i++) { printf ("%8u) %s %s\n", i, @@ -478,7 +478,7 @@ DbgPrint ( va_list Args; - if (!Gbl_DebugFlag) + if (!AslGbl_DebugFlag) { return; } @@ -547,20 +547,20 @@ UtDisplaySummary ( /* Summary of main input and output files */ - if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) + if (AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) { FlPrintFile (FileId, "%-14s %s - %u lines, %u bytes, %u fields\n", "Table Input:", - Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber, - Gbl_InputByteCount, Gbl_InputFieldCount); + AslGbl_Files[ASL_FILE_INPUT].Filename, AslGbl_CurrentLineNumber, + AslGbl_InputByteCount, AslGbl_InputFieldCount); - if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) + if ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || (AslGbl_IgnoreErrors)) { FlPrintFile (FileId, "%-14s %s - %u bytes\n", "Binary Output:", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength); + AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename, AslGbl_TableLength); } } else @@ -568,22 +568,22 @@ UtDisplaySummary ( FlPrintFile (FileId, "%-14s %s - %u lines, %u bytes, %u keywords\n", "ASL Input:", - Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber, - Gbl_OriginalInputFileSize, TotalKeywords); + AslGbl_Files[ASL_FILE_INPUT].Filename, AslGbl_CurrentLineNumber, + AslGbl_OriginalInputFileSize, AslGbl_TotalKeywords); /* AML summary */ - if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) + if ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || (AslGbl_IgnoreErrors)) { - if (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) + if (AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle) { FlPrintFile (FileId, "%-14s %s - %u bytes, %u named objects, " "%u executable opcodes\n", "AML Output:", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, + AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename, FlGetFileSize (ASL_FILE_AML_OUTPUT), - TotalNamedObjects, TotalExecutableOpcodes); + AslGbl_TotalNamedObjects, AslGbl_TotalExecutableOpcodes); } } } @@ -592,48 +592,48 @@ UtDisplaySummary ( for (i = ASL_FILE_SOURCE_OUTPUT; i <= ASL_MAX_FILE_TYPE; i++) { - if (!Gbl_Files[i].Filename || !Gbl_Files[i].Handle) + if (!AslGbl_Files[i].Filename || !AslGbl_Files[i].Handle) { continue; } /* .SRC is a temp file unless specifically requested */ - if ((i == ASL_FILE_SOURCE_OUTPUT) && (!Gbl_SourceOutputFlag)) + if ((i == ASL_FILE_SOURCE_OUTPUT) && (!AslGbl_SourceOutputFlag)) { continue; } /* .PRE is the preprocessor intermediate file */ - if ((i == ASL_FILE_PREPROCESSOR) && (!Gbl_KeepPreprocessorTempFile)) + if ((i == ASL_FILE_PREPROCESSOR) && (!AslGbl_KeepPreprocessorTempFile)) { continue; } FlPrintFile (FileId, "%14s %s - %u bytes\n", - Gbl_Files[i].ShortDescription, - Gbl_Files[i].Filename, FlGetFileSize (i)); + AslGbl_Files[i].ShortDescription, + AslGbl_Files[i].Filename, FlGetFileSize (i)); } /* Error summary */ FlPrintFile (FileId, "\nCompilation 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]); + AslGbl_ExceptionCount[ASL_ERROR], + AslGbl_ExceptionCount[ASL_WARNING] + + AslGbl_ExceptionCount[ASL_WARNING2] + + AslGbl_ExceptionCount[ASL_WARNING3], + AslGbl_ExceptionCount[ASL_REMARK]); - if (Gbl_FileType != ASL_INPUT_TYPE_ASCII_DATA) + if (AslGbl_FileType != ASL_INPUT_TYPE_ASCII_DATA) { FlPrintFile (FileId, ", %u Optimizations", - Gbl_ExceptionCount[ASL_OPTIMIZATION]); + AslGbl_ExceptionCount[ASL_OPTIMIZATION]); - if (TotalFolds) + if (AslGbl_TotalFolds) { - FlPrintFile (FileId, ", %u Constants Folded", TotalFolds); + FlPrintFile (FileId, ", %u Constants Folded", AslGbl_TotalFolds); } } @@ -670,10 +670,10 @@ UtCheckIntegerRange ( if ((Op->Asl.Value.Integer < LowValue) || (Op->Asl.Value.Integer > HighValue)) { - sprintf (MsgBuffer, "0x%X, allowable: 0x%X-0x%X", + sprintf (AslGbl_MsgBuffer, "0x%X, allowable: 0x%X-0x%X", (UINT32) Op->Asl.Value.Integer, LowValue, HighValue); - AslError (ASL_ERROR, ASL_MSG_RANGE, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_RANGE, Op, AslGbl_MsgBuffer); return (NULL); } @@ -899,9 +899,9 @@ UtDoConstant ( sprintf (ErrBuf, "While creating 64-bit constant: %s\n", AcpiFormatException (Status)); - AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, - Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, - Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, ErrBuf); + AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, AslGbl_CurrentLineNumber, + AslGbl_LogicalLineNumber, AslGbl_CurrentLineOffset, + AslGbl_CurrentColumn, AslGbl_Files[ASL_FILE_INPUT].Filename, ErrBuf); } return (ConvertedInteger); diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index 504736599..64a14e2c5 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -616,14 +616,14 @@ AnOperandTypecheckWalkEnd ( { /* No match -- this is a type mismatch error */ - AnFormatBtype (StringBuffer, ThisNodeBtype); - AnFormatBtype (StringBuffer2, RequiredBtypes); + AnFormatBtype (AslGbl_StringBuffer, ThisNodeBtype); + AnFormatBtype (AslGbl_StringBuffer2, RequiredBtypes); - sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); + sprintf (AslGbl_MsgBuffer, "[%s] found, %s operator requires [%s]", + AslGbl_StringBuffer, OpInfo->Name, AslGbl_StringBuffer2); AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, - ArgOp, MsgBuffer); + ArgOp, AslGbl_MsgBuffer); } NextArgument: @@ -742,7 +742,7 @@ AnOtherSemanticAnalysisWalkBegin ( { case PARSEOP_STORE: - if (Gbl_DoTypechecking) + if (AslGbl_DoTypechecking) { AnAnalyzeStoreOperator (Op); } @@ -935,7 +935,7 @@ AnAnalyzeStoreOperator ( case PARSEOP_INDEX: case PARSEOP_REFOF: - if (!Gbl_EnableReferenceTypechecking) + if (!AslGbl_EnableReferenceTypechecking) { return; } diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index c34ab49c8..5273ea82e 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -237,7 +237,7 @@ XfCrossReferenceNamespace ( /* Walk the entire parse tree */ - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin, XfNamespaceLocateEnd, WalkState); ACPI_FREE (WalkState); @@ -683,7 +683,7 @@ XfNamespaceLocateBegin ( * The namespace is also used as a lookup table for references to resource * descriptors and the fields within them. */ - Gbl_NsLookupCount++; + AslGbl_NsLookupCount++; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_EXECUTE, Flags, WalkState, &Node); @@ -881,12 +881,12 @@ XfNamespaceLocateBegin ( if (Message) { - sprintf (MsgBuffer, + sprintf (AslGbl_MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s", TagBitLength, (TagBitLength > 1) ? "s" : "", FieldBitLength, (FieldBitLength > 1) ? "s" : ""); - AslError (ASL_WARNING, Message, Op, MsgBuffer); + AslError (ASL_WARNING, Message, Op, AslGbl_MsgBuffer); } } @@ -952,10 +952,10 @@ XfNamespaceLocateBegin ( */ if (Node->Type != ACPI_TYPE_METHOD) { - sprintf (MsgBuffer, "%s is a %s", + sprintf (AslGbl_MsgBuffer, "%s is a %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, AslGbl_MsgBuffer); return_ACPI_STATUS (AE_OK); } @@ -993,16 +993,16 @@ XfNamespaceLocateBegin ( */ if (PassedArgs != Node->Value) { - sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, - Node->Value); + sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName, + Node->Value); if (PassedArgs < Node->Value) { - AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, AslGbl_MsgBuffer); } else { - AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, AslGbl_MsgBuffer); } } } diff --git a/source/compiler/aslxrefout.c b/source/compiler/aslxrefout.c index 0e548ece2..87a03fc39 100644 --- a/source/compiler/aslxrefout.c +++ b/source/compiler/aslxrefout.c @@ -248,7 +248,7 @@ OtCreateXrefFile ( /* Build cross-reference output file if requested */ - if (!Gbl_CrossReferenceOutput) + if (!AslGbl_CrossReferenceOutput) { return; } @@ -260,7 +260,7 @@ OtCreateXrefFile ( OtPrintHeaders ("Part 2: Method Reference Map " "(Invocations of each user-defined control method)"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, OtXrefWalkPart2, NULL, &XrefInfo); /* Cross-reference output file, part 3 (All other object refs) */ @@ -268,7 +268,7 @@ OtCreateXrefFile ( OtPrintHeaders ("Part 3: Full Object Reference Map " "(Methods that reference each object in namespace"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, OtXrefWalkPart3, NULL, &XrefInfo); /* Cross-reference summary */ @@ -620,7 +620,7 @@ OtXrefWalkPart2 ( XrefInfo->ThisMethodInvocations = 0; XrefInfo->MethodOp = Op; - (void) TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + (void) TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, OtXrefAnalysisWalkPart2, NULL, XrefInfo); if (!XrefInfo->ThisMethodInvocations) @@ -787,7 +787,7 @@ OtXrefWalkPart3 ( XrefInfo->ThisObjectReferences = 0; XrefInfo->TotalObjects = 0; - (void) TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + (void) TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, OtXrefAnalysisWalkPart3, NULL, XrefInfo); if (!XrefInfo->ThisObjectReferences) diff --git a/source/compiler/cvcompiler.c b/source/compiler/cvcompiler.c index b5ae2c838..147644930 100644 --- a/source/compiler/cvcompiler.c +++ b/source/compiler/cvcompiler.c @@ -193,8 +193,8 @@ CvProcessComment ( *StringBuffer = 0; CvDbgPrint ("Multi-line comment\n"); - CommentString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1); - strcpy (CommentString, MsgBuffer); + CommentString = UtLocalCacheCalloc (strlen (AslGbl_MsgBuffer) + 1); + strcpy (CommentString, AslGbl_MsgBuffer); CvDbgPrint ("CommentString: %s\n", CommentString); @@ -313,8 +313,8 @@ CvProcessCommentType2 ( { *StringBuffer = 0; /* null terminate */ CvDbgPrint ("Single-line comment\n"); - CommentString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1); - strcpy (CommentString, MsgBuffer); + CommentString = UtLocalCacheCalloc (strlen (AslGbl_MsgBuffer) + 1); + strcpy (CommentString, AslGbl_MsgBuffer); /* If this comment lies on the same line as the latest parse op, * assign it to that op's CommentAfter field. Saving in this field @@ -825,53 +825,53 @@ CvProcessCommentState ( if (Input != ' ') { - Gbl_CommentState.SpacesBefore = 0; + AslGbl_CommentState.SpacesBefore = 0; } switch (Input) { case '\n': - Gbl_CommentState.CommentType = ASL_COMMENT_STANDARD; + AslGbl_CommentState.CommentType = ASL_COMMENT_STANDARD; break; case ' ': /* Keep the CommentType the same */ - Gbl_CommentState.SpacesBefore++; + AslGbl_CommentState.SpacesBefore++; break; case '(': - Gbl_CommentState.CommentType = ASL_COMMENT_OPEN_PAREN; + AslGbl_CommentState.CommentType = ASL_COMMENT_OPEN_PAREN; break; case ')': - Gbl_CommentState.CommentType = ASL_COMMENT_CLOSE_PAREN; + AslGbl_CommentState.CommentType = ASL_COMMENT_CLOSE_PAREN; break; case '{': - Gbl_CommentState.CommentType = ASL_COMMENT_STANDARD; - Gbl_CommentState.ParsingParenBraceNode = NULL; + AslGbl_CommentState.CommentType = ASL_COMMENT_STANDARD; + AslGbl_CommentState.ParsingParenBraceNode = NULL; CvDbgPrint ("End Parsing paren/Brace node!\n"); break; case '}': - Gbl_CommentState.CommentType = ASL_COMMENT_CLOSE_BRACE; + AslGbl_CommentState.CommentType = ASL_COMMENT_CLOSE_BRACE; break; case ',': - Gbl_CommentState.CommentType = ASLCOMMENT_INLINE; + AslGbl_CommentState.CommentType = ASLCOMMENT_INLINE; break; default: - Gbl_CommentState.CommentType = ASLCOMMENT_INLINE; + AslGbl_CommentState.CommentType = ASLCOMMENT_INLINE; break; } } @@ -895,18 +895,18 @@ CvAddToCommentList ( char *ToAdd) { - if (Gbl_CommentListHead) + if (AslGbl_CommentListHead) { - Gbl_CommentListTail->Next = CvCommentNodeCalloc (); - Gbl_CommentListTail = Gbl_CommentListTail->Next; + AslGbl_CommentListTail->Next = CvCommentNodeCalloc (); + AslGbl_CommentListTail = AslGbl_CommentListTail->Next; } else { - Gbl_CommentListHead = CvCommentNodeCalloc (); - Gbl_CommentListTail = Gbl_CommentListHead; + AslGbl_CommentListHead = CvCommentNodeCalloc (); + AslGbl_CommentListTail = AslGbl_CommentListHead; } - Gbl_CommentListTail->Comment = ToAdd; + AslGbl_CommentListTail->Comment = ToAdd; } @@ -976,8 +976,8 @@ CvPlaceComment( ACPI_PARSE_OBJECT *ParenBraceNode; - LatestParseNode = Gbl_CommentState.LatestParseOp; - ParenBraceNode = Gbl_CommentState.ParsingParenBraceNode; + LatestParseNode = AslGbl_CommentState.LatestParseOp; + ParenBraceNode = AslGbl_CommentState.ParsingParenBraceNode; CvDbgPrint ("Placing comment %s for type %d\n", CommentString, Type); switch (Type) @@ -996,8 +996,8 @@ CvPlaceComment( case ASL_COMMENT_OPEN_PAREN: - Gbl_InlineCommentBuffer = - CvAppendInlineComment(Gbl_InlineCommentBuffer, + AslGbl_InlineCommentBuffer = + CvAppendInlineComment(AslGbl_InlineCommentBuffer, CommentString); break; diff --git a/source/compiler/cvdisasm.c b/source/compiler/cvdisasm.c index 8150f2a2a..8604c0317 100644 --- a/source/compiler/cvdisasm.c +++ b/source/compiler/cvdisasm.c @@ -522,10 +522,10 @@ CvSwitchFiles( * if it does not exist, then abort. */ FlDeleteFile (ASL_FILE_AML_OUTPUT); - sprintf (MsgBuffer, "\"Cannot find %s\" - %s", + sprintf (AslGbl_MsgBuffer, "\"Cannot find %s\" - %s", Filename, strerror (errno)); AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, - NULL, MsgBuffer); + NULL, AslGbl_MsgBuffer); AslAbort (); } diff --git a/source/compiler/cvparser.c b/source/compiler/cvparser.c index 747b03f51..7c46c6358 100644 --- a/source/compiler/cvparser.c +++ b/source/compiler/cvparser.c @@ -638,9 +638,9 @@ CvAddToFileTree ( /* delete the .xxx file */ FlDeleteFile (ASL_FILE_AML_OUTPUT); - sprintf (MsgBuffer, "\"%s\" - %s", Filename, strerror (errno)); + sprintf (AslGbl_MsgBuffer, "\"%s\" - %s", Filename, strerror (errno)); AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, - NULL, MsgBuffer); + NULL, AslGbl_MsgBuffer); AslAbort (); } } diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index 939441467..78bb7bbb3 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -184,7 +184,7 @@ DtInsertCompilerIds ( * * DESCRIPTION: Main entry point for the data table compiler. * - * Note: Assumes Gbl_Files[ASL_FILE_INPUT] is initialized and the file is + * Note: Assumes AslGbl_Files[ASL_FILE_INPUT] is initialized and the file is * open at seek offset zero. * *****************************************************************************/ @@ -209,7 +209,7 @@ DtDoCompile ( /* Preprocessor */ - if (Gbl_PreprocessFlag) + if (AslGbl_PreprocessFlag) { /* Preprocessor */ @@ -217,7 +217,7 @@ DtDoCompile ( PrDoPreprocess (); UtEndEvent (Event); - if (Gbl_PreprocessOnly) + if (AslGbl_PreprocessOnly) { return (AE_OK); } @@ -228,7 +228,7 @@ DtDoCompile ( * build the parse tree */ Event = UtBeginEvent ("Scan and parse input file"); - FieldList = DtScanFile (Gbl_Files[ASL_FILE_INPUT].Handle); + FieldList = DtScanFile (AslGbl_Files[ASL_FILE_INPUT].Handle); UtEndEvent (Event); /* Did the parse tree get successfully constructed? */ @@ -264,8 +264,8 @@ DtDoCompile ( /* Create/open the binary output file */ - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL; - Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); + AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL; + Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix); if (ACPI_FAILURE (Status)) { goto CleanupAndExit; @@ -273,7 +273,7 @@ DtDoCompile ( /* Write the binary, then the optional hex file */ - DtOutputBinary (Gbl_RootTable); + DtOutputBinary (AslGbl_RootTable); HxDoHexOutput (); DtWriteTableToListing (); @@ -319,9 +319,9 @@ DtInitialize ( AcpiUtSetIntegerWidth (2); /* Set width to 64 bits */ - Gbl_FieldList = NULL; - Gbl_RootTable = NULL; - Gbl_SubtableStack = NULL; + AslGbl_FieldList = NULL; + AslGbl_RootTable = NULL; + AslGbl_SubtableStack = NULL; sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION); return (AE_OK); @@ -353,7 +353,7 @@ DtInsertCompilerIds ( * Don't insert current compiler ID if requested. Used for compiler * debug/validation only. */ - if (Gbl_UseOriginalCompilerId) + if (AslGbl_UseOriginalCompilerId) { return; } @@ -404,14 +404,14 @@ DtCompileDataTable ( Signature = DtGetFieldValue (*FieldList); if (!Signature) { - sprintf (MsgBuffer, "Expected \"%s\"", "Signature"); + sprintf (AslGbl_MsgBuffer, "Expected \"%s\"", "Signature"); DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, - *FieldList, MsgBuffer); + *FieldList, AslGbl_MsgBuffer); return (AE_ERROR); } - Gbl_Signature = UtLocalCacheCalloc (strlen (Signature) + 1); - strcpy (Gbl_Signature, Signature); + AslGbl_Signature = UtLocalCacheCalloc (strlen (Signature) + 1); + strcpy (AslGbl_Signature, Signature); /* * Handle tables that don't use the common ACPI table header structure. @@ -453,18 +453,18 @@ DtCompileDataTable ( DtInsertCompilerIds (*FieldList); Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader, - &Gbl_RootTable); + &AslGbl_RootTable); if (ACPI_FAILURE (Status)) { return (Status); } - DtPushSubtable (Gbl_RootTable); + DtPushSubtable (AslGbl_RootTable); /* Validate the signature via the ACPI table list */ TableData = AcpiDmGetTableData (Signature); - if (!TableData || Gbl_CompileGeneric) + if (!TableData || AslGbl_CompileGeneric) { /* Unknown table signature and/or force generic compile */ @@ -498,7 +498,7 @@ DtCompileDataTable ( return (Status); } - DtInsertSubtable (Gbl_RootTable, Subtable); + DtInsertSubtable (AslGbl_RootTable, Subtable); DtPopSubtable (); } } @@ -515,7 +515,7 @@ FinishHeader: DtSetTableLength (); AcpiTableHeader = ACPI_CAST_PTR ( - ACPI_TABLE_HEADER, Gbl_RootTable->Buffer); + ACPI_TABLE_HEADER, AslGbl_RootTable->Buffer); DtSetTableChecksum (&AcpiTableHeader->Checksum); DtDumpFieldList (RootField); @@ -612,21 +612,21 @@ DtCompileTable ( if (!LocalField) { - sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed", + sprintf (AslGbl_MsgBuffer, "Found NULL field - Field name \"%s\" needed", Info->Name); - DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer); Status = AE_BAD_DATA; goto Error; } /* Maintain table offsets */ - LocalField->TableOffset = Gbl_CurrentTableOffset; + LocalField->TableOffset = AslGbl_CurrentTableOffset; FieldLength = DtGetFieldLength (LocalField, Info); - Gbl_CurrentTableOffset += FieldLength; + AslGbl_CurrentTableOffset += FieldLength; FieldType = DtGetFieldType (Info); - Gbl_InputFieldCount++; + AslGbl_InputFieldCount++; switch (FieldType) { @@ -696,9 +696,9 @@ DtCompileTable ( break; default: - sprintf (MsgBuffer, "Invalid DMT opcode: 0x%.2X", + sprintf (AslGbl_MsgBuffer, "Invalid DMT opcode: 0x%.2X", Info->Opcode); - DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer); Status = AE_BAD_DATA; break; } diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 48d308b42..3b93f6b31 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -238,35 +238,35 @@ typedef struct dt_subtable /* List of all field names and values from the input source */ -DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_FieldList, NULL); +DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*AslGbl_FieldList, NULL); /* List of all compiled tables and subtables */ -DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_RootTable, NULL); +DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*AslGbl_RootTable, NULL); /* Stack for subtables */ -DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableStack, NULL); +DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*AslGbl_SubtableStack, NULL); /* List for defined labels */ -DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_LabelList, NULL); +DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*AslGbl_LabelList, NULL); /* Current offset within the binary output table */ -DT_EXTERN UINT32 DT_INIT_GLOBAL (Gbl_CurrentTableOffset, 0); +DT_EXTERN UINT32 DT_INIT_GLOBAL (AslGbl_CurrentTableOffset, 0); /* Local caches */ -DT_EXTERN UINT32 DT_INIT_GLOBAL (Gbl_SubtableCount, 0); -DT_EXTERN ASL_CACHE_INFO DT_INIT_GLOBAL (*Gbl_SubtableCacheList, NULL); -DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableCacheNext, NULL); -DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableCacheLast, NULL); +DT_EXTERN UINT32 DT_INIT_GLOBAL (AslGbl_SubtableCount, 0); +DT_EXTERN ASL_CACHE_INFO DT_INIT_GLOBAL (*AslGbl_SubtableCacheList, NULL); +DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*AslGbl_SubtableCacheNext, NULL); +DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*AslGbl_SubtableCacheLast, NULL); -DT_EXTERN UINT32 DT_INIT_GLOBAL (Gbl_FieldCount, 0); -DT_EXTERN ASL_CACHE_INFO DT_INIT_GLOBAL (*Gbl_FieldCacheList, NULL); -DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_FieldCacheNext, NULL); -DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_FieldCacheLast, NULL); +DT_EXTERN UINT32 DT_INIT_GLOBAL (AslGbl_FieldCount, 0); +DT_EXTERN ASL_CACHE_INFO DT_INIT_GLOBAL (*AslGbl_FieldCacheList, NULL); +DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*AslGbl_FieldCacheNext, NULL); +DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*AslGbl_FieldCacheLast, NULL); /* dtcompiler - main module */ diff --git a/source/compiler/dtexpress.c b/source/compiler/dtexpress.c index aa68cf1ee..e444b5cbd 100644 --- a/source/compiler/dtexpress.c +++ b/source/compiler/dtexpress.c @@ -168,7 +168,7 @@ DtLookupLabel ( /* Global used for errors during parse and related functions */ -DT_FIELD *Gbl_CurrentField; +DT_FIELD *AslGbl_CurrentField; /****************************************************************************** @@ -196,7 +196,7 @@ DtResolveIntegerExpression ( DbgPrint (ASL_DEBUG_OUTPUT, "Full Integer expression: %s\n", Field->Value); - Gbl_CurrentField = Field; + AslGbl_CurrentField = Field; Result = DtEvaluateExpression (Field->Value); *ReturnValue = Result; @@ -251,7 +251,7 @@ DtDoOperator ( if (!RightValue) { DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, - Gbl_CurrentField, NULL); + AslGbl_CurrentField, NULL); return (0); } @@ -263,7 +263,7 @@ DtDoOperator ( if (!RightValue) { DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, - Gbl_CurrentField, NULL); + AslGbl_CurrentField, NULL); return (0); } @@ -349,7 +349,7 @@ DtDoOperator ( /* Unknown operator */ DtFatal (ASL_MSG_INVALID_EXPRESSION, - Gbl_CurrentField, NULL); + AslGbl_CurrentField, NULL); return (0); } @@ -396,7 +396,7 @@ DtResolveLabel ( if (!LabelField) { DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL, - Gbl_CurrentField, LabelString); + AslGbl_CurrentField, LabelString); return (0); } @@ -431,7 +431,7 @@ DtDetectAllLabels ( UINT32 TableOffset; - TableOffset = Gbl_CurrentTableOffset; + TableOffset = AslGbl_CurrentTableOffset; GenericField = FieldList; /* @@ -485,8 +485,8 @@ DtInsertLabelField ( "DtInsertLabelField: Found Label : %s at output table offset %X\n", Field->Value, Field->TableOffset); - Field->NextLabel = Gbl_LabelList; - Gbl_LabelList = Field; + Field->NextLabel = AslGbl_LabelList; + AslGbl_LabelList = Field; } @@ -519,7 +519,7 @@ DtLookupLabel ( /* Search global list */ - LabelField = Gbl_LabelList; + LabelField = AslGbl_LabelList; while (LabelField) { if (!strcmp (Name, LabelField->Value)) diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index 50d484c9f..a9d56cab7 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -280,8 +280,8 @@ DtCompileString ( if (Length > ByteLength) { - sprintf (MsgBuffer, "Maximum %u characters", ByteLength); - DtError (ASL_ERROR, ASL_MSG_STRING_LENGTH, Field, MsgBuffer); + sprintf (AslGbl_MsgBuffer, "Maximum %u characters", ByteLength); + DtError (ASL_ERROR, ASL_MSG_STRING_LENGTH, Field, AslGbl_MsgBuffer); Length = ByteLength; } @@ -360,8 +360,8 @@ DtCompileUuid ( Status = AuValidateUuid (InString); if (ACPI_FAILURE (Status)) { - sprintf (MsgBuffer, "%s", Field->Value); - DtNameError (ASL_ERROR, ASL_MSG_INVALID_UUID, Field, MsgBuffer); + sprintf (AslGbl_MsgBuffer, "%s", Field->Value); + DtNameError (ASL_ERROR, ASL_MSG_INVALID_UUID, Field, AslGbl_MsgBuffer); } else { @@ -462,9 +462,9 @@ DtCompileInteger ( if (Value > MaxValue) { - sprintf (MsgBuffer, "%8.8X%8.8X - max %u bytes", + sprintf (AslGbl_MsgBuffer, "%8.8X%8.8X - max %u bytes", ACPI_FORMAT_UINT64 (Value), ByteLength); - DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer); + DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, AslGbl_MsgBuffer); } memcpy (Buffer, &Value, ByteLength); @@ -712,8 +712,8 @@ DtCompileFlag ( if (Value >= ((UINT64) 1 << BitLength)) { - sprintf (MsgBuffer, "Maximum %u bit", BitLength); - DtError (ASL_ERROR, ASL_MSG_FLAG_VALUE, Field, MsgBuffer); + sprintf (AslGbl_MsgBuffer, "Maximum %u bit", BitLength); + DtError (ASL_ERROR, ASL_MSG_FLAG_VALUE, Field, AslGbl_MsgBuffer); Value = 0; } diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c index 0ba15b421..b15d3b97f 100644 --- a/source/compiler/dtio.c +++ b/source/compiler/dtio.c @@ -209,7 +209,7 @@ DtDumpSubtableTree ( #define DT_MERGE_LINES 6 #define DT_ESCAPE_SEQUENCE 7 -static UINT32 Gbl_NextLineOffset; +static UINT32 AslGbl_NextLineOffset; /****************************************************************************** @@ -317,7 +317,7 @@ DtLinkField ( DT_FIELD *Next; - Prev = Next = Gbl_FieldList; + Prev = Next = AslGbl_FieldList; while (Next) { @@ -331,7 +331,7 @@ DtLinkField ( } else { - Gbl_FieldList = Field; + AslGbl_FieldList = Field; } } @@ -507,8 +507,8 @@ DtParseLine ( * Handles both slash-asterisk and slash-slash comments. * Also, quoted strings, but no escapes within. * - * Line is returned in Gbl_CurrentLineBuffer. - * Line number in original file is returned in Gbl_CurrentLineNumber. + * Line is returned in AslGbl_CurrentLineBuffer. + * Line number in original file is returned in AslGbl_CurrentLineNumber. * *****************************************************************************/ @@ -524,14 +524,14 @@ DtGetNextLine ( int c; - memset (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize); + memset (AslGbl_CurrentLineBuffer, 0, AslGbl_LineBufferSize); for (i = 0; ;) { /* * If line is too long, expand the line buffers. Also increases - * Gbl_LineBufferSize. + * AslGbl_LineBufferSize. */ - if (i >= Gbl_LineBufferSize) + if (i >= AslGbl_LineBufferSize) { UtExpandLineBuffers (); } @@ -576,7 +576,7 @@ DtGetNextLine ( /* Normal text, insert char into line buffer */ - Gbl_CurrentLineBuffer[i] = (char) c; + AslGbl_CurrentLineBuffer[i] = (char) c; switch (c) { case '/': @@ -601,9 +601,9 @@ DtGetNextLine ( case '\n': - CurrentLineOffset = Gbl_NextLineOffset; - Gbl_NextLineOffset = (UINT32) ftell (Handle); - Gbl_CurrentLineNumber++; + CurrentLineOffset = AslGbl_NextLineOffset; + AslGbl_NextLineOffset = (UINT32) ftell (Handle); + AslGbl_CurrentLineNumber++; /* * Exit if line is complete. Ignore empty lines (only \n) @@ -611,12 +611,12 @@ DtGetNextLine ( */ if ((i != 0) && LineNotAllBlanks) { - if ((i + 1) >= Gbl_LineBufferSize) + if ((i + 1) >= AslGbl_LineBufferSize) { UtExpandLineBuffers (); } - Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate string */ + AslGbl_CurrentLineBuffer[i+1] = 0; /* Terminate string */ return (CurrentLineOffset); } @@ -642,7 +642,7 @@ DtGetNextLine ( /* Insert raw chars until end of quoted string */ - Gbl_CurrentLineBuffer[i] = (char) c; + AslGbl_CurrentLineBuffer[i] = (char) c; i++; switch (c) @@ -663,7 +663,7 @@ DtGetNextLine ( { AcpiOsPrintf ( "ERROR at line %u: Unterminated quoted string\n", - Gbl_CurrentLineNumber++); + AslGbl_CurrentLineNumber++); State = DT_NORMAL_TEXT; } break; @@ -678,7 +678,7 @@ DtGetNextLine ( /* Just copy the escaped character. TBD: sufficient for table compiler? */ - Gbl_CurrentLineBuffer[i] = (char) c; + AslGbl_CurrentLineBuffer[i] = (char) c; i++; State = DT_START_QUOTED_STRING; break; @@ -702,12 +702,12 @@ DtGetNextLine ( default: /* Not a comment */ i++; /* Save the preceding slash */ - if (i >= Gbl_LineBufferSize) + if (i >= AslGbl_LineBufferSize) { UtExpandLineBuffers (); } - Gbl_CurrentLineBuffer[i] = (char) c; + AslGbl_CurrentLineBuffer[i] = (char) c; i++; State = DT_NORMAL_TEXT; break; @@ -722,8 +722,8 @@ DtGetNextLine ( { case '\n': - Gbl_NextLineOffset = (UINT32) ftell (Handle); - Gbl_CurrentLineNumber++; + AslGbl_NextLineOffset = (UINT32) ftell (Handle); + AslGbl_CurrentLineNumber++; break; case '*': @@ -763,9 +763,9 @@ DtGetNextLine ( case '\n': - CurrentLineOffset = Gbl_NextLineOffset; - Gbl_NextLineOffset = (UINT32) ftell (Handle); - Gbl_CurrentLineNumber++; + CurrentLineOffset = AslGbl_NextLineOffset; + AslGbl_NextLineOffset = (UINT32) ftell (Handle); + AslGbl_CurrentLineNumber++; break; case '*': @@ -800,14 +800,14 @@ DtGetNextLine ( * immediately by a newline. Insert a space between the * lines (overwrite the backslash) */ - Gbl_CurrentLineBuffer[i] = ' '; + AslGbl_CurrentLineBuffer[i] = ' '; i++; /* Ignore newline, this will merge the lines */ - CurrentLineOffset = Gbl_NextLineOffset; - Gbl_NextLineOffset = (UINT32) ftell (Handle); - Gbl_CurrentLineNumber++; + CurrentLineOffset = AslGbl_NextLineOffset; + AslGbl_NextLineOffset = (UINT32) ftell (Handle); + AslGbl_CurrentLineNumber++; State = DT_NORMAL_TEXT; } break; @@ -830,7 +830,7 @@ DtGetNextLine ( * RETURN: Pointer to start of the constructed parse tree. * * DESCRIPTION: Scan source file, link all field names and values - * to the global parse tree: Gbl_FieldList + * to the global parse tree: AslGbl_FieldList * *****************************************************************************/ @@ -847,25 +847,25 @@ DtScanFile ( /* Get the file size */ - Gbl_InputByteCount = CmGetFileSize (Handle); - if (Gbl_InputByteCount == ACPI_UINT32_MAX) + AslGbl_InputByteCount = CmGetFileSize (Handle); + if (AslGbl_InputByteCount == ACPI_UINT32_MAX) { AslAbort (); } - Gbl_CurrentLineNumber = 0; - Gbl_CurrentLineOffset = 0; - Gbl_NextLineOffset = 0; + AslGbl_CurrentLineNumber = 0; + AslGbl_CurrentLineOffset = 0; + AslGbl_NextLineOffset = 0; /* Scan line-by-line */ while ((Offset = DtGetNextLine (Handle, 0)) != ASL_EOF) { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s", - Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer)); + AslGbl_CurrentLineNumber, Offset, AslGbl_CurrentLineBuffer)); - Status = DtParseLine (Gbl_CurrentLineBuffer, - Gbl_CurrentLineNumber, Offset); + Status = DtParseLine (AslGbl_CurrentLineBuffer, + AslGbl_CurrentLineNumber, Offset); if (Status == AE_NOT_FOUND) { break; @@ -874,8 +874,8 @@ DtScanFile ( /* Dump the parse tree if debug enabled */ - DtDumpFieldList (Gbl_FieldList); - return (Gbl_FieldList); + DtDumpFieldList (AslGbl_FieldList); + return (AslGbl_FieldList); } @@ -932,8 +932,8 @@ DtOutputBinary ( DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL); - Gbl_TableLength = CmGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); - if (Gbl_TableLength == ACPI_UINT32_MAX) + AslGbl_TableLength = CmGetFileSize (AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle); + if (AslGbl_TableLength == ACPI_UINT32_MAX) { AslAbort (); } @@ -1048,7 +1048,7 @@ DtDumpFieldList ( DT_FIELD *Field) { - if (!Gbl_DebugFlag || !Field) + if (!AslGbl_DebugFlag || !Field) { return; } @@ -1132,7 +1132,7 @@ DtDumpSubtableList ( void) { - if (!Gbl_DebugFlag || !Gbl_RootTable) + if (!AslGbl_DebugFlag || !AslGbl_RootTable) { return; } @@ -1141,11 +1141,11 @@ DtDumpSubtableList ( "Subtable Info:\n" "Depth Name Length TotalLen LenSize Flags " "This Parent Child Peer\n\n"); - DtWalkTableTree (Gbl_RootTable, DtDumpSubtableInfo, NULL, NULL); + DtWalkTableTree (AslGbl_RootTable, DtDumpSubtableInfo, NULL, NULL); DbgPrint (ASL_DEBUG_OUTPUT, "\nSubtable Tree: (Depth, Name, Subtable, Length, TotalLength)\n\n"); - DtWalkTableTree (Gbl_RootTable, DtDumpSubtableTree, NULL, NULL); + DtWalkTableTree (AslGbl_RootTable, DtDumpSubtableTree, NULL, NULL); DbgPrint (ASL_DEBUG_OUTPUT, "\n"); } @@ -1174,7 +1174,7 @@ DtWriteFieldToListing ( UINT8 FileByte; - if (!Gbl_ListingFlag || !Field) + if (!AslGbl_ListingFlag || !Field) { return; } @@ -1232,24 +1232,24 @@ DtWriteTableToListing ( UINT8 *Buffer; - if (!Gbl_ListingFlag) + if (!AslGbl_ListingFlag) { return; } /* Read the entire table from the output file */ - Buffer = UtLocalCalloc (Gbl_TableLength); + Buffer = UtLocalCalloc (AslGbl_TableLength); FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - FlReadFile (ASL_FILE_AML_OUTPUT, Buffer, Gbl_TableLength); + FlReadFile (ASL_FILE_AML_OUTPUT, Buffer, AslGbl_TableLength); /* Dump the raw table data */ - AcpiOsRedirectOutput (Gbl_Files[ASL_FILE_LISTING_OUTPUT].Handle); + AcpiOsRedirectOutput (AslGbl_Files[ASL_FILE_LISTING_OUTPUT].Handle); AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n", - ACPI_RAW_TABLE_DATA_HEADER, Gbl_TableLength, Gbl_TableLength); - AcpiUtDumpBuffer (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY, 0); + ACPI_RAW_TABLE_DATA_HEADER, AslGbl_TableLength, AslGbl_TableLength); + AcpiUtDumpBuffer (Buffer, AslGbl_TableLength, DB_BYTE_DISPLAY, 0); AcpiOsRedirectOutput (stdout); ACPI_FREE (Buffer); diff --git a/source/compiler/dtparser.y b/source/compiler/dtparser.y index 1c4457123..a1ac1931d 100644 --- a/source/compiler/dtparser.y +++ b/source/compiler/dtparser.y @@ -166,7 +166,7 @@ int DtParserlex (void); int DtParserparse (void); void DtParsererror (char const *msg); extern char *DtParsertext; -extern DT_FIELD *Gbl_CurrentField; +extern DT_FIELD *AslGbl_CurrentField; UINT64 DtParserResult; /* Expression return value */ @@ -321,7 +321,7 @@ DtParsererror ( char const *Message) { DtError (ASL_ERROR, ASL_MSG_SYNTAX, - Gbl_CurrentField, (char *) Message); + AslGbl_CurrentField, (char *) Message); } @@ -381,7 +381,7 @@ DtEvaluateExpression ( if (DtInitLexer (ExprString)) { DtError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, - Gbl_CurrentField, "Could not initialize lexer"); + AslGbl_CurrentField, "Could not initialize lexer"); return (0); } diff --git a/source/compiler/dtsubtable.c b/source/compiler/dtsubtable.c index f2730c513..54e3138da 100644 --- a/source/compiler/dtsubtable.c +++ b/source/compiler/dtsubtable.c @@ -261,8 +261,8 @@ DtPushSubtable ( DT_SUBTABLE *Subtable) { - Subtable->StackTop = Gbl_SubtableStack; - Gbl_SubtableStack = Subtable; + Subtable->StackTop = AslGbl_SubtableStack; + AslGbl_SubtableStack = Subtable; } @@ -285,11 +285,11 @@ DtPopSubtable ( DT_SUBTABLE *Subtable; - Subtable = Gbl_SubtableStack; + Subtable = AslGbl_SubtableStack; if (Subtable) { - Gbl_SubtableStack = Subtable->StackTop; + AslGbl_SubtableStack = Subtable->StackTop; } } @@ -311,7 +311,7 @@ DtPeekSubtable ( void) { - return (Gbl_SubtableStack); + return (AslGbl_SubtableStack); } @@ -455,9 +455,9 @@ DtGetSubtableLength ( Error: if (!Field) { - sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed", + sprintf (AslGbl_MsgBuffer, "Found NULL field - Field name \"%s\" needed", Info->Name); - DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer); } return (ASL_EOF); diff --git a/source/compiler/dttable.c b/source/compiler/dttable.c index 44efbee47..8a937c054 100644 --- a/source/compiler/dttable.c +++ b/source/compiler/dttable.c @@ -182,13 +182,13 @@ DtCompileRsdp ( /* Compile the "common" RSDP (ACPI 1.0) */ Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp1, - &Gbl_RootTable); + &AslGbl_RootTable); if (ACPI_FAILURE (Status)) { return (Status); } - Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Gbl_RootTable->Buffer); + Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, AslGbl_RootTable->Buffer); DtSetTableChecksum (&Rsdp->Checksum); if (Rsdp->Revision > 0) @@ -202,12 +202,12 @@ DtCompileRsdp ( return (Status); } - DtInsertSubtable (Gbl_RootTable, Subtable); + DtInsertSubtable (AslGbl_RootTable, Subtable); /* Set length and extended checksum for entire RSDP */ RsdpExtension = ACPI_CAST_PTR (ACPI_RSDP_EXTENSION, Subtable->Buffer); - RsdpExtension->Length = Gbl_RootTable->Length + Subtable->Length; + RsdpExtension->Length = AslGbl_RootTable->Length + Subtable->Length; DtSetTableChecksum (&RsdpExtension->ExtendedChecksum); } @@ -326,7 +326,7 @@ DtCompileFacs ( Status = DtCompileTable (PFieldList, AcpiDmTableInfoFacs, - &Gbl_RootTable); + &AslGbl_RootTable); if (ACPI_FAILURE (Status)) { return (Status); @@ -340,6 +340,6 @@ DtCompileFacs ( DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); ACPI_FREE (ReservedBuffer); - DtInsertSubtable (Gbl_RootTable, Subtable); + DtInsertSubtable (AslGbl_RootTable, Subtable); return (AE_OK); } diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c index 785bc7a11..3f9703776 100644 --- a/source/compiler/dttable2.c +++ b/source/compiler/dttable2.c @@ -1288,13 +1288,13 @@ DtCompileS3pt ( Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt, - &Gbl_RootTable); + &AslGbl_RootTable); if (ACPI_FAILURE (Status)) { return (Status); } - DtPushSubtable (Gbl_RootTable); + DtPushSubtable (AslGbl_RootTable); while (*PFieldList) { @@ -2274,10 +2274,10 @@ DtCompileGeneric ( Info = DtGetGenericTableInfo ((*PFieldList)->Name); if (!Info) { - sprintf (MsgBuffer, "Generic data type \"%s\" not found", + sprintf (AslGbl_MsgBuffer, "Generic data type \"%s\" not found", (*PFieldList)->Name); DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, - (*PFieldList), MsgBuffer); + (*PFieldList), AslGbl_MsgBuffer); *PFieldList = (*PFieldList)->Next; continue; @@ -2299,10 +2299,10 @@ DtCompileGeneric ( if (Status == AE_NOT_FOUND) { - sprintf (MsgBuffer, "Generic data type \"%s\" not found", + sprintf (AslGbl_MsgBuffer, "Generic data type \"%s\" not found", (*PFieldList)->Name); DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, - (*PFieldList), MsgBuffer); + (*PFieldList), AslGbl_MsgBuffer); } } } diff --git a/source/compiler/dttemplate.c b/source/compiler/dttemplate.c index 89a145aad..46f56722c 100644 --- a/source/compiler/dttemplate.c +++ b/source/compiler/dttemplate.c @@ -546,7 +546,7 @@ DtCreateOneTemplate ( AcpiOsPrintf (" (static data table)\n"); - if (Gbl_VerboseTemplates) + if (AslGbl_VerboseTemplates) { AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength]" " FieldName : HexFieldValue\n */\n\n"); diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index fe079eacd..4018a9bea 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -201,7 +201,7 @@ DtError ( FieldObject->Line, FieldObject->ByteOffset, FieldObject->Column, - Gbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage); + AslGbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage); } else { @@ -239,7 +239,7 @@ DtNameError ( case ASL_WARNING2: case ASL_WARNING3: - if (Gbl_WarningLevel < Level) + if (AslGbl_WarningLevel < Level) { return; } @@ -257,7 +257,7 @@ DtNameError ( FieldObject->Line, FieldObject->ByteOffset, FieldObject->NameColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage); + AslGbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage); } else { @@ -640,8 +640,8 @@ DtGetFieldLength ( else { /* At this point, this is a fatal error */ - sprintf (MsgBuffer, "Expected \"%s\"", Info->Name); - DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + sprintf (AslGbl_MsgBuffer, "Expected \"%s\"", Info->Name); + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer); return (0); } break; @@ -672,8 +672,8 @@ DtGetFieldLength ( else { /* At this point, this is a fatal error */ - sprintf (MsgBuffer, "Expected \"%s\"", Info->Name); - DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + sprintf (AslGbl_MsgBuffer, "Expected \"%s\"", Info->Name); + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer); return (0); } break; @@ -768,7 +768,7 @@ DtSetTableChecksum ( UINT8 OldSum; - DtWalkTableTree (Gbl_RootTable, DtSum, NULL, &Checksum); + DtWalkTableTree (AslGbl_RootTable, DtSum, NULL, &Checksum); OldSum = *ChecksumPointer; Checksum = (UINT8) (Checksum - OldSum); @@ -800,7 +800,7 @@ DtSetTableLength ( DT_SUBTABLE *ChildTable; - ParentTable = Gbl_RootTable; + ParentTable = AslGbl_RootTable; ChildTable = NULL; if (!ParentTable) @@ -838,7 +838,7 @@ DtSetTableLength ( { ChildTable = ParentTable; - if (ChildTable == Gbl_RootTable) + if (ChildTable == AslGbl_RootTable) { break; } @@ -907,7 +907,7 @@ DtWalkTableTree ( else { ChildTable = ParentTable; - if (ChildTable == Gbl_RootTable) + if (ChildTable == AslGbl_RootTable) { break; } diff --git a/source/compiler/preprocess.h b/source/compiler/preprocess.h index 446fdaf4e..9ae7cf0c1 100644 --- a/source/compiler/preprocess.h +++ b/source/compiler/preprocess.h @@ -183,7 +183,7 @@ #define PR_PREFIX_ID "Pr(%.4u) - " /* Used for debug output */ -#define THIS_TOKEN_OFFSET(t) ((t-Gbl_MainTokenBuffer) + 1) +#define THIS_TOKEN_OFFSET(t) ((AslGbl_MainTokenBuffer - t) + 1) /* @@ -247,21 +247,22 @@ typedef struct directive_info /* * Globals */ +PR_EXTERN char PR_INIT_GLOBAL (*AslGbl_MainTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ +PR_EXTERN char PR_INIT_GLOBAL (*AslGbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ +PR_EXTERN char PR_INIT_GLOBAL (*AslGbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ + +PR_EXTERN UINT32 AslGbl_PreprocessorLineNumber; +PR_EXTERN int AslGbl_IfDepth; +PR_EXTERN PR_FILE_NODE *AslGbl_InputFileList; +PR_EXTERN BOOLEAN PR_INIT_GLOBAL (AslGbl_PreprocessorError, FALSE); +PR_EXTERN BOOLEAN PR_INIT_GLOBAL (AslGbl_IgnoringThisCodeBlock, FALSE); +PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*AslGbl_DefineList, NULL); +PR_EXTERN DIRECTIVE_INFO PR_INIT_GLOBAL (*AslGbl_DirectiveStack, NULL); + #if 0 /* TBD for macros */ PR_EXTERN char PR_INIT_GLOBAL (*XXXEvalBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ #endif -PR_EXTERN char PR_INIT_GLOBAL (*Gbl_MainTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ -PR_EXTERN char PR_INIT_GLOBAL (*Gbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ -PR_EXTERN char PR_INIT_GLOBAL (*Gbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ - -PR_EXTERN UINT32 Gbl_PreprocessorLineNumber; -PR_EXTERN int Gbl_IfDepth; -PR_EXTERN PR_FILE_NODE *Gbl_InputFileList; -PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*Gbl_DefineList, NULL); -PR_EXTERN BOOLEAN PR_INIT_GLOBAL (Gbl_PreprocessorError, FALSE); -PR_EXTERN BOOLEAN PR_INIT_GLOBAL (Gbl_IgnoringThisCodeBlock, FALSE); -PR_EXTERN DIRECTIVE_INFO PR_INIT_GLOBAL (*Gbl_DirectiveStack, NULL); /* * prscan - Preprocessor entry diff --git a/source/compiler/prexpress.c b/source/compiler/prexpress.c index 390aa2114..0d4fcfd18 100644 --- a/source/compiler/prexpress.c +++ b/source/compiler/prexpress.c @@ -223,8 +223,8 @@ PrExpandMacros ( int OffsetAdjust; - strcpy (Gbl_ExpressionTokenBuffer, Gbl_CurrentLineBuffer); - Token = PrGetNextToken (Gbl_ExpressionTokenBuffer, PR_EXPR_SEPARATORS, &Next); + strcpy (AslGbl_ExpressionTokenBuffer, AslGbl_CurrentLineBuffer); + Token = PrGetNextToken (AslGbl_ExpressionTokenBuffer, PR_EXPR_SEPARATORS, &Next); OffsetAdjust = 0; while (Token) @@ -238,10 +238,10 @@ PrExpandMacros ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Matched Macro: %s->%s\n", - Gbl_CurrentLineNumber, DefineInfo->Identifier, + AslGbl_CurrentLineNumber, DefineInfo->Identifier, DefineInfo->Replacement); - PrDoMacroInvocation (Gbl_ExpressionTokenBuffer, Token, + PrDoMacroInvocation (AslGbl_ExpressionTokenBuffer, Token, DefineInfo, &Next); } else @@ -250,9 +250,9 @@ PrExpandMacros ( /* Replace the name in the original line buffer */ - TokenOffset = Token - Gbl_ExpressionTokenBuffer + OffsetAdjust; + TokenOffset = Token - AslGbl_ExpressionTokenBuffer + OffsetAdjust; PrReplaceData ( - &Gbl_CurrentLineBuffer[TokenOffset], strlen (Token), + &AslGbl_CurrentLineBuffer[TokenOffset], strlen (Token), ReplaceString, strlen (ReplaceString)); /* Adjust for length difference between old and new name length */ @@ -261,7 +261,7 @@ PrExpandMacros ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Matched #define within expression: %s->%s\n", - Gbl_CurrentLineNumber, Token, + AslGbl_CurrentLineNumber, Token, *ReplaceString ? ReplaceString : "(NULL STRING)"); } } @@ -294,7 +294,7 @@ PrIsDefined ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "**** Is defined?: %s\n", Gbl_CurrentLineNumber, Identifier); + "**** Is defined?: %s\n", AslGbl_CurrentLineNumber, Identifier); Value = 0; /* Default is "Not defined" -- FALSE */ @@ -306,7 +306,7 @@ PrIsDefined ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "[#if defined %s] resolved to: %8.8X%8.8X\n", - Gbl_CurrentLineNumber, Identifier, ACPI_FORMAT_UINT64 (Value)); + AslGbl_CurrentLineNumber, Identifier, ACPI_FORMAT_UINT64 (Value)); return (Value); } @@ -333,7 +333,7 @@ PrResolveDefine ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "**** Resolve #define: %s\n", Gbl_CurrentLineNumber, Identifier); + "**** Resolve #define: %s\n", AslGbl_CurrentLineNumber, Identifier); Value = 0; /* Default is "Not defined" -- FALSE */ @@ -345,7 +345,7 @@ PrResolveDefine ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "[#if defined %s] resolved to: %8.8X%8.8X\n", - Gbl_CurrentLineNumber, Identifier, ACPI_FORMAT_UINT64 (Value)); + AslGbl_CurrentLineNumber, Identifier, ACPI_FORMAT_UINT64 (Value)); return (Value); } @@ -376,7 +376,7 @@ PrResolveIntegerExpression ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "**** Resolve #if: %s\n", Gbl_CurrentLineNumber, Line); + "**** Resolve #if: %s\n", AslGbl_CurrentLineNumber, Line); /* Expand all macros within the expression first */ @@ -387,7 +387,7 @@ PrResolveIntegerExpression ( Result = PrEvaluateExpression (ExpandedLine); DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "**** Expression Resolved to: %8.8X%8.8X\n", - Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Result)); + AslGbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Result)); *ReturnValue = Result; return (AE_OK); @@ -404,7 +404,7 @@ NormalExit: DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "**** Expression Resolved to: %8.8X%8.8X\n", - Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value1)); + AslGbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value1)); *ReturnValue = Value1; return (AE_OK); diff --git a/source/compiler/prmacros.c b/source/compiler/prmacros.c index c384288f8..5e75901e2 100644 --- a/source/compiler/prmacros.c +++ b/source/compiler/prmacros.c @@ -176,7 +176,7 @@ PrDumpPredefinedNames ( PR_DEFINE_INFO *DefineInfo; - DefineInfo = Gbl_DefineList; + DefineInfo = AslGbl_DefineList; while (DefineInfo) { DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID @@ -225,7 +225,7 @@ PrAddDefine ( { DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID, "#define: name already exists: %s\n", - Gbl_CurrentLineNumber, Identifier); + AslGbl_CurrentLineNumber, Identifier); /* * Name already exists. This is only an error if the target name @@ -257,13 +257,13 @@ PrAddDefine ( DefineInfo->Identifier = IdentifierString; DefineInfo->Persist = Persist; - if (Gbl_DefineList) + if (AslGbl_DefineList) { - Gbl_DefineList->Previous = DefineInfo; + AslGbl_DefineList->Previous = DefineInfo; } - DefineInfo->Next = Gbl_DefineList; - Gbl_DefineList = DefineInfo; + DefineInfo->Next = AslGbl_DefineList; + AslGbl_DefineList = DefineInfo; return (DefineInfo); } @@ -291,7 +291,7 @@ PrRemoveDefine ( /* Match name and delete the node */ - DefineInfo = Gbl_DefineList; + DefineInfo = AslGbl_DefineList; while (DefineInfo) { if (!strcmp (DefineName, DefineInfo->Identifier)) @@ -304,7 +304,7 @@ PrRemoveDefine ( } else { - Gbl_DefineList = DefineInfo->Next; + AslGbl_DefineList = DefineInfo->Next; } if (DefineInfo->Next) @@ -325,7 +325,7 @@ PrRemoveDefine ( */ DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "#undef: could not find %s\n", - Gbl_CurrentLineNumber, DefineName); + AslGbl_CurrentLineNumber, DefineName); } @@ -348,7 +348,7 @@ PrMatchDefine ( PR_DEFINE_INFO *DefineInfo; - DefineInfo = Gbl_DefineList; + DefineInfo = AslGbl_DefineList; while (DefineInfo) { if (!strcmp (MatchString, DefineInfo->Identifier)) @@ -399,10 +399,10 @@ PrAddMacro ( /* Find the end of the arguments list */ - TokenOffset = Name - Gbl_MainTokenBuffer + strlen (Name) + 1; + TokenOffset = Name - AslGbl_MainTokenBuffer + strlen (Name) + 1; while (1) { - BufferChar = Gbl_CurrentLineBuffer[TokenOffset]; + BufferChar = AslGbl_CurrentLineBuffer[TokenOffset]; if (BufferChar == '(') { Depth++; @@ -447,7 +447,7 @@ PrAddMacro ( /* Don't go beyond the argument list */ - TokenOffset = Token - Gbl_MainTokenBuffer + strlen (Token); + TokenOffset = Token - AslGbl_MainTokenBuffer + strlen (Token); if (TokenOffset > EndOfArgList) { break; @@ -455,7 +455,7 @@ PrAddMacro ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Macro arg: %s \n", - Gbl_CurrentLineNumber, Token); + AslGbl_CurrentLineNumber, Token); Args[i].Name = UtLocalCalloc (strlen (Token) + 1); strcpy (Args[i].Name, Token); @@ -472,7 +472,7 @@ PrAddMacro ( /* Get the macro body. Token now points to start of body */ - MacroBodyOffset = Token - Gbl_MainTokenBuffer; + MacroBodyOffset = Token - AslGbl_MainTokenBuffer; /* Match each method arg in the macro body for later use */ @@ -494,11 +494,11 @@ PrAddMacro ( UseCount = Args[i].UseCount; Args[i].Offset[UseCount] = - (Token - Gbl_MainTokenBuffer) - MacroBodyOffset; + (Token - AslGbl_MainTokenBuffer) - MacroBodyOffset; DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Macro Arg #%u: %s UseCount %u Offset %u \n", - Gbl_CurrentLineNumber, i, Token, + AslGbl_CurrentLineNumber, i, Token, UseCount+1, Args[i].Offset[UseCount]); Args[i].UseCount++; @@ -516,7 +516,7 @@ PrAddMacro ( Token = PrGetNextToken (NULL, PR_MACRO_SEPARATORS, Next); } - BodyInSource = &Gbl_CurrentLineBuffer[MacroBodyOffset]; + BodyInSource = &AslGbl_CurrentLineBuffer[MacroBodyOffset]; AddMacroToList: @@ -528,7 +528,7 @@ AddMacroToList: { DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "#define: macro name already exists: %s\n", - Gbl_CurrentLineNumber, Name); + AslGbl_CurrentLineNumber, Name); /* Error only if not exactly the same macro */ @@ -544,7 +544,7 @@ AddMacroToList: DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Macro body: %s \n", - Gbl_CurrentLineNumber, BodyInSource); + AslGbl_CurrentLineNumber, BodyInSource); /* Add macro to the #define list */ @@ -600,7 +600,7 @@ PrDoMacroInvocation ( /* Take a copy of the macro body for expansion */ - strcpy (Gbl_MacroTokenBuffer, DefineInfo->Body); + strcpy (AslGbl_MacroTokenBuffer, DefineInfo->Body); /* Replace each argument within the prototype body */ @@ -619,8 +619,8 @@ PrDoMacroInvocation ( Length = Token - MacroStart + strlen (Token) + 1; PrReplaceData ( - &Gbl_CurrentLineBuffer[TokenOffset], Length, - Gbl_MacroTokenBuffer, strlen (Gbl_MacroTokenBuffer)); + &AslGbl_CurrentLineBuffer[TokenOffset], Length, + AslGbl_MacroTokenBuffer, strlen (AslGbl_MacroTokenBuffer)); return; } @@ -647,12 +647,12 @@ PrDoMacroInvocation ( } PrReplaceData ( - &Gbl_MacroTokenBuffer[Args->Offset[i]], strlen (Args->Name), + &AslGbl_MacroTokenBuffer[Args->Offset[i]], strlen (Args->Name), Token, strlen (Token)); DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "ExpandArg: %s \n", - Gbl_CurrentLineNumber, Gbl_MacroTokenBuffer); + AslGbl_CurrentLineNumber, AslGbl_MacroTokenBuffer); } Args++; @@ -671,8 +671,8 @@ PrDoMacroInvocation ( Length = Token - MacroStart + strlen (Token) + 1; PrReplaceData ( - &Gbl_CurrentLineBuffer[TokenOffset], Length, - Gbl_MacroTokenBuffer, strlen (Gbl_MacroTokenBuffer)); + &AslGbl_CurrentLineBuffer[TokenOffset], Length, + AslGbl_MacroTokenBuffer, strlen (AslGbl_MacroTokenBuffer)); return; @@ -683,6 +683,6 @@ BadInvocation: DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Bad macro invocation: %s \n", - Gbl_CurrentLineNumber, Gbl_MacroTokenBuffer); + AslGbl_CurrentLineNumber, AslGbl_MacroTokenBuffer); return; } diff --git a/source/compiler/prparser.l b/source/compiler/prparser.l index 8940197b7..a379a4fd3 100644 --- a/source/compiler/prparser.l +++ b/source/compiler/prparser.l @@ -155,8 +155,8 @@ /* Buffer to pass strings to the parser */ -#define STRING_SETUP strcpy (StringBuffer, PrParsertext);\ - PrParserlval.str = StringBuffer +#define STRING_SETUP strcpy (AslGbl_StringBuffer, PrParsertext);\ + PrParserlval.str = AslGbl_StringBuffer #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("prscanner") diff --git a/source/compiler/prparser.y b/source/compiler/prparser.y index a00d60035..08cb666a6 100644 --- a/source/compiler/prparser.y +++ b/source/compiler/prparser.y @@ -321,10 +321,10 @@ PrParsererror ( char const *Message) { - sprintf (StringBuffer, "Preprocessor Parser : %s (near line %u)", - Message, Gbl_CurrentLineNumber); + sprintf (AslGbl_StringBuffer, "Preprocessor Parser : %s (near line %u)", + Message, AslGbl_CurrentLineNumber); DtError (ASL_ERROR, ASL_MSG_SYNTAX, - NULL, (char *) StringBuffer); + NULL, (char *) AslGbl_StringBuffer); } diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index 939d4e6f1..580b47f0a 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -214,7 +214,7 @@ PrDoIncludeFile ( * Supported preprocessor directives * Each entry is of the form "Name, ArgumentCount" */ -static const PR_DIRECTIVE_INFO Gbl_DirectiveInfo[] = +static const PR_DIRECTIVE_INFO AslGbl_DirectiveInfo[] = { {"define", 1}, {"elif", 0}, /* Converted to #else..#if internally */ @@ -275,7 +275,7 @@ PrInitializePreprocessor ( /* Init globals and the list of #defines */ PrInitializeGlobals (); - Gbl_DefineList = NULL; + AslGbl_DefineList = NULL; } @@ -299,16 +299,16 @@ PrInitializeGlobals ( { /* Init globals */ - Gbl_InputFileList = NULL; - Gbl_CurrentLineNumber = 1; - Gbl_PreprocessorLineNumber = 1; - Gbl_PreprocessorError = FALSE; + AslGbl_InputFileList = NULL; + AslGbl_CurrentLineNumber = 1; + AslGbl_PreprocessorLineNumber = 1; + AslGbl_PreprocessorError = FALSE; /* These are used to track #if/#else blocks (possibly nested) */ - Gbl_IfDepth = 0; - Gbl_IgnoringThisCodeBlock = FALSE; - Gbl_DirectiveStack = NULL; + AslGbl_IfDepth = 0; + AslGbl_IgnoringThisCodeBlock = FALSE; + AslGbl_DirectiveStack = NULL; } @@ -337,10 +337,10 @@ PrTerminatePreprocessor ( * The persistent defines (created on the command line) are always at the * end of the list. We save them. */ - while ((Gbl_DefineList) && (!Gbl_DefineList->Persist)) + while ((AslGbl_DefineList) && (!AslGbl_DefineList->Persist)) { - DefineInfo = Gbl_DefineList; - Gbl_DefineList = DefineInfo->Next; + DefineInfo = AslGbl_DefineList; + AslGbl_DefineList = DefineInfo->Next; ACPI_FREE (DefineInfo->Replacement); ACPI_FREE (DefineInfo->Identifier); @@ -388,15 +388,15 @@ PrDoPreprocess ( /* Point compiler input to the new preprocessor output file (.pre) */ FlCloseFile (ASL_FILE_INPUT); - Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle; - AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; + AslGbl_Files[ASL_FILE_INPUT].Handle = AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle; + AslCompilerin = AslGbl_Files[ASL_FILE_INPUT].Handle; /* Reset globals to allow compiler to run */ FlSeekFile (ASL_FILE_INPUT, 0); - if (!Gbl_PreprocessOnly) + if (!AslGbl_PreprocessOnly) { - Gbl_CurrentLineNumber = 0; + AslGbl_CurrentLineNumber = 0; } DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n"); @@ -436,10 +436,10 @@ PrPreprocessInputFile ( /* Scan source line-by-line and process directives. Then write the .i file */ - while ((Status = PrGetNextLine (Gbl_Files[ASL_FILE_INPUT].Handle)) != ASL_EOF) + while ((Status = PrGetNextLine (AslGbl_Files[ASL_FILE_INPUT].Handle)) != ASL_EOF) { - Gbl_CurrentLineNumber++; - Gbl_LogicalLineNumber++; + AslGbl_CurrentLineNumber++; + AslGbl_LogicalLineNumber++; if (Status == ASL_IGNORE_LINE) { @@ -448,8 +448,8 @@ PrPreprocessInputFile ( /* Need a copy of the input line for strok() */ - strcpy (Gbl_MainTokenBuffer, Gbl_CurrentLineBuffer); - Token = PrGetNextToken (Gbl_MainTokenBuffer, PR_TOKEN_SEPARATORS, &Next); + strcpy (AslGbl_MainTokenBuffer, AslGbl_CurrentLineBuffer); + Token = PrGetNextToken (AslGbl_MainTokenBuffer, PR_TOKEN_SEPARATORS, &Next); OffsetAdjust = 0; /* All preprocessor directives must begin with '#' */ @@ -476,7 +476,7 @@ PrPreprocessInputFile ( * FALSE, ignore the line and do not write it to the output file. * This continues until an #else or #endif is encountered. */ - if (Gbl_IgnoringThisCodeBlock) + if (AslGbl_IgnoringThisCodeBlock) { continue; } @@ -494,10 +494,10 @@ PrPreprocessInputFile ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Matched Macro: %s->%s\n", - Gbl_CurrentLineNumber, DefineInfo->Identifier, + AslGbl_CurrentLineNumber, DefineInfo->Identifier, DefineInfo->Replacement); - PrDoMacroInvocation (Gbl_MainTokenBuffer, Token, + PrDoMacroInvocation (AslGbl_MainTokenBuffer, Token, DefineInfo, &Next); } else @@ -506,9 +506,9 @@ PrPreprocessInputFile ( /* Replace the name in the original line buffer */ - TokenOffset = Token - Gbl_MainTokenBuffer + OffsetAdjust; + TokenOffset = Token - AslGbl_MainTokenBuffer + OffsetAdjust; PrReplaceData ( - &Gbl_CurrentLineBuffer[TokenOffset], strlen (Token), + &AslGbl_CurrentLineBuffer[TokenOffset], strlen (Token), ReplaceString, strlen (ReplaceString)); /* Adjust for length difference between old and new name length */ @@ -517,7 +517,7 @@ PrPreprocessInputFile ( DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Matched #define: %s->%s\n", - Gbl_CurrentLineNumber, Token, + AslGbl_CurrentLineNumber, Token, *ReplaceString ? ReplaceString : "(NULL STRING)"); } } @@ -525,7 +525,7 @@ PrPreprocessInputFile ( Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, &Next); } - Gbl_PreprocessorLineNumber++; + AslGbl_PreprocessorLineNumber++; WriteEntireLine: @@ -533,8 +533,8 @@ WriteEntireLine: * Now we can write the possibly modified source line to the * preprocessor file(s). */ - FlWriteFile (ASL_FILE_PREPROCESSOR, Gbl_CurrentLineBuffer, - strlen (Gbl_CurrentLineBuffer)); + FlWriteFile (ASL_FILE_PREPROCESSOR, AslGbl_CurrentLineBuffer, + strlen (AslGbl_CurrentLineBuffer)); } } @@ -557,7 +557,7 @@ PrDoDirective ( char *DirectiveToken, char **Next) { - char *Token = Gbl_MainTokenBuffer; + char *Token = AslGbl_MainTokenBuffer; char *Token2 = NULL; char *End; UINT64 Value; @@ -579,7 +579,7 @@ PrDoDirective ( DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "#%s: Unknown directive\n", - Gbl_CurrentLineNumber, DirectiveToken); + AslGbl_CurrentLineNumber, DirectiveToken); return; } @@ -590,25 +590,25 @@ PrDoDirective ( * original source file. */ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\" // #%s\n", - Gbl_CurrentLineNumber, Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_DirectiveInfo[Directive].Name); + AslGbl_CurrentLineNumber, AslGbl_Files[ASL_FILE_INPUT].Filename, + AslGbl_DirectiveInfo[Directive].Name); /* * If we are currently ignoring this block and we encounter a #else or * #elif, we must ignore their blocks also if the parent block is also * being ignored. */ - if (Gbl_IgnoringThisCodeBlock) + if (AslGbl_IgnoringThisCodeBlock) { switch (Directive) { case PR_DIRECTIVE_ELSE: case PR_DIRECTIVE_ELIF: - if (Gbl_DirectiveStack && - Gbl_DirectiveStack->IgnoringThisCodeBlock) + if (AslGbl_DirectiveStack && + AslGbl_DirectiveStack->IgnoringThisCodeBlock) { - PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name); + PrDbgPrint ("Ignoring", AslGbl_DirectiveInfo[Directive].Name); return; } break; @@ -627,16 +627,16 @@ PrDoDirective ( { case PR_DIRECTIVE_ELSE: - Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock); + AslGbl_IgnoringThisCodeBlock = !(AslGbl_IgnoringThisCodeBlock); PrDbgPrint ("Executing", "else block"); return; case PR_DIRECTIVE_ELIF: - Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock); + AslGbl_IgnoringThisCodeBlock = !(AslGbl_IgnoringThisCodeBlock); Directive = PR_DIRECTIVE_IF; - if (Gbl_IgnoringThisCodeBlock == TRUE) + if (AslGbl_IgnoringThisCodeBlock == TRUE) { /* Not executing the ELSE part -- all done here */ PrDbgPrint ("Ignoring", "elif block"); @@ -675,7 +675,7 @@ PrDoDirective ( /* Most directives have at least one argument */ - if (Gbl_DirectiveInfo[Directive].ArgCount >= 1) + if (AslGbl_DirectiveInfo[Directive].ArgCount >= 1) { Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); if (!Token) @@ -684,7 +684,7 @@ PrDoDirective ( } } - if (Gbl_DirectiveInfo[Directive].ArgCount >= 2) + if (AslGbl_DirectiveInfo[Directive].ArgCount >= 2) { Token2 = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); if (!Token2) @@ -699,7 +699,7 @@ PrDoDirective ( * For "if" style directives, open/push a new block anyway. We * must do this to keep track of #endif directives */ - if (Gbl_IgnoringThisCodeBlock) + if (AslGbl_IgnoringThisCodeBlock) { switch (Directive) { @@ -708,7 +708,7 @@ PrDoDirective ( case PR_DIRECTIVE_IFNDEF: PrPushDirective (Directive, Token); - PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name); + PrDbgPrint ("Ignoring", AslGbl_DirectiveInfo[Directive].Name); break; default: @@ -721,18 +721,18 @@ PrDoDirective ( /* * Execute the directive */ - PrDbgPrint ("Begin execution", Gbl_DirectiveInfo[Directive].Name); + PrDbgPrint ("Begin execution", AslGbl_DirectiveInfo[Directive].Name); switch (Directive) { case PR_DIRECTIVE_IF: - TokenOffset = Token - Gbl_MainTokenBuffer; + TokenOffset = Token - AslGbl_MainTokenBuffer; /* Need to expand #define macros in the expression string first */ Status = PrResolveIntegerExpression ( - &Gbl_CurrentLineBuffer[TokenOffset-1], &Value); + &AslGbl_CurrentLineBuffer[TokenOffset-1], &Value); if (ACPI_FAILURE (Status)) { return; @@ -741,13 +741,13 @@ PrDoDirective ( PrPushDirective (Directive, Token); if (!Value) { - Gbl_IgnoringThisCodeBlock = TRUE; + AslGbl_IgnoringThisCodeBlock = TRUE; } DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Resolved #if: %8.8X%8.8X %s\n", - Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), - Gbl_IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>"); + AslGbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), + AslGbl_IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>"); break; case PR_DIRECTIVE_IFDEF: @@ -755,7 +755,7 @@ PrDoDirective ( PrPushDirective (Directive, Token); if (!PrMatchDefine (Token)) { - Gbl_IgnoringThisCodeBlock = TRUE; + AslGbl_IgnoringThisCodeBlock = TRUE; } PrDbgPrint ("Evaluated", "ifdef"); @@ -766,7 +766,7 @@ PrDoDirective ( PrPushDirective (Directive, Token); if (PrMatchDefine (Token)) { - Gbl_IgnoringThisCodeBlock = TRUE; + AslGbl_IgnoringThisCodeBlock = TRUE; } PrDbgPrint ("Evaluated", "ifndef"); @@ -777,13 +777,13 @@ PrDoDirective ( * By definition, if first char after the name is a paren, * this is a function macro. */ - TokenOffset = Token - Gbl_MainTokenBuffer + strlen (Token); - if (*(&Gbl_CurrentLineBuffer[TokenOffset]) == '(') + TokenOffset = Token - AslGbl_MainTokenBuffer + strlen (Token); + if (*(&AslGbl_CurrentLineBuffer[TokenOffset]) == '(') { #ifndef MACROS_SUPPORTED AcpiOsPrintf ( "%s ERROR - line %u: #define macros are not supported yet\n", - Gbl_CurrentLineBuffer, Gbl_LogicalLineNumber); + AslGbl_CurrentLineBuffer, AslGbl_LogicalLineNumber); exit(1); #else PrAddMacro (Token, Next); @@ -822,7 +822,7 @@ PrDoDirective ( #endif DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "New #define: %s->%s\n", - Gbl_LogicalLineNumber, Token, Token2); + AslGbl_LogicalLineNumber, Token, Token2); PrAddDefine (Token, Token2, FALSE); } @@ -835,8 +835,8 @@ PrDoDirective ( PrError (ASL_ERROR, ASL_MSG_ERROR_DIRECTIVE, THIS_TOKEN_OFFSET (Token)); - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; + AslGbl_SourceLine = 0; + AslGbl_NextError = AslGbl_ErrorLog; CmCleanupAndExit (); exit(1); @@ -849,8 +849,8 @@ PrDoDirective ( } DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID - "Start #include file \"%s\"\n", Gbl_CurrentLineNumber, - Token, Gbl_CurrentLineNumber); + "Start #include file \"%s\"\n", AslGbl_CurrentLineNumber, + Token, AslGbl_CurrentLineNumber); PrDoIncludeFile (Token); break; @@ -871,32 +871,32 @@ PrDoDirective ( DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Start #includebuffer input from file \"%s\", buffer name %s\n", - Gbl_CurrentLineNumber, Token, Token2); + AslGbl_CurrentLineNumber, Token, Token2); PrDoIncludeBuffer (Token, Token2); break; case PR_DIRECTIVE_LINE: - TokenOffset = Token - Gbl_MainTokenBuffer; + TokenOffset = Token - AslGbl_MainTokenBuffer; Status = PrResolveIntegerExpression ( - &Gbl_CurrentLineBuffer[TokenOffset-1], &Value); + &AslGbl_CurrentLineBuffer[TokenOffset-1], &Value); if (ACPI_FAILURE (Status)) { return; } DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID - "User #line invocation %s\n", Gbl_CurrentLineNumber, + "User #line invocation %s\n", AslGbl_CurrentLineNumber, Token); - Gbl_CurrentLineNumber = (UINT32) Value; + AslGbl_CurrentLineNumber = (UINT32) Value; /* Emit #line into the preprocessor file */ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n", - Gbl_CurrentLineNumber, Gbl_Files[ASL_FILE_INPUT].Filename); + AslGbl_CurrentLineNumber, AslGbl_Files[ASL_FILE_INPUT].Filename); break; case PR_DIRECTIVE_PRAGMA: @@ -909,8 +909,8 @@ PrDoDirective ( goto SyntaxError; } - TokenOffset = Token - Gbl_MainTokenBuffer; - AslDisableException (&Gbl_CurrentLineBuffer[TokenOffset]); + TokenOffset = Token - AslGbl_MainTokenBuffer; + AslDisableException (&AslGbl_CurrentLineBuffer[TokenOffset]); } else if (!strcmp (Token, "message")) { @@ -920,8 +920,8 @@ PrDoDirective ( goto SyntaxError; } - TokenOffset = Token - Gbl_MainTokenBuffer; - AcpiOsPrintf ("%s\n", &Gbl_CurrentLineBuffer[TokenOffset]); + TokenOffset = Token - AslGbl_MainTokenBuffer; + AcpiOsPrintf ("%s\n", &AslGbl_CurrentLineBuffer[TokenOffset]); } else { @@ -935,7 +935,7 @@ PrDoDirective ( case PR_DIRECTIVE_UNDEF: DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID - "#undef: %s\n", Gbl_CurrentLineNumber, Token); + "#undef: %s\n", AslGbl_CurrentLineNumber, Token); PrRemoveDefine (Token); break; @@ -945,8 +945,8 @@ PrDoDirective ( PrError (ASL_WARNING, ASL_MSG_WARNING_DIRECTIVE, THIS_TOKEN_OFFSET (Token)); - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; + AslGbl_SourceLine = 0; + AslGbl_NextError = AslGbl_ErrorLog; break; default: @@ -954,7 +954,7 @@ PrDoDirective ( /* Should never get here */ DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Unrecognized directive: %u\n", - Gbl_CurrentLineNumber, Directive); + AslGbl_CurrentLineNumber, Directive); break; } @@ -1010,14 +1010,14 @@ PrGetNextLine ( /* Always clear the global line buffer */ - memset (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize); + memset (AslGbl_CurrentLineBuffer, 0, AslGbl_LineBufferSize); for (i = 0; ;) { /* * If line is too long, expand the line buffers. Also increases - * Gbl_LineBufferSize. + * AslGbl_LineBufferSize. */ - if (i >= Gbl_LineBufferSize) + if (i >= AslGbl_LineBufferSize) { UtExpandLineBuffers (); } @@ -1033,7 +1033,7 @@ PrGetNextLine ( */ if (i > 0) { - Gbl_CurrentLineBuffer[i] = '\n'; + AslGbl_CurrentLineBuffer[i] = '\n'; return (AE_OK); } @@ -1093,7 +1093,7 @@ PrGetNextLine ( /* Always copy the character into line buffer */ - Gbl_CurrentLineBuffer[i] = (char) c; + AslGbl_CurrentLineBuffer[i] = (char) c; i++; /* Always exit on end-of-line */ @@ -1152,9 +1152,9 @@ PrMatchDirective ( return (ASL_DIRECTIVE_NOT_FOUND); } - for (i = 0; Gbl_DirectiveInfo[i].Name; i++) + for (i = 0; AslGbl_DirectiveInfo[i].Name; i++) { - if (!strcmp (Gbl_DirectiveInfo[i].Name, Directive)) + if (!strcmp (AslGbl_DirectiveInfo[i].Name, Directive)) { return (i); } @@ -1191,25 +1191,26 @@ PrPushDirective ( /* Allocate and populate a stack info item */ - Info = ACPI_ALLOCATE (sizeof (DIRECTIVE_INFO)); + Info = ACPI_CAST_PTR (DIRECTIVE_INFO, + UtLocalCacheCalloc (sizeof (DIRECTIVE_INFO))); - Info->Next = Gbl_DirectiveStack; + Info->Next = AslGbl_DirectiveStack; Info->Directive = Directive; - Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock; + Info->IgnoringThisCodeBlock = AslGbl_IgnoringThisCodeBlock; AcpiUtSafeStrncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n", - Gbl_CurrentLineNumber, Gbl_IfDepth, - Gbl_IgnoringThisCodeBlock ? "I" : "E", - Gbl_IfDepth * 4, " ", - Gbl_DirectiveInfo[Directive].Name, - Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE"); + AslGbl_CurrentLineNumber, AslGbl_IfDepth, + AslGbl_IgnoringThisCodeBlock ? "I" : "E", + AslGbl_IfDepth * 4, " ", + AslGbl_DirectiveInfo[Directive].Name, + Argument, AslGbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE"); /* Push new item */ - Gbl_DirectiveStack = Info; - Gbl_IfDepth++; + AslGbl_DirectiveStack = Info; + AslGbl_IfDepth++; } @@ -1238,7 +1239,7 @@ PrPopDirective ( /* Check for empty stack */ - Info = Gbl_DirectiveStack; + Info = AslGbl_DirectiveStack; if (!Info) { return (AE_ERROR); @@ -1246,17 +1247,17 @@ PrPopDirective ( /* Pop one item, keep globals up-to-date */ - Gbl_IfDepth--; - Gbl_IgnoringThisCodeBlock = Info->IgnoringThisCodeBlock; - Gbl_DirectiveStack = Info->Next; + AslGbl_IfDepth--; + AslGbl_IgnoringThisCodeBlock = Info->IgnoringThisCodeBlock; + AslGbl_DirectiveStack = Info->Next; DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] %*s Popped [#%s %s]: IgnoreFlag now = %s\n", - Gbl_CurrentLineNumber, Gbl_IfDepth, - Gbl_IgnoringThisCodeBlock ? "I" : "E", - Gbl_IfDepth * 4, " ", - Gbl_DirectiveInfo[Info->Directive].Name, - Info->Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE"); + AslGbl_CurrentLineNumber, AslGbl_IfDepth, + AslGbl_IgnoringThisCodeBlock ? "I" : "E", + AslGbl_IfDepth * 4, " ", + AslGbl_DirectiveInfo[Info->Directive].Name, + Info->Argument, AslGbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE"); ACPI_FREE (Info); return (AE_OK); @@ -1284,10 +1285,10 @@ PrDbgPrint ( DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] " "%*s %s #%s, IfDepth %u\n", - Gbl_CurrentLineNumber, Gbl_IfDepth, - Gbl_IgnoringThisCodeBlock ? "I" : "E", - Gbl_IfDepth * 4, " ", - Action, DirectiveName, Gbl_IfDepth); + AslGbl_CurrentLineNumber, AslGbl_IfDepth, + AslGbl_IgnoringThisCodeBlock ? "I" : "E", + AslGbl_IfDepth * 4, " ", + Action, DirectiveName, AslGbl_IfDepth); } @@ -1365,7 +1366,7 @@ PrDoIncludeBuffer ( DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "#includebuffer: read %u bytes from %s\n", - Gbl_CurrentLineNumber, i, FullPathname); + AslGbl_CurrentLineNumber, i, FullPathname); /* Close the Name() operator */ diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c index 51fe2a5a1..4480d11c4 100644 --- a/source/compiler/prutils.c +++ b/source/compiler/prutils.c @@ -261,8 +261,8 @@ PrError ( UINT32 Column) { #if 0 - AcpiOsPrintf ("%s (%u) : %s", Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_CurrentLineNumber, Gbl_CurrentLineBuffer); + AcpiOsPrintf ("%s (%u) : %s", AslGbl_Files[ASL_FILE_INPUT].Filename, + AslGbl_CurrentLineNumber, AslGbl_CurrentLineBuffer); #endif @@ -274,11 +274,11 @@ PrError ( /* TBD: Need Logical line number? */ AslCommonError2 (Level, MessageId, - Gbl_CurrentLineNumber, Column, - Gbl_CurrentLineBuffer, - Gbl_Files[ASL_FILE_INPUT].Filename, "Preprocessor"); + AslGbl_CurrentLineNumber, Column, + AslGbl_CurrentLineBuffer, + AslGbl_Files[ASL_FILE_INPUT].Filename, "Preprocessor"); - Gbl_PreprocessorError = TRUE; + AslGbl_PreprocessorError = TRUE; } @@ -358,7 +358,7 @@ PrOpenIncludeFile ( /* Start the actual include file on the next line */ - Gbl_CurrentLineOffset++; + AslGbl_CurrentLineOffset++; /* Attempt to open the include file */ /* If the file specifies an absolute path, just open it */ @@ -385,7 +385,7 @@ PrOpenIncludeFile ( * Construct the file pathname from the global directory name. */ IncludeFile = PrOpenIncludeWithPrefix ( - Gbl_DirectoryPath, Filename, OpenMode, FullPathname); + AslGbl_DirectoryPath, Filename, OpenMode, FullPathname); if (IncludeFile) { return (IncludeFile); @@ -395,7 +395,7 @@ PrOpenIncludeFile ( * Second, search for the file within the (possibly multiple) * directories specified by the -I option on the command line. */ - NextDir = Gbl_IncludeDirList; + NextDir = AslGbl_IncludeDirList; while (NextDir) { IncludeFile = PrOpenIncludeWithPrefix ( @@ -411,7 +411,7 @@ PrOpenIncludeFile ( /* We could not open the include file after trying very hard */ ErrorExit: - sprintf (Gbl_MainTokenBuffer, "%s, %s", Filename, strerror (errno)); + sprintf (AslGbl_MainTokenBuffer, "%s, %s", Filename, strerror (errno)); PrError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, 0); return (NULL); } @@ -448,7 +448,7 @@ PrOpenIncludeWithPrefix ( DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Include: Opening file - \"%s\"\n", - Gbl_CurrentLineNumber, Pathname); + AslGbl_CurrentLineNumber, Pathname); /* Attempt to open the file, push if successful */ @@ -490,33 +490,33 @@ PrPushInputFileStack ( PR_FILE_NODE *Fnode; - Gbl_HasIncludeFiles = TRUE; + AslGbl_HasIncludeFiles = TRUE; /* Save the current state in an Fnode */ Fnode = UtLocalCalloc (sizeof (PR_FILE_NODE)); - Fnode->File = Gbl_Files[ASL_FILE_INPUT].Handle; - Fnode->Next = Gbl_InputFileList; - Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; + Fnode->File = AslGbl_Files[ASL_FILE_INPUT].Handle; + Fnode->Next = AslGbl_InputFileList; + Fnode->Filename = AslGbl_Files[ASL_FILE_INPUT].Filename; + Fnode->CurrentLineNumber = AslGbl_CurrentLineNumber; /* Push it on the stack */ - Gbl_InputFileList = Fnode; + AslGbl_InputFileList = Fnode; DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Push InputFile Stack: handle %p\n\n", - Gbl_CurrentLineNumber, InputFile); + AslGbl_CurrentLineNumber, InputFile); /* Reset the global line count and filename */ - Gbl_Files[ASL_FILE_INPUT].Filename = + AslGbl_Files[ASL_FILE_INPUT].Filename = UtLocalCacheCalloc (strlen (Filename) + 1); - strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename); + strcpy (AslGbl_Files[ASL_FILE_INPUT].Filename, Filename); - Gbl_Files[ASL_FILE_INPUT].Handle = InputFile; - Gbl_CurrentLineNumber = 1; + AslGbl_Files[ASL_FILE_INPUT].Handle = InputFile; + AslGbl_CurrentLineNumber = 1; /* Emit a new #line directive for the include file */ @@ -546,10 +546,10 @@ PrPopInputFileStack ( PR_FILE_NODE *Fnode; - Fnode = Gbl_InputFileList; + Fnode = AslGbl_InputFileList; DbgPrint (ASL_PARSE_OUTPUT, "\n" PR_PREFIX_ID "Pop InputFile Stack, Fnode %p\n\n", - Gbl_CurrentLineNumber, Fnode); + AslGbl_CurrentLineNumber, Fnode); if (!Fnode) { @@ -558,22 +558,22 @@ PrPopInputFileStack ( /* Close the current include file */ - fclose (Gbl_Files[ASL_FILE_INPUT].Handle); + fclose (AslGbl_Files[ASL_FILE_INPUT].Handle); /* Update the top-of-stack */ - Gbl_InputFileList = Fnode->Next; + AslGbl_InputFileList = Fnode->Next; /* Reset global line counter and filename */ - Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename; - Gbl_Files[ASL_FILE_INPUT].Handle = Fnode->File; - Gbl_CurrentLineNumber = Fnode->CurrentLineNumber; + AslGbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename; + AslGbl_Files[ASL_FILE_INPUT].Handle = Fnode->File; + AslGbl_CurrentLineNumber = Fnode->CurrentLineNumber; /* Emit a new #line directive after the include file */ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n", - Gbl_CurrentLineNumber, Fnode->Filename); + AslGbl_CurrentLineNumber, Fnode->Filename); /* All done with this node */ diff --git a/source/components/disassembler/dmutils.c b/source/components/disassembler/dmutils.c index 6c760439f..c8de45e5d 100644 --- a/source/components/disassembler/dmutils.c +++ b/source/components/disassembler/dmutils.c @@ -259,7 +259,7 @@ AcpiDmDecodeAttribute ( AcpiOsPrintf ("AttribQuick"); break; - case AML_FIELD_ATTRIB_SEND_RCV: + case AML_FIELD_ATTRIB_SEND_RECEIVE: AcpiOsPrintf ("AttribSendReceive"); break; @@ -279,17 +279,17 @@ AcpiDmDecodeAttribute ( AcpiOsPrintf ("AttribBlock"); break; - case AML_FIELD_ATTRIB_MULTIBYTE: + case AML_FIELD_ATTRIB_BYTES: AcpiOsPrintf ("AttribBytes"); break; - case AML_FIELD_ATTRIB_WORD_CALL: + case AML_FIELD_ATTRIB_PROCESS_CALL: AcpiOsPrintf ("AttribProcessCall"); break; - case AML_FIELD_ATTRIB_BLOCK_CALL: + case AML_FIELD_ATTRIB_BLOCK_PROCESS_CALL: AcpiOsPrintf ("AttribBlockProcessCall"); break; @@ -299,7 +299,7 @@ AcpiDmDecodeAttribute ( AcpiOsPrintf ("AttribRawBytes"); break; - case AML_FIELD_ATTRIB_RAW_PROCESS: + case AML_FIELD_ATTRIB_RAW_PROCESS_BYTES: AcpiOsPrintf ("AttribRawProcessBytes"); break; diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index efc53d7b4..0f5fb469f 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -838,6 +838,20 @@ AcpiEvExecuteRegMethods ( ACPI_FUNCTION_TRACE (EvExecuteRegMethods); + /* + * These address spaces do not need a call to _REG, since the ACPI + * specification defines them as: "must always be accessible". Since + * they never change state (never become unavailable), no need to ever + * call _REG on them. Also, a DataTable is not a "real" address space, + * so do not call _REG. September 2018. + */ + if ((SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) || + (SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) || + (SpaceId == ACPI_ADR_SPACE_DATA_TABLE)) + { + return_VOID; + } + Info.SpaceId = SpaceId; Info.Function = Function; Info.RegRunCount = 0; @@ -904,8 +918,8 @@ AcpiEvRegRun ( } /* - * We only care about regions.and objects that are allowed to have address - * space handlers + * We only care about regions and objects that are allowed to have + * address space handlers */ if ((Node->Type != ACPI_TYPE_REGION) && (Node != AcpiGbl_RootNode)) diff --git a/source/components/events/evrgnini.c b/source/components/events/evrgnini.c index 678b23ccf..3e030845e 100644 --- a/source/components/events/evrgnini.c +++ b/source/components/events/evrgnini.c @@ -158,12 +158,6 @@ #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evrgnini") -/* Local prototypes */ - -static BOOLEAN -AcpiEvIsPciRootBridge ( - ACPI_NAMESPACE_NODE *Node); - /******************************************************************************* * @@ -490,7 +484,7 @@ AcpiEvPciConfigRegionSetup ( * ******************************************************************************/ -static BOOLEAN +BOOLEAN AcpiEvIsPciRootBridge ( ACPI_NAMESPACE_NODE *Node) { diff --git a/source/components/events/evxfregn.c b/source/components/events/evxfregn.c index f0d4c3ce8..6182853a5 100644 --- a/source/components/events/evxfregn.c +++ b/source/components/events/evxfregn.c @@ -354,7 +354,6 @@ AcpiRemoveAddressSpaceHandler ( * DetachRegion removed the previous head. */ RegionObj = HandlerObj->AddressSpace.RegionList; - } /* Remove this Handler object from the list */ diff --git a/source/components/executer/exfield.c b/source/components/executer/exfield.c index b50b09b90..ccd6bee0b 100644 --- a/source/components/executer/exfield.c +++ b/source/components/executer/exfield.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: exfield - ACPI AML (p-code) execution - field manipulation + * Module Name: exfield - AML execution - FieldUnit read/write * *****************************************************************************/ @@ -159,80 +159,68 @@ #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exfield") -/* Local prototypes */ -static UINT32 -AcpiExGetSerialAccessLength ( - UINT32 AccessorType, - UINT32 AccessLength); +/* + * This table maps the various Attrib protocols to the byte transfer + * length. Used for the generic serial bus. + */ +#define ACPI_INVALID_PROTOCOL_ID 0x80 +#define ACPI_MAX_PROTOCOL_ID 0x0F + +const UINT8 AcpiProtocolLengths[] = +{ + ACPI_INVALID_PROTOCOL_ID, /* 0 - reserved */ + ACPI_INVALID_PROTOCOL_ID, /* 1 - reserved */ + 0x00, /* 2 - ATTRIB_QUICK */ + ACPI_INVALID_PROTOCOL_ID, /* 3 - reserved */ + 0x01, /* 4 - ATTRIB_SEND_RECEIVE */ + ACPI_INVALID_PROTOCOL_ID, /* 5 - reserved */ + 0x01, /* 6 - ATTRIB_BYTE */ + ACPI_INVALID_PROTOCOL_ID, /* 7 - reserved */ + 0x02, /* 8 - ATTRIB_WORD */ + ACPI_INVALID_PROTOCOL_ID, /* 9 - reserved */ + 0xFF, /* A - ATTRIB_BLOCK */ + 0xFF, /* B - ATTRIB_BYTES */ + 0x02, /* C - ATTRIB_PROCESS_CALL */ + 0xFF, /* D - ATTRIB_BLOCK_PROCESS_CALL */ + 0xFF, /* E - ATTRIB_RAW_BYTES */ + 0xFF /* F - ATTRIB_RAW_PROCESS_BYTES */ +}; /******************************************************************************* * - * FUNCTION: AcpiExGetSerialAccessLength + * FUNCTION: AcpiExGetProtocolBufferLength * - * PARAMETERS: AccessorType - The type of the protocol indicated by region + * PARAMETERS: ProtocolId - The type of the protocol indicated by region * field access attributes - * AccessLength - The access length of the region field + * ReturnLength - Where the protocol byte transfer length is + * returned * - * RETURN: Decoded access length + * RETURN: Status and decoded byte transfer length * * DESCRIPTION: This routine returns the length of the GenericSerialBus * protocol bytes * ******************************************************************************/ -static UINT32 -AcpiExGetSerialAccessLength ( - UINT32 AccessorType, - UINT32 AccessLength) +ACPI_STATUS +AcpiExGetProtocolBufferLength ( + UINT32 ProtocolId, + UINT32 *ReturnLength) { - UINT32 Length; - - switch (AccessorType) + if ((ProtocolId > ACPI_MAX_PROTOCOL_ID) || + (AcpiProtocolLengths[ProtocolId] == ACPI_INVALID_PROTOCOL_ID)) { - case AML_FIELD_ATTRIB_QUICK: - - Length = 0; - break; - - case AML_FIELD_ATTRIB_SEND_RCV: - case AML_FIELD_ATTRIB_BYTE: + ACPI_ERROR ((AE_INFO, + "Invalid Field/AccessAs protocol ID: 0x%4.4X", ProtocolId)); - Length = 1; - break; - - case AML_FIELD_ATTRIB_WORD: - case AML_FIELD_ATTRIB_WORD_CALL: - - Length = 2; - break; - - case AML_FIELD_ATTRIB_MULTIBYTE: - case AML_FIELD_ATTRIB_RAW_BYTES: - - Length = AccessLength; - break; - - case AML_FIELD_ATTRIB_RAW_PROCESS: - /* - * Worst case bidirectional buffer size. This ignores the - * AccessLength argument to AccessAs because it is not needed. - * August 2018. - */ - Length = ACPI_MAX_GSBUS_BUFFER_SIZE; - break; - - case AML_FIELD_ATTRIB_BLOCK: - case AML_FIELD_ATTRIB_BLOCK_CALL: - default: - - Length = ACPI_GSBUS_BUFFER_SIZE - 2; - break; + return (AE_AML_PROTOCOL); } - return (Length); + *ReturnLength = AcpiProtocolLengths[ProtocolId]; + return (AE_OK); } @@ -259,10 +247,8 @@ AcpiExReadDataFromField ( { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *BufferDesc; - ACPI_SIZE Length; void *Buffer; - UINT32 Function; - UINT16 AccessorType; + UINT32 BufferLength; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); @@ -295,71 +281,14 @@ AcpiExReadDataFromField ( } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { - /* - * This is an SMBus, GSBus or IPMI read. We must create a buffer to - * hold the data and then directly access the region handler. - * - * Note: SMBus and GSBus protocol value is passed in upper 16-bits - * of Function - */ - if (ObjDesc->Field.RegionObj->Region.SpaceId == - ACPI_ADR_SPACE_SMBUS) - { - Length = ACPI_SMBUS_BUFFER_SIZE; - Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); - } - else if (ObjDesc->Field.RegionObj->Region.SpaceId == - ACPI_ADR_SPACE_GSBUS) - { - AccessorType = ObjDesc->Field.Attribute; - if (AccessorType == AML_FIELD_ATTRIB_RAW_PROCESS) - { - ACPI_ERROR ((AE_INFO, - "Invalid direct read using bidirectional write-then-read protocol")); - - return_ACPI_STATUS (AE_AML_PROTOCOL); - } - - Length = AcpiExGetSerialAccessLength ( - AccessorType, ObjDesc->Field.AccessLength); - - /* - * Add additional 2 bytes for the GenericSerialBus data buffer: - * - * Status; (Byte 0 of the data buffer) - * Length; (Byte 1 of the data buffer) - * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) - */ - Length += 2; - Function = ACPI_READ | (AccessorType << 16); - } - else /* IPMI */ - { - Length = ACPI_IPMI_BUFFER_SIZE; - Function = ACPI_READ; - } - - BufferDesc = AcpiUtCreateBufferObject (Length); - if (!BufferDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Lock entire transaction if requested */ + /* SMBus, GSBus, IPMI serial */ - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* Call the region handler for the read */ - - Status = AcpiExAccessRegion (ObjDesc, 0, - ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer), Function); - - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - goto Exit; + Status = AcpiExReadSerialBus (ObjDesc, RetBufferDesc); + return_ACPI_STATUS (Status); } /* @@ -372,14 +301,14 @@ AcpiExReadDataFromField ( * * Note: Field.length is in bits. */ - Length = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( + BufferLength = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( ObjDesc->Field.BitLength); - if (Length > AcpiGbl_IntegerByteWidth) + if (BufferLength > AcpiGbl_IntegerByteWidth) { /* Field is too large for an Integer, create a Buffer instead */ - BufferDesc = AcpiUtCreateBufferObject (Length); + BufferDesc = AcpiUtCreateBufferObject (BufferLength); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -396,47 +325,22 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_NO_MEMORY); } - Length = AcpiGbl_IntegerByteWidth; + BufferLength = AcpiGbl_IntegerByteWidth; Buffer = &BufferDesc->Integer.Value; } if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) { - /* - * For GPIO (GeneralPurposeIo), the Address will be the bit offset - * from the previous Connection() operator, making it effectively a - * pin number index. The BitLength is the length of the field, which - * is thus the number of pins. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "GPIO FieldRead [FROM]: Pin %u Bits %u\n", - ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); + /* General Purpose I/O */ - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* Perform the write */ - - Status = AcpiExAccessRegion ( - ObjDesc, 0, (UINT64 *) Buffer, ACPI_READ); - - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (BufferDesc); - } - else - { - *RetBufferDesc = BufferDesc; - } - return_ACPI_STATUS (Status); + Status = AcpiExReadGpio (ObjDesc, Buffer); + goto Exit; } ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", - ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length)); + ObjDesc, ObjDesc->Common.Type, Buffer, BufferLength)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", ObjDesc->CommonField.BitLength, @@ -449,7 +353,7 @@ AcpiExReadDataFromField ( /* Read from the field */ - Status = AcpiExExtractFromField (ObjDesc, Buffer, (UINT32) Length); + Status = AcpiExExtractFromField (ObjDesc, Buffer, BufferLength); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); @@ -488,12 +392,8 @@ AcpiExWriteDataToField ( ACPI_OPERAND_OBJECT **ResultDesc) { ACPI_STATUS Status; - UINT32 Length; - UINT32 DataLength; + UINT32 BufferLength; void *Buffer; - ACPI_OPERAND_OBJECT *BufferDesc; - UINT32 Function; - UINT16 AccessorType; ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); @@ -522,142 +422,21 @@ AcpiExWriteDataToField ( } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || - ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) { - /* - * This is an SMBus, GSBus or IPMI write. We will bypass the entire - * field mechanism and handoff the buffer directly to the handler. - * For these address spaces, the buffer is bi-directional; on a - * write, return data is returned in the same buffer. - * - * Source must be a buffer of sufficient size: - * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or - * ACPI_IPMI_BUFFER_SIZE. - * - * Note: SMBus and GSBus protocol type is passed in upper 16-bits - * of Function - */ - if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) - { - ACPI_ERROR ((AE_INFO, - "SMBus/IPMI/GenericSerialBus write requires " - "Buffer, found type %s", - AcpiUtGetObjectTypeName (SourceDesc))); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - if (ObjDesc->Field.RegionObj->Region.SpaceId == - ACPI_ADR_SPACE_SMBUS) - { - Length = ACPI_SMBUS_BUFFER_SIZE; - DataLength = Length; - Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); - } - else if (ObjDesc->Field.RegionObj->Region.SpaceId == - ACPI_ADR_SPACE_GSBUS) - { - AccessorType = ObjDesc->Field.Attribute; - Length = AcpiExGetSerialAccessLength ( - AccessorType, ObjDesc->Field.AccessLength); - - /* - * Buffer format for Generic Serial Bus protocols: - * Status; (Byte 0 of the data buffer) - * Length; (Byte 1 of the data buffer) - * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) - */ - DataLength = SourceDesc->Buffer.Pointer[1]; /* Data length is 2nd byte */ - if (!DataLength) - { - ACPI_ERROR ((AE_INFO, - "Invalid zero data length in transfer buffer")); - - return_ACPI_STATUS (AE_AML_BUFFER_LENGTH); - } - - Function = ACPI_WRITE | (AccessorType << 16); - } - else /* IPMI */ - { - Length = ACPI_IPMI_BUFFER_SIZE; - DataLength = Length; - Function = ACPI_WRITE; - } - - if (SourceDesc->Buffer.Length < DataLength) - { - ACPI_ERROR ((AE_INFO, - "SMBus/IPMI/GenericSerialBus write requires " - "Buffer data length %u, found buffer length %u", - DataLength, SourceDesc->Buffer.Length)); - - return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); - } + /* General Purpose I/O */ - /* Create the transfer/bidirectional buffer */ - - BufferDesc = AcpiUtCreateBufferObject (Length); - if (!BufferDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Copy the input buffer data to the transfer buffer */ - - Buffer = BufferDesc->Buffer.Pointer; - memcpy (Buffer, SourceDesc->Buffer.Pointer, DataLength); - - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* - * Perform the write (returns status and perhaps data in the - * same buffer) - */ - Status = AcpiExAccessRegion ( - ObjDesc, 0, (UINT64 *) Buffer, Function); - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - - *ResultDesc = BufferDesc; + Status = AcpiExWriteGpio (SourceDesc, ObjDesc, ResultDesc); return_ACPI_STATUS (Status); } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { - /* - * For GPIO (GeneralPurposeIo), we will bypass the entire field - * mechanism and handoff the bit address and bit width directly to - * the handler. The Address will be the bit offset - * from the previous Connection() operator, making it effectively a - * pin number index. The BitLength is the length of the field, which - * is thus the number of pins. - */ - if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) - { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", - AcpiUtGetTypeName (SourceDesc->Common.Type), - SourceDesc->Common.Type, (UINT32) SourceDesc->Integer.Value, - ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); + /* SMBus, GSBus, IPMI serial */ - Buffer = &SourceDesc->Integer.Value; - - /* Lock entire transaction if requested */ - - AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - - /* Perform the write */ - - Status = AcpiExAccessRegion ( - ObjDesc, 0, (UINT64 *) Buffer, ACPI_WRITE); - AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + Status = AcpiExWriteSerialBus (SourceDesc, ObjDesc, ResultDesc); return_ACPI_STATUS (Status); } @@ -668,30 +447,29 @@ AcpiExWriteDataToField ( case ACPI_TYPE_INTEGER: Buffer = &SourceDesc->Integer.Value; - Length = sizeof (SourceDesc->Integer.Value); + BufferLength = sizeof (SourceDesc->Integer.Value); break; case ACPI_TYPE_BUFFER: Buffer = SourceDesc->Buffer.Pointer; - Length = SourceDesc->Buffer.Length; + BufferLength = SourceDesc->Buffer.Length; break; case ACPI_TYPE_STRING: Buffer = SourceDesc->String.Pointer; - Length = SourceDesc->String.Length; + BufferLength = SourceDesc->String.Length; break; default: - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), - SourceDesc->Common.Type, Buffer, Length)); + SourceDesc->Common.Type, Buffer, BufferLength)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", @@ -707,8 +485,7 @@ AcpiExWriteDataToField ( /* Write to the field */ - Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length); + Status = AcpiExInsertIntoField (ObjDesc, Buffer, BufferLength); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - return_ACPI_STATUS (Status); } diff --git a/source/components/executer/exserial.c b/source/components/executer/exserial.c new file mode 100755 index 000000000..73f2aa4a3 --- /dev/null +++ b/source/components/executer/exserial.c @@ -0,0 +1,524 @@ +/****************************************************************************** + * + * Module Name: exserial - FieldUnit support for serial address spaces + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2018, 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. + * + ***************************************************************************** + * + * Alternatively, you may choose to be licensed under the terms of the + * following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, you may choose to be licensed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "acinterp.h" +#include "amlcode.h" + + +#define _COMPONENT ACPI_EXECUTER + ACPI_MODULE_NAME ("exserial") + + +/******************************************************************************* + * + * FUNCTION: AcpiExReadGpio + * + * PARAMETERS: ObjDesc - The named field to read + * Buffer - Where the return data is returnd + * + * RETURN: Status + * + * DESCRIPTION: Read from a named field that references a Generic Serial Bus + * field + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExReadGpio ( + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (ExReadGpio, ObjDesc); + + + /* + * For GPIO (GeneralPurposeIo), the Address will be the bit offset + * from the previous Connection() operator, making it effectively a + * pin number index. The BitLength is the length of the field, which + * is thus the number of pins. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "GPIO FieldRead [FROM]: Pin %u Bits %u\n", + ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); + + /* Lock entire transaction if requested */ + + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + + /* Perform the read */ + + Status = AcpiExAccessRegion ( + ObjDesc, 0, (UINT64 *) Buffer, ACPI_READ); + + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExWriteGpio + * + * PARAMETERS: SourceDesc - Contains data to write. Expect to be + * an Integer object. + * ObjDesc - The named field + * ResultDesc - Where the return value is returned, if any + * + * RETURN: Status + * + * DESCRIPTION: Write to a named field that references a General Purpose I/O + * field. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExWriteGpio ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ReturnBuffer) +{ + ACPI_STATUS Status; + void *Buffer; + + + ACPI_FUNCTION_TRACE_PTR (ExWriteGpio, ObjDesc); + + + /* + * For GPIO (GeneralPurposeIo), we will bypass the entire field + * mechanism and handoff the bit address and bit width directly to + * the handler. The Address will be the bit offset + * from the previous Connection() operator, making it effectively a + * pin number index. The BitLength is the length of the field, which + * is thus the number of pins. + */ + if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) + { + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "GPIO FieldWrite [FROM]: (%s:%X), Value %.8X [TO]: Pin %u Bits %u\n", + AcpiUtGetTypeName (SourceDesc->Common.Type), + SourceDesc->Common.Type, (UINT32) SourceDesc->Integer.Value, + ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); + + Buffer = &SourceDesc->Integer.Value; + + /* Lock entire transaction if requested */ + + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + + /* Perform the write */ + + Status = AcpiExAccessRegion ( + ObjDesc, 0, (UINT64 *) Buffer, ACPI_WRITE); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExReadSerialBus + * + * PARAMETERS: ObjDesc - The named field to read + * ReturnBuffer - Where the return value is returned, if any + * + * RETURN: Status + * + * DESCRIPTION: Read from a named field that references a serial bus + * (SMBus, IPMI, or GSBus). + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExReadSerialBus ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ReturnBuffer) +{ + ACPI_STATUS Status; + UINT32 BufferLength; + ACPI_OPERAND_OBJECT *BufferDesc; + UINT32 Function; + UINT16 AccessorType; + + + ACPI_FUNCTION_TRACE_PTR (ExReadSerialBus, ObjDesc); + + + /* + * This is an SMBus, GSBus or IPMI read. We must create a buffer to + * hold the data and then directly access the region handler. + * + * Note: SMBus and GSBus protocol value is passed in upper 16-bits + * of Function + * + * Common buffer format: + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) + */ + switch (ObjDesc->Field.RegionObj->Region.SpaceId) + { + case ACPI_ADR_SPACE_SMBUS: + + BufferLength = ACPI_SMBUS_BUFFER_SIZE; + Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); + break; + + case ACPI_ADR_SPACE_IPMI: + + BufferLength = ACPI_IPMI_BUFFER_SIZE; + Function = ACPI_READ; + break; + + case ACPI_ADR_SPACE_GSBUS: + + AccessorType = ObjDesc->Field.Attribute; + if (AccessorType == AML_FIELD_ATTRIB_RAW_PROCESS_BYTES) + { + ACPI_ERROR ((AE_INFO, + "Invalid direct read using bidirectional write-then-read protocol")); + + return_ACPI_STATUS (AE_AML_PROTOCOL); + } + + Status = AcpiExGetProtocolBufferLength (AccessorType, &BufferLength); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, + "Invalid protocol ID for GSBus: 0x%4.4X", AccessorType)); + + return_ACPI_STATUS (Status); + } + + /* Add header length to get the full size of the buffer */ + + BufferLength += ACPI_SERIAL_HEADER_SIZE; + Function = ACPI_READ | (AccessorType << 16); + break; + + default: + return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); + } + + /* Create the local transfer buffer that is returned to the caller */ + + BufferDesc = AcpiUtCreateBufferObject (BufferLength); + if (!BufferDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Lock entire transaction if requested */ + + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + + /* Call the region handler for the write-then-read */ + + Status = AcpiExAccessRegion (ObjDesc, 0, + ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer), Function); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + + *ReturnBuffer = BufferDesc; + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExWriteSerialBus + * + * PARAMETERS: SourceDesc - Contains data to write + * ObjDesc - The named field + * ReturnBuffer - Where the return value is returned, if any + * + * RETURN: Status + * + * DESCRIPTION: Write to a named field that references a serial bus + * (SMBus, IPMI, GSBus). + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExWriteSerialBus ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ReturnBuffer) +{ + ACPI_STATUS Status; + UINT32 BufferLength; + UINT32 DataLength; + void *Buffer; + ACPI_OPERAND_OBJECT *BufferDesc; + UINT32 Function; + UINT16 AccessorType; + + + ACPI_FUNCTION_TRACE_PTR (ExWriteSerialBus, ObjDesc); + + + /* + * This is an SMBus, GSBus or IPMI write. We will bypass the entire + * field mechanism and handoff the buffer directly to the handler. + * For these address spaces, the buffer is bidirectional; on a + * write, return data is returned in the same buffer. + * + * Source must be a buffer of sufficient size, these are fixed size: + * ACPI_SMBUS_BUFFER_SIZE, or ACPI_IPMI_BUFFER_SIZE. + * + * Note: SMBus and GSBus protocol type is passed in upper 16-bits + * of Function + * + * Common buffer format: + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) + */ + if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) + { + ACPI_ERROR ((AE_INFO, + "SMBus/IPMI/GenericSerialBus write requires " + "Buffer, found type %s", + AcpiUtGetObjectTypeName (SourceDesc))); + + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + + switch (ObjDesc->Field.RegionObj->Region.SpaceId) + { + case ACPI_ADR_SPACE_SMBUS: + + BufferLength = ACPI_SMBUS_BUFFER_SIZE; + DataLength = ACPI_SMBUS_DATA_SIZE; + Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); + break; + + case ACPI_ADR_SPACE_IPMI: + + BufferLength = ACPI_IPMI_BUFFER_SIZE; + DataLength = ACPI_IPMI_DATA_SIZE; + Function = ACPI_WRITE; + break; + + case ACPI_ADR_SPACE_GSBUS: + + AccessorType = ObjDesc->Field.Attribute; + Status = AcpiExGetProtocolBufferLength (AccessorType, &BufferLength); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, + "Invalid protocol ID for GSBus: 0x%4.4X", AccessorType)); + + return_ACPI_STATUS (Status); + } + + /* Add header length to get the full size of the buffer */ + + BufferLength += ACPI_SERIAL_HEADER_SIZE; + DataLength = SourceDesc->Buffer.Pointer[1]; + Function = ACPI_WRITE | (AccessorType << 16); + break; + + default: + return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); + } + +#if 0 +OBSOLETE? + /* Check for possible buffer overflow */ + + if (DataLength > SourceDesc->Buffer.Length) + { + ACPI_ERROR ((AE_INFO, + "Length in buffer header (%u)(%u) is greater than " + "the physical buffer length (%u) and will overflow", + DataLength, BufferLength, SourceDesc->Buffer.Length)); + + return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); + } +#endif + + /* Create the transfer/bidirectional/return buffer */ + + BufferDesc = AcpiUtCreateBufferObject (BufferLength); + if (!BufferDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Copy the input buffer data to the transfer buffer */ + + Buffer = BufferDesc->Buffer.Pointer; + memcpy (Buffer, SourceDesc->Buffer.Pointer, DataLength); + + /* Lock entire transaction if requested */ + + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + + /* + * Perform the write (returns status and perhaps data in the + * same buffer) + */ + Status = AcpiExAccessRegion ( + ObjDesc, 0, (UINT64 *) Buffer, Function); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + + *ReturnBuffer = BufferDesc; + return_ACPI_STATUS (Status); +} diff --git a/source/include/acconfig.h b/source/include/acconfig.h index 844ffd248..9fa6910c8 100644 --- a/source/include/acconfig.h +++ b/source/include/acconfig.h @@ -318,12 +318,20 @@ #define ACPI_RSDP_CHECKSUM_LENGTH 20 #define ACPI_RSDP_XCHECKSUM_LENGTH 36 -/* SMBus, GSBus and IPMI bidirectional buffer size */ +/* + * SMBus, GSBus and IPMI buffer sizes. All have a 2-byte header, + * containing both Status and Length. + */ +#define ACPI_SERIAL_HEADER_SIZE 2 /* Common for below. Status and Length fields */ + +#define ACPI_SMBUS_DATA_SIZE 32 +#define ACPI_SMBUS_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_SMBUS_DATA_SIZE + +#define ACPI_IPMI_DATA_SIZE 64 +#define ACPI_IPMI_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_IPMI_DATA_SIZE -#define ACPI_SMBUS_BUFFER_SIZE 34 -#define ACPI_IPMI_BUFFER_SIZE 66 -#define ACPI_GSBUS_BUFFER_SIZE 34 /* Not clear if this is needed */ -#define ACPI_MAX_GSBUS_BUFFER_SIZE 255 /* Worst-case bidirectional buffer */ +#define ACPI_MAX_GSBUS_DATA_SIZE 255 +#define ACPI_MAX_GSBUS_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_MAX_GSBUS_DATA_SIZE /* _SxD and _SxW control methods */ diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 271a57a48..b774b20ff 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -580,7 +580,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; * dmtable and ahtable */ extern const ACPI_DMTABLE_DATA AcpiDmTableData[]; -extern const AH_TABLE Gbl_AcpiSupportedTables[]; +extern const AH_TABLE AcpiGbl_SupportedTables[]; UINT8 AcpiDmGenerateChecksum ( diff --git a/source/include/acevents.h b/source/include/acevents.h index 3dc36606b..03e7bba21 100644 --- a/source/include/acevents.h +++ b/source/include/acevents.h @@ -467,6 +467,10 @@ ACPI_STATUS AcpiEvInitializeRegion ( ACPI_OPERAND_OBJECT *RegionObj); +BOOLEAN +AcpiEvIsPciRootBridge ( + ACPI_NAMESPACE_NODE *Node); + /* * evsci - SCI (System Control Interrupt) handling/dispatch diff --git a/source/include/acinterp.h b/source/include/acinterp.h index fde066dcb..f40f40e11 100644 --- a/source/include/acinterp.h +++ b/source/include/acinterp.h @@ -285,6 +285,11 @@ AcpiExTracePoint ( * exfield - ACPI AML (p-code) execution - field manipulation */ ACPI_STATUS +AcpiExGetProtocolBufferLength ( + UINT32 ProtocolId, + UINT32 *ReturnLength); + +ACPI_STATUS AcpiExCommonBufferSetup ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 BufferLength, @@ -495,6 +500,32 @@ AcpiExPrepFieldValue ( /* + * exserial - FieldUnit support for serial address spaces + */ +ACPI_STATUS +AcpiExReadSerialBus ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ReturnBuffer); + +ACPI_STATUS +AcpiExWriteSerialBus ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ReturnBuffer); + +ACPI_STATUS +AcpiExReadGpio ( + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer); + +ACPI_STATUS +AcpiExWriteGpio ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ReturnBuffer); + + +/* * exsystem - Interface to OS services */ ACPI_STATUS diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 2e2bcd0d2..a2aaa9744 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -597,9 +597,9 @@ typedef struct acpi_simple_repair_info typedef struct acpi_reg_walk_info { - ACPI_ADR_SPACE_TYPE SpaceId; UINT32 Function; UINT32 RegRunCount; + ACPI_ADR_SPACE_TYPE SpaceId; } ACPI_REG_WALK_INFO; diff --git a/source/include/amlcode.h b/source/include/amlcode.h index 6507ae677..358a17a7e 100644 --- a/source/include/amlcode.h +++ b/source/include/amlcode.h @@ -594,16 +594,16 @@ typedef enum */ typedef enum { - AML_FIELD_ATTRIB_QUICK = 0x02, - AML_FIELD_ATTRIB_SEND_RCV = 0x04, - AML_FIELD_ATTRIB_BYTE = 0x06, - AML_FIELD_ATTRIB_WORD = 0x08, - AML_FIELD_ATTRIB_BLOCK = 0x0A, - AML_FIELD_ATTRIB_MULTIBYTE = 0x0B, - AML_FIELD_ATTRIB_WORD_CALL = 0x0C, - AML_FIELD_ATTRIB_BLOCK_CALL = 0x0D, - AML_FIELD_ATTRIB_RAW_BYTES = 0x0E, - AML_FIELD_ATTRIB_RAW_PROCESS = 0x0F + AML_FIELD_ATTRIB_QUICK = 0x02, + AML_FIELD_ATTRIB_SEND_RECEIVE = 0x04, + AML_FIELD_ATTRIB_BYTE = 0x06, + AML_FIELD_ATTRIB_WORD = 0x08, + AML_FIELD_ATTRIB_BLOCK = 0x0A, + AML_FIELD_ATTRIB_BYTES = 0x0B, + AML_FIELD_ATTRIB_PROCESS_CALL = 0x0C, + AML_FIELD_ATTRIB_BLOCK_PROCESS_CALL = 0x0D, + AML_FIELD_ATTRIB_RAW_BYTES = 0x0E, + AML_FIELD_ATTRIB_RAW_PROCESS_BYTES = 0x0F } AML_ACCESS_ATTRIBUTE; diff --git a/source/tools/acpiexec/aeregion.c b/source/tools/acpiexec/aeregion.c index 8ae0f9fea..fd427a3c1 100644 --- a/source/tools/acpiexec/aeregion.c +++ b/source/tools/acpiexec/aeregion.c @@ -189,7 +189,9 @@ AeRegionHandler ( ACPI_PHYSICAL_ADDRESS BaseAddressEnd; ACPI_PHYSICAL_ADDRESS RegionAddress; ACPI_PHYSICAL_ADDRESS RegionAddressEnd; - ACPI_SIZE Length; + UINT32 Length; + UINT8 DataLength; + UINT8 *DataBuffer; BOOLEAN BufferExists; BOOLEAN BufferResize; AE_REGION *RegionElement; @@ -207,9 +209,9 @@ AeRegionHandler ( ACPI_FUNCTION_NAME (AeRegionHandler); - /* - * If the object is not a region, simply return - */ + + /* If the object is not a region, simply return */ + if (RegionObject->Region.Type != ACPI_TYPE_REGION) { return (AE_OK); @@ -219,7 +221,8 @@ AeRegionHandler ( if (HandlerContext != &AeMyContext) { - printf ("Region handler received incorrect context %p, should be %p\n", + AcpiOsPrintf ( + "Region handler received incorrect context %p, should be %p\n", HandlerContext, &AeMyContext); } @@ -230,7 +233,7 @@ AeRegionHandler ( * the linked list. */ BaseAddress = RegionObject->Region.Address; - Length = (ACPI_SIZE) RegionObject->Region.Length; + Length = RegionObject->Region.Length; SpaceId = RegionObject->Region.SpaceId; ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, @@ -324,93 +327,26 @@ AeRegionHandler ( case ACPI_ADR_SPACE_SMBUS: case ACPI_ADR_SPACE_GSBUS: /* ACPI 5.0 */ - Length = 0; - - switch (Function & ACPI_IO_MASK) + Status = AcpiExGetProtocolBufferLength ((Function >> 16), &Length); + if (ACPI_FAILURE (Status)) { - case ACPI_READ: - - switch (Function >> 16) - { - case AML_FIELD_ATTRIB_QUICK: - - Length = 0; - break; - - case AML_FIELD_ATTRIB_SEND_RCV: - case AML_FIELD_ATTRIB_BYTE: - - Length = 1; - break; - - case AML_FIELD_ATTRIB_WORD: - case AML_FIELD_ATTRIB_WORD_CALL: - - Length = 2; - break; - - case AML_FIELD_ATTRIB_BLOCK: - case AML_FIELD_ATTRIB_BLOCK_CALL: - - Length = 32; - break; - - case AML_FIELD_ATTRIB_MULTIBYTE: - case AML_FIELD_ATTRIB_RAW_BYTES: - case AML_FIELD_ATTRIB_RAW_PROCESS: - - Length = MyContext->AccessLength; - break; - - default: - - break; - } - break; - - case ACPI_WRITE: - - switch (Function >> 16) - { - case AML_FIELD_ATTRIB_QUICK: - case AML_FIELD_ATTRIB_SEND_RCV: - case AML_FIELD_ATTRIB_BYTE: - case AML_FIELD_ATTRIB_WORD: - case AML_FIELD_ATTRIB_BLOCK: - - Length = 0; - break; - - case AML_FIELD_ATTRIB_WORD_CALL: - Length = 2; - break; - - case AML_FIELD_ATTRIB_BLOCK_CALL: - Length = 32; - break; - - case AML_FIELD_ATTRIB_MULTIBYTE: - case AML_FIELD_ATTRIB_RAW_BYTES: - case AML_FIELD_ATTRIB_RAW_PROCESS: - - Length = ACPI_MAX_GSBUS_BUFFER_SIZE; - break; - - default: - - break; - } - break; + AcpiOsPrintf ("AcpiExec: Invalid SMbus/GSbus protocol ID: 0x%X\n", + (Function >> 16)); + return (Status); + } - default: + /* Adjust for fixed SMBus buffer size */ - break; + if ((SpaceId == ACPI_ADR_SPACE_SMBUS) && + (Length > ACPI_SMBUS_DATA_SIZE)) + { + Length = ACPI_SMBUS_DATA_SIZE; /* SMBus buffer is fixed-length */ } if (AcpiGbl_DisplayRegionAccess) { AcpiOsPrintf ("AcpiExec: %s " - "%s: Attr %X Addr %.4X BaseAddr %.4X Length %.2X BitWidth %X BufLen %X", + "%s: Attr %X Addr %.4X BaseAddr %.4X Length %.2X BitWidth %X BufLen %X\n", AcpiUtGetRegionName (SpaceId), (Function & ACPI_IO_MASK) ? "Write" : "Read ", (UINT32) (Function >> 16), @@ -419,31 +355,41 @@ AeRegionHandler ( /* GenericSerialBus has a Connection() parameter */ - if (SpaceId == ACPI_ADR_SPACE_GSBUS) + if ((SpaceId == ACPI_ADR_SPACE_GSBUS) && MyContext) { Status = AcpiBufferToResource (MyContext->Connection, MyContext->Length, &Resource); + if (ACPI_SUCCESS (Status)) + { + ACPI_FREE (Resource); + } AcpiOsPrintf (" [AccessLength %.2X Connnection %p]", MyContext->AccessLength, MyContext->Connection); } + AcpiOsPrintf ("\n"); } + DataBuffer = &Buffer[2]; + DataLength = (UINT8) Length; + /* Setup the return buffer. Note: ASLTS depends on these fill values */ + if (Length == ACPI_MAX_GSBUS_DATA_SIZE) + { + DataLength = 0x20; /* For ASLTS only */ + } + for (i = 0; i < Length; i++) { - Buffer[i] = (UINT8) (0xA0 + i); + DataBuffer[i] = (UINT8) (0xA0 + i); } - Buffer[0] = 0; /* Return Status, OK */ - Buffer[1] = (UINT8) Length; /* Length of valid data */ - Buffer[2] = 0x12; /* Reserved for Command byte 1 */ - Buffer[3] = 0x34; /* Reserved for Command byte 2 */ + Buffer[0] = 0; /* Return Status, OK */ + Buffer[1] = DataLength; /* Length of valid data */ return (AE_OK); - case ACPI_ADR_SPACE_IPMI: /* ACPI 4.0 */ if (AcpiGbl_DisplayRegionAccess) @@ -461,16 +407,16 @@ AeRegionHandler ( * * Return some example data to show use of the bidirectional buffer */ - Buffer[0] = 0; /* Status byte */ - Buffer[1] = 64; /* Return buffer data length */ - Buffer[2] = 0; /* Completion code */ - Buffer[3] = 0; /* Reserved */ + Buffer[0] = 0; /* Status byte */ + Buffer[1] = ACPI_IPMI_DATA_SIZE; /* Return buffer data length */ + Buffer[2] = 0; /* Completion code */ + Buffer[3] = 0; /* Reserved */ /* * Fill the 66-byte buffer with the return data. * Note: ASLTS depends on these fill values. */ - for (i = 4; i < 66; i++) + for (i = 4; i < ACPI_IPMI_BUFFER_SIZE; i++) { Buffer[i] = (UINT8) (i); } @@ -486,11 +432,13 @@ AeRegionHandler ( if (AcpiGbl_DisplayRegionAccess) { AcpiOsPrintf ("AcpiExec: GPIO " - "%s: Addr %.4X Width %X Conn %p\n", + "%s: Address %.4X Length %X BitWidth %X Conn %p\n", (Function & ACPI_IO_MASK) ? "Write" : "Read ", - (UINT32) Address, BitWidth, MyContext->Connection); + (UINT32) Address, Length, BitWidth, MyContext->Connection); } - return (AE_OK); + + /* Now perform the "normal" SystemMemory handling, for AcpiExec only */ + break; default: break; @@ -664,7 +612,6 @@ AeRegionHandler ( /* Calculate the size of the memory copy */ ByteWidth = (BitWidth / 8); - if (BitWidth % 8) { ByteWidth += 1; @@ -729,11 +676,16 @@ DoFunction: case ACPI_ADR_SPACE_SYSTEM_MEMORY: AcpiOsPrintf ("AcpiExec: SystemMemory " - "%s: Val %.8X Addr %.4X Width %X [REGION: BaseAddr %.4X Len %.2X]\n", + "%s: Val %.8X Addr %.4X BitWidth %X [REGION: BaseAddr %.4X Len %.2X]\n", (Function & ACPI_IO_MASK) ? "Write" : "Read ", (UINT32) *Value, (UINT32) Address, BitWidth, (UINT32) BaseAddress, Length); break; + case ACPI_ADR_SPACE_GSBUS: + + AcpiOsPrintf ("AcpiExec: GenericSerialBus\n"); + break; + case ACPI_ADR_SPACE_GPIO: /* ACPI 5.0 */ /* This space is required to always be ByteAcc */ @@ -742,14 +694,20 @@ DoFunction: MyContext->Length, &Resource); AcpiOsPrintf ("AcpiExec: GeneralPurposeIo " - "%s: Val %.8X Addr %.4X BaseAddr %.4X Len %.2X Width %X AccLen %.2X Conn %p\n", + "%s: %.8X Addr %.4X BaseAddr %.4X Length %.2X " + "BitWidth %X AccLen %.2X Conn %p\n", (Function & ACPI_IO_MASK) ? "Write" : "Read ", (UINT32) *Value, (UINT32) Address, (UINT32) BaseAddress, Length, BitWidth, MyContext->AccessLength, MyContext->Connection); + if (ACPI_SUCCESS (Status)) + { + ACPI_FREE (Resource); + } break; default: + AcpiOsPrintf ("AcpiExec: Region access on SpaceId %2.2X\n", SpaceId); break; } } diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h index 1b63e2860..931aad9c1 100644 --- a/source/tools/acpihelp/acpihelp.h +++ b/source/tools/acpihelp/acpihelp.h @@ -281,7 +281,7 @@ extern const AH_ASL_OPERATOR Gbl_AslOperatorInfo[]; extern const AH_ASL_KEYWORD Gbl_AslKeywordInfo[]; extern const AH_UUID Gbl_AcpiUuids[]; extern const AH_DIRECTIVE_INFO Gbl_PreprocessorDirectives[]; -extern const AH_TABLE Gbl_AcpiSupportedTables[]; +extern const AH_TABLE AcpiGbl_SupportedTables[]; void diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index bec66864f..4c6850385 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -610,7 +610,7 @@ AhDisplayTables ( printf ("Known ACPI tables:\n"); - for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++) + for (Info = AcpiGbl_SupportedTables; Info->Signature; Info++) { printf ("%8s : %s\n", Info->Signature, Info->Description); i++; diff --git a/tests/aslts.sh b/tests/aslts.sh index d8b364be4..80090abea 100755 --- a/tests/aslts.sh +++ b/tests/aslts.sh @@ -84,9 +84,11 @@ build_acpi_tools() { REBUILD_TOOLS=yes fi if [ "x$REBUILD_TOOLS" = "xyes" ]; then + jobs=`nproc` make clean - make iasl ASLTS=TRUE - make acpiexec ASLTS=TRUE + make iasl ASLTS=TRUE -j$jobs + make acpibin ASLTS=TRUE -j$jobs + make acpiexec ASLTS=TRUE -j$jobs fi if [ -d "bin" ] && [ -f "bin/iasl" ]; then diff --git a/tests/aslts/src/runtime/collections/functional/region/regionfield.asl b/tests/aslts/src/runtime/collections/functional/region/regionfield.asl index 507042d78..5dad0b771 100644 --- a/tests/aslts/src/runtime/collections/functional/region/regionfield.asl +++ b/tests/aslts/src/runtime/collections/functional/region/regionfield.asl @@ -607,9 +607,11 @@ CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ CreateByteField (BUFF, 0x02, DAT0) + CreateByteField (BUFR, 0x00, OB11) CreateByteField (BUFR, 0x01, LEN1) CreateByteField (BUFR, 0x02, DAT1) + /* Signal device (e.g. ON) */ BUFR = FLD0 = BUFF /* \M751.BUFF */ /* Invoke Write Quick transaction */ @@ -628,9 +630,9 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x00) } - If ((OB11 != 0x7A)) + If ((OB11 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x00) } If ((LEN1 != 0x00)) @@ -638,20 +640,16 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) } - If ((DAT1 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0x00) - } - OB10 = 0x00 LEN0 = 0xFF DAT0 = 0x00 + /* Signal device (e.g. OFF) */ BUFF = FLD0 /* Invoke Read Quick transaction */ /* \M751.FLD0 */ - If ((OB10 != 0x7A)) + If ((OB10 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) } If ((LEN0 != 0x00)) @@ -663,7 +661,7 @@ /* Note: Since LEN0 should be zero there's no need to check DAT0 */ } - /* Read/Write Quick (SMBQuick) */ + /* AttribSendReceive */ /* m752(CallChain) */ /* CallChain: String */ Method (M752, 1, Serialized) @@ -683,13 +681,15 @@ CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ CreateByteField (BUFF, 0x02, DAT0) + CreateByteField (BUFR, 0x00, OB11) CreateByteField (BUFR, 0x01, LEN1) CreateByteField (BUFR, 0x02, DAT1) + /* Send the byte '0x16' to the device */ OB10 = 0x00 - LEN0 = 0x00 + LEN0 = 0x01 DAT0 = 0x16 /* Save 0x16 into the data buffer */ BUFR = FLD0 = BUFF /* \M752.BUFF */ /* Invoke a Send Byte transaction */ If ((OB10 != 0x00)) @@ -697,9 +697,9 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) } - If ((LEN0 != 0x00)) + If ((LEN0 != 0x01)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x01) } If ((DAT0 != 0x16)) @@ -707,27 +707,27 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x16) } - If ((OB11 != 0x7A)) + If ((OB11 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x00) } - If ((LEN1 != 0x00)) + If ((LEN1 != 0x01)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x01) } - If ((DAT1 != 0x16)) + If ((DAT1 != 0xA0)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0xA0) } /* Receive a byte of data from the device */ BUFF = FLD0 /* Invoke a Receive Byte transaction */ /* \M752.FLD0 */ - If ((OB10 != 0x7A)) + If ((OB10 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) } If ((LEN0 != 0x01)) @@ -763,13 +763,14 @@ CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ CreateByteField (BUFF, 0x02, DAT0) + CreateByteField (BUFR, 0x00, OB11) CreateByteField (BUFR, 0x01, LEN1) CreateByteField (BUFR, 0x02, DAT1) /* Write the byte '0x16' to the device using command value 2 */ OB10 = 0x00 - LEN0 = 0x00 + LEN0 = 0x01 DAT0 = 0x16 /* Save 0x16 into the data buffer */ BUFR = FLD2 = BUFF /* \M753.BUFF */ /* Invoke a Write Byte transaction */ If ((OB10 != 0x00)) @@ -777,9 +778,9 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) } - If ((LEN0 != 0x00)) + If ((LEN0 != 0x01)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x01) } If ((DAT0 != 0x16)) @@ -787,27 +788,27 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x16) } - If ((OB11 != 0x7A)) + If ((OB11 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x00) } - If ((LEN1 != 0x00)) + If ((LEN1 != 0x01)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x01) } - If ((DAT1 != 0x16)) + If ((DAT1 != 0xA0)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0xA0) } /* Read a byte of data from the device using command value 1 */ BUFF = FLD1 /* Invoke a Read Byte transaction */ /* \M753.FLD1 */ - If ((OB10 != 0x7A)) + If ((OB10 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) } If ((LEN0 != 0x01)) @@ -843,6 +844,7 @@ CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ CreateWordField (BUFF, 0x02, DAT0) + CreateByteField (BUFR, 0x00, OB11) CreateByteField (BUFR, 0x01, LEN1) CreateWordField (BUFR, 0x02, DAT1) @@ -864,30 +866,30 @@ If ((DAT0 != 0x5416)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x16) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x5416) } - If ((OB11 != 0x7A)) + If ((OB11 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x00) } - If ((LEN1 != 0x00)) + If ((LEN1 != 0x02)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x02) } - If ((DAT1 != 0x5416)) + If ((DAT1 != 0xA1A0)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0xA1A0) } /* Read two bytes of data from the device using command value 1 */ BUFF = FLD1 /* Invoke a Read Word transaction */ /* \M754.FLD1 */ - If ((OB10 != 0x7A)) + If ((OB10 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) } If ((LEN0 != 0x02)) @@ -918,78 +920,30 @@ /* Create the SMBus data buffer */ - Name (BUFF, Buffer (0x22){}) /* Create SMBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create SMBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateField (BUFF, 0x10, 0x0100, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateField (BUFR, 0x10, 0x0100, DAT1) - /* Write the block 'TEST' to the device using command value 2 */ + Name (BUF1, Buffer (24){}) /* Create SMBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateField (BUF1, 0x10, 0x0080, DAT1) - OB10 = 0x00 - LEN0 = 0x04 - DAT0 = "TEST" /* Save 'TEST' into the data buffer */ - BUFR = FLD2 = BUFF /* \M755.BUFF */ /* Invoke a Write Block transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } + // Read block of data from the device using command value 0 - If ((LEN0 != 0x04)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x04) - } + BUF1 = FLD0 + Printf ("AttribBlock, received: %o", BUF1) - Local0 = Buffer (0x20) - { - "TEST" - } - If ((DAT0 != Local0)) + If ((STA1 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local0) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0x00) } - If ((OB11 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) - } + // Perform write-then-read - If ((LEN1 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) - } + STA1 = 0x00 + LEN1 = 16 + DAT1 = Buffer() {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} + Printf ("AttribBlock, sent: %o", BUF1) - If ((DAT1 != Local0)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, Local0) - } - - /* Read block of data from the device using command value 1 */ - - BUFF = FLD1 /* Invoke a Read Block transaction */ /* \M755.FLD1 */ - If ((OB10 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) - } - - If ((LEN0 != 0x20)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x20) - } - - Local1 = Buffer (0x20) - { - /* 0000 */ 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, // ........ - /* 0008 */ 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, // ........ - /* 0010 */ 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, // ........ - /* 0018 */ 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF // ........ - } - If ((DAT0 != Local1)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local1) - } + BUF1 = FLD2 = BUF1 /* \M75C.BUF1 */ /* Invoke a Send Byte transaction */ + Printf ("AttribBlock, received: %o", BUF1) } /* Word Process Call (SMBProcessCall) */ @@ -1014,9 +968,11 @@ CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ CreateWordField (BUFF, 0x02, DAT0) + CreateByteField (BUFR, 0x00, OB11) CreateByteField (BUFR, 0x01, LEN1) CreateWordField (BUFR, 0x02, DAT1) + /* Process Call with input value '0x5416' to the device using command value 1 */ OB10 = 0x00 @@ -1038,9 +994,9 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x16) } - If ((OB11 != 0x7A)) + If ((OB11 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x00) } If ((LEN1 != 0x02)) @@ -1075,9 +1031,11 @@ CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ CreateField (BUFF, 0x10, 0x0100, DAT0) + CreateByteField (BUFR, 0x00, OB11) CreateByteField (BUFR, 0x01, LEN1) CreateField (BUFR, 0x10, 0x0100, DAT1) + /* Process Call with input value "TEST" to the device using command value 1 */ OB10 = 0x00 @@ -1103,9 +1061,9 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local0) } - If ((OB11 != 0x7A)) + If ((OB11 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x00) } If ((LEN1 != 0x20)) @@ -1144,32 +1102,33 @@ */ /* Read/Write Quick (AttribQuick) */ M758 (Arg0) - /* Send/Receive Byte (AttribSendReceive) */ + /* Send/Receive Byte (AttribSendReceive) */ M759 (Arg0) - /* Read/Write Byte (AttribByte) */ + /* Read/Write Byte (AttribByte) */ M75A (Arg0) - /* Read/Write Word (AttribWord) */ + /* Read/Write Word (AttribWord) */ M75B (Arg0) - /* Read/Write Block (AttribBlock) */ + /* Read/Write Block (AttribBlock) */ M75C (Arg0) - /* Word Process Call (AttribProcessCall) */ + /* Word Process Call (AttribProcessCall) */ M75D (Arg0) - /* Block Process Call (AttribBlockProcessCall) */ + /* Block Process Call (AttribBlockProcessCall) */ M75E (Arg0) - /* Next 3 types are used for GenericSerialBus only */ + + /* Next 3 types are exclusive to the GenericSerialBus */ /* Read/Write N Bytes (AttribBytes) */ M75F (Arg0) - /* Raw Read/Write N Bytes (AttribRawBytes) */ + /* Raw Read/Write N Bytes (AttribRawBytes) */ M760 (Arg0) - /* Raw Process Call (AttribRawProcessBytes) */ + /* Raw Process Call (AttribRawProcessBytes) */ M761 (Arg0) } @@ -1183,6 +1142,7 @@ Field (GSBD, BufferAcc, NoLock, Preserve) { AccessAs (BufferAcc, AttribQuick), + /* A Connection is required */ Connection ( @@ -1191,73 +1151,33 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, 8 - } /* Virtual register at command value 0. */ - - /* Create the GenericSerialBus data buffer */ - - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateByteField (BUFF, 0x02, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateByteField (BUFR, 0x02, DAT1) - /* Signal device (e.g. ON) */ - - BUFR = FLD0 = BUFF /* \M758.BUFF */ /* Invoke Write Quick transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } - - If ((LEN0 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x00) - } - - If ((DAT0 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x00) - } - - If ((OB11 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + FLD0, 8 /* Virtual register at command value 0. */ } - If ((LEN1 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) - } + /* Create the GenericSerialBus data buffer */ - If ((DAT1 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0x00) - } + Name (BUF0, Buffer (2){}) /* Create GenericSerialBus data buffer as BUF0 */ + CreateByteField (BUF0, 0x00, STA0) /* Status (Byte) */ + CreateByteField (BUF0, 0x01, LEN0) /* Length (Byte) */ - OB10 = 0x00 - LEN0 = 0xFF - DAT0 = 0x00 /* Signal device (e.g. OFF) */ - BUFF = FLD0 /* Invoke Read Quick transaction */ /* \M758.FLD0 */ - If ((OB10 != 0x7A)) + BUF0 = FLD0 /* \M758.BUF0 */ /* Invoke Read Quick transaction */ + Printf ("AttribQuick, received: %o", BUF0) + + If ((STA0 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA0, 0x00) } - If ((LEN0 != 0x00)) - { - /* Length is zero for Quick operations */ + /* Signal device (e.g. ON) */ - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x00) - } - /* Note: Since LEN0 should be zero there's no need to check DAT0 */ + LEN0 = 0 + FLD0 = BUF0 /* Invoke Write Quick transaction */ + Printf ("AttribQuick, sent: %o", BUF0) } - /* Read/Write Quick (AttribQuick) */ + /* AttribSendReceive */ /* m759(CallChain) */ /* CallChain: String */ Method (M759, 1, Serialized) @@ -1267,6 +1187,7 @@ Field (GSBD, BufferAcc, NoLock, Preserve) { AccessAs (BufferAcc, AttribSendReceive), + /* A Connection is required */ Connection ( @@ -1275,72 +1196,46 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, 8 - } /* Virtual register at command value 0. */ + FLD0, 8 /* Virtual register at command value 0. */ + } /* Create the GenericSerialBus data buffer */ - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateByteField (BUFF, 0x02, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateByteField (BUFR, 0x02, DAT1) - /* Send the byte '0x16' to the device */ - - OB10 = 0x00 - LEN0 = 0x00 - DAT0 = 0x16 /* Save 0x16 into the data buffer */ - BUFR = FLD0 = BUFF /* \M759.BUFF */ /* Invoke a Send Byte transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } + Name (BUF0, Buffer (3){}) /* Create GenericSerialBus data buffer as BUF0 */ + CreateByteField (BUF0, 0x00, STA0) /* Status (Byte) */ + CreateByteField (BUF0, 0x01, LEN0) /* Length (Byte) */ + CreateByteField (BUF0, 0x02, DAT0) - If ((LEN0 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x00) - } + Name (BUF1, Buffer (3){}) /* Create GenericSerialBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateByteField (BUF1, 0x02, DAT1) - If ((DAT0 != 0x16)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x16) - } + /* Receive a byte of data from the device */ - If ((OB11 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) - } + BUF1 = FLD0 + Printf ("AttribSendReceive, received: %o", BUF1) - If ((LEN1 != 0x00)) + If ((STA1 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0x00) } - - If ((DAT1 != 0x16)) + If ((LEN1 != 0x01)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x01) } - - /* Receive a byte of data from the device */ - - BUFF = FLD0 /* Invoke a Receive Byte transaction */ /* \M759.FLD0 */ - If ((OB10 != 0x7A)) + If ((DAT1 != 0xA0)) /* 0xA0 is from AcpiExec */ { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0xA0) } - If ((LEN0 != 0x01)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x01) - } + /* Send the byte '0x16' to the device */ - If ((DAT0 != 0xA0)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0xA0) - } + STA0 = 0x00 + LEN0 = 0x01 + DAT0 = 0x16 /* Save 0x16 into the data buffer */ + FLD0 = BUF0 /* \M759.BUF0 */ /* Invoke a Send Byte transaction */ + Printf ("AttribSendReceive, sent: %o", BUF0) } /* Read/Write Byte (AttribByte) */ @@ -1361,74 +1256,43 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, /* Virtual register at command value 0. */ 8, - FLD1, /* Virtual register at command value 1. */ 8, - FLD2, 8 - } /* Virtual register at command value 2. */ + FLD0, 8, /* Virtual register at command value 0. */ + FLD1, 8, /* Virtual register at command value 1. */ + FLD2, 8 /* Virtual register at command value 2. */ + } /* Create the GenericSerialBus data buffer */ - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateByteField (BUFF, 0x02, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateByteField (BUFR, 0x02, DAT1) - /* Write the byte '0x16' to the device using command value 2 */ - - OB10 = 0x00 - LEN0 = 0x00 - DAT0 = 0x16 /* Save 0x16 into the data buffer */ - BUFR = FLD2 = BUFF /* \M75A.BUFF */ /* Invoke a Write Byte transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } + Name (BUF1, Buffer (3){}) /* Create GenericSerialBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateByteField (BUF1, 0x02, DAT1) - If ((LEN0 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x00) - } + /* Receive a byte of data from the device, command value 1 */ - If ((DAT0 != 0x16)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x16) - } + BUF1 = FLD1 + Printf ("AttribByte, received: %o", BUF1) - If ((OB11 != 0x7A)) + If ((STA1 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0x00) } - - If ((LEN1 != 0x00)) + If ((LEN1 != 0x01)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x01) } - - If ((DAT1 != 0x16)) + If ((DAT1 != 0xA0)) /* 0xA0 is from AcpiExec */ { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0xA0) } - /* Read a byte of data from the device using command value 1 */ + /* Send the byte '0x16' to the device, command value 2 */ - BUFF = FLD1 /* Invoke a Read Byte transaction */ /* \M75A.FLD1 */ - If ((OB10 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) - } - - If ((LEN0 != 0x01)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x01) - } - - If ((DAT0 != 0xA0)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0xA0) - } + STA1 = 0x00 + LEN1 = 0x01 + DAT1 = 0x16 /* Save 0x16 into the data buffer */ + FLD2 = BUF1 /* \M75A.BUF1 */ /* Invoke a Send Byte transaction */ + Printf ("AttribByte, sent: %o", BUF1) } /* Read/Write Word (AttribWord) */ @@ -1441,6 +1305,7 @@ Field (GSBD, BufferAcc, NoLock, Preserve) { AccessAs (BufferAcc, AttribWord), + /* A Connection is required */ Connection ( @@ -1449,74 +1314,43 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, /* Virtual register at command value 0. */ 8, - FLD1, /* Virtual register at command value 1. */ 8, - FLD2, 8 - } /* Virtual register at command value 2. */ + FLD0, 8, /* Virtual register at command value 0. */ + FLD1, 8, /* Virtual register at command value 1. */ + FLD2, 8 /* Virtual register at command value 2. */ + } /* Create the GenericSerialBus data buffer */ - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateWordField (BUFF, 0x02, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateWordField (BUFR, 0x02, DAT1) - /* Write the word '0x5416' to the device using command value 2 */ - - OB10 = 0x00 - LEN0 = 0x00 - DAT0 = 0x5416 /* Save 0x5416 into the data buffer */ - BUFR = FLD2 = BUFF /* \M75B.BUFF */ /* Invoke a Write Word transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } - - If ((LEN0 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x00) - } + Name (BUF1, Buffer (4){}) /* Create GenericSerialBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateWordField (BUF1, 0x02, DAT1) - If ((DAT0 != 0x5416)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x16) - } + /* Receive a word of data from the device, command value 1 */ - If ((OB11 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) - } + BUF1 = FLD1 + Printf ("AttribWord, received: %o", BUF1) - If ((LEN1 != 0x00)) + If ((STA1 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0x00) } - - If ((DAT1 != 0x5416)) + If ((LEN1 != 0x02)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x02) } - - /* Read two bytes of data from the device using command value 1 */ - - BUFF = FLD1 /* Invoke a Read Word transaction */ /* \M75B.FLD1 */ - If ((OB10 != 0x7A)) + If ((DAT1 != 0xA1A0)) /* 0xA1A0 is from AcpiExec */ { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0xA1A0) } - If ((LEN0 != 0x02)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x02) - } + /* Send the word '0x5678' to the device, command value 2 */ - If ((DAT0 != 0xA1A0)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0xA1A0) - } + STA1 = 0x00 + LEN1 = 0x02 + DAT1 = 0x5678 /* Save 0x16 into the data buffer */ + FLD2 = BUF1 /* \M75B.BUF1 */ /* Invoke a Send Byte transaction */ + Printf ("AttribWord, sent: %o", BUF1) } /* Read/Write Block (AttribBlock) */ @@ -1529,6 +1363,7 @@ Field (GSBD, BufferAcc, NoLock, Preserve) { AccessAs (BufferAcc, AttribBlock), + /* A Connection is required */ Connection ( @@ -1537,85 +1372,37 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, /* Virtual register at command value 0. */ 8, - FLD1, /* Virtual register at command value 1. */ 8, - FLD2, 8 - } /* Virtual register at command value 2. */ - - /* Create the GenericSerialBus data buffer */ - - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateField (BUFF, 0x10, 0x0100, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateField (BUFR, 0x10, 0x0100, DAT1) - /* Write the block 'TEST' to the device using command value 2 */ - - OB10 = 0x00 - LEN0 = 0x04 - DAT0 = "TEST" /* Save 'TEST' into the data buffer */ - BUFR = FLD2 = BUFF /* \M75C.BUFF */ /* Invoke a Write Block transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) + FLD0, 8, /* Virtual register at command value 0. */ + FLD1, 8, /* Virtual register at command value 1. */ + FLD2, 8 /* Virtual register at command value 2. */ } - If ((LEN0 != 0x04)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x04) - } + /* Create the GenericSerialBus data buffer */ - Local0 = Buffer (0x20) - { - "TEST" - } - If ((DAT0 != Local0)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local0) - } + Name (BUF1, Buffer (24){}) /* Create GenericSerialBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateField (BUF1, 0x10, 0x0080, DAT1) - If ((OB11 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) - } + // Read block of data from the device using command value 0 - If ((LEN1 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x00) - } + BUF1 = FLD0 + Printf ("AttribBlock, received: %o", BUF1) - If ((DAT1 != Local0)) + If ((STA1 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, Local0) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0x00) } - /* Read block of data from the device using command value 1 */ + // Perform write-then-read - BUFF = FLD1 /* Invoke a Read Block transaction */ /* \M75C.FLD1 */ - If ((OB10 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x7A) - } - - If ((LEN0 != 0x20)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x20) - } + STA1 = 0x00 + LEN1 = 16 + DAT1 = Buffer() {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} + Printf ("AttribBlock, sent: %o", BUF1) - Local1 = Buffer (0x20) - { - /* 0000 */ 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, // ........ - /* 0008 */ 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, // ........ - /* 0010 */ 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, // ........ - /* 0018 */ 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF // ........ - } - If ((DAT0 != Local1)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local1) - } + BUF1 = FLD2 = BUF1 /* \M75C.BUF1 */ /* Invoke a Send Byte transaction */ + Printf ("AttribBlock, received: %o", BUF1) } /* Word Process Call (AttribProcessCall) */ @@ -1628,6 +1415,7 @@ Field (GSBD, BufferAcc, NoLock, Preserve) { AccessAs (BufferAcc, AttribProcessCall), + /* A Connection is required */ Connection ( @@ -1636,55 +1424,39 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, /* Virtual register at command value 0. */ 8, - FLD1, /* Virtual register at command value 1. */ 8, - FLD2, 8 - } /* Virtual register at command value 2. */ + FLD0, 8, /* Virtual register at command value 0. */ + FLD1, 8, /* Virtual register at command value 1. */ + FLD2, 8 /* Virtual register at command value 2. */ + } /* Create the GenericSerialBus data buffer */ - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateWordField (BUFF, 0x02, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateWordField (BUFR, 0x02, DAT1) - /* Process Call with input value '0x5416' to the device using command value 1 */ + Name (BUF0, Buffer (4){}) /* Create GenericSerialBus data buffer as BUF0 */ + CreateByteField (BUF0, 0x00, STA0) /* Status (Byte) */ + CreateByteField (BUF0, 0x01, LEN0) /* Length (Byte) */ + CreateWordField (BUF0, 0x02, DAT0) - OB10 = 0x00 - LEN0 = 0x00 - DAT0 = 0x5416 /* Save 0x5416 into the data buffer */ - BUFR = FLD1 = BUFF /* \M75D.BUFF */ /* Invoke a Process Call transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } + Name (BUF1, Buffer (0){}) /* Create GenericSerialBus result buffer */ - If ((LEN0 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x00) - } + /* Process Call with input value '0x5416' to the device using command value 1 */ - If ((DAT0 != 0x5416)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, 0x16) - } + STA0 = 0x00 + LEN0 = 0x02 + DAT0 = 0x5416 /* Save 0x5416 into the data buffer */ + Printf ("AttribProcessCall, sent: %o", BUF0) - If ((OB11 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) - } + BUF1 = FLD1 = BUF0 /* \M75D.BUF0 */ /* Invoke a Process Call transaction */ + Printf ("AttribProcessCall, received: %o", BUF1) - If ((LEN1 != 0x02)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x02) - } + /* Now that BUF1 is valid, can create fields within it */ - If ((DAT1 != 0xA1A0)) + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateWordField (BUF1, 0x02, DAT1) + + If ((STA1 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, 0xA1A0) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0x00) } } @@ -1698,6 +1470,7 @@ Field (GSBD, BufferAcc, NoLock, Preserve) { AccessAs (BufferAcc, AttribBlockProcessCall), + /* A Connection is required */ Connection ( @@ -1706,65 +1479,48 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, /* Virtual register at command value 0. */ 8, - FLD1, 8 - } /* Virtual register at command value 1. */ + FLD0, 8, /* Virtual register at command value 0. */ + FLD1, 8 /* Virtual register at command value 1. */ + } /* Create the GenericSerialBus data buffer */ - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateField (BUFF, 0x10, 0x0100, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateField (BUFR, 0x10, 0x0100, DAT1) + Name (BUF0, Buffer (8){}) /* Create GenericSerialBus data buffer as BUF0 */ + CreateByteField (BUF0, 0x00, STA0) /* Status (Byte) */ + CreateByteField (BUF0, 0x01, LEN0) /* Length (Byte) */ + CreateField (BUF0, 0x10, 32, DAT0) + + Name (BUF1, Buffer (0x14){}) /* Create GenericSerialBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateField (BUF1, 0x10, 32, DAT1) + /* Process Call with input value "TEST" to the device using command value 1 */ - OB10 = 0x00 + STA0 = 0x00 LEN0 = 0x04 - DAT0 = "TEST" /* Save 'TEST' into the data buffer */ - BUFR = FLD1 = BUFF /* \M75E.BUFF */ /* Invoke a Write Block transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } - - If ((LEN0 != 0x04)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x04) - } + DAT0 = "TEST" /* Save 'TEST' into the data buffer */ + Printf ("AttribBlockProcessCall, sent: %o", BUF0) - Local0 = Buffer (0x20) - { - "TEST" - } - If ((DAT0 != Local0)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local0) - } + BUF1 = FLD1 = BUF0 /* \M75E.BUF0 */ /* Invoke a Write Block transaction */ + Printf ("AttribBlockProcessCall, received: %o", BUF1) - If ((OB11 != 0x7A)) + If ((STA1 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0x00) } - If ((LEN1 != 0x20)) { ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x20) } - Local1 = Buffer (0x20) + Local0 = Buffer (0x20) { - /* 0000 */ 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, // ........ - /* 0008 */ 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, // ........ - /* 0010 */ 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, // ........ - /* 0018 */ 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF // ........ + "TEST" } - If ((DAT1 != Local1)) + If ((DAT0 != Local0)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, Local1) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local0) } } @@ -1781,7 +1537,8 @@ * Note: AccessLength for AttribBytes here must at least 2 less than the * transfer buffer to account for the status and length bytes */ - AccessAs (BufferAcc, AttribBytes (0x20)), + AccessAs (BufferAcc, AttribBytes (0x22)), + /* A Connection is required */ Connection ( @@ -1790,50 +1547,47 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, /* Virtual register at command value 0. */ 8, - FLD1, 8 - } /* Virtual register at command value 1. */ + FLD0, 8, /* Virtual register at command value 0. */ + FLD1, 8 /* Virtual register at command value 1. */ + } /* Create the GenericSerialBus data buffer */ - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateField (BUFF, 0x10, 0x0100, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateField (BUFR, 0x10, 0x0100, DAT1) - /* Process Call with input value "TEST" to the device using command value 1 */ + Name (BUF0, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUF0 */ + CreateByteField (BUF0, 0x00, STA0) /* Status (Byte) */ + CreateByteField (BUF0, 0x01, LEN0) /* Length (Byte) */ + CreateField (BUF0, 0x10, 0x0100, DAT0) - OB10 = 0x00 - LEN0 = 0x04 - DAT0 = "TEST" /* Save 'TEST' into the data buffer */ - BUFR = FLD1 = BUFF /* \M75F.BUFF */ /* Invoke a Write Block transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } + Name (BUF1, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateField (BUF1, 0x10, 0x0100, DAT1) - If ((LEN0 != 0x04)) + /* Read buffer from FLD0 */ + + BUF0 = FLD0 + Printf ("AttribBytes, received: %o", BUF0) + + If ((STA0 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x04) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA0, 0x00) } - - Local0 = Buffer (0x20) - { - "TEST" - } - If ((DAT0 != Local0)) + If ((LEN0 != 0x20)) /* Size of BUF0 */ { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local0) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x20) } - If ((OB11 != 0x7A)) + /* WRITE then READ to FLD1 (Force READ by not using double store) */ + + FLD1 = BUF0 + BUF1 = FLD1 + Printf ("AttribBytes, sent: %o", BUF0) + Printf ("AttribBytes, received: %o", BUF1) + + If ((STA1 != 0)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0) } - If ((LEN1 != 0x20)) { ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x20) @@ -1846,7 +1600,12 @@ /* 0010 */ 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, // ........ /* 0018 */ 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF // ........ } - If ((DAT1 != Local1)) + + If ((DAT0 != Local1)) + { + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local1) + } + If ((DAT0 != Local1)) { ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, Local1) } @@ -1865,7 +1624,7 @@ * Note: AccessLength for AttribBytes here must at least 2 less than the * transfer buffer to account for the status and length bytes */ - AccessAs (BufferAcc, AttribRawBytes (0x20)), + AccessAs (BufferAcc, AttribRawBytes (0x22)), /* A Connection is required */ Connection ( @@ -1874,50 +1633,47 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, /* Virtual register at command value 0. */ 8, - FLD1, 8 - } /* Virtual register at command value 1. */ + FLD0, 8, /* Virtual register at command value 0. */ + FLD1, 8 /* Virtual register at command value 1. */ + } /* Create the GenericSerialBus data buffer */ - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateField (BUFF, 0x10, 0x0100, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateField (BUFR, 0x10, 0x0100, DAT1) - /* Process Call with input value "TEST" to the device using command value 1 */ + Name (BUF0, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUF0 */ + CreateByteField (BUF0, 0x00, STA0) /* Status (Byte) */ + CreateByteField (BUF0, 0x01, LEN0) /* Length (Byte) */ + CreateField (BUF0, 0x10, 0x0100, DAT0) - OB10 = 0x00 - LEN0 = 0x04 - DAT0 = "TEST" /* Save 'TEST' into the data buffer */ - BUFR = FLD1 = BUFF /* \M760.BUFF */ /* Invoke a Write Block transaction */ - If ((OB10 != 0x00)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) - } + Name (BUF1, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateField (BUF1, 0x10, 0x0100, DAT1) - If ((LEN0 != 0x04)) + /* Read buffer from FLD0 */ + + BUF0 = FLD0 + Printf ("AttribRawBytes, received: %o", BUF0) + + If ((STA0 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x04) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA0, 0x00) } - - Local0 = Buffer (0x20) - { - "TEST" - } - If ((DAT0 != Local0)) + If ((LEN0 != 0x20)) /* Size of BUF0 */ { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local0) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x20) } - If ((OB11 != 0x7A)) + /* WRITE then READ to FLD1 (Force READ by not using double store) */ + + FLD1 = BUF0 + BUF1 = FLD1 + Printf ("AttribRawBytes, sent: %o", BUF0) + Printf ("AttribRawBytes, received: %o", BUF1) + + If ((STA1 != 0)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0) } - If ((LEN1 != 0x20)) { ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x20) @@ -1930,7 +1686,12 @@ /* 0010 */ 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, // ........ /* 0018 */ 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF // ........ } - If ((DAT1 != Local1)) + + If ((DAT0 != Local1)) + { + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local1) + } + If ((DAT0 != Local1)) { ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, Local1) } @@ -1950,6 +1711,7 @@ * transfer buffer to account for the status and length bytes */ AccessAs (BufferAcc, AttribRawProcessBytes (0x20)), + /* A Connection is required */ Connection ( @@ -1958,55 +1720,53 @@ 0xEE, ResourceConsumer, , Exclusive, ) ), - FLD0, /* Virtual register at command value 0. */ 8, - FLD1, 8 - } /* Virtual register at command value 1. */ + FLD0, 8, /* Virtual register at command value 0. */ + FLD1, 8 /* Virtual register at command value 1. */ + } - /* Create the GenericSerialBus data buffer */ + /* Create the GenericSerialBus data buffers */ + + Name (BUF0, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUF0 */ + CreateByteField (BUF0, 0x00, STA0) /* Status (Byte) */ + CreateByteField (BUF0, 0x01, LEN0) /* Length (Byte) */ + CreateWordField(BUF0, 0x02, CMD0) // Command (Bytes 2 and 3) + CreateField (BUF0, 0x10, 0x0100, DAT0) + + Name (BUF1, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ + CreateByteField (BUF1, 0x00, STA1) + CreateByteField (BUF1, 0x01, LEN1) + CreateWordField(BUF1, 0x02, CMD1) // Command (Bytes 2 and 3) + CreateField (BUF1, 0x10, 0x0100, DAT1) - Name (BUFF, Buffer (0x22){}) /* Create GenericSerialBus data buffer as BUFF */ - Name (BUFR, Buffer (0x22){}) /* Create GenericSerialBus result buffer */ - CreateByteField (BUFF, 0x00, OB10) /* Status (Byte) */ - CreateByteField (BUFF, 0x01, LEN0) /* Length (Byte) */ - CreateField (BUFF, 0x10, 0x0100, DAT0) - CreateByteField (BUFR, 0x00, OB11) - CreateByteField (BUFR, 0x01, LEN1) - CreateField (BUFR, 0x10, 0x0100, DAT1) /* Process Call with input value "TEST" to the device using command value 1 */ - OB10 = 0x00 - LEN0 = 0x04 - DAT0 = "TEST" /* Save 'TEST' into the data buffer */ - BUFR = FLD1 = BUFF /* \M761.BUFF */ /* Invoke a Write Block transaction */ - If ((OB10 != 0x00)) + STA0 = 0x00 + LEN0 = 0x08 + DAT0 = "TEST" /* Save 'TEST' into the data buffer */ + + BUF1 = FLD1 = BUF0 /* \M761.BUF0 */ /* Invoke a Write Block transaction */ + Printf ("AttribRawProcessBytes, sent: %o", BUF0) + Printf ("AttribRawProcessBytes, received: %o", BUF1) + + If ((STA1 != 0x00)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB10, 0x00) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, STA1, 0x00) } - - If ((LEN0 != 0x04)) + If ((LEN1 != 0x20)) { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN0, 0x04) + ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x20) } Local0 = Buffer (0x20) { "TEST" } + If ((DAT0 != Local0)) { ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT0, Local0) } - If ((OB11 != 0x7A)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, OB11, 0x7A) - } - - If ((LEN1 != 0x20)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, LEN1, 0x20) - } - Local1 = Buffer (0x20) { /* 0000 */ 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, // ........ @@ -2014,6 +1774,7 @@ /* 0010 */ 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, // ........ /* 0018 */ 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF // ........ } + If ((DAT1 != Local1)) { ERR (Arg0, Z143, __LINE__, 0x00, 0x00, DAT1, Local1) @@ -2027,7 +1788,7 @@ Method (M764, 1, Serialized) { Concatenate (Arg0, "-m764", Arg0) - Debug = "TEST: m764, Check GeneralPurposeIo Region Fields (ByteAcc access)" + Debug = "TEST: m764, Check GeneralPurposeIo Region Fields (ByteAcc access required)" /*...Other required stuff for this device */ Name (GMOD, ResourceTemplate () @@ -2100,17 +1861,21 @@ ERR (Arg0, Z143, __LINE__, 0x00, 0x00, Local0, 0x01) } - Name (TBUF, Buffer (0x10) - { - /* 0000 */ 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, // ........ - /* 0008 */ 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF // ........ - }) - BUFF = TBUF /* \M764.TBUF */ - Local0 = BUFF /* \M764.BUFF */ - If ((Local0 != TBUF)) - { - ERR (Arg0, Z143, __LINE__, 0x00, 0x00, Local0, TBUF) - } +// August 2018: +// Use of Buffer objects with GeneralPurposeIo is disallowed, since it doesn't +// really make sense. Test removed. +// +// Name (TBUF, Buffer (0x10) +// { +// /* 0000 */ 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, // ........ +// /* 0008 */ 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF // ........ +// }) +// BUFF = TBUF /* \M764.TBUF */ +// Local0 = BUFF /* \M764.BUFF */ +// If ((Local0 != TBUF)) +// { +// ERR (Arg0, Z143, __LINE__, 0x00, 0x00, Local0, TBUF) +// } } /***** IPMI (ACPI 4.0) - bidirectional buffer **************************** */ @@ -2948,6 +2713,8 @@ LPC0 = 0x00 While (LPN0) { + +printf ("LPN0: %o\n", LPN0) /* Operands */ Local6 = (LPC0 * 0x05) @@ -2963,15 +2730,22 @@ LPC1 = 0x00 While (LPN1) { + +printf ("LPN1: %o\n", LPN1) + NB00 = Local0 LPN2 = Local1 LPC2 = 0x00 Local6 = DerefOf (PFUO [IB00]) While (LPN2) { + +printf ("LPN2: %o\n", LPN2) + Local7 = DerefOf (PFUL [NB00]) /* Integer source */ +printf ("BINT: %o %o %o %o\n", Arg2, Local6, Local7, Local2) M72E (Concatenate (Arg0, "-BInt"), Arg2, Local6, Local7, Local2, 0x00) If ((Local7 > 0x08)) { |