2005-04-17 02:20:36 +04:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: dsfield - Dispatcher field routines
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2015-02-05 10:20:45 +03:00
|
|
|
* Copyright (C) 2000 - 2015, Intel Corp.
|
2005-04-17 02:20:36 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 08:30:03 +03:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "amlcode.h"
|
|
|
|
#include "acdispat.h"
|
|
|
|
#include "acinterp.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "acparser.h"
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_DISPATCHER
|
2005-08-05 08:44:28 +04:00
|
|
|
ACPI_MODULE_NAME("dsfield")
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-04-19 06:49:35 +04:00
|
|
|
/* Local prototypes */
|
2012-05-22 12:22:01 +04:00
|
|
|
#ifdef ACPI_ASL_COMPILER
|
|
|
|
#include "acdisasm.h"
|
|
|
|
static acpi_status
|
|
|
|
acpi_ds_create_external_region(acpi_status lookup_status,
|
|
|
|
union acpi_parse_object *op,
|
|
|
|
char *path,
|
|
|
|
struct acpi_walk_state *walk_state,
|
|
|
|
struct acpi_namespace_node **node);
|
|
|
|
#endif
|
|
|
|
|
2005-04-19 06:49:35 +04:00
|
|
|
static acpi_status
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_ds_get_field_names(struct acpi_create_field_info *info,
|
|
|
|
struct acpi_walk_state *walk_state,
|
|
|
|
union acpi_parse_object *arg);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2012-05-22 12:22:01 +04:00
|
|
|
#ifdef ACPI_ASL_COMPILER
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2012-07-12 05:40:10 +04:00
|
|
|
* FUNCTION: acpi_ds_create_external_region (iASL Disassembler only)
|
2012-05-22 12:22:01 +04:00
|
|
|
*
|
|
|
|
* PARAMETERS: lookup_status - Status from ns_lookup operation
|
2012-07-12 05:40:10 +04:00
|
|
|
* op - Op containing the Field definition and args
|
|
|
|
* path - Pathname of the region
|
2012-05-22 12:22:01 +04:00
|
|
|
* ` walk_state - Current method state
|
2012-07-12 05:40:10 +04:00
|
|
|
* node - Where the new region node is returned
|
2012-05-22 12:22:01 +04:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new
|
|
|
|
* region node/object.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static acpi_status
|
|
|
|
acpi_ds_create_external_region(acpi_status lookup_status,
|
|
|
|
union acpi_parse_object *op,
|
|
|
|
char *path,
|
|
|
|
struct acpi_walk_state *walk_state,
|
|
|
|
struct acpi_namespace_node **node)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
|
|
|
|
if (lookup_status != AE_NOT_FOUND) {
|
|
|
|
return (lookup_status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Table disassembly:
|
|
|
|
* operation_region not found. Generate an External for it, and
|
|
|
|
* insert the name into the namespace.
|
|
|
|
*/
|
2014-01-08 09:43:18 +04:00
|
|
|
acpi_dm_add_op_to_external_list(op, path, ACPI_TYPE_REGION, 0, 0);
|
2012-05-22 12:22:01 +04:00
|
|
|
status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION,
|
|
|
|
ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
|
|
|
|
walk_state, node);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Must create and install a region object for the new node */
|
|
|
|
|
|
|
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
|
|
|
|
if (!obj_desc) {
|
|
|
|
return (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
obj_desc->region.node = *node;
|
|
|
|
status = acpi_ns_attach_object(*node, obj_desc, ACPI_TYPE_REGION);
|
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_create_buffer_field
|
|
|
|
*
|
2012-07-12 05:40:10 +04:00
|
|
|
* PARAMETERS: op - Current parse op (create_XXField)
|
2005-04-17 02:20:36 +04:00
|
|
|
* walk_state - Current state
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Execute the create_field operators:
|
|
|
|
* create_bit_field_op,
|
|
|
|
* create_byte_field_op,
|
|
|
|
* create_word_field_op,
|
|
|
|
* create_dword_field_op,
|
|
|
|
* create_qword_field_op,
|
2005-04-19 06:49:35 +04:00
|
|
|
* create_field_op (all of which define a field in a buffer)
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_ds_create_buffer_field(union acpi_parse_object *op,
|
|
|
|
struct acpi_walk_state *walk_state)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2005-08-05 08:44:28 +04:00
|
|
|
union acpi_parse_object *arg;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
acpi_status status;
|
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
union acpi_operand_object *second_desc = NULL;
|
|
|
|
u32 flags;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 01:15:00 +04:00
|
|
|
ACPI_FUNCTION_TRACE(ds_create_buffer_field);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2008-04-10 19:06:44 +04:00
|
|
|
/*
|
|
|
|
* Get the name_string argument (name of the new buffer_field)
|
|
|
|
*/
|
2005-04-17 02:20:36 +04:00
|
|
|
if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
|
2008-04-10 19:06:44 +04:00
|
|
|
|
|
|
|
/* For create_field, name is the 4th argument */
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
arg = acpi_ps_get_arg(op, 3);
|
|
|
|
} else {
|
2012-07-12 05:40:10 +04:00
|
|
|
/* For all other create_XXXField operators, name is the 3rd argument */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
arg = acpi_ps_get_arg(op, 2);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!arg) {
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (walk_state->deferred_node) {
|
|
|
|
node = walk_state->deferred_node;
|
|
|
|
status = AE_OK;
|
2005-08-05 08:44:28 +04:00
|
|
|
} else {
|
2008-04-10 19:06:44 +04:00
|
|
|
/* Execute flag should always be set when this function is entered */
|
|
|
|
|
|
|
|
if (!(walk_state->parse_flags & ACPI_PARSE_EXECUTE)) {
|
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2008-04-10 19:06:44 +04:00
|
|
|
/* Creating new namespace node, should not already exist */
|
|
|
|
|
|
|
|
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
|
|
|
|
ACPI_NS_ERROR_IF_FOUND;
|
|
|
|
|
2009-08-13 10:03:15 +04:00
|
|
|
/*
|
|
|
|
* Mark node temporary if we are executing a normal control
|
|
|
|
* method. (Don't mark if this is a module-level code method)
|
|
|
|
*/
|
|
|
|
if (walk_state->method_node &&
|
|
|
|
!(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
|
2008-04-10 19:06:44 +04:00
|
|
|
flags |= ACPI_NS_TEMPORARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enter the name_string into the namespace */
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
status =
|
|
|
|
acpi_ns_lookup(walk_state->scope_info,
|
|
|
|
arg->common.value.string, ACPI_TYPE_ANY,
|
|
|
|
ACPI_IMODE_LOAD_PASS1, flags, walk_state,
|
2008-04-10 19:06:44 +04:00
|
|
|
&node);
|
2005-08-05 08:44:28 +04:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-02 19:48:18 +03:00
|
|
|
/*
|
|
|
|
* We could put the returned object (Node) on the object stack for later,
|
2005-04-19 06:49:35 +04:00
|
|
|
* but for now, we will put it in the "op" object that the parser uses,
|
2008-04-10 19:06:44 +04:00
|
|
|
* so we can get it again at the end of this scope.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
op->common.node = node;
|
|
|
|
|
|
|
|
/*
|
2005-04-19 06:49:35 +04:00
|
|
|
* If there is no object attached to the node, this node was just created
|
2008-04-10 19:06:44 +04:00
|
|
|
* and we need to create the field object. Otherwise, this was a lookup
|
2005-04-19 06:49:35 +04:00
|
|
|
* of an existing node and we don't want to create the field object again.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
2005-08-05 08:44:28 +04:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-17 02:20:36 +04:00
|
|
|
if (obj_desc) {
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The Field definition is not fully parsed at this time.
|
|
|
|
* (We must save the address of the AML for the buffer and index operands)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Create the buffer field object */
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER_FIELD);
|
2005-04-17 02:20:36 +04:00
|
|
|
if (!obj_desc) {
|
|
|
|
status = AE_NO_MEMORY;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-04-10 19:06:44 +04:00
|
|
|
* Remember location in AML stream of the field unit opcode and operands --
|
|
|
|
* since the buffer and index operands must be evaluated.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
2005-08-05 08:44:28 +04:00
|
|
|
second_desc = obj_desc->common.next_object;
|
2005-04-17 02:20:36 +04:00
|
|
|
second_desc->extra.aml_start = op->named.data;
|
|
|
|
second_desc->extra.aml_length = op->named.length;
|
|
|
|
obj_desc->buffer_field.node = node;
|
|
|
|
|
|
|
|
/* Attach constructed field descriptors to parent node */
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 02:20:36 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2013-10-29 05:30:02 +04:00
|
|
|
cleanup:
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* Remove local reference to the object */
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_get_field_names
|
|
|
|
*
|
2012-07-12 05:40:10 +04:00
|
|
|
* PARAMETERS: info - create_field info structure
|
2005-04-17 02:20:36 +04:00
|
|
|
* ` walk_state - Current method state
|
2012-07-12 05:40:10 +04:00
|
|
|
* arg - First parser arg for the field name list
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2012-10-31 06:26:55 +04:00
|
|
|
* DESCRIPTION: Process all named fields in a field declaration. Names are
|
2005-04-17 02:20:36 +04:00
|
|
|
* entered into the namespace.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-04-19 06:49:35 +04:00
|
|
|
static acpi_status
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_ds_get_field_names(struct acpi_create_field_info *info,
|
|
|
|
struct acpi_walk_state *walk_state,
|
|
|
|
union acpi_parse_object *arg)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_status status;
|
2010-01-21 05:06:32 +03:00
|
|
|
u64 position;
|
2011-11-16 09:39:07 +04:00
|
|
|
union acpi_parse_object *child;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 01:15:00 +04:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* First field starts at bit zero */
|
|
|
|
|
|
|
|
info->field_bit_position = 0;
|
|
|
|
|
|
|
|
/* Process all elements in the field list (of parse nodes) */
|
|
|
|
|
|
|
|
while (arg) {
|
|
|
|
/*
|
2011-11-16 09:39:07 +04:00
|
|
|
* Four types of field elements are handled:
|
2012-07-12 05:40:10 +04:00
|
|
|
* 1) name - Enters a new named field into the namespace
|
|
|
|
* 2) offset - specifies a bit offset
|
2011-11-16 09:39:07 +04:00
|
|
|
* 3) access_as - changes the access mode/attributes
|
2012-07-12 05:40:10 +04:00
|
|
|
* 4) connection - Associate a resource template with the field
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
switch (arg->common.aml_opcode) {
|
|
|
|
case AML_INT_RESERVEDFIELD_OP:
|
|
|
|
|
2010-01-21 05:06:32 +03:00
|
|
|
position = (u64) info->field_bit_position
|
|
|
|
+ (u64) arg->common.value.size;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
if (position > ACPI_UINT32_MAX) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Bit offset within field too large (> 0xFFFFFFFF)"));
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(AE_SUPPORT);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
info->field_bit_position = (u32) position;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_INT_ACCESSFIELD_OP:
|
2011-11-16 09:39:07 +04:00
|
|
|
case AML_INT_EXTACCESSFIELD_OP:
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
2011-11-16 09:39:07 +04:00
|
|
|
* Get new access_type, access_attribute, and access_length fields
|
|
|
|
* -- to be used for all field units that follow, until the
|
|
|
|
* end-of-field or another access_as keyword is encountered.
|
|
|
|
* NOTE. These three bytes are encoded in the integer value
|
|
|
|
* of the parseop for convenience.
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
2005-04-19 06:49:35 +04:00
|
|
|
* In field_flags, preserve the flag bits other than the
|
2011-11-16 09:39:07 +04:00
|
|
|
* ACCESS_TYPE bits.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
2011-11-16 09:39:07 +04:00
|
|
|
|
|
|
|
/* access_type (byte_acc, word_acc, etc.) */
|
|
|
|
|
2005-04-19 06:49:35 +04:00
|
|
|
info->field_flags = (u8)
|
2005-08-05 08:44:28 +04:00
|
|
|
((info->
|
|
|
|
field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
|
2011-11-16 09:39:07 +04:00
|
|
|
((u8)((u32)(arg->common.value.integer & 0x07))));
|
|
|
|
|
|
|
|
/* access_attribute (attrib_quick, attrib_byte, etc.) */
|
|
|
|
|
|
|
|
info->attribute =
|
|
|
|
(u8)((arg->common.value.integer >> 8) & 0xFF);
|
|
|
|
|
|
|
|
/* access_length (for serial/buffer protocols) */
|
|
|
|
|
|
|
|
info->access_length =
|
|
|
|
(u8)((arg->common.value.integer >> 16) & 0xFF);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_INT_CONNECTION_OP:
|
|
|
|
/*
|
|
|
|
* Clear any previous connection. New connection is used for all
|
|
|
|
* fields that follow, similar to access_as
|
|
|
|
*/
|
|
|
|
info->resource_buffer = NULL;
|
|
|
|
info->connection_node = NULL;
|
2014-09-23 06:35:47 +04:00
|
|
|
info->pin_number_index = 0;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2011-11-16 09:39:07 +04:00
|
|
|
/*
|
|
|
|
* A Connection() is either an actual resource descriptor (buffer)
|
|
|
|
* or a named reference to a resource template
|
|
|
|
*/
|
|
|
|
child = arg->common.value.arg;
|
|
|
|
if (child->common.aml_opcode == AML_INT_BYTELIST_OP) {
|
|
|
|
info->resource_buffer = child->named.data;
|
|
|
|
info->resource_length =
|
|
|
|
(u16)child->named.value.integer;
|
|
|
|
} else {
|
|
|
|
/* Lookup the Connection() namepath, it should already exist */
|
|
|
|
|
|
|
|
status = acpi_ns_lookup(walk_state->scope_info,
|
|
|
|
child->common.value.
|
|
|
|
name, ACPI_TYPE_ANY,
|
|
|
|
ACPI_IMODE_EXECUTE,
|
|
|
|
ACPI_NS_DONT_OPEN_SCOPE,
|
|
|
|
walk_state,
|
|
|
|
&info->connection_node);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
ACPI_ERROR_NAMESPACE(child->common.
|
|
|
|
value.name,
|
|
|
|
status);
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_INT_NAMEDFIELD_OP:
|
|
|
|
|
2008-04-10 19:06:44 +04:00
|
|
|
/* Lookup the name, it should already exist */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
status = acpi_ns_lookup(walk_state->scope_info,
|
|
|
|
(char *)&arg->named.name,
|
|
|
|
info->field_type,
|
|
|
|
ACPI_IMODE_EXECUTE,
|
|
|
|
ACPI_NS_DONT_OPEN_SCOPE,
|
|
|
|
walk_state, &info->field_node);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
|
|
|
|
status);
|
2008-04-10 19:06:44 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-08-05 08:44:28 +04:00
|
|
|
} else {
|
2005-04-17 02:20:36 +04:00
|
|
|
arg->common.node = info->field_node;
|
|
|
|
info->field_bit_length = arg->common.value.size;
|
|
|
|
|
2008-04-10 19:06:41 +04:00
|
|
|
/*
|
2008-04-10 19:06:44 +04:00
|
|
|
* If there is no object attached to the node, this node was
|
|
|
|
* just created and we need to create the field object.
|
|
|
|
* Otherwise, this was a lookup of an existing node and we
|
|
|
|
* don't want to create the field object again.
|
2008-04-10 19:06:41 +04:00
|
|
|
*/
|
|
|
|
if (!acpi_ns_get_attached_object
|
|
|
|
(info->field_node)) {
|
|
|
|
status = acpi_ex_prep_field_value(info);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Keep track of bit position for the next field */
|
|
|
|
|
2010-01-21 05:06:32 +03:00
|
|
|
position = (u64) info->field_bit_position
|
|
|
|
+ (u64) arg->common.value.size;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
if (position > ACPI_UINT32_MAX) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
|
|
|
|
ACPI_CAST_PTR(char,
|
|
|
|
&info->field_node->
|
|
|
|
name)));
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(AE_SUPPORT);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
info->field_bit_position += info->field_bit_length;
|
2014-09-23 06:35:47 +04:00
|
|
|
info->pin_number_index++; /* Index relative to previous Connection() */
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2010-03-05 12:56:40 +03:00
|
|
|
"Invalid opcode in field list: 0x%X",
|
2006-01-28 00:43:00 +03:00
|
|
|
arg->common.aml_opcode));
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
arg = arg->common.next;
|
|
|
|
}
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_create_field
|
|
|
|
*
|
2012-07-12 05:40:10 +04:00
|
|
|
* PARAMETERS: op - Op containing the Field definition and args
|
2005-04-17 02:20:36 +04:00
|
|
|
* region_node - Object for the containing Operation Region
|
|
|
|
* ` walk_state - Current method state
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a new field in the specified operation region
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_ds_create_field(union acpi_parse_object *op,
|
|
|
|
struct acpi_namespace_node *region_node,
|
|
|
|
struct acpi_walk_state *walk_state)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_status status;
|
|
|
|
union acpi_parse_object *arg;
|
|
|
|
struct acpi_create_field_info info;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 01:15:00 +04:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_create_field, op);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* First arg is the name of the parent op_region (must already exist) */
|
|
|
|
|
|
|
|
arg = op->common.value.arg;
|
2012-05-22 12:22:01 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
if (!region_node) {
|
2005-08-05 08:44:28 +04:00
|
|
|
status =
|
|
|
|
acpi_ns_lookup(walk_state->scope_info,
|
|
|
|
arg->common.value.name, ACPI_TYPE_REGION,
|
|
|
|
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
|
|
|
|
walk_state, ®ion_node);
|
2012-05-22 12:22:01 +04:00
|
|
|
#ifdef ACPI_ASL_COMPILER
|
|
|
|
status = acpi_ds_create_external_region(status, arg,
|
|
|
|
arg->common.value.name,
|
|
|
|
walk_state,
|
|
|
|
®ion_node);
|
|
|
|
#endif
|
2005-08-05 08:44:28 +04:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-01 09:45:11 +03:00
|
|
|
memset(&info, 0, sizeof(struct acpi_create_field_info));
|
2011-11-16 09:39:07 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* Second arg is the field flags */
|
|
|
|
|
|
|
|
arg = arg->common.next;
|
|
|
|
info.field_flags = (u8) arg->common.value.integer;
|
|
|
|
info.attribute = 0;
|
|
|
|
|
|
|
|
/* Each remaining arg is a Named Field */
|
|
|
|
|
|
|
|
info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD;
|
|
|
|
info.region_node = region_node;
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_init_field_objects
|
|
|
|
*
|
2012-07-12 05:40:10 +04:00
|
|
|
* PARAMETERS: op - Op containing the Field definition and args
|
2005-04-17 02:20:36 +04:00
|
|
|
* ` walk_state - Current method state
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: For each "Field Unit" name in the argument list that is
|
|
|
|
* part of the field declaration, enter the name into the
|
|
|
|
* namespace.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_ds_init_field_objects(union acpi_parse_object *op,
|
|
|
|
struct acpi_walk_state *walk_state)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_status status;
|
|
|
|
union acpi_parse_object *arg = NULL;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
u8 type = 0;
|
2008-04-10 19:06:41 +04:00
|
|
|
u32 flags;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 01:15:00 +04:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2008-04-10 19:06:44 +04:00
|
|
|
/* Execute flag should always be set when this function is entered */
|
|
|
|
|
|
|
|
if (!(walk_state->parse_flags & ACPI_PARSE_EXECUTE)) {
|
|
|
|
if (walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP) {
|
|
|
|
|
|
|
|
/* bank_field Op is deferred, just return OK */
|
|
|
|
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
2008-04-10 19:06:41 +04:00
|
|
|
}
|
|
|
|
|
2008-04-10 19:06:44 +04:00
|
|
|
/*
|
|
|
|
* Get the field_list argument for this opcode. This is the start of the
|
|
|
|
* list of field elements.
|
|
|
|
*/
|
2005-04-17 02:20:36 +04:00
|
|
|
switch (walk_state->opcode) {
|
|
|
|
case AML_FIELD_OP:
|
2013-06-08 04:58:14 +04:00
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
arg = acpi_ps_get_arg(op, 2);
|
2005-04-17 02:20:36 +04:00
|
|
|
type = ACPI_TYPE_LOCAL_REGION_FIELD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_BANK_FIELD_OP:
|
2013-06-08 04:58:14 +04:00
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
arg = acpi_ps_get_arg(op, 4);
|
2005-04-17 02:20:36 +04:00
|
|
|
type = ACPI_TYPE_LOCAL_BANK_FIELD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_INDEX_FIELD_OP:
|
2013-06-08 04:58:14 +04:00
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
arg = acpi_ps_get_arg(op, 3);
|
2005-04-17 02:20:36 +04:00
|
|
|
type = ACPI_TYPE_LOCAL_INDEX_FIELD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 04:58:14 +04:00
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2008-04-10 19:06:44 +04:00
|
|
|
/* Creating new namespace node(s), should not already exist */
|
|
|
|
|
|
|
|
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
|
|
|
|
ACPI_NS_ERROR_IF_FOUND;
|
|
|
|
|
2009-08-13 10:03:15 +04:00
|
|
|
/*
|
|
|
|
* Mark node(s) temporary if we are executing a normal control
|
|
|
|
* method. (Don't mark if this is a module-level code method)
|
|
|
|
*/
|
|
|
|
if (walk_state->method_node &&
|
|
|
|
!(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
|
2008-04-10 19:06:44 +04:00
|
|
|
flags |= ACPI_NS_TEMPORARY;
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Walk the list of entries in the field_list
|
2008-06-10 09:00:32 +04:00
|
|
|
* Note: field_list can be of zero length. In this case, Arg will be NULL.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
while (arg) {
|
2008-04-10 19:06:44 +04:00
|
|
|
/*
|
2011-11-16 09:39:07 +04:00
|
|
|
* Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
|
|
|
|
* in the field names in order to enter them into the namespace.
|
2008-04-10 19:06:44 +04:00
|
|
|
*/
|
2005-04-17 02:20:36 +04:00
|
|
|
if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
|
2005-08-05 08:44:28 +04:00
|
|
|
status = acpi_ns_lookup(walk_state->scope_info,
|
2008-04-10 19:06:44 +04:00
|
|
|
(char *)&arg->named.name, type,
|
|
|
|
ACPI_IMODE_LOAD_PASS1, flags,
|
|
|
|
walk_state, &node);
|
2005-08-05 08:44:28 +04:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
|
|
|
|
status);
|
2005-04-17 02:20:36 +04:00
|
|
|
if (status != AE_ALREADY_EXISTS) {
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Name already exists, just ignore this error */
|
|
|
|
|
|
|
|
status = AE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
arg->common.node = node;
|
|
|
|
}
|
|
|
|
|
2008-04-10 19:06:44 +04:00
|
|
|
/* Get the next field element in the list */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
arg = arg->common.next;
|
|
|
|
}
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_create_bank_field
|
|
|
|
*
|
2012-07-12 05:40:10 +04:00
|
|
|
* PARAMETERS: op - Op containing the Field definition and args
|
2005-04-17 02:20:36 +04:00
|
|
|
* region_node - Object for the containing Operation Region
|
2008-04-10 19:06:41 +04:00
|
|
|
* walk_state - Current method state
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a new bank field in the specified operation region
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_ds_create_bank_field(union acpi_parse_object *op,
|
|
|
|
struct acpi_namespace_node *region_node,
|
|
|
|
struct acpi_walk_state *walk_state)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_status status;
|
|
|
|
union acpi_parse_object *arg;
|
|
|
|
struct acpi_create_field_info info;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 01:15:00 +04:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_create_bank_field, op);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* First arg is the name of the parent op_region (must already exist) */
|
|
|
|
|
|
|
|
arg = op->common.value.arg;
|
|
|
|
if (!region_node) {
|
2005-08-05 08:44:28 +04:00
|
|
|
status =
|
|
|
|
acpi_ns_lookup(walk_state->scope_info,
|
|
|
|
arg->common.value.name, ACPI_TYPE_REGION,
|
|
|
|
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
|
|
|
|
walk_state, ®ion_node);
|
2012-05-22 12:22:01 +04:00
|
|
|
#ifdef ACPI_ASL_COMPILER
|
|
|
|
status = acpi_ds_create_external_region(status, arg,
|
|
|
|
arg->common.value.name,
|
|
|
|
walk_state,
|
|
|
|
®ion_node);
|
|
|
|
#endif
|
2005-08-05 08:44:28 +04:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Second arg is the Bank Register (Field) (must already exist) */
|
|
|
|
|
|
|
|
arg = arg->common.next;
|
2005-08-05 08:44:28 +04:00
|
|
|
status =
|
|
|
|
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
|
|
|
|
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
|
|
|
ACPI_NS_SEARCH_PARENT, walk_state,
|
|
|
|
&info.register_node);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2008-04-10 19:06:41 +04:00
|
|
|
/*
|
|
|
|
* Third arg is the bank_value
|
|
|
|
* This arg is a term_arg, not a constant
|
|
|
|
* It will be evaluated later, by acpi_ds_eval_bank_field_operands
|
|
|
|
*/
|
2005-04-17 02:20:36 +04:00
|
|
|
arg = arg->common.next;
|
2007-02-02 19:48:18 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* Fourth arg is the field flags */
|
|
|
|
|
|
|
|
arg = arg->common.next;
|
|
|
|
info.field_flags = (u8) arg->common.value.integer;
|
|
|
|
|
|
|
|
/* Each remaining arg is a Named Field */
|
|
|
|
|
|
|
|
info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD;
|
|
|
|
info.region_node = region_node;
|
|
|
|
|
2008-04-10 19:06:41 +04:00
|
|
|
/*
|
|
|
|
* Use Info.data_register_node to store bank_field Op
|
|
|
|
* It's safe because data_register_node will never be used when create bank field
|
|
|
|
* We store aml_start and aml_length in the bank_field Op for late evaluation
|
|
|
|
* Used in acpi_ex_prep_field_value(Info)
|
|
|
|
*
|
|
|
|
* TBD: Or, should we add a field in struct acpi_create_field_info, like "void *ParentOp"?
|
|
|
|
*/
|
|
|
|
info.data_register_node = (struct acpi_namespace_node *)op;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2008-04-10 19:06:41 +04:00
|
|
|
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_create_index_field
|
|
|
|
*
|
2012-07-12 05:40:10 +04:00
|
|
|
* PARAMETERS: op - Op containing the Field definition and args
|
2005-04-17 02:20:36 +04:00
|
|
|
* region_node - Object for the containing Operation Region
|
|
|
|
* ` walk_state - Current method state
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Create a new index field in the specified operation region
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_ds_create_index_field(union acpi_parse_object *op,
|
|
|
|
struct acpi_namespace_node *region_node,
|
|
|
|
struct acpi_walk_state *walk_state)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2005-08-05 08:44:28 +04:00
|
|
|
acpi_status status;
|
|
|
|
union acpi_parse_object *arg;
|
|
|
|
struct acpi_create_field_info info;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 01:15:00 +04:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_create_index_field, op);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* First arg is the name of the Index register (must already exist) */
|
|
|
|
|
|
|
|
arg = op->common.value.arg;
|
2005-08-05 08:44:28 +04:00
|
|
|
status =
|
|
|
|
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
|
|
|
|
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
|
|
|
ACPI_NS_SEARCH_PARENT, walk_state,
|
|
|
|
&info.register_node);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Second arg is the data register (must already exist) */
|
|
|
|
|
|
|
|
arg = arg->common.next;
|
2005-08-05 08:44:28 +04:00
|
|
|
status =
|
|
|
|
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
|
|
|
|
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
|
|
|
ACPI_NS_SEARCH_PARENT, walk_state,
|
|
|
|
&info.data_register_node);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2006-01-28 00:43:00 +03:00
|
|
|
ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
|
2005-08-05 08:44:28 +04:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Next arg is the field flags */
|
|
|
|
|
|
|
|
arg = arg->common.next;
|
|
|
|
info.field_flags = (u8) arg->common.value.integer;
|
|
|
|
|
|
|
|
/* Each remaining arg is a Named Field */
|
|
|
|
|
|
|
|
info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD;
|
|
|
|
info.region_node = region_node;
|
|
|
|
|
2005-08-05 08:44:28 +04:00
|
|
|
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|