Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/external/bsd/acpica/dist/compiler/dtcompile.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/external/bsd/acpica/dist/compiler/dtcompile.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.4 retrieving revision 1.4.2.3 diff -u -p -r1.4 -r1.4.2.3 --- src/sys/external/bsd/acpica/dist/compiler/dtcompile.c 2014/10/25 21:00:06 1.4 +++ src/sys/external/bsd/acpica/dist/compiler/dtcompile.c 2016/03/19 11:30:22 1.4.2.3 @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DTCOMPILE_C__ #define _DECLARE_DT_GLOBALS #include "aslcompiler.h" @@ -103,13 +102,18 @@ DtDoCompile ( /* Preprocessor */ - Event = UtBeginEvent ("Preprocess input file"); - PrDoPreprocess (); - UtEndEvent (Event); - - if (Gbl_PreprocessOnly) + if (Gbl_PreprocessFlag) { - return (AE_OK); + /* Preprocessor */ + + Event = UtBeginEvent ("Preprocess input file"); + PrDoPreprocess (); + UtEndEvent (Event); + + if (Gbl_PreprocessOnly) + { + return (AE_OK); + } } /* @@ -280,7 +284,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; @@ -299,7 +303,7 @@ DtCompileDataTable ( return (AE_ERROR); } - Gbl_Signature = UtStringCacheCalloc (ACPI_STRLEN (Signature) + 1); + Gbl_Signature = UtStringCacheCalloc (strlen (Signature) + 1); strcpy (Gbl_Signature, Signature); /* @@ -342,7 +346,7 @@ DtCompileDataTable ( DtInsertCompilerIds (*FieldList); Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader, - &Gbl_RootTable, TRUE); + &Gbl_RootTable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -355,7 +359,9 @@ DtCompileDataTable ( TableData = AcpiDmGetTableData (Signature); if (!TableData || Gbl_CompileGeneric) { - DtCompileGeneric ((void **) FieldList); + /* Unknown table signature and/or force generic compile */ + + DtCompileGeneric ((void **) FieldList, NULL, NULL); goto FinishHeader; } @@ -377,7 +383,7 @@ DtCompileDataTable ( Subtable = NULL; Status = DtCompileTable (FieldList, TableData->TableInfo, - &Subtable, TRUE); + &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); @@ -433,14 +439,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) @@ -451,7 +457,7 @@ DtCompileTable ( /* Ignore optional subtable if name does not match */ if ((Info->Flags & DT_OPTIONAL) && - ACPI_STRCMP ((*Field)->Name, Info->Name)) + strcmp ((*Field)->Name, Info->Name)) { *RetSubtable = NULL; return (AE_OK); @@ -476,6 +482,7 @@ DtCompileTable ( Buffer = Subtable->Buffer; LocalField = *Field; + Subtable->Name = LocalField->Name; /* * Main loop walks the info table for this ACPI table or subtable @@ -552,15 +559,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)) @@ -570,7 +594,7 @@ DtCompileTable ( DtSetSubtableLength (InlineSubtable); - ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength); + memcpy (Buffer, InlineSubtable->Buffer, FieldLength); LocalField = *Field; break; @@ -597,7 +621,6 @@ DtCompileTable ( Subtable->LengthField = Buffer; Subtable->SizeOfLengthField = FieldLength; } - break; } @@ -613,3 +636,94 @@ Error: ACPI_FREE (Subtable); return (Status); } + + +/****************************************************************************** + * + * FUNCTION: DtCompileTwoSubtables + * + * PARAMETERS: List - Current field list pointer + * TableInfo1 - Info table 1 + * TableInfo1 - Info table 2 + * + * RETURN: Status + * + * DESCRIPTION: Compile tables with a header and one or more same subtables. + * Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileTwoSubtables ( + void **List, + ACPI_DMTABLE_INFO *TableInfo1, + ACPI_DMTABLE_INFO *TableInfo2) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + + + Status = DtCompileTable (PFieldList, TableInfo1, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, TableInfo2, &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * 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); +}