2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: utdelete - object deletion and reference count utilities
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2015-02-05 15:20:45 +08:00
|
|
|
* Copyright (C) 2000 - 2015, Intel Corp.
|
2005-04-17 06:20:36 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 13:30:03 +08:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acinterp.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "acevents.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_UTILITIES
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MODULE_NAME("utdelete")
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Local prototypes */
|
2005-08-05 12:44:28 +08:00
|
|
|
static void acpi_ut_delete_internal_obj(union acpi_operand_object *object);
|
2005-04-19 10:49:35 +08:00
|
|
|
|
|
|
|
static void
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_delete_internal_obj
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: object - Object to be deleted
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Low level object deletion, after reference counts have been
|
|
|
|
* updated (All reference counts, including sub-objects!)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
void *obj_pointer = NULL;
|
|
|
|
union acpi_operand_object *handler_desc;
|
|
|
|
union acpi_operand_object *second_desc;
|
|
|
|
union acpi_operand_object *next_desc;
|
2014-02-26 10:33:47 +08:00
|
|
|
union acpi_operand_object *start_desc;
|
2009-05-21 11:03:29 +08:00
|
|
|
union acpi_operand_object **last_obj_ptr;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!object) {
|
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Must delete or free any pointers within the object that are not
|
|
|
|
* actual ACPI objects (for example, a raw buffer pointer).
|
|
|
|
*/
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (object->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"**** String %p, ptr %p\n", object,
|
|
|
|
object->string.pointer));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Free the actual string buffer */
|
|
|
|
|
|
|
|
if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* But only if it is NOT a pointer into an ACPI table */
|
|
|
|
|
|
|
|
obj_pointer = object->string.pointer;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"**** Buffer %p, ptr %p\n", object,
|
|
|
|
object->buffer.pointer));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Free the actual buffer */
|
|
|
|
|
|
|
|
if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* But only if it is NOT a pointer into an ACPI table */
|
|
|
|
|
|
|
|
obj_pointer = object->buffer.pointer;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_PACKAGE:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
" **** Package of count %X\n",
|
|
|
|
object->package.count));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Elements of the package are not handled here, they are deleted
|
|
|
|
* separately
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Free the (variable length) element pointer array */
|
|
|
|
|
|
|
|
obj_pointer = object->package.elements;
|
|
|
|
break;
|
|
|
|
|
2008-07-04 10:41:41 +08:00
|
|
|
/*
|
|
|
|
* These objects have a possible list of notify handlers.
|
|
|
|
* Device object also may have a GPE block.
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_DEVICE:
|
|
|
|
|
|
|
|
if (object->device.gpe_block) {
|
2005-08-05 12:44:28 +08:00
|
|
|
(void)acpi_ev_delete_gpe_block(object->device.
|
|
|
|
gpe_block);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-07-04 10:41:41 +08:00
|
|
|
/*lint -fallthrough */
|
|
|
|
|
|
|
|
case ACPI_TYPE_PROCESSOR:
|
|
|
|
case ACPI_TYPE_THERMAL:
|
|
|
|
|
2012-05-03 11:08:19 +08:00
|
|
|
/* Walk the address handler list for this object */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-07-04 10:41:41 +08:00
|
|
|
handler_desc = object->common_notify.handler;
|
2005-04-17 06:20:36 +08:00
|
|
|
while (handler_desc) {
|
|
|
|
next_desc = handler_desc->address_space.next;
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(handler_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
handler_desc = next_desc;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_MUTEX:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
2006-06-24 05:04:00 +08:00
|
|
|
"***** Mutex %p, OS Mutex %p\n",
|
|
|
|
object, object->mutex.os_mutex));
|
|
|
|
|
2008-04-10 23:06:37 +08:00
|
|
|
if (object == acpi_gbl_global_lock_mutex) {
|
2007-02-03 00:48:18 +08:00
|
|
|
|
|
|
|
/* Global Lock has extra semaphore */
|
2006-06-24 05:04:00 +08:00
|
|
|
|
|
|
|
(void)
|
|
|
|
acpi_os_delete_semaphore
|
|
|
|
(acpi_gbl_global_lock_semaphore);
|
|
|
|
acpi_gbl_global_lock_semaphore = NULL;
|
2007-02-03 00:48:18 +08:00
|
|
|
|
|
|
|
acpi_os_delete_mutex(object->mutex.os_mutex);
|
|
|
|
acpi_gbl_global_lock_mutex = NULL;
|
|
|
|
} else {
|
2007-05-10 11:01:59 +08:00
|
|
|
acpi_ex_unlink_mutex(object);
|
2007-02-03 00:48:18 +08:00
|
|
|
acpi_os_delete_mutex(object->mutex.os_mutex);
|
2006-06-24 05:04:00 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_EVENT:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
2006-06-24 05:04:00 +08:00
|
|
|
"***** Event %p, OS Semaphore %p\n",
|
|
|
|
object, object->event.os_semaphore));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-06-24 05:04:00 +08:00
|
|
|
(void)acpi_os_delete_semaphore(object->event.os_semaphore);
|
|
|
|
object->event.os_semaphore = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_METHOD:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"***** Method %p\n", object));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-06-24 05:04:00 +08:00
|
|
|
/* Delete the method mutex if it exists */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-06-24 05:04:00 +08:00
|
|
|
if (object->method.mutex) {
|
|
|
|
acpi_os_delete_mutex(object->method.mutex->mutex.
|
|
|
|
os_mutex);
|
|
|
|
acpi_ut_delete_object_desc(object->method.mutex);
|
|
|
|
object->method.mutex = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2015-07-23 12:52:31 +08:00
|
|
|
if (object->method.node) {
|
|
|
|
object->method.node = NULL;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_REGION:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"***** Region %p\n", object));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-01-12 13:10:32 +08:00
|
|
|
/*
|
|
|
|
* Update address_range list. However, only permanent regions
|
|
|
|
* are installed in this list. (Not created within a method)
|
|
|
|
*/
|
|
|
|
if (!(object->region.node->flags & ANOBJ_TEMPORARY)) {
|
|
|
|
acpi_ut_remove_address_range(object->region.space_id,
|
|
|
|
object->region.node);
|
|
|
|
}
|
ACPICA: fix leak of acpi_os_validate_address
http://bugzilla.kernel.org/show_bug.cgi?id=13620
If the dynamic region is created and added to resource list over and over again,
it has the potential to be a memory leak by growing the list every time.
This patch fixes the memory leak, as below
1) add a new field "count" to struct acpi_res_list.
When inserting, if the region(addr, len) is already in the resource
list, we just increase "count", otherwise, the region is inserted
with count=1.
When deleting, the "count" is decreased, if it's decreased to 0,
the region is deleted from the resource list.
With "count", the region with same address and length can only be
inserted to the resource list once, so prevent potential memory leak.
2) add a new function acpi_os_invalidate_address, which is called when
region is deleted.
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2009-08-13 10:43:27 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
second_desc = acpi_ns_get_secondary_object(object);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (second_desc) {
|
|
|
|
/*
|
|
|
|
* Free the region_context if and only if the handler is one of the
|
|
|
|
* default handlers -- and therefore, we created the context object
|
|
|
|
* locally, it was not created by an external caller.
|
|
|
|
*/
|
|
|
|
handler_desc = object->region.handler;
|
|
|
|
if (handler_desc) {
|
2009-05-21 11:03:29 +08:00
|
|
|
next_desc =
|
|
|
|
handler_desc->address_space.region_list;
|
2014-02-26 10:33:47 +08:00
|
|
|
start_desc = next_desc;
|
2009-05-21 11:03:29 +08:00
|
|
|
last_obj_ptr =
|
|
|
|
&handler_desc->address_space.region_list;
|
|
|
|
|
2014-02-26 10:33:47 +08:00
|
|
|
/* Remove the region object from the handler list */
|
2009-05-21 11:03:29 +08:00
|
|
|
|
|
|
|
while (next_desc) {
|
|
|
|
if (next_desc == object) {
|
|
|
|
*last_obj_ptr =
|
|
|
|
next_desc->region.next;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-02-26 10:33:47 +08:00
|
|
|
/* Walk the linked list of handlers */
|
2009-05-21 11:03:29 +08:00
|
|
|
|
|
|
|
last_obj_ptr = &next_desc->region.next;
|
|
|
|
next_desc = next_desc->region.next;
|
2014-02-26 10:33:47 +08:00
|
|
|
|
|
|
|
/* Prevent infinite loop if list is corrupted */
|
|
|
|
|
|
|
|
if (next_desc == start_desc) {
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Circular region list in address handler object %p",
|
|
|
|
handler_desc));
|
|
|
|
return_VOID;
|
|
|
|
}
|
2009-05-21 11:03:29 +08:00
|
|
|
}
|
|
|
|
|
2006-03-18 05:44:00 +08:00
|
|
|
if (handler_desc->address_space.handler_flags &
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
|
|
|
|
/* Deactivate region and free region context */
|
|
|
|
|
|
|
|
if (handler_desc->address_space.setup) {
|
|
|
|
(void)handler_desc->
|
|
|
|
address_space.setup(object,
|
|
|
|
ACPI_REGION_DEACTIVATE,
|
|
|
|
handler_desc->
|
|
|
|
address_space.
|
|
|
|
context,
|
|
|
|
&second_desc->
|
|
|
|
extra.
|
|
|
|
region_context);
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(handler_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now we can free the Extra object */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_delete_object_desc(second_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"***** Buffer Field %p\n", object));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
second_desc = acpi_ns_get_secondary_object(object);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (second_desc) {
|
2008-04-10 23:06:41 +08:00
|
|
|
acpi_ut_delete_object_desc(second_desc);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
|
|
|
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"***** Bank Field %p\n", object));
|
|
|
|
|
|
|
|
second_desc = acpi_ns_get_secondary_object(object);
|
|
|
|
if (second_desc) {
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_delete_object_desc(second_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free any allocated memory (pointer within the object) found above */
|
|
|
|
|
|
|
|
if (obj_pointer) {
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Deleting Object Subptr %p\n", obj_pointer));
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_FREE(obj_pointer);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now the object can be safely deleted */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
|
|
|
|
object, acpi_ut_get_object_type_name(object)));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_delete_object_desc(object);
|
2005-04-17 06:20:36 +08:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_delete_internal_object_list
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* PARAMETERS: obj_list - Pointer to the list to be deleted
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: This function deletes an internal object list, including both
|
|
|
|
* simple objects and package objects
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object **internal_obj;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-12-31 08:05:39 +08:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Walk the null-terminated internal list */
|
|
|
|
|
|
|
|
for (internal_obj = obj_list; *internal_obj; internal_obj++) {
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(*internal_obj);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Free the combined parameter pointer list and object array */
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_FREE(obj_list);
|
2012-12-19 13:37:59 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_update_ref_count
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: object - Object whose ref count is to be updated
|
2013-04-12 08:25:41 +08:00
|
|
|
* action - What to do (REF_INCREMENT or REF_DECREMENT)
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2013-04-12 08:25:41 +08:00
|
|
|
* RETURN: None. Sets new reference count within the object
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2013-04-12 08:25:41 +08:00
|
|
|
* DESCRIPTION: Modify the reference count for an internal acpi object
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static void
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2013-04-12 08:25:41 +08:00
|
|
|
u16 original_count;
|
|
|
|
u16 new_count = 0;
|
|
|
|
acpi_cpu_flags lock_flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_NAME(ut_update_ref_count);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2013-04-12 08:25:41 +08:00
|
|
|
* Always get the reference count lock. Note: Interpreter and/or
|
|
|
|
* Namespace is not always locked when this function is called.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2013-04-12 08:25:41 +08:00
|
|
|
lock_flags = acpi_os_acquire_lock(acpi_gbl_reference_count_lock);
|
|
|
|
original_count = object->common.reference_count;
|
|
|
|
|
|
|
|
/* Perform the reference count action (increment, decrement) */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
switch (action) {
|
|
|
|
case REF_INCREMENT:
|
|
|
|
|
2013-04-12 08:25:41 +08:00
|
|
|
new_count = original_count + 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
object->common.reference_count = new_count;
|
2013-04-12 08:25:41 +08:00
|
|
|
acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags);
|
|
|
|
|
|
|
|
/* The current reference count should never be zero here */
|
|
|
|
|
|
|
|
if (!original_count) {
|
|
|
|
ACPI_WARNING((AE_INFO,
|
|
|
|
"Obj %p, Reference Count was zero before increment\n",
|
|
|
|
object));
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
2013-04-12 08:25:41 +08:00
|
|
|
"Obj %p Type %.2X Refs %.2X [Incremented]\n",
|
|
|
|
object, object->common.type, new_count));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case REF_DECREMENT:
|
|
|
|
|
2013-04-12 08:25:41 +08:00
|
|
|
/* The current reference count must be non-zero */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-04-12 08:25:41 +08:00
|
|
|
if (original_count) {
|
|
|
|
new_count = original_count - 1;
|
|
|
|
object->common.reference_count = new_count;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2013-04-12 08:25:41 +08:00
|
|
|
acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags);
|
|
|
|
|
|
|
|
if (!original_count) {
|
|
|
|
ACPI_WARNING((AE_INFO,
|
|
|
|
"Obj %p, Reference Count is already zero, cannot decrement\n",
|
|
|
|
object));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2013-04-12 08:25:41 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Type %.2X Refs %.2X [Decremented]\n",
|
|
|
|
object, object->common.type, new_count));
|
|
|
|
|
|
|
|
/* Actually delete the object on a reference count of zero */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (new_count == 0) {
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_delete_internal_obj(object);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2013-04-12 08:25:41 +08:00
|
|
|
acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags);
|
|
|
|
ACPI_ERROR((AE_INFO, "Unknown Reference Count action (0x%X)",
|
|
|
|
action));
|
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sanity check the reference count, for debug purposes only.
|
|
|
|
* (A deleted object will have a huge reference count)
|
|
|
|
*/
|
2013-04-12 08:25:41 +08:00
|
|
|
if (new_count > ACPI_MAX_REFERENCE_COUNT) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_WARNING((AE_INFO,
|
2013-04-12 08:25:41 +08:00
|
|
|
"Large Reference Count (0x%X) in object %p, Type=0x%.2X",
|
|
|
|
new_count, object, object->common.type));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_update_object_reference
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: object - Increment ref count for this object
|
2005-04-17 06:20:36 +08:00
|
|
|
* and all sub-objects
|
2013-04-12 08:25:29 +08:00
|
|
|
* action - Either REF_INCREMENT or REF_DECREMENT
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Increment the object reference count
|
|
|
|
*
|
|
|
|
* Object references are incremented when:
|
|
|
|
* 1) An object is attached to a Node (namespace object)
|
|
|
|
* 2) An object is copied (all subobjects must be incremented)
|
|
|
|
*
|
|
|
|
* Object references are decremented when:
|
|
|
|
* 1) An object is detached from an Node
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2006-05-27 04:36:00 +08:00
|
|
|
acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
union acpi_generic_state *state_list = NULL;
|
|
|
|
union acpi_operand_object *next_object = NULL;
|
2012-05-03 11:08:19 +08:00
|
|
|
union acpi_operand_object *prev_object;
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_generic_state *state;
|
2008-06-10 13:42:13 +08:00
|
|
|
u32 i;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-12-19 13:37:59 +08:00
|
|
|
ACPI_FUNCTION_NAME(ut_update_object_reference);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-08 12:00:00 +08:00
|
|
|
while (object) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-07-08 12:00:00 +08:00
|
|
|
/* Make sure that this isn't a namespace handle */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Object %p is NS handle\n", object));
|
2012-12-19 13:37:59 +08:00
|
|
|
return (AE_OK);
|
2005-07-08 12:00:00 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* All sub-objects must have their reference count incremented also.
|
|
|
|
* Different object types have different subobjects.
|
|
|
|
*/
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (object->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_DEVICE:
|
2006-07-08 08:44:38 +08:00
|
|
|
case ACPI_TYPE_PROCESSOR:
|
|
|
|
case ACPI_TYPE_POWER:
|
|
|
|
case ACPI_TYPE_THERMAL:
|
2012-05-03 11:08:19 +08:00
|
|
|
/*
|
|
|
|
* Update the notify objects for these types (if present)
|
|
|
|
* Two lists, system and device notify handlers.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
|
|
|
|
prev_object =
|
|
|
|
object->common_notify.notify_list[i];
|
|
|
|
while (prev_object) {
|
|
|
|
next_object =
|
|
|
|
prev_object->notify.next[i];
|
|
|
|
acpi_ut_update_ref_count(prev_object,
|
|
|
|
action);
|
|
|
|
prev_object = next_object;
|
|
|
|
}
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_PACKAGE:
|
|
|
|
/*
|
2005-07-08 12:00:00 +08:00
|
|
|
* We must update all the sub-objects of the package,
|
|
|
|
* each of whom may have their own sub-objects.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
for (i = 0; i < object->package.count; i++) {
|
|
|
|
/*
|
2012-12-19 13:37:53 +08:00
|
|
|
* Null package elements are legal and can be simply
|
|
|
|
* ignored.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2012-12-19 13:37:53 +08:00
|
|
|
next_object = object->package.elements[i];
|
|
|
|
if (!next_object) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (next_object->common.type) {
|
|
|
|
case ACPI_TYPE_INTEGER:
|
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
/*
|
|
|
|
* For these very simple sub-objects, we can just
|
|
|
|
* update the reference count here and continue.
|
|
|
|
* Greatly increases performance of this operation.
|
|
|
|
*/
|
|
|
|
acpi_ut_update_ref_count(next_object,
|
|
|
|
action);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* For complex sub-objects, push them onto the stack
|
|
|
|
* for later processing (this eliminates recursion.)
|
|
|
|
*/
|
|
|
|
status =
|
|
|
|
acpi_ut_create_update_state_and_push
|
|
|
|
(next_object, action, &state_list);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
2012-12-19 13:37:53 +08:00
|
|
|
next_object = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
|
|
|
|
2005-07-08 12:00:00 +08:00
|
|
|
next_object = object->buffer_field.buffer_obj;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
|
|
|
|
2005-07-08 12:00:00 +08:00
|
|
|
next_object = object->field.region_obj;
|
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
|
|
|
|
2005-07-08 12:00:00 +08:00
|
|
|
next_object = object->bank_field.bank_obj;
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ut_create_update_state_and_push(object->
|
|
|
|
bank_field.
|
|
|
|
region_obj,
|
|
|
|
action,
|
|
|
|
&state_list);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
|
|
|
|
2005-07-08 12:00:00 +08:00
|
|
|
next_object = object->index_field.index_obj;
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ut_create_update_state_and_push(object->
|
|
|
|
index_field.
|
|
|
|
data_obj,
|
|
|
|
action,
|
|
|
|
&state_list);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
|
|
|
/*
|
2008-04-10 23:06:39 +08:00
|
|
|
* The target of an Index (a package, string, or buffer) or a named
|
|
|
|
* reference must track changes to the ref count of the index or
|
|
|
|
* target object.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2008-09-27 11:08:41 +08:00
|
|
|
if ((object->reference.class == ACPI_REFCLASS_INDEX) ||
|
|
|
|
(object->reference.class == ACPI_REFCLASS_NAME)) {
|
2005-07-08 12:00:00 +08:00
|
|
|
next_object = object->reference.object;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_REGION:
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2006-05-27 04:36:00 +08:00
|
|
|
break; /* No subobjects for all other types */
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2006-05-27 04:36:00 +08:00
|
|
|
* Now we can update the count in the main object. This can only
|
2005-04-17 06:20:36 +08:00
|
|
|
* happen after we update the sub-objects in case this causes the
|
|
|
|
* main object to be deleted.
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_update_ref_count(object, action);
|
2005-07-08 12:00:00 +08:00
|
|
|
object = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Move on to the next object to be updated */
|
|
|
|
|
2005-07-08 12:00:00 +08:00
|
|
|
if (next_object) {
|
|
|
|
object = next_object;
|
|
|
|
next_object = NULL;
|
2005-08-05 12:44:28 +08:00
|
|
|
} else if (state_list) {
|
|
|
|
state = acpi_ut_pop_generic_state(&state_list);
|
2005-07-08 12:00:00 +08:00
|
|
|
object = state->update.object;
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_delete_generic_state(state);
|
2005-07-08 12:00:00 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-12-19 13:37:59 +08:00
|
|
|
return (AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-10-29 09:30:02 +08:00
|
|
|
error_exit:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Could not update object reference count"));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-09-27 11:29:57 +08:00
|
|
|
/* Free any stacked Update State objects */
|
|
|
|
|
|
|
|
while (state_list) {
|
|
|
|
state = acpi_ut_pop_generic_state(&state_list);
|
|
|
|
acpi_ut_delete_generic_state(state);
|
|
|
|
}
|
|
|
|
|
2012-12-19 13:37:59 +08:00
|
|
|
return (status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_add_reference
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: object - Object whose reference count is to be
|
2005-04-19 10:49:35 +08:00
|
|
|
* incremented
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Add one reference to an ACPI object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
void acpi_ut_add_reference(union acpi_operand_object *object)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
|
2012-12-19 13:37:59 +08:00
|
|
|
ACPI_FUNCTION_NAME(ut_add_reference);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Ensure that we have a valid object */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (!acpi_ut_valid_internal_object(object)) {
|
2012-12-19 13:37:59 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Current Refs=%X [To Be Incremented]\n",
|
|
|
|
object, object->common.reference_count));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Increment the reference count */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
(void)acpi_ut_update_object_reference(object, REF_INCREMENT);
|
2012-12-19 13:37:59 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_remove_reference
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: object - Object whose ref count will be decremented
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Decrement the reference count of an ACPI internal object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
void acpi_ut_remove_reference(union acpi_operand_object *object)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
|
2012-12-19 13:37:59 +08:00
|
|
|
ACPI_FUNCTION_NAME(ut_remove_reference);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2006-05-27 04:36:00 +08:00
|
|
|
* Allow a NULL pointer to be passed in, just ignore it. This saves
|
|
|
|
* each caller from having to check. Also, ignore NS nodes.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
if (!object ||
|
2005-08-05 12:44:28 +08:00
|
|
|
(ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) {
|
2012-12-19 13:37:59 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure that we have a valid object */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (!acpi_ut_valid_internal_object(object)) {
|
2012-12-19 13:37:59 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Current Refs=%X [To Be Decremented]\n",
|
|
|
|
object, object->common.reference_count));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Decrement the reference count, and only actually delete the object
|
2006-05-27 04:36:00 +08:00
|
|
|
* if the reference count becomes 0. (Must also decrement the ref count
|
2005-04-17 06:20:36 +08:00
|
|
|
* of all subobjects!)
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
(void)acpi_ut_update_object_reference(object, REF_DECREMENT);
|
2012-12-19 13:37:59 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|