diff options
Diffstat (limited to 'source')
270 files changed, 9428 insertions, 8018 deletions
diff --git a/source/common/acfileio.c b/source/common/acfileio.c new file mode 100644 index 000000000000..b94adf8c4900 --- /dev/null +++ b/source/common/acfileio.c @@ -0,0 +1,357 @@ +/****************************************************************************** + * + * Module Name: acfileio - Get ACPI tables from file + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * 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. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * 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 MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" +#include "acapps.h" +#include "actables.h" +#include "acutils.h" +#include <errno.h> + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("acfileio") + + +/* Local prototypes */ + +static ACPI_STATUS +AcpiAcGetOneTableFromFile ( + char *Filename, + FILE *File, + UINT8 GetOnlyAmlTables, + ACPI_TABLE_HEADER **Table); + +static ACPI_STATUS +AcpiAcCheckTextModeCorruption ( + ACPI_TABLE_HEADER *Table); + + +/******************************************************************************* + * + * FUNCTION: AcpiAcGetAllTablesFromFile + * + * PARAMETERS: Filename - Table filename + * GetOnlyAmlTables - TRUE if the tables must be AML tables + * ReturnListHead - Where table list is returned + * + * RETURN: Status + * + * DESCRIPTION: Get all ACPI tables from within a single file. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiAcGetAllTablesFromFile ( + char *Filename, + UINT8 GetOnlyAmlTables, + ACPI_NEW_TABLE_DESC **ReturnListHead) +{ + ACPI_NEW_TABLE_DESC *ListHead = NULL; + ACPI_NEW_TABLE_DESC *ListTail = NULL; + ACPI_NEW_TABLE_DESC *TableDesc; + FILE *File; + ACPI_TABLE_HEADER *Table = NULL; + UINT32 FileSize; + ACPI_STATUS Status = AE_OK; + + + File = fopen (Filename, "rb"); + if (!File) + { + perror ("Could not open input file"); + if (errno == ENOENT) + { + return (AE_NOT_EXIST); + } + + return (AE_ERROR); + } + + /* Get the file size */ + + FileSize = CmGetFileSize (File); + if (FileSize == ACPI_UINT32_MAX) + { + return (AE_ERROR); + } + + if (FileSize < 4) + { + return (AE_BAD_HEADER); + } + + /* Read all tables within the file */ + + while (ACPI_SUCCESS (Status)) + { + /* Get one entire ACPI table */ + + Status = AcpiAcGetOneTableFromFile ( + Filename, File, GetOnlyAmlTables, &Table); + if (Status == AE_CTRL_TERMINATE) + { + Status = AE_OK; + break; + } + else if (Status == AE_TYPE) + { + continue; + } + else if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Allocate and link a table descriptor */ + + TableDesc = AcpiOsAllocate (sizeof (ACPI_NEW_TABLE_DESC)); + TableDesc->Table = Table; + TableDesc->Next = NULL; + + /* Link at the end of the local table list */ + + if (!ListHead) + { + ListHead = TableDesc; + ListTail = TableDesc; + } + else + { + ListTail->Next = TableDesc; + ListTail = TableDesc; + } + } + + /* Add the local table list to the end of the global list */ + + if (*ReturnListHead) + { + ListTail = *ReturnListHead; + while (ListTail->Next) + { + ListTail = ListTail->Next; + } + + ListTail->Next = ListHead; + } + else + { + *ReturnListHead = ListHead; + } + + fclose(File); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiAcGetOneTableFromFile + * + * PARAMETERS: Filename - File where table is located + * File - Open FILE pointer to Filename + * GetOnlyAmlTables - TRUE if the tables must be AML tables. + * ReturnTable - Where a pointer to the table is returned + * + * RETURN: Status + * + * DESCRIPTION: Read the next ACPI table from a file. Implements support + * for multiple tables within a single file. File must already + * be open. + * + * Note: Loading an RSDP is not supported. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiAcGetOneTableFromFile ( + char *Filename, + FILE *File, + UINT8 GetOnlyAmlTables, + ACPI_TABLE_HEADER **ReturnTable) +{ + ACPI_STATUS Status = AE_OK; + ACPI_TABLE_HEADER TableHeader; + ACPI_TABLE_HEADER *Table; + INT32 Count; + long Position; + + + *ReturnTable = NULL; + + + /* Get just the table header to get signature and length */ + + Position = ftell (File); + Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), File); + if (Count != sizeof (ACPI_TABLE_HEADER)) + { + return (AE_CTRL_TERMINATE); + } + + if (GetOnlyAmlTables) + { + /* Table must be an AML table (DSDT/SSDT) or FADT */ + + if (!ACPI_COMPARE_NAME (TableHeader.Signature, ACPI_SIG_FADT) && + !AcpiUtIsAmlTable (&TableHeader)) + { + fprintf (stderr, + " %s: [%4.4s] is not an AML table - ignoring\n", + Filename, TableHeader.Signature); + + return (AE_TYPE); + } + } + + /* Allocate a buffer for the entire table */ + + Table = AcpiOsAllocate ((size_t) TableHeader.Length); + if (!Table) + { + return (AE_NO_MEMORY); + } + + /* Now read the entire table */ + + fseek (File, Position, SEEK_SET); + + Count = fread (Table, 1, TableHeader.Length, File); + if (Count != (INT32) TableHeader.Length) + { + Status = AE_ERROR; + goto ErrorExit; + } + + /* Validate the checksum (just issue a warning) */ + + Status = AcpiTbVerifyChecksum (Table, TableHeader.Length); + if (ACPI_FAILURE (Status)) + { + Status = AcpiAcCheckTextModeCorruption (Table); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + } + + fprintf (stderr, + "Loading ACPI table [%4.4s] from file %12s - Length 0x%06X (%u)\n", + TableHeader.Signature, Filename, + TableHeader.Length, TableHeader.Length); + + *ReturnTable = Table; + return (AE_OK); + + +ErrorExit: + AcpiOsFree (Table); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiAcCheckTextModeCorruption + * + * PARAMETERS: Table - Table buffer starting with table header + * + * RETURN: Status + * + * DESCRIPTION: Check table for text mode file corruption where all linefeed + * characters (LF) have been replaced by carriage return linefeed + * pairs (CR/LF). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiAcCheckTextModeCorruption ( + ACPI_TABLE_HEADER *Table) +{ + UINT32 i; + UINT32 Pairs = 0; + UINT8 *Buffer = ACPI_CAST_PTR (UINT8, Table); + + + /* Scan entire table to determine if each LF has been prefixed with a CR */ + + for (i = 1; i < Table->Length; i++) + { + if (Buffer[i] == 0x0A) + { + if (Buffer[i - 1] != 0x0D) + { + /* The LF does not have a preceding CR, table not corrupted */ + + return (AE_OK); + } + else + { + /* Found a CR/LF pair */ + + Pairs++; + } + + i++; + } + } + + if (!Pairs) + { + return (AE_OK); + } + + /* + * Entire table scanned, each CR is part of a CR/LF pair -- + * meaning that the table was treated as a text file somewhere. + * + * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the + * original table are left untouched by the text conversion process -- + * meaning that we cannot simply replace CR/LF pairs with LFs. + */ + AcpiOsPrintf ("Table has been corrupted by text mode conversion\n"); + AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs); + AcpiOsPrintf ("Table cannot be repaired!\n"); + + return (AE_BAD_VALUE); +} diff --git a/source/common/acgetline.c b/source/common/acgetline.c index 5daa95a8be55..2273db406656 100644 --- a/source/common/acgetline.c +++ b/source/common/acgetline.c @@ -262,6 +262,7 @@ AcpiOsGetLine ( ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition + 1); EndOfLine--; + if (CursorPosition > 0) { CursorPosition--; diff --git a/source/common/adisasm.c b/source/common/adisasm.c index 8afabd5bcc12..33500d6df4d6 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -42,16 +42,14 @@ */ #include "aslcompiler.h" -#include "acparser.h" #include "amlcode.h" #include "acdisasm.h" #include "acdispat.h" #include "acnamesp.h" -#include "actables.h" +#include "acparser.h" #include "acapps.h" #include <stdio.h> -#include <time.h> #define _COMPONENT ACPI_TOOLS @@ -59,17 +57,29 @@ /* Local prototypes */ -static void -AdCreateTableHeader ( +static ACPI_STATUS +AdDoExternalFileList ( + char *Filename); + +static ACPI_STATUS +AdDisassembleOneTable ( + ACPI_TABLE_HEADER *Table, + FILE *File, char *Filename, - ACPI_TABLE_HEADER *Table); + char *DisasmFilename); static ACPI_STATUS -AdStoreTable ( +AdReparseOneTable ( ACPI_TABLE_HEADER *Table, - UINT32 *TableIndex); + FILE *File, + ACPI_OWNER_ID OwnerId); -/* Stubs for ASL compiler */ + +ACPI_TABLE_DESC LocalTables[1]; +ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; + + +/* Stubs for everything except ASL compiler */ #ifndef ACPI_ASL_COMPILER BOOLEAN @@ -77,7 +87,7 @@ AcpiDsIsResultUsed ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState) { - return TRUE; + return (TRUE); } ACPI_STATUS @@ -89,52 +99,6 @@ AcpiDsMethodError ( } #endif -ACPI_STATUS -AcpiNsLoadTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *Node) -{ - return (AE_NOT_IMPLEMENTED); -} - -ACPI_STATUS -AcpiDsRestartControlMethod ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ReturnDesc) -{ - return (AE_OK); -} - -void -AcpiDsTerminateControlMethod ( - ACPI_OPERAND_OBJECT *MethodDesc, - ACPI_WALK_STATE *WalkState) -{ - return; -} - -ACPI_STATUS -AcpiDsCallControlMethod ( - ACPI_THREAD_STATE *Thread, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsMethodDataInitArgs ( - ACPI_OPERAND_OBJECT **Params, - UINT32 MaxParamCount, - ACPI_WALK_STATE *WalkState) -{ - return (AE_OK); -} - - -static ACPI_TABLE_DESC LocalTables[1]; -static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; - /******************************************************************************* * @@ -202,7 +166,7 @@ AdInitialize ( * * RETURN: Status * - * DESCRIPTION: Disassemble an entire ACPI table + * DESCRIPTION: Disassembler entry point. Disassemble an entire ACPI table. * *****************************************************************************/ @@ -214,14 +178,10 @@ AdAmlDisassemble ( char **OutFilename) { ACPI_STATUS Status; - ACPI_STATUS GlobalStatus = AE_OK; char *DisasmFilename = NULL; - char *ExternalFilename; - ACPI_EXTERNAL_FILE *ExternalFileList = AcpiGbl_ExternalFileList; FILE *File = NULL; ACPI_TABLE_HEADER *Table = NULL; - ACPI_TABLE_HEADER *ExternalTable; - ACPI_OWNER_ID OwnerId; + ACPI_NEW_TABLE_DESC *ListHead = NULL; /* @@ -230,81 +190,22 @@ AdAmlDisassemble ( */ if (Filename) { - Status = AcpiDbGetTableFromFile (Filename, &Table, FALSE); + /* Get the list of all AML tables in the file */ + + Status = AcpiAcGetAllTablesFromFile (Filename, + ACPI_GET_ALL_TABLES, &ListHead); if (ACPI_FAILURE (Status)) { return (Status); } - /* - * External filenames separated by commas - * Example: iasl -e file1,file2,file3 -d xxx.aml - */ - while (ExternalFileList) - { - ExternalFilename = ExternalFileList->Path; - if (!strcmp (ExternalFilename, Filename)) - { - /* Next external file */ - - ExternalFileList = ExternalFileList->Next; - continue; - } - - Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable, TRUE); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_TYPE) - { - ExternalFileList = ExternalFileList->Next; - GlobalStatus = AE_TYPE; - Status = AE_OK; - continue; - } - return (Status); - } - - /* Load external table for symbol resolution */ - - if (ExternalTable) - { - Status = AdParseTable (ExternalTable, &OwnerId, TRUE, TRUE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", - AcpiFormatException (Status)); - return (Status); - } - - /* - * Load namespace from names created within control methods - * Set owner id of nodes in external table - */ - AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, - AcpiGbl_RootNode, OwnerId); - AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - } - - /* Next external file */ - - ExternalFileList = ExternalFileList->Next; - } - - if (ACPI_FAILURE (GlobalStatus)) - { - return (GlobalStatus); - } - - /* Clear external list generated by Scope in external tables */ + /* Process any user-specified files for external objects */ - if (AcpiGbl_ExternalFileList) + Status = AdDoExternalFileList (Filename); + if (ACPI_FAILURE (Status)) { - AcpiDmClearExternalList (); + return (Status); } - - /* Load any externals defined in the optional external ref file */ - - AcpiDmGetExternalsFromFile (); } else { @@ -353,7 +254,8 @@ AdAmlDisassemble ( File = fopen (DisasmFilename, "w+"); if (!File) { - fprintf (stderr, "Could not open output file %s\n", DisasmFilename); + fprintf (stderr, "Could not open output file %s\n", + DisasmFilename); Status = AE_ERROR; goto Cleanup; } @@ -363,190 +265,32 @@ AdAmlDisassemble ( *OutFilename = DisasmFilename; - /* ForceAmlDisassembly means to assume the table contains valid AML */ - - if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table)) - { - AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE); - AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n", - Table->Signature); - AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] " - "FieldName : FieldValue\n */\n\n"); - - AcpiDmDumpDataTable (Table); - fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", - Table->Signature); + /* Disassemble all AML tables within the file */ - if (File) - { - fprintf (stderr, "Formatted output: %s - %u bytes\n", - DisasmFilename, CmGetFileSize (File)); - } - } - else + while (ListHead) { - /* Always parse the tables, only option is what to display */ - - Status = AdParseTable (Table, &OwnerId, TRUE, FALSE); + Status = AdDisassembleOneTable (ListHead->Table, + File, Filename, DisasmFilename); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not parse ACPI tables, %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - if (AslCompilerdebug) - { - AcpiOsPrintf ("/**** Before second load\n"); - - if (File) - { - NsSetupNamespaceListing (File); - NsDisplayNamespace (); - } - AcpiOsPrintf ("*****/\n"); - } - - /* Load namespace from names created within control methods */ - - AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, - AcpiGbl_RootNode, OwnerId); - - /* - * Cross reference the namespace here, in order to - * generate External() statements - */ - AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, - AcpiGbl_RootNode, OwnerId); - - if (AslCompilerdebug) - { - AcpiDmDumpTree (AcpiGbl_ParseOpRoot); - } - - /* Find possible calls to external control methods */ - - AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot); - - /* - * If we found any external control methods, we must reparse - * the entire tree with the new information (namely, the - * number of arguments per method) - */ - if (AcpiDmGetExternalMethodCount ()) - { - fprintf (stderr, - "\nFound %u external control methods, " - "reparsing with new information\n", - AcpiDmGetExternalMethodCount ()); - - /* Reparse, rebuild namespace */ - - AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - AcpiGbl_ParseOpRoot = NULL; - AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); - - AcpiGbl_RootNode = NULL; - AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; - AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; - AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; - AcpiGbl_RootNodeStruct.Parent = NULL; - AcpiGbl_RootNodeStruct.Child = NULL; - AcpiGbl_RootNodeStruct.Peer = NULL; - AcpiGbl_RootNodeStruct.Object = NULL; - AcpiGbl_RootNodeStruct.Flags = 0; - - Status = AcpiNsRootInitialize (); - - /* New namespace, add the external definitions first */ - - AcpiDmAddExternalsToNamespace (); - - /* Parse the table again. No need to reload it, however */ - - Status = AdParseTable (Table, NULL, FALSE, FALSE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not parse ACPI tables, %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - /* Cross reference the namespace again */ - - AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, - AcpiGbl_RootNode, OwnerId); - - AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, - AcpiGbl_RootNode, OwnerId); - - if (AslCompilerdebug) - { - AcpiOsPrintf ("/**** After second load and resource conversion\n"); - if (File) - { - NsSetupNamespaceListing (File); - NsDisplayNamespace (); - } - AcpiOsPrintf ("*****/\n"); - - AcpiDmDumpTree (AcpiGbl_ParseOpRoot); - } + break; } - /* - * Now that the namespace is finalized, we can perform namespace - * transforms. - * - * 1) Convert fixed-offset references to resource descriptors - * to symbolic references (Note: modifies namespace) - */ - AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); - - /* Optional displays */ - - if (AcpiGbl_DmOpt_Disasm) - { - /* This is the real disassembly */ - - AdDisplayTables (Filename, Table); - - /* Dump hex table if requested (-vt) */ - - AcpiDmDumpDataTable (Table); - - fprintf (stderr, "Disassembly completed\n"); - if (File) - { - fprintf (stderr, "ASL Output: %s - %u bytes\n", - DisasmFilename, CmGetFileSize (File)); - } - - if (Gbl_MapfileFlag) - { - fprintf (stderr, "%14s %s - %u bytes\n", - Gbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription, - Gbl_Files[ASL_FILE_MAP_OUTPUT].Filename, - FlGetFileSize (ASL_FILE_MAP_OUTPUT)); - } - } + ListHead = ListHead->Next; } Cleanup: - if (Table && !AcpiGbl_ForceAmlDisassembly &&!AcpiUtIsAmlTable (Table)) +// check! +#if 0 + if (Table && !AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table)) { ACPI_FREE (Table); } +#endif if (File) { - if (AslCompilerdebug) /* Display final namespace, with transforms */ - { - NsSetupNamespaceListing (File); - NsDisplayNamespace (); - } - fclose (File); AcpiOsRedirectOutput (stdout); } @@ -559,290 +303,243 @@ Cleanup: /****************************************************************************** * - * FUNCTION: AdDisassemblerHeader + * FUNCTION: AdDisassembleOneTable * - * PARAMETERS: Filename - Input file for the table - * TableType - Either AML or DataTable + * PARAMETERS: Table - Raw AML table + * File - Pointer for the input file + * Filename - AML input filename + * DisasmFilename - Output filename * - * RETURN: None + * RETURN: Status * - * DESCRIPTION: Create the disassembler header, including ACPICA signon with - * current time and date. + * DESCRIPTION: Disassemble a single ACPI table. AML or data table. * *****************************************************************************/ -void -AdDisassemblerHeader ( +static ACPI_STATUS +AdDisassembleOneTable ( + ACPI_TABLE_HEADER *Table, + FILE *File, char *Filename, - UINT8 TableType) + char *DisasmFilename) { - time_t Timer; - - - time (&Timer); + ACPI_STATUS Status; + ACPI_OWNER_ID OwnerId; - /* Header and input table info */ - AcpiOsPrintf ("/*\n"); - AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * ")); + /* ForceAmlDisassembly means to assume the table contains valid AML */ - if (TableType == ACPI_IS_AML_TABLE) + if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table)) { - if (AcpiGbl_CstyleDisassembly) - { - AcpiOsPrintf ( - " * Disassembling to symbolic ASL+ operators\n" - " *\n"); - } - else - { - AcpiOsPrintf ( - " * Disassembling to non-symbolic legacy ASL operators\n" - " *\n"); - } - } + AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE); - AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer)); - AcpiOsPrintf (" *\n"); -} + /* This is a "Data Table" (non-AML table) */ + AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n", + Table->Signature); + AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] " + "FieldName : FieldValue\n */\n\n"); -/****************************************************************************** - * - * FUNCTION: AdCreateTableHeader - * - * PARAMETERS: Filename - Input file for the table - * Table - Pointer to the raw table - * - * RETURN: None - * - * DESCRIPTION: Create the ASL table header, including ACPICA signon with - * current time and date. - * - *****************************************************************************/ + AcpiDmDumpDataTable (Table); + fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", + Table->Signature); -static void -AdCreateTableHeader ( - char *Filename, - ACPI_TABLE_HEADER *Table) -{ - char *NewFilename; - UINT8 Checksum; + if (File) + { + fprintf (stderr, "Formatted output: %s - %u bytes\n", + DisasmFilename, CmGetFileSize (File)); + } + return (AE_OK); + } /* - * Print file header and dump original table header + * This is an AML table (DSDT or SSDT). + * Always parse the tables, only option is what to display */ - AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE); - - AcpiOsPrintf (" * Original Table Header:\n"); - AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); - AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); - - /* Print and validate the revision */ + Status = AdParseTable (Table, &OwnerId, TRUE, FALSE); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not parse ACPI tables, %s\n", + AcpiFormatException (Status)); + return (Status); + } - AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision); + /* Debug output, namespace and parse tree */ - switch (Table->Revision) + if (AslCompilerdebug && File) { - case 0: + AcpiOsPrintf ("/**** Before second load\n"); - AcpiOsPrintf (" **** Invalid Revision"); - break; + NsSetupNamespaceListing (File); + NsDisplayNamespace (); - case 1: + AcpiOsPrintf ("*****/\n"); + } - /* Revision of DSDT controls the ACPI integer width */ + /* Load namespace from names created within control methods */ - if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) - { - AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support"); - } - break; + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); - default: + /* + * Cross reference the namespace here, in order to + * generate External() statements + */ + AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); - break; + if (AslCompilerdebug) + { + AcpiDmDumpTree (AcpiGbl_ParseOpRoot); } - AcpiOsPrintf ("\n"); - /* Print and validate the table checksum */ + /* Find possible calls to external control methods */ - AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); + AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot); - Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); - if (Checksum) + /* + * If we found any external control methods, we must reparse + * the entire tree with the new information (namely, the + * number of arguments per method) + */ + if (AcpiDmGetExternalMethodCount ()) { - AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", - (UINT8) (Table->Checksum - Checksum)); + Status = AdReparseOneTable (Table, File, OwnerId); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } - AcpiOsPrintf ("\n"); - AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId); - AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId); - AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); - AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); - AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); - AcpiOsPrintf (" */\n"); + /* + * Now that the namespace is finalized, we can perform namespace + * transforms. + * + * 1) Convert fixed-offset references to resource descriptors + * to symbolic references (Note: modifies namespace) + */ + AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); - /* Create AML output filename based on input filename */ + /* Optional displays */ - if (Filename) - { - NewFilename = FlGenerateFilename (Filename, "aml"); - } - else + if (AcpiGbl_DmOpt_Disasm) { - NewFilename = UtStringCacheCalloc (9); - if (NewFilename) + /* This is the real disassembly */ + + AdDisplayTables (Filename, Table); + + /* Dump hex table if requested (-vt) */ + + AcpiDmDumpDataTable (Table); + + fprintf (stderr, "Disassembly completed\n"); + if (File) { - strncat (NewFilename, Table->Signature, 4); - strcat (NewFilename, ".aml"); + fprintf (stderr, "ASL Output: %s - %u bytes\n", + DisasmFilename, CmGetFileSize (File)); } - } - if (!NewFilename) - { - AcpiOsPrintf (" **** Could not generate AML output filename\n"); - return; + if (Gbl_MapfileFlag) + { + fprintf (stderr, "%14s %s - %u bytes\n", + Gbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription, + Gbl_Files[ASL_FILE_MAP_OUTPUT].Filename, + FlGetFileSize (ASL_FILE_MAP_OUTPUT)); + } } - /* Open the ASL definition block */ - - AcpiOsPrintf ( - "DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n", - NewFilename, Table->Signature, Table->Revision, - Table->OemId, Table->OemTableId, Table->OemRevision); + return (AE_OK); } /****************************************************************************** * - * FUNCTION: AdDisplayTables + * FUNCTION: AdReparseOneTable * - * PARAMETERS: Filename - Input file for the table - * Table - Pointer to the raw table + * PARAMETERS: Table - Raw AML table + * File - Pointer for the input file + * OwnerId - ID for this table * * RETURN: Status * - * DESCRIPTION: Display (disassemble) loaded tables and dump raw tables + * DESCRIPTION: Reparse a table that has already been loaded. Used to + * integrate information about external control methods. + * These methods may have been previously parsed incorrectly. * *****************************************************************************/ -ACPI_STATUS -AdDisplayTables ( - char *Filename, - ACPI_TABLE_HEADER *Table) +static ACPI_STATUS +AdReparseOneTable ( + ACPI_TABLE_HEADER *Table, + FILE *File, + ACPI_OWNER_ID OwnerId) { + ACPI_STATUS Status; - if (!AcpiGbl_ParseOpRoot) - { - return (AE_NOT_EXIST); - } + fprintf (stderr, + "\nFound %u external control methods, " + "reparsing with new information\n", + AcpiDmGetExternalMethodCount ()); - if (!AcpiGbl_DmOpt_Listing) - { - AdCreateTableHeader (Filename, Table); - } + /* Reparse, rebuild namespace */ - AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX); - MpEmitMappingInfo (); + AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); + AcpiGbl_ParseOpRoot = NULL; + AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); + + AcpiGbl_RootNode = NULL; + AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; + AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; + AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; + AcpiGbl_RootNodeStruct.Parent = NULL; + AcpiGbl_RootNodeStruct.Child = NULL; + AcpiGbl_RootNodeStruct.Peer = NULL; + AcpiGbl_RootNodeStruct.Object = NULL; + AcpiGbl_RootNodeStruct.Flags = 0; - if (AcpiGbl_DmOpt_Listing) + Status = AcpiNsRootInitialize (); + if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("\n\nTable Header:\n"); - AcpiUtDebugDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER), - DB_BYTE_DISPLAY, ACPI_UINT32_MAX); - - AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length); - AcpiUtDebugDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)), - Table->Length, DB_BYTE_DISPLAY, ACPI_UINT32_MAX); + return (Status); } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AdStoreTable - * - * PARAMETERS: Table - Table header - * TableIndex - Where the table index is returned - * - * RETURN: Status and table index. - * - * DESCRIPTION: Add an ACPI table to the global table list - * - ******************************************************************************/ + /* New namespace, add the external definitions first */ -static ACPI_STATUS -AdStoreTable ( - ACPI_TABLE_HEADER *Table, - UINT32 *TableIndex) -{ - ACPI_STATUS Status; - ACPI_TABLE_DESC *TableDesc; + AcpiDmAddExternalsToNamespace (); + /* Parse the table again. No need to reload it, however */ - Status = AcpiTbGetNextTableDescriptor (TableIndex, &TableDesc); + Status = AdParseTable (Table, NULL, FALSE, FALSE); if (ACPI_FAILURE (Status)) { + AcpiOsPrintf ("Could not parse ACPI tables, %s\n", + AcpiFormatException (Status)); return (Status); } - /* Initialize added table */ + /* Cross reference the namespace again */ - AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table); - Status = AcpiTbValidateTable (TableDesc); - return (Status); -} + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); + AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); -/****************************************************************************** - * - * FUNCTION: AdGetLocalTables - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Get the ACPI tables from either memory or a file - * - *****************************************************************************/ - -ACPI_STATUS -AdGetLocalTables ( - void) -{ - ACPI_STATUS Status; - ACPI_TABLE_HEADER TableHeader; - ACPI_TABLE_HEADER *NewTable; - UINT32 TableIndex; - + /* Debug output - namespace and parse tree */ - /* Get the DSDT via table override */ - - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (!NewTable) + if (AslCompilerdebug) { - fprintf (stderr, "Could not obtain DSDT\n"); - return (AE_NO_ACPI_TABLES); - } - - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_DSDT, NewTable->OemTableId); - - /* Store DSDT in the Table Manager */ + AcpiOsPrintf ("/**** After second load and resource conversion\n"); + if (File) + { + NsSetupNamespaceListing (File); + NsDisplayNamespace (); + } - Status = AdStoreTable (NewTable, &TableIndex); - if (ACPI_FAILURE (Status)) - { - fprintf (stderr, "Could not store DSDT\n"); - return (AE_NO_ACPI_TABLES); + AcpiOsPrintf ("*****/\n"); + AcpiDmDumpTree (AcpiGbl_ParseOpRoot); } return (AE_OK); @@ -851,134 +548,108 @@ AdGetLocalTables ( /****************************************************************************** * - * FUNCTION: AdParseTable + * FUNCTION: AdDoExternalFileList * - * PARAMETERS: Table - Pointer to the raw table - * OwnerId - Returned OwnerId of the table - * LoadTable - If add table to the global table list - * External - If this is an external table + * PARAMETERS: Filename - Input file for the table * * RETURN: Status * - * DESCRIPTION: Parse the DSDT. + * DESCRIPTION: Process all tables found in the -e external files list * *****************************************************************************/ -ACPI_STATUS -AdParseTable ( - ACPI_TABLE_HEADER *Table, - ACPI_OWNER_ID *OwnerId, - BOOLEAN LoadTable, - BOOLEAN External) +static ACPI_STATUS +AdDoExternalFileList ( + char *Filename) { - ACPI_STATUS Status = AE_OK; - ACPI_WALK_STATE *WalkState; - UINT8 *AmlStart; - UINT32 AmlLength; - UINT32 TableIndex; - - - if (!Table) - { - return (AE_NOT_EXIST); - } - - /* Pass 1: Parse everything except control method bodies */ - - fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature); - - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); - AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)); - - /* Create the root object */ - - AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart); - if (!AcpiGbl_ParseOpRoot) - { - return (AE_NO_MEMORY); - } - - /* Create and initialize a new walk state */ + ACPI_EXTERNAL_FILE *ExternalFileList; + char *ExternalFilename; + ACPI_NEW_TABLE_DESC *ExternalListHead = NULL; + ACPI_STATUS Status; + ACPI_STATUS GlobalStatus = AE_OK; + ACPI_OWNER_ID OwnerId; - WalkState = AcpiDsCreateWalkState (0, - AcpiGbl_ParseOpRoot, NULL, NULL); - if (!WalkState) - { - return (AE_NO_MEMORY); - } - Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot, - NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } + /* + * External filenames are specified on the command line like this: + * Example: iasl -e file1,file2,file3 -d xxx.aml + */ + ExternalFileList = AcpiGbl_ExternalFileList; - WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; - WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; + /* Process each external file */ - Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE (Status)) + while (ExternalFileList) { - return (Status); - } - - /* If LoadTable is FALSE, we are parsing the last loaded table */ + ExternalFilename = ExternalFileList->Path; + if (!strcmp (ExternalFilename, Filename)) + { + /* Next external file */ - TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1; + ExternalFileList = ExternalFileList->Next; + continue; + } - /* Pass 2 */ + AcpiOsPrintf ("External object resolution file %16s\n", + ExternalFilename); - if (LoadTable) - { - Status = AdStoreTable (Table, &TableIndex); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - Status = AcpiTbAllocateOwnerId (TableIndex); + Status = AcpiAcGetAllTablesFromFile ( + ExternalFilename, ACPI_GET_ONLY_AML_TABLES, &ExternalListHead); if (ACPI_FAILURE (Status)) { + if (Status == AE_TYPE) + { + ExternalFileList = ExternalFileList->Next; + GlobalStatus = AE_TYPE; + Status = AE_OK; + continue; + } + return (Status); } - if (OwnerId) + + /* Load external tables for symbol resolution */ + + while (ExternalListHead) { - Status = AcpiTbGetOwnerId (TableIndex, OwnerId); + Status = AdParseTable ( + ExternalListHead->Table, &OwnerId, TRUE, TRUE); if (ACPI_FAILURE (Status)) { + AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", + AcpiFormatException (Status)); return (Status); } + + /* + * Load namespace from names created within control methods + * Set owner id of nodes in external table + */ + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); + AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); + + ExternalListHead = ExternalListHead->Next; } - } - fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature); + /* Next external file */ - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL); - if (ACPI_FAILURE (Status)) - { - return (Status); + ExternalFileList = ExternalFileList->Next; } - /* No need to parse control methods of external table */ - - if (External) + if (ACPI_FAILURE (GlobalStatus)) { - return (AE_OK); + return (GlobalStatus); } - /* - * Pass 3: Parse control methods and link their parse trees - * into the main parse tree - */ - fprintf (stderr, - "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); - Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); - fprintf (stderr, "\n"); + /* Clear external list generated by Scope in external tables */ - /* Process Resource Templates */ + if (AcpiGbl_ExternalFileList) + { + AcpiDmClearExternalList (); + } - AcpiDmFindResources (AcpiGbl_ParseOpRoot); + /* Load any externals defined in the optional external ref file */ - fprintf (stderr, "Parsing completed\n"); + AcpiDmGetExternalsFromFile (); return (AE_OK); } diff --git a/source/common/adwalk.c b/source/common/adwalk.c index 270367521c19..41499090c97a 100644 --- a/source/common/adwalk.c +++ b/source/common/adwalk.c @@ -135,6 +135,7 @@ AcpiDmDumpTree ( Info.Count = 0; Info.Level = 0; Info.WalkState = NULL; + AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info); AcpiOsPrintf ("*/\n\n"); } @@ -168,6 +169,7 @@ AcpiDmFindOrphanMethods ( Info.Flags = 0; Info.Level = 0; Info.WalkState = NULL; + AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info); } @@ -211,7 +213,8 @@ AcpiDmFinishNamespaceLoad ( return; } - Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState); + Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, + WalkState); if (ACPI_FAILURE (Status)) { return; @@ -220,6 +223,7 @@ AcpiDmFinishNamespaceLoad ( Info.Flags = 0; Info.Level = 0; Info.WalkState = WalkState; + AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp, AcpiDmCommonAscendingOp, &Info); ACPI_FREE (WalkState); @@ -264,7 +268,8 @@ AcpiDmCrossReferenceNamespace ( return; } - Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState); + Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, + WalkState); if (ACPI_FAILURE (Status)) { return; @@ -273,6 +278,7 @@ AcpiDmCrossReferenceNamespace ( Info.Flags = 0; Info.Level = 0; Info.WalkState = WalkState; + AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp, AcpiDmCommonAscendingOp, &Info); ACPI_FREE (WalkState); @@ -317,7 +323,8 @@ AcpiDmConvertResourceIndexes ( return; } - Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState); + Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, + WalkState); if (ACPI_FAILURE (Status)) { return; @@ -326,6 +333,7 @@ AcpiDmConvertResourceIndexes ( Info.Flags = 0; Info.Level = 0; Info.WalkState = WalkState; + AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp, AcpiDmCommonAscendingOp, &Info); ACPI_FREE (WalkState); @@ -396,7 +404,7 @@ AcpiDmDumpDescending ( if (Op->Common.Value.String) { AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String, - NULL, &Path); + NULL, &Path); AcpiOsPrintf ("%s %p", Path, Op->Common.Node); ACPI_FREE (Path); } @@ -655,6 +663,7 @@ AcpiDmLoadDescendingOp ( { NextOp = NextOp->Common.Next; } + Path = NextOp->Common.Value.String; } @@ -666,8 +675,8 @@ AcpiDmLoadDescendingOp ( /* Insert the name into the namespace */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Node); + ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Node); Op->Common.Node = Node; @@ -708,7 +717,8 @@ Exit: { if (Op->Common.Node) { - Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState); + Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, + WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -825,8 +835,8 @@ AcpiDmXrefDescendingOp ( */ Node = NULL; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Node); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Node); if (ACPI_SUCCESS (Status) && (Node->Flags & ANOBJ_IS_EXTERNAL)) { /* Node was created by an External() statement */ @@ -908,7 +918,8 @@ Exit: { if (Op->Common.Node) { - Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState); + Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, + WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -956,7 +967,8 @@ AcpiDmResourceDescendingOp ( if (Op->Common.Node) { - Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState); + Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, + WalkState); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/common/ahuuids.c b/source/common/ahuuids.c index d48ea40e6c57..a264ccb9f45b 100644 --- a/source/common/ahuuids.c +++ b/source/common/ahuuids.c @@ -48,6 +48,7 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("ahuuids") + /* * Table of "known" (ACPI-related) UUIDs */ diff --git a/source/common/dmextern.c b/source/common/dmextern.c index 30beba36d34e..e09550b495f5 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -140,7 +140,6 @@ AcpiDmGetObjectTypeName ( { Type = ACPI_TYPE_DEVICE; } - else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD) { return (""); @@ -410,6 +409,7 @@ AcpiDmGetExternalsFromFile ( { continue; } + if (strcmp (Token, "External")) { continue; @@ -447,6 +447,7 @@ AcpiDmGetExternalsFromFile ( fprintf (stderr, "Invalid argument count (%s)\n", Token); continue; } + if (ArgCount > 7) { fprintf (stderr, "Invalid argument count (%u)\n", ArgCount); @@ -465,7 +466,8 @@ AcpiDmGetExternalsFromFile ( if (!ImportCount) { - fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n", + fprintf (stderr, + "Did not find any external methods in reference file \"%s\"\n", Gbl_ExternalRefFilename); } else @@ -815,7 +817,8 @@ AcpiDmCreateNewExternal ( (Value > 0)) { ACPI_ERROR ((AE_INFO, - "External method arg count mismatch %s: Current %u, attempted %u", + "External method arg count mismatch %s: " + "Current %u, attempted %u", NextExternal->Path, NextExternal->Value, Value)); } @@ -917,9 +920,9 @@ AcpiDmAddExternalsToNamespace ( /* Add the external name (object) into the namespace */ Status = AcpiNsLookup (NULL, External->InternalPath, External->Type, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); + ACPI_IMODE_LOAD_PASS1, + ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &Node); if (ACPI_FAILURE (Status)) { diff --git a/source/common/dmrestag.c b/source/common/dmrestag.c index de81db569646..d05166072929 100644 --- a/source/common/dmrestag.c +++ b/source/common/dmrestag.c @@ -498,9 +498,9 @@ AcpiDmCheckResourceReference ( /* Lookup the buffer in the namespace */ Status = AcpiNsLookup (WalkState->ScopeInfo, - BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, - &BufferNode); + BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, + &BufferNode); if (ACPI_FAILURE (Status)) { return; @@ -621,8 +621,8 @@ AcpiGetTagPathname ( /* Get the individual resource descriptor and validate it */ - Aml = ACPI_CAST_PTR (AML_RESOURCE, - &Op->Named.Data[ResourceNode->Value]); + Aml = ACPI_CAST_PTR ( + AML_RESOURCE, &Op->Named.Data[ResourceNode->Value]); Status = AcpiUtValidateResource (NULL, Aml, &ResourceTableIndex); if (ACPI_FAILURE (Status)) @@ -663,7 +663,7 @@ AcpiGetTagPathname ( } (void) AcpiNsBuildNormalizedPath (BufferNode, Pathname, - RequiredSize, FALSE); + RequiredSize, FALSE); /* * Create the full path to the resource and tag by: remove the buffer name, @@ -742,6 +742,7 @@ AcpiDmUpdateResourceName ( { AcpiGbl_NextResourceId = 0; AcpiGbl_NextPrefix++; + if (AcpiGbl_NextPrefix > ACPI_NUM_RES_PREFIX) { AcpiGbl_NextPrefix = 0; @@ -1028,9 +1029,9 @@ AcpiDmAddResourceToNamespace ( ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Context); Status = AcpiNsLookup (&ScopeInfo, "_TMP", ACPI_TYPE_LOCAL_RESOURCE, - ACPI_IMODE_LOAD_PASS2, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE, - NULL, &Node); + ACPI_IMODE_LOAD_PASS2, + ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE, + NULL, &Node); if (ACPI_FAILURE (Status)) { return (AE_OK); diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 3f9e64dbdca3..b66734c8f232 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -875,6 +875,7 @@ AcpiDmDumpTable ( AcpiOsPrintf ("\n"); LastOutputBlankLine = TRUE; } + ByteLength = sizeof (ACPI_GENERIC_ADDRESS); break; @@ -885,6 +886,7 @@ AcpiDmDumpTable ( AcpiOsPrintf ("\n"); LastOutputBlankLine = TRUE; } + ByteLength = sizeof (ACPI_HEST_NOTIFY); break; @@ -894,6 +896,7 @@ AcpiDmDumpTable ( { LastOutputBlankLine = FALSE; } + ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); break; @@ -1027,6 +1030,7 @@ AcpiDmDumpTable ( } } } + AcpiOsPrintf ("\n"); break; @@ -1050,6 +1054,7 @@ AcpiDmDumpTable ( AcpiDmCheckAscii (Target, RepairedName, 4); AcpiOsPrintf ("\"%.4s\" ", RepairedName); + TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target)); if (TableData) { @@ -1095,6 +1100,7 @@ AcpiDmDumpTable ( AcpiOsPrintf ( " /* Incorrect checksum, should be %2.2X */", Temp8); } + AcpiOsPrintf ("\n"); break; diff --git a/source/common/dmtables.c b/source/common/dmtables.c new file mode 100644 index 000000000000..0313068d2942 --- /dev/null +++ b/source/common/dmtables.c @@ -0,0 +1,499 @@ +/****************************************************************************** + * + * Module Name: dmtables - disassembler ACPI table support + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * 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. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * 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 MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +#include "aslcompiler.h" +#include "acapps.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "actables.h" +#include "acparser.h" + +#include <stdio.h> +#include <time.h> + +#define _COMPONENT ACPI_TOOLS + ACPI_MODULE_NAME ("dmtables") + + +/* Local prototypes */ + +static void +AdCreateTableHeader ( + char *Filename, + ACPI_TABLE_HEADER *Table); + +static ACPI_STATUS +AdStoreTable ( + ACPI_TABLE_HEADER *Table, + UINT32 *TableIndex); + + +extern ACPI_TABLE_DESC LocalTables[1]; +extern ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; + + +/****************************************************************************** + * + * FUNCTION: AdDisassemblerHeader + * + * PARAMETERS: Filename - Input file for the table + * TableType - Either AML or DataTable + * + * RETURN: None + * + * DESCRIPTION: Create the disassembler header, including ACPICA signon with + * current time and date. + * + *****************************************************************************/ + +void +AdDisassemblerHeader ( + char *Filename, + UINT8 TableType) +{ + time_t Timer; + + + time (&Timer); + + /* Header and input table info */ + + AcpiOsPrintf ("/*\n"); + AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * ")); + + if (TableType == ACPI_IS_AML_TABLE) + { + if (AcpiGbl_CstyleDisassembly) + { + AcpiOsPrintf ( + " * Disassembling to symbolic ASL+ operators\n" + " *\n"); + } + else + { + AcpiOsPrintf ( + " * Disassembling to non-symbolic legacy ASL operators\n" + " *\n"); + } + } + + AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer)); + AcpiOsPrintf (" *\n"); +} + + +/****************************************************************************** + * + * FUNCTION: AdCreateTableHeader + * + * PARAMETERS: Filename - Input file for the table + * Table - Pointer to the raw table + * + * RETURN: None + * + * DESCRIPTION: Create the ASL table header, including ACPICA signon with + * current time and date. + * + *****************************************************************************/ + +static void +AdCreateTableHeader ( + char *Filename, + ACPI_TABLE_HEADER *Table) +{ + char *NewFilename; + UINT8 Checksum; + + + /* + * Print file header and dump original table header + */ + AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE); + + AcpiOsPrintf (" * Original Table Header:\n"); + AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); + AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); + + /* Print and validate the revision */ + + AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision); + + switch (Table->Revision) + { + case 0: + + AcpiOsPrintf (" **** Invalid Revision"); + break; + + case 1: + + /* Revision of DSDT controls the ACPI integer width */ + + if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) + { + AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support"); + } + break; + + default: + + break; + } + AcpiOsPrintf ("\n"); + + /* Print and validate the table checksum */ + + AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); + + Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); + if (Checksum) + { + AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", + (UINT8) (Table->Checksum - Checksum)); + } + + AcpiOsPrintf ("\n"); + AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId); + AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId); + AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); + AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); + AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); + AcpiOsPrintf (" */\n"); + + /* Create AML output filename based on input filename */ + + if (Filename) + { + NewFilename = FlGenerateFilename (Filename, "aml"); + } + else + { + NewFilename = UtStringCacheCalloc (9); + if (NewFilename) + { + strncat (NewFilename, Table->Signature, 4); + strcat (NewFilename, ".aml"); + } + } + + if (!NewFilename) + { + AcpiOsPrintf (" **** Could not generate AML output filename\n"); + return; + } + + /* Open the ASL definition block */ + + AcpiOsPrintf ( + "DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n", + NewFilename, Table->Signature, Table->Revision, + Table->OemId, Table->OemTableId, Table->OemRevision); +} + + +/****************************************************************************** + * + * FUNCTION: AdDisplayTables + * + * PARAMETERS: Filename - Input file for the table + * Table - Pointer to the raw table + * + * RETURN: Status + * + * DESCRIPTION: Display (disassemble) loaded tables and dump raw tables + * + *****************************************************************************/ + +ACPI_STATUS +AdDisplayTables ( + char *Filename, + ACPI_TABLE_HEADER *Table) +{ + + + if (!AcpiGbl_ParseOpRoot) + { + return (AE_NOT_EXIST); + } + + if (!AcpiGbl_DmOpt_Listing) + { + AdCreateTableHeader (Filename, Table); + } + + AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX); + MpEmitMappingInfo (); + + if (AcpiGbl_DmOpt_Listing) + { + AcpiOsPrintf ("\n\nTable Header:\n"); + AcpiUtDebugDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER), + DB_BYTE_DISPLAY, ACPI_UINT32_MAX); + + AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length); + AcpiUtDebugDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)), + Table->Length, DB_BYTE_DISPLAY, ACPI_UINT32_MAX); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AdStoreTable + * + * PARAMETERS: Table - Table header + * TableIndex - Where the table index is returned + * + * RETURN: Status and table index. + * + * DESCRIPTION: Add an ACPI table to the global table list + * + ******************************************************************************/ + +static ACPI_STATUS +AdStoreTable ( + ACPI_TABLE_HEADER *Table, + UINT32 *TableIndex) +{ + ACPI_STATUS Status; + ACPI_TABLE_DESC *TableDesc; + + + Status = AcpiTbGetNextTableDescriptor (TableIndex, &TableDesc); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Initialize added table */ + + AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table), + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table); + Status = AcpiTbValidateTable (TableDesc); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AdGetLocalTables + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Get the ACPI tables from either memory or a file + * + *****************************************************************************/ + +ACPI_STATUS +AdGetLocalTables ( + void) +{ + ACPI_STATUS Status; + ACPI_TABLE_HEADER TableHeader; + ACPI_TABLE_HEADER *NewTable; + UINT32 TableIndex; + + + /* Get the DSDT via table override */ + + ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT); + AcpiOsTableOverride (&TableHeader, &NewTable); + if (!NewTable) + { + fprintf (stderr, "Could not obtain DSDT\n"); + return (AE_NO_ACPI_TABLES); + } + + AdWriteTable (NewTable, NewTable->Length, + ACPI_SIG_DSDT, NewTable->OemTableId); + + /* Store DSDT in the Table Manager */ + + Status = AdStoreTable (NewTable, &TableIndex); + if (ACPI_FAILURE (Status)) + { + fprintf (stderr, "Could not store DSDT\n"); + return (AE_NO_ACPI_TABLES); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AdParseTable + * + * PARAMETERS: Table - Pointer to the raw table + * OwnerId - Returned OwnerId of the table + * LoadTable - If add table to the global table list + * External - If this is an external table + * + * RETURN: Status + * + * DESCRIPTION: Parse an ACPI AML table + * + *****************************************************************************/ + +ACPI_STATUS +AdParseTable ( + ACPI_TABLE_HEADER *Table, + ACPI_OWNER_ID *OwnerId, + BOOLEAN LoadTable, + BOOLEAN External) +{ + ACPI_STATUS Status = AE_OK; + ACPI_WALK_STATE *WalkState; + UINT8 *AmlStart; + UINT32 AmlLength; + UINT32 TableIndex; + + + if (!Table) + { + return (AE_NOT_EXIST); + } + + /* Pass 1: Parse everything except control method bodies */ + + fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature); + + AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); + AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)); + + /* Create the root object */ + + AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart); + if (!AcpiGbl_ParseOpRoot) + { + return (AE_NO_MEMORY); + } + + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState (0, AcpiGbl_ParseOpRoot, NULL, NULL); + if (!WalkState) + { + return (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot, + NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; + WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; + + Status = AcpiPsParseAml (WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* If LoadTable is FALSE, we are parsing the last loaded table */ + + TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1; + + /* Pass 2 */ + + if (LoadTable) + { + Status = AdStoreTable (Table, &TableIndex); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + Status = AcpiTbAllocateOwnerId (TableIndex); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (OwnerId) + { + Status = AcpiTbGetOwnerId (TableIndex, OwnerId); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + } + + fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature); + + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* No need to parse control methods of external table */ + + if (External) + { + return (AE_OK); + } + + /* + * Pass 3: Parse control methods and link their parse trees + * into the main parse tree + */ + fprintf (stderr, + "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); + + Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); + fprintf (stderr, "\n"); + + /* Process Resource Templates */ + + AcpiDmFindResources (AcpiGbl_ParseOpRoot); + + fprintf (stderr, "Parsing completed\n"); + return (AE_OK); +} diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index 7ec19bc96026..2ae3ca791bef 100644 --- a/source/common/dmtbdump.c +++ b/source/common/dmtbdump.c @@ -178,6 +178,7 @@ AcpiDmDumpUnicode ( { AcpiOsPrintf ("%c", Buffer[i]); } + AcpiOsPrintf ("\"\n"); return; @@ -222,7 +223,7 @@ AcpiDmDumpRsdp ( /* Validate the first checksum */ Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON), - Rsdp->Checksum); + Rsdp->Checksum); if (Checksum != Rsdp->Checksum) { AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n", @@ -243,7 +244,7 @@ AcpiDmDumpRsdp ( /* Validate the extended checksum over entire RSDP */ Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP), - Rsdp->ExtendedChecksum); + Rsdp->ExtendedChecksum); if (Checksum != Rsdp->ExtendedChecksum) { AcpiOsPrintf ( @@ -361,7 +362,8 @@ AcpiDmDumpFadt ( /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */ - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, + AcpiDmTableInfoFadt1); if (ACPI_FAILURE (Status)) { return; @@ -372,7 +374,8 @@ AcpiDmDumpFadt ( if ((Table->Length > ACPI_FADT_V1_SIZE) && (Table->Length <= ACPI_FADT_V2_SIZE)) { - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, + AcpiDmTableInfoFadt2); if (ACPI_FAILURE (Status)) { return; @@ -383,7 +386,8 @@ AcpiDmDumpFadt ( else if (Table->Length > ACPI_FADT_V2_SIZE) { - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, + AcpiDmTableInfoFadt3); if (ACPI_FAILURE (Status)) { return; @@ -393,7 +397,8 @@ AcpiDmDumpFadt ( if (Table->Length > ACPI_FADT_V3_SIZE) { - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, + AcpiDmTableInfoFadt5); if (ACPI_FAILURE (Status)) { return; @@ -404,7 +409,8 @@ AcpiDmDumpFadt ( if (Table->Length > ACPI_FADT_V3_SIZE) { - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, + AcpiDmTableInfoFadt6); if (ACPI_FAILURE (Status)) { return; @@ -485,7 +491,8 @@ AcpiDmValidateFadtLength ( } AcpiOsPrintf ( - "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n", + "\n// ACPI Warning: FADT revision %X does not match length: " + "found %X expected %X\n", Revision, Length, ExpectedLength); } @@ -527,7 +534,7 @@ AcpiDmDumpAsf ( /* Common subtable header */ Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoAsfHdr); + SubTable->Header.Length, AcpiDmTableInfoAsfHdr); if (ACPI_FAILURE (Status)) { return; @@ -579,12 +586,13 @@ AcpiDmDumpAsf ( default: - AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", SubTable->Header.Type); + AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", + SubTable->Header.Type); return; } Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Header.Length, InfoTable); + SubTable->Header.Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -601,7 +609,7 @@ AcpiDmDumpAsf ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, DataOffset, - DataTable, DataLength, DataInfoTable); + DataTable, DataLength, DataInfoTable); if (ACPI_FAILURE (Status)) { return; @@ -624,9 +632,12 @@ AcpiDmDumpAsf ( AcpiOsPrintf ("%2.2X ", *DataTable); DataTable++; DataOffset++; + if (DataOffset > Table->Length) { - AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure! (ASF! table)\n"); + AcpiOsPrintf ( + "**** ACPI table terminates in the middle of a " + "data structure! (ASF! table)\n"); return; } } @@ -650,7 +661,8 @@ AcpiDmDumpAsf ( } Offset += SubTable->Header.Length; - SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length); + SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, + SubTable->Header.Length); } } @@ -693,7 +705,7 @@ AcpiDmDumpCpep ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoCpep0); + SubTable->Header.Length, AcpiDmTableInfoCpep0); if (ACPI_FAILURE (Status)) { return; @@ -703,7 +715,7 @@ AcpiDmDumpCpep ( Offset += SubTable->Header.Length; SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, - SubTable->Header.Length); + SubTable->Header.Length); } } @@ -747,7 +759,7 @@ AcpiDmDumpCsrt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoCsrt0); + SubTable->Length, AcpiDmTableInfoCsrt0); if (ACPI_FAILURE (Status)) { return; @@ -761,7 +773,7 @@ AcpiDmDumpCsrt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable, - sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1); + sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1); if (ACPI_FAILURE (Status)) { return; @@ -779,7 +791,7 @@ AcpiDmDumpCsrt ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable, - SubSubTable->Length, AcpiDmTableInfoCsrt2); + SubSubTable->Length, AcpiDmTableInfoCsrt2); if (ACPI_FAILURE (Status)) { return; @@ -793,8 +805,8 @@ AcpiDmDumpCsrt ( if (InfoLength) { Status = AcpiDmDumpTable (Length, - Offset + SubOffset + SubSubOffset, Table, - InfoLength, AcpiDmTableInfoCsrt2a); + Offset + SubOffset + SubSubOffset, Table, + InfoLength, AcpiDmTableInfoCsrt2a); if (ACPI_FAILURE (Status)) { return; @@ -806,14 +818,14 @@ AcpiDmDumpCsrt ( SubOffset += SubSubTable->Length; SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable, - SubSubTable->Length); + SubSubTable->Length); } /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable, - SubTable->Length); + SubTable->Length); } } @@ -860,7 +872,7 @@ AcpiDmDumpDbg2 ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoDbg2Device); + SubTable->Length, AcpiDmTableInfoDbg2Device); if (ACPI_FAILURE (Status)) { return; @@ -876,7 +888,7 @@ AcpiDmDumpDbg2 ( Array = (UINT8 *) SubTable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Addr); + SubTable->Length, AcpiDmTableInfoDbg2Addr); if (ACPI_FAILURE (Status)) { return; @@ -893,7 +905,7 @@ AcpiDmDumpDbg2 ( Array = (UINT8 *) SubTable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Size); + SubTable->Length, AcpiDmTableInfoDbg2Size); if (ACPI_FAILURE (Status)) { return; @@ -908,7 +920,7 @@ AcpiDmDumpDbg2 ( Array = (UINT8 *) SubTable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Name); + SubTable->Length, AcpiDmTableInfoDbg2Name); if (ACPI_FAILURE (Status)) { return; @@ -919,8 +931,8 @@ AcpiDmDumpDbg2 ( if (SubTable->OemDataOffset) { Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset, - Table, SubTable->OemDataLength, - AcpiDmTableInfoDbg2OemData); + Table, SubTable->OemDataLength, + AcpiDmTableInfoDbg2OemData); if (ACPI_FAILURE (Status)) { return; @@ -931,7 +943,7 @@ AcpiDmDumpDbg2 ( Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable, - SubTable->Length); + SubTable->Length); } } @@ -981,11 +993,12 @@ AcpiDmDumpDmar ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoDmarHdr); + SubTable->Length, AcpiDmTableInfoDmarHdr); if (ACPI_FAILURE (Status)) { return; } + AcpiOsPrintf ("\n"); switch (SubTable->Type) @@ -1022,12 +1035,13 @@ AcpiDmDumpDmar ( default: - AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", + SubTable->Type); return; } Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1049,7 +1063,7 @@ AcpiDmDumpDmar ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, - ScopeTable->Length, AcpiDmTableInfoDmarScope); + ScopeTable->Length, AcpiDmTableInfoDmarScope); if (ACPI_FAILURE (Status)) { return; @@ -1065,7 +1079,8 @@ AcpiDmDumpDmar ( while (PathOffset < ScopeTable->Length) { - AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path"); + AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, + "PCI Path"); AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]); /* Point to next PCI Path entry */ @@ -1086,7 +1101,8 @@ NextSubtable: /* Point to next subtable */ Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length); + SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, + SubTable->Length); } } @@ -1118,7 +1134,7 @@ AcpiDmDumpDrtm ( /* Main table */ Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, - AcpiDmTableInfoDrtm); + AcpiDmTableInfoDrtm); if (ACPI_FAILURE (Status)) { return; @@ -1133,12 +1149,13 @@ AcpiDmDumpDrtm ( DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset); AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, - DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables), - AcpiDmTableInfoDrtm0); + DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables), + AcpiDmTableInfoDrtm0); if (ACPI_FAILURE (Status)) { return; } + Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables); /* Dump Validated table addresses */ @@ -1148,12 +1165,13 @@ AcpiDmDumpDrtm ( (DrtmVtl->ValidatedTableCount > Count)) { Status = AcpiDmDumpTable (Table->Length, Offset, - ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64), - AcpiDmTableInfoDrtm0a); + ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64), + AcpiDmTableInfoDrtm0a); if (ACPI_FAILURE (Status)) { return; } + Offset += sizeof (UINT64); Count++; } @@ -1163,8 +1181,8 @@ AcpiDmDumpDrtm ( DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset); AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, - DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources), - AcpiDmTableInfoDrtm1); + DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources), + AcpiDmTableInfoDrtm1); if (ACPI_FAILURE (Status)) { return; @@ -1179,9 +1197,8 @@ AcpiDmDumpDrtm ( (DrtmRl->ResourceCount > Count)) { Status = AcpiDmDumpTable (Table->Length, Offset, - ACPI_ADD_PTR (void, Table, Offset), - sizeof (ACPI_DRTM_RESOURCE), - AcpiDmTableInfoDrtm1a); + ACPI_ADD_PTR (void, Table, Offset), + sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a); if (ACPI_FAILURE (Status)) { return; @@ -1196,8 +1213,7 @@ AcpiDmDumpDrtm ( DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset); AcpiOsPrintf ("\n"); (void) AcpiDmDumpTable (Table->Length, Offset, - DrtmDps, sizeof (ACPI_DRTM_DPS_ID), - AcpiDmTableInfoDrtm2); + DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2); } @@ -1239,7 +1255,7 @@ AcpiDmDumpEinj ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); + sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); if (ACPI_FAILURE (Status)) { return; @@ -1249,7 +1265,7 @@ AcpiDmDumpEinj ( Offset += sizeof (ACPI_WHEA_HEADER); SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, - sizeof (ACPI_WHEA_HEADER)); + sizeof (ACPI_WHEA_HEADER)); } } @@ -1292,7 +1308,7 @@ AcpiDmDumpErst ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0); + sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0); if (ACPI_FAILURE (Status)) { return; @@ -1302,7 +1318,7 @@ AcpiDmDumpErst ( Offset += sizeof (ACPI_WHEA_HEADER); SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, - sizeof (ACPI_WHEA_HEADER)); + sizeof (ACPI_WHEA_HEADER)); } } @@ -1342,7 +1358,7 @@ AcpiDmDumpFpdt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoFpdtHdr); + SubTable->Length, AcpiDmTableInfoFpdtHdr); if (ACPI_FAILURE (Status)) { return; @@ -1362,7 +1378,8 @@ AcpiDmDumpFpdt ( default: - AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", + SubTable->Type); /* Attempt to continue */ @@ -1375,7 +1392,7 @@ AcpiDmDumpFpdt ( } Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1385,7 +1402,8 @@ NextSubTable: /* Point to next subtable */ Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length); + SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, + SubTable->Length); } } @@ -1434,7 +1452,7 @@ AcpiDmDumpGtdt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoGtdtHdr); + SubTable->Length, AcpiDmTableInfoGtdtHdr); if (ACPI_FAILURE (Status)) { return; @@ -1447,7 +1465,7 @@ AcpiDmDumpGtdt ( SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, - SubTable))->TimerCount; + SubTable))->TimerCount; InfoTable = AcpiDmTableInfoGtdt0; break; @@ -1463,12 +1481,13 @@ AcpiDmDumpGtdt ( /* Cannot continue on unknown type - no length */ - AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", + SubTable->Type); return; } Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1482,14 +1501,15 @@ AcpiDmDumpGtdt ( if (GtCount) { - GtxTable = ACPI_ADD_PTR (ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength); + GtxTable = ACPI_ADD_PTR ( + ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength); SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); while (GtCount) { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, GtxTable, - sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a); + sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a); if (ACPI_FAILURE (Status)) { return; @@ -1555,7 +1575,7 @@ AcpiDmDumpHest ( InfoTable = AcpiDmTableInfoHest0; SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, - SubTable))->NumHardwareBanks; + SubTable))->NumHardwareBanks; break; case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: @@ -1563,7 +1583,7 @@ AcpiDmDumpHest ( InfoTable = AcpiDmTableInfoHest1; SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED); BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, - SubTable))->NumHardwareBanks; + SubTable))->NumHardwareBanks; break; case ACPI_HEST_TYPE_IA32_NMI: @@ -1600,13 +1620,14 @@ AcpiDmDumpHest ( /* Cannot continue on unknown type - no length */ - AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", + SubTable->Type); return; } AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTableLength, InfoTable); + SubTableLength, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1620,18 +1641,20 @@ AcpiDmDumpHest ( if (BankCount) { - BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength); + BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, + SubTableLength); SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); while (BankCount) { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, BankTable, - sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank); + sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank); if (ACPI_FAILURE (Status)) { return; } + Offset += sizeof (ACPI_HEST_IA_ERROR_BANK); BankTable++; BankCount--; @@ -1690,7 +1713,7 @@ AcpiDmDumpIort ( if (Iort->NodeOffset > Offset) { Status = AcpiDmDumpTable (Table->Length, Offset, Table, - Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad); + Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad); if (ACPI_FAILURE (Status)) { return; @@ -1706,7 +1729,7 @@ AcpiDmDumpIort ( AcpiOsPrintf ("\n"); Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); Status = AcpiDmDumpTable (Table->Length, Offset, - IortNode, Length, AcpiDmTableInfoIortHdr); + IortNode, Length, AcpiDmTableInfoIortHdr); if (ACPI_FAILURE (Status)) { return; @@ -1763,8 +1786,8 @@ AcpiDmDumpIort ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), - Length, InfoTable); + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1785,8 +1808,8 @@ AcpiDmDumpIort ( for (i = 0; i < IortItsGroup->ItsCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), - 4, AcpiDmTableInfoIort0a); + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + 4, AcpiDmTableInfoIort0a); NodeOffset += 4; } } @@ -1799,8 +1822,8 @@ AcpiDmDumpIort ( if (IortNode->Length > NodeOffset) { Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - Table, IortNode->Length - NodeOffset, - AcpiDmTableInfoIort1a); + Table, IortNode->Length - NodeOffset, + AcpiDmTableInfoIort1a); if (ACPI_FAILURE (Status)) { return; @@ -1819,8 +1842,8 @@ AcpiDmDumpIort ( Length = 2 * sizeof (UINT64); NodeOffset = IortSmmu->GlobalInterruptOffset; Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), - Length, AcpiDmTableInfoIort3a); + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, AcpiDmTableInfoIort3a); if (ACPI_FAILURE (Status)) { return; @@ -1830,12 +1853,13 @@ AcpiDmDumpIort ( for (i = 0; i < IortSmmu->ContextInterruptCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), - 8, AcpiDmTableInfoIort3b); + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + 8, AcpiDmTableInfoIort3b); if (ACPI_FAILURE (Status)) { return; } + NodeOffset += 8; } @@ -1843,12 +1867,13 @@ AcpiDmDumpIort ( for (i = 0; i < IortSmmu->PmuInterruptCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), - 8, AcpiDmTableInfoIort3c); + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + 8, AcpiDmTableInfoIort3c); if (ACPI_FAILURE (Status)) { return; } + NodeOffset += 8; } } @@ -1867,12 +1892,13 @@ AcpiDmDumpIort ( AcpiOsPrintf ("\n"); Length = sizeof (ACPI_IORT_ID_MAPPING); Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), - Length, AcpiDmTableInfoIortMap); + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, AcpiDmTableInfoIortMap); if (ACPI_FAILURE (Status)) { return; } + NodeOffset += Length; } @@ -1930,7 +1956,7 @@ AcpiDmDumpIvrs ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoIvrsHdr); + SubTable->Length, AcpiDmTableInfoIvrsHdr); if (ACPI_FAILURE (Status)) { return; @@ -1969,7 +1995,7 @@ AcpiDmDumpIvrs ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1981,7 +2007,7 @@ AcpiDmDumpIvrs ( { EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE); DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable, - sizeof (ACPI_IVRS_HARDWARE)); + sizeof (ACPI_IVRS_HARDWARE)); while (EntryOffset < (Offset + SubTable->Length)) { @@ -2046,7 +2072,7 @@ AcpiDmDumpIvrs ( /* Dump the Device Entry */ Status = AcpiDmDumpTable (Table->Length, EntryOffset, - DeviceEntry, EntryLength, InfoTable); + DeviceEntry, EntryLength, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -2054,7 +2080,7 @@ AcpiDmDumpIvrs ( EntryOffset += EntryLength; DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, - EntryLength); + EntryLength); } } @@ -2102,7 +2128,7 @@ AcpiDmDumpLpit ( /* Common subtable header */ Status = AcpiDmDumpTable (Length, Offset, SubTable, - sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr); + sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr); if (ACPI_FAILURE (Status)) { return; @@ -2120,16 +2146,18 @@ AcpiDmDumpLpit ( /* Cannot continue on unknown type - no length */ - AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", + SubTable->Type); return; } Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTableLength, InfoTable); + SubTableLength, InfoTable); if (ACPI_FAILURE (Status)) { return; } + AcpiOsPrintf ("\n"); /* Point to next subtable */ @@ -2181,7 +2209,7 @@ AcpiDmDumpMadt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoMadtHdr); + SubTable->Length, AcpiDmTableInfoMadtHdr); if (ACPI_FAILURE (Status)) { return; @@ -2271,7 +2299,8 @@ AcpiDmDumpMadt ( default: - AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", + SubTable->Type); /* Attempt to continue */ @@ -2280,11 +2309,12 @@ AcpiDmDumpMadt ( AcpiOsPrintf ("Invalid zero length subtable\n"); return; } + goto NextSubTable; } Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -2294,7 +2324,8 @@ NextSubTable: /* Point to next subtable */ Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length); + SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, + SubTable->Length); } } @@ -2342,7 +2373,7 @@ AcpiDmDumpMcfg ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0); + sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0); if (ACPI_FAILURE (Status)) { return; @@ -2352,7 +2383,7 @@ AcpiDmDumpMcfg ( Offset += sizeof (ACPI_MCFG_ALLOCATION); SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable, - sizeof (ACPI_MCFG_ALLOCATION)); + sizeof (ACPI_MCFG_ALLOCATION)); } } @@ -2402,7 +2433,7 @@ AcpiDmDumpMpst ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0, - sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0); + sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0); if (ACPI_FAILURE (Status)) { return; @@ -2423,7 +2454,7 @@ AcpiDmDumpMpst ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A, - sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A); + sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A); if (ACPI_FAILURE (Status)) { return; @@ -2446,7 +2477,7 @@ AcpiDmDumpMpst ( while (ComponentCount) { Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B, - sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B); + sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B); if (ACPI_FAILURE (Status)) { return; @@ -2471,7 +2502,7 @@ AcpiDmDumpMpst ( AcpiOsPrintf ("\n"); SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1, - sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1); + sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1); if (ACPI_FAILURE (Status)) { return; @@ -2482,13 +2513,14 @@ AcpiDmDumpMpst ( /* Subtable: Memory Power State Characteristics structure(s) */ - SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, sizeof (ACPI_MPST_DATA_HDR)); + SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, + sizeof (ACPI_MPST_DATA_HDR)); while ((Offset < Table->Length) && SubtableCount) { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2, - sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2); + sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2); if (ACPI_FAILURE (Status)) { return; @@ -2539,7 +2571,7 @@ AcpiDmDumpMsct ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0); + sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0); if (ACPI_FAILURE (Status)) { return; @@ -2548,7 +2580,8 @@ AcpiDmDumpMsct ( /* Point to next subtable */ Offset += sizeof (ACPI_MSCT_PROXIMITY); - SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY)); + SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, + sizeof (ACPI_MSCT_PROXIMITY)); } } @@ -2591,7 +2624,7 @@ AcpiDmDumpMtmr ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0); + sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0); if (ACPI_FAILURE (Status)) { return; @@ -2600,7 +2633,8 @@ AcpiDmDumpMtmr ( /* Point to next subtable */ Offset += sizeof (ACPI_MTMR_ENTRY); - SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY)); + SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, + sizeof (ACPI_MTMR_ENTRY)); } } @@ -2650,7 +2684,7 @@ AcpiDmDumpNfit ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoNfitHdr); + SubTable->Length, AcpiDmTableInfoNfitHdr); if (ACPI_FAILURE (Status)) { return; @@ -2703,7 +2737,8 @@ AcpiDmDumpNfit ( break; default: - AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", + SubTable->Type); /* Attempt to continue */ @@ -2717,7 +2752,7 @@ AcpiDmDumpNfit ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -2732,8 +2767,8 @@ AcpiDmDumpNfit ( for (i = 0; i < Interleave->LineCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, - &Interleave->LineOffset[i], - sizeof (UINT32), AcpiDmTableInfoNfit2a); + &Interleave->LineOffset[i], + sizeof (UINT32), AcpiDmTableInfoNfit2a); if (ACPI_FAILURE (Status)) { return; @@ -2745,13 +2780,15 @@ AcpiDmDumpNfit ( case ACPI_NFIT_TYPE_SMBIOS: - Length = SubTable->Length - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8); + Length = SubTable->Length - + sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8); + if (Length) { Status = AcpiDmDumpTable (Table->Length, - sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8), - SmbiosInfo, - Length, AcpiDmTableInfoNfit3a); + sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8), + SmbiosInfo, + Length, AcpiDmTableInfoNfit3a); if (ACPI_FAILURE (Status)) { return; @@ -2765,8 +2802,8 @@ AcpiDmDumpNfit ( for (i = 0; i < Hint->HintCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, - &Hint->HintAddress[i], - sizeof (UINT64), AcpiDmTableInfoNfit6a); + &Hint->HintAddress[i], + sizeof (UINT64), AcpiDmTableInfoNfit6a); if (ACPI_FAILURE (Status)) { return; @@ -2830,7 +2867,7 @@ AcpiDmDumpPcct ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoPcctHdr); + SubTable->Header.Length, AcpiDmTableInfoPcctHdr); if (ACPI_FAILURE (Status)) { return; @@ -2858,7 +2895,7 @@ AcpiDmDumpPcct ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, InfoTable); + SubTable->Header.Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -2868,7 +2905,7 @@ AcpiDmDumpPcct ( Offset += SubTable->Header.Length; SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable, - SubTable->Header.Length); + SubTable->Header.Length); } } @@ -2920,7 +2957,7 @@ AcpiDmDumpPmtt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoPmttHdr); + SubTable->Length, AcpiDmTableInfoPmttHdr); if (ACPI_FAILURE (Status)) { return; @@ -2939,7 +2976,7 @@ AcpiDmDumpPmtt ( /* Dump the fixed-length portion of the subtable */ Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoPmtt0); + SubTable->Length, AcpiDmTableInfoPmtt0); if (ACPI_FAILURE (Status)) { return; @@ -2958,8 +2995,8 @@ AcpiDmDumpPmtt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, - Offset + MemOffset, MemSubTable, - MemSubTable->Length, AcpiDmTableInfoPmttHdr); + Offset + MemOffset, MemSubTable, + MemSubTable->Length, AcpiDmTableInfoPmttHdr); if (ACPI_FAILURE (Status)) { return; @@ -2978,8 +3015,8 @@ AcpiDmDumpPmtt ( /* Dump the fixed-length portion of the controller subtable */ Status = AcpiDmDumpTable (Length, - Offset + MemOffset, MemSubTable, - MemSubTable->Length, AcpiDmTableInfoPmtt1); + Offset + MemOffset, MemSubTable, + MemSubTable->Length, AcpiDmTableInfoPmtt1); if (ACPI_FAILURE (Status)) { return; @@ -2997,8 +3034,8 @@ AcpiDmDumpPmtt ( DomainCount) { Status = AcpiDmDumpTable (Length, - Offset + MemOffset + DomainOffset, DomainArray, - sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a); + Offset + MemOffset + DomainOffset, DomainArray, + sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a); if (ACPI_FAILURE (Status)) { return; @@ -3028,8 +3065,8 @@ AcpiDmDumpPmtt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, - Offset + MemOffset + DimmOffset, DimmSubTable, - DimmSubTable->Length, AcpiDmTableInfoPmttHdr); + Offset + MemOffset + DimmOffset, DimmSubTable, + DimmSubTable->Length, AcpiDmTableInfoPmttHdr); if (ACPI_FAILURE (Status)) { return; @@ -3048,8 +3085,8 @@ AcpiDmDumpPmtt ( /* Dump the fixed-length DIMM subtable */ Status = AcpiDmDumpTable (Length, - Offset + MemOffset + DimmOffset, DimmSubTable, - DimmSubTable->Length, AcpiDmTableInfoPmtt2); + Offset + MemOffset + DimmOffset, DimmSubTable, + DimmSubTable->Length, AcpiDmTableInfoPmtt2); if (ACPI_FAILURE (Status)) { return; @@ -3116,7 +3153,7 @@ AcpiDmDumpS3pt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoS3ptHdr); + SubTable->Length, AcpiDmTableInfoS3ptHdr); if (ACPI_FAILURE (Status)) { return 0; @@ -3136,7 +3173,8 @@ AcpiDmDumpS3pt ( default: - AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", + SubTable->Type); /* Attempt to continue */ @@ -3150,7 +3188,7 @@ AcpiDmDumpS3pt ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, - SubTable->Length, InfoTable); + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return 0; @@ -3183,8 +3221,9 @@ void AcpiDmDumpSlic ( ACPI_TABLE_HEADER *Table) { + (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table, - Table->Length - sizeof (*Table), AcpiDmTableInfoSlic); + Table->Length - sizeof (*Table), AcpiDmTableInfoSlic); } @@ -3237,7 +3276,8 @@ AcpiDmDumpSlit ( if (Offset >= Table->Length) { - AcpiOsPrintf ("\n**** Not enough room in table for all localities\n"); + AcpiOsPrintf ( + "\n**** Not enough room in table for all localities\n"); return; } @@ -3305,7 +3345,7 @@ AcpiDmDumpSrat ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoSratHdr); + SubTable->Length, AcpiDmTableInfoSratHdr); if (ACPI_FAILURE (Status)) { return; @@ -3334,7 +3374,8 @@ AcpiDmDumpSrat ( break; default: - AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", + SubTable->Type); /* Attempt to continue */ @@ -3348,7 +3389,7 @@ AcpiDmDumpSrat ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -3358,7 +3399,8 @@ NextSubTable: /* Point to next subtable */ Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length); + SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, + SubTable->Length); } } @@ -3522,7 +3564,7 @@ AcpiDmDumpVrtc ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0); + sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0); if (ACPI_FAILURE (Status)) { return; @@ -3531,7 +3573,8 @@ AcpiDmDumpVrtc ( /* Point to next subtable */ Offset += sizeof (ACPI_VRTC_ENTRY); - SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY)); + SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, + sizeof (ACPI_VRTC_ENTRY)); } } @@ -3574,7 +3617,7 @@ AcpiDmDumpWdat ( AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0); + sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0); if (ACPI_FAILURE (Status)) { return; @@ -3583,10 +3626,12 @@ AcpiDmDumpWdat ( /* Point to next subtable */ Offset += sizeof (ACPI_WDAT_ENTRY); - SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY)); + SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, + sizeof (ACPI_WDAT_ENTRY)); } } + /******************************************************************************* * * FUNCTION: AcpiDmDumpWpbt diff --git a/source/common/getopt.c b/source/common/getopt.c index df069728533f..e5b72174c031 100644 --- a/source/common/getopt.c +++ b/source/common/getopt.c @@ -90,6 +90,7 @@ AcpiGetoptArgument ( int argc, char **argv) { + AcpiGbl_Optind--; CurrentCharPtr++; @@ -182,7 +183,8 @@ AcpiGetopt( } else if (++AcpiGbl_Optind >= argc) { - ACPI_OPTION_ERROR ("Option requires an argument: -", CurrentChar); + ACPI_OPTION_ERROR ( + "Option requires an argument: -", CurrentChar); CurrentCharPtr = 1; return ('?'); @@ -243,7 +245,9 @@ AcpiGetopt( } else { - ACPI_OPTION_ERROR ("Option requires a single-character suboption: -", CurrentChar); + ACPI_OPTION_ERROR ( + "Option requires a single-character suboption: -", + CurrentChar); CurrentCharPtr = 1; return ('?'); diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c index 45c4431abb74..fd717639c390 100644 --- a/source/compiler/aslanalyze.c +++ b/source/compiler/aslanalyze.c @@ -139,8 +139,7 @@ AnCheckId ( Length = strlen (Op->Asl.Value.String); if (!Length) { - AslError (ASL_ERROR, ASL_MSG_NULL_STRING, - Op, NULL); + AslError (ASL_ERROR, ASL_MSG_NULL_STRING, Op, NULL); return; } @@ -191,7 +190,7 @@ AnCheckId ( return; } - /* _HID Length is valid (7 or 8), now check the prefix (first 3 or 4 chars) */ + /* _HID Length is valid (7 or 8), now check prefix (first 3 or 4 chars) */ if (Length == 7) { @@ -231,8 +230,8 @@ AnCheckId ( { if (!isxdigit ((int) Op->Asl.Value.String[i])) { - AslError (ASL_ERROR, ASL_MSG_HID_SUFFIX, - Op, &Op->Asl.Value.String[i]); + AslError (ASL_ERROR, ASL_MSG_HID_SUFFIX, + Op, &Op->Asl.Value.String[i]); break; } } @@ -323,7 +322,8 @@ AnCheckMethodReturnValue ( { /* Method SOMETIMES returns a value, SOMETIMES not */ - AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, Op->Asl.ExternalName); + AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, + Op, Op->Asl.ExternalName); } else if (!(ThisNodeBtype & RequiredBtypes)) { @@ -400,12 +400,13 @@ AnIsResultUsed ( { return (TRUE); } + return (FALSE); /* Not used if one of these is the parent */ case PARSEOP_METHOD: - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: case PARSEOP_ELSE: return (FALSE); diff --git a/source/compiler/aslbtypes.c b/source/compiler/aslbtypes.c index 4b6fd4fe57cd..ed546352b4e2 100644 --- a/source/compiler/aslbtypes.c +++ b/source/compiler/aslbtypes.c @@ -78,7 +78,6 @@ AnMapArgTypeToBtype ( switch (ArgType) { - /* Simple types */ case ARGI_ANYTYPE: @@ -221,7 +220,6 @@ AnMapEtypeToBtype ( UINT32 Etype) { - if (Etype == ACPI_TYPE_ANY) { return (ACPI_BTYPE_OBJECTS_AND_REFS); @@ -328,7 +326,6 @@ AnFormatBtype ( *Buffer = 0; - if (Btype == 0) { strcat (Buffer, "NoReturnValue"); @@ -343,6 +340,7 @@ AnFormatBtype ( { strcat (Buffer, "|"); } + First = FALSE; strcat (Buffer, AcpiUtGetTypeName (Type)); } @@ -355,6 +353,7 @@ AnFormatBtype ( { strcat (Buffer, "|"); } + First = FALSE; strcat (Buffer, "Reference"); } @@ -366,6 +365,7 @@ AnFormatBtype ( { strcat (Buffer, "|"); } + First = FALSE; strcat (Buffer, "Resource"); } @@ -409,7 +409,8 @@ AnGetBtype ( if (!Node) { DbgPrint (ASL_DEBUG_OUTPUT, - "No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n", + "No attached Nsnode: [%s] at line %u name [%s], " + "ignoring typecheck\n", Op->Asl.ParseOpName, Op->Asl.LineNumber, Op->Asl.ExternalName); return (ACPI_UINT32_MAX); @@ -457,6 +458,7 @@ AnGetBtype ( return (ThisNodeBtype); } + /******************************************************************************* * * FUNCTION: AnMapObjTypeToBtype diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index dc8b7d51e626..cb3a4a5c7831 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -168,28 +168,28 @@ CgAmlWriteWalk ( } DbgPrint (ASL_TREE_OUTPUT, - "%08X %04X %04X %01X %04X %04X %04X %04X " - "%08X %08X %08X %08X %08X %08X %04X %02d %02d %02d %02d %02d\n", - /* 1 */ (UINT32) Op->Asl.Value.Integer, - /* 2 */ Op->Asl.ParseOpcode, - /* 3 */ Op->Asl.AmlOpcode, - /* 4 */ Op->Asl.AmlOpcodeLength, - /* 5 */ Op->Asl.AmlPkgLenBytes, - /* 6 */ Op->Asl.AmlLength, - /* 7 */ Op->Asl.AmlSubtreeLength, - /* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0, - /* 9 */ Op, - /* 10 */ Op->Asl.Parent, - /* 11 */ Op->Asl.Child, - /* 12 */ Op->Asl.Next, - /* 13 */ Op->Asl.CompileFlags, - /* 14 */ Op->Asl.AcpiBtype, - /* 15 */ Op->Asl.FinalAmlLength, - /* 16 */ Op->Asl.Column, - /* 17 */ Op->Asl.LineNumber, - /* 18 */ Op->Asl.EndLine, - /* 19 */ Op->Asl.LogicalLineNumber, - /* 20 */ Op->Asl.EndLogicalLine); + "%08X %04X %04X %01X %04X %04X %04X %04X " + "%08X %08X %08X %08X %08X %08X %04X %02d %02d %02d %02d %02d\n", + /* 1 */ (UINT32) Op->Asl.Value.Integer, + /* 2 */ Op->Asl.ParseOpcode, + /* 3 */ Op->Asl.AmlOpcode, + /* 4 */ Op->Asl.AmlOpcodeLength, + /* 5 */ Op->Asl.AmlPkgLenBytes, + /* 6 */ Op->Asl.AmlLength, + /* 7 */ Op->Asl.AmlSubtreeLength, + /* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0, + /* 9 */ Op, + /* 10 */ Op->Asl.Parent, + /* 11 */ Op->Asl.Child, + /* 12 */ Op->Asl.Next, + /* 13 */ Op->Asl.CompileFlags, + /* 14 */ Op->Asl.AcpiBtype, + /* 15 */ Op->Asl.FinalAmlLength, + /* 16 */ Op->Asl.Column, + /* 17 */ Op->Asl.LineNumber, + /* 18 */ Op->Asl.EndLine, + /* 19 */ Op->Asl.LogicalLineNumber, + /* 20 */ Op->Asl.EndLogicalLine); /* Generate the AML for this node */ @@ -274,7 +274,8 @@ CgWriteAmlOpcode ( /* These opcodes should not get here */ printf ("Found a node with an unassigned AML opcode\n"); - FlPrintFile (ASL_FILE_STDERR, "Found a node with an unassigned AML opcode\n"); + FlPrintFile (ASL_FILE_STDERR, + "Found a node with an unassigned AML opcode\n"); return; case AML_INT_RESERVEDFIELD_OP: @@ -357,8 +358,10 @@ CgWriteAmlOpcode ( */ PkgLen.Len >>= 4; - /* Now we can write the remaining bytes - either 1, 2, or 3 bytes */ - + /* + * Now we can write the remaining bytes - + * either 1, 2, or 3 bytes + */ for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++) { CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1); @@ -467,50 +470,100 @@ CgWriteTableHeader ( /* Table length. Checksum zero for now, will rewrite later */ - TableHeader.Length = Gbl_TableLength; + TableHeader.Length = sizeof (ACPI_TABLE_HEADER) + + Op->Asl.AmlSubtreeLength; TableHeader.Checksum = 0; + Op->Asl.FinalAmlOffset = ftell (Gbl_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)); } /******************************************************************************* * - * FUNCTION: CgCloseTable + * FUNCTION: CgUpdateHeader * - * PARAMETERS: None. + * PARAMETERS: Op - Op for the Definition Block * * RETURN: None. * * DESCRIPTION: Complete the ACPI table by calculating the checksum and - * re-writing the header. + * re-writing the header for the input definition block * ******************************************************************************/ static void -CgCloseTable ( - void) +CgUpdateHeader ( + ACPI_PARSE_OBJECT *Op) { signed char Sum; + UINT32 i; + UINT32 Length; UINT8 FileByte; + UINT8 Checksum; - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Sum = 0; + /* Calculate the checksum over the entire definition block */ - /* Calculate the checksum over the entire file */ + Sum = 0; + Length = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength; + FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset); - while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) == AE_OK) + for (i = 0; i < Length; i++) { + if (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) != AE_OK) + { + printf ("EOF while reading checksum bytes\n"); + return; + } + Sum = (signed char) (Sum + FileByte); } - /* Re-write the table header with the checksum */ + Checksum = (UINT8) (0 - Sum); + + /* Re-write the the checksum byte */ - TableHeader.Checksum = (UINT8) (0 - Sum); + FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset + + ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum)); - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - CgLocalWriteAmlData (NULL, &TableHeader, sizeof (ACPI_TABLE_HEADER)); + FlWriteFile (ASL_FILE_AML_OUTPUT, &Checksum, 1); +} + + +/******************************************************************************* + * + * FUNCTION: CgCloseTable + * + * PARAMETERS: None. + * + * RETURN: None. + * + * DESCRIPTION: Complete the ACPI table by calculating the checksum and + * re-writing each table header. This allows support for + * multiple definition blocks in a single source file. + * + ******************************************************************************/ + +static void +CgCloseTable ( + void) +{ + ACPI_PARSE_OBJECT *Op; + + + /* Process all definition blocks */ + + Op = RootNode->Asl.Child; + while (Op) + { + CgUpdateHeader (Op); + Op = Op->Asl.Next; + } } @@ -586,7 +639,7 @@ CgWriteNode ( break; - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: CgWriteTableHeader (Op); break; diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index a45814e48f3c..a564f8629c88 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -130,7 +130,8 @@ CmDoCompile ( if (Gbl_SyntaxError) { - fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n"); + fprintf (stderr, + "Compiler aborting due to parser-detected syntax error(s)\n"); LsDumpParseTree (); goto ErrorExit; } @@ -165,7 +166,7 @@ CmDoCompile ( LsDumpParseTree (); - OpcGetIntegerWidth (RootNode); + OpcGetIntegerWidth (RootNode->Asl.Child); UtEndEvent (Event); /* Pre-process parse tree for any operator transforms */ @@ -186,8 +187,8 @@ CmDoCompile ( /* * Now that the input is parsed, we can open the AML output file. - * Note: by default, the name of this file comes from the table descriptor - * within the input file. + * Note: by default, the name of this file comes from the table + * descriptor within the input file. */ Event = UtBeginEvent ("Open AML output file"); Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); @@ -263,7 +264,8 @@ CmDoCompile ( /* Namespace cross-reference */ - AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace"); + AslGbl_NamespaceEvent = UtBeginEvent ( + "Cross reference parse tree and Namespace"); Status = XfCrossReferenceNamespace (); if (ACPI_FAILURE (Status)) { @@ -301,7 +303,8 @@ CmDoCompile ( /* Semantic error checking part three - operand type checking */ Event = UtBeginEvent ("Analyze AML operand types"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n"); + DbgPrint (ASL_DEBUG_OUTPUT, + "\nSemantic analysis - Operand type checking\n\n"); if (Gbl_DoTypechecking) { TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, @@ -590,8 +593,8 @@ CmDumpAllEvents ( { ASL_EVENT_INFO *Event; UINT32 Delta; - UINT32 USec; - UINT32 MSec; + UINT32 MicroSeconds; + UINT32 MilliSeconds; UINT32 i; @@ -611,23 +614,23 @@ CmDumpAllEvents ( Delta = (UINT32) (Event->EndTime - Event->StartTime); - USec = Delta / ACPI_100NSEC_PER_USEC; - MSec = Delta / ACPI_100NSEC_PER_MSEC; + MicroSeconds = Delta / ACPI_100NSEC_PER_USEC; + MilliSeconds = Delta / ACPI_100NSEC_PER_MSEC; /* Round milliseconds up */ - if ((USec - (MSec * ACPI_USEC_PER_MSEC)) >= 500) + if ((MicroSeconds - (MilliSeconds * ACPI_USEC_PER_MSEC)) >= 500) { - MSec++; + MilliSeconds++; } DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", - USec, MSec, Event->EventName); + MicroSeconds, MilliSeconds, Event->EventName); if (Gbl_CompileTimesFlag) { printf ("%8u usec %8u msec - %s\n", - USec, MSec, Event->EventName); + MicroSeconds, MilliSeconds, Event->EventName); } } diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index 37e99ae6eef7..b9796a6c0d49 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -210,7 +210,7 @@ NamePathTail [.]{NameSeg} "Debug" { count (1); return (PARSEOP_DEBUG); } "Decrement" { count (3); return (PARSEOP_DECREMENT); } "Default" { count (3); return (PARSEOP_DEFAULT); } -"DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); } +"DefinitionBlock" { count (1); return (PARSEOP_DEFINITION_BLOCK); } "DeRefOf" { count (3); return (PARSEOP_DEREFOF); } "Device" { count (2); return (PARSEOP_DEVICE); } "Divide" { count (3); return (PARSEOP_DIVIDE); } diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 4f430d11d048..2c0516a56a85 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -267,8 +267,10 @@ AePrintException ( if (!Enode->SourceLine) { - /* Use the merged header/source file if present, otherwise use input file */ - + /* + * Use the merged header/source file if present, otherwise + * use input file + */ SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; if (!SourceFile) { @@ -314,18 +316,18 @@ AePrintException ( fprintf (OutputFile, " %6u: ", Enode->LineNumber); /* - * If not at EOF, get the corresponding source code line and - * display it. Don't attempt this if we have a premature EOF - * condition. + * If not at EOF, get the corresponding source code line + * and display it. Don't attempt this if we have a + * premature EOF condition. */ if (!PrematureEOF) { /* - * Seek to the offset in the combined source file, read - * the source line, and write it to the output. + * Seek to the offset in the combined source file, + * read the source line, and write it to the output. */ - Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, - (int) SEEK_SET); + Actual = fseek (SourceFile, + (long) Enode->LogicalByteOffset, (int) SEEK_SET); if (Actual) { fprintf (OutputFile, @@ -880,16 +882,17 @@ AslCoreSubsystemError ( if (Op) { - AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber, - Op->Asl.LogicalLineNumber, - Op->Asl.LogicalByteOffset, - Op->Asl.Column, - Op->Asl.Filename, MsgBuffer); + AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, + Op->Asl.LineNumber, + Op->Asl.LogicalLineNumber, + Op->Asl.LogicalByteOffset, + Op->Asl.Column, + Op->Asl.Filename, MsgBuffer); } else { - AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0, - 0, 0, 0, NULL, MsgBuffer); + AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, + 0, 0, 0, 0, NULL, MsgBuffer); } if (Abort) diff --git a/source/compiler/aslfileio.c b/source/compiler/aslfileio.c index 4db97a67358a..676eaf16835e 100644 --- a/source/compiler/aslfileio.c +++ b/source/compiler/aslfileio.c @@ -70,6 +70,7 @@ FlFileError ( sprintf (MsgBuffer, "\"%s\" (%s) - %s", Gbl_Files[FileId].Filename, Gbl_Files[FileId].Description, strerror (errno)); + AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer); } @@ -269,7 +270,8 @@ FlPrintFile ( AslAbort (); } - if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag) + if ((FileId == ASL_FILE_PREPROCESSOR) && + Gbl_PreprocessorOutputFlag) { /* * Duplicate the output to the user preprocessor (.i) file, @@ -291,7 +293,6 @@ FlPrintFile ( AslAbort (); } } - } diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 1b738ccf15d8..3ef1be06cb6c 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -56,7 +56,6 @@ FlOpenIncludeWithPrefix ( ACPI_PARSE_OBJECT *Op, char *Filename); - #ifdef ACPI_OBSOLETE_FUNCTIONS ACPI_STATUS FlParseInputPathname ( @@ -262,7 +261,8 @@ FlMergePathnames ( /* Build the final merged pathname */ ConcatenatePaths: - Pathname = UtStringCacheCalloc (strlen (CommonPath) + strlen (FilePathname) + 2); + Pathname = UtStringCacheCalloc ( + strlen (CommonPath) + strlen (FilePathname) + 2); if (LastElement && *CommonPath) { strcpy (Pathname, CommonPath); @@ -422,7 +422,8 @@ FlOpenIncludeFile ( * * Construct the file pathname from the global directory name. */ - IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op, Op->Asl.Value.String); + IncludeFile = FlOpenIncludeWithPrefix ( + Gbl_DirectoryPath, Op, Op->Asl.Value.String); if (IncludeFile) { return; @@ -435,7 +436,8 @@ FlOpenIncludeFile ( NextDir = Gbl_IncludeDirList; while (NextDir) { - IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op, Op->Asl.Value.String); + IncludeFile = FlOpenIncludeWithPrefix ( + NextDir->Dir, Op, Op->Asl.Value.String); if (IncludeFile) { return; diff --git a/source/compiler/aslfold.c b/source/compiler/aslfold.c index 0b3ef8d166a9..276b963a4ba9 100644 --- a/source/compiler/aslfold.c +++ b/source/compiler/aslfold.c @@ -100,7 +100,7 @@ TrInstallReducedConstant ( * * RETURN: Status * - * DESCRIPTION: Reduce an Op and its subtree to a constant if possible + * DESCRIPTION: Reduce an Op and its subtree to a constant if possible. * ******************************************************************************/ @@ -206,7 +206,8 @@ OpcAmlConstantWalk ( * * RETURN: Status * - * DESCRIPTION: Check one Op for a type 3/4/5 AML opcode + * DESCRIPTION: Check one Op for a reducible type 3/4/5 AML opcode. + * This is performed via a downward walk of the parse subtree. * ******************************************************************************/ @@ -218,6 +219,8 @@ OpcAmlCheckForConstant ( { ACPI_WALK_STATE *WalkState = Context; ACPI_STATUS Status = AE_OK; + ACPI_PARSE_OBJECT *NextOp; + const ACPI_OPCODE_INFO *OpInfo; WalkState->Op = Op; @@ -228,21 +231,6 @@ OpcAmlCheckForConstant ( Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName); /* - * TBD: Ignore buffer constants for now. The problem is that these - * constants have been transformed into RAW_DATA at this point, from - * the parse tree transform process which currently happens before - * the constant folding process. We may need to defer this transform - * for buffer until after the constant folding. - */ - if (WalkState->Opcode == AML_BUFFER_OP) - { - DbgPrint (ASL_PARSE_OUTPUT, - "\nBuffer+Buffer->Buffer constant reduction is not supported yet"); - Status = AE_TYPE; - goto CleanupAndExit; - } - - /* * These opcodes do not appear in the OpcodeInfo table, but * they represent constants, so abort the constant walk now. */ @@ -256,11 +244,95 @@ OpcAmlCheckForConstant ( goto CleanupAndExit; } + /* + * Search upwards for a possible Name() operator. This is done + * because a type 3/4/5 opcode within a Name() expression + * MUST be reduced to a simple constant. + */ + NextOp = Op->Asl.Parent; + while (NextOp) + { + /* Finished if we find a Name() opcode */ + + if (NextOp->Asl.AmlOpcode == AML_NAME_OP) + { + break; + } + + /* + * Any "deferred" opcodes contain one or more TermArg parameters, + * and thus are not required to be folded to constants at compile + * time. This affects things like Buffer() and Package() objects. + * We just ignore them here. However, any sub-expressions can and + * will still be typechecked. Note: These are called the + * "deferred" opcodes in the AML interpreter. + */ + OpInfo = AcpiPsGetOpcodeInfo (NextOp->Common.AmlOpcode); + if (OpInfo->Flags & AML_DEFER) + { + NextOp = NULL; + break; + } + + NextOp = NextOp->Asl.Parent; + } + /* Type 3/4/5 opcodes have the AML_CONSTANT flag set */ if (!(WalkState->OpInfo->Flags & AML_CONSTANT)) { - /* Not 3/4/5 opcode, but maybe can convert to STORE */ + /* + * From the ACPI specification: + * + * "The Type 3/4/5 opcodes return a value and can be used in an + * expression that evaluates to a constant. These opcodes may be + * evaluated at ASL compile-time. To ensure that these opcodes + * will evaluate to a constant, the following rules apply: The + * term cannot have a destination (target) operand, and must have + * either a Type3Opcode, Type4Opcode, Type5Opcode, ConstExprTerm, + * Integer, BufferTerm, Package, or String for all arguments." + */ + + /* + * The value (second) operand for the Name() operator MUST + * reduce to a single constant, as per the ACPI specification + * (the operand is a DataObject). This also implies that there + * can be no target operand. Name() is the only ASL operator + * with a "DataObject" as an operand and is thus special- + * cased here. + */ + if (NextOp) /* Inspect a Name() operator */ + { + /* Error if there is a target operand */ + + if (Op->Asl.CompileFlags & NODE_IS_TARGET) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, NULL); + Status = AE_TYPE; + } + + /* Error if expression cannot be reduced (folded) */ + + if (!(NextOp->Asl.CompileFlags & NODE_COULD_NOT_REDUCE)) + { + /* Ensure only one error message per statement */ + + NextOp->Asl.CompileFlags |= NODE_COULD_NOT_REDUCE; + DbgPrint (ASL_PARSE_OUTPUT, + "**** Could not reduce operands for NAME opcode ****\n"); + + AslError (ASL_ERROR, ASL_MSG_CONSTANT_REQUIRED, Op, + "Constant is required for Name operator"); + Status = AE_TYPE; + } + } + + if (ACPI_FAILURE (Status)) + { + goto CleanupAndExit; + } + + /* This is not a 3/4/5 opcode, but maybe can convert to STORE */ if (Op->Asl.CompileFlags & NODE_IS_TARGET) { @@ -272,13 +344,36 @@ OpcAmlCheckForConstant ( /* Expression cannot be reduced */ DbgPrint (ASL_PARSE_OUTPUT, - "**** Not a Type 3/4/5 opcode (%s) ****", + "**** Not a Type 3/4/5 opcode or cannot reduce/fold (%s) ****\n", Op->Asl.ParseOpName); Status = AE_TYPE; goto CleanupAndExit; } + /* + * TBD: Ignore buffer constants for now. The problem is that these + * constants have been transformed into RAW_DATA at this point, from + * the parse tree transform process which currently happens before + * the constant folding process. We may need to defer this transform + * for buffer until after the constant folding. + */ + if (WalkState->Opcode == AML_BUFFER_OP) + { + DbgPrint (ASL_PARSE_OUTPUT, + "\nBuffer constant reduction is not supported yet\n"); + + if (NextOp) /* Found a Name() operator, error */ + { + AslError (ASL_ERROR, ASL_MSG_UNSUPPORTED, Op, + "Buffer expression cannot be reduced"); + } + + Status = AE_TYPE; + goto CleanupAndExit; + } + + /* Debug output */ DbgPrint (ASL_PARSE_OUTPUT, "TYPE_345"); @@ -294,6 +389,7 @@ OpcAmlCheckForConstant ( DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " VALID TARGET"); } } + if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) { DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " TERMARG"); diff --git a/source/compiler/aslhex.c b/source/compiler/aslhex.c index a255daa1ed96..185845c9cad0 100644 --- a/source/compiler/aslhex.c +++ b/source/compiler/aslhex.c @@ -50,7 +50,6 @@ * This module emits ASCII hex output files in either C, ASM, or ASL format */ - /* Local prototypes */ static void @@ -223,6 +222,7 @@ HxDoHexOutputC ( FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset); LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n", HEX_TABLE_LINE_SIZE - LineLength + 1, " "); @@ -310,6 +310,7 @@ HxDoHexOutputAsl ( FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset); LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n", HEX_TABLE_LINE_SIZE - LineLength + 1, " "); @@ -393,6 +394,7 @@ HxDoHexOutputAsm ( FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset); LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); Offset += LineLength; diff --git a/source/compiler/asllength.c b/source/compiler/asllength.c index 8e876c7b6b33..0399124fc611 100644 --- a/source/compiler/asllength.c +++ b/source/compiler/asllength.c @@ -132,10 +132,11 @@ LnPackageLengthWalk ( if ((Op->Asl.Parent) && (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) { - Op->Asl.Parent->Asl.AmlSubtreeLength += (Op->Asl.AmlLength + - Op->Asl.AmlOpcodeLength + - Op->Asl.AmlPkgLenBytes + - Op->Asl.AmlSubtreeLength); + Op->Asl.Parent->Asl.AmlSubtreeLength += ( + Op->Asl.AmlLength + + Op->Asl.AmlOpcodeLength + + Op->Asl.AmlPkgLenBytes + + Op->Asl.AmlSubtreeLength); } return (AE_OK); } @@ -229,7 +230,7 @@ CgGenerateAmlOpcodeLength ( if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) { Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount ( - Op, Op->Asl.AmlSubtreeLength); + Op, Op->Asl.AmlSubtreeLength); } /* Data opcode lengths are easy */ @@ -332,10 +333,9 @@ CgGenerateAmlLengths ( switch (Op->Asl.ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: - Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + - Op->Asl.AmlSubtreeLength; + Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength; break; case PARSEOP_NAMESEG: @@ -365,7 +365,6 @@ CgGenerateAmlLengths ( Op->Asl.ExternalName = Op->Asl.Value.String; Op->Asl.Value.String = Buffer; Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED; - Op->Asl.AmlLength = strlen (Buffer); /* @@ -391,7 +390,7 @@ CgGenerateAmlLengths ( Op->Asl.AmlOpcodeLength = 0; Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, - (UINT32) Op->Asl.Value.Integer); + (UINT32) Op->Asl.Value.Integer); break; case PARSEOP_RAW_DATA: diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c index 34277459844e..91ddcac43a23 100644 --- a/source/compiler/asllisting.c +++ b/source/compiler/asllisting.c @@ -212,6 +212,12 @@ LsAmlListingWalk ( return (AE_OK); } + if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || + (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) + { + return (AE_OK); + } + /* Write the hex bytes to the listing file(s) (if requested) */ for (i = 0; i < Op->Asl.FinalAmlLength; i++) @@ -221,6 +227,7 @@ LsAmlListingWalk ( FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ); AslAbort (); } + LsWriteListingHexBytes (&FileByte, 1, FileId); } @@ -316,7 +323,7 @@ LsWriteNodeToListing ( { switch (Op->Asl.ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: case PARSEOP_METHODCALL: case PARSEOP_INCLUDE: case PARSEOP_INCLUDE_END: @@ -362,36 +369,46 @@ LsWriteNodeToListing ( switch (Op->Asl.ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId); /* Use the table Signature and TableId to build a unique name */ - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) + switch (FileId) { + case ASL_FILE_ASM_SOURCE_OUTPUT: + FlPrintFile (FileId, "%s_%s_Header \\\n", Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { + break; + + case ASL_FILE_C_SOURCE_OUTPUT: + FlPrintFile (FileId, " unsigned char %s_%s_Header [] =\n {\n", Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { + break; + + case ASL_FILE_ASM_INCLUDE_OUTPUT: + FlPrintFile (FileId, "extrn %s_%s_Header : byte\n", Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { + break; + + case ASL_FILE_C_INCLUDE_OUTPUT: + FlPrintFile (FileId, "extern unsigned char %s_%s_Header [];\n", Gbl_TableSignature, Gbl_TableId); + break; + + default: + break; } + return; @@ -540,31 +557,41 @@ LsWriteNodeToListing ( /* Create the appropriate symbol in the output file */ - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) + switch (FileId) { + case ASL_FILE_ASM_SOURCE_OUTPUT: + FlPrintFile (FileId, "%s_%s_%s \\\n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { + break; + + case ASL_FILE_C_SOURCE_OUTPUT: + FlPrintFile (FileId, " unsigned char %s_%s_%s [] =\n {\n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { + break; + + case ASL_FILE_ASM_INCLUDE_OUTPUT: + FlPrintFile (FileId, "extrn %s_%s_%s : byte\n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { + break; + + case ASL_FILE_C_INCLUDE_OUTPUT: + FlPrintFile (FileId, "extern unsigned char %s_%s_%s [];\n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); + break; + + default: + break; } } + ACPI_FREE (Pathname); } break; diff --git a/source/compiler/asllistsup.c b/source/compiler/asllistsup.c index 21ffb74f8d21..c073c1f420f1 100644 --- a/source/compiler/asllistsup.c +++ b/source/compiler/asllistsup.c @@ -88,6 +88,7 @@ LsDumpAscii ( FlPrintFile (FileId, "."); } } + FlPrintFile (FileId, "\""); } @@ -185,7 +186,6 @@ LsCheckException ( (LineNumber >= Gbl_NextError->LogicalLineNumber)) { AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n"); - Gbl_NextError = Gbl_NextError->Next; } @@ -576,6 +576,7 @@ LsFlushListingBuffer ( { FlPrintFile (FileId, ","); } + FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]); } diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index 0f68e0c4f5b0..8da8b806aa92 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -196,12 +196,11 @@ LdLoadFieldElements ( default: Status = AcpiNsLookup (WalkState->ScopeInfo, - Child->Asl.Value.String, - ACPI_TYPE_LOCAL_REGION_FIELD, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND, - NULL, &Node); + Child->Asl.Value.String, + ACPI_TYPE_LOCAL_REGION_FIELD, + ACPI_IMODE_LOAD_PASS1, + ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | + ACPI_NS_ERROR_IF_FOUND, NULL, &Node); if (ACPI_FAILURE (Status)) { if (Status != AE_ALREADY_EXISTS) @@ -266,9 +265,9 @@ LdLoadResourceElements ( * This opens a scope, so later field names are guaranteed to be new/unique. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath, - ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND, - WalkState, &Node); + ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, + ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND, + WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) @@ -296,11 +295,11 @@ LdLoadResourceElements ( if (InitializerOp->Asl.ExternalName) { Status = AcpiNsLookup (WalkState->ScopeInfo, - InitializerOp->Asl.ExternalName, - ACPI_TYPE_LOCAL_RESOURCE_FIELD, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); + InitializerOp->Asl.ExternalName, + ACPI_TYPE_LOCAL_RESOURCE_FIELD, + ACPI_IMODE_LOAD_PASS1, + ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &Node); if (ACPI_FAILURE (Status)) { return (Status); @@ -344,6 +343,7 @@ LdNamespace1Begin ( { ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *MethodOp; ACPI_STATUS Status; ACPI_OBJECT_TYPE ObjectType; ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY; @@ -500,8 +500,8 @@ LdNamespace1Begin ( * handle this case. Perhaps someday this case can go away. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) @@ -509,9 +509,9 @@ LdNamespace1Begin ( /* The name was not found, go ahead and create it */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - ACPI_TYPE_LOCAL_SCOPE, - ACPI_IMODE_LOAD_PASS1, Flags, - WalkState, &(Node)); + ACPI_TYPE_LOCAL_SCOPE, + ACPI_IMODE_LOAD_PASS1, Flags, + WalkState, &(Node)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -534,6 +534,35 @@ LdNamespace1Begin ( return_ACPI_STATUS (Status); } + else /* Status AE_OK */ + { + /* + * Do not allow references to external scopes from the DSDT. + * This is because the DSDT is always loaded first, and the + * external reference cannot be resolved -- causing a runtime + * error because Scope() must be resolved immediately. + * 10/2015. + */ + if ((Node->Flags & ANOBJ_IS_EXTERNAL) && + (ACPI_COMPARE_NAME (Gbl_TableSignature, "DSDT"))) + { + /* However, allowed if the reference is within a method */ + + MethodOp = Op->Asl.Parent; + while (MethodOp && + (MethodOp->Asl.ParseOpcode != PARSEOP_METHOD)) + { + MethodOp = MethodOp->Asl.Parent; + } + + if (!MethodOp) + { + /* Not in a control method, error */ + + AslError (ASL_ERROR, ASL_MSG_CROSS_TABLE_SCOPE, Op, NULL); + } + } + } /* We found a node with this name, now check the type */ @@ -569,7 +598,7 @@ LdNamespace1Begin ( Node->Type = ACPI_TYPE_LOCAL_SCOPE; Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, - WalkState); + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -591,7 +620,7 @@ LdNamespace1Begin ( */ Node->Type = ACPI_TYPE_LOCAL_SCOPE; Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, - WalkState); + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -611,7 +640,7 @@ LdNamespace1Begin ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n", - Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType))); + Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType))); /* The name must not already exist */ @@ -624,7 +653,7 @@ LdNamespace1Begin ( * parse tree later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); + ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) @@ -658,6 +687,17 @@ LdNamespace1Begin ( return_ACPI_STATUS (Status); } } + + Status = AE_OK; + } + else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) + { + /* + * Allow externals in same scope as the definition of the + * actual object. Similar to C. Allows multiple definition + * blocks that refer to each other in the same file. + */ Status = AE_OK; } else @@ -818,8 +858,8 @@ LdNamespace2Begin ( /* Get the NS node associated with the target. It must exist. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &TargetNode); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &TargetNode); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) @@ -832,9 +872,9 @@ LdNamespace2Begin ( * This prevents more errors later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - ACPI_TYPE_ANY, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, - WalkState, &(Node)); + ACPI_TYPE_ANY, + ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, + WalkState, &(Node)); return (AE_OK); } diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index 53382045c420..a69d5c0e41e5 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -479,6 +479,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* HORIZONTALOFFSET */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* PRINTF */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), /* FPRINTF */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), +/* ASLCODE */ OP_TABLE_ENTRY (0, 0, 0, 0) /*! [End] no source code translation !*/ }; diff --git a/source/compiler/aslmapenter.c b/source/compiler/aslmapenter.c index 8ab3e6273241..06a86235fab1 100644 --- a/source/compiler/aslmapenter.c +++ b/source/compiler/aslmapenter.c @@ -239,7 +239,7 @@ MpCreateGpioInfo ( /* Sort on source DeviceName first */ while (NextGpio && - (strcmp (DeviceName, NextGpio->DeviceName) > 0)) + (strcmp (DeviceName, NextGpio->DeviceName) > 0)) { PrevGpio = NextGpio; NextGpio = NextGpio->Next; @@ -248,8 +248,8 @@ MpCreateGpioInfo ( /* Now sort on the PinNumber */ while (NextGpio && - (NextGpio->PinNumber < PinNumber) && - !strcmp (DeviceName, NextGpio->DeviceName)) + (NextGpio->PinNumber < PinNumber) && + !strcmp (DeviceName, NextGpio->DeviceName)) { PrevGpio = NextGpio; NextGpio = NextGpio->Next; diff --git a/source/compiler/aslmapoutput.c b/source/compiler/aslmapoutput.c index 07ed89a1eb59..4d2e0e92f8ad 100644 --- a/source/compiler/aslmapoutput.c +++ b/source/compiler/aslmapoutput.c @@ -453,7 +453,7 @@ MpEmitDeviceTree ( /* Walk the namespace from the root */ (void) AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, MpEmitOneDevice, NULL, NULL, NULL); + ACPI_UINT32_MAX, FALSE, MpEmitOneDevice, NULL, NULL, NULL); } diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index bd693110e0a5..244e72ecb73d 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -238,8 +238,9 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_ILLEGAL_METHOD_REF */ "Illegal reference across two methods", /* ASL_MSG_LOCAL_NOT_USED */ "Method Local is set but never used", /* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used", -/* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used" - +/* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used", +/* ASL_MSG_CONSTANT_REQUIRED */ "Non-reducible expression", +/* ASL_MSG_CROSS_TABLE_SCOPE */ "Illegal open scope on external object from within DSDT" }; /* Table compiler */ diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index d7e3dd06e8b6..440513f9a7e3 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -241,6 +241,8 @@ typedef enum ASL_MSG_LOCAL_NOT_USED, ASL_MSG_ARG_AS_LOCAL_NOT_USED, ASL_MSG_ARG_NOT_USED, + ASL_MSG_CONSTANT_REQUIRED, + ASL_MSG_CROSS_TABLE_SCOPE, /* These messages are used by the Data Table compiler only */ diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c index 40ed971e0712..bf3a683f8d94 100644 --- a/source/compiler/aslmethod.c +++ b/source/compiler/aslmethod.c @@ -101,7 +101,7 @@ MtMethodAnalysisWalkBegin ( /* Create and init method info */ - MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO)); + MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO)); MethodInfo->Next = WalkInfo->MethodStack; MethodInfo->Op = Op; @@ -186,7 +186,9 @@ MtMethodAnalysisWalkBegin ( NextParamType = NextType->Asl.Child; while (NextParamType) { - MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType); + MethodInfo->ValidArgTypes[ActualArgs] |= + AnMapObjTypeToBtype (NextParamType); + NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; NextParamType = NextParamType->Asl.Next; } @@ -195,6 +197,7 @@ MtMethodAnalysisWalkBegin ( { MethodInfo->ValidArgTypes[ActualArgs] = AnMapObjTypeToBtype (NextType); + NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; ActualArgs++; } @@ -251,7 +254,8 @@ MtMethodAnalysisWalkBegin ( * Local was used outside a control method, or there was an error * in the method declaration. */ - AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName); + AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, + Op, Op->Asl.ExternalName); return (AE_ERROR); } @@ -294,7 +298,8 @@ MtMethodAnalysisWalkBegin ( * Arg was used outside a control method, or there was an error * in the method declaration. */ - AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName); + AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, + Op, Op->Asl.ExternalName); return (AE_ERROR); } @@ -317,7 +322,7 @@ MtMethodAnalysisWalkBegin ( * The only operator that accepts an uninitialized value is ObjectType() */ else if ((!MethodInfo->ArgInitialized[RegisterNumber]) && - (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE)) + (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE)) { AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName); } @@ -418,7 +423,8 @@ MtMethodAnalysisWalkBegin ( i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); if (i < ACPI_VALID_RESERVED_NAME_MAX) { - AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName); + AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, + Op, Op->Asl.ExternalName); } break; @@ -495,9 +501,10 @@ MtCheckNamedObjectInMethod ( const ACPI_OPCODE_INFO *OpInfo; - /* We don't care about actual method declarations */ + /* We don't care about actual method declarations or scopes */ - if (Op->Asl.AmlOpcode == AML_METHOD_OP) + if ((Op->Asl.AmlOpcode == AML_METHOD_OP) || + (Op->Asl.AmlOpcode == AML_SCOPE_OP)) { return; } @@ -677,7 +684,8 @@ MtMethodAnalysisWalkEnd ( */ if (Op->Asl.Next) { - AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL); + AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, + Op->Asl.Next, NULL); } break; diff --git a/source/compiler/aslnamesp.c b/source/compiler/aslnamesp.c index e2dea6fff5f6..4be3981da5af 100644 --- a/source/compiler/aslnamesp.c +++ b/source/compiler/aslnamesp.c @@ -124,16 +124,16 @@ NsDisplayNamespace ( /* Walk entire namespace from the root */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL, - NULL, NULL); + ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL, + NULL, NULL); /* Print the full pathname for each namespace node */ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL, - NULL, NULL); + ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL, + NULL, NULL); return (Status); } @@ -168,8 +168,7 @@ NsDoOneNamespaceObject ( FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s", Gbl_NumNamespaceObjects, Level, (Level * 3), " ", - &Node->Name, - AcpiUtGetTypeName (Node->Type)); + &Node->Name, AcpiUtGetTypeName (Node->Type)); Op = Node->Op; ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object); @@ -218,11 +217,13 @@ NsDoOneNamespaceObject ( { Op = Op->Asl.Child; } + if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) { Op = Op->Asl.Next; } + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value 0x%8.8X%8.8X]", ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); @@ -234,11 +235,13 @@ NsDoOneNamespaceObject ( { Op = Op->Asl.Child; } + if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) { Op = Op->Asl.Next; } + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value \"%s\"]", Op->Asl.Value.String); @@ -251,6 +254,7 @@ NsDoOneNamespaceObject ( { Op = Op->Asl.Child; } + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Offset 0x%04X Length 0x%04X bits]", Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer); @@ -303,11 +307,13 @@ NsDoOneNamespaceObject ( { Op = Op->Asl.Child; } + if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) { Op = Op->Asl.Next; } + Op = Op->Asl.Child; if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) || @@ -325,11 +331,13 @@ NsDoOneNamespaceObject ( { Op = Op->Asl.Child; } + if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) { Op = Op->Asl.Next; } + Op = Op->Asl.Child; if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER)) @@ -417,6 +425,5 @@ NsDoOnePathname ( FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer); ACPI_FREE (TargetPath.Pointer); - return (AE_OK); } diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index a7f14de6d3b8..29e9d795c7be 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -260,7 +260,7 @@ OpcSetOptimalIntegerSize ( */ if (Op->Asl.Parent && Op->Asl.Parent->Asl.Parent && - (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) + (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)) { return (0); } @@ -330,11 +330,13 @@ OpcSetOptimalIntegerSize ( Op->Asl.AmlOpcode = AML_BYTE_OP; return (1); } + if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX) { Op->Asl.AmlOpcode = AML_WORD_OP; return (2); } + if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX) { Op->Asl.AmlOpcode = AML_DWORD_OP; @@ -398,6 +400,7 @@ OpcDoAccessAs ( { AttribOp->Asl.Value.Integer = 0; } + AttribOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; AttribOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; @@ -486,21 +489,21 @@ OpcDoConnection ( * First Child -> BufferLength * Second Child -> Descriptor Buffer (raw byte data) */ - BufferOp->Asl.ParseOpcode = PARSEOP_BUFFER; - BufferOp->Asl.AmlOpcode = AML_BUFFER_OP; - BufferOp->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC; + BufferOp->Asl.ParseOpcode = PARSEOP_BUFFER; + BufferOp->Asl.AmlOpcode = AML_BUFFER_OP; + BufferOp->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC; UtSetParseOpName (BufferOp); - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; + BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; BufferLengthOp->Asl.Value.Integer = Rnode->BufferLength; (void) OpcSetOptimalIntegerSize (BufferLengthOp); UtSetParseOpName (BufferLengthOp); - BufferDataOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - BufferDataOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; - BufferDataOp->Asl.AmlOpcodeLength = 0; - BufferDataOp->Asl.AmlLength = Rnode->BufferLength; - BufferDataOp->Asl.Value.Buffer = (UINT8 *) Rnode; + BufferDataOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; + BufferDataOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; + BufferDataOp->Asl.AmlOpcodeLength = 0; + BufferDataOp->Asl.AmlLength = Rnode->BufferLength; + BufferDataOp->Asl.Value.Buffer = (UINT8 *) Rnode; UtSetParseOpName (BufferDataOp); } @@ -564,8 +567,8 @@ OpcDoUnicode ( * Just set the buffer size node to be the buffer length, regardless * of whether it was previously an integer or a default_arg placeholder */ - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; + BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; + BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; BufferLengthOp->Asl.Value.Integer = Length; UtSetParseOpName (BufferLengthOp); @@ -573,11 +576,11 @@ OpcDoUnicode ( /* The Unicode string is a raw data buffer */ - InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString; - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - InitializerOp->Asl.AmlLength = Length; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - InitializerOp->Asl.Child = NULL; + InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString; + InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; + InitializerOp->Asl.AmlLength = Length; + InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; + InitializerOp->Asl.Child = NULL; UtSetParseOpName (InitializerOp); } @@ -1330,9 +1333,9 @@ OpcDoPld ( NewOp = TrAllocateNode (PARSEOP_INTEGER); - NewOp->Asl.AmlOpcode = AML_BYTE_OP; + NewOp->Asl.AmlOpcode = AML_BYTE_OP; NewOp->Asl.Value.Integer = 20; - NewOp->Asl.Parent = Op; + NewOp->Asl.Parent = Op; Op->Asl.Child = NewOp; Op = NewOp; @@ -1340,10 +1343,10 @@ OpcDoPld ( /* Peer to the child is the raw buffer data */ NewOp = TrAllocateNode (PARSEOP_RAW_DATA); - NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - NewOp->Asl.AmlLength = 20; - NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); - NewOp->Asl.Parent = Op->Asl.Parent; + NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; + NewOp->Asl.AmlLength = 20; + NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); + NewOp->Asl.Parent = Op->Asl.Parent; Op->Asl.Next = NewOp; } @@ -1398,9 +1401,9 @@ OpcDoUuId ( NewOp = TrAllocateNode (PARSEOP_INTEGER); - NewOp->Asl.AmlOpcode = AML_BYTE_OP; + NewOp->Asl.AmlOpcode = AML_BYTE_OP; NewOp->Asl.Value.Integer = 16; - NewOp->Asl.Parent = Op; + NewOp->Asl.Parent = Op; Op->Asl.Child = NewOp; Op = NewOp; @@ -1408,10 +1411,10 @@ OpcDoUuId ( /* Peer to the child is the raw buffer data */ NewOp = TrAllocateNode (PARSEOP_RAW_DATA); - NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - NewOp->Asl.AmlLength = 16; - NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); - NewOp->Asl.Parent = Op->Asl.Parent; + NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; + NewOp->Asl.AmlLength = 16; + NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); + NewOp->Asl.Parent = Op->Asl.Parent; Op->Asl.Next = NewOp; } diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c index 913ac90a7abc..cdef7fab53f2 100644 --- a/source/compiler/asloperands.c +++ b/source/compiler/asloperands.c @@ -188,14 +188,16 @@ OpnDoMethod ( { AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); } + Concurrency = (UINT8) Next->Asl.Value.Integer; } /* Put the bits in their proper places */ - MethodFlags = (UINT8) ((NumArgs & 0x7) | - ((Serialized & 0x1) << 3) | - ((Concurrency & 0xF) << 4)); + MethodFlags = (UINT8) + ((NumArgs & 0x7) | + ((Serialized & 0x1) << 3) | + ((Concurrency & 0xF) << 4)); /* Use the last node for the combined flags byte */ @@ -272,9 +274,9 @@ OpnDoFieldCommon ( /* Set the node to RAW_DATA */ Next->Asl.Value.Integer = FieldFlags; - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; + Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; + Next->Asl.AmlLength = 1; + Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; /* Process the FieldUnitList */ @@ -345,8 +347,8 @@ OpnDoFieldCommon ( /* Named or reserved field entry */ - PkgLengthNode = Next->Asl.Child; - NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer; + PkgLengthNode = Next->Asl.Child; + NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer; CurrentBitOffset += NewBitOffset; /* Save the current AccessAs value for error checking later */ @@ -601,9 +603,9 @@ OpnDoBuffer ( { /* For buffers, this is a list of raw bytes */ - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - InitializerOp->Asl.AmlLength = 1; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; + InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; + InitializerOp->Asl.AmlLength = 1; + InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; BufferLength++; InitializerOp = ASL_GET_PEER_NODE (InitializerOp); @@ -618,9 +620,9 @@ OpnDoBuffer ( */ BufferLength = strlen (InitializerOp->Asl.Value.String) + 1; - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - InitializerOp->Asl.AmlLength = BufferLength; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; + InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; + InitializerOp->Asl.AmlLength = BufferLength; + InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; break; case PARSEOP_RAW_DATA: @@ -636,7 +638,7 @@ OpnDoBuffer ( AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp, "Unknown buffer initializer opcode"); printf ("Unknown buffer initializer opcode [%s]\n", - UtGetOpName (InitializerOp->Asl.ParseOpcode)); + UtGetOpName (InitializerOp->Asl.ParseOpcode)); return; } @@ -660,8 +662,8 @@ OpnDoBuffer ( * Just set the buffer size node to be the buffer length, regardless * of whether it was previously an integer or a default_arg placeholder */ - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; + BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; + BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; BufferLengthOp->Asl.Value.Integer = BufferLength; (void) OpcSetOptimalIntegerSize (BufferLengthOp); @@ -839,9 +841,9 @@ OpnDoLoadTable ( Next = Next->Asl.Next; if (Next->Asl.ParseOpcode == PARSEOP_ZERO) { - Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; - Next->Asl.Value.String = "\\"; - Next->Asl.AmlLength = 2; + Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; + Next->Asl.Value.String = "\\"; + Next->Asl.AmlLength = 2; OpcGenerateAmlOpcode (Next); } @@ -923,6 +925,7 @@ OpnDoDefinitionBlock ( Gbl_OutputFilenamePrefix = Filename; UtConvertBackslashes (Gbl_OutputFilenamePrefix); } + Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; /* Signature */ @@ -1131,7 +1134,7 @@ OpnGenerateAmlOperands ( switch (Op->Asl.ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: OpnDoDefinitionBlock (Op); break; diff --git a/source/compiler/aslopt.c b/source/compiler/aslopt.c index e41e22f087b0..05af0bef34ed 100644 --- a/source/compiler/aslopt.c +++ b/source/compiler/aslopt.c @@ -53,7 +53,7 @@ ACPI_MODULE_NAME ("aslopt") -static UINT32 OptTotal = 0; +static UINT32 OptTotal = 0; /* Local prototypes */ @@ -132,15 +132,15 @@ OptSearchToRoot ( * name in the search path before the one we want, the nodes will * not match, and we cannot use this optimization. */ - Path = &(((char *) TargetPath->Pointer)[TargetPath->Length - - ACPI_NAME_SIZE]), + Path = &(((char *) TargetPath->Pointer)[ + TargetPath->Length - ACPI_NAME_SIZE]), ScopeInfo.Scope.Node = CurrentNode; /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(Node)); + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &(Node)); if (ACPI_FAILURE (Status)) { return (Status); @@ -172,8 +172,8 @@ OptSearchToRoot ( if (strncmp (*NewPath, "_T_", 3)) { - AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op, - *NewPath); + AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, + Op, *NewPath); } return (AE_OK); @@ -292,7 +292,7 @@ OptBuildShortestPath ( /* Determine how many prefix Carats are required */ NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) - - NumCommonSegments; + NumCommonSegments; /* * Construct a new target string @@ -373,8 +373,8 @@ OptBuildShortestPath ( * path that has been created. */ Status = AcpiNsLookup (&ScopeInfo, NewPath, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) { /* Found the namepath, but make sure the node is correct */ @@ -446,7 +446,7 @@ OptOptimizeNameDeclaration ( if (((CurrentNode == AcpiGbl_RootNode) || - (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) && + (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)) && (ACPI_IS_ROOT_PREFIX (AmlNameString[0]))) { /* @@ -458,7 +458,7 @@ OptOptimizeNameDeclaration ( /* Debug output */ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath, - NULL, &NewPathExternal); + NULL, &NewPathExternal); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Externalizing NamePath", @@ -474,8 +474,8 @@ OptOptimizeNameDeclaration ( * We know that we are at the root, so NULL is used for the scope. */ Status = AcpiNsLookup (NULL, *NewPath, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) { /* Found the namepath, but make sure the node is correct */ @@ -633,6 +633,7 @@ OptOptimizeNamePath ( { NextOp = NextOp->Asl.Parent; } + if (NextOp && NextOp->Asl.Node) { CurrentNode = NextOp->Asl.Node; @@ -662,6 +663,7 @@ OptOptimizeNamePath ( ASL_NO_ABORT); return_VOID; } + TargetPath.Length--; /* Subtract one for null terminator */ /* CurrentPath is the path to this scope (where we are in the namespace) */ @@ -674,12 +676,13 @@ OptOptimizeNamePath ( ASL_NO_ABORT); return_VOID; } + CurrentPath.Length--; /* Subtract one for null terminator */ /* Debug output only */ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString, - NULL, &ExternalNameString); + NULL, &ExternalNameString); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Externalizing NamePath", @@ -705,7 +708,7 @@ OptOptimizeNamePath ( * a reference. */ Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode, - TargetNode, AmlNameString, &NewPath); + TargetNode, AmlNameString, &NewPath); if (ACPI_FAILURE (Status)) { /* @@ -713,8 +716,8 @@ OptOptimizeNamePath ( * optimize the namestring with carats (up-arrow) */ Status = OptBuildShortestPath (Op, WalkState, CurrentNode, - TargetNode, &CurrentPath, &TargetPath, - AmlNameStringLength, 1, &NewPath); + TargetNode, &CurrentPath, &TargetPath, + AmlNameStringLength, 1, &NewPath); } } else @@ -726,7 +729,7 @@ OptOptimizeNamePath ( * NameSeg of the NamePath */ Status = OptSearchToRoot (Op, WalkState, CurrentNode, - TargetNode, &TargetPath, &NewPath); + TargetNode, &TargetPath, &NewPath); if (ACPI_FAILURE (Status)) { /* @@ -734,8 +737,8 @@ OptOptimizeNamePath ( * optimize the namestring with carats (up-arrow) */ Status = OptBuildShortestPath (Op, WalkState, CurrentNode, - TargetNode, &CurrentPath, &TargetPath, - AmlNameStringLength, 0, &NewPath); + TargetNode, &CurrentPath, &TargetPath, + AmlNameStringLength, 0, &NewPath); } } diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index ef6ad8b5381c..2473a8d142cb 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -331,7 +331,8 @@ AslDoOptions ( Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]); if (ACPI_FAILURE (Status)) { - printf ("Could not add %s to external list\n", argv[AcpiGbl_Optind]); + printf ("Could not add %s to external list\n", + argv[AcpiGbl_Optind]); return (-1); } diff --git a/source/compiler/aslpredef.c b/source/compiler/aslpredef.c index 268549cfaade..7dd10b5fe60b 100644 --- a/source/compiler/aslpredef.c +++ b/source/compiler/aslpredef.c @@ -259,7 +259,7 @@ ApCheckPredefinedReturnValue ( */ Gbl_AllExceptionsDisabled = TRUE; Index = ApCheckForPredefinedName (MethodInfo->Op, - MethodInfo->Op->Asl.NameSeg); + MethodInfo->Op->Asl.NameSeg); Gbl_AllExceptionsDisabled = FALSE; switch (Index) @@ -571,7 +571,8 @@ ApCheckForSpecialName ( * warning and force the user to manually change the names. So, we * will issue a remark instead. */ - AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName); + AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, + Op, Op->Asl.ExternalName); return (ACPI_COMPILER_RESERVED_NAME); } @@ -580,8 +581,8 @@ ApCheckForSpecialName ( * warning, since the entire namespace starting with an underscore is * reserved by the ACPI spec. */ - AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, - Op->Asl.ExternalName); + AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, + Op, Op->Asl.ExternalName); return (ACPI_NOT_RESERVED_NAME); } diff --git a/source/compiler/aslprepkg.c b/source/compiler/aslprepkg.c index eb621274f620..ff80b57474c6 100644 --- a/source/compiler/aslprepkg.c +++ b/source/compiler/aslprepkg.c @@ -238,6 +238,7 @@ ApCheckPackage ( ApCheckObjectType (Predefined->Info.Name, Op, Package->RetInfo3.TailObjectType, i); } + Op = Op->Asl.Next; } break; diff --git a/source/compiler/aslprune.c b/source/compiler/aslprune.c index 3cf47da4e9f0..a797d2ecc009 100644 --- a/source/compiler/aslprune.c +++ b/source/compiler/aslprune.c @@ -63,6 +63,8 @@ PrPrintObjectAtLevel ( const char *ObjectName); +/* Structure used for the pruning parse tree walk */ + typedef struct acpi_prune_info { UINT32 PruneLevel; diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c index 1b96a362d554..895d69c18fce 100644 --- a/source/compiler/aslresource.c +++ b/source/compiler/aslresource.c @@ -396,6 +396,7 @@ RsGetStringDataLength ( { return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1)); } + InitializerOp = ASL_GET_PEER_NODE (InitializerOp); } @@ -431,7 +432,6 @@ RsAllocateResourceNode ( Rnode->Buffer = UtLocalCalloc (Size); Rnode->BufferLength = Size; - return (Rnode); } @@ -467,7 +467,6 @@ RsCreateResourceField ( Op->Asl.ExternalName = Name; Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; - Op->Asl.Value.Tag.BitOffset = (ByteOffset * 8) + BitOffset; Op->Asl.Value.Tag.BitLength = BitLength; } @@ -888,7 +887,7 @@ RsDoOneResourceDescriptor ( default: printf ("Unknown resource descriptor type [%s]\n", - Info->DescriptorTypeOp->Asl.ParseOpName); + Info->DescriptorTypeOp->Asl.ParseOpName); break; } @@ -904,7 +903,8 @@ RsDoOneResourceDescriptor ( if (Rnode) { Info->DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength; - Info->DescriptorTypeOp->Asl.Extra = ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType; + Info->DescriptorTypeOp->Asl.Extra = + ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType; } return (Rnode); diff --git a/source/compiler/aslrestype1.c b/source/compiler/aslrestype1.c index 92c8730f1e52..3f967ca453c2 100644 --- a/source/compiler/aslrestype1.c +++ b/source/compiler/aslrestype1.c @@ -86,7 +86,6 @@ RsDoEndTagDescriptor ( Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG | ASL_RDESC_END_TAG_SIZE; Descriptor->EndTag.Checksum = 0; - return (Rnode); } @@ -114,8 +113,8 @@ RsDoEndDependentDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT)); Descriptor = Rnode->Buffer; - Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT | - ASL_RDESC_END_DEPEND_SIZE; + Descriptor->EndDpf.DescriptorType = + ACPI_RESOURCE_NAME_END_DEPENDENT | ASL_RDESC_END_DEPEND_SIZE; return (Rnode); } @@ -151,7 +150,7 @@ RsDoMemory24Descriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24)); Descriptor = Rnode->Buffer; - Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24; + Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24; Descriptor->Memory24.ResourceLength = 9; /* Process all child initialization nodes */ @@ -257,7 +256,7 @@ RsDoMemory32Descriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32)); Descriptor = Rnode->Buffer; - Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32; + Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32; Descriptor->Memory32.ResourceLength = 17; /* Process all child initialization nodes */ @@ -360,7 +359,7 @@ RsDoMemory32FixedDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32)); Descriptor = Rnode->Buffer; - Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32; + Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32; Descriptor->FixedMemory32.ResourceLength = 9; /* Process all child initialization nodes */ @@ -448,8 +447,8 @@ RsDoStartDependentDescriptor ( /* Descriptor has priority byte */ - Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | - (ASL_RDESC_ST_DEPEND_SIZE + 0x01); + Descriptor->StartDpf.DescriptorType = + ACPI_RESOURCE_NAME_START_DEPENDENT | (ASL_RDESC_ST_DEPEND_SIZE + 0x01); /* Process all child initialization nodes */ @@ -493,8 +492,8 @@ RsDoStartDependentDescriptor ( * must keep track of the offset of not only each descriptor, but each * element (field) within each descriptor as well. */ - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, - NextRnode); + CurrentByteOffset += RsLinkDescriptorChain ( + &PreviousRnode, NextRnode); break; } @@ -536,8 +535,8 @@ RsDoStartDependentNoPriDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)); Descriptor = Rnode->Buffer; - Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT | - ASL_RDESC_ST_DEPEND_SIZE; + Descriptor->StartDpf.DescriptorType = + ACPI_RESOURCE_NAME_START_DEPENDENT | ASL_RDESC_ST_DEPEND_SIZE; PreviousRnode = Rnode; /* Increment offset past StartDependentNoPri descriptor */ @@ -599,7 +598,7 @@ RsDoVendorSmallDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7); Descriptor = Rnode->Buffer; - Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL; + Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL; VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER); /* Process all child initialization nodes */ diff --git a/source/compiler/aslrestype1i.c b/source/compiler/aslrestype1i.c index 7acdbbce1bec..07fc146fc2ff 100644 --- a/source/compiler/aslrestype1i.c +++ b/source/compiler/aslrestype1i.c @@ -88,8 +88,8 @@ RsDoDmaDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA)); Descriptor = Rnode->Buffer; - Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA | - ASL_RDESC_DMA_SIZE; + Descriptor->Dma.DescriptorType = + ACPI_RESOURCE_NAME_DMA | ASL_RDESC_DMA_SIZE; /* Process all child initialization nodes */ @@ -282,8 +282,8 @@ RsDoFixedIoDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO)); Descriptor = Rnode->Buffer; - Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO | - ASL_RDESC_FIXED_IO_SIZE; + Descriptor->Io.DescriptorType = + ACPI_RESOURCE_NAME_FIXED_IO | ASL_RDESC_FIXED_IO_SIZE; /* Process all child initialization nodes */ @@ -365,8 +365,8 @@ RsDoIoDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO)); Descriptor = Rnode->Buffer; - Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO | - ASL_RDESC_IO_SIZE; + Descriptor->Io.DescriptorType = + ACPI_RESOURCE_NAME_IO | ASL_RDESC_IO_SIZE; /* Process all child initialization nodes */ @@ -476,8 +476,8 @@ RsDoIrqDescriptor ( /* Length = 3 (with flag byte) */ Descriptor = Rnode->Buffer; - Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ | - (ASL_RDESC_IRQ_SIZE + 0x01); + Descriptor->Irq.DescriptorType = + ACPI_RESOURCE_NAME_IRQ | (ASL_RDESC_IRQ_SIZE + 0x01); /* Process all child initialization nodes */ @@ -596,8 +596,8 @@ RsDoIrqNoFlagsDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS)); Descriptor = Rnode->Buffer; - Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ | - ASL_RDESC_IRQ_SIZE; + Descriptor->Irq.DescriptorType = + ACPI_RESOURCE_NAME_IRQ | ASL_RDESC_IRQ_SIZE; /* Process all child initialization nodes */ diff --git a/source/compiler/aslrestype2.c b/source/compiler/aslrestype2.c index 45bbe232587e..4a017956dd0a 100644 --- a/source/compiler/aslrestype2.c +++ b/source/compiler/aslrestype2.c @@ -147,6 +147,7 @@ RsDoGeneralRegisterDescriptor ( InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } + return (Rnode); } @@ -213,7 +214,7 @@ RsDoInterruptDescriptor ( 1 + OptionIndex + StringLength); Descriptor = Rnode->Buffer; - Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ; + Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ; /* * Initial descriptor length -- may be enlarged if there are @@ -223,7 +224,7 @@ RsDoInterruptDescriptor ( Descriptor->ExtendedIrq.InterruptCount = 0; Rover = ACPI_CAST_PTR (AML_RESOURCE, - (&(Descriptor->ExtendedIrq.Interrupts[0]))); + (&(Descriptor->ExtendedIrq.Interrupts[0]))); /* Process all child initialization nodes */ @@ -382,9 +383,10 @@ RsDoInterruptDescriptor ( (Descriptor->ExtendedIrq.ResourceLength + StringLength); } - Rnode->BufferLength = (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) - - ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType)) - + OptionIndex + StringLength; + Rnode->BufferLength = + (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) - + ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType)) + + OptionIndex + StringLength; return (Rnode); } @@ -431,7 +433,7 @@ RsDoVendorLargeDescriptor ( Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_LARGE) + i); Descriptor = Rnode->Buffer; - Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE; + Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE; Descriptor->VendorLarge.ResourceLength = (UINT16) i; /* Point to end-of-descriptor for vendor data */ diff --git a/source/compiler/aslrestype2d.c b/source/compiler/aslrestype2d.c index c814f8c0e697..caca601da96b 100644 --- a/source/compiler/aslrestype2d.c +++ b/source/compiler/aslrestype2d.c @@ -91,11 +91,11 @@ RsDoDwordIoDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); + sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); Descriptor = Rnode->Buffer; Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; - Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; + Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; /* * Initial descriptor length -- may be enlarged if there are @@ -325,7 +325,7 @@ RsDoDwordMemoryDescriptor ( Descriptor = Rnode->Buffer; Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; - Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; + Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; /* * Initial descriptor length -- may be enlarged if there are @@ -556,7 +556,7 @@ RsDoDwordSpaceDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); + sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); Descriptor = Rnode->Buffer; Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32; diff --git a/source/compiler/aslrestype2e.c b/source/compiler/aslrestype2e.c index 07b7255007a0..eec12479ec25 100644 --- a/source/compiler/aslrestype2e.c +++ b/source/compiler/aslrestype2e.c @@ -87,14 +87,14 @@ RsDoExtendedIoDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); + sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; + Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; + Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; + Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - Descriptor->ExtAddress64.ResourceLength = (UINT16) + Descriptor->ExtAddress64.ResourceLength = (UINT16) (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - sizeof (AML_RESOURCE_LARGE_HEADER)); @@ -263,11 +263,11 @@ RsDoExtendedMemoryDescriptor ( sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; + Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; + Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; + Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - Descriptor->ExtAddress64.ResourceLength = (UINT16) + Descriptor->ExtAddress64.ResourceLength = (UINT16) (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - sizeof (AML_RESOURCE_LARGE_HEADER)); @@ -441,13 +441,13 @@ RsDoExtendedSpaceDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); + sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); Descriptor = Rnode->Buffer; - Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; - Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; + Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64; + Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - Descriptor->ExtAddress64.ResourceLength = (UINT16) + Descriptor->ExtAddress64.ResourceLength = (UINT16) (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - sizeof (AML_RESOURCE_LARGE_HEADER)); diff --git a/source/compiler/aslrestype2q.c b/source/compiler/aslrestype2q.c index 6db381521866..229daae62595 100644 --- a/source/compiler/aslrestype2q.c +++ b/source/compiler/aslrestype2q.c @@ -91,11 +91,11 @@ RsDoQwordIoDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); + sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); Descriptor = Rnode->Buffer; - Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; - Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; + Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; + Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; /* * Initial descriptor length -- may be enlarged if there are @@ -312,11 +312,11 @@ RsDoQwordMemoryDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); + sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); Descriptor = Rnode->Buffer; - Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; - Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; + Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; + Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE; /* * Initial descriptor length -- may be enlarged if there are @@ -541,7 +541,7 @@ RsDoQwordSpaceDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); + sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); Descriptor = Rnode->Buffer; Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64; diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c index 9fe03b7f2ec4..c7d545503a5a 100644 --- a/source/compiler/aslrestype2s.c +++ b/source/compiler/aslrestype2s.c @@ -313,17 +313,19 @@ RsDoGpioIntDescriptor ( /* Allocate the local resource node and initialize */ - Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); Descriptor = Rnode->Buffer; - Descriptor->Gpio.ResourceLength = DescriptorSize; - Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO; - Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION; - Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT; + Descriptor->Gpio.ResourceLength = DescriptorSize; + Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO; + Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION; + Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT; /* Build pointers to optional areas */ - InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO)); + InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, + sizeof (AML_RESOURCE_GPIO)); PinList = InterruptList; ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength); VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); @@ -337,8 +339,10 @@ RsDoGpioIntDescriptor ( ACPI_PTR_DIFF (ResourceSource, Descriptor); DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, IntLen: %.2X\n", - "GpioInt", Descriptor->Gpio.ResourceLength, (UINT16) sizeof (AML_RESOURCE_GPIO), + "%16s - Actual: %.2X, Base: %.2X, ResLen: " + "%.2X, VendLen: %.2X, IntLen: %.2X\n", + "GpioInt", Descriptor->Gpio.ResourceLength, + (UINT16) sizeof (AML_RESOURCE_GPIO), ResSourceLength, VendorLength, InterruptLength); /* Process all child initialization nodes */ @@ -397,7 +401,8 @@ RsDoGpioIntDescriptor ( if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) { - Descriptor->Gpio.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + Descriptor->Gpio.ResSourceIndex = + (UINT8) InitializerOp->Asl.Value.Integer; } break; @@ -422,7 +427,7 @@ RsDoGpioIntDescriptor ( ACPI_PTR_DIFF (VendorData, Descriptor); if (RsGetVendorData (InitializerOp, VendorData, - (CurrentByteOffset + Descriptor->Gpio.VendorOffset))) + (CurrentByteOffset + Descriptor->Gpio.VendorOffset))) { Descriptor->Gpio.VendorLength = VendorLength; } @@ -468,7 +473,8 @@ RsDoGpioIntDescriptor ( InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } - MpSaveGpioInfo (Info->MappingOp, Descriptor, PinCount, PinList, ResourceSource); + MpSaveGpioInfo (Info->MappingOp, Descriptor, + PinCount, PinList, ResourceSource); return (Rnode); } @@ -524,13 +530,14 @@ RsDoGpioIoDescriptor ( /* Allocate the local resource node and initialize */ - Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); Descriptor = Rnode->Buffer; - Descriptor->Gpio.ResourceLength = DescriptorSize; - Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO; - Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION; - Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO; + Descriptor->Gpio.ResourceLength = DescriptorSize; + Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO; + Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION; + Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO; /* Build pointers to optional areas */ @@ -548,8 +555,10 @@ RsDoGpioIoDescriptor ( ACPI_PTR_DIFF (ResourceSource, Descriptor); DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, IntLen: %.2X\n", - "GpioIo", Descriptor->Gpio.ResourceLength, (UINT16) sizeof (AML_RESOURCE_GPIO), + "%16s - Actual: %.2X, Base: %.2X, ResLen: " + "%.2X, VendLen: %.2X, IntLen: %.2X\n", + "GpioIo", Descriptor->Gpio.ResourceLength, + (UINT16) sizeof (AML_RESOURCE_GPIO), ResSourceLength, VendorLength, InterruptLength); /* Process all child initialization nodes */ @@ -632,7 +641,7 @@ RsDoGpioIoDescriptor ( ACPI_PTR_DIFF (VendorData, Descriptor); if (RsGetVendorData (InitializerOp, VendorData, - (CurrentByteOffset + Descriptor->Gpio.VendorOffset))) + (CurrentByteOffset + Descriptor->Gpio.VendorOffset))) { Descriptor->Gpio.VendorLength = VendorLength; } @@ -678,7 +687,8 @@ RsDoGpioIoDescriptor ( InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } - MpSaveGpioInfo (Info->MappingOp, Descriptor, PinCount, PinList, ResourceSource); + MpSaveGpioInfo (Info->MappingOp, Descriptor, + PinCount, PinList, ResourceSource); return (Rnode); } @@ -727,14 +737,15 @@ RsDoI2cSerialBusDescriptor ( /* Allocate the local resource node and initialize */ - Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); Descriptor = Rnode->Buffer; Descriptor->I2cSerialBus.ResourceLength = DescriptorSize; Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; - Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION; + Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION; Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION; - Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE; + Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE; Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength; /* Build pointers to optional areas */ @@ -743,7 +754,8 @@ RsDoI2cSerialBusDescriptor ( ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n", + "%16s - Actual: %.2X, Base: %.2X, ResLen: " + "%.2X, VendLen: %.2X, TypLen: %.2X\n", "I2cSerialBus", Descriptor->I2cSerialBus.ResourceLength, (UINT16) sizeof (AML_RESOURCE_I2C_SERIALBUS), ResSourceLength, VendorLength, Descriptor->I2cSerialBus.TypeDataLength); @@ -797,7 +809,8 @@ RsDoI2cSerialBusDescriptor ( if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) { - Descriptor->I2cSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + Descriptor->I2cSerialBus.ResSourceIndex = + (UINT8) InitializerOp->Asl.Value.Integer; } break; @@ -874,23 +887,26 @@ RsDoSpiSerialBusDescriptor ( /* Allocate the local resource node and initialize */ - Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); Descriptor = Rnode->Buffer; Descriptor->SpiSerialBus.ResourceLength = DescriptorSize; Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; - Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION; + Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION; Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION; - Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE; + Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE; Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength; /* Build pointers to optional areas */ - VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_SPI_SERIALBUS)); + VendorData = ACPI_ADD_PTR (UINT8, Descriptor, + sizeof (AML_RESOURCE_SPI_SERIALBUS)); ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n", + "%16s - Actual: %.2X, Base: %.2X, ResLen: " + "%.2X, VendLen: %.2X, TypLen: %.2X\n", "SpiSerialBus", Descriptor->SpiSerialBus.ResourceLength, (UINT16) sizeof (AML_RESOURCE_SPI_SERIALBUS), ResSourceLength, VendorLength, Descriptor->SpiSerialBus.TypeDataLength); @@ -972,7 +988,8 @@ RsDoSpiSerialBusDescriptor ( if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) { - Descriptor->SpiSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + Descriptor->SpiSerialBus.ResSourceIndex = + (UINT8) InitializerOp->Asl.Value.Integer; } break; @@ -1049,14 +1066,15 @@ RsDoUartSerialBusDescriptor ( /* Allocate the local resource node and initialize */ - Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); Descriptor = Rnode->Buffer; Descriptor->UartSerialBus.ResourceLength = DescriptorSize; Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; - Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION; + Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION; Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION; - Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE; + Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE; Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength; /* Build pointers to optional areas */ @@ -1065,7 +1083,8 @@ RsDoUartSerialBusDescriptor ( ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n", + "%16s - Actual: %.2X, Base: %.2X, ResLen: " + "%.2X, VendLen: %.2X, TypLen: %.2X\n", "UartSerialBus", Descriptor->UartSerialBus.ResourceLength, (UINT16) sizeof (AML_RESOURCE_UART_SERIALBUS), ResSourceLength, VendorLength, Descriptor->UartSerialBus.TypeDataLength); @@ -1154,7 +1173,8 @@ RsDoUartSerialBusDescriptor ( if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) { - Descriptor->UartSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + Descriptor->UartSerialBus.ResSourceIndex = + (UINT8) InitializerOp->Asl.Value.Integer; } break; diff --git a/source/compiler/aslrestype2w.c b/source/compiler/aslrestype2w.c index 3b4cc1038d19..98257ad97523 100644 --- a/source/compiler/aslrestype2w.c +++ b/source/compiler/aslrestype2w.c @@ -91,11 +91,11 @@ RsDoWordIoDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); + sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; - Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; + Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; + Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; /* * Initial descriptor length -- may be enlarged if there are @@ -312,11 +312,11 @@ RsDoWordBusNumberDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); + sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; - Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE; + Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; + Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE; /* * Initial descriptor length -- may be enlarged if there are @@ -517,10 +517,10 @@ RsDoWordSpaceDescriptor ( CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( - sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); + sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); Descriptor = Rnode->Buffer; - Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; + Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16; /* * Initial descriptor length -- may be enlarged if there are diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index cac37c3ddcb0..79accf4dd2e0 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -54,11 +54,12 @@ NoEcho(' * Root term. Allow multiple #line directives before the definition block * to handle output from preprocessors */ -ASLCode - : DefinitionBlockTerm +AslCode + : DefinitionBlockList {$<n>$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_ASL_CODE),1, $1);} | error {YYABORT; $$ = NULL;} ; + /* * Note concerning support for "module-level code". * @@ -75,7 +76,7 @@ ASLCode * of Type1 and Type2 opcodes at module level. */ DefinitionBlockTerm - : PARSEOP_DEFINITIONBLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);} + : PARSEOP_DEFINITION_BLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITION_BLOCK);} String ',' String ',' ByteConst ',' @@ -86,6 +87,12 @@ DefinitionBlockTerm '{' TermList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);} ; +DefinitionBlockList + : DefinitionBlockTerm + | DefinitionBlockTerm + DefinitionBlockList {$$ = TrLinkPeerNodes (2, $1,$2);} + ; + SuperName : NameString {} | ArgTerm {} diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c index 26f607fbbe9c..cd9203346791 100644 --- a/source/compiler/aslstubs.c +++ b/source/compiler/aslstubs.c @@ -270,3 +270,45 @@ AcpiTbFindTable ( { return (AE_SUPPORT); } + +ACPI_STATUS +AcpiNsLoadTable ( + UINT32 TableIndex, + ACPI_NAMESPACE_NODE *Node) +{ + return (AE_NOT_IMPLEMENTED); +} + +ACPI_STATUS +AcpiDsRestartControlMethod ( + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT *ReturnDesc) +{ + return (AE_OK); +} + +void +AcpiDsTerminateControlMethod ( + ACPI_OPERAND_OBJECT *MethodDesc, + ACPI_WALK_STATE *WalkState) +{ + return; +} + +ACPI_STATUS +AcpiDsCallControlMethod ( + ACPI_THREAD_STATE *Thread, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiDsMethodDataInitArgs ( + ACPI_OPERAND_OBJECT **Params, + UINT32 MaxParamCount, + ACPI_WALK_STATE *WalkState) +{ + return (AE_OK); +} diff --git a/source/compiler/asltokens.y b/source/compiler/asltokens.y index d52bb500bff2..17ae28d05a13 100644 --- a/source/compiler/asltokens.y +++ b/source/compiler/asltokens.y @@ -124,7 +124,7 @@ NoEcho(' %token <i> PARSEOP_DECREMENT %token <i> PARSEOP_DEFAULT %token <i> PARSEOP_DEFAULT_ARG -%token <i> PARSEOP_DEFINITIONBLOCK +%token <i> PARSEOP_DEFINITION_BLOCK %token <i> PARSEOP_DEREFOF %token <i> PARSEOP_DEVICE %token <i> PARSEOP_DEVICEPOLARITY_HIGH @@ -464,6 +464,9 @@ NoEcho(' /* PARSEOP_EXP_PAREN_OPEN */ /* PARSEOP_EXP_PAREN_CLOSE */ + +%token <i> PARSEOP_ASL_CODE + /* * Special functions. These should probably stay at the end of this * table. diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c index 709b7b09e68f..b2a0f39b3af3 100644 --- a/source/compiler/asltransform.c +++ b/source/compiler/asltransform.c @@ -111,7 +111,7 @@ TrAmlGetNextTempName ( char *TempName; - if (*TempCount >= (10+26)) /* 0-35 valid: 0-9 and A-Z for TempName[3] */ + if (*TempCount >= (10 + 26)) /* 0-35 valid: 0-9 and A-Z for TempName[3] */ { /* Too many temps */ @@ -129,6 +129,7 @@ TrAmlGetNextTempName ( { TempName[3] = (char) (*TempCount + ('A' - 10)); } + (*TempCount)++; /* First three characters are always "_T_" */ @@ -217,7 +218,7 @@ TrAmlSetSubtreeParent ( while (Next) { Next->Asl.Parent = Parent; - Next = Next->Asl.Next; + Next = Next->Asl.Next; } } @@ -242,7 +243,7 @@ TrAmlInsertPeer ( { NewPeer->Asl.Next = Op->Asl.Next; - Op->Asl.Next = NewPeer; + Op->Asl.Next = NewPeer; } @@ -297,7 +298,7 @@ TrTransformSubtree ( switch (Op->Asl.ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_DEFINITION_BLOCK: TrDoDefinitionBlock (Op); break; @@ -448,7 +449,7 @@ TrDoSwitch ( { /* Add an ELSE to complete the previous CASE */ - NewOp = TrCreateLeafNode (PARSEOP_ELSE); + NewOp = TrCreateLeafNode (PARSEOP_ELSE); NewOp->Asl.Parent = Conditional->Asl.Parent; TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent); @@ -458,9 +459,9 @@ TrDoSwitch ( CurrentParentNode = NewOp; } - CaseOp = Next; + CaseOp = Next; Conditional = CaseOp; - CaseBlock = CaseOp->Asl.Child->Asl.Next; + CaseBlock = CaseOp->Asl.Child->Asl.Next; Conditional->Asl.Child->Asl.Next = NULL; Predicate = CaseOp->Asl.Child; @@ -537,7 +538,7 @@ TrDoSwitch ( * CaseOp->Child->Peer is the beginning of the case block */ NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); + (UINT64) ACPI_TO_INTEGER (PredicateValueName)); NewOp->Asl.Next = Predicate; TrAmlInitLineNumbers (NewOp, Predicate); @@ -600,7 +601,7 @@ TrDoSwitch ( /* Unknown peer opcode */ AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%u)\n", - Next->Asl.ParseOpName, Next->Asl.ParseOpcode); + Next->Asl.ParseOpName, Next->Asl.ParseOpcode); } } @@ -645,7 +646,7 @@ TrDoSwitch ( Next = StartNode; while ((Next->Asl.ParseOpcode != PARSEOP_METHOD) && - (Next->Asl.ParseOpcode != PARSEOP_DEFINITIONBLOCK)) + (Next->Asl.ParseOpcode != PARSEOP_DEFINITION_BLOCK)) { Next = Next->Asl.Parent; } @@ -668,7 +669,8 @@ TrDoSwitch ( */ if (Next->Asl.ParseOpcode != PARSEOP_SERIALIZERULE_SERIAL) { - AslError (ASL_REMARK, ASL_MSG_SERIALIZED, MethodOp, "Due to use of Switch operator"); + AslError (ASL_REMARK, ASL_MSG_SERIALIZED, MethodOp, + "Due to use of Switch operator"); Next->Asl.ParseOpcode = PARSEOP_SERIALIZERULE_SERIAL; } @@ -682,7 +684,7 @@ TrDoSwitch ( /* Create the NameSeg child for the Name node */ NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); + (UINT64) ACPI_TO_INTEGER (PredicateValueName)); TrAmlInitLineNumbers (NewOp2, NewOp); NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION; NewOp->Asl.Child = NewOp2; @@ -694,25 +696,25 @@ TrDoSwitch ( case ACPI_BTYPE_INTEGER: NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO, - (UINT64) 0); + (UINT64) 0); TrAmlInitLineNumbers (NewOp2->Asl.Next, NewOp); break; case ACPI_BTYPE_STRING: NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, - (UINT64) ACPI_TO_INTEGER ("")); + (UINT64) ACPI_TO_INTEGER ("")); TrAmlInitLineNumbers (NewOp2->Asl.Next, NewOp); break; case ACPI_BTYPE_BUFFER: (void) TrLinkPeerNode (NewOp2, TrCreateValuedLeafNode (PARSEOP_BUFFER, - (UINT64) 0)); + (UINT64) 0)); Next = NewOp2->Asl.Next; TrAmlInitLineNumbers (Next, NewOp2); (void) TrLinkChildren (Next, 1, TrCreateValuedLeafNode (PARSEOP_ZERO, - (UINT64) 1)); + (UINT64) 1)); TrAmlInitLineNumbers (Next->Asl.Child, Next); BufferOp = TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (UINT64) 0); @@ -755,7 +757,7 @@ TrDoSwitch ( Predicate->Asl.Parent = StoreOp; NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG, - (UINT64) ACPI_TO_INTEGER (PredicateValueName)); + (UINT64) ACPI_TO_INTEGER (PredicateValueName)); TrAmlInitLineNumbers (NewOp, StoreOp); NewOp->Asl.Parent = StoreOp; Predicate->Asl.Next = NewOp; diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 173886109c1a..0d800654f6ca 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -340,6 +340,11 @@ TrPrintNodeCompileFlags ( FlagName = "NODE_METHOD_TYPED"; break; + case NODE_COULD_NOT_REDUCE: + + FlagName = "NODE_COULD_NOT_REDUCE"; + break; + case NODE_COMPILE_TIME_CONST: FlagName = "NODE_COMPILE_TIME_CONST"; @@ -489,7 +494,7 @@ TrSetEndLineNumber ( return; } - Op->Asl.EndLine = Gbl_CurrentLineNumber; + Op->Asl.EndLine = Gbl_CurrentLineNumber; Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber; } @@ -753,7 +758,8 @@ TrCreateConstantLeafNode ( } DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X \n", + "\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p " + "Op %s Value %8.8X%8.8X \n", Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode), ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); return (Op); @@ -860,7 +866,8 @@ TrCreateValuedLeafNode ( Op = TrAllocateNode (ParseOpcode); DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateValuedLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ", + "\nCreateValuedLeafNode Ln/Col %u/%u NewNode %p " + "Op %s Value %8.8X%8.8X ", Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode), ACPI_FORMAT_UINT64 (Value)); Op->Asl.Value.Integer = Value; @@ -946,15 +953,22 @@ TrCreateNode ( DbgPrint (ASL_PARSE_OUTPUT, "\nCreateNode Ln/Col %u/%u NewParent %p Child %u Op %s ", - Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode)); + Op->Asl.LineNumber, Op->Asl.Column, Op, + NumChildren, UtGetOpName(ParseOpcode)); /* Some extra debug output based on the parse opcode */ switch (ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_ASL_CODE: RootNode = Op; + Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->"); + break; + + case PARSEOP_DEFINITION_BLOCK: + DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->"); break; @@ -1075,9 +1089,15 @@ TrLinkChildren ( switch (Op->Asl.ParseOpcode) { - case PARSEOP_DEFINITIONBLOCK: + case PARSEOP_ASL_CODE: RootNode = Op; + Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->"); + break; + + case PARSEOP_DEFINITION_BLOCK: + DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->"); break; @@ -1155,6 +1175,7 @@ TrLinkChildren ( Child = Child->Asl.Next; Child->Asl.Parent = Op; } + PrevChild = Child; } diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index 6205dbfb7a01..4211767eae2f 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -66,7 +66,7 @@ #define NODE_METHOD_SOME_NO_RETVAL 0x00000200 #define NODE_RESULT_NOT_USED 0x00000400 #define NODE_METHOD_TYPED 0x00000800 -#define NODE_UNUSED_FLAG 0x00001000 +#define NODE_COULD_NOT_REDUCE 0x00001000 #define NODE_COMPILE_TIME_CONST 0x00002000 #define NODE_IS_TERM_ARG 0x00004000 #define NODE_WAS_ONES_OP 0x00008000 diff --git a/source/compiler/asltypes.y b/source/compiler/asltypes.y index 2ed708f13d64..7fa24a87a39a 100644 --- a/source/compiler/asltypes.y +++ b/source/compiler/asltypes.y @@ -51,12 +51,13 @@ NoEcho(' *****************************************************************************/ %type <n> ArgList -%type <n> ASLCode +%type <n> AslCode %type <n> BufferData %type <n> BufferTermData %type <n> CompilerDirective %type <n> DataObject %type <n> DefinitionBlockTerm +%type <n> DefinitionBlockList %type <n> IntegerData %type <n> NamedObject %type <n> NameSpaceModifier diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 9ea4c19c48a0..47851bddad88 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -199,7 +199,6 @@ UtBeginEvent ( AslGbl_Events[AslGbl_NextEvent].StartTime = AcpiOsGetTimer (); AslGbl_Events[AslGbl_NextEvent].EventName = Name; AslGbl_Events[AslGbl_NextEvent].Valid = TRUE; - return (AslGbl_NextEvent++); } @@ -806,6 +805,7 @@ UtPadNameWithUnderscores ( { *PaddedNameSeg = '_'; } + PaddedNameSeg++; } } @@ -1090,7 +1090,7 @@ stroul64 ( /* Check to see if value is out of range: */ if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / - (UINT64) Base)) + (UINT64) Base)) { goto ErrorExit; } diff --git a/source/compiler/asluuid.c b/source/compiler/asluuid.c index 86ca83a7fce7..ebb72c4f5fef 100644 --- a/source/compiler/asluuid.c +++ b/source/compiler/asluuid.c @@ -47,7 +47,7 @@ ACPI_MODULE_NAME ("asluuid") -extern UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH]; +extern UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH]; /******************************************************************************* @@ -90,11 +90,10 @@ AuValidateUuid ( return (AE_BAD_PARAMETER); } } - - /* All other positions must contain hex digits */ - else { + /* All other positions must contain hex digits */ + if (!isxdigit ((int) InString[i])) { return (AE_BAD_PARAMETER); diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index 6b65bb1699bf..9a830e16058f 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -148,7 +148,7 @@ XfCrossReferenceNamespace ( /* Walk the entire parse tree */ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin, - XfNamespaceLocateEnd, WalkState); + XfNamespaceLocateEnd, WalkState); ACPI_FREE (WalkState); return (AE_OK); @@ -177,8 +177,8 @@ XfObjectExists ( /* Walk entire namespace from the supplied root */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, XfCompareOneNamespaceObject, NULL, - Name, NULL); + ACPI_UINT32_MAX, FALSE, XfCompareOneNamespaceObject, NULL, + Name, NULL); if (Status == AE_CTRL_TRUE) { /* At least one instance of the name was found */ @@ -575,6 +575,7 @@ XfNamespaceLocateBegin ( { NextOp = NextOp->Asl.Next; } + Path = NextOp->Asl.Value.String; } else @@ -596,7 +597,7 @@ XfNamespaceLocateBegin ( Gbl_NsLookupCount++; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); + ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) @@ -778,7 +779,8 @@ XfNamespaceLocateBegin ( if (Message) { - sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s", + sprintf (MsgBuffer, + "Size mismatch, Tag: %u bit%s, Field: %u bit%s", TagBitLength, (TagBitLength > 1) ? "s" : "", FieldBitLength, (FieldBitLength > 1) ? "s" : ""); @@ -847,7 +849,7 @@ XfNamespaceLocateBegin ( if (Node->Type != ACPI_TYPE_METHOD) { sprintf (MsgBuffer, "%s is a %s", - Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); + Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer); return_ACPI_STATUS (AE_OK); @@ -870,7 +872,7 @@ XfNamespaceLocateBegin ( UtSetParseOpName (Op); PassedArgs = 0; - NextOp = Op->Asl.Child; + NextOp = Op->Asl.Child; while (NextOp) { @@ -976,7 +978,8 @@ XfNamespaceLocateBegin ( case ACPI_ADR_SPACE_CMOS: case ACPI_ADR_SPACE_GPIO: - if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE) + if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != + AML_FIELD_ACCESS_BYTE) { AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL); } @@ -986,7 +989,8 @@ XfNamespaceLocateBegin ( case ACPI_ADR_SPACE_IPMI: case ACPI_ADR_SPACE_GSBUS: - if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) + if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != + AML_FIELD_ACCESS_BUFFER) { AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL); } @@ -1014,10 +1018,10 @@ XfNamespaceLocateBegin ( if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child) { XfCheckFieldRange (Op, - Op->Asl.Parent->Asl.ExtraValue, - Op->Asl.ExtraValue, - (UINT32) Op->Asl.Child->Asl.Value.Integer, - Op->Asl.Child->Asl.ExtraValue); + Op->Asl.Parent->Asl.ExtraValue, + Op->Asl.ExtraValue, + (UINT32) Op->Asl.Child->Asl.Value.Integer, + Op->Asl.Child->Asl.ExtraValue); } } } diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index 58e749f5bc73..a3f5ea799a6e 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -345,7 +345,7 @@ DtCompileDataTable ( DtInsertCompilerIds (*FieldList); Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader, - &Gbl_RootTable, TRUE); + &Gbl_RootTable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -382,7 +382,7 @@ DtCompileDataTable ( Subtable = NULL; Status = DtCompileTable (FieldList, TableData->TableInfo, - &Subtable, TRUE); + &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -639,6 +639,57 @@ Error: /****************************************************************************** * + * FUNCTION: DtCompileTwoSubtables + * + * PARAMETERS: List - Current field list pointer + * TableInfo1 - Info table 1 + * TableInfo1 - Info table 2 + * + * RETURN: Status + * + * DESCRIPTION: Compile tables with a header and one or more same subtables. + * Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileTwoSubtables ( + void **List, + ACPI_DMTABLE_INFO *TableInfo1, + ACPI_DMTABLE_INFO *TableInfo2) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + + + Status = DtCompileTable (PFieldList, TableInfo1, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, TableInfo2, &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompilePadding * * PARAMETERS: Length - Padding field size diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 55d7c1285225..df7078d08f83 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -172,6 +172,12 @@ DtCompileTable ( BOOLEAN Required); ACPI_STATUS +DtCompileTwoSubtables ( + void **List, + ACPI_DMTABLE_INFO *TableInfo1, + ACPI_DMTABLE_INFO *TableInfo2); + +ACPI_STATUS DtCompilePadding ( UINT32 Length, DT_SUBTABLE **RetSubtable); diff --git a/source/compiler/dtexpress.c b/source/compiler/dtexpress.c index 97d01151419a..2ed63064e9b1 100644 --- a/source/compiler/dtexpress.c +++ b/source/compiler/dtexpress.c @@ -147,6 +147,7 @@ DtDoOperator ( Gbl_CurrentField, NULL); return (0); } + Result = LeftValue / RightValue; break; @@ -158,6 +159,7 @@ DtDoOperator ( Gbl_CurrentField, NULL); return (0); } + Result = LeftValue % RightValue; break; @@ -417,6 +419,7 @@ DtLookupLabel ( { return (LabelField); } + LabelField = LabelField->NextLabel; } diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index f083f05ae3f5..72abe40eeff0 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -99,6 +99,7 @@ DtCompileOneField ( { ACPI_STATUS Status; + switch (Type) { case DT_FIELD_TYPE_INTEGER: diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c index 41b46b525593..25e60ba060d7 100644 --- a/source/compiler/dtio.c +++ b/source/compiler/dtio.c @@ -102,7 +102,7 @@ DtDumpSubtableTree ( #define DT_MERGE_LINES 6 #define DT_ESCAPE_SEQUENCE 7 -static UINT32 Gbl_NextLineOffset; +static UINT32 Gbl_NextLineOffset; /****************************************************************************** @@ -354,6 +354,7 @@ DtParseLine ( End--; break; } + End++; } @@ -553,7 +554,8 @@ DtGetNextLine ( if (!(Flags & DT_ALLOW_MULTILINE_QUOTES)) { - AcpiOsPrintf ("ERROR at line %u: Unterminated quoted string\n", + AcpiOsPrintf ( + "ERROR at line %u: Unterminated quoted string\n", Gbl_CurrentLineNumber++); State = DT_NORMAL_TEXT; } @@ -755,7 +757,8 @@ DtScanFile ( ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s", Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer)); - Status = DtParseLine (Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber, Offset); + Status = DtParseLine (Gbl_CurrentLineBuffer, + Gbl_CurrentLineNumber, Offset); if (Status == AE_NOT_FOUND) { break; @@ -946,6 +949,7 @@ DtDumpFieldList ( DbgPrint (ASL_DEBUG_OUTPUT, "\nField List:\n" "LineNo ByteOff NameCol Column TableOff " "Flags %32s : %s\n\n", "Name", "Value"); + while (Field) { DbgPrint (ASL_DEBUG_OUTPUT, @@ -1092,6 +1096,7 @@ DtWriteFieldToListing ( FlPrintFile (ASL_FILE_LISTING_OUTPUT, "...Additional data, length 0x%X\n", strlen (Field->Value)); } + FlPrintFile (ASL_FILE_LISTING_OUTPUT, "\n"); /* Dump the hex data that will be output for this field */ diff --git a/source/compiler/dttable.c b/source/compiler/dttable.c index c5b2ef9f6f2e..d482e8e51452 100644 --- a/source/compiler/dttable.c +++ b/source/compiler/dttable.c @@ -41,7 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -/* Compile all complex data tables */ +/* Compile routines for the basic ACPI tables */ #include "aslcompiler.h" #include "dtcompiler.h" @@ -50,123 +50,6 @@ ACPI_MODULE_NAME ("dttable") -/* TBD: merge these into dmtbinfo.c? */ - -static ACPI_DMTABLE_INFO TableInfoAsfAddress[] = -{ - {ACPI_DMT_BUFFER, 0, "Addresses", 0}, - {ACPI_DMT_EXIT, 0, NULL, 0} -}; - -static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] = -{ - {ACPI_DMT_PCI_PATH, 0, "PCI Path", 0}, - {ACPI_DMT_EXIT, 0, NULL, 0} -}; - - -/* Local prototypes */ - -static ACPI_STATUS -DtCompileTwoSubtables ( - void **List, - ACPI_DMTABLE_INFO *TableInfo1, - ACPI_DMTABLE_INFO *TableInfo2); - - -/****************************************************************************** - * - * FUNCTION: DtCompileTwoSubtables - * - * PARAMETERS: List - Current field list pointer - * TableInfo1 - Info table 1 - * TableInfo1 - Info table 2 - * - * RETURN: Status - * - * DESCRIPTION: Compile tables with a header and one or more same subtables. - * Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT - * - *****************************************************************************/ - -static ACPI_STATUS -DtCompileTwoSubtables ( - void **List, - ACPI_DMTABLE_INFO *TableInfo1, - ACPI_DMTABLE_INFO *TableInfo2) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - - - Status = DtCompileTable (PFieldList, TableInfo1, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, TableInfo2, &Subtable, FALSE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileFacs - * - * PARAMETERS: PFieldList - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile FACS. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileFacs ( - DT_FIELD **PFieldList) -{ - DT_SUBTABLE *Subtable; - UINT8 *ReservedBuffer; - ACPI_STATUS Status; - UINT32 ReservedSize; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFacs, - &Gbl_RootTable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Large FACS reserved area at the end of the table */ - - ReservedSize = (UINT32) sizeof (((ACPI_TABLE_FACS *) NULL)->Reserved1); - ReservedBuffer = UtLocalCalloc (ReservedSize); - - DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); - - ACPI_FREE (ReservedBuffer); - DtInsertSubtable (Gbl_RootTable, Subtable); - return (AE_OK); -} - - /****************************************************************************** * * FUNCTION: DtCompileRsdp @@ -192,7 +75,7 @@ DtCompileRsdp ( /* Compile the "common" RSDP (ACPI 1.0) */ Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp1, - &Gbl_RootTable, TRUE); + &Gbl_RootTable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -206,7 +89,7 @@ DtCompileRsdp ( /* Compile the "extended" part of the RSDP as a subtable */ Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp2, - &Subtable, TRUE); + &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -227,799 +110,6 @@ DtCompileRsdp ( /****************************************************************************** * - * FUNCTION: DtCompileAsf - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile ASF!. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileAsf ( - void **List) -{ - ACPI_ASF_INFO *AsfTable; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - ACPI_DMTABLE_INFO *InfoTable; - ACPI_DMTABLE_INFO *DataInfoTable = NULL; - UINT32 DataCount = 0; - ACPI_STATUS Status; - UINT32 i; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoAsfHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - AsfTable = ACPI_CAST_PTR (ACPI_ASF_INFO, Subtable->Buffer); - - switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */ - { - case ACPI_ASF_TYPE_INFO: - - InfoTable = AcpiDmTableInfoAsf0; - break; - - case ACPI_ASF_TYPE_ALERT: - - InfoTable = AcpiDmTableInfoAsf1; - break; - - case ACPI_ASF_TYPE_CONTROL: - - InfoTable = AcpiDmTableInfoAsf2; - break; - - case ACPI_ASF_TYPE_BOOT: - - InfoTable = AcpiDmTableInfoAsf3; - break; - - case ACPI_ASF_TYPE_ADDRESS: - - InfoTable = AcpiDmTableInfoAsf4; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */ - { - case ACPI_ASF_TYPE_INFO: - - DataInfoTable = NULL; - break; - - case ACPI_ASF_TYPE_ALERT: - - DataInfoTable = AcpiDmTableInfoAsf1a; - DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, - ACPI_SUB_PTR (UINT8, Subtable->Buffer, - sizeof (ACPI_ASF_HEADER)))->Alerts; - break; - - case ACPI_ASF_TYPE_CONTROL: - - DataInfoTable = AcpiDmTableInfoAsf2a; - DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, - ACPI_SUB_PTR (UINT8, Subtable->Buffer, - sizeof (ACPI_ASF_HEADER)))->Controls; - break; - - case ACPI_ASF_TYPE_BOOT: - - DataInfoTable = NULL; - break; - - case ACPI_ASF_TYPE_ADDRESS: - - DataInfoTable = TableInfoAsfAddress; - DataCount = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, - ACPI_SUB_PTR (UINT8, Subtable->Buffer, - sizeof (ACPI_ASF_HEADER)))->Devices; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!"); - return (AE_ERROR); - } - - if (DataInfoTable) - { - switch (AsfTable->Header.Type & 0x7F) - { - case ACPI_ASF_TYPE_ADDRESS: - - while (DataCount > 0) - { - Status = DtCompileTable (PFieldList, DataInfoTable, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - DataCount = DataCount - Subtable->Length; - } - break; - - default: - - for (i = 0; i < DataCount; i++) - { - Status = DtCompileTable (PFieldList, DataInfoTable, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - break; - } - } - - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileCpep - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile CPEP. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileCpep ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoCpep, AcpiDmTableInfoCpep0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileCsrt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile CSRT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileCsrt ( - void **List) -{ - ACPI_STATUS Status = AE_OK; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - UINT32 DescriptorCount; - UINT32 GroupLength; - - - /* Subtables (Resource Groups) */ - - ParentTable = DtPeekSubtable (); - while (*PFieldList) - { - /* Resource group subtable */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt0, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Compute the number of resource descriptors */ - - GroupLength = - (ACPI_CAST_PTR (ACPI_CSRT_GROUP, - Subtable->Buffer))->Length - - (ACPI_CAST_PTR (ACPI_CSRT_GROUP, - Subtable->Buffer))->SharedInfoLength - - sizeof (ACPI_CSRT_GROUP); - - DescriptorCount = (GroupLength / - sizeof (ACPI_CSRT_DESCRIPTOR)); - - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - ParentTable = DtPeekSubtable (); - - /* Shared info subtable (One per resource group) */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt1, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - - /* Sub-Subtables (Resource Descriptors) */ - - while (*PFieldList && DescriptorCount) - { - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - - DtPushSubtable (Subtable); - ParentTable = DtPeekSubtable (); - if (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (Subtable) - { - DtInsertSubtable (ParentTable, Subtable); - } - } - DtPopSubtable (); - ParentTable = DtPeekSubtable (); - - DescriptorCount--; - } - - DtPopSubtable (); - ParentTable = DtPeekSubtable (); - } - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileDbg2 - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile DBG2. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileDbg2 ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - UINT32 SubtableCount; - ACPI_DBG2_HEADER *Dbg2Header; - ACPI_DBG2_DEVICE *DeviceInfo; - UINT16 CurrentOffset; - UINT32 i; - - - /* Main table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* Main table fields */ - - Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer); - Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF ( - ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header); - - SubtableCount = Dbg2Header->InfoCount; - DtPushSubtable (Subtable); - - /* Process all Device Information subtables (Count = InfoCount) */ - - while (*PFieldList && SubtableCount) - { - /* Subtable: Debug Device Information */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Device, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DeviceInfo = ACPI_CAST_PTR (ACPI_DBG2_DEVICE, Subtable->Buffer); - CurrentOffset = (UINT16) sizeof (ACPI_DBG2_DEVICE); - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - ParentTable = DtPeekSubtable (); - - /* BaseAddressRegister GAS array (Required, size is RegisterCount) */ - - DeviceInfo->BaseAddressOffset = CurrentOffset; - for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - CurrentOffset += (UINT16) sizeof (ACPI_GENERIC_ADDRESS); - DtInsertSubtable (ParentTable, Subtable); - } - - /* AddressSize array (Required, size = RegisterCount) */ - - DeviceInfo->AddressSizeOffset = CurrentOffset; - for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - CurrentOffset += (UINT16) sizeof (UINT32); - DtInsertSubtable (ParentTable, Subtable); - } - - /* NamespaceString device identifier (Required, size = NamePathLength) */ - - DeviceInfo->NamepathOffset = CurrentOffset; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Update the device info header */ - - DeviceInfo->NamepathLength = (UINT16) Subtable->Length; - CurrentOffset += (UINT16) DeviceInfo->NamepathLength; - DtInsertSubtable (ParentTable, Subtable); - - /* OemData - Variable-length data (Optional, size = OemDataLength) */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2OemData, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Update the device info header (zeros if no OEM data present) */ - - DeviceInfo->OemDataOffset = 0; - DeviceInfo->OemDataLength = 0; - - /* Optional subtable (OemData) */ - - if (Subtable && Subtable->Length) - { - DeviceInfo->OemDataOffset = CurrentOffset; - DeviceInfo->OemDataLength = (UINT16) Subtable->Length; - - DtInsertSubtable (ParentTable, Subtable); - } - - SubtableCount--; - DtPopSubtable (); /* Get next Device Information subtable */ - } - - DtPopSubtable (); - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileDmar - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile DMAR. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileDmar ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_DMTABLE_INFO *InfoTable; - ACPI_DMAR_HEADER *DmarHeader; - ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope; - UINT32 DeviceScopeLength; - UINT32 PciPathLength; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - while (*PFieldList) - { - /* DMAR Header */ - - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer); - - switch (DmarHeader->Type) - { - case ACPI_DMAR_TYPE_HARDWARE_UNIT: - - InfoTable = AcpiDmTableInfoDmar0; - break; - - case ACPI_DMAR_TYPE_RESERVED_MEMORY: - - InfoTable = AcpiDmTableInfoDmar1; - break; - - case ACPI_DMAR_TYPE_ROOT_ATS: - - InfoTable = AcpiDmTableInfoDmar2; - break; - - case ACPI_DMAR_TYPE_HARDWARE_AFFINITY: - - InfoTable = AcpiDmTableInfoDmar3; - break; - - case ACPI_DMAR_TYPE_NAMESPACE: - - InfoTable = AcpiDmTableInfoDmar4; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR"); - return (AE_ERROR); - } - - /* DMAR Subtable */ - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* - * Optional Device Scope subtables - */ - if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || - (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE)) - { - /* These types do not support device scopes */ - - DtPopSubtable (); - continue; - } - - DtPushSubtable (Subtable); - DeviceScopeLength = DmarHeader->Length - Subtable->Length - - ParentTable->Length; - while (DeviceScopeLength) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope, - &Subtable, FALSE); - if (Status == AE_NOT_FOUND) - { - break; - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer); - - /* Optional PCI Paths */ - - PciPathLength = DmarDeviceScope->Length - Subtable->Length; - while (PciPathLength) - { - Status = DtCompileTable (PFieldList, TableInfoDmarPciPath, - &Subtable, FALSE); - if (Status == AE_NOT_FOUND) - { - DtPopSubtable (); - break; - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - PciPathLength -= Subtable->Length; - } - - DtPopSubtable (); - DeviceScopeLength -= DmarDeviceScope->Length; - } - - DtPopSubtable (); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileDrtm - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile DRTM. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileDrtm ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - UINT32 Count; - /* ACPI_TABLE_DRTM *Drtm; */ - ACPI_DRTM_VTABLE_LIST *DrtmVtl; - ACPI_DRTM_RESOURCE_LIST *DrtmRl; - /* ACPI_DRTM_DPS_ID *DrtmDps; */ - - - ParentTable = DtPeekSubtable (); - - /* Compile DRTM header */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - - /* - * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care - * should be taken to avoid accessing ACPI_TABLE_HADER fields. - */ -#if 0 - Drtm = ACPI_SUB_PTR (ACPI_TABLE_DRTM, - Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); -#endif - /* Compile VTL */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - DrtmVtl = ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST, Subtable->Buffer); - - DtPushSubtable (Subtable); - ParentTable = DtPeekSubtable (); - Count = 0; - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Subtable) - { - break; - } - DtInsertSubtable (ParentTable, Subtable); - Count++; - } - DrtmVtl->ValidatedTableCount = Count; - DtPopSubtable (); - ParentTable = DtPeekSubtable (); - - /* Compile RL */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - DrtmRl = ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST, Subtable->Buffer); - - DtPushSubtable (Subtable); - ParentTable = DtPeekSubtable (); - Count = 0; - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Subtable) - { - break; - } - DtInsertSubtable (ParentTable, Subtable); - Count++; - } - DrtmRl->ResourceCount = Count; - DtPopSubtable (); - ParentTable = DtPeekSubtable (); - - /* Compile DPS */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm2, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/ - - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileEinj - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile EINJ. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileEinj ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoEinj, AcpiDmTableInfoEinj0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileErst - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile ERST. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileErst ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoErst, AcpiDmTableInfoEinj0); - return (Status); -} - - -/****************************************************************************** - * * FUNCTION: DtCompileFadt * * PARAMETERS: List - Current field list pointer @@ -1043,7 +133,7 @@ DtCompileFadt ( Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt1, - &Subtable, TRUE); + &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -1058,7 +148,7 @@ DtCompileFadt ( if (Revision == 2) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt2, - &Subtable, TRUE); + &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -1069,7 +159,7 @@ DtCompileFadt ( else if (Revision >= 2) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt3, - &Subtable, TRUE); + &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -1080,7 +170,7 @@ DtCompileFadt ( if (Revision >= 5) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt5, - &Subtable, TRUE); + &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -1092,344 +182,13 @@ DtCompileFadt ( if (Revision >= 6) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt6, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - } - - return (AE_OK); -} - -/****************************************************************************** - * - * FUNCTION: DtCompileGtdt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile GTDT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileGtdt ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_SUBTABLE_HEADER *GtdtHeader; - ACPI_DMTABLE_INFO *InfoTable; - UINT32 GtCount; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdtHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - GtdtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); - - switch (GtdtHeader->Type) - { - case ACPI_GTDT_TYPE_TIMER_BLOCK: - - InfoTable = AcpiDmTableInfoGtdt0; - break; - - case ACPI_GTDT_TYPE_WATCHDOG: - - InfoTable = AcpiDmTableInfoGtdt1; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "GTDT"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* - * Additional GT block subtable data - */ - - switch (GtdtHeader->Type) - { - case ACPI_GTDT_TYPE_TIMER_BLOCK: - - DtPushSubtable (Subtable); - ParentTable = DtPeekSubtable (); - - GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, - Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount; - while (GtCount) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt0a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - - DtInsertSubtable (ParentTable, Subtable); - GtCount--; - } - DtPopSubtable (); - break; - - default: - - break; - } - - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileFpdt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile FPDT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileFpdt ( - void **List) -{ - ACPI_STATUS Status; - ACPI_FPDT_HEADER *FpdtHeader; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - ACPI_DMTABLE_INFO *InfoTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFpdtHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer); - - switch (FpdtHeader->Type) - { - case ACPI_FPDT_TYPE_BOOT: - - InfoTable = AcpiDmTableInfoFpdt0; - break; - - case ACPI_FPDT_TYPE_S3PERF: - - InfoTable = AcpiDmTableInfoFpdt1; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "FPDT"); - return (AE_ERROR); - break; - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileHest - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile HEST. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileHest ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_DMTABLE_INFO *InfoTable; - UINT16 Type; - UINT32 BankCount; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - /* Get subtable type */ - - SubtableStart = *PFieldList; - DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0); - - switch (Type) - { - case ACPI_HEST_TYPE_IA32_CHECK: - - InfoTable = AcpiDmTableInfoHest0; - break; - - case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: - - InfoTable = AcpiDmTableInfoHest1; - break; - - case ACPI_HEST_TYPE_IA32_NMI: - - InfoTable = AcpiDmTableInfoHest2; - break; - - case ACPI_HEST_TYPE_AER_ROOT_PORT: - - InfoTable = AcpiDmTableInfoHest6; - break; - - case ACPI_HEST_TYPE_AER_ENDPOINT: - - InfoTable = AcpiDmTableInfoHest7; - break; - - case ACPI_HEST_TYPE_AER_BRIDGE: - - InfoTable = AcpiDmTableInfoHest8; - break; - - case ACPI_HEST_TYPE_GENERIC_ERROR: - - InfoTable = AcpiDmTableInfoHest9; - break; - - default: - - /* Cannot continue on unknown type */ - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HEST"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - - /* - * Additional subtable data - IA32 Error Bank(s) - */ - BankCount = 0; - switch (Type) - { - case ACPI_HEST_TYPE_IA32_CHECK: - - BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, - Subtable->Buffer))->NumHardwareBanks; - break; - - case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: - - BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, - Subtable->Buffer))->NumHardwareBanks; - break; - - default: - - break; - } - - while (BankCount) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoHestBank, - &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } DtInsertSubtable (ParentTable, Subtable); - BankCount--; } } @@ -1439,2086 +198,41 @@ DtCompileHest ( /****************************************************************************** * - * FUNCTION: DtCompileIort - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile IORT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileIort ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_TABLE_IORT *Iort; - ACPI_IORT_NODE *IortNode; - ACPI_IORT_ITS_GROUP *IortItsGroup; - ACPI_IORT_SMMU *IortSmmu; - UINT32 NodeNumber; - UINT32 NodeLength; - UINT32 IdMappingNumber; - UINT32 ItsNumber; - UINT32 ContextIrptNumber; - UINT32 PmuIrptNumber; - UINT32 PaddingLength; - - - ParentTable = DtPeekSubtable (); - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - - /* - * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care - * should be taken to avoid accessing ACPI_TABLE_HADER fields. - */ - Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT, - Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); - - /* - * OptionalPadding - Variable-length data - * (Optional, size = OffsetToNodes - sizeof (ACPI_TABLE_IORT)) - * Optionally allows the generic data types to be used for filling - * this field. - */ - Iort->NodeOffset = sizeof (ACPI_TABLE_IORT); - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (Subtable) - { - DtInsertSubtable (ParentTable, Subtable); - Iort->NodeOffset += Subtable->Length; - } - else - { - Status = DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList), - AcpiDmTableInfoIortHdr[0].Name, &PaddingLength); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - Iort->NodeOffset += PaddingLength; - } - - NodeNumber = 0; - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - IortNode = ACPI_CAST_PTR (ACPI_IORT_NODE, Subtable->Buffer); - NodeLength = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); - - DtPushSubtable (Subtable); - ParentTable = DtPeekSubtable (); - - switch (IortNode->Type) - { - case ACPI_IORT_NODE_ITS_GROUP: - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - IortItsGroup = ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP, Subtable->Buffer); - NodeLength += Subtable->Length; - - ItsNumber = 0; - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Subtable) - { - break; - } - DtInsertSubtable (ParentTable, Subtable); - NodeLength += Subtable->Length; - ItsNumber++; - } - - IortItsGroup->ItsCount = ItsNumber; - break; - - case ACPI_IORT_NODE_NAMED_COMPONENT: - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - NodeLength += Subtable->Length; - - /* - * Padding - Variable-length data - * Optionally allows the offset of the ID mappings to be used - * for filling this field. - */ - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (Subtable) - { - DtInsertSubtable (ParentTable, Subtable); - NodeLength += Subtable->Length; - } - else - { - if (NodeLength > IortNode->MappingOffset) - { - return (AE_BAD_DATA); - } - if (NodeLength < IortNode->MappingOffset) - { - Status = DtCompilePadding ( - IortNode->MappingOffset - NodeLength, - &Subtable); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - NodeLength = IortNode->MappingOffset; - } - } - break; - - case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort2, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - NodeLength += Subtable->Length; - break; - - case ACPI_IORT_NODE_SMMU: - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - IortSmmu = ACPI_CAST_PTR (ACPI_IORT_SMMU, Subtable->Buffer); - NodeLength += Subtable->Length; - - /* Compile global interrupt array */ - - IortSmmu->GlobalInterruptOffset = NodeLength; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - DtInsertSubtable (ParentTable, Subtable); - NodeLength += Subtable->Length; - - /* Compile context interrupt array */ - - ContextIrptNumber = 0; - IortSmmu->ContextInterruptOffset = NodeLength; - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Subtable) - { - break; - } - DtInsertSubtable (ParentTable, Subtable); - NodeLength += Subtable->Length; - ContextIrptNumber++; - } - IortSmmu->ContextInterruptCount = ContextIrptNumber; - - /* Compile PMU interrupt array */ - - PmuIrptNumber = 0; - IortSmmu->PmuInterruptOffset = NodeLength; - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Subtable) - { - break; - } - DtInsertSubtable (ParentTable, Subtable); - NodeLength += Subtable->Length; - PmuIrptNumber++; - } - IortSmmu->PmuInterruptCount = PmuIrptNumber; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT"); - return (AE_ERROR); - } - - /* Compile Array of ID mappings */ - - IortNode->MappingOffset = NodeLength; - IdMappingNumber = 0; - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortMap, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Subtable) - { - break; - } - DtInsertSubtable (ParentTable, Subtable); - NodeLength += sizeof (ACPI_IORT_ID_MAPPING); - IdMappingNumber++; - } - IortNode->MappingCount = IdMappingNumber; - - /* - * Node length can be determined by DT_LENGTH option - * IortNode->Length = NodeLength; - */ - DtPopSubtable (); - ParentTable = DtPeekSubtable (); - NodeNumber++; - } - Iort->NodeCount = NodeNumber; - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileIvrs - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile IVRS. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileIvrs ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_DMTABLE_INFO *InfoTable; - ACPI_IVRS_HEADER *IvrsHeader; - UINT8 EntryType; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - IvrsHeader = ACPI_CAST_PTR (ACPI_IVRS_HEADER, Subtable->Buffer); - - switch (IvrsHeader->Type) - { - case ACPI_IVRS_TYPE_HARDWARE: - - InfoTable = AcpiDmTableInfoIvrs0; - break; - - case ACPI_IVRS_TYPE_MEMORY1: - case ACPI_IVRS_TYPE_MEMORY2: - case ACPI_IVRS_TYPE_MEMORY3: - - InfoTable = AcpiDmTableInfoIvrs1; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IVRS"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE) - { - while (*PFieldList && - !strcmp ((*PFieldList)->Name, "Entry Type")) - { - SubtableStart = *PFieldList; - DtCompileInteger (&EntryType, *PFieldList, 1, 0); - - switch (EntryType) - { - /* 4-byte device entries */ - - case ACPI_IVRS_TYPE_PAD4: - case ACPI_IVRS_TYPE_ALL: - case ACPI_IVRS_TYPE_SELECT: - case ACPI_IVRS_TYPE_START: - case ACPI_IVRS_TYPE_END: - - InfoTable = AcpiDmTableInfoIvrs4; - break; - - /* 8-byte entries, type A */ - - case ACPI_IVRS_TYPE_ALIAS_SELECT: - case ACPI_IVRS_TYPE_ALIAS_START: - - InfoTable = AcpiDmTableInfoIvrs8a; - break; - - /* 8-byte entries, type B */ - - case ACPI_IVRS_TYPE_PAD8: - case ACPI_IVRS_TYPE_EXT_SELECT: - case ACPI_IVRS_TYPE_EXT_START: - - InfoTable = AcpiDmTableInfoIvrs8b; - break; - - /* 8-byte entries, type C */ - - case ACPI_IVRS_TYPE_SPECIAL: - - InfoTable = AcpiDmTableInfoIvrs8c; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, - "IVRS Device Entry"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - } - } - - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileLpit - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile LPIT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileLpit ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_DMTABLE_INFO *InfoTable; - ACPI_LPIT_HEADER *LpitHeader; - - - /* Note: Main table consists only of the standard ACPI table header */ - - while (*PFieldList) - { - SubtableStart = *PFieldList; - - /* LPIT Subtable header */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoLpitHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - LpitHeader = ACPI_CAST_PTR (ACPI_LPIT_HEADER, Subtable->Buffer); - - switch (LpitHeader->Type) - { - case ACPI_LPIT_TYPE_NATIVE_CSTATE: - - InfoTable = AcpiDmTableInfoLpit0; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT"); - return (AE_ERROR); - } - - /* LPIT Subtable */ - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileMadt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile MADT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileMadt ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_SUBTABLE_HEADER *MadtHeader; - ACPI_DMTABLE_INFO *InfoTable; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); - - switch (MadtHeader->Type) - { - case ACPI_MADT_TYPE_LOCAL_APIC: - - InfoTable = AcpiDmTableInfoMadt0; - break; - - case ACPI_MADT_TYPE_IO_APIC: - - InfoTable = AcpiDmTableInfoMadt1; - break; - - case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: - - InfoTable = AcpiDmTableInfoMadt2; - break; - - case ACPI_MADT_TYPE_NMI_SOURCE: - - InfoTable = AcpiDmTableInfoMadt3; - break; - - case ACPI_MADT_TYPE_LOCAL_APIC_NMI: - - InfoTable = AcpiDmTableInfoMadt4; - break; - - case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: - - InfoTable = AcpiDmTableInfoMadt5; - break; - - case ACPI_MADT_TYPE_IO_SAPIC: - - InfoTable = AcpiDmTableInfoMadt6; - break; - - case ACPI_MADT_TYPE_LOCAL_SAPIC: - - InfoTable = AcpiDmTableInfoMadt7; - break; - - case ACPI_MADT_TYPE_INTERRUPT_SOURCE: - - InfoTable = AcpiDmTableInfoMadt8; - break; - - case ACPI_MADT_TYPE_LOCAL_X2APIC: - - InfoTable = AcpiDmTableInfoMadt9; - break; - - case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: - - InfoTable = AcpiDmTableInfoMadt10; - break; - - case ACPI_MADT_TYPE_GENERIC_INTERRUPT: - - InfoTable = AcpiDmTableInfoMadt11; - break; - - case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: - - InfoTable = AcpiDmTableInfoMadt12; - break; - - case ACPI_MADT_TYPE_GENERIC_MSI_FRAME: - - InfoTable = AcpiDmTableInfoMadt13; - break; - - case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: - - InfoTable = AcpiDmTableInfoMadt14; - break; - - case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: - - InfoTable = AcpiDmTableInfoMadt15; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileMcfg - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile MCFG. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileMcfg ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileMpst - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile MPST. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileMpst ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - ACPI_MPST_CHANNEL *MpstChannelInfo; - ACPI_MPST_POWER_NODE *MpstPowerNode; - ACPI_MPST_DATA_HDR *MpstDataHeader; - UINT16 SubtableCount; - UINT32 PowerStateCount; - UINT32 ComponentCount; - - - /* Main table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer); - SubtableCount = MpstChannelInfo->PowerNodeCount; - - while (*PFieldList && SubtableCount) - { - /* Subtable: Memory Power Node(s) */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer); - PowerStateCount = MpstPowerNode->NumPowerStates; - ComponentCount = MpstPowerNode->NumPhysicalComponents; - - ParentTable = DtPeekSubtable (); - - /* Sub-subtables - Memory Power State Structure(s) */ - - while (*PFieldList && PowerStateCount) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0A, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - PowerStateCount--; - } - - /* Sub-subtables - Physical Component ID Structure(s) */ - - while (*PFieldList && ComponentCount) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0B, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - ComponentCount--; - } - - SubtableCount--; - DtPopSubtable (); - } - - /* Subtable: Count of Memory Power State Characteristic structures */ - - DtPopSubtable (); - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst1, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer); - SubtableCount = MpstDataHeader->CharacteristicsCount; - - ParentTable = DtPeekSubtable (); - - /* Subtable: Memory Power State Characteristics structure(s) */ - - while (*PFieldList && SubtableCount) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst2, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - SubtableCount--; - } - - DtPopSubtable (); - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileMsct - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile MSCT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileMsct ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileMtmr - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile MTMR. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileMtmr ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoMtmr, AcpiDmTableInfoMtmr0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileNfit - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile NFIT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileNfit ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_NFIT_HEADER *NfitHeader; - ACPI_DMTABLE_INFO *InfoTable; - UINT32 Count; - ACPI_NFIT_INTERLEAVE *Interleave = NULL; - ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; - - /* Main table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - /* Subtables */ - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer); - - switch (NfitHeader->Type) - { - case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: - - InfoTable = AcpiDmTableInfoNfit0; - break; - - case ACPI_NFIT_TYPE_MEMORY_MAP: - - InfoTable = AcpiDmTableInfoNfit1; - break; - - case ACPI_NFIT_TYPE_INTERLEAVE: - - Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer); - InfoTable = AcpiDmTableInfoNfit2; - break; - - case ACPI_NFIT_TYPE_SMBIOS: - - InfoTable = AcpiDmTableInfoNfit3; - break; - - case ACPI_NFIT_TYPE_CONTROL_REGION: - - InfoTable = AcpiDmTableInfoNfit4; - break; - - case ACPI_NFIT_TYPE_DATA_REGION: - - InfoTable = AcpiDmTableInfoNfit5; - break; - - case ACPI_NFIT_TYPE_FLUSH_ADDRESS: - - Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer); - InfoTable = AcpiDmTableInfoNfit6; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - - switch (NfitHeader->Type) - { - case ACPI_NFIT_TYPE_INTERLEAVE: - - Count = 0; - DtPushSubtable (Subtable); - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a, - &Subtable, FALSE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Subtable) - { - DtPopSubtable (); - break; - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - Count++; - } - - Interleave->LineCount = Count; - DtPopSubtable (); - break; - - case ACPI_NFIT_TYPE_SMBIOS: - - if (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (Subtable) - { - DtInsertSubtable (ParentTable, Subtable); - } - } - break; - - case ACPI_NFIT_TYPE_FLUSH_ADDRESS: - - Count = 0; - DtPushSubtable (Subtable); - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a, - &Subtable, FALSE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Subtable) - { - DtPopSubtable (); - break; - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - Count++; - } - - Hint->HintCount = (UINT16) Count; - DtPopSubtable (); - break; - - default: - break; - } - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompilePcct - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile PCCT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompilePcct ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_SUBTABLE_HEADER *PcctHeader; - ACPI_DMTABLE_INFO *InfoTable; - - - /* Main table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* Subtables */ - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcctHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - PcctHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); - - switch (PcctHeader->Type) - { - case ACPI_PCCT_TYPE_GENERIC_SUBSPACE: - - InfoTable = AcpiDmTableInfoPcct0; - break; - - case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE: - - InfoTable = AcpiDmTableInfoPcct1; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompilePmtt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile PMTT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompilePmtt ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_PMTT_HEADER *PmttHeader; - ACPI_PMTT_CONTROLLER *PmttController; - UINT16 DomainCount; - UINT8 PrevType = ACPI_PMTT_TYPE_SOCKET; - - - /* Main table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmttHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - PmttHeader = ACPI_CAST_PTR (ACPI_PMTT_HEADER, Subtable->Buffer); - while (PrevType >= PmttHeader->Type) - { - DtPopSubtable (); - - if (PrevType == ACPI_PMTT_TYPE_SOCKET) - { - break; - } - PrevType--; - } - PrevType = PmttHeader->Type; - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - switch (PmttHeader->Type) - { - case ACPI_PMTT_TYPE_SOCKET: - - /* Subtable: Socket Structure */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt0, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - break; - - case ACPI_PMTT_TYPE_CONTROLLER: - - /* Subtable: Memory Controller Structure */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER, - (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER))); - DomainCount = PmttController->DomainCount; - - while (DomainCount) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1a, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); - DomainCount--; - } - break; - - case ACPI_PMTT_TYPE_DIMM: - - /* Subtable: Physical Component Structure */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt2, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PMTT"); - return (AE_ERROR); - } - } - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileRsdt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile RSDT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileRsdt ( - void **List) -{ - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD *FieldList = *(DT_FIELD **) List; - UINT32 Address; - - - ParentTable = DtPeekSubtable (); - - while (FieldList) - { - DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO); - - DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable); - DtInsertSubtable (ParentTable, Subtable); - FieldList = FieldList->Next; - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileS3pt + * FUNCTION: DtCompileFacs * * PARAMETERS: PFieldList - Current field list pointer * * RETURN: Status * - * DESCRIPTION: Compile S3PT (Pointed to by FPDT) + * DESCRIPTION: Compile FACS. * *****************************************************************************/ ACPI_STATUS -DtCompileS3pt ( +DtCompileFacs ( DT_FIELD **PFieldList) { - ACPI_STATUS Status; - ACPI_S3PT_HEADER *S3ptHeader; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - ACPI_DMTABLE_INFO *InfoTable; - DT_FIELD *SubtableStart; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt, - &Gbl_RootTable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtPushSubtable (Gbl_RootTable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3ptHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - S3ptHeader = ACPI_CAST_PTR (ACPI_S3PT_HEADER, Subtable->Buffer); - - switch (S3ptHeader->Type) - { - case ACPI_S3PT_TYPE_RESUME: - - InfoTable = AcpiDmTableInfoS3pt0; - break; - - case ACPI_S3PT_TYPE_SUSPEND: - - InfoTable = AcpiDmTableInfoS3pt1; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "S3PT"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileSlic - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile SLIC. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileSlic ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - - - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlic, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileSlit - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile SLIT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileSlit ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *FieldList; - UINT32 Localities; - UINT8 *LocalityBuffer; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); - LocalityBuffer = UtLocalCalloc (Localities); - - /* Compile each locality buffer */ - - FieldList = *PFieldList; - while (FieldList) - { - DtCompileBuffer (LocalityBuffer, - FieldList->Value, FieldList, Localities); - - DtCreateSubtable (LocalityBuffer, Localities, &Subtable); - DtInsertSubtable (ParentTable, Subtable); - FieldList = FieldList->Next; - } - - ACPI_FREE (LocalityBuffer); - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileSrat - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile SRAT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileSrat ( - void **List) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_SUBTABLE_HEADER *SratHeader; - ACPI_DMTABLE_INFO *InfoTable; - - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - while (*PFieldList) - { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPushSubtable (Subtable); - - SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); - - switch (SratHeader->Type) - { - case ACPI_SRAT_TYPE_CPU_AFFINITY: - - InfoTable = AcpiDmTableInfoSrat0; - break; - - case ACPI_SRAT_TYPE_MEMORY_AFFINITY: - - InfoTable = AcpiDmTableInfoSrat1; - break; - - case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: - - InfoTable = AcpiDmTableInfoSrat2; - break; - - case ACPI_SRAT_TYPE_GICC_AFFINITY: - - InfoTable = AcpiDmTableInfoSrat3; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - DtPopSubtable (); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileStao - * - * PARAMETERS: PFieldList - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile STAO. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileStao ( - void **List) -{ - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - ACPI_STATUS Status; - - - /* Compile the main table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* Compile each ASCII namestring as a subtable */ - - while (*PFieldList) - { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileTcpa - * - * PARAMETERS: PFieldList - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile TCPA. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileTcpa ( - void **List) -{ - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_SUBTABLE *Subtable; - ACPI_TABLE_TCPA_HDR *TcpaHeader; - DT_SUBTABLE *ParentTable; - ACPI_STATUS Status; - - - /* Compile the main table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* - * Examine the PlatformClass field to determine the table type. - * Either a client or server table. Only one. - */ - TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer); - - switch (TcpaHeader->PlatformClass) - { - case ACPI_TCPA_CLIENT_TABLE: - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient, - &Subtable, TRUE); - break; - - case ACPI_TCPA_SERVER_TABLE: - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer, - &Subtable, TRUE); - break; - - default: - - AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n", - TcpaHeader->PlatformClass); - Status = AE_ERROR; - break; - } - - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtGetGenericTableInfo - * - * PARAMETERS: Name - Generic type name - * - * RETURN: Info entry - * - * DESCRIPTION: Obtain table info for a generic name entry - * - *****************************************************************************/ - -ACPI_DMTABLE_INFO * -DtGetGenericTableInfo ( - char *Name) -{ - ACPI_DMTABLE_INFO *Info; - UINT32 i; - - - if (!Name) - { - return (NULL); - } - - /* Search info table for name match */ - - for (i = 0; ; i++) - { - Info = AcpiDmTableInfoGeneric[i]; - if (Info->Opcode == ACPI_DMT_EXIT) - { - Info = NULL; - break; - } - - /* Use caseless compare for generic keywords */ - - if (!AcpiUtStricmp (Name, Info->Name)) - { - break; - } - } - - return (Info); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileUefi - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile UEFI. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileUefi ( - void **List) -{ - ACPI_STATUS Status; DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - UINT16 *DataOffset; - - - /* Compile the predefined portion of the UEFI table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DataOffset = (UINT16 *) (Subtable->Buffer + 16); - *DataOffset = sizeof (ACPI_TABLE_UEFI); - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - - /* - * Compile the "generic" portion of the UEFI table. This - * part of the table is not predefined and any of the generic - * operators may be used. - */ - - DtCompileGeneric ((void **) PFieldList, NULL, NULL); - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileVrtc - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile VRTC. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileVrtc ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoVrtc, AcpiDmTableInfoVrtc0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileWdat - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile WDAT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileWdat ( - void **List) -{ - ACPI_STATUS Status; - - - Status = DtCompileTwoSubtables (List, - AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileWpbt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile WPBT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileWpbt ( - void **List) -{ - DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - ACPI_TABLE_WPBT *Table; + UINT8 *ReservedBuffer; ACPI_STATUS Status; - UINT16 Length; - - - /* Compile the main table */ - - Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); + UINT32 ReservedSize; - /* Compile the argument list subtable */ - Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0, - &Subtable, TRUE); + Status = DtCompileTable (PFieldList, AcpiDmTableInfoFacs, + &Gbl_RootTable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } - /* Extract the length of the Arguments buffer, insert into main table */ - - Length = (UINT16) Subtable->TotalLength; - Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer); - Table->ArgumentsLength = Length; - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileXsdt - * - * PARAMETERS: List - Current field list pointer - * - * RETURN: Status - * - * DESCRIPTION: Compile XSDT. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileXsdt ( - void **List) -{ - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD *FieldList = *(DT_FIELD **) List; - UINT64 Address; - - - ParentTable = DtPeekSubtable (); - - while (FieldList) - { - DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO); - - DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable); - DtInsertSubtable (ParentTable, Subtable); - FieldList = FieldList->Next; - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: DtCompileGeneric - * - * PARAMETERS: List - Current field list pointer - * Name - Field name to end generic compiling - * Length - Compiled table length to return - * - * RETURN: Status - * - * DESCRIPTION: Compile generic unknown table. - * - *****************************************************************************/ - -ACPI_STATUS -DtCompileGeneric ( - void **List, - char *Name, - UINT32 *Length) -{ - ACPI_STATUS Status; - DT_SUBTABLE *Subtable; - DT_SUBTABLE *ParentTable; - DT_FIELD **PFieldList = (DT_FIELD **) List; - ACPI_DMTABLE_INFO *Info; - - - ParentTable = DtPeekSubtable (); - - /* - * Compile the "generic" portion of the table. This - * part of the table is not predefined and any of the generic - * operators may be used. - */ - - /* Find any and all labels in the entire generic portion */ - - DtDetectAllLabels (*PFieldList); - - /* Now we can actually compile the parse tree */ - - if (Length && *Length) - { - *Length = 0; - } - while (*PFieldList) - { - if (Name && !strcmp ((*PFieldList)->Name, Name)) - { - break; - } - Info = DtGetGenericTableInfo ((*PFieldList)->Name); - if (!Info) - { - sprintf (MsgBuffer, "Generic data type \"%s\" not found", - (*PFieldList)->Name); - DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, - (*PFieldList), MsgBuffer); - - *PFieldList = (*PFieldList)->Next; - continue; - } + /* Large FACS reserved area at the end of the table */ - Status = DtCompileTable (PFieldList, Info, - &Subtable, TRUE); - if (ACPI_SUCCESS (Status)) - { - DtInsertSubtable (ParentTable, Subtable); - if (Length) - { - *Length += Subtable->Length; - } - } - else - { - *PFieldList = (*PFieldList)->Next; + ReservedSize = (UINT32) sizeof (((ACPI_TABLE_FACS *) NULL)->Reserved1); + ReservedBuffer = UtLocalCalloc (ReservedSize); - if (Status == AE_NOT_FOUND) - { - sprintf (MsgBuffer, "Generic data type \"%s\" not found", - (*PFieldList)->Name); - DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, - (*PFieldList), MsgBuffer); - } - } - } + DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); + ACPI_FREE (ReservedBuffer); + DtInsertSubtable (Gbl_RootTable, Subtable); return (AE_OK); } diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c new file mode 100644 index 000000000000..1c3b0f251104 --- /dev/null +++ b/source/compiler/dttable1.c @@ -0,0 +1,1671 @@ +/****************************************************************************** + * + * Module Name: dttable1.c - handling for specific ACPI tables + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * 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. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * 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 MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +/* Compile all complex data tables, signatures starting with A-I */ + +#include "aslcompiler.h" +#include "dtcompiler.h" + +#define _COMPONENT DT_COMPILER + ACPI_MODULE_NAME ("dttable1") + + +static ACPI_DMTABLE_INFO TableInfoAsfAddress[] = +{ + {ACPI_DMT_BUFFER, 0, "Addresses", 0}, + {ACPI_DMT_EXIT, 0, NULL, 0} +}; + +static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] = +{ + {ACPI_DMT_PCI_PATH, 0, "PCI Path", 0}, + {ACPI_DMT_EXIT, 0, NULL, 0} +}; + + +/****************************************************************************** + * + * FUNCTION: DtCompileAsf + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile ASF!. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileAsf ( + void **List) +{ + ACPI_ASF_INFO *AsfTable; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_DMTABLE_INFO *DataInfoTable = NULL; + UINT32 DataCount = 0; + ACPI_STATUS Status; + UINT32 i; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoAsfHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + AsfTable = ACPI_CAST_PTR (ACPI_ASF_INFO, Subtable->Buffer); + + switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */ + { + case ACPI_ASF_TYPE_INFO: + + InfoTable = AcpiDmTableInfoAsf0; + break; + + case ACPI_ASF_TYPE_ALERT: + + InfoTable = AcpiDmTableInfoAsf1; + break; + + case ACPI_ASF_TYPE_CONTROL: + + InfoTable = AcpiDmTableInfoAsf2; + break; + + case ACPI_ASF_TYPE_BOOT: + + InfoTable = AcpiDmTableInfoAsf3; + break; + + case ACPI_ASF_TYPE_ADDRESS: + + InfoTable = AcpiDmTableInfoAsf4; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */ + { + case ACPI_ASF_TYPE_INFO: + + DataInfoTable = NULL; + break; + + case ACPI_ASF_TYPE_ALERT: + + DataInfoTable = AcpiDmTableInfoAsf1a; + DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, + ACPI_SUB_PTR (UINT8, Subtable->Buffer, + sizeof (ACPI_ASF_HEADER)))->Alerts; + break; + + case ACPI_ASF_TYPE_CONTROL: + + DataInfoTable = AcpiDmTableInfoAsf2a; + DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, + ACPI_SUB_PTR (UINT8, Subtable->Buffer, + sizeof (ACPI_ASF_HEADER)))->Controls; + break; + + case ACPI_ASF_TYPE_BOOT: + + DataInfoTable = NULL; + break; + + case ACPI_ASF_TYPE_ADDRESS: + + DataInfoTable = TableInfoAsfAddress; + DataCount = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, + ACPI_SUB_PTR (UINT8, Subtable->Buffer, + sizeof (ACPI_ASF_HEADER)))->Devices; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!"); + return (AE_ERROR); + } + + if (DataInfoTable) + { + switch (AsfTable->Header.Type & 0x7F) + { + case ACPI_ASF_TYPE_ADDRESS: + + while (DataCount > 0) + { + Status = DtCompileTable (PFieldList, DataInfoTable, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + DataCount = DataCount - Subtable->Length; + } + break; + + default: + + for (i = 0; i < DataCount; i++) + { + Status = DtCompileTable (PFieldList, DataInfoTable, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + } + break; + } + } + + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileCpep + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile CPEP. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileCpep ( + void **List) +{ + ACPI_STATUS Status; + + + Status = DtCompileTwoSubtables (List, + AcpiDmTableInfoCpep, AcpiDmTableInfoCpep0); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileCsrt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile CSRT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileCsrt ( + void **List) +{ + ACPI_STATUS Status = AE_OK; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + UINT32 DescriptorCount; + UINT32 GroupLength; + + + /* Subtables (Resource Groups) */ + + ParentTable = DtPeekSubtable (); + while (*PFieldList) + { + /* Resource group subtable */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Compute the number of resource descriptors */ + + GroupLength = + (ACPI_CAST_PTR (ACPI_CSRT_GROUP, + Subtable->Buffer))->Length - + (ACPI_CAST_PTR (ACPI_CSRT_GROUP, + Subtable->Buffer))->SharedInfoLength - + sizeof (ACPI_CSRT_GROUP); + + DescriptorCount = (GroupLength / + sizeof (ACPI_CSRT_DESCRIPTOR)); + + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + + /* Shared info subtable (One per resource group) */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + + /* Sub-Subtables (Resource Descriptors) */ + + while (*PFieldList && DescriptorCount) + { + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + if (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + } + } + + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + DescriptorCount--; + } + + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + } + + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileDbg2 + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile DBG2. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileDbg2 ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + UINT32 SubtableCount; + ACPI_DBG2_HEADER *Dbg2Header; + ACPI_DBG2_DEVICE *DeviceInfo; + UINT16 CurrentOffset; + UINT32 i; + + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Main table fields */ + + Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer); + Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF ( + ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header); + + SubtableCount = Dbg2Header->InfoCount; + DtPushSubtable (Subtable); + + /* Process all Device Information subtables (Count = InfoCount) */ + + while (*PFieldList && SubtableCount) + { + /* Subtable: Debug Device Information */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Device, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DeviceInfo = ACPI_CAST_PTR (ACPI_DBG2_DEVICE, Subtable->Buffer); + CurrentOffset = (UINT16) sizeof (ACPI_DBG2_DEVICE); + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + ParentTable = DtPeekSubtable (); + + /* BaseAddressRegister GAS array (Required, size is RegisterCount) */ + + DeviceInfo->BaseAddressOffset = CurrentOffset; + for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + CurrentOffset += (UINT16) sizeof (ACPI_GENERIC_ADDRESS); + DtInsertSubtable (ParentTable, Subtable); + } + + /* AddressSize array (Required, size = RegisterCount) */ + + DeviceInfo->AddressSizeOffset = CurrentOffset; + for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + CurrentOffset += (UINT16) sizeof (UINT32); + DtInsertSubtable (ParentTable, Subtable); + } + + /* NamespaceString device identifier (Required, size = NamePathLength) */ + + DeviceInfo->NamepathOffset = CurrentOffset; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Update the device info header */ + + DeviceInfo->NamepathLength = (UINT16) Subtable->Length; + CurrentOffset += (UINT16) DeviceInfo->NamepathLength; + DtInsertSubtable (ParentTable, Subtable); + + /* OemData - Variable-length data (Optional, size = OemDataLength) */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2OemData, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Update the device info header (zeros if no OEM data present) */ + + DeviceInfo->OemDataOffset = 0; + DeviceInfo->OemDataLength = 0; + + /* Optional subtable (OemData) */ + + if (Subtable && Subtable->Length) + { + DeviceInfo->OemDataOffset = CurrentOffset; + DeviceInfo->OemDataLength = (UINT16) Subtable->Length; + + DtInsertSubtable (ParentTable, Subtable); + } + + SubtableCount--; + DtPopSubtable (); /* Get next Device Information subtable */ + } + + DtPopSubtable (); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileDmar + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile DMAR. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileDmar ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_DMAR_HEADER *DmarHeader; + ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope; + UINT32 DeviceScopeLength; + UINT32 PciPathLength; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + while (*PFieldList) + { + /* DMAR Header */ + + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer); + + switch (DmarHeader->Type) + { + case ACPI_DMAR_TYPE_HARDWARE_UNIT: + + InfoTable = AcpiDmTableInfoDmar0; + break; + + case ACPI_DMAR_TYPE_RESERVED_MEMORY: + + InfoTable = AcpiDmTableInfoDmar1; + break; + + case ACPI_DMAR_TYPE_ROOT_ATS: + + InfoTable = AcpiDmTableInfoDmar2; + break; + + case ACPI_DMAR_TYPE_HARDWARE_AFFINITY: + + InfoTable = AcpiDmTableInfoDmar3; + break; + + case ACPI_DMAR_TYPE_NAMESPACE: + + InfoTable = AcpiDmTableInfoDmar4; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR"); + return (AE_ERROR); + } + + /* DMAR Subtable */ + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* + * Optional Device Scope subtables + */ + if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || + (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE)) + { + /* These types do not support device scopes */ + + DtPopSubtable (); + continue; + } + + DtPushSubtable (Subtable); + DeviceScopeLength = DmarHeader->Length - Subtable->Length - + ParentTable->Length; + while (DeviceScopeLength) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope, + &Subtable, FALSE); + if (Status == AE_NOT_FOUND) + { + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer); + + /* Optional PCI Paths */ + + PciPathLength = DmarDeviceScope->Length - Subtable->Length; + while (PciPathLength) + { + Status = DtCompileTable (PFieldList, TableInfoDmarPciPath, + &Subtable, FALSE); + if (Status == AE_NOT_FOUND) + { + DtPopSubtable (); + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + PciPathLength -= Subtable->Length; + } + + DtPopSubtable (); + DeviceScopeLength -= DmarDeviceScope->Length; + } + + DtPopSubtable (); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileDrtm + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile DRTM. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileDrtm ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + UINT32 Count; + /* ACPI_TABLE_DRTM *Drtm; */ + ACPI_DRTM_VTABLE_LIST *DrtmVtl; + ACPI_DRTM_RESOURCE_LIST *DrtmRl; + /* ACPI_DRTM_DPS_ID *DrtmDps; */ + + + ParentTable = DtPeekSubtable (); + + /* Compile DRTM header */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + + /* + * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care + * should be taken to avoid accessing ACPI_TABLE_HADER fields. + */ +#if 0 + Drtm = ACPI_SUB_PTR (ACPI_TABLE_DRTM, + Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); +#endif + /* Compile VTL */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + DrtmVtl = ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST, Subtable->Buffer); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + Count = 0; + + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + DrtmVtl->ValidatedTableCount = Count; + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + + /* Compile RL */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + DrtmRl = ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST, Subtable->Buffer); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + Count = 0; + + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Subtable) + { + break; + } + + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + DrtmRl->ResourceCount = Count; + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + + /* Compile DPS */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/ + + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileEinj + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile EINJ. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileEinj ( + void **List) +{ + ACPI_STATUS Status; + + + Status = DtCompileTwoSubtables (List, + AcpiDmTableInfoEinj, AcpiDmTableInfoEinj0); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileErst + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile ERST. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileErst ( + void **List) +{ + ACPI_STATUS Status; + + + Status = DtCompileTwoSubtables (List, + AcpiDmTableInfoErst, AcpiDmTableInfoEinj0); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileGtdt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile GTDT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileGtdt ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_SUBTABLE_HEADER *GtdtHeader; + ACPI_DMTABLE_INFO *InfoTable; + UINT32 GtCount; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdtHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + GtdtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); + + switch (GtdtHeader->Type) + { + case ACPI_GTDT_TYPE_TIMER_BLOCK: + + InfoTable = AcpiDmTableInfoGtdt0; + break; + + case ACPI_GTDT_TYPE_WATCHDOG: + + InfoTable = AcpiDmTableInfoGtdt1; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "GTDT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* + * Additional GT block subtable data + */ + + switch (GtdtHeader->Type) + { + case ACPI_GTDT_TYPE_TIMER_BLOCK: + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + + GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, + Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount; + + while (GtCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt0a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + GtCount--; + } + + DtPopSubtable (); + break; + + default: + + break; + } + + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileFpdt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile FPDT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileFpdt ( + void **List) +{ + ACPI_STATUS Status; + ACPI_FPDT_HEADER *FpdtHeader; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoFpdtHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer); + + switch (FpdtHeader->Type) + { + case ACPI_FPDT_TYPE_BOOT: + + InfoTable = AcpiDmTableInfoFpdt0; + break; + + case ACPI_FPDT_TYPE_S3PERF: + + InfoTable = AcpiDmTableInfoFpdt1; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "FPDT"); + return (AE_ERROR); + break; + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileHest + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile HEST. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileHest ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_DMTABLE_INFO *InfoTable; + UINT16 Type; + UINT32 BankCount; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + /* Get subtable type */ + + SubtableStart = *PFieldList; + DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0); + + switch (Type) + { + case ACPI_HEST_TYPE_IA32_CHECK: + + InfoTable = AcpiDmTableInfoHest0; + break; + + case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: + + InfoTable = AcpiDmTableInfoHest1; + break; + + case ACPI_HEST_TYPE_IA32_NMI: + + InfoTable = AcpiDmTableInfoHest2; + break; + + case ACPI_HEST_TYPE_AER_ROOT_PORT: + + InfoTable = AcpiDmTableInfoHest6; + break; + + case ACPI_HEST_TYPE_AER_ENDPOINT: + + InfoTable = AcpiDmTableInfoHest7; + break; + + case ACPI_HEST_TYPE_AER_BRIDGE: + + InfoTable = AcpiDmTableInfoHest8; + break; + + case ACPI_HEST_TYPE_GENERIC_ERROR: + + InfoTable = AcpiDmTableInfoHest9; + break; + + default: + + /* Cannot continue on unknown type */ + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HEST"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + + /* + * Additional subtable data - IA32 Error Bank(s) + */ + BankCount = 0; + switch (Type) + { + case ACPI_HEST_TYPE_IA32_CHECK: + + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, + Subtable->Buffer))->NumHardwareBanks; + break; + + case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: + + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, + Subtable->Buffer))->NumHardwareBanks; + break; + + default: + + break; + } + + while (BankCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoHestBank, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + BankCount--; + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileIort + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile IORT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileIort ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_TABLE_IORT *Iort; + ACPI_IORT_NODE *IortNode; + ACPI_IORT_ITS_GROUP *IortItsGroup; + ACPI_IORT_SMMU *IortSmmu; + UINT32 NodeNumber; + UINT32 NodeLength; + UINT32 IdMappingNumber; + UINT32 ItsNumber; + UINT32 ContextIrptNumber; + UINT32 PmuIrptNumber; + UINT32 PaddingLength; + + + ParentTable = DtPeekSubtable (); + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + + /* + * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care + * should be taken to avoid accessing ACPI_TABLE_HADER fields. + */ + Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT, + Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); + + /* + * OptionalPadding - Variable-length data + * (Optional, size = OffsetToNodes - sizeof (ACPI_TABLE_IORT)) + * Optionally allows the generic data types to be used for filling + * this field. + */ + Iort->NodeOffset = sizeof (ACPI_TABLE_IORT); + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + Iort->NodeOffset += Subtable->Length; + } + else + { + Status = DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList), + AcpiDmTableInfoIortHdr[0].Name, &PaddingLength); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + Iort->NodeOffset += PaddingLength; + } + + NodeNumber = 0; + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + IortNode = ACPI_CAST_PTR (ACPI_IORT_NODE, Subtable->Buffer); + NodeLength = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + + switch (IortNode->Type) + { + case ACPI_IORT_NODE_ITS_GROUP: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + IortItsGroup = ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP, Subtable->Buffer); + NodeLength += Subtable->Length; + + ItsNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + ItsNumber++; + } + + IortItsGroup->ItsCount = ItsNumber; + break; + + case ACPI_IORT_NODE_NAMED_COMPONENT: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + + /* + * Padding - Variable-length data + * Optionally allows the offset of the ID mappings to be used + * for filling this field. + */ + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + } + else + { + if (NodeLength > IortNode->MappingOffset) + { + return (AE_BAD_DATA); + } + + if (NodeLength < IortNode->MappingOffset) + { + Status = DtCompilePadding ( + IortNode->MappingOffset - NodeLength, + &Subtable); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength = IortNode->MappingOffset; + } + } + break; + + case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + break; + + case ACPI_IORT_NODE_SMMU: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + IortSmmu = ACPI_CAST_PTR (ACPI_IORT_SMMU, Subtable->Buffer); + NodeLength += Subtable->Length; + + /* Compile global interrupt array */ + + IortSmmu->GlobalInterruptOffset = NodeLength; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + + /* Compile context interrupt array */ + + ContextIrptNumber = 0; + IortSmmu->ContextInterruptOffset = NodeLength; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Subtable) + { + break; + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + ContextIrptNumber++; + } + + IortSmmu->ContextInterruptCount = ContextIrptNumber; + + /* Compile PMU interrupt array */ + + PmuIrptNumber = 0; + IortSmmu->PmuInterruptOffset = NodeLength; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Subtable) + { + break; + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + PmuIrptNumber++; + } + + IortSmmu->PmuInterruptCount = PmuIrptNumber; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT"); + return (AE_ERROR); + } + + /* Compile Array of ID mappings */ + + IortNode->MappingOffset = NodeLength; + IdMappingNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortMap, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Subtable) + { + break; + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength += sizeof (ACPI_IORT_ID_MAPPING); + IdMappingNumber++; + } + + IortNode->MappingCount = IdMappingNumber; + + /* + * Node length can be determined by DT_LENGTH option + * IortNode->Length = NodeLength; + */ + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + NodeNumber++; + } + + Iort->NodeCount = NodeNumber; + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileIvrs + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile IVRS. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileIvrs ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_IVRS_HEADER *IvrsHeader; + UINT8 EntryType; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + IvrsHeader = ACPI_CAST_PTR (ACPI_IVRS_HEADER, Subtable->Buffer); + + switch (IvrsHeader->Type) + { + case ACPI_IVRS_TYPE_HARDWARE: + + InfoTable = AcpiDmTableInfoIvrs0; + break; + + case ACPI_IVRS_TYPE_MEMORY1: + case ACPI_IVRS_TYPE_MEMORY2: + case ACPI_IVRS_TYPE_MEMORY3: + + InfoTable = AcpiDmTableInfoIvrs1; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IVRS"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE) + { + while (*PFieldList && + !strcmp ((*PFieldList)->Name, "Entry Type")) + { + SubtableStart = *PFieldList; + DtCompileInteger (&EntryType, *PFieldList, 1, 0); + + switch (EntryType) + { + /* 4-byte device entries */ + + case ACPI_IVRS_TYPE_PAD4: + case ACPI_IVRS_TYPE_ALL: + case ACPI_IVRS_TYPE_SELECT: + case ACPI_IVRS_TYPE_START: + case ACPI_IVRS_TYPE_END: + + InfoTable = AcpiDmTableInfoIvrs4; + break; + + /* 8-byte entries, type A */ + + case ACPI_IVRS_TYPE_ALIAS_SELECT: + case ACPI_IVRS_TYPE_ALIAS_START: + + InfoTable = AcpiDmTableInfoIvrs8a; + break; + + /* 8-byte entries, type B */ + + case ACPI_IVRS_TYPE_PAD8: + case ACPI_IVRS_TYPE_EXT_SELECT: + case ACPI_IVRS_TYPE_EXT_START: + + InfoTable = AcpiDmTableInfoIvrs8b; + break; + + /* 8-byte entries, type C */ + + case ACPI_IVRS_TYPE_SPECIAL: + + InfoTable = AcpiDmTableInfoIvrs8c; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, + "IVRS Device Entry"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + } + } + + DtPopSubtable (); + } + + return (AE_OK); +} diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c new file mode 100644 index 000000000000..ec2a36f00d67 --- /dev/null +++ b/source/compiler/dttable2.c @@ -0,0 +1,1686 @@ +/****************************************************************************** + * + * Module Name: dttable2.c - handling for specific ACPI tables + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * 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. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * 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 MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +/* Compile all complex data tables, signatures starting with L-Z */ + +#include "aslcompiler.h" +#include "dtcompiler.h" + +#define _COMPONENT DT_COMPILER + ACPI_MODULE_NAME ("dttable2") + + +/****************************************************************************** + * + * FUNCTION: DtCompileLpit + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile LPIT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileLpit ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_LPIT_HEADER *LpitHeader; + + + /* Note: Main table consists only of the standard ACPI table header */ + + while (*PFieldList) + { + SubtableStart = *PFieldList; + + /* LPIT Subtable header */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoLpitHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + LpitHeader = ACPI_CAST_PTR (ACPI_LPIT_HEADER, Subtable->Buffer); + + switch (LpitHeader->Type) + { + case ACPI_LPIT_TYPE_NATIVE_CSTATE: + + InfoTable = AcpiDmTableInfoLpit0; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT"); + return (AE_ERROR); + } + + /* LPIT Subtable */ + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileMadt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile MADT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileMadt ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_SUBTABLE_HEADER *MadtHeader; + ACPI_DMTABLE_INFO *InfoTable; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); + + switch (MadtHeader->Type) + { + case ACPI_MADT_TYPE_LOCAL_APIC: + + InfoTable = AcpiDmTableInfoMadt0; + break; + + case ACPI_MADT_TYPE_IO_APIC: + + InfoTable = AcpiDmTableInfoMadt1; + break; + + case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: + + InfoTable = AcpiDmTableInfoMadt2; + break; + + case ACPI_MADT_TYPE_NMI_SOURCE: + + InfoTable = AcpiDmTableInfoMadt3; + break; + + case ACPI_MADT_TYPE_LOCAL_APIC_NMI: + + InfoTable = AcpiDmTableInfoMadt4; + break; + + case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: + + InfoTable = AcpiDmTableInfoMadt5; + break; + + case ACPI_MADT_TYPE_IO_SAPIC: + + InfoTable = AcpiDmTableInfoMadt6; + break; + + case ACPI_MADT_TYPE_LOCAL_SAPIC: + + InfoTable = AcpiDmTableInfoMadt7; + break; + + case ACPI_MADT_TYPE_INTERRUPT_SOURCE: + + InfoTable = AcpiDmTableInfoMadt8; + break; + + case ACPI_MADT_TYPE_LOCAL_X2APIC: + + InfoTable = AcpiDmTableInfoMadt9; + break; + + case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: + + InfoTable = AcpiDmTableInfoMadt10; + break; + + case ACPI_MADT_TYPE_GENERIC_INTERRUPT: + + InfoTable = AcpiDmTableInfoMadt11; + break; + + case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: + + InfoTable = AcpiDmTableInfoMadt12; + break; + + case ACPI_MADT_TYPE_GENERIC_MSI_FRAME: + + InfoTable = AcpiDmTableInfoMadt13; + break; + + case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: + + InfoTable = AcpiDmTableInfoMadt14; + break; + + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: + + InfoTable = AcpiDmTableInfoMadt15; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileMcfg + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile MCFG. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileMcfg ( + void **List) +{ + ACPI_STATUS Status; + + + Status = DtCompileTwoSubtables (List, + AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileMpst + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile MPST. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileMpst ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + ACPI_MPST_CHANNEL *MpstChannelInfo; + ACPI_MPST_POWER_NODE *MpstPowerNode; + ACPI_MPST_DATA_HDR *MpstDataHeader; + UINT16 SubtableCount; + UINT32 PowerStateCount; + UINT32 ComponentCount; + + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer); + SubtableCount = MpstChannelInfo->PowerNodeCount; + + while (*PFieldList && SubtableCount) + { + /* Subtable: Memory Power Node(s) */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer); + PowerStateCount = MpstPowerNode->NumPowerStates; + ComponentCount = MpstPowerNode->NumPhysicalComponents; + + ParentTable = DtPeekSubtable (); + + /* Sub-subtables - Memory Power State Structure(s) */ + + while (*PFieldList && PowerStateCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0A, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + PowerStateCount--; + } + + /* Sub-subtables - Physical Component ID Structure(s) */ + + while (*PFieldList && ComponentCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0B, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + ComponentCount--; + } + + SubtableCount--; + DtPopSubtable (); + } + + /* Subtable: Count of Memory Power State Characteristic structures */ + + DtPopSubtable (); + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst1, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer); + SubtableCount = MpstDataHeader->CharacteristicsCount; + + ParentTable = DtPeekSubtable (); + + /* Subtable: Memory Power State Characteristics structure(s) */ + + while (*PFieldList && SubtableCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + SubtableCount--; + } + + DtPopSubtable (); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileMsct + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile MSCT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileMsct ( + void **List) +{ + ACPI_STATUS Status; + + + Status = DtCompileTwoSubtables (List, + AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileMtmr + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile MTMR. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileMtmr ( + void **List) +{ + ACPI_STATUS Status; + + + Status = DtCompileTwoSubtables (List, + AcpiDmTableInfoMtmr, AcpiDmTableInfoMtmr0); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileNfit + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile NFIT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileNfit ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_NFIT_HEADER *NfitHeader; + ACPI_DMTABLE_INFO *InfoTable; + UINT32 Count; + ACPI_NFIT_INTERLEAVE *Interleave = NULL; + ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; + + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + /* Subtables */ + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer); + + switch (NfitHeader->Type) + { + case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: + + InfoTable = AcpiDmTableInfoNfit0; + break; + + case ACPI_NFIT_TYPE_MEMORY_MAP: + + InfoTable = AcpiDmTableInfoNfit1; + break; + + case ACPI_NFIT_TYPE_INTERLEAVE: + + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer); + InfoTable = AcpiDmTableInfoNfit2; + break; + + case ACPI_NFIT_TYPE_SMBIOS: + + InfoTable = AcpiDmTableInfoNfit3; + break; + + case ACPI_NFIT_TYPE_CONTROL_REGION: + + InfoTable = AcpiDmTableInfoNfit4; + break; + + case ACPI_NFIT_TYPE_DATA_REGION: + + InfoTable = AcpiDmTableInfoNfit5; + break; + + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer); + InfoTable = AcpiDmTableInfoNfit6; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + + switch (NfitHeader->Type) + { + case ACPI_NFIT_TYPE_INTERLEAVE: + + Count = 0; + DtPushSubtable (Subtable); + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a, + &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Subtable) + { + DtPopSubtable (); + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + Interleave->LineCount = Count; + DtPopSubtable (); + break; + + case ACPI_NFIT_TYPE_SMBIOS: + + if (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + } + } + break; + + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + + Count = 0; + DtPushSubtable (Subtable); + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a, + &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Subtable) + { + DtPopSubtable (); + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + Hint->HintCount = (UINT16) Count; + DtPopSubtable (); + break; + + default: + break; + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompilePcct + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile PCCT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompilePcct ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_SUBTABLE_HEADER *PcctHeader; + ACPI_DMTABLE_INFO *InfoTable; + + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Subtables */ + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcctHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + PcctHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); + + switch (PcctHeader->Type) + { + case ACPI_PCCT_TYPE_GENERIC_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct0; + break; + + case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct1; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompilePmtt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile PMTT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompilePmtt ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_PMTT_HEADER *PmttHeader; + ACPI_PMTT_CONTROLLER *PmttController; + UINT16 DomainCount; + UINT8 PrevType = ACPI_PMTT_TYPE_SOCKET; + + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmttHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + PmttHeader = ACPI_CAST_PTR (ACPI_PMTT_HEADER, Subtable->Buffer); + while (PrevType >= PmttHeader->Type) + { + DtPopSubtable (); + + if (PrevType == ACPI_PMTT_TYPE_SOCKET) + { + break; + } + + PrevType--; + } + + PrevType = PmttHeader->Type; + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + switch (PmttHeader->Type) + { + case ACPI_PMTT_TYPE_SOCKET: + + /* Subtable: Socket Structure */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + break; + + case ACPI_PMTT_TYPE_CONTROLLER: + + /* Subtable: Memory Controller Structure */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER, + (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER))); + DomainCount = PmttController->DomainCount; + + while (DomainCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + DomainCount--; + } + break; + + case ACPI_PMTT_TYPE_DIMM: + + /* Subtable: Physical Component Structure */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PMTT"); + return (AE_ERROR); + } + } + + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileRsdt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile RSDT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileRsdt ( + void **List) +{ + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD *FieldList = *(DT_FIELD **) List; + UINT32 Address; + + + ParentTable = DtPeekSubtable (); + + while (FieldList) + { + DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO); + + DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable); + DtInsertSubtable (ParentTable, Subtable); + FieldList = FieldList->Next; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileS3pt + * + * PARAMETERS: PFieldList - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile S3PT (Pointed to by FPDT) + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileS3pt ( + DT_FIELD **PFieldList) +{ + ACPI_STATUS Status; + ACPI_S3PT_HEADER *S3ptHeader; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + DT_FIELD *SubtableStart; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt, + &Gbl_RootTable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtPushSubtable (Gbl_RootTable); + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3ptHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + S3ptHeader = ACPI_CAST_PTR (ACPI_S3PT_HEADER, Subtable->Buffer); + + switch (S3ptHeader->Type) + { + case ACPI_S3PT_TYPE_RESUME: + + InfoTable = AcpiDmTableInfoS3pt0; + break; + + case ACPI_S3PT_TYPE_SUSPEND: + + InfoTable = AcpiDmTableInfoS3pt1; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "S3PT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileSlic + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile SLIC. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileSlic ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + + + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlic, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileSlit + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile SLIT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileSlit ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *FieldList; + UINT32 Localities; + UINT8 *LocalityBuffer; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); + LocalityBuffer = UtLocalCalloc (Localities); + + /* Compile each locality buffer */ + + FieldList = *PFieldList; + while (FieldList) + { + DtCompileBuffer (LocalityBuffer, + FieldList->Value, FieldList, Localities); + + DtCreateSubtable (LocalityBuffer, Localities, &Subtable); + DtInsertSubtable (ParentTable, Subtable); + FieldList = FieldList->Next; + } + + ACPI_FREE (LocalityBuffer); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileSrat + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile SRAT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileSrat ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_SUBTABLE_HEADER *SratHeader; + ACPI_DMTABLE_INFO *InfoTable; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); + + switch (SratHeader->Type) + { + case ACPI_SRAT_TYPE_CPU_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat0; + break; + + case ACPI_SRAT_TYPE_MEMORY_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat1; + break; + + case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat2; + break; + + case ACPI_SRAT_TYPE_GICC_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat3; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileStao + * + * PARAMETERS: PFieldList - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile STAO. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileStao ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_STATUS Status; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Compile each ASCII namestring as a subtable */ + + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileTcpa + * + * PARAMETERS: PFieldList - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile TCPA. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileTcpa ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + ACPI_TABLE_TCPA_HDR *TcpaHeader; + DT_SUBTABLE *ParentTable; + ACPI_STATUS Status; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* + * Examine the PlatformClass field to determine the table type. + * Either a client or server table. Only one. + */ + TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer); + + switch (TcpaHeader->PlatformClass) + { + case ACPI_TCPA_CLIENT_TABLE: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient, + &Subtable, TRUE); + break; + + case ACPI_TCPA_SERVER_TABLE: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer, + &Subtable, TRUE); + break; + + default: + + AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n", + TcpaHeader->PlatformClass); + Status = AE_ERROR; + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtGetGenericTableInfo + * + * PARAMETERS: Name - Generic type name + * + * RETURN: Info entry + * + * DESCRIPTION: Obtain table info for a generic name entry + * + *****************************************************************************/ + +ACPI_DMTABLE_INFO * +DtGetGenericTableInfo ( + char *Name) +{ + ACPI_DMTABLE_INFO *Info; + UINT32 i; + + + if (!Name) + { + return (NULL); + } + + /* Search info table for name match */ + + for (i = 0; ; i++) + { + Info = AcpiDmTableInfoGeneric[i]; + if (Info->Opcode == ACPI_DMT_EXIT) + { + Info = NULL; + break; + } + + /* Use caseless compare for generic keywords */ + + if (!AcpiUtStricmp (Name, Info->Name)) + { + break; + } + } + + return (Info); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileUefi + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile UEFI. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileUefi ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + UINT16 *DataOffset; + + + /* Compile the predefined portion of the UEFI table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DataOffset = (UINT16 *) (Subtable->Buffer + 16); + *DataOffset = sizeof (ACPI_TABLE_UEFI); + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* + * Compile the "generic" portion of the UEFI table. This + * part of the table is not predefined and any of the generic + * operators may be used. + */ + DtCompileGeneric ((void **) PFieldList, NULL, NULL); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileVrtc + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile VRTC. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileVrtc ( + void **List) +{ + ACPI_STATUS Status; + + + Status = DtCompileTwoSubtables (List, + AcpiDmTableInfoVrtc, AcpiDmTableInfoVrtc0); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileWdat + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile WDAT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileWdat ( + void **List) +{ + ACPI_STATUS Status; + + + Status = DtCompileTwoSubtables (List, + AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileWpbt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile WPBT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileWpbt ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_TABLE_WPBT *Table; + ACPI_STATUS Status; + UINT16 Length; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Compile the argument list subtable */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Extract the length of the Arguments buffer, insert into main table */ + + Length = (UINT16) Subtable->TotalLength; + Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer); + Table->ArgumentsLength = Length; + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileXsdt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile XSDT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileXsdt ( + void **List) +{ + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD *FieldList = *(DT_FIELD **) List; + UINT64 Address; + + + ParentTable = DtPeekSubtable (); + + while (FieldList) + { + DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO); + + DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable); + DtInsertSubtable (ParentTable, Subtable); + FieldList = FieldList->Next; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileGeneric + * + * PARAMETERS: List - Current field list pointer + * Name - Field name to end generic compiling + * Length - Compiled table length to return + * + * RETURN: Status + * + * DESCRIPTION: Compile generic unknown table. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileGeneric ( + void **List, + char *Name, + UINT32 *Length) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + ACPI_DMTABLE_INFO *Info; + + + ParentTable = DtPeekSubtable (); + + /* + * Compile the "generic" portion of the table. This + * part of the table is not predefined and any of the generic + * operators may be used. + */ + + /* Find any and all labels in the entire generic portion */ + + DtDetectAllLabels (*PFieldList); + + /* Now we can actually compile the parse tree */ + + if (Length && *Length) + { + *Length = 0; + } + while (*PFieldList) + { + if (Name && !strcmp ((*PFieldList)->Name, Name)) + { + break; + } + + Info = DtGetGenericTableInfo ((*PFieldList)->Name); + if (!Info) + { + sprintf (MsgBuffer, "Generic data type \"%s\" not found", + (*PFieldList)->Name); + DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, + (*PFieldList), MsgBuffer); + + *PFieldList = (*PFieldList)->Next; + continue; + } + + Status = DtCompileTable (PFieldList, Info, + &Subtable, TRUE); + if (ACPI_SUCCESS (Status)) + { + DtInsertSubtable (ParentTable, Subtable); + if (Length) + { + *Length += Subtable->Length; + } + } + else + { + *PFieldList = (*PFieldList)->Next; + + if (Status == AE_NOT_FOUND) + { + sprintf (MsgBuffer, "Generic data type \"%s\" not found", + (*PFieldList)->Name); + DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, + (*PFieldList), MsgBuffer); + } + } + } + + return (AE_OK); +} diff --git a/source/compiler/dttemplate.c b/source/compiler/dttemplate.c index 3da0692bb086..622e2011038f 100644 --- a/source/compiler/dttemplate.c +++ b/source/compiler/dttemplate.c @@ -189,7 +189,6 @@ GetTemplate: Status = DtCreateOneTemplate (Signature, TableData); - /* Shutdown ACPICA subsystem */ (void) AcpiTerminate (); @@ -235,7 +234,7 @@ DtCreateAllTemplates ( if (TableData->Template) { Status = DtCreateOneTemplate (TableData->Signature, - TableData); + TableData); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/compiler/prexpress.c b/source/compiler/prexpress.c index b7af4121cdbd..ca18c358f54d 100644 --- a/source/compiler/prexpress.c +++ b/source/compiler/prexpress.c @@ -84,6 +84,7 @@ PrUnTokenize ( { return; } + if (Buffer[Length] != '\n') { Buffer[strlen(Buffer)] = ' '; diff --git a/source/compiler/prmacros.c b/source/compiler/prmacros.c index c2781138dfa6..89a553fedf0b 100644 --- a/source/compiler/prmacros.c +++ b/source/compiler/prmacros.c @@ -387,7 +387,8 @@ PrAddMacro ( { UseCount = Args[i].UseCount; - Args[i].Offset[UseCount] = (Token - Gbl_MainTokenBuffer) - MacroBodyOffset; + Args[i].Offset[UseCount] = + (Token - Gbl_MainTokenBuffer) - MacroBodyOffset; DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Macro Arg #%u: %s UseCount %u Offset %u \n", diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index 27eb6be85318..1ba58d14c679 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -499,7 +499,8 @@ PrDoDirective ( case PR_DIRECTIVE_ELSE: case PR_DIRECTIVE_ELIF: - if (Gbl_DirectiveStack && Gbl_DirectiveStack->IgnoringThisCodeBlock) + if (Gbl_DirectiveStack && + Gbl_DirectiveStack->IgnoringThisCodeBlock) { PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name); return; @@ -674,7 +675,8 @@ PrDoDirective ( if (*(&Gbl_CurrentLineBuffer[TokenOffset]) == '(') { #ifndef MACROS_SUPPORTED - AcpiOsPrintf ("%s ERROR - line %u: #define macros are not supported yet\n", + AcpiOsPrintf ( + "%s ERROR - line %u: #define macros are not supported yet\n", Gbl_CurrentLineBuffer, Gbl_LogicalLineNumber); exit(1); #else @@ -692,11 +694,13 @@ PrDoDirective ( { Token2++; } + End = Token2; while (*End != '\n') { End++; } + *End = 0; } else @@ -999,6 +1003,7 @@ PrGetNextLine ( { return (ASL_BLANK_LINE); } + return (AE_OK); } } diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c index d967e5cb19b8..c9e260c8511f 100644 --- a/source/compiler/prutils.c +++ b/source/compiler/prutils.c @@ -122,8 +122,10 @@ PrGetNextToken ( { *Next = NULL; } + return (TokenStart); } + Buffer++; } diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index c9d06f977f83..1a3b8c848bc8 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -117,8 +117,7 @@ AcpiDbConvertToNode ( Node = ACPI_TO_POINTER (Address); if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) { - AcpiOsPrintf ("Address %p is invalid", - Node); + AcpiOsPrintf ("Address %p is invalid", Node); return (NULL); } @@ -127,7 +126,7 @@ AcpiDbConvertToNode ( if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { AcpiOsPrintf ("Address %p is not a valid namespace node [%s]\n", - Node, AcpiUtGetDescriptorName (Node)); + Node, AcpiUtGetDescriptorName (Node)); return (NULL); } } @@ -914,7 +913,7 @@ AcpiDbDeviceResources ( Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - ParentPath = AcpiNsGetExternalPathname (Node); + ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); if (!ParentPath) { return (AE_NO_MEMORY); @@ -1005,7 +1004,7 @@ GetCrs: /* Get the _CRS resource list (test ALLOCATE buffer) */ ReturnBuffer.Pointer = NULL; - ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiGetCurrentResources (Node, &ReturnBuffer); if (ACPI_FAILURE (Status)) @@ -1074,7 +1073,7 @@ GetPrs: } ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; Status = AcpiGetPossibleResources (Node, &ReturnBuffer); if (ACPI_FAILURE (Status)) @@ -1097,7 +1096,7 @@ GetAei: AcpiOsPrintf ("Evaluating _AEI\n"); ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnBuffer); if (ACPI_FAILURE (Status)) @@ -1108,7 +1107,7 @@ GetAei: } ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; Status = AcpiGetEventResources (Node, &ReturnBuffer); if (ACPI_FAILURE (Status)) @@ -1224,8 +1223,8 @@ AcpiDbGenerateGpe ( } } - GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), - GpeNumber); + GpeEventInfo = AcpiEvGetGpeEventInfo ( + ACPI_TO_POINTER (BlockNumber), GpeNumber); if (!GpeEventInfo) { AcpiOsPrintf ("Invalid GPE\n"); @@ -1284,15 +1283,8 @@ AcpiDbTrace ( UINT32 Flags = 0; - if (EnableArg) - { - AcpiUtStrupr (EnableArg); - } - - if (OnceArg) - { - AcpiUtStrupr (OnceArg); - } + AcpiUtStrupr (EnableArg); + AcpiUtStrupr (OnceArg); if (MethodArg) { diff --git a/source/components/debugger/dbconvert.c b/source/components/debugger/dbconvert.c index 058838a42e84..218909e1bbac 100644 --- a/source/components/debugger/dbconvert.c +++ b/source/components/debugger/dbconvert.c @@ -198,7 +198,7 @@ AcpiDbConvertToBuffer ( } j++; - i+=2; + i += 2; while (String[i] && ((String[i] == ',') || (String[i] == ' '))) { diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c index 267ab58fd859..09d1232a74ea 100644 --- a/source/components/debugger/dbdisply.c +++ b/source/components/debugger/dbdisply.c @@ -413,14 +413,13 @@ AcpiDbDisplayMethodInfo ( } ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; + Node = WalkState->MethodNode; AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", - AcpiUtGetNodeName (Node)); + AcpiUtGetNodeName (Node)); AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n", - (UINT32) ObjDesc->Method.ParamCount, - (UINT32) ObjDesc->Method.SyncLevel); - + (UINT32) ObjDesc->Method.ParamCount, + (UINT32) ObjDesc->Method.SyncLevel); RootOp = StartOp; while (RootOp->Common.Parent) @@ -581,7 +580,7 @@ AcpiDbDisplayResults ( } ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; + Node = WalkState->MethodNode; if (WalkState->Results) { @@ -657,7 +656,7 @@ AcpiDbDisplayCallingTree ( * * FUNCTION: AcpiDbDisplayObjectType * - * PARAMETERS: Name - User entered NS node handle or name + * PARAMETERS: ObjectArg - User entered NS node handle * * RETURN: None * @@ -667,21 +666,17 @@ AcpiDbDisplayCallingTree ( void AcpiDbDisplayObjectType ( - char *Name) + char *ObjectArg) { - ACPI_NAMESPACE_NODE *Node; + ACPI_HANDLE Handle; ACPI_DEVICE_INFO *Info; ACPI_STATUS Status; UINT32 i; - Node = AcpiDbConvertToNode (Name); - if (!Node) - { - return; - } + Handle = ACPI_TO_POINTER (strtoul (ObjectArg, NULL, 16)); - Status = AcpiGetObjectInfo (ACPI_CAST_PTR (ACPI_HANDLE, Node), &Info); + Status = AcpiGetObjectInfo (Handle, &Info); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not get object info, %s\n", @@ -689,25 +684,18 @@ AcpiDbDisplayObjectType ( return; } - if (Info->Valid & ACPI_VALID_ADR) - { - AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", - ACPI_FORMAT_UINT64 (Info->Address), - Info->CurrentStatus, Info->Flags); - } - if (Info->Valid & ACPI_VALID_SXDS) - { - AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", - Info->HighestDstates[0], Info->HighestDstates[1], - Info->HighestDstates[2], Info->HighestDstates[3]); - } - if (Info->Valid & ACPI_VALID_SXWS) - { - AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", - Info->LowestDstates[0], Info->LowestDstates[1], - Info->LowestDstates[2], Info->LowestDstates[3], - Info->LowestDstates[4]); - } + AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", + ACPI_FORMAT_UINT64 (Info->Address), + Info->CurrentStatus, Info->Flags); + + AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", + Info->HighestDstates[0], Info->HighestDstates[1], + Info->HighestDstates[2], Info->HighestDstates[3]); + + AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", + Info->LowestDstates[0], Info->LowestDstates[1], + Info->LowestDstates[2], Info->LowestDstates[3], + Info->LowestDstates[4]); if (Info->Valid & ACPI_VALID_HID) { @@ -719,11 +707,6 @@ AcpiDbDisplayObjectType ( AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); } - if (Info->Valid & ACPI_VALID_SUB) - { - AcpiOsPrintf ("SUB: %s\n", Info->SubsystemId.String); - } - if (Info->Valid & ACPI_VALID_CID) { for (i = 0; i < Info->CompatibleIdList.Count; i++) @@ -760,6 +743,13 @@ AcpiDbDisplayResultObject ( ACPI_WALK_STATE *WalkState) { +#ifndef ACPI_APPLICATION + if (AcpiGbl_DbThreadId != AcpiOsGetThreadId()) + { + return; + } +#endif + /* Only display if single stepping */ if (!AcpiGbl_CmSingleStep) @@ -792,6 +782,13 @@ AcpiDbDisplayArgumentObject ( ACPI_WALK_STATE *WalkState) { +#ifndef ACPI_APPLICATION + if (AcpiGbl_DbThreadId != AcpiOsGetThreadId()) + { + return; + } +#endif + if (!AcpiGbl_CmSingleStep) { return; @@ -1171,7 +1168,7 @@ AcpiDbDisplayNonRootHandlers ( return (AE_OK); } - Pathname = AcpiNsGetExternalPathname (Node); + Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); if (!Pathname) { return (AE_OK); diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index af01ca277f41..b2836eb55db8 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -528,8 +528,8 @@ AcpiDbExecute ( /* Dump a _PLD buffer if present */ if (ACPI_COMPARE_NAME ((ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - AcpiGbl_DbMethodInfo.Method)->Name.Ascii), - METHOD_NAME__PLD)) + AcpiGbl_DbMethodInfo.Method)->Name.Ascii), + METHOD_NAME__PLD)) { AcpiDbDumpPldBuffer (ReturnObj.Pointer); } @@ -627,7 +627,8 @@ AcpiDbMethodThread ( if (ReturnObj.Length) { AcpiOsPrintf ("Evaluation of %s returned object %p Buflen %X\n", - Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); + Info->Pathname, ReturnObj.Pointer, + (UINT32) ReturnObj.Length); AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); } #endif @@ -694,7 +695,7 @@ AcpiDbCreateExecutionThreads ( /* Get the arguments */ NumThreads = strtoul (NumThreadsArg, NULL, 0); - NumLoops = strtoul (NumLoopsArg, NULL, 0); + NumLoops = strtoul (NumLoopsArg, NULL, 0); if (!NumThreads || !NumLoops) { @@ -810,7 +811,7 @@ AcpiDbCreateExecutionThreads ( for (i = 0; i < (NumThreads); i++) { - Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbMethodThread, + Status = AcpiOsExecute (OSL_DEBUGGER_EXEC_THREAD, AcpiDbMethodThread, &AcpiGbl_DbMethodInfo); if (ACPI_FAILURE (Status)) { diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index aaeda4527f86..9ce3f2ff6a52 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -46,7 +46,10 @@ #include "accommon.h" #include "acdebug.h" #include "actables.h" - +#include <stdio.h> +#ifdef ACPI_APPLICATION +#include "acapps.h" +#endif #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbfileio") @@ -121,134 +124,35 @@ AcpiDbOpenDebugFile ( #endif -#ifdef ACPI_APPLICATION -#include "acapps.h" - /******************************************************************************* * - * FUNCTION: AeLocalLoadTable + * FUNCTION: AcpiDbLoadTables * - * PARAMETERS: Table - pointer to a buffer containing the entire - * table to be loaded + * PARAMETERS: ListHead - List of ACPI tables to load * * RETURN: Status * - * DESCRIPTION: This function is called to load a table from the caller's - * buffer. The buffer must contain an entire ACPI Table including - * a valid header. The header fields will be verified, and if it - * is determined that the table is invalid, the call will fail. - * - ******************************************************************************/ - -static ACPI_STATUS -AeLocalLoadTable ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (AeLocalLoadTable); - -#if 0 -/* ACPI_TABLE_DESC TableInfo; */ - - if (!Table) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - TableInfo.Pointer = Table; - Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_ALL); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Install the new table into the local data structures */ - - Status = AcpiTbInitTableDescriptor (&TableInfo); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - /* Table already exists, no error */ - - Status = AE_OK; - } - - /* Free table allocated by AcpiTbGetTable */ - - AcpiTbDeleteSingleTable (&TableInfo); - return_ACPI_STATUS (Status); - } - -#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) - - Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode); - if (ACPI_FAILURE (Status)) - { - /* Uninstall table and free the buffer */ - - AcpiTbDeleteTablesByType (ACPI_TABLE_ID_DSDT); - return_ACPI_STATUS (Status); - } -#endif -#endif - - return_ACPI_STATUS (Status); -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetTableFromFile - * - * PARAMETERS: Filename - File where table is located - * ReturnTable - Where a pointer to the table is returned - * - * RETURN: Status - * - * DESCRIPTION: Load an ACPI table from a file + * DESCRIPTION: Load ACPI tables from a previously constructed table list. * ******************************************************************************/ ACPI_STATUS -AcpiDbGetTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **ReturnTable, - BOOLEAN MustBeAmlFile) +AcpiDbLoadTables ( + ACPI_NEW_TABLE_DESC *ListHead) { -#ifdef ACPI_APPLICATION ACPI_STATUS Status; + ACPI_NEW_TABLE_DESC *TableListHead; ACPI_TABLE_HEADER *Table; - BOOLEAN IsAmlTable = TRUE; - Status = AcpiUtReadTableFromFile (Filename, &Table); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (MustBeAmlFile) - { - IsAmlTable = AcpiUtIsAmlTable (Table); - if (!IsAmlTable) - { - ACPI_EXCEPTION ((AE_INFO, AE_OK, - "Input for -e is not an AML table: " - "\"%4.4s\" (must be DSDT/SSDT)", - Table->Signature)); - return (AE_TYPE); - } - } + /* Load all ACPI tables in the list */ - if (IsAmlTable) + TableListHead = ListHead; + while (TableListHead) { - /* Attempt to recognize and install the table */ + Table = TableListHead->Table; - Status = AeLocalLoadTable (Table); + Status = AcpiLoadTable (Table); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) @@ -265,20 +169,12 @@ AcpiDbGetTableFromFile ( return (Status); } - AcpiTbPrintTableHeader (0, Table); - fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n", Table->Signature); - } - AcpiGbl_AcpiHardwarePresent = FALSE; - if (ReturnTable) - { - *ReturnTable = Table; + TableListHead = TableListHead->Next; } - -#endif /* ACPI_APPLICATION */ return (AE_OK); } diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 1b9a9175e294..68043cbed6f8 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -45,6 +45,9 @@ #include "accommon.h" #include "acdebug.h" +#ifdef ACPI_APPLICATION +#include "acapps.h" +#endif #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbinput") @@ -679,10 +682,7 @@ AcpiDbGetLine ( /* Uppercase the actual command */ - if (AcpiGbl_DbArgs[0]) - { - AcpiUtStrupr (AcpiGbl_DbArgs[0]); - } + AcpiUtStrupr (AcpiGbl_DbArgs[0]); Count = i; if (Count) @@ -762,7 +762,7 @@ AcpiDbCommandDispatch ( /* If AcpiTerminate has been called, terminate this thread */ - if (AcpiGbl_DbTerminateThreads) + if (AcpiGbl_DbTerminateLoop) { return (AE_CTRL_TERMINATE); } @@ -942,8 +942,8 @@ AcpiDbCommandDispatch ( else if (ParamCount == 2) { Temp = AcpiGbl_DbConsoleDebugLevel; - AcpiGbl_DbConsoleDebugLevel = strtoul (AcpiGbl_DbArgs[1], - NULL, 16); + AcpiGbl_DbConsoleDebugLevel = + strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel); @@ -1119,8 +1119,16 @@ AcpiDbCommandDispatch ( break; case CMD_LOAD: + { + ACPI_NEW_TABLE_DESC *ListHead = NULL; - Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL, FALSE); + Status = AcpiAcGetAllTablesFromFile (AcpiGbl_DbArgs[1], + ACPI_GET_ALL_TABLES, &ListHead); + if (ACPI_SUCCESS (Status)) + { + AcpiDbLoadTables (ListHead); + } + } break; case CMD_OPEN: @@ -1140,6 +1148,7 @@ AcpiDbCommandDispatch ( * re-creating the semaphores! */ + AcpiGbl_DbTerminateLoop = TRUE; /* AcpiInitialize (NULL); */ break; @@ -1184,7 +1193,7 @@ AcpiDbCommandDispatch ( #ifdef ACPI_APPLICATION AcpiDbCloseDebugFile (); #endif - AcpiGbl_DbTerminateThreads = TRUE; + AcpiGbl_DbTerminateLoop = TRUE; return (AE_CTRL_TERMINATE); case CMD_NOT_FOUND: @@ -1224,7 +1233,7 @@ AcpiDbExecuteThread ( ACPI_STATUS MStatus; - while (Status != AE_CTRL_TERMINATE) + while (Status != AE_CTRL_TERMINATE && !AcpiGbl_DbTerminateLoop) { AcpiGbl_MethodExecuting = FALSE; AcpiGbl_StepToNextCall = FALSE; @@ -1240,6 +1249,7 @@ AcpiDbExecuteThread ( AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete); } + AcpiGbl_DbThreadsTerminated = TRUE; } @@ -1294,7 +1304,7 @@ AcpiDbUserCommands ( /* TBD: [Restructure] Need a separate command line buffer for step mode */ - while (!AcpiGbl_DbTerminateThreads) + while (!AcpiGbl_DbTerminateLoop) { /* Force output to console until a command is entered */ @@ -1330,10 +1340,6 @@ AcpiDbUserCommands ( * and wait for the command to complete. */ AcpiOsReleaseMutex (AcpiGbl_DbCommandReady); - if (ACPI_FAILURE (Status)) - { - return (Status); - } Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete, ACPI_WAIT_FOREVER); @@ -1350,14 +1356,5 @@ AcpiDbUserCommands ( } } - /* Shut down the debugger */ - - AcpiTerminateDebugger (); - - /* - * Only this thread (the original thread) should actually terminate the - * subsystem, because all the semaphores are deleted during termination - */ - Status = AcpiTerminate (); return (Status); } diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index ee13baef979c..6351b2a0d132 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -89,7 +89,7 @@ AcpiDbSetMethodBreakpoint ( Address = strtoul (Location, NULL, 16); AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, - WalkState->ParserState.AmlStart); + WalkState->ParserState.AmlStart); if (Address <= AmlOffset) { AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index 6b41dc6ea2a7..f9b192574c25 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -198,7 +198,7 @@ AcpiDbSetScope ( /* Build the final pathname */ if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf), - Name)) + Name)) { Status = AE_BUFFER_OVERFLOW; goto ErrorExit; @@ -499,7 +499,7 @@ AcpiDbWalkForPredefinedNames ( return (AE_OK); } - Pathname = AcpiNsGetExternalPathname (Node); + Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); if (!Pathname) { return (AE_OK); @@ -560,7 +560,8 @@ AcpiDbCheckPredefinedNames ( /* Search all nodes in namespace */ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL); + ACPI_UINT32_MAX, AcpiDbWalkForPredefinedNames, + NULL, (void *) &Count, NULL); AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count); } @@ -962,7 +963,7 @@ AcpiDbBusWalk ( /* Exit if there is no _PRT under this device */ Status = AcpiGetHandle (Node, METHOD_NAME__PRT, - ACPI_CAST_PTR (ACPI_HANDLE, &TempNode)); + ACPI_CAST_PTR (ACPI_HANDLE, &TempNode)); if (ACPI_FAILURE (Status)) { return (AE_OK); diff --git a/source/components/debugger/dbobject.c b/source/components/debugger/dbobject.c index 019e8115fc0d..da9ff396101b 100644 --- a/source/components/debugger/dbobject.c +++ b/source/components/debugger/dbobject.c @@ -495,7 +495,8 @@ AcpiDbDecodeLocals ( } else { - AcpiOsPrintf ("No Local Variables are initialized for method [%4.4s]\n", + AcpiOsPrintf ( + "No Local Variables are initialized for method [%4.4s]\n", AcpiUtGetNodeName (Node)); } } @@ -572,7 +573,8 @@ AcpiDbDecodeArguments ( } else { - AcpiOsPrintf ("No Arguments are initialized for method [%4.4s]\n", + AcpiOsPrintf ( + "No Arguments are initialized for method [%4.4s]\n", AcpiUtGetNodeName (Node)); } } diff --git a/source/components/debugger/dbstats.c b/source/components/debugger/dbstats.c index e1ff8bb00c3c..cc781762956c 100644 --- a/source/components/debugger/dbstats.c +++ b/source/components/debugger/dbstats.c @@ -339,7 +339,7 @@ AcpiDbClassifyOneObject ( Op = AcpiPsGetDepthNext (Root, Op); SizeOfParseTree = (NumGrammarElements - NumMethodElements) * - (UINT32) sizeof (ACPI_PARSE_OBJECT); + (UINT32) sizeof (ACPI_PARSE_OBJECT); SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT); SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE); SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT); @@ -439,6 +439,7 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i), AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]); } + AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown", AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc); diff --git a/source/components/debugger/dbtest.c b/source/components/debugger/dbtest.c index 840d371d11c0..83a2c9ec6312 100644 --- a/source/components/debugger/dbtest.c +++ b/source/components/debugger/dbtest.c @@ -980,7 +980,8 @@ AcpiDbEvaluateAllPredefinedNames ( ACPI_UINT32_MAX, AcpiDbEvaluateOnePredefinedName, NULL, (void *) &Info, NULL); - AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count); + AcpiOsPrintf ( + "Evaluated %u predefined names in the namespace\n", Info.Count); } @@ -1033,7 +1034,7 @@ AcpiDbEvaluateOnePredefinedName ( return (AE_OK); } - Pathname = AcpiNsGetExternalPathname (Node); + Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); if (!Pathname) { return (AE_OK); diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c index 90fd949cf445..4d4ee60ab4f7 100644 --- a/source/components/debugger/dbutils.c +++ b/source/components/debugger/dbutils.c @@ -199,6 +199,7 @@ AcpiDbDumpExternalObject ( { AcpiOsPrintf ("\n"); } + AcpiUtDebugDumpBuffer ( ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), ObjDesc->Buffer.Length, DB_BYTE_DISPLAY, _COMPONENT); diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c index 9e7c31d6c0c8..cc636dece49a 100644 --- a/source/components/debugger/dbxface.c +++ b/source/components/debugger/dbxface.c @@ -152,6 +152,40 @@ AcpiDbStartCommand ( /******************************************************************************* * + * FUNCTION: AcpiDbSignalBreakPoint + * + * PARAMETERS: WalkState - Current walk + * + * RETURN: Status + * + * DESCRIPTION: Called for AML_BREAK_POINT_OP + * + ******************************************************************************/ + +void +AcpiDbSignalBreakPoint ( + ACPI_WALK_STATE *WalkState) +{ + +#ifndef ACPI_APPLICATION + if (AcpiGbl_DbThreadId != AcpiOsGetThreadId ()) + { + return; + } +#endif + + /* + * Set the single-step flag. This will cause the debugger (if present) + * to break to the console within the AML debugger at the start of the + * next AML instruction. + */ + AcpiGbl_CmSingleStep = TRUE; + AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbSingleStep * * PARAMETERS: WalkState - Current walk @@ -181,6 +215,13 @@ AcpiDbSingleStep ( ACPI_FUNCTION_ENTRY (); +#ifndef ACPI_APPLICATION + if (AcpiGbl_DbThreadId != AcpiOsGetThreadId ()) + { + return (AE_OK); + } +#endif + /* Check the abort flag */ if (AcpiGbl_AbortMethod) @@ -439,6 +480,10 @@ AcpiInitializeDebugger ( AcpiGbl_DbScopeBuf [1] = 0; AcpiGbl_DbScopeNode = AcpiGbl_RootNode; + /* Initialize user commands loop */ + + AcpiGbl_DbTerminateLoop = FALSE; + /* * If configured for multi-thread support, the debug executor runs in * a separate thread so that the front end can be in another address @@ -466,15 +511,21 @@ AcpiInitializeDebugger ( /* Create the debug execution thread to execute commands */ - Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, + AcpiGbl_DbThreadsTerminated = FALSE; + Status = AcpiOsExecute (OSL_DEBUGGER_MAIN_THREAD, AcpiDbExecuteThread, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not start debugger thread")); + AcpiGbl_DbThreadsTerminated = TRUE; return_ACPI_STATUS (Status); } } + else + { + AcpiGbl_DbThreadId = AcpiOsGetThreadId (); + } return_ACPI_STATUS (AE_OK); } @@ -499,6 +550,22 @@ AcpiTerminateDebugger ( void) { + /* Terminate the AML Debugger */ + + AcpiGbl_DbTerminateLoop = TRUE; + + if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) + { + AcpiOsReleaseMutex (AcpiGbl_DbCommandReady); + + /* Wait the AML Debugger threads */ + + while (!AcpiGbl_DbThreadsTerminated) + { + AcpiOsSleep (100); + } + } + if (AcpiGbl_DbBuffer) { AcpiOsFree (AcpiGbl_DbBuffer); @@ -511,3 +578,25 @@ AcpiTerminateDebugger ( } ACPI_EXPORT_SYMBOL (AcpiTerminateDebugger) + + +/******************************************************************************* + * + * FUNCTION: AcpiSetDebuggerThreadId + * + * PARAMETERS: ThreadId - Debugger thread ID + * + * RETURN: None + * + * DESCRIPTION: Set debugger thread ID + * + ******************************************************************************/ + +void +AcpiSetDebuggerThreadId ( + ACPI_THREAD_ID ThreadId) +{ + AcpiGbl_DbThreadId = ThreadId; +} + +ACPI_EXPORT_SYMBOL (AcpiSetDebuggerThreadId) diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 7bab89fe4140..596dbf12f48c 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -254,7 +254,8 @@ AcpiDmByteList ( { case ACPI_DASM_RESOURCE: - AcpiDmResourceTemplate (Info, Op->Common.Parent, ByteData, ByteCount); + AcpiDmResourceTemplate ( + Info, Op->Common.Parent, ByteData, ByteCount); break; case ACPI_DASM_STRING: @@ -751,13 +752,17 @@ AcpiDmPldBuffer ( AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Lid", PldInfo->Lid); AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Panel", AcpiDmFindNameByIndex(PldInfo->Panel, DmPanelList)); + AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_VerticalPosition", AcpiDmFindNameByIndex(PldInfo->VerticalPosition, DmVerticalPositionList)); + AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_HorizontalPosition", AcpiDmFindNameByIndex(PldInfo->HorizontalPosition, DmHorizontalPositionList)); + AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Shape", AcpiDmFindNameByIndex(PldInfo->Shape, DmShapeList)); AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupOrientation", PldInfo->GroupOrientation); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupToken", PldInfo->GroupToken); AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupPosition", PldInfo->GroupPosition); AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Bay", PldInfo->Bay); diff --git a/source/components/disassembler/dmcstyle.c b/source/components/disassembler/dmcstyle.c index 7616723d9a9e..4402eb09a44c 100644 --- a/source/components/disassembler/dmcstyle.c +++ b/source/components/disassembler/dmcstyle.c @@ -685,6 +685,7 @@ AcpiDmGetCompoundSymbol ( default: /* No operator string for all other opcodes */ + return (NULL); } diff --git a/source/components/disassembler/dmdeferred.c b/source/components/disassembler/dmdeferred.c index 35d5650f82ee..c8bf5f10fde1 100644 --- a/source/components/disassembler/dmdeferred.c +++ b/source/components/disassembler/dmdeferred.c @@ -105,7 +105,8 @@ AcpiDmParseDeferredOps ( case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: - Status = AcpiDmDeferredParse (Op, Op->Named.Data, Op->Named.Length); + Status = AcpiDmDeferredParse ( + Op, Op->Named.Data, Op->Named.Length); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/components/disassembler/dmnames.c b/source/components/disassembler/dmnames.c index 99ca38e20fe7..022541e4c5f7 100644 --- a/source/components/disassembler/dmnames.c +++ b/source/components/disassembler/dmnames.c @@ -155,15 +155,15 @@ AcpiPsDisplayObjectPathname ( /* Node not defined in this scope, look it up */ Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); if (ACPI_FAILURE (Status)) { /* - * We can't get the pathname since the object - * is not in the namespace. This can happen during single - * stepping where a dynamic named object is *about* to be created. + * We can't get the pathname since the object is not in the + * namespace. This can happen during single stepping + * where a dynamic named object is *about* to be created. */ AcpiOsPrintf (" [Path not found]"); goto Exit; @@ -269,6 +269,7 @@ AcpiDmNamestring ( AcpiOsPrintf ("."); } + Name += ACPI_NAME_SIZE; } } @@ -332,7 +333,6 @@ AcpiDmDisplayPath ( } Prev = NULL; /* Start with Root Node */ - while (Prev != Op) { /* Search upwards in the tree to find scope with "prev" as its parent */ @@ -390,6 +390,7 @@ AcpiDmDisplayPath ( DoDot = TRUE; } } + Prev = Search; } } diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index 1d52cd794c3d..02c51bdefa41 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -820,7 +820,9 @@ AcpiDmDisassembleOneOp ( } else if (Status == AE_AML_NO_RESOURCE_END_TAG) { - AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ "); + AcpiOsPrintf ( + "/**** Is ResourceTemplate, " + "but EndTag not at buffer end ****/ "); } } @@ -895,7 +897,8 @@ AcpiDmDisassembleOneOp ( if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP) { - AcpiOsPrintf (" (0x%2.2X)", (unsigned) ((Op->Common.Value.Integer >> 16) & 0xFF)); + AcpiOsPrintf (" (0x%2.2X)", (unsigned) + ((Op->Common.Value.Integer >> 16) & 0xFF)); } AcpiOsPrintf (")"); diff --git a/source/components/disassembler/dmresrc.c b/source/components/disassembler/dmresrc.c index a12f0a95b7bd..f1c9f5968a99 100644 --- a/source/components/disassembler/dmresrc.c +++ b/source/components/disassembler/dmresrc.c @@ -212,6 +212,7 @@ AcpiDmBitList ( { AcpiOsPrintf (","); } + Previous = TRUE; AcpiOsPrintf ("%u", i); } @@ -285,7 +286,8 @@ AcpiDmResourceTemplate ( Status = AcpiUtValidateResource (NULL, Aml, &ResourceIndex); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n", + AcpiOsPrintf ( + "/*** Could not validate Resource, type (%X) %s***/\n", ResourceType, AcpiFormatException (Status)); return; } @@ -335,7 +337,8 @@ AcpiDmResourceTemplate ( AcpiDmIndent (Level); AcpiOsPrintf ( - "/*** Disassembler: inserted missing EndDependentFn () ***/\n"); + "/*** Disassembler: inserted " + "missing EndDependentFn () ***/\n"); } return; diff --git a/source/components/disassembler/dmresrcl.c b/source/components/disassembler/dmresrcl.c index 9a02058f3eeb..37c38f784431 100644 --- a/source/components/disassembler/dmresrcl.c +++ b/source/components/disassembler/dmresrcl.c @@ -307,7 +307,8 @@ AcpiDmAddressCommon ( if ((ResourceType > 2) && (ResourceType < 0xC0)) { - AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType); + AcpiOsPrintf ( + "/**** Invalid Resource Type: 0x%X ****/", ResourceType); return; } @@ -327,7 +328,8 @@ AcpiDmAddressCommon ( /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */ - AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]); + AcpiOsPrintf ("%s (", + AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]); /* Decode the general and type-specific flags */ @@ -340,7 +342,8 @@ AcpiDmAddressCommon ( AcpiDmIoFlags (Flags); if (ResourceType == ACPI_IO_RANGE) { - AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]); + AcpiOsPrintf (" %s,", + AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]); } } } @@ -735,7 +738,8 @@ AcpiDmExtendedDescriptor ( /* Dump resource name and flags */ - AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level); + AcpiDmAddressCommon ( + Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level); /* Dump the 5 contiguous QWORD values */ @@ -871,10 +875,12 @@ AcpiDmFixedMemory32Descriptor ( AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]); AcpiDmIndent (Level + 1); - AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base"); + AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, + "Address Base"); AcpiDmIndent (Level + 1); - AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length"); + AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, + "Address Length"); /* Insert a descriptor name */ diff --git a/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c index 76ef29975e39..60161e69b823 100644 --- a/source/components/disassembler/dmresrcl2.c +++ b/source/components/disassembler/dmresrcl2.c @@ -152,6 +152,7 @@ AcpiDmDumpRawDataBuffer ( AcpiOsPrintf (", "); } + AcpiOsPrintf ("\n"); AcpiDmIndent (Level + 2); @@ -197,7 +198,8 @@ AcpiDmGpioCommon ( AcpiDmIndent (Level + 1); if (Resource->Gpio.ResSourceOffset) { - DeviceName = ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset), + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->Gpio.ResSourceOffset), AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); } @@ -241,13 +243,15 @@ AcpiDmGpioCommon ( for (i = 0; i < PinCount; i++) { AcpiDmIndent (Level + 2); - AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], ((i + 1) < PinCount) ? "," : ""); + AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], + ((i + 1) < PinCount) ? "," : ""); } AcpiDmIndent (Level + 1); AcpiOsPrintf ("}\n"); - MpSaveGpioInfo (Info->MappingOp, Resource, PinCount, PinList, DeviceName); + MpSaveGpioInfo (Info->MappingOp, Resource, + PinCount, PinList, DeviceName); } diff --git a/source/components/disassembler/dmresrcs.c b/source/components/disassembler/dmresrcs.c index d1165b16c297..705319dc793d 100644 --- a/source/components/disassembler/dmresrcs.c +++ b/source/components/disassembler/dmresrcs.c @@ -171,7 +171,8 @@ AcpiDmFixedDmaDescriptor ( } else { - AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ", Resource->FixedDma.Width); + AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ", + Resource->FixedDma.Width); } /* Insert a descriptor name */ diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 8cbc1c3f9a7e..4a094789a703 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -464,7 +464,7 @@ AcpiDmDescendingOp ( if (Info->WalkState) { AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, - Info->WalkState->ParserState.AmlStart); + Info->WalkState->ParserState.AmlStart); if (AcpiGbl_DmOpt_Verbose) { AcpiOsPrintf (DB_FULL_OP_INFO, @@ -487,8 +487,8 @@ AcpiDmDescendingOp ( } } else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && - (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) + (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && + (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list, @@ -906,8 +906,8 @@ AcpiDmAscendingOp ( if (!AcpiDmCommaIfListMember (Op)) { if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && - (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) + (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && + (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list @@ -968,8 +968,8 @@ AcpiDmAscendingOp ( if (!AcpiDmCommaIfListMember (Op)) { if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && - (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) + (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && + (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list diff --git a/source/components/dispatcher/dsargs.c b/source/components/dispatcher/dsargs.c index 5d2d5f5684ad..353d9c1c2170 100644 --- a/source/components/dispatcher/dsargs.c +++ b/source/components/dispatcher/dsargs.c @@ -114,7 +114,7 @@ AcpiDsExecuteArguments ( } Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); + AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -161,7 +161,7 @@ AcpiDsExecuteArguments ( /* Execute the opcode and arguments */ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_EXECUTE); + AmlLength, NULL, ACPI_IMODE_EXECUTE); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -214,8 +214,8 @@ AcpiDsGetBufferFieldArguments ( ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); Node = ObjDesc->BufferField.Node; - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, - Node, NULL)); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( + ACPI_TYPE_BUFFER_FIELD, Node, NULL)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", AcpiUtGetNodeName (Node))); @@ -223,7 +223,7 @@ AcpiDsGetBufferFieldArguments ( /* Execute the AML code for the TermArg arguments */ Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); return_ACPI_STATUS (Status); } @@ -263,8 +263,8 @@ AcpiDsGetBankFieldArguments ( ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); Node = ObjDesc->BankField.Node; - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, - Node, NULL)); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( + ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", AcpiUtGetNodeName (Node))); @@ -272,7 +272,7 @@ AcpiDsGetBankFieldArguments ( /* Execute the AML code for the TermArg arguments */ Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); return_ACPI_STATUS (Status); } @@ -312,7 +312,8 @@ AcpiDsGetBufferArguments ( if (!Node) { ACPI_ERROR ((AE_INFO, - "No pointer back to namespace node in buffer object %p", ObjDesc)); + "No pointer back to namespace node in buffer object %p", + ObjDesc)); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -321,7 +322,7 @@ AcpiDsGetBufferArguments ( /* Execute the AML code for the TermArg arguments */ Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); + ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); return_ACPI_STATUS (Status); } @@ -370,7 +371,7 @@ AcpiDsGetPackageArguments ( /* Execute the AML code for the TermArg arguments */ Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); + ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); return_ACPI_STATUS (Status); } @@ -415,22 +416,23 @@ AcpiDsGetRegionArguments ( Node = ObjDesc->Region.Node; - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL)); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( + ACPI_TYPE_REGION, Node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[%4.4s] OpRegion Arg Init at AML %p\n", AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart)); /* Execute the argument AML */ Status = AcpiDsExecuteArguments (Node, ExtraDesc->Extra.ScopeNode, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId, - ObjDesc->Region.Address, ObjDesc->Region.Length, - Node); + ObjDesc->Region.Address, ObjDesc->Region.Length, Node); return_ACPI_STATUS (Status); } diff --git a/source/components/dispatcher/dscontrol.c b/source/components/dispatcher/dscontrol.c index fed1f4a9ed3f..f5344e83a0c5 100644 --- a/source/components/dispatcher/dscontrol.c +++ b/source/components/dispatcher/dscontrol.c @@ -47,6 +47,7 @@ #include "amlcode.h" #include "acdispat.h" #include "acinterp.h" +#include "acdebug.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dscontrol") @@ -119,9 +120,12 @@ AcpiDsExecBeginControlOp ( * Save a pointer to the predicate for multiple executions * of a loop */ - ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1; - ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd; - ControlState->Control.Opcode = Op->Common.AmlOpcode; + ControlState->Control.AmlPredicateStart = + WalkState->ParserState.Aml - 1; + ControlState->Control.PackageEnd = + WalkState->ParserState.PkgEnd; + ControlState->Control.Opcode = + Op->Common.AmlOpcode; /* Push the control state on this walk's control stack */ @@ -232,7 +236,8 @@ AcpiDsExecEndControlOp ( * another time */ Status = AE_CTRL_PENDING; - WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; + WalkState->AmlLastWhile = + ControlState->Control.AmlPredicateStart; break; } @@ -276,7 +281,8 @@ AcpiDsExecEndControlOp ( * an arg or local), resolve it now because it may * cease to exist at the end of the method. */ - Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); + Status = AcpiExResolveToValue ( + &WalkState->Operands [0], WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -305,11 +311,15 @@ AcpiDsExecEndControlOp ( * Allow references created by the Index operator to return * unchanged. */ - if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) && - ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX)) + if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == + ACPI_DESC_TYPE_OPERAND) && + ((WalkState->Results->Results.ObjDesc [0])->Common.Type == + ACPI_TYPE_LOCAL_REFERENCE) && + ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != + ACPI_REFCLASS_INDEX)) { - Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); + Status = AcpiExResolveToValue ( + &WalkState->Results->Results.ObjDesc [0], WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -327,9 +337,9 @@ AcpiDsExecEndControlOp ( AcpiUtRemoveReference (WalkState->Operands [0]); } - WalkState->Operands [0] = NULL; - WalkState->NumOperands = 0; - WalkState->ReturnDesc = NULL; + WalkState->Operands[0] = NULL; + WalkState->NumOperands = 0; + WalkState->ReturnDesc = NULL; } @@ -350,20 +360,12 @@ AcpiDsExecEndControlOp ( case AML_BREAK_POINT_OP: - /* - * Set the single-step flag. This will cause the debugger (if present) - * to break to the console within the AML debugger at the start of the - * next AML instruction. - */ - ACPI_DEBUGGER_EXEC ( - AcpiGbl_CmSingleStep = TRUE); - ACPI_DEBUGGER_EXEC ( - AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n")); + AcpiDbSignalBreakPoint (WalkState); /* Call to the OSL in case OS wants a piece of the action */ Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, - "Executed AML Breakpoint opcode"); + "Executed AML Breakpoint opcode"); break; case AML_BREAK_OP: @@ -387,7 +389,8 @@ AcpiDsExecEndControlOp ( /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */ - WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd; + WalkState->AmlLastWhile = + WalkState->ControlState->Control.PackageEnd; /* Return status depending on opcode */ diff --git a/source/components/dispatcher/dsdebug.c b/source/components/dispatcher/dsdebug.c index b28f44362087..87c31c2d1941 100644 --- a/source/components/dispatcher/dsdebug.c +++ b/source/components/dispatcher/dsdebug.c @@ -175,6 +175,7 @@ AcpiDsDumpMethodStack ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "\n**** Exception %s during execution of method ", AcpiFormatException (Status))); + AcpiDsPrintNodePathname (WalkState->MethodNode, NULL); /* Display stack of executing methods */ @@ -191,8 +192,8 @@ AcpiDsDumpMethodStack ( if (MethodDesc) { AcpiExStopTraceMethod ( - (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, - MethodDesc, WalkState); + (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, + MethodDesc, WalkState); } ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, @@ -220,8 +221,8 @@ AcpiDsDumpMethodStack ( { /* * This method has called another method - * NOTE: the method call parse subtree is already deleted at this - * point, so we cannot disassemble the method invocation. + * NOTE: the method call parse subtree is already deleted at + * this point, so we cannot disassemble the method invocation. */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Call to method ")); AcpiDsPrintNodePathname (PreviousMethod, NULL); diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index 69437de24982..c4477fa3962a 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -115,6 +115,7 @@ AcpiDsCreateExternalRegion ( * insert the name into the namespace. */ AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_REGION, 0, 0); + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_REGION, ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, Node); if (ACPI_FAILURE (Status)) @@ -210,7 +211,7 @@ AcpiDsCreateBufferField ( /* Creating new namespace node, should not already exist */ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; + ACPI_NS_ERROR_IF_FOUND; /* * Mark node temporary if we are executing a normal control @@ -224,9 +225,9 @@ AcpiDsCreateBufferField ( /* Enter the NameString into the namespace */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &Node); + Status = AcpiNsLookup (WalkState->ScopeInfo, + Arg->Common.Value.String, ACPI_TYPE_ANY, + ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); @@ -267,13 +268,13 @@ AcpiDsCreateBufferField ( } /* - * Remember location in AML stream of the field unit opcode and operands -- - * since the buffer and index operands must be evaluated. + * Remember location in AML stream of the field unit opcode and operands + * -- since the buffer and index operands must be evaluated. */ - SecondDesc = ObjDesc->Common.NextObject; - SecondDesc->Extra.AmlStart = Op->Named.Data; + SecondDesc = ObjDesc->Common.NextObject; + SecondDesc->Extra.AmlStart = Op->Named.Data; SecondDesc->Extra.AmlLength = Op->Named.Length; - ObjDesc->BufferField.Node = Node; + ObjDesc->BufferField.Node = Node; /* Attach constructed field descriptors to parent node */ @@ -341,8 +342,8 @@ AcpiDsGetFieldNames ( { case AML_INT_RESERVEDFIELD_OP: - Position = (UINT64) Info->FieldBitPosition - + (UINT64) Arg->Common.Value.Size; + Position = (UINT64) Info->FieldBitPosition + + (UINT64) Arg->Common.Value.Size; if (Position > ACPI_UINT32_MAX) { @@ -375,11 +376,13 @@ AcpiDsGetFieldNames ( /* AccessAttribute (AttribQuick, AttribByte, etc.) */ - Info->Attribute = (UINT8) ((Arg->Common.Value.Integer >> 8) & 0xFF); + Info->Attribute = (UINT8) + ((Arg->Common.Value.Integer >> 8) & 0xFF); /* AccessLength (for serial/buffer protocols) */ - Info->AccessLength = (UINT8) ((Arg->Common.Value.Integer >> 16) & 0xFF); + Info->AccessLength = (UINT8) + ((Arg->Common.Value.Integer >> 16) & 0xFF); break; case AML_INT_CONNECTION_OP: @@ -406,9 +409,9 @@ AcpiDsGetFieldNames ( /* Lookup the Connection() namepath, it should already exist */ Status = AcpiNsLookup (WalkState->ScopeInfo, - Child->Common.Value.Name, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->ConnectionNode); + Child->Common.Value.Name, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Info->ConnectionNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Child->Common.Value.Name, Status); @@ -422,9 +425,9 @@ AcpiDsGetFieldNames ( /* Lookup the name, it should already exist */ Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, Info->FieldType, - ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->FieldNode); + (char *) &Arg->Named.Name, Info->FieldType, + ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Info->FieldNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); @@ -453,8 +456,8 @@ AcpiDsGetFieldNames ( /* Keep track of bit position for the next field */ - Position = (UINT64) Info->FieldBitPosition - + (UINT64) Arg->Common.Value.Size; + Position = (UINT64) Info->FieldBitPosition + + (UINT64) Arg->Common.Value.Size; if (Position > ACPI_UINT32_MAX) { @@ -471,7 +474,8 @@ AcpiDsGetFieldNames ( default: ACPI_ERROR ((AE_INFO, - "Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode)); + "Invalid opcode in field list: 0x%X", + Arg->Common.AmlOpcode)); return_ACPI_STATUS (AE_AML_BAD_OPCODE); } @@ -517,8 +521,8 @@ AcpiDsCreateField ( if (!RegionNode) { Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); + ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); #ifdef ACPI_ASL_COMPILER Status = AcpiDsCreateExternalRegion (Status, Arg, Arg->Common.Value.Name, WalkState, &RegionNode); @@ -624,7 +628,7 @@ AcpiDsInitFieldObjects ( /* Creating new namespace node(s), should not already exist */ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; + ACPI_NS_ERROR_IF_FOUND; /* * Mark node(s) temporary if we are executing a normal control @@ -649,8 +653,8 @@ AcpiDsInitFieldObjects ( if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &Node); + (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, + Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); @@ -710,8 +714,8 @@ AcpiDsCreateBankField ( if (!RegionNode) { Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); + ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); #ifdef ACPI_ASL_COMPILER Status = AcpiDsCreateExternalRegion (Status, Arg, Arg->Common.Value.Name, WalkState, &RegionNode); @@ -727,8 +731,8 @@ AcpiDsCreateBankField ( Arg = Arg->Common.Next; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); @@ -754,11 +758,12 @@ AcpiDsCreateBankField ( /* * Use Info.DataRegisterNode to store BankField Op - * It's safe because DataRegisterNode will never be used when create bank field - * We store AmlStart and AmlLength in the BankField Op for late evaluation - * Used in AcpiExPrepFieldValue(Info) + * It's safe because DataRegisterNode will never be used when create + * bank field \we store AmlStart and AmlLength in the BankField Op for + * late evaluation. Used in AcpiExPrepFieldValue(Info) * - * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"? + * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like + * "void *ParentOp"? */ Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op; @@ -799,8 +804,8 @@ AcpiDsCreateIndexField ( Arg = Op->Common.Value.Arg; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); @@ -811,8 +816,8 @@ AcpiDsCreateIndexField ( Arg = Arg->Common.Next; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); diff --git a/source/components/dispatcher/dsinit.c b/source/components/dispatcher/dsinit.c index b3a9bdcf45d7..573d0ddf0745 100644 --- a/source/components/dispatcher/dsinit.c +++ b/source/components/dispatcher/dsinit.c @@ -242,7 +242,7 @@ AcpiDsInitializeObjects ( * the namespace reader lock. */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL); + ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); @@ -259,7 +259,8 @@ AcpiDsInitializeObjects ( if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\nInitializing Namespace objects:\n")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "\nInitializing Namespace objects:\n")); } /* Summary of objects initialized */ @@ -267,9 +268,10 @@ AcpiDsInitializeObjects ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Table [%4.4s:%8.8s] (id %.2X) - %4u Objects with %3u Devices, " "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n", - Table->Signature, Table->OemTableId, OwnerId, Info.ObjectCount, Info.DeviceCount, - Info.OpRegionCount, Info.MethodCount, Info.SerialMethodCount, - Info.NonSerialMethodCount, Info.SerializedMethodCount)); + Table->Signature, Table->OemTableId, OwnerId, Info.ObjectCount, + Info.DeviceCount,Info.OpRegionCount, Info.MethodCount, + Info.SerialMethodCount, Info.NonSerialMethodCount, + Info.SerializedMethodCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount)); diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index 95e0cb3f2a00..0da02fd6c06f 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/components/dispatcher/dsmethod.c @@ -127,8 +127,8 @@ AcpiDsAutoSerializeMethod ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength, NULL, 0); + Status = AcpiDsInitAmlWalk (WalkState, Op, Node, + ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, 0); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -251,12 +251,12 @@ AcpiDsMethodError ( * AE_OK, in which case the executing method will not be aborted. */ AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, - WalkState->ParserState.AmlStart); + WalkState->ParserState.AmlStart); Status = AcpiGbl_ExceptionHandler (Status, - WalkState->MethodNode ? - WalkState->MethodNode->Name.Integer : 0, - WalkState->Opcode, AmlOffset, NULL); + WalkState->MethodNode ? + WalkState->MethodNode->Name.Integer : 0, + WalkState->Opcode, AmlOffset, NULL); AcpiExEnterInterpreter (); } @@ -400,10 +400,12 @@ AcpiDsBeginMethodExecution ( */ if (WalkState && (!(ObjDesc->Method.InfoFlags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) && - (WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel)) + (WalkState->Thread->CurrentSyncLevel > + ObjDesc->Method.Mutex->Mutex.SyncLevel)) { ACPI_ERROR ((AE_INFO, - "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", + "Cannot acquire Mutex for method [%4.4s]" + ", current SyncLevel is too large (%u)", AcpiUtGetNodeName (MethodNode), WalkState->Thread->CurrentSyncLevel)); @@ -416,14 +418,15 @@ AcpiDsBeginMethodExecution ( */ if (!WalkState || !ObjDesc->Method.Mutex->Mutex.ThreadId || - (WalkState->Thread->ThreadId != ObjDesc->Method.Mutex->Mutex.ThreadId)) + (WalkState->Thread->ThreadId != + ObjDesc->Method.Mutex->Mutex.ThreadId)) { /* * Acquire the method mutex. This releases the interpreter if we * block (and reacquires it before it returns) */ - Status = AcpiExSystemWaitMutex (ObjDesc->Method.Mutex->Mutex.OsMutex, - ACPI_WAIT_FOREVER); + Status = AcpiExSystemWaitMutex ( + ObjDesc->Method.Mutex->Mutex.OsMutex, ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -436,8 +439,22 @@ AcpiDsBeginMethodExecution ( ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel; - ObjDesc->Method.Mutex->Mutex.ThreadId = WalkState->Thread->ThreadId; - WalkState->Thread->CurrentSyncLevel = ObjDesc->Method.SyncLevel; + ObjDesc->Method.Mutex->Mutex.ThreadId = + WalkState->Thread->ThreadId; + + /* + * Update the current SyncLevel only if this is not an auto- + * serialized method. In the auto case, we have to ignore + * the sync level for the method mutex (created for the + * auto-serialization) because we have no idea of what the + * sync level should be. Therefore, just ignore it. + */ + if (!(ObjDesc->Method.InfoFlags & + ACPI_METHOD_IGNORE_SYNC_LEVEL)) + { + WalkState->Thread->CurrentSyncLevel = + ObjDesc->Method.SyncLevel; + } } else { @@ -515,7 +532,8 @@ AcpiDsCallControlMethod ( ACPI_FUNCTION_TRACE_PTR (DsCallControlMethod, ThisWalkState); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Calling method %p, currentstate=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Calling method %p, currentstate=%p\n", ThisWalkState->PrevOp, ThisWalkState)); /* @@ -535,8 +553,8 @@ AcpiDsCallControlMethod ( /* Init for new method, possibly wait on method mutex */ - Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, - ThisWalkState); + Status = AcpiDsBeginMethodExecution ( + MethodNode, ObjDesc, ThisWalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -544,8 +562,8 @@ AcpiDsCallControlMethod ( /* Begin method parse/execution. Create a new walk state */ - NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId, - NULL, ObjDesc, Thread); + NextWalkState = AcpiDsCreateWalkState ( + ObjDesc->Method.OwnerId, NULL, ObjDesc, Thread); if (!NextWalkState) { Status = AE_NO_MEMORY; @@ -574,8 +592,8 @@ AcpiDsCallControlMethod ( Info->Parameters = &ThisWalkState->Operands[0]; Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode, - ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, - Info, ACPI_IMODE_EXECUTE); + ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, + Info, ACPI_IMODE_EXECUTE); ACPI_FREE (Info); if (ACPI_FAILURE (Status)) @@ -770,7 +788,8 @@ AcpiDsTerminateControlMethod ( WalkState->Thread->CurrentSyncLevel = MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; - AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex); + AcpiOsReleaseMutex ( + MethodDesc->Method.Mutex->Mutex.OsMutex); MethodDesc->Method.Mutex->Mutex.ThreadId = 0; } } @@ -800,7 +819,8 @@ AcpiDsTerminateControlMethod ( if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE) { AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); - MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_MODIFIED_NAMESPACE; + MethodDesc->Method.InfoFlags &= + ~ACPI_METHOD_MODIFIED_NAMESPACE; } } } @@ -848,7 +868,8 @@ AcpiDsTerminateControlMethod ( if (WalkState) { ACPI_INFO ((AE_INFO, - "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", + "Marking method %4.4s as Serialized " + "because of AE_ALREADY_EXISTS error", WalkState->MethodNode->Name.Ascii)); } @@ -863,7 +884,9 @@ AcpiDsTerminateControlMethod ( * marking the method permanently as Serialized when the last * thread exits here. */ - MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_SERIALIZED_PENDING; + MethodDesc->Method.InfoFlags &= + ~ACPI_METHOD_SERIALIZED_PENDING; + MethodDesc->Method.InfoFlags |= (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); MethodDesc->Method.SyncLevel = 0; @@ -878,7 +901,7 @@ AcpiDsTerminateControlMethod ( } AcpiExStopTraceMethod ((ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, - MethodDesc, WalkState); + MethodDesc, WalkState); return_VOID; } diff --git a/source/components/dispatcher/dsmthdat.c b/source/components/dispatcher/dsmthdat.c index fe9869299451..2040a3339782 100644 --- a/source/components/dispatcher/dsmthdat.c +++ b/source/components/dispatcher/dsmthdat.c @@ -110,7 +110,9 @@ AcpiDsMethodDataInit ( for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { - ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name, NAMEOF_ARG_NTE); + ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name, + NAMEOF_ARG_NTE); + WalkState->Arguments[i].Name.Integer |= (i << 24); WalkState->Arguments[i].DescriptorType = ACPI_DESC_TYPE_NAMED; WalkState->Arguments[i].Type = ACPI_TYPE_ANY; @@ -121,7 +123,8 @@ AcpiDsMethodDataInit ( for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { - ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name, NAMEOF_LOCAL_NTE); + ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name, + NAMEOF_LOCAL_NTE); WalkState->LocalVariables[i].Name.Integer |= (i << 24); WalkState->LocalVariables[i].DescriptorType = ACPI_DESC_TYPE_NAMED; @@ -163,7 +166,7 @@ AcpiDsMethodDataDeleteAll ( if (WalkState->LocalVariables[Index].Object) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%u=%p\n", - Index, WalkState->LocalVariables[Index].Object)); + Index, WalkState->LocalVariables[Index].Object)); /* Detach object (if present) and remove a reference */ @@ -178,7 +181,7 @@ AcpiDsMethodDataDeleteAll ( if (WalkState->Arguments[Index].Object) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%u=%p\n", - Index, WalkState->Arguments[Index].Object)); + Index, WalkState->Arguments[Index].Object)); /* Detach object (if present) and remove a reference */ @@ -221,7 +224,8 @@ AcpiDsMethodDataInitArgs ( if (!Params) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "No parameter list passed to method\n")); return_ACPI_STATUS (AE_OK); } @@ -236,8 +240,8 @@ AcpiDsMethodDataInitArgs ( * Store the argument in the method/walk descriptor. * Do not copy the arg in order to implement call by reference */ - Status = AcpiDsMethodDataSetValue (ACPI_REFCLASS_ARG, Index, - Params[Index], WalkState); + Status = AcpiDsMethodDataSetValue ( + ACPI_REFCLASS_ARG, Index, Params[Index], WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -627,7 +631,8 @@ AcpiDsStoreObjectToLocal ( NewObjDesc = ObjDesc; if (ObjDesc->Common.ReferenceCount > 1) { - Status = AcpiUtCopyIobjectToIobject (ObjDesc, &NewObjDesc, WalkState); + Status = AcpiUtCopyIobjectToIobject ( + ObjDesc, &NewObjDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -664,13 +669,16 @@ AcpiDsStoreObjectToLocal ( * If we have a valid reference object that came from RefOf(), * do the indirect store */ - if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_OPERAND) && - (CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - (CurrentObjDesc->Reference.Class == ACPI_REFCLASS_REFOF)) + if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == + ACPI_DESC_TYPE_OPERAND) && + (CurrentObjDesc->Common.Type == + ACPI_TYPE_LOCAL_REFERENCE) && + (CurrentObjDesc->Reference.Class == + ACPI_REFCLASS_REFOF)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Arg (%p) is an ObjRef(Node), storing in node %p\n", - NewObjDesc, CurrentObjDesc)); + "Arg (%p) is an ObjRef(Node), storing in node %p\n", + NewObjDesc, CurrentObjDesc)); /* * Store this object to the Node (perform the indirect store) @@ -678,8 +686,8 @@ AcpiDsStoreObjectToLocal ( * specification rules on storing to Locals/Args. */ Status = AcpiExStoreObjectToNode (NewObjDesc, - CurrentObjDesc->Reference.Object, WalkState, - ACPI_NO_IMPLICIT_CONVERSION); + CurrentObjDesc->Reference.Object, WalkState, + ACPI_NO_IMPLICIT_CONVERSION); /* Remove local reference if we copied the object above */ @@ -687,6 +695,7 @@ AcpiDsStoreObjectToLocal ( { AcpiUtRemoveReference (NewObjDesc); } + return_ACPI_STATUS (Status); } } diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index cdc84314c914..8c22423eca23 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -102,10 +102,10 @@ AcpiDsBuildInternalObject ( if (!Op->Common.Node) { Status = AcpiNsLookup (WalkState->ScopeInfo, - Op->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node))); + Op->Common.Value.String, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node))); if (ACPI_FAILURE (Status)) { /* Check if we are resolving a named reference within a package */ @@ -161,8 +161,8 @@ AcpiDsBuildInternalObject ( ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Op->Common.Node); Status = AcpiExResolveNodeToValue ( - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc), - WalkState); + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc), + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -222,14 +222,14 @@ AcpiDsBuildInternalObject ( /* Create and init a new internal ACPI object */ ObjDesc = AcpiUtCreateInternalObject ( - (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType); + (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode, - &ObjDesc); + Status = AcpiDsInitObjectFromOp ( + WalkState, Op, Op->Common.AmlOpcode, &ObjDesc); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); @@ -336,8 +336,8 @@ AcpiDsBuildInternalBufferObj ( } else { - ObjDesc->Buffer.Pointer = ACPI_ALLOCATE_ZEROED ( - ObjDesc->Buffer.Length); + ObjDesc->Buffer.Pointer = + ACPI_ALLOCATE_ZEROED (ObjDesc->Buffer.Length); if (!ObjDesc->Buffer.Pointer) { AcpiUtDeleteObjectDesc (ObjDesc); @@ -349,7 +349,7 @@ AcpiDsBuildInternalBufferObj ( if (ByteList) { memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data, - ByteListLength); + ByteListLength); } } @@ -468,8 +468,8 @@ AcpiDsBuildInternalPackageObj ( * invocation, so we special case it here */ Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP; - Status = AcpiDsBuildInternalObject (WalkState, Arg, - &ObjDesc->Package.Elements[i]); + Status = AcpiDsBuildInternalObject ( + WalkState, Arg, &ObjDesc->Package.Elements[i]); } else { @@ -481,8 +481,8 @@ AcpiDsBuildInternalPackageObj ( } else { - Status = AcpiDsBuildInternalObject (WalkState, Arg, - &ObjDesc->Package.Elements[i]); + Status = AcpiDsBuildInternalObject ( + WalkState, Arg, &ObjDesc->Package.Elements[i]); } if (*ObjDescPtr) @@ -539,7 +539,8 @@ AcpiDsBuildInternalPackageObj ( } ACPI_INFO ((AE_INFO, - "Actual Package length (%u) is larger than NumElements field (%u), truncated", + "Actual Package length (%u) is larger than " + "NumElements field (%u), truncated", i, ElementCount)); } else if (i < ElementCount) @@ -549,7 +550,8 @@ AcpiDsBuildInternalPackageObj ( * Note: this is not an error, the package is padded out with NULLs. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length (%u) smaller than NumElements count (%u), padded with null elements\n", + "Package List length (%u) smaller than NumElements " + "count (%u), padded with null elements\n", i, ElementCount)); } @@ -605,8 +607,8 @@ AcpiDsCreateNode ( /* Build an internal object for the argument(s) */ - Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg, - &ObjDesc); + Status = AcpiDsBuildInternalObject ( + WalkState, Op->Common.Value.Arg, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -678,9 +680,9 @@ AcpiDsInitObjectFromOp ( /* * Defer evaluation of Buffer TermArg operand */ - ObjDesc->Buffer.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - WalkState->Operands[0]); - ObjDesc->Buffer.AmlStart = Op->Named.Data; + ObjDesc->Buffer.Node = ACPI_CAST_PTR ( + ACPI_NAMESPACE_NODE, WalkState->Operands[0]); + ObjDesc->Buffer.AmlStart = Op->Named.Data; ObjDesc->Buffer.AmlLength = Op->Named.Length; break; @@ -688,9 +690,9 @@ AcpiDsInitObjectFromOp ( /* * Defer evaluation of Package TermArg operand */ - ObjDesc->Package.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - WalkState->Operands[0]); - ObjDesc->Package.AmlStart = Op->Named.Data; + ObjDesc->Package.Node = ACPI_CAST_PTR ( + ACPI_NAMESPACE_NODE, WalkState->Operands[0]); + ObjDesc->Package.AmlStart = Op->Named.Data; ObjDesc->Package.AmlLength = Op->Named.Length; break; @@ -800,9 +802,9 @@ AcpiDsInitObjectFromOp ( #ifndef ACPI_NO_METHOD_EXECUTION Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_LOCAL, - ObjDesc->Reference.Value, WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, - &ObjDesc->Reference.Object)); + ObjDesc->Reference.Value, WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, + &ObjDesc->Reference.Object)); #endif break; @@ -815,9 +817,9 @@ AcpiDsInitObjectFromOp ( #ifndef ACPI_NO_METHOD_EXECUTION Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_ARG, - ObjDesc->Reference.Value, WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, - &ObjDesc->Reference.Object)); + ObjDesc->Reference.Value, WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, + &ObjDesc->Reference.Object)); #endif break; diff --git a/source/components/dispatcher/dsopcode.c b/source/components/dispatcher/dsopcode.c index ede5f416b971..68de21c2227a 100644 --- a/source/components/dispatcher/dsopcode.c +++ b/source/components/dispatcher/dsopcode.c @@ -259,8 +259,8 @@ AcpiDsInitBufferField ( * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), * UPDATE_RULE = 0 (UPDATE_PRESERVE) */ - Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0, - BitOffset, BitCount); + Status = AcpiExPrepCommonFieldObject ( + ObjDesc, FieldFlags, 0, BitOffset, BitCount); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -357,8 +357,8 @@ AcpiDsEvalBufferFieldOperands ( /* Resolve the operands */ - Status = AcpiExResolveOperands (Op->Common.AmlOpcode, - ACPI_WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands ( + Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X", @@ -374,16 +374,16 @@ AcpiDsEvalBufferFieldOperands ( /* NOTE: Slightly different operands for this opcode */ Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc, - WalkState->Operands[0], WalkState->Operands[1], - WalkState->Operands[2], WalkState->Operands[3]); + WalkState->Operands[0], WalkState->Operands[1], + WalkState->Operands[2], WalkState->Operands[3]); } else { /* All other, CreateXxxField opcodes */ Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc, - WalkState->Operands[0], WalkState->Operands[1], - NULL, WalkState->Operands[2]); + WalkState->Operands[0], WalkState->Operands[1], + NULL, WalkState->Operands[2]); } return_ACPI_STATUS (Status); @@ -443,8 +443,8 @@ AcpiDsEvalRegionOperands ( /* Resolve the length and address operands to numbers */ - Status = AcpiExResolveOperands (Op->Common.AmlOpcode, - ACPI_WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands ( + Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -472,18 +472,16 @@ AcpiDsEvalRegionOperands ( OperandDesc = WalkState->Operands[WalkState->NumOperands - 2]; ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) - OperandDesc->Integer.Value; + OperandDesc->Integer.Value; AcpiUtRemoveReference (OperandDesc); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - ObjDesc, - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID; - return_ACPI_STATUS (Status); } @@ -546,8 +544,8 @@ AcpiDsEvalTableRegionOperands ( * Resolve the Signature string, OemId string, * and OemTableId string operands */ - Status = AcpiExResolveOperands (Op->Common.AmlOpcode, - ACPI_WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands ( + Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -556,9 +554,9 @@ AcpiDsEvalTableRegionOperands ( /* Find the ACPI table */ Status = AcpiTbFindTable ( - Operand[0]->String.Pointer, - Operand[1]->String.Pointer, - Operand[2]->String.Pointer, &TableIndex); + Operand[0]->String.Pointer, + Operand[1]->String.Pointer, + Operand[2]->String.Pointer, &TableIndex); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) @@ -649,8 +647,8 @@ AcpiDsEvalDataObjectOperands ( } Status = AcpiExResolveOperands (WalkState->Opcode, - &(WalkState->Operands [WalkState->NumOperands -1]), - WalkState); + &(WalkState->Operands [WalkState->NumOperands -1]), + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -678,13 +676,15 @@ AcpiDsEvalDataObjectOperands ( { case AML_BUFFER_OP: - Status = AcpiDsBuildInternalBufferObj (WalkState, Op, Length, &ObjDesc); + Status = AcpiDsBuildInternalBufferObj ( + WalkState, Op, Length, &ObjDesc); break; case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: - Status = AcpiDsBuildInternalPackageObj (WalkState, Op, Length, &ObjDesc); + Status = AcpiDsBuildInternalPackageObj ( + WalkState, Op, Length, &ObjDesc); break; default: diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index 15c54fb21489..a32b3d481782 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -140,9 +140,9 @@ AcpiDsDoImplicitReturn ( } ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result %p will be implicitly returned; Prev=%p\n", - ReturnDesc, - WalkState->ImplicitReturnObj)); + "Result %p will be implicitly returned; Prev=%p\n", + ReturnDesc, + WalkState->ImplicitReturnObj)); /* * Delete any "stale" implicit return value first. However, in @@ -266,7 +266,8 @@ AcpiDsIsResultUsed ( * If we are executing the predicate AND this is the predicate op, * we will use the return value */ - if ((WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING) && + if ((WalkState->ControlState->Common.State == + ACPI_CONTROL_PREDICATE_EXECUTING) && (WalkState->ControlState->Control.PredicateOp == Op)) { goto ResultUsed; @@ -523,8 +524,8 @@ AcpiDsCreateOperand ( /* Get the entire name string from the AML stream */ - Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Common.Value.Buffer, - &NameString, &NameLength); + Status = AcpiExGetNameString (ACPI_TYPE_ANY, + Arg->Common.Value.Buffer, &NameString, &NameLength); if (ACPI_FAILURE (Status)) { @@ -544,10 +545,11 @@ AcpiDsCreateOperand ( */ if ((WalkState->DeferredNode) && (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) && - (ArgIndex == (UINT32) ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2))) + (ArgIndex == (UINT32) + ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2))) { ObjDesc = ACPI_CAST_PTR ( - ACPI_OPERAND_OBJECT, WalkState->DeferredNode); + ACPI_OPERAND_OBJECT, WalkState->DeferredNode); Status = AE_OK; } else /* All other opcodes */ @@ -560,6 +562,7 @@ AcpiDsCreateOperand ( */ ParentOp = Arg->Common.Parent; OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode); + if ((OpInfo->Flags & AML_NSNODE) && (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && (ParentOp->Common.AmlOpcode != AML_REGION_OP) && @@ -577,10 +580,9 @@ AcpiDsCreateOperand ( } Status = AcpiNsLookup (WalkState->ScopeInfo, NameString, - ACPI_TYPE_ANY, InterpreterMode, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); + ACPI_TYPE_ANY, InterpreterMode, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); /* * The only case where we pass through (ignore) a NOT_FOUND * error is for the CondRefOf opcode. @@ -596,7 +598,7 @@ AcpiDsCreateOperand ( * object to the root */ ObjDesc = ACPI_CAST_PTR ( - ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); + ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); Status = AE_OK; } else if (ParentOp->Common.AmlOpcode == AML_EXTERNAL_OP) @@ -642,7 +644,8 @@ AcpiDsCreateOperand ( { return_ACPI_STATUS (Status); } - ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState)); + + AcpiDbDisplayArgumentObject (ObjDesc, WalkState); } else { @@ -675,13 +678,14 @@ AcpiDsCreateOperand ( return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - if ((OpInfo->Flags & AML_HAS_RETVAL) || (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) + if ((OpInfo->Flags & AML_HAS_RETVAL) || + (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Argument previously created, already stacked\n")); - ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject ( - WalkState->Operands [WalkState->NumOperands - 1], WalkState)); + AcpiDbDisplayArgumentObject ( + WalkState->Operands [WalkState->NumOperands - 1], WalkState); /* * Use value that was already previously returned @@ -712,7 +716,7 @@ AcpiDsCreateOperand ( /* Initialize the new object */ Status = AcpiDsInitObjectFromOp ( - WalkState, Arg, Opcode, &ObjDesc); + WalkState, Arg, Opcode, &ObjDesc); if (ACPI_FAILURE (Status)) { AcpiUtDeleteObjectDesc (ObjDesc); @@ -728,7 +732,7 @@ AcpiDsCreateOperand ( return_ACPI_STATUS (Status); } - ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState)); + AcpiDbDisplayArgumentObject (ObjDesc, WalkState); } return_ACPI_STATUS (AE_OK); @@ -898,7 +902,8 @@ AcpiDsEvaluateNamePath ( AcpiUtRemoveReference (*Operand); - Status = AcpiUtCopyIobjectToIobject (*Operand, &NewObjDesc, WalkState); + Status = AcpiUtCopyIobjectToIobject ( + *Operand, &NewObjDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Exit; diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index f5f9072fedce..d604b74e3cba 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -189,12 +189,13 @@ AcpiDsGetPredicateValue ( Cleanup: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Completed a predicate eval=%X Op=%p\n", WalkState->ControlState->Common.Value, WalkState->Op)); - /* Break to debugger to display result */ + /* Break to debugger to display result */ - ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (LocalObjDesc, WalkState)); + AcpiDbDisplayResultObject (LocalObjDesc, WalkState); /* * Delete the predicate result object (we know that @@ -286,10 +287,12 @@ AcpiDsExecBeginOp ( (WalkState->ControlState->Common.State == ACPI_CONTROL_CONDITIONAL_EXECUTING)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n", - Op, WalkState)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Exec predicate Op=%p State=%p\n", + Op, WalkState)); - WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING; + WalkState->ControlState->Common.State = + ACPI_CONTROL_PREDICATE_EXECUTING; /* Save start of predicate */ @@ -337,8 +340,8 @@ AcpiDsExecBeginOp ( } else { - Status = AcpiDsScopeStackPush (Op->Named.Node, - Op->Named.Node->Type, WalkState); + Status = AcpiDsScopeStackPush ( + Op->Named.Node, Op->Named.Node->Type, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -397,8 +400,8 @@ AcpiDsExecEndOp ( ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState); - Op = WalkState->Op; - OpType = WalkState->OpInfo->Type; + Op = WalkState->Op; + OpType = WalkState->OpInfo->Type; OpClass = WalkState->OpInfo->Class; if (OpClass == AML_CLASS_UNKNOWN) @@ -418,8 +421,11 @@ AcpiDsExecEndOp ( /* Call debugger for single step support (DEBUG build only) */ - ACPI_DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass)); - ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);}); + Status = AcpiDbSingleStep (WalkState, Op, OpClass); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* Decode the Opcode Class */ @@ -456,8 +462,8 @@ AcpiDsExecEndOp ( /* Resolve all operands */ Status = AcpiExResolveOperands (WalkState->Opcode, - &(WalkState->Operands [WalkState->NumOperands -1]), - WalkState); + &(WalkState->Operands [WalkState->NumOperands -1]), + WalkState); } if (ACPI_SUCCESS (Status)) @@ -534,7 +540,8 @@ AcpiDsExecEndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", Op)); - Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node; + Op->Common.Node = (ACPI_NAMESPACE_NODE *) + Op->Asl.Value.Arg->Asl.Node; AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object); return_ACPI_STATUS (AE_OK); } @@ -616,12 +623,12 @@ AcpiDsExecEndOp ( * Put the Node on the object stack (Contains the ACPI Name * of this object) */ - WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node; + WalkState->Operands[0] = (void *) + Op->Common.Parent->Common.Node; WalkState->NumOperands = 1; Status = AcpiDsCreateNode (WalkState, - Op->Common.Parent->Common.Node, - Op->Common.Parent); + Op->Common.Parent->Common.Node, Op->Common.Parent); if (ACPI_FAILURE (Status)) { break; @@ -633,7 +640,7 @@ AcpiDsExecEndOp ( case AML_INT_EVAL_SUBTREE_OP: Status = AcpiDsEvalDataObjectOperands (WalkState, Op, - AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node)); + AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node)); break; default: @@ -714,7 +721,8 @@ AcpiDsExecEndOp ( default: ACPI_ERROR ((AE_INFO, - "Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p", + "Unimplemented opcode, class=0x%X " + "type=0x%X Opcode=0x%X Op=%p", OpClass, OpType, Op->Common.AmlOpcode, Op)); Status = AE_NOT_IMPLEMENTED; @@ -749,8 +757,7 @@ Cleanup: { /* Break to debugger to display result */ - ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, - WalkState)); + AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState); /* * Delete the result op if and only if: diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index bcc786801154..0c6d848579e7 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -188,7 +188,8 @@ AcpiDsLoad1BeginOp ( ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p [%s]\n", WalkState, Op, AcpiUtGetTypeName (ObjectType))); + "State=%p Op=%p [%s]\n", WalkState, Op, + AcpiUtGetTypeName (ObjectType))); switch (WalkState->Opcode) { @@ -199,7 +200,7 @@ AcpiDsLoad1BeginOp ( * Allow search-to-root for single namesegs. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); #ifdef ACPI_ASL_COMPILER if (Status == AE_NOT_FOUND) { @@ -210,8 +211,8 @@ AcpiDsLoad1BeginOp ( */ AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0, 0); Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, - WalkState, &Node); + ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, + WalkState, &Node); } #endif if (ACPI_FAILURE (Status)) @@ -329,20 +330,20 @@ AcpiDsLoad1BeginOp ( { Flags |= ACPI_NS_OVERRIDE_IF_FOUND; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Override allowed\n", - AcpiUtGetTypeName (ObjectType))); + AcpiUtGetTypeName (ObjectType))); } else { Flags |= ACPI_NS_ERROR_IF_FOUND; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", - AcpiUtGetTypeName (ObjectType))); + AcpiUtGetTypeName (ObjectType))); } } else { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", - AcpiUtGetTypeName (ObjectType))); + AcpiUtGetTypeName (ObjectType))); } /* @@ -352,7 +353,7 @@ AcpiDsLoad1BeginOp ( * parse tree later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); + ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) @@ -372,7 +373,8 @@ AcpiDsLoad1BeginOp ( if (AcpiNsOpensScope (ObjectType)) { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + Status = AcpiDsScopeStackPush ( + Node, ObjectType, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -494,8 +496,9 @@ AcpiDsLoad1EndOp ( if (Op->Common.AmlOpcode == AML_REGION_OP) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), - WalkState); + (ACPI_ADR_SPACE_TYPE) + ((Op->Common.Value.Arg)->Common.Value.Integer), + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -504,7 +507,7 @@ AcpiDsLoad1EndOp ( else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - ACPI_ADR_SPACE_DATA_TABLE, WalkState); + ACPI_ADR_SPACE_DATA_TABLE, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -556,11 +559,12 @@ AcpiDsLoad1EndOp ( WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); WalkState->NumOperands = 1; - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + Status = AcpiDsCreateOperands ( + WalkState, Op->Common.Value.Arg); if (ACPI_SUCCESS (Status)) { Status = AcpiExCreateMethod (Op->Named.Data, - Op->Named.Length, WalkState); + Op->Named.Length, WalkState); } WalkState->Operands[0] = NULL; diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index f6095d971900..4c7392045b85 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -159,8 +159,8 @@ AcpiDsLoad2BeginOp ( * for use later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); break; case AML_SCOPE_OP: @@ -185,8 +185,8 @@ AcpiDsLoad2BeginOp ( * for use later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); if (ACPI_FAILURE (Status)) { #ifdef ACPI_ASL_COMPILER @@ -323,7 +323,7 @@ AcpiDsLoad2BeginOp ( /* Add new entry or lookup existing entry */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); + ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) { @@ -401,7 +401,7 @@ AcpiDsLoad2EndOp ( Op = WalkState->Op; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", - WalkState->OpInfo->Name, Op, WalkState)); + WalkState->OpInfo->Name, Op, WalkState)); /* Check if opcode had an associated namespace object */ @@ -507,8 +507,8 @@ AcpiDsLoad2EndOp ( { case AML_INDEX_FIELD_OP: - Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, - WalkState); + Status = AcpiDsCreateIndexField ( + Op, (ACPI_HANDLE) Arg->Common.Node, WalkState); break; case AML_BANK_FIELD_OP: @@ -593,7 +593,7 @@ AcpiDsLoad2EndOp ( if (Op->Common.AmlOpcode == AML_REGION_OP) { RegionSpace = (ACPI_ADR_SPACE_TYPE) - ((Op->Common.Value.Arg)->Common.Value.Integer); + ((Op->Common.Value.Arg)->Common.Value.Integer); } else { @@ -618,8 +618,8 @@ AcpiDsLoad2EndOp ( * Executing a method: initialize the region and unlock * the interpreter */ - Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - RegionSpace, WalkState); + Status = AcpiExCreateRegion (Op->Named.Data, + Op->Named.Length, RegionSpace, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -628,8 +628,8 @@ AcpiDsLoad2EndOp ( AcpiExExitInterpreter (); } - Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), - FALSE); + Status = AcpiEvInitializeRegion ( + AcpiNsGetAttachedObject (Node), FALSE); if (WalkState->MethodNode) { AcpiExEnterInterpreter (); @@ -672,12 +672,14 @@ AcpiDsLoad2EndOp ( WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); WalkState->NumOperands = 1; - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + Status = AcpiDsCreateOperands ( + WalkState, Op->Common.Value.Arg); if (ACPI_SUCCESS (Status)) { - Status = AcpiExCreateMethod (Op->Named.Data, - Op->Named.Length, WalkState); + Status = AcpiExCreateMethod ( + Op->Named.Data, Op->Named.Length, WalkState); } + WalkState->Operands[0] = NULL; WalkState->NumOperands = 0; @@ -712,9 +714,9 @@ AcpiDsLoad2EndOp ( * Lookup the method name and save the Node */ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(NewNode)); + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &(NewNode)); if (ACPI_SUCCESS (Status)) { /* diff --git a/source/components/dispatcher/dswscope.c b/source/components/dispatcher/dswscope.c index fe9a2566edf5..f67f2c4be784 100644 --- a/source/components/dispatcher/dswscope.c +++ b/source/components/dispatcher/dswscope.c @@ -82,6 +82,7 @@ AcpiDsScopeStackClear ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Popped object type (%s)\n", AcpiUtGetTypeName (ScopeInfo->Common.Value))); + AcpiUtDeleteGenericState (ScopeInfo); } } diff --git a/source/components/dispatcher/dswstate.c b/source/components/dispatcher/dswstate.c index b45974f964d7..8b7aa74fc97a 100644 --- a/source/components/dispatcher/dswstate.c +++ b/source/components/dispatcher/dswstate.c @@ -299,8 +299,8 @@ AcpiDsResultStackPop ( if (WalkState->Results == NULL) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result stack underflow - State=%p\n", - WalkState)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Result stack underflow - State=%p\n", WalkState)); return (AE_AML_NO_OPERAND); } @@ -707,7 +707,8 @@ AcpiDsInitAmlWalk ( /* Push start scope on scope stack and make it current */ - Status = AcpiDsScopeStackPush (MethodNode, ACPI_TYPE_METHOD, WalkState); + Status = AcpiDsScopeStackPush ( + MethodNode, ACPI_TYPE_METHOD, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -750,7 +751,7 @@ AcpiDsInitAmlWalk ( /* Push start scope on scope stack and make it current */ Status = AcpiDsScopeStackPush (ParserState->StartNode, - ParserState->StartNode->Type, WalkState); + ParserState->StartNode->Type, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/events/evevent.c b/source/components/events/evevent.c index 96e4682c0ec9..d7c38cd7512f 100644 --- a/source/components/events/evevent.c +++ b/source/components/events/evevent.c @@ -203,8 +203,8 @@ AcpiEvFixedEventInitialize ( if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF) { Status = AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[i].EnableRegisterId, - ACPI_DISABLE_EVENT); + AcpiGbl_FixedEventInfo[i].EnableRegisterId, + ACPI_DISABLE_EVENT); if (ACPI_FAILURE (Status)) { return (Status); @@ -307,8 +307,8 @@ AcpiEvFixedEventDispatch ( /* Clear the status bit */ (void) AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].StatusRegisterId, - ACPI_CLEAR_STATUS); + AcpiGbl_FixedEventInfo[Event].StatusRegisterId, + ACPI_CLEAR_STATUS); /* * Make sure that a handler exists. If not, report an error @@ -317,8 +317,8 @@ AcpiEvFixedEventDispatch ( if (!AcpiGbl_FixedEventHandlers[Event].Handler) { (void) AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - ACPI_DISABLE_EVENT); + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + ACPI_DISABLE_EVENT); ACPI_ERROR ((AE_INFO, "No installed handler for fixed event - %s (%u), disabling", @@ -330,7 +330,7 @@ AcpiEvFixedEventDispatch ( /* Invoke the Fixed Event handler */ return ((AcpiGbl_FixedEventHandlers[Event].Handler)( - AcpiGbl_FixedEventHandlers[Event].Context)); + AcpiGbl_FixedEventHandlers[Event].Context)); } #endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/source/components/events/evglock.c b/source/components/events/evglock.c index 7617d5cefeb0..ce137340f529 100644 --- a/source/components/events/evglock.c +++ b/source/components/events/evglock.c @@ -90,7 +90,7 @@ AcpiEvInitGlobalLockHandler ( /* Attempt installation of the global lock handler */ Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler, NULL); + AcpiEvGlobalLockHandler, NULL); /* * If the global lock does not exist on this platform, the attempt to @@ -140,9 +140,10 @@ AcpiEvRemoveGlobalLockHandler ( ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); + AcpiGbl_GlobalLockPresent = FALSE; Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler); + AcpiEvGlobalLockHandler); AcpiOsDeleteLock (AcpiGbl_GlobalLockPendingLock); return_ACPI_STATUS (Status); @@ -302,8 +303,8 @@ AcpiEvAcquireGlobalLock ( * Wait for handshake with the global lock interrupt handler. * This interface releases the interpreter if we must wait. */ - Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, - ACPI_WAIT_FOREVER); + Status = AcpiExSystemWaitSemaphore ( + AcpiGbl_GlobalLockSemaphore, ACPI_WAIT_FOREVER); Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); @@ -361,7 +362,7 @@ AcpiEvReleaseGlobalLock ( if (Pending) { Status = AcpiWriteBitRegister ( - ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); + ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index 2ce57f9d460c..04a1f1e0b713 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -104,8 +104,8 @@ AcpiEvUpdateGpeEnableMask ( { ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit); } - GpeRegisterInfo->EnableMask = GpeRegisterInfo->EnableForRun; + GpeRegisterInfo->EnableMask = GpeRegisterInfo->EnableForRun; return_ACPI_STATUS (AE_OK); } @@ -327,7 +327,7 @@ AcpiEvGetGpeEventInfo ( for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { GpeInfo = AcpiEvLowGetGpeInfo (GpeNumber, - AcpiGbl_GpeFadtBlocks[i]); + AcpiGbl_GpeFadtBlocks[i]); if (GpeInfo) { return (GpeInfo); @@ -588,8 +588,8 @@ AcpiEvAsynchExecuteGpeMethod ( Notify = GpeEventInfo->Dispatch.NotifyList; while (ACPI_SUCCESS (Status) && Notify) { - Status = AcpiEvQueueNotifyRequest (Notify->DeviceNode, - ACPI_NOTIFY_DEVICE_WAKE); + Status = AcpiEvQueueNotifyRequest ( + Notify->DeviceNode, ACPI_NOTIFY_DEVICE_WAKE); Notify = Notify->Next; } @@ -633,7 +633,7 @@ AcpiEvAsynchExecuteGpeMethod ( /* Defer enabling of GPE until all notify handlers are done */ Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, - AcpiEvAsynchEnableGpe, GpeEventInfo); + AcpiEvAsynchEnableGpe, GpeEventInfo); if (ACPI_SUCCESS (Status)) { return_VOID; @@ -778,8 +778,8 @@ AcpiEvGpeDispatch ( { ACPI_EXCEPTION ((AE_INFO, Status, "Unable to clear GPE %02X", GpeNumber)); - (void) AcpiHwLowSetGpe (GpeEventInfo, - ACPI_GPE_CONDITIONAL_ENABLE); + (void) AcpiHwLowSetGpe ( + GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } } @@ -816,7 +816,7 @@ AcpiEvGpeDispatch ( * NOTE: Level-triggered GPEs are cleared after the method completes. */ Status = AcpiOsExecute (OSL_GPE_HANDLER, - AcpiEvAsynchExecuteGpeMethod, GpeEventInfo); + AcpiEvAsynchExecuteGpeMethod, GpeEventInfo); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, diff --git a/source/components/events/evgpeblk.c b/source/components/events/evgpeblk.c index d3342a5b0f6b..8d266bfe33b0 100644 --- a/source/components/events/evgpeblk.c +++ b/source/components/events/evgpeblk.c @@ -193,6 +193,7 @@ AcpiEvDeleteGpeBlock ( { GpeBlock->Next->Previous = GpeBlock->Previous; } + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); } @@ -241,8 +242,8 @@ AcpiEvCreateGpeInfoBlocks ( /* Allocate the GPE register information block */ GpeRegisterInfo = ACPI_ALLOCATE_ZEROED ( - (ACPI_SIZE) GpeBlock->RegisterCount * - sizeof (ACPI_GPE_REGISTER_INFO)); + (ACPI_SIZE) GpeBlock->RegisterCount * + sizeof (ACPI_GPE_REGISTER_INFO)); if (!GpeRegisterInfo) { ACPI_ERROR ((AE_INFO, @@ -255,7 +256,7 @@ AcpiEvCreateGpeInfoBlocks ( * per register. Initialization to zeros is sufficient. */ GpeEventInfo = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) GpeBlock->GpeCount * - sizeof (ACPI_GPE_EVENT_INFO)); + sizeof (ACPI_GPE_EVENT_INFO)); if (!GpeEventInfo) { ACPI_ERROR ((AE_INFO, @@ -267,7 +268,7 @@ AcpiEvCreateGpeInfoBlocks ( /* Save the new Info arrays in the GPE block */ GpeBlock->RegisterInfo = GpeRegisterInfo; - GpeBlock->EventInfo = GpeEventInfo; + GpeBlock->EventInfo = GpeEventInfo; /* * Initialize the GPE Register and Event structures. A goal of these @@ -276,7 +277,7 @@ AcpiEvCreateGpeInfoBlocks ( * first half, and the enable registers occupy the second half. */ ThisRegister = GpeRegisterInfo; - ThisEvent = GpeEventInfo; + ThisEvent = GpeEventInfo; for (i = 0; i < GpeBlock->RegisterCount; i++) { @@ -434,8 +435,8 @@ AcpiEvCreateGpeBlock ( WalkInfo.ExecuteByOwnerId = FALSE; Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL); + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, + AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL); /* Return the new block */ diff --git a/source/components/events/evgpeinit.c b/source/components/events/evgpeinit.c index d23a345263d4..dc421d53ca12 100644 --- a/source/components/events/evgpeinit.c +++ b/source/components/events/evgpeinit.c @@ -138,10 +138,10 @@ AcpiEvGpeInitialize ( /* Install GPE Block 0 */ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, - AcpiGbl_FADT.XGpe0Block.Address, - AcpiGbl_FADT.XGpe0Block.SpaceId, - RegisterCount0, 0, - AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]); + AcpiGbl_FADT.XGpe0Block.Address, + AcpiGbl_FADT.XGpe0Block.SpaceId, + RegisterCount0, 0, + AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]); if (ACPI_FAILURE (Status)) { @@ -178,11 +178,11 @@ AcpiEvGpeInitialize ( /* Install GPE Block 1 */ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, - AcpiGbl_FADT.XGpe1Block.Address, - AcpiGbl_FADT.XGpe1Block.SpaceId, - RegisterCount1, - AcpiGbl_FADT.Gpe1Base, - AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]); + AcpiGbl_FADT.XGpe1Block.Address, + AcpiGbl_FADT.XGpe1Block.SpaceId, + RegisterCount1, + AcpiGbl_FADT.Gpe1Base, + AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]); if (ACPI_FAILURE (Status)) { @@ -195,7 +195,7 @@ AcpiEvGpeInitialize ( * space. However, GPE0 always starts at GPE number zero. */ GpeNumberMax = AcpiGbl_FADT.Gpe1Base + - ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1); + ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1); } } @@ -275,9 +275,9 @@ AcpiEvUpdateGpes ( WalkInfo.GpeDevice = GpeBlock->Node; Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, - WalkInfo.GpeDevice, ACPI_UINT32_MAX, - ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod, - NULL, &WalkInfo, NULL); + WalkInfo.GpeDevice, ACPI_UINT32_MAX, + ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod, + NULL, &WalkInfo, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -430,7 +430,7 @@ AcpiEvMatchGpeMethod ( } if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_METHOD) + ACPI_GPE_DISPATCH_METHOD) { /* * If there is already a method, ignore this method. But check diff --git a/source/components/events/evgpeutil.c b/source/components/events/evgpeutil.c index 18cbbf7cc706..e4431bf3e8a8 100644 --- a/source/components/events/evgpeutil.c +++ b/source/components/events/evgpeutil.c @@ -238,7 +238,7 @@ AcpiEvGetGpeXruptBlock ( if (InterruptNumber != AcpiGbl_FADT.SciInterrupt) { Status = AcpiOsInstallInterruptHandler (InterruptNumber, - AcpiEvGpeXruptHandler, GpeXrupt); + AcpiEvGpeXruptHandler, GpeXrupt); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -288,7 +288,7 @@ AcpiEvDeleteGpeXrupt ( /* Disable this interrupt */ Status = AcpiOsRemoveInterruptHandler ( - GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler); + GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -374,7 +374,7 @@ AcpiEvDeleteGpeHandlers ( GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; } else if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_NOTIFY) + ACPI_GPE_DISPATCH_NOTIFY) { /* Delete the implicit notification device list */ @@ -385,6 +385,7 @@ AcpiEvDeleteGpeHandlers ( ACPI_FREE (Notify); Notify = Next; } + GpeEventInfo->Dispatch.NotifyList = NULL; GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; } diff --git a/source/components/events/evhandler.c b/source/components/events/evhandler.c index c797abe1f7d7..e2d5955a089c 100644 --- a/source/components/events/evhandler.c +++ b/source/components/events/evhandler.c @@ -122,8 +122,8 @@ AcpiEvInstallRegionHandlers ( for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode, - AcpiGbl_DefaultAddressSpaces[i], - ACPI_DEFAULT_HANDLER, NULL, NULL); + AcpiGbl_DefaultAddressSpaces[i], + ACPI_DEFAULT_HANDLER, NULL, NULL); switch (Status) { case AE_OK: @@ -184,7 +184,7 @@ AcpiEvHasDefaultHandler ( if (HandlerObj->AddressSpace.SpaceId == SpaceId) { if (HandlerObj->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { return (TRUE); } @@ -282,7 +282,7 @@ AcpiEvInstallHandler ( /* Found a handler, is it for the same address space? */ if (NextHandlerObj->AddressSpace.SpaceId == - HandlerObj->AddressSpace.SpaceId) + HandlerObj->AddressSpace.SpaceId) { ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Found handler for region [%s] in device %p(%p) " @@ -574,8 +574,8 @@ AcpiEvInstallSpaceHandler ( * of the branch */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler, NULL, - HandlerObj, NULL); + ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler, NULL, + HandlerObj, NULL); UnlockAndExit: return_ACPI_STATUS (Status); diff --git a/source/components/events/evmisc.c b/source/components/events/evmisc.c index accf22298b92..0a69c239b44f 100644 --- a/source/components/events/evmisc.c +++ b/source/components/events/evmisc.c @@ -75,6 +75,7 @@ BOOLEAN AcpiEvIsNotifyObject ( ACPI_NAMESPACE_NODE *Node) { + switch (Node->Type) { case ACPI_TYPE_DEVICE: @@ -183,8 +184,8 @@ AcpiEvQueueNotifyRequest ( AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), NotifyValue, AcpiUtGetNotifyName (NotifyValue, ACPI_TYPE_ANY), Node)); - Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, - Info); + Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, + AcpiEvNotifyDispatch, Info); if (ACPI_FAILURE (Status)) { AcpiUtDeleteGenericState (Info); diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index 298a1dbf535e..c2f229270655 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -110,7 +110,7 @@ AcpiEvInitializeOpRegions ( AcpiGbl_DefaultAddressSpaces[i])) { Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode, - AcpiGbl_DefaultAddressSpaces[i]); + AcpiGbl_DefaultAddressSpaces[i]); } } @@ -210,7 +210,7 @@ AcpiEvAddressSpaceDispatch ( AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, - Context, &RegionContext); + Context, &RegionContext); /* Re-enter the interpreter */ @@ -292,7 +292,7 @@ AcpiEvAddressSpaceDispatch ( AcpiUtGetRegionName (RegionObj->Region.SpaceId))); if (!(HandlerDesc->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { /* * For handlers other than the default (supplied) handlers, we must @@ -314,7 +314,7 @@ AcpiEvAddressSpaceDispatch ( } if (!(HandlerDesc->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { /* * We just returned from a non-default handler, we must re-enter the diff --git a/source/components/events/evrgnini.c b/source/components/events/evrgnini.c index 6cf1b031fbfa..cc0240d9de17 100644 --- a/source/components/events/evrgnini.c +++ b/source/components/events/evrgnini.c @@ -248,9 +248,9 @@ AcpiEvPciConfigRegionSetup ( /* Install a handler for this PCI root bridge */ Status = AcpiInstallAddressSpaceHandler ( - (ACPI_HANDLE) PciRootNode, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_DEFAULT_HANDLER, NULL, NULL); + (ACPI_HANDLE) PciRootNode, + ACPI_ADR_SPACE_PCI_CONFIG, + ACPI_DEFAULT_HANDLER, NULL, NULL); if (ACPI_FAILURE (Status)) { if (Status == AE_SAME_HANDLER) @@ -324,7 +324,7 @@ AcpiEvPciConfigRegionSetup ( * contained in the parent's scope. */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, - PciDeviceNode, &PciValue); + PciDeviceNode, &PciValue); /* * The default is zero, and since the allocation above zeroed the data, @@ -339,7 +339,7 @@ AcpiEvPciConfigRegionSetup ( /* The PCI segment number comes from the _SEG method */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, - PciRootNode, &PciValue); + PciRootNode, &PciValue); if (ACPI_SUCCESS (Status)) { PciId->Segment = ACPI_LOWORD (PciValue); @@ -348,7 +348,7 @@ AcpiEvPciConfigRegionSetup ( /* The PCI bus number comes from the _BBN method */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, - PciRootNode, &PciValue); + PciRootNode, &PciValue); if (ACPI_SUCCESS (Status)) { PciId->Bus = ACPI_LOWORD (PciValue); @@ -604,7 +604,7 @@ AcpiEvInitializeRegion ( /* Find any "_REG" method associated with this region definition */ Status = AcpiNsSearchOneScope ( - *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode); + *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode); if (ACPI_SUCCESS (Status)) { /* @@ -680,7 +680,7 @@ AcpiEvInitializeRegion ( HandlerObj, RegionObj, ObjDesc)); Status = AcpiEvAttachRegion (HandlerObj, RegionObj, - AcpiNsLocked); + AcpiNsLocked); /* * Tell all users that this region is usable by diff --git a/source/components/events/evsci.c b/source/components/events/evsci.c index 93b307e4c1b5..f2218656e089 100644 --- a/source/components/events/evsci.c +++ b/source/components/events/evsci.c @@ -218,7 +218,7 @@ AcpiEvInstallSciHandler ( Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt, - AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead); + AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead); return_ACPI_STATUS (Status); } @@ -257,7 +257,7 @@ AcpiEvRemoveAllSciHandlers ( /* Just let the OS remove the handler and disable the level */ Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt, - AcpiEvSciXruptHandler); + AcpiEvSciXruptHandler); if (!AcpiGbl_SciHandlerList) { diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c index 0a3b6c831168..c6b1c2e3bec5 100644 --- a/source/components/events/evxface.c +++ b/source/components/events/evxface.c @@ -1002,8 +1002,8 @@ AcpiInstallGpeHandler ( ACPI_FUNCTION_TRACE (AcpiInstallGpeHandler); - Status = AcpiEvInstallGpeHandler (GpeDevice, GpeNumber, Type, FALSE, - Address, Context); + Status = AcpiEvInstallGpeHandler (GpeDevice, GpeNumber, Type, + FALSE, Address, Context); return_ACPI_STATUS (Status); } @@ -1043,8 +1043,8 @@ AcpiInstallGpeRawHandler ( ACPI_FUNCTION_TRACE (AcpiInstallGpeRawHandler); - Status = AcpiEvInstallGpeHandler (GpeDevice, GpeNumber, Type, TRUE, - Address, Context); + Status = AcpiEvInstallGpeHandler (GpeDevice, GpeNumber, Type, + TRUE, Address, Context); return_ACPI_STATUS (Status); } @@ -1210,7 +1210,7 @@ AcpiAcquireGlobalLock ( AcpiExEnterInterpreter (); Status = AcpiExAcquireMutexObject (Timeout, - AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); + AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); if (ACPI_SUCCESS (Status)) { diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c index fe46dfb993cb..e633cebcd881 100644 --- a/source/components/events/evxfevnt.c +++ b/source/components/events/evxfevnt.c @@ -76,7 +76,7 @@ AcpiEnable ( /* ACPI tables must be present */ - if (!AcpiTbTablesLoaded ()) + if (AcpiGbl_FadtIndex == ACPI_INVALID_TABLE_INDEX) { return_ACPI_STATUS (AE_NO_ACPI_TABLES); } @@ -92,7 +92,8 @@ AcpiEnable ( if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI) { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, + "System is already in ACPI mode\n")); } else { @@ -162,7 +163,8 @@ AcpiDisable ( return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, + "ACPI mode disabled\n")); } return_ACPI_STATUS (Status); @@ -208,8 +210,8 @@ AcpiEnableEvent ( * register bit) */ Status = AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - ACPI_ENABLE_EVENT); + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + ACPI_ENABLE_EVENT); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -218,7 +220,7 @@ AcpiEnableEvent ( /* Make sure that the hardware responded */ Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -274,15 +276,15 @@ AcpiDisableEvent ( * register bit) */ Status = AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - ACPI_DISABLE_EVENT); + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + ACPI_DISABLE_EVENT); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -335,8 +337,8 @@ AcpiClearEvent ( * register bit) */ Status = AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[Event].StatusRegisterId, - ACPI_CLEAR_STATUS); + AcpiGbl_FixedEventInfo[Event].StatusRegisterId, + ACPI_CLEAR_STATUS); return_ACPI_STATUS (Status); } @@ -393,7 +395,7 @@ AcpiGetEventStatus ( /* Fixed event currently enabled? */ Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &InByte); + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &InByte); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -408,7 +410,7 @@ AcpiGetEventStatus ( /* Fixed event currently active? */ Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].StatusRegisterId, &InByte); + AcpiGbl_FixedEventInfo[Event].StatusRegisterId, &InByte); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c index 79a055c833c4..44b0a4793ce0 100644 --- a/source/components/events/evxfgpe.c +++ b/source/components/events/evxfgpe.c @@ -440,7 +440,7 @@ AcpiSetupGpeForWake ( * level-triggered (for windows compatibility). */ if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_NONE) + ACPI_GPE_DISPATCH_NONE) { /* * This is the first device for implicit notify on this GPE. @@ -455,7 +455,7 @@ AcpiSetupGpeForWake ( * this device to the notify list. */ if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_NOTIFY) + ACPI_GPE_DISPATCH_NOTIFY) { /* Ensure that the device is not already in the list */ @@ -920,8 +920,8 @@ AcpiInstallGpeBlock ( * is always zero */ Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress->Address, - GpeBlockAddress->SpaceId, RegisterCount, - 0, InterruptNumber, &GpeBlock); + GpeBlockAddress->SpaceId, RegisterCount, + 0, InterruptNumber, &GpeBlock); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; diff --git a/source/components/events/evxfregn.c b/source/components/events/evxfregn.c index 1126bbe53b78..d26f3bf053dd 100644 --- a/source/components/events/evxfregn.c +++ b/source/components/events/evxfregn.c @@ -114,7 +114,8 @@ AcpiInstallAddressSpaceHandler ( /* Install the handler for all Regions for this Space ID */ - Status = AcpiEvInstallSpaceHandler (Node, SpaceId, Handler, Setup, Context); + Status = AcpiEvInstallSpaceHandler ( + Node, SpaceId, Handler, Setup, Context); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -144,6 +145,7 @@ AcpiInstallAddressSpaceHandler ( if (!AcpiGbl_RegMethodsExecuted) { /* We will defer execution of the _REG methods for this space */ + goto UnlockAndExit; } break; diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index 361367d67914..75d1ff01af4a 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -181,9 +181,9 @@ AcpiExLoadTableOp ( /* Find the ACPI table in the RSDT/XSDT */ Status = AcpiTbFindTable ( - Operand[0]->String.Pointer, - Operand[1]->String.Pointer, - Operand[2]->String.Pointer, &TableIndex); + Operand[0]->String.Pointer, + Operand[1]->String.Pointer, + Operand[2]->String.Pointer, &TableIndex); if (ACPI_FAILURE (Status)) { if (Status != AE_NOT_FOUND) @@ -217,7 +217,7 @@ AcpiExLoadTableOp ( * location within the namespace where the table will be loaded. */ Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer, - ACPI_NS_SEARCH_PARENT, &ParentNode); + ACPI_NS_SEARCH_PARENT, &ParentNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -241,7 +241,7 @@ AcpiExLoadTableOp ( /* Find the node referenced by the ParameterPathString */ Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer, - ACPI_NS_SEARCH_PARENT, &ParameterNode); + ACPI_NS_SEARCH_PARENT, &ParameterNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -263,8 +263,7 @@ AcpiExLoadTableOp ( /* Store the parameter data into the optional parameter object */ Status = AcpiExStore (Operand[5], - ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), - WalkState); + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), WalkState); if (ACPI_FAILURE (Status)) { (void) AcpiExUnloadTable (DdbHandle); @@ -286,7 +285,7 @@ AcpiExLoadTableOp ( if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, - AcpiGbl_TableHandlerContext); + AcpiGbl_TableHandlerContext); } *ReturnDesc = DdbHandle; @@ -326,7 +325,7 @@ AcpiExRegionRead ( for (i = 0; i < Length; i++) { Status = AcpiEvAddressSpaceDispatch (ObjDesc, NULL, ACPI_READ, - RegionOffset, 8, &Value); + RegionOffset, 8, &Value); if (ACPI_FAILURE (Status)) { return (Status); @@ -396,8 +395,8 @@ AcpiExLoadOp ( } /* - * If the Region Address and Length have not been previously evaluated, - * evaluate them now and save the results. + * If the Region Address and Length have not been previously + * evaluated, evaluate them now and save the results. */ if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) { @@ -417,7 +416,7 @@ AcpiExLoadOp ( } Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER), - ACPI_CAST_PTR (UINT8, TableHeader)); + ACPI_CAST_PTR (UINT8, TableHeader)); Length = TableHeader->Length; ACPI_FREE (TableHeader); @@ -460,7 +459,7 @@ AcpiExLoadOp ( /* Read the entire table */ Status = AcpiExRegionRead (ObjDesc, Length, - ACPI_CAST_PTR (UINT8, Table)); + ACPI_CAST_PTR (UINT8, Table)); if (ACPI_FAILURE (Status)) { ACPI_FREE (Table); @@ -482,7 +481,8 @@ AcpiExLoadOp ( /* Get the actual table length from the table header */ - TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); + TableHeader = ACPI_CAST_PTR ( + ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); Length = TableHeader->Length; /* Table cannot extend beyond the buffer */ @@ -497,8 +497,8 @@ AcpiExLoadOp ( } /* - * Copy the table from the buffer because the buffer could be modified - * or even deleted in the future + * Copy the table from the buffer because the buffer could be + * modified or even deleted in the future */ Table = ACPI_ALLOCATE (Length); if (!Table) @@ -520,8 +520,8 @@ AcpiExLoadOp ( (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, TRUE, - &TableIndex); + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, TRUE, + &TableIndex); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) @@ -536,7 +536,8 @@ AcpiExLoadOp ( * Note: Now table is "INSTALLED", it must be validated before * loading. */ - Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]); + Status = AcpiTbValidateTable ( + &AcpiGbl_RootTableList.Tables[TableIndex]); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -579,7 +580,7 @@ AcpiExLoadOp ( if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, - AcpiGbl_TableHandlerContext); + AcpiGbl_TableHandlerContext); } return_ACPI_STATUS (Status); @@ -656,7 +657,7 @@ AcpiExUnloadTable ( if (ACPI_SUCCESS (Status)) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, Table, - AcpiGbl_TableHandlerContext); + AcpiGbl_TableHandlerContext); } } diff --git a/source/components/executer/exconvrt.c b/source/components/executer/exconvrt.c index c964217816c2..592206ce9233 100644 --- a/source/components/executer/exconvrt.c +++ b/source/components/executer/exconvrt.c @@ -251,9 +251,7 @@ AcpiExConvertToBuffer ( /* Copy the integer to the buffer, LSB first */ NewBuf = ReturnDesc->Buffer.Pointer; - memcpy (NewBuf, - &ObjDesc->Integer.Value, - AcpiGbl_IntegerByteWidth); + memcpy (NewBuf, &ObjDesc->Integer.Value, AcpiGbl_IntegerByteWidth); break; case ACPI_TYPE_STRING: @@ -266,8 +264,8 @@ AcpiExConvertToBuffer ( * ASL/AML code that depends on the null being transferred to the new * buffer. */ - ReturnDesc = AcpiUtCreateBufferObject ( - (ACPI_SIZE) ObjDesc->String.Length + 1); + ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) + ObjDesc->String.Length + 1); if (!ReturnDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -390,7 +388,8 @@ AcpiExConvertToAscii ( { /* Get one hex digit, most significant digits first */ - String[k] = (UINT8) AcpiUtHexToAsciiChar (Integer, ACPI_MUL_4 (j)); + String[k] = (UINT8) + AcpiUtHexToAsciiChar (Integer, ACPI_MUL_4 (j)); k++; } break; @@ -491,8 +490,8 @@ AcpiExConvertToString ( /* Convert integer to string */ - StringLength = AcpiExConvertToAscii (ObjDesc->Integer.Value, Base, - NewBuf, AcpiGbl_IntegerByteWidth); + StringLength = AcpiExConvertToAscii ( + ObjDesc->Integer.Value, Base, NewBuf, AcpiGbl_IntegerByteWidth); /* Null terminate at the correct place */ @@ -581,8 +580,7 @@ AcpiExConvertToString ( for (i = 0; i < ObjDesc->Buffer.Length; i++) { NewBuf += AcpiExConvertToAscii ( - (UINT64) ObjDesc->Buffer.Pointer[i], Base, - NewBuf, 1); + (UINT64) ObjDesc->Buffer.Pointer[i], Base, NewBuf, 1); *NewBuf++ = Separator; /* each separated by a comma or space */ } @@ -685,8 +683,7 @@ AcpiExConvertToTargetType ( * These types require an Integer operand. We can convert * a Buffer or a String to an Integer if necessary. */ - Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, - 16); + Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, 16); break; case ACPI_TYPE_STRING: @@ -695,7 +692,7 @@ AcpiExConvertToTargetType ( * Integer or Buffer if necessary */ Status = AcpiExConvertToString (SourceDesc, ResultDesc, - ACPI_IMPLICIT_CONVERT_HEX); + ACPI_IMPLICIT_CONVERT_HEX); break; case ACPI_TYPE_BUFFER: @@ -708,7 +705,8 @@ AcpiExConvertToTargetType ( default: - ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: 0x%X", + ACPI_ERROR ((AE_INFO, + "Bad destination type during conversion: 0x%X", DestinationType)); Status = AE_AML_INTERNAL; break; diff --git a/source/components/executer/excreate.c b/source/components/executer/excreate.c index 9a002b88b657..5e67346091d7 100644 --- a/source/components/executer/excreate.c +++ b/source/components/executer/excreate.c @@ -147,7 +147,7 @@ AcpiExCreateAlias ( * target node or the alias Node */ Status = AcpiNsAttachObject (AliasNode, - AcpiNsGetAttachedObject (TargetNode), TargetNode->Type); + AcpiNsGetAttachedObject (TargetNode), TargetNode->Type); break; } @@ -192,7 +192,7 @@ AcpiExCreateEvent ( * that the event is created in an unsignalled state */ Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, - &ObjDesc->Event.OsSemaphore); + &ObjDesc->Event.OsSemaphore); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -200,8 +200,9 @@ AcpiExCreateEvent ( /* Attach object to the Node */ - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], - ObjDesc, ACPI_TYPE_EVENT); + Status = AcpiNsAttachObject ( + (ACPI_NAMESPACE_NODE *) WalkState->Operands[0], + ObjDesc, ACPI_TYPE_EVENT); Cleanup: /* @@ -260,7 +261,8 @@ AcpiExCreateMutex ( ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value; ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; - Status = AcpiNsAttachObject (ObjDesc->Mutex.Node, ObjDesc, ACPI_TYPE_MUTEX); + Status = AcpiNsAttachObject ( + ObjDesc->Mutex.Node, ObjDesc, ACPI_TYPE_MUTEX); Cleanup: @@ -328,7 +330,8 @@ AcpiExCreateRegion ( * a table load for this exception. Instead, if the region is * actually used at runtime, abort the executing method. */ - ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); + ACPI_ERROR ((AE_INFO, + "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); } ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n", @@ -423,7 +426,7 @@ AcpiExCreateProcessor ( /* Install the processor object in the parent Node */ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], - ObjDesc, ACPI_TYPE_PROCESSOR); + ObjDesc, ACPI_TYPE_PROCESSOR); /* Remove local reference to the object */ @@ -474,7 +477,7 @@ AcpiExCreatePowerResource ( /* Install the power resource object in the parent Node */ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], - ObjDesc, ACPI_TYPE_POWER); + ObjDesc, ACPI_TYPE_POWER); /* Remove local reference to the object */ @@ -533,7 +536,8 @@ AcpiExCreateMethod ( * flag, and SyncLevel for efficiency. */ MethodFlags = (UINT8) Operand[1]->Integer.Value; - ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT); + ObjDesc->Method.ParamCount = (UINT8) + (MethodFlags & AML_METHOD_ARG_COUNT); /* * Get the SyncLevel. If method is serialized, a mutex will be @@ -554,7 +558,7 @@ AcpiExCreateMethod ( /* Attach the new object to the method Node */ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], - ObjDesc, ACPI_TYPE_METHOD); + ObjDesc, ACPI_TYPE_METHOD); /* Remove local reference to the object */ diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c index f50d07b17945..4d97cda0d372 100644 --- a/source/components/executer/exdebug.c +++ b/source/components/executer/exdebug.c @@ -43,26 +43,13 @@ #include "acpi.h" #include "accommon.h" -#include "acnamesp.h" #include "acinterp.h" -#include "acparser.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exdebug") -static ACPI_OPERAND_OBJECT *AcpiGbl_TraceMethodObject = NULL; - -/* Local prototypes */ - -#ifdef ACPI_DEBUG_OUTPUT -static const char * -AcpiExGetTraceEventName ( - ACPI_TRACE_EVENT_TYPE Type); -#endif - - #ifndef ACPI_NO_ERROR_MESSAGES /******************************************************************************* * @@ -153,7 +140,7 @@ AcpiExDoDebugObject ( { AcpiOsPrintf ("%s: %p\n", AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type), - SourceDesc); + SourceDesc); return_VOID; } else @@ -205,7 +192,7 @@ AcpiExDoDebugObject ( for (i = 0; i < SourceDesc->Package.Count; i++) { AcpiExDoDebugObject (SourceDesc->Package.Elements[i], - Level+4, i+1); + Level + 4, i + 1); } break; @@ -241,7 +228,7 @@ AcpiExDoDebugObject ( if (SourceDesc->Reference.Node) { if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) != - ACPI_DESC_TYPE_NAMED) + ACPI_DESC_TYPE_NAMED) { AcpiOsPrintf (" %p - Not a valid namespace node\n", SourceDesc->Reference.Node); @@ -266,7 +253,7 @@ AcpiExDoDebugObject ( default: AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, - Level+4, 0); + Level + 4, 0); break; } } @@ -274,11 +261,11 @@ AcpiExDoDebugObject ( else if (SourceDesc->Reference.Object) { if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) == - ACPI_DESC_TYPE_NAMED) + ACPI_DESC_TYPE_NAMED) { AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *) SourceDesc->Reference.Object)->Object, - Level+4, 0); + Level + 4, 0); } else { @@ -327,362 +314,3 @@ AcpiExDoDebugObject ( return_VOID; } #endif - - -/******************************************************************************* - * - * FUNCTION: AcpiExInterpreterTraceEnabled - * - * PARAMETERS: Name - Whether method name should be matched, - * this should be checked before starting - * the tracer - * - * RETURN: TRUE if interpreter trace is enabled. - * - * DESCRIPTION: Check whether interpreter trace is enabled - * - ******************************************************************************/ - -static BOOLEAN -AcpiExInterpreterTraceEnabled ( - char *Name) -{ - - /* Check if tracing is enabled */ - - if (!(AcpiGbl_TraceFlags & ACPI_TRACE_ENABLED)) - { - return (FALSE); - } - - /* - * Check if tracing is filtered: - * - * 1. If the tracer is started, AcpiGbl_TraceMethodObject should have - * been filled by the trace starter - * 2. If the tracer is not started, AcpiGbl_TraceMethodName should be - * matched if it is specified - * 3. If the tracer is oneshot style, AcpiGbl_TraceMethodName should - * not be cleared by the trace stopper during the first match - */ - if (AcpiGbl_TraceMethodObject) - { - return (TRUE); - } - if (Name && - (AcpiGbl_TraceMethodName && - strcmp (AcpiGbl_TraceMethodName, Name))) - { - return (FALSE); - } - if ((AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) && - !AcpiGbl_TraceMethodName) - { - return (FALSE); - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExGetTraceEventName - * - * PARAMETERS: Type - Trace event type - * - * RETURN: Trace event name. - * - * DESCRIPTION: Used to obtain the full trace event name. - * - ******************************************************************************/ - -#ifdef ACPI_DEBUG_OUTPUT - -static const char * -AcpiExGetTraceEventName ( - ACPI_TRACE_EVENT_TYPE Type) -{ - switch (Type) - { - case ACPI_TRACE_AML_METHOD: - - return "Method"; - - case ACPI_TRACE_AML_OPCODE: - - return "Opcode"; - - case ACPI_TRACE_AML_REGION: - - return "Region"; - - default: - - return ""; - } -} - -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiExTracePoint - * - * PARAMETERS: Type - Trace event type - * Begin - TRUE if before execution - * Aml - Executed AML address - * Pathname - Object path - * - * RETURN: None - * - * DESCRIPTION: Internal interpreter execution trace. - * - ******************************************************************************/ - -void -AcpiExTracePoint ( - ACPI_TRACE_EVENT_TYPE Type, - BOOLEAN Begin, - UINT8 *Aml, - char *Pathname) -{ - - ACPI_FUNCTION_NAME (ExTracePoint); - - - if (Pathname) - { - ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, - "%s %s [0x%p:%s] execution.\n", - AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", - Aml, Pathname)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, - "%s %s [0x%p] execution.\n", - AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", - Aml)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStartTraceMethod - * - * PARAMETERS: MethodNode - Node of the method - * ObjDesc - The method object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Start control method execution trace - * - ******************************************************************************/ - -void -AcpiExStartTraceMethod ( - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - char *Pathname = NULL; - BOOLEAN Enabled = FALSE; - - - ACPI_FUNCTION_NAME (ExStartTraceMethod); - - - if (MethodNode) - { - Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - Enabled = AcpiExInterpreterTraceEnabled (Pathname); - if (Enabled && !AcpiGbl_TraceMethodObject) - { - AcpiGbl_TraceMethodObject = ObjDesc; - AcpiGbl_OriginalDbgLevel = AcpiDbgLevel; - AcpiGbl_OriginalDbgLayer = AcpiDbgLayer; - AcpiDbgLevel = ACPI_TRACE_LEVEL_ALL; - AcpiDbgLayer = ACPI_TRACE_LAYER_ALL; - - if (AcpiGbl_TraceDbgLevel) - { - AcpiDbgLevel = AcpiGbl_TraceDbgLevel; - } - if (AcpiGbl_TraceDbgLayer) - { - AcpiDbgLayer = AcpiGbl_TraceDbgLayer; - } - } - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - -Exit: - if (Enabled) - { - ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE, - ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); - } - if (Pathname) - { - ACPI_FREE (Pathname); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStopTraceMethod - * - * PARAMETERS: MethodNode - Node of the method - * ObjDesc - The method object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Stop control method execution trace - * - ******************************************************************************/ - -void -AcpiExStopTraceMethod ( - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - char *Pathname = NULL; - BOOLEAN Enabled; - - - ACPI_FUNCTION_NAME (ExStopTraceMethod); - - - if (MethodNode) - { - Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto ExitPath; - } - - Enabled = AcpiExInterpreterTraceEnabled (NULL); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - - if (Enabled) - { - ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE, - ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto ExitPath; - } - - /* Check whether the tracer should be stopped */ - - if (AcpiGbl_TraceMethodObject == ObjDesc) - { - /* Disable further tracing if type is one-shot */ - - if (AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) - { - AcpiGbl_TraceMethodName = NULL; - } - - AcpiDbgLevel = AcpiGbl_OriginalDbgLevel; - AcpiDbgLayer = AcpiGbl_OriginalDbgLayer; - AcpiGbl_TraceMethodObject = NULL; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - -ExitPath: - if (Pathname) - { - ACPI_FREE (Pathname); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStartTraceOpcode - * - * PARAMETERS: Op - The parser opcode object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Start opcode execution trace - * - ******************************************************************************/ - -void -AcpiExStartTraceOpcode ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - - ACPI_FUNCTION_NAME (ExStartTraceOpcode); - - - if (AcpiExInterpreterTraceEnabled (NULL) && - (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) - { - ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, TRUE, - Op->Common.Aml, Op->Common.AmlOpName); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExStopTraceOpcode - * - * PARAMETERS: Op - The parser opcode object - * WalkState - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Stop opcode execution trace - * - ******************************************************************************/ - -void -AcpiExStopTraceOpcode ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - - ACPI_FUNCTION_NAME (ExStopTraceOpcode); - - - if (AcpiExInterpreterTraceEnabled (NULL) && - (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) - { - ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, FALSE, - Op->Common.Aml, Op->Common.AmlOpName); - } -} diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index f64c6ff42612..ebd78d9af5fd 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -453,7 +453,8 @@ AcpiExDumpObject ( case ACPI_EXD_BUFFER: - ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length); + ACPI_DUMP_BUFFER ( + ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length); break; case ACPI_EXD_PACKAGE: @@ -472,7 +473,8 @@ AcpiExDumpObject ( case ACPI_EXD_REFERENCE: ReferenceName = AcpiUtGetReferenceName (ObjDesc); - AcpiExOutString ("Class Name", ACPI_CAST_PTR (char, ReferenceName)); + AcpiExOutString ( + "Class Name", ACPI_CAST_PTR (char, ReferenceName)); AcpiExDumpReferenceObj (ObjDesc); break; @@ -501,7 +503,8 @@ AcpiExDumpObject ( if ((Next == Start) || (Next == Data)) { - AcpiOsPrintf ("\n**** Error: Object list appears to be circular linked"); + AcpiOsPrintf ( + "\n**** Error: Object list appears to be circular linked"); break; } } @@ -535,7 +538,8 @@ AcpiExDumpObject ( if ((Next == Start) || (Next == Data)) { - AcpiOsPrintf ("\n**** Error: Handler list appears to be circular linked"); + AcpiOsPrintf ( + "\n**** Error: Handler list appears to be circular linked"); break; } } @@ -569,7 +573,8 @@ AcpiExDumpObject ( if ((Next == Start) || (Next == Data)) { - AcpiOsPrintf ("\n**** Error: Region list appears to be circular linked"); + AcpiOsPrintf ( + "\n**** Error: Region list appears to be circular linked"); break; } } @@ -677,7 +682,8 @@ AcpiExDumpOperand ( { case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc)); + AcpiOsPrintf ("Reference: [%s] ", + AcpiUtGetReferenceName (ObjDesc)); switch (ObjDesc->Reference.Class) { @@ -705,7 +711,8 @@ AcpiExDumpOperand ( case ACPI_REFCLASS_NAME: - AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii); + AcpiOsPrintf ("- [%4.4s]\n", + ObjDesc->Reference.Node->Name.Ascii); break; case ACPI_REFCLASS_ARG: @@ -736,8 +743,8 @@ AcpiExDumpOperand ( Length = 128; } - AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n", - Length); + AcpiOsPrintf ( + "Buffer Contents: (displaying length 0x%.2X)\n", Length); ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length); } break; @@ -763,7 +770,8 @@ AcpiExDumpOperand ( { for (Index = 0; Index < ObjDesc->Package.Count; Index++) { - AcpiExDumpOperand (ObjDesc->Package.Elements[Index], Depth+1); + AcpiExDumpOperand ( + ObjDesc->Package.Elements[Index], Depth + 1); } } break; @@ -816,7 +824,7 @@ AcpiExDumpOperand ( ObjDesc->Field.BaseByteOffset, ObjDesc->Field.StartFieldBitOffset); - AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1); + AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth + 1); break; case ACPI_TYPE_LOCAL_INDEX_FIELD: @@ -836,13 +844,13 @@ AcpiExDumpOperand ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n")); } else if ((ObjDesc->BufferField.BufferObj)->Common.Type != - ACPI_TYPE_BUFFER) + ACPI_TYPE_BUFFER) { AcpiOsPrintf ("*not a Buffer*\n"); } else { - AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth+1); + AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth + 1); } break; @@ -1142,7 +1150,8 @@ AcpiExDumpPackageObj ( AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length); if (ObjDesc->Buffer.Length) { - AcpiUtDebugDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), + AcpiUtDebugDumpBuffer ( + ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); } else @@ -1158,7 +1167,8 @@ AcpiExDumpPackageObj ( for (i = 0; i < ObjDesc->Package.Count; i++) { - AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i); + AcpiExDumpPackageObj ( + ObjDesc->Package.Elements[i], Level + 1, i); } break; @@ -1256,7 +1266,8 @@ DumpObject: ObjDesc = ObjDesc->Common.NextObject; if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX) { - AcpiOsPrintf ("Secondary object is not a known object type: %2.2X\n", + AcpiOsPrintf ( + "Secondary object is not a known object type: %2.2X\n", ObjDesc->Common.Type); return_VOID; diff --git a/source/components/executer/exfield.c b/source/components/executer/exfield.c index d0ebcf04cadb..fc4f90520bfa 100644 --- a/source/components/executer/exfield.c +++ b/source/components/executer/exfield.c @@ -184,28 +184,31 @@ AcpiExReadDataFromField ( 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. + * 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 + * Note: SMBus and GSBus protocol value is passed in upper 16-bits + * of Function */ - if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + 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) + else if (ObjDesc->Field.RegionObj->Region.SpaceId == + ACPI_ADR_SPACE_GSBUS) { AccessorType = ObjDesc->Field.Attribute; - Length = AcpiExGetSerialAccessLength (AccessorType, - ObjDesc->Field.AccessLength); + 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) + * 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); @@ -229,8 +232,8 @@ AcpiExReadDataFromField ( /* Call the region handler for the read */ Status = AcpiExAccessRegion (ObjDesc, 0, - ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer), - Function); + ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer), Function); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); goto Exit; } @@ -245,7 +248,9 @@ AcpiExReadDataFromField ( * * Note: Field.length is in bits. */ - Length = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength); + Length = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->Field.BitLength); + if (Length > AcpiGbl_IntegerByteWidth) { /* Field is too large for an Integer, create a Buffer instead */ @@ -290,8 +295,9 @@ AcpiExReadDataFromField ( /* Perform the write */ - Status = AcpiExAccessRegion (ObjDesc, 0, - (UINT64 *) Buffer, ACPI_READ); + Status = AcpiExAccessRegion ( + ObjDesc, 0, (UINT64 *) Buffer, ACPI_READ); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); if (ACPI_FAILURE (Status)) { @@ -396,42 +402,47 @@ AcpiExWriteDataToField ( ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * 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. + * 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. + * 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 + * 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", + "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) + if (ObjDesc->Field.RegionObj->Region.SpaceId == + ACPI_ADR_SPACE_SMBUS) { Length = ACPI_SMBUS_BUFFER_SIZE; Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); } - else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) + else if (ObjDesc->Field.RegionObj->Region.SpaceId == + ACPI_ADR_SPACE_GSBUS) { AccessorType = ObjDesc->Field.Attribute; - Length = AcpiExGetSerialAccessLength (AccessorType, - ObjDesc->Field.AccessLength); + 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) + * 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_WRITE | (AccessorType << 16); @@ -445,7 +456,8 @@ AcpiExWriteDataToField ( if (SourceDesc->Buffer.Length < Length) { ACPI_ERROR ((AE_INFO, - "SMBus/IPMI/GenericSerialBus write requires Buffer of length %u, found length %u", + "SMBus/IPMI/GenericSerialBus write requires " + "Buffer of length %u, found length %u", Length, SourceDesc->Buffer.Length)); return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); @@ -470,8 +482,8 @@ AcpiExWriteDataToField ( * Perform the write (returns status and perhaps data in the * same buffer) */ - Status = AcpiExAccessRegion (ObjDesc, 0, - (UINT64 *) Buffer, Function); + Status = AcpiExAccessRegion ( + ObjDesc, 0, (UINT64 *) Buffer, Function); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); *ResultDesc = BufferDesc; @@ -494,7 +506,7 @@ AcpiExWriteDataToField ( } ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", + "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)); @@ -507,8 +519,8 @@ AcpiExWriteDataToField ( /* Perform the write */ - Status = AcpiExAccessRegion (ObjDesc, 0, - (UINT64 *) Buffer, ACPI_WRITE); + Status = AcpiExAccessRegion ( + ObjDesc, 0, (UINT64 *) Buffer, ACPI_WRITE); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); return_ACPI_STATUS (Status); } diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c index 5c95223b2c64..c5d9399cafd2 100644 --- a/source/components/executer/exfldio.c +++ b/source/components/executer/exfldio.c @@ -120,7 +120,8 @@ AcpiExSetupRegion ( if (!AcpiIsValidSpaceId (SpaceId)) { - ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); + ACPI_ERROR ((AE_INFO, + "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); } @@ -170,8 +171,8 @@ AcpiExSetupRegion ( * (Region length is specified in bytes) */ if (RgnDesc->Region.Length < - (ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset + - ObjDesc->CommonField.AccessByteWidth)) + (ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset + + ObjDesc->CommonField.AccessByteWidth)) { if (AcpiGbl_EnableInterpreterSlack) { @@ -198,7 +199,8 @@ AcpiExSetupRegion ( * byte, and a field with Dword access specified. */ ACPI_ERROR ((AE_INFO, - "Field [%4.4s] access width (%u bytes) too large for region [%4.4s] (length %u)", + "Field [%4.4s] access width (%u bytes) " + "too large for region [%4.4s] (length %u)", AcpiUtGetNodeName (ObjDesc->CommonField.Node), ObjDesc->CommonField.AccessByteWidth, AcpiUtGetNodeName (RgnDesc->Region.Node), @@ -210,7 +212,8 @@ AcpiExSetupRegion ( * exceeds region length, indicate an error */ ACPI_ERROR ((AE_INFO, - "Field [%4.4s] Base+Offset+Width %u+%u+%u is beyond end of region [%4.4s] (length %u)", + "Field [%4.4s] Base+Offset+Width %u+%u+%u " + "is beyond end of region [%4.4s] (length %u)", AcpiUtGetNodeName (ObjDesc->CommonField.Node), ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth, @@ -300,8 +303,8 @@ AcpiExAccessRegion ( /* Invoke the appropriate AddressSpace/OpRegion handler */ Status = AcpiEvAddressSpaceDispatch (RgnDesc, ObjDesc, - Function, RegionOffset, - ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); + Function, RegionOffset, + ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); if (ACPI_FAILURE (Status)) { @@ -512,8 +515,8 @@ AcpiExFieldDatumIo ( * For simple RegionFields, we just directly access the owning * Operation Region. */ - Status = AcpiExAccessRegion (ObjDesc, FieldDatumByteOffset, Value, - ReadWrite); + Status = AcpiExAccessRegion ( + ObjDesc, FieldDatumByteOffset, Value, ReadWrite); break; case ACPI_TYPE_LOCAL_INDEX_FIELD: @@ -536,8 +539,7 @@ AcpiExFieldDatumIo ( FieldDatumByteOffset)); Status = AcpiExInsertIntoField (ObjDesc->IndexField.IndexObj, - &FieldDatumByteOffset, - sizeof (FieldDatumByteOffset)); + &FieldDatumByteOffset, sizeof (FieldDatumByteOffset)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -550,8 +552,8 @@ AcpiExFieldDatumIo ( ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Read from Data Register\n")); - Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj, - Value, sizeof (UINT64)); + Status = AcpiExExtractFromField ( + ObjDesc->IndexField.DataObj, Value, sizeof (UINT64)); } else { @@ -561,8 +563,8 @@ AcpiExFieldDatumIo ( "Write to Data Register: Value %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (*Value))); - Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj, - Value, sizeof (UINT64)); + Status = AcpiExInsertIntoField ( + ObjDesc->IndexField.DataObj, Value, sizeof (UINT64)); } break; @@ -644,14 +646,14 @@ AcpiExWriteWithUpdateRule ( * ones) The left shift drops the bits we want to ignore. */ if ((~Mask << (ACPI_MUL_8 (sizeof (Mask)) - - ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0) + ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0) { /* * Read the current contents of the byte/word/dword containing * the field, and merge with the new field value. */ - Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, - &CurrentValue, ACPI_READ); + Status = AcpiExFieldDatumIo ( + ObjDesc, FieldDatumByteOffset, &CurrentValue, ACPI_READ); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -679,13 +681,15 @@ AcpiExWriteWithUpdateRule ( ACPI_ERROR ((AE_INFO, "Unknown UpdateRule value: 0x%X", - (ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK))); + (ObjDesc->CommonField.FieldFlags & + AML_FIELD_UPDATE_RULE_MASK))); return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } } ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", + "Mask %8.8X%8.8X, DatumOffset %X, Width %X, " + "Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Mask), FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth, @@ -694,8 +698,8 @@ AcpiExWriteWithUpdateRule ( /* Write the merged value */ - Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, - &MergedValue, ACPI_WRITE); + Status = AcpiExFieldDatumIo ( + ObjDesc, FieldDatumByteOffset, &MergedValue, ACPI_WRITE); return_ACPI_STATUS (Status); } @@ -806,8 +810,8 @@ AcpiExExtractFromField ( /* Get next input datum from the field */ FieldOffset += ObjDesc->CommonField.AccessByteWidth; - Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset, - &RawDatum, ACPI_READ); + Status = AcpiExFieldDatumIo ( + ObjDesc, FieldOffset, &RawDatum, ACPI_READ); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -904,7 +908,8 @@ AcpiExInsertIntoField ( NewBuffer = NULL; RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.BitLength); + ObjDesc->CommonField.BitLength); + /* * We must have a buffer that is at least as long as the field * we are writing to. This is because individual fields are @@ -982,8 +987,8 @@ AcpiExInsertIntoField ( /* Write merged datum to the target field */ MergedDatum &= Mask; - Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, - MergedDatum, FieldOffset); + Status = AcpiExWriteWithUpdateRule ( + ObjDesc, Mask, MergedDatum, FieldOffset); if (ACPI_FAILURE (Status)) { goto Exit; @@ -1040,8 +1045,8 @@ AcpiExInsertIntoField ( /* Write the last datum to the field */ MergedDatum &= Mask; - Status = AcpiExWriteWithUpdateRule (ObjDesc, - Mask, MergedDatum, FieldOffset); + Status = AcpiExWriteWithUpdateRule ( + ObjDesc, Mask, MergedDatum, FieldOffset); Exit: /* Free temporary buffer if we used one */ diff --git a/source/components/executer/exmisc.c b/source/components/executer/exmisc.c index 2a7b6202a663..ab01f6ea50dd 100644 --- a/source/components/executer/exmisc.c +++ b/source/components/executer/exmisc.c @@ -287,8 +287,8 @@ AcpiExDoConcatenate ( case ACPI_TYPE_STRING: - Status = AcpiExConvertToString (Operand1, &LocalOperand1, - ACPI_IMPLICIT_CONVERT_HEX); + Status = AcpiExConvertToString ( + Operand1, &LocalOperand1, ACPI_IMPLICIT_CONVERT_HEX); break; case ACPI_TYPE_BUFFER: @@ -328,8 +328,8 @@ AcpiExDoConcatenate ( /* Result of two Integers is a Buffer */ /* Need enough buffer space for two integers */ - ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) - ACPI_MUL_2 (AcpiGbl_IntegerByteWidth)); + ReturnDesc = AcpiUtCreateBufferObject ( + (ACPI_SIZE) ACPI_MUL_2 (AcpiGbl_IntegerByteWidth)); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -341,13 +341,12 @@ AcpiExDoConcatenate ( /* Copy the first integer, LSB first */ memcpy (NewBuf, &Operand0->Integer.Value, - AcpiGbl_IntegerByteWidth); + AcpiGbl_IntegerByteWidth); /* Copy the second integer (LSB first) after the first */ memcpy (NewBuf + AcpiGbl_IntegerByteWidth, - &LocalOperand1->Integer.Value, - AcpiGbl_IntegerByteWidth); + &LocalOperand1->Integer.Value, AcpiGbl_IntegerByteWidth); break; case ACPI_TYPE_STRING: @@ -355,8 +354,8 @@ AcpiExDoConcatenate ( /* Result of two Strings is a String */ ReturnDesc = AcpiUtCreateStringObject ( - ((ACPI_SIZE) Operand0->String.Length + - LocalOperand1->String.Length)); + ((ACPI_SIZE) Operand0->String.Length + + LocalOperand1->String.Length)); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -369,7 +368,7 @@ AcpiExDoConcatenate ( strcpy (NewBuf, Operand0->String.Pointer); strcpy (NewBuf + Operand0->String.Length, - LocalOperand1->String.Pointer); + LocalOperand1->String.Pointer); break; case ACPI_TYPE_BUFFER: @@ -377,8 +376,8 @@ AcpiExDoConcatenate ( /* Result of two Buffers is a Buffer */ ReturnDesc = AcpiUtCreateBufferObject ( - ((ACPI_SIZE) Operand0->Buffer.Length + - LocalOperand1->Buffer.Length)); + ((ACPI_SIZE) Operand0->Buffer.Length + + LocalOperand1->Buffer.Length)); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -390,10 +389,10 @@ AcpiExDoConcatenate ( /* Concatenate the buffers */ memcpy (NewBuf, Operand0->Buffer.Pointer, - Operand0->Buffer.Length); + Operand0->Buffer.Length); memcpy (NewBuf + Operand0->Buffer.Length, - LocalOperand1->Buffer.Pointer, - LocalOperand1->Buffer.Length); + LocalOperand1->Buffer.Pointer, + LocalOperand1->Buffer.Length); break; default: @@ -635,8 +634,8 @@ AcpiExDoLogicalOp ( case ACPI_TYPE_STRING: - Status = AcpiExConvertToString (Operand1, &LocalOperand1, - ACPI_IMPLICIT_CONVERT_HEX); + Status = AcpiExConvertToString ( + Operand1, &LocalOperand1, ACPI_IMPLICIT_CONVERT_HEX); break; case ACPI_TYPE_BUFFER: @@ -713,8 +712,8 @@ AcpiExDoLogicalOp ( /* Lexicographic compare: compare the data bytes */ Compare = memcmp (Operand0->Buffer.Pointer, - LocalOperand1->Buffer.Pointer, - (Length0 > Length1) ? Length1 : Length0); + LocalOperand1->Buffer.Pointer, + (Length0 > Length1) ? Length1 : Length0); switch (Opcode) { diff --git a/source/components/executer/exmutex.c b/source/components/executer/exmutex.c index acbb6f84806b..3ed546aa1baf 100644 --- a/source/components/executer/exmutex.c +++ b/source/components/executer/exmutex.c @@ -209,8 +209,7 @@ AcpiExAcquireMutexObject ( } else { - Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex, - Timeout); + Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex, Timeout); } if (ACPI_FAILURE (Status)) @@ -273,33 +272,48 @@ AcpiExAcquireMutex ( } /* - * Current sync level must be less than or equal to the sync level of the - * mutex. This mechanism provides some deadlock prevention + * Current sync level must be less than or equal to the sync level + * of the mutex. This mechanism provides some deadlock prevention. */ if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) { ACPI_ERROR ((AE_INFO, - "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)", + "Cannot acquire Mutex [%4.4s], " + "current SyncLevel is too large (%u)", AcpiUtGetNodeName (ObjDesc->Mutex.Node), WalkState->Thread->CurrentSyncLevel)); return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Acquiring: Mutex SyncLevel %u, Thread SyncLevel %u, " + "Depth %u TID %p\n", + ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, + ObjDesc->Mutex.AcquisitionDepth, WalkState->Thread)); + Status = AcpiExAcquireMutexObject ((UINT16) TimeDesc->Integer.Value, - ObjDesc, WalkState->Thread->ThreadId); + ObjDesc, WalkState->Thread->ThreadId); + if (ACPI_SUCCESS (Status) && ObjDesc->Mutex.AcquisitionDepth == 1) { /* Save Thread object, original/current sync levels */ ObjDesc->Mutex.OwnerThread = WalkState->Thread; - ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel; - WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; + ObjDesc->Mutex.OriginalSyncLevel = + WalkState->Thread->CurrentSyncLevel; + WalkState->Thread->CurrentSyncLevel = + ObjDesc->Mutex.SyncLevel; /* Link the mutex to the current thread for force-unlock at method exit */ AcpiExLinkMutex (ObjDesc, WalkState->Thread); } + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Acquired: Mutex SyncLevel %u, Thread SyncLevel %u, Depth %u\n", + ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, + ObjDesc->Mutex.AcquisitionDepth)); + return_ACPI_STATUS (Status); } @@ -395,9 +409,9 @@ AcpiExReleaseMutex ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status = AE_OK; UINT8 PreviousSyncLevel; ACPI_THREAD_STATE *OwnerThread; + ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (ExReleaseMutex); @@ -455,7 +469,8 @@ AcpiExReleaseMutex ( if (ObjDesc->Mutex.SyncLevel != OwnerThread->CurrentSyncLevel) { ACPI_ERROR ((AE_INFO, - "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u", + "Cannot release Mutex [%4.4s], SyncLevel mismatch: " + "mutex %u current %u", AcpiUtGetNodeName (ObjDesc->Mutex.Node), ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel)); return_ACPI_STATUS (AE_AML_MUTEX_ORDER); @@ -469,6 +484,13 @@ AcpiExReleaseMutex ( PreviousSyncLevel = OwnerThread->AcquiredMutexList->Mutex.OriginalSyncLevel; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Releasing: Object SyncLevel %u, Thread SyncLevel %u, " + "Prev SyncLevel %u, Depth %u TID %p\n", + ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, + PreviousSyncLevel, ObjDesc->Mutex.AcquisitionDepth, + WalkState->Thread)); + Status = AcpiExReleaseMutexObject (ObjDesc); if (ACPI_FAILURE (Status)) { @@ -482,6 +504,12 @@ AcpiExReleaseMutex ( OwnerThread->CurrentSyncLevel = PreviousSyncLevel; } + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Released: Object SyncLevel %u, Thread SyncLevel, %u, " + "Prev SyncLevel %u, Depth %u\n", + ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, + PreviousSyncLevel, ObjDesc->Mutex.AcquisitionDepth)); + return_ACPI_STATUS (Status); } @@ -512,7 +540,7 @@ AcpiExReleaseAllMutexes ( ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_FUNCTION_NAME (ExReleaseAllMutexes); + ACPI_FUNCTION_TRACE (ExReleaseAllMutexes); /* Traverse the list of owned mutexes, releasing each one */ @@ -520,14 +548,10 @@ AcpiExReleaseAllMutexes ( while (Next) { ObjDesc = Next; - Next = ObjDesc->Mutex.Next; - - ObjDesc->Mutex.Prev = NULL; - ObjDesc->Mutex.Next = NULL; - ObjDesc->Mutex.AcquisitionDepth = 0; - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Force-releasing held mutex: %p\n", ObjDesc)); + "Mutex [%4.4s] force-release, SyncLevel %u Depth %u\n", + ObjDesc->Mutex.Node->Name.Ascii, ObjDesc->Mutex.SyncLevel, + ObjDesc->Mutex.AcquisitionDepth)); /* Release the mutex, special case for Global Lock */ @@ -542,13 +566,20 @@ AcpiExReleaseAllMutexes ( AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); } + /* Update Thread SyncLevel (Last mutex is the important one) */ + + Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; + /* Mark mutex unowned */ + Next = ObjDesc->Mutex.Next; + + ObjDesc->Mutex.Prev = NULL; + ObjDesc->Mutex.Next = NULL; + ObjDesc->Mutex.AcquisitionDepth = 0; ObjDesc->Mutex.OwnerThread = NULL; ObjDesc->Mutex.ThreadId = 0; - - /* Update Thread SyncLevel (Last mutex is the important one) */ - - Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; } + + return_VOID; } diff --git a/source/components/executer/exnames.c b/source/components/executer/exnames.c index 61a5bbd7d29c..f679de6550b0 100644 --- a/source/components/executer/exnames.c +++ b/source/components/executer/exnames.c @@ -160,6 +160,7 @@ AcpiExAllocateNameString ( return_PTR (NameString); } + /******************************************************************************* * * FUNCTION: AcpiExNameSegment @@ -189,8 +190,8 @@ AcpiExNameSegment ( /* - * If first character is a digit, then we know that we aren't looking at a - * valid name segment + * If first character is a digit, then we know that we aren't looking + * at a valid name segment */ CharBuf[0] = *AmlAddress; @@ -394,7 +395,8 @@ AcpiExGetNameString ( AmlAddress++; NumSegments = *AmlAddress; - NameString = AcpiExAllocateNameString (PrefixCount, NumSegments); + NameString = AcpiExAllocateNameString ( + PrefixCount, NumSegments); if (!NameString) { Status = AE_NO_MEMORY; diff --git a/source/components/executer/exoparg1.c b/source/components/executer/exoparg1.c index e44dda776331..4d2d88f64862 100644 --- a/source/components/executer/exoparg1.c +++ b/source/components/executer/exoparg1.c @@ -331,7 +331,7 @@ AcpiExOpcode_1A_1T_1R ( * endian unsigned value, so this boundary condition is valid. */ for (Temp32 = 0; ReturnDesc->Integer.Value && - Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) + Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) { ReturnDesc->Integer.Value >>= 1; } @@ -348,7 +348,7 @@ AcpiExOpcode_1A_1T_1R ( * endian unsigned value, so this boundary condition is valid. */ for (Temp32 = 0; ReturnDesc->Integer.Value && - Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) + Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) { ReturnDesc->Integer.Value <<= 1; } @@ -454,7 +454,7 @@ AcpiExOpcode_1A_1T_1R ( /* Get the object reference, store it, and remove our reference */ Status = AcpiExGetObjectReference (Operand[0], - &ReturnDesc2, WalkState); + &ReturnDesc2, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -509,28 +509,30 @@ AcpiExOpcode_1A_1T_1R ( */ case AML_COPY_OP: /* Copy (Source, Target) */ - Status = AcpiUtCopyIobjectToIobject (Operand[0], &ReturnDesc, - WalkState); + Status = AcpiUtCopyIobjectToIobject ( + Operand[0], &ReturnDesc, WalkState); break; case AML_TO_DECSTRING_OP: /* ToDecimalString (Data, Result) */ - Status = AcpiExConvertToString (Operand[0], &ReturnDesc, - ACPI_EXPLICIT_CONVERT_DECIMAL); + Status = AcpiExConvertToString ( + Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_DECIMAL); if (ReturnDesc == Operand[0]) { /* No conversion performed, add ref to handle return value */ + AcpiUtAddReference (ReturnDesc); } break; case AML_TO_HEXSTRING_OP: /* ToHexString (Data, Result) */ - Status = AcpiExConvertToString (Operand[0], &ReturnDesc, - ACPI_EXPLICIT_CONVERT_HEX); + Status = AcpiExConvertToString ( + Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_HEX); if (ReturnDesc == Operand[0]) { /* No conversion performed, add ref to handle return value */ + AcpiUtAddReference (ReturnDesc); } break; @@ -541,17 +543,19 @@ AcpiExOpcode_1A_1T_1R ( if (ReturnDesc == Operand[0]) { /* No conversion performed, add ref to handle return value */ + AcpiUtAddReference (ReturnDesc); } break; case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */ - Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc, - ACPI_ANY_BASE); + Status = AcpiExConvertToInteger ( + Operand[0], &ReturnDesc, ACPI_ANY_BASE); if (ReturnDesc == Operand[0]) { /* No conversion performed, add ref to handle return value */ + AcpiUtAddReference (ReturnDesc); } break; @@ -702,11 +706,11 @@ AcpiExOpcode_1A_0T_1R ( */ if (WalkState->Opcode == AML_INCREMENT_OP) { - ReturnDesc->Integer.Value = TempDesc->Integer.Value +1; + ReturnDesc->Integer.Value = TempDesc->Integer.Value + 1; } else { - ReturnDesc->Integer.Value = TempDesc->Integer.Value -1; + ReturnDesc->Integer.Value = TempDesc->Integer.Value - 1; } /* Finished with this Integer object */ @@ -754,8 +758,8 @@ AcpiExOpcode_1A_0T_1R ( /* Get the base object */ - Status = AcpiExResolveMultiple (WalkState, - Operand[0], &Type, &TempDesc); + Status = AcpiExResolveMultiple ( + WalkState, Operand[0], &Type, &TempDesc); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -801,8 +805,10 @@ AcpiExOpcode_1A_0T_1R ( default: ACPI_ERROR ((AE_INFO, - "Operand must be Buffer/Integer/String/Package - found type %s", + "Operand must be Buffer/Integer/String/Package" + " - found type %s", AcpiUtGetTypeName (Type))); + Status = AE_AML_OPERAND_TYPE; goto Cleanup; } @@ -827,7 +833,8 @@ AcpiExOpcode_1A_0T_1R ( case AML_REF_OF_OP: /* RefOf (SourceObject) */ - Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc, WalkState); + Status = AcpiExGetObjectReference ( + Operand[0], &ReturnDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -874,9 +881,9 @@ AcpiExOpcode_1A_0T_1R ( /* Set Operand[0] to the value of the local/arg */ Status = AcpiDsMethodDataGetValue ( - Operand[0]->Reference.Class, - Operand[0]->Reference.Value, - WalkState, &TempDesc); + Operand[0]->Reference.Class, + Operand[0]->Reference.Value, + WalkState, &TempDesc); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -930,19 +937,19 @@ AcpiExOpcode_1A_0T_1R ( * Field, so we need to resolve the node to a value. */ Status = AcpiNsGetNode (WalkState->ScopeInfo->Scope.Node, - Operand[0]->String.Pointer, - ACPI_NS_SEARCH_PARENT, - ACPI_CAST_INDIRECT_PTR ( - ACPI_NAMESPACE_NODE, &ReturnDesc)); + Operand[0]->String.Pointer, + ACPI_NS_SEARCH_PARENT, + ACPI_CAST_INDIRECT_PTR ( + ACPI_NAMESPACE_NODE, &ReturnDesc)); if (ACPI_FAILURE (Status)) { goto Cleanup; } Status = AcpiExResolveNodeToValue ( - ACPI_CAST_INDIRECT_PTR ( - ACPI_NAMESPACE_NODE, &ReturnDesc), - WalkState); + ACPI_CAST_INDIRECT_PTR ( + ACPI_NAMESPACE_NODE, &ReturnDesc), + WalkState); goto Cleanup; } } @@ -958,7 +965,7 @@ AcpiExOpcode_1A_0T_1R ( * dereferenced above. */ ReturnDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) Operand[0]); + (ACPI_NAMESPACE_NODE *) Operand[0]); AcpiUtAddReference (ReturnDesc); } else @@ -1025,6 +1032,7 @@ AcpiExOpcode_1A_0T_1R ( ACPI_ERROR ((AE_INFO, "Unknown Index TargetType 0x%X in reference object %p", Operand[0]->Reference.TargetType, Operand[0])); + Status = AE_AML_OPERAND_TYPE; goto Cleanup; } @@ -1055,8 +1063,8 @@ AcpiExOpcode_1A_0T_1R ( case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - Status = AcpiExReadDataFromField (WalkState, - ReturnDesc, &TempDesc); + Status = AcpiExReadDataFromField ( + WalkState, ReturnDesc, &TempDesc); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -1091,6 +1099,7 @@ AcpiExOpcode_1A_0T_1R ( ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); + Status = AE_AML_BAD_OPCODE; goto Cleanup; } diff --git a/source/components/executer/exoparg2.c b/source/components/executer/exoparg2.c index a5b1513e4028..25b4be3b75d8 100644 --- a/source/components/executer/exoparg2.c +++ b/source/components/executer/exoparg2.c @@ -203,10 +203,11 @@ AcpiExOpcode_2A_2T_1R ( /* Quotient to ReturnDesc1, remainder to ReturnDesc2 */ - Status = AcpiUtDivide (Operand[0]->Integer.Value, - Operand[1]->Integer.Value, - &ReturnDesc1->Integer.Value, - &ReturnDesc2->Integer.Value); + Status = AcpiUtDivide ( + Operand[0]->Integer.Value, + Operand[1]->Integer.Value, + &ReturnDesc1->Integer.Value, + &ReturnDesc2->Integer.Value); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -217,6 +218,7 @@ AcpiExOpcode_2A_2T_1R ( ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); + Status = AE_AML_BAD_OPCODE; goto Cleanup; } @@ -301,9 +303,10 @@ AcpiExOpcode_2A_1T_1R ( goto Cleanup; } - ReturnDesc->Integer.Value = AcpiExDoMathOp (WalkState->Opcode, - Operand[0]->Integer.Value, - Operand[1]->Integer.Value); + ReturnDesc->Integer.Value = AcpiExDoMathOp ( + WalkState->Opcode, + Operand[0]->Integer.Value, + Operand[1]->Integer.Value); goto StoreResultToTarget; } @@ -320,16 +323,17 @@ AcpiExOpcode_2A_1T_1R ( /* ReturnDesc will contain the remainder */ - Status = AcpiUtDivide (Operand[0]->Integer.Value, - Operand[1]->Integer.Value, - NULL, - &ReturnDesc->Integer.Value); + Status = AcpiUtDivide ( + Operand[0]->Integer.Value, + Operand[1]->Integer.Value, + NULL, + &ReturnDesc->Integer.Value); break; case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ - Status = AcpiExDoConcatenate (Operand[0], Operand[1], - &ReturnDesc, WalkState); + Status = AcpiExDoConcatenate ( + Operand[0], Operand[1], &ReturnDesc, WalkState); break; case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */ @@ -376,8 +380,8 @@ AcpiExOpcode_2A_1T_1R ( /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */ - Status = AcpiExConcatTemplate (Operand[0], Operand[1], - &ReturnDesc, WalkState); + Status = AcpiExConcatTemplate ( + Operand[0], Operand[1], &ReturnDesc, WalkState); break; case AML_INDEX_OP: /* Index (Source Index Result) */ @@ -560,8 +564,8 @@ AcpiExOpcode_2A_0T_1R ( /* LogicalOp (Operand0, Operand1) */ Status = AcpiExDoLogicalNumericOp (WalkState->Opcode, - Operand[0]->Integer.Value, Operand[1]->Integer.Value, - &LogicalResult); + Operand[0]->Integer.Value, Operand[1]->Integer.Value, + &LogicalResult); goto StoreLogicalResult; } else if (WalkState->OpInfo->Flags & AML_LOGICAL) @@ -569,7 +573,7 @@ AcpiExOpcode_2A_0T_1R ( /* LogicalOp (Operand0, Operand1) */ Status = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0], - Operand[1], &LogicalResult); + Operand[1], &LogicalResult); goto StoreLogicalResult; } @@ -600,6 +604,7 @@ AcpiExOpcode_2A_0T_1R ( ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); + Status = AE_AML_BAD_OPCODE; goto Cleanup; } diff --git a/source/components/executer/exoparg3.c b/source/components/executer/exoparg3.c index aa42edbfbfb9..6d777bfb8e64 100644 --- a/source/components/executer/exoparg3.c +++ b/source/components/executer/exoparg3.c @@ -105,7 +105,8 @@ AcpiExOpcode_3A_0T_0R ( case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", + "FatalOp: Type %X Code %X Arg %X " + "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", (UINT32) Operand[0]->Integer.Value, (UINT32) Operand[1]->Integer.Value, (UINT32) Operand[2]->Integer.Value)); @@ -113,8 +114,8 @@ AcpiExOpcode_3A_0T_0R ( Fatal = ACPI_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO)); if (Fatal) { - Fatal->Type = (UINT32) Operand[0]->Integer.Value; - Fatal->Code = (UINT32) Operand[1]->Integer.Value; + Fatal->Type = (UINT32) Operand[0]->Integer.Value; + Fatal->Code = (UINT32) Operand[1]->Integer.Value; Fatal->Argument = (UINT32) Operand[2]->Integer.Value; } @@ -142,6 +143,7 @@ AcpiExOpcode_3A_0T_0R ( ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); + Status = AE_AML_BAD_OPCODE; goto Cleanup; } @@ -189,7 +191,7 @@ AcpiExOpcode_3A_1T_1R ( * either a String or a Buffer, so just use its type. */ ReturnDesc = AcpiUtCreateInternalObject ( - (Operand[0])->Common.Type); + (Operand[0])->Common.Type); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -214,8 +216,8 @@ AcpiExOpcode_3A_1T_1R ( else if ((Index + Length) > Operand[0]->String.Length) { - Length = (ACPI_SIZE) Operand[0]->String.Length - - (ACPI_SIZE) Index; + Length = + (ACPI_SIZE) Operand[0]->String.Length - (ACPI_SIZE) Index; } /* Strings always have a sub-pointer, not so for buffers */ @@ -261,8 +263,8 @@ AcpiExOpcode_3A_1T_1R ( { /* We have a buffer, copy the portion requested */ - memcpy (Buffer, Operand[0]->String.Pointer + Index, - Length); + memcpy (Buffer, + Operand[0]->String.Pointer + Index, Length); } /* Set the length of the new String/Buffer */ @@ -279,6 +281,7 @@ AcpiExOpcode_3A_1T_1R ( ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); + Status = AE_AML_BAD_OPCODE; goto Cleanup; } @@ -296,12 +299,12 @@ Cleanup: AcpiUtRemoveReference (ReturnDesc); WalkState->ResultObj = NULL; } - - /* Set the return object and exit */ - else { + /* Set the return object and exit */ + WalkState->ResultObj = ReturnDesc; } + return_ACPI_STATUS (Status); } diff --git a/source/components/executer/exoparg6.c b/source/components/executer/exoparg6.c index ccc1c7881eb3..5b68b3833f21 100644 --- a/source/components/executer/exoparg6.c +++ b/source/components/executer/exoparg6.c @@ -132,8 +132,8 @@ AcpiExDoMatch ( * True if equal: (P[i] == M) * Change to: (M == P[i]) */ - Status = AcpiExDoLogicalOp (AML_LEQUAL_OP, MatchObj, PackageObj, - &LogicalResult); + Status = AcpiExDoLogicalOp ( + AML_LEQUAL_OP, MatchObj, PackageObj, &LogicalResult); if (ACPI_FAILURE (Status)) { return (FALSE); @@ -145,8 +145,8 @@ AcpiExDoMatch ( * True if less than or equal: (P[i] <= M) (P[i] NotGreater than M) * Change to: (M >= P[i]) (M NotLess than P[i]) */ - Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj, - &LogicalResult); + Status = AcpiExDoLogicalOp ( + AML_LLESS_OP, MatchObj, PackageObj, &LogicalResult); if (ACPI_FAILURE (Status)) { return (FALSE); @@ -159,8 +159,8 @@ AcpiExDoMatch ( * True if less than: (P[i] < M) * Change to: (M > P[i]) */ - Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj, - &LogicalResult); + Status = AcpiExDoLogicalOp ( + AML_LGREATER_OP, MatchObj, PackageObj, &LogicalResult); if (ACPI_FAILURE (Status)) { return (FALSE); @@ -172,8 +172,8 @@ AcpiExDoMatch ( * True if greater than or equal: (P[i] >= M) (P[i] NotLess than M) * Change to: (M <= P[i]) (M NotGreater than P[i]) */ - Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj, - &LogicalResult); + Status = AcpiExDoLogicalOp ( + AML_LGREATER_OP, MatchObj, PackageObj, &LogicalResult); if (ACPI_FAILURE (Status)) { return (FALSE); @@ -186,8 +186,8 @@ AcpiExDoMatch ( * True if greater than: (P[i] > M) * Change to: (M < P[i]) */ - Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj, - &LogicalResult); + Status = AcpiExDoLogicalOp ( + AML_LLESS_OP, MatchObj, PackageObj, &LogicalResult); if (ACPI_FAILURE (Status)) { return (FALSE); @@ -303,13 +303,13 @@ AcpiExOpcode_6A_0T_1R ( * non-match. */ if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value, - ThisElement, Operand[2])) + ThisElement, Operand[2])) { continue; } if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value, - ThisElement, Operand[4])) + ThisElement, Operand[4])) { continue; } @@ -330,6 +330,7 @@ AcpiExOpcode_6A_0T_1R ( ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); + Status = AE_AML_BAD_OPCODE; goto Cleanup; } diff --git a/source/components/executer/exprep.c b/source/components/executer/exprep.c index 6cadb507703e..7676e25ca445 100644 --- a/source/components/executer/exprep.c +++ b/source/components/executer/exprep.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities + * Module Name: exprep - ACPI AML field prep utilities * *****************************************************************************/ @@ -69,6 +69,7 @@ AcpiExGenerateAccess ( UINT32 FieldBitLength, UINT32 RegionLength); + /******************************************************************************* * * FUNCTION: AcpiExGenerateAccess @@ -113,10 +114,13 @@ AcpiExGenerateAccess ( /* Round Field start offset and length to "minimal" byte boundaries */ - FieldByteOffset = ACPI_DIV_8 (ACPI_ROUND_DOWN (FieldBitOffset, 8)); - FieldByteEndOffset = ACPI_DIV_8 (ACPI_ROUND_UP (FieldBitLength + - FieldBitOffset, 8)); - FieldByteLength = FieldByteEndOffset - FieldByteOffset; + FieldByteOffset = ACPI_DIV_8 ( + ACPI_ROUND_DOWN (FieldBitOffset, 8)); + + FieldByteEndOffset = ACPI_DIV_8 ( + ACPI_ROUND_UP (FieldBitLength + FieldBitOffset, 8)); + + FieldByteLength = FieldByteEndOffset - FieldByteOffset; ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Bit length %u, Bit offset %u\n", @@ -141,7 +145,8 @@ AcpiExGenerateAccess ( * are done. (This does not optimize for the perfectly aligned * case yet). */ - if (ACPI_ROUND_UP (FieldByteEndOffset, AccessByteWidth) <= RegionLength) + if (ACPI_ROUND_UP (FieldByteEndOffset, AccessByteWidth) <= + RegionLength) { FieldStartOffset = ACPI_ROUND_DOWN (FieldByteOffset, AccessByteWidth) / @@ -165,7 +170,8 @@ AcpiExGenerateAccess ( if (Accesses <= 1) { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Entire field can be accessed with one operation of size %u\n", + "Entire field can be accessed " + "with one operation of size %u\n", AccessByteWidth)); return_VALUE (AccessByteWidth); } @@ -176,14 +182,15 @@ AcpiExGenerateAccess ( */ if (Accesses < MinimumAccesses) { - MinimumAccesses = Accesses; + MinimumAccesses = Accesses; MinimumAccessWidth = AccessByteWidth; } } else { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "AccessWidth %u end is NOT within region\n", AccessByteWidth)); + "AccessWidth %u end is NOT within region\n", + AccessByteWidth)); if (AccessByteWidth == 1) { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, @@ -211,6 +218,7 @@ AcpiExGenerateAccess ( */ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Cannot access field in one operation, using width 8\n")); + return_VALUE (8); } #endif /* ACPI_UNDER_DEVELOPMENT */ @@ -295,6 +303,7 @@ AcpiExDecodeFieldAccess ( ACPI_ERROR ((AE_INFO, "Unknown field access type 0x%X", Access)); + return_UINT32 (0); } @@ -374,8 +383,8 @@ AcpiExPrepCommonFieldObject ( * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is * the same (equivalent) as the ByteAlignment. */ - AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags, - &ByteAlignment); + AccessBitWidth = AcpiExDecodeFieldAccess ( + ObjDesc, FieldFlags, &ByteAlignment); if (!AccessBitWidth) { return_ACPI_STATUS (AE_AML_OPERAND_VALUE); @@ -471,8 +480,8 @@ AcpiExPrepFieldValue ( ObjDesc->CommonField.Node = Info->FieldNode; Status = AcpiExPrepCommonFieldObject (ObjDesc, - Info->FieldFlags, Info->Attribute, - Info->FieldBitPosition, Info->FieldBitLength); + Info->FieldFlags, Info->Attribute, + Info->FieldBitPosition, Info->FieldBitLength); if (ACPI_FAILURE (Status)) { AcpiUtDeleteObjectDesc (ObjDesc); @@ -504,8 +513,10 @@ AcpiExPrepFieldValue ( } } - ObjDesc->Field.ResourceBuffer = SecondDesc->Buffer.Pointer; - ObjDesc->Field.ResourceLength = (UINT16) SecondDesc->Buffer.Length; + ObjDesc->Field.ResourceBuffer = + SecondDesc->Buffer.Pointer; + ObjDesc->Field.ResourceLength = + (UINT16) SecondDesc->Buffer.Length; } else if (Info->ResourceBuffer) { @@ -527,7 +538,8 @@ AcpiExPrepFieldValue ( if (AccessByteWidth < 256) { - ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth; + ObjDesc->CommonField.AccessByteWidth = + (UINT8) AccessByteWidth; } } @@ -537,8 +549,10 @@ AcpiExPrepFieldValue ( ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", - ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset, - ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj)); + ObjDesc->Field.StartFieldBitOffset, + ObjDesc->Field.BaseByteOffset, + ObjDesc->Field.AccessByteWidth, + ObjDesc->Field.RegionObj)); break; case ACPI_TYPE_LOCAL_BANK_FIELD: @@ -618,7 +632,8 @@ AcpiExPrepFieldValue ( ObjDesc->IndexField.AccessByteWidth); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", + "IndexField: BitOff %X, Off %X, Value %X, " + "Gran %X, Index %p, Data %p\n", ObjDesc->IndexField.StartFieldBitOffset, ObjDesc->IndexField.BaseByteOffset, ObjDesc->IndexField.Value, @@ -638,10 +653,11 @@ AcpiExPrepFieldValue ( * Store the constructed descriptor (ObjDesc) into the parent Node, * preserving the current type of that NamedObj. */ - Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc, - AcpiNsGetType (Info->FieldNode)); + Status = AcpiNsAttachObject ( + Info->FieldNode, ObjDesc, AcpiNsGetType (Info->FieldNode)); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Set NamedObj %p [%4.4s], ObjDesc %p\n", Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc)); /* Remove local reference to the object */ diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c index 6aaf69c84b5a..6e779097d84f 100644 --- a/source/components/executer/exregion.c +++ b/source/components/executer/exregion.c @@ -417,7 +417,8 @@ AcpiExPciConfigSpaceHandler ( PciRegister = (UINT16) (UINT32) Address; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", + "Pci-Config %u (%u) Seg(%04x) Bus(%04x) " + "Dev(%04x) Func(%04x) Reg(%04x)\n", Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device, PciId->Function, PciRegister)); @@ -426,14 +427,14 @@ AcpiExPciConfigSpaceHandler ( case ACPI_READ: *Value = 0; - Status = AcpiOsReadPciConfiguration (PciId, PciRegister, - Value, BitWidth); + Status = AcpiOsReadPciConfiguration ( + PciId, PciRegister, Value, BitWidth); break; case ACPI_WRITE: - Status = AcpiOsWritePciConfiguration (PciId, PciRegister, - *Value, BitWidth); + Status = AcpiOsWritePciConfiguration ( + PciId, PciRegister, *Value, BitWidth); break; default: diff --git a/source/components/executer/exresnte.c b/source/components/executer/exresnte.c index 0aa52629e85e..c094663717c3 100644 --- a/source/components/executer/exresnte.c +++ b/source/components/executer/exresnte.c @@ -98,9 +98,9 @@ AcpiExResolveNodeToValue ( * The stack pointer points to a ACPI_NAMESPACE_NODE (Node). Get the * object that is attached to the Node. */ - Node = *ObjectPtr; + Node = *ObjectPtr; SourceDesc = AcpiNsGetAttachedObject (Node); - EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); + EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n", Node, SourceDesc, AcpiUtGetTypeName (EntryType))); @@ -110,15 +110,15 @@ AcpiExResolveNodeToValue ( { /* There is always exactly one level of indirection */ - Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object); + Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object); SourceDesc = AcpiNsGetAttachedObject (Node); - EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); + EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); *ObjectPtr = Node; } /* * Several object types require no further processing: - * 1) Device/Thermal objects don't have a "real" subobject, return the Node + * 1) Device/Thermal objects don't have a "real" subobject, return Node * 2) Method locals and arguments have a pseudo-Node * 3) 10/2007: Added method type to assist with Package construction. */ diff --git a/source/components/executer/exresolv.c b/source/components/executer/exresolv.c index 79878c669aa0..2678e59cca4e 100644 --- a/source/components/executer/exresolv.c +++ b/source/components/executer/exresolv.c @@ -119,8 +119,8 @@ AcpiExResolveToValue ( if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_NAMED) { Status = AcpiExResolveNodeToValue ( - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, StackPtr), - WalkState); + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, StackPtr), + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -179,7 +179,7 @@ AcpiExResolveObjectToValue ( * Note: this increments the local's object reference count */ Status = AcpiDsMethodDataGetValue (RefType, - StackDesc->Reference.Value, WalkState, &ObjDesc); + StackDesc->Reference.Value, WalkState, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -235,7 +235,8 @@ AcpiExResolveObjectToValue ( * the package, can't dereference it */ ACPI_ERROR ((AE_INFO, - "Attempt to dereference an Index to NULL package element Idx=%p", + "Attempt to dereference an Index to " + "NULL package element Idx=%p", StackDesc)); Status = AE_AML_UNINITIALIZED_ELEMENT; } @@ -286,7 +287,8 @@ AcpiExResolveObjectToValue ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference type 0x%X in %p", RefType, StackDesc)); + "Unknown Reference type 0x%X in %p", + RefType, StackDesc)); Status = AE_AML_INTERNAL; break; } @@ -307,7 +309,8 @@ AcpiExResolveObjectToValue ( case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "FieldRead SourceDesc=%p Type=%X\n", StackDesc, StackDesc->Common.Type)); Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc); @@ -378,7 +381,8 @@ AcpiExResolveMultiple ( if (Type == ACPI_TYPE_LOCAL_ALIAS) { Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; - ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc); + ObjDesc = AcpiNsGetAttachedObject ( + (ACPI_NAMESPACE_NODE *) ObjDesc); } if (!ObjDesc) @@ -492,7 +496,7 @@ AcpiExResolveMultiple ( if (ReturnDesc) { Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class, - ObjDesc->Reference.Value, WalkState, &ObjDesc); + ObjDesc->Reference.Value, WalkState, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -502,7 +506,7 @@ AcpiExResolveMultiple ( else { Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Class, - ObjDesc->Reference.Value, WalkState, &Node); + ObjDesc->Reference.Value, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -527,7 +531,8 @@ AcpiExResolveMultiple ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference Class 0x%2.2X", ObjDesc->Reference.Class)); + "Unknown Reference Class 0x%2.2X", + ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_INTERNAL); } } diff --git a/source/components/executer/exresop.c b/source/components/executer/exresop.c index d4c528905fd7..3fec899eb44b 100644 --- a/source/components/executer/exresop.c +++ b/source/components/executer/exresop.c @@ -99,7 +99,8 @@ AcpiExCheckObjectType ( * specification, a store to a constant is a noop.) */ if ((ThisType == ACPI_TYPE_INTEGER) && - (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT)) + (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & + AOPOBJ_AML_CONSTANT)) { return (AE_OK); } @@ -216,7 +217,8 @@ AcpiExResolveOperands ( */ if (ObjectType == ACPI_TYPE_LOCAL_ALIAS) { - ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc); + ObjDesc = AcpiNsGetAttachedObject ( + (ACPI_NAMESPACE_NODE *) ObjDesc); *StackPtr = ObjDesc; ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; } @@ -297,7 +299,8 @@ AcpiExResolveOperands ( { case ARGI_REF_OR_STRING: /* Can be a String or Reference */ - if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) && + if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == + ACPI_DESC_TYPE_OPERAND) && (ObjDesc->Common.Type == ACPI_TYPE_STRING)) { /* @@ -331,8 +334,8 @@ AcpiExResolveOperands ( goto NextOperand; } - Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE, - ObjectType, ObjDesc); + Status = AcpiExCheckObjectType ( + ACPI_TYPE_LOCAL_REFERENCE, ObjectType, ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -483,8 +486,8 @@ AcpiExResolveOperands ( * But we can implicitly convert from a BUFFER or INTEGER * Aka - "Implicit Source Operand Conversion" */ - Status = AcpiExConvertToString (ObjDesc, StackPtr, - ACPI_IMPLICIT_CONVERT_HEX); + Status = AcpiExConvertToString ( + ObjDesc, StackPtr, ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) @@ -617,8 +620,10 @@ AcpiExResolveOperands ( case ARGI_REGION_OR_BUFFER: /* Used by Load() only */ - /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ - + /* + * Need an operand of type REGION or a BUFFER + * (which could be a resolved region field) + */ switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER: @@ -662,9 +667,9 @@ AcpiExResolveOperands ( if (AcpiGbl_EnableInterpreterSlack) { /* - * Enable original behavior of Store(), allowing any and all - * objects as the source operand. The ACPI spec does not - * allow this, however. + * Enable original behavior of Store(), allowing any + * and all objects as the source operand. The ACPI + * spec does not allow this, however. */ break; } @@ -677,7 +682,8 @@ AcpiExResolveOperands ( } ACPI_ERROR ((AE_INFO, - "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p", + "Needed Integer/Buffer/String/Package/Ref/Ddb]" + ", found [%s] %p", AcpiUtGetObjectTypeName (ObjDesc), ObjDesc)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -699,8 +705,8 @@ AcpiExResolveOperands ( * Make sure that the original object was resolved to the * required object type (Simple cases only). */ - Status = AcpiExCheckObjectType (TypeNeeded, - (*StackPtr)->Common.Type, *StackPtr); + Status = AcpiExCheckObjectType ( + TypeNeeded, (*StackPtr)->Common.Type, *StackPtr); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/executer/exstore.c b/source/components/executer/exstore.c index 1f2f912170fa..026bc166462c 100644 --- a/source/components/executer/exstore.c +++ b/source/components/executer/exstore.c @@ -117,8 +117,8 @@ AcpiExStore ( * Storing an object into a Named node. */ Status = AcpiExStoreObjectToNode (SourceDesc, - (ACPI_NAMESPACE_NODE *) DestDesc, WalkState, - ACPI_IMPLICIT_CONVERSION); + (ACPI_NAMESPACE_NODE *) DestDesc, WalkState, + ACPI_IMPLICIT_CONVERSION); return_ACPI_STATUS (Status); } @@ -168,8 +168,8 @@ AcpiExStore ( /* Storing an object into a Name "container" */ Status = AcpiExStoreObjectToNode (SourceDesc, - RefDesc->Reference.Object, - WalkState, ACPI_IMPLICIT_CONVERSION); + RefDesc->Reference.Object, + WalkState, ACPI_IMPLICIT_CONVERSION); break; case ACPI_REFCLASS_INDEX: @@ -185,7 +185,7 @@ AcpiExStore ( /* Store to a method local/arg */ Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class, - RefDesc->Reference.Value, SourceDesc, WalkState); + RefDesc->Reference.Value, SourceDesc, WalkState); break; case ACPI_REFCLASS_DEBUG: @@ -274,7 +274,8 @@ AcpiExStoreObjectToIndex ( { /* Normal object, copy it */ - Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); + Status = AcpiUtCopyIobjectToIobject ( + SourceDesc, &NewDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -487,7 +488,8 @@ AcpiExStoreObjectToNode ( case ACPI_TYPE_THERMAL: ACPI_ERROR ((AE_INFO, - "Target must be [Buffer/Integer/String/Reference], found [%s] (%4.4s)", + "Target must be [Buffer/Integer/String/Reference]" + ", found [%s] (%4.4s)", AcpiUtGetTypeName (Node->Type), Node->Name.Ascii)); return_ACPI_STATUS (AE_AML_TARGET_TYPE); @@ -527,8 +529,7 @@ AcpiExStoreObjectToNode ( * an implicit conversion, as per the ACPI specification. * A direct store is performed instead. */ - Status = AcpiExStoreDirectToNode (SourceDesc, Node, - WalkState); + Status = AcpiExStoreDirectToNode (SourceDesc, Node, WalkState); break; } @@ -552,8 +553,8 @@ AcpiExStoreObjectToNode ( * store has been performed such that the node/object type * has been changed. */ - Status = AcpiNsAttachObject (Node, NewDesc, - NewDesc->Common.Type); + Status = AcpiNsAttachObject ( + Node, NewDesc, NewDesc->Common.Type); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Store type [%s] into [%s] via Convert/Attach\n", @@ -585,8 +586,7 @@ AcpiExStoreObjectToNode ( * operator. (Note, for this default case, all normal * Store/Target operations exited above with an error). */ - Status = AcpiExStoreDirectToNode (SourceDesc, Node, - WalkState); + Status = AcpiExStoreDirectToNode (SourceDesc, Node, WalkState); break; } diff --git a/source/components/executer/exstoren.c b/source/components/executer/exstoren.c index f5844387d572..b2cc7829f972 100644 --- a/source/components/executer/exstoren.c +++ b/source/components/executer/exstoren.c @@ -124,7 +124,7 @@ AcpiExResolveObject ( (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) && (SourceDesc->Common.Type != ACPI_TYPE_STRING) && !((SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - (SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE))) + (SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE))) { /* Conversion successful but still not a valid type */ @@ -233,7 +233,7 @@ AcpiExStoreObjectToObject ( * converted object. */ Status = AcpiExConvertToTargetType (DestDesc->Common.Type, - SourceDesc, &ActualSrcDesc, WalkState); + SourceDesc, &ActualSrcDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/executer/exstorob.c b/source/components/executer/exstorob.c index 87791c03904a..6b1a488e318b 100644 --- a/source/components/executer/exstorob.c +++ b/source/components/executer/exstorob.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: exstorob - AML Interpreter object store support, store to object + * Module Name: exstorob - AML object store support, store to object * *****************************************************************************/ @@ -221,8 +221,9 @@ AcpiExStoreStringToString ( ACPI_FREE (TargetDesc->String.Pointer); } - TargetDesc->String.Pointer = ACPI_ALLOCATE_ZEROED ( - (ACPI_SIZE) Length + 1); + TargetDesc->String.Pointer = + ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Length + 1); + if (!TargetDesc->String.Pointer) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/source/components/executer/exsystem.c b/source/components/executer/exsystem.c index 2862c0d5209f..f467c26462b8 100644 --- a/source/components/executer/exsystem.c +++ b/source/components/executer/exsystem.c @@ -86,7 +86,6 @@ AcpiExSystemWaitSemaphore ( /* We must wait, so unlock the interpreter */ AcpiExExitInterpreter (); - Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, @@ -139,7 +138,6 @@ AcpiExSystemWaitMutex ( /* We must wait, so unlock the interpreter */ AcpiExExitInterpreter (); - Status = AcpiOsAcquireMutex (Mutex, Timeout); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, @@ -190,8 +188,8 @@ AcpiExSystemDoStall ( * (ACPI specifies 100 usec as max, but this gives some slack in * order to support existing BIOSs) */ - ACPI_ERROR ((AE_INFO, "Time parameter is too large (%u)", - HowLong)); + ACPI_ERROR ((AE_INFO, + "Time parameter is too large (%u)", HowLong)); Status = AE_AML_OPERAND_VALUE; } else @@ -306,7 +304,7 @@ AcpiExSystemWaitEvent ( if (ObjDesc) { Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.OsSemaphore, - (UINT16) TimeDesc->Integer.Value); + (UINT16) TimeDesc->Integer.Value); } return_ACPI_STATUS (Status); diff --git a/source/components/executer/extrace.c b/source/components/executer/extrace.c new file mode 100644 index 000000000000..9bf2e92e8982 --- /dev/null +++ b/source/components/executer/extrace.c @@ -0,0 +1,427 @@ +/****************************************************************************** + * + * Module Name: extrace - Support for interpreter execution tracing + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * 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. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * 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 MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acinterp.h" + + +#define _COMPONENT ACPI_EXECUTER + ACPI_MODULE_NAME ("extrace") + + +static ACPI_OPERAND_OBJECT *AcpiGbl_TraceMethodObject = NULL; + +/* Local prototypes */ + +#ifdef ACPI_DEBUG_OUTPUT +static const char * +AcpiExGetTraceEventName ( + ACPI_TRACE_EVENT_TYPE Type); +#endif + + +/******************************************************************************* + * + * FUNCTION: AcpiExInterpreterTraceEnabled + * + * PARAMETERS: Name - Whether method name should be matched, + * this should be checked before starting + * the tracer + * + * RETURN: TRUE if interpreter trace is enabled. + * + * DESCRIPTION: Check whether interpreter trace is enabled + * + ******************************************************************************/ + +static BOOLEAN +AcpiExInterpreterTraceEnabled ( + char *Name) +{ + + /* Check if tracing is enabled */ + + if (!(AcpiGbl_TraceFlags & ACPI_TRACE_ENABLED)) + { + return (FALSE); + } + + /* + * Check if tracing is filtered: + * + * 1. If the tracer is started, AcpiGbl_TraceMethodObject should have + * been filled by the trace starter + * 2. If the tracer is not started, AcpiGbl_TraceMethodName should be + * matched if it is specified + * 3. If the tracer is oneshot style, AcpiGbl_TraceMethodName should + * not be cleared by the trace stopper during the first match + */ + if (AcpiGbl_TraceMethodObject) + { + return (TRUE); + } + + if (Name && + (AcpiGbl_TraceMethodName && + strcmp (AcpiGbl_TraceMethodName, Name))) + { + return (FALSE); + } + + if ((AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) && + !AcpiGbl_TraceMethodName) + { + return (FALSE); + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExGetTraceEventName + * + * PARAMETERS: Type - Trace event type + * + * RETURN: Trace event name. + * + * DESCRIPTION: Used to obtain the full trace event name. + * + ******************************************************************************/ + +#ifdef ACPI_DEBUG_OUTPUT + +static const char * +AcpiExGetTraceEventName ( + ACPI_TRACE_EVENT_TYPE Type) +{ + + switch (Type) + { + case ACPI_TRACE_AML_METHOD: + + return "Method"; + + case ACPI_TRACE_AML_OPCODE: + + return "Opcode"; + + case ACPI_TRACE_AML_REGION: + + return "Region"; + + default: + + return ""; + } +} + +#endif + + +/******************************************************************************* + * + * FUNCTION: AcpiExTracePoint + * + * PARAMETERS: Type - Trace event type + * Begin - TRUE if before execution + * Aml - Executed AML address + * Pathname - Object path + * + * RETURN: None + * + * DESCRIPTION: Internal interpreter execution trace. + * + ******************************************************************************/ + +void +AcpiExTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname) +{ + + ACPI_FUNCTION_NAME (ExTracePoint); + + + if (Pathname) + { + ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, + "%s %s [0x%p:%s] execution.\n", + AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", + Aml, Pathname)); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT, + "%s %s [0x%p] execution.\n", + AcpiExGetTraceEventName (Type), Begin ? "Begin" : "End", + Aml)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExStartTraceMethod + * + * PARAMETERS: MethodNode - Node of the method + * ObjDesc - The method object + * WalkState - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Start control method execution trace + * + ******************************************************************************/ + +void +AcpiExStartTraceMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status; + char *Pathname = NULL; + BOOLEAN Enabled = FALSE; + + + ACPI_FUNCTION_NAME (ExStartTraceMethod); + + + if (MethodNode) + { + Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + Enabled = AcpiExInterpreterTraceEnabled (Pathname); + if (Enabled && !AcpiGbl_TraceMethodObject) + { + AcpiGbl_TraceMethodObject = ObjDesc; + AcpiGbl_OriginalDbgLevel = AcpiDbgLevel; + AcpiGbl_OriginalDbgLayer = AcpiDbgLayer; + AcpiDbgLevel = ACPI_TRACE_LEVEL_ALL; + AcpiDbgLayer = ACPI_TRACE_LAYER_ALL; + + if (AcpiGbl_TraceDbgLevel) + { + AcpiDbgLevel = AcpiGbl_TraceDbgLevel; + } + + if (AcpiGbl_TraceDbgLayer) + { + AcpiDbgLayer = AcpiGbl_TraceDbgLayer; + } + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + +Exit: + if (Enabled) + { + ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE, + ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); + } + + if (Pathname) + { + ACPI_FREE (Pathname); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExStopTraceMethod + * + * PARAMETERS: MethodNode - Node of the method + * ObjDesc - The method object + * WalkState - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Stop control method execution trace + * + ******************************************************************************/ + +void +AcpiExStopTraceMethod ( + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status; + char *Pathname = NULL; + BOOLEAN Enabled; + + + ACPI_FUNCTION_NAME (ExStopTraceMethod); + + + if (MethodNode) + { + Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + goto ExitPath; + } + + Enabled = AcpiExInterpreterTraceEnabled (NULL); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + if (Enabled) + { + ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE, + ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + goto ExitPath; + } + + /* Check whether the tracer should be stopped */ + + if (AcpiGbl_TraceMethodObject == ObjDesc) + { + /* Disable further tracing if type is one-shot */ + + if (AcpiGbl_TraceFlags & ACPI_TRACE_ONESHOT) + { + AcpiGbl_TraceMethodName = NULL; + } + + AcpiDbgLevel = AcpiGbl_OriginalDbgLevel; + AcpiDbgLayer = AcpiGbl_OriginalDbgLayer; + AcpiGbl_TraceMethodObject = NULL; + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + +ExitPath: + if (Pathname) + { + ACPI_FREE (Pathname); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExStartTraceOpcode + * + * PARAMETERS: Op - The parser opcode object + * WalkState - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Start opcode execution trace + * + ******************************************************************************/ + +void +AcpiExStartTraceOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState) +{ + + ACPI_FUNCTION_NAME (ExStartTraceOpcode); + + + if (AcpiExInterpreterTraceEnabled (NULL) && + (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) + { + ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, TRUE, + Op->Common.Aml, Op->Common.AmlOpName); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExStopTraceOpcode + * + * PARAMETERS: Op - The parser opcode object + * WalkState - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Stop opcode execution trace + * + ******************************************************************************/ + +void +AcpiExStopTraceOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState) +{ + + ACPI_FUNCTION_NAME (ExStopTraceOpcode); + + + if (AcpiExInterpreterTraceEnabled (NULL) && + (AcpiGbl_TraceFlags & ACPI_TRACE_OPCODE)) + { + ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE, FALSE, + Op->Common.Aml, Op->Common.AmlOpName); + } +} diff --git a/source/components/executer/exutils.c b/source/components/executer/exutils.c index a4cc73af0404..d3aef8a54284 100644 --- a/source/components/executer/exutils.c +++ b/source/components/executer/exutils.c @@ -187,8 +187,8 @@ AcpiExTruncateFor32bitTable ( (ObjDesc->Integer.Value > (UINT64) ACPI_UINT32_MAX)) { /* - * We are executing in a 32-bit ACPI table. - * Truncate the value to 32 bits by zeroing out the upper 32-bit field + * We are executing in a 32-bit ACPI table. Truncate + * the value to 32 bits by zeroing out the upper 32-bit field */ ObjDesc->Integer.Value &= (UINT64) ACPI_UINT32_MAX; return (TRUE); @@ -232,7 +232,7 @@ AcpiExAcquireGlobalLock ( /* Attempt to get the global lock, wait forever */ Status = AcpiExAcquireMutexObject (ACPI_WAIT_FOREVER, - AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); + AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); if (ACPI_FAILURE (Status)) { @@ -369,7 +369,8 @@ AcpiExEisaIdToString ( if (CompressedId > ACPI_UINT32_MAX) { ACPI_WARNING ((AE_INFO, - "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", + "Expected EISAID is larger than 32 bits: " + "0x%8.8X%8.8X, truncating", ACPI_FORMAT_UINT64 (CompressedId))); } @@ -496,5 +497,4 @@ AcpiIsValidSpaceId ( return (TRUE); } - #endif diff --git a/source/components/hardware/hwacpi.c b/source/components/hardware/hwacpi.c index dd92c9d06414..d22546f60a13 100644 --- a/source/components/hardware/hwacpi.c +++ b/source/components/hardware/hwacpi.c @@ -113,7 +113,7 @@ AcpiHwSetMode ( /* BIOS should have disabled ALL fixed and GP events */ Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, - (UINT32) AcpiGbl_FADT.AcpiEnable, 8); + (UINT32) AcpiGbl_FADT.AcpiEnable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); break; @@ -123,9 +123,9 @@ AcpiHwSetMode ( * enable bits to default */ Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, - (UINT32) AcpiGbl_FADT.AcpiDisable, 8); + (UINT32) AcpiGbl_FADT.AcpiDisable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Attempting to enable Legacy (non-ACPI) mode\n")); + "Attempting to enable Legacy (non-ACPI) mode\n")); break; default: @@ -149,8 +149,8 @@ AcpiHwSetMode ( { if (AcpiHwGetMode () == Mode) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", - Mode)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Mode %X successfully enabled\n", Mode)); return_ACPI_STATUS (AE_OK); } AcpiOsStall (ACPI_USEC_PER_MSEC); diff --git a/source/components/hardware/hwesleep.c b/source/components/hardware/hwesleep.c index 4d53c25316cb..adfc5c4d80e1 100644 --- a/source/components/hardware/hwesleep.c +++ b/source/components/hardware/hwesleep.c @@ -130,7 +130,8 @@ AcpiHwExtendedSleep ( /* Clear wake status (WAK_STS) */ - Status = AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus); + Status = AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, + &AcpiGbl_FADT.SleepStatus); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -202,7 +203,7 @@ AcpiHwExtendedWakePrep ( Status = AcpiGetSleepTypeData (ACPI_STATE_S0, - &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); + &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); if (ACPI_SUCCESS (Status)) { SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) & diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c index 1458f4fed22c..c4b3b6f9c30e 100644 --- a/source/components/hardware/hwgpe.c +++ b/source/components/hardware/hwgpe.c @@ -208,9 +208,7 @@ AcpiHwClearGpe ( */ RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - Status = AcpiHwWrite (RegisterBit, - &GpeRegisterInfo->StatusAddress); - + Status = AcpiHwWrite (RegisterBit, &GpeRegisterInfo->StatusAddress); return (Status); } @@ -251,7 +249,7 @@ AcpiHwGetGpeStatus ( /* GPE currently handled? */ if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != - ACPI_GPE_DISPATCH_NONE) + ACPI_GPE_DISPATCH_NONE) { LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER; } @@ -333,8 +331,8 @@ AcpiHwGpeEnableWrite ( GpeRegisterInfo->EnableMask = EnableMask; - Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); + Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); return (Status); } @@ -459,7 +457,7 @@ AcpiHwEnableRuntimeGpeBlock ( /* Enable all "runtime" GPEs in this register */ Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForRun, - GpeRegisterInfo); + GpeRegisterInfo); if (ACPI_FAILURE (Status)) { return (Status); @@ -506,7 +504,7 @@ AcpiHwEnableWakeupGpeBlock ( * remaining ones. */ Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForWake, - GpeRegisterInfo); + GpeRegisterInfo); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/components/hardware/hwregs.c b/source/components/hardware/hwregs.c index 60e3fef8b4a7..d7ef3ca0a9e2 100644 --- a/source/components/hardware/hwregs.c +++ b/source/components/hardware/hwregs.c @@ -68,6 +68,7 @@ AcpiHwWriteMultiple ( #endif /* !ACPI_REDUCED_HARDWARE */ + /****************************************************************************** * * FUNCTION: AcpiHwValidateRegister @@ -196,14 +197,14 @@ AcpiHwRead ( if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) - Address, &Value64, Reg->BitWidth); + Address, &Value64, Reg->BitWidth); *Value = (UINT32) Value64; } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) - Address, Value, Reg->BitWidth); + Address, Value, Reg->BitWidth); } ACPI_DEBUG_PRINT ((ACPI_DB_IO, @@ -257,12 +258,12 @@ AcpiHwWrite ( if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) - Address, (UINT64) Value, Reg->BitWidth); + Address, (UINT64) Value, Reg->BitWidth); } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) - Address, Value, Reg->BitWidth); + Address, Value, Reg->BitWidth); } ACPI_DEBUG_PRINT ((ACPI_DB_IO, @@ -307,7 +308,7 @@ AcpiHwClearAcpiStatus ( /* Clear the fixed events in PM1 A/B */ Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, - ACPI_BITMASK_ALL_FIXED_STATUS); + ACPI_BITMASK_ALL_FIXED_STATUS); AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); @@ -426,22 +427,22 @@ AcpiHwRegisterRead ( case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */ Status = AcpiHwReadMultiple (&Value, - &AcpiGbl_XPm1aStatus, - &AcpiGbl_XPm1bStatus); + &AcpiGbl_XPm1aStatus, + &AcpiGbl_XPm1bStatus); break; case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */ Status = AcpiHwReadMultiple (&Value, - &AcpiGbl_XPm1aEnable, - &AcpiGbl_XPm1bEnable); + &AcpiGbl_XPm1aEnable, + &AcpiGbl_XPm1bEnable); break; case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ Status = AcpiHwReadMultiple (&Value, - &AcpiGbl_FADT.XPm1aControlBlock, - &AcpiGbl_FADT.XPm1bControlBlock); + &AcpiGbl_FADT.XPm1aControlBlock, + &AcpiGbl_FADT.XPm1bControlBlock); /* * Zero the write-only bits. From the ACPI specification, "Hardware @@ -537,15 +538,15 @@ AcpiHwRegisterWrite ( Value &= ~ACPI_PM1_STATUS_PRESERVED_BITS; Status = AcpiHwWriteMultiple (Value, - &AcpiGbl_XPm1aStatus, - &AcpiGbl_XPm1bStatus); + &AcpiGbl_XPm1aStatus, + &AcpiGbl_XPm1bStatus); break; case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */ Status = AcpiHwWriteMultiple (Value, - &AcpiGbl_XPm1aEnable, - &AcpiGbl_XPm1bEnable); + &AcpiGbl_XPm1aEnable, + &AcpiGbl_XPm1bEnable); break; case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ @@ -554,8 +555,8 @@ AcpiHwRegisterWrite ( * Note: This includes SCI_EN, we never want to change this bit */ Status = AcpiHwReadMultiple (&ReadValue, - &AcpiGbl_FADT.XPm1aControlBlock, - &AcpiGbl_FADT.XPm1bControlBlock); + &AcpiGbl_FADT.XPm1aControlBlock, + &AcpiGbl_FADT.XPm1bControlBlock); if (ACPI_FAILURE (Status)) { goto Exit; @@ -568,8 +569,8 @@ AcpiHwRegisterWrite ( /* Now we can write the data */ Status = AcpiHwWriteMultiple (Value, - &AcpiGbl_FADT.XPm1aControlBlock, - &AcpiGbl_FADT.XPm1bControlBlock); + &AcpiGbl_FADT.XPm1aControlBlock, + &AcpiGbl_FADT.XPm1bControlBlock); break; case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ diff --git a/source/components/hardware/hwsleep.c b/source/components/hardware/hwsleep.c index f56110e04c2a..9517ad3a380b 100644 --- a/source/components/hardware/hwsleep.c +++ b/source/components/hardware/hwsleep.c @@ -83,7 +83,8 @@ AcpiHwLegacySleep ( /* Clear wake status */ - Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); + Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, + ACPI_CLEAR_STATUS); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -117,7 +118,7 @@ AcpiHwLegacySleep ( /* Get current value of PM1A control */ Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, - &Pm1aControl); + &Pm1aControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -128,7 +129,7 @@ AcpiHwLegacySleep ( /* Clear the SLP_EN and SLP_TYP fields */ Pm1aControl &= ~(SleepTypeRegInfo->AccessBitMask | - SleepEnableRegInfo->AccessBitMask); + SleepEnableRegInfo->AccessBitMask); Pm1bControl = Pm1aControl; /* Insert the SLP_TYP bits */ @@ -182,7 +183,7 @@ AcpiHwLegacySleep ( AcpiOsStall (10 * ACPI_USEC_PER_SEC); Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_CONTROL, - SleepEnableRegInfo->AccessBitMask); + SleepEnableRegInfo->AccessBitMask); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -238,7 +239,7 @@ AcpiHwLegacyWakePrep ( * by some machines. */ Status = AcpiGetSleepTypeData (ACPI_STATE_S0, - &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); + &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); if (ACPI_SUCCESS (Status)) { SleepTypeRegInfo = @@ -249,7 +250,7 @@ AcpiHwLegacyWakePrep ( /* Get current value of PM1A control */ Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, - &Pm1aControl); + &Pm1aControl); if (ACPI_SUCCESS (Status)) { /* Clear the SLP_EN and SLP_TYP fields */ @@ -334,7 +335,8 @@ AcpiHwLegacyWake ( * and use it to determine whether the system is rebooting or * resuming. Clear WAK_STS for compatibility. */ - (void) AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); + (void) AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, + ACPI_CLEAR_STATUS); AcpiGbl_SystemAwakeAndRunning = TRUE; /* Enable power button */ diff --git a/source/components/hardware/hwxface.c b/source/components/hardware/hwxface.c index 7a8b5a2a91cd..ab6a3277860b 100644 --- a/source/components/hardware/hwxface.c +++ b/source/components/hardware/hwxface.c @@ -169,7 +169,7 @@ AcpiRead ( if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) - Address, ReturnValue, Reg->BitWidth); + Address, ReturnValue, Reg->BitWidth); if (ACPI_FAILURE (Status)) { return (Status); @@ -187,7 +187,7 @@ AcpiRead ( } Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) - Address, &ValueLo, Width); + Address, &ValueLo, Width); if (ACPI_FAILURE (Status)) { return (Status); @@ -198,7 +198,7 @@ AcpiRead ( /* Read the top 32 bits */ Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) - (Address + 4), &ValueHi, 32); + (Address + 4), &ValueHi, 32); if (ACPI_FAILURE (Status)) { return (Status); @@ -263,7 +263,7 @@ AcpiWrite ( if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) - Address, Value, Reg->BitWidth); + Address, Value, Reg->BitWidth); if (ACPI_FAILURE (Status)) { return (Status); @@ -278,7 +278,7 @@ AcpiWrite ( } Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) - Address, ACPI_LODWORD (Value), Width); + Address, ACPI_LODWORD (Value), Width); if (ACPI_FAILURE (Status)) { return (Status); @@ -287,7 +287,7 @@ AcpiWrite ( if (Reg->BitWidth == 64) { Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) - (Address + 4), ACPI_HIDWORD (Value), 32); + (Address + 4), ACPI_HIDWORD (Value), 32); if (ACPI_FAILURE (Status)) { return (Status); @@ -358,7 +358,7 @@ AcpiReadBitRegister ( /* Read the entire parent register */ Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, - &RegisterValue); + &RegisterValue); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -367,7 +367,7 @@ AcpiReadBitRegister ( /* Normalize the value that was read, mask off other bits */ Value = ((RegisterValue & BitRegInfo->AccessBitMask) - >> BitRegInfo->BitPosition); + >> BitRegInfo->BitPosition); ACPI_DEBUG_PRINT ((ACPI_DB_IO, "BitReg %X, ParentReg %X, Actual %8.8X, ReturnValue %8.8X\n", @@ -439,7 +439,7 @@ AcpiWriteBitRegister ( * interested in */ Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, - &RegisterValue); + &RegisterValue); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -453,7 +453,7 @@ AcpiWriteBitRegister ( BitRegInfo->AccessBitMask, Value); Status = AcpiHwRegisterWrite (BitRegInfo->ParentRegister, - RegisterValue); + RegisterValue); } else { @@ -473,7 +473,7 @@ AcpiWriteBitRegister ( if (RegisterValue) { Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, - RegisterValue); + RegisterValue); } } @@ -565,12 +565,20 @@ AcpiGetSleepTypeData ( * Evaluate the \_Sx namespace object containing the register values * for this state */ - Info->RelativePathname = ACPI_CAST_PTR ( - char, AcpiGbl_SleepStateNames[SleepState]); + Info->RelativePathname = ACPI_CAST_PTR (char, + AcpiGbl_SleepStateNames[SleepState]); + Status = AcpiNsEvaluate (Info); if (ACPI_FAILURE (Status)) { - goto Cleanup; + if (Status == AE_NOT_FOUND) + { + /* The _Sx states are optional, ignore NOT_FOUND */ + + goto FinalCleanup; + } + + goto WarningCleanup; } /* Must have a return object */ @@ -580,7 +588,7 @@ AcpiGetSleepTypeData ( ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]", Info->RelativePathname)); Status = AE_AML_NO_RETURN_VALUE; - goto Cleanup; + goto WarningCleanup; } /* Return object must be of type Package */ @@ -589,7 +597,7 @@ AcpiGetSleepTypeData ( { ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package")); Status = AE_AML_OPERAND_TYPE; - goto Cleanup1; + goto ReturnValueCleanup; } /* @@ -636,16 +644,18 @@ AcpiGetSleepTypeData ( break; } -Cleanup1: +ReturnValueCleanup: AcpiUtRemoveReference (Info->ReturnObject); -Cleanup: +WarningCleanup: if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "While evaluating Sleep State [%s]", Info->RelativePathname)); + "While evaluating Sleep State [%s]", + Info->RelativePathname)); } +FinalCleanup: ACPI_FREE (Info); return_ACPI_STATUS (Status); } diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c index 892c4a092d23..15eaef419979 100644 --- a/source/components/hardware/hwxfsleep.c +++ b/source/components/hardware/hwxfsleep.c @@ -172,7 +172,7 @@ AcpiSetFirmwareWakingVector ( if (AcpiGbl_FACS) { (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_FACS, - PhysicalAddress, PhysicalAddress64); + PhysicalAddress, PhysicalAddress64); } return_ACPI_STATUS (AE_OK); @@ -239,7 +239,7 @@ AcpiEnterSleepStateS4bios ( ACPI_FLUSH_CPU_CACHE (); Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, - (UINT32) AcpiGbl_FADT.S4BiosRequest, 8); + (UINT32) AcpiGbl_FADT.S4BiosRequest, 8); do { AcpiOsStall (ACPI_USEC_PER_MSEC); @@ -248,6 +248,7 @@ AcpiEnterSleepStateS4bios ( { return_ACPI_STATUS (Status); } + } while (!InValue); return_ACPI_STATUS (AE_OK); @@ -343,7 +344,7 @@ AcpiEnterSleepStatePrep ( Status = AcpiGetSleepTypeData (SleepState, - &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); + &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 615257aefee4..774d7c0b74bb 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -117,8 +117,8 @@ AcpiNsRootInitialize ( } Status = AcpiNsLookup (NULL, InitVal->Name, InitVal->Type, - ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, - NULL, &NewNode); + ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, + NULL, &NewNode); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -219,7 +219,7 @@ AcpiNsRootInitialize ( /* Create additional counting semaphore for global lock */ Status = AcpiOsCreateSemaphore ( - 1, 0, &AcpiGbl_GlobalLockSemaphore); + 1, 0, &AcpiGbl_GlobalLockSemaphore); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); @@ -240,7 +240,7 @@ AcpiNsRootInitialize ( /* Store pointer to value descriptor in the Node */ Status = AcpiNsAttachObject (NewNode, ObjDesc, - ObjDesc->Common.Type); + ObjDesc->Common.Type); /* Remove local reference to the object */ @@ -257,7 +257,7 @@ UnlockAndExit: if (ACPI_SUCCESS (Status)) { Status = AcpiNsGetNode (NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, - &AcpiGbl_FadtGpeDevice); + &AcpiGbl_FadtGpeDevice); } return_ACPI_STATUS (Status); @@ -589,7 +589,7 @@ AcpiNsLookup ( /* Try to find the single (4 character) ACPI name */ Status = AcpiNsSearchAndEnter (SimpleName, WalkState, CurrentNode, - InterpreterMode, ThisSearchType, LocalFlags, &ThisNode); + InterpreterMode, ThisSearchType, LocalFlags, &ThisNode); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index 1939cac6f4df..f42fe2653a12 100644 --- a/source/components/namespace/nsalloc.c +++ b/source/components/namespace/nsalloc.c @@ -85,7 +85,7 @@ AcpiNsCreateNode ( #ifdef ACPI_DBG_TRACK_ALLOCATIONS Temp = AcpiGbl_NsNodeList->TotalAllocated - - AcpiGbl_NsNodeList->TotalFreed; + AcpiGbl_NsNodeList->TotalFreed; if (Temp > AcpiGbl_NsNodeList->MaxOccupied) { AcpiGbl_NsNodeList->MaxOccupied = Temp; @@ -277,7 +277,8 @@ AcpiNsInstallNode ( * modified the namespace. This is used for cleanup when the * method exits. */ - WalkState->MethodDesc->Method.InfoFlags |= ACPI_METHOD_MODIFIED_NAMESPACE; + WalkState->MethodDesc->Method.InfoFlags |= + ACPI_METHOD_MODIFIED_NAMESPACE; } } diff --git a/source/components/namespace/nsarguments.c b/source/components/namespace/nsarguments.c index 93cf7a02e0f2..054150d25625 100644 --- a/source/components/namespace/nsarguments.c +++ b/source/components/namespace/nsarguments.c @@ -137,7 +137,8 @@ AcpiNsCheckAcpiCompliance ( /* Get the ACPI-required arg count from the predefined info table */ - RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); + RequiredParamCount = + METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); /* * If this object is not a control method, we can check if the ACPI @@ -283,7 +284,8 @@ AcpiNsCheckArgumentCount ( * Some methods are allowed to have a "minimum" number of args (_SCP) * because their definition in ACPI has changed over time. */ - RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); + RequiredParamCount = + METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); if (UserParamCount < RequiredParamCount) { diff --git a/source/components/namespace/nsconvert.c b/source/components/namespace/nsconvert.c index c3ca5b8679be..84eeec1fa48a 100644 --- a/source/components/namespace/nsconvert.c +++ b/source/components/namespace/nsconvert.c @@ -84,7 +84,7 @@ AcpiNsConvertToInteger ( /* String-to-Integer conversion */ Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, - ACPI_ANY_BASE, &Value); + ACPI_ANY_BASE, &Value); if (ACPI_FAILURE (Status)) { return (Status); @@ -104,7 +104,8 @@ AcpiNsConvertToInteger ( for (i = 0; i < OriginalObject->Buffer.Length; i++) { - Value |= ((UINT64) OriginalObject->Buffer.Pointer[i] << (i * 8)); + Value |= ((UINT64) + OriginalObject->Buffer.Pointer[i] << (i * 8)); } break; @@ -167,8 +168,8 @@ AcpiNsConvertToString ( } else { - Status = AcpiExConvertToString (OriginalObject, &NewObject, - ACPI_IMPLICIT_CONVERT_HEX); + Status = AcpiExConvertToString (OriginalObject, + &NewObject, ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE (Status)) { return (Status); @@ -263,7 +264,8 @@ AcpiNsConvertToBuffer ( /* String-to-Buffer conversion. Simple data copy */ - NewObject = AcpiUtCreateBufferObject (OriginalObject->String.Length); + NewObject = AcpiUtCreateBufferObject + (OriginalObject->String.Length); if (!NewObject) { return (AE_NO_MEMORY); diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index 0e692baf3f96..93e24df4c1d3 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -258,7 +258,8 @@ AcpiNsDumpOneObject ( if (Type > ACPI_TYPE_LOCAL_MAX) { - ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type)); + ACPI_WARNING ((AE_INFO, + "Invalid ACPI Object Type 0x%08X", Type)); } AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); @@ -267,7 +268,7 @@ AcpiNsDumpOneObject ( /* Now we can print out the pertinent information */ AcpiOsPrintf (" %-12s %p %2.2X ", - AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); + AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; @@ -354,7 +355,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf ("Len %.2X", - ObjDesc->Buffer.Length); + ObjDesc->Buffer.Length); /* Dump some of the buffer */ @@ -535,9 +536,9 @@ AcpiNsDumpOneObject ( /* If there is an attached object, display it */ - DbgLevel = AcpiDbgLevel; + DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; - ObjDesc = AcpiNsGetAttachedObject (ThisNode); + ObjDesc = AcpiNsGetAttachedObject (ThisNode); AcpiDbgLevel = DbgLevel; /* Dump attached objects */ @@ -564,14 +565,18 @@ AcpiNsDumpOneObject ( if (ObjType > ACPI_TYPE_LOCAL_MAX) { - AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", + AcpiOsPrintf ( + "(Pointer to ACPI Object type %.2X [UNKNOWN])\n", ObjType); + BytesToDump = 32; } else { - AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n", + AcpiOsPrintf ( + "(Pointer to ACPI Object type %.2X [%s])\n", ObjType, AcpiUtGetTypeName (ObjType)); + BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } @@ -601,7 +606,8 @@ AcpiNsDumpOneObject ( */ BytesToDump = ObjDesc->String.Length; ObjDesc = (void *) ObjDesc->String.Pointer; - AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n", + + AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n", ObjDesc, BytesToDump); ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); goto Cleanup; @@ -702,8 +708,8 @@ AcpiNsDumpObjects ( Info.DisplayType = DisplayType; (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } @@ -753,7 +759,7 @@ AcpiNsDumpOneObjectPath ( return (AE_OK); } - Pathname = AcpiNsGetExternalPathname (Node); + Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); PathIndent = 1; if (Level <= MaxLevel) @@ -839,14 +845,14 @@ AcpiNsDumpObjectPaths ( /* Get the max depth of the namespace tree, for formatting later */ (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); /* Now dump the entire namespace */ (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, - ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } @@ -917,7 +923,8 @@ AcpiNsDumpTables ( * If the name space has not been initialized, * there is nothing to dump. */ - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, + "namespace not initialized!\n")); return_VOID; } @@ -930,7 +937,7 @@ AcpiNsDumpTables ( } AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, - ACPI_OWNER_ID_MAX, SearchHandle); + ACPI_OWNER_ID_MAX, SearchHandle); return_VOID; } #endif diff --git a/source/components/namespace/nsdumpdv.c b/source/components/namespace/nsdumpdv.c index 0bfc029e7cc7..818694e5c1be 100644 --- a/source/components/namespace/nsdumpdv.c +++ b/source/components/namespace/nsdumpdv.c @@ -149,8 +149,8 @@ AcpiNsDumpRootDevices ( "Display of all devices in the namespace:\n")); Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiNsDumpOneDevice, NULL, NULL, NULL); + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, + AcpiNsDumpOneDevice, NULL, NULL, NULL); } #endif diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index bc7cdcfcc688..0509c80e7a0c 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -144,7 +144,7 @@ AcpiNsEvaluate ( /* Get the full pathname to the object, for use in warning messages */ - Info->FullPathname = AcpiNsGetExternalPathname (Info->Node); + Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE); if (!Info->FullPathname) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -441,7 +441,7 @@ AcpiNsExecModuleCode ( * of the method object descriptor. */ ParentNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - MethodObj->Method.NextObject); + MethodObj->Method.NextObject); Type = AcpiNsGetType (ParentNode); /* @@ -480,7 +480,7 @@ AcpiNsExecModuleCode ( /* Install the method (module-level code) in the parent node */ Status = AcpiNsAttachObject (ParentNode, MethodObj, - ACPI_TYPE_METHOD); + ACPI_TYPE_METHOD); if (ACPI_FAILURE (Status)) { goto Exit; diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index c80d2c88255a..b2e2be324a0b 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -110,8 +110,8 @@ AcpiNsInitializeObjects ( /* Walk entire namespace from the supplied root */ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, - &Info, NULL); + ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, + &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); @@ -173,7 +173,7 @@ AcpiNsInitializeDevices ( /* Tree analysis: find all subtrees that contain _INI methods */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); + ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -207,7 +207,7 @@ AcpiNsInitializeDevices ( /* Walk namespace to execute all _INIs on present devices */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); + ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); /* * Any _OSI requests should be completed by now. If the BIOS has @@ -631,7 +631,7 @@ AcpiNsInitOneDevice ( { /* Ignore error and move on to next device */ - char *ScopeName = AcpiNsGetExternalPathname (Info->Node); + char *ScopeName = AcpiNsGetNormalizedPathname (DeviceNode, TRUE); ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution", ScopeName)); diff --git a/source/components/namespace/nsload.c b/source/components/namespace/nsload.c index f893348e9670..b1b6afa70615 100644 --- a/source/components/namespace/nsload.c +++ b/source/components/namespace/nsload.c @@ -259,8 +259,8 @@ AcpiNsDeleteSubtree ( ParentHandle = StartHandle; - ChildHandle = NULL; - Level = 1; + ChildHandle = NULL; + Level = 1; /* * Traverse the tree of objects until we bubble back up @@ -271,7 +271,7 @@ AcpiNsDeleteSubtree ( /* Attempt to get the next object in this scope */ Status = AcpiGetNextObject (ACPI_TYPE_ANY, ParentHandle, - ChildHandle, &NextChildHandle); + ChildHandle, &NextChildHandle); ChildHandle = NextChildHandle; @@ -282,7 +282,7 @@ AcpiNsDeleteSubtree ( /* Check if this object has any children */ if (ACPI_SUCCESS (AcpiGetNextObject (ACPI_TYPE_ANY, ChildHandle, - NULL, &Dummy))) + NULL, &Dummy))) { /* * There is at least one child of this object, @@ -360,7 +360,6 @@ AcpiNsUnloadNamespace ( /* This function does the real work */ Status = AcpiNsDeleteSubtree (Handle); - return_ACPI_STATUS (Status); } #endif diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index ea10930d1e4b..d132d9e1c4cd 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -77,7 +77,6 @@ AcpiNsGetExternalPathname ( NameBuffer = AcpiNsGetNormalizedPathname (Node, FALSE); - return_PTR (NameBuffer); } @@ -105,7 +104,6 @@ AcpiNsGetPathnameLength ( Size = AcpiNsBuildNormalizedPath (Node, NULL, 0, FALSE); - return (Size); } @@ -165,7 +163,7 @@ AcpiNsHandleToPathname ( /* Build the path in the caller buffer */ (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer, - RequiredSize, NoTrailing); + RequiredSize, NoTrailing); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -246,6 +244,7 @@ AcpiNsBuildNormalizedPath ( { ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length); } + ACPI_MOVE_32_TO_32 (Name, &NextNode->Name); DoNoTrailing = NoTrailing; for (i = 0; i < 4; i++) @@ -260,8 +259,10 @@ AcpiNsBuildNormalizedPath ( ACPI_PATH_PUT8(FullPath, PathSize, c, Length); } } + NextNode = NextNode->Parent; } + ACPI_PATH_PUT8(FullPath, PathSize, AML_ROOT_PREFIX, Length); /* Reverse the path string */ @@ -269,7 +270,8 @@ AcpiNsBuildNormalizedPath ( if (Length <= PathSize) { Left = FullPath; - Right = FullPath+Length-1; + Right = FullPath+Length - 1; + while (Left < Right) { c = *Left; @@ -281,7 +283,7 @@ AcpiNsBuildNormalizedPath ( /* Append the trailing null */ BuildTrailingNull: - ACPI_PATH_PUT8(FullPath, PathSize, '\0', Length); + ACPI_PATH_PUT8 (FullPath, PathSize, '\0', Length); #undef ACPI_PATH_PUT8 @@ -331,7 +333,8 @@ AcpiNsGetNormalizedPathname ( NameBuffer = ACPI_ALLOCATE_ZEROED (Size); if (!NameBuffer) { - ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size)); + ACPI_ERROR ((AE_INFO, + "Could not allocate %u bytes", (UINT32) Size)); return_PTR (NULL); } diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c index a72fc93e4b52..3bac53e3be01 100644 --- a/source/components/namespace/nsobject.c +++ b/source/components/namespace/nsobject.c @@ -145,7 +145,7 @@ AcpiNsAttachObject ( * Value passed is a name handle and that name has a * non-null value. Use that name's value and type. */ - ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object; + ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object; ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type; } @@ -195,8 +195,8 @@ AcpiNsAttachObject ( LastObjDesc->Common.NextObject = Node->Object; } - Node->Type = (UINT8) ObjectType; - Node->Object = ObjDesc; + Node->Type = (UINT8) ObjectType; + Node->Object = ObjDesc; return_ACPI_STATUS (AE_OK); } diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c index 996db01747fb..331be76da693 100644 --- a/source/components/namespace/nsparse.c +++ b/source/components/namespace/nsparse.c @@ -124,7 +124,7 @@ AcpiNsOneCompleteParse ( } Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, - AmlStart, AmlLength, NULL, (UINT8) PassNumber); + AmlStart, AmlLength, NULL, (UINT8) PassNumber); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -143,7 +143,8 @@ AcpiNsOneCompleteParse ( if (StartNode && StartNode != AcpiGbl_RootNode) { - Status = AcpiDsScopeStackPush (StartNode, ACPI_TYPE_METHOD, WalkState); + Status = AcpiDsScopeStackPush ( + StartNode, ACPI_TYPE_METHOD, WalkState); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -153,7 +154,8 @@ AcpiNsOneCompleteParse ( /* Parse the AML */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", PassNumber)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "*PARSE* pass %u parse\n", PassNumber)); Status = AcpiPsParseAml (WalkState); Cleanup: @@ -197,8 +199,9 @@ AcpiNsParseTable ( * performs another complete parse of the AML. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, - TableIndex, StartNode); + TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -215,7 +218,7 @@ AcpiNsParseTable ( */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, - TableIndex, StartNode); + TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/namespace/nsprepkg.c b/source/components/namespace/nsprepkg.c index 599af7e6a563..beec84de88fa 100644 --- a/source/components/namespace/nsprepkg.c +++ b/source/components/namespace/nsprepkg.c @@ -171,8 +171,8 @@ AcpiNsCheckPackage ( /* Validate all elements of the returned package */ Status = AcpiNsCheckPackageElements (Info, Elements, - Package->RetInfo.ObjectType1, Package->RetInfo.Count1, - Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); + Package->RetInfo.ObjectType1, Package->RetInfo.Count1, + Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); break; case ACPI_PTYPE1_VAR: @@ -183,7 +183,7 @@ AcpiNsCheckPackage ( for (i = 0; i < Count; i++) { Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo.ObjectType1, i); + Package->RetInfo.ObjectType1, i); if (ACPI_FAILURE (Status)) { return (Status); @@ -215,7 +215,7 @@ AcpiNsCheckPackage ( /* These are the required package elements (0, 1, or 2) */ Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo3.ObjectType[i], i); + Package->RetInfo3.ObjectType[i], i); if (ACPI_FAILURE (Status)) { return (Status); @@ -226,7 +226,7 @@ AcpiNsCheckPackage ( /* These are the optional package elements */ Status = AcpiNsCheckObjectType (Info, Elements, - Package->RetInfo3.TailObjectType, i); + Package->RetInfo3.TailObjectType, i); if (ACPI_FAILURE (Status)) { return (Status); @@ -240,8 +240,8 @@ AcpiNsCheckPackage ( /* First element is the (Integer) revision */ - Status = AcpiNsCheckObjectType (Info, Elements, - ACPI_RTYPE_INTEGER, 0); + Status = AcpiNsCheckObjectType ( + Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { return (Status); @@ -259,8 +259,8 @@ AcpiNsCheckPackage ( /* First element is the (Integer) count of subpackages to follow */ - Status = AcpiNsCheckObjectType (Info, Elements, - ACPI_RTYPE_INTEGER, 0); + Status = AcpiNsCheckObjectType ( + Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { return (Status); @@ -303,7 +303,8 @@ AcpiNsCheckPackage ( { /* Create the new outer package and populate it */ - Status = AcpiNsWrapWithPackage (Info, ReturnObject, ReturnObjectPtr); + Status = AcpiNsWrapWithPackage ( + Info, ReturnObject, ReturnObjectPtr); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/components/namespace/nsrepair.c b/source/components/namespace/nsrepair.c index 160d84308561..d98e11022eef 100644 --- a/source/components/namespace/nsrepair.c +++ b/source/components/namespace/nsrepair.c @@ -222,7 +222,7 @@ AcpiNsSimpleRepair ( ACPI_WARN_ALWAYS, "Found unexpected NULL package element")); Status = AcpiNsRepairNullElement (Info, ExpectedBtypes, - PackageIndex, ReturnObjectPtr); + PackageIndex, ReturnObjectPtr); if (ACPI_SUCCESS (Status)) { return (AE_OK); /* Repair was successful */ @@ -380,6 +380,7 @@ AcpiNsMatchSimpleRepair ( return (NULL); } + ThisName++; } @@ -464,11 +465,13 @@ AcpiNsRepairNullElement ( /* Set the reference count according to the parent Package object */ - NewObject->Common.ReferenceCount = Info->ParentPackage->Common.ReferenceCount; + NewObject->Common.ReferenceCount = + Info->ParentPackage->Common.ReferenceCount; ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Converted NULL package element to expected %s at index %u\n", - Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex)); + Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), + PackageIndex)); *ReturnObjectPtr = NewObject; Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; @@ -551,6 +554,7 @@ AcpiNsRemoveNullElements ( *Dest = *Source; Dest++; } + Source++; } @@ -607,8 +611,8 @@ AcpiNsWrapWithPackage ( /* - * Create the new outer package and populate it. The new package will - * have a single element, the lone sub-object. + * Create the new outer package and populate it. The new + * package will have a single element, the lone sub-object. */ PkgObjDesc = AcpiUtCreatePackageObject (1); if (!PkgObjDesc) diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index f68f8bcced32..17c3ce5c5e10 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -254,6 +254,7 @@ AcpiNsMatchComplexRepair ( { return (ThisName); } + ThisName++; } @@ -286,7 +287,7 @@ AcpiNsRepair_ALR ( Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 2, 1, - ACPI_SORT_ASCENDING, "AmbientIlluminance"); + ACPI_SORT_ASCENDING, "AmbientIlluminance"); return (Status); } @@ -339,7 +340,8 @@ AcpiNsRepair_FDE ( if (ReturnObject->Buffer.Length != ACPI_FDE_BYTE_BUFFER_SIZE) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "Incorrect return buffer length %u, expected %u", ReturnObject->Buffer.Length, ACPI_FDE_DWORD_BUFFER_SIZE)); @@ -348,7 +350,8 @@ AcpiNsRepair_FDE ( /* Create the new (larger) buffer object */ - BufferObject = AcpiUtCreateBufferObject (ACPI_FDE_DWORD_BUFFER_SIZE); + BufferObject = AcpiUtCreateBufferObject ( + ACPI_FDE_DWORD_BUFFER_SIZE); if (!BufferObject) { return (AE_NO_MEMORY); @@ -357,7 +360,8 @@ AcpiNsRepair_FDE ( /* Expand each byte to a DWORD */ ByteBuffer = ReturnObject->Buffer.Pointer; - DwordBuffer = ACPI_CAST_PTR (UINT32, BufferObject->Buffer.Pointer); + DwordBuffer = ACPI_CAST_PTR (UINT32, + BufferObject->Buffer.Pointer); for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) { @@ -510,7 +514,8 @@ AcpiNsRepair_CST ( if ((*OuterElements)->Package.Count == 0) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "SubPackage[%u] - removing entry due to zero count", i)); Removing = TRUE; goto RemoveElement; @@ -519,7 +524,8 @@ AcpiNsRepair_CST ( ObjDesc = (*OuterElements)->Package.Elements[1]; /* Index1 = Type */ if ((UINT32) ObjDesc->Integer.Value == 0) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "SubPackage[%u] - removing entry due to invalid Type(0)", i)); Removing = TRUE; } @@ -546,7 +552,7 @@ RemoveElement: * C-state type, in ascending order. */ Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1, - ACPI_SORT_ASCENDING, "C-State Type"); + ACPI_SORT_ASCENDING, "C-State Type"); if (ACPI_FAILURE (Status)) { return (Status); @@ -594,7 +600,8 @@ AcpiNsRepair_HID ( if (ReturnObject->String.Length == 0) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "Invalid zero-length _HID or _CID string")); /* Return AE_OK anyway, let driver handle it */ @@ -756,8 +763,8 @@ AcpiNsRepair_PSS ( * incorrectly sorted, sort it. We sort by CpuFrequency, since this * should be proportional to the power. */ - Status =AcpiNsCheckSortedList (Info, ReturnObject, 0, 6, 0, - ACPI_SORT_DESCENDING, "CpuFrequency"); + Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 6, 0, + ACPI_SORT_DESCENDING, "CpuFrequency"); if (ACPI_FAILURE (Status)) { return (Status); @@ -778,7 +785,8 @@ AcpiNsRepair_PSS ( if ((UINT32) ObjDesc->Integer.Value > PreviousValue) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "SubPackage[%u,%u] - suspicious power dissipation values", i-1, i)); } @@ -832,7 +840,7 @@ AcpiNsRepair_TSS ( } Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 5, 1, - ACPI_SORT_DESCENDING, "PowerDissipation"); + ACPI_SORT_DESCENDING, "PowerDissipation"); return (Status); } @@ -1064,6 +1072,7 @@ AcpiNsRemoveElement ( *Dest = *Source; Dest++; } + Source++; } diff --git a/source/components/namespace/nssearch.c b/source/components/namespace/nssearch.c index bdd4e8684e1a..fa6fc87806d3 100644 --- a/source/components/namespace/nssearch.c +++ b/source/components/namespace/nssearch.c @@ -112,7 +112,7 @@ AcpiNsSearchOneScope ( { char *ScopeName; - ScopeName = AcpiNsGetExternalPathname (ParentNode); + ScopeName = AcpiNsGetNormalizedPathname (ParentNode, TRUE); if (ScopeName) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, @@ -248,7 +248,7 @@ AcpiNsSearchParentTree ( * the actual name we are searching for. Typechecking comes later. */ Status = AcpiNsSearchOneScope ( - TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode); + TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode); if (ACPI_SUCCESS (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 35a96c1b4b02..126794fde5d4 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -196,9 +196,10 @@ AcpiNsGetInternalNameLength ( Info->FullyQualified = FALSE; /* - * For the internal name, the required length is 4 bytes per segment, plus - * 1 each for RootPrefix, MultiNamePrefixOp, segment count, trailing null - * (which is not really needed, but no there's harm in putting it there) + * For the internal name, the required length is 4 bytes per segment, + * plus 1 each for RootPrefix, MultiNamePrefixOp, segment count, + * trailing null (which is not really needed, but no there's harm in + * putting it there) * * strlen() + 1 covers the first NameSeg, which has no path separator */ @@ -243,7 +244,7 @@ AcpiNsGetInternalNameLength ( } Info->Length = (ACPI_NAME_SIZE * Info->NumSegments) + - 4 + Info->NumCarats; + 4 + Info->NumCarats; Info->NextExternalChar = NextExternalChar; } @@ -574,7 +575,7 @@ AcpiNsExternalizeName ( * punctuation ('.') between object names, plus the NULL terminator. */ RequiredLength = PrefixLength + (4 * NumSegments) + - ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1; + ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1; /* * Check to see if we're still in bounds. If not, there's a problem @@ -612,7 +613,8 @@ AcpiNsExternalizeName ( /* Copy and validate the 4-char name segment */ - ACPI_MOVE_NAME (&(*ConvertedName)[j], &InternalName[NamesIndex]); + ACPI_MOVE_NAME (&(*ConvertedName)[j], + &InternalName[NamesIndex]); AcpiUtRepairName (&(*ConvertedName)[j]); j += ACPI_NAME_SIZE; @@ -813,6 +815,7 @@ AcpiNsGetNode ( { *ReturnNode = AcpiGbl_RootNode; } + return_ACPI_STATUS (AE_OK); } @@ -847,12 +850,12 @@ AcpiNsGetNode ( /* Lookup the name in the namespace */ Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE), - NULL, ReturnNode); + ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE), + NULL, ReturnNode); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s\n", - Pathname, AcpiFormatException (Status))); + Pathname, AcpiFormatException (Status))); } (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); diff --git a/source/components/namespace/nswalk.c b/source/components/namespace/nswalk.c index c1cec4347697..2deee0eb3827 100644 --- a/source/components/namespace/nswalk.c +++ b/source/components/namespace/nswalk.c @@ -218,10 +218,10 @@ AcpiNsWalkNamespace ( /* Null child means "get first node" */ - ParentNode = StartNode; - ChildNode = AcpiNsGetNextNode (ParentNode, NULL); - ChildType = ACPI_TYPE_ANY; - Level = 1; + ParentNode = StartNode; + ChildNode = AcpiNsGetNextNode (ParentNode, NULL); + ChildType = ACPI_TYPE_ANY; + Level = 1; /* * Traverse the tree of nodes until we bubble back up to where we @@ -279,7 +279,7 @@ AcpiNsWalkNamespace ( if (DescendingCallback) { Status = DescendingCallback (ChildNode, Level, - Context, ReturnValue); + Context, ReturnValue); } } else @@ -287,7 +287,7 @@ AcpiNsWalkNamespace ( if (AscendingCallback) { Status = AscendingCallback (ChildNode, Level, - Context, ReturnValue); + Context, ReturnValue); } } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 1a867bda8366..e279f40959c5 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -432,13 +432,13 @@ AcpiEvaluateObject ( /* Get the size of the returned object */ Status = AcpiUtGetObjectSize (Info->ReturnObject, - &BufferSpaceNeeded); + &BufferSpaceNeeded); if (ACPI_SUCCESS (Status)) { /* Validate/Allocate/Clear caller buffer */ Status = AcpiUtInitializeBuffer (ReturnBuffer, - BufferSpaceNeeded); + BufferSpaceNeeded); if (ACPI_FAILURE (Status)) { /* @@ -454,8 +454,8 @@ AcpiEvaluateObject ( { /* We have enough space for the object, build it */ - Status = AcpiUtCopyIobjectToEobject (Info->ReturnObject, - ReturnBuffer); + Status = AcpiUtCopyIobjectToEobject ( + Info->ReturnObject, ReturnBuffer); } } } @@ -668,8 +668,8 @@ AcpiWalkNamespace ( } Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, - ACPI_NS_WALK_UNLOCK, DescendingCallback, - AscendingCallback, Context, ReturnValue); + ACPI_NS_WALK_UNLOCK, DescendingCallback, + AscendingCallback, Context, ReturnValue); UnlockAndExit2: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -820,8 +820,8 @@ AcpiNsGetDeviceCallback ( /* We have a valid device, invoke the user function */ - Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, - ReturnValue); + Status = Info->UserFunction (ObjHandle, NestingLevel, + Info->Context, ReturnValue); return (Status); } @@ -876,8 +876,8 @@ AcpiGetDevices ( * We're going to call their callback from OUR callback, so we need * to know what it is, and their context parameter. */ - Info.Hid = HID; - Info.Context = Context; + Info.Hid = HID; + Info.Context = Context; Info.UserFunction = UserFunction; /* @@ -893,8 +893,8 @@ AcpiGetDevices ( } Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue); + ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, + AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index 311431b2de84..757e6bc7675a 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -177,7 +177,7 @@ AcpiGetName ( { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; - char *NodeName; + const char *NodeName; /* Parameter validation */ @@ -199,7 +199,7 @@ AcpiGetName ( /* Get the full pathname (From the namespace root) */ Status = AcpiNsHandleToPathname (Handle, Buffer, - NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE); + NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE); return (Status); } @@ -265,7 +265,6 @@ AcpiNsCopyDeviceId ( ACPI_PNP_DEVICE_ID *Source, char *StringArea) { - /* Create the destination PNP_DEVICE_ID */ Dest->String = StringArea; @@ -291,11 +290,18 @@ AcpiNsCopyDeviceId ( * namespace node and possibly by running several standard * control methods (Such as in the case of a device.) * - * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, - * _CLS, _STA, _ADR, _SxW, and _SxD methods. + * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, + * _CLS, _ADR, _SxW, and _SxD methods. * * Note: Allocates the return buffer, must be freed by the caller. * + * Note: This interface is intended to be used during the initial device + * discovery namespace traversal. Therefore, no complex methods can be + * executed, especially those that access operation regions. Therefore, do + * not add any additional methods that could cause problems in this area. + * this was the fate of the _SUB method which was found to cause such + * problems and was removed (11/2015). + * ******************************************************************************/ ACPI_STATUS @@ -308,7 +314,6 @@ AcpiGetObjectInfo ( ACPI_PNP_DEVICE_ID_LIST *CidList = NULL; ACPI_PNP_DEVICE_ID *Hid = NULL; ACPI_PNP_DEVICE_ID *Uid = NULL; - ACPI_PNP_DEVICE_ID *Sub = NULL; ACPI_PNP_DEVICE_ID *Cls = NULL; char *NextIdString; ACPI_OBJECT_TYPE Type; @@ -362,7 +367,7 @@ AcpiGetObjectInfo ( { /* * Get extra info for ACPI Device/Processor objects only: - * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods. + * Run the Device _HID, _UID, _CLS, and _CID methods. * * Note: none of these methods are required, so they may or may * not be present for this device. The Info->Valid bitfield is used @@ -387,15 +392,6 @@ AcpiGetObjectInfo ( Valid |= ACPI_VALID_UID; } - /* Execute the Device._SUB method */ - - Status = AcpiUtExecute_SUB (Node, &Sub); - if (ACPI_SUCCESS (Status)) - { - InfoSize += Sub->Length; - Valid |= ACPI_VALID_SUB; - } - /* Execute the Device._CID method */ Status = AcpiUtExecute_CID (Node, &CidList); @@ -458,7 +454,7 @@ AcpiGetObjectInfo ( /* Execute the Device._ADR method */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, - &Info->Address); + &Info->Address); if (ACPI_SUCCESS (Status)) { Valid |= ACPI_VALID_ADR; @@ -467,8 +463,8 @@ AcpiGetObjectInfo ( /* Execute the Device._SxW methods */ Status = AcpiUtExecutePowerMethods (Node, - AcpiGbl_LowestDstateNames, ACPI_NUM_SxW_METHODS, - Info->LowestDstates); + AcpiGbl_LowestDstateNames, ACPI_NUM_SxW_METHODS, + Info->LowestDstates); if (ACPI_SUCCESS (Status)) { Valid |= ACPI_VALID_SXWS; @@ -477,8 +473,8 @@ AcpiGetObjectInfo ( /* Execute the Device._SxD methods */ Status = AcpiUtExecutePowerMethods (Node, - AcpiGbl_HighestDstateNames, ACPI_NUM_SxD_METHODS, - Info->HighestDstates); + AcpiGbl_HighestDstateNames, ACPI_NUM_SxD_METHODS, + Info->HighestDstates); if (ACPI_SUCCESS (Status)) { Valid |= ACPI_VALID_SXDS; @@ -498,9 +494,8 @@ AcpiGetObjectInfo ( } /* - * Copy the HID, UID, SUB, and CIDs to the return buffer. - * The variable-length strings are copied to the reserved area - * at the end of the buffer. + * Copy the HID, UID, and CIDs to the return buffer. The variable-length + * strings are copied to the reserved area at the end of the buffer. * * For HID and CID, check if the ID is a PCI Root Bridge. */ @@ -521,12 +516,6 @@ AcpiGetObjectInfo ( Uid, NextIdString); } - if (Sub) - { - NextIdString = AcpiNsCopyDeviceId (&Info->SubsystemId, - Sub, NextIdString); - } - if (CidList) { Info->CompatibleIdList.Count = CidList->Count; @@ -573,10 +562,6 @@ Cleanup: { ACPI_FREE (Uid); } - if (Sub) - { - ACPI_FREE (Sub); - } if (CidList) { ACPI_FREE (CidList); @@ -652,6 +637,7 @@ AcpiInstallMethod ( ParserState.Aml += AcpiPsGetOpcodeSize (Opcode); ParserState.PkgEnd = AcpiPsGetNextPackageEnd (&ParserState); Path = AcpiPsGetNextNamestring (&ParserState); + MethodFlags = *ParserState.Aml++; AmlStart = ParserState.Aml; AmlLength = ACPI_PTR_DIFF (ParserState.PkgEnd, AmlStart); @@ -684,7 +670,7 @@ AcpiInstallMethod ( /* The lookup either returns an existing node or creates a new one */ Status = AcpiNsLookup (NULL, Path, ACPI_TYPE_METHOD, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, NULL, &Node); + ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, NULL, &Node); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); diff --git a/source/components/namespace/nsxfobj.c b/source/components/namespace/nsxfobj.c index 6fed2b8709c3..b23c32e02d36 100644 --- a/source/components/namespace/nsxfobj.c +++ b/source/components/namespace/nsxfobj.c @@ -81,10 +81,8 @@ AcpiGetType ( return (AE_BAD_PARAMETER); } - /* - * Special case for the predefined Root Node - * (return type ANY) - */ + /* Special case for the predefined Root Node (return type ANY) */ + if (Handle == ACPI_ROOT_OBJECT) { *RetType = ACPI_TYPE_ANY; @@ -108,7 +106,6 @@ AcpiGetType ( *RetType = Node->Type; - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c index 538b73eebd1f..7876a0eb4988 100644 --- a/source/components/parser/psargs.c +++ b/source/components/parser/psargs.c @@ -287,8 +287,8 @@ AcpiPsGetNextNamepath ( * the upsearch) */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); /* * If this name is a control method invocation, we must @@ -359,7 +359,7 @@ AcpiPsGetNextNamepath ( /* 1) NotFound is ok during load pass 1/2 (allow forward references) */ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) != - ACPI_PARSE_EXECUTE) + ACPI_PARSE_EXECUTE) { Status = AE_OK; } @@ -391,7 +391,7 @@ AcpiPsGetNextNamepath ( ACPI_ERROR_NAMESPACE (Path, Status); if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == - ACPI_PARSE_EXECUTE) + ACPI_PARSE_EXECUTE) { /* Report a control method execution error */ @@ -787,6 +787,7 @@ AcpiPsGetNextArg ( { return_ACPI_STATUS (AE_NO_MEMORY); } + AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg); break; @@ -835,7 +836,7 @@ AcpiPsGetNextArg ( /* Non-empty list */ Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP, - ParserState->Aml); + ParserState->Aml); if (!Arg) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c index 244037fac11f..044cf9d3e77e 100644 --- a/source/components/parser/psloop.c +++ b/source/components/parser/psloop.c @@ -120,7 +120,8 @@ AcpiPsGetArguments ( case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ - Status = AcpiPsGetNextNamepath (WalkState, &(WalkState->ParserState), Op, 1); + Status = AcpiPsGetNextNamepath ( + WalkState, &(WalkState->ParserState), Op, 1); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -133,12 +134,13 @@ AcpiPsGetArguments ( /* * Op is not a constant or string, append each argument to the Op */ - while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount) + while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && + !WalkState->ArgCount) { WalkState->Aml = WalkState->ParserState.Aml; Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState), - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); + GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -550,7 +552,7 @@ AcpiPsParseLoop ( * prepare for argument */ Status = AcpiPsPushScope (ParserState, Op, - WalkState->ArgTypes, WalkState->ArgCount); + WalkState->ArgTypes, WalkState->ArgCount); if (ACPI_FAILURE (Status)) { Status = AcpiPsCompleteOp (WalkState, &Op, Status); diff --git a/source/components/parser/psobject.c b/source/components/parser/psobject.c index b9d8e8ce69bb..8acde2e16133 100644 --- a/source/components/parser/psobject.c +++ b/source/components/parser/psobject.c @@ -109,7 +109,7 @@ AcpiPsGetAmlOpcode ( if (WalkState->PassNumber == 2) { AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, - WalkState->ParserState.AmlStart); + WalkState->ParserState.AmlStart); ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", @@ -151,7 +151,8 @@ AcpiPsGetAmlOpcode ( /* Found opcode info, this is a normal opcode */ - WalkState->ParserState.Aml += AcpiPsGetOpcodeSize (WalkState->Opcode); + WalkState->ParserState.Aml += + AcpiPsGetOpcodeSize (WalkState->Opcode); WalkState->ArgTypes = WalkState->OpInfo->ParseArgs; break; } @@ -201,7 +202,7 @@ AcpiPsBuildNamedOp ( (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME)) { Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState), - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); + GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c index 49ab6313a1ac..d4d045a2686c 100644 --- a/source/components/parser/psparse.c +++ b/source/components/parser/psparse.c @@ -200,8 +200,8 @@ AcpiPsCompleteThisOp ( * These opcodes contain TermArg operands. The current * op must be replaced by a placeholder return op */ - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, - Op->Common.Aml); + ReplacementOp = AcpiPsAllocOp ( + AML_INT_RETURN_VALUE_OP, Op->Common.Aml); if (!ReplacementOp) { Status = AE_NO_MEMORY; @@ -220,8 +220,8 @@ AcpiPsCompleteThisOp ( (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, - Op->Common.Aml); + ReplacementOp = AcpiPsAllocOp ( + AML_INT_RETURN_VALUE_OP, Op->Common.Aml); if (!ReplacementOp) { Status = AE_NO_MEMORY; @@ -235,7 +235,7 @@ AcpiPsCompleteThisOp ( (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode, - Op->Common.Aml); + Op->Common.Aml); if (!ReplacementOp) { Status = AE_NO_MEMORY; @@ -251,8 +251,8 @@ AcpiPsCompleteThisOp ( default: - ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP, - Op->Common.Aml); + ReplacementOp = AcpiPsAllocOp ( + AML_INT_RETURN_VALUE_OP, Op->Common.Aml); if (!ReplacementOp) { Status = AE_NO_MEMORY; @@ -267,11 +267,11 @@ AcpiPsCompleteThisOp ( if (ReplacementOp) { - ReplacementOp->Common.Parent = Op->Common.Parent; - ReplacementOp->Common.Value.Arg = NULL; - ReplacementOp->Common.Node = Op->Common.Node; + ReplacementOp->Common.Parent = Op->Common.Parent; + ReplacementOp->Common.Value.Arg = NULL; + ReplacementOp->Common.Node = Op->Common.Node; Op->Common.Parent->Common.Value.Arg = ReplacementOp; - ReplacementOp->Common.Next = Op->Common.Next; + ReplacementOp->Common.Next = Op->Common.Next; } else { @@ -290,11 +290,11 @@ AcpiPsCompleteThisOp ( { if (ReplacementOp) { - ReplacementOp->Common.Parent = Op->Common.Parent; + ReplacementOp->Common.Parent = Op->Common.Parent; ReplacementOp->Common.Value.Arg = NULL; - ReplacementOp->Common.Node = Op->Common.Node; - Prev->Common.Next = ReplacementOp; - ReplacementOp->Common.Next = Op->Common.Next; + ReplacementOp->Common.Node = Op->Common.Node; + Prev->Common.Next = ReplacementOp; + ReplacementOp->Common.Next = Op->Common.Next; Next = NULL; } else @@ -494,7 +494,8 @@ AcpiPsParseAml ( */ if (WalkState->MethodDesc) { - WalkState->Thread->CurrentSyncLevel = WalkState->MethodDesc->Method.SyncLevel; + WalkState->Thread->CurrentSyncLevel = + WalkState->MethodDesc->Method.SyncLevel; } AcpiDsPushWalkState (WalkState, Thread); @@ -540,8 +541,8 @@ AcpiPsParseAml ( } /* - * If the transfer to the new method method call worked, a new walk - * state was created -- get it + * If the transfer to the new method method call worked + *, a new walk state was created -- get it */ WalkState = AcpiDsGetCurrentWalkState (Thread); continue; @@ -560,7 +561,8 @@ AcpiPsParseAml ( /* Check for possible multi-thread reentrancy problem */ if ((Status == AE_ALREADY_EXISTS) && - (!(WalkState->MethodDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED))) + (!(WalkState->MethodDesc->Method.InfoFlags & + ACPI_METHOD_SERIALIZED))) { /* * Method is not serialized and tried to create an object @@ -586,7 +588,8 @@ AcpiPsParseAml ( * encountered an error during the method parse phase, there's lots of * cleanup to do */ - if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) || + if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == + ACPI_PARSE_EXECUTE) || (ACPI_FAILURE (Status))) { AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); @@ -633,7 +636,7 @@ AcpiPsParseAml ( /* Restart the calling control method */ Status = AcpiDsRestartControlMethod (WalkState, - PreviousWalkState->ImplicitReturnObj); + PreviousWalkState->ImplicitReturnObj); } else { @@ -644,7 +647,7 @@ AcpiPsParseAml ( AcpiDsClearImplicitReturn (PreviousWalkState); Status = AcpiDsRestartControlMethod (WalkState, - PreviousWalkState->ReturnDesc); + PreviousWalkState->ReturnDesc); } if (ACPI_SUCCESS (Status)) { diff --git a/source/components/parser/psscope.c b/source/components/parser/psscope.c index 09fbb10edb53..a1779b829b15 100644 --- a/source/components/parser/psscope.c +++ b/source/components/parser/psscope.c @@ -236,9 +236,9 @@ AcpiPsPopScope ( /* Return to parsing previous op */ - *Op = Scope->ParseScope.Op; - *ArgList = Scope->ParseScope.ArgList; - *ArgCount = Scope->ParseScope.ArgCount; + *Op = Scope->ParseScope.Op; + *ArgList = Scope->ParseScope.ArgList; + *ArgCount = Scope->ParseScope.ArgCount; ParserState->PkgEnd = Scope->ParseScope.PkgEnd; /* All done with this scope state structure */ @@ -249,8 +249,8 @@ AcpiPsPopScope ( { /* Empty parse stack, prepare to fetch next opcode */ - *Op = NULL; - *ArgList = 0; + *Op = NULL; + *ArgList = 0; *ArgCount = 0; } diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c index ec0d20c8e082..b7bebab58aac 100644 --- a/source/components/parser/psutils.c +++ b/source/components/parser/psutils.c @@ -105,8 +105,8 @@ AcpiPsInitOp ( Op->Common.AmlOpcode = Opcode; ACPI_DISASM_ONLY_MEMBERS (strncpy (Op->Common.AmlOpName, - (AcpiPsGetOpcodeInfo (Opcode))->Name, - sizeof (Op->Common.AmlOpName))); + (AcpiPsGetOpcodeInfo (Opcode))->Name, + sizeof (Op->Common.AmlOpName))); } @@ -205,7 +205,8 @@ AcpiPsFreeOp ( if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", Op)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + "Free retval op: %p\n", Op)); } if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) diff --git a/source/components/parser/pswalk.c b/source/components/parser/pswalk.c index 2cc2fb5cf58b..69d71f3b2da4 100644 --- a/source/components/parser/pswalk.c +++ b/source/components/parser/pswalk.c @@ -106,6 +106,7 @@ AcpiPsDeleteParseTree ( { return_VOID; } + if (Next) { Op = Next; diff --git a/source/components/parser/psxface.c b/source/components/parser/psxface.c index ae072b7dce7b..273a75ad3310 100644 --- a/source/components/parser/psxface.c +++ b/source/components/parser/psxface.c @@ -183,7 +183,7 @@ AcpiPsExecuteMethod ( Info->PassNumber = ACPI_IMODE_EXECUTE; WalkState = AcpiDsCreateWalkState ( - Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL); + Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL); if (!WalkState) { Status = AE_NO_MEMORY; @@ -191,8 +191,8 @@ AcpiPsExecuteMethod ( } Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, - Info->ObjDesc->Method.AmlStart, - Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber); + Info->ObjDesc->Method.AmlStart, + Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -303,7 +303,8 @@ AcpiPsUpdateParameterList ( { /* Ignore errors, just do them all */ - (void) AcpiUtUpdateObjectReference (Info->Parameters[i], Action); + (void) AcpiUtUpdateObjectReference ( + Info->Parameters[i], Action); } } } diff --git a/source/components/resources/rsaddr.c b/source/components/resources/rsaddr.c index 0ec02ef793f5..260f6c2dfd6f 100644 --- a/source/components/resources/rsaddr.c +++ b/source/components/resources/rsaddr.c @@ -328,30 +328,35 @@ AcpiRsGetAddressCommon ( /* Validate the Resource Type */ - if ((Aml->Address.ResourceType > 2) && (Aml->Address.ResourceType < 0xC0)) + if ((Aml->Address.ResourceType > 2) && + (Aml->Address.ResourceType < 0xC0)) { return (FALSE); } /* Get the Resource Type and General Flags */ - (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertGeneralFlags); + (void) AcpiRsConvertAmlToResource ( + Resource, Aml, AcpiRsConvertGeneralFlags); /* Get the Type-Specific Flags (Memory and I/O descriptors only) */ if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { - (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertMemFlags); + (void) AcpiRsConvertAmlToResource ( + Resource, Aml, AcpiRsConvertMemFlags); } else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE) { - (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertIoFlags); + (void) AcpiRsConvertAmlToResource ( + Resource, Aml, AcpiRsConvertIoFlags); } else { /* Generic resource type, just grab the TypeSpecific byte */ - Resource->Data.Address.Info.TypeSpecific = Aml->Address.SpecificFlags; + Resource->Data.Address.Info.TypeSpecific = + Aml->Address.SpecificFlags; } return (TRUE); @@ -382,22 +387,26 @@ AcpiRsSetAddressCommon ( /* Set the Resource Type and General Flags */ - (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertGeneralFlags); + (void) AcpiRsConvertResourceToAml ( + Resource, Aml, AcpiRsConvertGeneralFlags); /* Set the Type-Specific Flags (Memory and I/O descriptors only) */ if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { - (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertMemFlags); + (void) AcpiRsConvertResourceToAml ( + Resource, Aml, AcpiRsConvertMemFlags); } else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE) { - (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertIoFlags); + (void) AcpiRsConvertResourceToAml ( + Resource, Aml, AcpiRsConvertIoFlags); } else { /* Generic resource type, just copy the TypeSpecific byte */ - Aml->Address.SpecificFlags = Resource->Data.Address.Info.TypeSpecific; + Aml->Address.SpecificFlags = + Resource->Data.Address.Info.TypeSpecific; } } diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index d41dfeed78a4..5d3a92efc0d9 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -164,16 +164,17 @@ AcpiRsStreamOptionLength ( /* - * The ResourceSourceIndex and ResourceSource are optional elements of some - * Large-type resource descriptors. + * The ResourceSourceIndex and ResourceSource are optional elements of + * some Large-type resource descriptors. */ /* - * If the length of the actual resource descriptor is greater than the ACPI - * spec-defined minimum length, it means that a ResourceSourceIndex exists - * and is followed by a (required) null terminated string. The string length - * (including the null terminator) is the resource length minus the minimum - * length, minus one byte for the ResourceSourceIndex itself. + * If the length of the actual resource descriptor is greater than the + * ACPI spec-defined minimum length, it means that a ResourceSourceIndex + * exists and is followed by a (required) null terminated string. The + * string length (including the null terminator) is the resource length + * minus the minimum length, minus one byte for the ResourceSourceIndex + * itself. */ if (ResourceLength > MinimumAmlResourceLength) { @@ -309,9 +310,9 @@ AcpiRsGetAmlLength ( * 16-Bit Address Resource: * Add the size of the optional ResourceSource info */ - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + AcpiRsStructOptionLength ( - &Resource->Data.Address16.ResourceSource)); + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + AcpiRsStructOptionLength ( + &Resource->Data.Address16.ResourceSource)); break; @@ -320,9 +321,9 @@ AcpiRsGetAmlLength ( * 32-Bit Address Resource: * Add the size of the optional ResourceSource info */ - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + AcpiRsStructOptionLength ( - &Resource->Data.Address32.ResourceSource)); + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + AcpiRsStructOptionLength ( + &Resource->Data.Address32.ResourceSource)); break; @@ -331,9 +332,9 @@ AcpiRsGetAmlLength ( * 64-Bit Address Resource: * Add the size of the optional ResourceSource info */ - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + AcpiRsStructOptionLength ( - &Resource->Data.Address64.ResourceSource)); + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + AcpiRsStructOptionLength ( + &Resource->Data.Address64.ResourceSource)); break; @@ -343,8 +344,7 @@ AcpiRsGetAmlLength ( * Add the size of each additional optional interrupt beyond the * required 1 (4 bytes for each UINT32 interrupt number) */ - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + ((Resource->Data.ExtendedIrq.InterruptCount - 1) * 4) + /* Add the size of the optional ResourceSource info */ @@ -356,7 +356,8 @@ AcpiRsGetAmlLength ( case ACPI_RESOURCE_TYPE_GPIO: - TotalSize = (ACPI_RS_LENGTH) (TotalSize + (Resource->Data.Gpio.PinTableLength * 2) + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + (Resource->Data.Gpio.PinTableLength * 2) + Resource->Data.Gpio.ResourceSource.StringLength + Resource->Data.Gpio.VendorLength); @@ -365,7 +366,8 @@ AcpiRsGetAmlLength ( case ACPI_RESOURCE_TYPE_SERIAL_BUS: - TotalSize = AcpiGbl_AmlResourceSerialBusSizes [Resource->Data.CommonSerialBus.Type]; + TotalSize = AcpiGbl_AmlResourceSerialBusSizes [ + Resource->Data.CommonSerialBus.Type]; TotalSize = (ACPI_RS_LENGTH) (TotalSize + Resource->Data.I2cSerialBus.ResourceSource.StringLength + @@ -544,12 +546,15 @@ AcpiRsGetListLength ( if (AmlResource->Gpio.VendorLength) { - ExtraStructBytes += AmlResource->Gpio.VendorOffset - - AmlResource->Gpio.PinTableOffset + AmlResource->Gpio.VendorLength; + ExtraStructBytes += + AmlResource->Gpio.VendorOffset - + AmlResource->Gpio.PinTableOffset + + AmlResource->Gpio.VendorLength; } else { - ExtraStructBytes += AmlResource->LargeHeader.ResourceLength + + ExtraStructBytes += + AmlResource->LargeHeader.ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER) - AmlResource->Gpio.PinTableOffset; } @@ -559,7 +564,8 @@ AcpiRsGetListLength ( MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[ AmlResource->CommonSerialBus.Type]; - ExtraStructBytes += AmlResource->CommonSerialBus.ResourceLength - + ExtraStructBytes += + AmlResource->CommonSerialBus.ResourceLength - MinimumAmlResourceLength; break; @@ -574,7 +580,8 @@ AcpiRsGetListLength ( * Important: Round the size up for the appropriate alignment. This * is a requirement on IA64. */ - if (AcpiUtGetResourceType (AmlBuffer) == ACPI_RESOURCE_NAME_SERIAL_BUS) + if (AcpiUtGetResourceType (AmlBuffer) == + ACPI_RESOURCE_NAME_SERIAL_BUS) { BufferSize = AcpiGbl_ResourceStructSerialBusSizes[ AmlResource->CommonSerialBus.Type] + ExtraStructBytes; @@ -582,10 +589,10 @@ AcpiRsGetListLength ( else { BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] + - ExtraStructBytes; + ExtraStructBytes; } - BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize); + BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize); *SizeNeeded += BufferSize; ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES, @@ -722,7 +729,7 @@ AcpiRsGetPciRoutingTableLength ( else { TempSizeNeeded += AcpiNsGetPathnameLength ( - (*SubObjectList)->Reference.Node); + (*SubObjectList)->Reference.Node); } } else diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index 926d79b768c8..3107ad43e2e4 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -86,8 +86,8 @@ AcpiBufferToResource ( /* Get the required length for the converted resource */ - Status = AcpiRsGetListLength (AmlBuffer, AmlBufferLength, - &ListSizeNeeded); + Status = AcpiRsGetListLength ( + AmlBuffer, AmlBufferLength, &ListSizeNeeded); if (Status == AE_AML_NO_RESOURCE_END_TAG) { Status = AE_OK; @@ -109,7 +109,7 @@ AcpiBufferToResource ( /* Perform the AML-to-Resource conversion */ Status = AcpiUtWalkAmlResources (NULL, AmlBuffer, AmlBufferLength, - AcpiRsConvertAmlToResources, &CurrentResourcePtr); + AcpiRsConvertAmlToResources, &CurrentResourcePtr); if (Status == AE_AML_NO_RESOURCE_END_TAG) { Status = AE_OK; @@ -197,14 +197,14 @@ AcpiRsCreateResourceList ( Resource = OutputBuffer->Pointer; Status = AcpiUtWalkAmlResources (NULL, AmlStart, AmlBufferLength, - AcpiRsConvertAmlToResources, &Resource); + AcpiRsConvertAmlToResources, &Resource); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } @@ -255,8 +255,8 @@ AcpiRsCreatePciRoutingTable ( /* Get the required buffer length */ - Status = AcpiRsGetPciRoutingTableLength (PackageObject, - &BufferSizeNeeded); + Status = AcpiRsGetPciRoutingTableLength ( + PackageObject,&BufferSizeNeeded); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -278,10 +278,10 @@ AcpiRsCreatePciRoutingTable ( * package that in turn contains an UINT64 Address, a UINT8 Pin, * a Name, and a UINT8 SourceIndex. */ - TopObjectList = PackageObject->Package.Elements; + TopObjectList = PackageObject->Package.Elements; NumberOfElements = PackageObject->Package.Count; - Buffer = OutputBuffer->Pointer; - UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); + Buffer = OutputBuffer->Pointer; + UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); for (Index = 0; Index < NumberOfElements; Index++) { @@ -295,9 +295,9 @@ AcpiRsCreatePciRoutingTable ( UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); /* - * Fill in the Length field with the information we have at this point. - * The minus four is to subtract the size of the UINT8 Source[4] member - * because it is added below. + * Fill in the Length field with the information we have at this + * point. The minus four is to subtract the size of the UINT8 + * Source[4] member because it is added below. */ UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); @@ -323,7 +323,8 @@ AcpiRsCreatePciRoutingTable ( ObjDesc = SubObjectList[0]; if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { - ACPI_ERROR ((AE_INFO, "(PRT[%u].Address) Need Integer, found %s", + ACPI_ERROR ((AE_INFO, + "(PRT[%u].Address) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -366,12 +367,12 @@ AcpiRsCreatePciRoutingTable ( /* Use *remaining* length of the buffer as max for pathname */ PathBuffer.Length = OutputBuffer->Length - - (UINT32) ((UINT8 *) UserPrt->Source - - (UINT8 *) OutputBuffer->Pointer); + (UINT32) ((UINT8 *) UserPrt->Source - + (UINT8 *) OutputBuffer->Pointer); PathBuffer.Pointer = UserPrt->Source; - Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, - &PathBuffer, FALSE); + Status = AcpiNsHandleToPathname ( + (ACPI_HANDLE) Node, &PathBuffer, FALSE); /* +1 to include null terminator */ @@ -391,8 +392,8 @@ AcpiRsCreatePciRoutingTable ( case ACPI_TYPE_INTEGER: /* - * If this is a number, then the Source Name is NULL, since the - * entire buffer was zeroed out, we can leave this alone. + * If this is a number, then the Source Name is NULL, since + * the entire buffer was zeroed out, we can leave this alone. * * Add to the Length field the length of the UINT32 NULL */ @@ -431,7 +432,7 @@ AcpiRsCreatePciRoutingTable ( } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } @@ -472,8 +473,8 @@ AcpiRsCreateAmlResources ( /* Get the buffer size needed for the AML byte stream */ - Status = AcpiRsGetAmlLength (ResourceList->Pointer, - ResourceList->Length, &AmlSizeNeeded); + Status = AcpiRsGetAmlLength ( + ResourceList->Pointer, ResourceList->Length, &AmlSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", (UINT32) AmlSizeNeeded, AcpiFormatException (Status))); @@ -493,7 +494,7 @@ AcpiRsCreateAmlResources ( /* Do the conversion */ Status = AcpiRsConvertResourcesToAml (ResourceList->Pointer, - AmlSizeNeeded, OutputBuffer->Pointer); + AmlSizeNeeded, OutputBuffer->Pointer); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 666331728329..04874c74233f 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -545,6 +545,7 @@ AcpiRsOutString ( char *Title, char *Value) { + AcpiOsPrintf ("%27s : %s", Title, Value); if (!*Value) { @@ -566,6 +567,7 @@ AcpiRsOutInteger16 ( char *Title, UINT16 Value) { + AcpiOsPrintf ("%27s : %4.4X\n", Title, Value); } @@ -574,6 +576,7 @@ AcpiRsOutInteger32 ( char *Title, UINT32 Value) { + AcpiOsPrintf ("%27s : %8.8X\n", Title, Value); } @@ -582,6 +585,7 @@ AcpiRsOutInteger64 ( char *Title, UINT64 Value) { + AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title, ACPI_FORMAT_UINT64 (Value)); } @@ -590,6 +594,7 @@ static void AcpiRsOutTitle ( char *Title) { + AcpiOsPrintf ("%27s : ", Title); } @@ -617,8 +622,7 @@ AcpiRsDumpByteList ( for (i = 0; i < Length; i++) { - AcpiOsPrintf ("%25s%2.2X : %2.2X\n", - "Byte", i, Data[i]); + AcpiOsPrintf ("%25s%2.2X : %2.2X\n", "Byte", i, Data[i]); } } @@ -634,6 +638,7 @@ AcpiRsDumpShortByteList ( { AcpiOsPrintf ("%X ", Data[i]); } + AcpiOsPrintf ("\n"); } @@ -647,8 +652,7 @@ AcpiRsDumpDwordList ( for (i = 0; i < Length; i++) { - AcpiOsPrintf ("%25s%2.2X : %8.8X\n", - "Dword", i, Data[i]); + AcpiOsPrintf ("%25s%2.2X : %8.8X\n", "Dword", i, Data[i]); } } @@ -662,7 +666,6 @@ AcpiRsDumpWordList ( for (i = 0; i < Length; i++) { - AcpiOsPrintf ("%25s%2.2X : %4.4X\n", - "Word", i, Data[i]); + AcpiOsPrintf ("%25s%2.2X : %4.4X\n", "Word", i, Data[i]); } } diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c index db910acd4c9c..412835ff3129 100644 --- a/source/components/resources/rslist.c +++ b/source/components/resources/rslist.c @@ -97,9 +97,12 @@ AcpiRsConvertAmlToResources ( /* Get the appropriate conversion info table */ AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml); - if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) + + if (AcpiUtGetResourceType (Aml) == + ACPI_RESOURCE_NAME_SERIAL_BUS) { - if (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE) + if (AmlResource->CommonSerialBus.Type > + AML_RESOURCE_MAX_SERIALBUSTYPE) { ConversionTable = NULL; } @@ -107,15 +110,13 @@ AcpiRsConvertAmlToResources ( { /* This is an I2C, SPI, or UART SerialBus descriptor */ - ConversionTable = - AcpiGbl_ConvertResourceSerialBusDispatch[ - AmlResource->CommonSerialBus.Type]; + ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch [ + AmlResource->CommonSerialBus.Type]; } } else { - ConversionTable = - AcpiGbl_GetResourceDispatch[ResourceIndex]; + ConversionTable = AcpiGbl_GetResourceDispatch[ResourceIndex]; } if (!ConversionTable) @@ -210,7 +211,8 @@ AcpiRsConvertResourcesToAml ( if (Resource->Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { - if (Resource->Data.CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE) + if (Resource->Data.CommonSerialBus.Type > + AML_RESOURCE_MAX_SERIALBUSTYPE) { ConversionTable = NULL; } @@ -236,8 +238,7 @@ AcpiRsConvertResourcesToAml ( } Status = AcpiRsConvertResourceToAml (Resource, - ACPI_CAST_PTR (AML_RESOURCE, Aml), - ConversionTable); + ACPI_CAST_PTR (AML_RESOURCE, Aml), ConversionTable); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -248,8 +249,8 @@ AcpiRsConvertResourcesToAml ( /* Perform final sanity check on the new AML resource descriptor */ - Status = AcpiUtValidateResource (NULL, - ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL); + Status = AcpiUtValidateResource ( + NULL, ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 83f50aa95dac..a47a8cce2566 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -121,7 +121,7 @@ AcpiRsConvertAmlToResource ( * Source is the external AML byte stream buffer, * destination is the internal resource descriptor */ - Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset); + Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset); Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset); switch (Info->Opcode) @@ -200,8 +200,7 @@ AcpiRsConvertAmlToResource ( ItemCount = ACPI_GET8 (Source); ACPI_SET8 (Destination, ItemCount); - Resource->Length = Resource->Length + - (Info->Value * ItemCount); + Resource->Length = Resource->Length + (Info->Value * ItemCount); break; case ACPI_RSC_COUNT_GPIO_RES: @@ -273,7 +272,7 @@ AcpiRsConvertAmlToResource ( /* Generate and set the PIN data pointer */ Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount * 2)); + (Resource->Length - ItemCount * 2)); *(UINT16 **) Destination = ACPI_CAST_PTR (UINT16, Target); /* Copy the PIN data */ @@ -287,7 +286,7 @@ AcpiRsConvertAmlToResource ( /* Generate and set the ResourceSource string pointer */ Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); + (Resource->Length - ItemCount)); *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); /* Copy the ResourceSource string */ @@ -301,7 +300,7 @@ AcpiRsConvertAmlToResource ( /* Generate and set the Vendor Data pointer */ Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); + (Resource->Length - ItemCount)); *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); /* Copy the Vendor Data */ @@ -315,12 +314,13 @@ AcpiRsConvertAmlToResource ( /* Generate and set the ResourceSource string pointer */ Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); + (Resource->Length - ItemCount)); *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); /* Copy the ResourceSource string */ - Source = ACPI_ADD_PTR (void, Aml, (ACPI_GET16 (Source) + Info->Value)); + Source = ACPI_ADD_PTR ( + void, Aml, (ACPI_GET16 (Source) + Info->Value)); AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); break; @@ -442,7 +442,8 @@ Exit: { /* Round the resource struct length up to the next boundary (32 or 64) */ - Resource->Length = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (Resource->Length); + Resource->Length = (UINT32) + ACPI_ROUND_UP_TO_NATIVE_WORD (Resource->Length); } return_ACPI_STATUS (AE_OK); } @@ -498,7 +499,7 @@ AcpiRsConvertResourceToAml ( * Source is the internal resource descriptor, * destination is the external AML byte stream buffer */ - Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset); + Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset); Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset); switch (Info->Opcode) @@ -507,7 +508,8 @@ AcpiRsConvertResourceToAml ( memset (Aml, 0, INIT_RESOURCE_LENGTH (Info)); AmlLength = INIT_RESOURCE_LENGTH (Info); - AcpiRsSetResourceHeader (INIT_RESOURCE_TYPE (Info), AmlLength, Aml); + AcpiRsSetResourceHeader ( + INIT_RESOURCE_TYPE (Info), AmlLength, Aml); break; case ACPI_RSC_INITGET: @@ -549,7 +551,8 @@ AcpiRsConvertResourceToAml ( ItemCount = ACPI_GET8 (Source); ACPI_SET8 (Destination, ItemCount); - AmlLength = (UINT16) (AmlLength + (Info->Value * (ItemCount - 1))); + AmlLength = (UINT16) + (AmlLength + (Info->Value * (ItemCount - 1))); break; case ACPI_RSC_COUNT16: @@ -575,7 +578,8 @@ AcpiRsConvertResourceToAml ( ItemCount = ACPI_GET16 (Source); ACPI_SET16 (Destination, ItemCount); - AmlLength = (UINT16) (AmlLength + (Info->Value * ItemCount)); + AmlLength = (UINT16) ( + AmlLength + (Info->Value * ItemCount)); AcpiRsSetResourceLength (AmlLength, Aml); break; @@ -636,7 +640,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_MOVE_GPIO_PIN: Destination = (char *) ACPI_ADD_PTR (void, Aml, - ACPI_GET16 (Destination)); + ACPI_GET16 (Destination)); Source = * (UINT16 **) Source; AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); break; @@ -646,7 +650,7 @@ AcpiRsConvertResourceToAml ( /* Used for both ResourceSource string and VendorData */ Destination = (char *) ACPI_ADD_PTR (void, Aml, - ACPI_GET16 (Destination)); + ACPI_GET16 (Destination)); Source = * (UINT8 **) Source; AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); break; @@ -654,7 +658,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_MOVE_SERIAL_VEN: Destination = (char *) ACPI_ADD_PTR (void, Aml, - (AmlLength - ItemCount)); + (AmlLength - ItemCount)); Source = * (UINT8 **) Source; AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); break; @@ -662,7 +666,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_MOVE_SERIAL_RES: Destination = (char *) ACPI_ADD_PTR (void, Aml, - (AmlLength - ItemCount)); + (AmlLength - ItemCount)); Source = * (UINT8 **) Source; AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); break; @@ -679,7 +683,7 @@ AcpiRsConvertResourceToAml ( * Optional ResourceSource (Index and String) */ AmlLength = AcpiRsSetResourceSource ( - Aml, (ACPI_RS_LENGTH) AmlLength, Source); + Aml, (ACPI_RS_LENGTH) AmlLength, Source); AcpiRsSetResourceLength (AmlLength, Aml); break; @@ -705,8 +709,8 @@ AcpiRsConvertResourceToAml ( /* * 16-bit encoded bitmask (IRQ macro) */ - Temp16 = AcpiRsEncodeBitmask (Source, - *ACPI_ADD_PTR (UINT8, Resource, Info->Value)); + Temp16 = AcpiRsEncodeBitmask ( + Source, *ACPI_ADD_PTR (UINT8, Resource, Info->Value)); ACPI_MOVE_16_TO_16 (Destination, &Temp16); break; @@ -729,7 +733,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_COMPARE_VALUE: if (*ACPI_ADD_PTR (UINT8, Resource, - COMPARE_TARGET (Info)) != COMPARE_VALUE (Info)) + COMPARE_TARGET (Info)) != COMPARE_VALUE (Info)) { goto Exit; } @@ -747,7 +751,7 @@ AcpiRsConvertResourceToAml ( * Control - Exit conversion if equal */ if (*ACPI_ADD_PTR (UINT8, Resource, - COMPARE_TARGET (Info)) == COMPARE_VALUE (Info)) + COMPARE_TARGET (Info)) == COMPARE_VALUE (Info)) { goto Exit; } @@ -771,7 +775,8 @@ Exit: #if 0 /* Previous resource validations */ - if (Aml->ExtAddress64.RevisionID != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) + if (Aml->ExtAddress64.RevisionID != + AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { return_ACPI_STATUS (AE_SUPPORT); } diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index a5517c6bff92..bb48aef5fba8 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -185,20 +185,23 @@ AcpiRsMoveData ( case ACPI_RSC_MOVE16: case ACPI_RSC_MOVE_GPIO_PIN: - ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i], - &ACPI_CAST_PTR (UINT16, Source)[i]); + ACPI_MOVE_16_TO_16 ( + &ACPI_CAST_PTR (UINT16, Destination)[i], + &ACPI_CAST_PTR (UINT16, Source)[i]); break; case ACPI_RSC_MOVE32: - ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i], - &ACPI_CAST_PTR (UINT32, Source)[i]); + ACPI_MOVE_32_TO_32 ( + &ACPI_CAST_PTR (UINT32, Destination)[i], + &ACPI_CAST_PTR (UINT32, Source)[i]); break; case ACPI_RSC_MOVE64: - ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i], - &ACPI_CAST_PTR (UINT64, Source)[i]); + ACPI_MOVE_64_TO_64 ( + &ACPI_CAST_PTR (UINT64, Destination)[i], + &ACPI_CAST_PTR (UINT64, Source)[i]); break; default: @@ -248,18 +251,18 @@ AcpiRsSetResourceLength ( { /* Large descriptor -- bytes 1-2 contain the 16-bit length */ - ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength); + ACPI_MOVE_16_TO_16 ( + &Aml->LargeHeader.ResourceLength, &ResourceLength); } else { - /* Small descriptor -- bits 2:0 of byte 0 contain the length */ - + /* + * Small descriptor -- bits 2:0 of byte 0 contain the length + * Clear any existing length, preserving descriptor type bits + */ Aml->SmallHeader.DescriptorType = (UINT8) - - /* Clear any existing length, preserving descriptor type bits */ - - ((Aml->SmallHeader.DescriptorType & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) - + ((Aml->SmallHeader.DescriptorType & + ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) | ResourceLength); } } @@ -378,8 +381,8 @@ AcpiRsGetResourceSource ( AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength); /* - * ResourceSource is present if the length of the descriptor is longer than - * the minimum length. + * ResourceSource is present if the length of the descriptor is longer + * than the minimum length. * * Note: Some resource descriptors will have an additional null, so * we add 1 to the minimum length. @@ -397,8 +400,8 @@ AcpiRsGetResourceSource ( * String destination pointer is not specified; Set the String * pointer to the end of the current ResourceSource structure. */ - ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource, - sizeof (ACPI_RESOURCE_SOURCE)); + ResourceSource->StringPtr = ACPI_ADD_PTR ( + char, ResourceSource, sizeof (ACPI_RESOURCE_SOURCE)); } /* @@ -410,13 +413,15 @@ AcpiRsGetResourceSource ( */ TotalLength = (UINT32) strlen ( ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1; + TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength); memset (ResourceSource->StringPtr, 0, TotalLength); /* Copy the ResourceSource string to the destination */ - ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr, + ResourceSource->StringLength = AcpiRsStrcpy ( + ResourceSource->StringPtr, ACPI_CAST_PTR (char, &AmlResourceSource[1])); return ((ACPI_RS_LENGTH) TotalLength); @@ -484,7 +489,8 @@ AcpiRsSetResourceSource ( * Add the length of the string (+ 1 for null terminator) to the * final descriptor length */ - DescriptorLength += ((ACPI_RSDESC_SIZE) ResourceSource->StringLength + 1); + DescriptorLength += ((ACPI_RSDESC_SIZE) + ResourceSource->StringLength + 1); } /* Return the new total length of the AML descriptor */ @@ -527,8 +533,8 @@ AcpiRsGetPrtMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRT, - ACPI_BTYPE_PACKAGE, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__PRT, ACPI_BTYPE_PACKAGE, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -581,8 +587,8 @@ AcpiRsGetCrsMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__CRS, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__CRS, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -636,8 +642,8 @@ AcpiRsGetPrsMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRS, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__PRS, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -691,8 +697,8 @@ AcpiRsGetAeiMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__AEI, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__AEI, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -748,7 +754,8 @@ AcpiRsGetMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle), + Status = AcpiUtEvaluateObject ( + ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle), Path, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index 1008af010ff3..c1a9b1b60b13 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -54,7 +54,7 @@ /* Local macros for 16,32-bit to 64-bit conversion */ #define ACPI_COPY_FIELD(Out, In, Field) ((Out)->Field = (In)->Field) -#define ACPI_COPY_ADDRESS(Out, In) \ +#define ACPI_COPY_ADDRESS(Out, In) \ ACPI_COPY_FIELD(Out, In, ResourceType); \ ACPI_COPY_FIELD(Out, In, ProducerConsumer); \ ACPI_COPY_FIELD(Out, In, Decode); \ @@ -433,13 +433,15 @@ AcpiResourceToAddress64 ( { case ACPI_RESOURCE_TYPE_ADDRESS16: - Address16 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS16, &Resource->Data); + Address16 = ACPI_CAST_PTR ( + ACPI_RESOURCE_ADDRESS16, &Resource->Data); ACPI_COPY_ADDRESS (Out, Address16); break; case ACPI_RESOURCE_TYPE_ADDRESS32: - Address32 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS32, &Resource->Data); + Address32 = ACPI_CAST_PTR ( + ACPI_RESOURCE_ADDRESS32, &Resource->Data); ACPI_COPY_ADDRESS (Out, Address32); break; @@ -504,8 +506,8 @@ AcpiGetVendorResource ( /* Walk the _CRS or _PRS resource list for this device */ - Status = AcpiWalkResources (DeviceHandle, Name, AcpiRsMatchVendorResource, - &Info); + Status = AcpiWalkResources ( + DeviceHandle, Name, AcpiRsMatchVendorResource, &Info); if (ACPI_FAILURE (Status)) { return (Status); @@ -624,7 +626,8 @@ AcpiWalkResourceBuffer ( /* Buffer contains the resource list and length */ Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer); - ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer->Pointer, Buffer->Length); + ResourceEnd = ACPI_ADD_PTR ( + ACPI_RESOURCE, Buffer->Pointer, Buffer->Length); /* Walk the resource list until the EndTag is found (or buffer end) */ diff --git a/source/components/tables/tbdata.c b/source/components/tables/tbdata.c index 5769a8e70527..2943a0885802 100644 --- a/source/components/tables/tbdata.c +++ b/source/components/tables/tbdata.c @@ -122,7 +122,7 @@ AcpiTbAcquireTable ( case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, - ACPI_PHYSADDR_TO_PTR (TableDesc->Address)); + ACPI_PHYSADDR_TO_PTR (TableDesc->Address)); break; default: @@ -229,7 +229,7 @@ AcpiTbAcquireTempTable ( case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER, - ACPI_PHYSADDR_TO_PTR (Address)); + ACPI_PHYSADDR_TO_PTR (Address)); if (!TableHeader) { return (AE_NO_MEMORY); @@ -303,7 +303,7 @@ AcpiTbValidateTable ( if (!TableDesc->Pointer) { Status = AcpiTbAcquireTable (TableDesc, &TableDesc->Pointer, - &TableDesc->Length, &TableDesc->Flags); + &TableDesc->Length, &TableDesc->Flags); if (!TableDesc->Pointer) { Status = AE_NO_MEMORY; @@ -444,6 +444,7 @@ AcpiTbVerifyTempTable ( AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ? TableDesc->Signature.Ascii : "????", ACPI_FORMAT_UINT64 (TableDesc->Address))); + goto InvalidateAndExit; } } @@ -721,7 +722,7 @@ AcpiTbAllocateOwnerId ( if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) { Status = AcpiUtAllocateOwnerId ( - &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); + &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); } (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index bcbf576bc368..bfb80e5557ae 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -326,7 +326,7 @@ AcpiTbSelectAddress ( * * FUNCTION: AcpiTbParseFadt * - * PARAMETERS: TableIndex - Index for the FADT + * PARAMETERS: None * * RETURN: None * @@ -337,7 +337,7 @@ AcpiTbSelectAddress ( void AcpiTbParseFadt ( - UINT32 TableIndex) + void) { UINT32 Length; ACPI_TABLE_HEADER *Table; @@ -350,10 +350,10 @@ AcpiTbParseFadt ( * Get a local copy of the FADT and convert it to a common format * Map entire FADT, assumed to be smaller than one page. */ - Length = AcpiGbl_RootTableList.Tables[TableIndex].Length; + Length = AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex].Length; Table = AcpiOsMapMemory ( - AcpiGbl_RootTableList.Tables[TableIndex].Address, Length); + AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex].Address, Length); if (!Table) { return; diff --git a/source/components/tables/tbfind.c b/source/components/tables/tbfind.c index 4d360ae8bee3..34cf12c13f47 100644 --- a/source/components/tables/tbfind.c +++ b/source/components/tables/tbfind.c @@ -108,7 +108,7 @@ AcpiTbFindTable ( for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature), - Header.Signature, ACPI_NAME_SIZE)) + Header.Signature, ACPI_NAME_SIZE)) { /* Not the requested table */ @@ -136,13 +136,13 @@ AcpiTbFindTable ( /* Check for table match on all IDs */ if (!memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, - Header.Signature, ACPI_NAME_SIZE) && + Header.Signature, ACPI_NAME_SIZE) && (!OemId[0] || !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, - Header.OemId, ACPI_OEM_ID_SIZE)) && + Header.OemId, ACPI_OEM_ID_SIZE)) && (!OemTableId[0] || !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId, - Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE))) + Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE))) { *TableIndex = i; diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index a98a68989ec4..6abcc86c013b 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -83,7 +83,7 @@ AcpiTbCompareTables ( Status = AcpiTbAcquireTable (&AcpiGbl_RootTableList.Tables[TableIndex], - &Table, &TableLength, &TableFlags); + &Table, &TableLength, &TableFlags); if (ACPI_FAILURE (Status)) { return (FALSE); @@ -206,7 +206,7 @@ AcpiTbInstallFixedTable ( /* Fill a table descriptor for validation */ Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X", @@ -278,7 +278,8 @@ AcpiTbInstallStandardTable ( Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags); if (ACPI_FAILURE (Status)) { - ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X", + ACPI_ERROR ((AE_INFO, + "Could not acquire table length at %8.8X%8.8X", ACPI_FORMAT_UINT64 (Address))); return_ACPI_STATUS (Status); } @@ -291,7 +292,8 @@ AcpiTbInstallStandardTable ( AcpiGbl_DisableSsdtTableInstall && ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) { - ACPI_INFO ((AE_INFO, "Ignoring installation of %4.4s at %8.8X%8.8X", + ACPI_INFO ((AE_INFO, + "Ignoring installation of %4.4s at %8.8X%8.8X", NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address))); goto ReleaseAndExit; } @@ -359,7 +361,8 @@ AcpiTbInstallStandardTable ( * need to be unregistered when they are unloaded, and slots in the * root table list should be reused when empty. */ - if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED) + if (AcpiGbl_RootTableList.Tables[i].Flags & + ACPI_TABLE_IS_LOADED) { /* Table is still loaded, this is an error */ diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c index af73279cc6ee..25f319967cd8 100644 --- a/source/components/tables/tbprint.c +++ b/source/components/tables/tbprint.c @@ -88,6 +88,7 @@ AcpiTbFixString ( { *String = '?'; } + String++; Length--; } @@ -156,8 +157,8 @@ AcpiTbPrintTableHeader ( { /* RSDP has no common fields */ - memcpy (LocalHeader.OemId, - ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE); + memcpy (LocalHeader.OemId, ACPI_CAST_PTR (ACPI_TABLE_RSDP, + Header)->OemId, ACPI_OEM_ID_SIZE); AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); ACPI_INFO ((AE_INFO, "RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)", diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 988a3b18f637..19daea867e35 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -86,16 +86,16 @@ AcpiTbInitializeFacs ( return (AE_OK); } else if (AcpiGbl_FADT.XFacs && - (!AcpiGbl_FADT.Facs || !AcpiGbl_Use32BitFacsAddresses)) + (!AcpiGbl_FADT.Facs || !AcpiGbl_Use32BitFacsAddresses)) { (void) AcpiGetTableByIndex (AcpiGbl_XFacsIndex, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); AcpiGbl_FACS = Facs; } else if (AcpiGbl_FADT.Facs) { (void) AcpiGetTableByIndex (AcpiGbl_FacsIndex, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); AcpiGbl_FACS = Facs; } @@ -108,33 +108,6 @@ AcpiTbInitializeFacs ( /******************************************************************************* * - * FUNCTION: AcpiTbTablesLoaded - * - * PARAMETERS: None - * - * RETURN: TRUE if required ACPI tables are loaded - * - * DESCRIPTION: Determine if the minimum required ACPI tables are present - * (FADT, FACS, DSDT) - * - ******************************************************************************/ - -BOOLEAN -AcpiTbTablesLoaded ( - void) -{ - - if (AcpiGbl_RootTableList.CurrentTableCount >= 4) - { - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * * FUNCTION: AcpiTbCheckDsdtHeader * * PARAMETERS: None @@ -160,6 +133,7 @@ AcpiTbCheckDsdtHeader ( ACPI_BIOS_ERROR ((AE_INFO, "The DSDT has been corrupted or replaced - " "old, new headers below")); + AcpiTbPrintTableHeader (0, &AcpiGbl_OriginalDsdtHeader); AcpiTbPrintTableHeader (0, AcpiGbl_DSDT); @@ -208,8 +182,8 @@ AcpiTbCopyDsdt ( AcpiTbInitTableDescriptor ( &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex], - ACPI_PTR_TO_PHYSADDR (NewTable), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, - NewTable); + ACPI_PTR_TO_PHYSADDR (NewTable), + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, NewTable); ACPI_INFO ((AE_INFO, "Forced DSDT copy: length 0x%05X copied locally, original unmapped", @@ -254,7 +228,8 @@ AcpiTbGetRootTableEntry ( * 32-bit platform, RSDT: Return 32-bit table entry * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return */ - return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (UINT32, TableEntry))); + return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR ( + UINT32, TableEntry))); } else { @@ -420,10 +395,12 @@ AcpiTbParseRootTable ( ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex); if (ACPI_SUCCESS (Status) && - ACPI_COMPARE_NAME (&AcpiGbl_RootTableList.Tables[TableIndex].Signature, + ACPI_COMPARE_NAME ( + &AcpiGbl_RootTableList.Tables[TableIndex].Signature, ACPI_SIG_FADT)) { - AcpiTbParseFadt (TableIndex); + AcpiGbl_FadtIndex = TableIndex; + AcpiTbParseFadt (); } NextTable: @@ -432,7 +409,6 @@ NextTable: } AcpiOsUnmapMemory (Table, Length); - return_ACPI_STATUS (AE_OK); } diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c index bcaf6af2a990..f2c878618c80 100644 --- a/source/components/tables/tbxface.c +++ b/source/components/tables/tbxface.c @@ -246,8 +246,8 @@ AcpiGetTableHeader ( for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) { - if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - Signature)) + if (!ACPI_COMPARE_NAME ( + &(AcpiGbl_RootTableList.Tables[i].Signature), Signature)) { continue; } @@ -264,15 +264,14 @@ AcpiGetTableHeader ( ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL) { Header = AcpiOsMapMemory ( - AcpiGbl_RootTableList.Tables[i].Address, - sizeof (ACPI_TABLE_HEADER)); + AcpiGbl_RootTableList.Tables[i].Address, + sizeof (ACPI_TABLE_HEADER)); if (!Header) { return (AE_NO_MEMORY); } - memcpy (OutTableHeader, Header, - sizeof (ACPI_TABLE_HEADER)); + memcpy (OutTableHeader, Header, sizeof (ACPI_TABLE_HEADER)); AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER)); } else @@ -333,8 +332,8 @@ AcpiGetTable ( for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) { - if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - Signature)) + if (!ACPI_COMPARE_NAME ( + &(AcpiGbl_RootTableList.Tables[i].Signature), Signature)) { continue; } @@ -405,7 +404,8 @@ AcpiGetTableByIndex ( { /* Table is not mapped, map it */ - Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]); + Status = AcpiTbValidateTable ( + &AcpiGbl_RootTableList.Tables[TableIndex]); if (ACPI_FAILURE (Status)) { (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index bd5f7d7bc41f..b9b22259f11f 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -210,6 +210,7 @@ AcpiTbLoadNamespace ( { ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table", Table->Signature.Ascii, Table->Pointer->OemTableId)); + TablesFailed++; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, @@ -227,7 +228,7 @@ AcpiTbLoadNamespace ( if (!TablesFailed) { ACPI_INFO ((AE_INFO, - "%u ACPI AML tables successfully acquired and loaded", + "%u ACPI AML tables successfully acquired and loaded\n", TablesLoaded)); } else @@ -343,8 +344,8 @@ AcpiLoadTable ( (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, TRUE, FALSE, - &TableIndex); + ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, TRUE, FALSE, + &TableIndex); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) @@ -356,7 +357,8 @@ AcpiLoadTable ( * Note: Now table is "INSTALLED", it must be validated before * using. */ - Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]); + Status = AcpiTbValidateTable ( + &AcpiGbl_RootTableList.Tables[TableIndex]); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -369,7 +371,7 @@ AcpiLoadTable ( if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, - AcpiGbl_TableHandlerContext); + AcpiGbl_TableHandlerContext); } UnlockAndExit: @@ -452,8 +454,8 @@ AcpiUnloadParentTable ( * that can create namespace objects. */ if (ACPI_COMPARE_NAME ( - AcpiGbl_RootTableList.Tables[i].Signature.Ascii, - ACPI_SIG_DSDT)) + AcpiGbl_RootTableList.Tables[i].Signature.Ascii, + ACPI_SIG_DSDT)) { Status = AE_TYPE; break; @@ -472,8 +474,8 @@ AcpiUnloadParentTable ( if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, - AcpiGbl_RootTableList.Tables[i].Pointer, - AcpiGbl_TableHandlerContext); + AcpiGbl_RootTableList.Tables[i].Pointer, + AcpiGbl_TableHandlerContext); } /* diff --git a/source/components/tables/tbxfroot.c b/source/components/tables/tbxfroot.c index 92ace5cb02be..455f13334dd2 100644 --- a/source/components/tables/tbxfroot.c +++ b/source/components/tables/tbxfroot.c @@ -171,8 +171,8 @@ AcpiFindRootPointer ( /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ TablePtr = AcpiOsMapMemory ( - (ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION, - ACPI_EBDA_PTR_LENGTH); + (ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION, + ACPI_EBDA_PTR_LENGTH); if (!TablePtr) { ACPI_ERROR ((AE_INFO, @@ -198,8 +198,8 @@ AcpiFindRootPointer ( * minimum of 1K length) */ TablePtr = AcpiOsMapMemory ( - (ACPI_PHYSICAL_ADDRESS) PhysicalAddress, - ACPI_EBDA_WINDOW_SIZE); + (ACPI_PHYSICAL_ADDRESS) PhysicalAddress, + ACPI_EBDA_WINDOW_SIZE); if (!TablePtr) { ACPI_ERROR ((AE_INFO, @@ -209,14 +209,16 @@ AcpiFindRootPointer ( return_ACPI_STATUS (AE_NO_MEMORY); } - MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_EBDA_WINDOW_SIZE); + MemRover = AcpiTbScanMemoryForRsdp ( + TablePtr, ACPI_EBDA_WINDOW_SIZE); AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE); if (MemRover) { /* Return the physical address */ - PhysicalAddress += (UINT32) ACPI_PTR_DIFF (MemRover, TablePtr); + PhysicalAddress += + (UINT32) ACPI_PTR_DIFF (MemRover, TablePtr); *TableAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress; return_ACPI_STATUS (AE_OK); @@ -227,8 +229,8 @@ AcpiFindRootPointer ( * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ TablePtr = AcpiOsMapMemory ( - (ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE, - ACPI_HI_RSDP_WINDOW_SIZE); + (ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE, + ACPI_HI_RSDP_WINDOW_SIZE); if (!TablePtr) { @@ -239,7 +241,8 @@ AcpiFindRootPointer ( return_ACPI_STATUS (AE_NO_MEMORY); } - MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); + MemRover = AcpiTbScanMemoryForRsdp ( + TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); if (MemRover) @@ -297,7 +300,8 @@ AcpiTbScanMemoryForRsdp ( { /* The RSDP signature and checksum must both be correct */ - Status = AcpiTbValidateRsdp (ACPI_CAST_PTR (ACPI_TABLE_RSDP, MemRover)); + Status = AcpiTbValidateRsdp ( + ACPI_CAST_PTR (ACPI_TABLE_RSDP, MemRover)); if (ACPI_SUCCESS (Status)) { /* Sig and checksum valid, we have found a real RSDP */ diff --git a/source/components/utilities/utaddress.c b/source/components/utilities/utaddress.c index 2ebdea47e830..3106c4d4e272 100644 --- a/source/components/utilities/utaddress.c +++ b/source/components/utilities/utaddress.c @@ -263,7 +263,7 @@ AcpiUtCheckAddressRange ( OverlapCount++; if (Warn) /* Optional warning message */ { - Pathname = AcpiNsGetExternalPathname (RangeInfo->RegionNode); + Pathname = AcpiNsGetNormalizedPathname (RangeInfo->RegionNode, TRUE); ACPI_WARNING ((AE_INFO, "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)", diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c index d0b5c920634c..9fed8b84550f 100644 --- a/source/components/utilities/utalloc.c +++ b/source/components/utilities/utalloc.c @@ -110,35 +110,35 @@ AcpiUtCreateCaches ( /* Object Caches, for frequently used objects */ Status = AcpiOsCreateCache ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE), - ACPI_MAX_NAMESPACE_CACHE_DEPTH, &AcpiGbl_NamespaceCache); + ACPI_MAX_NAMESPACE_CACHE_DEPTH, &AcpiGbl_NamespaceCache); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsCreateCache ("Acpi-State", sizeof (ACPI_GENERIC_STATE), - ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache); + ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsCreateCache ("Acpi-Parse", sizeof (ACPI_PARSE_OBJ_COMMON), - ACPI_MAX_PARSE_CACHE_DEPTH, &AcpiGbl_PsNodeCache); + ACPI_MAX_PARSE_CACHE_DEPTH, &AcpiGbl_PsNodeCache); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsCreateCache ("Acpi-ParseExt", sizeof (ACPI_PARSE_OBJ_NAMED), - ACPI_MAX_EXTPARSE_CACHE_DEPTH, &AcpiGbl_PsNodeExtCache); + ACPI_MAX_EXTPARSE_CACHE_DEPTH, &AcpiGbl_PsNodeExtCache); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsCreateCache ("Acpi-Operand", sizeof (ACPI_OPERAND_OBJECT), - ACPI_MAX_OBJECT_CACHE_DEPTH, &AcpiGbl_OperandCache); + ACPI_MAX_OBJECT_CACHE_DEPTH, &AcpiGbl_OperandCache); if (ACPI_FAILURE (Status)) { return (Status); @@ -150,14 +150,14 @@ AcpiUtCreateCaches ( /* Memory allocation lists */ Status = AcpiUtCreateList ("Acpi-Global", 0, - &AcpiGbl_GlobalList); + &AcpiGbl_GlobalList); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiUtCreateList ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE), - &AcpiGbl_NsNodeList); + &AcpiGbl_NsNodeList); if (ACPI_FAILURE (Status)) { return (Status); @@ -187,6 +187,7 @@ AcpiUtDeleteCaches ( #ifdef ACPI_DBG_TRACK_ALLOCATIONS char Buffer[7]; + if (AcpiGbl_DisplayFinalMemStats) { strcpy (Buffer, "MEMORY"); diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c index 7a0f210dff6a..01c04fab9335 100644 --- a/source/components/utilities/utcache.c +++ b/source/components/utilities/utcache.c @@ -93,9 +93,9 @@ AcpiOsCreateCache ( /* Populate the cache object and return it */ memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); - Cache->ListName = CacheName; + Cache->ListName = CacheName; Cache->ObjectSize = ObjectSize; - Cache->MaxDepth = MaxDepth; + Cache->MaxDepth = MaxDepth; *ReturnCache = Cache; return (AE_OK); diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c index dc5ecda7731c..bab6b9f27013 100644 --- a/source/components/utilities/utcopy.c +++ b/source/components/utilities/utcopy.c @@ -163,7 +163,7 @@ AcpiUtCopyIsimpleToEsimple ( ExternalObject->String.Pointer = (char *) DataSpace; ExternalObject->String.Length = InternalObject->String.Length; *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( - (ACPI_SIZE) InternalObject->String.Length + 1); + (ACPI_SIZE) InternalObject->String.Length + 1); memcpy ((void *) DataSpace, (void *) InternalObject->String.Pointer, @@ -175,7 +175,7 @@ AcpiUtCopyIsimpleToEsimple ( ExternalObject->Buffer.Pointer = DataSpace; ExternalObject->Buffer.Length = InternalObject->Buffer.Length; *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( - InternalObject->String.Length); + InternalObject->String.Length); memcpy ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer, @@ -275,9 +275,9 @@ AcpiUtCopyIelementToEelement ( ACPI_FUNCTION_ENTRY (); - ThisIndex = State->Pkg.Index; - TargetObject = (ACPI_OBJECT *) - &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex]; + ThisIndex = State->Pkg.Index; + TargetObject = (ACPI_OBJECT *) &((ACPI_OBJECT *) + (State->Pkg.DestObject))->Package.Elements[ThisIndex]; switch (ObjectType) { @@ -286,7 +286,7 @@ AcpiUtCopyIelementToEelement ( * This is a simple or null object */ Status = AcpiUtCopyIsimpleToEsimple (SourceObject, - TargetObject, Info->FreeSpace, &ObjectSpace); + TargetObject, Info->FreeSpace, &ObjectSpace); if (ACPI_FAILURE (Status)) { return (Status); @@ -297,9 +297,9 @@ AcpiUtCopyIelementToEelement ( /* * Build the package object */ - TargetObject->Type = ACPI_TYPE_PACKAGE; - TargetObject->Package.Count = SourceObject->Package.Count; - TargetObject->Package.Elements = + TargetObject->Type = ACPI_TYPE_PACKAGE; + TargetObject->Package.Count = SourceObject->Package.Count; + TargetObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace); /* @@ -312,8 +312,8 @@ AcpiUtCopyIelementToEelement ( * update the buffer length counter */ ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD ( - (ACPI_SIZE) TargetObject->Package.Count * - sizeof (ACPI_OBJECT)); + (ACPI_SIZE) TargetObject->Package.Count * + sizeof (ACPI_OBJECT)); break; default: @@ -321,8 +321,8 @@ AcpiUtCopyIelementToEelement ( return (AE_BAD_PARAMETER); } - Info->FreeSpace += ObjectSpace; - Info->Length += ObjectSpace; + Info->FreeSpace += ObjectSpace; + Info->Length += ObjectSpace; return (Status); } @@ -368,28 +368,28 @@ AcpiUtCopyIpackageToEpackage ( /* * Free space begins right after the first package */ - Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD ( - sizeof (ACPI_OBJECT)); + Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); + Info.FreeSpace = Buffer + + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Info.ObjectSpace = 0; Info.NumPackages = 1; - ExternalObject->Type = InternalObject->Common.Type; - ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, - Info.FreeSpace); + ExternalObject->Type = InternalObject->Common.Type; + ExternalObject->Package.Count = InternalObject->Package.Count; + ExternalObject->Package.Elements = + ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace); /* * Leave room for an array of ACPI_OBJECTS in the buffer * and move the free space past it */ - Info.Length += (ACPI_SIZE) ExternalObject->Package.Count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); + Info.Length += (ACPI_SIZE) ExternalObject->Package.Count * + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Info.FreeSpace += ExternalObject->Package.Count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject, - AcpiUtCopyIelementToEelement, &Info); + AcpiUtCopyIelementToEelement, &Info); *SpaceUsed = Info.Length; return_ACPI_STATUS (Status); @@ -428,7 +428,7 @@ AcpiUtCopyIobjectToEobject ( * nested packages) */ Status = AcpiUtCopyIpackageToEpackage (InternalObject, - RetBuffer->Pointer, &RetBuffer->Length); + RetBuffer->Pointer, &RetBuffer->Length); } else { @@ -436,10 +436,10 @@ AcpiUtCopyIobjectToEobject ( * Build a simple object (no nested objects) */ Status = AcpiUtCopyIsimpleToEsimple (InternalObject, - ACPI_CAST_PTR (ACPI_OBJECT, RetBuffer->Pointer), - ACPI_ADD_PTR (UINT8, RetBuffer->Pointer, - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))), - &RetBuffer->Length); + ACPI_CAST_PTR (ACPI_OBJECT, RetBuffer->Pointer), + ACPI_ADD_PTR (UINT8, RetBuffer->Pointer, + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))), + &RetBuffer->Length); /* * build simple does not include the object size in the length * so we add it in here @@ -489,7 +489,7 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_LOCAL_REFERENCE: InternalObject = AcpiUtCreateInternalObject ( - (UINT8) ExternalObject->Type); + (UINT8) ExternalObject->Type); if (!InternalObject) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -529,10 +529,10 @@ AcpiUtCopyEsimpleToIsimple ( } memcpy (InternalObject->String.Pointer, - ExternalObject->String.Pointer, - ExternalObject->String.Length); + ExternalObject->String.Pointer, + ExternalObject->String.Length); - InternalObject->String.Length = ExternalObject->String.Length; + InternalObject->String.Length = ExternalObject->String.Length; break; case ACPI_TYPE_BUFFER: @@ -545,10 +545,10 @@ AcpiUtCopyEsimpleToIsimple ( } memcpy (InternalObject->Buffer.Pointer, - ExternalObject->Buffer.Pointer, - ExternalObject->Buffer.Length); + ExternalObject->Buffer.Pointer, + ExternalObject->Buffer.Length); - InternalObject->Buffer.Length = ExternalObject->Buffer.Length; + InternalObject->Buffer.Length = ExternalObject->Buffer.Length; /* Mark buffer data valid */ @@ -557,7 +557,7 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_INTEGER: - InternalObject->Integer.Value = ExternalObject->Integer.Value; + InternalObject->Integer.Value = ExternalObject->Integer.Value; break; case ACPI_TYPE_LOCAL_REFERENCE: @@ -615,7 +615,8 @@ AcpiUtCopyEpackageToIpackage ( /* Create the package object */ - PackageObject = AcpiUtCreatePackageObject (ExternalObject->Package.Count); + PackageObject = AcpiUtCreatePackageObject ( + ExternalObject->Package.Count); if (!PackageObject) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -624,14 +625,14 @@ AcpiUtCopyEpackageToIpackage ( PackageElements = PackageObject->Package.Elements; /* - * Recursive implementation. Probably ok, since nested external packages - * as parameters should be very rare. + * Recursive implementation. Probably ok, since nested external + * packages as parameters should be very rare. */ for (i = 0; i < ExternalObject->Package.Count; i++) { Status = AcpiUtCopyEobjectToIobject ( - &ExternalObject->Package.Elements[i], - &PackageElements[i]); + &ExternalObject->Package.Elements[i], + &PackageElements[i]); if (ACPI_FAILURE (Status)) { /* Truncate package and delete it */ @@ -678,14 +679,16 @@ AcpiUtCopyEobjectToIobject ( if (ExternalObject->Type == ACPI_TYPE_PACKAGE) { - Status = AcpiUtCopyEpackageToIpackage (ExternalObject, InternalObject); + Status = AcpiUtCopyEpackageToIpackage ( + ExternalObject, InternalObject); } else { /* * Build a simple object (no nested objects) */ - Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, InternalObject); + Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, + InternalObject); } return_ACPI_STATUS (Status); @@ -836,7 +839,7 @@ AcpiUtCopySimpleObject ( case ACPI_TYPE_EVENT: Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, - &DestDesc->Event.OsSemaphore); + &DestDesc->Event.OsSemaphore); if (ACPI_FAILURE (Status)) { return (Status); @@ -882,9 +885,9 @@ AcpiUtCopyIelementToIelement ( ACPI_FUNCTION_ENTRY (); - ThisIndex = State->Pkg.Index; + ThisIndex = State->Pkg.Index; ThisTargetPtr = (ACPI_OPERAND_OBJECT **) - &State->Pkg.DestObject->Package.Elements[ThisIndex]; + &State->Pkg.DestObject->Package.Elements[ThisIndex]; switch (ObjectType) { @@ -898,7 +901,7 @@ AcpiUtCopyIelementToIelement ( * This is a simple object, just copy it */ TargetObject = AcpiUtCreateInternalObject ( - SourceObject->Common.Type); + SourceObject->Common.Type); if (!TargetObject) { return (AE_NO_MEMORY); @@ -925,7 +928,8 @@ AcpiUtCopyIelementToIelement ( * This object is a package - go down another nesting level * Create and build the package object */ - TargetObject = AcpiUtCreatePackageObject (SourceObject->Package.Count); + TargetObject = AcpiUtCreatePackageObject ( + SourceObject->Package.Count); if (!TargetObject) { return (AE_NO_MEMORY); @@ -982,16 +986,16 @@ AcpiUtCopyIpackageToIpackage ( ACPI_FUNCTION_TRACE (UtCopyIpackageToIpackage); - DestObj->Common.Type = SourceObj->Common.Type; - DestObj->Common.Flags = SourceObj->Common.Flags; - DestObj->Package.Count = SourceObj->Package.Count; + DestObj->Common.Type = SourceObj->Common.Type; + DestObj->Common.Flags = SourceObj->Common.Flags; + DestObj->Package.Count = SourceObj->Package.Count; /* * Create the object array and walk the source package tree */ DestObj->Package.Elements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) SourceObj->Package.Count + 1) * - sizeof (void *)); + ((ACPI_SIZE) SourceObj->Package.Count + 1) * + sizeof (void *)); if (!DestObj->Package.Elements) { ACPI_ERROR ((AE_INFO, "Package allocation failure")); @@ -1003,7 +1007,7 @@ AcpiUtCopyIpackageToIpackage ( * This handles nested packages of arbitrary depth. */ Status = AcpiUtWalkPackageTree (SourceObj, DestObj, - AcpiUtCopyIelementToIelement, WalkState); + AcpiUtCopyIelementToIelement, WalkState); if (ACPI_FAILURE (Status)) { /* On failure, delete the destination package object */ @@ -1053,8 +1057,8 @@ AcpiUtCopyIobjectToIobject ( if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE) { - Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc, - WalkState); + Status = AcpiUtCopyIpackageToIpackage ( + SourceDesc, *DestDesc, WalkState); } else { @@ -1065,7 +1069,7 @@ AcpiUtCopyIobjectToIobject ( if (ACPI_FAILURE (Status)) { - AcpiUtRemoveReference(*DestDesc); + AcpiUtRemoveReference (*DestDesc); } return_ACPI_STATUS (Status); diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index fc21e205845b..e8f380f0c51f 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -119,7 +119,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = }; -char * +const char * AcpiUtGetRegionName ( UINT8 SpaceId) { @@ -141,7 +141,7 @@ AcpiUtGetRegionName ( return ("InvalidSpaceId"); } - return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId])); + return (AcpiGbl_RegionTypes[SpaceId]); } @@ -169,7 +169,7 @@ static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = }; -char * +const char * AcpiUtGetEventName ( UINT32 EventId) { @@ -179,7 +179,7 @@ AcpiUtGetEventName ( return ("InvalidEventID"); } - return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId])); + return (AcpiGbl_EventTypes[EventId]); } @@ -201,7 +201,8 @@ AcpiUtGetEventName ( * * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; * when stored in a table it really means that we have thus far seen no - * evidence to indicate what type is actually going to be stored for this entry. + * evidence to indicate what type is actually going to be stored for this + & entry. */ static const char AcpiGbl_BadType[] = "UNDEFINED"; @@ -243,21 +244,21 @@ static const char *AcpiGbl_NsTypeNames[] = }; -char * +const char * AcpiUtGetTypeName ( ACPI_OBJECT_TYPE Type) { if (Type > ACPI_TYPE_INVALID) { - return (ACPI_CAST_PTR (char, AcpiGbl_BadType)); + return (AcpiGbl_BadType); } - return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type])); + return (AcpiGbl_NsTypeNames[Type]); } -char * +const char * AcpiUtGetObjectTypeName ( ACPI_OPERAND_OBJECT *ObjDesc) { @@ -299,7 +300,7 @@ AcpiUtGetObjectTypeName ( * ******************************************************************************/ -char * +const char * AcpiUtGetNodeName ( void *Object) { @@ -375,7 +376,7 @@ static const char *AcpiGbl_DescTypeNames[] = }; -char * +const char * AcpiUtGetDescriptorName ( void *Object) { @@ -390,9 +391,7 @@ AcpiUtGetDescriptorName ( return ("Not a Descriptor"); } - return (ACPI_CAST_PTR (char, - AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)])); - + return (AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]); } @@ -469,7 +468,7 @@ AcpiUtGetReferenceName ( /* Names for internal mutex objects, used for debug output */ -static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = +static const char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = { "ACPI_MTX_Interpreter", "ACPI_MTX_Namespace", @@ -479,7 +478,7 @@ static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = "ACPI_MTX_Memory", }; -char * +const char * AcpiUtGetMutexName ( UINT32 MutexId) { diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 17ccacb6e2a2..95521f060d3e 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -220,6 +220,7 @@ AcpiUtDeleteInternalObj ( AcpiUtDeleteObjectDesc (Object->Method.Mutex); Object->Method.Mutex = NULL; } + if (Object->Method.Node) { Object->Method.Node = NULL; @@ -553,8 +554,8 @@ AcpiUtUpdateObjectReference ( } /* - * All sub-objects must have their reference count incremented also. - * Different object types have different subobjects. + * All sub-objects must have their reference count incremented + * also. Different object types have different subobjects. */ switch (Object->Common.Type) { @@ -614,7 +615,7 @@ AcpiUtUpdateObjectReference ( * for later processing (this eliminates recursion.) */ Status = AcpiUtCreateUpdateStateAndPush ( - NextObject, Action, &StateList); + NextObject, Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -639,7 +640,7 @@ AcpiUtUpdateObjectReference ( NextObject = Object->BankField.BankObj; Status = AcpiUtCreateUpdateStateAndPush ( - Object->BankField.RegionObj, Action, &StateList); + Object->BankField.RegionObj, Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -650,7 +651,7 @@ AcpiUtUpdateObjectReference ( NextObject = Object->IndexField.IndexObj; Status = AcpiUtCreateUpdateStateAndPush ( - Object->IndexField.DataObj, Action, &StateList); + Object->IndexField.DataObj, Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; diff --git a/source/components/utilities/uterror.c b/source/components/utilities/uterror.c index b5f532f2fbd7..756a259f9424 100644 --- a/source/components/utilities/uterror.c +++ b/source/components/utilities/uterror.c @@ -244,8 +244,8 @@ AcpiUtNamespaceError ( { /* Convert path to external format */ - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, - InternalName, NULL, &Name); + Status = AcpiNsExternalizeName ( + ACPI_UINT32_MAX, InternalName, NULL, &Name); /* Print target name */ @@ -307,8 +307,8 @@ AcpiUtMethodError ( if (Path) { - Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH, - &Node); + Status = AcpiNsGetNode (PrefixNode, Path, + ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("[Could not get node by pathname]"); diff --git a/source/components/utilities/uteval.c b/source/components/utilities/uteval.c index 542c691276c1..24afcad2a3cb 100644 --- a/source/components/utilities/uteval.c +++ b/source/components/utilities/uteval.c @@ -231,7 +231,7 @@ AcpiUtEvaluateNumericObject ( Status = AcpiUtEvaluateObject (DeviceNode, ObjectName, - ACPI_BTYPE_INTEGER, &ObjDesc); + ACPI_BTYPE_INTEGER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -278,7 +278,7 @@ AcpiUtExecute_STA ( Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA, - ACPI_BTYPE_INTEGER, &ObjDesc); + ACPI_BTYPE_INTEGER, &ObjDesc); if (ACPI_FAILURE (Status)) { if (AE_NOT_FOUND == Status) @@ -351,8 +351,8 @@ AcpiUtExecutePowerMethods ( * return type is an Integer. */ Status = AcpiUtEvaluateObject (DeviceNode, - ACPI_CAST_PTR (char, MethodNames[i]), - ACPI_BTYPE_INTEGER, &ObjDesc); + ACPI_CAST_PTR (char, MethodNames[i]), + ACPI_BTYPE_INTEGER, &ObjDesc); if (ACPI_SUCCESS (Status)) { OutValues[i] = (UINT8) ObjDesc->Integer.Value; diff --git a/source/components/utilities/utfileio.c b/source/components/utilities/utfileio.c deleted file mode 100644 index 8c503543507e..000000000000 --- a/source/components/utilities/utfileio.c +++ /dev/null @@ -1,366 +0,0 @@ -/******************************************************************************* - * - * Module Name: utfileio - simple file I/O routines - * - ******************************************************************************/ - -/* - * Copyright (C) 2000 - 2015, Intel Corp. - * All rights reserved. - * - * 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. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * 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 MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. - */ - -#include "acpi.h" -#include "accommon.h" -#include "actables.h" -#include "acapps.h" -#include "errno.h" - -#ifdef ACPI_ASL_COMPILER -#include "aslcompiler.h" -#endif - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("utfileio") - - -#ifdef ACPI_APPLICATION - -/* Local prototypes */ - -static ACPI_STATUS -AcpiUtCheckTextModeCorruption ( - UINT8 *Table, - UINT32 TableLength, - UINT32 FileLength); - -static ACPI_STATUS -AcpiUtReadTable ( - FILE *fp, - ACPI_TABLE_HEADER **Table, - UINT32 *TableLength); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCheckTextModeCorruption - * - * PARAMETERS: Table - Table buffer - * TableLength - Length of table from the table header - * FileLength - Length of the file that contains the table - * - * RETURN: Status - * - * DESCRIPTION: Check table for text mode file corruption where all linefeed - * characters (LF) have been replaced by carriage return linefeed - * pairs (CR/LF). - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCheckTextModeCorruption ( - UINT8 *Table, - UINT32 TableLength, - UINT32 FileLength) -{ - UINT32 i; - UINT32 Pairs = 0; - - - if (TableLength != FileLength) - { - ACPI_WARNING ((AE_INFO, - "File length (0x%X) is not the same as the table length (0x%X)", - FileLength, TableLength)); - } - - /* Scan entire table to determine if each LF has been prefixed with a CR */ - - for (i = 1; i < FileLength; i++) - { - if (Table[i] == 0x0A) - { - if (Table[i - 1] != 0x0D) - { - /* The LF does not have a preceding CR, table not corrupted */ - - return (AE_OK); - } - else - { - /* Found a CR/LF pair */ - - Pairs++; - } - i++; - } - } - - if (!Pairs) - { - return (AE_OK); - } - - /* - * Entire table scanned, each CR is part of a CR/LF pair -- - * meaning that the table was treated as a text file somewhere. - * - * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the - * original table are left untouched by the text conversion process -- - * meaning that we cannot simply replace CR/LF pairs with LFs. - */ - AcpiOsPrintf ("Table has been corrupted by text mode conversion\n"); - AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs); - AcpiOsPrintf ("Table cannot be repaired!\n"); - return (AE_BAD_VALUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtReadTable - * - * PARAMETERS: fp - File that contains table - * Table - Return value, buffer with table - * TableLength - Return value, length of table - * - * RETURN: Status - * - * DESCRIPTION: Load the DSDT from the file pointer - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtReadTable ( - FILE *fp, - ACPI_TABLE_HEADER **Table, - UINT32 *TableLength) -{ - ACPI_TABLE_HEADER TableHeader; - UINT32 Actual; - ACPI_STATUS Status; - UINT32 FileSize; - BOOLEAN StandardHeader = TRUE; - INT32 Count; - - /* Get the file size */ - - FileSize = CmGetFileSize (fp); - if (FileSize == ACPI_UINT32_MAX) - { - return (AE_ERROR); - } - - if (FileSize < 4) - { - return (AE_BAD_HEADER); - } - - /* Read the signature */ - - fseek (fp, 0, SEEK_SET); - - Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp); - if (Count != sizeof (ACPI_TABLE_HEADER)) - { - AcpiOsPrintf ("Could not read the table header\n"); - return (AE_BAD_HEADER); - } - - /* The RSDP table does not have standard ACPI header */ - - if (ACPI_VALIDATE_RSDP_SIG (TableHeader.Signature)) - { - *TableLength = FileSize; - StandardHeader = FALSE; - } - else - { - -#if 0 - /* Validate the table header/length */ - - Status = AcpiTbValidateTableHeader (&TableHeader); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Table header is invalid!\n"); - return (Status); - } -#endif - - /* File size must be at least as long as the Header-specified length */ - - if (TableHeader.Length > FileSize) - { - AcpiOsPrintf ( - "TableHeader length [0x%X] greater than the input file size [0x%X]\n", - TableHeader.Length, FileSize); - -#ifdef ACPI_ASL_COMPILER - AcpiOsPrintf ("File is corrupt or is ASCII text -- " - "it must be a binary file\n"); -#endif - return (AE_BAD_HEADER); - } - -#ifdef ACPI_OBSOLETE_CODE - /* We only support a limited number of table types */ - - if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) && - !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) && - !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT)) - { - AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n", - (char *) TableHeader.Signature); - ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER)); - return (AE_ERROR); - } -#endif - - *TableLength = TableHeader.Length; - } - - /* Allocate a buffer for the table */ - - *Table = AcpiOsAllocate ((size_t) FileSize); - if (!*Table) - { - AcpiOsPrintf ( - "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", - TableHeader.Signature, *TableLength); - return (AE_NO_MEMORY); - } - - /* Get the rest of the table */ - - fseek (fp, 0, SEEK_SET); - Actual = fread (*Table, 1, (size_t) FileSize, fp); - if (Actual == FileSize) - { - if (StandardHeader) - { - /* Now validate the checksum */ - - Status = AcpiTbVerifyChecksum ((void *) *Table, - ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length); - - if (Status == AE_BAD_CHECKSUM) - { - Status = AcpiUtCheckTextModeCorruption ((UINT8 *) *Table, - FileSize, (*Table)->Length); - return (Status); - } - } - return (AE_OK); - } - - if (Actual > 0) - { - AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n", - FileSize, Actual); - return (AE_OK); - } - - AcpiOsPrintf ("Error - could not read the table file\n"); - AcpiOsFree (*Table); - *Table = NULL; - *TableLength = 0; - return (AE_ERROR); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtReadTableFromFile - * - * PARAMETERS: Filename - File where table is located - * Table - Where a pointer to the table is returned - * - * RETURN: Status - * - * DESCRIPTION: Get an ACPI table from a file - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtReadTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **Table) -{ - FILE *File; - UINT32 FileSize; - UINT32 TableLength; - ACPI_STATUS Status = AE_ERROR; - - - /* Open the file, get current size */ - - File = fopen (Filename, "rb"); - if (!File) - { - perror ("Could not open input file"); - - if (errno == ENOENT) - { - return (AE_NOT_EXIST); - } - - return (Status); - } - - FileSize = CmGetFileSize (File); - if (FileSize == ACPI_UINT32_MAX) - { - goto Exit; - } - - /* Get the entire file */ - - fprintf (stderr, - "Reading ACPI table from file %12s - Length %.8u (0x%06X)\n", - Filename, FileSize, FileSize); - - Status = AcpiUtReadTable (File, Table, &TableLength); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get table from the file\n"); - } - -Exit: - fclose(File); - return (Status); -} - -#endif diff --git a/source/components/utilities/uthex.c b/source/components/utilities/uthex.c index abbf5f4874f1..7ec8fe059e39 100644 --- a/source/components/utilities/uthex.c +++ b/source/components/utilities/uthex.c @@ -50,7 +50,7 @@ /* Hex to ASCII conversion table */ -static char AcpiGbl_HexToAscii[] = +static const char AcpiGbl_HexToAscii[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; diff --git a/source/components/utilities/utids.c b/source/components/utilities/utids.c index 1b7f1f5dad8a..528d78c64936 100644 --- a/source/components/utilities/utids.c +++ b/source/components/utilities/utids.c @@ -83,7 +83,7 @@ AcpiUtExecute_HID ( Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -102,7 +102,8 @@ AcpiUtExecute_HID ( /* Allocate a buffer for the HID */ - Hid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + Hid = ACPI_ALLOCATE_ZEROED ( + sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); if (!Hid) { Status = AE_NO_MEMORY; @@ -139,77 +140,6 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiUtExecute_SUB - * - * PARAMETERS: DeviceNode - Node for the device - * ReturnId - Where the _SUB is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _SUB control method that returns the subsystem - * ID of the device. The _SUB value is always a string containing - * either a valid PNP or ACPI ID. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_SUB ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PNP_DEVICE_ID *Sub; - UINT32 Length; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_SUB); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__SUB, - ACPI_BTYPE_STRING, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the size of the String to be returned, includes null terminator */ - - Length = ObjDesc->String.Length + 1; - - /* Allocate a buffer for the SUB */ - - Sub = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); - if (!Sub) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Area for the string starts after PNP_DEVICE_ID struct */ - - Sub->String = ACPI_ADD_PTR (char, Sub, sizeof (ACPI_PNP_DEVICE_ID)); - - /* Simply copy existing string */ - - strcpy (Sub->String, ObjDesc->String.Pointer); - Sub->Length = Length; - *ReturnId = Sub; - - -Cleanup: - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * * FUNCTION: AcpiUtExecute_UID * * PARAMETERS: DeviceNode - Node for the device @@ -241,7 +171,7 @@ AcpiUtExecute_UID ( Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -260,7 +190,8 @@ AcpiUtExecute_UID ( /* Allocate a buffer for the UID */ - Uid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + Uid = ACPI_ALLOCATE_ZEROED ( + sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); if (!Uid) { Status = AE_NO_MEMORY; @@ -341,8 +272,8 @@ AcpiUtExecute_CID ( /* Evaluate the _CID method for this device */ Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, - &ObjDesc); + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, + &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -419,7 +350,8 @@ AcpiUtExecute_CID ( { /* Convert the Integer (EISAID) CID to a string */ - AcpiExEisaIdToString (NextIdString, CidObjects[i]->Integer.Value); + AcpiExEisaIdToString ( + NextIdString, CidObjects[i]->Integer.Value); Length = ACPI_EISAID_STRING_SIZE; } else /* ACPI_TYPE_STRING */ @@ -488,7 +420,7 @@ AcpiUtExecute_CLS ( Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CLS, - ACPI_BTYPE_PACKAGE, &ObjDesc); + ACPI_BTYPE_PACKAGE, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -518,7 +450,8 @@ AcpiUtExecute_CLS ( /* Allocate a buffer for the CLS */ - Cls = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + Cls = ACPI_ALLOCATE_ZEROED ( + sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); if (!Cls) { Status = AE_NO_MEMORY; diff --git a/source/components/utilities/utinit.c b/source/components/utilities/utinit.c index 8f8eaaad92b9..9689abb43516 100644 --- a/source/components/utilities/utinit.c +++ b/source/components/utilities/utinit.c @@ -262,8 +262,6 @@ AcpiUtInitGlobals ( AcpiGbl_DisableMemTracking = FALSE; #endif - ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = FALSE); - return_ACPI_STATUS (AE_OK); } @@ -312,6 +310,20 @@ AcpiUtSubsystemShutdown ( ACPI_FUNCTION_TRACE (UtSubsystemShutdown); + /* Just exit if subsystem is already shutdown */ + + if (AcpiGbl_Shutdown) + { + ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated")); + return_VOID; + } + + /* Subsystem appears active, go ahead and shut it down */ + + AcpiGbl_Shutdown = TRUE; + AcpiGbl_StartupFlags = 0; + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); + #ifndef ACPI_ASL_COMPILER /* Close the AcpiEvent Handling */ diff --git a/source/components/utilities/utmath.c b/source/components/utilities/utmath.c index 0f920751c17c..9d44ad5533d5 100644 --- a/source/components/utilities/utmath.c +++ b/source/components/utilities/utmath.c @@ -122,9 +122,10 @@ AcpiUtShortDivide ( * and is generated by the second divide. */ ACPI_DIV_64_BY_32 (0, DividendOvl.Part.Hi, Divisor, - Quotient.Part.Hi, Remainder32); + Quotient.Part.Hi, Remainder32); + ACPI_DIV_64_BY_32 (Remainder32, DividendOvl.Part.Lo, Divisor, - Quotient.Part.Lo, Remainder32); + Quotient.Part.Lo, Remainder32); /* Return only what was requested */ @@ -200,9 +201,10 @@ AcpiUtDivide ( * and is generated by the second divide. */ ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor.Part.Lo, - Quotient.Part.Hi, Partial1); + Quotient.Part.Hi, Partial1); + ACPI_DIV_64_BY_32 (Partial1, Dividend.Part.Lo, Divisor.Part.Lo, - Quotient.Part.Lo, Remainder.Part.Lo); + Quotient.Part.Lo, Remainder.Part.Lo); } else @@ -219,25 +221,24 @@ AcpiUtDivide ( do { - ACPI_SHIFT_RIGHT_64 (NormalizedDivisor.Part.Hi, - NormalizedDivisor.Part.Lo); - ACPI_SHIFT_RIGHT_64 (NormalizedDividend.Part.Hi, - NormalizedDividend.Part.Lo); + ACPI_SHIFT_RIGHT_64 ( + NormalizedDivisor.Part.Hi, NormalizedDivisor.Part.Lo); + ACPI_SHIFT_RIGHT_64 ( + NormalizedDividend.Part.Hi, NormalizedDividend.Part.Lo); } while (NormalizedDivisor.Part.Hi != 0); /* Partial divide */ - ACPI_DIV_64_BY_32 (NormalizedDividend.Part.Hi, - NormalizedDividend.Part.Lo, - NormalizedDivisor.Part.Lo, - Quotient.Part.Lo, Partial1); + ACPI_DIV_64_BY_32 ( + NormalizedDividend.Part.Hi, NormalizedDividend.Part.Lo, + NormalizedDivisor.Part.Lo, Quotient.Part.Lo, Partial1); /* - * The quotient is always 32 bits, and simply requires adjustment. - * The 64-bit remainder must be generated. + * The quotient is always 32 bits, and simply requires + * adjustment. The 64-bit remainder must be generated. */ - Partial1 = Quotient.Part.Lo * Divisor.Part.Hi; + Partial1 = Quotient.Part.Lo * Divisor.Part.Hi; Partial2.Full = (UINT64) Quotient.Part.Lo * Divisor.Part.Lo; Partial3.Full = (UINT64) Partial2.Part.Hi + Partial1; @@ -263,7 +264,7 @@ AcpiUtDivide ( } } - Remainder.Full = Remainder.Full - Dividend.Full; + Remainder.Full = Remainder.Full - Dividend.Full; Remainder.Part.Hi = (UINT32) -((INT32) Remainder.Part.Hi); Remainder.Part.Lo = (UINT32) -((INT32) Remainder.Part.Lo); diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index 3ab7f16ade78..b56a50cfe59a 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -72,10 +72,10 @@ AcpiUtIsPciRootBridge ( * ACPI 3.0+: check for a PCI Express root also. */ if (!(strcmp (Id, - PCI_ROOT_HID_STRING)) || + PCI_ROOT_HID_STRING)) || !(strcmp (Id, - PCI_EXPRESS_ROOT_HID_STRING))) + PCI_EXPRESS_ROOT_HID_STRING))) { return (TRUE); } @@ -185,17 +185,17 @@ AcpiUtSetIntegerWidth ( { /* 32-bit case */ - AcpiGbl_IntegerBitWidth = 32; + AcpiGbl_IntegerBitWidth = 32; AcpiGbl_IntegerNybbleWidth = 8; - AcpiGbl_IntegerByteWidth = 4; + AcpiGbl_IntegerByteWidth = 4; } else { /* 64-bit case (ACPI 2.0+) */ - AcpiGbl_IntegerBitWidth = 64; + AcpiGbl_IntegerBitWidth = 64; AcpiGbl_IntegerNybbleWidth = 16; - AcpiGbl_IntegerByteWidth = 8; + AcpiGbl_IntegerByteWidth = 8; } } @@ -286,9 +286,9 @@ AcpiUtWalkPackageTree ( { /* Get one element of the package */ - ThisIndex = State->Pkg.Index; + ThisIndex = State->Pkg.Index; ThisSourceObj = (ACPI_OPERAND_OBJECT *) - State->Pkg.SourceObject->Package.Elements[ThisIndex]; + State->Pkg.SourceObject->Package.Elements[ThisIndex]; /* * Check for: @@ -299,7 +299,8 @@ AcpiUtWalkPackageTree ( * case below. */ if ((!ThisSourceObj) || - (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_OPERAND) || + (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != + ACPI_DESC_TYPE_OPERAND) || (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE)) { Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, @@ -310,7 +311,8 @@ AcpiUtWalkPackageTree ( } State->Pkg.Index++; - while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count) + while (State->Pkg.Index >= + State->Pkg.SourceObject->Package.Count) { /* * We've handled all of the objects at this level, This means @@ -345,8 +347,8 @@ AcpiUtWalkPackageTree ( { /* This is a subobject of type package */ - Status = WalkCallback (ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, - State, Context); + Status = WalkCallback ( + ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, State, Context); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -357,8 +359,8 @@ AcpiUtWalkPackageTree ( * The callback above returned a new target package object. */ AcpiUtPushGenericState (&StateList, State); - State = AcpiUtCreatePkgState (ThisSourceObj, - State->Pkg.ThisTargetObj, 0); + State = AcpiUtCreatePkgState ( + ThisSourceObj, State->Pkg.ThisTargetObj, 0); if (!State) { /* Free any stacked Update State objects */ diff --git a/source/components/utilities/utmutex.c b/source/components/utilities/utmutex.c index 60b94c11e52b..9cbc599c417f 100644 --- a/source/components/utilities/utmutex.c +++ b/source/components/utilities/utmutex.c @@ -329,11 +329,12 @@ AcpiUtAcquireMutex ( "Thread %u attempting to acquire Mutex [%s]\n", (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); - Status = AcpiOsAcquireMutex (AcpiGbl_MutexInfo[MutexId].Mutex, - ACPI_WAIT_FOREVER); + Status = AcpiOsAcquireMutex ( + AcpiGbl_MutexInfo[MutexId].Mutex, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, + "Thread %u acquired Mutex [%s]\n", (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); AcpiGbl_MutexInfo[MutexId].UseCount++; diff --git a/source/components/utilities/utnonansi.c b/source/components/utilities/utnonansi.c index 3c64eaa1f5f1..257450e41be6 100644 --- a/source/components/utilities/utnonansi.c +++ b/source/components/utilities/utnonansi.c @@ -332,8 +332,8 @@ AcpiUtStrtoul64 ( /* Divide the digit into the correct position */ - (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit), - Base, &Quotient, NULL); + (void) AcpiUtShortDivide ( + (Dividend - (UINT64) ThisDigit), Base, &Quotient, NULL); if (ReturnValue > Quotient) { diff --git a/source/components/utilities/utobject.c b/source/components/utilities/utobject.c index 62758c4f7aeb..e8e157640ce6 100644 --- a/source/components/utilities/utobject.c +++ b/source/components/utilities/utobject.c @@ -107,7 +107,8 @@ AcpiUtCreateInternalObjectDbg ( /* Allocate the raw object descriptor */ - Object = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId); + Object = AcpiUtAllocateObjectDescDbg ( + ModuleName, LineNumber, ComponentId); if (!Object) { return_PTR (NULL); @@ -121,8 +122,8 @@ AcpiUtCreateInternalObjectDbg ( /* These types require a secondary object */ - SecondObject = AcpiUtAllocateObjectDescDbg (ModuleName, - LineNumber, ComponentId); + SecondObject = AcpiUtAllocateObjectDescDbg ( + ModuleName, LineNumber, ComponentId); if (!SecondObject) { AcpiUtDeleteObjectDesc (Object); @@ -193,7 +194,7 @@ AcpiUtCreatePackageObject ( * terminated. */ PackageElements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) Count + 1) * sizeof (void *)); + ((ACPI_SIZE) Count + 1) * sizeof (void *)); if (!PackageElements) { ACPI_FREE (PackageDesc); @@ -283,6 +284,7 @@ AcpiUtCreateBufferObject ( { ACPI_ERROR ((AE_INFO, "Could not allocate size %u", (UINT32) BufferSize)); + AcpiUtRemoveReference (BufferDesc); return_PTR (NULL); } @@ -342,6 +344,7 @@ AcpiUtCreateStringObject ( { ACPI_ERROR ((AE_INFO, "Could not allocate size %u", (UINT32) StringSize)); + AcpiUtRemoveReference (StringDesc); return_PTR (NULL); } @@ -398,8 +401,8 @@ AcpiUtValidInternalObject ( default: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%p is not an ACPI operand obj [%s]\n", - Object, AcpiUtGetDescriptorName (Object))); + "%p is not an ACPI operand obj [%s]\n", + Object, AcpiUtGetDescriptorName (Object))); break; } @@ -448,7 +451,7 @@ AcpiUtAllocateObjectDescDbg ( ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_OPERAND); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", - Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT))); + Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT))); return_PTR (Object); } @@ -711,12 +714,12 @@ AcpiUtGetPackageObjectSize ( ACPI_FUNCTION_TRACE_PTR (UtGetPackageObjectSize, InternalObject); - Info.Length = 0; + Info.Length = 0; Info.ObjectSpace = 0; Info.NumPackages = 1; - Status = AcpiUtWalkPackageTree (InternalObject, NULL, - AcpiUtGetElementLength, &Info); + Status = AcpiUtWalkPackageTree ( + InternalObject, NULL, AcpiUtGetElementLength, &Info); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -727,8 +730,8 @@ AcpiUtGetPackageObjectSize ( * just add the length of the package objects themselves. * Round up to the next machine word. */ - Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) * - (ACPI_SIZE) Info.NumPackages; + Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD ( + sizeof (ACPI_OBJECT)) * (ACPI_SIZE) Info.NumPackages; /* Return the total package length */ @@ -762,7 +765,8 @@ AcpiUtGetObjectSize ( ACPI_FUNCTION_ENTRY (); - if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_OPERAND) && + if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == + ACPI_DESC_TYPE_OPERAND) && (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)) { Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength); diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index 30cba5422389..64a08493b484 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -156,7 +156,9 @@ AcpiUtInitializeInterfaces ( /* Link the static list of supported interfaces */ - for (i = 0; i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); i++) + for (i = 0; + i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); + i++) { AcpiDefaultSupportedInterfaces[i].Next = &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1]; @@ -300,8 +302,10 @@ AcpiUtRemoveInterface ( { if (!strcmp (InterfaceName, NextInterface->Name)) { - /* Found: name is in either the static list or was added at runtime */ - + /* + * Found: name is in either the static list + * or was added at runtime + */ if (NextInterface->Flags & ACPI_OSI_DYNAMIC) { /* Interface was added dynamically, remove and free it */ @@ -321,8 +325,8 @@ AcpiUtRemoveInterface ( else { /* - * Interface is in static list. If marked invalid, then it - * does not actually exist. Else, mark it invalid. + * Interface is in static list. If marked invalid, then + * it does not actually exist. Else, mark it invalid. */ if (NextInterface->Flags & ACPI_OSI_INVALID) { diff --git a/source/components/utilities/utownerid.c b/source/components/utilities/utownerid.c index a130fb704ed5..dc3922a1c1ba 100644 --- a/source/components/utilities/utownerid.c +++ b/source/components/utilities/utownerid.c @@ -81,7 +81,8 @@ AcpiUtAllocateOwnerId ( if (*OwnerId) { - ACPI_ERROR ((AE_INFO, "Owner ID [0x%2.2X] already exists", *OwnerId)); + ACPI_ERROR ((AE_INFO, + "Owner ID [0x%2.2X] already exists", *OwnerId)); return_ACPI_STATUS (AE_ALREADY_EXISTS); } @@ -95,8 +96,8 @@ AcpiUtAllocateOwnerId ( /* * Find a free owner ID, cycle through all possible IDs on repeated - * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have - * to be scanned twice. + * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index + * may have to be scanned twice. */ for (i = 0, j = AcpiGbl_LastOwnerIdIndex; i < (ACPI_NUM_OWNERID_MASKS + 1); @@ -152,8 +153,8 @@ AcpiUtAllocateOwnerId ( * they are released when a table is unloaded or a method completes * execution. * - * If this error happens, there may be very deep nesting of invoked control - * methods, or there may be a bug where the IDs are not released. + * If this error happens, there may be very deep nesting of invoked + * control methods, or there may be a bug where the IDs are not released. */ Status = AE_OWNER_ID_LIMIT; ACPI_ERROR ((AE_INFO, diff --git a/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c index 1b7ef34181cb..f5d835327329 100644 --- a/source/components/utilities/utpredef.c +++ b/source/components/utilities/utpredef.c @@ -254,8 +254,10 @@ AcpiUtMatchResourceName ( const ACPI_PREDEFINED_INFO *ThisName; - /* Quick check for a predefined name, first character must be underscore */ - + /* + * Quick check for a predefined name, first character must + * be underscore + */ if (Name[0] != '_') { return (NULL); diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index 6d7b87cd3e8a..1b0e12b32f13 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -390,8 +390,8 @@ AcpiUtFormatNumber ( String = AcpiUtBoundStringOutput (String, End, '0'); if (Base == 16) { - String = AcpiUtBoundStringOutput (String, End, - Upper ? 'X' : 'x'); + String = AcpiUtBoundStringOutput ( + String, End, Upper ? 'X' : 'x'); } } if (!(Type & ACPI_FORMAT_LEFT)) @@ -500,6 +500,7 @@ AcpiUtVsnprintf ( { break; } + } while (1); /* Process width */ @@ -537,6 +538,7 @@ AcpiUtVsnprintf ( ++Format; Precision = va_arg (Args, int); } + if (Precision < 0) { Precision = 0; @@ -599,11 +601,13 @@ AcpiUtVsnprintf ( Pos = AcpiUtBoundStringOutput (Pos, End, ' '); } } + for (i = 0; i < Length; ++i) { Pos = AcpiUtBoundStringOutput (Pos, End, *s); ++s; } + while (Length < Width--) { Pos = AcpiUtBoundStringOutput (Pos, End, ' '); @@ -642,8 +646,8 @@ AcpiUtVsnprintf ( } p = va_arg (Args, void *); - Pos = AcpiUtFormatNumber (Pos, End, - ACPI_TO_INTEGER (p), 16, Width, Precision, Type); + Pos = AcpiUtFormatNumber ( + Pos, End, ACPI_TO_INTEGER (p), 16, Width, Precision, Type); continue; default: @@ -694,7 +698,7 @@ AcpiUtVsnprintf ( } Pos = AcpiUtFormatNumber (Pos, End, Number, Base, - Width, Precision, Type); + Width, Precision, Type); } if (Size > 0) @@ -773,7 +777,7 @@ AcpiUtFileVprintf ( Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer, - sizeof (AcpiGbl_PrintBuffer), Format, Args); + sizeof (AcpiGbl_PrintBuffer), Format, Args); (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1); AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c index df3c73ee4eb4..41db3968c1a0 100644 --- a/source/components/utilities/utresrc.c +++ b/source/components/utilities/utresrc.c @@ -489,8 +489,8 @@ AcpiUtWalkAmlResources ( if (ACPI_FAILURE (Status)) { /* - * Exit on failure. Cannot continue because the descriptor length - * may be bogus also. + * Exit on failure. Cannot continue because the descriptor + * length may be bogus also. */ return_ACPI_STATUS (Status); } @@ -503,7 +503,8 @@ AcpiUtWalkAmlResources ( if (UserFunction) { - Status = UserFunction (Aml, Length, Offset, ResourceIndex, Context); + Status = UserFunction ( + Aml, Length, Offset, ResourceIndex, Context); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -625,8 +626,8 @@ AcpiUtValidateResource ( } /* - * Check validity of the resource type, via AcpiGbl_ResourceTypes. Zero - * indicates an invalid resource. + * Check validity of the resource type, via AcpiGbl_ResourceTypes. + * Zero indicates an invalid resource. */ if (!AcpiGbl_ResourceTypes[ResourceIndex]) { @@ -813,7 +814,7 @@ AcpiUtGetResourceLength ( /* Small Resource type -- bits 2:0 of byte 0 contain the length */ ResourceLength = (UINT16) (ACPI_GET8 (Aml) & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); } return (ResourceLength); @@ -878,7 +879,7 @@ AcpiUtGetDescriptorLength ( * the header length (depends on if this is a small or large resource) */ return (AcpiUtGetResourceLength (Aml) + - AcpiUtGetResourceHeaderLength (Aml)); + AcpiUtGetResourceHeaderLength (Aml)); } @@ -918,7 +919,7 @@ AcpiUtGetResourceEndTag ( /* Validate the template and get a pointer to the EndTag */ Status = AcpiUtWalkAmlResources (NULL, ObjDesc->Buffer.Pointer, - ObjDesc->Buffer.Length, NULL, (void **) EndTag); + ObjDesc->Buffer.Length, NULL, (void **) EndTag); return_ACPI_STATUS (Status); } diff --git a/source/components/utilities/utstate.c b/source/components/utilities/utstate.c index 49fc8e9b8df1..ad07a4a74ac8 100644 --- a/source/components/utilities/utstate.c +++ b/source/components/utilities/utstate.c @@ -278,6 +278,7 @@ AcpiUtCreatePkgState ( State->Pkg.DestObject = ExternalObject; State->Pkg.Index= Index; State->Pkg.NumPackages = 1; + return (State); } @@ -317,6 +318,7 @@ AcpiUtCreateControlState ( State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_CONTROL; State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING; + return (State); } @@ -347,5 +349,6 @@ AcpiUtDeleteGenericState ( { (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State); } + return; } diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index af7b4af761da..c8b41f10ad78 100644 --- a/source/components/utilities/utstring.c +++ b/source/components/utilities/utstring.c @@ -147,6 +147,7 @@ AcpiUtPrintString ( break; } } + AcpiOsPrintf ("\""); if (i == MaxLength && String[i]) diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index 7a594be88fc2..234fe50f63c5 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -115,7 +115,7 @@ AcpiUtCreateList ( memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); - Cache->ListName = ListName; + Cache->ListName = ListName; Cache->ObjectSize = ObjectSize; *ReturnCache = Cache; @@ -169,8 +169,8 @@ AcpiUtAllocateAndTrack ( return (NULL); } - Status = AcpiUtTrackAllocation (Allocation, Size, - ACPI_MEM_MALLOC, Component, Module, Line); + Status = AcpiUtTrackAllocation ( + Allocation, Size, ACPI_MEM_MALLOC, Component, Module, Line); if (ACPI_FAILURE (Status)) { AcpiOsFree (Allocation); @@ -180,9 +180,12 @@ AcpiUtAllocateAndTrack ( AcpiGbl_GlobalList->TotalAllocated++; AcpiGbl_GlobalList->TotalSize += (UINT32) Size; AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size; - if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied) + + if (AcpiGbl_GlobalList->CurrentTotalSize > + AcpiGbl_GlobalList->MaxOccupied) { - AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize; + AcpiGbl_GlobalList->MaxOccupied = + AcpiGbl_GlobalList->CurrentTotalSize; } return ((void *) &Allocation->UserSpace); @@ -224,7 +227,8 @@ AcpiUtAllocateZeroedAndTrack ( Size = 1; } - Allocation = AcpiOsAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER)); + Allocation = AcpiOsAllocateZeroed ( + Size + sizeof (ACPI_DEBUG_MEM_HEADER)); if (!Allocation) { /* Report allocation error */ @@ -235,7 +239,7 @@ AcpiUtAllocateZeroedAndTrack ( } Status = AcpiUtTrackAllocation (Allocation, Size, - ACPI_MEM_CALLOC, Component, Module, Line); + ACPI_MEM_CALLOC, Component, Module, Line); if (ACPI_FAILURE (Status)) { AcpiOsFree (Allocation); @@ -245,9 +249,12 @@ AcpiUtAllocateZeroedAndTrack ( AcpiGbl_GlobalList->TotalAllocated++; AcpiGbl_GlobalList->TotalSize += (UINT32) Size; AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size; - if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied) + + if (AcpiGbl_GlobalList->CurrentTotalSize > + AcpiGbl_GlobalList->MaxOccupied) { - AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize; + AcpiGbl_GlobalList->MaxOccupied = + AcpiGbl_GlobalList->CurrentTotalSize; } return ((void *) &Allocation->UserSpace); @@ -292,13 +299,12 @@ AcpiUtFreeAndTrack ( } DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK, - (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER))); + (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER))); AcpiGbl_GlobalList->TotalFreed++; AcpiGbl_GlobalList->CurrentTotalSize -= DebugBlock->Size; - Status = AcpiUtRemoveAllocation (DebugBlock, - Component, Module, Line); + Status = AcpiUtRemoveAllocation (DebugBlock, Component, Module, Line); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not free memory")); @@ -440,10 +446,10 @@ AcpiUtTrackAllocation ( /* Fill in the instance data */ - Allocation->Size = (UINT32) Size; + Allocation->Size = (UINT32) Size; Allocation->AllocType = AllocType; Allocation->Component = Component; - Allocation->Line = Line; + Allocation->Line = Line; strncpy (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0; @@ -454,7 +460,8 @@ AcpiUtTrackAllocation ( if (MemList->ListHead) { - ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation; + ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = + Allocation; } Allocation->Next = MemList->ListHead; @@ -587,37 +594,37 @@ AcpiUtDumpAllocationInfo ( /* ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current allocations", - MemList->CurrentCount, - ROUND_UP_TO_1K (MemList->CurrentSize))); + ("%30s: %4d (%3d Kb)\n", "Current allocations", + MemList->CurrentCount, + ROUND_UP_TO_1K (MemList->CurrentSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", - MemList->MaxConcurrentCount, - ROUND_UP_TO_1K (MemList->MaxConcurrentSize))); + ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", + MemList->MaxConcurrentCount, + ROUND_UP_TO_1K (MemList->MaxConcurrentSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", - RunningObjectCount, - ROUND_UP_TO_1K (RunningObjectSize))); + ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", + RunningObjectCount, + ROUND_UP_TO_1K (RunningObjectSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", - RunningAllocCount, - ROUND_UP_TO_1K (RunningAllocSize))); + ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", + RunningAllocCount, + ROUND_UP_TO_1K (RunningAllocSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current Nodes", - AcpiGbl_CurrentNodeCount, - ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize))); + ("%30s: %4d (%3d Kb)\n", "Current Nodes", + AcpiGbl_CurrentNodeCount, + ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max Nodes", - AcpiGbl_MaxConcurrentNodeCount, - ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount * - sizeof (ACPI_NAMESPACE_NODE))))); + ("%30s: %4d (%3d Kb)\n", "Max Nodes", + AcpiGbl_MaxConcurrentNodeCount, + ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount * + sizeof (ACPI_NAMESPACE_NODE))))); */ return_VOID; } @@ -669,7 +676,8 @@ AcpiUtDumpAllocations ( if ((Element->Component & Component) && ((Module == NULL) || (0 == strcmp (Module, Element->Module)))) { - Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace); + Descriptor = ACPI_CAST_PTR ( + ACPI_DESCRIPTOR, &Element->UserSpace); if (Element->Size < sizeof (ACPI_COMMON_DESCRIPTOR)) { @@ -682,7 +690,8 @@ AcpiUtDumpAllocations ( { /* Ignore allocated objects that are in a cache */ - if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED) + if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != + ACPI_DESC_TYPE_CACHED) { AcpiOsPrintf ("%p Length 0x%04X %9.9s-%u [%s] ", Descriptor, Element->Size, Element->Module, diff --git a/source/components/utilities/utuuid.c b/source/components/utilities/utuuid.c index 7ad4b27ef756..0cb7e71925f0 100644 --- a/source/components/utilities/utuuid.c +++ b/source/components/utilities/utuuid.c @@ -93,11 +93,11 @@ AcpiUtConvertStringToUuid ( for (i = 0; i < UUID_BUFFER_LENGTH; i++) { - UuidBuffer[i] = - (AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i]]) << 4); + UuidBuffer[i] = (AcpiUtAsciiCharToHex ( + InString[AcpiGbl_MapToUuidOffset[i]]) << 4); - UuidBuffer[i] |= - AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i] + 1]); + UuidBuffer[i] |= AcpiUtAsciiCharToHex ( + InString[AcpiGbl_MapToUuidOffset[i] + 1]); } } #endif diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index d41c93a18f86..57c2f458bcc8 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -73,24 +73,6 @@ AcpiTerminate ( ACPI_FUNCTION_TRACE (AcpiTerminate); - /* Just exit if subsystem is already shutdown */ - - if (AcpiGbl_Shutdown) - { - ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated")); - return_ACPI_STATUS (AE_OK); - } - - /* Subsystem appears active, go ahead and shut it down */ - - AcpiGbl_Shutdown = TRUE; - AcpiGbl_StartupFlags = 0; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); - - /* Terminate the AML Debugger if present */ - - ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = TRUE); - /* Shutdown and free all resources */ AcpiUtSubsystemShutdown (); @@ -190,7 +172,6 @@ AcpiGetSystemInfo ( * Populate the return buffer */ InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer; - InfoPtr->AcpiCaVersion = ACPI_CA_VERSION; /* System flags (ACPI capabilities) */ @@ -258,11 +239,9 @@ AcpiGetStatistics ( memcpy (Stats->FixedEventCount, AcpiFixedEventCount, sizeof (AcpiFixedEventCount)); - /* Other counters */ Stats->MethodCount = AcpiMethodCount; - return_ACPI_STATUS (AE_OK); } diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c index a6a6818b6888..8cbb2632c4d4 100644 --- a/source/components/utilities/utxferror.c +++ b/source/components/utilities/utxferror.c @@ -133,8 +133,10 @@ AcpiException ( } else { - AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); + AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", + AcpiFormatException (Status)); } + va_start (ArgList, Format); AcpiOsVprintf (Format, ArgList); ACPI_MSG_SUFFIX; diff --git a/source/components/utilities/utxfmutex.c b/source/components/utilities/utxfmutex.c index cf27a02df566..3e8d6d858d29 100644 --- a/source/components/utilities/utxfmutex.c +++ b/source/components/utilities/utxfmutex.c @@ -98,8 +98,8 @@ AcpiUtGetMutexObject ( MutexNode = Handle; if (Pathname != NULL) { - Status = AcpiGetHandle (Handle, Pathname, - ACPI_CAST_PTR (ACPI_HANDLE, &MutexNode)); + Status = AcpiGetHandle ( + Handle, Pathname, ACPI_CAST_PTR (ACPI_HANDLE, &MutexNode)); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/include/acapps.h b/source/include/acapps.h index 9ca8e7301097..6652cefcd596 100644 --- a/source/include/acapps.h +++ b/source/include/acapps.h @@ -44,6 +44,7 @@ #ifndef _ACAPPS #define _ACAPPS +#include <stdio.h> #ifdef _MSC_VER /* disable some level-4 warnings */ #pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ @@ -93,10 +94,38 @@ AcpiOsPrintf (" %-18s%s\n", Name, Description); +/* Check for unexpected exceptions */ + +#define ACPI_CHECK_STATUS(Name, Status, Expected) \ + if (Status != Expected) \ + { \ + AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \ + AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \ + } + +/* Check for unexpected non-AE_OK errors */ + + +#define ACPI_CHECK_OK(Name, Status) ACPI_CHECK_STATUS (Name, Status, AE_OK); + #define FILE_SUFFIX_DISASSEMBLY "dsl" #define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */ +/* acfileio */ + +ACPI_STATUS +AcpiAcGetAllTablesFromFile ( + char *Filename, + UINT8 GetOnlyAmlTables, + ACPI_NEW_TABLE_DESC **ReturnListHead); + +/* Values for GetOnlyAmlTables */ + +#define ACPI_GET_ONLY_AML_TABLES TRUE +#define ACPI_GET_ALL_TABLES FALSE + + /* * getopt */ @@ -125,51 +154,6 @@ CmGetFileSize ( ACPI_FILE File); -#ifndef ACPI_DUMP_APP -/* - * adisasm - */ -ACPI_STATUS -AdAmlDisassemble ( - BOOLEAN OutToFile, - char *Filename, - char *Prefix, - char **OutFilename); - -void -AdPrintStatistics ( - void); - -ACPI_STATUS -AdFindDsdt( - UINT8 **DsdtPtr, - UINT32 *DsdtLength); - -void -AdDumpTables ( - void); - -ACPI_STATUS -AdGetLocalTables ( - void); - -ACPI_STATUS -AdParseTable ( - ACPI_TABLE_HEADER *Table, - ACPI_OWNER_ID *OwnerId, - BOOLEAN LoadTable, - BOOLEAN External); - -ACPI_STATUS -AdDisplayTables ( - char *Filename, - ACPI_TABLE_HEADER *Table); - -ACPI_STATUS -AdDisplayStatistics ( - void); - - /* * adwalk */ @@ -228,6 +212,5 @@ AdWriteTable ( UINT32 Length, char *TableName, char *OemTableId); -#endif #endif /* _ACAPPS */ diff --git a/source/include/acdebug.h b/source/include/acdebug.h index faf3c136df3d..6bf85c13cd90 100644 --- a/source/include/acdebug.h +++ b/source/include/acdebug.h @@ -91,11 +91,17 @@ typedef struct acpi_db_execute_walk /* * dbxface - external debugger interfaces */ +ACPI_DBR_DEPENDENT_RETURN_OK ( ACPI_STATUS AcpiDbSingleStep ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, - UINT32 OpType); + UINT32 OpType)) + +ACPI_DBR_DEPENDENT_RETURN_VOID ( +void +AcpiDbSignalBreakPoint ( + ACPI_WALK_STATE *WalkState)) /* @@ -290,10 +296,11 @@ AcpiDbDecodeAndDisplayObject ( char *Target, char *OutputType); +ACPI_DBR_DEPENDENT_RETURN_VOID ( void AcpiDbDisplayResultObject ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); + ACPI_WALK_STATE *WalkState)) ACPI_STATUS AcpiDbDisplayAllMethods ( @@ -319,10 +326,11 @@ void AcpiDbDisplayObjectType ( char *ObjectArg); +ACPI_DBR_DEPENDENT_RETURN_VOID ( void AcpiDbDisplayArgumentObject ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); + ACPI_WALK_STATE *WalkState)) /* @@ -374,10 +382,8 @@ AcpiDbLoadAcpiTable ( char *Filename); ACPI_STATUS -AcpiDbGetTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **Table, - BOOLEAN MustBeAmlTable); +AcpiDbLoadTables ( + ACPI_NEW_TABLE_DESC *ListHead); /* diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index f362430bed09..a39e5e63e254 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -1047,7 +1047,7 @@ AcpiDmCloseOperator ( /* - * acdisasm + * dmtables */ void AdDisassemblerHeader ( @@ -1057,4 +1057,35 @@ AdDisassemblerHeader ( #define ACPI_IS_AML_TABLE 0 #define ACPI_IS_DATA_TABLE 1 + +/* + * adisasm + */ +ACPI_STATUS +AdAmlDisassemble ( + BOOLEAN OutToFile, + char *Filename, + char *Prefix, + char **OutFilename); + +ACPI_STATUS +AdGetLocalTables ( + void); + +ACPI_STATUS +AdParseTable ( + ACPI_TABLE_HEADER *Table, + ACPI_OWNER_ID *OwnerId, + BOOLEAN LoadTable, + BOOLEAN External); + +ACPI_STATUS +AdDisplayTables ( + char *Filename, + ACPI_TABLE_HEADER *Table); + +ACPI_STATUS +AdDisplayStatistics ( + void); + #endif /* __ACDISASM_H__ */ diff --git a/source/include/acglobal.h b/source/include/acglobal.h index a9e349fe6a7b..f98401d28f00 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -62,6 +62,7 @@ ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader); ACPI_INIT_GLOBAL (UINT32, AcpiGbl_DsdtIndex, ACPI_INVALID_TABLE_INDEX); ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FacsIndex, ACPI_INVALID_TABLE_INDEX); ACPI_INIT_GLOBAL (UINT32, AcpiGbl_XFacsIndex, ACPI_INVALID_TABLE_INDEX); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FadtIndex, ACPI_INVALID_TABLE_INDEX); #if (!ACPI_REDUCED_HARDWARE) ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS); @@ -328,9 +329,9 @@ ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList); #ifdef ACPI_DEBUGGER -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateThreads, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_MethodExecuting, FALSE); +ACPI_INIT_GLOBAL (ACPI_THREAD_ID, AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoIniMethods); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoRegionSupport); @@ -340,6 +341,8 @@ ACPI_GLOBAL (char *, AcpiGbl_DbFilename); ACPI_GLOBAL (UINT32, AcpiGbl_DbDebugLevel); ACPI_GLOBAL (UINT32, AcpiGbl_DbConsoleDebugLevel); ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_DbScopeNode); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateLoop); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbThreadsTerminated); ACPI_GLOBAL (char *, AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]); ACPI_GLOBAL (ACPI_OBJECT_TYPE, AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]); diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 15759e13811b..d618055d4189 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -118,6 +118,14 @@ typedef struct acpi_rw_lock #define ACPI_MUTEX_NOT_ACQUIRED (ACPI_THREAD_ID) -1 +/* This Thread ID means an invalid thread ID */ + +#ifdef ACPI_OS_INVALID_THREAD_ID +#define ACPI_INVALID_THREAD_ID ACPI_OS_INVALID_THREAD_ID +#else +#define ACPI_INVALID_THREAD_ID ((ACPI_THREAD_ID) 0xFFFFFFFF) +#endif + /* Table for the global mutexes */ typedef struct acpi_mutex_info @@ -236,6 +244,16 @@ typedef struct acpi_table_list #define ACPI_ROOT_ALLOW_RESIZE (2) +/* List to manage incoming ACPI tables */ + +typedef struct acpi_new_table_desc +{ + ACPI_TABLE_HEADER *Table; + struct acpi_new_table_desc *Next; + +} ACPI_NEW_TABLE_DESC; + + /* Predefined table indexes */ #define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF) diff --git a/source/include/acmacros.h b/source/include/acmacros.h index 48620fb470a6..2dc5c201fe59 100644 --- a/source/include/acmacros.h +++ b/source/include/acmacros.h @@ -406,18 +406,6 @@ /* - * Some code only gets executed when the debugger is built in. - * Note that this is entirely independent of whether the - * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. - */ -#ifdef ACPI_DEBUGGER -#define ACPI_DEBUGGER_EXEC(a) a -#else -#define ACPI_DEBUGGER_EXEC(a) -#endif - - -/* * Macros used for ACPICA utilities only */ diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h index f894abefb10f..f31e62e68f8e 100644 --- a/source/include/acpiosxf.h +++ b/source/include/acpiosxf.h @@ -57,7 +57,8 @@ typedef enum OSL_GLOBAL_LOCK_HANDLER, OSL_NOTIFY_HANDLER, OSL_GPE_HANDLER, - OSL_DEBUGGER_THREAD, + OSL_DEBUGGER_MAIN_THREAD, + OSL_DEBUGGER_EXEC_THREAD, OSL_EC_POLL_HANDLER, OSL_EC_BURST_HANDLER diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 79972714f62a..80465d3c5aa2 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20150930 +#define ACPI_CA_VERSION 0x20151124 #include "acconfig.h" #include "actypes.h" @@ -377,6 +377,30 @@ ACPI_GLOBAL (BOOLEAN, AcpiGbl_SystemAwakeAndRunning); #endif /* ACPI_APPLICATION */ +/* + * Debugger prototypes + * + * All interfaces used by debugger will be configured + * out of the ACPICA build unless the ACPI_DEBUGGER + * flag is defined. + */ +#ifdef ACPI_DEBUGGER +#define ACPI_DBR_DEPENDENT_RETURN_OK(Prototype) \ + ACPI_EXTERNAL_RETURN_OK(Prototype) + +#define ACPI_DBR_DEPENDENT_RETURN_VOID(Prototype) \ + ACPI_EXTERNAL_RETURN_VOID(Prototype) + +#else +#define ACPI_DBR_DEPENDENT_RETURN_OK(Prototype) \ + static ACPI_INLINE Prototype {return(AE_OK);} + +#define ACPI_DBR_DEPENDENT_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} + +#endif /* ACPI_DEBUGGER */ + + /***************************************************************************** * * ACPICA public interface prototypes @@ -1216,4 +1240,8 @@ void AcpiTerminateDebugger ( void); +void +AcpiSetDebuggerThreadId ( + ACPI_THREAD_ID ThreadId); + #endif /* __ACXFACE_H__ */ diff --git a/source/include/actables.h b/source/include/actables.h index 0f8fdd505374..f450b1b4f30a 100644 --- a/source/include/actables.h +++ b/source/include/actables.h @@ -115,7 +115,7 @@ AcpiTbSetTableLoadedFlag ( */ void AcpiTbParseFadt ( - UINT32 TableIndex); + void); void AcpiTbCreateLocalFadt ( @@ -207,10 +207,6 @@ ACPI_STATUS AcpiTbInitializeFacs ( void); -BOOLEAN -AcpiTbTablesLoaded ( - void); - void AcpiTbPrintTableHeader( ACPI_PHYSICAL_ADDRESS Address, diff --git a/source/include/actypes.h b/source/include/actypes.h index cbae6f0d69b9..7eb6376c72f4 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -1232,7 +1232,7 @@ UINT32 (*ACPI_INTERFACE_HANDLER) ( #define ACPI_PCICLS_STRING_SIZE 7 /* Includes null terminator */ -/* Structures used for device/processor HID, UID, CID, and SUB */ +/* Structures used for device/processor HID, UID, CID */ typedef struct acpi_pnp_device_id { @@ -1267,7 +1267,6 @@ typedef struct acpi_device_info UINT64 Address; /* _ADR value */ ACPI_PNP_DEVICE_ID HardwareId; /* _HID value */ ACPI_PNP_DEVICE_ID UniqueId; /* _UID value */ - ACPI_PNP_DEVICE_ID SubsystemId; /* _SUB value */ ACPI_PNP_DEVICE_ID ClassCode; /* _CLS value */ ACPI_PNP_DEVICE_ID_LIST CompatibleIdList; /* _CID list <must be last> */ @@ -1283,13 +1282,12 @@ typedef struct acpi_device_info #define ACPI_VALID_ADR 0x0002 #define ACPI_VALID_HID 0x0004 #define ACPI_VALID_UID 0x0008 -#define ACPI_VALID_SUB 0x0010 #define ACPI_VALID_CID 0x0020 #define ACPI_VALID_CLS 0x0040 #define ACPI_VALID_SXDS 0x0100 #define ACPI_VALID_SXWS 0x0200 -/* Flags for _STA return value (CurrentStatus above) */ +/* Flags for _STA method */ #define ACPI_STA_DEVICE_PRESENT 0x01 #define ACPI_STA_DEVICE_ENABLED 0x02 diff --git a/source/include/acutils.h b/source/include/acutils.h index 1699c4ed7605..93a88878aaf6 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -206,7 +206,7 @@ AcpiUtInitGlobals ( #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -char * +const char * AcpiUtGetMutexName ( UINT32 MutexId); @@ -216,15 +216,15 @@ AcpiUtGetNotifyName ( ACPI_OBJECT_TYPE Type); #endif -char * +const char * AcpiUtGetTypeName ( ACPI_OBJECT_TYPE Type); -char * +const char * AcpiUtGetNodeName ( void *Object); -char * +const char * AcpiUtGetDescriptorName ( void *Object); @@ -232,15 +232,15 @@ const char * AcpiUtGetReferenceName ( ACPI_OPERAND_OBJECT *Object); -char * +const char * AcpiUtGetObjectTypeName ( ACPI_OPERAND_OBJECT *ObjDesc); -char * +const char * AcpiUtGetRegionName ( UINT8 SpaceId); -char * +const char * AcpiUtGetEventName ( UINT32 EventId); @@ -484,17 +484,6 @@ AcpiUtExecutePowerMethods ( /* - * utfileio - file operations - */ -#ifdef ACPI_APPLICATION -ACPI_STATUS -AcpiUtReadTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **Table); -#endif - - -/* * utids - device ID support */ ACPI_STATUS @@ -508,11 +497,6 @@ AcpiUtExecute_UID ( ACPI_PNP_DEVICE_ID **ReturnId); ACPI_STATUS -AcpiUtExecute_SUB ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId); - -ACPI_STATUS AcpiUtExecute_CID ( ACPI_NAMESPACE_NODE *DeviceNode, ACPI_PNP_DEVICE_ID_LIST **ReturnCidList); diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h index 3a916918d0a8..473055f5f349 100644 --- a/source/include/platform/aclinux.h +++ b/source/include/platform/aclinux.h @@ -64,12 +64,16 @@ #define ACPI_USE_SYSTEM_INTTYPES -/* Compile for reduced hardware mode only with this kernel config */ +/* Kernel specific ACPICA configuration */ #ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY #define ACPI_REDUCED_HARDWARE 1 #endif +#ifdef CONFIG_ACPI_DEBUGGER +#define ACPI_DEBUGGER +#endif + #include <linux/string.h> #include <linux/kernel.h> #include <linux/ctype.h> @@ -152,7 +156,6 @@ * OSL interfaces used by utilities */ #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress diff --git a/source/include/platform/aclinuxex.h b/source/include/platform/aclinuxex.h index 867228895f5a..5f65f28d5d83 100644 --- a/source/include/platform/aclinuxex.h +++ b/source/include/platform/aclinuxex.h @@ -136,6 +136,15 @@ AcpiOsGetThreadId ( Lock ? AE_OK : AE_NO_MEMORY; \ }) +static inline BOOLEAN +AcpiOsReadable ( + void *Pointer, + ACPI_SIZE Length) +{ + return TRUE; +} + + /* * OSL interfaces added by Linux */ diff --git a/source/os_specific/service_layers/oslibcfs.c b/source/os_specific/service_layers/oslibcfs.c index a3aa5cf69375..34cc7b0ba29a 100644 --- a/source/os_specific/service_layers/oslibcfs.c +++ b/source/os_specific/service_layers/oslibcfs.c @@ -81,6 +81,7 @@ AcpiOsOpenFile ( { ModesStr[i++] = 'w'; } + if (Modes & ACPI_FILE_BINARY) { ModesStr[i++] = 'b'; @@ -114,6 +115,7 @@ void AcpiOsCloseFile ( ACPI_FILE File) { + fclose (File); } @@ -239,6 +241,7 @@ AcpiOsSetFileOffset ( { Ret = fseek (File, Offset, SEEK_SET); } + if (From == ACPI_FILE_END) { Ret = fseek (File, Offset, SEEK_END); diff --git a/source/os_specific/service_layers/oswindir.c b/source/os_specific/service_layers/oswindir.c index 18a2c7a459c1..748964df9216 100644 --- a/source/os_specific/service_layers/oswindir.c +++ b/source/os_specific/service_layers/oswindir.c @@ -102,7 +102,8 @@ AcpiOsOpenDirectory ( /* Allocate space for the full wildcard path */ - FullWildcardSpec = calloc (strlen (DirPathname) + strlen (WildcardSpec) + 2, 1); + FullWildcardSpec = calloc ( + strlen (DirPathname) + strlen (WildcardSpec) + 2, 1); if (!FullWildcardSpec) { printf ("Could not allocate buffer for wildcard pathname\n"); diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c index 816332a856e6..2260fed3e682 100644 --- a/source/os_specific/service_layers/oswinxf.c +++ b/source/os_specific/service_layers/oswinxf.c @@ -102,6 +102,7 @@ ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES]; BOOLEAN AcpiGbl_DebugTimeout = FALSE; + /****************************************************************************** * * FUNCTION: AcpiOsTerminate @@ -554,6 +555,7 @@ AcpiOsGetLine ( { *BytesRead = i; } + return (AE_OK); } @@ -777,7 +779,8 @@ AcpiOsCreateSemaphore ( if (i >= ACPI_OS_MAX_SEMAPHORES) { ACPI_EXCEPTION ((AE_INFO, AE_LIMIT, - "Reached max semaphores (%u), could not create", ACPI_OS_MAX_SEMAPHORES)); + "Reached max semaphores (%u), could not create", + ACPI_OS_MAX_SEMAPHORES)); return (AE_LIMIT); } @@ -794,8 +797,9 @@ AcpiOsCreateSemaphore ( AcpiGbl_Semaphores[i].CurrentUnits = (UINT16) InitialUnits; AcpiGbl_Semaphores[i].OsHandle = Mutex; - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Handle=%u, Max=%u, Current=%u, OsHandle=%p\n", - i, MaxUnits, InitialUnits, Mutex)); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, + "Handle=%u, Max=%u, Current=%u, OsHandle=%p\n", + i, MaxUnits, InitialUnits, Mutex)); *OutHandle = (void *) i; return (AE_OK); @@ -890,7 +894,8 @@ AcpiOsWaitSemaphore ( OsTimeout += 10; } - WaitStatus = WaitForSingleObject (AcpiGbl_Semaphores[Index].OsHandle, OsTimeout); + WaitStatus = WaitForSingleObject ( + AcpiGbl_Semaphores[Index].OsHandle, OsTimeout); if (WaitStatus == WAIT_TIMEOUT) { if (AcpiGbl_DebugTimeout) @@ -899,12 +904,14 @@ AcpiOsWaitSemaphore ( "Debug timeout on semaphore 0x%04X (%ums)\n", Index, ACPI_OS_DEBUG_TIMEOUT)); } + return (AE_TIME); } if (AcpiGbl_Semaphores[Index].CurrentUnits == 0) { - ACPI_ERROR ((AE_INFO, "%s - No unit received. Timeout 0x%X, OS_Status 0x%X", + ACPI_ERROR ((AE_INFO, + "%s - No unit received. Timeout 0x%X, OS_Status 0x%X", AcpiUtGetMutexName (Index), Timeout, WaitStatus)); return (AE_OK); @@ -1533,7 +1540,6 @@ AcpiOsExecute ( { Function (Context); - return (AE_OK); } @@ -1557,5 +1563,6 @@ void AcpiOsWaitEventsComplete ( void) { + return; } diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c index d27d4876462e..ea42171428f0 100644 --- a/source/tools/acpibin/abcompare.c +++ b/source/tools/acpibin/abcompare.c @@ -615,12 +615,3 @@ Exit1: free (FileBuffer); return (Status); } - - -/****************************************************************************** - * - * FUNCTION: Stubs - * - * DESCRIPTION: For linkage - * - ******************************************************************************/ diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c index 4e866ef10e00..d8ad86795b85 100644 --- a/source/tools/acpidump/apfiles.c +++ b/source/tools/acpidump/apfiles.c @@ -52,6 +52,18 @@ ApIsExistingFile ( char *Pathname); +/****************************************************************************** + * + * FUNCTION: ApIsExistingFile + * + * PARAMETERS: Pathname - Output filename + * + * RETURN: 0 on success + * + * DESCRIPTION: Query for file overwrite if it already exists. + * + ******************************************************************************/ + static int ApIsExistingFile ( char *Pathname) @@ -159,6 +171,7 @@ ApWriteToBinaryFile ( { ACPI_MOVE_NAME (Filename, Table->Signature); } + Filename[0] = (char) tolower ((int) Filename[0]); Filename[1] = (char) tolower ((int) Filename[1]); Filename[2] = (char) tolower ((int) Filename[2]); diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index 162bc3fd0ceb..bc30acf0ea11 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -64,34 +64,6 @@ #include <string.h> #include <signal.h> -extern BOOLEAN AcpiGbl_IgnoreErrors; -extern UINT8 AcpiGbl_RegionFillValue; -extern UINT8 AcpiGbl_UseHwReducedFadt; -extern BOOLEAN AcpiGbl_DisplayRegionAccess; -extern BOOLEAN AcpiGbl_DoInterfaceTests; -extern BOOLEAN AcpiGbl_LoadTestTables; -extern FILE *AcpiGbl_NamespaceInitFile; -extern ACPI_CONNECTION_INFO AeMyContext; - -/* Check for unexpected exceptions */ - -#define AE_CHECK_STATUS(Name, Status, Expected) \ - if (Status != Expected) \ - { \ - AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \ - AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \ - } - -/* Check for unexpected non-AE_OK errors */ - -#define AE_CHECK_OK(Name, Status) AE_CHECK_STATUS (Name, Status, AE_OK); - -typedef struct ae_table_desc -{ - ACPI_TABLE_HEADER *Table; - struct ae_table_desc *Next; - -} AE_TABLE_DESC; /* * Debug Regions @@ -114,6 +86,16 @@ typedef struct ae_debug_regions } AE_DEBUG_REGIONS; +extern BOOLEAN AcpiGbl_IgnoreErrors; +extern UINT8 AcpiGbl_RegionFillValue; +extern UINT8 AcpiGbl_UseHwReducedFadt; +extern BOOLEAN AcpiGbl_DisplayRegionAccess; +extern BOOLEAN AcpiGbl_DoInterfaceTests; +extern BOOLEAN AcpiGbl_LoadTestTables; +extern FILE *AcpiGbl_NamespaceInitFile; +extern ACPI_CONNECTION_INFO AeMyContext; + + #define TEST_OUTPUT_LEVEL(lvl) if ((lvl) & OutputLevel) #define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\ @@ -125,8 +107,7 @@ AeCtrlCHandler ( ACPI_STATUS AeBuildLocalTables ( - UINT32 TableCount, - AE_TABLE_DESC *TableList); + ACPI_NEW_TABLE_DESC *TableList); ACPI_STATUS AeInstallTables ( diff --git a/source/tools/acpiexec/aeexec.c b/source/tools/acpiexec/aeexec.c index 518c20e94520..b428cde0f96a 100644 --- a/source/tools/acpiexec/aeexec.c +++ b/source/tools/acpiexec/aeexec.c @@ -158,7 +158,7 @@ AfInstallGpeBlock ( /* _GPE should always exist */ Status = AcpiGetHandle (NULL, "\\_GPE", &Handle); - AE_CHECK_OK (AcpiGetHandle, Status); + ACPI_CHECK_OK (AcpiGetHandle, Status); if (ACPI_FAILURE (Status)) { return; @@ -181,29 +181,29 @@ AfInstallGpeBlock ( } Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 7, 8); - AE_CHECK_OK (AcpiInstallGpeBlock, Status); + ACPI_CHECK_OK (AcpiInstallGpeBlock, Status); Status = AcpiInstallGpeHandler (Handle, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (Handle, 8); - AE_CHECK_OK (AcpiEnableGpe, Status); + ACPI_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiGetGpeDevice (0x30, &GpeDevice); - AE_CHECK_OK (AcpiGetGpeDevice, Status); + ACPI_CHECK_OK (AcpiGetGpeDevice, Status); Status = AcpiGetGpeDevice (0x42, &GpeDevice); - AE_CHECK_OK (AcpiGetGpeDevice, Status); + ACPI_CHECK_OK (AcpiGetGpeDevice, Status); Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice); - AE_CHECK_OK (AcpiGetGpeDevice, Status); + ACPI_CHECK_OK (AcpiGetGpeDevice, Status); Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice); - AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST); + ACPI_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST); Status = AcpiRemoveGpeHandler (Handle, 8, AeGpeHandler); - AE_CHECK_OK (AcpiRemoveGpeHandler, Status); + ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status); } /* Attempt to install a GPE block on GPE3 (if present) */ @@ -219,7 +219,7 @@ AfInstallGpeBlock ( } Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 8, 11); - AE_CHECK_OK (AcpiInstallGpeBlock, Status); + ACPI_CHECK_OK (AcpiInstallGpeBlock, Status); } } #endif /* !ACPI_REDUCED_HARDWARE */ @@ -233,10 +233,12 @@ AeTestBufferArgument ( { ACPI_OBJECT_LIST Params; ACPI_OBJECT BufArg; - UINT8 Buffer[] = { + UINT8 Buffer[] = + { 0,0,0,0, 4,0,0,0, - 1,2,3,4}; + 1,2,3,4 + }; BufArg.Type = ACPI_TYPE_BUFFER; @@ -359,7 +361,8 @@ ExecuteOSI ( if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not execute _OSI method, %s\n", + AcpiOsPrintf ( + "Could not execute _OSI method, %s\n", AcpiFormatException (Status)); return (Status); } @@ -368,7 +371,8 @@ ExecuteOSI ( if (ReturnValue.Length < sizeof (ACPI_OBJECT)) { - AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n", + AcpiOsPrintf ( + "Return value from _OSI method too small, %.8X\n", ReturnValue.Length); goto ErrorExit; } @@ -376,13 +380,15 @@ ExecuteOSI ( Obj = ReturnValue.Pointer; if (Obj->Type != ACPI_TYPE_INTEGER) { - AcpiOsPrintf ("Invalid return type from _OSI method, %.2X\n", Obj->Type); + AcpiOsPrintf ( + "Invalid return type from _OSI method, %.2X\n", Obj->Type); goto ErrorExit; } if (Obj->Integer.Value != ExpectedResult) { - AcpiOsPrintf ("Invalid return value from _OSI, expected %.8X found %.8X\n", + AcpiOsPrintf ( + "Invalid return value from _OSI, expected %.8X found %.8X\n", ExpectedResult, (UINT32) Obj->Integer.Value); goto ErrorExit; } @@ -398,7 +404,6 @@ ErrorExit: /* Free a buffer created via ACPI_ALLOCATE_BUFFER */ AcpiOsFree (ReturnValue.Pointer); - return (Status); } @@ -427,20 +432,20 @@ AeGenericRegisters ( GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; Status = AcpiRead (&Value, &GenericRegister); - AE_CHECK_OK (AcpiRead, Status); + ACPI_CHECK_OK (AcpiRead, Status); Status = AcpiWrite (Value, &GenericRegister); - AE_CHECK_OK (AcpiWrite, Status); + ACPI_CHECK_OK (AcpiWrite, Status); GenericRegister.Address = 0x12345678; GenericRegister.BitOffset = 0; GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY; Status = AcpiRead (&Value, &GenericRegister); - AE_CHECK_OK (AcpiRead, Status); + ACPI_CHECK_OK (AcpiRead, Status); Status = AcpiWrite (Value, &GenericRegister); - AE_CHECK_OK (AcpiWrite, Status); + ACPI_CHECK_OK (AcpiWrite, Status); } @@ -468,7 +473,7 @@ AeMutexInterfaces ( return; } - AE_CHECK_OK (AcpiGetHandle, Status); + ACPI_CHECK_OK (AcpiGetHandle, Status); if (ACPI_FAILURE (Status)) { return; @@ -477,7 +482,7 @@ AeMutexInterfaces ( /* Acquire the mutex */ Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF); - AE_CHECK_OK (AcpiAcquireMutex, Status); + ACPI_CHECK_OK (AcpiAcquireMutex, Status); if (ACPI_FAILURE (Status)) { return; @@ -486,7 +491,7 @@ AeMutexInterfaces ( /* Release mutex with different parameters */ Status = AcpiReleaseMutex (MutexHandle, NULL); - AE_CHECK_OK (AcpiReleaseMutex, Status); + ACPI_CHECK_OK (AcpiReleaseMutex, Status); } @@ -516,29 +521,29 @@ AeHardwareInterfaces ( } Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1); - AE_CHECK_OK (AcpiWriteBitRegister, Status); + ACPI_CHECK_OK (AcpiWriteBitRegister, Status); Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1); - AE_CHECK_OK (AcpiWriteBitRegister, Status); + ACPI_CHECK_OK (AcpiWriteBitRegister, Status); Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1); - AE_CHECK_OK (AcpiWriteBitRegister, Status); + ACPI_CHECK_OK (AcpiWriteBitRegister, Status); Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1); - AE_CHECK_OK (AcpiWriteBitRegister, Status); + ACPI_CHECK_OK (AcpiWriteBitRegister, Status); Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value); - AE_CHECK_OK (AcpiReadBitRegister, Status); + ACPI_CHECK_OK (AcpiReadBitRegister, Status); Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value); - AE_CHECK_OK (AcpiReadBitRegister, Status); + ACPI_CHECK_OK (AcpiReadBitRegister, Status); Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value); - AE_CHECK_OK (AcpiReadBitRegister, Status); + ACPI_CHECK_OK (AcpiReadBitRegister, Status); Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value); - AE_CHECK_OK (AcpiReadBitRegister, Status); + ACPI_CHECK_OK (AcpiReadBitRegister, Status); #endif /* !ACPI_REDUCED_HARDWARE */ } @@ -563,14 +568,15 @@ AeMiscellaneousTests ( ACPI_HANDLE Handle; #if (!ACPI_REDUCED_HARDWARE) - ACPI_VENDOR_UUID Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}}; UINT32 LockHandle1; UINT32 LockHandle2; + ACPI_VENDOR_UUID Uuid = + {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}}; #endif /* !ACPI_REDUCED_HARDWARE */ Status = AcpiGetHandle (NULL, "\\", &Handle); - AE_CHECK_OK (AcpiGetHandle, Status); + ACPI_CHECK_OK (AcpiGetHandle, Status); if (AcpiGbl_DoInterfaceTests) { @@ -581,42 +587,42 @@ AeMiscellaneousTests ( /* Attempt unload of DSDT, should fail */ Status = AcpiGetHandle (NULL, "\\_SB_", &Handle); - AE_CHECK_OK (AcpiGetHandle, Status); + ACPI_CHECK_OK (AcpiGetHandle, Status); Status = AcpiUnloadParentTable (Handle); - AE_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE); + ACPI_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE); /* Load and unload SSDT4 */ Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code); - AE_CHECK_OK (AcpiLoadTable, Status); + ACPI_CHECK_OK (AcpiLoadTable, Status); Status = AcpiGetHandle (NULL, "\\_T96", &Handle); - AE_CHECK_OK (AcpiGetHandle, Status); + ACPI_CHECK_OK (AcpiGetHandle, Status); Status = AcpiUnloadParentTable (Handle); - AE_CHECK_OK (AcpiUnloadParentTable, Status); + ACPI_CHECK_OK (AcpiUnloadParentTable, Status); /* Re-load SSDT4 */ Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code); - AE_CHECK_OK (AcpiLoadTable, Status); + ACPI_CHECK_OK (AcpiLoadTable, Status); /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */ Status = AcpiGetHandle (NULL, "\\_T99", &Handle); - AE_CHECK_OK (AcpiGetHandle, Status); + ACPI_CHECK_OK (AcpiGetHandle, Status); Status = AcpiUnloadParentTable (Handle); - AE_CHECK_OK (AcpiUnloadParentTable, Status); + ACPI_CHECK_OK (AcpiUnloadParentTable, Status); Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code); - AE_CHECK_OK (AcpiLoadTable, Status); + ACPI_CHECK_OK (AcpiLoadTable, Status); /* Load OEM9 table (causes table override) */ Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code); - AE_CHECK_OK (AcpiLoadTable, Status); + ACPI_CHECK_OK (AcpiLoadTable, Status); } AeHardwareInterfaces (); @@ -630,36 +636,36 @@ AeMiscellaneousTests ( /* Test _OSI install/remove */ Status = AcpiInstallInterface (""); - AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER); + ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER); Status = AcpiInstallInterface ("TestString"); - AE_CHECK_OK (AcpiInstallInterface, Status); + ACPI_CHECK_OK (AcpiInstallInterface, Status); Status = AcpiInstallInterface ("TestString"); - AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS); + ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS); Status = AcpiRemoveInterface ("Windows 2006"); - AE_CHECK_OK (AcpiRemoveInterface, Status); + ACPI_CHECK_OK (AcpiRemoveInterface, Status); Status = AcpiRemoveInterface ("TestString"); - AE_CHECK_OK (AcpiRemoveInterface, Status); + ACPI_CHECK_OK (AcpiRemoveInterface, Status); Status = AcpiRemoveInterface ("XXXXXX"); - AE_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST); + ACPI_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST); Status = AcpiInstallInterface ("AnotherTestString"); - AE_CHECK_OK (AcpiInstallInterface, Status); + ACPI_CHECK_OK (AcpiInstallInterface, Status); /* Test _OSI execution */ Status = ExecuteOSI ("Extended Address Space Descriptor", 0xFFFFFFFF); - AE_CHECK_OK (ExecuteOSI, Status); + ACPI_CHECK_OK (ExecuteOSI, Status); Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF); - AE_CHECK_OK (ExecuteOSI, Status); + ACPI_CHECK_OK (ExecuteOSI, Status); Status = ExecuteOSI ("MichiganTerminalSystem", 0); - AE_CHECK_OK (ExecuteOSI, Status); + ACPI_CHECK_OK (ExecuteOSI, Status); ReturnBuf.Length = 32; @@ -667,21 +673,21 @@ AeMiscellaneousTests ( Status = AcpiGetName (ACPI_ROOT_OBJECT, ACPI_FULL_PATHNAME_NO_TRAILING, &ReturnBuf); - AE_CHECK_OK (AcpiGetName, Status); + ACPI_CHECK_OK (AcpiGetName, Status); /* Get Devices */ Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL); - AE_CHECK_OK (AcpiGetDevices, Status); + ACPI_CHECK_OK (AcpiGetDevices, Status); Status = AcpiGetStatistics (&Stats); - AE_CHECK_OK (AcpiGetStatistics, Status); + ACPI_CHECK_OK (AcpiGetStatistics, Status); #if (!ACPI_REDUCED_HARDWARE) Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL); - AE_CHECK_OK (AcpiInstallGlobalEventHandler, Status); + ACPI_CHECK_OK (AcpiInstallGlobalEventHandler, Status); /* If Hardware Reduced flag is set, we are all done */ @@ -691,98 +697,107 @@ AeMiscellaneousTests ( } Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0); - AE_CHECK_OK (AcpiEnableEvent, Status); + ACPI_CHECK_OK (AcpiEnableEvent, Status); /* * GPEs: Handlers, enable/disable, etc. */ - Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 0, + ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 0); - AE_CHECK_OK (AcpiEnableGpe, Status); + ACPI_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler); - AE_CHECK_OK (AcpiRemoveGpeHandler, Status); + ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status); - Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 0, + ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 0); - AE_CHECK_OK (AcpiEnableGpe, Status); + ACPI_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE); - AE_CHECK_OK (AcpiSetGpe, Status); + ACPI_CHECK_OK (AcpiSetGpe, Status); Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE); - AE_CHECK_OK (AcpiSetGpe, Status); + ACPI_CHECK_OK (AcpiSetGpe, Status); - Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 1, + ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 1); - AE_CHECK_OK (AcpiEnableGpe, Status); + ACPI_CHECK_OK (AcpiEnableGpe, Status); - Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 2, + ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 2); - AE_CHECK_OK (AcpiEnableGpe, Status); + ACPI_CHECK_OK (AcpiEnableGpe, Status); - Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 3, + ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); - Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 4, + ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); - Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 5, + ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiGetHandle (NULL, "\\_SB", &Handle); - AE_CHECK_OK (AcpiGetHandle, Status); + ACPI_CHECK_OK (AcpiGetHandle, Status); Status = AcpiSetupGpeForWake (Handle, NULL, 5); - AE_CHECK_OK (AcpiSetupGpeForWake, Status); + ACPI_CHECK_OK (AcpiSetupGpeForWake, Status); Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE); - AE_CHECK_OK (AcpiSetGpeWakeMask, Status); + ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status); Status = AcpiSetupGpeForWake (Handle, NULL, 6); - AE_CHECK_OK (AcpiSetupGpeForWake, Status); + ACPI_CHECK_OK (AcpiSetupGpeForWake, Status); Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6); - AE_CHECK_OK (AcpiSetupGpeForWake, Status); + ACPI_CHECK_OK (AcpiSetupGpeForWake, Status); Status = AcpiSetupGpeForWake (Handle, NULL, 9); - AE_CHECK_OK (AcpiSetupGpeForWake, Status); + ACPI_CHECK_OK (AcpiSetupGpeForWake, Status); - Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 0x19, + ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 0x19); - AE_CHECK_OK (AcpiEnableGpe, Status); + ACPI_CHECK_OK (AcpiEnableGpe, Status); /* GPE block 1 */ - Status = AcpiInstallGpeHandler (NULL, 101, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AE_CHECK_OK (AcpiInstallGpeHandler, Status); + Status = AcpiInstallGpeHandler (NULL, 101, + ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + ACPI_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 101); - AE_CHECK_OK (AcpiEnableGpe, Status); + ACPI_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiDisableGpe (NULL, 101); - AE_CHECK_OK (AcpiDisableGpe, Status); + ACPI_CHECK_OK (AcpiDisableGpe, Status); AfInstallGpeBlock (); /* Here is where the GPEs are actually "enabled" */ Status = AcpiUpdateAllGpes (); - AE_CHECK_OK (AcpiUpdateAllGpes, Status); + ACPI_CHECK_OK (AcpiUpdateAllGpes, Status); Status = AcpiGetHandle (NULL, "RSRC", &Handle); if (ACPI_SUCCESS (Status)) @@ -799,16 +814,16 @@ AeMiscellaneousTests ( /* Test global lock */ Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1); - AE_CHECK_OK (AcpiAcquireGlobalLock, Status); + ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status); Status = AcpiAcquireGlobalLock (0x5, &LockHandle2); - AE_CHECK_OK (AcpiAcquireGlobalLock, Status); + ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status); Status = AcpiReleaseGlobalLock (LockHandle1); - AE_CHECK_OK (AcpiReleaseGlobalLock, Status); + ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status); Status = AcpiReleaseGlobalLock (LockHandle2); - AE_CHECK_OK (AcpiReleaseGlobalLock, Status); + ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status); #endif /* !ACPI_REDUCED_HARDWARE */ } diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index 9fce63d1bb24..625cf5704d4f 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -363,6 +363,7 @@ AeExceptionHandler ( { AcpiOsPrintf ("at module level (table load)"); } + AcpiOsPrintf (" Opcode [%s] @%X\n", AcpiPsGetOpcodeName (Opcode), AmlOffset); /* @@ -458,7 +459,7 @@ AeTableHandler ( /* Enable any GPEs associated with newly-loaded GPE methods */ Status = AcpiUpdateAllGpes (); - AE_CHECK_OK (AcpiUpdateAllGpes, Status); + ACPI_CHECK_OK (AcpiUpdateAllGpes, Status); printf ("[AcpiExec] Table Event %s, [%4.4s] %p\n", TableEvents[Event], ((ACPI_TABLE_HEADER *) Table)->Signature, Table); @@ -528,7 +529,8 @@ AeGlobalEventHandler ( break; } - AcpiOsPrintf ("[AcpiExec] Global Event Handler received: Type %s Number %.2X Dev %p\n", + AcpiOsPrintf ( + "[AcpiExec] Global Event Handler received: Type %s Number %.2X Dev %p\n", TypeName, EventNumber, Device); } @@ -699,15 +701,17 @@ AeInstallLateHandlers ( /* Install a user SCI handler */ Status = AeInstallSciHandler (); - AE_CHECK_OK (AeInstallSciHandler, Status); + ACPI_CHECK_OK (AeInstallSciHandler, Status); /* Install some fixed event handlers */ - Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL); - AE_CHECK_OK (AcpiInstallFixedEventHandler, Status); + Status = AcpiInstallFixedEventHandler ( + ACPI_EVENT_GLOBAL, AeEventHandler, NULL); + ACPI_CHECK_OK (AcpiInstallFixedEventHandler, Status); - Status = AcpiInstallFixedEventHandler (ACPI_EVENT_RTC, AeEventHandler, NULL); - AE_CHECK_OK (AcpiInstallFixedEventHandler, Status); + Status = AcpiInstallFixedEventHandler ( + ACPI_EVENT_RTC, AeEventHandler, NULL); + ACPI_CHECK_OK (AcpiInstallFixedEventHandler, Status); } #endif /* !ACPI_REDUCED_HARDWARE */ @@ -817,11 +821,11 @@ AeInstallEarlyHandlers ( Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler1, NULL); - AE_CHECK_OK (AcpiInstallNotifyHandler, Status); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler1); - AE_CHECK_OK (AcpiRemoveNotifyHandler, Status); + ACPI_CHECK_OK (AcpiRemoveNotifyHandler, Status); #if 0 Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, @@ -847,35 +851,34 @@ AeInstallEarlyHandlers ( AeNotifyHandler1, ACPI_CAST_PTR (void, 0x77777777)); Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); - AE_CHECK_OK (AcpiAttachData, Status); + ACPI_CHECK_OK (AcpiAttachData, Status); Status = AcpiDetachData (Handle, AeAttachedDataHandler); - AE_CHECK_OK (AcpiDetachData, Status); + ACPI_CHECK_OK (AcpiDetachData, Status); /* Test attach data at the root object */ Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler, AcpiGbl_RootNode); - AE_CHECK_OK (AcpiAttachData, Status); + ACPI_CHECK_OK (AcpiAttachData, Status); Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler2, AcpiGbl_RootNode); - AE_CHECK_OK (AcpiAttachData, Status); + ACPI_CHECK_OK (AcpiAttachData, Status); /* Test support for multiple attaches */ Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); - AE_CHECK_OK (AcpiAttachData, Status); + ACPI_CHECK_OK (AcpiAttachData, Status); Status = AcpiAttachData (Handle, AeAttachedDataHandler2, Handle); - AE_CHECK_OK (AcpiAttachData, Status); + ACPI_CHECK_OK (AcpiAttachData, Status); } else { printf ("No _SB_ found, %s\n", AcpiFormatException (Status)); } - Status = AcpiGetHandle (NULL, "\\_TZ.TZ1", &Handle); if (ACPI_SUCCESS (Status)) { diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 861cb49bae75..bc35036df4b4 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -42,6 +42,7 @@ */ #include "aecommon.h" +#include "errno.h" #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("aemain") @@ -93,7 +94,6 @@ BOOLEAN AcpiGbl_LoadTestTables = FALSE; BOOLEAN AcpiGbl_AeLoadOnly = FALSE; static UINT8 AcpiGbl_ExecutionMode = AE_MODE_COMMAND_LOOP; static char BatchBuffer[AE_BUFFER_SIZE]; /* Batch command buffer */ -static AE_TABLE_DESC *AeTableListHead = NULL; #define ACPIEXEC_NAME "AML Execution/Debug Utility" #define AE_SUPPORTED_OPTIONS "?b:d:e:f^ghi:lm^rv^:x:" @@ -440,11 +440,9 @@ main ( int argc, char **argv) { + ACPI_NEW_TABLE_DESC *ListHead = NULL; ACPI_STATUS Status; UINT32 InitFlags; - ACPI_TABLE_HEADER *Table = NULL; - UINT32 TableCount; - AE_TABLE_DESC *TableDesc; int ExitCode = 0; @@ -459,7 +457,7 @@ main ( /* Init ACPICA and start debugger thread */ Status = AcpiInitializeSubsystem (); - AE_CHECK_OK (AcpiInitializeSubsystem, Status); + ACPI_CHECK_OK (AcpiInitializeSubsystem, Status); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -473,7 +471,7 @@ main ( /* Initialize the AML debugger */ Status = AcpiInitializeDebugger (); - AE_CHECK_OK (AcpiInitializeDebugger, Status); + ACPI_CHECK_OK (AcpiInitializeDebugger, Status); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -496,6 +494,7 @@ main ( { ExitCode = 0; } + goto ErrorExit; } @@ -507,44 +506,21 @@ main ( } AcpiGbl_CstyleDisassembly = FALSE; /* Not supported for AcpiExec */ - TableCount = 0; /* Get each of the ACPI table files on the command line */ while (argv[AcpiGbl_Optind]) { - /* Get one entire table */ + /* Get all ACPI AML tables in this file */ - Status = AcpiUtReadTableFromFile (argv[AcpiGbl_Optind], &Table); + Status = AcpiAcGetAllTablesFromFile (argv[AcpiGbl_Optind], + ACPI_GET_ONLY_AML_TABLES, &ListHead); if (ACPI_FAILURE (Status)) { - fprintf (stderr, "**** Could not get table from file %s, %s\n", - argv[AcpiGbl_Optind], AcpiFormatException (Status)); + ExitCode = -1; goto ErrorExit; } - /* Ignore non-AML tables, we can't use them. Except for an FADT */ - - if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) && - !AcpiUtIsAmlTable (Table)) - { - fprintf (stderr, " %s: [%4.4s] is not an AML table - ignoring\n", - argv[AcpiGbl_Optind], Table->Signature); - - AcpiOsFree (Table); - } - else - { - /* Allocate and link a table descriptor */ - - TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC)); - TableDesc->Table = Table; - TableDesc->Next = AeTableListHead; - AeTableListHead = TableDesc; - - TableCount++; - } - AcpiGbl_Optind++; } @@ -552,7 +528,7 @@ main ( /* Build a local RSDT with all tables and let ACPICA process the RSDT */ - Status = AeBuildLocalTables (TableCount, AeTableListHead); + Status = AeBuildLocalTables (ListHead); if (ACPI_FAILURE (Status)) { goto ErrorExit; diff --git a/source/tools/acpiexec/aeregion.c b/source/tools/acpiexec/aeregion.c index 311b6ae61756..a33e9e70def1 100644 --- a/source/tools/acpiexec/aeregion.c +++ b/source/tools/acpiexec/aeregion.c @@ -165,8 +165,8 @@ AeInstallRegionHandlers ( /* Install handler at the root object */ Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, - SpaceIdList[i], AeRegionHandler, - AeRegionInit, &AeMyContext); + SpaceIdList[i], AeRegionHandler, + AeRegionInit, &AeMyContext); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -194,8 +194,8 @@ AeOverrideRegionHandlers ( /* Install handler at the root object */ Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, - DefaultSpaceIdList[i], AeRegionHandler, - AeRegionInit, &AeMyContext); + DefaultSpaceIdList[i], AeRegionHandler, + AeRegionInit, &AeMyContext); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -373,9 +373,10 @@ AeRegionHandler ( Length = (ACPI_SIZE) RegionObject->Region.Length; SpaceId = RegionObject->Region.SpaceId; - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Operation Region request on %s at 0x%X\n", - AcpiUtGetRegionName (RegionObject->Region.SpaceId), - (UINT32) Address)); + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, + "Operation Region request on %s at 0x%X\n", + AcpiUtGetRegionName (RegionObject->Region.SpaceId), + (UINT32) Address)); /* * Region support can be disabled with the -do option. @@ -410,16 +411,16 @@ AeRegionHandler ( /* Split the 64-bit request into two 32-bit requests */ Status = AcpiHwReadPort (Address, &Value1, 32); - AE_CHECK_OK (AcpiHwReadPort, Status); + ACPI_CHECK_OK (AcpiHwReadPort, Status); Status = AcpiHwReadPort (Address+4, &Value2, 32); - AE_CHECK_OK (AcpiHwReadPort, Status); + ACPI_CHECK_OK (AcpiHwReadPort, Status); *Value = Value1 | ((UINT64) Value2 << 32); } else { Status = AcpiHwReadPort (Address, &Value1, BitWidth); - AE_CHECK_OK (AcpiHwReadPort, Status); + ACPI_CHECK_OK (AcpiHwReadPort, Status); *Value = (UINT64) Value1; } break; @@ -431,14 +432,14 @@ AeRegionHandler ( /* Split the 64-bit request into two 32-bit requests */ Status = AcpiHwWritePort (Address, ACPI_LODWORD (*Value), 32); - AE_CHECK_OK (AcpiHwWritePort, Status); + ACPI_CHECK_OK (AcpiHwWritePort, Status); Status = AcpiHwWritePort (Address+4, ACPI_HIDWORD (*Value), 32); - AE_CHECK_OK (AcpiHwWritePort, Status); + ACPI_CHECK_OK (AcpiHwWritePort, Status); } else { Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth); - AE_CHECK_OK (AcpiHwWritePort, Status); + ACPI_CHECK_OK (AcpiHwWritePort, Status); } break; @@ -819,7 +820,8 @@ AeRegionHandler ( ((UINT64)(RegionElement->Address) + RegionElement->Length)) { ACPI_WARNING ((AE_INFO, - "Request on [%4.4s] is beyond region limit Req-0x%X+0x%X, Base=0x%X, Len-0x%X", + "Request on [%4.4s] is beyond region limit " + "Req-0x%X+0x%X, Base=0x%X, Len-0x%X", (RegionObject->Region.Node)->Name.Ascii, (UINT32) Address, ByteWidth, (UINT32)(RegionElement->Address), RegionElement->Length)); @@ -831,7 +833,7 @@ AeRegionHandler ( * Get BufferValue to point to the "address" in the buffer */ BufferValue = ((UINT8 *) RegionElement->Buffer + - ((UINT64) Address - (UINT64) RegionElement->Address)); + ((UINT64) Address - (UINT64) RegionElement->Address)); DoFunction: /* diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c index 75dea6127327..7e81fc3cefd0 100644 --- a/source/tools/acpiexec/aetables.c +++ b/source/tools/acpiexec/aetables.c @@ -169,7 +169,7 @@ AeInitializeTableHeader ( * FUNCTION: AeBuildLocalTables * * PARAMETERS: TableCount - Number of tables on the command line - * TableList - List of actual tables from files + * ListHead - List of actual tables from files * * RETURN: Status * @@ -180,12 +180,12 @@ AeInitializeTableHeader ( ACPI_STATUS AeBuildLocalTables ( - UINT32 TableCount, - AE_TABLE_DESC *TableList) + ACPI_NEW_TABLE_DESC *ListHead) { + UINT32 TableCount = 1; ACPI_PHYSICAL_ADDRESS DsdtAddress = 0; UINT32 XsdtSize; - AE_TABLE_DESC *NextTable; + ACPI_NEW_TABLE_DESC *NextTable; UINT32 NextIndex; ACPI_TABLE_FADT *ExternalFadt = NULL; @@ -195,18 +195,20 @@ AeBuildLocalTables ( * For the FADT, this table is already accounted for since we usually * install a local FADT. */ - NextTable = TableList; + NextTable = ListHead; while (NextTable) { - if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) || - ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) + if (!ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) && + !ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { - TableCount--; + TableCount++; } + NextTable = NextTable->Next; } - XsdtSize = (((TableCount + 1) * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER)); + XsdtSize = (((TableCount + 1) * sizeof (UINT64)) + + sizeof (ACPI_TABLE_HEADER)); if (AcpiGbl_LoadTestTables) { XsdtSize += BASE_XSDT_SIZE; @@ -231,7 +233,7 @@ AeBuildLocalTables ( * Note: The tables are loaded in reverse order from the incoming * input, which makes it match the command line order. */ - NextTable = TableList; + NextTable = ListHead; while (NextTable) { /* @@ -489,10 +491,10 @@ AeInstallTables ( Status = AcpiInitializeTables (NULL, ACPI_MAX_INIT_TABLES, TRUE); - AE_CHECK_OK (AcpiInitializeTables, Status); + ACPI_CHECK_OK (AcpiInitializeTables, Status); Status = AcpiLoadTables (); - AE_CHECK_OK (AcpiLoadTables, Status); + ACPI_CHECK_OK (AcpiLoadTables, Status); /* * Test run-time control method installation. Do it twice to test code @@ -517,24 +519,24 @@ AeInstallTables ( /* Test multiple table/UEFI support. First, get the headers */ Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 1, &Header); - AE_CHECK_OK (AcpiGetTableHeader, Status); + ACPI_CHECK_OK (AcpiGetTableHeader, Status); Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 2, &Header); - AE_CHECK_OK (AcpiGetTableHeader, Status); + ACPI_CHECK_OK (AcpiGetTableHeader, Status); Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 3, &Header); - AE_CHECK_STATUS (AcpiGetTableHeader, Status, AE_NOT_FOUND); + ACPI_CHECK_STATUS (AcpiGetTableHeader, Status, AE_NOT_FOUND); /* Now get the actual tables */ Status = AcpiGetTable (ACPI_SIG_UEFI, 1, &Table); - AE_CHECK_OK (AcpiGetTable, Status); + ACPI_CHECK_OK (AcpiGetTable, Status); Status = AcpiGetTable (ACPI_SIG_UEFI, 2, &Table); - AE_CHECK_OK (AcpiGetTable, Status); + ACPI_CHECK_OK (AcpiGetTable, Status); Status = AcpiGetTable (ACPI_SIG_UEFI, 3, &Table); - AE_CHECK_STATUS (AcpiGetTable, Status, AE_NOT_FOUND); + ACPI_CHECK_STATUS (AcpiGetTable, Status, AE_NOT_FOUND); } /* Check that we can get all of the ACPI tables */ @@ -546,7 +548,8 @@ AeInstallTables ( { break; } - AE_CHECK_OK (AcpiGetTableByIndex, Status); + + ACPI_CHECK_OK (AcpiGetTableByIndex, Status); } return (AE_OK); diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index 8684c6a1c042..bca1eeb8b891 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -827,6 +827,7 @@ AhPrintOneField ( { printf ("\n%*s", (int) Indent, " "); } + printf ("%s", This); } } @@ -1014,7 +1015,8 @@ AhDecodeException ( if (!HexString) { printf ("All defined ACPICA exception codes:\n\n"); - AH_DISPLAY_EXCEPTION (0, "AE_OK (No error occurred)"); + AH_DISPLAY_EXCEPTION (0, + "AE_OK (No error occurred)"); /* Display codes in each block of exception types */ @@ -1028,6 +1030,7 @@ AhDecodeException ( { AH_DISPLAY_EXCEPTION_TEXT (Status, ExceptionInfo); } + Status++; } while (ExceptionInfo); diff --git a/source/tools/acpinames/acpinames.h b/source/tools/acpinames/acpinames.h index 62d006974f92..8abf41386a33 100644 --- a/source/tools/acpinames/acpinames.h +++ b/source/tools/acpinames/acpinames.h @@ -48,11 +48,19 @@ #include "accommon.h" #include "acapps.h" #include "acutils.h" -#include "../acpiexec/aecommon.h" +#include "acnamesp.h" +#include "actables.h" +#include "acinterp.h" #include <stdio.h> #define ACPI_MAX_INIT_TABLES (32) extern BOOLEAN AcpiGbl_NsLoadOnly; + + +ACPI_STATUS +AnBuildLocalTables ( + ACPI_NEW_TABLE_DESC *TableList); + #endif diff --git a/source/tools/acpinames/anmain.c b/source/tools/acpinames/anmain.c index a613ac2613c3..8b0e0220aa01 100644 --- a/source/tools/acpinames/anmain.c +++ b/source/tools/acpinames/anmain.c @@ -43,6 +43,7 @@ #include "acpinames.h" #include "actables.h" +#include "errno.h" #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("anmain") @@ -51,8 +52,9 @@ /* Local prototypes */ static int -NsDumpEntireNamespace ( - UINT32 TableCount); +AnDumpEntireNamespace ( + ACPI_NEW_TABLE_DESC *ListHead); + /* * Main routine for the ACPI user-space namespace utility. @@ -65,8 +67,7 @@ NsDumpEntireNamespace ( * Windows: The setargv.obj module must be linked in to automatically * expand wildcards. */ -static AE_TABLE_DESC *AeTableListHead = NULL; -BOOLEAN AcpiGbl_NsLoadOnly = FALSE; +BOOLEAN AcpiGbl_NsLoadOnly = FALSE; #define AN_UTILITY_NAME "ACPI Namespace Dump Utility" @@ -100,7 +101,103 @@ usage ( /****************************************************************************** * - * FUNCTION: NsDumpEntireNamespace + * FUNCTION: main + * + * PARAMETERS: argc, argv + * + * RETURN: Status (pass/fail) + * + * DESCRIPTION: Main routine for NsDump utility + * + *****************************************************************************/ + +int ACPI_SYSTEM_XFACE +main ( + int argc, + char **argv) +{ + ACPI_NEW_TABLE_DESC *ListHead = NULL; + ACPI_STATUS Status; + int j; + + + ACPI_DEBUG_INITIALIZE (); /* For debug version only */ + + /* Init debug globals and ACPICA */ + + AcpiDbgLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES; + AcpiDbgLayer = 0xFFFFFFFF; + + Status = AcpiInitializeSubsystem (); + ACPI_CHECK_OK (AcpiInitializeSubsystem, Status); + if (ACPI_FAILURE (Status)) + { + return (-1); + } + + printf (ACPI_COMMON_SIGNON (AN_UTILITY_NAME)); + if (argc < 2) + { + usage (); + return (0); + } + + /* Get the command line options */ + + while ((j = AcpiGetopt (argc, argv, AN_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch(j) + { + case 'l': + + AcpiGbl_NsLoadOnly = TRUE; + break; + + case 'v': /* -v: (Version): signon already emitted, just exit */ + + return (0); + + case 'x': + + AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0); + printf ("Debug Level: 0x%8.8X\n", AcpiDbgLevel); + break; + + case '?': + case 'h': + default: + + usage(); + return (0); + } + + /* Get each of the ACPI table files on the command line */ + + while (argv[AcpiGbl_Optind]) + { + /* Get all ACPI AML tables in this file */ + + Status = AcpiAcGetAllTablesFromFile (argv[AcpiGbl_Optind], + ACPI_GET_ONLY_AML_TABLES, &ListHead); + if (ACPI_FAILURE (Status)) + { + return (-1); + } + + AcpiGbl_Optind++; + } + + printf ("\n"); + + /* + * The next argument is the filename for the DSDT or SSDT. + * Open the file, build namespace and dump it. + */ + return (AnDumpEntireNamespace (ListHead)); +} + + +/****************************************************************************** + * + * FUNCTION: AnDumpEntireNamespace * * PARAMETERS: AmlFilename - Filename for DSDT or SSDT AML table * @@ -112,8 +209,8 @@ usage ( *****************************************************************************/ static int -NsDumpEntireNamespace ( - UINT32 TableCount) +AnDumpEntireNamespace ( + ACPI_NEW_TABLE_DESC *ListHead) { ACPI_STATUS Status; ACPI_HANDLE Handle; @@ -123,7 +220,7 @@ NsDumpEntireNamespace ( * Build a local XSDT with all tables. Normally, here is where the * RSDP search is performed to find the ACPI tables */ - Status = AeBuildLocalTables (TableCount, AeTableListHead); + Status = AnBuildLocalTables (ListHead); if (ACPI_FAILURE (Status)) { return (-1); @@ -168,10 +265,10 @@ NsDumpEntireNamespace ( * hardware or event manager code underneath. */ Status = AcpiEnableSubsystem ( - ACPI_NO_ACPI_ENABLE | - ACPI_NO_ADDRESS_SPACE_INIT | - ACPI_NO_EVENT_INIT | - ACPI_NO_HANDLER_INIT); + ACPI_NO_ACPI_ENABLE | + ACPI_NO_ADDRESS_SPACE_INIT | + ACPI_NO_EVENT_INIT | + ACPI_NO_HANDLER_INIT); if (ACPI_FAILURE (Status)) { printf ("**** Could not EnableSubsystem, %s\n", @@ -180,9 +277,9 @@ NsDumpEntireNamespace ( } Status = AcpiInitializeObjects ( - ACPI_NO_ADDRESS_SPACE_INIT | - ACPI_NO_DEVICE_INIT | - ACPI_NO_EVENT_INIT); + ACPI_NO_ADDRESS_SPACE_INIT | + ACPI_NO_DEVICE_INIT | + ACPI_NO_EVENT_INIT); if (ACPI_FAILURE (Status)) { printf ("**** Could not InitializeObjects, %s\n", @@ -195,137 +292,14 @@ NsDumpEntireNamespace ( */ AcpiOsPrintf ("\nACPI Namespace:\n"); - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, ACPI_UINT32_MAX, - ACPI_OWNER_ID_MAX, AcpiGbl_RootNode); + AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, + ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode); /* Example: get a handle to the _GPE scope */ Status = AcpiGetHandle (NULL, "\\_GPE", &Handle); - AE_CHECK_OK (AcpiGetHandle, Status); + ACPI_CHECK_OK (AcpiGetHandle, Status); return (0); } - - -/****************************************************************************** - * - * FUNCTION: main - * - * PARAMETERS: argc, argv - * - * RETURN: Status (pass/fail) - * - * DESCRIPTION: Main routine for NsDump utility - * - *****************************************************************************/ - -int ACPI_SYSTEM_XFACE -main ( - int argc, - char **argv) -{ - AE_TABLE_DESC *TableDesc; - ACPI_TABLE_HEADER *Table = NULL; - ACPI_STATUS Status; - UINT32 TableCount; - int j; - - - ACPI_DEBUG_INITIALIZE (); /* For debug version only */ - - /* Init debug globals and ACPICA */ - - AcpiDbgLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES; - AcpiDbgLayer = 0xFFFFFFFF; - - Status = AcpiInitializeSubsystem (); - AE_CHECK_OK (AcpiInitializeSubsystem, Status); - if (ACPI_FAILURE (Status)) - { - return (-1); - } - - printf (ACPI_COMMON_SIGNON (AN_UTILITY_NAME)); - if (argc < 2) - { - usage (); - return (0); - } - - /* Get the command line options */ - - while ((j = AcpiGetopt (argc, argv, AN_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch(j) - { - case 'l': - - AcpiGbl_NsLoadOnly = TRUE; - break; - - case 'v': /* -v: (Version): signon already emitted, just exit */ - - return (0); - - case 'x': - - AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0); - printf ("Debug Level: 0x%8.8X\n", AcpiDbgLevel); - break; - - case '?': - case 'h': - default: - - usage(); - return (0); - } - - TableCount = 0; - - /* Get each of the ACPI table files on the command line */ - - while (argv[AcpiGbl_Optind]) - { - /* Get one entire table */ - - Status = AcpiUtReadTableFromFile (argv[AcpiGbl_Optind], &Table); - if (ACPI_FAILURE (Status)) - { - fprintf (stderr, "**** Could not get table from file %s, %s\n", - argv[AcpiGbl_Optind], AcpiFormatException (Status)); - return (-1); - } - - /* Ignore non-AML tables, we can't use them. Except for an FADT */ - - if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) && - !AcpiUtIsAmlTable (Table)) - { - fprintf (stderr, " %s: [%4.4s] is not an AML table - ignoring\n", - argv[AcpiGbl_Optind], Table->Signature); - - AcpiOsFree (Table); - } - else - { - /* Allocate and link a table descriptor */ - - TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC)); - TableDesc->Table = Table; - TableDesc->Next = AeTableListHead; - AeTableListHead = TableDesc; - - TableCount++; - } - - AcpiGbl_Optind++; - } - - printf ("\n"); - - /* - * The next argument is the filename for the DSDT or SSDT. - * Open the file, build namespace and dump it. - */ - return (NsDumpEntireNamespace (TableCount)); -} diff --git a/source/tools/acpinames/antables.c b/source/tools/acpinames/antables.c index 1dbf692992cf..300d521788ba 100644 --- a/source/tools/acpinames/antables.c +++ b/source/tools/acpinames/antables.c @@ -49,7 +49,7 @@ /* Local prototypes */ static void -AeInitializeTableHeader ( +AnInitializeTableHeader ( ACPI_TABLE_HEADER *Header, char *Signature, UINT32 Length); @@ -79,7 +79,7 @@ static ACPI_TABLE_XSDT *LocalXSDT; /****************************************************************************** * - * FUNCTION: AeInitializeTableHeader + * FUNCTION: AnInitializeTableHeader * * PARAMETERS: Header - A valid standard ACPI table header * Signature - Signature to insert @@ -92,7 +92,7 @@ static ACPI_TABLE_XSDT *LocalXSDT; *****************************************************************************/ static void -AeInitializeTableHeader ( +AnInitializeTableHeader ( ACPI_TABLE_HEADER *Header, char *Signature, UINT32 Length) @@ -117,7 +117,7 @@ AeInitializeTableHeader ( /****************************************************************************** * - * FUNCTION: AeBuildLocalTables + * FUNCTION: AnBuildLocalTables * * PARAMETERS: TableCount - Number of tables on the command line * TableList - List of actual tables from files @@ -130,13 +130,13 @@ AeInitializeTableHeader ( *****************************************************************************/ ACPI_STATUS -AeBuildLocalTables ( - UINT32 TableCount, - AE_TABLE_DESC *TableList) +AnBuildLocalTables ( + ACPI_NEW_TABLE_DESC *TableList) { + UINT32 TableCount = 0; ACPI_PHYSICAL_ADDRESS DsdtAddress = 0; UINT32 XsdtSize; - AE_TABLE_DESC *NextTable; + ACPI_NEW_TABLE_DESC *NextTable; UINT32 NextIndex; ACPI_TABLE_FADT *ExternalFadt = NULL; @@ -149,11 +149,12 @@ AeBuildLocalTables ( NextTable = TableList; while (NextTable) { - if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) || - ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) + if (!ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) && + !ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { - TableCount--; + TableCount++; } + NextTable = NextTable->Next; } @@ -199,8 +200,10 @@ AeBuildLocalTables ( } else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { - ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table); - LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); + ExternalFadt = + ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table); + LocalXSDT->TableOffsetEntry[0] = + ACPI_PTR_TO_PHYSADDR (NextTable->Table); } else { @@ -226,7 +229,7 @@ AeBuildLocalTables ( /* Set checksums for both XSDT and RSDP */ - AeInitializeTableHeader ((void *) LocalXSDT, ACPI_SIG_XSDT, XsdtSize); + AnInitializeTableHeader ((void *) LocalXSDT, ACPI_SIG_XSDT, XsdtSize); LocalRSDP.Checksum = 0; LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum ( @@ -317,7 +320,7 @@ AeBuildLocalTables ( ACPI_MUL_8 (LocalFADT.Pm1EventLength); } - AeInitializeTableHeader ((void *) &LocalFADT, + AnInitializeTableHeader ((void *) &LocalFADT, ACPI_SIG_FADT, sizeof (ACPI_TABLE_FADT)); /* Build a FACS */ diff --git a/source/tools/acpisrc/ascase.c b/source/tools/acpisrc/ascase.c index 53e61ad7ad4f..9c33362f5a82 100644 --- a/source/tools/acpisrc/ascase.c +++ b/source/tools/acpisrc/ascase.c @@ -241,6 +241,7 @@ AsMixedCaseToUnderscores ( SubBuffer++; } + SubBuffer++; continue; } @@ -260,6 +261,7 @@ AsMixedCaseToUnderscores ( LineNumber, Filename); return; } + continue; } @@ -535,6 +537,7 @@ AsLowerCaseIdentifiers ( SubBuffer++; break; } + SubBuffer++; } } diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c index 5a82167c13af..a277264b96d2 100644 --- a/source/tools/acpisrc/asconvrt.c +++ b/source/tools/acpisrc/asconvrt.c @@ -252,6 +252,7 @@ AsMatchValidToken ( { SubBuffer++; } + SubBuffer++; continue; } @@ -283,6 +284,7 @@ AsMatchValidToken ( { SubBuffer++; } + SubBuffer++; } @@ -1154,6 +1156,7 @@ AsTabify8 ( LastLineTabCount = TabCount; TabCount = 0; } + FirstNonBlank = NULL; LastLineColumnStart = ThisColumnStart; SubBuffer++; @@ -1190,6 +1193,7 @@ AsTabify8 ( LastLineTabCount = TabCount; TabCount = 0; } + FirstNonBlank = NULL; LastLineColumnStart = ThisColumnStart; } @@ -1208,6 +1212,7 @@ AsTabify8 ( { return; } + SpaceCount = 0; } @@ -1396,8 +1401,8 @@ AsCountSourceLines ( /* Find end of comment */ while (SubBuffer[0] && SubBuffer[1] && - !(((SubBuffer[0] == '*') && - (SubBuffer[1] == '/')))) + !(((SubBuffer[0] == '*') && + (SubBuffer[1] == '/')))) { if (SubBuffer[0] == '\n') { diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c index cd1843057085..c59f9d7ff471 100644 --- a/source/tools/acpisrc/asfile.c +++ b/source/tools/acpisrc/asfile.c @@ -123,7 +123,7 @@ AsDoWildcard ( /* If we actually have a dir, process the subtree */ if (!AsCheckForDirectory (SourcePath, TargetPath, Filename, - &SourceDirPath, &TargetDirPath)) + &SourceDirPath, &TargetDirPath)) { VERBOSE_PRINT (("Subdirectory: %s\n", Filename)); @@ -140,7 +140,7 @@ AsDoWildcard ( VERBOSE_PRINT (("File: %s\n", Filename)); AsProcessOneFile (ConversionTable, SourcePath, TargetPath, - MaxPathLength, Filename, FileType); + MaxPathLength, Filename, FileType); break; default: @@ -197,32 +197,32 @@ AsProcessTree ( /* Do the C source files */ AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_SOURCE, "*.c"); + FILE_TYPE_SOURCE, "*.c"); /* Do the C header files */ AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_HEADER, "*.h"); + FILE_TYPE_HEADER, "*.h"); /* Do the Lex file(s) */ AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_SOURCE, "*.l"); + FILE_TYPE_SOURCE, "*.l"); /* Do the yacc file(s) */ AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_SOURCE, "*.y"); + FILE_TYPE_SOURCE, "*.y"); /* Do any ASL files */ AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_HEADER, "*.asl"); + FILE_TYPE_HEADER, "*.asl"); /* Do any subdirectories */ AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_DIRECTORY, "*"); + FILE_TYPE_DIRECTORY, "*"); return (0); } @@ -259,6 +259,7 @@ AsDetectLoneLineFeeds ( { LfCount++; } + LineCount++; } i++; @@ -278,6 +279,7 @@ AsDetectLoneLineFeeds ( { printf ("%s: %u lone linefeeds in file\n", Filename, LfCount); } + return (TRUE); } @@ -365,7 +367,7 @@ AsConvertFile ( for (i = 0; ConversionTable->LowerCaseTable[i].Identifier; i++) { AsLowerCaseString (ConversionTable->LowerCaseTable[i].Identifier, - FileBuffer); + FileBuffer); } } @@ -376,7 +378,7 @@ AsConvertFile ( for (i = 0; StringTable[i].Target; i++) { AsReplaceString (StringTable[i].Target, StringTable[i].Replacement, - StringTable[i].Type, FileBuffer); + StringTable[i].Type, FileBuffer); } } @@ -410,7 +412,8 @@ AsConvertFile ( { for (i = 0; StructTable[i].Identifier; i++) { - AsInsertPrefix (FileBuffer, StructTable[i].Identifier, StructTable[i].Type); + AsInsertPrefix (FileBuffer, StructTable[i].Identifier, + StructTable[i].Type); } } @@ -610,7 +613,8 @@ AsProcessOneFile ( { /* Generate the target pathname and write the file */ - OutPathname = calloc (MaxPathLength + strlen (Filename) + 2 + strlen (TargetPath), 1); + OutPathname = calloc (MaxPathLength + + strlen (Filename) + 2 + strlen (TargetPath), 1); if (!OutPathname) { printf ("Could not allocate buffer for file pathnames\n"); diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c index 4da3cdd5c5a3..40d0cd47853d 100644 --- a/source/tools/acpisrc/asmain.c +++ b/source/tools/acpisrc/asmain.c @@ -221,7 +221,8 @@ AsDisplayStats ( if ((Gbl_CommentLines + Gbl_NonAnsiComments) > 0) { printf ("%8.1f Ratio of code to comments\n", - ((float) Gbl_SourceLines / (float) (Gbl_CommentLines + Gbl_NonAnsiComments))); + ((float) Gbl_SourceLines / + (float) (Gbl_CommentLines + Gbl_NonAnsiComments))); } if (!Gbl_TotalLines) @@ -456,15 +457,18 @@ main ( if (strstr (SourcePath, ".h")) { - AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_HEADER); + AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, + SourcePath, FILE_TYPE_HEADER); } else if (strstr (SourcePath, ".c")) { - AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_SOURCE); + AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, + SourcePath, FILE_TYPE_SOURCE); } else if (strstr (SourcePath, ".patch")) { - AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_PATCH); + AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, + SourcePath, FILE_TYPE_PATCH); } else { @@ -475,6 +479,5 @@ main ( /* Always display final summary and stats */ AsDisplayStats (); - return (0); } diff --git a/source/tools/acpisrc/asremove.c b/source/tools/acpisrc/asremove.c index 9a4e57c2fae0..358430a482b5 100644 --- a/source/tools/acpisrc/asremove.c +++ b/source/tools/acpisrc/asremove.c @@ -78,7 +78,6 @@ AsRemoveStatement ( SubBuffer = Buffer; SubString = Buffer; - while (SubString) { SubString = strstr (SubBuffer, Keyword); @@ -160,7 +159,6 @@ AsRemoveConditionalCompile ( SubBuffer = Buffer; SubString = Buffer; - while (SubString) { SubBuffer = strstr (SubString, Keyword); @@ -225,6 +223,7 @@ AsRemoveConditionalCompile ( { SubString--; } + SubString++; /* Find the "#ifxxxx" */ @@ -327,7 +326,6 @@ AsRemoveMacro ( SubBuffer = Buffer; SubString = Buffer; - while (SubString) { SubString = strstr (SubBuffer, Keyword); @@ -397,7 +395,6 @@ AsRemoveLine ( SubBuffer = Buffer; SubString = Buffer; - while (SubString) { SubString = strstr (SubBuffer, Keyword); @@ -451,7 +448,6 @@ AsReduceTypedefs ( SubBuffer = Buffer; SubString = Buffer; - while (SubString) { SubString = strstr (SubBuffer, Keyword); @@ -555,6 +551,7 @@ AsRemoveEmptyBlocks ( EmptyBlock = FALSE; break; } + SubBuffer++; } @@ -664,6 +661,7 @@ AsCleanupSpecialMacro ( { SubString++; } + SubString++; NestLevel = 1; @@ -697,6 +695,7 @@ SkipLine: { NewLine = TRUE; } + SubString++; } diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 8781c80e2595..494df3ce7d37 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -276,6 +276,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_NAMESTRING_INFO", SRC_TYPE_STRUCT}, {"ACPI_NATIVE_INT", SRC_TYPE_SIMPLE}, {"ACPI_NATIVE_UINT", SRC_TYPE_SIMPLE}, + {"ACPI_NEW_TABLE_DESC", SRC_TYPE_STRUCT}, {"ACPI_NOTIFY_HANDLER", SRC_TYPE_SIMPLE}, {"ACPI_NOTIFY_INFO", SRC_TYPE_STRUCT}, {"ACPI_NS_SEARCH_DATA", SRC_TYPE_STRUCT}, @@ -346,6 +347,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_PREDEFINED_DATA", SRC_TYPE_STRUCT}, {"ACPI_PREDEFINED_INFO", SRC_TYPE_UNION}, {"ACPI_PREDEFINED_NAMES", SRC_TYPE_STRUCT}, + {"ACPI_PRUNE_INFO", SRC_TYPE_STRUCT}, {"ACPI_PSCOPE_STATE", SRC_TYPE_STRUCT}, {"ACPI_RASF_PARAMETER_BLOCK", SRC_TYPE_STRUCT}, {"ACPI_RASF_PATROL_SCRUB_PARAMETER", SRC_TYPE_STRUCT}, @@ -484,7 +486,6 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"APIC_HEADER", SRC_TYPE_STRUCT}, {"AE_DEBUG_REGIONS", SRC_TYPE_STRUCT}, {"AE_REGION", SRC_TYPE_STRUCT}, - {"AE_TABLE_DESC", SRC_TYPE_STRUCT}, {"ASL_ANALYSIS_WALK_INFO", SRC_TYPE_STRUCT}, {"ASL_ERROR_MSG", SRC_TYPE_STRUCT}, {"ASL_ERROR_MSG", SRC_TYPE_STRUCT}, @@ -796,8 +797,8 @@ ACPI_IDENTIFIER_TABLE LinuxSpecialMacros[] = { }; -ACPI_CONVERSION_TABLE LinuxConversionTable = { - +ACPI_CONVERSION_TABLE LinuxConversionTable = +{ DualLicenseHeader, FLG_NO_CARRIAGE_RETURNS | FLG_LOWERCASE_DIRNAMES, @@ -849,8 +850,8 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = { * ******************************************************************************/ -ACPI_CONVERSION_TABLE CleanupConversionTable = { - +ACPI_CONVERSION_TABLE CleanupConversionTable = +{ NULL, FLG_DEFAULT_FLAGS, NULL, @@ -888,8 +889,8 @@ ACPI_CONVERSION_TABLE CleanupConversionTable = { }; -ACPI_CONVERSION_TABLE StatsConversionTable = { - +ACPI_CONVERSION_TABLE StatsConversionTable = +{ NULL, FLG_NO_FILE_OUTPUT, NULL, @@ -935,8 +936,8 @@ ACPI_CONVERSION_TABLE StatsConversionTable = { * ******************************************************************************/ -ACPI_CONVERSION_TABLE LicenseConversionTable = { - +ACPI_CONVERSION_TABLE LicenseConversionTable = +{ DualLicenseHeader, FLG_DEFAULT_FLAGS, NULL, @@ -982,9 +983,8 @@ ACPI_CONVERSION_TABLE LicenseConversionTable = { * ******************************************************************************/ -ACPI_STRING_TABLE CustomReplacements[] = { - - +ACPI_STRING_TABLE CustomReplacements[] = +{ {"(c) 1999 - 2014", "(c) 1999 - 2015", REPLACE_WHOLE_WORD}, /* Main ACPICA source */ {"(c) 2006 - 2014", "(c) 2006 - 2015", REPLACE_WHOLE_WORD}, /* Test suites */ @@ -1037,8 +1037,8 @@ ACPI_STRING_TABLE CustomReplacements[] = { }; -ACPI_CONVERSION_TABLE CustomConversionTable = { - +ACPI_CONVERSION_TABLE CustomConversionTable = +{ NULL, FLG_DEFAULT_FLAGS, NULL, @@ -1083,8 +1083,8 @@ ACPI_CONVERSION_TABLE CustomConversionTable = { * ******************************************************************************/ -ACPI_CONVERSION_TABLE IndentConversionTable = { - +ACPI_CONVERSION_TABLE IndentConversionTable = +{ NULL, FLG_NO_CARRIAGE_RETURNS, diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c index 373c9cd95bc7..4641c712a30e 100644 --- a/source/tools/acpixtract/acpixtract.c +++ b/source/tools/acpixtract/acpixtract.c @@ -41,579 +41,307 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include "acpi.h" -#include "accommon.h" -#include "acapps.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -/* Local prototypes */ - -static void -AxCheckAscii ( - char *Name, - int Count); - -static void -AxNormalizeSignature ( - char *Signature); - -static unsigned int -AxGetNextInstance ( - char *InputPathname, - char *Signature); - -static size_t -AxGetTableHeader ( - FILE *InputFile, - unsigned char *OutputData); - -static unsigned int -AxCountTableInstances ( - char *InputPathname, - char *Signature); - -int -AxExtractTables ( - char *InputPathname, - char *Signature, - unsigned int MinimumInstances); - -int -AxListTables ( - char *InputPathname); - -static size_t -AxConvertLine ( - char *InputLine, - unsigned char *OutputData); - -static int -AxIsEmptyLine ( - char *Buffer); - -typedef struct AxTableInfo -{ - UINT32 Signature; - unsigned int Instances; - unsigned int NextInstance; - struct AxTableInfo *Next; - -} AX_TABLE_INFO; - -/* Extraction states */ - -#define AX_STATE_FIND_HEADER 0 -#define AX_STATE_EXTRACT_DATA 1 - -/* Miscellaneous constants */ - -#define AX_LINE_BUFFER_SIZE 256 -#define AX_MIN_TABLE_NAME_LENGTH 6 /* strlen ("DSDT @") */ - - -static AX_TABLE_INFO *AxTableListHead = NULL; -static char Filename[16]; -static unsigned char Data[16]; -static char LineBuffer[AX_LINE_BUFFER_SIZE]; -static char HeaderBuffer[AX_LINE_BUFFER_SIZE]; -static char InstanceBuffer[AX_LINE_BUFFER_SIZE]; - - -/******************************************************************************* - * - * FUNCTION: AxCheckAscii - * - * PARAMETERS: Name - Ascii string, at least as long as Count - * Count - Number of characters to check - * - * RETURN: None - * - * DESCRIPTION: Ensure that the requested number of characters are printable - * Ascii characters. Sets non-printable and null chars to <space>. - * - ******************************************************************************/ - -static void -AxCheckAscii ( - char *Name, - int Count) -{ - int i; - - - for (i = 0; i < Count; i++) - { - if (!Name[i] || !isprint ((int) Name[i])) - { - Name[i] = ' '; - } - } -} +#include "acpixtract.h" /****************************************************************************** * - * FUNCTION: AxIsEmptyLine + * FUNCTION: AxExtractTables * - * PARAMETERS: Buffer - Line from input file + * PARAMETERS: InputPathname - Filename for input acpidump file + * Signature - Requested ACPI signature to extract. + * NULL means extract ALL tables. + * MinimumInstances - Min instances that are acceptable * - * RETURN: TRUE if line is empty (zero or more blanks only) + * RETURN: Status * - * DESCRIPTION: Determine if an input line is empty. + * DESCRIPTION: Convert text ACPI tables to binary * ******************************************************************************/ -static int -AxIsEmptyLine ( - char *Buffer) +int +AxExtractTables ( + char *InputPathname, + char *Signature, + unsigned int MinimumInstances) { + FILE *InputFile; + FILE *OutputFile = NULL; + unsigned int BytesConverted; + unsigned int ThisTableBytesWritten = 0; + unsigned int FoundTable = 0; + unsigned int Instances = 0; + unsigned int ThisInstance; + char ThisSignature[4]; + int Status = 0; + unsigned int State = AX_STATE_FIND_HEADER; - /* Skip all spaces */ - - while (*Buffer == ' ') - { - Buffer++; - } - /* If end-of-line, this line is empty */ + /* Open input in text mode, output is in binary mode */ - if (*Buffer == '\n') + InputFile = fopen (InputPathname, "rt"); + if (!InputFile) { - return (1); + printf ("Could not open input file %s\n", InputPathname); + return (-1); } - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: AxNormalizeSignature - * - * PARAMETERS: Name - Ascii string containing an ACPI signature - * - * RETURN: None - * - * DESCRIPTION: Change "RSD PTR" to "RSDP" - * - ******************************************************************************/ - -static void -AxNormalizeSignature ( - char *Signature) -{ - - if (!strncmp (Signature, "RSD ", 4)) + if (Signature) { - Signature[3] = 'P'; - } -} - + /* Are there enough instances of the table to continue? */ -/****************************************************************************** - * - * FUNCTION: AxConvertLine - * - * PARAMETERS: InputLine - One line from the input acpidump file - * OutputData - Where the converted data is returned - * - * RETURN: The number of bytes actually converted - * - * DESCRIPTION: Convert one line of ascii text binary (up to 16 bytes) - * - ******************************************************************************/ + AxNormalizeSignature (Signature); -static size_t -AxConvertLine ( - char *InputLine, - unsigned char *OutputData) -{ - char *End; - int BytesConverted; - int Converted[16]; - int i; + Instances = AxCountTableInstances (InputPathname, Signature); + if (Instances < MinimumInstances) + { + printf ("Table [%s] was not found in %s\n", + Signature, InputPathname); + fclose (InputFile); + return (-1); + } + if (Instances == 0) + { + fclose (InputFile); + return (-1); + } + } - /* Terminate the input line at the end of the actual data (for sscanf) */ + /* Convert all instances of the table to binary */ - End = strstr (InputLine + 2, " "); - if (!End) + while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { - return (0); /* Don't understand the format */ - } - *End = 0; - - /* - * Convert one line of table data, of the form: - * <offset>: <up to 16 bytes of hex data> <ASCII representation> <newline> - * - * Example: - * 02C0: 5F 53 42 5F 4C 4E 4B 44 00 12 13 04 0C FF FF 08 _SB_LNKD........ - */ - BytesConverted = sscanf (InputLine, - "%*s %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x", - &Converted[0], &Converted[1], &Converted[2], &Converted[3], - &Converted[4], &Converted[5], &Converted[6], &Converted[7], - &Converted[8], &Converted[9], &Converted[10], &Converted[11], - &Converted[12], &Converted[13], &Converted[14], &Converted[15]); - - /* Pack converted data into a byte array */ - - for (i = 0; i < BytesConverted; i++) - { - OutputData[i] = (unsigned char) Converted[i]; - } + switch (State) + { + case AX_STATE_FIND_HEADER: - return ((size_t) BytesConverted); -} + if (!AxIsDataBlockHeader ()) + { + continue; + } + ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer); + if (Signature) + { + /* Ignore signatures that don't match */ -/****************************************************************************** - * - * FUNCTION: AxGetTableHeader - * - * PARAMETERS: InputFile - Handle for the input acpidump file - * OutputData - Where the table header is returned - * - * RETURN: The actual number of bytes converted - * - * DESCRIPTION: Extract and convert an ACPI table header - * - ******************************************************************************/ + if (!ACPI_COMPARE_NAME (ThisSignature, Signature)) + { + continue; + } + } -static size_t -AxGetTableHeader ( - FILE *InputFile, - unsigned char *OutputData) -{ - size_t BytesConverted; - size_t TotalConverted = 0; - int i; + /* + * Get the instance number for this signature. Only the + * SSDT and PSDT tables can have multiple instances. + */ + ThisInstance = AxGetNextInstance (InputPathname, ThisSignature); + /* Build an output filename and create/open the output file */ - /* Get the full 36 byte ACPI table header, requires 3 input text lines */ + if (ThisInstance > 0) + { + /* Add instance number to the output filename */ - for (i = 0; i < 3; i++) - { - if (!fgets (HeaderBuffer, AX_LINE_BUFFER_SIZE, InputFile)) - { - return (TotalConverted); - } + sprintf (Gbl_OutputFilename, "%4.4s%u.dat", + ThisSignature, ThisInstance); + } + else + { + sprintf (Gbl_OutputFilename, "%4.4s.dat", + ThisSignature); + } - BytesConverted = AxConvertLine (HeaderBuffer, OutputData); - TotalConverted += BytesConverted; - OutputData += 16; + AcpiUtStrlwr (Gbl_OutputFilename); + OutputFile = fopen (Gbl_OutputFilename, "w+b"); + if (!OutputFile) + { + printf ("Could not open output file %s\n", + Gbl_OutputFilename); + fclose (InputFile); + return (-1); + } - if (BytesConverted != 16) - { - return (TotalConverted); - } - } + /* + * Toss this block header of the form "<sig> @ <addr>" line + * and move on to the actual data block + */ + Gbl_TableCount++; + FoundTable = 1; + ThisTableBytesWritten = 0; + State = AX_STATE_EXTRACT_DATA; + continue; - return (TotalConverted); -} + case AX_STATE_EXTRACT_DATA: + /* Empty line or non-data line terminates the data block */ -/****************************************************************************** - * - * FUNCTION: AxCountTableInstances - * - * PARAMETERS: InputPathname - Filename for acpidump file - * Signature - Requested signature to count - * - * RETURN: The number of instances of the signature - * - * DESCRIPTION: Count the instances of tables with the given signature within - * the input acpidump file. - * - ******************************************************************************/ + BytesConverted = AxProcessOneTextLine ( + OutputFile, ThisSignature, ThisTableBytesWritten); + switch (BytesConverted) + { + case 0: -static unsigned int -AxCountTableInstances ( - char *InputPathname, - char *Signature) -{ - FILE *InputFile; - unsigned int Instances = 0; + State = AX_STATE_FIND_HEADER; /* No more data block lines */ + continue; + case -1: - InputFile = fopen (InputPathname, "rt"); - if (!InputFile) - { - printf ("Could not open file %s\n", InputPathname); - return (0); - } + goto CleanupAndExit; /* There was a write error */ - /* Count the number of instances of this signature */ + default: /* Normal case, get next line */ - while (fgets (InstanceBuffer, AX_LINE_BUFFER_SIZE, InputFile)) - { - /* Ignore empty lines and lines that start with a space */ + ThisTableBytesWritten += BytesConverted; + continue; + } - if (AxIsEmptyLine (InstanceBuffer) || - (InstanceBuffer[0] == ' ')) - { - continue; - } + default: - AxNormalizeSignature (InstanceBuffer); - if (ACPI_COMPARE_NAME (InstanceBuffer, Signature)) - { - Instances++; + Status = -1; + goto CleanupAndExit; } } - fclose (InputFile); - return (Instances); -} - - -/****************************************************************************** - * - * FUNCTION: AxGetNextInstance - * - * PARAMETERS: InputPathname - Filename for acpidump file - * Signature - Requested ACPI signature - * - * RETURN: The next instance number for this signature. Zero if this - * is the first instance of this signature. - * - * DESCRIPTION: Get the next instance number of the specified table. If this - * is the first instance of the table, create a new instance - * block. Note: only SSDT and PSDT tables can have multiple - * instances. - * - ******************************************************************************/ + if (!FoundTable) + { + printf ("Table [%s] was not found in %s\n", + Signature, InputPathname); + } -static unsigned int -AxGetNextInstance ( - char *InputPathname, - char *Signature) -{ - AX_TABLE_INFO *Info; +CleanupAndExit: - Info = AxTableListHead; - while (Info) + if (State == AX_STATE_EXTRACT_DATA) { - if (*(UINT32 *) Signature == Info->Signature) - { - break; - } + /* Received an input file EOF while extracting data */ - Info = Info->Next; + printf (AX_TABLE_INFO_FORMAT, + ThisSignature, ThisTableBytesWritten, Gbl_OutputFilename); } - if (!Info) + if (Gbl_TableCount > 1) { - /* Signature not found, create new table info block */ - - Info = malloc (sizeof (AX_TABLE_INFO)); - if (!Info) - { - printf ("Could not allocate memory\n"); - exit (0); - } - - Info->Signature = *(UINT32 *) Signature; - Info->Instances = AxCountTableInstances (InputPathname, Signature); - Info->NextInstance = 1; - Info->Next = AxTableListHead; - AxTableListHead = Info; + printf ("\n%d binary ACPI tables extracted\n", + Gbl_TableCount); } - if (Info->Instances > 1) + if (OutputFile) { - return (Info->NextInstance++); + fclose (OutputFile); } - return (0); + fclose (InputFile); + return (Status); } /****************************************************************************** * - * FUNCTION: AxExtractTables + * FUNCTION: AxExtractToMultiAmlFile * - * PARAMETERS: InputPathname - Filename for acpidump file - * Signature - Requested ACPI signature to extract. - * NULL means extract ALL tables. - * MinimumInstances - Min instances that are acceptable + * PARAMETERS: InputPathname - Filename for input acpidump file * * RETURN: Status * - * DESCRIPTION: Convert text ACPI tables to binary + * DESCRIPTION: Convert all DSDT/SSDT tables to binary and append them all + * into a single output file. Used to simplify the loading of + * multiple/many SSDTs into a utility like acpiexec -- instead + * of creating many separate output files. * ******************************************************************************/ int -AxExtractTables ( - char *InputPathname, - char *Signature, - unsigned int MinimumInstances) +AxExtractToMultiAmlFile ( + char *InputPathname) { FILE *InputFile; - FILE *OutputFile = NULL; - size_t BytesWritten; - size_t TotalBytesWritten = 0; - size_t BytesConverted; - unsigned int State = AX_STATE_FIND_HEADER; - unsigned int FoundTable = 0; - unsigned int Instances = 0; - unsigned int ThisInstance; - char ThisSignature[4]; + FILE *OutputFile; int Status = 0; + unsigned int TotalBytesWritten = 0; + unsigned int ThisTableBytesWritten = 0; + unsigned int BytesConverted; + char ThisSignature[4]; + unsigned int State = AX_STATE_FIND_HEADER; - /* Open input in text mode, output is in binary mode */ + strcpy (Gbl_OutputFilename, AX_MULTI_TABLE_FILENAME); + + /* Open the input file in text mode */ InputFile = fopen (InputPathname, "rt"); if (!InputFile) { - printf ("Could not open file %s\n", InputPathname); + printf ("Could not open input file %s\n", InputPathname); return (-1); } - if (Signature) - { - /* Are there enough instances of the table to continue? */ - - AxNormalizeSignature (Signature); + /* Open the output file in binary mode */ - Instances = AxCountTableInstances (InputPathname, Signature); - if (Instances < MinimumInstances) - { - printf ("Table %s was not found in %s\n", Signature, InputPathname); - Status = -1; - goto CleanupAndExit; - } - - if (Instances == 0) - { - goto CleanupAndExit; - } + OutputFile = fopen (Gbl_OutputFilename, "w+b"); + if (!OutputFile) + { + printf ("Could not open output file %s\n", Gbl_OutputFilename); + fclose (InputFile); + return (-1); } - /* Convert all instances of the table to binary */ + /* Convert the DSDT and all SSDTs to binary */ - while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) + while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { switch (State) { case AX_STATE_FIND_HEADER: - /* Ignore lines that are too short to be header lines */ - - if (strlen (LineBuffer) < AX_MIN_TABLE_NAME_LENGTH) + if (!AxIsDataBlockHeader ()) { continue; } - /* Ignore empty lines and lines that start with a space */ + ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer); - if (AxIsEmptyLine (LineBuffer) || - (LineBuffer[0] == ' ')) - { - continue; - } + /* Only want DSDT and SSDTs */ - /* - * Ignore lines that are not of the form <sig> @ <addr>. - * Examples of lines that must be supported: - * - * DSDT @ 0x737e4000 - * XSDT @ 0x737f2fff - * RSD PTR @ 0xf6cd0 - * SSDT @ (nil) - */ - if (!strstr (LineBuffer, " @ ")) + if (!ACPI_COMPARE_NAME (ThisSignature, ACPI_SIG_DSDT) && + !ACPI_COMPARE_NAME (ThisSignature, ACPI_SIG_SSDT)) { continue; } - AxNormalizeSignature (LineBuffer); - ACPI_MOVE_NAME (ThisSignature, LineBuffer); - - if (Signature) - { - /* Ignore signatures that don't match */ - - if (!ACPI_COMPARE_NAME (ThisSignature, Signature)) - { - continue; - } - } - /* - * Get the instance number for this signature. Only the - * SSDT and PSDT tables can have multiple instances. + * Toss this block header of the form "<sig> @ <addr>" line + * and move on to the actual data block */ - ThisInstance = AxGetNextInstance (InputPathname, ThisSignature); - - /* Build an output filename and create/open the output file */ - - if (ThisInstance > 0) - { - sprintf (Filename, "%4.4s%u.dat", ThisSignature, ThisInstance); - } - else - { - sprintf (Filename, "%4.4s.dat", ThisSignature); - } - - AcpiUtStrlwr (Filename); - OutputFile = fopen (Filename, "w+b"); - if (!OutputFile) - { - printf ("Could not open file %s\n", Filename); - Status = -1; - goto CleanupAndExit; - } - + Gbl_TableCount++; + ThisTableBytesWritten = 0; State = AX_STATE_EXTRACT_DATA; - TotalBytesWritten = 0; - FoundTable = 1; continue; case AX_STATE_EXTRACT_DATA: - /* Empty line or non-data line terminates the data */ + /* Empty line or non-data line terminates the data block */ - if (AxIsEmptyLine (LineBuffer) || - (LineBuffer[0] != ' ')) + BytesConverted = AxProcessOneTextLine ( + OutputFile, ThisSignature, ThisTableBytesWritten); + switch (BytesConverted) { - fclose (OutputFile); - OutputFile = NULL; - State = AX_STATE_FIND_HEADER; + case 0: - printf ("Acpi table [%4.4s] - %u bytes written to %s\n", - ThisSignature, (unsigned int) TotalBytesWritten, Filename); + State = AX_STATE_FIND_HEADER; /* No more data block lines */ continue; - } - /* Convert the ascii data (one line of text) to binary */ + case -1: - BytesConverted = AxConvertLine (LineBuffer, Data); + goto CleanupAndExit; /* There was a write error */ - /* Write the binary data */ + default: /* Normal case, get next line */ - BytesWritten = fwrite (Data, 1, BytesConverted, OutputFile); - if (BytesWritten != BytesConverted) - { - printf ("Error when writing file %s\n", Filename); - fclose (OutputFile); - OutputFile = NULL; - Status = -1; - goto CleanupAndExit; + ThisTableBytesWritten += BytesConverted; + TotalBytesWritten += BytesConverted; + continue; } - TotalBytesWritten += BytesConverted; - continue; - default: Status = -1; @@ -621,27 +349,22 @@ AxExtractTables ( } } - if (!FoundTable) - { - printf ("Table %s was not found in %s\n", Signature, InputPathname); - } - CleanupAndExit: - if (OutputFile) + if (State == AX_STATE_EXTRACT_DATA) { - fclose (OutputFile); - if (State == AX_STATE_EXTRACT_DATA) - { - /* Received an EOF while extracting data */ + /* Received an input file EOF or error while writing data */ - printf ("Acpi table [%4.4s] - %u bytes written to %s\n", - ThisSignature, (unsigned int) TotalBytesWritten, Filename); - } + printf (AX_TABLE_INFO_FORMAT, + ThisSignature, ThisTableBytesWritten, Gbl_OutputFilename); } + printf ("\n%d binary ACPI tables extracted and written to %s (%u bytes)\n", + Gbl_TableCount, Gbl_OutputFilename, TotalBytesWritten); + fclose (InputFile); + fclose (OutputFile); return (Status); } @@ -666,7 +389,6 @@ AxListTables ( FILE *InputFile; size_t HeaderSize; unsigned char Header[48]; - unsigned int TableCount = 0; ACPI_TABLE_HEADER *TableHeader = (ACPI_TABLE_HEADER *) (void *) Header; @@ -675,21 +397,21 @@ AxListTables ( InputFile = fopen (InputPathname, "rt"); if (!InputFile) { - printf ("Could not open file %s\n", InputPathname); + printf ("Could not open input file %s\n", InputPathname); return (-1); } /* Dump the headers for all tables found in the input file */ printf ("\nSignature Length Revision OemId OemTableId" - " OemRevision CompilerId CompilerRevision\n\n"); + " OemRevision CompilerId CompilerRevision\n\n"); - while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) + while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { /* Ignore empty lines and lines that start with a space */ - if (AxIsEmptyLine (LineBuffer) || - (LineBuffer[0] == ' ')) + if (AxIsEmptyLine (Gbl_LineBuffer) || + (Gbl_LineBuffer[0] == ' ')) { continue; } @@ -707,8 +429,9 @@ AxListTables ( if (!strncmp (TableHeader->Signature, "RSD PTR ", 8)) { AxCheckAscii ((char *) &Header[9], 6); - printf ("%7.4s \"%6.6s\"\n", "RSDP", &Header[9]); - TableCount++; + printf ("%7.4s \"%6.6s\"\n", "RSDP", + &Header[9]); + Gbl_TableCount++; continue; } @@ -721,8 +444,9 @@ AxListTables ( /* Signature and Table length */ - TableCount++; - printf ("%7.4s 0x%8.8X", TableHeader->Signature, TableHeader->Length); + Gbl_TableCount++; + printf ("%7.4s 0x%8.8X", TableHeader->Signature, + TableHeader->Length); /* FACS has only signature and length */ @@ -738,13 +462,15 @@ AxListTables ( AxCheckAscii (TableHeader->OemTableId, 8); AxCheckAscii (TableHeader->AslCompilerId, 4); - printf (" 0x%2.2X \"%6.6s\" \"%8.8s\" 0x%8.8X \"%4.4s\" 0x%8.8X\n", + printf ( + " 0x%2.2X \"%6.6s\" \"%8.8s\" 0x%8.8X" + " \"%4.4s\" 0x%8.8X\n", TableHeader->Revision, TableHeader->OemId, TableHeader->OemTableId, TableHeader->OemRevision, TableHeader->AslCompilerId, TableHeader->AslCompilerRevision); } - printf ("\nFound %u ACPI tables\n", TableCount); + printf ("\nFound %u ACPI tables\n", Gbl_TableCount); fclose (InputFile); return (0); } diff --git a/source/tools/acpixtract/acpixtract.h b/source/tools/acpixtract/acpixtract.h new file mode 100644 index 000000000000..304693bbb113 --- /dev/null +++ b/source/tools/acpixtract/acpixtract.h @@ -0,0 +1,173 @@ +/****************************************************************************** + * + * Module Name: acpixtract.h - Include for acpixtract utility + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * 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. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * 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 MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" +#include "acapps.h" +#include <stdio.h> + + +#undef ACPI_GLOBAL + +#ifdef DEFINE_ACPIXTRACT_GLOBALS +#define ACPI_GLOBAL(type,name) \ + extern type name; \ + type name + +#else +#define ACPI_GLOBAL(type,name) \ + extern type name +#endif + + +/* Options */ + +#define AX_EXTRACT_ALL 0 +#define AX_LIST_ALL 1 +#define AX_EXTRACT_SIGNATURE 2 +#define AX_EXTRACT_AML_TABLES 3 +#define AX_EXTRACT_MULTI_TABLE 4 + +#define AX_OPTIONAL_TABLES 0 +#define AX_REQUIRED_TABLE 1 + +#define AX_UTILITY_NAME "ACPI Binary Table Extraction Utility" +#define AX_SUPPORTED_OPTIONS "ahlms:v" +#define AX_MULTI_TABLE_FILENAME "amltables.dat" +#define AX_TABLE_INFO_FORMAT "Acpi table [%4.4s] - %7u bytes written to %s\n" + +/* Extraction states */ + +#define AX_STATE_FIND_HEADER 0 +#define AX_STATE_EXTRACT_DATA 1 + +/* Miscellaneous constants */ + +#define AX_LINE_BUFFER_SIZE 256 +#define AX_MIN_BLOCK_HEADER_LENGTH 6 /* strlen ("DSDT @") */ + + +typedef struct AxTableInfo +{ + UINT32 Signature; + unsigned int Instances; + unsigned int NextInstance; + struct AxTableInfo *Next; + +} AX_TABLE_INFO; + + +/* Globals */ + +ACPI_GLOBAL (char, Gbl_LineBuffer[AX_LINE_BUFFER_SIZE]); +ACPI_GLOBAL (char, Gbl_HeaderBuffer[AX_LINE_BUFFER_SIZE]); +ACPI_GLOBAL (char, Gbl_InstanceBuffer[AX_LINE_BUFFER_SIZE]); + +ACPI_GLOBAL (AX_TABLE_INFO, *Gbl_TableListHead); +ACPI_GLOBAL (char, Gbl_OutputFilename[32]); +ACPI_GLOBAL (unsigned char, Gbl_BinaryData[16]); +ACPI_GLOBAL (unsigned int, Gbl_TableCount); + +/* + * acpixtract.c + */ +int +AxExtractTables ( + char *InputPathname, + char *Signature, + unsigned int MinimumInstances); + +int +AxExtractToMultiAmlFile ( + char *InputPathname); + +int +AxListTables ( + char *InputPathname); + + +/* + * axutils.c + */ +size_t +AxGetTableHeader ( + FILE *InputFile, + unsigned char *OutputData); + +unsigned int +AxCountTableInstances ( + char *InputPathname, + char *Signature); + +unsigned int +AxGetNextInstance ( + char *InputPathname, + char *Signature); + +void +AxNormalizeSignature ( + char *Signature); + +void +AxCheckAscii ( + char *Name, + int Count); + +int +AxIsEmptyLine ( + char *Buffer); + +int +AxIsDataBlockHeader ( + void); + +long +AxProcessOneTextLine ( + FILE *OutputFile, + char *ThisSignature, + unsigned int ThisTableBytesWritten); + +size_t +AxConvertLine ( + char *InputLine, + unsigned char *OutputData); diff --git a/source/tools/acpixtract/axmain.c b/source/tools/acpixtract/axmain.c index 905787a3c725..3fa179940f4a 100644 --- a/source/tools/acpixtract/axmain.c +++ b/source/tools/acpixtract/axmain.c @@ -41,42 +41,16 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include "acpi.h" -#include "accommon.h" -#include "acapps.h" -#include <stdio.h> +#define DEFINE_ACPIXTRACT_GLOBALS +#include "acpixtract.h" +/* Local prototypes */ + static void DisplayUsage ( void); -int -AxExtractTables ( - char *InputPathname, - char *Signature, - unsigned int MinimumInstances); - -int -AxListTables ( - char *InputPathname); - - -/* Options */ - -#define AX_EXTRACT_ALL 0 -#define AX_LIST_ALL 1 -#define AX_EXTRACT_SIGNATURE 2 -#define AX_EXTRACT_AML_TABLES 3 - -static int AxAction = AX_EXTRACT_AML_TABLES; /* DSDT & SSDTs */ - -#define AX_OPTIONAL_TABLES 0 -#define AX_REQUIRED_TABLE 1 - -#define AX_UTILITY_NAME "ACPI Binary Table Extraction Utility" -#define AX_SUPPORTED_OPTIONS "ahls:v" - /****************************************************************************** * @@ -95,6 +69,7 @@ DisplayUsage ( ACPI_OPTION ("-a", "Extract all tables, not just DSDT/SSDT"); ACPI_OPTION ("-l", "List table summaries, do not extract"); + ACPI_OPTION ("-m", "Extract multiple DSDT/SSDTs to a single file"); ACPI_OPTION ("-s <signature>", "Extract all tables with <signature>"); ACPI_OPTION ("-v", "Display version information"); @@ -117,10 +92,15 @@ main ( char *argv[]) { char *Filename; + int AxAction; int Status; int j; + Gbl_TableCount = 0; + Gbl_TableListHead = NULL; + AxAction = AX_EXTRACT_AML_TABLES; /* Default: DSDT & SSDTs */ + ACPI_DEBUG_INITIALIZE (); /* For debug version only */ AcpiOsInitialize (); printf (ACPI_COMMON_SIGNON (AX_UTILITY_NAME)); @@ -145,6 +125,11 @@ main ( AxAction = AX_LIST_ALL; /* List tables only, do not extract */ break; + case 'm': + + AxAction = AX_EXTRACT_MULTI_TABLE; /* Make single file for all DSDT/SSDTs */ + break; + case 's': AxAction = AX_EXTRACT_SIGNATURE; /* Extract only tables with this sig */ @@ -179,6 +164,11 @@ main ( Status = AxExtractTables (Filename, NULL, AX_OPTIONAL_TABLES); break; + case AX_EXTRACT_MULTI_TABLE: + + Status = AxExtractToMultiAmlFile (Filename); + break; + case AX_LIST_ALL: Status = AxListTables (Filename); diff --git a/source/tools/acpixtract/axutils.c b/source/tools/acpixtract/axutils.c new file mode 100644 index 000000000000..eb7dd15139a2 --- /dev/null +++ b/source/tools/acpixtract/axutils.c @@ -0,0 +1,463 @@ +/****************************************************************************** + * + * Module Name: axutils - Utility functions for acpixtract tool. + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * 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. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * 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 MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +#include "acpixtract.h" + + +/******************************************************************************* + * + * FUNCTION: AxCheckAscii + * + * PARAMETERS: Name - Ascii string, at least as long as Count + * Count - Number of characters to check + * + * RETURN: None + * + * DESCRIPTION: Ensure that the requested number of characters are printable + * Ascii characters. Sets non-printable and null chars to <space>. + * + ******************************************************************************/ + +void +AxCheckAscii ( + char *Name, + int Count) +{ + int i; + + + for (i = 0; i < Count; i++) + { + if (!Name[i] || !isprint ((int) Name[i])) + { + Name[i] = ' '; + } + } +} + + +/****************************************************************************** + * + * FUNCTION: AxIsEmptyLine + * + * PARAMETERS: Buffer - Line from input file + * + * RETURN: TRUE if line is empty (zero or more blanks only) + * + * DESCRIPTION: Determine if an input line is empty. + * + ******************************************************************************/ + +int +AxIsEmptyLine ( + char *Buffer) +{ + + /* Skip all spaces */ + + while (*Buffer == ' ') + { + Buffer++; + } + + /* If end-of-line, this line is empty */ + + if (*Buffer == '\n') + { + return (1); + } + + return (0); +} + + +/******************************************************************************* + * + * FUNCTION: AxNormalizeSignature + * + * PARAMETERS: Name - Ascii string containing an ACPI signature + * + * RETURN: None + * + * DESCRIPTION: Change "RSD PTR" to "RSDP" + * + ******************************************************************************/ + +void +AxNormalizeSignature ( + char *Signature) +{ + + if (!strncmp (Signature, "RSD ", 4)) + { + Signature[3] = 'P'; + } +} + + +/****************************************************************************** + * + * FUNCTION: AxConvertLine + * + * PARAMETERS: InputLine - One line from the input acpidump file + * OutputData - Where the converted data is returned + * + * RETURN: The number of bytes actually converted + * + * DESCRIPTION: Convert one line of ascii text binary (up to 16 bytes) + * + ******************************************************************************/ + +size_t +AxConvertLine ( + char *InputLine, + unsigned char *OutputData) +{ + char *End; + int BytesConverted; + int Converted[16]; + int i; + + + /* Terminate the input line at the end of the actual data (for sscanf) */ + + End = strstr (InputLine + 2, " "); + if (!End) + { + return (0); /* Don't understand the format */ + } + *End = 0; + + /* + * Convert one line of table data, of the form: + * <offset>: <up to 16 bytes of hex data> <ASCII representation> <newline> + * + * Example: + * 02C0: 5F 53 42 5F 4C 4E 4B 44 00 12 13 04 0C FF FF 08 _SB_LNKD........ + */ + BytesConverted = sscanf (InputLine, + "%*s %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x", + &Converted[0], &Converted[1], &Converted[2], &Converted[3], + &Converted[4], &Converted[5], &Converted[6], &Converted[7], + &Converted[8], &Converted[9], &Converted[10], &Converted[11], + &Converted[12], &Converted[13], &Converted[14], &Converted[15]); + + /* Pack converted data into a byte array */ + + for (i = 0; i < BytesConverted; i++) + { + OutputData[i] = (unsigned char) Converted[i]; + } + + return ((size_t) BytesConverted); +} + + +/****************************************************************************** + * + * FUNCTION: AxGetTableHeader + * + * PARAMETERS: InputFile - Handle for the input acpidump file + * OutputData - Where the table header is returned + * + * RETURN: The actual number of bytes converted + * + * DESCRIPTION: Extract and convert an ACPI table header + * + ******************************************************************************/ + +size_t +AxGetTableHeader ( + FILE *InputFile, + unsigned char *OutputData) +{ + size_t BytesConverted; + size_t TotalConverted = 0; + int i; + + + /* Get the full 36 byte ACPI table header, requires 3 input text lines */ + + for (i = 0; i < 3; i++) + { + if (!fgets (Gbl_HeaderBuffer, AX_LINE_BUFFER_SIZE, InputFile)) + { + return (TotalConverted); + } + + BytesConverted = AxConvertLine (Gbl_HeaderBuffer, OutputData); + TotalConverted += BytesConverted; + OutputData += 16; + + if (BytesConverted != 16) + { + return (TotalConverted); + } + } + + return (TotalConverted); +} + + +/****************************************************************************** + * + * FUNCTION: AxCountTableInstances + * + * PARAMETERS: InputPathname - Filename for acpidump file + * Signature - Requested signature to count + * + * RETURN: The number of instances of the signature + * + * DESCRIPTION: Count the instances of tables with the given signature within + * the input acpidump file. + * + ******************************************************************************/ + +unsigned int +AxCountTableInstances ( + char *InputPathname, + char *Signature) +{ + FILE *InputFile; + unsigned int Instances = 0; + + + InputFile = fopen (InputPathname, "rt"); + if (!InputFile) + { + printf ("Could not open input file %s\n", InputPathname); + return (0); + } + + /* Count the number of instances of this signature */ + + while (fgets (Gbl_InstanceBuffer, AX_LINE_BUFFER_SIZE, InputFile)) + { + /* Ignore empty lines and lines that start with a space */ + + if (AxIsEmptyLine (Gbl_InstanceBuffer) || + (Gbl_InstanceBuffer[0] == ' ')) + { + continue; + } + + AxNormalizeSignature (Gbl_InstanceBuffer); + if (ACPI_COMPARE_NAME (Gbl_InstanceBuffer, Signature)) + { + Instances++; + } + } + + fclose (InputFile); + return (Instances); +} + + +/****************************************************************************** + * + * FUNCTION: AxGetNextInstance + * + * PARAMETERS: InputPathname - Filename for acpidump file + * Signature - Requested ACPI signature + * + * RETURN: The next instance number for this signature. Zero if this + * is the first instance of this signature. + * + * DESCRIPTION: Get the next instance number of the specified table. If this + * is the first instance of the table, create a new instance + * block. Note: only SSDT and PSDT tables can have multiple + * instances. + * + ******************************************************************************/ + +unsigned int +AxGetNextInstance ( + char *InputPathname, + char *Signature) +{ + AX_TABLE_INFO *Info; + + + Info = Gbl_TableListHead; + while (Info) + { + if (*(UINT32 *) Signature == Info->Signature) + { + break; + } + + Info = Info->Next; + } + + if (!Info) + { + /* Signature not found, create new table info block */ + + Info = malloc (sizeof (AX_TABLE_INFO)); + if (!Info) + { + printf ("Could not allocate memory (0x%X bytes)\n", + (unsigned int) sizeof (AX_TABLE_INFO)); + exit (0); + } + + Info->Signature = *(UINT32 *) Signature; + Info->Instances = AxCountTableInstances (InputPathname, Signature); + Info->NextInstance = 1; + Info->Next = Gbl_TableListHead; + Gbl_TableListHead = Info; + } + + if (Info->Instances > 1) + { + return (Info->NextInstance++); + } + + return (0); +} + + +/****************************************************************************** + * + * FUNCTION: AxIsDataBlockHeader + * + * PARAMETERS: None + * + * RETURN: Status. 1 if the table header is valid, 0 otherwise. + * + * DESCRIPTION: Check if the ACPI table identifier in the input acpidump text + * file is valid (of the form: <sig> @ <addr>). + * + ******************************************************************************/ + +int +AxIsDataBlockHeader ( + void) +{ + + /* Ignore lines that are too short to be header lines */ + + if (strlen (Gbl_LineBuffer) < AX_MIN_BLOCK_HEADER_LENGTH) + { + return (0); + } + + /* Ignore empty lines and lines that start with a space */ + + if (AxIsEmptyLine (Gbl_LineBuffer) || + (Gbl_LineBuffer[0] == ' ')) + { + return (0); + } + + /* + * Ignore lines that are not headers of the form <sig> @ <addr>. + * Basically, just look for the '@' symbol, surrounded by spaces. + * + * Examples of headers that must be supported: + * + * DSDT @ 0x737e4000 + * XSDT @ 0x737f2fff + * RSD PTR @ 0xf6cd0 + * SSDT @ (nil) + */ + if (!strstr (Gbl_LineBuffer, " @ ")) + { + return (0); + } + + AxNormalizeSignature (Gbl_LineBuffer); + return (1); +} + + +/****************************************************************************** + * + * FUNCTION: AxProcessOneTextLine + * + * PARAMETERS: OutputFile - Where to write the binary data + * ThisSignature - Signature of current ACPI table + * ThisTableBytesWritten - Total count of data written + * + * RETURN: Length of the converted line + * + * DESCRIPTION: Convert one line of input hex ascii text to binary, and write + * the binary data to the table output file. + * + ******************************************************************************/ + +long +AxProcessOneTextLine ( + FILE *OutputFile, + char *ThisSignature, + unsigned int ThisTableBytesWritten) +{ + size_t BytesWritten; + size_t BytesConverted; + + + /* Check for the end of this table data block */ + + if (AxIsEmptyLine (Gbl_LineBuffer) || + (Gbl_LineBuffer[0] != ' ')) + { + printf (AX_TABLE_INFO_FORMAT, + ThisSignature, ThisTableBytesWritten, Gbl_OutputFilename); + return (0); + } + + /* Convert one line of ascii hex data to binary */ + + BytesConverted = AxConvertLine (Gbl_LineBuffer, Gbl_BinaryData); + + /* Write the binary data */ + + BytesWritten = fwrite (Gbl_BinaryData, 1, BytesConverted, OutputFile); + if (BytesWritten != BytesConverted) + { + printf ("Error while writing file %s\n", Gbl_OutputFilename); + return (-1); + } + + return (BytesWritten); +} diff --git a/source/tools/examples/examples.c b/source/tools/examples/examples.c index ef9cbf0e7a72..98d7bbcb908b 100644 --- a/source/tools/examples/examples.c +++ b/source/tools/examples/examples.c @@ -152,7 +152,8 @@ main ( ACPI_INFO ((AE_INFO, "Example ACPICA info message")); ACPI_WARNING ((AE_INFO, "Example ACPICA warning message")); ACPI_ERROR ((AE_INFO, "Example ACPICA error message")); - ACPI_EXCEPTION ((AE_INFO, AE_AML_OPERAND_TYPE, "Example ACPICA exception message")); + ACPI_EXCEPTION ((AE_INFO, AE_AML_OPERAND_TYPE, + "Example ACPICA exception message")); ExecuteOSI (); ExecuteMAIN (); @@ -395,16 +396,16 @@ InstallHandlers (void) /* Install global notify handler */ - Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, - NotifyHandler, NULL); + Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, + ACPI_SYSTEM_NOTIFY, NotifyHandler, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While installing Notify handler")); return (Status); } - Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_SYSTEM_MEMORY, - RegionHandler, RegionInit, NULL); + Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, + ACPI_ADR_SPACE_SYSTEM_MEMORY, RegionHandler, RegionInit, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While installing an OpRegion handler")); @@ -480,7 +481,8 @@ ExecuteOSI (void) AcpiOsPrintf ("Invalid return type from _OSI, %.2X\n", Object->Type); } - ACPI_INFO ((AE_INFO, "_OSI returned 0x%8.8X", (UINT32) Object->Integer.Value)); + ACPI_INFO ((AE_INFO, "_OSI returned 0x%8.8X", + (UINT32) Object->Integer.Value)); ErrorExit: @@ -536,7 +538,8 @@ ExecuteMAIN (void) Object = ReturnValue.Pointer; if (Object->Type == ACPI_TYPE_STRING) { - AcpiOsPrintf ("Method [MAIN] returned: \"%s\"\n", Object->String.Pointer); + AcpiOsPrintf ("Method [MAIN] returned: \"%s\"\n", + Object->String.Pointer); } ACPI_FREE (ReturnValue.Pointer); |