2005-04-16 16:20:36 -06:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: psargs - Parse AML opcode arguments
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2008-04-23 21:00:13 -06:00
|
|
|
* Copyright (C) 2000 - 2008, Intel Corp.
|
2005-04-16 16:20:36 -06:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-08 22:30:03 -07:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acparser.h"
|
|
|
|
#include "amlcode.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "acdispat.h"
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_PARSER
|
2005-08-04 22:44:28 -06:00
|
|
|
ACPI_MODULE_NAME("psargs")
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
/* Local prototypes */
|
|
|
|
static u32
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state);
|
2005-04-18 20:49:35 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
|
|
|
|
*parser_state);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ps_get_next_package_length
|
|
|
|
*
|
|
|
|
* PARAMETERS: parser_state - Current parser state object
|
|
|
|
*
|
2005-11-17 11:07:00 -07:00
|
|
|
* RETURN: Decoded package length. On completion, the AML pointer points
|
2005-04-16 16:20:36 -06:00
|
|
|
* past the length byte or bytes.
|
|
|
|
*
|
2005-11-17 11:07:00 -07:00
|
|
|
* DESCRIPTION: Decode and return a package length field.
|
|
|
|
* Note: Largest package length is 28 bits, from ACPI specification
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
static u32
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-11-17 11:07:00 -07:00
|
|
|
u8 *aml = parser_state->aml;
|
|
|
|
u32 package_length = 0;
|
2008-06-09 23:42:13 -06:00
|
|
|
u32 byte_count;
|
2005-11-17 11:07:00 -07:00
|
|
|
u8 byte_zero_mask = 0x3F; /* Default [0:5] */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE(ps_get_next_package_length);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/*
|
|
|
|
* Byte 0 bits [6:7] contain the number of additional bytes
|
|
|
|
* used to encode the package length, either 0,1,2, or 3
|
|
|
|
*/
|
|
|
|
byte_count = (aml[0] >> 6);
|
2008-06-09 23:42:13 -06:00
|
|
|
parser_state->aml += ((acpi_size) byte_count + 1);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Get bytes 3, 2, 1 as needed */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
while (byte_count) {
|
|
|
|
/*
|
|
|
|
* Final bit positions for the package length bytes:
|
|
|
|
* Byte3->[20:27]
|
|
|
|
* Byte2->[12:19]
|
|
|
|
* Byte1->[04:11]
|
|
|
|
* Byte0->[00:03]
|
|
|
|
*/
|
|
|
|
package_length |= (aml[byte_count] << ((byte_count << 3) - 4));
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
byte_zero_mask = 0x0F; /* Use bits [0:3] of byte 0 */
|
|
|
|
byte_count--;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
|
|
|
|
|
|
|
|
package_length |= (aml[0] & byte_zero_mask);
|
|
|
|
return_UINT32(package_length);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ps_get_next_package_end
|
|
|
|
*
|
|
|
|
* PARAMETERS: parser_state - Current parser state object
|
|
|
|
*
|
|
|
|
* RETURN: Pointer to end-of-package +1
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get next package length and return a pointer past the end of
|
|
|
|
* the package. Consumes the package length field
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
u8 *start = parser_state->aml;
|
2005-11-17 11:07:00 -07:00
|
|
|
u32 package_length;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE(ps_get_next_package_end);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Function below updates parser_state->Aml */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
package_length = acpi_ps_get_next_package_length(parser_state);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
return_PTR(start + package_length); /* end of package */
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ps_get_next_namestring
|
|
|
|
*
|
|
|
|
* PARAMETERS: parser_state - Current parser state object
|
|
|
|
*
|
|
|
|
* RETURN: Pointer to the start of the name string (pointer points into
|
|
|
|
* the AML.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get next raw namestring within the AML stream. Handles all name
|
|
|
|
* prefix characters. Set parser state to point past the string.
|
|
|
|
* (Name is consumed from the AML.)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
u8 *start = parser_state->aml;
|
|
|
|
u8 *end = parser_state->aml;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE(ps_get_next_namestring);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Point past any namestring prefix characters (backslash or carat) */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
while (acpi_ps_is_prefix_char(*end)) {
|
2005-04-16 16:20:36 -06:00
|
|
|
end++;
|
|
|
|
}
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Decode the path prefix character */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
switch (*end) {
|
2005-04-16 16:20:36 -06:00
|
|
|
case 0:
|
|
|
|
|
|
|
|
/* null_name */
|
|
|
|
|
|
|
|
if (end == start) {
|
|
|
|
start = NULL;
|
|
|
|
}
|
|
|
|
end++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_DUAL_NAME_PREFIX:
|
|
|
|
|
|
|
|
/* Two name segments */
|
|
|
|
|
|
|
|
end += 1 + (2 * ACPI_NAME_SIZE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_MULTI_NAME_PREFIX_OP:
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Multiple name segments, 4 chars each, count in next byte */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
end += 2 + (*(end + 1) * ACPI_NAME_SIZE);
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* Single name segment */
|
|
|
|
|
|
|
|
end += ACPI_NAME_SIZE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
parser_state->aml = end;
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR((char *)start);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ps_get_next_namepath
|
|
|
|
*
|
|
|
|
* PARAMETERS: parser_state - Current parser state object
|
|
|
|
* Arg - Where the namepath will be stored
|
|
|
|
* arg_count - If the namepath points to a control method
|
|
|
|
* the method's argument is returned here.
|
2005-12-16 15:05:00 -07:00
|
|
|
* possible_method_call - Whether the namepath can possibly be the
|
2005-04-16 16:20:36 -06:00
|
|
|
* start of a method call
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get next name (if method call, return # of required args).
|
|
|
|
* Names are looked up in the internal namespace to determine
|
|
|
|
* if the name represents a control method. If a method
|
|
|
|
* is found, the number of arguments to the method is returned.
|
|
|
|
* This information is critical for parsing to continue correctly.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
|
|
|
|
struct acpi_parse_state *parser_state,
|
2005-12-16 15:05:00 -07:00
|
|
|
union acpi_parse_object *arg, u8 possible_method_call)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2008-04-10 09:06:38 -06:00
|
|
|
acpi_status status;
|
2005-08-04 22:44:28 -06:00
|
|
|
char *path;
|
|
|
|
union acpi_parse_object *name_op;
|
|
|
|
union acpi_operand_object *method_desc;
|
|
|
|
struct acpi_namespace_node *node;
|
2008-04-10 09:06:42 -06:00
|
|
|
u8 *start = parser_state->aml;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE(ps_get_next_namepath);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
path = acpi_ps_get_next_namestring(parser_state);
|
2005-12-16 15:05:00 -07:00
|
|
|
acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-12-16 15:05:00 -07:00
|
|
|
/* Null path case is allowed, just exit */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-12-16 15:05:00 -07:00
|
|
|
if (!path) {
|
|
|
|
arg->common.value.name = path;
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-04-10 09:06:38 -06:00
|
|
|
* Lookup the name in the internal namespace, starting with the current
|
|
|
|
* scope. We don't want to add anything new to the namespace here,
|
|
|
|
* however, so we use MODE_EXECUTE.
|
2005-12-16 15:05:00 -07:00
|
|
|
* Allow searching of the parent tree, but don't open a new scope -
|
|
|
|
* we just want to lookup the object (must be mode EXECUTE to perform
|
|
|
|
* the upsearch)
|
|
|
|
*/
|
2008-04-10 09:06:38 -06:00
|
|
|
status = acpi_ns_lookup(walk_state->scope_info, path,
|
|
|
|
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
|
|
|
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
|
|
|
|
NULL, &node);
|
2005-12-16 15:05:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If this name is a control method invocation, we must
|
|
|
|
* setup the method call
|
|
|
|
*/
|
|
|
|
if (ACPI_SUCCESS(status) &&
|
|
|
|
possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
|
2008-06-10 00:29:26 -06:00
|
|
|
if (walk_state->opcode == AML_UNLOAD_OP) {
|
2008-04-10 09:06:42 -06:00
|
|
|
/*
|
|
|
|
* acpi_ps_get_next_namestring has increased the AML pointer,
|
|
|
|
* so we need to restore the saved AML pointer for method call.
|
|
|
|
*/
|
|
|
|
walk_state->parser_state.aml = start;
|
|
|
|
walk_state->arg_count = 1;
|
|
|
|
acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-12-16 15:05:00 -07:00
|
|
|
/* This name is actually a control method invocation */
|
|
|
|
|
|
|
|
method_desc = acpi_ns_get_attached_object(node);
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
|
|
|
"Control Method - %p Desc %p Path=%p\n", node,
|
|
|
|
method_desc, path));
|
|
|
|
|
|
|
|
name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
|
|
|
|
if (!name_op) {
|
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Change Arg into a METHOD CALL and attach name to it */
|
|
|
|
|
|
|
|
acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
|
|
|
|
name_op->common.value.name = path;
|
|
|
|
|
|
|
|
/* Point METHODCALL/NAME to the METHOD Node */
|
|
|
|
|
|
|
|
name_op->common.node = node;
|
|
|
|
acpi_ps_append_arg(arg, name_op);
|
|
|
|
|
|
|
|
if (!method_desc) {
|
2006-01-27 14:43:00 -07:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Control Method %p has no attached object",
|
|
|
|
node));
|
2005-12-16 15:05:00 -07:00
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
|
|
|
"Control Method - %p Args %X\n",
|
|
|
|
node, method_desc->method.param_count));
|
|
|
|
|
|
|
|
/* Get the number of arguments to expect */
|
|
|
|
|
|
|
|
walk_state->arg_count = method_desc->method.param_count;
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Special handling if the name was not found during the lookup -
|
|
|
|
* some not_found cases are allowed
|
|
|
|
*/
|
|
|
|
if (status == AE_NOT_FOUND) {
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-12-16 15:05:00 -07:00
|
|
|
/* 1) not_found is ok during load pass 1/2 (allow forward references) */
|
|
|
|
|
|
|
|
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) !=
|
|
|
|
ACPI_PARSE_EXECUTE) {
|
|
|
|
status = AE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 2) not_found during a cond_ref_of(x) is ok by definition */
|
|
|
|
|
|
|
|
else if (walk_state->op->common.aml_opcode ==
|
|
|
|
AML_COND_REF_OF_OP) {
|
|
|
|
status = AE_OK;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-12-16 15:05:00 -07:00
|
|
|
* 3) not_found while building a Package is ok at this point, we
|
|
|
|
* may flag as an error later if slack mode is not enabled.
|
|
|
|
* (Some ASL code depends on allowing this behavior)
|
2005-04-16 16:20:36 -06:00
|
|
|
*/
|
2005-12-16 15:05:00 -07:00
|
|
|
else if ((arg->common.parent) &&
|
|
|
|
((arg->common.parent->common.aml_opcode ==
|
|
|
|
AML_PACKAGE_OP)
|
|
|
|
|| (arg->common.parent->common.aml_opcode ==
|
|
|
|
AML_VAR_PACKAGE_OP))) {
|
|
|
|
status = AE_OK;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
2005-12-16 15:05:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Final exception check (may have been changed from code above) */
|
|
|
|
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-27 14:43:00 -07:00
|
|
|
ACPI_ERROR_NAMESPACE(path, status);
|
2005-12-16 15:05:00 -07:00
|
|
|
|
|
|
|
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
|
|
|
|
ACPI_PARSE_EXECUTE) {
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-12-16 15:05:00 -07:00
|
|
|
/* Report a control method execution error */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-12-16 15:05:00 -07:00
|
|
|
status = acpi_ds_method_error(status, walk_state);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-16 15:05:00 -07:00
|
|
|
/* Save the namepath */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-12-16 15:05:00 -07:00
|
|
|
arg->common.value.name = path;
|
2005-08-04 22:44:28 -06:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ps_get_next_simple_arg
|
|
|
|
*
|
|
|
|
* PARAMETERS: parser_state - Current parser state object
|
|
|
|
* arg_type - The argument type (AML_*_ARG)
|
|
|
|
* Arg - Where the argument is returned
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get the next simple argument (constant, string, or namestring)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
void
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
|
|
|
|
u32 arg_type, union acpi_parse_object *arg)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-11-17 11:07:00 -07:00
|
|
|
u32 length;
|
|
|
|
u16 opcode;
|
|
|
|
u8 *aml = parser_state->aml;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE_U32(ps_get_next_simple_arg, arg_type);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
switch (arg_type) {
|
|
|
|
case ARGP_BYTEDATA:
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Get 1 byte from the AML stream */
|
|
|
|
|
|
|
|
opcode = AML_BYTE_OP;
|
|
|
|
arg->common.value.integer = (acpi_integer) * aml;
|
|
|
|
length = 1;
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_WORDDATA:
|
|
|
|
|
|
|
|
/* Get 2 bytes from the AML stream */
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
opcode = AML_WORD_OP;
|
|
|
|
ACPI_MOVE_16_TO_64(&arg->common.value.integer, aml);
|
|
|
|
length = 2;
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_DWORDDATA:
|
|
|
|
|
|
|
|
/* Get 4 bytes from the AML stream */
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
opcode = AML_DWORD_OP;
|
|
|
|
ACPI_MOVE_32_TO_64(&arg->common.value.integer, aml);
|
|
|
|
length = 4;
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_QWORDDATA:
|
|
|
|
|
|
|
|
/* Get 8 bytes from the AML stream */
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
opcode = AML_QWORD_OP;
|
|
|
|
ACPI_MOVE_64_TO_64(&arg->common.value.integer, aml);
|
|
|
|
length = 8;
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_CHARLIST:
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Get a pointer to the string, point past the string */
|
|
|
|
|
|
|
|
opcode = AML_STRING_OP;
|
|
|
|
arg->common.value.string = ACPI_CAST_PTR(char, aml);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
/* Find the null terminator */
|
|
|
|
|
|
|
|
length = 0;
|
|
|
|
while (aml[length]) {
|
|
|
|
length++;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
2005-11-17 11:07:00 -07:00
|
|
|
length++;
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_NAME:
|
|
|
|
case ARGP_NAMESTRING:
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
|
|
|
|
arg->common.value.name =
|
|
|
|
acpi_ps_get_next_namestring(parser_state);
|
2005-11-17 11:07:00 -07:00
|
|
|
return_VOID;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
default:
|
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_ERROR((AE_INFO, "Invalid ArgType %X", arg_type));
|
2005-11-17 11:07:00 -07:00
|
|
|
return_VOID;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2005-11-17 11:07:00 -07:00
|
|
|
acpi_ps_init_op(arg, opcode);
|
|
|
|
parser_state->aml += length;
|
2005-04-16 16:20:36 -06:00
|
|
|
return_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ps_get_next_field
|
|
|
|
*
|
|
|
|
* PARAMETERS: parser_state - Current parser state object
|
|
|
|
*
|
|
|
|
* RETURN: A newly allocated FIELD op
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get next field (named_field, reserved_field, or access_field)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
|
|
|
|
*parser_state)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
u32 aml_offset = (u32)
|
|
|
|
ACPI_PTR_DIFF(parser_state->aml,
|
|
|
|
parser_state->aml_start);
|
|
|
|
union acpi_parse_object *field;
|
|
|
|
u16 opcode;
|
|
|
|
u32 name;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE(ps_get_next_field);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
/* Determine field type */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
switch (ACPI_GET8(parser_state->aml)) {
|
2005-04-16 16:20:36 -06:00
|
|
|
default:
|
|
|
|
|
|
|
|
opcode = AML_INT_NAMEDFIELD_OP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x00:
|
|
|
|
|
|
|
|
opcode = AML_INT_RESERVEDFIELD_OP;
|
|
|
|
parser_state->aml++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x01:
|
|
|
|
|
|
|
|
opcode = AML_INT_ACCESSFIELD_OP;
|
|
|
|
parser_state->aml++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate a new field op */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
field = acpi_ps_alloc_op(opcode);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!field) {
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(NULL);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
field->common.aml_offset = aml_offset;
|
|
|
|
|
|
|
|
/* Decode the field type */
|
|
|
|
|
|
|
|
switch (opcode) {
|
|
|
|
case AML_INT_NAMEDFIELD_OP:
|
|
|
|
|
|
|
|
/* Get the 4-character name */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
ACPI_MOVE_32_TO_32(&name, parser_state->aml);
|
|
|
|
acpi_ps_set_name(field, name);
|
2005-04-16 16:20:36 -06:00
|
|
|
parser_state->aml += ACPI_NAME_SIZE;
|
|
|
|
|
|
|
|
/* Get the length which is encoded as a package length */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
field->common.value.size =
|
|
|
|
acpi_ps_get_next_package_length(parser_state);
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_INT_RESERVEDFIELD_OP:
|
|
|
|
|
|
|
|
/* Get the length which is encoded as a package length */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
field->common.value.size =
|
|
|
|
acpi_ps_get_next_package_length(parser_state);
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_INT_ACCESSFIELD_OP:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get access_type and access_attrib and merge into the field Op
|
|
|
|
* access_type is first operand, access_attribute is second
|
|
|
|
*/
|
2005-08-04 22:44:28 -06:00
|
|
|
field->common.value.integer =
|
2005-11-17 11:07:00 -07:00
|
|
|
(((u32) ACPI_GET8(parser_state->aml) << 8));
|
2005-04-16 16:20:36 -06:00
|
|
|
parser_state->aml++;
|
2005-08-04 22:44:28 -06:00
|
|
|
field->common.value.integer |= ACPI_GET8(parser_state->aml);
|
2005-04-16 16:20:36 -06:00
|
|
|
parser_state->aml++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* Opcode was set in previous switch */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
return_PTR(field);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ps_get_next_arg
|
|
|
|
*
|
2005-04-18 20:49:35 -06:00
|
|
|
* PARAMETERS: walk_state - Current state
|
|
|
|
* parser_state - Current parser state object
|
2005-04-16 16:20:36 -06:00
|
|
|
* arg_type - The argument type (AML_*_ARG)
|
2005-04-18 20:49:35 -06:00
|
|
|
* return_arg - Where the next arg is returned
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
* RETURN: Status, and an op object containing the next argument.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get next argument (including complex list arguments that require
|
|
|
|
* pushing the parser stack)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
|
|
|
|
struct acpi_parse_state *parser_state,
|
|
|
|
u32 arg_type, union acpi_parse_object **return_arg)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2005-08-04 22:44:28 -06:00
|
|
|
union acpi_parse_object *arg = NULL;
|
|
|
|
union acpi_parse_object *prev = NULL;
|
|
|
|
union acpi_parse_object *field;
|
|
|
|
u32 subop;
|
|
|
|
acpi_status status = AE_OK;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ps_get_next_arg, parser_state);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
switch (arg_type) {
|
|
|
|
case ARGP_BYTEDATA:
|
|
|
|
case ARGP_WORDDATA:
|
|
|
|
case ARGP_DWORDDATA:
|
|
|
|
case ARGP_CHARLIST:
|
|
|
|
case ARGP_NAME:
|
|
|
|
case ARGP_NAMESTRING:
|
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
/* Constants, strings, and namestrings are all the same size */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
arg = acpi_ps_alloc_op(AML_BYTE_OP);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!arg) {
|
2005-08-04 22:44:28 -06:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
2005-08-04 22:44:28 -06:00
|
|
|
acpi_ps_get_next_simple_arg(parser_state, arg_type, arg);
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_PKGLENGTH:
|
|
|
|
|
|
|
|
/* Package length, nothing returned */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
parser_state->pkg_end =
|
|
|
|
acpi_ps_get_next_package_end(parser_state);
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_FIELDLIST:
|
|
|
|
|
|
|
|
if (parser_state->aml < parser_state->pkg_end) {
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/* Non-empty list */
|
|
|
|
|
|
|
|
while (parser_state->aml < parser_state->pkg_end) {
|
2005-08-04 22:44:28 -06:00
|
|
|
field = acpi_ps_get_next_field(parser_state);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!field) {
|
2005-08-04 22:44:28 -06:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (prev) {
|
|
|
|
prev->common.next = field;
|
2005-08-04 22:44:28 -06:00
|
|
|
} else {
|
2005-04-16 16:20:36 -06:00
|
|
|
arg = field;
|
|
|
|
}
|
|
|
|
prev = field;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Skip to End of byte data */
|
|
|
|
|
|
|
|
parser_state->aml = parser_state->pkg_end;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_BYTELIST:
|
|
|
|
|
|
|
|
if (parser_state->aml < parser_state->pkg_end) {
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/* Non-empty list */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!arg) {
|
2005-08-04 22:44:28 -06:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Fill in bytelist data */
|
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
arg->common.value.size = (u32)
|
2005-08-04 22:44:28 -06:00
|
|
|
ACPI_PTR_DIFF(parser_state->pkg_end,
|
|
|
|
parser_state->aml);
|
2005-04-16 16:20:36 -06:00
|
|
|
arg->named.data = parser_state->aml;
|
|
|
|
|
|
|
|
/* Skip to End of byte data */
|
|
|
|
|
|
|
|
parser_state->aml = parser_state->pkg_end;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_TARGET:
|
|
|
|
case ARGP_SUPERNAME:
|
|
|
|
case ARGP_SIMPLENAME:
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
subop = acpi_ps_peek_opcode(parser_state);
|
|
|
|
if (subop == 0 ||
|
|
|
|
acpi_ps_is_leading_char(subop) ||
|
|
|
|
acpi_ps_is_prefix_char(subop)) {
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/* null_name or name_string */
|
|
|
|
|
2005-08-04 22:44:28 -06:00
|
|
|
arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!arg) {
|
2005-08-04 22:44:28 -06:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2008-04-10 09:06:42 -06:00
|
|
|
/* To support super_name arg of Unload */
|
|
|
|
|
2008-06-10 00:29:26 -06:00
|
|
|
if (walk_state->opcode == AML_UNLOAD_OP) {
|
2008-04-10 09:06:42 -06:00
|
|
|
status =
|
|
|
|
acpi_ps_get_next_namepath(walk_state,
|
|
|
|
parser_state, arg,
|
|
|
|
1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the super_name arg of Unload is a method call,
|
|
|
|
* we have restored the AML pointer, just free this Arg
|
|
|
|
*/
|
|
|
|
if (arg->common.aml_opcode ==
|
|
|
|
AML_INT_METHODCALL_OP) {
|
|
|
|
acpi_ps_free_op(arg);
|
|
|
|
arg = NULL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
status =
|
|
|
|
acpi_ps_get_next_namepath(walk_state,
|
|
|
|
parser_state, arg,
|
|
|
|
0);
|
|
|
|
}
|
2005-08-04 22:44:28 -06:00
|
|
|
} else {
|
2005-04-18 20:49:35 -06:00
|
|
|
/* Single complex argument, nothing returned */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
walk_state->arg_count = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_DATAOBJ:
|
|
|
|
case ARGP_TERMARG:
|
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
/* Single complex argument, nothing returned */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
walk_state->arg_count = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGP_DATAOBJLIST:
|
|
|
|
case ARGP_TERMLIST:
|
|
|
|
case ARGP_OBJLIST:
|
|
|
|
|
|
|
|
if (parser_state->aml < parser_state->pkg_end) {
|
2006-10-01 22:00:00 -06:00
|
|
|
|
2005-04-18 20:49:35 -06:00
|
|
|
/* Non-empty list of variable arguments, nothing returned */
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
walk_state->arg_count = ACPI_VAR_ARGS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 15:15:00 -06:00
|
|
|
ACPI_ERROR((AE_INFO, "Invalid ArgType: %X", arg_type));
|
2005-04-16 16:20:36 -06:00
|
|
|
status = AE_AML_OPERAND_TYPE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
*return_arg = arg;
|
2005-08-04 22:44:28 -06:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|