ACPI_STATUS AcpiLoadTable ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; ACPI_TABLE_DESC TableDesc; UINT32 TableIndex; ACPI_FUNCTION_TRACE (AcpiLoadTable); /* Parameter validation */ if (!Table) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Init local table descriptor */ ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC)); TableDesc.Address = ACPI_PTR_TO_PHYSADDR (Table); TableDesc.Pointer = Table; TableDesc.Length = Table->Length; TableDesc.Flags = ACPI_TABLE_ORIGIN_UNKNOWN; /* Must acquire the interpreter lock during this operation */ Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Install the table and load it into the namespace */ ACPI_INFO ((AE_INFO, "Host-directed Dynamic ACPI Table Load:")); Status = AcpiTbAddTable (&TableDesc, &TableIndex); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } Status = AcpiNsLoadTable (TableIndex, AcpiGbl_RootNode); /* Invoke table handler if present */ if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, AcpiGbl_TableHandlerContext); } UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); return_ACPI_STATUS (Status); }
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 = AcpiTbInitTableDescriptor (&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 AcpiTbLoadTable ( UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode) { ACPI_TABLE_HEADER *Table; ACPI_STATUS Status; ACPI_OWNER_ID OwnerId; ACPI_FUNCTION_TRACE (TbLoadTable); /* * Note: Now table is "INSTALLED", it must be validated before * using. */ Status = AcpiGetTableByIndex (TableIndex, &Table); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiNsLoadTable (TableIndex, ParentNode); /* * This case handles the legacy option that groups all module-level * code blocks together and defers execution until all of the tables * are loaded. Execute all of these blocks at this time. * Execute any module-level code that was detected during the table * load phase. * * Note: this option is deprecated and will be eliminated in the * future. Use of this option can cause problems with AML code that * depends upon in-order immediate execution of module-level code. */ AcpiNsExecModuleCodeList (); /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. */ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); if (ACPI_SUCCESS (Status)) { AcpiEvUpdateGpes (OwnerId); } /* Invoke table handler */ AcpiTbNotifyTable (ACPI_TABLE_EVENT_LOAD, Table); return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiTbLoadTable ( UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode) { ACPI_TABLE_HEADER *Table; ACPI_STATUS Status; ACPI_OWNER_ID OwnerId; ACPI_FUNCTION_TRACE (TbLoadTable); /* * Note: Now table is "INSTALLED", it must be validated before * using. */ Status = AcpiGetTableByIndex (TableIndex, &Table); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiNsLoadTable (TableIndex, ParentNode); /* Execute any module-level code that was found in the table */ if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode) { AcpiNsExecModuleCodeList (); } /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. */ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); if (ACPI_SUCCESS (Status)) { AcpiEvUpdateGpes (OwnerId); } /* Invoke table handler if present */ if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, AcpiGbl_TableHandlerContext); } return_ACPI_STATUS (Status); }
static ACPI_STATUS AcpiExAddTable ( UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle) { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_FUNCTION_TRACE (ExAddTable); /* Create an object to be the table handle */ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Init the table handle */ ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE; *DdbHandle = ObjDesc; /* Install the new table into the local data structures */ ObjDesc->Reference.Value = TableIndex; /* Add the table to the namespace */ Status = AcpiNsLoadTable (TableIndex, ParentNode); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); *DdbHandle = NULL; return_ACPI_STATUS (Status); } /* Execute any module-level code that was found in the table */ AcpiExExitInterpreter (); AcpiNsExecModuleCodeList (); AcpiExEnterInterpreter (); 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); }
static ACPI_STATUS AcpiTbLoadNamespace ( void) { ACPI_STATUS Status; UINT32 i; ACPI_TABLE_HEADER *NewDsdt; ACPI_FUNCTION_TRACE (TbLoadNamespace); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* * Load the namespace. The DSDT is required, but any SSDT and * PSDT tables are optional. Verify the DSDT. */ if (!AcpiGbl_RootTableList.CurrentTableCount || !ACPI_COMPARE_NAME ( &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), ACPI_SIG_DSDT) || ACPI_FAILURE (AcpiTbVerifyTable ( &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) { Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; } /* * Save the DSDT pointer for simple access. This is the mapped memory * address. We must take care here because the address of the .Tables * array can change dynamically as tables are loaded at run-time. Note: * .Pointer field is not validated until after call to AcpiTbVerifyTable. */ AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer; /* * Optionally copy the entire DSDT to local memory (instead of simply * mapping it.) There are some BIOSs that corrupt or replace the original * DSDT, creating the need for this option. Default is FALSE, do not copy * the DSDT. */ if (AcpiGbl_CopyDsdtLocally) { NewDsdt = AcpiTbCopyDsdt (ACPI_TABLE_INDEX_DSDT); if (NewDsdt) { AcpiGbl_DSDT = NewDsdt; } } /* * Save the original DSDT header for detection of table corruption * and/or replacement of the DSDT from outside the OS. */ ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER)); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); /* Load and parse tables */ Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 2; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_PSDT)) || ACPI_FAILURE (AcpiTbVerifyTable ( &AcpiGbl_RootTableList.Tables[i]))) { continue; } /* Skip SSDT when it is overriden with DSDT */ if (ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_SSDT) && (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_ORIGIN_OVERRIDE)) { continue; } /* Ignore errors while loading tables, get as many as possible */ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); (void) AcpiNsLoadTable (i, AcpiGbl_RootNode); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); } ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); }
static ACPI_STATUS AcpiExAddTable ( UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; ACPI_OWNER_ID OwnerId; ACPI_FUNCTION_TRACE (ExAddTable); /* Create an object to be the table handle */ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Init the table handle */ ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE; *DdbHandle = ObjDesc; /* Install the new table into the local data structures */ ObjDesc->Reference.Value = TableIndex; /* Add the table to the namespace */ Status = AcpiNsLoadTable (TableIndex, ParentNode); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); *DdbHandle = NULL; return_ACPI_STATUS (Status); } /* Execute any module-level code that was found in the table */ AcpiExExitInterpreter (); AcpiNsExecModuleCodeList (); AcpiExEnterInterpreter (); /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. */ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); if (ACPI_SUCCESS (Status)) { AcpiEvUpdateGpes (OwnerId); } return_ACPI_STATUS (AE_OK); }
ACPI_STATUS AcpiLoadTable ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; UINT32 TableIndex; ACPI_FUNCTION_TRACE (AcpiLoadTable); /* Parameter validation */ if (!Table) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Must acquire the interpreter lock during this operation */ Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Install the table and load it into the namespace */ ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, TRUE, FALSE, &TableIndex); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } /* * Note: Now table is "INSTALLED", it must be validated before * using. */ Status = AcpiTbValidateTable ( &AcpiGbl_RootTableList.Tables[TableIndex]); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } Status = AcpiNsLoadTable (TableIndex, AcpiGbl_RootNode); /* Invoke table handler if present */ if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, AcpiGbl_TableHandlerContext); } UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiTbLoadNamespace ( void) { ACPI_STATUS Status; UINT32 i; ACPI_TABLE_HEADER *NewDsdt; ACPI_TABLE_DESC *Table; UINT32 TablesLoaded = 0; UINT32 TablesFailed = 0; ACPI_FUNCTION_TRACE (TbLoadNamespace); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* * Load the namespace. The DSDT is required, but any SSDT and * PSDT tables are optional. Verify the DSDT. */ Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex]; if (!AcpiGbl_RootTableList.CurrentTableCount || !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_DSDT) || ACPI_FAILURE (AcpiTbValidateTable (Table))) { Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; } /* * Save the DSDT pointer for simple access. This is the mapped memory * address. We must take care here because the address of the .Tables * array can change dynamically as tables are loaded at run-time. Note: * .Pointer field is not validated until after call to AcpiTbValidateTable. */ AcpiGbl_DSDT = Table->Pointer; /* * Optionally copy the entire DSDT to local memory (instead of simply * mapping it.) There are some BIOSs that corrupt or replace the original * DSDT, creating the need for this option. Default is FALSE, do not copy * the DSDT. */ if (AcpiGbl_CopyDsdtLocally) { NewDsdt = AcpiTbCopyDsdt (AcpiGbl_DsdtIndex); if (NewDsdt) { AcpiGbl_DSDT = NewDsdt; } } /* * Save the original DSDT header for detection of table corruption * and/or replacement of the DSDT from outside the OS. */ memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER)); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); /* Load and parse tables */ Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed")); TablesFailed++; } else { TablesLoaded++; } /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { Table = &AcpiGbl_RootTableList.Tables[i]; if (!AcpiGbl_RootTableList.Tables[i].Address || (!ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_PSDT) && !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_OSDT)) || ACPI_FAILURE (AcpiTbValidateTable (Table))) { continue; } /* Ignore errors while loading tables, get as many as possible */ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); Status = AcpiNsLoadTable (i, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table", Table->Signature.Ascii, Table->Pointer->OemTableId)); TablesFailed++; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Table [%4.4s:%8.8s] (id FF) - Table namespace load failed\n\n", Table->Signature.Ascii, Table->Pointer->OemTableId)); } else { TablesLoaded++; } (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); } if (!TablesFailed) { ACPI_INFO (( "%u ACPI AML tables successfully acquired and loaded\n", TablesLoaded)); } else { ACPI_ERROR ((AE_INFO, "%u table load failures, %u successful", TablesFailed, TablesLoaded)); /* Indicate at least one failure */ Status = AE_CTRL_TERMINATE; } UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); }
static ACPI_STATUS AcpiTbLoadNamespace ( void) { ACPI_STATUS Status; UINT32 i; ACPI_FUNCTION_TRACE (TbLoadNamespace); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* * Load the namespace. The DSDT is required, but any SSDT and PSDT tables * are optional. */ if (!AcpiGbl_RootTableList.Count || !ACPI_COMPARE_NAME ( &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), ACPI_SIG_DSDT) || ACPI_FAILURE (AcpiTbVerifyTable ( &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) { Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; } /* A valid DSDT is required */ Status = AcpiTbVerifyTable ( &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]); if (ACPI_FAILURE (Status)) { Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; } (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); /* Load and parse tables */ Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 0; i < AcpiGbl_RootTableList.Count; ++i) { if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_PSDT)) || ACPI_FAILURE (AcpiTbVerifyTable ( &AcpiGbl_RootTableList.Tables[i]))) { continue; } /* Ignore errors while loading tables, get as many as possible */ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); (void) AcpiNsLoadTable (i, AcpiGbl_RootNode); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); } ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 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); }
ACPI_STATUS AcpiNsLoadTableByType ( ACPI_TABLE_TYPE TableType) { UINT32 i; ACPI_STATUS Status; ACPI_TABLE_DESC *TableDesc; ACPI_FUNCTION_TRACE ("NsLoadTableByType"); Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* * Table types supported are: * DSDT (one), SSDT/PSDT (multiple) */ switch (TableType) { case ACPI_TABLE_DSDT: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n")); TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_DSDT]; /* If table already loaded into namespace, just return */ if (TableDesc->LoadedIntoNamespace) { goto UnlockAndExit; } TableDesc->TableId = TABLE_ID_DSDT; /* Now load the single DSDT */ Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode); if (ACPI_SUCCESS (Status)) { TableDesc->LoadedIntoNamespace = TRUE; } break; case ACPI_TABLE_SSDT: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n", AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count)); /* * Traverse list of SSDT tables */ TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_SSDT]; for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count; i++) { /* * Only attempt to load table if it is not * already loaded! */ if (!TableDesc->LoadedIntoNamespace) { Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { break; } TableDesc->LoadedIntoNamespace = TRUE; } TableDesc = TableDesc->Next; } break; case ACPI_TABLE_PSDT: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n", AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count)); /* * Traverse list of PSDT tables */ TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_PSDT]; for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count; i++) { /* Only attempt to load table if it is not already loaded! */ if (!TableDesc->LoadedIntoNamespace) { Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { break; } TableDesc->LoadedIntoNamespace = TRUE; } TableDesc = TableDesc->Next; } break; default: Status = AE_SUPPORT; break; } UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiTbInstallAndLoadTable ( ACPI_TABLE_HEADER *Table, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, BOOLEAN Override, UINT32 *TableIndex) { ACPI_STATUS Status; UINT32 i; ACPI_OWNER_ID OwnerId; ACPI_FUNCTION_TRACE (AcpiLoadTable); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* Install the table and load it into the namespace */ Status = AcpiTbInstallStandardTable (Address, Flags, TRUE, Override, &i); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } /* * Note: Now table is "INSTALLED", it must be validated before * using. */ Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); Status = AcpiNsLoadTable (i, AcpiGbl_RootNode); /* Execute any module-level code that was found in the table */ if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode) { AcpiNsExecModuleCodeList (); } /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. */ Status = AcpiTbGetOwnerId (i, &OwnerId); if (ACPI_SUCCESS (Status)) { AcpiEvUpdateGpes (OwnerId); } /* Invoke table handler if present */ if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, AcpiGbl_TableHandlerContext); } (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); UnlockAndExit: *TableIndex = i; (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); }