From 0ff2ef6cfe11e98b10c26dc8f1c359e6502538c8 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Thu, 4 Apr 2013 21:18:57 +0000 Subject: [PATCH] Import ACPICA 20130328. --- changes.txt | 75 ++ generate/unix/acpiexec/Makefile | 1 + generate/unix/acpihelp/Makefile | 3 +- generate/unix/iasl/Makefile | 3 + source/common/ahpredef.c | 4 +- source/compiler/aslcompile.c | 3 + source/compiler/aslcompiler.h | 73 +- source/compiler/asldefine.h | 6 + source/compiler/aslerror.c | 28 +- source/compiler/aslfiles.c | 21 + source/compiler/aslglobal.h | 4 +- source/compiler/asllisting.c | 846 +++-------------- source/compiler/asllistsup.c | 706 ++++++++++++++ source/compiler/aslmain.c | 8 + source/compiler/asloffset.c | 326 +++++++ source/compiler/aslpredef.c | 266 ++---- source/compiler/aslprepkg.c | 26 +- source/compiler/aslresource.c | 1 + source/compiler/asltypes.h | 5 +- source/compiler/aslwalks.c | 6 +- source/components/debugger/dbmethod.c | 2 +- source/components/debugger/dbnames.c | 8 +- source/components/dispatcher/dsopcode.c | 2 +- source/components/dispatcher/dswexec.c | 2 +- source/components/events/evevent.c | 2 +- source/components/executer/exoparg2.c | 10 +- source/components/namespace/nseval.c | 26 +- source/components/namespace/nspredef.c | 121 +-- source/components/tables/tbfadt.c | 4 + source/components/tables/tbxface.c | 22 +- source/components/utilities/utdelete.c | 96 +- source/components/utilities/utmutex.c | 10 +- source/components/utilities/utosi.c | 29 +- source/components/utilities/utpredef.c | 451 +++++++++ source/components/utilities/utxface.c | 20 +- source/include/acglobal.h | 1 + source/include/aclocal.h | 12 +- source/include/acnamesp.h | 4 - source/include/acpixf.h | 2 +- source/include/acpredef.h | 1138 ++++++++++++++++------- source/include/acutils.h | 37 +- source/tools/acpihelp/ahdecode.c | 97 +- source/tools/acpisrc/astable.c | 1 + 43 files changed, 2955 insertions(+), 1553 deletions(-) create mode 100644 source/compiler/asllistsup.c create mode 100644 source/compiler/asloffset.c create mode 100644 source/components/utilities/utpredef.c diff --git a/changes.txt b/changes.txt index cf247faf826e..dd8b8067f191 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,78 @@ +---------------------------------------- +28 March 2013. Summary of changes for version 20130328: + +1) ACPICA kernel-resident subsystem: + +Fixed several possible race conditions with the internal object reference +counting mechanism. Some of the external ACPICA interfaces update object +reference counts without holding the interpreter or namespace lock. This +change adds a spinlock to protect reference count updates on the internal +ACPICA objects. Reported by and with assistance from Andriy Gapon +(avg@FreeBSD.org). + +FADT support: Removed an extraneous warning for very large GPE register +sets. This change removes a size mismatch warning if the legacy length +field for a GPE register set is larger than the 64-bit GAS structure can +accommodate. GPE register sets can be larger than the 255-bit width +limitation of the GAS structure. Linn Crosetto (linn@hp.com). + +_OSI Support: handle any errors from AcpiOsAcquireMutex. Check for error +return from this interface. Handles a possible timeout case if +ACPI_WAIT_FOREVER is modified by the host to be a value less than +"forever". Jung-uk Kim. + +Predefined name support: Add allowed/required argument type information to +the master predefined info table. This change adds the infrastructure to +enable typechecking on incoming arguments for all predefined +methods/objects. It does not actually contain the code that will fully +utilize this information, this is still under development. Also condenses +some duplicate code for the predefined names into a new module, +utilities/utpredef.c + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Previous Release: + Non-Debug Version: 95.0K Code, 25.9K Data, 120.9K Total + Debug Version: 182.9K Code, 75.6K Data, 258.5K Total + Current Release: + Non-Debug Version: 95.2K Code, 26.4K Data, 121.6K Total + Debug Version: 183.0K Code, 76.0K Data, 259.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented a new option to simplify the development of ACPI-related +BIOS code. Adds support for a new "offset table" output file. The -so +option will create a C table containing the AML table offsets of various +named objects in the namespace so that BIOS code can modify them easily at +boot time. This can simplify BIOS runtime code by eliminating expensive +searches for "magic values", enhancing boot times and adding greater +reliability. With assistance from Lee Hamel. + +iASL: Allow additional predefined names to return zero-length packages. +Now, all predefined names that are defined by the ACPI specification to +return a "variable-length package of packages" are allowed to return a +zero length top-level package. This allows the BIOS to tell the host that +the requested feature is not supported, and supports existing BIOS/ASL +code and practices. + +iASL: Changed the "result not used" warning to an error. This is the case +where an ASL operator is effectively a NOOP because the result of the +operation is not stored anywhere. For example: + Add (4, Local0) +There is no target (missing 3rd argument), nor is the function return +value used. This is potentially a very serious problem -- since the code +was probably intended to do something, but for whatever reason, the value +was not stored. Therefore, this issue has been upgraded from a warning to +an error. + +AcpiHelp: Added allowable/required argument types to the predefined names +info display. This feature utilizes the recent update to the predefined +names table (above). + ---------------------------------------- 14 February 2013. Summary of changes for version 20130214: diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 5ac3da32641c..c6bd9109379e 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -202,6 +202,7 @@ OBJECTS = \ $(OBJDIR)/utobject.o\ $(OBJDIR)/utosi.o\ $(OBJDIR)/utownerid.o\ + $(OBJDIR)/utpredef.o\ $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ diff --git a/generate/unix/acpihelp/Makefile b/generate/unix/acpihelp/Makefile index 817cf98feabe..2dbd13b0151d 100644 --- a/generate/unix/acpihelp/Makefile +++ b/generate/unix/acpihelp/Makefile @@ -34,7 +34,8 @@ OBJECTS = \ $(OBJDIR)/ahpredef.o\ $(OBJDIR)/ahmain.o\ $(OBJDIR)/getopt.o\ - $(OBJDIR)/utexcep.o + $(OBJDIR)/utexcep.o\ + $(OBJDIR)/utpredef.o # # Flags specific to acpihelp diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 0f66301b11b7..e7761c2769c3 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -58,12 +58,14 @@ OBJECTS = \ $(OBJDIR)/aslhex.o\ $(OBJDIR)/asllength.o\ $(OBJDIR)/asllisting.o\ + $(OBJDIR)/asllistsup.o\ $(OBJDIR)/aslload.o\ $(OBJDIR)/asllookup.o\ $(OBJDIR)/aslmain.o\ $(OBJDIR)/aslmap.o\ $(OBJDIR)/aslmethod.o\ $(OBJDIR)/aslnamesp.o\ + $(OBJDIR)/asloffset.o\ $(OBJDIR)/aslopcodes.o\ $(OBJDIR)/asloperands.o\ $(OBJDIR)/aslopt.o\ @@ -188,6 +190,7 @@ OBJECTS = \ $(OBJDIR)/utmutex.o\ $(OBJDIR)/utobject.o\ $(OBJDIR)/utownerid.o\ + $(OBJDIR)/utpredef.o\ $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ diff --git a/source/common/ahpredef.c b/source/common/ahpredef.c index 80332805b1b4..15cc27aa1112 100644 --- a/source/common/ahpredef.c +++ b/source/common/ahpredef.c @@ -61,7 +61,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = { AH_PREDEF ("_ACx", "Active Cooling", "Returns the active cooling policy threshold values"), - AH_PREDEF ("_ADR", "Address", "Returns the address of a device on its parent bus"), + AH_PREDEF ("_ADR", "Address", "Returns address of a device on parent bus, and resource field"), AH_PREDEF ("_AEI", "ACPI Event Interrupts", "Returns a list of GPIO events to be used as ACPI events"), AH_PREDEF ("_ALC", "Ambient Light Chromaticity", "Returns the ambient light color chromaticity"), AH_PREDEF ("_ALI", "Ambient Light Illuminance", "Returns the ambient light brightness"), @@ -113,7 +113,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_DGS", "Display Graphics State", "Return the current state of the output device"), AH_PREDEF ("_DIS", "Disable Device", "Disables a device"), AH_PREDEF ("_DLM", "Device Lock Mutex", "Defines mutex for OS/AML sharing"), - AH_PREDEF ("_DMA", "Direct Memory Access", "Returns a device's current resources for DMA transactions"), + AH_PREDEF ("_DMA", "Direct Memory Access", "Returns device current resources for DMA transactions, and resource field"), AH_PREDEF ("_DOD", "Display Output Devices", "Enumerate all devices attached to the display adapter"), AH_PREDEF ("_DOS", "Disable Output Switching", "Sets the display output switching mode"), AH_PREDEF ("_DPL", "Device Selection Polarity", "Polarity of Device Selection signal, Resource Descriptor field"), diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index c7528704f92a..73b67322a796 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -126,6 +126,7 @@ AslCompilerSignon ( break; case ASL_FILE_C_SOURCE_OUTPUT: + case ASL_FILE_C_OFFSET_OUTPUT: case ASL_FILE_C_INCLUDE_OUTPUT: Prefix = " * "; @@ -199,6 +200,7 @@ AslCompilerFileHeader ( break; case ASL_FILE_C_SOURCE_OUTPUT: + case ASL_FILE_C_OFFSET_OUTPUT: case ASL_FILE_C_INCLUDE_OUTPUT: Prefix = " * "; @@ -222,6 +224,7 @@ AslCompilerFileHeader ( switch (FileId) { case ASL_FILE_C_SOURCE_OUTPUT: + case ASL_FILE_C_OFFSET_OUTPUT: case ASL_FILE_C_INCLUDE_OUTPUT: FlPrintFile (FileId, " */\n"); break; diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 4f899fc5dad2..cfe3ecf0c5d2 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -349,12 +349,6 @@ void LsDoListings ( void); -void -LsDumpAsciiInComment ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer); - void LsWriteNodeToAsmListing ( ACPI_PARSE_OBJECT *Op); @@ -369,6 +363,55 @@ LsDumpParseTree ( void); +/* + * asllistsup - Listing file support utilities + */ +void +LsDumpAscii ( + UINT32 FileId, + UINT32 Count, + UINT8 *Buffer); + +void +LsDumpAsciiInComment ( + UINT32 FileId, + UINT32 Count, + UINT8 *Buffer); + +void +LsCheckException ( + UINT32 LineNumber, + UINT32 FileId); + +void +LsFlushListingBuffer ( + UINT32 FileId); + +void +LsWriteListingHexBytes ( + UINT8 *Buffer, + UINT32 Length, + UINT32 FileId); + +void +LsWriteSourceLines ( + UINT32 ToLineNumber, + UINT32 ToLogicalLineNumber, + UINT32 FileId); + +UINT32 +LsWriteOneSourceLine ( + UINT32 FileId); + +void +LsPushNode ( + char *Filename); + +ASL_LISTING_NODE * +LsPopNode ( + void); + + /* * aslhex - generate all "hex" output files (C, ASM, ASL) */ @@ -387,6 +430,24 @@ OpcAmlConstantWalk ( void *Context); +/* + * asloffset - generate C offset file for BIOS support + */ +ACPI_STATUS +LsAmlOffsetWalk ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +void +LsDoOffsetTableHeader ( + UINT32 FileId); + +void +LsDoOffsetTableFooter ( + UINT32 FileId); + + /* * aslopcodes - generate AML opcodes */ diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 75c8fad0e197..76e2e12e7cd7 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -120,6 +120,7 @@ #define FILE_SUFFIX_ASM_INCLUDE "inc" #define FILE_SUFFIX_C_INCLUDE "h" #define FILE_SUFFIX_ASL_CODE "asl" +#define FILE_SUFFIX_C_OFFSET "offset.h" /* Types for input files */ @@ -138,6 +139,11 @@ #define ASL_EOF ACPI_UINT32_MAX +/* Listings */ + +#define ASL_LISTING_LINE_PREFIX ": " + + /* Support for reserved method names */ #define ACPI_VALID_RESERVED_NAME_MAX 0x80000000 diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 551a2a54d0fa..5b3b483e33e2 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -302,12 +302,25 @@ AePrintException ( } else { - while (RActual && SourceByte && (SourceByte != '\n') && (Total < 256)) + /* Read/write the source line, up to the maximum line length */ + + while (RActual && SourceByte && (SourceByte != '\n')) { - if (fwrite (&SourceByte, 1, 1, OutputFile) != 1) + if (Total < 256) { - printf ("[*** iASL: Write error on output file ***]\n"); - return; + /* After the max line length, we will just read the line, no write */ + + if (fwrite (&SourceByte, 1, 1, OutputFile) != 1) + { + printf ("[*** iASL: Write error on output file ***]\n"); + return; + } + } + else if (Total == 256) + { + fprintf (OutputFile, + "\n[*** iASL: Very long input line, message below refers to column %u ***]", + Enode->Column); } RActual = fread (&SourceByte, 1, 1, SourceFile); @@ -320,13 +333,6 @@ AePrintException ( } Total++; } - - if (Total >= 256) - { - fprintf (OutputFile, - "\n[*** iASL: Long input line, an error occurred at column %u ***]", - Enode->Column); - } } } } diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 5676df15af82..0881fd46af5f 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -675,6 +675,27 @@ FlOpenMiscOutputFiles ( AslCompilerFileHeader (ASL_FILE_C_SOURCE_OUTPUT); } + /* Create/Open a C code source output file for the offset table if asked */ + + if (Gbl_C_OffsetTableFlag) + { + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_OFFSET); + if (!Filename) + { + AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + + /* Open the C code source file, text mode */ + + FlOpenFile (ASL_FILE_C_OFFSET_OUTPUT, Filename, "w+t"); + + FlPrintFile (ASL_FILE_C_OFFSET_OUTPUT, "/*\n"); + AslCompilerSignon (ASL_FILE_C_OFFSET_OUTPUT); + AslCompilerFileHeader (ASL_FILE_C_OFFSET_OUTPUT); + } + /* Create/Open a assembly include output file if asked */ if (Gbl_AsmIncludeOutputFlag) diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 1b1f67c9d512..c15c669b2272 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -86,7 +86,8 @@ ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] = {NULL, NULL, "ASM Source: ", "Assembly Code Output"}, {NULL, NULL, "C Source: ", "C Code Output"}, {NULL, NULL, "ASM Include: ", "Assembly Header Output"}, - {NULL, NULL, "C Include: ", "C Header Output"} + {NULL, NULL, "C Include: ", "C Header Output"}, + {NULL, NULL, "Offset Table: ", "C Offset Table Output"} }; #else @@ -143,6 +144,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OffsetTableFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE); diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c index 4e7bb48d6337..04c517960282 100644 --- a/source/compiler/asllisting.c +++ b/source/compiler/asllisting.c @@ -41,23 +41,22 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include "aslcompiler.h" #include "aslcompiler.y.h" #include "amlcode.h" #include "acparser.h" #include "acnamesp.h" + #define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslisting") + ACPI_MODULE_NAME ("asllisting") + /* Local prototypes */ static void -LsDumpAscii ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer); +LsGenerateListing ( + UINT32 FileId); static ACPI_STATUS LsAmlListingWalk ( @@ -65,66 +64,27 @@ LsAmlListingWalk ( UINT32 Level, void *Context); -static void -LsGenerateListing ( - UINT32 FileId); - -static void -LsPushNode ( - char *Filename); - -static ASL_LISTING_NODE * -LsPopNode ( - void); - -static void -LsCheckException ( - UINT32 LineNumber, - UINT32 FileId); - -static void -LsFlushListingBuffer ( - UINT32 FileId); - -static void -LsWriteListingHexBytes ( - UINT8 *Buffer, - UINT32 Length, - UINT32 FileId); - -static UINT32 -LsWriteOneSourceLine ( - UINT32 FileId); - -static void -LsFinishSourceListing ( - UINT32 FileId); - -static void -LsWriteSourceLines ( - UINT32 ToLineNumber, - UINT32 ToLogicalLineNumber, - UINT32 FileId); - -static void -LsWriteNodeToListing ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId); - static ACPI_STATUS LsTreeWriteWalk ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context); -#define ASL_LISTING_LINE_PREFIX ": " +static void +LsWriteNodeToListing ( + ACPI_PARSE_OBJECT *Op, + UINT32 FileId); + +static void +LsFinishSourceListing ( + UINT32 FileId); /******************************************************************************* * * FUNCTION: LsDoListings * - * PARAMETERS: None + * PARAMETERS: None. Examines the various output file global flags. * * RETURN: None * @@ -161,153 +121,60 @@ LsDoListings ( { LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT); } -} - -/******************************************************************************* - * - * FUNCTION: LsTreeWriteWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * - * RETURN: None - * - * DESCRIPTION: Dump entire parse tree, for compiler debug only - * - ******************************************************************************/ - -static ACPI_STATUS -LsTreeWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* Debug output */ - - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); - - - DbgPrint (ASL_TREE_OUTPUT, "\n"); - return (AE_OK); -} - - -void -LsDumpParseTree ( - void) -{ - - if (!Gbl_DebugFlag) + if (Gbl_C_OffsetTableFlag) { - return; + LsGenerateListing (ASL_FILE_C_OFFSET_OUTPUT); } - - DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - LsTreeWriteWalk, NULL, NULL); } /******************************************************************************* * - * FUNCTION: LsDumpAscii + * FUNCTION: LsGenerateListing * - * PARAMETERS: FileId - ID of current listing file - * Count - Number of bytes to convert - * Buffer - Buffer of bytes to convert + * PARAMETERS: FileId - ID of listing file * * RETURN: None * - * DESCRIPTION: Convert hex bytes to ascii + * DESCRIPTION: Generate a listing file. This can be one of the several types + * of "listings" supported. * ******************************************************************************/ static void -LsDumpAscii ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer) +LsGenerateListing ( + UINT32 FileId) { - UINT8 BufChar; - UINT32 i; + /* Start at the beginning of both the source and AML files */ - FlPrintFile (FileId, " \""); - for (i = 0; i < Count; i++) + FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); + FlSeekFile (ASL_FILE_AML_OUTPUT, 0); + Gbl_SourceLine = 0; + Gbl_CurrentHexColumn = 0; + LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename); + + if (FileId == ASL_FILE_C_OFFSET_OUTPUT) { - BufChar = Buffer[i]; - if (isprint (BufChar)) - { - FlPrintFile (FileId, "%c", BufChar); - } - else - { - /* Not a printable character, just put out a dot */ + /* Offset table file has a special header and footer */ - FlPrintFile (FileId, "."); - } + LsDoOffsetTableHeader (FileId); + + TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlOffsetWalk, + NULL, (void *) ACPI_TO_POINTER (FileId)); + LsDoOffsetTableFooter (FileId); + return; } - FlPrintFile (FileId, "\""); -} + /* Process all parse nodes */ -/******************************************************************************* - * - * FUNCTION: LsDumpAsciiInComment - * - * PARAMETERS: FileId - ID of current listing file - * Count - Number of bytes to convert - * Buffer - Buffer of bytes to convert - * - * RETURN: None - * - * DESCRIPTION: Convert hex bytes to ascii - * - ******************************************************************************/ + TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, + NULL, (void *) ACPI_TO_POINTER (FileId)); -void -LsDumpAsciiInComment ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer) -{ - UINT8 BufChar = 0; - UINT8 LastChar; - UINT32 i; + /* Final processing */ - - FlPrintFile (FileId, " \""); - for (i = 0; i < Count; i++) - { - LastChar = BufChar; - BufChar = Buffer[i]; - - if (isprint (BufChar)) - { - /* Handle embedded C comment sequences */ - - if (((LastChar == '*') && (BufChar == '/')) || - ((LastChar == '/') && (BufChar == '*'))) - { - /* Insert a space to break the sequence */ - - FlPrintFile (FileId, ".", BufChar); - } - - FlPrintFile (FileId, "%c", BufChar); - } - else - { - /* Not a printable character, just put out a dot */ - - FlPrintFile (FileId, "."); - } - } - FlPrintFile (FileId, "\""); + LsFinishSourceListing (FileId); } @@ -361,576 +228,47 @@ LsAmlListingWalk ( /******************************************************************************* * - * FUNCTION: LsGenerateListing - * - * PARAMETERS: FileId - ID of listing file - * - * RETURN: None - * - * DESCRIPTION: Generate a listing file. This can be one of the several types - * of "listings" supported. - * - ******************************************************************************/ - -static void -LsGenerateListing ( - UINT32 FileId) -{ - - /* Start at the beginning of both the source and AML files */ - - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_CurrentHexColumn = 0; - LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename); - - /* Process all parse nodes */ - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, - NULL, (void *) ACPI_TO_POINTER (FileId)); - - /* Final processing */ - - LsFinishSourceListing (FileId); -} - - -/******************************************************************************* - * - * FUNCTION: LsPushNode - * - * PARAMETERS: Filename - Pointer to the include filename - * - * RETURN: None - * - * DESCRIPTION: Push a listing node on the listing/include file stack. This - * stack enables tracking of include files (infinitely nested) - * and resumption of the listing of the parent file when the - * include file is finished. - * - ******************************************************************************/ - -static void -LsPushNode ( - char *Filename) -{ - ASL_LISTING_NODE *Lnode; - - - /* Create a new node */ - - Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE)); - - /* Initialize */ - - Lnode->Filename = Filename; - Lnode->LineNumber = 0; - - /* Link (push) */ - - Lnode->Next = Gbl_ListingNode; - Gbl_ListingNode = Lnode; -} - - -/******************************************************************************* - * - * FUNCTION: LsPopNode + * FUNCTION: LsDumpParseTree, LsTreeWriteWalk * * PARAMETERS: None * - * RETURN: List head after current head is popped off + * RETURN: None * - * DESCRIPTION: Pop the current head of the list, free it, and return the - * next node on the stack (the new current node). + * DESCRIPTION: Dump entire parse tree, for compiler debug only * ******************************************************************************/ -static ASL_LISTING_NODE * -LsPopNode ( +void +LsDumpParseTree ( void) { - ASL_LISTING_NODE *Lnode; - - /* Just grab the node at the head of the list */ - - Lnode = Gbl_ListingNode; - if ((!Lnode) || - (!Lnode->Next)) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, - "Could not pop empty listing stack"); - return (Gbl_ListingNode); - } - - Gbl_ListingNode = Lnode->Next; - ACPI_FREE (Lnode); - - /* New "Current" node is the new head */ - - return (Gbl_ListingNode); -} - - -/******************************************************************************* - * - * FUNCTION: LsCheckException - * - * PARAMETERS: LineNumber - Current logical (cumulative) line # - * FileId - ID of output listing file - * - * RETURN: None - * - * DESCRIPTION: Check if there is an exception for this line, and if there is, - * put it in the listing immediately. Handles multiple errors - * per line. Gbl_NextError points to the next error in the - * sorted (by line #) list of compile errors/warnings. - * - ******************************************************************************/ - -static void -LsCheckException ( - UINT32 LineNumber, - UINT32 FileId) -{ - - if ((!Gbl_NextError) || - (LineNumber < Gbl_NextError->LogicalLineNumber )) + if (!Gbl_DebugFlag) { return; } - /* Handle multiple errors per line */ - - if (FileId == ASL_FILE_LISTING_OUTPUT) - { - while (Gbl_NextError && - (LineNumber >= Gbl_NextError->LogicalLineNumber)) - { - AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n"); - - Gbl_NextError = Gbl_NextError->Next; - } - - FlPrintFile (FileId, "\n"); - } + DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n"); + TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + LsTreeWriteWalk, NULL, NULL); } -/******************************************************************************* - * - * FUNCTION: LsFlushListingBuffer - * - * PARAMETERS: FileId - ID of the listing file - * - * RETURN: None - * - * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code - * buffer. Usually called at the termination of a single line - * of source code or when the buffer is full. - * - ******************************************************************************/ - -static void -LsFlushListingBuffer ( - UINT32 FileId) -{ - UINT32 i; - - - if (Gbl_CurrentHexColumn == 0) - { - return; - } - - /* Write the hex bytes */ - - switch (FileId) - { - case ASL_FILE_LISTING_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 3); i++) - { - FlWriteFile (FileId, ".", 1); - } - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - break; - - - case ASL_FILE_ASM_SOURCE_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - if (i > 0) - { - FlPrintFile (FileId, ","); - } - FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) - { - FlWriteFile (FileId, " ", 1); - } - - FlPrintFile (FileId, " ;%8.8X", - Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - break; - - - case ASL_FILE_C_SOURCE_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) - { - FlWriteFile (FileId, " ", 1); - } - - FlPrintFile (FileId, " /* %8.8X", - Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAsciiInComment (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); - FlPrintFile (FileId, " */"); - break; - - default: - /* No other types supported */ - return; - } - - FlPrintFile (FileId, "\n"); - - Gbl_CurrentHexColumn = 0; - Gbl_HexBytesWereWritten = TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteListingHexBytes - * - * PARAMETERS: Buffer - AML code buffer - * Length - Number of AML bytes to write - * FileId - ID of current listing file. - * - * RETURN: None - * - * DESCRIPTION: Write the contents of the AML buffer to the listing file via - * the listing buffer. The listing buffer is flushed every 16 - * AML bytes. - * - ******************************************************************************/ - -static void -LsWriteListingHexBytes ( - UINT8 *Buffer, - UINT32 Length, - UINT32 FileId) -{ - UINT32 i; - - - /* Transfer all requested bytes */ - - for (i = 0; i < Length; i++) - { - /* Print line header when buffer is empty */ - - if (Gbl_CurrentHexColumn == 0) - { - if (Gbl_HasIncludeFiles) - { - FlPrintFile (FileId, "%*s", 10, " "); - } - - switch (FileId) - { - case ASL_FILE_LISTING_OUTPUT: - - FlPrintFile (FileId, "%8.8X%s", Gbl_CurrentAmlOffset, - ASL_LISTING_LINE_PREFIX); - break; - - case ASL_FILE_ASM_SOURCE_OUTPUT: - - FlPrintFile (FileId, " db "); - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - - FlPrintFile (FileId, " "); - break; - - default: - /* No other types supported */ - return; - } - } - - /* Transfer AML byte and update counts */ - - Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i]; - - Gbl_CurrentHexColumn++; - Gbl_CurrentAmlOffset++; - - /* Flush buffer when it is full */ - - if (Gbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE) - { - LsFlushListingBuffer (FileId); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteOneSourceLine - * - * PARAMETERS: FileID - ID of current listing file - * - * RETURN: FALSE on EOF (input source file), TRUE otherwise - * - * DESCRIPTION: Read one line from the input source file and echo it to the - * listing file, prefixed with the line number, and if the source - * file contains include files, prefixed with the current filename - * - ******************************************************************************/ - -static UINT32 -LsWriteOneSourceLine ( - UINT32 FileId) -{ - UINT8 FileByte; - - - Gbl_SourceLine++; - Gbl_ListingNode->LineNumber++; - - /* Ignore lines that are completely blank (but count the line above) */ - - if (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) != AE_OK) - { - return (0); - } - if (FileByte == '\n') - { - return (1); - } - - /* - * This is a non-empty line, we will print the entire line with - * the line number and possibly other prefixes and transforms. - */ - - /* Line prefixes for special files, C and ASM output */ - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " *"); - } - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "; "); - } - - if (Gbl_HasIncludeFiles) - { - /* - * This file contains "include" statements, print the current - * filename and line number within the current file - */ - FlPrintFile (FileId, "%12s %5d%s", - Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber, - ASL_LISTING_LINE_PREFIX); - } - else - { - /* No include files, just print the line number */ - - FlPrintFile (FileId, "%8u%s", Gbl_SourceLine, - ASL_LISTING_LINE_PREFIX); - } - - /* Read the rest of this line (up to a newline or EOF) */ - - do - { - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - if (FileByte == '/') - { - FileByte = '*'; - } - } - - FlWriteFile (FileId, &FileByte, 1); - if (FileByte == '\n') - { - /* - * This line has been completed. - * Check if an error occurred on this source line during the compile. - * If so, we print the error message after the source line. - */ - LsCheckException (Gbl_SourceLine, FileId); - return (1); - } - - } while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK); - - /* EOF on the input file was reached */ - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: LsFinishSourceListing - * - * PARAMETERS: FileId - ID of current listing file. - * - * RETURN: None - * - * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML - * listing buffer, and flush out any remaining lines in the - * source input file. - * - ******************************************************************************/ - -static void -LsFinishSourceListing ( - UINT32 FileId) +static ACPI_STATUS +LsTreeWriteWalk ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) { - if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || - (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) - { - return; - } + /* Debug output */ - LsFlushListingBuffer (FileId); - Gbl_CurrentAmlOffset = 0; + DbgPrint (ASL_TREE_OUTPUT, + "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); + UtPrintFormattedName (Op->Asl.ParseOpcode, Level); - /* Flush any remaining text in the source file */ - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " /*\n"); - } - - while (LsWriteOneSourceLine (FileId)) - { ; } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "\n */\n };\n"); - } - - FlPrintFile (FileId, "\n"); - - if (FileId == ASL_FILE_LISTING_OUTPUT) - { - /* Print a summary of the compile exceptions */ - - FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n"); - AePrintErrorLog (FileId); - FlPrintFile (FileId, "\n"); - UtDisplaySummary (FileId); - FlPrintFile (FileId, "\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteSourceLines - * - * PARAMETERS: ToLineNumber - - * ToLogicalLineNumber - Write up to this source line number - * FileId - ID of current listing file - * - * RETURN: None - * - * DESCRIPTION: Read then write source lines to the listing file until we have - * reached the specified logical (cumulative) line number. This - * automatically echos out comment blocks and other non-AML - * generating text until we get to the actual AML-generating line - * of ASL code specified by the logical line number. - * - ******************************************************************************/ - -static void -LsWriteSourceLines ( - UINT32 ToLineNumber, - UINT32 ToLogicalLineNumber, - UINT32 FileId) -{ - - if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || - (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) - { - return; - } - - Gbl_CurrentLine = ToLogicalLineNumber; - - /* Flush any hex bytes remaining from the last opcode */ - - LsFlushListingBuffer (FileId); - - /* Read lines and write them as long as we are not caught up */ - - if (Gbl_SourceLine < Gbl_CurrentLine) - { - /* - * If we just completed writing some AML hex bytes, output a linefeed - * to add some whitespace for readability. - */ - if (Gbl_HexBytesWereWritten) - { - FlPrintFile (FileId, "\n"); - Gbl_HexBytesWereWritten = FALSE; - } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " /*\n"); - } - - /* Write one line at a time until we have reached the target line # */ - - while ((Gbl_SourceLine < Gbl_CurrentLine) && - LsWriteOneSourceLine (FileId)) - { ; } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " */"); - } - FlPrintFile (FileId, "\n"); - } + DbgPrint (ASL_TREE_OUTPUT, "\n"); + return (AE_OK); } @@ -938,7 +276,7 @@ LsWriteSourceLines ( * * FUNCTION: LsWriteNodeToListing * - * PARAMETERS: Op - Parse node to write to the listing file. + * PARAMETERS: Op - Parse node to write to the listing file. * FileId - ID of current listing file * * RETURN: None. @@ -1244,3 +582,61 @@ LsWriteNodeToListing ( break; } } + + +/******************************************************************************* + * + * FUNCTION: LsFinishSourceListing + * + * PARAMETERS: FileId - ID of current listing file. + * + * RETURN: None + * + * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML + * listing buffer, and flush out any remaining lines in the + * source input file. + * + ******************************************************************************/ + +static void +LsFinishSourceListing ( + UINT32 FileId) +{ + + if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || + (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) + { + return; + } + + LsFlushListingBuffer (FileId); + Gbl_CurrentAmlOffset = 0; + + /* Flush any remaining text in the source file */ + + if (FileId == ASL_FILE_C_SOURCE_OUTPUT) + { + FlPrintFile (FileId, " /*\n"); + } + + while (LsWriteOneSourceLine (FileId)) + { ; } + + if (FileId == ASL_FILE_C_SOURCE_OUTPUT) + { + FlPrintFile (FileId, "\n */\n };\n"); + } + + FlPrintFile (FileId, "\n"); + + if (FileId == ASL_FILE_LISTING_OUTPUT) + { + /* Print a summary of the compile exceptions */ + + FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n"); + AePrintErrorLog (FileId); + FlPrintFile (FileId, "\n"); + UtDisplaySummary (FileId); + FlPrintFile (FileId, "\n"); + } +} diff --git a/source/compiler/asllistsup.c b/source/compiler/asllistsup.c new file mode 100644 index 000000000000..4156dcc0b03c --- /dev/null +++ b/source/compiler/asllistsup.c @@ -0,0 +1,706 @@ +/****************************************************************************** + * + * Module Name: asllistsup - Listing file support utilities + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2013, 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 "aslcompiler.y.h" + + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslistsup") + + +/******************************************************************************* + * + * FUNCTION: LsDumpAscii + * + * PARAMETERS: FileId - ID of current listing file + * Count - Number of bytes to convert + * Buffer - Buffer of bytes to convert + * + * RETURN: None + * + * DESCRIPTION: Convert hex bytes to ascii + * + ******************************************************************************/ + +void +LsDumpAscii ( + UINT32 FileId, + UINT32 Count, + UINT8 *Buffer) +{ + UINT8 BufChar; + UINT32 i; + + + FlPrintFile (FileId, " \""); + for (i = 0; i < Count; i++) + { + BufChar = Buffer[i]; + if (isprint (BufChar)) + { + FlPrintFile (FileId, "%c", BufChar); + } + else + { + /* Not a printable character, just put out a dot */ + + FlPrintFile (FileId, "."); + } + } + FlPrintFile (FileId, "\""); +} + + +/******************************************************************************* + * + * FUNCTION: LsDumpAsciiInComment + * + * PARAMETERS: FileId - ID of current listing file + * Count - Number of bytes to convert + * Buffer - Buffer of bytes to convert + * + * RETURN: None + * + * DESCRIPTION: Convert hex bytes to ascii + * + ******************************************************************************/ + +void +LsDumpAsciiInComment ( + UINT32 FileId, + UINT32 Count, + UINT8 *Buffer) +{ + UINT8 BufChar = 0; + UINT8 LastChar; + UINT32 i; + + + FlPrintFile (FileId, " \""); + for (i = 0; i < Count; i++) + { + LastChar = BufChar; + BufChar = Buffer[i]; + + if (isprint (BufChar)) + { + /* Handle embedded C comment sequences */ + + if (((LastChar == '*') && (BufChar == '/')) || + ((LastChar == '/') && (BufChar == '*'))) + { + /* Insert a space to break the sequence */ + + FlPrintFile (FileId, ".", BufChar); + } + + FlPrintFile (FileId, "%c", BufChar); + } + else + { + /* Not a printable character, just put out a dot */ + + FlPrintFile (FileId, "."); + } + } + + FlPrintFile (FileId, "\""); +} + + +/******************************************************************************* + * + * FUNCTION: LsCheckException + * + * PARAMETERS: LineNumber - Current logical (cumulative) line # + * FileId - ID of output listing file + * + * RETURN: None + * + * DESCRIPTION: Check if there is an exception for this line, and if there is, + * put it in the listing immediately. Handles multiple errors + * per line. Gbl_NextError points to the next error in the + * sorted (by line #) list of compile errors/warnings. + * + ******************************************************************************/ + +void +LsCheckException ( + UINT32 LineNumber, + UINT32 FileId) +{ + + if ((!Gbl_NextError) || + (LineNumber < Gbl_NextError->LogicalLineNumber )) + { + return; + } + + /* Handle multiple errors per line */ + + if (FileId == ASL_FILE_LISTING_OUTPUT) + { + while (Gbl_NextError && + (LineNumber >= Gbl_NextError->LogicalLineNumber)) + { + AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n"); + + Gbl_NextError = Gbl_NextError->Next; + } + + FlPrintFile (FileId, "\n"); + } +} + + +/******************************************************************************* + * + * FUNCTION: LsWriteListingHexBytes + * + * PARAMETERS: Buffer - AML code buffer + * Length - Number of AML bytes to write + * FileId - ID of current listing file. + * + * RETURN: None + * + * DESCRIPTION: Write the contents of the AML buffer to the listing file via + * the listing buffer. The listing buffer is flushed every 16 + * AML bytes. + * + ******************************************************************************/ + +void +LsWriteListingHexBytes ( + UINT8 *Buffer, + UINT32 Length, + UINT32 FileId) +{ + UINT32 i; + + + /* Transfer all requested bytes */ + + for (i = 0; i < Length; i++) + { + /* Print line header when buffer is empty */ + + if (Gbl_CurrentHexColumn == 0) + { + if (Gbl_HasIncludeFiles) + { + FlPrintFile (FileId, "%*s", 10, " "); + } + + switch (FileId) + { + case ASL_FILE_LISTING_OUTPUT: + + FlPrintFile (FileId, "%8.8X%s", Gbl_CurrentAmlOffset, + ASL_LISTING_LINE_PREFIX); + break; + + case ASL_FILE_ASM_SOURCE_OUTPUT: + + FlPrintFile (FileId, " db "); + break; + + case ASL_FILE_C_SOURCE_OUTPUT: + + FlPrintFile (FileId, " "); + break; + + default: + /* No other types supported */ + return; + } + } + + /* Transfer AML byte and update counts */ + + Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i]; + + Gbl_CurrentHexColumn++; + Gbl_CurrentAmlOffset++; + + /* Flush buffer when it is full */ + + if (Gbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE) + { + LsFlushListingBuffer (FileId); + } + } +} + + +/******************************************************************************* + * + * FUNCTION: LsWriteSourceLines + * + * PARAMETERS: ToLineNumber - + * ToLogicalLineNumber - Write up to this source line number + * FileId - ID of current listing file + * + * RETURN: None + * + * DESCRIPTION: Read then write source lines to the listing file until we have + * reached the specified logical (cumulative) line number. This + * automatically echos out comment blocks and other non-AML + * generating text until we get to the actual AML-generating line + * of ASL code specified by the logical line number. + * + ******************************************************************************/ + +void +LsWriteSourceLines ( + UINT32 ToLineNumber, + UINT32 ToLogicalLineNumber, + UINT32 FileId) +{ + + /* Nothing to do for these file types */ + + if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || + (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) + { + return; + } + + Gbl_CurrentLine = ToLogicalLineNumber; + + /* Flush any hex bytes remaining from the last opcode */ + + LsFlushListingBuffer (FileId); + + /* Read lines and write them as long as we are not caught up */ + + if (Gbl_SourceLine < Gbl_CurrentLine) + { + /* + * If we just completed writing some AML hex bytes, output a linefeed + * to add some whitespace for readability. + */ + if (Gbl_HexBytesWereWritten) + { + FlPrintFile (FileId, "\n"); + Gbl_HexBytesWereWritten = FALSE; + } + + if (FileId == ASL_FILE_C_SOURCE_OUTPUT) + { + FlPrintFile (FileId, " /*\n"); + } + + /* Write one line at a time until we have reached the target line # */ + + while ((Gbl_SourceLine < Gbl_CurrentLine) && + LsWriteOneSourceLine (FileId)) + { ; } + + if (FileId == ASL_FILE_C_SOURCE_OUTPUT) + { + FlPrintFile (FileId, " */"); + } + + FlPrintFile (FileId, "\n"); + } +} + + +/******************************************************************************* + * + * FUNCTION: LsWriteOneSourceLine + * + * PARAMETERS: FileId - ID of current listing file + * + * RETURN: FALSE on EOF (input source file), TRUE otherwise + * + * DESCRIPTION: Read one line from the input source file and echo it to the + * listing file, prefixed with the line number, and if the source + * file contains include files, prefixed with the current filename + * + ******************************************************************************/ + +UINT32 +LsWriteOneSourceLine ( + UINT32 FileId) +{ + UINT8 FileByte; + UINT32 Column = 0; + UINT32 Index = 16; + BOOLEAN StartOfLine = FALSE; + BOOLEAN ProcessLongLine = FALSE; + + + Gbl_SourceLine++; + Gbl_ListingNode->LineNumber++; + + /* Ignore lines that are completely blank (but count the line above) */ + + if (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) != AE_OK) + { + return (0); + } + if (FileByte == '\n') + { + return (1); + } + + /* + * This is a non-empty line, we will print the entire line with + * the line number and possibly other prefixes and transforms. + */ + + /* Line prefixes for special files, C and ASM output */ + + if (FileId == ASL_FILE_C_SOURCE_OUTPUT) + { + FlPrintFile (FileId, " *"); + } + if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) + { + FlPrintFile (FileId, "; "); + } + + if (Gbl_HasIncludeFiles) + { + /* + * This file contains "include" statements, print the current + * filename and line number within the current file + */ + FlPrintFile (FileId, "%12s %5d%s", + Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber, + ASL_LISTING_LINE_PREFIX); + } + else + { + /* No include files, just print the line number */ + + FlPrintFile (FileId, "%8u%s", Gbl_SourceLine, + ASL_LISTING_LINE_PREFIX); + } + + /* Read the rest of this line (up to a newline or EOF) */ + + do + { + if (FileId == ASL_FILE_C_SOURCE_OUTPUT) + { + if (FileByte == '/') + { + FileByte = '*'; + } + } + + /* Split long input lines for readability in the listing */ + + Column++; + if (Column >= 128) + { + if (!ProcessLongLine) + { + if ((FileByte != '}') && + (FileByte != '{')) + { + goto WriteByte; + } + + ProcessLongLine = TRUE; + } + + if (FileByte == '{') + { + FlPrintFile (FileId, "\n%*s{\n", Index, " "); + StartOfLine = TRUE; + Index += 4; + continue; + } + + else if (FileByte == '}') + { + if (!StartOfLine) + { + FlPrintFile (FileId, "\n"); + } + + StartOfLine = TRUE; + Index -= 4; + FlPrintFile (FileId, "%*s}\n", Index, " "); + continue; + } + + /* Ignore spaces/tabs at the start of line */ + + else if ((FileByte == ' ') && StartOfLine) + { + continue; + } + + else if (StartOfLine) + { + StartOfLine = FALSE; + FlPrintFile (FileId, "%*s", Index, " "); + } + +WriteByte: + FlWriteFile (FileId, &FileByte, 1); + if (FileByte == '\n') + { + /* + * This line has been completed. + * Check if an error occurred on this source line during the compile. + * If so, we print the error message after the source line. + */ + LsCheckException (Gbl_SourceLine, FileId); + return (1); + } + } + else + { + FlWriteFile (FileId, &FileByte, 1); + if (FileByte == '\n') + { + /* + * This line has been completed. + * Check if an error occurred on this source line during the compile. + * If so, we print the error message after the source line. + */ + LsCheckException (Gbl_SourceLine, FileId); + return (1); + } + } + + } while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK); + + /* EOF on the input file was reached */ + + return (0); +} + + +/******************************************************************************* + * + * FUNCTION: LsFlushListingBuffer + * + * PARAMETERS: FileId - ID of the listing file + * + * RETURN: None + * + * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code + * buffer. Usually called at the termination of a single line + * of source code or when the buffer is full. + * + ******************************************************************************/ + +void +LsFlushListingBuffer ( + UINT32 FileId) +{ + UINT32 i; + + + if (Gbl_CurrentHexColumn == 0) + { + return; + } + + /* Write the hex bytes */ + + switch (FileId) + { + case ASL_FILE_LISTING_OUTPUT: + + for (i = 0; i < Gbl_CurrentHexColumn; i++) + { + FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]); + } + + for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 3); i++) + { + FlWriteFile (FileId, ".", 1); + } + + /* Write the ASCII character associated with each of the bytes */ + + LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); + break; + + + case ASL_FILE_ASM_SOURCE_OUTPUT: + + for (i = 0; i < Gbl_CurrentHexColumn; i++) + { + if (i > 0) + { + FlPrintFile (FileId, ","); + } + FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]); + } + + for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) + { + FlWriteFile (FileId, " ", 1); + } + + FlPrintFile (FileId, " ;%8.8X", + Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE); + + /* Write the ASCII character associated with each of the bytes */ + + LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); + break; + + + case ASL_FILE_C_SOURCE_OUTPUT: + + for (i = 0; i < Gbl_CurrentHexColumn; i++) + { + FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]); + } + + /* Pad hex output with spaces if line is shorter than max line size */ + + for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++) + { + FlWriteFile (FileId, " ", 1); + } + + /* AML offset for the start of the line */ + + FlPrintFile (FileId, " /* %8.8X", + Gbl_CurrentAmlOffset - Gbl_CurrentHexColumn); + + /* Write the ASCII character associated with each of the bytes */ + + LsDumpAsciiInComment (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer); + FlPrintFile (FileId, " */"); + break; + + default: + /* No other types supported */ + return; + } + + FlPrintFile (FileId, "\n"); + + Gbl_CurrentHexColumn = 0; + Gbl_HexBytesWereWritten = TRUE; +} + + +/******************************************************************************* + * + * FUNCTION: LsPushNode + * + * PARAMETERS: Filename - Pointer to the include filename + * + * RETURN: None + * + * DESCRIPTION: Push a listing node on the listing/include file stack. This + * stack enables tracking of include files (infinitely nested) + * and resumption of the listing of the parent file when the + * include file is finished. + * + ******************************************************************************/ + +void +LsPushNode ( + char *Filename) +{ + ASL_LISTING_NODE *Lnode; + + + /* Create a new node */ + + Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE)); + + /* Initialize */ + + Lnode->Filename = Filename; + Lnode->LineNumber = 0; + + /* Link (push) */ + + Lnode->Next = Gbl_ListingNode; + Gbl_ListingNode = Lnode; +} + + +/******************************************************************************* + * + * FUNCTION: LsPopNode + * + * PARAMETERS: None + * + * RETURN: List head after current head is popped off + * + * DESCRIPTION: Pop the current head of the list, free it, and return the + * next node on the stack (the new current node). + * + ******************************************************************************/ + +ASL_LISTING_NODE * +LsPopNode ( + void) +{ + ASL_LISTING_NODE *Lnode; + + + /* Just grab the node at the head of the list */ + + Lnode = Gbl_ListingNode; + if ((!Lnode) || + (!Lnode->Next)) + { + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, + "Could not pop empty listing stack"); + return (Gbl_ListingNode); + } + + Gbl_ListingNode = Lnode->Next; + ACPI_FREE (Lnode); + + /* New "Current" node is the new head */ + + return (Gbl_ListingNode); +} diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 71a7cec0b306..4cc63faf92bf 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -156,6 +156,7 @@ Options ( ACPI_OPTION ("-sc -sa", "Create source file in C or assembler (*.c or *.asm)"); ACPI_OPTION ("-ic -ia", "Create include file in C or assembler (*.h or *.inc)"); ACPI_OPTION ("-tc -ta -ts", "Create hex AML table in C, assembler, or ASL (*.hex)"); + ACPI_OPTION ("-so", "Create offset table in C (*.offset.h)"); printf ("\nOptional Listing Files:\n"); ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)"); @@ -784,6 +785,13 @@ AslDoOptions ( Gbl_C_OutputFlag = TRUE; break; + case 'o': + + /* Produce AML offset table in C */ + + Gbl_C_OffsetTableFlag = TRUE; + break; + default: printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); return (-1); diff --git a/source/compiler/asloffset.c b/source/compiler/asloffset.c new file mode 100644 index 000000000000..190b92ada863 --- /dev/null +++ b/source/compiler/asloffset.c @@ -0,0 +1,326 @@ +/****************************************************************************** + * + * Module Name: asloffset - Generate a C "offset table" for BIOS use. + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2013, 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 "aslcompiler.y.h" +#include "amlcode.h" +#include "acnamesp.h" + + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("asloffset") + + +/* Local prototypes */ + +static void +LsEmitOffsetTableEntry ( + UINT32 FileId, + ACPI_NAMESPACE_NODE *Node, + UINT32 Offset, + UINT32 Length, + char *OpName, + UINT64 Value, + UINT8 AmlOpcode); + + +/******************************************************************************* + * + * FUNCTION: LsAmlOffsetWalk + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Process one node during a offset table file generation. + * + * Three types of objects are currently emitted to the offset table: + * 1) Tagged (named) resource descriptors + * 2) Named integer objects with constant integer values + * 3) Operation Regions that have constant Offset (address) parameters + * + * The offset table allows the BIOS to dynamically update the values of these + * objects at boot time. + * + ******************************************************************************/ + +ACPI_STATUS +LsAmlOffsetWalk ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context); + ACPI_NAMESPACE_NODE *Node; + UINT32 Length; + UINT32 OffsetOfOpcode; + ACPI_PARSE_OBJECT *AddressOp; + + + /* Ignore actual data blocks for resource descriptors */ + + if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA) + { + return (AE_OK); /* Do NOT update the global AML offset */ + } + + /* We are only interested in named objects (have a namespace node) */ + + Node = Op->Asl.Node; + if (!Node) + { + Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength; + return (AE_OK); + } + + /* Named resource descriptor (has a descriptor tag) */ + + if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE) && + (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)) + { + LsEmitOffsetTableEntry (FileId, Node, Gbl_CurrentAmlOffset, + Op->Asl.FinalAmlLength, Op->Asl.ParseOpName, 0, Op->Asl.Extra); + } + + /* Named object -- Name (NameString, DataRefObject) */ + + else if (Op->Asl.AmlOpcode == AML_NAME_OP) + { + if (!Op->Asl.Child) + { + FlPrintFile (FileId, "%s NO CHILD!\n", MsgBuffer); + return (AE_OK); + } + + Length = Op->Asl.FinalAmlLength; + + /* Get to the NameSeg/NamePath Op (and length of the name) */ + + Op = Op->Asl.Child; + OffsetOfOpcode = Length + Op->Asl.FinalAmlLength; + + /* Get actual value associated with the name */ + + Op = Op->Asl.Next; + switch (Op->Asl.AmlOpcode) + { + /* + * We are only interested in integer constants that can be changed + * at boot time. Note, the One/Ones/Zero opcodes are considered + * non-changeable, so we ignore them here. + */ + case AML_BYTE_OP: + case AML_WORD_OP: + case AML_DWORD_OP: + case AML_QWORD_OP: + + /* The +1/-1 is to handle the integer size prefix (opcode) */ + + LsEmitOffsetTableEntry (FileId, Node, + (Gbl_CurrentAmlOffset + OffsetOfOpcode + 1), + (Op->Asl.FinalAmlLength - 1), Op->Asl.ParseOpName, + Op->Asl.Value.Integer, (UINT8) Op->Asl.AmlOpcode); + break; + + default: + break; + } + + Gbl_CurrentAmlOffset += Length; + return (AE_OK); + } + + /* OperationRegion (NameString, RegionSpace, RegionOffset, RegionLength) */ + + else if (Op->Asl.AmlOpcode == AML_REGION_OP) + { + Length = Op->Asl.FinalAmlLength; + + /* Get the name/namepath node */ + + AddressOp = Op->Asl.Child; + OffsetOfOpcode = Length + AddressOp->Asl.FinalAmlLength + 1; + + /* Get the SpaceId node, then the Offset (address) node */ + + AddressOp = AddressOp->Asl.Next; + AddressOp = AddressOp->Asl.Next; + + switch (AddressOp->Asl.AmlOpcode) + { + /* + * We are only interested in integer constants that can be changed + * at boot time. Note, the One/Ones/Zero opcodes are considered + * non-changeable, so we ignore them here. + */ + case AML_BYTE_OP: + case AML_WORD_OP: + case AML_DWORD_OP: + case AML_QWORD_OP: + + /* The +1/-1 is to handle the integer size prefix (opcode) */ + + LsEmitOffsetTableEntry (FileId, Node, + (Gbl_CurrentAmlOffset + OffsetOfOpcode + 1), + (AddressOp->Asl.FinalAmlLength - 1), Op->Asl.ParseOpName, + AddressOp->Asl.Value.Integer, (UINT8) AddressOp->Asl.AmlOpcode); + + Gbl_CurrentAmlOffset += Length; + return (AE_OK); + + default: + break; + } + } + + Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: LsEmitOffsetTableEntry + * + * PARAMETERS: FileId - ID of current listing file + * Node - Namespace node associated with the name + * Offset - Offset of the value within the AML table + * Length - Length in bytes of the value + * OpName - Name of the AML opcode + * Value - Current value of the AML field + * AmlOpcode - Opcode associated with the field + * + * RETURN: None + * + * DESCRIPTION: Emit a line of the offset table (-so option) + * + ******************************************************************************/ + +static void +LsEmitOffsetTableEntry ( + UINT32 FileId, + ACPI_NAMESPACE_NODE *Node, + UINT32 Offset, + UINT32 Length, + char *OpName, + UINT64 Value, + UINT8 AmlOpcode) +{ + ACPI_BUFFER TargetPath; + ACPI_STATUS Status; + + + /* Get the full pathname to the namespace node */ + + TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + Status = AcpiNsHandleToPathname (Node, &TargetPath); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* [1] - Skip the opening backslash for the path */ + + strcpy (MsgBuffer, "\""); + strcat (MsgBuffer, &((char *) TargetPath.Pointer)[1]); + strcat (MsgBuffer, "\","); + ACPI_FREE (TargetPath.Pointer); + + /* + * Max offset is 4G, constrained by 32-bit ACPI table length. + * Max Length for Integers is 8 bytes. + */ + FlPrintFile (FileId, + " {%-29s 0x%8.8X, 0x%2.2X, 0x%8.8X%8.8X}, /* %s */\n", + MsgBuffer, Offset, AmlOpcode, ACPI_FORMAT_UINT64 (Value), OpName); +} + + +/******************************************************************************* + * + * FUNCTION: LsDoOffsetTableHeader, LsDoOffsetTableFooter + * + * PARAMETERS: FileId - ID of current listing file + * + * RETURN: None + * + * DESCRIPTION: Header and footer for the offset table file. + * + ******************************************************************************/ + +void +LsDoOffsetTableHeader ( + UINT32 FileId) +{ + + Gbl_CurrentAmlOffset = 0; + + FlPrintFile (FileId, + "#ifndef __AML_OFFSET_TABLE_H\n" + "#define __AML_OFFSET_TABLE_H\n\n"); + + FlPrintFile (FileId, "typedef struct {\n" + " char *Pathname;\n" + " unsigned long Offset;\n" + " unsigned char AmlOpcode;\n" + " unsigned long long AmlValue;\n" + "} AML_OFFSET_TABLE_ENTRY;\n\n"); + + FlPrintFile (FileId, + "#endif /* __AML_OFFSET_TABLE_H */\n\n"); + + FlPrintFile (FileId, + "AML_OFFSET_TABLE_ENTRY %s_%s_OffsetTable[] =\n{\n", + Gbl_TableSignature, Gbl_TableId); +} + + +void +LsDoOffsetTableFooter ( + UINT32 FileId) +{ + + FlPrintFile (FileId, + " {0,0,0,0} /* Table terminator */\n};\n\n"); + Gbl_CurrentAmlOffset = 0; +} diff --git a/source/compiler/aslpredef.c b/source/compiler/aslpredef.c index ca877a8ada50..4330c1907696 100644 --- a/source/compiler/aslpredef.c +++ b/source/compiler/aslpredef.c @@ -42,6 +42,7 @@ */ #define ACPI_CREATE_PREDEFINED_TABLE +#define ACPI_CREATE_RESOURCE_TABLE #include "aslcompiler.h" #include "aslcompiler.y.h" @@ -65,90 +66,6 @@ ApCheckForSpecialName ( ACPI_PARSE_OBJECT *Op, char *Name); -static void -ApGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes); - - -/* - * Names for the types that can be returned by the predefined objects. - * Used for warning messages. Must be in the same order as the ACPI_RTYPEs - */ -static const char *AcpiRtypeNames[] = -{ - "/Integer", - "/String", - "/Buffer", - "/Package", - "/Reference", -}; - -/* - * Predefined names for use in Resource Descriptors. These names do not - * appear in the global Predefined Name table (since these names never - * appear in actual AML byte code, only in the original ASL) - */ -static const ACPI_PREDEFINED_INFO ResourceNames[] = { - {{"_ALN", 0, 0}}, - {{"_ASI", 0, 0}}, - {{"_ASZ", 0, 0}}, - {{"_ATT", 0, 0}}, - {{"_BAS", 0, 0}}, - {{"_BM_", 0, 0}}, - {{"_DBT", 0, 0}}, /* Acpi 5.0 */ - {{"_DEC", 0, 0}}, - {{"_DPL", 0, 0}}, /* Acpi 5.0 */ - {{"_DRS", 0, 0}}, /* Acpi 5.0 */ - {{"_END", 0, 0}}, /* Acpi 5.0 */ - {{"_FLC", 0, 0}}, /* Acpi 5.0 */ - {{"_GRA", 0, 0}}, - {{"_HE_", 0, 0}}, - {{"_INT", 0, 0}}, - {{"_IOR", 0, 0}}, /* Acpi 5.0 */ - {{"_LEN", 0, 0}}, - {{"_LIN", 0, 0}}, /* Acpi 5.0 */ - {{"_LL_", 0, 0}}, - {{"_MAF", 0, 0}}, - {{"_MAX", 0, 0}}, - {{"_MEM", 0, 0}}, - {{"_MIF", 0, 0}}, - {{"_MIN", 0, 0}}, - {{"_MOD", 0, 0}}, /* Acpi 5.0 */ - {{"_MTP", 0, 0}}, - {{"_PAR", 0, 0}}, /* Acpi 5.0 */ - {{"_PHA", 0, 0}}, /* Acpi 5.0 */ - {{"_PIN", 0, 0}}, /* Acpi 5.0 */ - {{"_PPI", 0, 0}}, /* Acpi 5.0 */ - {{"_POL", 0, 0}}, /* Acpi 5.0 */ - {{"_RBO", 0, 0}}, - {{"_RBW", 0, 0}}, - {{"_RNG", 0, 0}}, - {{"_RT_", 0, 0}}, /* Acpi 3.0 */ - {{"_RW_", 0, 0}}, - {{"_RXL", 0, 0}}, /* Acpi 5.0 */ - {{"_SHR", 0, 0}}, - {{"_SIZ", 0, 0}}, - {{"_SLV", 0, 0}}, /* Acpi 5.0 */ - {{"_SPE", 0, 0}}, /* Acpi 5.0 */ - {{"_STB", 0, 0}}, /* Acpi 5.0 */ - {{"_TRA", 0, 0}}, - {{"_TRS", 0, 0}}, - {{"_TSF", 0, 0}}, /* Acpi 3.0 */ - {{"_TTP", 0, 0}}, - {{"_TXL", 0, 0}}, /* Acpi 5.0 */ - {{"_TYP", 0, 0}}, - {{"_VEN", 0, 0}}, /* Acpi 5.0 */ - {{{0,0,0,0}, 0, 0}} /* Table terminator */ -}; - -static const ACPI_PREDEFINED_INFO ScopeNames[] = { - {{"_SB_", 0, 0}}, - {{"_SI_", 0, 0}}, - {{"_TZ_", 0, 0}}, - {{{0,0,0,0}, 0, 0}} /* Table terminator */ -}; - /******************************************************************************* * @@ -170,9 +87,9 @@ ApCheckForPredefinedMethod ( ACPI_PARSE_OBJECT *Op, ASL_METHOD_INFO *MethodInfo) { - UINT32 Index; - UINT32 RequiredArgsCurrent; - UINT32 RequiredArgsOld; + UINT32 Index; + UINT32 RequiredArgCount; + const ACPI_PREDEFINED_INFO *ThisName; /* Check for a match against the predefined name list */ @@ -213,17 +130,16 @@ ApCheckForPredefinedMethod ( * arg counts. */ Gbl_ReservedMethods++; + ThisName = &AcpiGbl_PredefinedMethods[Index]; + RequiredArgCount = ThisName->Info.ArgumentList & METHOD_ARG_MASK; - RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F; - RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4; - - if ((MethodInfo->NumArguments != RequiredArgsCurrent) && - (MethodInfo->NumArguments != RequiredArgsOld)) + if (MethodInfo->NumArguments != RequiredArgCount) { sprintf (MsgBuffer, "%4.4s requires %u", - PredefinedNames[Index].Info.Name, RequiredArgsCurrent); + ThisName->Info.Name, RequiredArgCount); - if (MethodInfo->NumArguments > RequiredArgsCurrent) + if ((MethodInfo->NumArguments > RequiredArgCount) && + !(ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) { AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer); @@ -240,13 +156,13 @@ ApCheckForPredefinedMethod ( * required to return a value */ if (MethodInfo->NumReturnNoValue && - PredefinedNames[Index].Info.ExpectedBtypes) + ThisName->Info.ExpectedBtypes) { - ApGetExpectedTypes (StringBuffer, - PredefinedNames[Index].Info.ExpectedBtypes); + AcpiUtGetExpectedReturnTypes (StringBuffer, + ThisName->Info.ExpectedBtypes); sprintf (MsgBuffer, "%s required for %4.4s", - StringBuffer, PredefinedNames[Index].Info.Name); + StringBuffer, ThisName->Info.Name); AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, MsgBuffer); @@ -329,8 +245,9 @@ ApCheckPredefinedReturnValue ( ACPI_PARSE_OBJECT *Op, ASL_METHOD_INFO *MethodInfo) { - UINT32 Index; - ACPI_PARSE_OBJECT *ReturnValueOp; + UINT32 Index; + ACPI_PARSE_OBJECT *ReturnValueOp; + const ACPI_PREDEFINED_INFO *ThisName; /* Check parent method for a match against the predefined name list */ @@ -356,7 +273,8 @@ ApCheckPredefinedReturnValue ( default: /* A standard predefined ACPI name */ - if (!PredefinedNames[Index].Info.ExpectedBtypes) + ThisName = &AcpiGbl_PredefinedMethods[Index]; + if (!ThisName->Info.ExpectedBtypes) { /* No return value expected, warn if there is one */ @@ -379,16 +297,14 @@ ApCheckPredefinedReturnValue ( /* Static data return object - check against expected type */ - ApCheckObjectType (PredefinedNames[Index].Info.Name, - ReturnValueOp, - PredefinedNames[Index].Info.ExpectedBtypes, - ACPI_NOT_PACKAGE_ELEMENT); + ApCheckObjectType (ThisName->Info.Name, ReturnValueOp, + ThisName->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT); /* For packages, check the individual package elements */ if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_PACKAGE) { - ApCheckPackage (ReturnValueOp, &PredefinedNames[Index]); + ApCheckPackage (ReturnValueOp, ThisName); } break; @@ -430,8 +346,9 @@ ApCheckForPredefinedObject ( ACPI_PARSE_OBJECT *Op, char *Name) { - UINT32 Index; - ACPI_PARSE_OBJECT *ObjectOp; + UINT32 Index; + ACPI_PARSE_OBJECT *ObjectOp; + const ACPI_PREDEFINED_INFO *ThisName; /* @@ -470,7 +387,8 @@ ApCheckForPredefinedObject ( * If this predefined name requires input arguments, then * it must be implemented as a control method */ - if (PredefinedNames[Index].Info.ParamCount > 0) + ThisName = &AcpiGbl_PredefinedMethods[Index]; + if ((ThisName->Info.ArgumentList & METHOD_ARG_MASK) > 0) { AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, "with arguments"); @@ -483,7 +401,7 @@ ApCheckForPredefinedObject ( * (with zero args, because the args > 0 case was handled above) * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx */ - if (!PredefinedNames[Index].Info.ExpectedBtypes) + if (!ThisName->Info.ExpectedBtypes) { AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, "with zero arguments"); @@ -493,16 +411,14 @@ ApCheckForPredefinedObject ( /* Typecheck the actual object, it is the next argument */ ObjectOp = Op->Asl.Child->Asl.Next; - ApCheckObjectType (PredefinedNames[Index].Info.Name, - Op->Asl.Child->Asl.Next, - PredefinedNames[Index].Info.ExpectedBtypes, - ACPI_NOT_PACKAGE_ELEMENT); + ApCheckObjectType (ThisName->Info.Name, Op->Asl.Child->Asl.Next, + ThisName->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT); /* For packages, check the individual package elements */ if (ObjectOp->Asl.ParseOpcode == PARSEOP_PACKAGE) { - ApCheckPackage (ObjectOp, &PredefinedNames[Index]); + ApCheckPackage (ObjectOp, ThisName); } } @@ -525,7 +441,8 @@ ApCheckForPredefinedName ( ACPI_PARSE_OBJECT *Op, char *Name) { - UINT32 i; + UINT32 i; + const ACPI_PREDEFINED_INFO *ThisName; if (Name[0] == 0) @@ -543,31 +460,40 @@ ApCheckForPredefinedName ( /* Check for a standard predefined method name */ - for (i = 0; PredefinedNames[i].Info.Name[0]; i++) + ThisName = AcpiGbl_PredefinedMethods; + for (i = 0; ThisName->Info.Name[0]; i++) { - if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name)) + if (ACPI_COMPARE_NAME (Name, ThisName->Info.Name)) { /* Return index into predefined array */ return (i); } + + ThisName++; /* Does not account for extra package data, but is OK */ } /* Check for resource names and predefined scope names */ - for (i = 0; ResourceNames[i].Info.Name[0]; i++) + ThisName = AcpiGbl_ResourceNames; + while (ThisName->Info.Name[0]) { - if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name)) + if (ACPI_COMPARE_NAME (Name, ThisName->Info.Name)) { return (ACPI_PREDEFINED_NAME); } + + ThisName++; } - for (i = 0; ScopeNames[i].Info.Name[0]; i++) + ThisName = AcpiGbl_ScopeNames; + while (ThisName->Info.Name[0]) { - if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name)) + if (ACPI_COMPARE_NAME (Name, ThisName->Info.Name)) { return (ACPI_PREDEFINED_NAME); } + + ThisName++; } /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */ @@ -742,16 +668,16 @@ TypeErrorExit: /* Format the expected types and emit an error message */ - ApGetExpectedTypes (StringBuffer, ExpectedBtypes); + AcpiUtGetExpectedReturnTypes (StringBuffer, ExpectedBtypes); if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT) { - sprintf (MsgBuffer, "%s: found %s, %s required", + sprintf (MsgBuffer, "%4.4s: found %s, %s required", PredefinedName, TypeName, StringBuffer); } else { - sprintf (MsgBuffer, "%s: found %s at index %u, %s required", + sprintf (MsgBuffer, "%4.4s: found %s at index %u, %s required", PredefinedName, TypeName, PackageIndex, StringBuffer); } @@ -778,8 +704,8 @@ ApDisplayReservedNames ( void) { const ACPI_PREDEFINED_INFO *ThisName; - char TypeBuffer[48]; /* Room for 5 types */ UINT32 Count; + UINT32 NumTypes; /* @@ -788,33 +714,12 @@ ApDisplayReservedNames ( printf ("\nPredefined Name Information\n\n"); Count = 0; - ThisName = PredefinedNames; + ThisName = AcpiGbl_PredefinedMethods; while (ThisName->Info.Name[0]) { - printf ("%4.4s Requires %u arguments, ", - ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F); - - if (ThisName->Info.ExpectedBtypes) - { - ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes); - printf ("Must return: %s\n", TypeBuffer); - } - else - { - printf ("No return value\n"); - } - - /* - * Skip next entry in the table if this name returns a Package - * (next entry contains the package info) - */ - if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) - { - ThisName++; - } - + AcpiUtDisplayPredefinedMethod (MsgBuffer, ThisName, FALSE); Count++; - ThisName++; + ThisName = AcpiUtGetNextPredefinedMethod (ThisName); } printf ("%u Predefined Names are recognized\n", Count); @@ -822,69 +727,34 @@ ApDisplayReservedNames ( /* * Resource Descriptor names */ - printf ("\nResource Descriptor Predefined Names\n\n"); + printf ("\nPredefined Names for Resource Descriptor Fields\n\n"); Count = 0; - ThisName = ResourceNames; + ThisName = AcpiGbl_ResourceNames; while (ThisName->Info.Name[0]) { - printf ("%4.4s Resource Descriptor\n", ThisName->Info.Name); + NumTypes = AcpiUtGetResourceBitWidth (MsgBuffer, + ThisName->Info.ArgumentList); + + printf ("%4.4s Field is %s bits wide%s\n", + ThisName->Info.Name, MsgBuffer, + (NumTypes > 1) ? " (depending on descriptor type)" : ""); + Count++; ThisName++; } - printf ("%u Resource Descriptor Names are recognized\n", Count); + printf ("%u Resource Descriptor Field Names are recognized\n", Count); /* * Predefined scope names */ - printf ("\nPredefined Scope Names\n\n"); + printf ("\nPredefined Scope/Device Names (automatically created at root)\n\n"); - ThisName = ScopeNames; + ThisName = AcpiGbl_ScopeNames; while (ThisName->Info.Name[0]) { - printf ("%4.4s Scope\n", ThisName->Info.Name); + printf ("%4.4s Scope/Device\n", ThisName->Info.Name); ThisName++; } } - - -/******************************************************************************* - * - * FUNCTION: ApGetExpectedTypes - * - * PARAMETERS: Buffer - Where the formatted string is returned - * ExpectedBTypes - Bitfield of expected data types - * - * RETURN: None, formatted string - * - * DESCRIPTION: Format the expected object types into a printable string. - * - ******************************************************************************/ - -static void -ApGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes) -{ - UINT32 ThisRtype; - UINT32 i; - UINT32 j; - - - j = 1; - Buffer[0] = 0; - ThisRtype = ACPI_RTYPE_INTEGER; - - for (i = 0; i < ACPI_NUM_RTYPES; i++) - { - /* If one of the expected types, concatenate the name of this type */ - - if (ExpectedBtypes & ThisRtype) - { - ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); - j = 0; /* Use name separator from now on */ - } - ThisRtype <<= 1; /* Next Rtype */ - } -} diff --git a/source/compiler/aslprepkg.c b/source/compiler/aslprepkg.c index e8434d529256..da34947fb0be 100644 --- a/source/compiler/aslprepkg.c +++ b/source/compiler/aslprepkg.c @@ -126,15 +126,35 @@ ApCheckPackage ( Count = (UINT32) Op->Asl.Value.Integer; /* - * Most packages must have at least one element. The only exception - * is the variable-length package (ACPI_PTYPE1_VAR). + * Many of the variable-length top-level packages are allowed to simply + * have zero elements. This allows the BIOS to tell the host that even + * though the predefined name/method exists, the feature is not supported. + * Other package types require one or more elements. In any case, there + * is no need to continue validation. */ if (!Count) { - if (Package->RetInfo.Type != ACPI_PTYPE1_VAR) + switch (Package->RetInfo.Type) { + case ACPI_PTYPE1_FIXED: + case ACPI_PTYPE1_OPTION: + case ACPI_PTYPE2_PKG_COUNT: + case ACPI_PTYPE2_REV_FIXED: + ApZeroLengthPackage (Predefined->Info.Name, ParentOp); + break; + + case ACPI_PTYPE1_VAR: + case ACPI_PTYPE2: + case ACPI_PTYPE2_COUNT: + case ACPI_PTYPE2_FIXED: + case ACPI_PTYPE2_MIN: + case ACPI_PTYPE2_FIX_VAR: + default: + + break; } + return; } diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c index f0b3998b5acf..272f9b00bab8 100644 --- a/source/compiler/aslresource.c +++ b/source/compiler/aslresource.c @@ -894,6 +894,7 @@ RsDoOneResourceDescriptor ( if (Rnode) { DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength; + DescriptorTypeOp->Asl.Extra = ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType; } return (Rnode); diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index 538911fdde74..6f2fb88c0e75 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -164,12 +164,13 @@ typedef enum ASL_FILE_ASM_SOURCE_OUTPUT, ASL_FILE_C_SOURCE_OUTPUT, ASL_FILE_ASM_INCLUDE_OUTPUT, - ASL_FILE_C_INCLUDE_OUTPUT + ASL_FILE_C_INCLUDE_OUTPUT, + ASL_FILE_C_OFFSET_OUTPUT } ASL_FILE_TYPES; -#define ASL_MAX_FILE_TYPE 13 +#define ASL_MAX_FILE_TYPE 14 #define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index 8976a9d40c03..20adf5e36ca4 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -499,13 +499,13 @@ AnOtherSemanticAnalysisWalkBegin ( (PrevArgNode) && (PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO)) { - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, + AslError (ASL_ERROR, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); } } else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) { - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, + AslError (ASL_ERROR, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); } } @@ -523,7 +523,7 @@ AnOtherSemanticAnalysisWalkBegin ( break; default: - AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, + AslError (ASL_ERROR, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); break; } diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index f8f831f73e2a..90c0aad3ea6b 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -445,7 +445,7 @@ AcpiDbWalkForExecute ( const ACPI_PREDEFINED_INFO *Predefined; - Predefined = AcpiNsCheckForPredefinedName (Node); + Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); if (!Predefined) { return (AE_OK); diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index 2d2a088c9a1f..68a92d5929b1 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -46,6 +46,7 @@ #include "accommon.h" #include "acnamesp.h" #include "acdebug.h" +#include "acpredef.h" #ifdef ACPI_DEBUGGER @@ -436,7 +437,7 @@ AcpiDbWalkForPredefinedNames ( char *Pathname; - Predefined = AcpiNsCheckForPredefinedName (Node); + Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); if (!Predefined) { return (AE_OK); @@ -450,13 +451,14 @@ AcpiDbWalkForPredefinedNames ( /* If method returns a package, the info is in the next table entry */ - if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE) + if (Predefined->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) { Package = Predefined + 1; } AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname, - Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes); + (Predefined->Info.ArgumentList & METHOD_ARG_MASK), + Predefined->Info.ExpectedBtypes); if (Package) { diff --git a/source/components/dispatcher/dsopcode.c b/source/components/dispatcher/dsopcode.c index 3ecb288fbba9..8415bec31f03 100644 --- a/source/components/dispatcher/dsopcode.c +++ b/source/components/dispatcher/dsopcode.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: dsopcode - Dispatcher suport for regions and fields + * Module Name: dsopcode - Dispatcher support for regions and fields * *****************************************************************************/ diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index 76cee7f0a61d..0336635dc531 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -727,7 +727,7 @@ 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; diff --git a/source/components/events/evevent.c b/source/components/events/evevent.c index fd0b5fba9e96..b6d75e6478ad 100644 --- a/source/components/events/evevent.c +++ b/source/components/events/evevent.c @@ -292,7 +292,7 @@ AcpiEvFixedEventDetect ( * DESCRIPTION: Clears the status bit for the requested event, calls the * handler that previously registered for the event. * NOTE: If there is no handler for the event, the event is - * disabled to prevent futher interrupts. + * disabled to prevent further interrupts. * ******************************************************************************/ diff --git a/source/components/executer/exoparg2.c b/source/components/executer/exoparg2.c index ada92663327b..6151fa8ddf8f 100644 --- a/source/components/executer/exoparg2.c +++ b/source/components/executer/exoparg2.c @@ -286,7 +286,7 @@ AcpiExOpcode_2A_1T_1R ( ACPI_OPERAND_OBJECT *ReturnDesc = NULL; UINT64 Index; ACPI_STATUS Status = AE_OK; - ACPI_SIZE Length; + ACPI_SIZE Length = 0; ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R, @@ -356,7 +356,6 @@ AcpiExOpcode_2A_1T_1R ( * NOTE: A length of zero is ok, and will create a zero-length, null * terminated string. */ - Length = 0; while ((Length < Operand[0]->Buffer.Length) && (Length < Operand[1]->Integer.Value) && (Operand[0]->Buffer.Pointer[Length])) @@ -418,6 +417,7 @@ AcpiExOpcode_2A_1T_1R ( if (Index >= Operand[0]->String.Length) { + Length = Operand[0]->String.Length; Status = AE_AML_STRING_LIMIT; } @@ -428,6 +428,7 @@ AcpiExOpcode_2A_1T_1R ( if (Index >= Operand[0]->Buffer.Length) { + Length = Operand[0]->Buffer.Length; Status = AE_AML_BUFFER_LIMIT; } @@ -438,6 +439,7 @@ AcpiExOpcode_2A_1T_1R ( if (Index >= Operand[0]->Package.Count) { + Length = Operand[0]->Package.Count; Status = AE_AML_PACKAGE_LIMIT; } @@ -456,8 +458,8 @@ AcpiExOpcode_2A_1T_1R ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Index (0x%8.8X%8.8X) is beyond end of object", - ACPI_FORMAT_UINT64 (Index))); + "Index (0x%X%8.8X) is beyond end of object (length 0x%X)", + ACPI_FORMAT_UINT64 (Index), (UINT32) Length)); goto Cleanup; } diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index cdd6a9fcd004..1de341ce9024 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -109,18 +109,22 @@ AcpiNsEvaluate ( Info->ReturnObject = NULL; Info->ParamCount = 0; - /* - * Get the actual namespace node for the target object. Handles these cases: - * - * 1) Null node, Pathname (absolute path) - * 2) Node, Pathname (path relative to Node) - * 3) Node, Null Pathname - */ - Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname, - ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode); - if (ACPI_FAILURE (Status)) + if (!Info->ResolvedNode) { - return_ACPI_STATUS (Status); + /* + * Get the actual namespace node for the target object if we need to. + * Handles these cases: + * + * 1) Null node, Pathname (absolute path) + * 2) Node, Pathname (path relative to Node) + * 3) Node, Null Pathname + */ + Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname, + ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } /* diff --git a/source/components/namespace/nspredef.c b/source/components/namespace/nspredef.c index f12bc155ac06..a9250e36207c 100644 --- a/source/components/namespace/nspredef.c +++ b/source/components/namespace/nspredef.c @@ -82,30 +82,11 @@ AcpiNsCheckReference ( ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT *ReturnObject); -static void -AcpiNsGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes); - static UINT32 AcpiNsGetBitmappedType ( ACPI_OPERAND_OBJECT *ReturnObject); -/* - * Names for the types that can be returned by the predefined objects. - * Used for warning messages. Must be in the same order as the ACPI_RTYPEs - */ -static const char *AcpiRtypeNames[] = -{ - "/Integer", - "/String", - "/Buffer", - "/Package", - "/Reference", -}; - - /******************************************************************************* * * FUNCTION: AcpiNsCheckPredefinedNames @@ -137,7 +118,7 @@ AcpiNsCheckPredefinedNames ( /* Match the name for this method/object against the predefined list */ - Predefined = AcpiNsCheckForPredefinedName (Node); + Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); /* Get the full pathname to the object, for use in warning messages */ @@ -321,8 +302,8 @@ AcpiNsCheckParameterCount ( * Validate the user-supplied parameter count. * Allow two different legal argument counts (_SCP, etc.) */ - RequiredParamsCurrent = Predefined->Info.ParamCount & 0x0F; - RequiredParamsOld = Predefined->Info.ParamCount >> 4; + RequiredParamsCurrent = Predefined->Info.ArgumentList & METHOD_ARG_MASK; + RequiredParamsOld = Predefined->Info.ArgumentList >> METHOD_ARG_BIT_WIDTH; if (UserParamCount != ACPI_UINT32_MAX) { @@ -351,58 +332,6 @@ AcpiNsCheckParameterCount ( } -/******************************************************************************* - * - * FUNCTION: AcpiNsCheckForPredefinedName - * - * PARAMETERS: Node - Namespace node for the method/object - * - * RETURN: Pointer to entry in predefined table. NULL indicates not found. - * - * DESCRIPTION: Check an object name against the predefined object list. - * - ******************************************************************************/ - -const ACPI_PREDEFINED_INFO * -AcpiNsCheckForPredefinedName ( - ACPI_NAMESPACE_NODE *Node) -{ - const ACPI_PREDEFINED_INFO *ThisName; - - - /* Quick check for a predefined name, first character must be underscore */ - - if (Node->Name.Ascii[0] != '_') - { - return (NULL); - } - - /* Search info table for a predefined method/object name */ - - ThisName = PredefinedNames; - while (ThisName->Info.Name[0]) - { - if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Info.Name)) - { - return (ThisName); - } - - /* - * Skip next entry in the table if this name returns a Package - * (next entry contains the package info) - */ - if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) - { - ThisName++; - } - - ThisName++; - } - - return (NULL); /* Not found */ -} - - /******************************************************************************* * * FUNCTION: AcpiNsCheckObjectType @@ -480,7 +409,7 @@ TypeErrorExit: /* Create a string with all expected types for this predefined object */ - AcpiNsGetExpectedTypes (TypeBuffer, ExpectedBtypes); + AcpiUtGetExpectedReturnTypes (TypeBuffer, ExpectedBtypes); if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT) { @@ -600,45 +529,3 @@ AcpiNsGetBitmappedType ( return (ReturnBtype); } - - -/******************************************************************************* - * - * FUNCTION: AcpiNsGetExpectedTypes - * - * PARAMETERS: Buffer - Pointer to where the string is returned - * ExpectedBtypes - Bitmap of expected return type(s) - * - * RETURN: Buffer is populated with type names. - * - * DESCRIPTION: Translate the expected types bitmap into a string of ascii - * names of expected types, for use in warning messages. - * - ******************************************************************************/ - -static void -AcpiNsGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes) -{ - UINT32 ThisRtype; - UINT32 i; - UINT32 j; - - - j = 1; - Buffer[0] = 0; - ThisRtype = ACPI_RTYPE_INTEGER; - - for (i = 0; i < ACPI_NUM_RTYPES; i++) - { - /* If one of the expected types, concatenate the name of this type */ - - if (ExpectedBtypes & ThisRtype) - { - ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); - j = 0; /* Use name separator from now on */ - } - ThisRtype <<= 1; /* Next Rtype */ - } -} diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index 772e0774791f..6f41c46321e4 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -590,8 +590,12 @@ AcpiTbValidateFadt ( /* * For each extended field, check for length mismatch between the * legacy length field and the corresponding 64-bit X length field. + * Note: If the legacy length field is > 0xFF bits, ignore this + * check. (GPE registers can be larger than the 64-bit GAS structure + * can accomodate, 0xFF bits). */ if (Address64->Address && + (ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) && (Address64->BitWidth != ACPI_MUL_8 (Length))) { ACPI_BIOS_WARNING ((AE_INFO, diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c index 1f6906918811..53081625999b 100644 --- a/source/components/tables/tbxface.c +++ b/source/components/tables/tbxface.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: tbxface - ACPI table oriented external interfaces + * Module Name: tbxface - ACPI table-oriented external interfaces * *****************************************************************************/ @@ -86,7 +86,7 @@ AcpiAllocateRootTable ( * array is dynamically allocated. * InitialTableCount - Size of InitialTableArray, in number of * ACPI_TABLE_DESC structures - * AllowRealloc - Flag to tell Table Manager if resize of + * AllowResize - Flag to tell Table Manager if resize of * pre-allocated array is allowed. Ignored * if InitialTableArray is NULL. * @@ -117,8 +117,8 @@ AcpiInitializeTables ( /* - * Set up the Root Table Array - * Allocate the table array if requested + * Setup the Root Table Array and allocate the table array + * if requested */ if (!InitialTableArray) { @@ -304,9 +304,10 @@ ACPI_EXPORT_SYMBOL (AcpiGetTableHeader) * Instance - Which instance (for SSDTs) * OutTable - Where the pointer to the table is returned * - * RETURN: Status and pointer to table + * RETURN: Status and pointer to the requested table * - * DESCRIPTION: Finds and verifies an ACPI table. + * DESCRIPTION: Finds and verifies an ACPI table. Table must be in the + * RSDT/XSDT. * ******************************************************************************/ @@ -365,9 +366,10 @@ ACPI_EXPORT_SYMBOL (AcpiGetTable) * PARAMETERS: TableIndex - Table index * Table - Where the pointer to the table is returned * - * RETURN: Status and pointer to the table + * RETURN: Status and pointer to the requested table * - * DESCRIPTION: Obtain a table by an index into the global table list. + * DESCRIPTION: Obtain a table by an index into the global table list. Used + * internally also. * ******************************************************************************/ @@ -428,7 +430,7 @@ ACPI_EXPORT_SYMBOL (AcpiGetTableByIndex) * * RETURN: Status * - * DESCRIPTION: Install table event handler + * DESCRIPTION: Install a global table event handler. * ******************************************************************************/ @@ -484,7 +486,7 @@ ACPI_EXPORT_SYMBOL (AcpiInstallTableHandler) * * RETURN: Status * - * DESCRIPTION: Remove table event handler + * DESCRIPTION: Remove a table event handler * ******************************************************************************/ diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index a1007136a27d..f18d5564f9d9 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -390,11 +390,11 @@ AcpiUtDeleteInternalObjectList ( * FUNCTION: AcpiUtUpdateRefCount * * PARAMETERS: Object - Object whose ref count is to be updated - * Action - What to do + * Action - What to do (REF_INCREMENT or REF_DECREMENT) * - * RETURN: New ref count + * RETURN: None. Sets new reference count within the object * - * DESCRIPTION: Modify the ref count and return it. + * DESCRIPTION: Modify the reference count for an internal acpi object * ******************************************************************************/ @@ -403,8 +403,9 @@ AcpiUtUpdateRefCount ( ACPI_OPERAND_OBJECT *Object, UINT32 Action) { - UINT16 Count; - UINT16 NewCount; + UINT16 OriginalCount; + UINT16 NewCount = 0; + ACPI_CPU_FLAGS LockFlags; ACPI_FUNCTION_NAME (UtUpdateRefCount); @@ -415,80 +416,85 @@ AcpiUtUpdateRefCount ( return; } - Count = Object->Common.ReferenceCount; - NewCount = Count; - /* - * Perform the reference count action (increment, decrement, force delete) + * Always get the reference count lock. Note: Interpreter and/or + * Namespace is not always locked when this function is called. */ + LockFlags = AcpiOsAcquireLock (AcpiGbl_ReferenceCountLock); + OriginalCount = Object->Common.ReferenceCount; + + /* Perform the reference count action (increment, decrement) */ + switch (Action) { case REF_INCREMENT: - NewCount++; + NewCount = OriginalCount + 1; Object->Common.ReferenceCount = NewCount; + AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags); + + /* The current reference count should never be zero here */ + + if (!OriginalCount) + { + ACPI_WARNING ((AE_INFO, + "Obj %p, Reference Count was zero before increment\n", + Object)); + } ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Refs=%X, [Incremented]\n", - Object, NewCount)); + "Obj %p Type %.2X Refs %.2X [Incremented]\n", + Object, Object->Common.Type, NewCount)); break; case REF_DECREMENT: - if (Count < 1) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Refs=%X, can't decrement! (Set to 0)\n", - Object, NewCount)); + /* The current reference count must be non-zero */ - NewCount = 0; - } - else + if (OriginalCount) { - NewCount--; - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Refs=%X, [Decremented]\n", - Object, NewCount)); + NewCount = OriginalCount - 1; + Object->Common.ReferenceCount = NewCount; } - if (Object->Common.Type == ACPI_TYPE_METHOD) + AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags); + + if (!OriginalCount) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount)); + ACPI_WARNING ((AE_INFO, + "Obj %p, Reference Count is already zero, cannot decrement\n", + Object)); } - Object->Common.ReferenceCount = NewCount; + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + "Obj %p Type %.2X Refs %.2X [Decremented]\n", + Object, Object->Common.Type, NewCount)); + + /* Actually delete the object on a reference count of zero */ + if (NewCount == 0) { AcpiUtDeleteInternalObj (Object); } break; - case REF_FORCE_DELETE: - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "Obj %p Refs=%X, Force delete! (Set to 0)\n", Object, Count)); - - NewCount = 0; - Object->Common.ReferenceCount = NewCount; - AcpiUtDeleteInternalObj (Object); - break; - default: - ACPI_ERROR ((AE_INFO, "Unknown action (0x%X)", Action)); - break; + AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags); + ACPI_ERROR ((AE_INFO, "Unknown Reference Count action (0x%X)", + Action)); + return; } /* * Sanity check the reference count, for debug purposes only. * (A deleted object will have a huge reference count) */ - if (Count > ACPI_MAX_REFERENCE_COUNT) + if (NewCount > ACPI_MAX_REFERENCE_COUNT) { ACPI_WARNING ((AE_INFO, - "Large Reference Count (0x%X) in object %p", Count, Object)); + "Large Reference Count (0x%X) in object %p, Type=0x%.2X", + NewCount, Object, Object->Common.Type)); } } @@ -499,8 +505,7 @@ AcpiUtUpdateRefCount ( * * PARAMETERS: Object - Increment ref count for this object * and all sub-objects - * Action - Either REF_INCREMENT or REF_DECREMENT or - * REF_FORCE_DELETE + * Action - Either REF_INCREMENT or REF_DECREMENT * * RETURN: Status * @@ -771,7 +776,6 @@ AcpiUtRemoveReference ( /* * Allow a NULL pointer to be passed in, just ignore it. This saves * each caller from having to check. Also, ignore NS nodes. - * */ if (!Object || (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)) diff --git a/source/components/utilities/utmutex.c b/source/components/utilities/utmutex.c index 7755c9b2f691..a74ef81fa0b4 100644 --- a/source/components/utilities/utmutex.c +++ b/source/components/utilities/utmutex.c @@ -96,7 +96,7 @@ AcpiUtMutexInitialize ( } } - /* Create the spinlocks for use at interrupt level */ + /* Create the spinlocks for use at interrupt level or for speed */ Status = AcpiOsCreateLock (&AcpiGbl_GpeLock); if (ACPI_FAILURE (Status)) @@ -110,7 +110,14 @@ AcpiUtMutexInitialize ( return_ACPI_STATUS (Status); } + Status = AcpiOsCreateLock (&AcpiGbl_ReferenceCountLock); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Mutex for _OSI support */ + Status = AcpiOsCreateMutex (&AcpiGbl_OsiMutex); if (ACPI_FAILURE (Status)) { @@ -160,6 +167,7 @@ AcpiUtMutexTerminate ( AcpiOsDeleteLock (AcpiGbl_GpeLock); AcpiOsDeleteLock (AcpiGbl_HardwareLock); + AcpiOsDeleteLock (AcpiGbl_ReferenceCountLock); /* Delete the reader/writer lock */ diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index 7449b26feb8b..81d648bd5107 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -115,10 +115,16 @@ ACPI_STATUS AcpiUtInitializeInterfaces ( void) { + ACPI_STATUS Status; UINT32 i; - (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces; /* Link the static list of supported interfaces */ @@ -140,23 +146,28 @@ AcpiUtInitializeInterfaces ( * * PARAMETERS: None * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Delete all interfaces in the global list. Sets * AcpiGbl_SupportedInterfaces to NULL. * ******************************************************************************/ -void +ACPI_STATUS AcpiUtInterfaceTerminate ( void) { + ACPI_STATUS Status; ACPI_INTERFACE_INFO *NextInterface; - (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - NextInterface = AcpiGbl_SupportedInterfaces; + Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + NextInterface = AcpiGbl_SupportedInterfaces; while (NextInterface) { AcpiGbl_SupportedInterfaces = NextInterface->Next; @@ -173,6 +184,7 @@ AcpiUtInterfaceTerminate ( } AcpiOsReleaseMutex (AcpiGbl_OsiMutex); + return (AE_OK); } @@ -350,6 +362,7 @@ AcpiUtOsiImplementation ( ACPI_OPERAND_OBJECT *ReturnDesc; ACPI_INTERFACE_INFO *InterfaceInfo; ACPI_INTERFACE_HANDLER InterfaceHandler; + ACPI_STATUS Status; UINT32 ReturnValue; @@ -376,7 +389,11 @@ AcpiUtOsiImplementation ( /* Default return value is 0, NOT SUPPORTED */ ReturnValue = 0; - (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + if (ACPI_FAILURE (Status)) + { + return (Status); + } /* Lookup the interface in the global _OSI list */ diff --git a/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c new file mode 100644 index 000000000000..4d85497e6779 --- /dev/null +++ b/source/components/utilities/utpredef.c @@ -0,0 +1,451 @@ +/****************************************************************************** + * + * Module Name: utpredef - support functions for predefined names + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2013, 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. + */ + +#define __UTPREDEF_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acpredef.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utpredef") + + +/* + * Names for the types that can be returned by the predefined objects. + * Used for warning messages. Must be in the same order as the ACPI_RTYPEs + */ +static const char *UtRtypeNames[] = +{ + "/Integer", + "/String", + "/Buffer", + "/Package", + "/Reference", +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetNextPredefinedMethod + * + * PARAMETERS: ThisName - Entry in the predefined method/name table + * + * RETURN: Pointer to next entry in predefined table. + * + * DESCRIPTION: Get the next entry in the predefine method table. Handles the + * cases where a package info entry follows a method name that + * returns a package. + * + ******************************************************************************/ + +const ACPI_PREDEFINED_INFO * +AcpiUtGetNextPredefinedMethod ( + const ACPI_PREDEFINED_INFO *ThisName) +{ + + /* + * Skip next entry in the table if this name returns a Package + * (next entry contains the package info) + */ + if ((ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) && + (ThisName->Info.ExpectedBtypes != ACPI_RTYPE_ALL)) + { + ThisName++; + } + + ThisName++; + return (ThisName); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtMatchPredefinedMethod + * + * PARAMETERS: Name - Name to find + * + * RETURN: Pointer to entry in predefined table. NULL indicates not found. + * + * DESCRIPTION: Check an object name against the predefined object list. + * + ******************************************************************************/ + +const ACPI_PREDEFINED_INFO * +AcpiUtMatchPredefinedMethod ( + char *Name) +{ + const ACPI_PREDEFINED_INFO *ThisName; + + + /* Quick check for a predefined name, first character must be underscore */ + + if (Name[0] != '_') + { + return (NULL); + } + + /* Search info table for a predefined method/object name */ + + ThisName = AcpiGbl_PredefinedMethods; + while (ThisName->Info.Name[0]) + { + if (ACPI_COMPARE_NAME (Name, ThisName->Info.Name)) + { + return (ThisName); + } + + ThisName = AcpiUtGetNextPredefinedMethod (ThisName); + } + + return (NULL); /* Not found */ +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetExpectedReturnTypes + * + * PARAMETERS: Buffer - Where the formatted string is returned + * ExpectedBTypes - Bitfield of expected data types + * + * RETURN: Formatted string in Buffer. + * + * DESCRIPTION: Format the expected object types into a printable string. + * + ******************************************************************************/ + +void +AcpiUtGetExpectedReturnTypes ( + char *Buffer, + UINT32 ExpectedBtypes) +{ + UINT32 ThisRtype; + UINT32 i; + UINT32 j; + + + j = 1; + Buffer[0] = 0; + ThisRtype = ACPI_RTYPE_INTEGER; + + for (i = 0; i < ACPI_NUM_RTYPES; i++) + { + /* If one of the expected types, concatenate the name of this type */ + + if (ExpectedBtypes & ThisRtype) + { + ACPI_STRCAT (Buffer, &UtRtypeNames[i][j]); + j = 0; /* Use name separator from now on */ + } + + ThisRtype <<= 1; /* Next Rtype */ + } +} + + +/******************************************************************************* + * + * The remaining functions are used by iASL and AcpiHelp only + * + ******************************************************************************/ + +#if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP) +#include +#include + +/* Local prototypes */ + +static UINT32 +AcpiUtGetArgumentTypes ( + char *Buffer, + UINT16 ArgumentTypes); + + +/* Types that can be returned externally by a predefined name */ + +static const char *UtExternalTypeNames[] = /* Indexed by ACPI_TYPE_* */ +{ + ", UNSUPPORTED-TYPE", + ", Integer", + ", String", + ", Buffer", + ", Package" +}; + +/* Bit widths for resource descriptor predefined names */ + +static const char *UtResourceTypeNames[] = +{ + "/1", + "/2", + "/3", + "/8", + "/16", + "/32", + "/64", + "/variable", +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtMatchResourceName + * + * PARAMETERS: Name - Name to find + * + * RETURN: Pointer to entry in the resource table. NULL indicates not + * found. + * + * DESCRIPTION: Check an object name against the predefined resource + * descriptor object list. + * + ******************************************************************************/ + +const ACPI_PREDEFINED_INFO * +AcpiUtMatchResourceName ( + char *Name) +{ + const ACPI_PREDEFINED_INFO *ThisName; + + + /* Quick check for a predefined name, first character must be underscore */ + + if (Name[0] != '_') + { + return (NULL); + } + + /* Search info table for a predefined method/object name */ + + ThisName = AcpiGbl_ResourceNames; + while (ThisName->Info.Name[0]) + { + if (ACPI_COMPARE_NAME (Name, ThisName->Info.Name)) + { + return (ThisName); + } + + ThisName++; + } + + return (NULL); /* Not found */ +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtDisplayPredefinedMethod + * + * PARAMETERS: Buffer - Scratch buffer for this function + * ThisName - Entry in the predefined method/name table + * MultiLine - TRUE if output should be on >1 line + * + * RETURN: None + * + * DESCRIPTION: Display information about a predefined method. Number and + * type of the input arguments, and expected type(s) for the + * return value, if any. + * + ******************************************************************************/ + +void +AcpiUtDisplayPredefinedMethod ( + char *Buffer, + const ACPI_PREDEFINED_INFO *ThisName, + BOOLEAN MultiLine) +{ + UINT32 ArgCount; + + /* + * Get the argument count and the string buffer + * containing all argument types + */ + ArgCount = AcpiUtGetArgumentTypes (Buffer, + ThisName->Info.ArgumentList); + + if (MultiLine) + { + printf (" "); + } + + printf ("%4.4s Requires %s%u argument%s", + ThisName->Info.Name, + (ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM) ? + "(at least) " : "", + ArgCount, ArgCount != 1 ? "s" : ""); + + /* Display the types for any arguments */ + + if (ArgCount > 0) + { + printf (" (%s)", Buffer); + } + + if (MultiLine) + { + printf ("\n "); + } + + /* Get the return value type(s) allowed */ + + if (ThisName->Info.ExpectedBtypes) + { + AcpiUtGetExpectedReturnTypes (Buffer, ThisName->Info.ExpectedBtypes); + printf (" Return value types: %s\n", Buffer); + } + else + { + printf (" No return value\n"); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetArgumentTypes + * + * PARAMETERS: Buffer - Where to return the formatted types + * ArgumentTypes - Types field for this method + * + * RETURN: Count - the number of arguments required for this method + * + * DESCRIPTION: Format the required data types for this method (Integer, + * String, Buffer, or Package) and return the required argument + * count. + * + ******************************************************************************/ + +static UINT32 +AcpiUtGetArgumentTypes ( + char *Buffer, + UINT16 ArgumentTypes) +{ + UINT16 ThisArgumentType; + UINT16 SubIndex; + UINT16 ArgCount; + UINT32 i; + + + *Buffer = 0; + SubIndex = 2; + + /* First field in the types list is the count of args to follow */ + + ArgCount = (ArgumentTypes & METHOD_ARG_MASK); + ArgumentTypes >>= METHOD_ARG_BIT_WIDTH; + + if (ArgCount > METHOD_PREDEF_ARGS_MAX) + { + printf ("**** Invalid argument count (%u) " + "in predefined info structure\n", ArgCount); + return (ArgCount); + } + + /* Get each argument from the list, convert to ascii, store to buffer */ + + for (i = 0; i < ArgCount; i++) + { + ThisArgumentType = (ArgumentTypes & METHOD_ARG_MASK); + if (!ThisArgumentType || (ThisArgumentType > METHOD_MAX_ARG_TYPE)) + { + printf ("**** Invalid argument type (%u) " + "in predefined info structure\n", ThisArgumentType); + return (ArgCount); + } + + strcat (Buffer, UtExternalTypeNames[ThisArgumentType] + SubIndex); + + /* Shift to next argument type field */ + + ArgumentTypes >>= METHOD_ARG_BIT_WIDTH; + SubIndex = 0; + } + + return (ArgCount); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetResourceBitWidth + * + * PARAMETERS: Buffer - Where the formatted string is returned + * Types - Bitfield of expected data types + * + * RETURN: Count of return types. Formatted string in Buffer. + * + * DESCRIPTION: Format the resource bit widths into a printable string. + * + ******************************************************************************/ + +UINT32 +AcpiUtGetResourceBitWidth ( + char *Buffer, + UINT16 Types) +{ + UINT32 i; + UINT16 SubIndex; + UINT32 Found; + + + *Buffer = 0; + SubIndex = 1; + Found = 0; + + for (i = 0; i < NUM_RESOURCE_WIDTHS; i++) + { + if (Types & 1) + { + strcat (Buffer, &(UtResourceTypeNames[i][SubIndex])); + SubIndex = 0; + Found++; + } + + Types >>= 1; + } + + return (Found); +} +#endif diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index 60405aa47564..450698054d3b 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -373,7 +373,11 @@ AcpiInstallInterface ( return (AE_BAD_PARAMETER); } - (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + if (ACPI_FAILURE (Status)) + { + return (Status); + } /* Check if the interface name is already in the global list */ @@ -434,7 +438,11 @@ AcpiRemoveInterface ( return (AE_BAD_PARAMETER); } - (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + if (ACPI_FAILURE (Status)) + { + return (Status); + } Status = AcpiUtRemoveInterface (InterfaceName); @@ -464,10 +472,14 @@ ACPI_STATUS AcpiInstallInterfaceHandler ( ACPI_INTERFACE_HANDLER Handler) { - ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status; - (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); + if (ACPI_FAILURE (Status)) + { + return (Status); + } if (Handler && AcpiGbl_InterfaceHandler) { diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 987fc6126efa..91661d631a29 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -228,6 +228,7 @@ ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPending; */ ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */ ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */ +ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_ReferenceCountLock; /* Mutex for _OSI support */ diff --git a/source/include/aclocal.h b/source/include/aclocal.h index ab03935a9c4e..f9fefb5df796 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -335,6 +335,7 @@ ACPI_STATUS (*ACPI_INTERNAL_METHOD) ( #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF +#pragma pack(1) /* * Information structure for ACPI predefined names. @@ -347,7 +348,7 @@ ACPI_STATUS (*ACPI_INTERNAL_METHOD) ( typedef struct acpi_name_info { char Name[ACPI_NAME_SIZE]; - UINT8 ParamCount; + UINT16 ArgumentList; UINT8 ExpectedBtypes; } ACPI_NAME_INFO; @@ -372,7 +373,7 @@ typedef struct acpi_package_info UINT8 Count1; UINT8 ObjectType2; UINT8 Count2; - UINT8 Reserved; + UINT16 Reserved; } ACPI_PACKAGE_INFO; @@ -383,6 +384,7 @@ typedef struct acpi_package_info2 UINT8 Type; UINT8 Count; UINT8 ObjectType[4]; + UINT8 Reserved; } ACPI_PACKAGE_INFO2; @@ -394,7 +396,7 @@ typedef struct acpi_package_info3 UINT8 Count; UINT8 ObjectType[2]; UINT8 TailObjectType; - UINT8 Reserved; + UINT16 Reserved; } ACPI_PACKAGE_INFO3; @@ -407,6 +409,10 @@ typedef union acpi_predefined_info } ACPI_PREDEFINED_INFO; +/* Reset to default packing */ + +#pragma pack() + /* Data block used during object validation */ diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 4009c2d14438..07b0fe95315f 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -295,10 +295,6 @@ AcpiNsCheckPredefinedNames ( ACPI_STATUS ReturnStatus, ACPI_OPERAND_OBJECT **ReturnObject); -const ACPI_PREDEFINED_INFO * -AcpiNsCheckForPredefinedName ( - ACPI_NAMESPACE_NODE *Node); - void AcpiNsCheckParameterCount ( char *Pathname, diff --git a/source/include/acpixf.h b/source/include/acpixf.h index a547bcc8bb1f..405eb360ec9e 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -47,7 +47,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20130214 +#define ACPI_CA_VERSION 0x20130328 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/acpredef.h b/source/include/acpredef.h index 771e3441fc69..7a652b51fac3 100644 --- a/source/include/acpredef.h +++ b/source/include/acpredef.h @@ -57,7 +57,7 @@ * object type * count * - * ACPI_PTYPE1_VAR: Variable-length length: + * ACPI_PTYPE1_VAR: Variable-length length. Zero-length package is allowed: * object type (Int/Buf/Ref) * * ACPI_PTYPE1_OPTION: Package has some required and some optional elements @@ -67,14 +67,16 @@ * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each * of the different types describe the contents of each of the sub-packages. * - * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: + * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types. Zero-length + * parent package is allowed: * object type * count * object type * count * (Used for _ALR,_MLS,_PSS,_TRT,_TSS) * - * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element: + * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element. + * Zero-length parent package is allowed: * object type * (Used for _CSD,_PSD,_TSD) * @@ -85,17 +87,19 @@ * count * (Used for _CST) * - * ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length + * ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length. Zero-length + * parent package is allowed. * (Used for _PRT) * - * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length + * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length. + * Zero-length parent package is allowed: * (Used for _HPX) * * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length * (Used for _ART, _FPS) * * ACPI_PTYPE2_FIX_VAR: Each subpackage consists of some fixed-length elements - * followed by an optional element + * followed by an optional element. Zero-length parent package is allowed. * object type * count * object type @@ -119,8 +123,49 @@ enum AcpiReturnPackageTypes }; +/* Support macros for users of the predefined info table */ + +#define METHOD_PREDEF_ARGS_MAX 4 +#define METHOD_ARG_BIT_WIDTH 3 +#define METHOD_ARG_MASK 0x0007 +#define ARG_COUNT_IS_MINIMUM 0x8000 +#define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE + +#define METHOD_GET_COUNT(ArgList) (ArgList & METHOD_ARG_MASK) +#define METHOD_GET_NEXT_ARG(ArgList) (ArgList >> METHOD_ARG_BIT_WIDTH) + +/* Macros used to build the predefined info table */ + +#define METHOD_0ARGS 0 +#define METHOD_1ARGS(a1) (1 | (a1 << 3)) +#define METHOD_2ARGS(a1,a2) (2 | (a1 << 3) | (a2 << 6)) +#define METHOD_3ARGS(a1,a2,a3) (3 | (a1 << 3) | (a2 << 6) | (a3 << 9)) +#define METHOD_4ARGS(a1,a2,a3,a4) (4 | (a1 << 3) | (a2 << 6) | (a3 << 9) | (a4 << 12)) + +#define METHOD_RETURNS(type) (type) +#define METHOD_NO_RETURN_VALUE 0 + +#define PACKAGE_INFO(a,b,c,d,e,f) {{{(a),(b),(c),(d)}, ((((UINT16)(f)) << 8) | (e)), 0}} + + +/* Support macros for the resource descriptor info table */ + +#define WIDTH_1 0x0001 +#define WIDTH_2 0x0002 +#define WIDTH_3 0x0004 +#define WIDTH_8 0x0008 +#define WIDTH_16 0x0010 +#define WIDTH_32 0x0020 +#define WIDTH_64 0x0040 +#define VARIABLE_DATA 0x0080 +#define NUM_RESOURCE_WIDTHS 8 + +#define WIDTH_ADDRESS WIDTH_16 | WIDTH_32 | WIDTH_64 + + #ifdef ACPI_CREATE_PREDEFINED_TABLE -/* +/****************************************************************************** + * * Predefined method/object information table. * * These are the names that can actually be evaluated via AcpiEvaluateObject. @@ -131,6 +176,7 @@ enum AcpiReturnPackageTypes * _Lxx and _Exx GPE methods * _Qxx EC methods * _T_x compiler temporary variables + * _Wxx wake events * * 2) Predefined names that never actually exist within the AML code: * Predefined resource descriptor field names @@ -138,13 +184,13 @@ enum AcpiReturnPackageTypes * 3) Predefined names that are implemented within ACPICA: * _OSI * - * 4) Some predefined names that are not documented within the ACPI spec. - * _WDG, _WED - * * The main entries in the table each contain the following items: * * Name - The ACPI reserved name - * ParamCount - Number of arguments to the method + * ArgumentList - Contains (in 16 bits), the number of required + * arguments to the method (3 bits), and a 3-bit type + * field for each argument (up to 4 arguments). The + * METHOD_?ARGS macros generate the correct packed data. * ExpectedBtypes - Allowed type(s) for the return value. * 0 means that no return value is expected. * @@ -154,252 +200,492 @@ enum AcpiReturnPackageTypes * overall size of the stored data. * * Note: The additional braces are intended to promote portability. - */ -static const ACPI_PREDEFINED_INFO PredefinedNames[] = + * + * Note2: Table is used by the kernel-resident subsystem, the iASL compiler, + * and the AcpiHelp utility. + * + * TBD: _PRT - currently ignore reversed entries. Attempt to fix in nsrepair. + * Possibly fixing package elements like _BIF, etc. + * + *****************************************************************************/ + +const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = { - {{"_AC0", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC1", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC2", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC3", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC4", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC5", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC6", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC7", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC8", 0, ACPI_RTYPE_INTEGER}}, - {{"_AC9", 0, ACPI_RTYPE_INTEGER}}, - {{"_ADR", 0, ACPI_RTYPE_INTEGER}}, - {{"_AEI", 0, ACPI_RTYPE_BUFFER}}, - {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC0", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC1", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC2", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC3", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL4", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC4", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL5", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC5", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL6", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC6", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL7", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC7", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL8", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC8", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_AL9", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_AC9", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_ALC", 0, ACPI_RTYPE_INTEGER}}, - {{"_ALI", 0, ACPI_RTYPE_INTEGER}}, - {{"_ALP", 0, ACPI_RTYPE_INTEGER}}, - {{"_ALR", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 (Ints) */ - {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, + {{"_ADR", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_ALT", 0, ACPI_RTYPE_INTEGER}}, - {{"_ART", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */ - {{{ACPI_PTYPE2_REV_FIXED,ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 11,0}}, + {{"_AEI", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - {{"_BBN", 0, ACPI_RTYPE_INTEGER}}, - {{"_BCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, + {{"_AL0", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_BCM", 1, 0}}, - {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, - {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, - {{"_BFS", 1, 0}}, - {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4,0}}, + {{"_AL1", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4,0}}, + {{"_AL2", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_BLT", 3, 0}}, - {{"_BMA", 1, ACPI_RTYPE_INTEGER}}, - {{"_BMC", 1, 0}}, - {{"_BMD", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (5 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + {{"_AL3", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_BMS", 1, ACPI_RTYPE_INTEGER}}, - {{"_BQC", 0, ACPI_RTYPE_INTEGER}}, - {{"_BST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, + {{"_AL4", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_BTM", 1, ACPI_RTYPE_INTEGER}}, - {{"_BTP", 1, 0}}, - {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */ - {{"_CDM", 0, ACPI_RTYPE_INTEGER}}, - {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}}, + {{"_AL5", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0}, 0,0}}, + {{"_AL6", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_CPC", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Bufs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,0}, 0,0}}, + {{"_AL7", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_CRS", 0, ACPI_RTYPE_BUFFER}}, - {{"_CRT", 0, ACPI_RTYPE_INTEGER}}, - {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */ - {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, + {{"_AL8", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ - {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}}, + {{"_AL9", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_CWS", 1, ACPI_RTYPE_INTEGER}}, - {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, - {{"_DCS", 0, ACPI_RTYPE_INTEGER}}, - {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, - {{"_DDN", 0, ACPI_RTYPE_STRING}}, - {{"_DEP", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_ALC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_DGS", 0, ACPI_RTYPE_INTEGER}}, - {{"_DIS", 0, 0}}, + {{"_ALI", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_DLM", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */ - {{{ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1, ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER}, 0,0}}, + {{"_ALP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_DMA", 0, ACPI_RTYPE_BUFFER}}, - {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, + {{"_ALR", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 2 (Ints) */ + PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0,0,0), - {{"_DOS", 1, 0}}, - {{"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ - {{"_DSS", 1, 0}}, - {{"_DSW", 3, 0}}, - {{"_DTI", 1, 0}}, - {{"_EC_", 0, ACPI_RTYPE_INTEGER}}, - {{"_EDL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs)*/ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_ALT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_EJ0", 1, 0}}, - {{"_EJ1", 1, 0}}, - {{"_EJ2", 1, 0}}, - {{"_EJ3", 1, 0}}, - {{"_EJ4", 1, 0}}, - {{"_EJD", 0, ACPI_RTYPE_STRING}}, - {{"_ERR", 3, ACPI_RTYPE_INTEGER}}, /* Internal use only, used by ACPICA test suites */ - {{"_EVT", 1, 0}}, - {{"_FDE", 0, ACPI_RTYPE_BUFFER}}, - {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}}, + {{"_ART", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */ + PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER, 11,0), - {{"_FDM", 1, 0}}, - {{"_FIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, + {{"_BBN", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_FIX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, + {{"_BCL", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0,0,0), - {{"_FPS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */ - {{{ACPI_PTYPE2_REV_FIXED,ACPI_RTYPE_INTEGER, 5, 0}, 0,0}}, + {{"_BCM", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, - {{"_FSL", 1, 0}}, - {{"_FST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0}, 0,0}}, + {{"_BCT", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_BDN", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_GAI", 0, ACPI_RTYPE_INTEGER}}, - {{"_GCP", 0, ACPI_RTYPE_INTEGER}}, - {{"_GHL", 0, ACPI_RTYPE_INTEGER}}, - {{"_GLK", 0, ACPI_RTYPE_INTEGER}}, - {{"_GPD", 0, ACPI_RTYPE_INTEGER}}, - {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ - {{"_GRT", 0, ACPI_RTYPE_BUFFER}}, - {{"_GSB", 0, ACPI_RTYPE_INTEGER}}, - {{"_GTF", 0, ACPI_RTYPE_BUFFER}}, - {{"_GTM", 0, ACPI_RTYPE_BUFFER}}, - {{"_GTS", 1, 0}}, - {{"_GWS", 1, ACPI_RTYPE_INTEGER}}, - {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, - {{"_HOT", 0, ACPI_RTYPE_INTEGER}}, - {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, + {{"_BFS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_BIF", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (9 Int),(4 Str) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING, 4,0), + + {{"_BIX", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING, 4,0), + + {{"_BLT", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_BMA", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_BMC", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_BMD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (5 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0,0,0), + + {{"_BMS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_BQC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_BST", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), + + {{"_BTM", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_BTP", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_CBA", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See PCI firmware spec 3.0 */ + + {{"_CDM", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_CID", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Strs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0,0,0), + + {{"_CLS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0,0,0), + + {{"_CPC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Bufs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,0,0,0), + + {{"_CRS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_CRT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_CSD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(n), n-1 Int) */ + PACKAGE_INFO (ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0,0,0), + + {{"_CST", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ + PACKAGE_INFO (ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER, 3,0), + + {{"_CWS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_DCK", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_DCS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_DDC", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER)}}, + + {{"_DDN", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_STRING)}}, + + {{"_DEP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_DGS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_DIS", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, + + {{"_DLM", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */ + PACKAGE_INFO (ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1, ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER, 0,0), + + {{"_DMA", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_DOD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0,0,0), + + {{"_DOS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_DSM", METHOD_4ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_PACKAGE), + METHOD_RETURNS (ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */ + + {{"_DSS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_DSW", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_DTI", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_EC_", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_EDL", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs)*/ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_EJ0", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_EJ1", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_EJ2", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_EJ3", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_EJ4", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_EJD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_STRING)}}, + + {{"_ERR", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_STRING, ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* Internal use only, used by ACPICA test suites */ + + {{"_EVT", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_FDE", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_FDI", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0,0,0), + + {{"_FDM", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_FIF", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), + + {{"_FIX", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0,0,0), + + {{"_FPS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */ + PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED,ACPI_RTYPE_INTEGER, 5, 0,0,0), + + {{"_FSL", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_FST", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0,0,0), + + {{"_GAI", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_GCP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_GHL", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_GLK", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_GPD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_GPE", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* _GPE method, not _GPE scope */ + + {{"_GRT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_GSB", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_GTF", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_GTM", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_GTS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_GWS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_HID", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}}, + + {{"_HOT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_HPP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), /* - * For _HPX, a single package is returned, containing a Variable-length number + * For _HPX, a single package is returned, containing a variable-length number * of sub-packages. Each sub-package contains a PCI record setting. * There are several different type of record settings, of different * lengths, but all elements of all settings are Integers. */ - {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */ - {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + {{"_HPX", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (var Ints) */ + PACKAGE_INFO (ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0,0,0), - {{"_HRV", 0, ACPI_RTYPE_INTEGER}}, - {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ - {{"_INI", 0, 0}}, - {{"_IRC", 0, 0}}, - {{"_LCK", 1, 0}}, - {{"_LID", 0, ACPI_RTYPE_INTEGER}}, - {{"_MAT", 0, ACPI_RTYPE_BUFFER}}, - {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8,0}, 0,0}}, + {{"_HRV", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Str/1 Buf) */ - {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, ACPI_RTYPE_BUFFER}, 1,0}}, + {{"_IFT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See IPMI spec */ - {{"_MSG", 1, 0}}, - {{"_MSM", 4, ACPI_RTYPE_INTEGER}}, - {{"_NTT", 0, ACPI_RTYPE_INTEGER}}, - {{"_OFF", 0, 0}}, - {{"_ON_", 0, 0}}, - {{"_OS_", 0, ACPI_RTYPE_STRING}}, - {{"_OSC", 4, ACPI_RTYPE_BUFFER}}, - {{"_OST", 3, 0}}, - {{"_PAI", 1, ACPI_RTYPE_INTEGER}}, - {{"_PCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_INI", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, - {{"_PCT", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, + {{"_IRC", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, - {{"_PDC", 1, 0}}, - {{"_PDL", 0, ACPI_RTYPE_INTEGER}}, - {{"_PIC", 1, 0}}, - {{"_PIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int),(3 Str) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_STRING}, 3,0}}, + {{"_LCK", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, - {{"_PLD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Bufs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0}, 0,0}}, + {{"_LID", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_PMC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (11 Int),(3 Str) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, ACPI_RTYPE_STRING}, 3,0}}, + {{"_MAT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - {{"_PMD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_MBM", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (8 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8,0,0,0), - {{"_PMM", 0, ACPI_RTYPE_INTEGER}}, - {{"_PPC", 0, ACPI_RTYPE_INTEGER}}, - {{"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* See dig64 spec */ - {{"_PR0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_MLS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (1 Str/1 Buf) */ + PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, ACPI_RTYPE_BUFFER, 1,0), - {{"_PR1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_MSG", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, - {{"_PR2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_MSM", METHOD_4ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_NTT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_PRE", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_OFF", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, - {{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_ON_", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, - {{"_PRS", 0, ACPI_RTYPE_BUFFER}}, + {{"_OS_", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_STRING)}}, + + {{"_OSC", METHOD_4ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_BUFFER), + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_OST", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_BUFFER), + METHOD_NO_RETURN_VALUE}}, + + {{"_PAI", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_PCL", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PCT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Buf) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0,0,0), + + {{"_PDC", METHOD_1ARGS (ACPI_TYPE_BUFFER), + METHOD_NO_RETURN_VALUE}}, + + {{"_PDL", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_PIC", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_PIF", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int),(3 Str) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_STRING, 3,0), + + {{"_PLD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Bufs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0,0,0), + + {{"_PMC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (11 Int),(3 Str) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, ACPI_RTYPE_STRING, 3,0), + + {{"_PMD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PMM", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_PPC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_PPE", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See dig64 spec */ + + {{"_PR0", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PR1", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PR2", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PR3", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PRE", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PRL", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PRS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, /* * For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source @@ -409,47 +695,86 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = * warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3) * in the statement below. */ - {{"_PRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */ - {{{ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER,ACPI_RTYPE_INTEGER}, - ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, - ACPI_RTYPE_INTEGER}}, + {{"_PRT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */ + PACKAGE_INFO (ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER, ACPI_RTYPE_INTEGER, + ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER), - {{"_PRW", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */ - {{{ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE, - ACPI_RTYPE_INTEGER}, ACPI_RTYPE_REFERENCE,0}}, + {{"_PRW", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */ + PACKAGE_INFO (ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE, + ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0), - {{"_PS0", 0, 0}}, - {{"_PS1", 0, 0}}, - {{"_PS2", 0, 0}}, - {{"_PS3", 0, 0}}, - {{"_PSC", 0, ACPI_RTYPE_INTEGER}}, - {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */ - {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}}, + {{"_PS0", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, - {{"_PSE", 1, 0}}, - {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_PS1", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, - {{"_PSR", 0, ACPI_RTYPE_INTEGER}}, - {{"_PSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (6 Int) */ - {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0}, 0,0}}, + {{"_PS2", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, - {{"_PSV", 0, ACPI_RTYPE_INTEGER}}, - {{"_PSW", 1, 0}}, - {{"_PTC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, + {{"_PS3", METHOD_0ARGS, + METHOD_NO_RETURN_VALUE}}, - {{"_PTP", 2, ACPI_RTYPE_INTEGER}}, - {{"_PTS", 1, 0}}, - {{"_PUR", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, + {{"_PSC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_PXM", 0, ACPI_RTYPE_INTEGER}}, - {{"_REG", 2, 0}}, - {{"_REV", 0, ACPI_RTYPE_INTEGER}}, - {{"_RMV", 0, ACPI_RTYPE_INTEGER}}, - {{"_ROM", 2, ACPI_RTYPE_BUFFER}}, - {{"_RTV", 0, ACPI_RTYPE_INTEGER}}, + {{"_PSD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (5 Int) with count */ + PACKAGE_INFO (ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0,0,0), + + {{"_PSE", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_PSL", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_PSR", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_PSS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (6 Int) */ + PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0,0,0), + + {{"_PSV", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_PSW", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_PTC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Buf) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0,0,0), + + {{"_PTP", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_PTS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_PUR", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), + + {{"_PXM", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_REG", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_REV", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_RMV", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_ROM", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_RTV", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* * For _S0_ through _S5_, the ACPI spec defines a return Package @@ -457,108 +782,283 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = * Allow this by making the objects "Variable-length length", but all elements * must be Integers. */ - {{"_S0_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + {{"_S0_", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - {{"_S1_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + {{"_S1_", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - {{"_S2_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + {{"_S2_", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - {{"_S3_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + {{"_S3_", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - {{"_S4_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + {{"_S4_", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - {{"_S5_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + {{"_S5_", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0,0,0), - {{"_S1D", 0, ACPI_RTYPE_INTEGER}}, - {{"_S2D", 0, ACPI_RTYPE_INTEGER}}, - {{"_S3D", 0, ACPI_RTYPE_INTEGER}}, - {{"_S4D", 0, ACPI_RTYPE_INTEGER}}, - {{"_S0W", 0, ACPI_RTYPE_INTEGER}}, - {{"_S1W", 0, ACPI_RTYPE_INTEGER}}, - {{"_S2W", 0, ACPI_RTYPE_INTEGER}}, - {{"_S3W", 0, ACPI_RTYPE_INTEGER}}, - {{"_S4W", 0, ACPI_RTYPE_INTEGER}}, - {{"_SBS", 0, ACPI_RTYPE_INTEGER}}, - {{"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */ - /* Note: the 3-arg definition may be removed for ACPI 4.0 */ - {{"_SDD", 1, 0}}, - {{"_SEG", 0, ACPI_RTYPE_INTEGER}}, - {{"_SHL", 1, ACPI_RTYPE_INTEGER}}, - {{"_SLI", 0, ACPI_RTYPE_BUFFER}}, - {{"_SPD", 1, ACPI_RTYPE_INTEGER}}, - {{"_SRS", 1, 0}}, - {{"_SRT", 1, ACPI_RTYPE_INTEGER}}, - {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ - {{"_SST", 1, 0}}, - {{"_STA", 0, ACPI_RTYPE_INTEGER}}, - {{"_STM", 3, 0}}, - {{"_STP", 2, ACPI_RTYPE_INTEGER}}, - {{"_STR", 0, ACPI_RTYPE_BUFFER}}, - {{"_STV", 2, ACPI_RTYPE_INTEGER}}, - {{"_SUB", 0, ACPI_RTYPE_STRING}}, - {{"_SUN", 0, ACPI_RTYPE_INTEGER}}, - {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, - {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, - {{"_TC2", 0, ACPI_RTYPE_INTEGER}}, - {{"_TDL", 0, ACPI_RTYPE_INTEGER}}, - {{"_TIP", 1, ACPI_RTYPE_INTEGER}}, - {{"_TIV", 1, ACPI_RTYPE_INTEGER}}, - {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, - {{"_TPC", 0, ACPI_RTYPE_INTEGER}}, - {{"_TPT", 1, 0}}, - {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 Ref/6 Int */ - {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}}, + {{"_S1D", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int with count */ - {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + {{"_S2D", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_TSP", 0, ACPI_RTYPE_INTEGER}}, - {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int */ - {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + {{"_S3D", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_TST", 0, ACPI_RTYPE_INTEGER}}, - {{"_TTS", 1, 0}}, - {{"_TZD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ - {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_S4D", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_TZM", 0, ACPI_RTYPE_REFERENCE}}, - {{"_TZP", 0, ACPI_RTYPE_INTEGER}}, - {{"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, - {{"_UPC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, + {{"_S0W", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, - {{"_UPD", 0, ACPI_RTYPE_INTEGER}}, - {{"_UPP", 0, ACPI_RTYPE_INTEGER}}, - {{"_VPO", 0, ACPI_RTYPE_INTEGER}}, + {{"_S1W", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_S2W", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_S3W", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_S4W", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_SBS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_SCP", METHOD_1ARGS (ACPI_TYPE_INTEGER) | ARG_COUNT_IS_MINIMUM, + METHOD_NO_RETURN_VALUE}}, /* Acpi 1.0 allowed 1 integer arg. Acpi 3.0 expanded to 3 args. Allow both. */ + + {{"_SDD", METHOD_1ARGS (ACPI_TYPE_BUFFER), + METHOD_NO_RETURN_VALUE}}, + + {{"_SEG", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_SHL", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_SLI", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_SPD", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_SRS", METHOD_1ARGS (ACPI_TYPE_BUFFER), + METHOD_NO_RETURN_VALUE}}, + + {{"_SRT", METHOD_1ARGS (ACPI_TYPE_BUFFER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_SRV", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See IPMI spec */ + + {{"_SST", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_STA", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_STM", METHOD_3ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_BUFFER, ACPI_TYPE_BUFFER), + METHOD_NO_RETURN_VALUE}}, + + {{"_STP", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_STR", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + + {{"_STV", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_SUB", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_STRING)}}, + + {{"_SUN", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_SWS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TC1", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TC2", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TDL", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TIP", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TIV", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TMP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TPC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TPT", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_TRT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 2 Ref/6 Int */ + PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER, 6, 0), + + {{"_TSD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int with count */ + PACKAGE_INFO (ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0,0,0), + + {{"_TSP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TSS", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int */ + PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0,0,0), + + {{"_TST", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_TTS", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_NO_RETURN_VALUE}}, + + {{"_TZD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ + PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + + {{"_TZM", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_REFERENCE)}}, + + {{"_TZP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_UID", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}}, + + {{"_UPC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), + + {{"_UPD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_UPP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + + {{"_VPO", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ - {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, - {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */ + {{"_WAK", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE)}}, + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), /* Fixed-length (2 Int), but is optional */ /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */ - {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, - {{"_WED", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}}, + {{"_WDG", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - {{{0,0,0,0}, 0,0}} /* Table terminator */ + {{"_WED", METHOD_1ARGS (ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER)}}, + + PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ +}; +#else +extern const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[]; +#endif + + +#if (defined ACPI_CREATE_RESOURCE_TABLE && defined ACPI_APPLICATION) +/****************************************************************************** + * + * Predefined names for use in Resource Descriptors. These names do not + * appear in the global Predefined Name table (since these names never + * appear in actual AML byte code, only in the original ASL) + * + * Note: Used by iASL compiler and AcpiHelp utility only. + * + *****************************************************************************/ + +const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[] = +{ + {{"_ADR", WIDTH_16 | WIDTH_64, 0}}, + {{"_ALN", WIDTH_8 | WIDTH_16 | WIDTH_32, 0}}, + {{"_ASI", WIDTH_8, 0}}, + {{"_ASZ", WIDTH_8, 0}}, + {{"_ATT", WIDTH_64, 0}}, + {{"_BAS", WIDTH_16 | WIDTH_32, 0}}, + {{"_BM_", WIDTH_1, 0}}, + {{"_DBT", WIDTH_16, 0}}, /* Acpi 5.0 */ + {{"_DEC", WIDTH_1, 0}}, + {{"_DMA", WIDTH_8, 0}}, + {{"_DPL", WIDTH_1, 0}}, /* Acpi 5.0 */ + {{"_DRS", WIDTH_16, 0}}, /* Acpi 5.0 */ + {{"_END", WIDTH_1, 0}}, /* Acpi 5.0 */ + {{"_FLC", WIDTH_2, 0}}, /* Acpi 5.0 */ + {{"_GRA", WIDTH_ADDRESS, 0}}, + {{"_HE_", WIDTH_1, 0}}, + {{"_INT", WIDTH_16 | WIDTH_32, 0}}, + {{"_IOR", WIDTH_2, 0}}, /* Acpi 5.0 */ + {{"_LEN", WIDTH_8 | WIDTH_ADDRESS, 0}}, + {{"_LIN", WIDTH_8, 0}}, /* Acpi 5.0 */ + {{"_LL_", WIDTH_1, 0}}, + {{"_MAF", WIDTH_1, 0}}, + {{"_MAX", WIDTH_ADDRESS, 0}}, + {{"_MEM", WIDTH_2, 0}}, + {{"_MIF", WIDTH_1, 0}}, + {{"_MIN", WIDTH_ADDRESS, 0}}, + {{"_MOD", WIDTH_1, 0}}, /* Acpi 5.0 */ + {{"_MTP", WIDTH_2, 0}}, + {{"_PAR", WIDTH_8, 0}}, /* Acpi 5.0 */ + {{"_PHA", WIDTH_1, 0}}, /* Acpi 5.0 */ + {{"_PIN", WIDTH_16, 0}}, /* Acpi 5.0 */ + {{"_PPI", WIDTH_8, 0}}, /* Acpi 5.0 */ + {{"_POL", WIDTH_1 | WIDTH_2, 0}}, /* Acpi 5.0 */ + {{"_RBO", WIDTH_8, 0}}, + {{"_RBW", WIDTH_8, 0}}, + {{"_RNG", WIDTH_1, 0}}, + {{"_RT_", WIDTH_8, 0}}, /* Acpi 3.0 */ + {{"_RW_", WIDTH_1, 0}}, + {{"_RXL", WIDTH_16, 0}}, /* Acpi 5.0 */ + {{"_SHR", WIDTH_2, 0}}, + {{"_SIZ", WIDTH_2, 0}}, + {{"_SLV", WIDTH_1, 0}}, /* Acpi 5.0 */ + {{"_SPE", WIDTH_32, 0}}, /* Acpi 5.0 */ + {{"_STB", WIDTH_2, 0}}, /* Acpi 5.0 */ + {{"_TRA", WIDTH_ADDRESS, 0}}, + {{"_TRS", WIDTH_1, 0}}, + {{"_TSF", WIDTH_8, 0}}, /* Acpi 3.0 */ + {{"_TTP", WIDTH_1, 0}}, + {{"_TXL", WIDTH_16, 0}}, /* Acpi 5.0 */ + {{"_TYP", WIDTH_2 | WIDTH_16, 0}}, + {{"_VEN", VARIABLE_DATA, 0}}, /* Acpi 5.0 */ + PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ }; -#if 0 - - /* This is an internally implemented control method, no need to check */ - {{"_OSI", 1, ACPI_RTYPE_INTEGER}}, - - /* TBD: */ - - _PRT - currently ignore reversed entries. Attempt to fix here? - Think about possibly fixing package elements like _BIF, etc. -#endif +static const ACPI_PREDEFINED_INFO AcpiGbl_ScopeNames[] = { + {{"_GPE", 0, 0}}, + {{"_PR_", 0, 0}}, + {{"_SB_", 0, 0}}, + {{"_SI_", 0, 0}}, + {{"_TZ_", 0, 0}}, + PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ +}; +#else +extern const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[]; #endif + #endif diff --git a/source/include/acutils.h b/source/include/acutils.h index 165a1587e71b..52fb04981700 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -119,9 +119,10 @@ typedef struct acpi_pkg_info } ACPI_PKG_INFO; +/* Object reference counts */ + #define REF_INCREMENT (UINT16) 0 #define REF_DECREMENT (UINT16) 1 -#define REF_FORCE_DELETE (UINT16) 2 /* AcpiUtDumpBuffer */ @@ -614,7 +615,7 @@ ACPI_STATUS AcpiUtInitializeInterfaces ( void); -void +ACPI_STATUS AcpiUtInterfaceTerminate ( void); @@ -635,6 +636,38 @@ AcpiUtOsiImplementation ( ACPI_WALK_STATE *WalkState); +/* + * utpredef - support for predefined names + */ +const ACPI_PREDEFINED_INFO * +AcpiUtGetNextPredefinedMethod ( + const ACPI_PREDEFINED_INFO *ThisName); + +const ACPI_PREDEFINED_INFO * +AcpiUtMatchPredefinedMethod ( + char *Name); + +const ACPI_PREDEFINED_INFO * +AcpiUtMatchResourceName ( + char *Name); + +void +AcpiUtDisplayPredefinedMethod ( + char *Buffer, + const ACPI_PREDEFINED_INFO *ThisName, + BOOLEAN MultiLine); + +void +AcpiUtGetExpectedReturnTypes ( + char *Buffer, + UINT32 ExpectedBtypes); + +UINT32 +AcpiUtGetResourceBitWidth ( + char *Buffer, + UINT16 Types); + + /* * utstate - Generic state creation/cache routines */ diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index 633b0db0a412..38e2b7e2378e 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -41,9 +41,10 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include "acpihelp.h" - #define ACPI_CREATE_PREDEFINED_TABLE +#define ACPI_CREATE_RESOURCE_TABLE + +#include "acpihelp.h" #include "acpredef.h" @@ -93,15 +94,6 @@ static const AH_DEVICE_ID AhDeviceIds[] = static char Gbl_Buffer[BUFFER_LENGTH]; static char Gbl_LineBuffer[LINE_BUFFER_LENGTH]; -static const char *AcpiRtypeNames[] = -{ - "/Integer", - "/String", - "/Buffer", - "/Package", - "/Reference", -}; - /* Local prototypes */ @@ -115,9 +107,8 @@ AhDisplayPredefinedInfo ( char *Name); static void -AhGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes); +AhDisplayResourceName ( + const ACPI_PREDEFINED_INFO *ThisName); static void AhDisplayAmlOpcode ( @@ -279,83 +270,57 @@ AhDisplayPredefinedName ( static void AhDisplayPredefinedInfo ( - char *Name) + char *Name) { const ACPI_PREDEFINED_INFO *ThisName; - BOOLEAN Matched; - UINT32 i; - /* Find/display only the exact input name */ + /* NOTE: we check both tables always because there are some dupes */ - for (ThisName = PredefinedNames; ThisName->Info.Name[0]; ThisName++) + /* Check against the predefine methods first */ + + ThisName = AcpiUtMatchPredefinedMethod (Name); + if (ThisName) { - Matched = TRUE; - for (i = 0; i < ACPI_NAME_SIZE; i++) - { - if (ThisName->Info.Name[i] != Name[i]) - { - Matched = FALSE; - break; - } - } + AcpiUtDisplayPredefinedMethod (Gbl_Buffer, ThisName, TRUE); + } - if (Matched) - { - AhGetExpectedTypes (Gbl_Buffer, ThisName->Info.ExpectedBtypes); + /* Check against the predefined resource descriptor names */ - printf ("%*s%4.4s has %u arguments, returns: %s\n", - 6, " ", ThisName->Info.Name, ThisName->Info.ParamCount, - ThisName->Info.ExpectedBtypes ? Gbl_Buffer : "-Nothing-"); - return; - } - - if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) - { - ThisName++; - } + ThisName = AcpiUtMatchResourceName (Name); + if (ThisName) + { + AhDisplayResourceName (ThisName); } } /******************************************************************************* * - * FUNCTION: AhGetExpectedTypes + * FUNCTION: AhDisplayResourceName * - * PARAMETERS: Buffer - Where the formatted string is returned - * ExpectedBTypes - Bitfield of expected data types + * PARAMETERS: ThisName - Entry in the predefined method/name table * - * RETURN: Formatted string in Buffer. + * RETURN: None * - * DESCRIPTION: Format the expected object types into a printable string. + * DESCRIPTION: Display information about a resource descriptor name. * ******************************************************************************/ static void -AhGetExpectedTypes ( - char *Buffer, - UINT32 ExpectedBtypes) +AhDisplayResourceName ( + const ACPI_PREDEFINED_INFO *ThisName) { - UINT32 ThisRtype; - UINT32 i; - UINT32 j; + UINT32 NumTypes; - j = 1; - Buffer[0] = 0; - ThisRtype = ACPI_RTYPE_INTEGER; + NumTypes = AcpiUtGetResourceBitWidth (Gbl_Buffer, + ThisName->Info.ArgumentList); - for (i = 0; i < ACPI_NUM_RTYPES; i++) - { - /* If one of the expected types, concatenate the name of this type */ - - if (ExpectedBtypes & ThisRtype) - { - strcat (Buffer, &AcpiRtypeNames[i][j]); - j = 0; /* Use name separator from now on */ - } - ThisRtype <<= 1; /* Next Rtype */ - } + printf (" %4.4s resource descriptor field is %s bits wide%s\n", + ThisName->Info.Name, + Gbl_Buffer, + (NumTypes > 1) ? " (depending on descriptor type)" : ""); } diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 1bd757534f0c..18317ffe3665 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -282,6 +282,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_OBJECT_BUFFER_FIELD", SRC_TYPE_STRUCT}, {"ACPI_OBJECT_CACHE_LIST", SRC_TYPE_STRUCT}, {"ACPI_OBJECT_COMMON", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_CONVERTER", SRC_TYPE_SIMPLE}, {"ACPI_OBJECT_DATA", SRC_TYPE_STRUCT}, {"ACPI_OBJECT_DEVICE", SRC_TYPE_STRUCT}, {"ACPI_OBJECT_EVENT", SRC_TYPE_STRUCT},