diff options
Diffstat (limited to 'source/tools')
| -rw-r--r-- | source/tools/acpibin/abcompare.c | 1 | ||||
| -rw-r--r-- | source/tools/acpibin/abmain.c | 1 | ||||
| -rw-r--r-- | source/tools/acpibin/acpibin.h | 5 | ||||
| -rw-r--r-- | source/tools/acpidump/acpidump.h | 13 | ||||
| -rw-r--r-- | source/tools/acpidump/apdump.c | 28 | ||||
| -rw-r--r-- | source/tools/acpidump/apfiles.c | 43 | ||||
| -rw-r--r-- | source/tools/acpidump/apmain.c | 16 | ||||
| -rw-r--r-- | source/tools/acpiexec/aecommon.h | 5 | ||||
| -rw-r--r-- | source/tools/acpiexec/aeinitfile.c | 3 | ||||
| -rw-r--r-- | source/tools/acpiexec/aemain.c | 32 | ||||
| -rw-r--r-- | source/tools/acpihelp/acpihelp.h | 24 | ||||
| -rw-r--r-- | source/tools/acpihelp/ahamlops.c | 1 | ||||
| -rw-r--r-- | source/tools/acpihelp/ahdecode.c | 130 | ||||
| -rw-r--r-- | source/tools/acpihelp/ahgrammar.c | 289 | ||||
| -rw-r--r-- | source/tools/acpihelp/ahmain.c | 38 | ||||
| -rw-r--r-- | source/tools/acpisrc/acpisrc.h | 5 | ||||
| -rw-r--r-- | source/tools/acpisrc/asfile.c | 1 | ||||
| -rw-r--r-- | source/tools/acpisrc/asmain.c | 1 | ||||
| -rw-r--r-- | source/tools/acpisrc/astable.c | 1 |
19 files changed, 519 insertions, 118 deletions
diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c index 452d2036e37a..b997a5cdae4f 100644 --- a/source/tools/acpibin/abcompare.c +++ b/source/tools/acpibin/abcompare.c @@ -42,7 +42,6 @@ */ #include "acpibin.h" -#include "acapps.h" ACPI_TABLE_HEADER Header1; diff --git a/source/tools/acpibin/abmain.c b/source/tools/acpibin/abmain.c index 53a1ffd325ef..5334bc002a3a 100644 --- a/source/tools/acpibin/abmain.c +++ b/source/tools/acpibin/abmain.c @@ -43,7 +43,6 @@ #define _DECLARE_GLOBALS #include "acpibin.h" -#include "acapps.h" /* Local prototypes */ diff --git a/source/tools/acpibin/acpibin.h b/source/tools/acpibin/acpibin.h index cc22be76fa69..679f1a5538bc 100644 --- a/source/tools/acpibin/acpibin.h +++ b/source/tools/acpibin/acpibin.h @@ -43,10 +43,7 @@ #include "acpi.h" #include "accommon.h" - -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> +#include "acapps.h" #define DB_CONSOLE_OUTPUT 0x02 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 diff --git a/source/tools/acpidump/acpidump.h b/source/tools/acpidump/acpidump.h index 0817338dac22..3fd4202c0713 100644 --- a/source/tools/acpidump/acpidump.h +++ b/source/tools/acpidump/acpidump.h @@ -55,12 +55,7 @@ #include "acpi.h" #include "accommon.h" #include "actables.h" - -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/stat.h> - +#include "acapps.h" /* Globals */ @@ -73,12 +68,6 @@ EXTERN ACPI_FILE INIT_GLOBAL (Gbl_OutputFile, NULL); EXTERN char INIT_GLOBAL (*Gbl_OutputFilename, NULL); EXTERN UINT64 INIT_GLOBAL (Gbl_RsdpBase, 0); -/* Globals required for use with ACPICA modules */ - -#ifdef _DECLARE_GLOBALS -UINT8 AcpiGbl_IntegerByteWidth = 8; -#endif - /* Action table used to defer requested options */ typedef struct ap_dump_action diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c index 58e430c5a41c..98ca3b6b4e5c 100644 --- a/source/tools/acpidump/apdump.c +++ b/source/tools/acpidump/apdump.c @@ -76,7 +76,7 @@ ApIsValidHeader ( if (!AcpiUtValidNameseg (Table->Signature)) { - AcpiLogError ("Table signature (0x%8.8X) is invalid\n", + fprintf (stderr, "Table signature (0x%8.8X) is invalid\n", *(UINT32 *) Table->Signature); return (FALSE); } @@ -85,7 +85,7 @@ ApIsValidHeader ( if (Table->Length < sizeof (ACPI_TABLE_HEADER)) { - AcpiLogError ("Table length (0x%8.8X) is invalid\n", + fprintf (stderr, "Table length (0x%8.8X) is invalid\n", Table->Length); return (FALSE); } @@ -131,7 +131,7 @@ ApIsValidChecksum ( if (ACPI_FAILURE (Status)) { - AcpiLogError ("%4.4s: Warning: wrong checksum in table\n", + fprintf (stderr, "%4.4s: Warning: wrong checksum in table\n", Table->Signature); } @@ -223,13 +223,13 @@ ApDumpTableBuffer ( * Note: simplest to just always emit a 64-bit address. AcpiXtract * utility can handle this. */ - AcpiUtFilePrintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n", + fprintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n", Table->Signature, ACPI_FORMAT_UINT64 (Address)); AcpiUtDumpBufferToFile (Gbl_OutputFile, ACPI_CAST_PTR (UINT8, Table), TableLength, DB_BYTE_DISPLAY, 0); - AcpiUtFilePrintf (Gbl_OutputFile, "\n"); + fprintf (Gbl_OutputFile, "\n"); return (0); } @@ -274,13 +274,13 @@ ApDumpAllTables ( } else if (i == 0) { - AcpiLogError ("Could not get ACPI tables, %s\n", + fprintf (stderr, "Could not get ACPI tables, %s\n", AcpiFormatException (Status)); return (-1); } else { - AcpiLogError ("Could not get ACPI table at index %u, %s\n", + fprintf (stderr, "Could not get ACPI table at index %u, %s\n", i, AcpiFormatException (Status)); continue; } @@ -330,7 +330,7 @@ ApDumpTableByAddress ( ACPI_MAX64_BYTE_WIDTH, &LongAddress); if (ACPI_FAILURE (Status)) { - AcpiLogError ("%s: Could not convert to a physical address\n", + fprintf (stderr, "%s: Could not convert to a physical address\n", AsciiAddress); return (-1); } @@ -339,7 +339,7 @@ ApDumpTableByAddress ( Status = AcpiOsGetTableByAddress (Address, &Table); if (ACPI_FAILURE (Status)) { - AcpiLogError ("Could not get table at 0x%8.8X%8.8X, %s\n", + fprintf (stderr, "Could not get table at 0x%8.8X%8.8X, %s\n", ACPI_FORMAT_UINT64 (Address), AcpiFormatException (Status)); return (-1); @@ -378,7 +378,7 @@ ApDumpTableByName ( if (strlen (Signature) != ACPI_NAME_SIZE) { - AcpiLogError ( + fprintf (stderr, "Invalid table signature [%s]: must be exactly 4 characters\n", Signature); return (-1); @@ -415,7 +415,7 @@ ApDumpTableByName ( return (0); } - AcpiLogError ( + fprintf (stderr, "Could not get ACPI table with signature [%s], %s\n", LocalSignature, AcpiFormatException (Status)); return (-1); @@ -467,7 +467,7 @@ ApDumpTableFromFile ( if (!AcpiUtValidNameseg (Table->Signature)) { - AcpiLogError ( + fprintf (stderr, "No valid ACPI signature was found in input file %s\n", Pathname); } @@ -476,7 +476,7 @@ ApDumpTableFromFile ( if (Table->Length > FileSize) { - AcpiLogError ( + fprintf (stderr, "Table length (0x%X) is too large for input file (0x%X) %s\n", Table->Length, FileSize, Pathname); goto Exit; @@ -484,7 +484,7 @@ ApDumpTableFromFile ( if (Gbl_VerboseMode) { - AcpiLogError ( + fprintf (stderr, "Input file: %s contains table [%4.4s], 0x%X (%u) bytes\n", Pathname, Table->Signature, FileSize, FileSize); } diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c index f26ef6b6ce6a..02de98238d72 100644 --- a/source/tools/acpidump/apfiles.c +++ b/source/tools/acpidump/apfiles.c @@ -42,7 +42,6 @@ */ #include "acpidump.h" -#include "acapps.h" /* Local prototypes */ @@ -74,7 +73,7 @@ ApIsExistingFile ( if (!stat (Pathname, &StatInfo)) { - AcpiLogError ("Target path already exists, overwrite? [y|n] "); + fprintf (stderr, "Target path already exists, overwrite? [y|n] "); if (getchar () != 'y') { @@ -116,10 +115,10 @@ ApOpenOutputFile ( /* Point stdout to the file */ - File = AcpiOsOpenFile (Pathname, ACPI_FILE_WRITING); + File = fopen (Pathname, "w"); if (!File) { - AcpiLogError ("Could not open output file: %s\n", Pathname); + fprintf (stderr, "Could not open output file: %s\n", Pathname); return (-1); } @@ -153,7 +152,7 @@ ApWriteToBinaryFile ( char Filename[ACPI_NAME_SIZE + 16]; char InstanceStr [16]; ACPI_FILE File; - size_t Actual; + ACPI_SIZE Actual; UINT32 TableLength; @@ -182,7 +181,7 @@ ApWriteToBinaryFile ( if (Instance > 0) { - AcpiUtSnprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance); + snprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance); strcat (Filename, InstanceStr); } @@ -190,30 +189,29 @@ ApWriteToBinaryFile ( if (Gbl_VerboseMode) { - AcpiLogError ( + fprintf (stderr, "Writing [%4.4s] to binary file: %s 0x%X (%u) bytes\n", Table->Signature, Filename, Table->Length, Table->Length); } /* Open the file and dump the entire table in binary mode */ - File = AcpiOsOpenFile (Filename, - ACPI_FILE_WRITING | ACPI_FILE_BINARY); + File = fopen (Filename, "wb"); if (!File) { - AcpiLogError ("Could not open output file: %s\n", Filename); + fprintf (stderr, "Could not open output file: %s\n", Filename); return (-1); } - Actual = AcpiOsWriteFile (File, Table, 1, TableLength); + Actual = fwrite (Table, 1, TableLength, File); if (Actual != TableLength) { - AcpiLogError ("Error writing binary output file: %s\n", Filename); - AcpiOsCloseFile (File); + fprintf (stderr, "Error writing binary output file: %s\n", Filename); + fclose (File); return (-1); } - AcpiOsCloseFile (File); + fclose (File); return (0); } @@ -239,15 +237,15 @@ ApGetTableFromFile ( ACPI_TABLE_HEADER *Buffer = NULL; ACPI_FILE File; UINT32 FileSize; - size_t Actual; + ACPI_SIZE Actual; /* Must use binary mode */ - File = AcpiOsOpenFile (Pathname, ACPI_FILE_READING | ACPI_FILE_BINARY); + File = fopen (Pathname, "rb"); if (!File) { - AcpiLogError ("Could not open input file: %s\n", Pathname); + fprintf (stderr, "Could not open input file: %s\n", Pathname); return (NULL); } @@ -256,7 +254,7 @@ ApGetTableFromFile ( FileSize = CmGetFileSize (File); if (FileSize == ACPI_UINT32_MAX) { - AcpiLogError ( + fprintf (stderr, "Could not get input file size: %s\n", Pathname); goto Cleanup; } @@ -266,18 +264,17 @@ ApGetTableFromFile ( Buffer = ACPI_ALLOCATE_ZEROED (FileSize); if (!Buffer) { - AcpiLogError ( + fprintf (stderr, "Could not allocate file buffer of size: %u\n", FileSize); goto Cleanup; } /* Read the entire file */ - Actual = AcpiOsReadFile (File, Buffer, 1, FileSize); + Actual = fread (Buffer, 1, FileSize, File); if (Actual != FileSize) { - AcpiLogError ( - "Could not read input file: %s\n", Pathname); + fprintf (stderr, "Could not read input file: %s\n", Pathname); ACPI_FREE (Buffer); Buffer = NULL; goto Cleanup; @@ -286,6 +283,6 @@ ApGetTableFromFile ( *OutFileSize = FileSize; Cleanup: - AcpiOsCloseFile (File); + fclose (File); return (Buffer); } diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c index 65d7b157815f..26a956e043a8 100644 --- a/source/tools/acpidump/apmain.c +++ b/source/tools/acpidump/apmain.c @@ -43,7 +43,6 @@ #define _DECLARE_GLOBALS #include "acpidump.h" -#include "acapps.h" /* @@ -161,7 +160,7 @@ ApInsertAction ( CurrentAction++; if (CurrentAction > AP_MAX_ACTIONS) { - AcpiLogError ("Too many table options (max %u)\n", AP_MAX_ACTIONS); + fprintf (stderr, "Too many table options (max %u)\n", AP_MAX_ACTIONS); return (-1); } @@ -215,7 +214,7 @@ ApDoOptions ( } else { - AcpiLogError ("%s: Cannot handle this switch, please use on|off\n", + fprintf (stderr, "%s: Cannot handle this switch, please use on|off\n", AcpiGbl_Optarg); return (-1); } @@ -241,7 +240,7 @@ ApDoOptions ( ACPI_MAX64_BYTE_WIDTH, &Gbl_RsdpBase); if (ACPI_FAILURE (Status)) { - AcpiLogError ("%s: Could not convert to a physical address\n", + fprintf (stderr, "%s: Could not convert to a physical address\n", AcpiGbl_Optarg); return (-1); } @@ -272,7 +271,7 @@ ApDoOptions ( case 'z': /* Verbose mode */ Gbl_VerboseMode = TRUE; - AcpiLogError (ACPI_COMMON_SIGNON (AP_UTILITY_NAME)); + fprintf (stderr, ACPI_COMMON_SIGNON (AP_UTILITY_NAME)); continue; /* @@ -355,6 +354,7 @@ acpi_main ( ACPI_DEBUG_INITIALIZE (); /* For debug version only */ AcpiOsInitialize (); Gbl_OutputFile = ACPI_FILE_OUT; + AcpiGbl_IntegerByteWidth = 8; /* Process command line options */ @@ -397,7 +397,7 @@ acpi_main ( default: - AcpiLogError ("Internal error, invalid action: 0x%X\n", + fprintf (stderr, "Internal error, invalid action: 0x%X\n", Action->ToBeDone); return (-1); } @@ -415,11 +415,11 @@ acpi_main ( /* Summary for the output file */ FileSize = CmGetFileSize (Gbl_OutputFile); - AcpiLogError ("Output file %s contains 0x%X (%u) bytes\n\n", + fprintf (stderr, "Output file %s contains 0x%X (%u) bytes\n\n", Gbl_OutputFilename, FileSize, FileSize); } - AcpiOsCloseFile (Gbl_OutputFile); + fclose (Gbl_OutputFile); } return (Status); diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index e573f73ebc46..8650707e294c 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -59,11 +59,6 @@ #include "amlresrc.h" #include "acapps.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <signal.h> - /* * Debug Regions diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c index 9b2f45d5d0d3..d41ba1412aa6 100644 --- a/source/tools/acpiexec/aeinitfile.c +++ b/source/tools/acpiexec/aeinitfile.c @@ -86,7 +86,8 @@ AeOpenInitializationFile ( InitFile = fopen (Filename, "r"); if (!InitFile) { - perror ("Could not open initialization file"); + fprintf (stderr, + "Could not open initialization file: %s\n", Filename); return (-1); } diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 22688c2452f4..d2c9d519aa49 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -42,7 +42,6 @@ */ #include "aecommon.h" -#include "errno.h" #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("aemain") @@ -59,7 +58,6 @@ * Windows: The setargv.obj module must be linked in to automatically * expand wildcards. */ -extern BOOLEAN AcpiGbl_DebugTimeout; /* Local prototypes */ @@ -68,7 +66,7 @@ AeDoOptions ( int argc, char **argv); -static ACPI_STATUS +static void AcpiDbRunBatchMode ( void); @@ -653,20 +651,23 @@ EnterDebugger: case AE_MODE_BATCH_SINGLE: AcpiDbExecute (BatchBuffer, NULL, NULL, EX_NO_SINGLE_STEP); - - /* Shut down the debugger */ - - AcpiTerminateDebugger (); - Status = AcpiTerminate (); break; } - (void) AcpiOsTerminate (); + /* Shut down the debugger and ACPICA */ + +#if 0 + + /* Temporarily removed */ + AcpiTerminateDebugger (); + Status = AcpiTerminate (); +#endif + + Status = AcpiOsTerminate (); return (0); ErrorExit: - (void) AcpiOsTerminate (); return (ExitCode); } @@ -679,18 +680,17 @@ ErrorExit: * to be executed. * Use only commas to separate elements of * particular command. - * RETURN: Status + * RETURN: None * * DESCRIPTION: For each command of list separated by ';' prepare the command * buffer and pass it to AcpiDbCommandDispatch. * *****************************************************************************/ -static ACPI_STATUS +static void AcpiDbRunBatchMode ( void) { - ACPI_STATUS Status; char *Ptr = BatchBuffer; char *Cmd = Ptr; UINT8 Run = 0; @@ -721,10 +721,4 @@ AcpiDbRunBatchMode ( Cmd = Ptr; } } - - /* Shut down the debugger */ - - AcpiTerminateDebugger (); - Status = AcpiTerminate (); - return (Status); } diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h index 19f005265cee..20055674762d 100644 --- a/source/tools/acpihelp/acpihelp.h +++ b/source/tools/acpihelp/acpihelp.h @@ -49,17 +49,11 @@ #include "accommon.h" #include "acapps.h" -#include <stdio.h> -#include <sys/stat.h> #include <sys/types.h> -#include <fcntl.h> -#include <ctype.h> -#include <string.h> #ifdef WIN32 #include <io.h> #include <direct.h> #endif -#include <errno.h> typedef enum @@ -70,9 +64,11 @@ typedef enum AH_DECODE_PREDEFINED_NAME, AH_DECODE_AML, AH_DECODE_AML_OPCODE, - AH_DISPLAY_DEVICE_IDS, - AH_DECODE_EXCEPTION, + AH_DECODE_AML_TYPE, AH_DECODE_ASL_AML, + AH_DECODE_EXCEPTION, + + AH_DISPLAY_DEVICE_IDS, AH_DISPLAY_UUIDS, AH_DISPLAY_TABLES, AH_DISPLAY_DIRECTIVES @@ -96,6 +92,13 @@ typedef struct ah_aml_opcode } AH_AML_OPCODE; +typedef struct ah_aml_type +{ + char *Name; + char *Description; + +} AH_AML_TYPE; + typedef struct ah_asl_operator { char *Name; @@ -120,6 +123,7 @@ 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[]; @@ -156,6 +160,10 @@ AhFindAslKeywords ( char *Name); void +AhFindAmlTypes ( + char *Name); + +void AhDisplayDeviceIds ( char *Name); diff --git a/source/tools/acpihelp/ahamlops.c b/source/tools/acpihelp/ahamlops.c index 8ca28728c572..57a0963c1f29 100644 --- a/source/tools/acpihelp/ahamlops.c +++ b/source/tools/acpihelp/ahamlops.c @@ -43,6 +43,7 @@ #include "acpihelp.h" + /* * AML opcodes with related syntax and grammar information. * This table was extracted from the ACPI specification. diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index ec22e4964fa5..5f422904a53c 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -81,6 +81,10 @@ AhDisplayAmlOpcode ( const AH_AML_OPCODE *Op); static void +AhDisplayAmlType ( + const AH_AML_TYPE *Op); + +static void AhDisplayAslOperator ( const AH_ASL_OPERATOR *Op); @@ -152,7 +156,7 @@ AhFindPredefinedNames ( char Name[9]; - if (!NamePrefix) + if (!NamePrefix || (NamePrefix[0] == '*')) { Found = AhDisplayPredefinedName (NULL, 0); return; @@ -356,7 +360,7 @@ AhFindAmlOpcode ( continue; } - if (!Name) + if (!Name || (Name[0] == '*')) { AhDisplayAmlOpcode (Op); Found = TRUE; @@ -503,6 +507,122 @@ AhDisplayAmlOpcode ( /******************************************************************************* * + * 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. @@ -527,7 +647,7 @@ AhFindAslKeywords ( for (Keyword = AslKeywordInfo; Keyword->Name; Keyword++) { - if (!Name) + if (!Name || (Name[0] == '*')) { AhDisplayAslKeyword (Keyword); Found = TRUE; @@ -644,7 +764,7 @@ AhFindAslOperators ( for (Operator = AslOperatorInfo; Operator->Name; Operator++) { - if (!Name) + if (!Name || (Name[0] == '*')) { AhDisplayAslOperator (Operator); MatchCount++; @@ -859,7 +979,7 @@ AhDisplayDeviceIds ( /* Null input name indicates "display all" */ - if (!Name) + if (!Name || (Name[0] == '*')) { printf ("ACPI and PNP Device/Hardware IDs:\n\n"); for (Info = AslDeviceIds; Info->Name; Info++) diff --git a/source/tools/acpihelp/ahgrammar.c b/source/tools/acpihelp/ahgrammar.c new file mode 100644 index 000000000000..1e0d54974689 --- /dev/null +++ b/source/tools/acpihelp/ahgrammar.c @@ -0,0 +1,289 @@ +/****************************************************************************** + * + * Module Name: ahgrammar - AML grammar items + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, 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 "acpihelp.h" + +const AH_AML_TYPE AmlTypesInfo[] = +{ + {"ComputationalData", + "ComputationalData :=\n" + "ByteConst | WordConst | DWordConst | QWordConst |\n" + "String | ConstObj | RevisionOp | DefBuffer\n\n" + "DataObject := ComputationalData | DefPackage | DefVarPackage\n" + "DataRefObject := DataObject | ObjectReference | DDBHandle\n\n" + + "ByteConst := BytePrefix ByteData\n" + "BytePrefix := 0x0A\n" + "ByteList := Nothing | <ByteData ByteList>\n" + "ByteData := 0x00 - 0xFF\n\n" + + "WordConst := WordPrefix WordData\n" + "WordPrefix := 0x0B\n" + "WordData := 0x0000-0xFFFF\n\n" + + "DWordConst := DWordPrefix DWordData\n" + "DWordPrefix := 0x0C\n" + "DWordData := 0x00000000-0xFFFFFFFF\n\n" + + "QWordConst := QWordPrefix QWordData\n" + "QWordPrefix := 0x0E\n" + "QWordData := 0x0000000000000000-0xFFFFFFFFFFFFFFFF\n\n" + + "String := StringPrefix AsciiCharList NullChar\n" + "StringPrefix := 0x0D\n" + "AsciiCharList := Nothing | <AsciiChar AsciiCharList>\n" + "AsciiChar := 0x01 - 0x7F\n" + "NullChar := 0x00\n\n" + + "ConstObj := ZeroOp | OneOp | OnesOp\n\n"}, + + {"DefinitionBlock", + "DefinitionBlockHeader :=\n" + "TableSignature TableLength SpecCompliance Checksum\n" + "OemID OemTableID OemRevision CreatorID CreatorRevision\n\n" + + "TableSignature := AsciiChar AsciiChar AsciiChar AsciiChar\n" + "TableLength := DWordData\n" + "// Length of the table in bytes including\n" + "// the block header.\n\n" + + "SpecCompliance := ByteData\n" + "// The revision of the structure\n\n" + + "CheckSum := ByteData\n" + "// Byte checksum of the entire table\n\n" + + "OemID := ByteData(6)\n" + "// OEM ID of up to 6 characters. If the OEM\n" + "// ID is shorter than 6 characters, it\n" + "// can be terminated with a NULL\n" + "// character.\n\n" + + "OemTableID := ByteData(8)\n" + "// OEM Table ID of up to 8 characters. If\n" + "// the OEM Table ID is shorter than 8\n" + "// characters, it can be terminated with\n" + "// a NULL character.\n" + "OemRevision := DWordData\n" + "// OEM Table Revision\n\n" + "CreatorID := DWordData\n" + "// Vendor ID of the ASL compiler\n" + "CreatorRevision := DWordData\n" + "// Revision of the ASL compiler\n"}, + + {"FieldFlags", + "FieldFlags := ByteData\n" + "// bits 0-3: AccessType\n" + "// 0 AnyAcc\n" + "// 1 ByteAcc\n" + "// 2 WordAcc\n" + "// 3 DWordAcc\n" + "// 4 QWordAcc\n" + "// 5 BufferAcc\n" + "// 6 Reserved\n" + "// 7 Reserved\n" + "// bit 4: LockRule\n" + "// 0 NoLock\n" + "// 1 Lock\n" + "// bits 5-6: UpdateRule\n" + "// 0 Preserve\n" + "// 1 WriteAsOnes\n" + "// 2 WriteAsZeros\n" + "// bit 7:\n" + "// 0 Reserved (must be 0)\n"}, + + {"FieldList", + "FieldList := Nothing | <FieldElement FieldList>\n\n" + "FieldElement := NamedField | ReservedField | AccessField |\n" + " ExtendedAccessField | ConnectField\n\n" + "NamedField := NameSeg PkgLength\n" + "ReservedField := 0x00 PkgLength\n\n" + + "AccessField := 0x01 AccessType\n" + "AccessField := 0x01 AccessType AccessAttrib\n\n" + + "AccessType := ByteData\n" + "// Bits 0:3 - Same as AccessType bits of FieldFlags.\n" + "// Bits 4:5 - Reserved\n" + "// Bits 7:6 - 0 = AccessAttribute\n" + "// Normal Access Attributes\n" + "// 1 = AttribBytes (x)\n" + "// 2 = AttribRawBytes (x)\n" + "// 3 = AttribRawProcessBytes (x)\n" + "// Note: 'x' is encoded as bits 0:7 of the AccessAttrib byte.\n\n" + + "AccessAttrib := ByteData\n" + "// bits 0:7: Byte length\n" + "//\n" + "// If AccessType is BufferAcc for the SMB or\n" + "// GPIO OpRegions, AccessAttrib can be one of\n" + "// the following values:\n" + "// 0x02 AttribQuick\n" + "// 0x04 AttribSendReceive\n" + "// 0x06 AttribByte\n" + "// 0x08 AttribWord\n" + "// 0x0A AttribBlock\n" + "// 0x0C AttribProcessCall\n" + "// 0x0D AttribBlockProcessCall\n\n" + + "ExtendedAccessField := 0x03 AccessType ExtendedAccessAttrib AccessLength\n" + "ExtendedAccessAttrib := ByteData\n" + "// 0x0B AttribBytes\n" + "// 0x0E AttribRawBytes\n" + "// 0x0F AttribRawProcess\n\n" + + "ConnectField := 0x02 NameString> | <0x02 BufferData\n"}, + + {"MatchOpcode", + "DefMatch := MatchOp SearchPkg MatchOpcode Operand MatchOpcode Operand StartIndex\n" + "MatchOp := 0x89\n" + "SearchPkg := TermArg => Package\n" + "MatchOpcode := ByteData\n" + "// 0 MTR\n" + "// 1 MEQ\n" + "// 2 MLE\n" + "// 3 MLT\n" + "// 4 MGE\n" + "// 5 MGT\n"}, + + {"MethodFlags", + "DefMethod := MethodOp PkgLength NameString MethodFlags TermList\n" + "MethodOp := 0x14\n" + "MethodFlags := ByteData\n" + "// bit 0-2: ArgCount (0-7)\n" + "// bit 3: SerializeFlag\n" + "// 0 NotSerialized\n" + "// 1 Serialized\n" + "// bit 4-7: SyncLevel (0x00-0x0f)\n"}, + + {"Miscellaneous", + "ZeroOp := 0x00\n" + "OneOp := 0x01\n" + "OnesOp := 0xFF\n" + "RevisionOp := ExtOpPrefix 0x30\n" + "ExtOpPrefix := 0x5B\n"}, + + {"NameSeg", + "NameSeg := <LeadNameChar NameChar NameChar NameChar>\n" + "// Note: NameSegs shorter than 4 characters are filled with\n" + "// trailing underscores.\n\n" + "NameChar := DigitChar | LeadNameChar\n" + "LeadNameChar := 'A'-'Z' | '_' (0x41 - 0x5A) | (0x5F)\n" + "DigitChar := '0'-'9' (0x30 - 0x39)\n"}, + + {"NameString", + "NameString := <RootChar NamePath> | <PrefixPath NamePath>\n" + "PrefixPath := Nothing | <ParentPrefixChar PrefixPath>\n" + "RootChar := '\\' (0x5C)\n" + "ParentPrefixChar := '^' (0x5E)\n"}, + + {"NamePath", + "NamePath := NameSeg | DualNamePath | MultiNamePath | NullName\n" + "DualNamePath := DualNamePrefix NameSeg NameSeg\n" + "DualNamePrefix := 0x2E\n" + "MultiNamePath := MultiNamePrefix SegCount NameSeg(SegCount)\n" + "MultiNamePrefix := 0x2F\n" + "SegCount := ByteData\n" + "// Note: SegCount can be from 1 to 255. For example: MultiNamePrefix(35)\n" + "// is encoded as 0x2f 0x23 and followed by 35 NameSegs. So, the total\n" + "// encoding length will be 1 + 1 + (35 * 4) = 142. Notice that:\n" + "// DualNamePrefix NameSeg NameSeg has a smaller encoding than the\n" + "// encoding of: MultiNamePrefix(2) NameSeg NameSeg\n\n" + + "SimpleName := NameString | ArgObj | LocalObj\n" + "SuperName := SimpleName | DebugObj | Type6Opcode\n" + "NullName := 0x00\n" + "Target := SuperName | NullName\n"}, + + {"PkgLength", + "PkgLength := PkgLeadByte |\n" + "<PkgLeadByte ByteData> |\n" + "<PkgLeadByte ByteData ByteData> |\n" + "<PkgLeadByte ByteData ByteData ByteData>\n\n" + + "PkgLeadByte :=\n" + "bit 7-6: Count of ByteData that follows (0-3)\n" + "bit 5-4: Only used if (PkgLength < 63)\n" + "bit 3-0: Least significant package length nybble\n" + "// Note: The high 2 bits of the first byte reveal how many follow bytes\n" + "// are in the PkgLength. If the PkgLength has only one byte, bit 0 through 5\n" + "// are used to encode the package length (in other words, values 0-63). If\n" + "// the package length value is more than 63, more than one byte must be\n" + "// used for the encoding in which case bit 4 and 5 of the PkgLeadByte are\n" + "// reserved and must be zero. If the multiple bytes encoding is used, bits\n" + "// 0-3 of the PkgLeadByte become the least significant 4 bits of the\n" + "// resulting package length value. The next ByteData will become the next\n" + "// least significant 8 bits of the resulting value and so on, up to 3\n" + "// ByteData bytes. Thus, the maximum package length is 2**28.\n"}, + + {"RegionSpace", + "RegionSpace := ByteData\n" + "// 0x00 SystemMemory\n" + "// 0x01 SystemIO\n" + "// 0x02 PCI_Config\n" + "// 0x03 EmbeddedControl\n" + "// 0x04 SMBus\n" + "// 0x05 SystemCMOS\n" + "// 0x06 PciBarTarget\n" + "// 0x07 IPMI\n" + "// 0x08 GeneralPurposeIO\n" + "// 0x09 GenericSerialBus\n" + "// 0x0A Platform Communications Channel\n" + "// 0x0B-0x7E: Reserved\n" + "// 0x7F: Functional Fixed Hardware\n" + "// 0x80-0xBF: Reserved\n" + "// 0xC0-0xFF: OEM Defined\n"}, + + {"TermObj", + "TermObj := NameSpaceModifierObj | NamedObj | Type1Opcode | Type2Opcode\n" + "TermList := Nothing | <TermObj TermList>\n\n" + + "MethodInvocation := NameString TermArgList\n" + "TermArgList := Nothing | <TermArg TermArgList>\n" + "TermArg := Type2Opcode | DataObject | ArgObj | LocalObj\n\n" + + "ObjectList := Nothing | <Object ObjectList>\n" + "Object := NameSpaceModifierObj | NamedObj\n"}, + + {NULL, NULL} +}; diff --git a/source/tools/acpihelp/ahmain.c b/source/tools/acpihelp/ahmain.c index 4538ae4ea203..1c45e436269e 100644 --- a/source/tools/acpihelp/ahmain.c +++ b/source/tools/acpihelp/ahmain.c @@ -51,9 +51,16 @@ AhDisplayUsage ( void); #define AH_UTILITY_NAME "ACPI Help Utility" -#define AH_SUPPORTED_OPTIONS "adehikmopstuv" +#define AH_SUPPORTED_OPTIONS "adeghikmopstuv" +#if defined ACPI_OPTION +#undef ACPI_OPTION +#endif + +#define ACPI_OPTION(Name, Description) \ + AcpiOsPrintf (" %-24s%s\n", Name, Description); + /****************************************************************************** * * FUNCTION: AhDisplayUsage @@ -71,21 +78,22 @@ AhDisplayUsage ( ACPI_OPTION ("-h", "Display help"); ACPI_OPTION ("-v", "Display version information"); - ACPI_USAGE_TEXT ("\nAML (ACPI Machine Language) Names and Encodings:\n"); - ACPI_OPTION ("-a [Name/Prefix]", "Find/Display both ASL operator and AML opcode name(s)"); - ACPI_OPTION ("-m [Name/Prefix]", "Find/Display AML opcode name(s)"); + ACPI_USAGE_TEXT ("\nAML Names and Encodings (ACPI Machine Language):\n"); + ACPI_OPTION ("-a [Name/Prefix | *]", "Display both ASL operator and AML opcode name(s)"); + ACPI_OPTION ("-g [Name/Prefix | *]", "Display AML grammar elements(s)"); + ACPI_OPTION ("-m [Name/Prefix | *]", "Display AML opcode name(s)"); ACPI_USAGE_TEXT ("\nACPI Values:\n"); ACPI_OPTION ("-e [HexValue]", "Decode ACPICA exception code"); ACPI_OPTION ("-o [HexValue]", "Decode hex AML opcode"); - ACPI_USAGE_TEXT ("\nASL (ACPI Source Language) Names and Symbols:\n"); - ACPI_OPTION ("-k [Name/Prefix]", "Find/Display ASL non-operator keyword(s)"); - ACPI_OPTION ("-p [Name/Prefix]", "Find/Display ASL predefined method name(s)"); - ACPI_OPTION ("-s [Name/Prefix]", "Find/Display ASL operator name(s)"); + ACPI_USAGE_TEXT ("\nASL Names and Symbols (ACPI Source Language):\n"); + ACPI_OPTION ("-k [Name/Prefix | *]", "Display ASL non-operator keyword(s)"); + ACPI_OPTION ("-p [Name/Prefix | *]", "Display ASL predefined method name(s)"); + ACPI_OPTION ("-s [Name/Prefix | *]", "Display ASL operator name(s)"); - ACPI_USAGE_TEXT ("\nOther ACPI Names:\n"); - ACPI_OPTION ("-i [Name/Prefix]", "Find/Display ACPI/PNP Hardware ID(s)"); + ACPI_USAGE_TEXT ("\nOther miscellaneous ACPI Names:\n"); + ACPI_OPTION ("-i [Name/Prefix | *]", "Display ACPI/PNP Hardware ID(s)"); ACPI_OPTION ("-d", "Display iASL Preprocessor directives"); ACPI_OPTION ("-t", "Display supported ACPI tables"); ACPI_OPTION ("-u", "Display ACPI-related UUIDs"); @@ -145,6 +153,11 @@ main ( DecodeType = AH_DECODE_EXCEPTION; break; + case 'g': + + DecodeType = AH_DECODE_AML_TYPE; + break; + case 'i': DecodeType = AH_DISPLAY_DEVICE_IDS; @@ -217,6 +230,11 @@ main ( AhDecodeAmlOpcode (Name); break; + case AH_DECODE_AML_TYPE: + + AhFindAmlTypes (Name); + break; + case AH_DECODE_PREDEFINED_NAME: AhFindPredefinedNames (Name); diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h index ea1161f0075a..78a215ed6868 100644 --- a/source/tools/acpisrc/acpisrc.h +++ b/source/tools/acpisrc/acpisrc.h @@ -43,10 +43,7 @@ #include "acpi.h" #include "accommon.h" - -#include <stdio.h> -#include <sys/stat.h> -#include <errno.h> +#include "acapps.h" /* mkdir support */ diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c index 2c595735fccc..b8f0501d6c48 100644 --- a/source/tools/acpisrc/asfile.c +++ b/source/tools/acpisrc/asfile.c @@ -42,7 +42,6 @@ */ #include "acpisrc.h" -#include "acapps.h" /* Local prototypes */ diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c index f64e95f5fc05..5554f69d02cd 100644 --- a/source/tools/acpisrc/asmain.c +++ b/source/tools/acpisrc/asmain.c @@ -42,7 +42,6 @@ */ #include "acpisrc.h" -#include "acapps.h" /* Local prototypes */ diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 63e78f92e522..a6c0a5c517e9 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -42,7 +42,6 @@ */ #include "acpisrc.h" -#include "acapps.h" /****************************************************************************** |
