From 6c5f27fedfeebe154ae00b64273240d6cc033726 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Thu, 8 Dec 2016 08:56:47 -0800 Subject: acpihelp: Split files and generate cleanup Split the AML and ASL decode into separate files. --- source/common/ahtable.c | 6 +- source/common/ahuuids.c | 4 +- source/compiler/aslutils.c | 2 +- source/include/acdisasm.h | 2 +- source/tools/acpihelp/acpihelp.h | 74 +++- source/tools/acpihelp/ahaml.c | 421 ++++++++++++++++++++++ source/tools/acpihelp/ahamlops.c | 2 +- source/tools/acpihelp/ahasl.c | 391 ++++++++++++++++++++ source/tools/acpihelp/ahaslkey.c | 4 +- source/tools/acpihelp/ahaslops.c | 2 +- source/tools/acpihelp/ahdecode.c | 732 ++++---------------------------------- source/tools/acpihelp/ahgrammar.c | 2 +- source/tools/acpihelp/ahmain.c | 2 + 13 files changed, 957 insertions(+), 687 deletions(-) create mode 100644 source/tools/acpihelp/ahaml.c create mode 100644 source/tools/acpihelp/ahasl.c diff --git a/source/common/ahtable.c b/source/common/ahtable.c index 59ddc836e..67d1eea1f 100644 --- a/source/common/ahtable.c +++ b/source/common/ahtable.c @@ -123,7 +123,7 @@ const AH_TABLE * AcpiAhGetTableInfo ( char *Signature); -extern const AH_TABLE AcpiSupportedTables[]; +extern const AH_TABLE Gbl_AcpiSupportedTables[]; /******************************************************************************* @@ -145,7 +145,7 @@ AcpiAhGetTableInfo ( const AH_TABLE *Info; - for (Info = AcpiSupportedTables; Info->Signature; Info++) + for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++) { if (ACPI_COMPARE_NAME (Signature, Info->Signature)) { @@ -161,7 +161,7 @@ AcpiAhGetTableInfo ( * Note: Any tables added here should be duplicated within AcpiDmTableData * in the file common/dmtable.c */ -const AH_TABLE AcpiSupportedTables[] = +const AH_TABLE Gbl_AcpiSupportedTables[] = { {ACPI_SIG_ASF, "Alert Standard Format table"}, {ACPI_SIG_BERT, "Boot Error Record Table"}, diff --git a/source/common/ahuuids.c b/source/common/ahuuids.c index abcdfce92..157a5eef9 100644 --- a/source/common/ahuuids.c +++ b/source/common/ahuuids.c @@ -124,7 +124,7 @@ /* * Table of "known" (ACPI-related) UUIDs */ -const AH_UUID AcpiUuids[] = +const AH_UUID Gbl_AcpiUuids[] = { {"[Controllers]", NULL}, {"GPIO Controller", UUID_GPIO_CONTROLLER}, @@ -184,7 +184,7 @@ AcpiAhMatchUuid ( /* Walk the table of known ACPI-related UUIDs */ - for (Info = AcpiUuids; Info->Description; Info++) + for (Info = Gbl_AcpiUuids; Info->Description; Info++) { /* Null string means desciption is a UUID class */ diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 588945930..c1033f5b7 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -227,7 +227,7 @@ UtDisplaySupportedTables ( /* All ACPI tables with the common table header */ printf ("\n Supported ACPI tables:\n"); - for (TableData = AcpiSupportedTables, i = 1; + for (TableData = Gbl_AcpiSupportedTables, i = 1; TableData->Signature; TableData++, i++) { printf ("%8u) %s %s\n", i, diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 9c01d88bd..3102a9531 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -501,7 +501,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; * dmtable and ahtable */ extern const ACPI_DMTABLE_DATA AcpiDmTableData[]; -extern const AH_TABLE AcpiSupportedTables[]; +extern const AH_TABLE Gbl_AcpiSupportedTables[]; UINT8 AcpiDmGenerateChecksum ( diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h index 939654d3a..493c2dba7 100644 --- a/source/tools/acpihelp/acpihelp.h +++ b/source/tools/acpihelp/acpihelp.h @@ -128,6 +128,50 @@ #endif +/* + * Global variables. Defined in ahmain.c only, externed in all other files + */ +#undef ACPI_GLOBAL +#undef ACPI_INIT_GLOBAL + +#ifdef DEFINE_AHELP_GLOBALS +#define ACPI_GLOBAL(type,name) \ + extern type name; \ + type name + +#define ACPI_INIT_GLOBAL(type,name,value) \ + type name=value + +#else +#ifndef ACPI_GLOBAL +#define ACPI_GLOBAL(type,name) \ + extern type name +#endif + +#ifndef ACPI_INIT_GLOBAL +#define ACPI_INIT_GLOBAL(type,name,value) \ + extern type name +#endif +#endif + + +#define AH_BUFFER_LENGTH 128 +#define AH_LINE_BUFFER_LENGTH 512 +#define AH_MAX_ASL_LINE_LENGTH 70 +#define AH_MAX_AML_LINE_LENGTH 100 + +ACPI_GLOBAL (char, Gbl_Buffer[AH_BUFFER_LENGTH]); +ACPI_GLOBAL (char, Gbl_LineBuffer[AH_LINE_BUFFER_LENGTH]); + + +#define AH_DISPLAY_EXCEPTION(Status, Name) \ + printf ("%.4X: %s\n", Status, Name) + +#define AH_DISPLAY_EXCEPTION_TEXT(Status, Exception) \ + printf ("%.4X: %-28s (%s)\n", Status,\ + Exception->Name, Exception->Description) + + typedef enum { AH_DECODE_DEFAULT = 0, @@ -147,10 +191,6 @@ typedef enum } AH_OPTION_TYPES; -#define AH_MAX_ASL_LINE_LENGTH 70 -#define AH_MAX_AML_LINE_LENGTH 100 - - typedef struct ah_aml_opcode { UINT16 OpcodeRangeStart; @@ -194,14 +234,17 @@ typedef struct ah_directive_info } AH_DIRECTIVE_INFO; -extern const AH_AML_OPCODE AmlOpcodeInfo[]; -extern const AH_AML_TYPE AmlTypesInfo[]; -extern const AH_ASL_OPERATOR AslOperatorInfo[]; -extern const AH_ASL_KEYWORD AslKeywordInfo[]; -extern const AH_UUID AcpiUuids[]; -extern const AH_DIRECTIVE_INFO PreprocessorDirectives[]; -extern const AH_TABLE AcpiSupportedTables[]; -extern BOOLEAN AhDisplayAll; + +/* Externals for various data tables */ + +extern const AH_AML_OPCODE Gbl_AmlOpcodeInfo[]; +extern const AH_AML_TYPE Gbl_AmlTypesInfo[]; +extern const AH_ASL_OPERATOR Gbl_AslOperatorInfo[]; +extern const AH_ASL_KEYWORD Gbl_AslKeywordInfo[]; +extern const AH_UUID Gbl_AcpiUuids[]; +extern const AH_DIRECTIVE_INFO Gbl_PreprocessorDirectives[]; +extern const AH_TABLE Gbl_AcpiSupportedTables[]; + void AhFindAmlOpcode ( @@ -255,4 +298,11 @@ void AhDisplayDirectives ( void); +void +AhPrintOneField ( + UINT32 Indent, + UINT32 CurrentPosition, + UINT32 MaxPosition, + const char *Field); + #endif /* __ACPIHELP_H */ diff --git a/source/tools/acpihelp/ahaml.c b/source/tools/acpihelp/ahaml.c new file mode 100644 index 000000000..f6a6a555b --- /dev/null +++ b/source/tools/acpihelp/ahaml.c @@ -0,0 +1,421 @@ +/****************************************************************************** + * + * Module Name: ahaml - AML opcode decoding for acpihelp utility + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpihelp.h" + + +/* Local prototypes */ + +static void +AhDisplayAmlOpcode ( + const AH_AML_OPCODE *Op); + +static void +AhDisplayAmlType ( + const AH_AML_TYPE *Op); + + +/******************************************************************************* + * + * FUNCTION: AhFindAmlOpcode (entry point for AML opcode name search) + * + * PARAMETERS: Name - Name or prefix for an AML opcode. + * NULL means "find all" + * + * RETURN: None + * + * DESCRIPTION: Find all AML opcodes that match the input Name or name + * prefix. + * + ******************************************************************************/ + +void +AhFindAmlOpcode ( + char *Name) +{ + const AH_AML_OPCODE *Op; + BOOLEAN Found = FALSE; + + + AcpiUtStrupr (Name); + + /* Find/display all opcode names that match the input name prefix */ + + for (Op = Gbl_AmlOpcodeInfo; Op->OpcodeString; Op++) + { + if (!Op->OpcodeName) /* Unused opcodes */ + { + continue; + } + + if (!Name || (Name[0] == '*')) + { + AhDisplayAmlOpcode (Op); + Found = TRUE; + continue; + } + + /* Upper case the opcode name before substring compare */ + + strcpy (Gbl_Buffer, Op->OpcodeName); + AcpiUtStrupr (Gbl_Buffer); + + if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) + { + AhDisplayAmlOpcode (Op); + Found = TRUE; + } + } + + if (!Found) + { + printf ("%s, no matching AML operators\n", Name); + } +} + + +/******************************************************************************* + * + * FUNCTION: AhDecodeAmlOpcode (entry point for AML opcode search) + * + * PARAMETERS: OpcodeString - String version of AML opcode + * + * RETURN: None + * + * DESCRIPTION: Display information about the input AML opcode + * + ******************************************************************************/ + +void +AhDecodeAmlOpcode ( + char *OpcodeString) +{ + const AH_AML_OPCODE *Op; + UINT32 Opcode; + UINT8 Prefix; + + + if (!OpcodeString) + { + AhFindAmlOpcode (NULL); + return; + } + + Opcode = strtoul (OpcodeString, NULL, 16); + if (Opcode > ACPI_UINT16_MAX) + { + printf ("Invalid opcode (more than 16 bits)\n"); + return; + } + + /* Only valid opcode extension is 0x5B */ + + Prefix = (Opcode & 0x0000FF00) >> 8; + if (Prefix && (Prefix != 0x5B)) + { + printf ("Invalid opcode (invalid extension prefix 0x%X)\n", + Prefix); + return; + } + + /* Find/Display the opcode. May fall within an opcode range */ + + for (Op = Gbl_AmlOpcodeInfo; Op->OpcodeString; Op++) + { + if ((Opcode >= Op->OpcodeRangeStart) && + (Opcode <= Op->OpcodeRangeEnd)) + { + AhDisplayAmlOpcode (Op); + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AhDisplayAmlOpcode + * + * PARAMETERS: Op - An opcode info struct + * + * RETURN: None + * + * DESCRIPTION: Display the contents of an AML opcode information struct + * + ******************************************************************************/ + +static void +AhDisplayAmlOpcode ( + const AH_AML_OPCODE *Op) +{ + + if (!Op->OpcodeName) + { + printf ("%18s: Opcode=%-9s\n", "Reserved opcode", Op->OpcodeString); + return; + } + + /* Opcode name and value(s) */ + + printf ("%18s: Opcode=%-9s Type (%s)", + Op->OpcodeName, Op->OpcodeString, Op->Type); + + /* Optional fixed/static arguments */ + + if (Op->FixedArguments) + { + printf (" FixedArgs ("); + AhPrintOneField (37, 36 + 7 + strlen (Op->Type) + 12, + AH_MAX_AML_LINE_LENGTH, Op->FixedArguments); + printf (")"); + } + + /* Optional variable-length argument list */ + + if (Op->VariableArguments) + { + if (Op->FixedArguments) + { + printf ("\n%*s", 36, " "); + } + printf (" VariableArgs ("); + AhPrintOneField (37, 15, AH_MAX_AML_LINE_LENGTH, Op->VariableArguments); + printf (")"); + } + printf ("\n"); + + /* Grammar specification */ + + if (Op->Grammar) + { + AhPrintOneField (37, 0, AH_MAX_AML_LINE_LENGTH, Op->Grammar); + printf ("\n"); + } +} + + +/******************************************************************************* + * + * FUNCTION: AhFindAmlTypes (entry point for AML grammar keyword search) + * + * PARAMETERS: Name - Name or prefix for an AML grammar element. + * NULL means "find all" + * + * RETURN: None + * + * DESCRIPTION: Find all AML grammar keywords that match the input Name or name + * prefix. + * + ******************************************************************************/ + +void +AhFindAmlTypes ( + char *Name) +{ + const AH_AML_TYPE *Keyword; + BOOLEAN Found = FALSE; + + + AcpiUtStrupr (Name); + + for (Keyword = Gbl_AmlTypesInfo; Keyword->Name; Keyword++) + { + if (!Name) + { + printf (" %s\n", Keyword->Name); + Found = TRUE; + continue; + } + + if (*Name == '*') + { + AhDisplayAmlType (Keyword); + Found = TRUE; + continue; + } + + /* Upper case the operator name before substring compare */ + + strcpy (Gbl_Buffer, Keyword->Name); + AcpiUtStrupr (Gbl_Buffer); + + if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) + { + AhDisplayAmlType (Keyword); + Found = TRUE; + } + } + + if (!Found) + { + printf ("%s, no matching AML grammar type\n", Name); + } +} + + +/******************************************************************************* + * + * FUNCTION: AhDisplayAmlType + * + * PARAMETERS: Op - Pointer to AML grammar info + * + * RETURN: None + * + * DESCRIPTION: Format and display info for an AML grammar element. + * + ******************************************************************************/ + +static void +AhDisplayAmlType ( + const AH_AML_TYPE *Op) +{ + char *Description; + + + Description = Op->Description; + printf ("%4s", " "); /* Primary indent */ + + /* Emit the entire description string */ + + while (*Description) + { + /* Description can be multiple lines, must indent each */ + + while (*Description != '\n') + { + printf ("%c", *Description); + Description++; + } + + printf ("\n"); + Description++; + + /* Do indent */ + + if (*Description) + { + printf ("%8s", " "); /* Secondary indent */ + + /* Index extra for a comment */ + + if ((Description[0] == '/') && + (Description[1] == '/')) + { + printf ("%4s", " "); + } + } + } + + printf ("\n"); +} diff --git a/source/tools/acpihelp/ahamlops.c b/source/tools/acpihelp/ahamlops.c index 79b596c67..799c2d353 100644 --- a/source/tools/acpihelp/ahamlops.c +++ b/source/tools/acpihelp/ahamlops.c @@ -120,7 +120,7 @@ * AML opcodes with related syntax and grammar information. * This table was extracted from the ACPI specification. */ -const AH_AML_OPCODE AmlOpcodeInfo[] = +const AH_AML_OPCODE Gbl_AmlOpcodeInfo[] = { {0x00, 0x00, "0x00", "ZeroOp", "DataObject", NULL, NULL, NULL}, diff --git a/source/tools/acpihelp/ahasl.c b/source/tools/acpihelp/ahasl.c new file mode 100644 index 000000000..83777074a --- /dev/null +++ b/source/tools/acpihelp/ahasl.c @@ -0,0 +1,391 @@ +/****************************************************************************** + * + * Module Name: ahasl - ASL operator decoding for acpihelp utility + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpihelp.h" + + +/* Local prototypes */ + +static void +AhDisplayAslOperator ( + const AH_ASL_OPERATOR *Op); + +static void +AhDisplayOperatorKeywords ( + const AH_ASL_OPERATOR *Op); + +static void +AhDisplayAslKeyword ( + const AH_ASL_KEYWORD *Op); + + +/******************************************************************************* + * + * FUNCTION: AhFindAslKeywords (entry point for ASL keyword search) + * + * PARAMETERS: Name - Name or prefix for an ASL keyword. + * NULL means "find all" + * + * RETURN: None + * + * DESCRIPTION: Find all ASL keywords that match the input Name or name + * prefix. + * + ******************************************************************************/ + +void +AhFindAslKeywords ( + char *Name) +{ + const AH_ASL_KEYWORD *Keyword; + BOOLEAN Found = FALSE; + + + AcpiUtStrupr (Name); + + for (Keyword = Gbl_AslKeywordInfo; Keyword->Name; Keyword++) + { + if (!Name || (Name[0] == '*')) + { + AhDisplayAslKeyword (Keyword); + Found = TRUE; + continue; + } + + /* Upper case the operator name before substring compare */ + + strcpy (Gbl_Buffer, Keyword->Name); + AcpiUtStrupr (Gbl_Buffer); + + if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) + { + AhDisplayAslKeyword (Keyword); + Found = TRUE; + } + } + + if (!Found) + { + printf ("%s, no matching ASL keywords\n", Name); + } +} + + +/******************************************************************************* + * + * FUNCTION: AhDisplayAslKeyword + * + * PARAMETERS: Op - Pointer to ASL keyword with syntax info + * + * RETURN: None + * + * DESCRIPTION: Format and display syntax info for an ASL keyword. Splits + * long lines appropriately for reading. + * + ******************************************************************************/ + +static void +AhDisplayAslKeyword ( + const AH_ASL_KEYWORD *Op) +{ + + /* ASL keyword name and description */ + + printf ("%22s: %s\n", Op->Name, Op->Description); + if (!Op->KeywordList) + { + return; + } + + /* List of actual keywords */ + + AhPrintOneField (24, 0, AH_MAX_ASL_LINE_LENGTH, Op->KeywordList); + printf ("\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AhFindAslAndAmlOperators + * + * PARAMETERS: Name - Name or prefix for an ASL operator. + * NULL means "find all" + * + * RETURN: None + * + * DESCRIPTION: Find all ASL operators that match the input Name or name + * prefix. Also displays the AML information if only one entry + * matches. + * + ******************************************************************************/ + +void +AhFindAslAndAmlOperators ( + char *Name) +{ + UINT32 MatchCount; + + + MatchCount = AhFindAslOperators (Name); + if (MatchCount == 1) + { + AhFindAmlOpcode (Name); + } +} + + +/******************************************************************************* + * + * FUNCTION: AhFindAslOperators (entry point for ASL operator search) + * + * PARAMETERS: Name - Name or prefix for an ASL operator. + * NULL means "find all" + * + * RETURN: Number of operators that matched the name prefix. + * + * DESCRIPTION: Find all ASL operators that match the input Name or name + * prefix. + * + ******************************************************************************/ + +UINT32 +AhFindAslOperators ( + char *Name) +{ + const AH_ASL_OPERATOR *Operator; + BOOLEAN MatchCount = 0; + + + AcpiUtStrupr (Name); + + /* Find/display all names that match the input name prefix */ + + for (Operator = Gbl_AslOperatorInfo; Operator->Name; Operator++) + { + if (!Name || (Name[0] == '*')) + { + AhDisplayAslOperator (Operator); + MatchCount++; + continue; + } + + /* Upper case the operator name before substring compare */ + + strcpy (Gbl_Buffer, Operator->Name); + AcpiUtStrupr (Gbl_Buffer); + + if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) + { + AhDisplayAslOperator (Operator); + MatchCount++; + } + } + + if (!MatchCount) + { + printf ("%s, no matching ASL operators\n", Name); + } + + return (MatchCount); +} + + +/******************************************************************************* + * + * FUNCTION: AhDisplayAslOperator + * + * PARAMETERS: Op - Pointer to ASL operator with syntax info + * + * RETURN: None + * + * DESCRIPTION: Format and display syntax info for an ASL operator. Splits + * long lines appropriately for reading. + * + ******************************************************************************/ + +static void +AhDisplayAslOperator ( + const AH_ASL_OPERATOR *Op) +{ + + /* ASL operator name and description */ + + printf ("%16s: %s\n", Op->Name, Op->Description); + if (!Op->Syntax) + { + return; + } + + /* Syntax for the operator */ + + AhPrintOneField (18, 0, AH_MAX_ASL_LINE_LENGTH, Op->Syntax); + printf ("\n"); + + AhDisplayOperatorKeywords (Op); + printf ("\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AhDisplayOperatorKeywords + * + * PARAMETERS: Op - Pointer to ASL keyword with syntax info + * + * RETURN: None + * + * DESCRIPTION: Display any/all keywords that are associated with the ASL + * operator. + * + ******************************************************************************/ + +static void +AhDisplayOperatorKeywords ( + const AH_ASL_OPERATOR *Op) +{ + char *Token; + char *Separators = "(){}, "; + BOOLEAN FirstKeyword = TRUE; + + + if (!Op || !Op->Syntax) + { + return; + } + + /* + * Find all parameters that have the word "keyword" within, and then + * display the info about that keyword + */ + strcpy (Gbl_LineBuffer, Op->Syntax); + Token = strtok (Gbl_LineBuffer, Separators); + while (Token) + { + if (strstr (Token, "Keyword")) + { + if (FirstKeyword) + { + printf ("\n"); + FirstKeyword = FALSE; + } + + /* Found a keyword, display keyword information */ + + AhFindAslKeywords (Token); + } + + Token = strtok (NULL, Separators); + } +} diff --git a/source/tools/acpihelp/ahaslkey.c b/source/tools/acpihelp/ahaslkey.c index fb2a41f9e..71d0b6bc0 100644 --- a/source/tools/acpihelp/ahaslkey.c +++ b/source/tools/acpihelp/ahaslkey.c @@ -120,7 +120,7 @@ * ASL Keyword types and associated actual keywords. * This table was extracted from the ACPI specification. */ -const AH_ASL_KEYWORD AslKeywordInfo[] = +const AH_ASL_KEYWORD Gbl_AslKeywordInfo[] = { {"AccessAttribKeyword", "Serial Bus Attributes (with legacy SMBus aliases)", ":= AttribQuick (SMBusQuick) | AttribSendReceive (SMBusSendReceive) | " @@ -223,7 +223,7 @@ const AH_ASL_KEYWORD AslKeywordInfo[] = /* Preprocessor directives */ -const AH_DIRECTIVE_INFO PreprocessorDirectives[] = +const AH_DIRECTIVE_INFO Gbl_PreprocessorDirectives[] = { {"#include \"Filename\"", "Standard include of an ASCII ASL source code file"}, {"#include ", "Alternate syntax for #include, alternate search path"}, diff --git a/source/tools/acpihelp/ahaslops.c b/source/tools/acpihelp/ahaslops.c index 54e8fe946..e4d8585e2 100644 --- a/source/tools/acpihelp/ahaslops.c +++ b/source/tools/acpihelp/ahaslops.c @@ -120,7 +120,7 @@ * Note: All tokens require a space separator. * Long lines are automatically split during output. */ -const AH_ASL_OPERATOR AslOperatorInfo[] = +const AH_ASL_OPERATOR Gbl_AslOperatorInfo[] = { {"AccessAs", "(AccessType, AccessAttribKeyword | " "ExtendedAttribKeyword (AccessLength))", diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index f455f3601..797f43bc6 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: ahdecode - Operator/Opcode decoding for acpihelp utility + * Module Name: ahdecode - Miscellaneous decoding for acpihelp utility * *****************************************************************************/ @@ -120,19 +120,6 @@ #include "acpredef.h" -#define AH_DISPLAY_EXCEPTION(Status, Name) \ - printf ("%.4X: %s\n", Status, Name) - -#define AH_DISPLAY_EXCEPTION_TEXT(Status, Exception) \ - printf ("%.4X: %-28s (%s)\n", Status, Exception->Name, Exception->Description) - -#define BUFFER_LENGTH 128 -#define LINE_BUFFER_LENGTH 512 - -static char Gbl_Buffer[BUFFER_LENGTH]; -static char Gbl_LineBuffer[LINE_BUFFER_LENGTH]; - - /* Local prototypes */ static BOOLEAN @@ -148,32 +135,77 @@ static void AhDisplayResourceName ( const ACPI_PREDEFINED_INFO *ThisName); -static void -AhDisplayAmlOpcode ( - const AH_AML_OPCODE *Op); - -static void -AhDisplayAmlType ( - const AH_AML_TYPE *Op); - -static void -AhDisplayAslOperator ( - const AH_ASL_OPERATOR *Op); - -static void -AhDisplayOperatorKeywords ( - const AH_ASL_OPERATOR *Op); -static void -AhDisplayAslKeyword ( - const AH_ASL_KEYWORD *Op); +/******************************************************************************* + * + * FUNCTION: AhPrintOneField + * + * PARAMETERS: Indent - Indent length for new line(s) + * CurrentPosition - Position on current line + * MaxPosition - Max allowed line length + * Field - Data to output + * + * RETURN: Line position after field is written + * + * DESCRIPTION: Split long lines appropriately for ease of reading. + * + ******************************************************************************/ -static void +void AhPrintOneField ( UINT32 Indent, UINT32 CurrentPosition, UINT32 MaxPosition, - const char *Field); + const char *Field) +{ + UINT32 Position; + UINT32 TokenLength; + const char *This; + const char *Next; + const char *Last; + + + This = Field; + Position = CurrentPosition; + + if (Position == 0) + { + printf ("%*s", (int) Indent, " "); + Position = Indent; + } + + Last = This + strlen (This); + while ((Next = strpbrk (This, " "))) + { + TokenLength = Next - This; + Position += TokenLength; + + /* Split long lines */ + + if (Position > MaxPosition) + { + printf ("\n%*s", (int) Indent, " "); + Position = TokenLength; + } + + printf ("%.*s ", (int) TokenLength, This); + This = Next + 1; + } + + /* Handle last token on the input line */ + + TokenLength = Last - This; + if (TokenLength > 0) + { + Position += TokenLength; + if (Position > MaxPosition) + { + printf ("\n%*s", (int) Indent, " "); + } + + printf ("%s", This); + } +} /******************************************************************************* @@ -197,7 +229,7 @@ AhDisplayDirectives ( printf ("iASL Preprocessor Directives\n\n"); - for (Info = PreprocessorDirectives; Info->Name; Info++) + for (Info = Gbl_PreprocessorDirectives; Info->Name; Info++) { printf (" %-36s : %s\n", Info->Name, Info->Description); } @@ -399,632 +431,6 @@ AhDisplayResourceName ( } -/******************************************************************************* - * - * FUNCTION: AhFindAmlOpcode (entry point for AML opcode name search) - * - * PARAMETERS: Name - Name or prefix for an AML opcode. - * NULL means "find all" - * - * RETURN: None - * - * DESCRIPTION: Find all AML opcodes that match the input Name or name - * prefix. - * - ******************************************************************************/ - -void -AhFindAmlOpcode ( - char *Name) -{ - const AH_AML_OPCODE *Op; - BOOLEAN Found = FALSE; - - - AcpiUtStrupr (Name); - - /* Find/display all opcode names that match the input name prefix */ - - for (Op = AmlOpcodeInfo; Op->OpcodeString; Op++) - { - if (!Op->OpcodeName) /* Unused opcodes */ - { - continue; - } - - if (!Name || (Name[0] == '*')) - { - AhDisplayAmlOpcode (Op); - Found = TRUE; - continue; - } - - /* Upper case the opcode name before substring compare */ - - strcpy (Gbl_Buffer, Op->OpcodeName); - AcpiUtStrupr (Gbl_Buffer); - - if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) - { - AhDisplayAmlOpcode (Op); - Found = TRUE; - } - } - - if (!Found) - { - printf ("%s, no matching AML operators\n", Name); - } -} - - -/******************************************************************************* - * - * FUNCTION: AhDecodeAmlOpcode (entry point for AML opcode search) - * - * PARAMETERS: OpcodeString - String version of AML opcode - * - * RETURN: None - * - * DESCRIPTION: Display information about the input AML opcode - * - ******************************************************************************/ - -void -AhDecodeAmlOpcode ( - char *OpcodeString) -{ - const AH_AML_OPCODE *Op; - UINT32 Opcode; - UINT8 Prefix; - - - if (!OpcodeString) - { - AhFindAmlOpcode (NULL); - return; - } - - Opcode = strtoul (OpcodeString, NULL, 16); - if (Opcode > ACPI_UINT16_MAX) - { - printf ("Invalid opcode (more than 16 bits)\n"); - return; - } - - /* Only valid opcode extension is 0x5B */ - - Prefix = (Opcode & 0x0000FF00) >> 8; - if (Prefix && (Prefix != 0x5B)) - { - printf ("Invalid opcode (invalid extension prefix 0x%X)\n", - Prefix); - return; - } - - /* Find/Display the opcode. May fall within an opcode range */ - - for (Op = AmlOpcodeInfo; Op->OpcodeString; Op++) - { - if ((Opcode >= Op->OpcodeRangeStart) && - (Opcode <= Op->OpcodeRangeEnd)) - { - AhDisplayAmlOpcode (Op); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AhDisplayAmlOpcode - * - * PARAMETERS: Op - An opcode info struct - * - * RETURN: None - * - * DESCRIPTION: Display the contents of an AML opcode information struct - * - ******************************************************************************/ - -static void -AhDisplayAmlOpcode ( - const AH_AML_OPCODE *Op) -{ - - if (!Op->OpcodeName) - { - printf ("%18s: Opcode=%-9s\n", "Reserved opcode", Op->OpcodeString); - return; - } - - /* Opcode name and value(s) */ - - printf ("%18s: Opcode=%-9s Type (%s)", - Op->OpcodeName, Op->OpcodeString, Op->Type); - - /* Optional fixed/static arguments */ - - if (Op->FixedArguments) - { - printf (" FixedArgs ("); - AhPrintOneField (37, 36 + 7 + strlen (Op->Type) + 12, - AH_MAX_AML_LINE_LENGTH, Op->FixedArguments); - printf (")"); - } - - /* Optional variable-length argument list */ - - if (Op->VariableArguments) - { - if (Op->FixedArguments) - { - printf ("\n%*s", 36, " "); - } - printf (" VariableArgs ("); - AhPrintOneField (37, 15, AH_MAX_AML_LINE_LENGTH, Op->VariableArguments); - printf (")"); - } - printf ("\n"); - - /* Grammar specification */ - - if (Op->Grammar) - { - AhPrintOneField (37, 0, AH_MAX_AML_LINE_LENGTH, Op->Grammar); - printf ("\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: AhFindAmlTypes (entry point for AML grammar keyword search) - * - * PARAMETERS: Name - Name or prefix for an AML grammar element. - * NULL means "find all" - * - * RETURN: None - * - * DESCRIPTION: Find all AML grammar keywords that match the input Name or name - * prefix. - * - ******************************************************************************/ - -void -AhFindAmlTypes ( - char *Name) -{ - const AH_AML_TYPE *Keyword; - BOOLEAN Found = FALSE; - - - AcpiUtStrupr (Name); - - for (Keyword = AmlTypesInfo; Keyword->Name; Keyword++) - { - if (!Name) - { - printf (" %s\n", Keyword->Name); - Found = TRUE; - continue; - } - - if (*Name == '*') - { - AhDisplayAmlType (Keyword); - Found = TRUE; - continue; - } - - /* Upper case the operator name before substring compare */ - - strcpy (Gbl_Buffer, Keyword->Name); - AcpiUtStrupr (Gbl_Buffer); - - if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) - { - AhDisplayAmlType (Keyword); - Found = TRUE; - } - } - - if (!Found) - { - printf ("%s, no matching AML grammar type\n", Name); - } -} - - -/******************************************************************************* - * - * FUNCTION: AhDisplayAmlType - * - * PARAMETERS: Op - Pointer to AML grammar info - * - * RETURN: None - * - * DESCRIPTION: Format and display info for an AML grammar element. - * - ******************************************************************************/ - -static void -AhDisplayAmlType ( - const AH_AML_TYPE *Op) -{ - char *Description; - - - Description = Op->Description; - printf ("%4s", " "); /* Primary indent */ - - /* Emit the entire description string */ - - while (*Description) - { - /* Description can be multiple lines, must indent each */ - - while (*Description != '\n') - { - printf ("%c", *Description); - Description++; - } - - printf ("\n"); - Description++; - - /* Do indent */ - - if (*Description) - { - printf ("%8s", " "); /* Secondary indent */ - - /* Index extra for a comment */ - - if ((Description[0] == '/') && - (Description[1] == '/')) - { - printf ("%4s", " "); - } - } - } - - printf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AhFindAslKeywords (entry point for ASL keyword search) - * - * PARAMETERS: Name - Name or prefix for an ASL keyword. - * NULL means "find all" - * - * RETURN: None - * - * DESCRIPTION: Find all ASL keywords that match the input Name or name - * prefix. - * - ******************************************************************************/ - -void -AhFindAslKeywords ( - char *Name) -{ - const AH_ASL_KEYWORD *Keyword; - BOOLEAN Found = FALSE; - - - AcpiUtStrupr (Name); - - for (Keyword = AslKeywordInfo; Keyword->Name; Keyword++) - { - if (!Name || (Name[0] == '*')) - { - AhDisplayAslKeyword (Keyword); - Found = TRUE; - continue; - } - - /* Upper case the operator name before substring compare */ - - strcpy (Gbl_Buffer, Keyword->Name); - AcpiUtStrupr (Gbl_Buffer); - - if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) - { - AhDisplayAslKeyword (Keyword); - Found = TRUE; - } - } - - if (!Found) - { - printf ("%s, no matching ASL keywords\n", Name); - } -} - - -/******************************************************************************* - * - * FUNCTION: AhDisplayAslKeyword - * - * PARAMETERS: Op - Pointer to ASL keyword with syntax info - * - * RETURN: None - * - * DESCRIPTION: Format and display syntax info for an ASL keyword. Splits - * long lines appropriately for reading. - * - ******************************************************************************/ - -static void -AhDisplayAslKeyword ( - const AH_ASL_KEYWORD *Op) -{ - - /* ASL keyword name and description */ - - printf ("%22s: %s\n", Op->Name, Op->Description); - if (!Op->KeywordList) - { - return; - } - - /* List of actual keywords */ - - AhPrintOneField (24, 0, AH_MAX_ASL_LINE_LENGTH, Op->KeywordList); - printf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AhFindAslAndAmlOperators - * - * PARAMETERS: Name - Name or prefix for an ASL operator. - * NULL means "find all" - * - * RETURN: None - * - * DESCRIPTION: Find all ASL operators that match the input Name or name - * prefix. Also displays the AML information if only one entry - * matches. - * - ******************************************************************************/ - -void -AhFindAslAndAmlOperators ( - char *Name) -{ - UINT32 MatchCount; - - - MatchCount = AhFindAslOperators (Name); - if (MatchCount == 1) - { - AhFindAmlOpcode (Name); - } -} - - -/******************************************************************************* - * - * FUNCTION: AhFindAslOperators (entry point for ASL operator search) - * - * PARAMETERS: Name - Name or prefix for an ASL operator. - * NULL means "find all" - * - * RETURN: Number of operators that matched the name prefix. - * - * DESCRIPTION: Find all ASL operators that match the input Name or name - * prefix. - * - ******************************************************************************/ - -UINT32 -AhFindAslOperators ( - char *Name) -{ - const AH_ASL_OPERATOR *Operator; - BOOLEAN MatchCount = 0; - - - AcpiUtStrupr (Name); - - /* Find/display all names that match the input name prefix */ - - for (Operator = AslOperatorInfo; Operator->Name; Operator++) - { - if (!Name || (Name[0] == '*')) - { - AhDisplayAslOperator (Operator); - MatchCount++; - continue; - } - - /* Upper case the operator name before substring compare */ - - strcpy (Gbl_Buffer, Operator->Name); - AcpiUtStrupr (Gbl_Buffer); - - if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) - { - AhDisplayAslOperator (Operator); - MatchCount++; - } - } - - if (!MatchCount) - { - printf ("%s, no matching ASL operators\n", Name); - } - - return (MatchCount); -} - - -/******************************************************************************* - * - * FUNCTION: AhDisplayAslOperator - * - * PARAMETERS: Op - Pointer to ASL operator with syntax info - * - * RETURN: None - * - * DESCRIPTION: Format and display syntax info for an ASL operator. Splits - * long lines appropriately for reading. - * - ******************************************************************************/ - -static void -AhDisplayAslOperator ( - const AH_ASL_OPERATOR *Op) -{ - - /* ASL operator name and description */ - - printf ("%16s: %s\n", Op->Name, Op->Description); - if (!Op->Syntax) - { - return; - } - - /* Syntax for the operator */ - - AhPrintOneField (18, 0, AH_MAX_ASL_LINE_LENGTH, Op->Syntax); - printf ("\n"); - - AhDisplayOperatorKeywords (Op); - printf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AhDisplayOperatorKeywords - * - * PARAMETERS: Op - Pointer to ASL keyword with syntax info - * - * RETURN: None - * - * DESCRIPTION: Display any/all keywords that are associated with the ASL - * operator. - * - ******************************************************************************/ - -static void -AhDisplayOperatorKeywords ( - const AH_ASL_OPERATOR *Op) -{ - char *Token; - char *Separators = "(){}, "; - BOOLEAN FirstKeyword = TRUE; - - - if (!Op || !Op->Syntax) - { - return; - } - - /* - * Find all parameters that have the word "keyword" within, and then - * display the info about that keyword - */ - strcpy (Gbl_LineBuffer, Op->Syntax); - Token = strtok (Gbl_LineBuffer, Separators); - while (Token) - { - if (strstr (Token, "Keyword")) - { - if (FirstKeyword) - { - printf ("\n"); - FirstKeyword = FALSE; - } - - /* Found a keyword, display keyword information */ - - AhFindAslKeywords (Token); - } - - Token = strtok (NULL, Separators); - } -} - - -/******************************************************************************* - * - * FUNCTION: AhPrintOneField - * - * PARAMETERS: Indent - Indent length for new line(s) - * CurrentPosition - Position on current line - * MaxPosition - Max allowed line length - * Field - Data to output - * - * RETURN: Line position after field is written - * - * DESCRIPTION: Split long lines appropriately for ease of reading. - * - ******************************************************************************/ - -static void -AhPrintOneField ( - UINT32 Indent, - UINT32 CurrentPosition, - UINT32 MaxPosition, - const char *Field) -{ - UINT32 Position; - UINT32 TokenLength; - const char *This; - const char *Next; - const char *Last; - - - This = Field; - Position = CurrentPosition; - - if (Position == 0) - { - printf ("%*s", (int) Indent, " "); - Position = Indent; - } - - Last = This + strlen (This); - while ((Next = strpbrk (This, " "))) - { - TokenLength = Next - This; - Position += TokenLength; - - /* Split long lines */ - - if (Position > MaxPosition) - { - printf ("\n%*s", (int) Indent, " "); - Position = TokenLength; - } - - printf ("%.*s ", (int) TokenLength, This); - This = Next + 1; - } - - /* Handle last token on the input line */ - - TokenLength = Last - This; - if (TokenLength > 0) - { - Position += TokenLength; - if (Position > MaxPosition) - { - printf ("\n%*s", (int) Indent, " "); - } - - printf ("%s", This); - } -} - - /******************************************************************************* * * FUNCTION: AhDisplayDeviceIds @@ -1121,7 +527,7 @@ AhDisplayUuids ( /* Display entire table of known ACPI-related UUIDs/GUIDs */ - for (Info = AcpiUuids; Info->Description; Info++) + for (Info = Gbl_AcpiUuids; Info->Description; Info++) { if (!Info->String) /* Null UUID string means group description */ { @@ -1168,7 +574,7 @@ AhDisplayTables ( printf ("Known ACPI tables:\n"); - for (Info = AcpiSupportedTables; Info->Signature; Info++) + for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++) { printf ("%8s : %s\n", Info->Signature, Info->Description); i++; diff --git a/source/tools/acpihelp/ahgrammar.c b/source/tools/acpihelp/ahgrammar.c index 7375add1d..c8159ce82 100644 --- a/source/tools/acpihelp/ahgrammar.c +++ b/source/tools/acpihelp/ahgrammar.c @@ -115,7 +115,7 @@ #include "acpihelp.h" -const AH_AML_TYPE AmlTypesInfo[] = +const AH_AML_TYPE Gbl_AmlTypesInfo[] = { {"ComputationalData", "ComputationalData :=\n" diff --git a/source/tools/acpihelp/ahmain.c b/source/tools/acpihelp/ahmain.c index b86f79fb0..0c13d654b 100644 --- a/source/tools/acpihelp/ahmain.c +++ b/source/tools/acpihelp/ahmain.c @@ -113,6 +113,7 @@ * *****************************************************************************/ +#define DEFINE_AHELP_GLOBALS #include "acpihelp.h" @@ -133,6 +134,7 @@ AhDisplayUsage ( #define ACPI_OPTION(Name, Description) \ AcpiOsPrintf (" %-24s%s\n", Name, Description); + /****************************************************************************** * * FUNCTION: AhDisplayUsage -- cgit v1.2.1