Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117295
b: refs/heads/master
c: bbc2413
h: refs/heads/master
i:
  117293: ed2848f
  117291: 8c2f0bf
  117287: a176fa2
  117279: 68e3a8e
v: v3
  • Loading branch information
Lin Ming authored and Len Brown committed Oct 23, 2008
1 parent 842e084 commit ced02c7
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b417d40b9a850f12f69aa9d785d2af39c9463bb8
refs/heads/master: bbc241340681557a16982f4d1840f00963bc05b4
79 changes: 79 additions & 0 deletions trunk/drivers/acpi/namespace/nsxfeval.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>

#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsxfeval")

/* Local prototypes */
static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);

#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
Expand All @@ -69,6 +74,7 @@ ACPI_MODULE_NAME("nsxfeval")
* be valid (non-null)
*
******************************************************************************/

acpi_status
acpi_evaluate_object_typed(acpi_handle handle,
acpi_string pathname,
Expand Down Expand Up @@ -283,6 +289,10 @@ acpi_evaluate_object(acpi_handle handle,

if (ACPI_SUCCESS(status)) {

/* Dereference Index and ref_of references */

acpi_ns_resolve_references(info);

/* Get the size of the returned object */

status =
Expand Down Expand Up @@ -350,6 +360,74 @@ acpi_evaluate_object(acpi_handle handle,

ACPI_EXPORT_SYMBOL(acpi_evaluate_object)

/*******************************************************************************
*
* FUNCTION: acpi_ns_resolve_references
*
* PARAMETERS: Info - Evaluation info block
*
* RETURN: Info->return_object is replaced with the dereferenced object
*
* DESCRIPTION: Dereference certain reference objects. Called before an
* internal return object is converted to an external union acpi_object.
*
* Performs an automatic dereference of Index and ref_of reference objects.
* These reference objects are not supported by the union acpi_object, so this is a
* last resort effort to return something useful. Also, provides compatibility
* with other ACPI implementations.
*
* NOTE: does not handle references within returned package objects or nested
* references, but this support could be added later if found to be necessary.
*
******************************************************************************/
static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
{
union acpi_operand_object *obj_desc = NULL;
struct acpi_namespace_node *node;

/* We are interested in reference objects only */

if (ACPI_GET_OBJECT_TYPE(info->return_object) !=
ACPI_TYPE_LOCAL_REFERENCE) {
return;
}

/*
* Two types of references are supported - those created by Index and
* ref_of operators. A name reference (AML_NAMEPATH_OP) can be converted
* to an union acpi_object, so it is not dereferenced here. A ddb_handle
* (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
* an union acpi_object.
*/
switch (info->return_object->reference.opcode) {
case AML_INDEX_OP:

obj_desc = *(info->return_object->reference.where);
break;

case AML_REF_OF_OP:

node = info->return_object->reference.object;
if (node) {
obj_desc = node->object;
}
break;

default:
return;
}

/* Replace the existing reference object */

if (obj_desc) {
acpi_ut_add_reference(obj_desc);
acpi_ut_remove_reference(info->return_object);
info->return_object = obj_desc;
}

return;
}

/*******************************************************************************
*
* FUNCTION: acpi_walk_namespace
Expand Down Expand Up @@ -379,6 +457,7 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object)
* function, etc.
*
******************************************************************************/

acpi_status
acpi_walk_namespace(acpi_object_type type,
acpi_handle start_object,
Expand Down

0 comments on commit ced02c7

Please sign in to comment.