void AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node) { ACPI_NAMESPACE_NODE *ParentNode; ACPI_NAMESPACE_NODE *PrevNode; ACPI_NAMESPACE_NODE *NextNode; ACPI_FUNCTION_TRACE_PTR (NsDeleteNode, Node); ParentNode = AcpiNsGetParentNode (Node); PrevNode = NULL; NextNode = ParentNode->Child; /* Find the node that is the previous peer in the parent's child list */ while (NextNode != Node) { PrevNode = NextNode; NextNode = PrevNode->Peer; } if (PrevNode) { /* Node is not first child, unlink it */ PrevNode->Peer = NextNode->Peer; if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST) { PrevNode->Flags |= ANOBJ_END_OF_PEER_LIST; } } else { /* Node is first child (has no previous peer) */ if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST) { /* No peers at all */ ParentNode->Child = NULL; } else { /* Link peer list to parent */ ParentNode->Child = NextNode->Peer; } } ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); /* Detach an object if there is one, then delete the node */ AcpiNsDetachObject (Node); (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); return_VOID; }
void AcpiPsFreeOp ( ACPI_PARSE_OBJECT *Op) { ACPI_FUNCTION_NAME (PsFreeOp); if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) { ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", Op)); } if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) { (void) AcpiOsReleaseObject (AcpiGbl_PsNodeCache, Op); } else { (void) AcpiOsReleaseObject (AcpiGbl_PsNodeExtCache, Op); } }
void AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *NextDesc; ACPI_FUNCTION_NAME (NsDeleteNode); /* Detach an object if there is one */ AcpiNsDetachObject (Node); /* * Delete an attached data object list if present (objects that were * attached via AcpiAttachData). Note: After any normal object is * detached above, the only possible remaining object(s) are data * objects, in a linked list. */ ObjDesc = Node->Object; while (ObjDesc && (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) { /* Invoke the attached data deletion handler if present */ if (ObjDesc->Data.Handler) { ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer); } NextDesc = ObjDesc->Common.NextObject; AcpiUtRemoveReference (ObjDesc); ObjDesc = NextDesc; } /* Special case for the statically allocated root node */ if (Node == AcpiGbl_RootNode) { return; } /* Now we can delete the node */ (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n", Node, AcpiGbl_CurrentNodeCount)); }
void AcpiUtDeleteGenericState ( ACPI_GENERIC_STATE *State) { ACPI_FUNCTION_TRACE (UtDeleteGenericState); /* Ignore null state */ if (State) { (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State); } return_VOID; }
void AcpiUtDeleteObjectDesc ( ACPI_OPERAND_OBJECT *Object) { ACPI_FUNCTION_TRACE_PTR (UtDeleteObjectDesc, Object); /* Object must be of type ACPI_OPERAND_OBJECT */ if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) { ACPI_ERROR ((AE_INFO, "%p is not an ACPI Operand object [%s]", Object, AcpiUtGetDescriptorName (Object))); return_VOID; } (void) AcpiOsReleaseObject (AcpiGbl_OperandCache, Object); return_VOID; }
void AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_FUNCTION_NAME (NsDeleteNode); /* Detach an object if there is one */ AcpiNsDetachObject (Node); /* * Delete an attached data object if present (an object that was created * and attached via AcpiAttachData). Note: After any normal object is * detached above, the only possible remaining object is a data object. */ ObjDesc = Node->Object; if (ObjDesc && (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) { /* Invoke the attached data deletion handler if present */ if (ObjDesc->Data.Handler) { ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer); } AcpiUtRemoveReference (ObjDesc); } /* Now we can delete the node */ (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n", Node, AcpiGbl_CurrentNodeCount)); }
void AcpiNsDeleteChildren ( ACPI_NAMESPACE_NODE *ParentNode) { ACPI_NAMESPACE_NODE *ChildNode; ACPI_NAMESPACE_NODE *NextNode; UINT8 Flags; ACPI_FUNCTION_TRACE_PTR (NsDeleteChildren, ParentNode); if (!ParentNode) { return_VOID; } /* If no children, all done! */ ChildNode = ParentNode->Child; if (!ChildNode) { return_VOID; } /* * Deallocate all children at this level */ do { /* Get the things we need */ NextNode = ChildNode->Peer; Flags = ChildNode->Flags; /* Grandchildren should have all been deleted already */ if (ChildNode->Child) { ACPI_ERROR ((AE_INFO, "Found a grandchild! P=%p C=%p", ParentNode, ChildNode)); } /* Now we can free this child object */ ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n", ChildNode, AcpiGbl_CurrentNodeCount)); /* * Detach an object if there is one, then free the child node */ AcpiNsDetachObject (ChildNode); /* Now we can delete the node */ (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, ChildNode); /* And move on to the next child in the list */ ChildNode = NextNode; } while (!(Flags & ANOBJ_END_OF_PEER_LIST)); /* Clear the parent's child pointer */ ParentNode->Child = NULL; return_VOID; }