ACPI_STATUS DtCompileFacs ( DT_FIELD **PFieldList) { DT_SUBTABLE *Subtable; UINT8 *ReservedBuffer; ACPI_STATUS Status; UINT32 ReservedSize; Status = DtCompileTable (PFieldList, AcpiDmTableInfoFacs, &Gbl_RootTable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } /* Large FACS reserved area at the end of the table */ ReservedSize = (UINT32) sizeof (((ACPI_TABLE_FACS *) NULL)->Reserved1); ReservedBuffer = UtLocalCalloc (ReservedSize); DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); ACPI_FREE (ReservedBuffer); DtInsertSubtable (Gbl_RootTable, Subtable); return (AE_OK); }
ACPI_STATUS DtCompileSlit ( void **List) { ACPI_STATUS Status; DT_SUBTABLE *Subtable; DT_SUBTABLE *ParentTable; DT_FIELD **PFieldList = (DT_FIELD **) List; DT_FIELD *FieldList; UINT32 Localities; UINT8 *LocalityBuffer; UINT32 RemainingData; Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit, &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); LocalityBuffer = UtLocalCalloc (Localities); FieldList = *PFieldList; while (FieldList) { /* Handle multiple-line buffer */ RemainingData = Localities; while (RemainingData && FieldList) { RemainingData = DtCompileBuffer ( LocalityBuffer + (Localities - RemainingData), FieldList->Value, FieldList, RemainingData); FieldList = FieldList->Next; } DtCreateSubtable (LocalityBuffer, Localities, &Subtable); DtInsertSubtable (ParentTable, Subtable); } ACPI_FREE (LocalityBuffer); return (AE_OK); }
ACPI_STATUS DtCompileSlit ( void **List) { ACPI_STATUS Status; DT_SUBTABLE *Subtable; DT_SUBTABLE *ParentTable; DT_FIELD **PFieldList = (DT_FIELD **) List; DT_FIELD *FieldList; UINT32 Localities; UINT8 *LocalityBuffer; Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit, &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); LocalityBuffer = UtLocalCalloc (Localities); /* Compile each locality buffer */ FieldList = *PFieldList; while (FieldList) { DtCompileBuffer (LocalityBuffer, FieldList->Value, FieldList, Localities); DtCreateSubtable (LocalityBuffer, Localities, &Subtable); DtInsertSubtable (ParentTable, Subtable); FieldList = FieldList->Next; } ACPI_FREE (LocalityBuffer); return (AE_OK); }
ACPI_STATUS DtCompileXsdt ( void **List) { DT_SUBTABLE *Subtable; DT_SUBTABLE *ParentTable; DT_FIELD *FieldList = *(DT_FIELD **) List; UINT64 Address; ParentTable = DtPeekSubtable (); while (FieldList) { DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO); DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable); DtInsertSubtable (ParentTable, Subtable); FieldList = FieldList->Next; } return (AE_OK); }
ACPI_STATUS DtCompileDmar ( void **List) { ACPI_STATUS Status; DT_SUBTABLE *Subtable; DT_SUBTABLE *ParentTable; DT_FIELD **PFieldList = (DT_FIELD **) List; DT_FIELD *SubtableStart; ACPI_DMTABLE_INFO *InfoTable; ACPI_DMAR_HEADER *DmarHeader; UINT8 *ReservedBuffer; UINT32 ReservedSize; Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); /* DMAR Reserved area */ ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved); ReservedBuffer = UtLocalCalloc (ReservedSize); DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); ACPI_FREE (ReservedBuffer); ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); while (*PFieldList) { /* DMAR Header */ SubtableStart = *PFieldList; Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr, &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); DtPushSubtable (Subtable); DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer); switch (DmarHeader->Type) { case ACPI_DMAR_TYPE_HARDWARE_UNIT: InfoTable = AcpiDmTableInfoDmar0; break; case ACPI_DMAR_TYPE_RESERVED_MEMORY: InfoTable = AcpiDmTableInfoDmar1; break; case ACPI_DMAR_TYPE_ATSR: InfoTable = AcpiDmTableInfoDmar2; break; case ACPI_DMAR_HARDWARE_AFFINITY: InfoTable = AcpiDmTableInfoDmar3; break; default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR"); return (AE_ERROR); } /* DMAR Subtable */ Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); /* Optional Device Scope subtables */ while (*PFieldList) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope, &Subtable, FALSE); if (Status == AE_NOT_FOUND) { break; } ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); DtPushSubtable (Subtable); /* Optional PCI Paths */ while (*PFieldList) { Status = DtCompileTable (PFieldList, TableInfoDmarPciPath, &Subtable, FALSE); if (Status == AE_NOT_FOUND) { DtPopSubtable (); break; } ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); } } DtPopSubtable (); } return (AE_OK); }