2005-04-16 16:20:36 -06:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: utobject - ACPI object create/delete/size/cache routines
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2006-01-13 14:22:00 -07:00
|
|
|
* Copyright (C) 2000 - 2006, R. Byron Moore
|
2005-04-16 16:20:36 -06: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>
|
|
|
|
#include <acpi/acnamesp.h>
|
|
|
|
#include <acpi/amlcode.h>
|
|
|
|
|
|
|
|
#define _COMPONENT ACPI_UTILITIES
|
2005-08-04 22:44:28 -06:00
|
|
|
ACPI_MODULE_NAME("utobject")
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
/* Local prototypes */
|
|
|
|
static acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_get_simple_object_size(union acpi_operand_object *obj,
|
|
|
|
acpi_size * obj_length);
|
2005-04-18 20:49:35 -06:00
|
|
|
|
|
|
|
static acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_get_package_object_size(union acpi_operand_object *obj,
|
|
|
|
acpi_size * obj_length);
|
2005-04-18 20:49:35 -06:00
|
|
|
|
|
|
|
static acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_get_element_length(u8 object_type,
|
|
|
|
union acpi_operand_object *source_object,
|
|
|
|
union acpi_generic_state *state, void *context);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_create_internal_object_dbg
|
|
|
|
*
|
|
|
|
* PARAMETERS: module_name - Source file name of caller
|
|
|
|
* line_number - Line number of caller
|
|
|
|
* component_id - Component type of caller
|
|
|
|
* Type - ACPI Type of the new object
|
|
|
|
*
|
2005-04-18 20:49:35 -06:00
|
|
|
* RETURN: A new internal object, null on failure
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Create and initialize a new internal object.
|
|
|
|
*
|
|
|
|
* NOTE: We always allocate the worst-case object descriptor because
|
|
|
|
* these objects are cached, and we want them to be
|
|
|
|
* one-size-satisifies-any-request. This in itself may not be
|
|
|
|
* the most memory efficient, but the efficiency of the object
|
|
|
|
* cache should more than make up for this!
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
|
|
|
|
u32 line_number,
|
|
|
|
u32 component_id,
|
|
|
|
acpi_object_type
|
|
|
|
type)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
union acpi_operand_object *object;
|
|
|
|
union acpi_operand_object *second_object;
|
2005-04-16 16:20:36 -06: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-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg,
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_get_type_name(type));
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Allocate the raw object descriptor */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
object =
|
|
|
|
acpi_ut_allocate_object_desc_dbg(module_name, line_number,
|
|
|
|
component_id);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!object) {
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(NULL);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case ACPI_TYPE_REGION:
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
|
|
|
|
|
|
|
/* These types require a secondary object */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
second_object = acpi_ut_allocate_object_desc_dbg(module_name,
|
|
|
|
line_number,
|
|
|
|
component_id);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!second_object) {
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_delete_object_desc(object);
|
|
|
|
return_PTR(NULL);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
second_object->common.type = ACPI_TYPE_LOCAL_EXTRA;
|
|
|
|
second_object->common.reference_count = 1;
|
|
|
|
|
|
|
|
/* Link the second object to the first */
|
|
|
|
|
|
|
|
object->common.next_object = second_object;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* All others have no secondary object */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Save the object type in the object descriptor */
|
|
|
|
|
|
|
|
object->common.type = (u8) type;
|
|
|
|
|
|
|
|
/* Init the reference count */
|
|
|
|
|
|
|
|
object->common.reference_count = 1;
|
|
|
|
|
|
|
|
/* Any per-type initialization should go here */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(object);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_create_buffer_object
|
|
|
|
*
|
|
|
|
* PARAMETERS: buffer_size - Size of buffer to be created
|
|
|
|
*
|
2005-04-18 20:49:35 -06:00
|
|
|
* RETURN: Pointer to a new Buffer object, null on failure
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a fully initialized buffer object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
union acpi_operand_object *buffer_desc;
|
|
|
|
u8 *buffer = NULL;
|
2005-04-16 16:20:36 -06: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-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Create a new Buffer object */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!buffer_desc) {
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(NULL);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create an actual buffer only if size > 0 */
|
|
|
|
|
|
|
|
if (buffer_size > 0) {
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/* Allocate the actual buffer */
|
|
|
|
|
2006-10-02 22:00:00 -06:00
|
|
|
buffer = ACPI_ALLOCATE_ZEROED(buffer_size);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!buffer) {
|
2006-01-27 14:43:00 -07:00
|
|
|
ACPI_ERROR((AE_INFO, "Could not allocate size %X",
|
|
|
|
(u32) buffer_size));
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_remove_reference(buffer_desc);
|
|
|
|
return_PTR(NULL);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Complete buffer object initialization */
|
|
|
|
|
|
|
|
buffer_desc->buffer.flags |= AOPOBJ_DATA_VALID;
|
|
|
|
buffer_desc->buffer.pointer = buffer;
|
|
|
|
buffer_desc->buffer.length = (u32) buffer_size;
|
|
|
|
|
|
|
|
/* Return the new buffer descriptor */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(buffer_desc);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_create_string_object
|
|
|
|
*
|
2005-04-18 20:49:35 -06:00
|
|
|
* PARAMETERS: string_size - Size of string to be created. Does not
|
|
|
|
* include NULL terminator, this is added
|
|
|
|
* automatically.
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
* RETURN: Pointer to a new String object
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a fully initialized string object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
union acpi_operand_object *string_desc;
|
|
|
|
char *string;
|
2005-04-16 16:20:36 -06: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-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Create a new String object */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
string_desc = acpi_ut_create_internal_object(ACPI_TYPE_STRING);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!string_desc) {
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(NULL);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate the actual string buffer -- (Size + 1) for NULL terminator.
|
|
|
|
* NOTE: Zero-length strings are NULL terminated
|
|
|
|
*/
|
2006-10-02 22:00:00 -06:00
|
|
|
string = ACPI_ALLOCATE_ZEROED(string_size + 1);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!string) {
|
2006-01-27 14:43:00 -07:00
|
|
|
ACPI_ERROR((AE_INFO, "Could not allocate size %X",
|
|
|
|
(u32) string_size));
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_remove_reference(string_desc);
|
|
|
|
return_PTR(NULL);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Complete string object initialization */
|
|
|
|
|
|
|
|
string_desc->string.pointer = string;
|
|
|
|
string_desc->string.length = (u32) string_size;
|
|
|
|
|
|
|
|
/* Return the new string descriptor */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(string_desc);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_valid_internal_object
|
|
|
|
*
|
|
|
|
* PARAMETERS: Object - Object to be validated
|
|
|
|
*
|
2005-04-18 20:49:35 -06:00
|
|
|
* RETURN: TRUE if object is valid, FALSE otherwise
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Validate a pointer to be an union acpi_operand_object
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
u8 acpi_ut_valid_internal_object(void *object)
|
2005-04-16 16:20:36 -06: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-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_NAME(ut_valid_internal_object);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Check for a null pointer */
|
|
|
|
|
|
|
|
if (!object) {
|
2005-08-04 22:44:28 -06:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Null Object Ptr\n"));
|
2005-04-16 16:20:36 -06:00
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check the descriptor type field */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
switch (ACPI_GET_DESCRIPTOR_TYPE(object)) {
|
2005-04-16 16:20:36 -06:00
|
|
|
case ACPI_DESC_TYPE_OPERAND:
|
|
|
|
|
|
|
|
/* The object appears to be a valid union acpi_operand_object */
|
|
|
|
|
|
|
|
return (TRUE);
|
|
|
|
|
|
|
|
default:
|
2005-08-04 22:44:28 -06:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
|
|
"%p is not not an ACPI operand obj [%s]\n",
|
|
|
|
object, acpi_ut_get_descriptor_name(object)));
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_allocate_object_desc_dbg
|
|
|
|
*
|
|
|
|
* PARAMETERS: module_name - Caller's module name (for error output)
|
|
|
|
* line_number - Caller's line number (for error output)
|
|
|
|
* component_id - Caller's component ID (for error output)
|
|
|
|
*
|
|
|
|
* RETURN: Pointer to newly allocated object descriptor. Null on error
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Allocate a new object descriptor. Gracefully handle
|
|
|
|
* error conditions.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
void *acpi_ut_allocate_object_desc_dbg(char *module_name,
|
|
|
|
u32 line_number, u32 component_id)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
union acpi_operand_object *object;
|
2005-04-16 16:20:36 -06: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-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
object = acpi_os_acquire_object(acpi_gbl_operand_cache);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!object) {
|
2006-01-27 14:43:00 -07:00
|
|
|
ACPI_ERROR((module_name, line_number,
|
|
|
|
"Could not allocate an object descriptor"));
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(NULL);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Mark the descriptor type */
|
2006-10-02 22:00:00 -06:00
|
|
|
|
ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>
ACPICA 20050617:
Moved the object cache operations into the OS interface
layer (OSL) to allow the host OS to handle these operations
if desired (for example, the Linux OSL will invoke the
slab allocator). This support is optional; the compile
time define ACPI_USE_LOCAL_CACHE may be used to utilize
the original cache code in the ACPI CA core. The new OSL
interfaces are shown below. See utalloc.c for an example
implementation, and acpiosxf.h for the exact interface
definitions. Thanks to Alexey Starikovskiy.
acpi_os_create_cache
acpi_os_delete_cache
acpi_os_purge_cache
acpi_os_acquire_object
acpi_os_release_object
Modified the interfaces to acpi_os_acquire_lock and
acpi_os_release_lock to return and restore a flags
parameter. This fits better with many OS lock models.
Note: the current execution state (interrupt handler
or not) is no longer passed to these interfaces. If
necessary, the OSL must determine this state by itself, a
simple and fast operation. Thanks to Alexey Starikovskiy.
Fixed a problem in the ACPI table handling where a valid
XSDT was assumed present if the revision of the RSDP
was 2 or greater. According to the ACPI specification,
the XSDT is optional in all cases, and the table manager
therefore now checks for both an RSDP >=2 and a valid
XSDT pointer. Otherwise, the RSDT pointer is used.
Some ACPI 2.0 compliant BIOSs contain only the RSDT.
Fixed an interpreter problem with the Mid() operator in the
case of an input string where the resulting output string
is of zero length. It now correctly returns a valid,
null terminated string object instead of a string object
with a null pointer.
Fixed a problem with the control method argument handling
to allow a store to an Arg object that already contains an
object of type Device. The Device object is now correctly
overwritten. Previously, an error was returned.
ACPICA 20050624:
Modified the new OSL cache interfaces to use ACPI_CACHE_T
as the type for the host-defined cache object. This allows
the OSL implementation to define and type this object in
any manner desired, simplifying the OSL implementation.
For example, ACPI_CACHE_T is defined as kmem_cache_t for
Linux, and should be defined in the OS-specific header
file for other operating systems as required.
Changed the interface to AcpiOsAcquireObject to directly
return the requested object as the function return (instead
of ACPI_STATUS.) This change was made for performance
reasons, since this is the purpose of the interface in the
first place. acpi_os_acquire_object is now similar to the
acpi_os_allocate interface. Thanks to Alexey Starikovskiy.
Modified the initialization sequence in
acpi_initialize_subsystem to call the OSL interface
acpi_osl_initialize first, before any local initialization.
This change was required because the global initialization
now calls OSL interfaces.
Restructured the code base to split some files because
of size and/or because the code logically belonged in a
separate file. New files are listed below.
utilities/utcache.c /* Local cache interfaces */
utilities/utmutex.c /* Local mutex support */
utilities/utstate.c /* State object support */
parser/psloop.c /* Main AML parse loop */
Signed-off-by: Len Brown <len.brown@intel.com>
2005-06-23 22:00:00 -06:00
|
|
|
memset(object, 0, sizeof(union acpi_operand_object));
|
2005-08-04 22:44:28 -06:00
|
|
|
ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
|
|
|
|
object, (u32) sizeof(union acpi_operand_object)));
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(object);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_delete_object_desc
|
|
|
|
*
|
|
|
|
* PARAMETERS: Object - An Acpi internal object to be deleted
|
|
|
|
*
|
|
|
|
* RETURN: None.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Free an ACPI object descriptor or add it to the object cache
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
void acpi_ut_delete_object_desc(union acpi_operand_object *object)
|
2005-04-16 16:20:36 -06: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-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Object must be an union acpi_operand_object */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
|
2006-01-27 14:43:00 -07:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"%p is not an ACPI Operand object [%s]", object,
|
|
|
|
acpi_ut_get_descriptor_name(object)));
|
2005-04-16 16:20:36 -06:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
(void)acpi_os_release_object(acpi_gbl_operand_cache, object);
|
2005-04-16 16:20:36 -06:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_get_simple_object_size
|
|
|
|
*
|
2005-04-18 20:49:35 -06:00
|
|
|
* PARAMETERS: internal_object - An ACPI operand object
|
|
|
|
* obj_length - Where the length is returned
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: This function is called to determine the space required to
|
|
|
|
* contain a simple object for return to an external user.
|
|
|
|
*
|
|
|
|
* The length includes the object structure plus any additional
|
|
|
|
* needed space.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
static acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
|
|
|
|
acpi_size * obj_length)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_size length;
|
|
|
|
acpi_status status = AE_OK;
|
2005-04-16 16:20:36 -06: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-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
/*
|
|
|
|
* Handle a null object (Could be a uninitialized package
|
|
|
|
* element -- which is legal)
|
|
|
|
*/
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!internal_object) {
|
|
|
|
*obj_length = 0;
|
2005-08-04 22:44:28 -06:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Start with the length of the Acpi object */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
length = sizeof(union acpi_object);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/* Object is a named object (reference), just return the length */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
*obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The final length depends on the object type
|
|
|
|
* Strings and Buffers are packed right up against the parent object and
|
|
|
|
* must be accessed bytewise or there may be alignment problems on
|
|
|
|
* certain processors
|
|
|
|
*/
|
2005-08-04 22:44:28 -06:00
|
|
|
switch (ACPI_GET_OBJECT_TYPE(internal_object)) {
|
2005-04-16 16:20:36 -06:00
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
|
|
|
|
length += (acpi_size) internal_object->string.length + 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
|
|
|
length += (acpi_size) internal_object->buffer.length;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_INTEGER:
|
|
|
|
case ACPI_TYPE_PROCESSOR:
|
|
|
|
case ACPI_TYPE_POWER:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* No extra data for these types
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
|
|
|
|
|
|
|
switch (internal_object->reference.opcode) {
|
|
|
|
case AML_INT_NAMEPATH_OP:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the actual length of the full pathname to this object.
|
|
|
|
* The reference will be converted to the pathname to the object
|
|
|
|
*/
|
2005-08-04 22:44:28 -06:00
|
|
|
length +=
|
|
|
|
ACPI_ROUND_UP_TO_NATIVE_WORD
|
|
|
|
(acpi_ns_get_pathname_length
|
|
|
|
(internal_object->reference.node));
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* No other reference opcodes are supported.
|
|
|
|
* Notably, Locals and Args are not supported, but this may be
|
|
|
|
* required eventually.
|
|
|
|
*/
|
2006-01-27 14:43:00 -07:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Unsupported Reference opcode=%X in object %p",
|
|
|
|
internal_object->reference.opcode,
|
|
|
|
internal_object));
|
2005-04-16 16:20:36 -06:00
|
|
|
status = AE_TYPE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2006-01-27 14:43:00 -07:00
|
|
|
ACPI_ERROR((AE_INFO, "Unsupported type=%X in object %p",
|
|
|
|
ACPI_GET_OBJECT_TYPE(internal_object),
|
|
|
|
internal_object));
|
2005-04-16 16:20:36 -06:00
|
|
|
status = AE_TYPE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Account for the space required by the object rounded up to the next
|
|
|
|
* multiple of the machine word size. This keeps each object aligned
|
|
|
|
* on a machine word boundary. (preventing alignment faults on some
|
|
|
|
* machines.)
|
|
|
|
*/
|
2005-08-04 22:44:28 -06:00
|
|
|
*obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_get_element_length
|
|
|
|
*
|
|
|
|
* PARAMETERS: acpi_pkg_callback
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get the length of one package element.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
static acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_get_element_length(u8 object_type,
|
|
|
|
union acpi_operand_object *source_object,
|
|
|
|
union acpi_generic_state *state, void *context)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_pkg_info *info = (struct acpi_pkg_info *)context;
|
|
|
|
acpi_size object_space;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
switch (object_type) {
|
|
|
|
case ACPI_COPY_TYPE_SIMPLE:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simple object - just get the size (Null object/entry is handled
|
|
|
|
* here also) and sum it into the running package length
|
|
|
|
*/
|
2005-08-04 22:44:28 -06:00
|
|
|
status =
|
|
|
|
acpi_ut_get_simple_object_size(source_object,
|
|
|
|
&object_space);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 16:20:36 -06:00
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
|
|
|
info->length += object_space;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_COPY_TYPE_PACKAGE:
|
|
|
|
|
|
|
|
/* Package object - nothing much to do here, let the walk handle it */
|
|
|
|
|
|
|
|
info->num_packages++;
|
|
|
|
state->pkg.this_target_obj = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* No other types allowed */
|
|
|
|
|
|
|
|
return (AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_get_package_object_size
|
|
|
|
*
|
2005-04-18 20:49:35 -06:00
|
|
|
* PARAMETERS: internal_object - An ACPI internal object
|
|
|
|
* obj_length - Where the length is returned
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: This function is called to determine the space required to
|
|
|
|
* contain a package object for return to an external user.
|
|
|
|
*
|
|
|
|
* This is moderately complex since a package contains other
|
|
|
|
* objects including packages.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
static acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
|
|
|
|
acpi_size * obj_length)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_status status;
|
|
|
|
struct acpi_pkg_info info;
|
2005-04-16 16:20:36 -06: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-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
info.length = 0;
|
2005-04-16 16:20:36 -06:00
|
|
|
info.object_space = 0;
|
|
|
|
info.num_packages = 1;
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
status = acpi_ut_walk_package_tree(internal_object, NULL,
|
|
|
|
acpi_ut_get_element_length, &info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We have handled all of the objects in all levels of the package.
|
|
|
|
* just add the length of the package objects themselves.
|
|
|
|
* Round up to the next machine word.
|
|
|
|
*/
|
2005-08-04 22:44:28 -06:00
|
|
|
info.length += ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) *
|
|
|
|
(acpi_size) info.num_packages;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Return the total package length */
|
|
|
|
|
|
|
|
*obj_length = info.length;
|
2005-08-04 22:44:28 -06:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_get_object_size
|
|
|
|
*
|
2005-04-18 20:49:35 -06:00
|
|
|
* PARAMETERS: internal_object - An ACPI internal object
|
|
|
|
* obj_length - Where the length will be returned
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: This function is called to determine the space required to
|
|
|
|
* contain an object for return to an API user.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ut_get_object_size(union acpi_operand_object *internal_object,
|
|
|
|
acpi_size * obj_length)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_ENTRY();
|
|
|
|
|
|
|
|
if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) ==
|
|
|
|
ACPI_DESC_TYPE_OPERAND)
|
|
|
|
&& (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE)) {
|
|
|
|
status =
|
|
|
|
acpi_ut_get_package_object_size(internal_object,
|
|
|
|
obj_length);
|
|
|
|
} else {
|
|
|
|
status =
|
|
|
|
acpi_ut_get_simple_object_size(internal_object, obj_length);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return (status);
|
|
|
|
}
|