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/executer/exconfig.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/external/bsd/acpica/dist/executer/exconfig.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.5 retrieving revision 1.5.2.6 diff -u -p -r1.5 -r1.5.2.6 --- src/sys/external/bsd/acpica/dist/executer/exconfig.c 2014/10/25 21:00:07 1.5 +++ src/sys/external/bsd/acpica/dist/executer/exconfig.c 2017/02/05 13:40:50 1.5.2.6 @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2017, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXCONFIG_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" @@ -61,7 +59,6 @@ static ACPI_STATUS AcpiExAddTable ( UINT32 TableIndex, - ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle); static ACPI_STATUS @@ -89,12 +86,9 @@ AcpiExRegionRead ( 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); @@ -112,39 +106,8 @@ AcpiExAddTable ( 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); - } - + *DdbHandle = ObjDesc; return_ACPI_STATUS (AE_OK); } @@ -173,28 +136,20 @@ AcpiExLoadTableOp ( ACPI_NAMESPACE_NODE *StartNode; ACPI_NAMESPACE_NODE *ParameterNode = NULL; ACPI_OPERAND_OBJECT *DdbHandle; - ACPI_TABLE_HEADER *Table; UINT32 TableIndex; ACPI_FUNCTION_TRACE (ExLoadTableOp); - /* Validate lengths for the Signature, OemId, and OemTableId strings */ - - if ((Operand[0]->String.Length > ACPI_NAME_SIZE) || - (Operand[1]->String.Length > ACPI_OEM_ID_SIZE) || - (Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE)) - { - return_ACPI_STATUS (AE_AML_STRING_LIMIT); - } - /* Find the ACPI table in the RSDT/XSDT */ + AcpiExExitInterpreter (); Status = AcpiTbFindTable ( - Operand[0]->String.Pointer, - Operand[1]->String.Pointer, - Operand[2]->String.Pointer, &TableIndex); + Operand[0]->String.Pointer, + Operand[1]->String.Pointer, + Operand[2]->String.Pointer, &TableIndex); + AcpiExEnterInterpreter (); if (ACPI_FAILURE (Status)) { if (Status != AE_NOT_FOUND) @@ -227,8 +182,9 @@ AcpiExLoadTableOp ( * Find the node referenced by the RootPathString. This is the * location within the namespace where the table will be loaded. */ - Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer, - ACPI_NS_SEARCH_PARENT, &ParentNode); + Status = AcpiNsGetNodeUnlocked (StartNode, + Operand[3]->String.Pointer, ACPI_NS_SEARCH_PARENT, + &ParentNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -251,8 +207,9 @@ AcpiExLoadTableOp ( /* Find the node referenced by the ParameterPathString */ - Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer, - ACPI_NS_SEARCH_PARENT, &ParameterNode); + Status = AcpiNsGetNodeUnlocked (StartNode, + Operand[4]->String.Pointer, ACPI_NS_SEARCH_PARENT, + &ParameterNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -261,7 +218,16 @@ AcpiExLoadTableOp ( /* Load the table into the namespace */ - Status = AcpiExAddTable (TableIndex, ParentNode, &DdbHandle); + ACPI_INFO (("Dynamic OEM Table Load:")); + AcpiExExitInterpreter (); + Status = AcpiTbLoadTable (TableIndex, ParentNode); + AcpiExEnterInterpreter (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiExAddTable (TableIndex, &DdbHandle); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -274,8 +240,7 @@ AcpiExLoadTableOp ( /* Store the parameter data into the optional parameter object */ Status = AcpiExStore (Operand[5], - ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), - WalkState); + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), WalkState); if (ACPI_FAILURE (Status)) { (void) AcpiExUnloadTable (DdbHandle); @@ -285,21 +250,6 @@ AcpiExLoadTableOp ( } } - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_SUCCESS (Status)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Dynamic OEM Table Load:")); - AcpiTbPrintTableHeader (0, Table); - } - - /* Invoke table handler if present */ - - if (AcpiGbl_TableHandler) - { - (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, - AcpiGbl_TableHandlerContext); - } - *ReturnDesc = DdbHandle; return_ACPI_STATUS (Status); } @@ -337,7 +287,7 @@ AcpiExRegionRead ( for (i = 0; i < Length; i++) { Status = AcpiEvAddressSpaceDispatch (ObjDesc, NULL, ACPI_READ, - RegionOffset, 8, &Value); + RegionOffset, 8, &Value); if (ACPI_FAILURE (Status)) { return (Status); @@ -407,8 +357,8 @@ AcpiExLoadOp ( } /* - * If the Region Address and Length have not been previously evaluated, - * evaluate them now and save the results. + * If the Region Address and Length have not been previously + * evaluated, evaluate them now and save the results. */ if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) { @@ -428,7 +378,7 @@ AcpiExLoadOp ( } Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER), - ACPI_CAST_PTR (UINT8, TableHeader)); + ACPI_CAST_PTR (UINT8, TableHeader)); Length = TableHeader->Length; ACPI_FREE (TableHeader); @@ -471,7 +421,7 @@ AcpiExLoadOp ( /* Read the entire table */ Status = AcpiExRegionRead (ObjDesc, Length, - ACPI_CAST_PTR (UINT8, Table)); + ACPI_CAST_PTR (UINT8, Table)); if (ACPI_FAILURE (Status)) { ACPI_FREE (Table); @@ -493,7 +443,8 @@ AcpiExLoadOp ( /* Get the actual table length from the table header */ - TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); + TableHeader = ACPI_CAST_PTR ( + ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); Length = TableHeader->Length; /* Table cannot extend beyond the buffer */ @@ -508,8 +459,8 @@ AcpiExLoadOp ( } /* - * Copy the table from the buffer because the buffer could be modified - * or even deleted in the future + * Copy the table from the buffer because the buffer could be + * modified or even deleted in the future */ Table = ACPI_ALLOCATE (Length); if (!Table) @@ -517,7 +468,7 @@ AcpiExLoadOp ( return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_MEMCPY (Table, TableHeader, Length); + memcpy (Table, TableHeader, Length); break; default: @@ -527,14 +478,11 @@ AcpiExLoadOp ( /* Install the new table into the local data structures */ - ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:")); - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, TRUE, - &TableIndex); - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + ACPI_INFO (("Dynamic OEM Table Load:")); + AcpiExExitInterpreter (); + Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table), + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, &TableIndex); + AcpiExEnterInterpreter (); if (ACPI_FAILURE (Status)) { /* Delete allocated table buffer */ @@ -544,23 +492,13 @@ AcpiExLoadOp ( } /* - * Note: Now table is "INSTALLED", it must be validated before - * loading. - */ - Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* * Add the table to the namespace. * * Note: Load the table objects relative to the root of the namespace. * This appears to go against the ACPI specification, but we do it for * compatibility with other ACPI implementations. */ - Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle); + Status = AcpiExAddTable (TableIndex, &DdbHandle); if (ACPI_FAILURE (Status)) { /* On error, TablePtr was deallocated above */ @@ -584,15 +522,6 @@ AcpiExLoadOp ( /* Remove the reference by added by AcpiExStore above */ AcpiUtRemoveReference (DdbHandle); - - /* Invoke table handler if present */ - - if (AcpiGbl_TableHandler) - { - (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, - AcpiGbl_TableHandlerContext); - } - return_ACPI_STATUS (Status); } @@ -616,7 +545,6 @@ AcpiExUnloadTable ( ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *TableDesc = DdbHandle; UINT32 TableIndex; - ACPI_TABLE_HEADER *Table; ACPI_FUNCTION_TRACE (ExUnloadTable); @@ -652,40 +580,21 @@ AcpiExUnloadTable ( TableIndex = TableDesc->Reference.Value; - /* Ensure the table is still loaded */ - - if (!AcpiTbIsTableLoaded (TableIndex)) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Invoke table handler if present */ - - if (AcpiGbl_TableHandler) - { - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_SUCCESS (Status)) - { - (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, Table, - AcpiGbl_TableHandlerContext); - } - } - - /* Delete the portion of the namespace owned by this table */ - - Status = AcpiTbDeleteNamespaceByOwner (TableIndex); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - (void) AcpiTbReleaseOwnerId (TableIndex); - AcpiTbSetTableLoadedFlag (TableIndex, FALSE); + /* + * Release the interpreter lock so that the table lock won't have + * strict order requirement against it. + */ + AcpiExExitInterpreter (); + Status = AcpiTbUnloadTable (TableIndex); + AcpiExEnterInterpreter (); /* * Invalidate the handle. We do this because the handle may be stored * in a named object and may not be actually deleted until much later. */ - DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; - return_ACPI_STATUS (AE_OK); + if (ACPI_SUCCESS (Status)) + { + DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; + } + return_ACPI_STATUS (Status); }