diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2017-05-31 22:40:24 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2017-05-31 22:40:24 +0000 |
commit | c457a42be4fca72c51fdca569271b62213d01a37 (patch) | |
tree | 0ce624183fb74a6ec5d2260e6904585800e8c4d8 /source/compiler | |
parent | 65c600c804e5a81af3a34d461312027000738994 (diff) | |
download | src-c457a42be4fca72c51fdca569271b62213d01a37.tar.gz src-c457a42be4fca72c51fdca569271b62213d01a37.zip |
Import ACPICA 20170531.vendor/acpica/20170531
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=319363
svn path=/vendor-sys/acpica/20170531/; revision=319364; tag=vendor/acpica/20170531
Diffstat (limited to 'source/compiler')
35 files changed, 1868 insertions, 135 deletions
diff --git a/source/compiler/aslascii.c b/source/compiler/aslascii.c index afaee56ffe65..18bcd28fe177 100644 --- a/source/compiler/aslascii.c +++ b/source/compiler/aslascii.c @@ -194,7 +194,7 @@ FlIsFileAsciiSource ( BOOLEAN DisplayErrors) { UINT8 Byte; - ACPI_SIZE BadBytes = 0; + UINT32 BadBytes = 0; BOOLEAN OpeningComment = FALSE; ASL_FILE_STATUS Status; FILE *Handle; @@ -285,6 +285,9 @@ FlIsFileAsciiSource ( if (BadBytes) { + fprintf (stderr, + "File appears to be binary: found %u non-ASCII characters, disassembling\n", + BadBytes); if (DisplayErrors) { AcpiOsPrintf ( diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 9c2a244ab517..181fc364c745 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -568,7 +568,7 @@ AslCompilerSignon ( /* Running compiler or disassembler? */ - if (Gbl_DisasmFlag) + if (AcpiGbl_DisasmFlag) { UtilityName = AML_DISASSEMBLER_NAME; } diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 4c6ba020f5ec..07a7d512e4d6 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -1398,6 +1398,26 @@ ASL_RESOURCE_NODE * RsDoUartSerialBusDescriptor ( ASL_RESOURCE_INFO *Info); +ASL_RESOURCE_NODE * +RsDoPinFunctionDescriptor ( + ASL_RESOURCE_INFO *Info); + +ASL_RESOURCE_NODE * +RsDoPinConfigDescriptor ( + ASL_RESOURCE_INFO *Info); + +ASL_RESOURCE_NODE * +RsDoPinGroupDescriptor ( + ASL_RESOURCE_INFO *Info); + +ASL_RESOURCE_NODE * +RsDoPinGroupFunctionDescriptor ( + ASL_RESOURCE_INFO *Info); + +ASL_RESOURCE_NODE * +RsDoPinGroupConfigDescriptor ( + ASL_RESOURCE_INFO *Info); + /* * aslrestype2d - DWord address descriptors */ diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index a9d595ab5558..4b36058b6ea7 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -455,6 +455,11 @@ NamePathTail [.]{NameSeg} "Memory24" { count (1); return (PARSEOP_MEMORY24); } "Memory32" { count (1); return (PARSEOP_MEMORY32); } "Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); } +"PinConfig" { count (1); return (PARSEOP_PINCONFIG); } +"PinFunction" { count (1); return (PARSEOP_PINFUNCTION); } +"PinGroup" { count (1); return (PARSEOP_PINGROUP); } +"PinGroupConfig" { count (1); return (PARSEOP_PINGROUPCONFIG); } +"PinGroupFunction" { count (1); return (PARSEOP_PINGROUPFUNCTION); } "QWordIO" { count (1); return (PARSEOP_QWORDIO); } "QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); } "QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); } diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 3333562bf3f3..2b6d73d67788 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -161,8 +161,8 @@ #define ASL_INVOCATION_NAME "iasl" #define ASL_CREATOR_ID "INTL" #define ASL_DEFINE "__IASL__" - -#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.1" +#define ASL_PREFIX "iASL: " +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.2" /* Configuration constants */ diff --git a/source/compiler/aslexternal.c b/source/compiler/aslexternal.c index 20fcc9ecd4ce..67a95e562c84 100644 --- a/source/compiler/aslexternal.c +++ b/source/compiler/aslexternal.c @@ -435,6 +435,7 @@ ExMoveExternals ( ACPI_PARSE_OBJECT *Next; char *ExternalName; ACPI_OBJECT_TYPE ObjType; + ACPI_STATUS Status; UINT32 i; @@ -473,8 +474,16 @@ ExMoveExternals ( { Next->Asl.ParseOpcode = PARSEOP_NAMESTRING; } + Next->Asl.ExternalName = ExternalName; - UtInternalizeName (ExternalName, &Next->Asl.Value.String); + Status = UtInternalizeName (ExternalName, &Next->Asl.Value.String); + if (ACPI_FAILURE (Status)) + { + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + Next, "Could not internalize namestring"); + return; + } + Next->Asl.AmlLength = strlen (Next->Asl.Value.String); Next = Next->Asl.Next; diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index a4955527244a..16b798c11e2c 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -275,7 +275,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_WarningsAsErrors, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); diff --git a/source/compiler/aslhelp.c b/source/compiler/aslhelp.c index 2244e264db96..2b0dc7632e83 100644 --- a/source/compiler/aslhelp.c +++ b/source/compiler/aslhelp.c @@ -180,7 +180,6 @@ Usage ( ACPI_OPTION ("-@ <file>", "Specify command file"); ACPI_OPTION ("-I <dir>", "Specify additional include directory"); ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files"); - ACPI_OPTION ("-ca <file>", "convert a given ASL file to ASL+ (retains comments)"); ACPI_OPTION ("-v", "Display compiler version"); ACPI_OPTION ("-vd", "Display compiler build date and time"); ACPI_OPTION ("-vo", "Enable optimization comments"); @@ -209,7 +208,7 @@ Usage ( ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level"); ACPI_OPTION ("-we", "Report warnings as errors"); - printf ("\nAML Code Generation (*.aml):\n"); + printf ("\nAML Bytecode Generation (*.aml):\n"); ACPI_OPTION ("-oa", "Disable all optimizations (compatibility mode)"); ACPI_OPTION ("-of", "Disable constant folding"); ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones"); @@ -226,20 +225,24 @@ Usage ( ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)"); ACPI_OPTION ("-lx", "Create cross-reference file (*.xrf)"); - printf ("\nFirmware Support - C Output:\n"); + printf ("\nFirmware Support - C Text Output:\n"); ACPI_OPTION ("-tc", "Create hex AML table in C (*.hex)"); ACPI_OPTION ("-sc", "Create named hex AML arrays in C (*.c)"); ACPI_OPTION ("-ic", "Create include file in C for -sc symbols (*.h)"); ACPI_OPTION ("-so", "Create namespace AML offset table in C (*.offset.h)"); - printf ("\nFirmware Support - Assembler Output:\n"); + printf ("\nFirmware Support - Assembler Text Output:\n"); ACPI_OPTION ("-ta", "Create hex AML table in assembler (*.hex)"); ACPI_OPTION ("-sa", "Create named hex AML arrays in assembler (*.asm)"); ACPI_OPTION ("-ia", "Create include file in assembler for -sa symbols (*.inc)"); - printf ("\nFirmware Support - ASL Output:\n"); + printf ("\nFirmware Support - ASL Text Output:\n"); ACPI_OPTION ("-ts", "Create hex AML table in ASL (Buffer object) (*.hex)"); + printf ("\nLegacy-ASL to ASL+ Converter:\n"); + ACPI_OPTION ("-ca <file>", "Convert legacy-ASL source file to new ASL+ file"); + ACPI_OPTION ("", " (Original comments are passed through to ASL+ file)"); + printf ("\nData Table Compiler:\n"); ACPI_OPTION ("-G", "Compile custom table that contains generic operators"); ACPI_OPTION ("-T <sig list>|ALL", "Create ACPI table template/example files"); diff --git a/source/compiler/aslhelpers.y b/source/compiler/aslhelpers.y index f99650605697..f200bf2b0e78 100644 --- a/source/compiler/aslhelpers.y +++ b/source/compiler/aslhelpers.y @@ -330,6 +330,15 @@ OptionalResourceType | ',' ResourceTypeKeyword {$$ = $2;} ; +/* Same as above except default is producer */ +OptionalProducerResourceType + : {$$ = TrCreateLeafNode ( + PARSEOP_RESOURCETYPE_PRODUCER);} + | ',' {$$ = TrCreateLeafNode ( + PARSEOP_RESOURCETYPE_PRODUCER);} + | ',' ResourceTypeKeyword {$$ = $2;} + ; + OptionalSlaveMode : ',' {$$ = NULL;} | ',' SlaveModeKeyword {$$ = $2;} diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index dfe4ca4dbb49..bd564b33682e 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -315,13 +315,20 @@ LdLoadFieldElements ( Child->Asl.Value.String); return (Status); } - - /* - * The name already exists in this scope - * But continue processing the elements - */ - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, - Child->Asl.Value.String); + else if (Status == AE_ALREADY_EXISTS && + (Node->Flags & ANOBJ_IS_EXTERNAL)) + { + Node->Type = (UINT8) ACPI_TYPE_LOCAL_REGION_FIELD; + } + else + { + /* + * The name already exists in this scope + * But continue processing the elements + */ + AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, + Child->Asl.Value.String); + } } else { @@ -458,12 +465,30 @@ LdNamespace1Begin ( ACPI_PARSE_OBJECT *Arg; UINT32 i; BOOLEAN ForceNewScope = FALSE; + ACPI_OWNER_ID OwnerId = 0; ACPI_FUNCTION_NAME (LdNamespace1Begin); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", Op, Op->Asl.ParseOpName)); + if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) + { + /* + * Allocate an OwnerId for this block. This helps identify the owners + * of each namespace node. This is used in determining whether if + * certain external declarations cause redefinition errors. + */ + Status = AcpiUtAllocateOwnerId (&OwnerId); + WalkState->OwnerId = OwnerId; + if (ACPI_FAILURE (Status)) + { + AslCoreSubsystemError (Op, Status, + "Failure to allocate owner ID to this definition block.", FALSE); + return_ACPI_STATUS (Status); + } + } + /* * We are only interested in opcodes that have an associated name * (or multiple names) @@ -778,7 +803,9 @@ LdNamespace1Begin ( { /* * Allow one create on an object or segment that was - * previously declared External + * previously declared External only if WalkState->OwnerId and + * Node->OwnerId are found in different tables (meaning that + * they have differnt OwnerIds). */ Node->Flags &= ~ANOBJ_IS_EXTERNAL; Node->Type = (UINT8) ObjectType; @@ -795,6 +822,12 @@ LdNamespace1Begin ( } Status = AE_OK; + + if (Node->OwnerId == WalkState->OwnerId) + { + AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, + Op->Asl.ExternalName); + } } else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) && (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) @@ -802,15 +835,52 @@ LdNamespace1Begin ( /* * Allow externals in same scope as the definition of the * actual object. Similar to C. Allows multiple definition - * blocks that refer to each other in the same file. + * blocks that refer to each other in the same file. However, + * do not allow name declaration and an external declaration + * within the same table. This is considered a re-declaration. */ Status = AE_OK; + + if (Node->OwnerId == WalkState->OwnerId) + { + AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, + Op->Asl.ExternalName); + } } else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && (ObjectType == ACPI_TYPE_ANY)) { - /* Allow update of externals of unknown type. */ + /* + * Allow update of externals of unknown type. + * In the case that multiple definition blocks are being + * parsed, updating the OwnerId allows enables subsequent calls + * of this method to understand which table the most recent + * external declaration was seen. Without this OwnerId update, + * code like the following is allowed to compile: + * + * DefinitionBlock("externtest.aml", "DSDT", 0x02, "Intel", "Many", 0x00000001) + * { + * External(ERRS,methodobj) + * Method (MAIN) + * { + * Name(NUM2, 0) + * ERRS(1,2,3) + * } + * } + * + * DefinitionBlock("externtest.aml", "SSDT", 0x02, "Intel", "Many", 0x00000001) + * { + * if (0) + * { + * External(ERRS,methodobj) + * } + * Method (ERRS,3) + * {} + * + * } + */ + Node->OwnerId = WalkState->OwnerId; if (AcpiNsOpensScope (ActualObjectType)) { diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index a282b0c4926b..10251fb2a80f 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -207,6 +207,9 @@ main ( int ReturnStatus = 0; + signal (SIGINT, AslSignalHandler); + signal (SIGSEGV, AslSignalHandler); + /* * Big-endian machines are not currently supported. ACPI tables must * be little-endian, and support for big-endian machines needs to @@ -224,7 +227,6 @@ main ( /* Initialize preprocessor and compiler before command line processing */ - signal (SIGINT, AslSignalHandler); AcpiGbl_ExternalFileList = NULL; AcpiDbgLevel = 0; PrInitializePreprocessor (); @@ -254,6 +256,7 @@ main ( } } + /* Process each pathname/filename in the list, with possible wildcards */ while (argv[Index2]) @@ -301,8 +304,10 @@ CleanupAndExit: * * RETURN: None * - * DESCRIPTION: Control-C handler. Delete any intermediate files and any - * output files that may be left in an indeterminate state. + * DESCRIPTION: Signal interrupt handler. Delete any intermediate files and + * any output files that may be left in an indeterminate state. + * Currently handles SIGINT (control-c) and SIGSEGV (segmentation + * fault). * *****************************************************************************/ @@ -314,11 +319,34 @@ AslSignalHandler ( signal (Sig, SIG_IGN); - printf ("Aborting\n\n"); + fflush (stdout); + fflush (stderr); + + switch (Sig) + { + case SIGINT: + + printf ("\n" ASL_PREFIX "<Control-C>\n"); + break; - /* Close all open files */ + case SIGSEGV: - Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */ + /* Even on a seg fault, we will try to delete any partial files */ + + printf (ASL_PREFIX "Segmentation Fault\n"); + break; + + default: + + printf (ASL_PREFIX "Unknown interrupt signal (%u), ignoring\n", Sig); + return; + } + + /* + * Close all open files + * Note: the .pre file is the same as the input source file + */ + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { @@ -332,6 +360,7 @@ AslSignalHandler ( FlDeleteFile (i); } + printf (ASL_PREFIX "Terminating\n"); exit (0); } diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index f3c04797a484..aed87661d091 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -451,6 +451,11 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* PARITYTYPE_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* PARITYTYPE_ODD */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), /* PARITYTYPE_SPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 4, 0, 0), +/* PINCONFIG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* PINFUNCTION */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* PINGROUP */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* PINGROUPCONFIG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* PINGROUPFUNCTION */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* PIN_NOPULL */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), /* PIN_PULLDEFAULT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* PIN_PULLDOWN */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), diff --git a/source/compiler/asloffset.c b/source/compiler/asloffset.c index e3fdf1c91656..0964d4feaa81 100644 --- a/source/compiler/asloffset.c +++ b/source/compiler/asloffset.c @@ -250,7 +250,6 @@ LsAmlOffsetWalk ( } Length = Op->Asl.FinalAmlLength; - NamepathOffset = Gbl_CurrentAmlOffset + Length; /* Get to the NameSeg/NamePath Op (and length of the name) */ diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 65fc4bfa378f..2dcd49402e04 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -229,7 +229,7 @@ AslCommandLine ( /* Next parameter must be the input filename */ if (!argv[AcpiGbl_Optind] && - !Gbl_DisasmFlag) + !AcpiGbl_DisasmFlag) { printf ("Missing input filename\n"); BadCommandLine = TRUE; @@ -469,7 +469,7 @@ AslDoOptions ( return (-1); } - Gbl_DisasmFlag = TRUE; + AcpiGbl_DisasmFlag = TRUE; break; case 'D': /* Define a symbol */ @@ -541,6 +541,7 @@ AslDoOptions ( { case '^': + printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); Usage (); exit (0); diff --git a/source/compiler/aslparser.y b/source/compiler/aslparser.y index 72043ae04547..6426cebefa78 100644 --- a/source/compiler/aslparser.y +++ b/source/compiler/aslparser.y @@ -208,7 +208,7 @@ AslLocalAllocate ( * These shift/reduce conflicts are expected. There should be zero * reduce/reduce conflicts. */ -%expect 102 +%expect 118 /*! [Begin] no source code translation */ diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c index f12795a51ea2..42931452da7a 100644 --- a/source/compiler/aslresource.c +++ b/source/compiler/aslresource.c @@ -990,6 +990,31 @@ RsDoOneResourceDescriptor ( Rnode = RsDoUartSerialBusDescriptor (Info); break; + case PARSEOP_PINCONFIG: + + Rnode = RsDoPinConfigDescriptor (Info); + break; + + case PARSEOP_PINFUNCTION: + + Rnode = RsDoPinFunctionDescriptor (Info); + break; + + case PARSEOP_PINGROUP: + + Rnode = RsDoPinGroupDescriptor (Info); + break; + + case PARSEOP_PINGROUPFUNCTION: + + Rnode = RsDoPinGroupFunctionDescriptor (Info); + break; + + case PARSEOP_PINGROUPCONFIG: + + Rnode = RsDoPinGroupConfigDescriptor (Info); + break; + case PARSEOP_DEFAULT_ARG: /* Just ignore any of these, they are used as fillers/placeholders */ diff --git a/source/compiler/aslresources.y b/source/compiler/aslresources.y index d14fdd457f8f..fc70940c7e9c 100644 --- a/source/compiler/aslresources.y +++ b/source/compiler/aslresources.y @@ -211,6 +211,11 @@ ResourceMacroTerm | Memory24Term {} | Memory32FixedTerm {} | Memory32Term {} + | PinConfigTerm {} + | PinFunctionTerm {} + | PinGroupTerm {} + | PinGroupConfigTerm {} + | PinGroupFunctionTerm {} | QWordIOTerm {} | QWordMemoryTerm {} | QWordSpaceTerm {} @@ -605,6 +610,95 @@ Memory32Term error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} ; +PinConfigTerm + : PARSEOP_PINCONFIG + PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_PINCONFIG);} + OptionalShareType_First /* 04: SharedType */ + ',' ByteConstExpr /* 06: PinConfigType */ + ',' DWordConstExpr /* 08: PinConfigValue */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkChildren ($<n>3,9, + $4,$6,$8,$10,$11,$12,$13,$14,$17);} + | PARSEOP_PINCONFIG + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinFunctionTerm + : PARSEOP_PINFUNCTION + PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_PINFUNCTION);} + OptionalShareType_First /* 04: SharedType */ + ',' PinConfigByte /* 06: PinConfig */ + ',' WordConstExpr /* 08: FunctionNumber */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkChildren ($<n>3,9, + $4,$6,$8,$10,$11,$12,$13,$14,$17);} + | PARSEOP_PINFUNCTION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupTerm + : PARSEOP_PINGROUP + PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_PINGROUP);} + StringData /* 04: ResourceLabel */ + OptionalProducerResourceType /* 05: ResourceType */ + OptionalNameString /* 06: DescriptorName */ + OptionalBuffer_Last /* 07: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$5,$6,$7,$10);} + | PARSEOP_PINGROUP + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupConfigTerm + : PARSEOP_PINGROUPCONFIG + PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_PINGROUPCONFIG);} + OptionalShareType_First /* 04: SharedType */ + ',' ByteConstExpr /* 06: PinConfigType */ + ',' DWordConstExpr /* 08: PinConfigValue */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + ',' StringData /* 13: ResourceSourceLabel */ + OptionalResourceType /* 14: ResourceType */ + OptionalNameString /* 15: DescriptorName */ + OptionalBuffer_Last /* 16: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkChildren ($<n>3,9, + $4,$6,$8,$10,$11,$13,$14,$15,$16);} + | PARSEOP_PINGROUPCONFIG + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupFunctionTerm + : PARSEOP_PINGROUPFUNCTION + PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_PINGROUPFUNCTION);} + OptionalShareType_First /* 04: SharedType */ + ',' WordConstExpr /* 06: FunctionNumber */ + ',' StringData /* 08: ResourceSource */ + OptionalByteConstExpr /* 09: ResourceSourceIndex */ + ',' StringData /* 11: ResourceSourceLabel */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkChildren ($<n>3,8, + $4,$6,$8,$9,$11,$12,$13,$14);} + | PARSEOP_PINGROUPFUNCTION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + QWordIOTerm : PARSEOP_QWORDIO PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDIO);} diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c index ccaac7c97cc0..243d1a3fef04 100644 --- a/source/compiler/aslrestype2s.c +++ b/source/compiler/aslrestype2s.c @@ -163,7 +163,8 @@ RsGetBufferDataLength ( static UINT16 RsGetInterruptDataLength ( - ACPI_PARSE_OBJECT *InitializerOp); + ACPI_PARSE_OBJECT *InitializerOp, + UINT32 StartIndex); static BOOLEAN RsGetVendorData ( @@ -171,6 +172,11 @@ RsGetVendorData ( UINT8 *VendorData, ACPI_SIZE DescriptorOffset); +static UINT16 +RsGetStringDataLengthAt ( + ACPI_PARSE_OBJECT *InitializerOp, + UINT32 StartIndex); + /* * This module contains descriptors for serial buses and GPIO: * @@ -179,6 +185,11 @@ RsGetVendorData ( * I2cSerialBus * SpiSerialBus * UartSerialBus + * PinFunction + * PinConfig + * PinGroup + * PinGroupFunction + * PinGroupConfig */ @@ -238,6 +249,7 @@ RsGetBufferDataLength ( * * PARAMETERS: InitializerOp - Current parse op, start of the resource * descriptor + * StartIndex - Start index of interrupt/pin list * * RETURN: Length of the interrupt data list * @@ -248,7 +260,8 @@ RsGetBufferDataLength ( static UINT16 RsGetInterruptDataLength ( - ACPI_PARSE_OBJECT *InitializerOp) + ACPI_PARSE_OBJECT *InitializerOp, + UINT32 StartIndex) { UINT16 InterruptLength; UINT32 i; @@ -261,9 +274,9 @@ RsGetInterruptDataLength ( { InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - /* Interrupt list starts at offset 10 (Gpio descriptors) */ + /* Interrupt list starts at offset StartIndex (Gpio descriptors) */ - if (i >= 10) + if (i >= StartIndex) { InterruptLength += 2; } @@ -373,6 +386,43 @@ RsGetVendorData ( /******************************************************************************* * + * FUNCTION: RsGetStringDataLengthAt + * + * PARAMETERS: InitializerOp - Start of a subtree of init nodes + * StartIndex - Starting index of the string node + * + * RETURN: Valid string length if a string node is found at given + * StartIndex or 0 otherwise. + * + * DESCRIPTION: In a list of peer nodes, find the first one at given index + * that contains a string and return length. + * + ******************************************************************************/ + +static UINT16 +RsGetStringDataLengthAt ( + ACPI_PARSE_OBJECT *InitializerOp, + UINT32 StartIndex) +{ + UINT32 i; + + for (i = 0; InitializerOp; i++) + { + if (i == StartIndex && + InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) + { + return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1)); + } + + InitializerOp = ASL_GET_PEER_NODE (InitializerOp); + } + + return (0); +} + + +/******************************************************************************* + * * FUNCTION: RsDoGpioIntDescriptor * * PARAMETERS: Info - Parse Op and resource template offset @@ -414,7 +464,7 @@ RsDoGpioIntDescriptor ( */ ResSourceLength = RsGetStringDataLength (InitializerOp); VendorLength = RsGetBufferDataLength (InitializerOp); - InterruptLength = RsGetInterruptDataLength (InitializerOp); + InterruptLength = RsGetInterruptDataLength (InitializerOp, 10); DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + ResSourceLength + VendorLength + InterruptLength; @@ -623,7 +673,7 @@ RsDoGpioIoDescriptor ( */ ResSourceLength = RsGetStringDataLength (InitializerOp); VendorLength = RsGetBufferDataLength (InitializerOp); - InterruptLength = RsGetInterruptDataLength (InitializerOp); + InterruptLength = RsGetInterruptDataLength (InitializerOp, 10); PinList = InterruptList; DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + @@ -1336,3 +1386,858 @@ RsDoUartSerialBusDescriptor ( MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); return (Rnode); } + + +/******************************************************************************* + * + * FUNCTION: RsDoPinFunctionDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinFunction" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinFunctionDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 *PinList = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 PinListLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + * 3) PIN (interrupt) list + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + PinListLength = RsGetInterruptDataLength (InitializerOp, 8); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_FUNCTION) + + ResSourceLength + VendorLength + PinListLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinFunction.ResourceLength = DescriptorSize; + Descriptor->PinFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_FUNCTION; + Descriptor->PinFunction.RevisionId = AML_RESOURCE_PIN_FUNCTION_REVISION; + + /* Build pointers to optional areas */ + + PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_FUNCTION)); + ResourceSource = ACPI_ADD_PTR (char, PinList, PinListLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinFunction.PinTableOffset = (UINT16) + ACPI_PTR_DIFF (PinList, Descriptor); + + Descriptor->PinFunction.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->PinFunction.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.Flags), 0); + break; + + case 1: /* Pin Config [BYTE] (_PPI) */ + + Descriptor->PinFunction.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.PinConfig)); + break; + + case 2: /* Function Number [WORD] (_FUN) */ + + Descriptor->PinFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.FunctionNumber)); + break; + + case 3: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, InitializerOp->Asl.Value.String); + } + break; + + case 4: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->PinFunction.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 5: /* Resource Usage (consumer/producer) */ + + /* Assumed to be consumer */ + + break; + + case 6: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinFunction.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinFunction.VendorOffset))) + { + Descriptor->PinFunction.VendorLength = VendorLength; + } + break; + + default: + /* + * PINs come through here, repeatedly. Each PIN must be a WORD. + * NOTE: there is no "length" field for this, so from ACPI spec: + * The number of pins in the table can be calculated from: + * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ + *PinList = (UINT16) InitializerOp->Asl.Value.Integer; + PinList++; + PinCount++; + + /* Case 8: First pin number in list */ + + if (i == 8) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + + /* Check now for duplicates in list */ + + RsCheckListForDuplicates (InitializerOp); + + /* Create a named field at the start of the list */ + + RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN, + CurrentByteOffset + Descriptor->PinFunction.PinTableOffset); + } + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoPinConfigDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinConfig" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinConfigDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 *PinList = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 PinListLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + * 3) PIN (interrupt) list + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + PinListLength = RsGetInterruptDataLength (InitializerOp, 8); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_CONFIG) + + ResSourceLength + VendorLength + PinListLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinConfig.ResourceLength = DescriptorSize; + Descriptor->PinConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_CONFIG; + Descriptor->PinConfig.RevisionId = AML_RESOURCE_PIN_CONFIG_REVISION; + + /* Build pointers to optional areas */ + + PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_CONFIG)); + ResourceSource = ACPI_ADD_PTR (char, PinList, PinListLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinConfig.PinTableOffset = (UINT16) + ACPI_PTR_DIFF (PinList, Descriptor); + + Descriptor->PinConfig.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + BOOLEAN isValid; + + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->PinConfig.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.Flags), 0); + break; + + case 1: /* Pin Config Type [BYTE] (_TYP) */ + + isValid = InitializerOp->Asl.Value.Integer <= 0x0d; + if (!isValid) + { + isValid = InitializerOp->Asl.Value.Integer >= 0x80 && + InitializerOp->Asl.Value.Integer <= 0xff; + } + if (!isValid) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, InitializerOp, NULL); + } + + Descriptor->PinConfig.PinConfigType = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG_TYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigType)); + + break; + + case 2: /* Pin Config Value [DWORD] (_VAL) */ + + Descriptor->PinConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigValue)); + break; + + case 3: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, InitializerOp->Asl.Value.String); + } + break; + + case 4: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->PinConfig.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 5: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->PinConfig.Flags, InitializerOp, 1, 1); + + break; + + case 6: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinConfig.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinConfig.VendorOffset))) + { + Descriptor->PinConfig.VendorLength = VendorLength; + } + break; + + default: + /* + * PINs come through here, repeatedly. Each PIN must be a WORD. + * NOTE: there is no "length" field for this, so from ACPI spec: + * The number of pins in the table can be calculated from: + * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ + *PinList = (UINT16) InitializerOp->Asl.Value.Integer; + PinList++; + PinCount++; + + /* Case 8: First pin number in list */ + + if (i == 8) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + + /* Check now for duplicates in list */ + + RsCheckListForDuplicates (InitializerOp); + + /* Create a named field at the start of the list */ + + RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN, + CurrentByteOffset + Descriptor->PinConfig.PinTableOffset); + } + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoPinGroupDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinGroup" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinGroupDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + UINT8 *VendorData = NULL; + UINT16 *PinList = NULL; + char *Label = NULL; + UINT16 LabelLength; + UINT16 VendorLength; + UINT16 PinListLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Label + * 2) Vendor Data buffer + * 3) PIN (interrupt) list + */ + LabelLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + PinListLength = RsGetInterruptDataLength (InitializerOp, 4); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP) + + LabelLength + VendorLength + PinListLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinGroup.ResourceLength = DescriptorSize; + Descriptor->PinGroup.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP; + Descriptor->PinGroup.RevisionId = AML_RESOURCE_PIN_GROUP_REVISION; + + /* Build pointers to optional areas */ + + PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP)); + Label = ACPI_ADD_PTR (char, PinList, PinListLength); + VendorData = ACPI_ADD_PTR (UINT8, Label, LabelLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinGroup.PinTableOffset = (UINT16) ACPI_PTR_DIFF (PinList, Descriptor); + Descriptor->PinGroup.LabelOffset = (UINT16) ACPI_PTR_DIFF (Label, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Resource Label */ + + if (LabelLength < 2) + { + AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL); + } + strcpy (Label, InitializerOp->Asl.Value.String); + + break; + + case 1: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->PinGroup.Flags, InitializerOp, 0, 0); + + break; + + case 2: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 3: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinGroup.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinGroup.VendorOffset))) + { + Descriptor->PinGroup.VendorLength = VendorLength; + } + break; + + default: + /* + * PINs come through here, repeatedly. Each PIN must be a WORD. + * NOTE: there is no "length" field for this, so from ACPI spec: + * The number of pins in the table can be calculated from: + * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ + *PinList = (UINT16) InitializerOp->Asl.Value.Integer; + PinList++; + PinCount++; + + /* Case 3: First pin number in list */ + + if (i == 4) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + + /* Check now for duplicates in list */ + + RsCheckListForDuplicates (InitializerOp); + + /* Create a named field at the start of the list */ + + RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN, + CurrentByteOffset + Descriptor->PinGroup.PinTableOffset); + } + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoPinGroupFunctionDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinGroupFunction" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinGroupFunctionDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + char *ResourceSourceLabel = NULL; + UINT8 *VendorData = NULL; + UINT16 ResSourceLength; + UINT16 ResSourceLabelLength; + UINT16 VendorLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Resource Source Label string + * 3) Vendor Data buffer + */ + ResSourceLength = RsGetStringDataLengthAt (InitializerOp, 2); + ResSourceLabelLength = RsGetStringDataLengthAt (InitializerOp, 4); + VendorLength = RsGetBufferDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_FUNCTION) + + ResSourceLength + ResSourceLabelLength + VendorLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinGroupFunction.ResourceLength = DescriptorSize; + Descriptor->PinGroupFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION; + Descriptor->PinGroupFunction.RevisionId = AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION; + + /* Build pointers to optional areas */ + + ResourceSource = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION)); + ResourceSourceLabel = ACPI_ADD_PTR (char, ResourceSource, ResSourceLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSourceLabel, ResSourceLabelLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinGroupFunction.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + Descriptor->PinGroupFunction.ResSourceLabelOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSourceLabel, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->PinGroupFunction.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.Flags), 0); + break; + + case 1: /* Function Number [WORD] */ + + Descriptor->PinGroupFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.FunctionNumber)); + break; + + case 2: /* ResourceSource [STRING] */ + + strcpy (ResourceSource, InitializerOp->Asl.Value.String); + break; + + case 3: /* Resource Index */ + + Descriptor->PinGroupFunction.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + break; + + case 4: /* ResourceSourceLabel [STRING] */ + + if (ResSourceLabelLength < 2) + { + AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL); + } + + strcpy (ResourceSourceLabel, InitializerOp->Asl.Value.String); + break; + + case 5: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->PinGroupFunction.Flags, InitializerOp, 1, 1); + + break; + + case 6: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinGroupFunction.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinGroupFunction.VendorOffset))) + { + Descriptor->PinGroupFunction.VendorLength = VendorLength; + } + break; + + default: + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoPinGroupConfigDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinGroupConfig" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinGroupConfigDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + char *ResourceSourceLabel = NULL; + UINT8 *VendorData = NULL; + UINT16 ResSourceLength; + UINT16 ResSourceLabelLength; + UINT16 VendorLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Resource Source Label string + * 3) Vendor Data buffer + */ + ResSourceLength = RsGetStringDataLengthAt (InitializerOp, 3); + ResSourceLabelLength = RsGetStringDataLengthAt (InitializerOp, 5); + VendorLength = RsGetBufferDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_CONFIG) + + ResSourceLength + ResSourceLabelLength + VendorLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinGroupConfig.ResourceLength = DescriptorSize; + Descriptor->PinGroupConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG; + Descriptor->PinGroupConfig.RevisionId = AML_RESOURCE_PIN_GROUP_CONFIG_REVISION; + + /* Build pointers to optional areas */ + + ResourceSource = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP_CONFIG)); + ResourceSourceLabel = ACPI_ADD_PTR (char, ResourceSource, ResSourceLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSourceLabel, ResSourceLabelLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinGroupConfig.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + Descriptor->PinGroupConfig.ResSourceLabelOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSourceLabel, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + BOOLEAN isValid; + + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->PinGroupConfig.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.Flags), 0); + break; + + case 1: /* Pin Config Type [BYTE] (_TYP) */ + + isValid = InitializerOp->Asl.Value.Integer <= 0x0d; + if (!isValid) + { + isValid = InitializerOp->Asl.Value.Integer >= 0x80 && + InitializerOp->Asl.Value.Integer <= 0xff; + } + if (!isValid) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, InitializerOp, NULL); + } + + Descriptor->PinGroupConfig.PinConfigType = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG_TYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigType)); + + break; + + case 2: /* Pin Config Value [DWORD] (_VAL) */ + + Descriptor->PinGroupConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigValue)); + break; + + case 3: /* ResourceSource [STRING] */ + + /* Copy string to the descriptor */ + + strcpy (ResourceSource, InitializerOp->Asl.Value.String); + break; + + case 4: /* Resource Index */ + + Descriptor->PinGroupConfig.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + break; + + case 5: /* ResourceSourceLabel [STRING] */ + + if (ResSourceLabelLength < 2) + { + AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL); + } + + strcpy (ResourceSourceLabel, InitializerOp->Asl.Value.String); + break; + + case 6: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->PinGroupConfig.Flags, InitializerOp, 1, 1); + + break; + + case 7: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinGroupConfig.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinGroupConfig.VendorOffset))) + { + Descriptor->PinGroupConfig.VendorLength = VendorLength; + } + break; + + default: + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index ae4d37147b9e..d09852c7d166 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -269,11 +269,9 @@ TermArg : SimpleName {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} -/* | PARSEOP_OPEN_PAREN TermArg - PARSEOP_CLOSE_PAREN {} -*/ + PARSEOP_CLOSE_PAREN {$$ = TrSetNodeFlags ($2, NODE_IS_TERM_ARG);} ; /* @@ -395,7 +393,7 @@ Object : CompilerDirective {} | NamedObject {} | NameSpaceModifier {} -// | StructureTerm {} +/* | StructureTerm {} */ ; PackageList @@ -644,7 +642,7 @@ NamedObject NameSpaceModifier : AliasTerm {} | NameTerm {} -// | NameTermAslPlus {} +/* | NameTermAslPlus {} */ | ScopeTerm {} ; @@ -751,8 +749,8 @@ Type2IntegerOpcode /* "Type3" opcodes */ | FromBCDTerm {} | IncTerm {} | IndexTerm {} -// | StructureIndexTerm {} -// | StructurePointerTerm {} +/* | StructureIndexTerm {} */ +/* | StructurePointerTerm {} */ | LAndTerm {} | LEqualTerm {} | LGreaterTerm {} @@ -827,8 +825,8 @@ Type6Opcode | DerefOfTerm {} | IndexTerm {} | IndexExpTerm {} -// | StructureIndexTerm {} -// | StructurePointerTerm {} +/* | StructureIndexTerm {} */ +/* | StructurePointerTerm {} */ | MethodInvocationTerm {} ; diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index bef4c7695afd..2f037bf87287 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -316,6 +316,11 @@ AslDetectSourceFileType ( Type = ASL_INPUT_TYPE_BINARY_ACPI_TABLE; goto Cleanup; } + else + { + fprintf (stderr, + "Binary file does not contain a valid ACPI table\n"); + } Type = ASL_INPUT_TYPE_BINARY; @@ -456,7 +461,7 @@ AslDoOneFile ( /* * AML Disassembly (Optional) */ - if (Gbl_DisasmFlag) + if (AcpiGbl_DisasmFlag) { Status = AslDoDisassembly (); if (Status != AE_CTRL_CONTINUE) @@ -581,7 +586,7 @@ AslDoOneFile ( CvDbgPrint ("OUTPUTFILENAME: %s\n", Gbl_OutputFilenamePrefix); Gbl_Files[ASL_FILE_INPUT].Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename; - + AcpiGbl_DisasmFlag = TRUE; fprintf (stderr, "\n"); AslDoDisassembly (); @@ -601,7 +606,7 @@ AslDoOneFile ( FlCloseFile (ASL_FILE_INPUT); Gbl_DoCompile = FALSE; - Gbl_DisasmFlag = TRUE; + AcpiGbl_DisasmFlag = TRUE; Status = AslDoDisassembly (); return (Status); diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 130540674d68..42cee752a952 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -697,15 +697,19 @@ AslDoCommentType2 ( AslInsertLineBuffer ('/'); - AslInsertLineBuffer ('*'); if (Gbl_CaptureComments && CurrentState.CaptureComments) { + AslInsertLineBuffer ('*'); *StringBuffer = '/'; ++StringBuffer; *StringBuffer = '*'; ++StringBuffer; } + else + { + AslInsertLineBuffer ('/'); + } while (((c = input ()) != '\n') && (c != EOF)) { @@ -1006,15 +1010,6 @@ CompletedString: *StringBuffer = 0; CleanString = UtStringCacheCalloc (strlen (MsgBuffer) + 1); - if (!CleanString) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); - } - strcpy (CleanString, MsgBuffer); AslCompilerlval.s = CleanString; return (TRUE); diff --git a/source/compiler/asltokens.y b/source/compiler/asltokens.y index ba0803f8d1b4..e6e9006d0475 100644 --- a/source/compiler/asltokens.y +++ b/source/compiler/asltokens.y @@ -389,6 +389,11 @@ NoEcho(' %token <i> PARSEOP_PARITYTYPE_NONE %token <i> PARSEOP_PARITYTYPE_ODD %token <i> PARSEOP_PARITYTYPE_SPACE +%token <i> PARSEOP_PINCONFIG +%token <i> PARSEOP_PINFUNCTION +%token <i> PARSEOP_PINGROUP +%token <i> PARSEOP_PINGROUPCONFIG +%token <i> PARSEOP_PINGROUPFUNCTION %token <i> PARSEOP_PIN_NOPULL %token <i> PARSEOP_PIN_PULLDEFAULT %token <i> PARSEOP_PIN_PULLDOWN diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 0f31296e8193..b80a42263fc9 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -295,17 +295,14 @@ TrAllocateNode ( } Gbl_CommentState.Latest_Parse_Node = Op; - if (Gbl_CommentState.Latest_Parse_Node->Asl.ParseOpName) - { - CvDbgPrint ("trallocatenode=Set latest parse node to this node.\n"); - CvDbgPrint (" Op->Asl.ParseOpName = %s\n", - Gbl_CommentState.Latest_Parse_Node->Asl.ParseOpName); - CvDbgPrint (" Op->Asl.ParseOpcode = 0x%x\n", ParseOpcode); + CvDbgPrint ("trallocatenode=Set latest parse node to this node.\n"); + CvDbgPrint (" Op->Asl.ParseOpName = %s\n", + Gbl_CommentState.Latest_Parse_Node->Asl.ParseOpName); + CvDbgPrint (" Op->Asl.ParseOpcode = 0x%x\n", ParseOpcode); - if (Op->Asl.FileChanged) - { - CvDbgPrint(" file has been changed!\n"); - } + if (Op->Asl.FileChanged) + { + CvDbgPrint(" file has been changed!\n"); } /* @@ -1660,7 +1657,7 @@ TrLinkChildNode ( * turn on capture comments as it signifies that we are done parsing * a method call. */ - if (Gbl_CaptureComments) + if (Gbl_CaptureComments && Op1) { if (Op1->Asl.ParseOpcode == PARSEOP_METHODCALL) { diff --git a/source/compiler/asltypes.y b/source/compiler/asltypes.y index 7f0680efe380..6886a0dc40d2 100644 --- a/source/compiler/asltypes.y +++ b/source/compiler/asltypes.y @@ -432,6 +432,11 @@ NoEcho(' %type <n> Memory32Term %type <n> NameSeg %type <n> NameString +%type <n> PinConfigTerm +%type <n> PinFunctionTerm +%type <n> PinGroupTerm +%type <n> PinGroupConfigTerm +%type <n> PinGroupFunctionTerm %type <n> QWordIOTerm %type <n> QWordMemoryTerm %type <n> QWordSpaceTerm @@ -487,6 +492,7 @@ NoEcho(' %type <n> OptionalReference %type <n> OptionalResourceType %type <n> OptionalResourceType_First +%type <n> OptionalProducerResourceType %type <n> OptionalReturnArg %type <n> OptionalSerializeRuleKeyword %type <n> OptionalShareType diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 202cf38df019..fd91baeb20e5 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -635,7 +635,7 @@ UtCheckIntegerRange ( * * PARAMETERS: Length - Size of buffer requested * - * RETURN: Pointer to the buffer. Aborts on allocation failure + * RETURN: Pointer to the buffer. Aborts compiler on allocation failure * * DESCRIPTION: Allocate a string buffer. Bypass the local * dynamic memory manager for performance reasons (This has a @@ -833,10 +833,6 @@ UtInternalizeName ( /* We need a segment to store the internal name */ Info.InternalName = UtStringCacheCalloc (Info.Length); - if (!Info.InternalName) - { - return (AE_NO_MEMORY); - } /* Build the name */ diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index ec1ce21bb3ae..62933ec1be70 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -621,7 +621,8 @@ XfNamespaceLocateBegin ( (!(OpInfo->Flags & AML_CREATE)) && (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && - (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) + (Op->Asl.ParseOpcode != PARSEOP_METHODCALL) && + (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) { return_ACPI_STATUS (AE_OK); } @@ -644,7 +645,8 @@ XfNamespaceLocateBegin ( Flags = ACPI_NS_SEARCH_PARENT; if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) + (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) || + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) { /* * These are name references, do not push the scope stack @@ -1183,7 +1185,8 @@ XfNamespaceLocateEnd ( if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) + (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) || + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) { return_ACPI_STATUS (AE_OK); } diff --git a/source/compiler/cvcompiler.c b/source/compiler/cvcompiler.c index e8366ce5523e..fab9fb946d7d 100644 --- a/source/compiler/cvcompiler.c +++ b/source/compiler/cvcompiler.c @@ -191,6 +191,7 @@ CvProcessComment ( *StringBuffer = (char) c1; ++StringBuffer; *StringBuffer = 0; + CvDbgPrint ("Multi-line comment\n"); CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1); strcpy (CommentString, MsgBuffer); @@ -198,17 +199,15 @@ CvProcessComment ( CvDbgPrint ("CommentString: %s\n", CommentString); /* - * Determine whether if this comment spans multiple lines. - * If so, break apart the comment by line so that it can be - * properly indented. + * Determine whether if this comment spans multiple lines. If so, + * break apart the comment by storing each line in a different node + * within the comment list. This allows the disassembler to + * properly indent a multi-line comment. */ - if (strchr (CommentString, '\n') != NULL) + LineToken = strtok (CommentString, "\n"); + + if (LineToken) { - /* - * Get the first token. The for loop pads subsequent lines - * for comments similar to the style of this comment. - */ - LineToken = strtok (CommentString, "\n"); FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1); strcpy (FinalLineToken, LineToken); @@ -263,7 +262,10 @@ CvProcessComment ( * if this is not a regular comment, pad with extra spaces that appeared * in the original source input to retain the original spacing. */ - FinalCommentString = UtStringCacheCalloc (strlen (CommentString) + CurrentState.SpacesBefore + 1); + FinalCommentString = + UtStringCacheCalloc (strlen (CommentString) + + CurrentState.SpacesBefore + 1); + for (i=0; (CurrentState.CommentType != ASL_COMMENT_STANDARD) && (i < CurrentState.SpacesBefore); ++i) { @@ -333,7 +335,9 @@ CvProcessCommentType2 ( * [ (spaces) (comment) ( * /) ('\0') ] * */ - FinalCommentString = UtStringCacheCalloc (CurrentState.SpacesBefore + strlen (CommentString) + 3 + 1); + FinalCommentString = UtStringCacheCalloc (CurrentState.SpacesBefore + + strlen (CommentString) + 3 + 1); + for (i=0; (CurrentState.CommentType!=1) && (i<CurrentState.SpacesBefore); ++i) { FinalCommentString[i] = ' '; @@ -556,6 +560,12 @@ CgWriteOneAmlComment( UINT8 CommentOption = InputOption; UINT8 CommentOpcode = (UINT8)AML_COMMENT_OP; + + if (!CommentToPrint) + { + return; + } + CgLocalWriteAmlData (Op, &CommentOpcode, 1); CgLocalWriteAmlData (Op, &CommentOption, 1); @@ -603,8 +613,12 @@ CgWriteAmlComment( NewFilename = FlGenerateFilename (Op->Asl.Filename, FILE_SUFFIX_DISASSEMBLY); - CvDbgPrint ("Writing file comment, \"%s\" for %s\n", - NewFilename, Op->Asl.ParseOpName); + if (NewFilename) + { + CvDbgPrint ("Writing file comment, \"%s\" for %s\n", + NewFilename, Op->Asl.ParseOpName); + } + CgWriteOneAmlComment(Op, NewFilename, FILENAME_COMMENT); if (Op->Asl.ParentFilename && @@ -688,17 +702,16 @@ CgWriteAmlComment( * ******************************************************************************/ -ACPI_COMMENT_NODE* +ACPI_COMMENT_NODE * CvCommentNodeCalloc ( void) { ACPI_COMMENT_NODE *NewCommentNode; - NewCommentNode = - (ACPI_COMMENT_NODE*) UtLocalCalloc (sizeof(ACPI_COMMENT_NODE)); + NewCommentNode = UtLocalCalloc (sizeof (ACPI_COMMENT_NODE)); NewCommentNode->Next = NULL; - return NewCommentNode; + return (NewCommentNode); } @@ -907,10 +920,12 @@ CvAppendInlineComment ( { return ToAdd; } - if (ToAdd) + if (!ToAdd) { - Size = strlen (ToAdd); + return InlineComment; } + + Size = strlen (ToAdd); Size += strlen (InlineComment); Str = UtStringCacheCalloc (Size+1); strcpy (Str, InlineComment); diff --git a/source/compiler/cvdisasm.c b/source/compiler/cvdisasm.c index e75ee0ab115d..6e9b73f0a367 100644 --- a/source/compiler/cvdisasm.c +++ b/source/compiler/cvdisasm.c @@ -314,6 +314,7 @@ CvPrintOneCommentType ( if (*CommentToPrint) { + CommentExists = TRUE; AcpiOsPrintf ("%s", *CommentToPrint); *CommentToPrint = NULL; } @@ -495,6 +496,7 @@ CvSwitchFiles( { char *Filename = Op->Common.CvFilename; ACPI_FILE_NODE *FNode; + ACPI_FILE_NODE *Current; CvDbgPrint ("Switching from %s to %s\n", AcpiGbl_CurrentFilename, Filename); FNode = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot); @@ -509,23 +511,23 @@ CvSwitchFiles( AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, NULL, MsgBuffer); AslAbort (); } + Current = FNode; /* * If the previous file is a descendent of the current file, * make sure that Include statements from the current file * to the previous have been emitted. */ - while (FNode && - FNode->Parent && - AcpiUtStricmp (FNode->Filename, AcpiGbl_CurrentFilename)) + while (Current && + Current->Parent && + AcpiUtStricmp (Current->Filename, AcpiGbl_CurrentFilename)) { - CvPrintInclude (FNode, Level); - FNode = FNode->Parent; + CvPrintInclude (Current, Level); + Current = Current->Parent; } - /* Redirect output to the Op->Common.CvFilename */ + /* Redirect output to Op->Common.CvFilename */ - FNode = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot); AcpiOsRedirectOutput (FNode->File); AcpiGbl_CurrentFilename = FNode->Filename; } diff --git a/source/compiler/cvparser.c b/source/compiler/cvparser.c index cdb165dc1daf..060e8aedec9c 100644 --- a/source/compiler/cvparser.c +++ b/source/compiler/cvparser.c @@ -215,7 +215,7 @@ CvIsFilename ( for(i = 0; i<Length; ++i) { - if (!isprint (Filename[i])) + if (!isprint ((int) Filename[i])) { return FALSE; } @@ -440,6 +440,11 @@ CvFilenameExists( ACPI_FILE_NODE *Current = Head; + if (!Filename) + { + return (NULL); + } + while (Current) { if (!AcpiUtStricmp (Current->Filename, Filename)) diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 9a6f08ee542a..61b40b4a93ef 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -578,6 +578,10 @@ DtCompileHest ( void **PFieldList); ACPI_STATUS +DtCompileHmat ( + void **PFieldList); + +ACPI_STATUS DtCompileIort ( void **PFieldList); @@ -618,6 +622,10 @@ DtCompilePmtt ( void **PFieldList); ACPI_STATUS +DtCompilePptt ( + void **PFieldList); + +ACPI_STATUS DtCompilePcct ( void **PFieldList); @@ -698,6 +706,7 @@ extern const unsigned char TemplateFadt[]; extern const unsigned char TemplateFpdt[]; extern const unsigned char TemplateGtdt[]; extern const unsigned char TemplateHest[]; +extern const unsigned char TemplateHmat[]; extern const unsigned char TemplateHpet[]; extern const unsigned char TemplateIort[]; extern const unsigned char TemplateIvrs[]; @@ -712,6 +721,7 @@ extern const unsigned char TemplateMtmr[]; extern const unsigned char TemplateNfit[]; extern const unsigned char TemplatePcct[]; extern const unsigned char TemplatePmtt[]; +extern const unsigned char TemplatePptt[]; extern const unsigned char TemplateRasf[]; extern const unsigned char TemplateRsdt[]; extern const unsigned char TemplateS3pt[]; @@ -731,6 +741,7 @@ extern const unsigned char TemplateWdat[]; extern const unsigned char TemplateWddt[]; extern const unsigned char TemplateWdrt[]; extern const unsigned char TemplateWpbt[]; +extern const unsigned char TemplateWsmt[]; extern const unsigned char TemplateXenv[]; extern const unsigned char TemplateXsdt[]; diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index 33afa3bf764a..13e8b6388019 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -679,6 +679,36 @@ DtCompileFlag ( BitLength = 2; break; + case ACPI_DMT_FLAGS4_0: + + BitPosition = 0; + BitLength = 4; + break; + + case ACPI_DMT_FLAGS4_4: + + BitPosition = 4; + BitLength = 4; + break; + + case ACPI_DMT_FLAGS4_8: + + BitPosition = 8; + BitLength = 4; + break; + + case ACPI_DMT_FLAGS4_12: + + BitPosition = 12; + BitLength = 4; + break; + + case ACPI_DMT_FLAGS16_16: + + BitPosition = 16; + BitLength = 16; + break; + default: DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid flag opcode"); diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c index c25f4b0e09af..bdf0419cf940 100644 --- a/source/compiler/dttable1.c +++ b/source/compiler/dttable1.c @@ -1249,6 +1249,16 @@ DtCompileHest ( InfoTable = AcpiDmTableInfoHest9; break; + case ACPI_HEST_TYPE_GENERIC_ERROR_V2: + + InfoTable = AcpiDmTableInfoHest10; + break; + + case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK: + + InfoTable = AcpiDmTableInfoHest11; + break; + default: /* Cannot continue on unknown type */ @@ -1283,6 +1293,12 @@ DtCompileHest ( Subtable->Buffer))->NumHardwareBanks; break; + case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK: + + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK, + Subtable->Buffer))->NumHardwareBanks; + break; + default: break; @@ -1308,6 +1324,218 @@ DtCompileHest ( /****************************************************************************** * + * FUNCTION: DtCompileHmat + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile HMAT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileHmat ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + DT_FIELD *EntryStart; + ACPI_HMAT_STRUCTURE *HmatStruct; + ACPI_HMAT_LOCALITY *HmatLocality; + ACPI_HMAT_CACHE *HmatCache; + ACPI_DMTABLE_INFO *InfoTable; + UINT32 IntPDNumber; + UINT32 TgtPDNumber; + UINT64 EntryNumber; + UINT16 SMBIOSHandleNumber; + + + ParentTable = DtPeekSubtable (); + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmat, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + /* Compile HMAT structure header */ + + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmatHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + + HmatStruct = ACPI_CAST_PTR (ACPI_HMAT_STRUCTURE, Subtable->Buffer); + HmatStruct->Length = Subtable->Length; + + /* Compile HMAT structure body */ + + switch (HmatStruct->Type) + { + case ACPI_HMAT_TYPE_ADDRESS_RANGE: + + InfoTable = AcpiDmTableInfoHmat0; + break; + + case ACPI_HMAT_TYPE_LOCALITY: + + InfoTable = AcpiDmTableInfoHmat1; + break; + + case ACPI_HMAT_TYPE_CACHE: + + InfoTable = AcpiDmTableInfoHmat2; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HMAT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + + /* Compile HMAT structure additionals */ + + switch (HmatStruct->Type) + { + case ACPI_HMAT_TYPE_LOCALITY: + + HmatLocality = ACPI_SUB_PTR (ACPI_HMAT_LOCALITY, + Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE)); + + /* Compile initiator proximity domain list */ + + IntPDNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoHmat1a, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + IntPDNumber++; + } + HmatLocality->NumberOfInitiatorPDs = IntPDNumber; + + /* Compile target proximity domain list */ + + TgtPDNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoHmat1b, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + TgtPDNumber++; + } + HmatLocality->NumberOfTargetPDs = TgtPDNumber; + + /* Save start of the entries for reporting errors */ + + EntryStart = *PFieldList; + + /* Compile latency/bandwidth entries */ + + EntryNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoHmat1c, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + EntryNumber++; + } + + /* Validate number of entries */ + + if (EntryNumber != + ((UINT64)IntPDNumber * (UINT64)TgtPDNumber)) + { + DtFatal (ASL_MSG_INVALID_EXPRESSION, EntryStart, "HMAT"); + return (AE_ERROR); + } + break; + + case ACPI_HMAT_TYPE_CACHE: + + /* Compile SMBIOS handles */ + + HmatCache = ACPI_SUB_PTR (ACPI_HMAT_CACHE, + Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE)); + SMBIOSHandleNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoHmat2a, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + SMBIOSHandleNumber++; + } + HmatCache->NumberOfSMBIOSHandles = SMBIOSHandleNumber; + break; + + default: + + break; + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileIort * * PARAMETERS: List - Current field list pointer diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c index e1d0e8bf0f36..356a7d0d19f2 100644 --- a/source/compiler/dttable2.c +++ b/source/compiler/dttable2.c @@ -871,6 +871,16 @@ DtCompilePcct ( InfoTable = AcpiDmTableInfoPcct2; break; + case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct3; + break; + + case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct4; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT"); @@ -1037,6 +1047,125 @@ DtCompilePmtt ( /****************************************************************************** * + * FUNCTION: DtCompilePptt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile PPTT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompilePptt ( + void **List) +{ + ACPI_STATUS Status; + ACPI_SUBTABLE_HEADER *PpttHeader; + ACPI_PPTT_PROCESSOR *PpttProcessor = NULL; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + + + ParentTable = DtPeekSubtable (); + while (*PFieldList) + { + SubtableStart = *PFieldList; + + /* Compile PPTT subtable header */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPpttHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + PpttHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); + PpttHeader->Length = (UINT8)(Subtable->Length); + + switch (PpttHeader->Type) + { + case ACPI_PPTT_TYPE_PROCESSOR: + + InfoTable = AcpiDmTableInfoPptt0; + break; + + case ACPI_PPTT_TYPE_CACHE: + + InfoTable = AcpiDmTableInfoPptt1; + break; + + case ACPI_PPTT_TYPE_ID: + + InfoTable = AcpiDmTableInfoPptt2; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PPTT"); + return (AE_ERROR); + } + + /* Compile PPTT subtable body */ + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + PpttHeader->Length += (UINT8)(Subtable->Length); + + /* Compile PPTT subtable additionals */ + + switch (PpttHeader->Type) + { + case ACPI_PPTT_TYPE_PROCESSOR: + + PpttProcessor = ACPI_SUB_PTR (ACPI_PPTT_PROCESSOR, + Subtable->Buffer, sizeof (ACPI_SUBTABLE_HEADER)); + if (PpttProcessor) + { + /* Compile initiator proximity domain list */ + + PpttProcessor->NumberOfPrivResources = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoPptt0a, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + + DtInsertSubtable (ParentTable, Subtable); + PpttHeader->Length += (UINT8)(Subtable->Length); + PpttProcessor->NumberOfPrivResources++; + } + } + break; + + default: + + break; + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileRsdt * * PARAMETERS: List - Current field list pointer @@ -1324,6 +1453,11 @@ DtCompileSrat ( InfoTable = AcpiDmTableInfoSrat3; break; + case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat4; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT"); diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index 701e70f4f236..bb4dded4e634 100644 --- a/source/compiler/dttemplate.h +++ b/source/compiler/dttemplate.h @@ -577,11 +577,11 @@ const unsigned char TemplateGtdt[] = const unsigned char TemplateHest[] = { - 0x48,0x45,0x53,0x54,0xD4,0x01,0x00,0x00, /* 00000000 "HEST...." */ - 0x01,0x20,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ". INTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x48,0x45,0x53,0x54,0x7C,0x02,0x00,0x00, /* 00000000 "HEST|..." */ + 0x01,0x97,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x28,0x05,0x10,0x20,0x04,0x00,0x00,0x00, /* 00000020 "(.. ...." */ + 0x03,0x03,0x17,0x20,0x04,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, /* 00000028 "........" */ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ @@ -596,7 +596,7 @@ const unsigned char TemplateHest[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ 0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, /* 00000088 "........" */ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000090 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ + 0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */ 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, /* 000000B0 "........" */ @@ -635,7 +635,52 @@ const unsigned char TemplateHest[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001B8 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C0 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C8 "........" */ - 0x00,0x10,0x00,0x00 /* 000001D0 "...." */ + 0x00,0x10,0x00,0x00,0x0A,0x00,0x03,0x00, /* 000001D0 "........" */ + 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00, /* 000001D8 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00, /* 000001E0 "........" */ + 0x00,0x40,0x00,0x04,0x00,0x00,0x00,0x00, /* 000001E8 ".@......" */ + 0x00,0x00,0x00,0x00,0x04,0x1C,0x00,0x00, /* 000001F0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001F8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000200 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000208 "........" */ + 0x00,0x10,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000210 ".....@.." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000218 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000220 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000228 "........" */ + 0x0B,0x00,0x01,0x00,0x00,0x00,0x00,0x01, /* 00000230 "........" */ + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000238 "........" */ + 0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000240 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000248 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000250 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000258 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000260 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000268 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000270 "........" */ + 0x00,0x00,0x00,0x00 /* 00000278 "...." */ +}; + +const unsigned char TemplateHmat[] = +{ + 0x48,0x4D,0x41,0x54,0x9C,0x00,0x00,0x00, /* 00000000 "HMAT...." */ + 0x00,0x54,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".TINTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x03,0x03,0x17,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x00,0x28,0x00,0x00,0x00, /* 00000028 "....(..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x01,0x00,0x00,0x00,0x2A,0x00,0x00,0x00, /* 00000050 "....*..." */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ + 0x00,0x00,0x02,0x00,0x00,0x00,0x22,0x00, /* 00000078 "......"." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */ + 0x01,0x00,0x00,0x00 /* 00000098 "...." */ }; const unsigned char TemplateHpet[] = @@ -958,39 +1003,80 @@ const unsigned char TemplateMtmr[] = const unsigned char TemplatePcct[] = { - 0x50,0x43,0x43,0x54,0x06,0x01,0x00,0x00, /* 00000000 "PCCT...." */ - 0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x18,0x03,0x16,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x50,0x43,0x43,0x54,0x4e,0x02,0x00,0x00, /* 00000000 "PCCTN..." */ + 0x01,0x47,0x49,0x4e,0x54,0x45,0x4c,0x20, /* 00000008 ".GINTEL " */ + 0x54,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65, /* 00000010 "Template" */ + 0x01,0x00,0x00,0x00,0x49,0x4e,0x54,0x4c, /* 00000018 "....INTL" */ + 0x03,0x03,0x17,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ - 0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 ".>......" */ + 0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 ".>......" */ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, /* 00000038 "........" */ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, /* 00000040 """""""""" */ 0x01,0x32,0x00,0x03,0x33,0x33,0x33,0x33, /* 00000048 ".2..3333" */ 0x33,0x33,0x33,0x33,0x44,0x44,0x44,0x44, /* 00000050 "3333DDDD" */ 0x44,0x44,0x44,0x44,0x55,0x55,0x55,0x55, /* 00000058 "DDDDUUUU" */ 0x55,0x55,0x55,0x55,0x66,0x66,0x66,0x66, /* 00000060 "UUUUffff" */ - 0x77,0x77,0x77,0x77,0x88,0x88,0x01,0x3E, /* 00000068 "wwww...>" */ + 0x77,0x77,0x77,0x77,0x88,0x88,0x01,0x3e, /* 00000068 "wwww...>" */ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000070 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x32, /* 00000080 ".......2" */ 0x00,0x03,0x44,0x44,0x44,0x44,0x44,0x44, /* 00000088 "..DDDDDD" */ 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 00000090 "DDDDDDDD" */ 0x44,0x44,0x55,0x55,0x55,0x55,0x55,0x55, /* 00000098 "DDUUUUUU" */ - 0x55,0x55,0x66,0x66,0x66,0x66,0x77,0x77, /* 000000A0 "UUffffww" */ - 0x77,0x77,0x88,0x88,0x02,0x5A,0x01,0x00, /* 000000A8 "ww...Z.." */ - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */ - 0x00,0x00,0x00,0x00,0x01,0x32,0x00,0x03, /* 000000C0 ".....2.." */ - 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000C8 "DDDDDDDD" */ - 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000D0 "DDDDDDDD" */ - 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, /* 000000D8 "UUUUUUUU" */ - 0x66,0x66,0x66,0x66,0x77,0x77,0x77,0x77, /* 000000E0 "ffffwwww" */ - 0x88,0x88,0x01,0x32,0x00,0x03,0x33,0x33, /* 000000E8 "...2..33" */ - 0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 000000F0 "333333DD" */ - 0x44,0x44,0x44,0x44,0x44,0x44,0x55,0x55, /* 000000F8 "DDDDDDUU" */ - 0x55,0x55,0x55,0x55,0x55,0x55 /* 00000100 "UUUUUU" */ + 0x55,0x55,0x66,0x66,0x66,0x66,0x77,0x77, /* 000000a0 "UUffffww" */ + 0x77,0x77,0x88,0x88,0x02,0x5a,0x01,0x00, /* 000000a8 "ww...Z.." */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000b0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000b8 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x32,0x00,0x03, /* 000000c0 ".....2.." */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000c8 "DDDDDDDD" */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000d0 "DDDDDDDD" */ + 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, /* 000000d8 "UUUUUUUU" */ + 0x66,0x66,0x66,0x66,0x77,0x77,0x77,0x77, /* 000000e0 "ffffwwww" */ + 0x88,0x88,0x01,0x32,0x00,0x03,0x33,0x33, /* 000000e8 "...2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 000000f0 "333333DD" */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x55,0x55, /* 000000f8 "DDDDDDUU" */ + 0x55,0x55,0x55,0x55,0x55,0x55,0x03,0xa4, /* 00000100 "UUUUUU.." */ + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000108 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ + 0x00,0x00,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000118 "...2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 00000120 "333333DD" */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x55,0x55, /* 00000128 "DDDDDDUU" */ + 0x55,0x55,0x55,0x55,0x55,0x55,0x66,0x66, /* 00000130 "UUUUUUff" */ + 0x66,0x66,0x77,0x77,0x77,0x77,0x88,0x88, /* 00000138 "ffwwww.." */ + 0x88,0x88,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000140 "...2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x99,0x99, /* 00000148 "333333.." */ + 0x99,0x99,0x99,0x99,0x99,0x99,0x00,0x00, /* 00000150 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x32, /* 00000160 ".......2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000168 "..333333" */ + 0x33,0x33,0x22,0x22,0x22,0x22,0x22,0x22, /* 00000170 "33""""""" */ + 0x22,0x22,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000178 """.2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000180 "33333333" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 00000188 "333333DD" */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x01,0x32, /* 00000190 "DDDDDD.2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000198 "..333333" */ + 0x33,0x33,0x55,0x55,0x55,0x55,0x55,0x55, /* 000001a0 "33UUUUUU" */ + 0x55,0x55,0x04,0xa4,0x01,0x00,0x00,0x00, /* 000001a8 "UU......" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001b0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x32, /* 000001b8 ".......2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 000001c0 "..333333" */ + 0x33,0x33,0x44,0x44,0x44,0x44,0x44,0x44, /* 000001c8 "33DDDDDD" */ + 0x44,0x44,0x55,0x55,0x55,0x55,0x55,0x55, /* 000001d0 "DDUUUUUU" */ + 0x55,0x55,0x66,0x66,0x66,0x66,0x77,0x77, /* 000001d8 "UUffffww" */ + 0x77,0x77,0x88,0x88,0x88,0x88,0x01,0x32, /* 000001e0 "ww.....2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 000001e8 "..333333" */ + 0x33,0x33,0x99,0x99,0x99,0x99,0x99,0x99, /* 000001f0 "33......" */ + 0x99,0x99,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001f8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000200 "........" */ + 0x00,0x00,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000208 "...2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x22,0x22, /* 00000210 "333333""" */ + 0x22,0x22,0x22,0x22,0x22,0x22,0x01,0x32, /* 00000218 """"""".2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000220 "..333333" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000228 "33333333" */ + 0x33,0x33,0x44,0x44,0x44,0x44,0x44,0x44, /* 00000230 "33DDDDDD" */ + 0x44,0x44,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000238 "DD.2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x55,0x55, /* 00000240 "333333UU" */ + 0x55,0x55,0x55,0x55,0x55,0x55 /* 00000248 "UUUUUU| */ }; const unsigned char TemplatePmtt[] = @@ -1020,6 +1106,25 @@ const unsigned char TemplatePmtt[] = 0x00,0x00,0x00,0x00 /* 000000B0 "...." */ }; +const unsigned char TemplatePptt[] = +{ + 0x50,0x50,0x54,0x54,0x72,0x00,0x00,0x00, /* 00000000 "PPTTr..." */ + 0x01,0x86,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x03,0x03,0x17,0x20,0x00,0x18,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x18,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x02,0x1E,0x00,0x00, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x00 /* 00000070 ".." */ +}; + const unsigned char TemplateRasf[] = { 0x52,0x41,0x53,0x46,0x30,0x00,0x00,0x00, /* 00000000 "RASF0..." */ @@ -1213,11 +1318,11 @@ const unsigned char TemplateSpmi[] = const unsigned char TemplateSrat[] = { - 0x53,0x52,0x41,0x54,0x92,0x00,0x00,0x00, /* 00000000 "SRAT...." */ - 0x03,0x50,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".PINTEL " */ + 0x53,0x52,0x41,0x54,0x9E,0x00,0x00,0x00, /* 00000000 "SRAT...." */ + 0x03,0x55,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".UINTEL " */ 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x24,0x07,0x14,0x20,0x01,0x00,0x00,0x00, /* 00000020 "$.. ...." */ + 0x03,0x03,0x17,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ 0x00,0x10,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ @@ -1231,7 +1336,8 @@ const unsigned char TemplateSrat[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ 0x03,0x12,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ - 0x00,0x00 /* 00000090 ".." */ + 0x00,0x00,0x04,0x0C,0x00,0x00,0x00,0x00, /* 00000090 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00 /* 00000098 "......" */ }; const unsigned char TemplateStao[] = @@ -1379,6 +1485,15 @@ const unsigned char TemplateWpbt[] = 0x72,0x00,0x74,0x00,0x68,0x00,0x00,0x00 /* 00000090 "r.t.h..." */ }; +const unsigned char TemplateWsmt[] = +{ + 0x57,0x53,0x4D,0x54,0x28,0x00,0x00,0x00, /* 00000000 "WSMT(..." */ + 0x00,0x08,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" */ + 0x19,0x01,0x17,0x20,0x05,0x00,0x00,0x00 /* 00000020 "... ...." */ +}; + const unsigned char TemplateXenv[] = { 0x58,0x45,0x4E,0x56,0x39,0x00,0x00,0x00, /* 00000000 "XENV9..." */ diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index 7fbc7d569295..8807217510b8 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -371,6 +371,11 @@ DtGetFieldType ( case ACPI_DMT_FLAGS1: case ACPI_DMT_FLAGS2: case ACPI_DMT_FLAGS4: + case ACPI_DMT_FLAGS4_0: + case ACPI_DMT_FLAGS4_4: + case ACPI_DMT_FLAGS4_8: + case ACPI_DMT_FLAGS4_12: + case ACPI_DMT_FLAGS16_16: Type = DT_FIELD_TYPE_FLAG; break; @@ -512,6 +517,11 @@ DtGetFieldLength ( case ACPI_DMT_FLAGS1: case ACPI_DMT_FLAGS2: case ACPI_DMT_FLAGS4: + case ACPI_DMT_FLAGS4_0: + case ACPI_DMT_FLAGS4_4: + case ACPI_DMT_FLAGS4_8: + case ACPI_DMT_FLAGS4_12: + case ACPI_DMT_FLAGS16_16: case ACPI_DMT_LABEL: case ACPI_DMT_EXTRA_TEXT: @@ -527,6 +537,7 @@ DtGetFieldLength ( case ACPI_DMT_MADT: case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: + case ACPI_DMT_PPTT: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -543,6 +554,7 @@ DtGetFieldLength ( case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: case ACPI_DMT_HEST: + case ACPI_DMT_HMAT: case ACPI_DMT_NFIT: case ACPI_DMT_PCI_PATH: |