Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367573
b: refs/heads/master
c: d5a3610
h: refs/heads/master
i:
  367571: 80e6a91
v: v3
  • Loading branch information
Bob Moore authored and Rafael J. Wysocki committed Mar 11, 2013
1 parent a2ef4a2 commit 2c7f50e
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 88 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6be58e2f21edd7362d985e0a44060352458c0f49
refs/heads/master: d5a36100f62fa6db5541344e08b361b34e9114c5
15 changes: 15 additions & 0 deletions trunk/drivers/acpi/acpica/aclocal.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ struct acpi_predefined_data {
union acpi_operand_object *parent_package;
struct acpi_namespace_node *node;
u32 flags;
u32 return_btype;
u8 node_flags;
};

Expand All @@ -371,6 +372,20 @@ struct acpi_predefined_data {
#define ACPI_OBJECT_REPAIRED 1
#define ACPI_OBJECT_WRAPPED 2

/* Return object auto-repair info */

typedef acpi_status(*acpi_object_converter) (union acpi_operand_object
*original_object,
union acpi_operand_object
**converted_object);

struct acpi_simple_repair_info {
char name[ACPI_NAME_SIZE];
u32 unexpected_btypes;
u32 package_index;
acpi_object_converter object_converter;
};

/*
* Bitmapped return value types
* Note: the actual data types must be contiguous, a loop in nspredef.c
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/acpi/acpica/acnamesp.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
* predefined methods/objects
*/
acpi_status
acpi_ns_repair_object(struct acpi_predefined_data *data,
acpi_ns_simple_repair(struct acpi_predefined_data *data,
u32 expected_btypes,
u32 package_index,
union acpi_operand_object **return_object_ptr);
Expand Down
141 changes: 67 additions & 74 deletions trunk/drivers/acpi/acpica/nspredef.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ acpi_ns_check_reference(struct acpi_predefined_data *data,

static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes);

static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object);

/*
* Names for the types that can be returned by the predefined objects.
* Used for warning messages. Must be in the same order as the ACPI_RTYPEs
Expand Down Expand Up @@ -112,7 +114,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
acpi_status return_status,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
acpi_status status = AE_OK;
const union acpi_predefined_info *predefined;
char *pathname;
Expand Down Expand Up @@ -151,25 +152,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
goto cleanup;
}

/*
* If there is no return value, check if we require a return value for
* this predefined name. Either one return value is expected, or none,
* for both methods and other objects.
*
* Exit now if there is no return object. Warning if one was expected.
*/
if (!return_object) {
if ((predefined->info.expected_btypes) &&
(!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Missing expected return value"));

status = AE_AML_NO_RETURN_VALUE;
}
goto cleanup;
}

/*
* Return value validation and possible repair.
*
Expand Down Expand Up @@ -410,28 +392,12 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
{
union acpi_operand_object *return_object = *return_object_ptr;
acpi_status status = AE_OK;
u32 return_btype;
char type_buffer[48]; /* Room for 5 types */

/*
* If we get a NULL return_object here, it is a NULL package element.
* Since all extraneous NULL package elements were removed earlier by a
* call to acpi_ns_remove_null_elements, this is an unexpected NULL element.
* We will attempt to repair it.
*/
if (!return_object) {
status = acpi_ns_repair_null_element(data, expected_btypes,
package_index,
return_object_ptr);
if (ACPI_SUCCESS(status)) {
return (AE_OK); /* Repair was successful */
}
goto type_error_exit;
}

/* A Namespace node should not get here, but make sure */

if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
if (return_object &&
ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
"Invalid return type - Found a Namespace node [%4.4s] type %s",
return_object->node.name.ascii,
Expand All @@ -448,53 +414,25 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
* from all of the predefined names (including elements of returned
* packages)
*/
switch (return_object->common.type) {
case ACPI_TYPE_INTEGER:
return_btype = ACPI_RTYPE_INTEGER;
break;

case ACPI_TYPE_BUFFER:
return_btype = ACPI_RTYPE_BUFFER;
break;

case ACPI_TYPE_STRING:
return_btype = ACPI_RTYPE_STRING;
break;
data->return_btype = acpi_ns_get_bitmapped_type(return_object);
if (data->return_btype == ACPI_RTYPE_ANY) {

case ACPI_TYPE_PACKAGE:
return_btype = ACPI_RTYPE_PACKAGE;
break;

case ACPI_TYPE_LOCAL_REFERENCE:
return_btype = ACPI_RTYPE_REFERENCE;
break;

default:
/* Not one of the supported objects, must be incorrect */

goto type_error_exit;
}

/* Is the object one of the expected types? */

if (return_btype & expected_btypes) {

/* For reference objects, check that the reference type is correct */

if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
status = acpi_ns_check_reference(data, return_object);
}
/* For reference objects, check that the reference type is correct */

if ((data->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) {
status = acpi_ns_check_reference(data, return_object);
return (status);
}

/* Type mismatch -- attempt repair of the returned object */
/* Attempt simple repair of the returned object if necessary */

status = acpi_ns_repair_object(data, expected_btypes,
status = acpi_ns_simple_repair(data, expected_btypes,
package_index, return_object_ptr);
if (ACPI_SUCCESS(status)) {
return (AE_OK); /* Repair was successful */
}
return (status);

type_error_exit:

Expand Down Expand Up @@ -556,6 +494,61 @@ acpi_ns_check_reference(struct acpi_predefined_data *data,
return (AE_AML_OPERAND_TYPE);
}

/*******************************************************************************
*
* FUNCTION: acpi_ns_get_bitmapped_type
*
* PARAMETERS: return_object - Object returned from method/obj evaluation
*
* RETURN: Object return type. ACPI_RTYPE_ANY indicates that the object
* type is not supported. ACPI_RTYPE_NONE indicates that no
* object was returned (return_object is NULL).
*
* DESCRIPTION: Convert object type into a bitmapped object return type.
*
******************************************************************************/

static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object)
{
u32 return_btype;

if (!return_object) {
return (ACPI_RTYPE_NONE);
}

/* Map acpi_object_type to internal bitmapped type */

switch (return_object->common.type) {
case ACPI_TYPE_INTEGER:
return_btype = ACPI_RTYPE_INTEGER;
break;

case ACPI_TYPE_BUFFER:
return_btype = ACPI_RTYPE_BUFFER;
break;

case ACPI_TYPE_STRING:
return_btype = ACPI_RTYPE_STRING;
break;

case ACPI_TYPE_PACKAGE:
return_btype = ACPI_RTYPE_PACKAGE;
break;

case ACPI_TYPE_LOCAL_REFERENCE:
return_btype = ACPI_RTYPE_REFERENCE;
break;

default:
/* Not one of the supported objects, must be incorrect */

return_btype = ACPI_RTYPE_ANY;
break;
}

return (return_btype);
}

/*******************************************************************************
*
* FUNCTION: acpi_ns_get_expected_types
Expand Down
Loading

0 comments on commit 2c7f50e

Please sign in to comment.