diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c index e67cdfdef..b2790c406 100644 --- a/source/compiler/aslanalyze.c +++ b/source/compiler/aslanalyze.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslanalyze.c - check for semantic errors - * $Revision: 1.65 $ + * $Revision: 1.66 $ * *****************************************************************************/ @@ -192,13 +192,13 @@ AnMapArgTypeToBtype ( return (ACPI_BTYPE_COMPUTE_DATA); case ARGI_DATAOBJECT: - + /* Buffer, string, package or reference to a Op - Used only by SizeOf operator*/ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE); case ARGI_COMPLEXOBJ: - + /* Buffer, String, or package */ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE); @@ -875,7 +875,7 @@ AnMethodAnalysisWalkBegin ( case PARSEOP_PROCESSOR: case PARSEOP_THERMALZONE: - /* + /* * The first operand is a name to be created in the namespace. * Check against the reserved list. */ @@ -921,7 +921,7 @@ AnMethodAnalysisWalkBegin ( if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) { /* - * _HID is a string, all characters must be alphanumeric. + * _HID is a string, all characters must be alphanumeric. * One of the things we want to catch here is the use of * a leading asterisk in the string. */ diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 92a15dc89..d9f357b0a 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslcompile - top level compile module - * $Revision: 1.56 $ + * $Revision: 1.60 $ * *****************************************************************************/ @@ -123,7 +123,6 @@ ACPI_MODULE_NAME ("aslcompile") - /******************************************************************************* * * FUNCTION: AslCompilerSignon @@ -179,10 +178,10 @@ AslCompilerSignon ( /* Compiler signon with copyright */ FlPrintFile (FileId, - "%s\n%s%s %s [%s]\n%sIncludes ACPI CA Subsystem version %X\n%s%s\n%sSupports ACPI Specification Revision 2.0a\n%s\n", + "%s\n%s%s\n%s%s version %X [%s]\n%s%s\n%sSupports ACPI Specification Revision 2.0a\n%s\n", Prefix, - Prefix, CompilerId, CompilerVersion, __DATE__, - Prefix, ACPI_CA_VERSION, + Prefix, IntelAcpiCA, + Prefix, CompilerId, ACPI_CA_VERSION, __DATE__, Prefix, CompilerCopyright, Prefix, Prefix); @@ -311,6 +310,8 @@ CmDoCompile (void) AslCompilerparse(); UtEndEvent (i++); + OpcGetIntegerWidth (RootNode); + /* Pre-process parse tree for any operator transforms */ UtBeginEvent (i, "Generate AML opcodes"); @@ -358,7 +359,7 @@ CmDoCompile (void) /* Namespace loading */ UtBeginEvent (i, "Create ACPI Namespace"); - Status = LdLoadNamespace (); + Status = LdLoadNamespace (RootNode); UtEndEvent (i++); if (ACPI_FAILURE (Status)) { diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index d29d79d5c..7416858d8 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslcompiler.h - common include file - * $Revision: 1.98 $ + * $Revision: 1.113 $ * *****************************************************************************/ @@ -155,6 +155,7 @@ getopt ( #include "acpi.h" +#include "amlresrc.h" #include "acdebug.h" #include "asltypes.h" #include "aslglobal.h" @@ -164,12 +165,12 @@ getopt ( * Compiler versions and names */ -#define CompilerVersion "X2041" -#define CompilerCreatorRevision 0x02002041 /* Acpi 2.0, Version # */ +#define CompilerCreatorRevision ACPI_CA_VERSION -#define CompilerId "Intel ACPI Component Architecture ASL Compiler" +#define IntelAcpiCA "Intel ACPI Component Architecture" +#define CompilerId "ASL Compiler / AML Disassembler" #define CompilerCopyright "Copyright (C) 2000 - 2002 Intel Corporation" -#define CompilerCompliance "ACPI 2.0" +#define CompilerCompliance "ACPI 2.0a" #define CompilerName "iasl" #define CompilerCreatorId "INTL" @@ -180,6 +181,9 @@ getopt ( #define ASL_NODE_CACHE_SIZE 1024 #define ASL_STRING_CACHE_SIZE 32768 +#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS +#define ASL_YYTNAME_START 3 + /* * Macros */ @@ -218,6 +222,7 @@ getopt ( #define FILE_SUFFIX_NAMESPACE "nsp" #define FILE_SUFFIX_ASM_SOURCE "asm" #define FILE_SUFFIX_C_SOURCE "c" +#define FILE_SUFFIX_DISASSEMBLY "dsl" /* Misc */ @@ -399,6 +404,12 @@ OpcAmlOpcodeWalk ( UINT32 Level, void *Context); +ACPI_STATUS +OpcAmlConstantWalk ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + void OpcGenerateAmlOpcode ( ACPI_PARSE_OBJECT *Op); @@ -407,6 +418,9 @@ UINT32 OpcSetOptimalIntegerSize ( ACPI_PARSE_OBJECT *Op); +void +OpcGetIntegerWidth ( + ACPI_PARSE_OBJECT *Op); /* * asloperands - generate AML operands for the AML opcodes @@ -458,7 +472,6 @@ OpnDoRegion ( ACPI_PARSE_OBJECT *Op); - /* * aslresource - resource template generation */ @@ -560,7 +573,7 @@ TrDoElseif ( * asltree - parse tree support */ -void +ACPI_STATUS TrWalkParseTree ( ACPI_PARSE_OBJECT *Op, UINT32 Visitation, @@ -568,11 +581,16 @@ TrWalkParseTree ( ASL_WALK_CALLBACK AscendingCallback, void *Context); +ACPI_PARSE_OBJECT * +TrAllocateNode ( + UINT32 ParseOpcode); + + /* Values for "Visitation" parameter above */ #define ASL_WALK_VISIT_DOWNWARD 0x01 #define ASL_WALK_VISIT_UPWARD 0x02 -#define ASL_WALK_VISIT_TWICE 0x03 +#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) char * @@ -757,11 +775,16 @@ ACPI_STATUS FlOpenMiscOutputFiles ( char *InputFilename); +void +MpDisplayReservedNames ( + void); + /* Load */ ACPI_STATUS -LdLoadNamespace (void); +LdLoadNamespace ( + ACPI_PARSE_OBJECT *RootOp); ACPI_STATUS @@ -808,6 +831,10 @@ LsCompareOneNamespaceObject ( /* Utils */ +void +UtDisplayConstantOpcodes ( + void); + void UtBeginEvent ( UINT32 Event, @@ -848,6 +875,10 @@ char * UtGetOpName ( UINT32 ParseOpcode); +void +UtSetParseOpName ( + ACPI_PARSE_OBJECT *Op); + ACPI_PARSE_OBJECT * UtGetArg ( ACPI_PARSE_OBJECT *Op, @@ -892,5 +923,177 @@ LnAdjustLengthToRoot ( UINT32 LengthDelta); +#define NEXT_RESOURCE_DESC(a,b) (ASL_RESOURCE_DESC *) (((char *) (a)) + sizeof(b)) + +#define DEFAULT_RESOURCE_DESC_SIZE (sizeof (ASL_RESOURCE_DESC) + sizeof (ASL_END_TAG_DESC)) + + +/* + * Resource utilities + */ + +ASL_RESOURCE_NODE * +RsAllocateResourceNode ( + UINT32 Size); + + void +RsCreateBitField ( + ACPI_PARSE_OBJECT *Op, + char *Name, + UINT32 ByteOffset, + UINT32 BitOffset); + +void +RsCreateByteField ( + ACPI_PARSE_OBJECT *Op, + char *Name, + UINT32 ByteOffset); + +void +RsSetFlagBits ( + UINT8 *Flags, + ACPI_PARSE_OBJECT *Op, + UINT8 Position, + UINT8 Default); + +ACPI_PARSE_OBJECT * +RsCompleteNodeAndGetNext ( + ACPI_PARSE_OBJECT *Op); + +ASL_RESOURCE_NODE * +RsDoOneResourceDescriptor ( + ACPI_PARSE_OBJECT *DescriptorTypeOp, + UINT32 CurrentByteOffset, + UINT8 *State); + +#define ACPI_RSTATE_NORMAL 0 +#define ACPI_RSTATE_START_DEPENDENT 1 +#define ACPI_RSTATE_DEPENDENT_LIST 2 + +UINT32 +RsLinkDescriptorChain ( + ASL_RESOURCE_NODE **PreviousRnode, + ASL_RESOURCE_NODE *Rnode); + + +/* + * Small descriptors + */ + +ASL_RESOURCE_NODE * +RsDoDmaDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoEndDependentDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoFixedIoDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoInterruptDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoIoDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoIrqDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoIrqNoFlagsDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoMemory24Descriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoMemory32Descriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoMemory32FixedDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoStartDependentDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoStartDependentNoPriDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoVendorSmallDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + + +/* + * Large descriptors + */ + +UINT32 +RsGetStringDataLength ( + ACPI_PARSE_OBJECT *InitializerOp); + +ASL_RESOURCE_NODE * +RsDoDwordIoDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoDwordMemoryDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoQwordIoDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoQwordMemoryDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoWordIoDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoWordBusNumberDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoVendorLargeDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoGeneralRegisterDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + + #endif /* __ASLCOMPILER_H */ diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index fdc5e4325..597e0b994 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -3,7 +3,7 @@ /****************************************************************************** * * Module Name: aslcompiler.l - Flex input file - * $Revision: 1.56 $ + * $Revision: 1.60 $ * *****************************************************************************/ @@ -645,9 +645,7 @@ ResetCurrentLineBuffer ( Gbl_LineBufPtr - Gbl_CurrentLineBuffer); } - Gbl_InputByteCount++; /* Account for the CR/linefeed */ - Gbl_CurrentLineOffset += Gbl_CurrentColumn + 1; - + Gbl_CurrentLineOffset += Gbl_CurrentColumn; Gbl_CurrentColumn = 0; Gbl_CurrentLineNumber++; @@ -887,7 +885,7 @@ literal (void) char *CleanString; char StringChar; UINT32 State = ASL_NORMAL_CHAR; - UINT32 i; + UINT32 i = 0; UINT8 Digit; char ConvertBuffer[4]; @@ -982,9 +980,13 @@ DoCharacter: continue; } - /* Unknown escape sequence -- just ignore it */ + /* Unknown escape sequence issue warning, but use the character */ - continue; + AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE, + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + break; } break; @@ -1099,4 +1101,3 @@ CompletedString: } -