2005-04-16 22:20:36 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
|
|
|
|
* parents and siblings and Scope manipulation
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2006-01-13 21:22:00 +00:00
|
|
|
* Copyright (C) 2000 - 2006, R. Byron Moore
|
2005-04-16 22:20:36 +00: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>
|
|
|
|
#include <acpi/actables.h>
|
|
|
|
|
|
|
|
#define _COMPONENT ACPI_NAMESPACE
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_MODULE_NAME("nsutils")
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/* Local prototypes */
|
2005-08-05 04:44:28 +00:00
|
|
|
static u8 acpi_ns_valid_path_separator(char sep);
|
2005-04-19 02:49:35 +00:00
|
|
|
|
|
|
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
|
2005-04-19 02:49:35 +00:00
|
|
|
#endif
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_report_error
|
|
|
|
*
|
|
|
|
* PARAMETERS: module_name - Caller's module name (for error output)
|
|
|
|
* line_number - Caller's line number (for error output)
|
2005-04-19 02:49:35 +00:00
|
|
|
* internal_name - Name or path of the namespace node
|
|
|
|
* lookup_status - Exception code from NS lookup
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Print warning message with full pathname
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
void
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ns_report_error(char *module_name,
|
|
|
|
u32 line_number,
|
|
|
|
char *internal_name, acpi_status lookup_status)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status;
|
2006-02-17 05:00:00 +00:00
|
|
|
u32 bad_name;
|
2005-08-05 04:44:28 +00:00
|
|
|
char *name = NULL;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-03-17 21:44:00 +00:00
|
|
|
acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (lookup_status == AE_BAD_CHARACTER) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* There is a non-ascii character in the name */
|
|
|
|
|
2006-02-17 05:00:00 +00:00
|
|
|
ACPI_MOVE_32_TO_32(&bad_name, internal_name);
|
|
|
|
acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name);
|
2005-08-05 04:44:28 +00:00
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Convert path to external format */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
|
|
|
|
internal_name, NULL, &name);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Print target name */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_SUCCESS(status)) {
|
|
|
|
acpi_os_printf("[%s]", name);
|
|
|
|
} else {
|
|
|
|
acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (name) {
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_FREE(name);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-27 21:43:00 +00:00
|
|
|
acpi_os_printf(" Namespace lookup failure, %s\n",
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_format_exception(lookup_status));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_report_method_error
|
|
|
|
*
|
|
|
|
* PARAMETERS: module_name - Caller's module name (for error output)
|
|
|
|
* line_number - Caller's line number (for error output)
|
|
|
|
* Message - Error message to use on failure
|
2005-04-19 02:49:35 +00:00
|
|
|
* prefix_node - Prefix relative to the path
|
2006-01-13 21:22:00 +00:00
|
|
|
* Path - Path to the node (optional)
|
2005-04-19 02:49:35 +00:00
|
|
|
* method_status - Execution status
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Print warning message with full pathname
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
void
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ns_report_method_error(char *module_name,
|
|
|
|
u32 line_number,
|
|
|
|
char *message,
|
|
|
|
struct acpi_namespace_node *prefix_node,
|
|
|
|
char *path, acpi_status method_status)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status;
|
|
|
|
struct acpi_namespace_node *node = prefix_node;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-03-17 21:44:00 +00:00
|
|
|
acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
|
2006-01-13 21:22:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
if (path) {
|
2006-05-26 20:36:00 +00:00
|
|
|
status =
|
|
|
|
acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
|
|
|
|
&node);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-13 21:22:00 +00:00
|
|
|
acpi_os_printf("[Could not get node by pathname]");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ns_print_node_pathname(node, message);
|
|
|
|
acpi_os_printf(", %s\n", acpi_format_exception(method_status));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_print_node_pathname
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* PARAMETERS: Node - Object
|
|
|
|
* Message - Prefix message
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Print an object's full namespace pathname
|
|
|
|
* Manages allocation/freeing of a pathname buffer
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
void
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_buffer buffer;
|
|
|
|
acpi_status status;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!node) {
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_os_printf("[NULL NAME]");
|
2005-04-16 22:20:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert handle to full pathname and print it (with supplied message) */
|
|
|
|
|
|
|
|
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ns_handle_to_pathname(node, &buffer);
|
|
|
|
if (ACPI_SUCCESS(status)) {
|
2005-04-19 02:49:35 +00:00
|
|
|
if (message) {
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_os_printf("%s ", message);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node);
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_FREE(buffer.pointer);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_valid_root_prefix
|
|
|
|
*
|
|
|
|
* PARAMETERS: Prefix - Character to be checked
|
|
|
|
*
|
|
|
|
* RETURN: TRUE if a valid prefix
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Check if a character is a valid ACPI Root prefix
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
u8 acpi_ns_valid_root_prefix(char prefix)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
return ((u8) (prefix == '\\'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_valid_path_separator
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* PARAMETERS: Sep - Character to be checked
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: TRUE if a valid path separator
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Check if a character is a valid ACPI path separator
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
static u8 acpi_ns_valid_path_separator(char sep)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
return ((u8) (sep == '.'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_get_type
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* PARAMETERS: Node - Parent Node to be examined
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Type field from Node whose handle is passed
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* DESCRIPTION: Return the type of a Namespace node
|
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ns_get_type);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!node) {
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_WARNING((AE_INFO, "Null Node parameter"));
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-09-30 23:03:00 +00:00
|
|
|
return_UINT32(ACPI_TYPE_ANY);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-09-30 23:03:00 +00:00
|
|
|
return_UINT32((acpi_object_type) node->type);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_local
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* PARAMETERS: Type - A namespace object type
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: LOCAL if names must be found locally in objects of the
|
|
|
|
* passed type, 0 if enclosing scopes should be searched
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* DESCRIPTION: Returns scope rule for the given object type.
|
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
u32 acpi_ns_local(acpi_object_type type)
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ns_local);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (!acpi_ut_valid_object_type(type)) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Type code out of range */
|
|
|
|
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-09-30 23:03:00 +00:00
|
|
|
return_UINT32(ACPI_NS_NORMAL);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-09-30 23:03:00 +00:00
|
|
|
return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_get_internal_name_length
|
|
|
|
*
|
|
|
|
* PARAMETERS: Info - Info struct initialized with the
|
|
|
|
* external name pointer.
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* RETURN: None
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Calculate the length of the internal (AML) namestring
|
|
|
|
* corresponding to the external (ASL) namestring.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
char *next_external_char;
|
|
|
|
u32 i;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
next_external_char = info->external_name;
|
|
|
|
info->num_carats = 0;
|
|
|
|
info->num_segments = 0;
|
|
|
|
info->fully_qualified = FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For the internal name, the required length is 4 bytes per segment, plus
|
|
|
|
* 1 each for root_prefix, multi_name_prefix_op, segment count, trailing null
|
|
|
|
* (which is not really needed, but no there's harm in putting it there)
|
|
|
|
*
|
|
|
|
* strlen() + 1 covers the first name_seg, which has no path separator
|
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
if (acpi_ns_valid_root_prefix(next_external_char[0])) {
|
2005-04-16 22:20:36 +00:00
|
|
|
info->fully_qualified = TRUE;
|
|
|
|
next_external_char++;
|
2005-08-05 04:44:28 +00:00
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Handle Carat prefixes
|
|
|
|
*/
|
|
|
|
while (*next_external_char == '^') {
|
|
|
|
info->num_carats++;
|
|
|
|
next_external_char++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine the number of ACPI name "segments" by counting the number of
|
|
|
|
* path separators within the string. Start with one segment since the
|
|
|
|
* segment count is [(# separators) + 1], and zero separators is ok.
|
|
|
|
*/
|
|
|
|
if (*next_external_char) {
|
|
|
|
info->num_segments = 1;
|
|
|
|
for (i = 0; next_external_char[i]; i++) {
|
2005-08-05 04:44:28 +00:00
|
|
|
if (acpi_ns_valid_path_separator(next_external_char[i])) {
|
2005-04-16 22:20:36 +00:00
|
|
|
info->num_segments++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
info->length = (ACPI_NAME_SIZE * info->num_segments) +
|
2005-08-05 04:44:28 +00:00
|
|
|
4 + info->num_carats;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
info->next_external_char = next_external_char;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_build_internal_name
|
|
|
|
*
|
|
|
|
* PARAMETERS: Info - Info struct fully initialized
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the internal (AML) namestring
|
|
|
|
* corresponding to the external (ASL) namestring.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
u32 num_segments = info->num_segments;
|
|
|
|
char *internal_name = info->internal_name;
|
|
|
|
char *external_name = info->next_external_char;
|
|
|
|
char *result = NULL;
|
|
|
|
acpi_native_uint i;
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ns_build_internal_name);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Setup the correct prefixes, counts, and pointers */
|
|
|
|
|
|
|
|
if (info->fully_qualified) {
|
|
|
|
internal_name[0] = '\\';
|
|
|
|
|
|
|
|
if (num_segments <= 1) {
|
|
|
|
result = &internal_name[1];
|
2005-08-05 04:44:28 +00:00
|
|
|
} else if (num_segments == 2) {
|
2005-04-16 22:20:36 +00:00
|
|
|
internal_name[1] = AML_DUAL_NAME_PREFIX;
|
|
|
|
result = &internal_name[2];
|
2005-08-05 04:44:28 +00:00
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
|
2005-08-05 04:44:28 +00:00
|
|
|
internal_name[2] = (char)num_segments;
|
2005-04-16 22:20:36 +00:00
|
|
|
result = &internal_name[3];
|
|
|
|
}
|
2005-08-05 04:44:28 +00:00
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Not fully qualified.
|
|
|
|
* Handle Carats first, then append the name segments
|
|
|
|
*/
|
|
|
|
i = 0;
|
|
|
|
if (info->num_carats) {
|
|
|
|
for (i = 0; i < info->num_carats; i++) {
|
|
|
|
internal_name[i] = '^';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (num_segments <= 1) {
|
|
|
|
result = &internal_name[i];
|
2005-08-05 04:44:28 +00:00
|
|
|
} else if (num_segments == 2) {
|
2005-04-16 22:20:36 +00:00
|
|
|
internal_name[i] = AML_DUAL_NAME_PREFIX;
|
2005-08-05 04:44:28 +00:00
|
|
|
result = &internal_name[(acpi_native_uint) (i + 1)];
|
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
|
2005-08-05 04:44:28 +00:00
|
|
|
internal_name[(acpi_native_uint) (i + 1)] =
|
|
|
|
(char)num_segments;
|
|
|
|
result = &internal_name[(acpi_native_uint) (i + 2)];
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Build the name (minus path separators) */
|
|
|
|
|
|
|
|
for (; num_segments; num_segments--) {
|
|
|
|
for (i = 0; i < ACPI_NAME_SIZE; i++) {
|
2005-08-05 04:44:28 +00:00
|
|
|
if (acpi_ns_valid_path_separator(*external_name) ||
|
|
|
|
(*external_name == 0)) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Pad the segment with underscore(s) if segment is short */
|
|
|
|
|
|
|
|
result[i] = '_';
|
2005-08-05 04:44:28 +00:00
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Convert the character to uppercase and save it */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
result[i] =
|
|
|
|
(char)ACPI_TOUPPER((int)*external_name);
|
2005-04-16 22:20:36 +00:00
|
|
|
external_name++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now we must have a path separator, or the pathname is bad */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (!acpi_ns_valid_path_separator(*external_name) &&
|
|
|
|
(*external_name != 0)) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Move on the next segment */
|
|
|
|
|
|
|
|
external_name++;
|
|
|
|
result += ACPI_NAME_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Terminate the string */
|
|
|
|
|
|
|
|
*result = 0;
|
|
|
|
|
|
|
|
if (info->fully_qualified) {
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
|
|
|
"Returning [%p] (abs) \"\\%s\"\n",
|
|
|
|
internal_name, internal_name));
|
|
|
|
} else {
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
|
|
|
|
internal_name, internal_name));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_internalize_name
|
|
|
|
*
|
|
|
|
* PARAMETERS: *external_name - External representation of name
|
|
|
|
* **Converted Name - Where to return the resulting
|
|
|
|
* internal represention of the name
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0")
|
|
|
|
* to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
|
|
|
|
*
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
char *internal_name;
|
|
|
|
struct acpi_namestring_info info;
|
|
|
|
acpi_status status;
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ns_internalize_name);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if ((!external_name) || (*external_name == 0) || (!converted_name)) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the length of the new internal name */
|
|
|
|
|
|
|
|
info.external_name = external_name;
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ns_get_internal_name_length(&info);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* We need a segment to store the internal name */
|
|
|
|
|
2006-10-03 04:00:00 +00:00
|
|
|
internal_name = ACPI_ALLOCATE_ZEROED(info.length);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!internal_name) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Build the name */
|
|
|
|
|
|
|
|
info.internal_name = internal_name;
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ns_build_internal_name(&info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-10-03 04:00:00 +00:00
|
|
|
ACPI_FREE(internal_name);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*converted_name = internal_name;
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_externalize_name
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* PARAMETERS: internal_name_length - Lenth of the internal name below
|
|
|
|
* internal_name - Internal representation of name
|
|
|
|
* converted_name_length - Where the length is returned
|
|
|
|
* converted_name - Where the resulting external name
|
|
|
|
* is returned
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
|
2005-04-19 02:49:35 +00:00
|
|
|
* to its external (printable) form (e.g. "\_PR_.CPU0")
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ns_externalize_name(u32 internal_name_length,
|
|
|
|
char *internal_name,
|
|
|
|
u32 * converted_name_length, char **converted_name)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_native_uint names_index = 0;
|
|
|
|
acpi_native_uint num_segments = 0;
|
|
|
|
acpi_native_uint required_length;
|
|
|
|
acpi_native_uint prefix_length = 0;
|
|
|
|
acpi_native_uint i = 0;
|
|
|
|
acpi_native_uint j = 0;
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ns_externalize_name);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (!internal_name_length || !internal_name || !converted_name) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for a prefix (one '\' | one or more '^').
|
|
|
|
*/
|
|
|
|
switch (internal_name[0]) {
|
|
|
|
case '\\':
|
|
|
|
prefix_length = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '^':
|
|
|
|
for (i = 0; i < internal_name_length; i++) {
|
|
|
|
if (internal_name[i] == '^') {
|
|
|
|
prefix_length = i + 1;
|
2005-08-05 04:44:28 +00:00
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == internal_name_length) {
|
|
|
|
prefix_length = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for object names. Note that there could be 0-255 of these
|
|
|
|
* 4-byte elements.
|
|
|
|
*/
|
|
|
|
if (prefix_length < internal_name_length) {
|
|
|
|
switch (internal_name[prefix_length]) {
|
|
|
|
case AML_MULTI_NAME_PREFIX_OP:
|
|
|
|
|
|
|
|
/* <count> 4-byte names */
|
|
|
|
|
|
|
|
names_index = prefix_length + 2;
|
|
|
|
num_segments = (acpi_native_uint) (u8)
|
2005-08-05 04:44:28 +00:00
|
|
|
internal_name[(acpi_native_uint)
|
|
|
|
(prefix_length + 1)];
|
2005-04-16 22:20:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_DUAL_NAME_PREFIX:
|
|
|
|
|
|
|
|
/* Two 4-byte names */
|
|
|
|
|
|
|
|
names_index = prefix_length + 1;
|
|
|
|
num_segments = 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
/* null_name */
|
|
|
|
|
|
|
|
names_index = 0;
|
|
|
|
num_segments = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* one 4-byte name */
|
|
|
|
|
|
|
|
names_index = prefix_length;
|
|
|
|
num_segments = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Calculate the length of converted_name, which equals the length
|
|
|
|
* of the prefix, length of all object names, length of any required
|
|
|
|
* punctuation ('.') between object names, plus the NULL terminator.
|
|
|
|
*/
|
|
|
|
required_length = prefix_length + (4 * num_segments) +
|
2005-08-05 04:44:28 +00:00
|
|
|
((num_segments > 0) ? (num_segments - 1) : 0) + 1;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if we're still in bounds. If not, there's a problem
|
|
|
|
* with internal_name (invalid format).
|
|
|
|
*/
|
|
|
|
if (required_length > internal_name_length) {
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_ERROR((AE_INFO, "Invalid internal name"));
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_BAD_PATHNAME);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Build converted_name
|
|
|
|
*/
|
2006-10-03 04:00:00 +00:00
|
|
|
*converted_name = ACPI_ALLOCATE_ZEROED(required_length);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!(*converted_name)) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < prefix_length; i++) {
|
|
|
|
(*converted_name)[j++] = internal_name[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (num_segments > 0) {
|
|
|
|
for (i = 0; i < num_segments; i++) {
|
|
|
|
if (i > 0) {
|
|
|
|
(*converted_name)[j++] = '.';
|
|
|
|
}
|
|
|
|
|
|
|
|
(*converted_name)[j++] = internal_name[names_index++];
|
|
|
|
(*converted_name)[j++] = internal_name[names_index++];
|
|
|
|
(*converted_name)[j++] = internal_name[names_index++];
|
|
|
|
(*converted_name)[j++] = internal_name[names_index++];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (converted_name_length) {
|
|
|
|
*converted_name_length = (u32) required_length;
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_map_handle_to_node
|
|
|
|
*
|
|
|
|
* PARAMETERS: Handle - Handle to be converted to an Node
|
|
|
|
*
|
|
|
|
* RETURN: A Name table entry pointer
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert a namespace handle to a real Node
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* Note: Real integer handles would allow for more verification
|
|
|
|
* and keep all pointers within this subsystem - however this introduces
|
|
|
|
* more (and perhaps unnecessary) overhead.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
2006-05-26 20:36:00 +00:00
|
|
|
* Simple implementation
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2006-05-26 20:36:00 +00:00
|
|
|
if ((!handle) || (handle == ACPI_ROOT_OBJECT)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
return (acpi_gbl_root_node);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We can at least attempt to verify the handle */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) {
|
2005-04-16 22:20:36 +00:00
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
2006-05-26 20:36:00 +00:00
|
|
|
return (ACPI_CAST_PTR(struct acpi_namespace_node, handle));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_convert_entry_to_handle
|
|
|
|
*
|
|
|
|
* PARAMETERS: Node - Node to be converted to a Handle
|
|
|
|
*
|
|
|
|
* RETURN: A user handle
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert a real Node to a namespace handle
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simple implementation for now;
|
|
|
|
*/
|
|
|
|
return ((acpi_handle) node);
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/* Example future implementation ---------------------
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!Node)
|
|
|
|
{
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Node == acpi_gbl_root_node)
|
|
|
|
{
|
|
|
|
return (ACPI_ROOT_OBJECT);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ((acpi_handle) Node);
|
|
|
|
------------------------------------------------------*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_terminate
|
|
|
|
*
|
|
|
|
* PARAMETERS: none
|
|
|
|
*
|
|
|
|
* RETURN: none
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* DESCRIPTION: free memory allocated for namespace and ACPI table storage.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
void acpi_ns_terminate(void)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
union acpi_operand_object *obj_desc;
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ns_terminate);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 1) Free the entire namespace -- all nodes and objects
|
|
|
|
*
|
|
|
|
* Delete all object descriptors attached to namepsace nodes
|
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Detach any objects attached to the root */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (obj_desc) {
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ns_detach_object(acpi_gbl_root_node);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
|
2005-04-16 22:20:36 +00:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_opens_scope
|
|
|
|
*
|
|
|
|
* PARAMETERS: Type - A valid namespace type
|
|
|
|
*
|
|
|
|
* RETURN: NEWSCOPE if the passed type "opens a name scope" according
|
|
|
|
* to the ACPI specification, else 0
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
u32 acpi_ns_opens_scope(acpi_object_type type)
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (!acpi_ut_valid_object_type(type)) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* type code out of range */
|
|
|
|
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-09-30 23:03:00 +00:00
|
|
|
return_UINT32(ACPI_NS_NORMAL);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-09-30 23:03:00 +00:00
|
|
|
return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2006-05-26 20:36:00 +00:00
|
|
|
* FUNCTION: acpi_ns_get_node
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
|
|
|
|
* \ (backslash) and ^ (carat) prefixes, and the
|
|
|
|
* . (period) to separate segments are supported.
|
2006-05-26 20:36:00 +00:00
|
|
|
* prefix_node - Root of subtree to be searched, or NS_ALL for the
|
2005-04-16 22:20:36 +00:00
|
|
|
* root of the name space. If Name is fully
|
|
|
|
* qualified (first s8 is '\'), the passed value
|
|
|
|
* of Scope will not be accessed.
|
|
|
|
* Flags - Used to indicate whether to perform upsearch or
|
|
|
|
* not.
|
|
|
|
* return_node - Where the Node is returned
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Look up a name relative to a given scope and return the
|
|
|
|
* corresponding Node. NOTE: Scope can be null.
|
|
|
|
*
|
|
|
|
* MUTEX: Locks namespace
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2006-05-26 20:36:00 +00:00
|
|
|
acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
|
|
|
|
char *pathname,
|
|
|
|
u32 flags, struct acpi_namespace_node **return_node)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
union acpi_generic_state scope_info;
|
|
|
|
acpi_status status;
|
2006-05-26 20:36:00 +00:00
|
|
|
char *internal_path;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-05-26 20:36:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-05-26 20:36:00 +00:00
|
|
|
if (!pathname) {
|
|
|
|
*return_node = prefix_node;
|
|
|
|
if (!prefix_node) {
|
|
|
|
*return_node = acpi_gbl_root_node;
|
|
|
|
}
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2006-05-26 20:36:00 +00:00
|
|
|
/* Convert path to internal representation */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-05-26 20:36:00 +00:00
|
|
|
status = acpi_ns_internalize_name(pathname, &internal_path);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Must lock namespace during lookup */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup lookup scope (search starting point) */
|
|
|
|
|
2006-05-26 20:36:00 +00:00
|
|
|
scope_info.scope.node = prefix_node;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Lookup the name in the namespace */
|
|
|
|
|
2006-05-26 20:36:00 +00:00
|
|
|
status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY,
|
|
|
|
ACPI_IMODE_EXECUTE,
|
|
|
|
(flags | ACPI_NS_DONT_OPEN_SCOPE), NULL,
|
|
|
|
return_node);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n",
|
2006-05-26 20:36:00 +00:00
|
|
|
pathname, acpi_format_exception(status)));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
cleanup:
|
2006-05-26 20:36:00 +00:00
|
|
|
ACPI_FREE(internal_path);
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_get_parent_node
|
|
|
|
*
|
|
|
|
* PARAMETERS: Node - Current table entry
|
|
|
|
*
|
|
|
|
* RETURN: Parent entry of the given entry
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
|
|
|
|
*node)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Walk to the end of this peer list. The last entry is marked with a flag
|
|
|
|
* and the peer pointer is really a pointer back to the parent. This saves
|
|
|
|
* putting a parent back pointer in each and every named object!
|
|
|
|
*/
|
|
|
|
while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
|
|
|
|
node = node->peer;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (node->peer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_get_next_valid_node
|
|
|
|
*
|
|
|
|
* PARAMETERS: Node - Current table entry
|
|
|
|
*
|
|
|
|
* RETURN: Next valid Node in the linked node list. NULL if no more valid
|
|
|
|
* nodes.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Find the next valid node within a name table.
|
|
|
|
* Useful for implementing NULL-end-of-list loops.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
|
|
|
|
acpi_namespace_node
|
|
|
|
*node)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
/* If we are at the end of this peer list, return NULL */
|
|
|
|
|
|
|
|
if (node->flags & ANOBJ_END_OF_PEER_LIST) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise just return the next peer */
|
|
|
|
|
|
|
|
return (node->peer);
|
|
|
|
}
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ns_find_parent_name
|
|
|
|
*
|
|
|
|
* PARAMETERS: *child_node - Named Obj whose name is to be found
|
|
|
|
*
|
|
|
|
* RETURN: The ACPI name
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Search for the given obj in its parent scope and return the
|
|
|
|
* name segment, or "????" if the parent name can't be found
|
|
|
|
* (which "should not happen").
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
|
2005-04-19 02:49:35 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
struct acpi_namespace_node *parent_node;
|
2005-04-19 02:49:35 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ns_find_parent_name);
|
2005-04-19 02:49:35 +00:00
|
|
|
|
|
|
|
if (child_node) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/* Valid entry. Get the parent Node */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
parent_node = acpi_ns_get_parent_node(child_node);
|
2005-04-19 02:49:35 +00:00
|
|
|
if (parent_node) {
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
|
|
|
"Parent of %p [%4.4s] is %p [%4.4s]\n",
|
|
|
|
child_node,
|
|
|
|
acpi_ut_get_node_name(child_node),
|
|
|
|
parent_node,
|
|
|
|
acpi_ut_get_node_name(parent_node)));
|
2005-04-19 02:49:35 +00:00
|
|
|
|
|
|
|
if (parent_node->name.integer) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_VALUE((acpi_name) parent_node->name.
|
|
|
|
integer);
|
2005-04-19 02:49:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
|
|
|
"Unable to find parent of %p (%4.4s)\n",
|
|
|
|
child_node,
|
|
|
|
acpi_ut_get_node_name(child_node)));
|
2005-04-19 02:49:35 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_VALUE(ACPI_UNKNOWN_NAME);
|
2005-04-19 02:49:35 +00:00
|
|
|
}
|
|
|
|
#endif
|