2018-03-15 07:13:07 +08:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
|
2005-04-17 06:20:36 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: utobject - ACPI object create/delete/size/cache routines
|
|
|
|
*
|
2019-01-15 01:55:25 +08:00
|
|
|
* Copyright (C) 2000 - 2019, Intel Corp.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2018-03-15 07:13:07 +08:00
|
|
|
*****************************************************************************/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2018-05-12 22:59:38 +08:00
|
|
|
#include <linux/kmemleak.h>
|
2009-01-09 13:30:03 +08:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acnamesp.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_UTILITIES
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MODULE_NAME("utobject")
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Local prototypes */
|
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_get_simple_object_size(union acpi_operand_object *obj,
|
2016-05-05 12:57:53 +08:00
|
|
|
acpi_size *obj_length);
|
2005-04-19 10:49:35 +08:00
|
|
|
|
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_get_package_object_size(union acpi_operand_object *obj,
|
2016-05-05 12:57:53 +08:00
|
|
|
acpi_size *obj_length);
|
2005-04-19 10:49:35 +08:00
|
|
|
|
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_get_element_length(u8 object_type,
|
|
|
|
union acpi_operand_object *source_object,
|
|
|
|
union acpi_generic_state *state, void *context);
|
2005-04-17 06:20:36 +08: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
|
2012-07-12 09:40:10 +08:00
|
|
|
* type - ACPI Type of the new object
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* RETURN: A new internal object, null on failure
|
2005-04-17 06:20:36 +08: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
|
2012-10-31 10:26:55 +08:00
|
|
|
* one-size-satisifies-any-request. This in itself may not be
|
2005-04-17 06:20:36 +08:00
|
|
|
* the most memory efficient, but the efficiency of the object
|
|
|
|
* cache should more than make up for this!
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2008-06-10 13:55:53 +08:00
|
|
|
union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
|
|
|
|
*module_name,
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 line_number,
|
|
|
|
u32 component_id,
|
|
|
|
acpi_object_type
|
|
|
|
type)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *object;
|
|
|
|
union acpi_operand_object *second_object;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg,
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_get_type_name(type));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Allocate the raw object descriptor */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
object =
|
|
|
|
acpi_ut_allocate_object_desc_dbg(module_name, line_number,
|
|
|
|
component_id);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!object) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_PTR(NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2018-05-12 22:59:38 +08:00
|
|
|
kmemleak_not_leak(object);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case ACPI_TYPE_REGION:
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
2008-04-10 23:06:41 +08:00
|
|
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* These types require a secondary object */
|
|
|
|
|
2015-12-29 13:54:36 +08:00
|
|
|
second_object =
|
|
|
|
acpi_ut_allocate_object_desc_dbg(module_name, line_number,
|
|
|
|
component_id);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!second_object) {
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_delete_object_desc(object);
|
|
|
|
return_PTR(NULL);
|
2005-04-17 06:20:36 +08: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:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* 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-05 12:44:28 +08:00
|
|
|
return_PTR(object);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2007-04-04 07:59:37 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_create_package_object
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: count - Number of package elements
|
2007-04-04 07:59:37 +08:00
|
|
|
*
|
|
|
|
* RETURN: Pointer to a new Package object, null on failure
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a fully initialized package object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
union acpi_operand_object *acpi_ut_create_package_object(u32 count)
|
|
|
|
{
|
|
|
|
union acpi_operand_object *package_desc;
|
|
|
|
union acpi_operand_object **package_elements;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE_U32(ut_create_package_object, count);
|
|
|
|
|
|
|
|
/* Create a new Package object */
|
|
|
|
|
|
|
|
package_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
|
|
|
|
if (!package_desc) {
|
|
|
|
return_PTR(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create the element array. Count+1 allows the array to be null
|
|
|
|
* terminated.
|
|
|
|
*/
|
2016-05-05 12:57:53 +08:00
|
|
|
package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size)count +
|
2008-06-10 13:42:13 +08:00
|
|
|
1) * sizeof(void *));
|
2007-04-04 07:59:37 +08:00
|
|
|
if (!package_elements) {
|
2013-10-31 09:30:42 +08:00
|
|
|
ACPI_FREE(package_desc);
|
2007-04-04 07:59:37 +08:00
|
|
|
return_PTR(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
package_desc->package.count = count;
|
|
|
|
package_desc->package.elements = package_elements;
|
|
|
|
return_PTR(package_desc);
|
|
|
|
}
|
|
|
|
|
2009-11-12 09:49:50 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_create_integer_object
|
|
|
|
*
|
|
|
|
* PARAMETERS: initial_value - Initial value for the integer
|
|
|
|
*
|
|
|
|
* RETURN: Pointer to a new Integer object, null on failure
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create an initialized integer object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
union acpi_operand_object *acpi_ut_create_integer_object(u64 initial_value)
|
|
|
|
{
|
|
|
|
union acpi_operand_object *integer_desc;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(ut_create_integer_object);
|
|
|
|
|
|
|
|
/* Create and initialize a new integer object */
|
|
|
|
|
|
|
|
integer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
|
|
|
if (!integer_desc) {
|
|
|
|
return_PTR(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
integer_desc->integer.value = initial_value;
|
|
|
|
return_PTR(integer_desc);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_create_buffer_object
|
|
|
|
*
|
|
|
|
* PARAMETERS: buffer_size - Size of buffer to be created
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* RETURN: Pointer to a new Buffer object, null on failure
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a fully initialized buffer object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *buffer_desc;
|
|
|
|
u8 *buffer = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Create a new Buffer object */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!buffer_desc) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_PTR(NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create an actual buffer only if size > 0 */
|
|
|
|
|
|
|
|
if (buffer_size > 0) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Allocate the actual buffer */
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
buffer = ACPI_ALLOCATE_ZEROED(buffer_size);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!buffer) {
|
2010-03-05 17:56:40 +08:00
|
|
|
ACPI_ERROR((AE_INFO, "Could not allocate size %u",
|
2015-12-29 13:52:32 +08:00
|
|
|
(u32)buffer_size));
|
2015-12-29 13:54:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(buffer_desc);
|
|
|
|
return_PTR(NULL);
|
2005-04-17 06:20:36 +08: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-05 12:44:28 +08:00
|
|
|
return_PTR(buffer_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_create_string_object
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* PARAMETERS: string_size - Size of string to be created. Does not
|
|
|
|
* include NULL terminator, this is added
|
|
|
|
* automatically.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Pointer to a new String object
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a fully initialized string object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *string_desc;
|
|
|
|
char *string;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Create a new String object */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
string_desc = acpi_ut_create_internal_object(ACPI_TYPE_STRING);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!string_desc) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_PTR(NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate the actual string buffer -- (Size + 1) for NULL terminator.
|
|
|
|
* NOTE: Zero-length strings are NULL terminated
|
|
|
|
*/
|
2006-10-03 12:00:00 +08:00
|
|
|
string = ACPI_ALLOCATE_ZEROED(string_size + 1);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!string) {
|
2010-03-05 17:56:40 +08:00
|
|
|
ACPI_ERROR((AE_INFO, "Could not allocate size %u",
|
2015-12-29 13:52:32 +08:00
|
|
|
(u32)string_size));
|
2015-12-29 13:54:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(string_desc);
|
|
|
|
return_PTR(NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Complete string object initialization */
|
|
|
|
|
|
|
|
string_desc->string.pointer = string;
|
|
|
|
string_desc->string.length = (u32) string_size;
|
|
|
|
|
|
|
|
/* Return the new string descriptor */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_PTR(string_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_valid_internal_object
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: object - Object to be validated
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* RETURN: TRUE if object is valid, FALSE otherwise
|
|
|
|
*
|
2012-07-16 09:52:27 +08:00
|
|
|
* DESCRIPTION: Validate a pointer to be of type union acpi_operand_object
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
u8 acpi_ut_valid_internal_object(void *object)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_NAME(ut_valid_internal_object);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Check for a null pointer */
|
|
|
|
|
|
|
|
if (!object) {
|
2009-02-18 14:58:08 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "**** Null Object Ptr\n"));
|
2005-04-17 06:20:36 +08:00
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check the descriptor type field */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
switch (ACPI_GET_DESCRIPTOR_TYPE(object)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_DESC_TYPE_OPERAND:
|
|
|
|
|
2012-07-16 09:52:27 +08:00
|
|
|
/* The object appears to be a valid union acpi_operand_object */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
return (TRUE);
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2009-02-18 14:58:08 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
2013-09-30 22:19:09 +08:00
|
|
|
"%p is not an ACPI operand obj [%s]\n",
|
2005-08-05 12:44:28 +08:00
|
|
|
object, acpi_ut_get_descriptor_name(object)));
|
2005-04-17 06:20:36 +08: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)
|
|
|
|
*
|
2012-10-31 10:26:55 +08:00
|
|
|
* RETURN: Pointer to newly allocated object descriptor. Null on error
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2012-10-31 10:26:55 +08:00
|
|
|
* DESCRIPTION: Allocate a new object descriptor. Gracefully handle
|
2005-04-17 06:20:36 +08:00
|
|
|
* error conditions.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2008-06-10 13:55:53 +08:00
|
|
|
void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 line_number, u32 component_id)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *object;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
object = acpi_os_acquire_object(acpi_gbl_operand_cache);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!object) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((module_name, line_number,
|
|
|
|
"Could not allocate an object descriptor"));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_PTR(NULL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Mark the descriptor type */
|
2006-10-03 12:00:00 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
|
|
|
|
object, (u32) sizeof(union acpi_operand_object)));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_PTR(object);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_delete_object_desc
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: object - An Acpi internal object to be deleted
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: None.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Free an ACPI object descriptor or add it to the object cache
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
void acpi_ut_delete_object_desc(union acpi_operand_object *object)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-12-19 13:36:49 +08:00
|
|
|
/* Object must be of type union acpi_operand_object */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"%p is not an ACPI Operand object [%s]", object,
|
|
|
|
acpi_ut_get_descriptor_name(object)));
|
2005-04-17 06:20:36 +08:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
(void)acpi_os_release_object(acpi_gbl_operand_cache, object);
|
2005-04-17 06:20:36 +08:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_get_simple_object_size
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* PARAMETERS: internal_object - An ACPI operand object
|
|
|
|
* obj_length - Where the length is returned
|
2005-04-17 06:20:36 +08: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-19 10:49:35 +08:00
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
|
2016-05-05 12:57:53 +08:00
|
|
|
acpi_size *obj_length)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_size length;
|
2008-08-04 11:13:01 +08:00
|
|
|
acpi_size size;
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-10-31 09:30:36 +08:00
|
|
|
/* Start with the length of the (external) Acpi object */
|
|
|
|
|
|
|
|
length = sizeof(union acpi_object);
|
|
|
|
|
|
|
|
/* A NULL object is allowed, can be a legal uninitialized package element */
|
|
|
|
|
|
|
|
if (!internal_object) {
|
2005-04-19 10:49:35 +08:00
|
|
|
/*
|
2013-10-31 09:30:36 +08:00
|
|
|
* Object is NULL, just return the length of union acpi_object
|
|
|
|
* (A NULL union acpi_object is an object of all zeroes.)
|
2005-04-19 10:49:35 +08:00
|
|
|
*/
|
2013-10-31 09:30:36 +08:00
|
|
|
*obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2013-10-31 09:30:36 +08:00
|
|
|
/* A Namespace Node should never appear here */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2013-10-31 09:30:36 +08:00
|
|
|
/* A namespace node should never get here */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-08-03 14:27:22 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Received a namespace node [%4.4s] "
|
|
|
|
"where an operand object is required",
|
|
|
|
ACPI_CAST_PTR(struct acpi_namespace_node,
|
|
|
|
internal_object)->name.ascii));
|
2013-10-31 09:30:36 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
2005-04-17 06:20:36 +08: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
|
|
|
|
*/
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (internal_object->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
|
2016-05-05 12:57:53 +08:00
|
|
|
length += (acpi_size)internal_object->string.length + 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
2016-05-05 12:57:53 +08:00
|
|
|
length += (acpi_size)internal_object->buffer.length;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_INTEGER:
|
|
|
|
case ACPI_TYPE_PROCESSOR:
|
|
|
|
case ACPI_TYPE_POWER:
|
|
|
|
|
2008-04-10 23:06:43 +08:00
|
|
|
/* No extra data for these types */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
switch (internal_object->reference.class) {
|
|
|
|
case ACPI_REFCLASS_NAME:
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Get the actual length of the full pathname to this object.
|
|
|
|
* The reference will be converted to the pathname to the object
|
|
|
|
*/
|
2008-08-04 11:13:01 +08:00
|
|
|
size =
|
|
|
|
acpi_ns_get_pathname_length(internal_object->
|
|
|
|
reference.node);
|
|
|
|
if (!size) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
length += ACPI_ROUND_UP_TO_NATIVE_WORD(size);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* No other reference opcodes are supported.
|
|
|
|
* Notably, Locals and Args are not supported, but this may be
|
|
|
|
* required eventually.
|
|
|
|
*/
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2008-08-04 10:41:29 +08:00
|
|
|
"Cannot convert to external object - "
|
2010-03-05 17:56:40 +08:00
|
|
|
"unsupported Reference Class [%s] 0x%X in object %p",
|
2008-08-04 10:41:29 +08:00
|
|
|
acpi_ut_get_reference_name(internal_object),
|
2008-09-27 11:08:41 +08:00
|
|
|
internal_object->reference.class,
|
2006-01-28 05:43:00 +08:00
|
|
|
internal_object));
|
2005-04-17 06:20:36 +08:00
|
|
|
status = AE_TYPE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2008-08-04 10:41:29 +08:00
|
|
|
ACPI_ERROR((AE_INFO, "Cannot convert to external object - "
|
2010-03-05 17:56:40 +08:00
|
|
|
"unsupported type [%s] 0x%X in object %p",
|
2008-08-04 10:41:29 +08:00
|
|
|
acpi_ut_get_object_type_name(internal_object),
|
2009-02-18 14:44:03 +08:00
|
|
|
internal_object->common.type, internal_object));
|
2005-04-17 06:20:36 +08:00
|
|
|
status = AE_TYPE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Account for the space required by the object rounded up to the next
|
2012-10-31 10:26:55 +08:00
|
|
|
* multiple of the machine word size. This keeps each object aligned
|
2005-04-17 06:20:36 +08:00
|
|
|
* on a machine word boundary. (preventing alignment faults on some
|
|
|
|
* machines.)
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
*obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_get_element_length
|
|
|
|
*
|
|
|
|
* PARAMETERS: acpi_pkg_callback
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get the length of one package element.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_get_element_length(u8 object_type,
|
|
|
|
union acpi_operand_object *source_object,
|
|
|
|
union acpi_generic_state *state, void *context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
struct acpi_pkg_info *info = (struct acpi_pkg_info *)context;
|
|
|
|
acpi_size object_space;
|
2005-04-17 06:20:36 +08: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-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ut_get_simple_object_size(source_object,
|
|
|
|
&object_space);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08: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-19 10:49:35 +08:00
|
|
|
* PARAMETERS: internal_object - An ACPI internal object
|
|
|
|
* obj_length - Where the length is returned
|
2005-04-17 06:20:36 +08: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-19 10:49:35 +08:00
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
|
2016-05-05 12:57:53 +08:00
|
|
|
acpi_size *obj_length)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
|
|
|
struct acpi_pkg_info info;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
info.length = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
info.object_space = 0;
|
|
|
|
info.num_packages = 1;
|
|
|
|
|
2015-12-29 13:54:36 +08:00
|
|
|
status =
|
|
|
|
acpi_ut_walk_package_tree(internal_object, NULL,
|
|
|
|
acpi_ut_get_element_length, &info);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08: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.
|
|
|
|
*/
|
2015-12-29 13:54:36 +08:00
|
|
|
info.length +=
|
|
|
|
ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) *
|
2016-05-05 12:57:53 +08:00
|
|
|
(acpi_size)info.num_packages;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Return the total package length */
|
|
|
|
|
|
|
|
*obj_length = info.length;
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_get_object_size
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* PARAMETERS: internal_object - An ACPI internal object
|
|
|
|
* obj_length - Where the length will be returned
|
2005-04-17 06:20:36 +08: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-05 12:44:28 +08:00
|
|
|
acpi_ut_get_object_size(union acpi_operand_object *internal_object,
|
2016-05-05 12:57:53 +08:00
|
|
|
acpi_size *obj_length)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_ENTRY();
|
|
|
|
|
|
|
|
if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) ==
|
2015-12-29 13:54:36 +08:00
|
|
|
ACPI_DESC_TYPE_OPERAND) &&
|
|
|
|
(internal_object->common.type == ACPI_TYPE_PACKAGE)) {
|
2005-08-05 12:44:28 +08:00
|
|
|
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-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return (status);
|
|
|
|
}
|