void AcpiTbParseFadt ( UINT32 TableIndex) { UINT32 Length; ACPI_TABLE_HEADER *Table; /* * The FADT has multiple versions with different lengths, * and it contains pointers to both the DSDT and FACS tables. * * Get a local copy of the FADT and convert it to a common format * Map entire FADT, assumed to be smaller than one page. */ Length = AcpiGbl_RootTableList.Tables[TableIndex].Length; Table = AcpiOsMapMemory ( AcpiGbl_RootTableList.Tables[TableIndex].Address, Length); if (!Table) { return; } /* * Validate the FADT checksum before we copy the table. Ignore * checksum error as we want to try to get the DSDT and FACS. */ (void) AcpiTbVerifyChecksum (Table, Length); /* Create a local copy of the FADT in common ACPI 2.0+ format */ AcpiTbCreateLocalFadt (Table, Length); /* All done with the real FADT, unmap it */ AcpiOsUnmapMemory (Table, Length); /* Obtain the DSDT and FACS tables via their addresses within the FADT */ AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); /* If Hardware Reduced flag is set, there is no FACS */ if (!AcpiGbl_ReducedHardware) { AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); } }
static ACPI_STATUS AeLocalLoadTable ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status = AE_OK; /* ACPI_TABLE_DESC TableInfo; */ ACPI_FUNCTION_TRACE (AeLocalLoadTable); #if 0 if (!Table) { return_ACPI_STATUS (AE_BAD_PARAMETER); } TableInfo.Pointer = Table; Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_ALL); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Install the new table into the local data structures */ Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) { /* Table already exists, no error */ Status = AE_OK; } /* Free table allocated by AcpiTbGetTable */ AcpiTbDeleteSingleTable (&TableInfo); return_ACPI_STATUS (Status); } #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { /* Uninstall table and free the buffer */ AcpiTbDeleteTablesByType (ACPI_TABLE_ID_DSDT); return_ACPI_STATUS (Status); } #endif #endif return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiTbGetPrimaryTable ( ACPI_POINTER *Address, ACPI_TABLE_DESC *TableInfo) { ACPI_STATUS Status; ACPI_TABLE_HEADER Header; ACPI_FUNCTION_TRACE ("TbGetPrimaryTable"); /* Ignore a NULL address in the RSDT */ if (!Address->Pointer.Value) { return_ACPI_STATUS (AE_OK); } /* * Get the header in order to get signature and table size */ Status = AcpiTbGetTableHeader (Address, &Header); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Clear the TableInfo */ ACPI_MEMSET (TableInfo, 0, sizeof (ACPI_TABLE_DESC)); /* * Check the table signature and make sure it is recognized. * Also checks the header checksum */ TableInfo->Pointer = &Header; Status = AcpiTbRecognizeTable (TableInfo, ACPI_TABLE_PRIMARY); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Get the entire table */ Status = AcpiTbGetTableBody (Address, &Header, TableInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Install the table */ Status = AcpiTbInstallTable (TableInfo); return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiTbGetSecondaryTable ( ACPI_POINTER *Address, ACPI_STRING Signature, ACPI_TABLE_DESC *TableInfo) { ACPI_STATUS Status; ACPI_TABLE_HEADER Header; ACPI_FUNCTION_TRACE_STR ("TbGetSecondaryTable", Signature); /* Get the header in order to match the signature */ Status = AcpiTbGetTableHeader (Address, &Header); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Signature must match request */ if (ACPI_STRNCMP (Header.Signature, Signature, ACPI_NAME_SIZE)) { ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n", Signature, Header.Signature)); return_ACPI_STATUS (AE_BAD_SIGNATURE); } /* * Check the table signature and make sure it is recognized. * Also checks the header checksum */ TableInfo->Pointer = &Header; Status = AcpiTbRecognizeTable (TableInfo, ACPI_TABLE_SECONDARY); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Get the entire table */ Status = AcpiTbGetTableBody (Address, &Header, TableInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Install the table */ Status = AcpiTbInstallTable (TableInfo); return_ACPI_STATUS (Status); }
/******************************************************************************* * * FUNCTION: AeLocalLoadTable * * PARAMETERS: TablePtr - pointer to a buffer containing the entire * table to be loaded * * RETURN: Status * * DESCRIPTION: This function is called to load a table from the caller's * buffer. The buffer must contain an entire ACPI Table including * a valid header. The header fields will be verified, and if it * is determined that the table is invalid, the call will fail. * * If the call fails an appropriate status will be returned. * ******************************************************************************/ #if 0 /* XXX unused -- [email protected] */ ACPI_STATUS AeLocalLoadTable ( ACPI_TABLE_HEADER *TablePtr) { ACPI_STATUS Status; ACPI_TABLE_DESC TableInfo; FUNCTION_TRACE ("AeLocalLoadTable"); if (!TablePtr) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Install the new table into the local data structures */ TableInfo.Pointer = TablePtr; Status = AcpiTbInstallTable (NULL, &TableInfo); if (ACPI_FAILURE (Status)) { /* Free table allocated by AcpiTbGetTable */ AcpiTbDeleteSingleTable (&TableInfo); return_ACPI_STATUS (Status); } #ifndef PARSER_ONLY Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { /* Uninstall table and free the buffer */ AcpiTbUninstallTable (TableInfo.InstalledDesc); return_ACPI_STATUS (Status); } #endif return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiLoadTable ( ACPI_TABLE_HEADER *TablePtr) { ACPI_STATUS Status; ACPI_TABLE_DESC TableInfo; ACPI_POINTER Address; ACPI_FUNCTION_TRACE ("AcpiLoadTable"); if (!TablePtr) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Copy the table to a local buffer */ Address.PointerType = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING; Address.Pointer.Logical = TablePtr; Status = AcpiTbGetTableBody (&Address, TablePtr, &TableInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Install the new table into the local data structures */ Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { /* Free table allocated by AcpiTbGetTableBody */ AcpiTbDeleteSingleTable (&TableInfo); return_ACPI_STATUS (Status); } /* Convert the table to common format if necessary */ switch (TableInfo.Type) { case ACPI_TABLE_FADT: Status = AcpiTbConvertTableFadt (); break; case ACPI_TABLE_FACS: Status = AcpiTbBuildCommonFacs (&TableInfo); break; default: /* Load table into namespace if it contains executable AML */ Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode); break; } if (ACPI_FAILURE (Status)) { /* Uninstall table and free the buffer */ (void) AcpiTbUninstallTable (TableInfo.InstalledDesc); } return_ACPI_STATUS (Status); }