DT_FIELD * DtScanFile ( FILE *Handle) { ACPI_STATUS Status; UINT32 Offset; DT_FIELD *Next; ACPI_FUNCTION_NAME (DtScanFile); /* Get the file size */ Gbl_InputByteCount = DtGetFileSize (Handle); Gbl_CurrentLineNumber = 0; Gbl_CurrentLineOffset = 0; Gbl_NextLineOffset = 0; /* Scan line-by-line */ while ((Offset = DtGetNextLine (Handle)) != ASL_EOF) { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s", Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer)); Status = DtParseLine (Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber, Offset); if (Status == AE_NOT_FOUND) { break; } } /* Dump the parse tree if debug enabled */ if (Gbl_DebugFlag) { Next = Gbl_FieldList; DbgPrint (ASL_DEBUG_OUTPUT, "Tree: %32s %32s %8s %8s %8s %8s %8s %8s\n\n", "Name", "Value", "Line", "ByteOff", "NameCol", "Column", "TableOff", "Flags"); while (Next) { DbgPrint (ASL_DEBUG_OUTPUT, "Field: %32.32s %32.32s %.8X %.8X %.8X %.8X %.8X %.8X\n", Next->Name, Next->Value, Next->Line, Next->ByteOffset, Next->NameColumn, Next->Column, Next->TableOffset, Next->Flags); Next = Next->Next; } } return (Gbl_FieldList); }
DT_FIELD * DtScanFile ( FILE *Handle) { ACPI_STATUS Status; UINT32 Offset; ACPI_FUNCTION_NAME (DtScanFile); /* Get the file size */ Gbl_InputByteCount = DtGetFileSize (Handle); Gbl_CurrentLineNumber = 0; Gbl_CurrentLineOffset = 0; Gbl_NextLineOffset = 0; /* Scan line-by-line */ while ((Offset = DtGetNextLine (Handle))) { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s", Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer)); Status = DtParseLine (Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber, Offset); if (Status == AE_NOT_FOUND) { break; } } return (Gbl_FieldList); }
void DtOutputBinary ( DT_SUBTABLE *RootTable) { if (!RootTable) { return; } /* Walk the entire parse tree, emitting the binary data */ DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL); Gbl_TableLength = DtGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); }
ACPI_STATUS FlCheckForAcpiTable ( FILE *Handle) { ACPI_TABLE_HEADER Table; UINT32 FileSize; size_t Actual; UINT32 i; /* Read a potential table header */ Actual = fread (&Table, 1, sizeof (ACPI_TABLE_HEADER), Handle); fseek (Handle, 0, SEEK_SET); if (Actual < sizeof (ACPI_TABLE_HEADER)) { return (AE_ERROR); } /* Header length field must match the file size */ FileSize = DtGetFileSize (Handle); if (Table.Length != FileSize) { return (AE_ERROR); } /* * These fields must be ASCII: * Signature, OemId, OemTableId, AslCompilerId. * We allow a NULL terminator in OemId and OemTableId. */ for (i = 0; i < ACPI_NAME_SIZE; i++) { if (!ACPI_IS_ASCII ((UINT8) Table.Signature[i])) { return (AE_ERROR); } if (!ACPI_IS_ASCII ((UINT8) Table.AslCompilerId[i])) { return (AE_ERROR); } } for (i = 0; (i < ACPI_OEM_ID_SIZE) && (Table.OemId[i]); i++) { if (!ACPI_IS_ASCII ((UINT8) Table.OemId[i])) { return (AE_ERROR); } } for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (Table.OemTableId[i]); i++) { if (!ACPI_IS_ASCII ((UINT8) Table.OemTableId[i])) { return (AE_ERROR); } } printf ("Binary file appears to be a valid ACPI table, disassembling\n"); return (AE_OK); }