2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: utmisc - common utility procedures
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2014-02-08 09:42:25 +08:00
|
|
|
* Copyright (C) 2000 - 2014, Intel Corp.
|
2005-04-17 06:20:36 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 13:30:03 +08:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "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("utmisc")
|
2005-04-19 10:49:35 +08:00
|
|
|
|
2009-06-29 13:39:29 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_is_pci_root_bridge
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: id - The HID/CID in string format
|
2009-06-29 13:39:29 +08:00
|
|
|
*
|
|
|
|
* RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
u8 acpi_ut_is_pci_root_bridge(char *id)
|
|
|
|
{
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check if this is a PCI root bridge.
|
|
|
|
* ACPI 3.0+: check for a PCI Express root also.
|
|
|
|
*/
|
|
|
|
if (!(ACPI_STRCMP(id,
|
|
|
|
PCI_ROOT_HID_STRING)) ||
|
|
|
|
!(ACPI_STRCMP(id, PCI_EXPRESS_ROOT_HID_STRING))) {
|
|
|
|
return (TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_is_aml_table
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: table - An ACPI table
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
*
|
|
|
|
* RETURN: TRUE if table contains executable AML; FALSE otherwise
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Check ACPI Signature for a table that contains AML code.
|
|
|
|
* Currently, these are DSDT,SSDT,PSDT. All other table types are
|
|
|
|
* data tables that do not contain AML code.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2007-02-03 00:48:19 +08:00
|
|
|
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
|
|
|
|
{
|
|
|
|
|
2006-07-08 08:44:38 +08:00
|
|
|
/* These are the only tables that contain executable AML */
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
|
2007-02-03 00:48:18 +08:00
|
|
|
if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
|
|
|
|
ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
|
|
|
|
ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
return (TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_dword_byte_swap
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: value - Value to be converted
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* RETURN: u32 integer with bytes swapped
|
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 acpi_ut_dword_byte_swap(u32 value)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
union {
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 value;
|
|
|
|
u8 bytes[4];
|
2005-04-17 06:20:36 +08:00
|
|
|
} out;
|
|
|
|
union {
|
2005-08-05 12:44:28 +08:00
|
|
|
u32 value;
|
|
|
|
u8 bytes[4];
|
2005-04-17 06:20:36 +08:00
|
|
|
} in;
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
in.value = value;
|
|
|
|
|
|
|
|
out.bytes[0] = in.bytes[3];
|
|
|
|
out.bytes[1] = in.bytes[2];
|
|
|
|
out.bytes[2] = in.bytes[1];
|
|
|
|
out.bytes[3] = in.bytes[0];
|
|
|
|
|
|
|
|
return (out.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_set_integer_width
|
|
|
|
*
|
|
|
|
* PARAMETERS: Revision From DSDT header
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Set the global integer bit width based upon the revision
|
2012-10-31 10:26:55 +08:00
|
|
|
* of the DSDT. For Revision 1 and 0, Integers are 32 bits.
|
|
|
|
* For Revision 2 and above, Integers are 64 bits. Yes, this
|
2005-04-17 06:20:36 +08:00
|
|
|
* makes a difference.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
void acpi_ut_set_integer_width(u8 revision)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
|
2007-02-03 00:48:18 +08:00
|
|
|
if (revision < 2) {
|
2006-07-08 08:44:38 +08:00
|
|
|
|
|
|
|
/* 32-bit case */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
acpi_gbl_integer_bit_width = 32;
|
|
|
|
acpi_gbl_integer_nybble_width = 8;
|
|
|
|
acpi_gbl_integer_byte_width = 4;
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
2006-07-08 08:44:38 +08:00
|
|
|
/* 64-bit case (ACPI 2.0+) */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
acpi_gbl_integer_bit_width = 64;
|
|
|
|
acpi_gbl_integer_nybble_width = 16;
|
|
|
|
acpi_gbl_integer_byte_width = 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_create_update_state_and_push
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: object - Object to be added to the new state
|
|
|
|
* action - Increment/Decrement
|
2005-04-17 06:20:36 +08:00
|
|
|
* state_list - List the state will be added to
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* RETURN: Status
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a new state and push it
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
|
|
|
|
u16 action,
|
|
|
|
union acpi_generic_state **state_list)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_generic_state *state;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Ignore null objects; these are expected */
|
|
|
|
|
|
|
|
if (!object) {
|
|
|
|
return (AE_OK);
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
state = acpi_ut_create_update_state(object, action);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!state) {
|
|
|
|
return (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_push_generic_state(state_list, state);
|
2005-04-17 06:20:36 +08:00
|
|
|
return (AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_walk_package_tree
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* PARAMETERS: source_object - The package to walk
|
|
|
|
* target_object - Target object (if package is being copied)
|
|
|
|
* walk_callback - Called once for each package element
|
2012-07-12 09:40:10 +08:00
|
|
|
* context - Passed to the callback function
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Walk through a package
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2012-10-31 10:25:05 +08:00
|
|
|
acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
|
2005-08-05 12:44:28 +08:00
|
|
|
void *target_object,
|
|
|
|
acpi_pkg_callback walk_callback, void *context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
union acpi_generic_state *state_list = NULL;
|
|
|
|
union acpi_generic_state *state;
|
|
|
|
u32 this_index;
|
|
|
|
union acpi_operand_object *this_source_obj;
|
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_walk_package_tree);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
state = acpi_ut_create_pkg_state(source_object, target_object, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!state) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
while (state) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Get one element of the package */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
this_index = state->pkg.index;
|
2005-04-17 06:20:36 +08:00
|
|
|
this_source_obj = (union acpi_operand_object *)
|
2005-08-05 12:44:28 +08:00
|
|
|
state->pkg.source_object->package.elements[this_index];
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for:
|
2012-10-31 10:26:55 +08:00
|
|
|
* 1) An uninitialized package element. It is completely
|
2005-04-17 06:20:36 +08:00
|
|
|
* legal to declare a package and leave it uninitialized
|
|
|
|
* 2) Not an internal object - can be a namespace node instead
|
2012-10-31 10:26:55 +08:00
|
|
|
* 3) Any type other than a package. Packages are handled in else
|
2005-04-17 06:20:36 +08:00
|
|
|
* case below.
|
|
|
|
*/
|
|
|
|
if ((!this_source_obj) ||
|
2005-08-05 12:44:28 +08:00
|
|
|
(ACPI_GET_DESCRIPTOR_TYPE(this_source_obj) !=
|
|
|
|
ACPI_DESC_TYPE_OPERAND)
|
2009-02-18 14:44:03 +08:00
|
|
|
|| (this_source_obj->common.type != ACPI_TYPE_PACKAGE)) {
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
walk_callback(ACPI_COPY_TYPE_SIMPLE,
|
|
|
|
this_source_obj, state, context);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
state->pkg.index++;
|
2005-08-05 12:44:28 +08:00
|
|
|
while (state->pkg.index >=
|
|
|
|
state->pkg.source_object->package.count) {
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* We've handled all of the objects at this level, This means
|
2012-10-31 10:26:55 +08:00
|
|
|
* that we have just completed a package. That package may
|
2005-04-17 06:20:36 +08:00
|
|
|
* have contained one or more packages itself.
|
|
|
|
*
|
|
|
|
* Delete this state and pop the previous state (package).
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_delete_generic_state(state);
|
|
|
|
state = acpi_ut_pop_generic_state(&state_list);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Finished when there are no more states */
|
|
|
|
|
|
|
|
if (!state) {
|
|
|
|
/*
|
|
|
|
* We have handled all of the objects in the top level
|
|
|
|
* package just add the length of the package objects
|
|
|
|
* and exit
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Go back up a level and move the index past the just
|
|
|
|
* completed package object.
|
|
|
|
*/
|
|
|
|
state->pkg.index++;
|
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
/* This is a subobject of type package */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
walk_callback(ACPI_COPY_TYPE_PACKAGE,
|
|
|
|
this_source_obj, state, context);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Push the current state and create a new one
|
|
|
|
* The callback above returned a new target package object.
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_push_generic_state(&state_list, state);
|
|
|
|
state = acpi_ut_create_pkg_state(this_source_obj,
|
|
|
|
state->pkg.
|
|
|
|
this_target_obj, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!state) {
|
2008-09-27 11:29:57 +08:00
|
|
|
|
|
|
|
/* Free any stacked Update State objects */
|
|
|
|
|
|
|
|
while (state_list) {
|
|
|
|
state =
|
|
|
|
acpi_ut_pop_generic_state
|
|
|
|
(&state_list);
|
|
|
|
acpi_ut_delete_generic_state(state);
|
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We should never get here */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2013-01-11 20:08:51 +08:00
|
|
|
|
|
|
|
#ifdef ACPI_DEBUG_OUTPUT
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ut_display_init_pathname
|
|
|
|
*
|
|
|
|
* PARAMETERS: type - Object type of the node
|
|
|
|
* obj_handle - Handle whose pathname will be displayed
|
|
|
|
* path - Additional path string to be appended.
|
|
|
|
* (NULL if no extra path)
|
|
|
|
*
|
|
|
|
* RETURN: acpi_status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Display full pathname of an object, DEBUG ONLY
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
void
|
|
|
|
acpi_ut_display_init_pathname(u8 type,
|
|
|
|
struct acpi_namespace_node *obj_handle,
|
|
|
|
char *path)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
struct acpi_buffer buffer;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_ENTRY();
|
|
|
|
|
|
|
|
/* Only print the path if the appropriate debug level is enabled */
|
|
|
|
|
|
|
|
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the full pathname to the node */
|
|
|
|
|
|
|
|
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
|
|
|
status = acpi_ns_handle_to_pathname(obj_handle, &buffer);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print what we're doing */
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case ACPI_TYPE_METHOD:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2013-01-11 20:08:51 +08:00
|
|
|
acpi_os_printf("Executing ");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2013-01-11 20:08:51 +08:00
|
|
|
acpi_os_printf("Initializing ");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print the object type and pathname */
|
|
|
|
|
|
|
|
acpi_os_printf("%-12s %s",
|
|
|
|
acpi_ut_get_type_name(type), (char *)buffer.pointer);
|
|
|
|
|
|
|
|
/* Extra path is used to append names like _STA, _INI, etc. */
|
|
|
|
|
|
|
|
if (path) {
|
|
|
|
acpi_os_printf(".%s", path);
|
|
|
|
}
|
|
|
|
acpi_os_printf("\n");
|
|
|
|
|
|
|
|
ACPI_FREE(buffer.pointer);
|
|
|
|
}
|
|
|
|
#endif
|