ACPI_STATUS AcpiExUnloadTable ( ACPI_OPERAND_OBJECT *DdbHandle) { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *TableDesc = DdbHandle; UINT32 TableIndex; ACPI_FUNCTION_TRACE (ExUnloadTable); /* * Temporarily emit a warning so that the ASL for the machine can be * hopefully obtained. This is to say that the Unload() operator is * extremely rare if not completely unused. */ ACPI_WARNING ((AE_INFO, "Received request to unload an ACPI table")); /* * Validate the handle * Although the handle is partially validated in AcpiExReconfiguration() * when it calls AcpiExResolveOperands(), the handle is more completely * validated here. * * Handle must be a valid operand object of type reference. Also, the * DdbHandle must still be marked valid (table has not been previously * unloaded) */ if ((!DdbHandle) || (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) || (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) || (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID))) { return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* Get the table index from the DdbHandle */ TableIndex = TableDesc->Reference.Value; /* * 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. */ if (ACPI_SUCCESS (Status)) { DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; } return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiUnloadParentTable ( ACPI_HANDLE Object) { ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object); ACPI_STATUS Status = AE_NOT_EXIST; ACPI_OWNER_ID OwnerId; UINT32 i; ACPI_FUNCTION_TRACE (AcpiUnloadParentTable); /* Parameter validation */ if (!Object) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* * The node OwnerId is currently the same as the parent table ID. * However, this could change in the future. */ OwnerId = Node->OwnerId; if (!OwnerId) { /* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */ return_ACPI_STATUS (AE_TYPE); } /* Must acquire the table lock during this operation */ Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Find the table in the global table list */ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) { if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId) { continue; } /* * Allow unload of SSDT and OEMx tables only. Do not allow unload * of the DSDT. No other types of tables should get here, since * only these types can contain AML and thus are the only types * that can create namespace objects. */ if (ACPI_COMPARE_NAME ( AcpiGbl_RootTableList.Tables[i].Signature.Ascii, ACPI_SIG_DSDT)) { Status = AE_TYPE; break; } (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); Status = AcpiTbUnloadTable (i); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); break; } (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); }