diff options
Diffstat (limited to 'source/compiler')
| -rw-r--r-- | source/compiler/aslcodegen.c | 6 | ||||
| -rw-r--r-- | source/compiler/aslcompile.c | 13 | ||||
| -rw-r--r-- | source/compiler/aslcompiler.h | 8 | ||||
| -rw-r--r-- | source/compiler/aslexternal.c | 61 | ||||
| -rw-r--r-- | source/compiler/aslglobal.h | 1 | ||||
| -rw-r--r-- | source/compiler/asllength.c | 8 | ||||
| -rw-r--r-- | source/compiler/aslload.c | 19 | ||||
| -rw-r--r-- | source/compiler/aslmessages.c | 4 | ||||
| -rw-r--r-- | source/compiler/aslopcodes.c | 707 | ||||
| -rw-r--r-- | source/compiler/aslopt.c | 44 | ||||
| -rw-r--r-- | source/compiler/asloptions.c | 7 | ||||
| -rw-r--r-- | source/compiler/aslpld.c | 729 | ||||
| -rw-r--r-- | source/compiler/aslrestype2e.c | 2 | ||||
| -rw-r--r-- | source/compiler/aslstubs.c | 7 | ||||
| -rw-r--r-- | source/compiler/asltransform.c | 6 | ||||
| -rw-r--r-- | source/compiler/aslutils.c | 4 | ||||
| -rw-r--r-- | source/compiler/aslwalks.c | 7 | ||||
| -rw-r--r-- | source/compiler/aslxrefout.c | 36 | ||||
| -rw-r--r-- | source/compiler/dtparser.y | 6 | ||||
| -rw-r--r-- | source/compiler/dttable1.c | 17 | ||||
| -rw-r--r-- | source/compiler/dttable2.c | 4 | ||||
| -rw-r--r-- | source/compiler/dttemplate.h | 15 | ||||
| -rw-r--r-- | source/compiler/prparser.y | 4 | ||||
| -rw-r--r-- | source/compiler/prscan.c | 11 |
24 files changed, 942 insertions, 784 deletions
diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 5e25d0d24441..30e79841a276 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -590,6 +590,12 @@ CgWriteNode ( return; } + if ((Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && + Gbl_DoExternals == FALSE) + { + return; + } + Op->Asl.FinalAmlLength = 0; switch (Op->Asl.AmlOpcode) diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 54c863e7638b..a2a03e9facfd 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -281,11 +281,14 @@ CmDoCompile ( /* Resolve External Declarations */ - Event = UtBeginEvent ("Resolve all Externals"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n"); - TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, - ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL); - UtEndEvent (Event); + if (Gbl_DoExternals) + { + Event = UtBeginEvent ("Resolve all Externals"); + DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n"); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, + ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL); + UtEndEvent (Event); + } /* * Semantic analysis. This can happen only after the diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index d92b9b1fee44..1446dc80970d 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -538,6 +538,14 @@ OptOptimizeNamePath ( /* + * aslpld - ToPLD macro support + */ +void +OpcDoPld ( + ACPI_PARSE_OBJECT *Op); + + +/* * aslprintf - Printf/Fprintf macros */ void diff --git a/source/compiler/aslexternal.c b/source/compiler/aslexternal.c index 5335048adaa3..a814efddd546 100644 --- a/source/compiler/aslexternal.c +++ b/source/compiler/aslexternal.c @@ -146,6 +146,7 @@ ExInsertArgCount ( char * ExternalName; char * CallName; UINT16 ArgCount = 0; + ACPI_STATUS Status; CallName = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE); @@ -166,43 +167,49 @@ ExInsertArgCount ( NameOp = Next->Asl.Child->Asl.Child; ExternalName = AcpiNsGetNormalizedPathname (NameOp->Asl.Node, TRUE); - if (!strcmp (CallName, ExternalName)) + if (strcmp (CallName, ExternalName)) { - Next->Asl.Child->Asl.CompileFlags |= NODE_VISITED; - - /* - * Since we will reposition Externals to the Root, set Namepath - * to the fully qualified name and recalculate the aml length - */ - if (ACPI_FAILURE (UtInternalizeName ( - ExternalName, &NameOp->Asl.Value.String))) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, - NULL, "- Could not Internalize External"); + ACPI_FREE (ExternalName); + Next = Next->Asl.Next; + continue; + } - break; - } + Next->Asl.Child->Asl.CompileFlags |= NODE_VISITED; - NameOp->Asl.AmlLength = strlen (NameOp->Asl.Value.String); + /* + * Since we will reposition Externals to the Root, set Namepath + * to the fully qualified name and recalculate the aml length + */ + Status = UtInternalizeName (ExternalName, + &NameOp->Asl.Value.String); - /* Get argument count */ + ACPI_FREE (ExternalName); + if (ACPI_FAILURE (Status)) + { + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + NULL, "- Could not Internalize External"); + break; + } - Child = Op->Asl.Child; - while (Child) - { - ArgCount++; - Child = Child->Asl.Next; - } + NameOp->Asl.AmlLength = strlen (NameOp->Asl.Value.String); - /* Setup ArgCount operand */ + /* Get argument count */ - ArgCountOp = Next->Asl.Child->Asl.Child->Asl.Next->Asl.Next; - ArgCountOp->Asl.Value.Integer = ArgCount; - break; + Child = Op->Asl.Child; + while (Child) + { + ArgCount++; + Child = Child->Asl.Next; } - Next = Next->Asl.Next; + /* Setup ArgCount operand */ + + ArgCountOp = Next->Asl.Child->Asl.Child->Asl.Next->Asl.Next; + ArgCountOp->Asl.Value.Integer = ArgCount; + break; } + + ACPI_FREE (CallName); } diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 0e534f3137b0..6f35c248ec43 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -181,6 +181,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTypechecking, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_EnableReferenceTypechecking, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoExternals, TRUE); #define HEX_OUTPUT_NONE 0 diff --git a/source/compiler/asllength.c b/source/compiler/asllength.c index 44c85aa5af5d..626c2e7f3e1c 100644 --- a/source/compiler/asllength.c +++ b/source/compiler/asllength.c @@ -406,6 +406,14 @@ CgGenerateAmlLengths ( break; + case PARSEOP_EXTERNAL: + + if (Gbl_DoExternals == TRUE) + { + CgGenerateAmlOpcodeLength (Op); + } + break; + default: CgGenerateAmlOpcodeLength (Op); diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index 955fd7f454a4..99ec1bfe06df 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -698,6 +698,25 @@ LdNamespace1Begin ( */ Status = AE_OK; } + else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && + (ObjectType == ACPI_TYPE_ANY)) + { + /* Allow update of externals of unknown type. */ + + if (AcpiNsOpensScope (ActualObjectType)) + { + Node->Type = (UINT8) ActualObjectType; + Status = AE_OK; + } + else + { + sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName, + AcpiUtGetTypeName (Node->Type)); + AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); + return_ACPI_STATUS (AE_OK); + } + } else { /* Valid error, object already exists */ diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index 8cf0e784d7bc..7a6506b8a9f5 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -130,7 +130,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_HID_SUFFIX */ "_HID suffix must be all hex digits", /* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", /* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", -/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating (DSDT version < 2)", +/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating (DSDT or SSDT version < 2)", /* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode", /* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)", /* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)", @@ -224,7 +224,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_TAG_SMALLER */ "ResourceTag smaller than Field", /* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed", /* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)", -/* ASL_MSG_TRUNCATION */ "64-bit return value will be truncated to 32 bits (DSDT version < 2)", +/* ASL_MSG_TRUNCATION */ "64-bit return value will be truncated to 32 bits (DSDT or SSDT version < 2)", /* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name", /* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable", /* ASL_MSG_UNSUPPORTED */ "Unsupported feature", diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index d1e4277a725b..de9ffe1baf09 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -68,62 +68,9 @@ OpcDoEisaId ( ACPI_PARSE_OBJECT *Op); static void -OpcDoPld ( - ACPI_PARSE_OBJECT *Op); - -static void OpcDoUuId ( ACPI_PARSE_OBJECT *Op); -static UINT8 * -OpcEncodePldBuffer ( - ACPI_PLD_INFO *PldInfo); - - -/* ToPld strings */ - -static char *AslPldPanelList[] = -{ - "TOP", - "BOTTOM", - "LEFT", - "RIGHT", - "FRONT", - "BACK", - "UNKNOWN", - NULL -}; - -static char *AslPldVerticalPositionList[] = -{ - "UPPER", - "CENTER", - "LOWER", - NULL -}; - -static char *AslPldHorizontalPositionList[] = -{ - "LEFT", - "CENTER", - "RIGHT", - NULL -}; - -static char *AslPldShapeList[] = -{ - "ROUND", - "OVAL", - "SQUARE", - "VERTICALRECTANGLE", - "HORIZONTALRECTANGLE", - "VERTICALTRAPEZOID", - "HORIZONTALTRAPEZOID", - "UNKNOWN", - "CHAMFERED", - NULL -}; - /******************************************************************************* * @@ -709,651 +656,6 @@ OpcDoEisaId ( /******************************************************************************* * - * FUNCTION: OpcEncodePldBuffer - * - * PARAMETERS: PldInfo - _PLD buffer struct (Using local struct) - * - * RETURN: Encode _PLD buffer suitable for return value from _PLD - * - * DESCRIPTION: Bit-packs a _PLD buffer struct. - * - ******************************************************************************/ - -static UINT8 * -OpcEncodePldBuffer ( - ACPI_PLD_INFO *PldInfo) -{ - UINT32 *Buffer; - UINT32 Dword; - - - Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE); - if (!Buffer) - { - return (NULL); - } - - /* First 32 bits */ - - Dword = 0; - ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision); - ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor); - ACPI_PLD_SET_RED (&Dword, PldInfo->Red); - ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green); - ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue); - ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword); - - /* Second 32 bits */ - - Dword = 0; - ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width); - ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height); - ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword); - - /* Third 32 bits */ - - Dword = 0; - ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible); - ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock); - ACPI_PLD_SET_LID (&Dword, PldInfo->Lid); - ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel); - ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition); - ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition); - ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape); - ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation); - ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken); - ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition); - ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay); - ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword); - - /* Fourth 32 bits */ - - Dword = 0; - ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable); - ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired); - ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber); - ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber); - ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference); - ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation); - ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order); - ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword); - - if (PldInfo->Revision >= 2) - { - /* Fifth 32 bits */ - - Dword = 0; - ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset); - ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset); - ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword); - } - - return (ACPI_CAST_PTR (UINT8, Buffer)); -} - - -/******************************************************************************* - * - * FUNCTION: OpcFindName - * - * PARAMETERS: List - Array of char strings to be searched - * Name - Char string to string for - * Index - Index value to set if found - * - * RETURN: TRUE if any names matched, FALSE otherwise - * - * DESCRIPTION: Match PLD name to value in lookup table. Sets Value to - * equivalent parameter value. - * - ******************************************************************************/ - -static BOOLEAN -OpcFindName ( - char **List, - char *Name, - UINT64 *Index) -{ - char *Str; - UINT32 i; - - - AcpiUtStrupr (Name); - - for (i = 0, Str = List[0]; Str; i++, Str = List[i]) - { - if (!(strncmp (Str, Name, strlen (Name)))) - { - *Index = i; - return (TRUE); - } - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoPld - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Convert ToPLD macro to 20-byte buffer - * - ******************************************************************************/ - -static void -OpcDoPld ( - ACPI_PARSE_OBJECT *Op) -{ - UINT8 *Buffer; - ACPI_PARSE_OBJECT *Node; - ACPI_PLD_INFO PldInfo; - ACPI_PARSE_OBJECT *NewOp; - - - if (!Op) - { - AslError(ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL); - return; - } - - if (Op->Asl.ParseOpcode != PARSEOP_TOPLD) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL); - return; - } - - memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO)); - - Node = Op->Asl.Child; - while (Node) - { - switch (Node->Asl.ParseOpcode) - { - case PARSEOP_PLD_REVISION: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 127) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - PldInfo.Revision = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_IGNORECOLOR: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 1) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - PldInfo.IgnoreColor = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_RED: - case PARSEOP_PLD_GREEN: - case PARSEOP_PLD_BLUE: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 255) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - if (Node->Asl.ParseOpcode == PARSEOP_PLD_RED) - { - PldInfo.Red = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - else if (Node->Asl.ParseOpcode == PARSEOP_PLD_GREEN) - { - PldInfo.Green = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - else /* PARSEOP_PLD_BLUE */ - { - PldInfo.Blue = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - break; - - case PARSEOP_PLD_WIDTH: - case PARSEOP_PLD_HEIGHT: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 65535) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - if (Node->Asl.ParseOpcode == PARSEOP_PLD_WIDTH) - { - PldInfo.Width = (UINT16) Node->Asl.Child->Asl.Value.Integer; - } - else /* PARSEOP_PLD_HEIGHT */ - { - PldInfo.Height = (UINT16) Node->Asl.Child->Asl.Value.Integer; - } - - break; - - case PARSEOP_PLD_USERVISIBLE: - case PARSEOP_PLD_DOCK: - case PARSEOP_PLD_LID: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 1) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - if (Node->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE) - { - PldInfo.UserVisible = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - else if (Node->Asl.ParseOpcode == PARSEOP_PLD_DOCK) - { - PldInfo.Dock = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - else - { - PldInfo.Lid = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - - break; - - case PARSEOP_PLD_PANEL: - - if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) - { - if (Node->Asl.Child->Asl.Value.Integer > 6) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - } - else /* PARSEOP_STRING */ - { - if (!OpcFindName(AslPldPanelList, - Node->Asl.Child->Asl.Value.String, - &Node->Asl.Child->Asl.Value.Integer)) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); - break; - } - } - - PldInfo.Panel = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_VERTICALPOSITION: - - if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) - { - if (Node->Asl.Child->Asl.Value.Integer > 2) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - } - else /* PARSEOP_STRING */ - { - if (!OpcFindName(AslPldVerticalPositionList, - Node->Asl.Child->Asl.Value.String, - &Node->Asl.Child->Asl.Value.Integer)) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); - break; - } - } - - PldInfo.VerticalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_HORIZONTALPOSITION: - - if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) - { - if (Node->Asl.Child->Asl.Value.Integer > 2) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - } - else /* PARSEOP_STRING */ - { - if (!OpcFindName(AslPldHorizontalPositionList, - Node->Asl.Child->Asl.Value.String, - &Node->Asl.Child->Asl.Value.Integer)) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); - break; - } - } - - PldInfo.HorizontalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_SHAPE: - - if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) - { - if (Node->Asl.Child->Asl.Value.Integer > 8) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - } - else /* PARSEOP_STRING */ - { - if (!OpcFindName(AslPldShapeList, - Node->Asl.Child->Asl.Value.String, - &Node->Asl.Child->Asl.Value.Integer)) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); - break; - } - } - - PldInfo.Shape = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_GROUPORIENTATION: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 1) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - PldInfo.GroupOrientation = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_GROUPTOKEN: - case PARSEOP_PLD_GROUPPOSITION: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 255) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - - if (Node->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN) - { - PldInfo.GroupToken = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - else /* PARSEOP_PLD_GROUPPOSITION */ - { - PldInfo.GroupPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - - break; - - case PARSEOP_PLD_BAY: - case PARSEOP_PLD_EJECTABLE: - case PARSEOP_PLD_EJECTREQUIRED: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 1) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - if (Node->Asl.ParseOpcode == PARSEOP_PLD_BAY) - { - PldInfo.Bay = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - else if (Node->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE) - { - PldInfo.Ejectable = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - else /* PARSEOP_PLD_EJECTREQUIRED */ - { - PldInfo.OspmEjectRequired = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - - break; - - case PARSEOP_PLD_CABINETNUMBER: - case PARSEOP_PLD_CARDCAGENUMBER: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 255) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - if (Node->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER) - { - PldInfo.CabinetNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - else /* PARSEOP_PLD_CARDCAGENUMBER */ - { - PldInfo.CardCageNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer; - } - - break; - - case PARSEOP_PLD_REFERENCE: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 1) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - PldInfo.Reference = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_ROTATION: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 7) - { - switch (Node->Asl.Child->Asl.Value.Integer) - { - case 45: - - Node->Asl.Child->Asl.Value.Integer = 1; - break; - - case 90: - - Node->Asl.Child->Asl.Value.Integer = 2; - break; - - case 135: - - Node->Asl.Child->Asl.Value.Integer = 3; - break; - - case 180: - - Node->Asl.Child->Asl.Value.Integer = 4; - break; - - case 225: - - Node->Asl.Child->Asl.Value.Integer = 5; - break; - - case 270: - - Node->Asl.Child->Asl.Value.Integer = 6; - break; - - case 315: - - Node->Asl.Child->Asl.Value.Integer = 7; - break; - - default: - - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - } - - PldInfo.Rotation = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_ORDER: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 31) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - PldInfo.Order = (UINT8) Node->Asl.Child->Asl.Value.Integer; - break; - - case PARSEOP_PLD_VERTICALOFFSET: - case PARSEOP_PLD_HORIZONTALOFFSET: - - if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) - { - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - if (Node->Asl.Child->Asl.Value.Integer > 65535) - { - AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); - break; - } - - if (Node->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET) - { - PldInfo.VerticalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer; - } - else /* PARSEOP_PLD_HORIZONTALOFFSET */ - { - PldInfo.HorizontalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer; - } - - break; - - default: - - AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); - break; - } - - Node = Node->Asl.Next; - } - - Buffer = OpcEncodePldBuffer(&PldInfo); - - /* Change Op to a Buffer */ - - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Common.AmlOpcode = AML_BUFFER_OP; - - /* Disable further optimization */ - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - UtSetParseOpName (Op); - - /* Child node is the buffer length */ - - NewOp = TrAllocateNode (PARSEOP_INTEGER); - - NewOp->Asl.AmlOpcode = AML_BYTE_OP; - NewOp->Asl.Value.Integer = 20; - NewOp->Asl.Parent = Op; - - Op->Asl.Child = NewOp; - Op = NewOp; - - /* Peer to the child is the raw buffer data */ - - NewOp = TrAllocateNode (PARSEOP_RAW_DATA); - NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - NewOp->Asl.AmlLength = 20; - NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); - NewOp->Asl.Parent = Op->Asl.Parent; - - Op->Asl.Next = NewOp; -} - - -/******************************************************************************* - * * FUNCTION: OpcDoUuId * * PARAMETERS: Op - Parse node @@ -1513,6 +815,15 @@ OpcGenerateAmlOpcode ( Gbl_HasIncludeFiles = TRUE; break; + case PARSEOP_EXTERNAL: + + if (Gbl_DoExternals == FALSE) + { + Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + } + break; + case PARSEOP_TIMER: if (AcpiGbl_IntegerBitWidth == 32) diff --git a/source/compiler/aslopt.c b/source/compiler/aslopt.c index d39e2cb07a89..a07f10c1814b 100644 --- a/source/compiler/aslopt.c +++ b/source/compiler/aslopt.c @@ -217,7 +217,7 @@ OptBuildShortestPath ( UINT32 Index; UINT32 NumCarats; UINT32 i; - char *NewPath; + char *NewPathInternal; char *NewPathExternal; ACPI_NAMESPACE_NODE *Node; ACPI_GENERIC_STATE ScopeInfo; @@ -253,11 +253,11 @@ OptBuildShortestPath ( { /* Compare two single NameSegs */ + Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1; + if (!ACPI_COMPARE_NAME ( - &((char *) TargetPath->Pointer)[ - (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1], - &((char *) CurrentPath->Pointer)[ - (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1])) + &(ACPI_CAST_PTR (char, TargetPath->Pointer)) [Index], + &(ACPI_CAST_PTR (char, CurrentPath->Pointer)) [Index])) { /* Mismatch */ @@ -297,8 +297,8 @@ OptBuildShortestPath ( /* * Construct a new target string */ - NewPathExternal = ACPI_ALLOCATE_ZEROED ( - TargetPath->Length + NumCarats + 1); + NewPathExternal = + ACPI_ALLOCATE_ZEROED (TargetPath->Length + NumCarats + 1); /* Insert the Carats into the Target string */ @@ -315,7 +315,8 @@ OptBuildShortestPath ( /* Special handling for exact subpath in a name declaration */ - if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length)) + if (IsDeclaration && SubPath && + (CurrentPath->Length > TargetPath->Length)) { /* * The current path is longer than the target, and the target is a @@ -341,7 +342,8 @@ OptBuildShortestPath ( Index = TargetPath->Length; } - strcpy (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]); + strcpy (&NewPathExternal[i], + &(ACPI_CAST_PTR (char, TargetPath->Pointer))[Index]); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal)); /* @@ -349,22 +351,24 @@ OptBuildShortestPath ( * string to make sure that this is in fact an optimization. If the * original string is already optimal, there is no point in continuing. */ - Status = AcpiNsInternalizeName (NewPathExternal, &NewPath); + Status = AcpiNsInternalizeName (NewPathExternal, &NewPathInternal); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", ASL_NO_ABORT); - ACPI_FREE (NewPathExternal); - return (Status); + goto Cleanup; } - if (strlen (NewPath) >= AmlNameStringLength) + if (strlen (NewPathInternal) >= AmlNameStringLength) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " NOT SHORTER (New %u old %u)", - (UINT32) strlen (NewPath), (UINT32) AmlNameStringLength)); - ACPI_FREE (NewPathExternal); - return (AE_NOT_FOUND); + (UINT32) strlen (NewPathInternal), + (UINT32) AmlNameStringLength)); + + ACPI_FREE (NewPathInternal); + Status = AE_NOT_FOUND; + goto Cleanup; } /* @@ -372,7 +376,7 @@ OptBuildShortestPath ( * looking for. This is simply a sanity check on the new * path that has been created. */ - Status = AcpiNsLookup (&ScopeInfo, NewPath, + Status = AcpiNsLookup (&ScopeInfo, NewPathInternal, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) @@ -385,7 +389,7 @@ OptBuildShortestPath ( AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, Op, NewPathExternal); - *ReturnNewPath = NewPath; + *ReturnNewPath = NewPathInternal; } else { @@ -401,11 +405,15 @@ OptBuildShortestPath ( { /* The lookup failed, we obviously cannot use this optimization */ + ACPI_FREE (NewPathInternal); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - did not find node"); } +Cleanup: + ACPI_FREE (NewPathExternal); return (Status); } diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 61d2cbf0c4f3..792e0db615ca 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -539,6 +539,13 @@ AslDoOptions ( Gbl_CompileTimesFlag = TRUE; break; + case 'e': + + /* Disable External opcode generation */ + + Gbl_DoExternals = FALSE; + break; + case 'f': /* Disable folding on "normal" expressions */ diff --git a/source/compiler/aslpld.c b/source/compiler/aslpld.c new file mode 100644 index 000000000000..afc46835272d --- /dev/null +++ b/source/compiler/aslpld.c @@ -0,0 +1,729 @@ +/****************************************************************************** + * + * Module Name: aslpld - Implementation of ASL ToPLD macro + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "amlcode.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslpld") + + +/* Local prototypes */ + +static UINT8 * +OpcEncodePldBuffer ( + ACPI_PLD_INFO *PldInfo); + +static BOOLEAN +OpcFindName ( + const char **List, + char *Name, + UINT32 *Index); + + +/******************************************************************************* + * + * FUNCTION: OpcDoPld + * + * PARAMETERS: Op - Current parse node + * + * RETURN: None + * + * DESCRIPTION: Convert ToPLD macro to 20-byte buffer + * + * The ToPLD parse tree looks like this: + * + * TOPLD + * PLD_REVISION + * INTEGER + * PLD_IGNORECOLOR + * INTEGER + * ... + * etc. + * + ******************************************************************************/ + +void +OpcDoPld ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PLD_INFO PldInfo; + UINT8 *Buffer; + ACPI_PARSE_OBJECT *ThisOp; + ACPI_PARSE_OBJECT *NewOp; + UINT16 ParseOpcode; + UINT32 Value; + + + if (!Op) + { + AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL); + return; + } + + if (Op->Asl.ParseOpcode != PARSEOP_TOPLD) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL); + return; + } + + memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO)); + + /* Traverse the list of PLD Ops (one per PLD field) */ + + ThisOp = Op->Asl.Child; + while (ThisOp) + { + /* Get child values */ + + ParseOpcode = ThisOp->Asl.Child->Asl.ParseOpcode; + Value = (UINT32) ThisOp->Asl.Child->Asl.Value.Integer; + + switch (ThisOp->Asl.ParseOpcode) + { + case PARSEOP_PLD_REVISION: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 127) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + PldInfo.Revision = (UINT8) Value; + break; + + case PARSEOP_PLD_IGNORECOLOR: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 1) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + PldInfo.IgnoreColor = (UINT8) Value; + break; + + case PARSEOP_PLD_RED: + case PARSEOP_PLD_GREEN: + case PARSEOP_PLD_BLUE: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + if (Value > 255) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_RED) + { + PldInfo.Red = (UINT8) Value; + } + else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GREEN) + { + PldInfo.Green = (UINT8) Value; + } + else /* PARSEOP_PLD_BLUE */ + { + PldInfo.Blue = (UINT8) Value; + } + break; + + case PARSEOP_PLD_WIDTH: + case PARSEOP_PLD_HEIGHT: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 65535) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_WIDTH) + { + PldInfo.Width = (UINT16) Value; + } + else /* PARSEOP_PLD_HEIGHT */ + { + PldInfo.Height = (UINT16) Value; + } + + break; + + case PARSEOP_PLD_USERVISIBLE: + case PARSEOP_PLD_DOCK: + case PARSEOP_PLD_LID: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 1) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE) + { + PldInfo.UserVisible = (UINT8) Value; + } + else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_DOCK) + { + PldInfo.Dock = (UINT8) Value; + } + else + { + PldInfo.Lid = (UINT8) Value; + } + + break; + + case PARSEOP_PLD_PANEL: + + if (ParseOpcode == PARSEOP_INTEGER) + { + if (Value > 6) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + } + else /* PARSEOP_STRING */ + { + if (!OpcFindName (AcpiGbl_PldPanelList, + ThisOp->Asl.Child->Asl.Value.String, + &Value)) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL); + break; + } + } + + PldInfo.Panel = (UINT8) Value; + break; + + case PARSEOP_PLD_VERTICALPOSITION: + + if (ParseOpcode == PARSEOP_INTEGER) + { + if (Value > 2) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + } + else /* PARSEOP_STRING */ + { + if (!OpcFindName (AcpiGbl_PldVerticalPositionList, + ThisOp->Asl.Child->Asl.Value.String, + &Value)) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL); + break; + } + } + + PldInfo.VerticalPosition = (UINT8) Value; + break; + + case PARSEOP_PLD_HORIZONTALPOSITION: + + if (ParseOpcode == PARSEOP_INTEGER) + { + if (Value > 2) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + } + else /* PARSEOP_STRING */ + { + if (!OpcFindName (AcpiGbl_PldHorizontalPositionList, + ThisOp->Asl.Child->Asl.Value.String, + &Value)) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL); + break; + } + } + + PldInfo.HorizontalPosition = (UINT8) Value; + break; + + case PARSEOP_PLD_SHAPE: + + if (ParseOpcode == PARSEOP_INTEGER) + { + if (Value > 8) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + } + else /* PARSEOP_STRING */ + { + if (!OpcFindName (AcpiGbl_PldShapeList, + ThisOp->Asl.Child->Asl.Value.String, + &Value)) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL); + break; + } + } + + PldInfo.Shape = (UINT8) Value; + break; + + case PARSEOP_PLD_GROUPORIENTATION: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 1) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + PldInfo.GroupOrientation = (UINT8) Value; + break; + + case PARSEOP_PLD_GROUPTOKEN: + case PARSEOP_PLD_GROUPPOSITION: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 255) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN) + { + PldInfo.GroupToken = (UINT8) Value; + } + else /* PARSEOP_PLD_GROUPPOSITION */ + { + PldInfo.GroupPosition = (UINT8) Value; + } + + break; + + case PARSEOP_PLD_BAY: + case PARSEOP_PLD_EJECTABLE: + case PARSEOP_PLD_EJECTREQUIRED: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 1) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_BAY) + { + PldInfo.Bay = (UINT8) Value; + } + else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE) + { + PldInfo.Ejectable = (UINT8) Value; + } + else /* PARSEOP_PLD_EJECTREQUIRED */ + { + PldInfo.OspmEjectRequired = (UINT8) Value; + } + + break; + + case PARSEOP_PLD_CABINETNUMBER: + case PARSEOP_PLD_CARDCAGENUMBER: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 255) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER) + { + PldInfo.CabinetNumber = (UINT8) Value; + } + else /* PARSEOP_PLD_CARDCAGENUMBER */ + { + PldInfo.CardCageNumber = (UINT8) Value; + } + + break; + + case PARSEOP_PLD_REFERENCE: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 1) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + PldInfo.Reference = (UINT8) Value; + break; + + case PARSEOP_PLD_ROTATION: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 7) + { + switch (Value) + { + case 45: + + Value = 1; + break; + + case 90: + + Value = 2; + break; + + case 135: + + Value = 3; + break; + + case 180: + + Value = 4; + break; + + case 225: + + Value = 5; + break; + + case 270: + + Value = 6; + break; + + case 315: + + Value = 7; + break; + + default: + + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + } + + PldInfo.Rotation = (UINT8) Value; + break; + + case PARSEOP_PLD_ORDER: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 31) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + PldInfo.Order = (UINT8) Value; + break; + + case PARSEOP_PLD_VERTICALOFFSET: + case PARSEOP_PLD_HORIZONTALOFFSET: + + if (ParseOpcode != PARSEOP_INTEGER) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + if (Value > 65535) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); + break; + } + + if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET) + { + PldInfo.VerticalOffset = (UINT16) Value; + } + else /* PARSEOP_PLD_HORIZONTALOFFSET */ + { + PldInfo.HorizontalOffset = (UINT16) Value; + } + + break; + + default: + + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); + break; + } + + ThisOp = ThisOp->Asl.Next; + } + + Buffer = OpcEncodePldBuffer (&PldInfo); + + /* Change Op to a Buffer */ + + Op->Asl.ParseOpcode = PARSEOP_BUFFER; + Op->Common.AmlOpcode = AML_BUFFER_OP; + + /* Disable further optimization */ + + Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; + UtSetParseOpName (Op); + + /* Child node is the buffer length */ + + NewOp = TrAllocateNode (PARSEOP_INTEGER); + + NewOp->Asl.AmlOpcode = AML_BYTE_OP; + NewOp->Asl.Value.Integer = 20; + NewOp->Asl.Parent = Op; + + Op->Asl.Child = NewOp; + Op = NewOp; + + /* Peer to the child is the raw buffer data */ + + NewOp = TrAllocateNode (PARSEOP_RAW_DATA); + NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; + NewOp->Asl.AmlLength = 20; + NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); + NewOp->Asl.Parent = Op->Asl.Parent; + + Op->Asl.Next = NewOp; +} + + +/******************************************************************************* + * + * FUNCTION: OpcEncodePldBuffer + * + * PARAMETERS: PldInfo - _PLD buffer struct (Using local struct) + * + * RETURN: Encode _PLD buffer suitable for return value from _PLD + * + * DESCRIPTION: Bit-packs a _PLD buffer struct. + * + ******************************************************************************/ + +static UINT8 * +OpcEncodePldBuffer ( + ACPI_PLD_INFO *PldInfo) +{ + UINT32 *Buffer; + UINT32 Dword; + + + Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE); + if (!Buffer) + { + return (NULL); + } + + /* First 32 bits */ + + Dword = 0; + ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision); + ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor); + ACPI_PLD_SET_RED (&Dword, PldInfo->Red); + ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green); + ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue); + ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword); + + /* Second 32 bits */ + + Dword = 0; + ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width); + ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height); + ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword); + + /* Third 32 bits */ + + Dword = 0; + ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible); + ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock); + ACPI_PLD_SET_LID (&Dword, PldInfo->Lid); + ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel); + ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition); + ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition); + ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape); + ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation); + ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken); + ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition); + ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay); + ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword); + + /* Fourth 32 bits */ + + Dword = 0; + ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable); + ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired); + ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber); + ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber); + ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference); + ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation); + ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order); + ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword); + + /* Revision 2 adds an additional DWORD */ + + if (PldInfo->Revision >= 2) + { + /* Fifth 32 bits */ + + Dword = 0; + ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset); + ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset); + ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword); + } + + return (ACPI_CAST_PTR (UINT8, Buffer)); +} + + +/******************************************************************************* + * + * FUNCTION: OpcFindName + * + * PARAMETERS: List - Array of char strings to be searched + * Name - Char string to string for + * Index - Index value to set if found + * + * RETURN: TRUE if any names matched, FALSE otherwise + * + * DESCRIPTION: Match PLD name to value in lookup table. Sets Value to + * equivalent parameter value. + * + ******************************************************************************/ + +static BOOLEAN +OpcFindName ( + const char **List, + char *Name, + UINT32 *Index) +{ + const char *NameString; + UINT32 i; + + + AcpiUtStrupr (Name); + + for (i = 0, NameString = List[0]; + NameString; + i++, NameString = List[i]) + { + if (!(strncmp (NameString, Name, strlen (Name)))) + { + *Index = i; + return (TRUE); + } + } + + return (FALSE); +} diff --git a/source/compiler/aslrestype2e.c b/source/compiler/aslrestype2e.c index fc07366d4316..aa17a755ab3e 100644 --- a/source/compiler/aslrestype2e.c +++ b/source/compiler/aslrestype2e.c @@ -143,7 +143,7 @@ RsDoExtendedIoDescriptor ( RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); GranOp = InitializerOp; - break; + break; case 6: /* Address Min */ diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c index 47c472030918..f0fbe035b586 100644 --- a/source/compiler/aslstubs.c +++ b/source/compiler/aslstubs.c @@ -64,6 +64,13 @@ AcpiNsExecModuleCodeList ( } ACPI_STATUS +AcpiNsInitializeObjects ( + void) +{ + return (AE_OK); +} + +ACPI_STATUS AcpiHwReadPort ( ACPI_IO_ADDRESS Address, UINT32 *Value, diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c index 8de5ba18c30c..e504220839af 100644 --- a/source/compiler/asltransform.c +++ b/source/compiler/asltransform.c @@ -350,7 +350,11 @@ TrTransformSubtree ( case PARSEOP_EXTERNAL: - ExDoExternal (Op); + if (Gbl_DoExternals == TRUE) + { + ExDoExternal (Op); + } + break; default: diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 288fe1f9f27b..f5ca7b7e861f 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -906,7 +906,9 @@ UtDoConstant ( char ErrBuf[64]; - Status = AcpiUtStrtoul64 (String, 0, &Converted); + Status = AcpiUtStrtoul64 (String, ACPI_ANY_BASE, + ACPI_MAX64_BYTE_WIDTH, &Converted); + if (ACPI_FAILURE (Status)) { sprintf (ErrBuf, "%s %s\n", "Conversion error:", diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index a4e5a8cdd767..357b92d0b38d 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -104,9 +104,12 @@ AnMethodTypingWalkEnd ( * The called method is untyped at this time (typically a * forward reference). * - * Check for a recursive method call first. + * Check for a recursive method call first. Note: the + * Child->Node will be null if the method has not been + * resolved. */ - if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op) + if (Op->Asl.Child->Asl.Node && + (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op)) { /* We must type the method here */ diff --git a/source/compiler/aslxrefout.c b/source/compiler/aslxrefout.c index 554f51fde0c5..701399cbaec4 100644 --- a/source/compiler/aslxrefout.c +++ b/source/compiler/aslxrefout.c @@ -252,7 +252,6 @@ OtXrefWalkPart1 ( MethodInfo->CurrentOp = Op; Node = Op->Asl.Node; - ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); /* Find all objects referenced by this method */ @@ -261,8 +260,11 @@ OtXrefWalkPart1 ( if (Status == AE_CTRL_TERMINATE) { + ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); + FlPrintFile (ASL_FILE_XREF_OUTPUT, " %-40s %s", ParentPath, AcpiUtGetTypeName (Node->Type)); + ACPI_FREE (ParentPath); switch (Node->Type) { @@ -324,12 +326,12 @@ OtXrefWalkPart1 ( } else { - ACPI_FREE (ParentPath); ParentPath = AcpiNsGetNormalizedPathname ( NextOp->Asl.Node, TRUE); FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%.2u bit) in Buffer %s", Length, ParentPath); + ACPI_FREE (ParentPath); } break; @@ -339,13 +341,13 @@ OtXrefWalkPart1 ( FieldOp = NextOp->Asl.Parent; NextOp = FieldOp->Asl.Child; - ACPI_FREE (ParentPath); ParentPath = AcpiNsGetNormalizedPathname ( NextOp->Asl.Node, TRUE); FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%.2u bit) in Region %s", (UINT32) Node->Op->Asl.Child->Asl.Value.Integer, ParentPath); + ACPI_FREE (ParentPath); if (FieldOp->Asl.ParseOpcode == PARSEOP_FIELD) { @@ -367,7 +369,6 @@ OtXrefWalkPart1 ( } FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n"); - ACPI_FREE (ParentPath); } break; @@ -672,6 +673,7 @@ OtXrefWalkPart3 ( "\n[%5u] %-40s %s Declaration\n", Op->Asl.LogicalLineNumber, ParentPath, AcpiUtGetTypeName (Node->Type)); + ACPI_FREE (ParentPath); XrefInfo->MethodOp = Op; XrefInfo->ThisObjectReferences = 0; @@ -716,7 +718,7 @@ OtXrefAnalysisWalkPart3 ( void *Context) { ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context; - char *CallerFullPathname; + char *CallerFullPathname = NULL; ACPI_PARSE_OBJECT *CallerOp; const char *Operator; @@ -756,27 +758,24 @@ OtXrefAnalysisWalkPart3 ( CallerOp = CallerOp->Asl.Parent; } - /* There are some special cases for the oddball operators */ + if (CallerOp == XrefInfo->CurrentMethodOp) + { + return (AE_OK); + } + + /* Null CallerOp means the caller is at the namespace root */ if (CallerOp) { CallerFullPathname = AcpiNsGetNormalizedPathname ( CallerOp->Asl.Node, TRUE); } - else - { - CallerFullPathname = "<root>"; - } - if (CallerOp == XrefInfo->CurrentMethodOp) - { - return (AE_OK); - } + /* There are some special cases for the oddball operators */ if (Op->Asl.ParseOpcode == PARSEOP_SCOPE) { Operator = "Scope"; - } else if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_ALIAS) { @@ -794,7 +793,7 @@ OtXrefAnalysisWalkPart3 ( FlPrintFile (ASL_FILE_XREF_OUTPUT, "[%5u] %-40s %-8s via path: %s, Operator: %s\n", Op->Asl.LogicalLineNumber, - CallerFullPathname, + CallerFullPathname ? CallerFullPathname : "<root>", Operator, Op->Asl.ExternalName, Op->Asl.Parent->Asl.ParseOpName); @@ -804,6 +803,11 @@ OtXrefAnalysisWalkPart3 ( CallerOp = ACPI_TO_POINTER (0xFFFFFFFF); } + if (CallerFullPathname) + { + ACPI_FREE (CallerFullPathname); + } + XrefInfo->CurrentMethodOp = CallerOp; XrefInfo->ThisObjectReferences++; return (AE_OK); diff --git a/source/compiler/dtparser.y b/source/compiler/dtparser.y index fbd424afedf2..233aa9614bb5 100644 --- a/source/compiler/dtparser.y +++ b/source/compiler/dtparser.y @@ -169,15 +169,15 @@ Expression /* Default base for a non-prefixed integer is 16 */ - | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, &$$);} + | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);} /* Standard hex number (0x1234) */ - | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, &$$);} + | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);} /* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */ - | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, 10, &$$);} + | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);} ; %% diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c index 353d84af7e59..a79d33be630a 100644 --- a/source/compiler/dttable1.c +++ b/source/compiler/dttable1.c @@ -1243,8 +1243,8 @@ DtCompileIort ( DtInsertSubtable (ParentTable, Subtable); /* - * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care - * should be taken to avoid accessing ACPI_TABLE_HADER fields. + * Using ACPI_SUB_PTR, We needn't define a separate structure. Care + * should be taken to avoid accessing ACPI_TABLE_HEADER fields. */ Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT, Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); @@ -1475,6 +1475,19 @@ DtCompileIort ( IortSmmu->PmuInterruptCount = PmuIrptNumber; break; + case ACPI_IORT_NODE_SMMU_V3: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort4, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT"); diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c index 9ebe3e59aed0..65be5057dcb4 100644 --- a/source/compiler/dttable2.c +++ b/source/compiler/dttable2.c @@ -976,7 +976,7 @@ DtCompileS3pt ( DT_FIELD **PFieldList) { ACPI_STATUS Status; - ACPI_S3PT_HEADER *S3ptHeader; + ACPI_FPDT_HEADER *S3ptHeader; DT_SUBTABLE *Subtable; DT_SUBTABLE *ParentTable; ACPI_DMTABLE_INFO *InfoTable; @@ -1006,7 +1006,7 @@ DtCompileS3pt ( DtInsertSubtable (ParentTable, Subtable); DtPushSubtable (Subtable); - S3ptHeader = ACPI_CAST_PTR (ACPI_S3PT_HEADER, Subtable->Buffer); + S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer); switch (S3ptHeader->Type) { diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index c93b7614042f..93747fcf6119 100644 --- a/source/compiler/dttemplate.h +++ b/source/compiler/dttemplate.h @@ -543,11 +543,11 @@ const unsigned char TemplateHpet[] = const unsigned char TemplateIort[] = { - 0x49,0x4F,0x52,0x54,0x0C,0x01,0x00,0x00, /* 00000000 "IORT...." */ - 0x00,0xBC,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x49,0x4F,0x52,0x54,0x48,0x01,0x00,0x00, /* 00000000 "IORTH..." */ + 0x00,0x02,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x10,0x04,0x15,0x20,0x04,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x12,0x02,0x16,0x20,0x05,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "4......." */ 0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00, /* 00000030 ".....,.." */ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */ @@ -576,7 +576,14 @@ const unsigned char TemplateIort[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */ - 0x00,0x00,0x00,0x00 /* 00000108 "...." */ + 0x00,0x00,0x00,0x00,0x04,0x3C,0x00,0x00, /* 00000108 ".....<.." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ + 0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "<......." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000128 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000140 "........" */ }; const unsigned char TemplateIvrs[] = diff --git a/source/compiler/prparser.y b/source/compiler/prparser.y index ba2dc55f630c..d2f84059bebe 100644 --- a/source/compiler/prparser.y +++ b/source/compiler/prparser.y @@ -182,11 +182,11 @@ Expression /* Default base for a non-prefixed integer is 10 */ - | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, 10, &$$);} + | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);} /* Standard hex number (0x1234) */ - | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, 16, &$$);} + | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);} ; %% diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index 8a4f24199eba..b24b31997955 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -919,6 +919,17 @@ PrGetNextLine ( c = getc (Handle); if (c == EOF) { + /* + * On EOF: If there is anything in the line buffer, terminate + * it with a newline, and catch the EOF on the next call + * to this function. + */ + if (i > 0) + { + Gbl_CurrentLineBuffer[i] = '\n'; + return (AE_OK); + } + return (ASL_EOF); } |
