diff options
Diffstat (limited to 'sys/contrib/dev/acpica/compiler')
21 files changed, 1451 insertions, 172 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslascii.c b/sys/contrib/dev/acpica/compiler/aslascii.c index e6b3311a3e83..08e4630aabf1 100644 --- a/sys/contrib/dev/acpica/compiler/aslascii.c +++ b/sys/contrib/dev/acpica/compiler/aslascii.c @@ -148,8 +148,7 @@ FlCheckForAcpiTable ( * * FUNCTION: FlCheckForAscii * - * PARAMETERS: Handle - Open input file - * Filename - Input filename + * PARAMETERS: Filename - Full input filename * DisplayErrors - TRUE if error messages desired * * RETURN: Status @@ -165,7 +164,6 @@ FlCheckForAcpiTable ( ACPI_STATUS FlCheckForAscii ( - FILE *Handle, char *Filename, BOOLEAN DisplayErrors) { @@ -173,7 +171,12 @@ FlCheckForAscii ( ACPI_SIZE BadBytes = 0; BOOLEAN OpeningComment = FALSE; ASL_FILE_STATUS Status; + FILE *Handle; + + + /* Open file in text mode so file offset is always accurate */ + Handle = fopen (Filename, "rb"); Status.Line = 1; Status.Offset = 0; @@ -214,16 +217,30 @@ FlCheckForAscii ( if ((BadBytes < 10) && (DisplayErrors)) { AcpiOsPrintf ( - "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n", + "Found non-ASCII character in source text: " + "0x%2.2X in line %u, file offset 0x%2.2X\n", Byte, Status.Line, Status.Offset); } + BadBytes++; + } + /* Ensure character is either printable or a "space" char */ + + else if (!ACPI_IS_PRINT (Byte) && !ACPI_IS_SPACE (Byte)) + { + if ((BadBytes < 10) && (DisplayErrors)) + { + AcpiOsPrintf ( + "Found invalid character in source text: " + "0x%2.2X in line %u, file offset 0x%2.2X\n", + Byte, Status.Line, Status.Offset); + } BadBytes++; } - /* Update line counter */ + /* Update line counter as necessary */ - else if (Byte == 0x0A) + if (Byte == 0x0A) { Status.Line++; } @@ -231,9 +248,7 @@ FlCheckForAscii ( Status.Offset++; } - /* Seek back to the beginning of the source file */ - - fseek (Handle, 0, SEEK_SET); + fclose (Handle); /* Were there any non-ASCII characters in the file? */ @@ -242,8 +257,8 @@ FlCheckForAscii ( if (DisplayErrors) { AcpiOsPrintf ( - "%u non-ASCII characters found in input source text, could be a binary file\n", - BadBytes); + "Total %u invalid characters found in input source text, " + "could be a binary file\n", BadBytes); AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, Filename); } @@ -286,6 +301,7 @@ FlConsumeAnsiComment ( { if (Byte == '/') { + Status->Offset++; return; } diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 7b0729510384..181b36c31079 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -172,7 +172,6 @@ FlCheckForAcpiTable ( ACPI_STATUS FlCheckForAscii ( - FILE *Handle, char *Filename, BOOLEAN DisplayErrors); diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l index f831233234fc..621f5aee2706 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.l +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l @@ -709,9 +709,18 @@ NamePathTail [.]{NameSeg} return (PARSEOP_NAMESTRING); } . { count (1); - sprintf (MsgBuffer, - "Invalid character (0x%2.2X), expecting ASL keyword or name", - *AslCompilertext); + if (ACPI_IS_PRINT (*AslCompilertext)) + { + sprintf (MsgBuffer, + "Invalid character (%c), expecting ASL keyword or name", + *AslCompilertext); + } + else + { + sprintf (MsgBuffer, + "Invalid character (0x%2.2X), expecting ASL keyword or name", + *AslCompilertext); + } AslCompilererror (MsgBuffer);} <<EOF>> { if (AslPopInputFileStack ()) diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h index 14307c1bfb23..0697276d28a2 100644 --- a/sys/contrib/dev/acpica/compiler/asldefine.h +++ b/sys/contrib/dev/acpica/compiler/asldefine.h @@ -53,7 +53,7 @@ #define ASL_INVOCATION_NAME "iasl" #define ASL_CREATOR_ID "INTL" -#define ASL_COMPLIANCE "Supports ACPI Specification Revision 5.1" +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.0" /* Configuration constants */ diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c index 63a8dbb50fbb..d8c9ed5968de 100644 --- a/sys/contrib/dev/acpica/compiler/aslfiles.c +++ b/sys/contrib/dev/acpica/compiler/aslfiles.c @@ -49,9 +49,10 @@ /* Local prototypes */ -FILE * +static FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, + ACPI_PARSE_OBJECT *Op, char *Filename); @@ -294,9 +295,10 @@ ConvertBackslashes: * ******************************************************************************/ -FILE * +static FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, + ACPI_PARSE_OBJECT *Op, char *Filename) { FILE *IncludeFile; @@ -320,6 +322,26 @@ FlOpenIncludeWithPrefix ( return (NULL); } +#ifdef _MUST_HANDLE_COMMENTS + /* + * Check entire include file for any # preprocessor directives. + * This is because there may be some confusion between the #include + * preprocessor directive and the ASL Include statement. + */ + while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, IncludeFile)) + { + if (Gbl_CurrentLineBuffer[0] == '#') + { + AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE, + Op, "use #include instead"); + } + } +#endif + + /* Must seek back to the start of the file */ + + fseek (IncludeFile, 0, SEEK_SET); + /* Push the include file on the open input file stack */ AslPushInputFileStack (IncludeFile, Pathname); @@ -376,7 +398,7 @@ FlOpenIncludeFile ( (Op->Asl.Value.String[0] == '\\') || (Op->Asl.Value.String[1] == ':')) { - IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); + IncludeFile = FlOpenIncludeWithPrefix ("", Op, Op->Asl.Value.String); if (!IncludeFile) { goto ErrorExit; @@ -392,7 +414,7 @@ FlOpenIncludeFile ( * * Construct the file pathname from the global directory name. */ - IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); + IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op, Op->Asl.Value.String); if (IncludeFile) { return; @@ -405,7 +427,7 @@ FlOpenIncludeFile ( NextDir = Gbl_IncludeDirList; while (NextDir) { - IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); + IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op, Op->Asl.Value.String); if (IncludeFile) { return; diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.c b/sys/contrib/dev/acpica/compiler/aslmessages.c index 12a4208eb75c..c57fd2d3f0a2 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.c +++ b/sys/contrib/dev/acpica/compiler/aslmessages.c @@ -270,7 +270,8 @@ const char *AslPreprocessorMsgs [] = /* ASL_MSG_TOO_MANY_ARGUMENTS */ "Too many macro arguments", /* ASL_MSG_UNKNOWN_DIRECTIVE */ "Unknown directive", /* ASL_MSG_UNKNOWN_PRAGMA */ "Unknown pragma", -/* ASL_MSG_WARNING_DIRECTIVE */ "#warning" +/* ASL_MSG_WARNING_DIRECTIVE */ "#warning", +/* ASL_MSG_INCLUDE_FILE */ "Found a # preprocessor directive in ASL Include() file" }; @@ -331,7 +332,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs)) { - return ("[Unknown Preprocesor exception ID]"); + return ("[Unknown Preprocessor exception ID]"); } } diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h index 7a04a635245c..9837d540698f 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.h +++ b/sys/contrib/dev/acpica/compiler/aslmessages.h @@ -267,6 +267,7 @@ typedef enum ASL_MSG_UNKNOWN_DIRECTIVE, ASL_MSG_UNKNOWN_PRAGMA, ASL_MSG_WARNING_DIRECTIVE, + ASL_MSG_INCLUDE_FILE } ASL_MESSAGE_IDS; diff --git a/sys/contrib/dev/acpica/compiler/aslprepkg.c b/sys/contrib/dev/acpica/compiler/aslprepkg.c index 37a58df3ecfc..be0a4c4728a6 100644 --- a/sys/contrib/dev/acpica/compiler/aslprepkg.c +++ b/sys/contrib/dev/acpica/compiler/aslprepkg.c @@ -151,6 +151,7 @@ ApCheckPackage ( case ACPI_PTYPE2_FIXED: case ACPI_PTYPE2_MIN: case ACPI_PTYPE2_FIX_VAR: + case ACPI_PTYPE2_VAR_VAR: default: break; @@ -324,6 +325,32 @@ ApCheckPackage ( break; + case ACPI_PTYPE2_VAR_VAR: + + /* Check for minimum size (ints at beginning + 1 subpackage) */ + + ExpectedCount = Package->RetInfo4.Count1 + 1; + if (Count < ExpectedCount) + { + goto PackageTooSmall; + } + + /* Check the non-package elements at beginning of main package */ + + for (i = 0; i < Package->RetInfo4.Count1; ++i) + { + Status = ApCheckObjectType (Predefined->Info.Name, Op, + Package->RetInfo4.ObjectType1, i); + Op = Op->Asl.Next; + } + + /* Examine the variable-length list of subpackages */ + + ApCheckPackageList (Predefined->Info.Name, Op, + Package, Package->RetInfo4.Count1, Count); + + break; + case ACPI_PTYPE2: case ACPI_PTYPE2_FIXED: case ACPI_PTYPE2_MIN: @@ -427,6 +454,7 @@ ApCheckPackageElements ( * ACPI_PTYPE2_MIN * ACPI_PTYPE2_COUNT * ACPI_PTYPE2_FIX_VAR + * ACPI_PTYPE2_VAR_VAR * ******************************************************************************/ @@ -473,9 +501,12 @@ ApCheckPackageList ( Count = (UINT32) Op->Asl.Value.Integer; Op = Op->Asl.Next; - /* The subpackage must have at least one element */ - - if (!Count) + /* + * Most subpackage must have at least one element, with + * only rare exceptions. (_RDI) + */ + if (!Count && + (Package->RetInfo.Type != ACPI_PTYPE2_VAR_VAR)) { ApZeroLengthPackage (PredefinedName, SubPackageOp); goto NextSubpackage; @@ -533,6 +564,25 @@ ApCheckPackageList ( Count - Package->RetInfo.Count1); break; + case ACPI_PTYPE2_VAR_VAR: + /* + * Must have at least the minimum number elements. + * A zero PkgCount means the number of elements is variable. + */ + ExpectedCount = Package->RetInfo4.PkgCount; + if (ExpectedCount && (Count < ExpectedCount)) + { + ApPackageTooSmall (PredefinedName, SubPackageOp, + Count, 1); + break; + } + + ApCheckPackageElements (PredefinedName, Op, + Package->RetInfo4.SubObjectTypes, + Package->RetInfo4.PkgCount, + 0, 0); + break; + case ACPI_PTYPE2_FIXED: /* Each subpackage has a fixed length */ diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index cbebd0d2e508..85e2f883fcc4 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -159,10 +159,10 @@ AslDetectSourceFileType ( /* Check for 100% ASCII source file (comments are ignored) */ - Status = FlCheckForAscii (Info->Handle, Info->Filename, TRUE); + Status = FlCheckForAscii (Info->Filename, TRUE); if (ACPI_FAILURE (Status)) { - printf ("Non-ascii input file - %s\n", Info->Filename); + printf ("Invalid characters in input file - %s\n", Info->Filename); if (!Gbl_IgnoreErrors) { diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index 37d394b43dd3..dadd6b157090 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -77,13 +77,11 @@ UtAttachNameseg ( * ******************************************************************************/ -#define ACPI_TABLE_HELP_FORMAT "%8u) %s %s\n" - void UtDisplaySupportedTables ( void) { - ACPI_DMTABLE_DATA *TableData; + const AH_TABLE *TableData; UINT32 i; @@ -91,20 +89,14 @@ UtDisplaySupportedTables ( " (Compiler, Disassembler, Template Generator)\n\n", ACPI_CA_VERSION); - /* Special tables */ - - printf (" Special tables and AML tables:\n"); - printf (ACPI_TABLE_HELP_FORMAT, 1, ACPI_RSDP_NAME, "Root System Description Pointer"); - printf (ACPI_TABLE_HELP_FORMAT, 2, ACPI_SIG_FACS, "Firmware ACPI Control Structure"); - printf (ACPI_TABLE_HELP_FORMAT, 3, ACPI_SIG_DSDT, "Differentiated System Description Table"); - printf (ACPI_TABLE_HELP_FORMAT, 4, ACPI_SIG_SSDT, "Secondary System Description Table"); - - /* All data tables with common table header */ + /* All ACPI tables with the common table header */ - printf ("\n Standard ACPI data tables:\n"); - for (TableData = AcpiDmTableData, i = 5; TableData->Signature; TableData++, i++) + printf ("\n Supported ACPI tables:\n"); + for (TableData = AcpiSupportedTables, i = 1; + TableData->Signature; TableData++, i++) { - printf (ACPI_TABLE_HELP_FORMAT, i, TableData->Signature, TableData->Name); + printf ("%8u) %s %s\n", i, + TableData->Signature, TableData->Description); } } diff --git a/sys/contrib/dev/acpica/compiler/dtcompile.c b/sys/contrib/dev/acpica/compiler/dtcompile.c index 74bfc3334ded..20da14341d08 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompile.c +++ b/sys/contrib/dev/acpica/compiler/dtcompile.c @@ -283,7 +283,7 @@ static ACPI_STATUS DtCompileDataTable ( DT_FIELD **FieldList) { - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *TableData; DT_SUBTABLE *Subtable; char *Signature; ACPI_TABLE_HEADER *AcpiTableHeader; @@ -358,7 +358,7 @@ DtCompileDataTable ( TableData = AcpiDmGetTableData (Signature); if (!TableData || Gbl_CompileGeneric) { - DtCompileGeneric ((void **) FieldList); + DtCompileGeneric ((void **) FieldList, NULL, NULL); goto FinishHeader; } @@ -436,14 +436,14 @@ DtCompileTable ( DT_FIELD *LocalField; UINT32 Length; DT_SUBTABLE *Subtable; - DT_SUBTABLE *InlineSubtable; + DT_SUBTABLE *InlineSubtable = NULL; UINT32 FieldLength = 0; UINT8 FieldType; UINT8 *Buffer; UINT8 *FlagBuffer = NULL; char *String; UINT32 CurrentFlagByteOffset = 0; - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; if (!Field || !*Field) @@ -479,6 +479,7 @@ DtCompileTable ( Buffer = Subtable->Buffer; LocalField = *Field; + Subtable->Name = LocalField->Name; /* * Main loop walks the info table for this ACPI table or subtable @@ -555,15 +556,32 @@ DtCompileTable ( */ *Field = LocalField; - if (Info->Opcode == ACPI_DMT_GAS) + switch (Info->Opcode) { + case ACPI_DMT_GAS: + Status = DtCompileTable (Field, AcpiDmTableInfoGas, &InlineSubtable, TRUE); - } - else - { + break; + + case ACPI_DMT_HESTNTFY: + Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify, &InlineSubtable, TRUE); + break; + + case ACPI_DMT_IORTMEM: + + Status = DtCompileTable (Field, AcpiDmTableInfoIortAcc, + &InlineSubtable, TRUE); + break; + + default: + sprintf (MsgBuffer, "Invalid DMT opcode: 0x%.2X", + Info->Opcode); + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + Status = AE_BAD_DATA; + break; } if (ACPI_FAILURE (Status)) @@ -600,7 +618,6 @@ DtCompileTable ( Subtable->LengthField = Buffer; Subtable->SizeOfLengthField = FieldLength; } - break; } @@ -616,3 +633,43 @@ Error: ACPI_FREE (Subtable); return (Status); } + + +/****************************************************************************** + * + * FUNCTION: DtCompilePadding + * + * PARAMETERS: Length - Padding field size + * RetSubtable - Compile result of table + * + * RETURN: Status + * + * DESCRIPTION: Compile a subtable for padding purpose + * + *****************************************************************************/ + +ACPI_STATUS +DtCompilePadding ( + UINT32 Length, + DT_SUBTABLE **RetSubtable) +{ + DT_SUBTABLE *Subtable; + /* UINT8 *Buffer; */ + char *String; + + + Subtable = UtSubtableCacheCalloc (); + + if (Length > 0) + { + String = UtStringCacheCalloc (Length); + Subtable->Buffer = ACPI_CAST_PTR (UINT8, String); + } + + Subtable->Length = Length; + Subtable->TotalLength = Length; + /* Buffer = Subtable->Buffer; */ + + *RetSubtable = Subtable; + return (AE_OK); +} diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h index 3a0b76379724..201b2dbfa2d6 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompiler.h +++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h @@ -115,6 +115,7 @@ typedef struct dt_subtable struct dt_subtable *StackTop; UINT8 *Buffer; UINT8 *LengthField; + char *Name; UINT32 Length; UINT32 TotalLength; UINT32 SizeOfLengthField; @@ -170,6 +171,11 @@ DtCompileTable ( DT_SUBTABLE **RetSubtable, BOOLEAN Required); +ACPI_STATUS +DtCompilePadding ( + UINT32 Length, + DT_SUBTABLE **RetSubtable); + /* dtio - binary and text input/output */ @@ -429,6 +435,10 @@ DtCompileDmar ( void **PFieldList); ACPI_STATUS +DtCompileDrtm ( + void **PFieldList); + +ACPI_STATUS DtCompileEinj ( void **PFieldList); @@ -453,6 +463,10 @@ DtCompileHest ( void **PFieldList); ACPI_STATUS +DtCompileIort ( + void **PFieldList); + +ACPI_STATUS DtCompileIvrs ( void **PFieldList); @@ -481,6 +495,10 @@ DtCompileMtmr ( void **PFieldList); ACPI_STATUS +DtCompileNfit ( + void **PFieldList); + +ACPI_STATUS DtCompilePmtt ( void **PFieldList); @@ -509,6 +527,10 @@ DtCompileSrat ( void **PFieldList); ACPI_STATUS +DtCompileStao ( + void **PFieldList); + +ACPI_STATUS DtCompileUefi ( void **PFieldList); @@ -521,12 +543,18 @@ DtCompileWdat ( void **PFieldList); ACPI_STATUS +DtCompileWpbt ( + void **PFieldList); + +ACPI_STATUS DtCompileXsdt ( void **PFieldList); ACPI_STATUS DtCompileGeneric ( - void **PFieldList); + void **PFieldList, + char *TermFieldName, + UINT32 *PFieldLength); ACPI_DMTABLE_INFO * DtGetGenericTableInfo ( @@ -543,6 +571,7 @@ extern const unsigned char TemplateCsrt[]; extern const unsigned char TemplateDbg2[]; extern const unsigned char TemplateDbgp[]; extern const unsigned char TemplateDmar[]; +extern const unsigned char TemplateDrtm[]; extern const unsigned char TemplateEcdt[]; extern const unsigned char TemplateEinj[]; extern const unsigned char TemplateErst[]; @@ -551,6 +580,7 @@ extern const unsigned char TemplateFpdt[]; extern const unsigned char TemplateGtdt[]; extern const unsigned char TemplateHest[]; extern const unsigned char TemplateHpet[]; +extern const unsigned char TemplateIort[]; extern const unsigned char TemplateIvrs[]; extern const unsigned char TemplateLpit[]; extern const unsigned char TemplateMadt[]; @@ -560,6 +590,7 @@ extern const unsigned char TemplateMpst[]; extern const unsigned char TemplateMsct[]; extern const unsigned char TemplateMsdm[]; extern const unsigned char TemplateMtmr[]; +extern const unsigned char TemplateNfit[]; extern const unsigned char TemplatePcct[]; extern const unsigned char TemplatePmtt[]; extern const unsigned char TemplateRsdt[]; @@ -570,6 +601,7 @@ extern const unsigned char TemplateSlit[]; extern const unsigned char TemplateSpcr[]; extern const unsigned char TemplateSpmi[]; extern const unsigned char TemplateSrat[]; +extern const unsigned char TemplateStao[]; extern const unsigned char TemplateTcpa[]; extern const unsigned char TemplateTpm2[]; extern const unsigned char TemplateUefi[]; @@ -578,6 +610,8 @@ extern const unsigned char TemplateWaet[]; extern const unsigned char TemplateWdat[]; extern const unsigned char TemplateWddt[]; extern const unsigned char TemplateWdrt[]; +extern const unsigned char TemplateWpbt[]; +extern const unsigned char TemplateXenv[]; extern const unsigned char TemplateXsdt[]; #endif diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c index bebd9279bd55..4b05bd0fe571 100644 --- a/sys/contrib/dev/acpica/compiler/dtio.c +++ b/sys/contrib/dev/acpica/compiler/dtio.c @@ -978,8 +978,8 @@ DtDumpSubtableInfo ( { DbgPrint (ASL_DEBUG_OUTPUT, - "[%.04X] %.08X %.08X %.08X %.08X %.08X %p %p %p\n", - Subtable->Depth, Subtable->Length, Subtable->TotalLength, + "[%.04X] %24s %.08X %.08X %.08X %.08X %.08X %p %p %p\n", + Subtable->Depth, Subtable->Name, Subtable->Length, Subtable->TotalLength, Subtable->SizeOfLengthField, Subtable->Flags, Subtable, Subtable->Parent, Subtable->Child, Subtable->Peer); } @@ -992,8 +992,8 @@ DtDumpSubtableTree ( { DbgPrint (ASL_DEBUG_OUTPUT, - "[%.04X] %*s%08X (%.02X) - (%.02X)\n", - Subtable->Depth, (4 * Subtable->Depth), " ", + "[%.04X] %24s %*s%08X (%.02X) - (%.02X)\n", + Subtable->Depth, Subtable->Name, (4 * Subtable->Depth), " ", Subtable, Subtable->Length, Subtable->TotalLength); } @@ -1024,12 +1024,12 @@ DtDumpSubtableList ( DbgPrint (ASL_DEBUG_OUTPUT, "Subtable Info:\n" - "Depth Length TotalLen LenSize Flags " + "Depth Name Length TotalLen LenSize Flags " "This Parent Child Peer\n\n"); DtWalkTableTree (Gbl_RootTable, DtDumpSubtableInfo, NULL, NULL); DbgPrint (ASL_DEBUG_OUTPUT, - "\nSubtable Tree: (Depth, Subtable, Length, TotalLength)\n\n"); + "\nSubtable Tree: (Depth, Name, Subtable, Length, TotalLength)\n\n"); DtWalkTableTree (Gbl_RootTable, DtDumpSubtableTree, NULL, NULL); DbgPrint (ASL_DEBUG_OUTPUT, "\n"); diff --git a/sys/contrib/dev/acpica/compiler/dtsubtable.c b/sys/contrib/dev/acpica/compiler/dtsubtable.c index 1e6a76a08c92..115265693245 100644 --- a/sys/contrib/dev/acpica/compiler/dtsubtable.c +++ b/sys/contrib/dev/acpica/compiler/dtsubtable.c @@ -321,6 +321,11 @@ DtGetSubtableLength ( Step = 9; break; + case ACPI_DMT_IORTMEM: + + Step = 10; + break; + default: Step = 1; diff --git a/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c index 3fe02e8f0b14..bae80ade2bdb 100644 --- a/sys/contrib/dev/acpica/compiler/dttable.c +++ b/sys/contrib/dev/acpica/compiler/dttable.c @@ -65,12 +65,6 @@ static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] = }; -/* TBD: move to acmacros.h */ - -#define ACPI_SUB_PTR(t, a, b) \ - ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b))) - - /* Local prototypes */ static ACPI_STATUS @@ -454,6 +448,7 @@ DtCompileCsrt ( /* Subtables (Resource Groups) */ + ParentTable = DtPeekSubtable (); while (*PFieldList) { /* Resource group subtable */ @@ -477,9 +472,9 @@ DtCompileCsrt ( DescriptorCount = (GroupLength / sizeof (ACPI_CSRT_DESCRIPTOR)); - ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); /* Shared info subtable (One per resource group) */ @@ -490,26 +485,44 @@ DtCompileCsrt ( return (Status); } - ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); /* Sub-Subtables (Resource Descriptors) */ while (*PFieldList && DescriptorCount) { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2, &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); + if (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + } + } + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + DescriptorCount--; } DtPopSubtable (); + ParentTable = DtPeekSubtable (); } return (Status); @@ -828,6 +841,135 @@ DtCompileDmar ( /****************************************************************************** * + * FUNCTION: DtCompileDrtm + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile DRTM. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileDrtm ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + UINT32 Count; + /* ACPI_TABLE_DRTM *Drtm; */ + ACPI_DRTM_VTABLE_LIST *DrtmVtl; + ACPI_DRTM_RESOURCE_LIST *DrtmRl; + /* ACPI_DRTM_DPS_ID *DrtmDps; */ + + + ParentTable = DtPeekSubtable (); + + /* Compile DRTM header */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + 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. + */ +#if 0 + Drtm = ACPI_SUB_PTR (ACPI_TABLE_DRTM, + Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); +#endif + /* Compile VTL */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + DrtmVtl = ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST, Subtable->Buffer); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + Count = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + DrtmVtl->ValidatedTableCount = Count; + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + + /* Compile RL */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + DrtmRl = ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST, Subtable->Buffer); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + Count = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + DrtmRl->ResourceCount = Count; + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + + /* Compile DPS */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/ + + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileEinj * * PARAMETERS: List - Current field list pointer @@ -946,6 +1088,18 @@ DtCompileFadt ( DtInsertSubtable (ParentTable, Subtable); } + + if (Revision >= 6) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt6, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + } } return (AE_OK); @@ -1285,6 +1439,309 @@ DtCompileHest ( /****************************************************************************** * + * FUNCTION: DtCompileIort + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile IORT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileIort ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_TABLE_IORT *Iort; + ACPI_IORT_NODE *IortNode; + ACPI_IORT_ITS_GROUP *IortItsGroup; + ACPI_IORT_SMMU *IortSmmu; + UINT32 NodeNumber; + UINT32 NodeLength; + UINT32 IdMappingNumber; + UINT32 ItsNumber; + UINT32 ContextIrptNumber; + UINT32 PmuIrptNumber; + UINT32 PaddingLength; + + + ParentTable = DtPeekSubtable (); + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + 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. + */ + Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT, + Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); + + /* + * OptionalPadding - Variable-length data + * (Optional, size = OffsetToNodes - sizeof (ACPI_TABLE_IORT)) + * Optionally allows the generic data types to be used for filling + * this field. + */ + Iort->NodeOffset = sizeof (ACPI_TABLE_IORT); + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + Iort->NodeOffset += Subtable->Length; + } + else + { + Status = DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList), + AcpiDmTableInfoIortHdr[0].Name, &PaddingLength); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + Iort->NodeOffset += PaddingLength; + } + + NodeNumber = 0; + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + IortNode = ACPI_CAST_PTR (ACPI_IORT_NODE, Subtable->Buffer); + NodeLength = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + + switch (IortNode->Type) + { + case ACPI_IORT_NODE_ITS_GROUP: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + IortItsGroup = ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP, Subtable->Buffer); + NodeLength += Subtable->Length; + + ItsNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + ItsNumber++; + } + + IortItsGroup->ItsCount = ItsNumber; + break; + + case ACPI_IORT_NODE_NAMED_COMPONENT: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + + /* + * Padding - Variable-length data + * Optionally allows the offset of the ID mappings to be used + * for filling this field. + */ + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + } + else + { + if (NodeLength > IortNode->MappingOffset) + { + return (AE_BAD_DATA); + } + if (NodeLength < IortNode->MappingOffset) + { + Status = DtCompilePadding ( + IortNode->MappingOffset - NodeLength, + &Subtable); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength = IortNode->MappingOffset; + } + } + break; + + case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + break; + + case ACPI_IORT_NODE_SMMU: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + IortSmmu = ACPI_CAST_PTR (ACPI_IORT_SMMU, Subtable->Buffer); + NodeLength += Subtable->Length; + + /* Compile global interrupt array */ + + IortSmmu->GlobalInterruptOffset = NodeLength; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + + /* Compile context interrupt array */ + + ContextIrptNumber = 0; + IortSmmu->ContextInterruptOffset = NodeLength; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + ContextIrptNumber++; + } + IortSmmu->ContextInterruptCount = ContextIrptNumber; + + /* Compile PMU interrupt array */ + + PmuIrptNumber = 0; + IortSmmu->PmuInterruptOffset = NodeLength; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + PmuIrptNumber++; + } + IortSmmu->PmuInterruptCount = PmuIrptNumber; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT"); + return (AE_ERROR); + } + + /* Compile Array of ID mappings */ + + IortNode->MappingOffset = NodeLength; + IdMappingNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortMap, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += sizeof (ACPI_IORT_ID_MAPPING); + IdMappingNumber++; + } + IortNode->MappingCount = IdMappingNumber; + + /* + * Node length can be determined by DT_LENGTH option + * IortNode->Length = NodeLength; + */ + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + NodeNumber++; + } + Iort->NodeCount = NodeNumber; + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileIvrs * * PARAMETERS: List - Current field list pointer @@ -1487,11 +1944,6 @@ DtCompileLpit ( InfoTable = AcpiDmTableInfoLpit0; break; - case ACPI_LPIT_TYPE_SIMPLE_IO: - - InfoTable = AcpiDmTableInfoLpit1; - break; - default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT"); @@ -1643,6 +2095,11 @@ DtCompileMadt ( InfoTable = AcpiDmTableInfoMadt14; break; + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: + + InfoTable = AcpiDmTableInfoMadt15; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT"); @@ -1878,6 +2335,201 @@ DtCompileMtmr ( /****************************************************************************** * + * FUNCTION: DtCompileNfit + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile NFIT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileNfit ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_NFIT_HEADER *NfitHeader; + ACPI_DMTABLE_INFO *InfoTable; + UINT32 Count; + ACPI_NFIT_INTERLEAVE *Interleave = NULL; + ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + /* Subtables */ + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer); + + switch (NfitHeader->Type) + { + case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: + + InfoTable = AcpiDmTableInfoNfit0; + break; + + case ACPI_NFIT_TYPE_MEMORY_MAP: + + InfoTable = AcpiDmTableInfoNfit1; + break; + + case ACPI_NFIT_TYPE_INTERLEAVE: + + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer); + InfoTable = AcpiDmTableInfoNfit2; + break; + + case ACPI_NFIT_TYPE_SMBIOS: + + InfoTable = AcpiDmTableInfoNfit3; + break; + + case ACPI_NFIT_TYPE_CONTROL_REGION: + + InfoTable = AcpiDmTableInfoNfit4; + break; + + case ACPI_NFIT_TYPE_DATA_REGION: + + InfoTable = AcpiDmTableInfoNfit5; + break; + + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer); + InfoTable = AcpiDmTableInfoNfit6; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + + switch (NfitHeader->Type) + { + case ACPI_NFIT_TYPE_INTERLEAVE: + + Count = 0; + DtPushSubtable (Subtable); + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a, + &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + DtPopSubtable (); + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + Interleave->LineCount = Count; + DtPopSubtable (); + break; + + case ACPI_NFIT_TYPE_SMBIOS: + + if (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + } + } + break; + + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + + Count = 0; + DtPushSubtable (Subtable); + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a, + &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + DtPopSubtable (); + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + Hint->HintCount = (UINT16) Count; + DtPopSubtable (); + break; + + default: + break; + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompilePcct * * PARAMETERS: List - Current field list pointer @@ -1901,6 +2553,8 @@ DtCompilePcct ( ACPI_DMTABLE_INFO *InfoTable; + /* Main table */ + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct, &Subtable, TRUE); if (ACPI_FAILURE (Status)) @@ -1911,6 +2565,8 @@ DtCompilePcct ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); + /* Subtables */ + while (*PFieldList) { SubtableStart = *PFieldList; @@ -2413,6 +3069,59 @@ DtCompileSrat ( /****************************************************************************** * + * FUNCTION: DtCompileStao + * + * PARAMETERS: PFieldList - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile STAO. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileStao ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_STATUS Status; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Compile each ASCII namestring as a subtable */ + + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtGetGenericTableInfo * * PARAMETERS: Name - Generic type name @@ -2503,7 +3212,7 @@ DtCompileUefi ( * operators may be used. */ - DtCompileGeneric ((void **) PFieldList); + DtCompileGeneric ((void **) PFieldList, NULL, NULL); return (AE_OK); } @@ -2561,6 +3270,63 @@ DtCompileWdat ( /****************************************************************************** * + * FUNCTION: DtCompileWpbt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile WPBT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileWpbt ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_TABLE_WPBT *Table; + ACPI_STATUS Status; + UINT16 Length; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Compile the argument list subtable */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Extract the length of the Arguments buffer, insert into main table */ + + Length = (UINT16) Subtable->TotalLength; + Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer); + Table->ArgumentsLength = Length; + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileXsdt * * PARAMETERS: List - Current field list pointer @@ -2580,6 +3346,7 @@ DtCompileXsdt ( DT_FIELD *FieldList = *(DT_FIELD **) List; UINT64 Address; + ParentTable = DtPeekSubtable (); while (FieldList) @@ -2600,6 +3367,8 @@ DtCompileXsdt ( * FUNCTION: DtCompileGeneric * * PARAMETERS: List - Current field list pointer + * Name - Field name to end generic compiling + * Length - Compiled table length to return * * RETURN: Status * @@ -2609,7 +3378,9 @@ DtCompileXsdt ( ACPI_STATUS DtCompileGeneric ( - void **List) + void **List, + char *Name, + UINT32 *Length) { ACPI_STATUS Status; DT_SUBTABLE *Subtable; @@ -2632,8 +3403,16 @@ DtCompileGeneric ( /* Now we can actually compile the parse tree */ + if (*Length) + { + *Length = 0; + } while (*PFieldList) { + if (Name && !ACPI_STRCMP ((*PFieldList)->Name, Name)) + { + break; + } Info = DtGetGenericTableInfo ((*PFieldList)->Name); if (!Info) { @@ -2651,6 +3430,10 @@ DtCompileGeneric ( if (ACPI_SUCCESS (Status)) { DtInsertSubtable (ParentTable, Subtable); + if (Length) + { + *Length += Subtable->Length; + } } else { diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.c b/sys/contrib/dev/acpica/compiler/dttemplate.c index 3fcf0814c18c..90b6b17286be 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.c +++ b/sys/contrib/dev/acpica/compiler/dttemplate.c @@ -59,7 +59,7 @@ AcpiUtIsSpecialTable ( static ACPI_STATUS DtCreateOneTemplate ( char *Signature, - ACPI_DMTABLE_DATA *TableData); + const ACPI_DMTABLE_DATA *TableData); static ACPI_STATUS DtCreateAllTemplates ( @@ -112,7 +112,7 @@ ACPI_STATUS DtCreateTemplates ( char *Signature) { - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *TableData; ACPI_STATUS Status; @@ -213,7 +213,7 @@ static ACPI_STATUS DtCreateAllTemplates ( void) { - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *TableData; ACPI_STATUS Status; @@ -292,7 +292,7 @@ DtCreateAllTemplates ( static ACPI_STATUS DtCreateOneTemplate ( char *Signature, - ACPI_DMTABLE_DATA *TableData) + const ACPI_DMTABLE_DATA *TableData) { char *DisasmFilename; FILE *File; diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h index 39be761764ec..1b27b4e7f01e 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.h +++ b/sys/contrib/dev/acpica/compiler/dttemplate.h @@ -234,6 +234,29 @@ const unsigned char TemplateDmar[] = 0x00,0x00,0x00,0x00 /* 00000088 "...." */ }; +const unsigned char TemplateDrtm[] = +{ + 0x44,0x52,0x54,0x4D,0x94,0x00,0x00,0x00, /* 00000000 "DRTM...." */ + 0x01,0xB9,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" */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x00,0x00,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 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ + 0x00,0x00,0x00,0x00 /* 00000090 "...." */ +}; + const unsigned char TemplateEcdt[] = { 0x45,0x43,0x44,0x54,0x42,0x00,0x00,0x00, /* 00000000 "ECDTB..." */ @@ -379,11 +402,11 @@ const unsigned char TemplateFacs[] = const unsigned char TemplateFadt[] = { - 0x46,0x41,0x43,0x50,0x0C,0x01,0x00,0x00, /* 00000000 "FACP...." */ - 0x05,0x64,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".dINTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x46,0x41,0x43,0x50,0x14,0x01,0x00,0x00, /* 00000000 "FACP...." */ + 0x06,0x8A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x10,0x04,0x15,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ @@ -412,7 +435,8 @@ const unsigned char TemplateFadt[] = 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 000000F0 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ 0x01,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000100 "........" */ - 0x00,0x00,0x00,0x00 /* 00000108 "...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ + 0x00,0x00,0x00,0x00 /* 00000110 "...." */ }; const unsigned char TemplateFpdt[] = @@ -538,6 +562,44 @@ const unsigned char TemplateHpet[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000030 "........" */ }; +const unsigned char TemplateIort[] = +{ + 0x49,0x4F,0x52,0x54,0x0C,0x01,0x00,0x00, /* 00000000 "IORT...." */ + 0x00,0xBC,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 "... ...." */ + 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 "........" */ + 0x18,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 ".0......" */ + 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, /* 00000068 "....0..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x5C,0x5F,0x53, /* 00000078 ".....\_S" */ + 0x42,0x2E,0x50,0x43,0x49,0x30,0x2E,0x44, /* 00000080 "B.PCI0.D" */ + 0x45,0x56,0x30,0x00,0x00,0x00,0x00,0x00, /* 00000088 "EV0....." */ + 0x02,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 ". ......" */ + 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00, /* 00000098 ".... ..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */ + 0x03,0x5C,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 ".\......" */ + 0x00,0x00,0x00,0x00,0x5C,0x00,0x00,0x00, /* 000000B8 "....\..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */ + 0x3C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000D8 "<......." */ + 0x4C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000E0 "L......." */ + 0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "T......." */ + 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 "...." */ +}; + const unsigned char TemplateIvrs[] = { 0x49,0x56,0x52,0x53,0xBC,0x00,0x00,0x00, /* 00000000 "IVRS...." */ @@ -568,73 +630,75 @@ const unsigned char TemplateIvrs[] = const unsigned char TemplateLpit[] = { - 0x4C,0x50,0x49,0x54,0xB4,0x00,0x00,0x00, /* 00000000 "LPIT...." */ - 0x01,0x20,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ". INTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x4C,0x50,0x49,0x54,0x94,0x00,0x00,0x00, /* 00000000 "LPIT...." */ + 0x00,0xD8,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" */ - 0x25,0x03,0x14,0x20,0x00,0x00,0x00,0x00, /* 00000020 "%.. ...." */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "8......." */ - 0x00,0x00,0x00,0x00,0x7F,0x01,0x02,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ - 0x00,0x20,0x00,0x03,0x00,0x00,0x00,0x00, /* 00000048 ". ......" */ + 0x7F,0x40,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 ".@......" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ - 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000058 "........" */ - 0x58,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000060 "X......." */ - 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 00000068 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "8......." */ + 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000068 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ - 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 00000088 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ - 0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */ - 0x00,0x00,0x00,0x00 /* 000000B0 "...." */ + 0x7F,0x40,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 ".@......" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ + 0x00,0x00,0x00,0x00 /* 00000090 "...." */ }; -/* MADT with ACPI 5.1 subtables */ +/* MADT with ACPI 6.0 subtables */ const unsigned char TemplateMadt[] = { - 0x41,0x50,0x49,0x43,0x2a,0x01,0x00,0x00, /* 00000000 "APIC*..." */ - 0x04,0x34,0x49,0x4e,0x54,0x45,0x4c,0x20, /* 00000008 ".4INTEL " */ - 0x54,0x45,0x4d,0x50,0x4c,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ - 0x01,0x00,0x00,0x00,0x49,0x4e,0x54,0x4c, /* 00000018 "....INTL" */ - 0x24,0x04,0x14,0x20,0x00,0x00,0x00,0x00, /* 00000020 "$.. ...." */ + 0x41,0x50,0x49,0x43,0x5A,0x01,0x00,0x00, /* 00000000 "APICZ..." */ + 0x03,0xEA,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" */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x01,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000028 "........" */ - 0x01,0x00,0x00,0x00,0x01,0x0c,0x01,0x00, /* 00000030 "........" */ + 0x01,0x00,0x00,0x00,0x01,0x0C,0x01,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ - 0x02,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ - 0x00,0x00,0x03,0x08,0x0d,0x00,0x01,0x00, /* 00000048 "........" */ + 0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x03,0x08,0x0D,0x00,0x01,0x00, /* 00000048 "........" */ 0x00,0x00,0x04,0x06,0x00,0x05,0x00,0x01, /* 00000050 "........" */ - 0x05,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x05,0x0C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ 0x00,0x00,0x00,0x00,0x06,0x10,0x00,0x00, /* 00000060 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ 0x00,0x00,0x00,0x00,0x07,0x16,0x00,0x00, /* 00000070 "........" */ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000078 "........" */ - 0x00,0x00,0x00,0x00,0x5c,0x43,0x50,0x55, /* 00000080 "....\CPU" */ + 0x00,0x00,0x00,0x00,0x5C,0x43,0x50,0x55, /* 00000080 "....\CPU" */ 0x30,0x00,0x08,0x10,0x05,0x00,0x00,0x00, /* 00000088 "0......." */ 0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00, /* 00000090 "........" */ 0x00,0x00,0x09,0x10,0x00,0x00,0x00,0x00, /* 00000098 "........" */ - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000a0 "........" */ - 0x00,0x00,0x0a,0x0c,0x05,0x00,0x00,0x00, /* 000000a8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x4c, /* 000000b0 ".......L" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000b8 "........" */ - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000c0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000c8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000d0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000d8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000e0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000e8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000f0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000f8 "........" */ - 0x00,0x00,0x0e,0x10,0x00,0x00,0x00,0x00, /* 00000100 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ + 0x00,0x00,0x0A,0x0C,0x05,0x00,0x00,0x00, /* 000000A8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x50, /* 000000B0 ".......P" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18, /* 00000100 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ - 0x00,0x00,0x0c,0x18,0x00,0x00,0x00,0x00, /* 00000110 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x0D,0x18, /* 00000118 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */ - 0x00,0x00 /* 00000128 ".. " */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00, /* 00000128 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x10, /* 00000130 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x14, /* 00000140 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000150 "........" */ + 0x00,0x00 /* 00000158 ".." */ }; const unsigned char TemplateMcfg[] = @@ -728,6 +792,56 @@ const unsigned char TemplateMsct[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000088 "........" */ }; +const unsigned char TemplateNfit[] = +{ + 0x4E,0x46,0x49,0x54,0x70,0x01,0x00,0x00, /* 00000000 "NFITp..." */ + 0x01,0x53,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".SINTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x38,0x00,0x01,0x00,0x00,0x00, /* 00000028 "..8....." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x30,0x05,0xAF,0x91,0x86,0x5D,0x0E,0x47, /* 00000038 "0....].G" */ + 0xA6,0xB0,0x0A,0x2D,0xB9,0x40,0x82,0x49, /* 00000040 "...-.@.I" */ + 0x00,0x00,0x00,0x7C,0x03,0x00,0x00,0x00, /* 00000048 "...|...." */ + 0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x00,0x30,0x00,0x01,0x00,0x00,0x00, /* 00000060 "..0....." */ + 0x04,0x00,0x00,0x00,0x01,0x00,0x01,0x00, /* 00000068 "........" */ + 0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00, /* 00000070 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ + 0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x01,0x00,0x03,0x00,0x2A,0x00,0x00,0x00, /* 00000088 "....*..." */ + 0x02,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000090 ".. ....." */ + 0x04,0x00,0x00,0x00,0x00,0x01,0x00,0x00, /* 00000098 "........" */ + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 000000A0 "........" */ + 0x06,0x00,0x00,0x00,0x09,0x00,0x00,0x00, /* 000000A8 "........" */ + 0x03,0x00,0x28,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "..(....." */ + 0xB4,0x13,0x5D,0x40,0x91,0x0B,0x29,0x93, /* 000000B8 "..]@..)." */ + 0x67,0xE8,0x23,0x4C,0x00,0x00,0x00,0x88, /* 000000C0 "g.#L...." */ + 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77, /* 000000C8 ".."3DUfw" */ + 0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, /* 000000D0 "........" */ + 0x04,0x00,0x50,0x00,0x01,0x00,0x86,0x80, /* 000000D8 "..P....." */ + 0x17,0x20,0x01,0x00,0x86,0x80,0x17,0x20, /* 000000E0 ". ..... " */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ + 0x89,0x00,0x54,0x76,0x01,0x03,0x00,0x01, /* 000000F0 "..Tv...." */ + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 ". ......" */ + 0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */ + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ + 0x00,0x10,0x80,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ + 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */ + 0x05,0x00,0x28,0x00,0x01,0x00,0x00,0x01, /* 00000128 "..(....." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */ + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 ". ......" */ + 0x00,0x00,0x00,0xE0,0x0F,0x00,0x00,0x00, /* 00000140 "........" */ + 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00, /* 00000148 "........" */ + 0x06,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000150 ".. ....." */ + 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */ + 0x00,0x00,0x00,0x18,0x04,0x00,0x00,0x00, /* 00000160 "........" */ + 0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00 /* 00000168 "........" */ +}; + const unsigned char TemplateMtmr[] = { 0x4D,0x54,0x4D,0x52,0x4C,0x00,0x00,0x00, /* 00000000 "MTMRL..." */ @@ -999,6 +1113,26 @@ const unsigned char TemplateSrat[] = 0x00,0x00 /* 00000090 ".." */ }; +const unsigned char TemplateStao[] = +{ + 0x53,0x54,0x41,0x4F,0x7E,0x00,0x00,0x00, /* 00000000 "STAO~..." */ + 0x01,0x7F,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,0x01,0x5C,0x5F,0x53, /* 00000020 "... .\_S" */ + 0x42,0x30,0x2E,0x42,0x55,0x53,0x30,0x2E, /* 00000028 "B0.BUS0." */ + 0x44,0x45,0x56,0x31,0x00,0x5C,0x5F,0x53, /* 00000030 "DEV1.\_S" */ + 0x42,0x30,0x2E,0x42,0x55,0x53,0x30,0x2E, /* 00000038 "B0.BUS0." */ + 0x44,0x45,0x56,0x32,0x00,0x5C,0x5F,0x53, /* 00000040 "DEV2.\_S" */ + 0x42,0x30,0x2E,0x42,0x55,0x53,0x31,0x2E, /* 00000048 "B0.BUS1." */ + 0x44,0x45,0x56,0x31,0x2E,0x44,0x45,0x56, /* 00000050 "DEV1.DEV" */ + 0x32,0x00,0x5C,0x5F,0x53,0x42,0x30,0x2E, /* 00000058 "2.\_SB0." */ + 0x42,0x55,0x53,0x31,0x2E,0x44,0x45,0x56, /* 00000060 "BUS1.DEV" */ + 0x32,0x2E,0x44,0x45,0x56,0x32,0x00,0x5C, /* 00000068 "2.DEV2.\" */ + 0x55,0x53,0x42,0x31,0x2E,0x48,0x55,0x42, /* 00000070 "USB1.HUB" */ + 0x31,0x2E,0x50,0x54,0x31,0x00 /* 00000078 "1.PT1." */ +}; + const unsigned char TemplateTcpa[] = { 0x54,0x43,0x50,0x41,0x32,0x00,0x00,0x00, /* 00000000 "TCPA2..." */ @@ -1095,6 +1229,41 @@ const unsigned char TemplateWdrt[] = 0x00,0x00,0x00,0x00,0xFF,0xFF,0x00 /* 00000040 "......." */ }; +const unsigned char TemplateWpbt[] = +{ + 0x57,0x50,0x42,0x54,0x98,0x00,0x00,0x00, /* 00000000 "WPBT...." */ + 0x01,0x83,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" */ + 0x10,0x04,0x15,0x20,0x78,0x56,0x34,0x12, /* 00000020 "... xV4." */ + 0x00,0x00,0x00,0xBB,0x00,0x00,0x00,0xAA, /* 00000028 "........" */ + 0x33,0x88,0x64,0x00,0x34,0x00,0x20,0x00, /* 00000030 "3.d.4. ." */ + 0x73,0x00,0x63,0x00,0x6F,0x00,0x72,0x00, /* 00000038 "s.c.o.r." */ + 0x65,0x00,0x20,0x00,0x61,0x00,0x6E,0x00, /* 00000040 "e. .a.n." */ + 0x64,0x00,0x20,0x00,0x37,0x00,0x20,0x00, /* 00000048 "d. .7. ." */ + 0x79,0x00,0x65,0x00,0x61,0x00,0x72,0x00, /* 00000050 "y.e.a.r." */ + 0x73,0x00,0x20,0x00,0x61,0x00,0x67,0x00, /* 00000058 "s. .a.g." */ + 0x6F,0x00,0x20,0x00,0x6F,0x00,0x75,0x00, /* 00000060 "o. .o.u." */ + 0x72,0x00,0x20,0x00,0x66,0x00,0x61,0x00, /* 00000068 "r. .f.a." */ + 0x74,0x00,0x68,0x00,0x65,0x00,0x72,0x00, /* 00000070 "t.h.e.r." */ + 0x73,0x00,0x20,0x00,0x62,0x00,0x72,0x00, /* 00000078 "s. .b.r." */ + 0x6F,0x00,0x75,0x00,0x67,0x00,0x68,0x00, /* 00000080 "o.u.g.h." */ + 0x74,0x00,0x20,0x00,0x66,0x00,0x6F,0x00, /* 00000088 "t. .f.o." */ + 0x72,0x00,0x74,0x00,0x68,0x00,0x00,0x00 /* 00000090 "r.t.h..." */ +}; + +const unsigned char TemplateXenv[] = +{ + 0x58,0x45,0x4E,0x56,0x39,0x00,0x00,0x00, /* 00000000 "XENV9..." */ + 0x01,0x3A,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" */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x10, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x0A,0x00,0x20,0x00,0x00, /* 00000028 "..... .." */ + 0x00,0x00,0x00,0x0B,0x25,0x00,0xBB,0xAA, /* 00000030 "....%..." */ + 0x03 /* 00000038 "." */ +}; + const unsigned char TemplateXsdt[] = { 0x58,0x53,0x44,0x54,0x64,0x00,0x00,0x00, /* 00000000 "XSDTd..." */ diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index 7d3c2c83d479..2d5b762af4a7 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/compiler/dtutils.c @@ -376,6 +376,7 @@ DtGetFieldType ( case ACPI_DMT_GAS: case ACPI_DMT_HESTNTFY: + case ACPI_DMT_IORTMEM: Type = DT_FIELD_TYPE_INLINE_SUBTABLE; break; @@ -520,6 +521,7 @@ DtGetFieldLength ( case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: case ACPI_DMT_HEST: + case ACPI_DMT_NFIT: case ACPI_DMT_PCI_PATH: ByteLength = 2; @@ -587,6 +589,11 @@ DtGetFieldLength ( ByteLength = sizeof (ACPI_HEST_NOTIFY); break; + case ACPI_DMT_IORTMEM: + + ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); + break; + case ACPI_DMT_BUFFER: case ACPI_DMT_RAW_BUFFER: diff --git a/sys/contrib/dev/acpica/compiler/preprocess.h b/sys/contrib/dev/acpica/compiler/preprocess.h index d064287733cc..9dc2bdbb0e77 100644 --- a/sys/contrib/dev/acpica/compiler/preprocess.h +++ b/sys/contrib/dev/acpica/compiler/preprocess.h @@ -267,14 +267,18 @@ PrReplaceData ( char *BufferToAdd, UINT32 LengthToAdd); -void +FILE * PrOpenIncludeFile ( - char *Filename); + char *Filename, + char *OpenMode, + char **FullPathname); FILE * PrOpenIncludeWithPrefix ( char *PrefixDir, - char *Filename); + char *Filename, + char *OpenMode, + char **FullPathname); void PrPushInputFileStack ( diff --git a/sys/contrib/dev/acpica/compiler/prscan.c b/sys/contrib/dev/acpica/compiler/prscan.c index 12e9b8e61d37..12d303c8b98e 100644 --- a/sys/contrib/dev/acpica/compiler/prscan.c +++ b/sys/contrib/dev/acpica/compiler/prscan.c @@ -85,28 +85,42 @@ PrDbgPrint ( char *Action, char *DirectiveName); +static void +PrDoIncludeBuffer ( + char *Pathname, + char *BufferName); + +static void +PrDoIncludeFile ( + char *Pathname); + /* * Supported preprocessor directives + * Each entry is of the form "Name, ArgumentCount" */ static const PR_DIRECTIVE_INFO Gbl_DirectiveInfo[] = { - {"define", 1}, - {"elif", 0}, /* Converted to #else..#if internally */ - {"else", 0}, - {"endif", 0}, - {"error", 1}, - {"if", 1}, - {"ifdef", 1}, - {"ifndef", 1}, - {"include", 0}, /* Argument is not standard format, so 0 */ - {"line", 1}, - {"pragma", 1}, - {"undef", 1}, - {"warning", 1}, - {NULL, 0} + {"define", 1}, + {"elif", 0}, /* Converted to #else..#if internally */ + {"else", 0}, + {"endif", 0}, + {"error", 1}, + {"if", 1}, + {"ifdef", 1}, + {"ifndef", 1}, + {"include", 0}, /* Argument is not standard format, so just use 0 here */ + {"includebuffer", 0}, /* Argument is not standard format, so just use 0 here */ + {"line", 1}, + {"loadbuffer", 0}, + {"pragma", 1}, + {"undef", 1}, + {"warning", 1}, + {NULL, 0} }; +/* This table must match ordering of above table exactly */ + enum Gbl_DirectiveIndexes { PR_DIRECTIVE_DEFINE = 0, @@ -118,6 +132,7 @@ enum Gbl_DirectiveIndexes PR_DIRECTIVE_IFDEF, PR_DIRECTIVE_IFNDEF, PR_DIRECTIVE_INCLUDE, + PR_DIRECTIVE_INCLUDEBUFFER, PR_DIRECTIVE_LINE, PR_DIRECTIVE_PRAGMA, PR_DIRECTIVE_UNDEF, @@ -382,13 +397,6 @@ PrPreprocessInputFile ( Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, &Next); } -#if 0 -/* Line prefix */ - FlPrintFile (ASL_FILE_PREPROCESSOR, "/* %14s %.5u i:%.5u */ ", - Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_CurrentLineNumber, Gbl_PreprocessorLineNumber); -#endif - /* * Emit a #line directive if necessary, to keep the line numbers in * the (.i) file synchronized with the original source code file, so @@ -433,7 +441,7 @@ PrDoDirective ( char **Next) { char *Token = Gbl_MainTokenBuffer; - char *Token2; + char *Token2 = NULL; char *End; UINT64 Value; ACPI_SIZE TokenOffset; @@ -452,7 +460,7 @@ PrDoDirective ( PrError (ASL_ERROR, ASL_MSG_UNKNOWN_DIRECTIVE, THIS_TOKEN_OFFSET (DirectiveToken)); - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "#%s: Unknown directive\n", Gbl_CurrentLineNumber, DirectiveToken); return; @@ -539,7 +547,7 @@ PrDoDirective ( /* Most directives have at least one argument */ - if (Gbl_DirectiveInfo[Directive].ArgCount == 1) + if (Gbl_DirectiveInfo[Directive].ArgCount >= 1) { Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); if (!Token) @@ -548,6 +556,15 @@ PrDoDirective ( } } + if (Gbl_DirectiveInfo[Directive].ArgCount >= 2) + { + Token2 = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); + if (!Token2) + { + goto SyntaxError; + } + } + /* * At this point, if we are ignoring the current code block, * do not process any more directives (i.e., ignore them also.) @@ -599,7 +616,7 @@ PrDoDirective ( Gbl_IgnoringThisCodeBlock = TRUE; } - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Resolved #if: %8.8X%8.8X %s\n", Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), Gbl_IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>"); @@ -672,7 +689,7 @@ PrDoDirective ( Token2 = ""; } #endif - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "New #define: %s->%s\n", Gbl_CurrentLineNumber, Token, Token2); @@ -700,11 +717,32 @@ PrDoDirective ( goto SyntaxError; } - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Start #include file \"%s\"\n", Gbl_CurrentLineNumber, Token, Gbl_CurrentLineNumber); - PrOpenIncludeFile (Token); + PrDoIncludeFile (Token); + break; + + case PR_DIRECTIVE_INCLUDEBUFFER: + + Token = PrGetNextToken (NULL, " \"<>", Next); + if (!Token) + { + goto SyntaxError; + } + + Token2 = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); + if (!Token2) + { + goto SyntaxError; + } + + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID + "Start #includebuffer input from file \"%s\", buffer name %s\n", + Gbl_CurrentLineNumber, Token, Token2); + + PrDoIncludeBuffer (Token, Token2); break; case PR_DIRECTIVE_LINE: @@ -718,7 +756,7 @@ PrDoDirective ( return; } - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "User #line invocation %s\n", Gbl_CurrentLineNumber, Token); @@ -768,7 +806,7 @@ PrDoDirective ( case PR_DIRECTIVE_UNDEF: - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "#undef: %s\n", Gbl_CurrentLineNumber, Token); PrRemoveDefine (Token); @@ -783,7 +821,7 @@ PrDoDirective ( default: /* Should never get here */ - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Unrecognized directive: %u\n", Gbl_CurrentLineNumber, Directive); break; @@ -954,9 +992,92 @@ PrDbgPrint ( { DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] " - "%*s %s #%s, Depth %u\n", + "%*s %s #%s, IfDepth %u\n", Gbl_CurrentLineNumber, Gbl_IfDepth, Gbl_IgnoringThisCodeBlock ? "I" : "E", Gbl_IfDepth * 4, " ", Action, DirectiveName, Gbl_IfDepth); } + + +/******************************************************************************* + * + * FUNCTION: PrDoIncludeFile + * + * PARAMETERS: Pathname - Name of the input file + * + * RETURN: None. + * + * DESCRIPTION: Open an include file, from #include. + * + ******************************************************************************/ + +static void +PrDoIncludeFile ( + char *Pathname) +{ + char *FullPathname; + + + (void) PrOpenIncludeFile (Pathname, "r", &FullPathname); +} + + +/******************************************************************************* + * + * FUNCTION: PrDoIncludeBuffer + * + * PARAMETERS: Pathname - Name of the input binary file + * BufferName - ACPI namepath of the buffer + * + * RETURN: None. + * + * DESCRIPTION: Create an ACPI buffer object from a binary file. The contents + * of the file are emitted into the buffer object as ascii + * hex data. From #includebuffer. + * + ******************************************************************************/ + +static void +PrDoIncludeBuffer ( + char *Pathname, + char *BufferName) +{ + char *FullPathname; + FILE *BinaryBufferFile; + UINT32 i = 0; + UINT8 c; + + + BinaryBufferFile = PrOpenIncludeFile (Pathname, "rb", &FullPathname); + if (!BinaryBufferFile) + { + return; + } + + /* Emit "Name (XXXX, Buffer() {" header */ + + FlPrintFile (ASL_FILE_PREPROCESSOR, "Name (%s, Buffer()\n{", BufferName); + + /* Dump the entire file in ascii hex format */ + + while (fread (&c, 1, 1, BinaryBufferFile)) + { + if (!(i % 8)) + { + FlPrintFile (ASL_FILE_PREPROCESSOR, "\n ", c); + } + + FlPrintFile (ASL_FILE_PREPROCESSOR, " 0x%2.2X,", c); + i++; + } + + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID + "#includebuffer: read %u bytes from %s\n", + Gbl_CurrentLineNumber, i, FullPathname); + + /* Close the Name() operator */ + + FlPrintFile (ASL_FILE_PREPROCESSOR, "\n})\n", BufferName); + fclose (BinaryBufferFile); +} diff --git a/sys/contrib/dev/acpica/compiler/prutils.c b/sys/contrib/dev/acpica/compiler/prutils.c index e36ea1d86824..7e880b1630c6 100644 --- a/sys/contrib/dev/acpica/compiler/prutils.c +++ b/sys/contrib/dev/acpica/compiler/prutils.c @@ -238,9 +238,11 @@ PrReplaceData ( * ******************************************************************************/ -void +FILE * PrOpenIncludeFile ( - char *Filename) + char *Filename, + char *OpenMode, + char **FullPathname) { FILE *IncludeFile; ASL_INCLUDE_DIR *NextDir; @@ -257,12 +259,13 @@ PrOpenIncludeFile ( (Filename[0] == '\\') || (Filename[1] == ':')) { - IncludeFile = PrOpenIncludeWithPrefix ("", Filename); + IncludeFile = PrOpenIncludeWithPrefix ( + "", Filename, OpenMode, FullPathname); if (!IncludeFile) { goto ErrorExit; } - return; + return (IncludeFile); } /* @@ -273,10 +276,11 @@ PrOpenIncludeFile ( * * Construct the file pathname from the global directory name. */ - IncludeFile = PrOpenIncludeWithPrefix (Gbl_DirectoryPath, Filename); + IncludeFile = PrOpenIncludeWithPrefix ( + Gbl_DirectoryPath, Filename, OpenMode, FullPathname); if (IncludeFile) { - return; + return (IncludeFile); } /* @@ -286,10 +290,11 @@ PrOpenIncludeFile ( NextDir = Gbl_IncludeDirList; while (NextDir) { - IncludeFile = PrOpenIncludeWithPrefix (NextDir->Dir, Filename); + IncludeFile = PrOpenIncludeWithPrefix ( + NextDir->Dir, Filename, OpenMode, FullPathname); if (IncludeFile) { - return; + return (IncludeFile); } NextDir = NextDir->Next; @@ -300,6 +305,7 @@ PrOpenIncludeFile ( ErrorExit: sprintf (Gbl_MainTokenBuffer, "%s, %s", Filename, strerror (errno)); PrError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, 0); + return (NULL); } @@ -320,7 +326,9 @@ ErrorExit: FILE * PrOpenIncludeWithPrefix ( char *PrefixDir, - char *Filename) + char *Filename, + char *OpenMode, + char **FullPathname) { FILE *IncludeFile; char *Pathname; @@ -336,7 +344,7 @@ PrOpenIncludeWithPrefix ( /* Attempt to open the file, push if successful */ - IncludeFile = fopen (Pathname, "r"); + IncludeFile = fopen (Pathname, OpenMode); if (!IncludeFile) { fprintf (stderr, "Could not open include file %s\n", Pathname); @@ -346,6 +354,7 @@ PrOpenIncludeWithPrefix ( /* Push the include file on the open input file stack */ PrPushInputFileStack (IncludeFile, Pathname); + *FullPathname = Pathname; return (IncludeFile); } |