2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: utdelete - object deletion and reference count utilities
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2011-01-17 10:05:40 +07:00
|
|
|
* Copyright (C) 2000 - 2011, Intel Corp.
|
2005-04-17 05:20:36 +07: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 12:30:03 +07:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acinterp.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "acevents.h"
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_UTILITIES
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_MODULE_NAME("utdelete")
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-04-19 09:49:35 +07:00
|
|
|
/* Local prototypes */
|
2005-08-05 11:44:28 +07:00
|
|
|
static void acpi_ut_delete_internal_obj(union acpi_operand_object *object);
|
2005-04-19 09:49:35 +07:00
|
|
|
|
|
|
|
static void
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_delete_internal_obj
|
|
|
|
*
|
2005-04-19 09:49:35 +07:00
|
|
|
* PARAMETERS: Object - Object to be deleted
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Low level object deletion, after reference counts have been
|
|
|
|
* updated (All reference counts, including sub-objects!)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
void *obj_pointer = NULL;
|
|
|
|
union acpi_operand_object *handler_desc;
|
|
|
|
union acpi_operand_object *second_desc;
|
|
|
|
union acpi_operand_object *next_desc;
|
2009-05-21 10:03:29 +07:00
|
|
|
union acpi_operand_object **last_obj_ptr;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object);
|
2005-04-17 05:20:36 +07: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 13:44:03 +07:00
|
|
|
switch (object->common.type) {
|
2005-04-17 05:20:36 +07:00
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"**** String %p, ptr %p\n", object,
|
|
|
|
object->string.pointer));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Free the actual string buffer */
|
|
|
|
|
|
|
|
if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
|
2006-10-02 11:00:00 +07:00
|
|
|
|
2005-04-17 05:20:36 +07: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 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"**** Buffer %p, ptr %p\n", object,
|
|
|
|
object->buffer.pointer));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Free the actual buffer */
|
|
|
|
|
|
|
|
if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
|
2006-10-02 11:00:00 +07:00
|
|
|
|
2005-04-17 05:20:36 +07: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 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
" **** Package of count %X\n",
|
|
|
|
object->package.count));
|
2005-04-17 05:20:36 +07: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 09:41:41 +07:00
|
|
|
/*
|
|
|
|
* These objects have a possible list of notify handlers.
|
|
|
|
* Device object also may have a GPE block.
|
|
|
|
*/
|
2005-04-17 05:20:36 +07:00
|
|
|
case ACPI_TYPE_DEVICE:
|
|
|
|
|
|
|
|
if (object->device.gpe_block) {
|
2005-08-05 11:44:28 +07:00
|
|
|
(void)acpi_ev_delete_gpe_block(object->device.
|
|
|
|
gpe_block);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2008-07-04 09:41:41 +07:00
|
|
|
/*lint -fallthrough */
|
|
|
|
|
|
|
|
case ACPI_TYPE_PROCESSOR:
|
|
|
|
case ACPI_TYPE_THERMAL:
|
|
|
|
|
|
|
|
/* Walk the notify handler list for this object */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-07-04 09:41:41 +07:00
|
|
|
handler_desc = object->common_notify.handler;
|
2005-04-17 05:20:36 +07:00
|
|
|
while (handler_desc) {
|
|
|
|
next_desc = handler_desc->address_space.next;
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_remove_reference(handler_desc);
|
2005-04-17 05:20:36 +07:00
|
|
|
handler_desc = next_desc;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_MUTEX:
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
2006-06-24 04:04:00 +07:00
|
|
|
"***** Mutex %p, OS Mutex %p\n",
|
|
|
|
object, object->mutex.os_mutex));
|
|
|
|
|
2008-04-10 22:06:37 +07:00
|
|
|
if (object == acpi_gbl_global_lock_mutex) {
|
2007-02-02 23:48:18 +07:00
|
|
|
|
|
|
|
/* Global Lock has extra semaphore */
|
2006-06-24 04:04:00 +07:00
|
|
|
|
|
|
|
(void)
|
|
|
|
acpi_os_delete_semaphore
|
|
|
|
(acpi_gbl_global_lock_semaphore);
|
|
|
|
acpi_gbl_global_lock_semaphore = NULL;
|
2007-02-02 23:48:18 +07:00
|
|
|
|
|
|
|
acpi_os_delete_mutex(object->mutex.os_mutex);
|
|
|
|
acpi_gbl_global_lock_mutex = NULL;
|
|
|
|
} else {
|
2007-05-10 10:01:59 +07:00
|
|
|
acpi_ex_unlink_mutex(object);
|
2007-02-02 23:48:18 +07:00
|
|
|
acpi_os_delete_mutex(object->mutex.os_mutex);
|
2006-06-24 04:04:00 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_EVENT:
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
2006-06-24 04:04:00 +07:00
|
|
|
"***** Event %p, OS Semaphore %p\n",
|
|
|
|
object, object->event.os_semaphore));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-06-24 04:04:00 +07:00
|
|
|
(void)acpi_os_delete_semaphore(object->event.os_semaphore);
|
|
|
|
object->event.os_semaphore = NULL;
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_METHOD:
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"***** Method %p\n", object));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-06-24 04:04:00 +07:00
|
|
|
/* Delete the method mutex if it exists */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-06-24 04:04:00 +07: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 05:20:36 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_REGION:
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"***** Region %p\n", object));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
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 09:43:27 +07:00
|
|
|
/* Invalidate the region address/length via the host OS */
|
|
|
|
|
|
|
|
acpi_os_invalidate_address(object->region.space_id,
|
|
|
|
object->region.address,
|
|
|
|
(acpi_size) object->region.length);
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
second_desc = acpi_ns_get_secondary_object(object);
|
2005-04-17 05:20:36 +07: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 10:03:29 +07:00
|
|
|
next_desc =
|
|
|
|
handler_desc->address_space.region_list;
|
|
|
|
last_obj_ptr =
|
|
|
|
&handler_desc->address_space.region_list;
|
|
|
|
|
|
|
|
/* Remove the region object from the handler's list */
|
|
|
|
|
|
|
|
while (next_desc) {
|
|
|
|
if (next_desc == object) {
|
|
|
|
*last_obj_ptr =
|
|
|
|
next_desc->region.next;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Walk the linked list of handler */
|
|
|
|
|
|
|
|
last_obj_ptr = &next_desc->region.next;
|
|
|
|
next_desc = next_desc->region.next;
|
|
|
|
}
|
|
|
|
|
2006-03-18 04:44:00 +07:00
|
|
|
if (handler_desc->address_space.handler_flags &
|
2005-08-05 11:44:28 +07: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 12:00:00 +07: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 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_remove_reference(handler_desc);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now we can free the Extra object */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_delete_object_desc(second_desc);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"***** Buffer Field %p\n", object));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
second_desc = acpi_ns_get_secondary_object(object);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (second_desc) {
|
2008-04-10 22:06:41 +07: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 11:44:28 +07:00
|
|
|
acpi_ut_delete_object_desc(second_desc);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free any allocated memory (pointer within the object) found above */
|
|
|
|
|
|
|
|
if (obj_pointer) {
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Deleting Object Subptr %p\n", obj_pointer));
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_FREE(obj_pointer);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now the object can be safely deleted */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
|
|
|
|
object, acpi_ut_get_object_type_name(object)));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_delete_object_desc(object);
|
2005-04-17 05:20:36 +07:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_delete_internal_object_list
|
|
|
|
*
|
2005-04-19 09:49:35 +07:00
|
|
|
* PARAMETERS: obj_list - Pointer to the list to be deleted
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: This function deletes an internal object list, including both
|
|
|
|
* simple objects and package objects
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
union acpi_operand_object **internal_obj;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(ut_delete_internal_object_list);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Walk the null-terminated internal list */
|
|
|
|
|
|
|
|
for (internal_obj = obj_list; *internal_obj; internal_obj++) {
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_remove_reference(*internal_obj);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Free the combined parameter pointer list and object array */
|
|
|
|
|
2006-10-03 11:00:00 +07:00
|
|
|
ACPI_FREE(obj_list);
|
2005-04-17 05:20:36 +07:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_update_ref_count
|
|
|
|
*
|
2005-04-19 09:49:35 +07:00
|
|
|
* PARAMETERS: Object - Object whose ref count is to be updated
|
2005-04-17 05:20:36 +07:00
|
|
|
* Action - What to do
|
|
|
|
*
|
|
|
|
* RETURN: New ref count
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Modify the ref count and return it.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static void
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
u16 count;
|
|
|
|
u16 new_count;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_NAME(ut_update_ref_count);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
if (!object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
count = object->common.reference_count;
|
|
|
|
new_count = count;
|
|
|
|
|
|
|
|
/*
|
2006-05-27 03:36:00 +07:00
|
|
|
* Perform the reference count action (increment, decrement, force delete)
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
switch (action) {
|
|
|
|
case REF_INCREMENT:
|
|
|
|
|
|
|
|
new_count++;
|
|
|
|
object->common.reference_count = new_count;
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Refs=%X, [Incremented]\n",
|
|
|
|
object, new_count));
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case REF_DECREMENT:
|
|
|
|
|
|
|
|
if (count < 1) {
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Refs=%X, can't decrement! (Set to 0)\n",
|
|
|
|
object, new_count));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
new_count = 0;
|
2005-08-05 11:44:28 +07:00
|
|
|
} else {
|
2005-04-17 05:20:36 +07:00
|
|
|
new_count--;
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Refs=%X, [Decremented]\n",
|
|
|
|
object, new_count));
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2009-02-18 13:44:03 +07:00
|
|
|
if (object->common.type == ACPI_TYPE_METHOD) {
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Method Obj %p Refs=%X, [Decremented]\n",
|
|
|
|
object, new_count));
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
object->common.reference_count = new_count;
|
|
|
|
if (new_count == 0) {
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_delete_internal_obj(object);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REF_FORCE_DELETE:
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Refs=%X, Force delete! (Set to 0)\n",
|
|
|
|
object, count));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
new_count = 0;
|
|
|
|
object->common.reference_count = new_count;
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_delete_internal_obj(object);
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2010-03-05 16:56:40 +07:00
|
|
|
ACPI_ERROR((AE_INFO, "Unknown action (0x%X)", action));
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sanity check the reference count, for debug purposes only.
|
|
|
|
* (A deleted object will have a huge reference count)
|
|
|
|
*/
|
|
|
|
if (count > ACPI_MAX_REFERENCE_COUNT) {
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_WARNING((AE_INFO,
|
2010-03-05 16:56:40 +07:00
|
|
|
"Large Reference Count (0x%X) in object %p",
|
|
|
|
count, object));
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_update_object_reference
|
|
|
|
*
|
2005-04-19 09:49:35 +07:00
|
|
|
* PARAMETERS: Object - Increment ref count for this object
|
2005-04-17 05:20:36 +07:00
|
|
|
* and all sub-objects
|
|
|
|
* Action - Either REF_INCREMENT or REF_DECREMENT or
|
|
|
|
* REF_FORCE_DELETE
|
|
|
|
*
|
|
|
|
* 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 03:36:00 +07:00
|
|
|
acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
union acpi_generic_state *state_list = NULL;
|
|
|
|
union acpi_operand_object *next_object = NULL;
|
|
|
|
union acpi_generic_state *state;
|
2008-06-10 12:42:13 +07:00
|
|
|
u32 i;
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-07-08 11:00:00 +07:00
|
|
|
while (object) {
|
2006-10-02 11:00:00 +07:00
|
|
|
|
2005-07-08 11:00:00 +07:00
|
|
|
/* Make sure that this isn't a namespace handle */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Object %p is NS handle\n", object));
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-07-08 11:00:00 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* All sub-objects must have their reference count incremented also.
|
|
|
|
* Different object types have different subobjects.
|
|
|
|
*/
|
2009-02-18 13:44:03 +07:00
|
|
|
switch (object->common.type) {
|
2005-04-17 05:20:36 +07:00
|
|
|
case ACPI_TYPE_DEVICE:
|
2006-07-08 07:44:38 +07:00
|
|
|
case ACPI_TYPE_PROCESSOR:
|
|
|
|
case ACPI_TYPE_POWER:
|
|
|
|
case ACPI_TYPE_THERMAL:
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-07-08 07:44:38 +07:00
|
|
|
/* Update the notify objects for these types (if present) */
|
|
|
|
|
|
|
|
acpi_ut_update_ref_count(object->common_notify.
|
|
|
|
system_notify, action);
|
|
|
|
acpi_ut_update_ref_count(object->common_notify.
|
|
|
|
device_notify, action);
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_PACKAGE:
|
|
|
|
/*
|
2005-07-08 11:00:00 +07:00
|
|
|
* We must update all the sub-objects of the package,
|
|
|
|
* each of whom may have their own sub-objects.
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
for (i = 0; i < object->package.count; i++) {
|
|
|
|
/*
|
|
|
|
* Push each element onto the stack for later processing.
|
|
|
|
* Note: There can be null elements within the package,
|
|
|
|
* these are simply ignored
|
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
|
|
|
acpi_ut_create_update_state_and_push
|
|
|
|
(object->package.elements[i], action,
|
|
|
|
&state_list);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
|
|
|
|
2005-07-08 11:00:00 +07:00
|
|
|
next_object = object->buffer_field.buffer_obj;
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
|
|
|
|
2005-07-08 11:00:00 +07:00
|
|
|
next_object = object->field.region_obj;
|
|
|
|
break;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
|
|
|
|
2005-07-08 11:00:00 +07:00
|
|
|
next_object = object->bank_field.bank_obj;
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
|
|
|
acpi_ut_create_update_state_and_push(object->
|
|
|
|
bank_field.
|
|
|
|
region_obj,
|
|
|
|
action,
|
|
|
|
&state_list);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
|
|
|
|
2005-07-08 11:00:00 +07:00
|
|
|
next_object = object->index_field.index_obj;
|
2005-08-05 11:44:28 +07:00
|
|
|
status =
|
|
|
|
acpi_ut_create_update_state_and_push(object->
|
|
|
|
index_field.
|
|
|
|
data_obj,
|
|
|
|
action,
|
|
|
|
&state_list);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
|
|
|
/*
|
2008-04-10 22:06:39 +07: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 05:20:36 +07:00
|
|
|
*/
|
2008-09-27 10:08:41 +07:00
|
|
|
if ((object->reference.class == ACPI_REFCLASS_INDEX) ||
|
|
|
|
(object->reference.class == ACPI_REFCLASS_NAME)) {
|
2005-07-08 11:00:00 +07:00
|
|
|
next_object = object->reference.object;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_REGION:
|
|
|
|
default:
|
2006-05-27 03:36:00 +07:00
|
|
|
break; /* No subobjects for all other types */
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2006-05-27 03:36:00 +07:00
|
|
|
* Now we can update the count in the main object. This can only
|
2005-04-17 05:20:36 +07:00
|
|
|
* happen after we update the sub-objects in case this causes the
|
|
|
|
* main object to be deleted.
|
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_update_ref_count(object, action);
|
2005-07-08 11:00:00 +07:00
|
|
|
object = NULL;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Move on to the next object to be updated */
|
|
|
|
|
2005-07-08 11:00:00 +07:00
|
|
|
if (next_object) {
|
|
|
|
object = next_object;
|
|
|
|
next_object = NULL;
|
2005-08-05 11:44:28 +07:00
|
|
|
} else if (state_list) {
|
|
|
|
state = acpi_ut_pop_generic_state(&state_list);
|
2005-07-08 11:00:00 +07:00
|
|
|
object = state->update.object;
|
2005-08-05 11:44:28 +07:00
|
|
|
acpi_ut_delete_generic_state(state);
|
2005-07-08 11:00:00 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
error_exit:
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
|
|
"Could not update object reference count"));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-09-27 10:29:57 +07:00
|
|
|
/* Free any stacked Update State objects */
|
|
|
|
|
|
|
|
while (state_list) {
|
|
|
|
state = acpi_ut_pop_generic_state(&state_list);
|
|
|
|
acpi_ut_delete_generic_state(state);
|
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_add_reference
|
|
|
|
*
|
2005-04-19 09:49:35 +07:00
|
|
|
* PARAMETERS: Object - Object whose reference count is to be
|
|
|
|
* incremented
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Add one reference to an ACPI object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
void acpi_ut_add_reference(union acpi_operand_object *object)
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Ensure that we have a valid object */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
if (!acpi_ut_valid_internal_object(object)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Current Refs=%X [To Be Incremented]\n",
|
|
|
|
object, object->common.reference_count));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Increment the reference count */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
(void)acpi_ut_update_object_reference(object, REF_INCREMENT);
|
2005-04-17 05:20:36 +07:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_remove_reference
|
|
|
|
*
|
2005-04-19 09:49:35 +07:00
|
|
|
* PARAMETERS: Object - Object whose ref count will be decremented
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Decrement the reference count of an ACPI internal object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
void acpi_ut_remove_reference(union acpi_operand_object *object)
|
2005-04-17 05:20:36 +07: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 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
2006-05-27 03:36:00 +07: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 05:20:36 +07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
if (!object ||
|
2005-08-05 11:44:28 +07:00
|
|
|
(ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure that we have a valid object */
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
if (!acpi_ut_valid_internal_object(object)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
|
|
|
"Obj %p Current Refs=%X [To Be Decremented]\n",
|
|
|
|
object, object->common.reference_count));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Decrement the reference count, and only actually delete the object
|
2006-05-27 03:36:00 +07:00
|
|
|
* if the reference count becomes 0. (Must also decrement the ref count
|
2005-04-17 05:20:36 +07:00
|
|
|
* of all subobjects!)
|
|
|
|
*/
|
2005-08-05 11:44:28 +07:00
|
|
|
(void)acpi_ut_update_object_reference(object, REF_DECREMENT);
|
2005-04-17 05:20:36 +07:00
|
|
|
return_VOID;
|
|
|
|
}
|