Merge branch 'acpica'

* acpica: (21 commits)
  ACPICA: Update version to 20130517
  ACPICA: _CST repair: Handle null package entries
  ACPICA: Add several repairs for _CST predefined name
  ACPICA: Move _PRT repair into the standard complex repair module
  ACPICA: Clear events initialized flag upon event component termination
  ACPICA: Fix possible memory leak in GPE init error path
  ACPICA: ACPICA Termination: Delete global lock pending lock
  ACPICA: Update interface to acpi_ut_valid_acpi_name()
  ACPICA: Do not use extended sleep registers unless HW-reduced bit is set
  ACPICA: Split table print utilities to a new a separate file
  ACPICA: Add option to disable loading of SSDTs from the RSDT/XSDT
  ACPICA: Standardize all switch() blocks
  ACPICA: Split internal error msg routines to a separate file
  ACPICA: Split buffer dump routines into separate file
  ACPICA: Update version to 20130418
  ACPICA: Update for "orphan" embedded controller _REG method support
  ACPICA: Remove unused macros, no functional change
  ACPICA: Predefined name support: Remove unused local variable
  ACPICA: Add argument typechecking for all predefined ACPI names
  ACPICA: Add BIOS error interface for predefined name validation support
  ...
This commit is contained in:
Rafael J. Wysocki 2013-06-28 12:58:14 +02:00
commit 80338681bb
98 changed files with 2163 additions and 1276 deletions

View File

@ -83,6 +83,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
acpi-y += \ acpi-y += \
nsaccess.o \ nsaccess.o \
nsalloc.o \ nsalloc.o \
nsarguments.o \
nsconvert.o \ nsconvert.o \
nsdump.o \ nsdump.o \
nseval.o \ nseval.o \
@ -137,6 +138,7 @@ acpi-y += \
tbfadt.o \ tbfadt.o \
tbfind.o \ tbfind.o \
tbinstal.o \ tbinstal.o \
tbprint.o \
tbutils.o \ tbutils.o \
tbxface.o \ tbxface.o \
tbxfload.o \ tbxfload.o \
@ -145,11 +147,13 @@ acpi-y += \
acpi-y += \ acpi-y += \
utaddress.o \ utaddress.o \
utalloc.o \ utalloc.o \
utbuffer.o \
utcopy.o \ utcopy.o \
utexcep.o \ utexcep.o \
utdebug.o \ utdebug.o \
utdecode.o \ utdecode.o \
utdelete.o \ utdelete.o \
uterror.o \
uteval.o \ uteval.o \
utglobal.o \ utglobal.o \
utids.o \ utids.o \

View File

@ -132,6 +132,12 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE);
*/ */
u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE); u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE);
/*
* Optionally do not load any SSDTs from the RSDT/XSDT during initialization.
* This can be useful for debugging ACPI problems on some machines.
*/
u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_ssdt_table_load, FALSE);
/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
struct acpi_table_fadt acpi_gbl_FADT; struct acpi_table_fadt acpi_gbl_FADT;

View File

@ -362,23 +362,6 @@ union acpi_predefined_info {
#pragma pack() #pragma pack()
/* Data block used during object validation */
struct acpi_predefined_data {
char *pathname;
const union acpi_predefined_info *predefined;
union acpi_operand_object *parent_package;
struct acpi_namespace_node *node;
u32 flags;
u32 return_btype;
u8 node_flags;
};
/* Defines for Flags field above */
#define ACPI_OBJECT_REPAIRED 1
#define ACPI_OBJECT_WRAPPED 2
/* Return object auto-repair info */ /* Return object auto-repair info */
typedef acpi_status(*acpi_object_converter) (union acpi_operand_object typedef acpi_status(*acpi_object_converter) (union acpi_operand_object

View File

@ -374,10 +374,11 @@
* the plist contains a set of parens to allow variable-length lists. * the plist contains a set of parens to allow variable-length lists.
* These macros are used for both the debug and non-debug versions of the code. * These macros are used for both the debug and non-debug versions of the code.
*/ */
#define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); #define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e);
#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e);
#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist
#define ACPI_BIOS_ERROR_PREDEFINED(plist) acpi_ut_predefined_bios_error plist
#else #else
@ -387,6 +388,7 @@
#define ACPI_ERROR_METHOD(s, n, p, e) #define ACPI_ERROR_METHOD(s, n, p, e)
#define ACPI_WARN_PREDEFINED(plist) #define ACPI_WARN_PREDEFINED(plist)
#define ACPI_INFO_PREDEFINED(plist) #define ACPI_INFO_PREDEFINED(plist)
#define ACPI_BIOS_ERROR_PREDEFINED(plist)
#endif /* ACPI_NO_ERROR_MESSAGES */ #endif /* ACPI_NO_ERROR_MESSAGES */

View File

@ -223,22 +223,33 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
void acpi_ns_exec_module_code_list(void); void acpi_ns_exec_module_code_list(void);
/* /*
* nspredef - Support for predefined/reserved names * nsarguments - Argument count/type checking for predefined/reserved names
*/ */
acpi_status void
acpi_ns_check_predefined_names(struct acpi_namespace_node *node, acpi_ns_check_argument_count(char *pathname,
u32 user_param_count, struct acpi_namespace_node *node,
acpi_status return_status, u32 user_param_count,
union acpi_operand_object **return_object); const union acpi_predefined_info *info);
void void
acpi_ns_check_parameter_count(char *pathname, acpi_ns_check_acpi_compliance(char *pathname,
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
u32 user_param_count, const union acpi_predefined_info *predefined);
const union acpi_predefined_info *info);
void acpi_ns_check_argument_types(struct acpi_evaluate_info *info);
/*
* nspredef - Return value checking for predefined/reserved names
*/
acpi_status
acpi_ns_check_return_value(struct acpi_namespace_node *node,
struct acpi_evaluate_info *info,
u32 user_param_count,
acpi_status return_status,
union acpi_operand_object **return_object);
acpi_status acpi_status
acpi_ns_check_object_type(struct acpi_predefined_data *data, acpi_ns_check_object_type(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr, union acpi_operand_object **return_object_ptr,
u32 expected_btypes, u32 package_index); u32 expected_btypes, u32 package_index);
@ -246,7 +257,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
* nsprepkg - Validation of predefined name packages * nsprepkg - Validation of predefined name packages
*/ */
acpi_status acpi_status
acpi_ns_check_package(struct acpi_predefined_data *data, acpi_ns_check_package(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
/* /*
@ -308,24 +319,24 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
* predefined methods/objects * predefined methods/objects
*/ */
acpi_status acpi_status
acpi_ns_simple_repair(struct acpi_predefined_data *data, acpi_ns_simple_repair(struct acpi_evaluate_info *info,
u32 expected_btypes, u32 expected_btypes,
u32 package_index, u32 package_index,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
acpi_status acpi_status
acpi_ns_wrap_with_package(struct acpi_predefined_data *data, acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
union acpi_operand_object *original_object, union acpi_operand_object *original_object,
union acpi_operand_object **obj_desc_ptr); union acpi_operand_object **obj_desc_ptr);
acpi_status acpi_status
acpi_ns_repair_null_element(struct acpi_predefined_data *data, acpi_ns_repair_null_element(struct acpi_evaluate_info *info,
u32 expected_btypes, u32 expected_btypes,
u32 package_index, u32 package_index,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
void void
acpi_ns_remove_null_elements(struct acpi_predefined_data *data, acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
u8 package_type, u8 package_type,
union acpi_operand_object *obj_desc); union acpi_operand_object *obj_desc);
@ -334,7 +345,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
* predefined methods/objects * predefined methods/objects
*/ */
acpi_status acpi_status
acpi_ns_complex_repairs(struct acpi_predefined_data *data, acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
acpi_status validate_status, acpi_status validate_status,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);

View File

@ -128,8 +128,8 @@ enum acpi_return_package_types {
#define ARG_COUNT_IS_MINIMUM 0x8000 #define ARG_COUNT_IS_MINIMUM 0x8000
#define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE #define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE
#define METHOD_GET_COUNT(arg_list) (arg_list & METHOD_ARG_MASK) #define METHOD_GET_ARG_COUNT(arg_list) ((arg_list) & METHOD_ARG_MASK)
#define METHOD_GET_NEXT_ARG(arg_list) (arg_list >> METHOD_ARG_BIT_WIDTH) #define METHOD_GET_NEXT_TYPE(arg_list) (((arg_list) >>= METHOD_ARG_BIT_WIDTH) & METHOD_ARG_MASK)
/* Macros used to build the predefined info table */ /* Macros used to build the predefined info table */

View File

@ -178,25 +178,41 @@ union acpi_aml_operands {
}; };
/* /*
* Structure used to pass object evaluation parameters. * Structure used to pass object evaluation information and parameters.
* Purpose is to reduce CPU stack use. * Purpose is to reduce CPU stack use.
*/ */
struct acpi_evaluate_info { struct acpi_evaluate_info {
struct acpi_namespace_node *prefix_node; /* The first 3 elements are passed by the caller to acpi_ns_evaluate */
char *pathname;
union acpi_operand_object *obj_desc; struct acpi_namespace_node *prefix_node; /* Input: starting node */
union acpi_operand_object **parameters; char *relative_pathname; /* Input: path relative to prefix_node */
struct acpi_namespace_node *resolved_node; union acpi_operand_object **parameters; /* Input: argument list */
union acpi_operand_object *return_object;
u8 param_count; struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */
u8 pass_number; union acpi_operand_object *obj_desc; /* Object attached to the resolved node */
u8 return_object_type; char *full_pathname; /* Full pathname of the resolved node */
u8 flags;
const union acpi_predefined_info *predefined; /* Used if Node is a predefined name */
union acpi_operand_object *return_object; /* Object returned from the evaluation */
union acpi_operand_object *parent_package; /* Used if return object is a Package */
u32 return_flags; /* Used for return value analysis */
u32 return_btype; /* Bitmapped type of the returned object */
u16 param_count; /* Count of the input argument list */
u8 pass_number; /* Parser pass number */
u8 return_object_type; /* Object type of the returned object */
u8 node_flags; /* Same as Node->Flags */
u8 flags; /* General flags */
}; };
/* Values for Flags above */ /* Values for Flags above */
#define ACPI_IGNORE_RETURN_VALUE 1 #define ACPI_IGNORE_RETURN_VALUE 1
/* Defines for return_flags field above */
#define ACPI_OBJECT_REPAIRED 1
#define ACPI_OBJECT_WRAPPED 2
/* Info used by acpi_ns_initialize_devices */ /* Info used by acpi_ns_initialize_devices */

View File

@ -87,6 +87,48 @@ extern const char *acpi_gbl_fc_decode[];
extern const char *acpi_gbl_pt_decode[]; extern const char *acpi_gbl_pt_decode[];
#endif #endif
/*
* For the iASL compiler case, the output is redirected to stderr so that
* any of the various ACPI errors and warnings do not appear in the output
* files, for either the compiler or disassembler portions of the tool.
*/
#ifdef ACPI_ASL_COMPILER
#include <stdio.h>
extern FILE *acpi_gbl_output_file;
#define ACPI_MSG_REDIRECT_BEGIN \
FILE *output_file = acpi_gbl_output_file; \
acpi_os_redirect_output (stderr);
#define ACPI_MSG_REDIRECT_END \
acpi_os_redirect_output (output_file);
#else
/*
* non-iASL case - no redirection, nothing to do
*/
#define ACPI_MSG_REDIRECT_BEGIN
#define ACPI_MSG_REDIRECT_END
#endif
/*
* Common error message prefixes
*/
#define ACPI_MSG_ERROR "ACPI Error: "
#define ACPI_MSG_EXCEPTION "ACPI Exception: "
#define ACPI_MSG_WARNING "ACPI Warning: "
#define ACPI_MSG_INFO "ACPI: "
#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
/*
* Common message suffix
*/
#define ACPI_MSG_SUFFIX \
acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
/* Types for Resource descriptor entries */ /* Types for Resource descriptor entries */
#define ACPI_INVALID_RESOURCE 0 #define ACPI_INVALID_RESOURCE 0
@ -578,7 +620,7 @@ void acpi_ut_print_string(char *string, u8 max_length);
void ut_convert_backslashes(char *pathname); void ut_convert_backslashes(char *pathname);
u8 acpi_ut_valid_acpi_name(u32 name); u8 acpi_ut_valid_acpi_name(char *name);
u8 acpi_ut_valid_acpi_char(char character, u32 position); u8 acpi_ut_valid_acpi_char(char character, u32 position);
@ -670,6 +712,12 @@ acpi_ut_predefined_info(const char *module_name,
u32 line_number, u32 line_number,
char *pathname, u8 node_flags, const char *format, ...); char *pathname, u8 node_flags, const char *format, ...);
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_bios_error(const char *module_name,
u32 line_number,
char *pathname,
u8 node_flags, const char *format, ...);
void void
acpi_ut_namespace_error(const char *module_name, acpi_ut_namespace_error(const char *module_name,
u32 line_number, u32 line_number,

View File

@ -78,7 +78,6 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
switch (op->common.aml_opcode) { switch (op->common.aml_opcode) {
case AML_WHILE_OP: case AML_WHILE_OP:
/* /*
* If this is an additional iteration of a while loop, continue. * If this is an additional iteration of a while loop, continue.
* There is no need to allocate a new control state. * There is no need to allocate a new control state.
@ -99,7 +98,6 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
/*lint -fallthrough */ /*lint -fallthrough */
case AML_IF_OP: case AML_IF_OP:
/* /*
* IF/WHILE: Create a new control state to manage these * IF/WHILE: Create a new control state to manage these
* constructs. We need to manage these as a stack, in order * constructs. We need to manage these as a stack, in order
@ -142,6 +140,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
break; break;
default: default:
break; break;
} }
@ -344,6 +343,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
case AML_NOOP_OP: case AML_NOOP_OP:
/* Just do nothing! */ /* Just do nothing! */
break; break;
case AML_BREAK_POINT_OP: case AML_BREAK_POINT_OP:

View File

@ -563,21 +563,25 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
*/ */
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_FIELD_OP: case AML_FIELD_OP:
arg = acpi_ps_get_arg(op, 2); arg = acpi_ps_get_arg(op, 2);
type = ACPI_TYPE_LOCAL_REGION_FIELD; type = ACPI_TYPE_LOCAL_REGION_FIELD;
break; break;
case AML_BANK_FIELD_OP: case AML_BANK_FIELD_OP:
arg = acpi_ps_get_arg(op, 4); arg = acpi_ps_get_arg(op, 4);
type = ACPI_TYPE_LOCAL_BANK_FIELD; type = ACPI_TYPE_LOCAL_BANK_FIELD;
break; break;
case AML_INDEX_FIELD_OP: case AML_INDEX_FIELD_OP:
arg = acpi_ps_get_arg(op, 3); arg = acpi_ps_get_arg(op, 3);
type = ACPI_TYPE_LOCAL_INDEX_FIELD; type = ACPI_TYPE_LOCAL_INDEX_FIELD;
break; break;
default: default:
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }

View File

@ -127,6 +127,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
break; break;
default: default:
break; break;
} }

View File

@ -285,6 +285,7 @@ acpi_ds_method_data_get_node(u8 type,
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Type %u is invalid", type)); ACPI_ERROR((AE_INFO, "Type %u is invalid", type));
return_ACPI_STATUS(AE_TYPE); return_ACPI_STATUS(AE_TYPE);
} }
@ -428,7 +429,6 @@ acpi_ds_method_data_get_value(u8 type,
return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
case ACPI_REFCLASS_LOCAL: case ACPI_REFCLASS_LOCAL:
/* /*
* No error message for this case, will be trapped again later to * No error message for this case, will be trapped again later to
* detect and ignore cases of Store(local_x,local_x) * detect and ignore cases of Store(local_x,local_x)

View File

@ -648,7 +648,6 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
switch (obj_desc->common.type) { switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* /*
* Defer evaluation of Buffer term_arg operand * Defer evaluation of Buffer term_arg operand
*/ */
@ -660,7 +659,6 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
/* /*
* Defer evaluation of Package term_arg operand * Defer evaluation of Package term_arg operand
*/ */
@ -741,6 +739,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Unknown Integer type 0x%X", ACPI_ERROR((AE_INFO, "Unknown Integer type 0x%X",
op_info->type)); op_info->type));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;

View File

@ -636,6 +636,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
break; break;
default: default:
return_ACPI_STATUS(AE_AML_BAD_OPCODE); return_ACPI_STATUS(AE_AML_BAD_OPCODE);
} }

View File

@ -240,7 +240,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
case AML_IF_OP: case AML_IF_OP:
case AML_WHILE_OP: case AML_WHILE_OP:
/* /*
* If we are executing the predicate AND this is the predicate op, * If we are executing the predicate AND this is the predicate op,
* we will use the return value * we will use the return value
@ -254,7 +253,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
break; break;
default: default:
/* Ignore other control opcodes */ /* Ignore other control opcodes */
break; break;
} }
@ -263,7 +264,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
goto result_not_used; goto result_not_used;
case AML_CLASS_CREATE: case AML_CLASS_CREATE:
/* /*
* These opcodes allow term_arg(s) as operands and therefore * These opcodes allow term_arg(s) as operands and therefore
* the operands can be method calls. The result is used. * the operands can be method calls. The result is used.
@ -292,7 +292,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
goto result_not_used; goto result_not_used;
default: default:
/* /*
* In all other cases. the parent will actually use the return * In all other cases. the parent will actually use the return
* object, so keep it. * object, so keep it.

View File

@ -327,6 +327,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
break; break;
default: default:
break; break;
} }
@ -488,7 +489,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
break; break;
case AML_TYPE_METHOD_CALL: case AML_TYPE_METHOD_CALL:
/* /*
* If the method is referenced from within a package * If the method is referenced from within a package
* declaration, it is not a invocation of the method, just * declaration, it is not a invocation of the method, just
@ -582,7 +582,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
switch (op->common.parent->common.aml_opcode) { switch (op->common.parent->common.aml_opcode) {
case AML_NAME_OP: case AML_NAME_OP:
/* /*
* Put the Node on the object stack (Contains the ACPI Name * Put the Node on the object stack (Contains the ACPI Name
* of this object) * of this object)

View File

@ -74,6 +74,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
switch (pass_number) { switch (pass_number) {
case 1: case 1:
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
ACPI_PARSE_DELETE_TREE; ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_load1_begin_op; walk_state->descending_callback = acpi_ds_load1_begin_op;
@ -81,6 +82,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
break; break;
case 2: case 2:
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
ACPI_PARSE_DELETE_TREE; ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_load2_begin_op; walk_state->descending_callback = acpi_ds_load2_begin_op;
@ -88,6 +90,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
break; break;
case 3: case 3:
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
walk_state->parse_flags |= ACPI_PARSE_EXECUTE | walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
ACPI_PARSE_DELETE_TREE; ACPI_PARSE_DELETE_TREE;
@ -97,6 +100,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
break; break;
default: default:
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
@ -161,7 +165,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_SCOPE_OP: case AML_SCOPE_OP:
/* /*
* The target name of the Scope() operator must exist at this point so * The target name of the Scope() operator must exist at this point so
* that we can actually open the scope to enter new names underneath it. * that we can actually open the scope to enter new names underneath it.
@ -210,7 +213,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* /*
* These types we will allow, but we will change the type. * These types we will allow, but we will change the type.
* This enables some existing code of the form: * This enables some existing code of the form:
@ -232,7 +234,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
break; break;
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
/* /*
* Allow scope change to root during execution of module-level * Allow scope change to root during execution of module-level
* code. Root is typed METHOD during this time. * code. Root is typed METHOD during this time.

View File

@ -509,6 +509,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
break; break;
default: default:
/* All NAMED_FIELD opcodes must be handled above */ /* All NAMED_FIELD opcodes must be handled above */
break; break;
} }
@ -548,6 +549,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
break; break;
default: default:
/* Unknown opcode */ /* Unknown opcode */
status = AE_OK; status = AE_OK;
@ -674,6 +676,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
#endif /* ACPI_NO_METHOD_EXECUTION */ #endif /* ACPI_NO_METHOD_EXECUTION */
default: default:
/* All NAMED_COMPLEX opcodes must be handled above */ /* All NAMED_COMPLEX opcodes must be handled above */
break; break;
} }
@ -721,6 +724,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
break; break;
default: default:
break; break;
} }

View File

@ -128,6 +128,7 @@ acpi_status acpi_ev_remove_global_lock_handler(void)
status = acpi_remove_fixed_event_handler(ACPI_EVENT_GLOBAL, status = acpi_remove_fixed_event_handler(ACPI_EVENT_GLOBAL,
acpi_ev_global_lock_handler); acpi_ev_global_lock_handler);
acpi_os_delete_lock(acpi_gbl_global_lock_pending_lock);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View File

@ -529,7 +529,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
switch (local_gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) { switch (local_gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) {
case ACPI_GPE_DISPATCH_NOTIFY: case ACPI_GPE_DISPATCH_NOTIFY:
/* /*
* Implicit notify. * Implicit notify.
* Dispatch a DEVICE_WAKE notify to the appropriate handler. * Dispatch a DEVICE_WAKE notify to the appropriate handler.
@ -579,11 +578,11 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
(local_gpe_event_info->dispatch. (local_gpe_event_info->dispatch.
method_node))); method_node)));
} }
break; break;
default: default:
return_VOID; /* Should never happen */
return_VOID; /* Should never happen */
} }
/* Defer enabling of GPE until all notify handlers are done */ /* Defer enabling of GPE until all notify handlers are done */
@ -755,7 +754,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
case ACPI_GPE_DISPATCH_METHOD: case ACPI_GPE_DISPATCH_METHOD:
case ACPI_GPE_DISPATCH_NOTIFY: case ACPI_GPE_DISPATCH_NOTIFY:
/* /*
* Execute the method associated with the GPE * Execute the method associated with the GPE
* NOTE: Level-triggered GPEs are cleared after the method completes. * NOTE: Level-triggered GPEs are cleared after the method completes.
@ -771,7 +769,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
break; break;
default: default:
/* /*
* No handler or method to run! * No handler or method to run!
* 03/2010: This case should no longer be possible. We will not allow * 03/2010: This case should no longer be possible. We will not allow

View File

@ -382,6 +382,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_FREE(gpe_block->register_info);
ACPI_FREE(gpe_block->event_info);
ACPI_FREE(gpe_block); ACPI_FREE(gpe_block);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View File

@ -363,14 +363,17 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
*/ */
switch (name[1]) { switch (name[1]) {
case 'L': case 'L':
type = ACPI_GPE_LEVEL_TRIGGERED; type = ACPI_GPE_LEVEL_TRIGGERED;
break; break;
case 'E': case 'E':
type = ACPI_GPE_EDGE_TRIGGERED; type = ACPI_GPE_EDGE_TRIGGERED;
break; break;
default: default:
/* Unknown method type, just ignore it */ /* Unknown method type, just ignore it */
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, ACPI_DEBUG_PRINT((ACPI_DB_LOAD,

View File

@ -354,36 +354,43 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
switch (space_id) { switch (space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_MEMORY:
handler = acpi_ex_system_memory_space_handler; handler = acpi_ex_system_memory_space_handler;
setup = acpi_ev_system_memory_region_setup; setup = acpi_ev_system_memory_region_setup;
break; break;
case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_SYSTEM_IO:
handler = acpi_ex_system_io_space_handler; handler = acpi_ex_system_io_space_handler;
setup = acpi_ev_io_space_region_setup; setup = acpi_ev_io_space_region_setup;
break; break;
case ACPI_ADR_SPACE_PCI_CONFIG: case ACPI_ADR_SPACE_PCI_CONFIG:
handler = acpi_ex_pci_config_space_handler; handler = acpi_ex_pci_config_space_handler;
setup = acpi_ev_pci_config_region_setup; setup = acpi_ev_pci_config_region_setup;
break; break;
case ACPI_ADR_SPACE_CMOS: case ACPI_ADR_SPACE_CMOS:
handler = acpi_ex_cmos_space_handler; handler = acpi_ex_cmos_space_handler;
setup = acpi_ev_cmos_region_setup; setup = acpi_ev_cmos_region_setup;
break; break;
case ACPI_ADR_SPACE_PCI_BAR_TARGET: case ACPI_ADR_SPACE_PCI_BAR_TARGET:
handler = acpi_ex_pci_bar_space_handler; handler = acpi_ex_pci_bar_space_handler;
setup = acpi_ev_pci_bar_region_setup; setup = acpi_ev_pci_bar_region_setup;
break; break;
case ACPI_ADR_SPACE_DATA_TABLE: case ACPI_ADR_SPACE_DATA_TABLE:
handler = acpi_ex_data_table_space_handler; handler = acpi_ex_data_table_space_handler;
setup = NULL; setup = NULL;
break; break;
default: default:
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
goto unlock_and_exit; goto unlock_and_exit;
} }

View File

@ -78,6 +78,7 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
return (TRUE); return (TRUE);
default: default:
return (FALSE); return (FALSE);
} }
} }
@ -275,6 +276,8 @@ void acpi_ev_terminate(void)
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Could not remove Global Lock handler")); "Could not remove Global Lock handler"));
} }
acpi_gbl_events_initialized = FALSE;
} }
/* Deallocate all handler objects installed within GPE info structs */ /* Deallocate all handler objects installed within GPE info structs */

View File

@ -54,7 +54,8 @@ extern u8 acpi_gbl_default_address_spaces[];
/* Local prototypes */ /* Local prototypes */
static void acpi_ev_orphan_ec_reg_method(void); static void
acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node);
static acpi_status static acpi_status
acpi_ev_reg_run(acpi_handle obj_handle, acpi_ev_reg_run(acpi_handle obj_handle,
@ -532,7 +533,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
} }
info->prefix_node = region_obj2->extra.method_REG; info->prefix_node = region_obj2->extra.method_REG;
info->pathname = NULL; info->relative_pathname = NULL;
info->parameters = args; info->parameters = args;
info->flags = ACPI_IGNORE_RETURN_VALUE; info->flags = ACPI_IGNORE_RETURN_VALUE;
@ -612,7 +613,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
/* Special case for EC: handle "orphan" _REG methods with no region */ /* Special case for EC: handle "orphan" _REG methods with no region */
if (space_id == ACPI_ADR_SPACE_EC) { if (space_id == ACPI_ADR_SPACE_EC) {
acpi_ev_orphan_ec_reg_method(); acpi_ev_orphan_ec_reg_method(node);
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
@ -681,7 +682,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
* *
* FUNCTION: acpi_ev_orphan_ec_reg_method * FUNCTION: acpi_ev_orphan_ec_reg_method
* *
* PARAMETERS: None * PARAMETERS: ec_device_node - Namespace node for an EC device
* *
* RETURN: None * RETURN: None
* *
@ -693,37 +694,27 @@ acpi_ev_reg_run(acpi_handle obj_handle,
* detected by providing a _REG method object underneath the * detected by providing a _REG method object underneath the
* Embedded Controller device." * Embedded Controller device."
* *
* To quickly access the EC device, we use the EC_ID that appears * To quickly access the EC device, we use the ec_device_node used
* within the ECDT. Otherwise, we would need to perform a time- * during EC handler installation. Otherwise, we would need to
* consuming namespace walk, executing _HID methods to find the * perform a time consuming namespace walk, executing _HID
* EC device. * methods to find the EC device.
*
* MUTEX: Assumes the namespace is locked
* *
******************************************************************************/ ******************************************************************************/
static void acpi_ev_orphan_ec_reg_method(void) static void
acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node)
{ {
struct acpi_table_ecdt *table; acpi_handle reg_method;
struct acpi_namespace_node *next_node;
acpi_status status; acpi_status status;
struct acpi_object_list args; struct acpi_object_list args;
union acpi_object objects[2]; union acpi_object objects[2];
struct acpi_namespace_node *ec_device_node;
struct acpi_namespace_node *reg_method;
struct acpi_namespace_node *next_node;
ACPI_FUNCTION_TRACE(ev_orphan_ec_reg_method); ACPI_FUNCTION_TRACE(ev_orphan_ec_reg_method);
/* Get the ECDT (if present in system) */ if (!ec_device_node) {
status = acpi_get_table(ACPI_SIG_ECDT, 0,
ACPI_CAST_INDIRECT_PTR(struct acpi_table_header,
&table));
if (ACPI_FAILURE(status)) {
return_VOID;
}
/* We need a valid EC_ID string */
if (!(*table->id)) {
return_VOID; return_VOID;
} }
@ -731,22 +722,11 @@ static void acpi_ev_orphan_ec_reg_method(void)
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
/* Get a handle to the EC device referenced in the ECDT */
status = acpi_get_handle(NULL,
ACPI_CAST_PTR(char, table->id),
ACPI_CAST_PTR(acpi_handle, &ec_device_node));
if (ACPI_FAILURE(status)) {
goto exit;
}
/* Get a handle to a _REG method immediately under the EC device */ /* Get a handle to a _REG method immediately under the EC device */
status = acpi_get_handle(ec_device_node, status = acpi_get_handle(ec_device_node, METHOD_NAME__REG, &reg_method);
METHOD_NAME__REG, ACPI_CAST_PTR(acpi_handle,
&reg_method));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto exit; goto exit; /* There is no _REG method present */
} }
/* /*
@ -754,19 +734,20 @@ static void acpi_ev_orphan_ec_reg_method(void)
* this scope with the Embedded Controller space ID. Otherwise, it * this scope with the Embedded Controller space ID. Otherwise, it
* will already have been executed. Note, this allows for Regions * will already have been executed. Note, this allows for Regions
* with other space IDs to be present; but the code below will then * with other space IDs to be present; but the code below will then
* execute the _REG method with the EC space ID argument. * execute the _REG method with the embedded_control space_ID argument.
*/ */
next_node = acpi_ns_get_next_node(ec_device_node, NULL); next_node = acpi_ns_get_next_node(ec_device_node, NULL);
while (next_node) { while (next_node) {
if ((next_node->type == ACPI_TYPE_REGION) && if ((next_node->type == ACPI_TYPE_REGION) &&
(next_node->object) && (next_node->object) &&
(next_node->object->region.space_id == ACPI_ADR_SPACE_EC)) { (next_node->object->region.space_id == ACPI_ADR_SPACE_EC)) {
goto exit; /* Do not execute _REG */ goto exit; /* Do not execute the _REG */
} }
next_node = acpi_ns_get_next_node(ec_device_node, next_node); next_node = acpi_ns_get_next_node(ec_device_node, next_node);
} }
/* Evaluate the _REG(EC,Connect) method */ /* Evaluate the _REG(embedded_control,Connect) method */
args.count = 2; args.count = 2;
args.pointer = objects; args.pointer = objects;

View File

@ -596,7 +596,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
break; break;
default: default:
/* Ignore other objects */ /* Ignore other objects */
break; break;
} }

View File

@ -366,16 +366,19 @@ acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action)
switch (action) { switch (action) {
case ACPI_GPE_ENABLE: case ACPI_GPE_ENABLE:
ACPI_SET_BIT(gpe_register_info->enable_for_wake, ACPI_SET_BIT(gpe_register_info->enable_for_wake,
(u8)register_bit); (u8)register_bit);
break; break;
case ACPI_GPE_DISABLE: case ACPI_GPE_DISABLE:
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
(u8)register_bit); (u8)register_bit);
break; break;
default: default:
ACPI_ERROR((AE_INFO, "%u, Invalid action", action)); ACPI_ERROR((AE_INFO, "%u, Invalid action", action));
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
break; break;

View File

@ -139,6 +139,7 @@ acpi_install_address_space_handler(acpi_handle device,
break; break;
default: default:
break; break;
} }

View File

@ -480,6 +480,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
break; break;
default: default:
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -588,7 +589,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
(ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) || (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
(ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE) || (ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE) ||
(!(ddb_handle->common.flags & AOPOBJ_DATA_VALID))) { (!(ddb_handle->common.flags & AOPOBJ_DATA_VALID))) {
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
/* Get the table index from the ddb_handle */ /* Get the table index from the ddb_handle */

View File

@ -99,6 +99,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
break; break;
default: default:
return_ACPI_STATUS(AE_TYPE); return_ACPI_STATUS(AE_TYPE);
} }
@ -117,7 +118,6 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
switch (obj_desc->common.type) { switch (obj_desc->common.type) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /*
* Convert string to an integer - for most cases, the string must be * Convert string to an integer - for most cases, the string must be
* hexadecimal as per the ACPI specification. The only exception (as * hexadecimal as per the ACPI specification. The only exception (as
@ -161,6 +161,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
default: default:
/* No other types can get here */ /* No other types can get here */
break; break;
} }
@ -213,7 +214,6 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* /*
* Create a new Buffer object. * Create a new Buffer object.
* Need enough space for one integer * Need enough space for one integer
@ -233,7 +233,6 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /*
* Create a new Buffer object * Create a new Buffer object
* Size will be the string length * Size will be the string length
@ -258,6 +257,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
break; break;
default: default:
return_ACPI_STATUS(AE_TYPE); return_ACPI_STATUS(AE_TYPE);
} }
@ -304,15 +304,18 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
switch (data_width) { switch (data_width) {
case 1: case 1:
decimal_length = ACPI_MAX8_DECIMAL_DIGITS; decimal_length = ACPI_MAX8_DECIMAL_DIGITS;
break; break;
case 4: case 4:
decimal_length = ACPI_MAX32_DECIMAL_DIGITS; decimal_length = ACPI_MAX32_DECIMAL_DIGITS;
break; break;
case 8: case 8:
default: default:
decimal_length = ACPI_MAX64_DECIMAL_DIGITS; decimal_length = ACPI_MAX64_DECIMAL_DIGITS;
break; break;
} }
@ -546,6 +549,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
break; break;
default: default:
return_ACPI_STATUS(AE_TYPE); return_ACPI_STATUS(AE_TYPE);
} }
@ -599,6 +603,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
break; break;
default: default:
/* No conversion allowed for these types */ /* No conversion allowed for these types */
if (destination_type != source_desc->common.type) { if (destination_type != source_desc->common.type) {
@ -649,6 +654,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
break; break;
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Bad destination type during conversion: 0x%X", "Bad destination type during conversion: 0x%X",
destination_type)); destination_type));
@ -664,6 +670,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
break; break;
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s", "Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
GET_CURRENT_ARG_TYPE(walk_state->op_info-> GET_CURRENT_ARG_TYPE(walk_state->op_info->

View File

@ -103,7 +103,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
/* /*
* These types open a new scope, so we need the NS node in order to access * These types open a new scope, so we need the NS node in order to access
* any children. * any children.
@ -113,7 +112,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL: case ACPI_TYPE_THERMAL:
case ACPI_TYPE_LOCAL_SCOPE: case ACPI_TYPE_LOCAL_SCOPE:
/* /*
* The new alias has the type ALIAS and points to the original * The new alias has the type ALIAS and points to the original
* NS node, not the object itself. * NS node, not the object itself.
@ -124,7 +122,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
break; break;
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
/* /*
* Control method aliases need to be differentiated * Control method aliases need to be differentiated
*/ */

View File

@ -193,6 +193,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
return_VOID; return_VOID;
default: default:
break; break;
} }
@ -226,6 +227,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
break; break;
default: default:
acpi_ex_do_debug_object((source_desc-> acpi_ex_do_debug_object((source_desc->
reference. reference.
node)->object, node)->object,

View File

@ -357,6 +357,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
switch (info->opcode) { switch (info->opcode) {
case ACPI_EXD_INIT: case ACPI_EXD_INIT:
break; break;
case ACPI_EXD_TYPE: case ACPI_EXD_TYPE:
@ -718,6 +719,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
break; break;
default: default:
/* Unknown Type */ /* Unknown Type */
acpi_os_printf("Unknown Type %X\n", obj_desc->common.type); acpi_os_printf("Unknown Type %X\n", obj_desc->common.type);

View File

@ -331,21 +331,25 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
switch (source_desc->common.type) { switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
buffer = &source_desc->integer.value; buffer = &source_desc->integer.value;
length = sizeof(source_desc->integer.value); length = sizeof(source_desc->integer.value);
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
buffer = source_desc->buffer.pointer; buffer = source_desc->buffer.pointer;
length = source_desc->buffer.length; length = source_desc->buffer.length;
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
buffer = source_desc->string.pointer; buffer = source_desc->string.pointer;
length = source_desc->string.length; length = source_desc->string.length;
break; break;
default: default:
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }

View File

@ -446,7 +446,6 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
break; break;
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
/* /*
* Ensure that the bank_value is not beyond the capacity of * Ensure that the bank_value is not beyond the capacity of
* the register * the register
@ -488,7 +487,6 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
break; break;
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* /*
* Ensure that the index_value is not beyond the capacity of * Ensure that the index_value is not beyond the capacity of
* the register * the register

View File

@ -105,7 +105,6 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
break; break;
case ACPI_DESC_TYPE_NAMED: case ACPI_DESC_TYPE_NAMED:
/* /*
* A named reference that has already been resolved to a Node * A named reference that has already been resolved to a Node
*/ */
@ -261,20 +260,24 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
*/ */
switch (operand0->common.type) { switch (operand0->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
status = status =
acpi_ex_convert_to_integer(operand1, &local_operand1, 16); acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
status = acpi_ex_convert_to_string(operand1, &local_operand1, status = acpi_ex_convert_to_string(operand1, &local_operand1,
ACPI_IMPLICIT_CONVERT_HEX); ACPI_IMPLICIT_CONVERT_HEX);
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
status = acpi_ex_convert_to_buffer(operand1, &local_operand1); status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X", ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
operand0->common.type)); operand0->common.type));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
@ -519,6 +522,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode,
break; break;
default: default:
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
@ -580,20 +584,24 @@ acpi_ex_do_logical_op(u16 opcode,
*/ */
switch (operand0->common.type) { switch (operand0->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
status = status =
acpi_ex_convert_to_integer(operand1, &local_operand1, 16); acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
status = acpi_ex_convert_to_string(operand1, &local_operand1, status = acpi_ex_convert_to_string(operand1, &local_operand1,
ACPI_IMPLICIT_CONVERT_HEX); ACPI_IMPLICIT_CONVERT_HEX);
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
status = acpi_ex_convert_to_buffer(operand1, &local_operand1); status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
break; break;
default: default:
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
@ -636,6 +644,7 @@ acpi_ex_do_logical_op(u16 opcode,
break; break;
default: default:
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
@ -703,6 +712,7 @@ acpi_ex_do_logical_op(u16 opcode,
break; break;
default: default:
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }

View File

@ -327,7 +327,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
break; break;
case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
/* /*
* The 64-bit ACPI integer can hold 16 4-bit BCD characters * The 64-bit ACPI integer can hold 16 4-bit BCD characters
* (if table is 32-bit, integer can hold 8 BCD characters) * (if table is 32-bit, integer can hold 8 BCD characters)
@ -407,7 +406,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
break; break;
case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */ case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */
/* /*
* This op is a little strange because the internal return value is * This op is a little strange because the internal return value is
* different than the return value stored in the result descriptor * different than the return value stored in the result descriptor
@ -442,13 +440,14 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
goto cleanup; goto cleanup;
default: default:
/* No other opcodes get here */ /* No other opcodes get here */
break; break;
} }
break; break;
case AML_STORE_OP: /* Store (Source, Target) */ case AML_STORE_OP: /* Store (Source, Target) */
/* /*
* A store operand is typically a number, string, buffer or lvalue * A store operand is typically a number, string, buffer or lvalue
* Be careful about deleting the source object, * Be careful about deleting the source object,
@ -615,7 +614,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
case AML_DECREMENT_OP: /* Decrement (Operand) */ case AML_DECREMENT_OP: /* Decrement (Operand) */
case AML_INCREMENT_OP: /* Increment (Operand) */ case AML_INCREMENT_OP: /* Increment (Operand) */
/* /*
* Create a new integer. Can't just get the base integer and * Create a new integer. Can't just get the base integer and
* increment it because it may be an Arg or Field. * increment it because it may be an Arg or Field.
@ -682,7 +680,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
case AML_TYPE_OP: /* object_type (source_object) */ case AML_TYPE_OP: /* object_type (source_object) */
/* /*
* Note: The operand is not resolved at this point because we want to * Note: The operand is not resolved at this point because we want to
* get the associated object, not its value. For example, we don't * get the associated object, not its value. For example, we don't
@ -709,7 +706,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
case AML_SIZE_OF_OP: /* size_of (source_object) */ case AML_SIZE_OF_OP: /* size_of (source_object) */
/* /*
* Note: The operand is not resolved at this point because we want to * Note: The operand is not resolved at this point because we want to
* get the associated object, not its value. * get the associated object, not its value.
@ -735,10 +731,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
*/ */
switch (type) { switch (type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
value = acpi_gbl_integer_byte_width; value = acpi_gbl_integer_byte_width;
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
value = temp_desc->string.length; value = temp_desc->string.length;
break; break;
@ -759,6 +757,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Operand must be Buffer/Integer/String/Package - found type %s", "Operand must be Buffer/Integer/String/Package - found type %s",
acpi_ut_get_type_name(type))); acpi_ut_get_type_name(type)));
@ -860,9 +859,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
break; break;
default: default:
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
} }
@ -923,7 +924,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
*/ */
switch (operand[0]->reference.class) { switch (operand[0]->reference.class) {
case ACPI_REFCLASS_INDEX: case ACPI_REFCLASS_INDEX:
/* /*
* The target type for the Index operator must be * The target type for the Index operator must be
* either a Buffer or a Package * either a Buffer or a Package
@ -956,7 +956,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
/* /*
* Return the referenced element of the package. We must * Return the referenced element of the package. We must
* add another reference to the referenced object, however. * add another reference to the referenced object, however.
@ -999,6 +998,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Unknown class in reference(%p) - 0x%2.2X", "Unknown class in reference(%p) - 0x%2.2X",
operand[0], operand[0],

View File

@ -304,7 +304,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
break; break;
case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
/* /*
* Input object is guaranteed to be a buffer at this point (it may have * Input object is guaranteed to be a buffer at this point (it may have
* been converted.) Copy the raw buffer data to a new object of * been converted.) Copy the raw buffer data to a new object of

View File

@ -155,7 +155,6 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
/* /*
* Create the return object. The Source operand is guaranteed to be * Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type. * either a String or a Buffer, so just use its type.

View File

@ -119,7 +119,6 @@ acpi_ex_do_match(u32 match_op,
break; break;
case MATCH_MEQ: case MATCH_MEQ:
/* /*
* True if equal: (P[i] == M) * True if equal: (P[i] == M)
* Change to: (M == P[i]) * Change to: (M == P[i])
@ -133,7 +132,6 @@ acpi_ex_do_match(u32 match_op,
break; break;
case MATCH_MLE: case MATCH_MLE:
/* /*
* True if less than or equal: (P[i] <= M) (P[i] not_greater than M) * True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
* Change to: (M >= P[i]) (M not_less than P[i]) * Change to: (M >= P[i]) (M not_less than P[i])
@ -148,7 +146,6 @@ acpi_ex_do_match(u32 match_op,
break; break;
case MATCH_MLT: case MATCH_MLT:
/* /*
* True if less than: (P[i] < M) * True if less than: (P[i] < M)
* Change to: (M > P[i]) * Change to: (M > P[i])
@ -162,7 +159,6 @@ acpi_ex_do_match(u32 match_op,
break; break;
case MATCH_MGE: case MATCH_MGE:
/* /*
* True if greater than or equal: (P[i] >= M) (P[i] not_less than M) * True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
* Change to: (M <= P[i]) (M not_greater than P[i]) * Change to: (M <= P[i]) (M not_greater than P[i])
@ -177,7 +173,6 @@ acpi_ex_do_match(u32 match_op,
break; break;
case MATCH_MGT: case MATCH_MGT:
/* /*
* True if greater than: (P[i] > M) * True if greater than: (P[i] > M)
* Change to: (M < P[i]) * Change to: (M < P[i])

View File

@ -253,26 +253,31 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
case AML_FIELD_ACCESS_BYTE: case AML_FIELD_ACCESS_BYTE:
case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
byte_alignment = 1; byte_alignment = 1;
bit_length = 8; bit_length = 8;
break; break;
case AML_FIELD_ACCESS_WORD: case AML_FIELD_ACCESS_WORD:
byte_alignment = 2; byte_alignment = 2;
bit_length = 16; bit_length = 16;
break; break;
case AML_FIELD_ACCESS_DWORD: case AML_FIELD_ACCESS_DWORD:
byte_alignment = 4; byte_alignment = 4;
bit_length = 32; bit_length = 32;
break; break;
case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
byte_alignment = 8; byte_alignment = 8;
bit_length = 64; bit_length = 64;
break; break;
default: default:
/* Invalid field access type */ /* Invalid field access type */
ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access));
@ -598,7 +603,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
break; break;
default: default:
/* No other types should get here */ /* No other types should get here */
break; break;
} }

View File

@ -88,22 +88,27 @@ acpi_ex_system_memory_space_handler(u32 function,
switch (bit_width) { switch (bit_width) {
case 8: case 8:
length = 1; length = 1;
break; break;
case 16: case 16:
length = 2; length = 2;
break; break;
case 32: case 32:
length = 4; length = 4;
break; break;
case 64: case 64:
length = 8; length = 8;
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %u", ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %u",
bit_width)); bit_width));
return_ACPI_STATUS(AE_AML_OPERAND_VALUE); return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
@ -214,23 +219,29 @@ acpi_ex_system_memory_space_handler(u32 function,
*value = 0; *value = 0;
switch (bit_width) { switch (bit_width) {
case 8: case 8:
*value = (u64) ACPI_GET8(logical_addr_ptr);
*value = (u64)ACPI_GET8(logical_addr_ptr);
break; break;
case 16: case 16:
*value = (u64) ACPI_GET16(logical_addr_ptr);
*value = (u64)ACPI_GET16(logical_addr_ptr);
break; break;
case 32: case 32:
*value = (u64) ACPI_GET32(logical_addr_ptr);
*value = (u64)ACPI_GET32(logical_addr_ptr);
break; break;
case 64: case 64:
*value = (u64) ACPI_GET64(logical_addr_ptr);
*value = (u64)ACPI_GET64(logical_addr_ptr);
break; break;
default: default:
/* bit_width was already validated */ /* bit_width was already validated */
break; break;
} }
break; break;
@ -239,28 +250,35 @@ acpi_ex_system_memory_space_handler(u32 function,
switch (bit_width) { switch (bit_width) {
case 8: case 8:
ACPI_SET8(logical_addr_ptr, *value); ACPI_SET8(logical_addr_ptr, *value);
break; break;
case 16: case 16:
ACPI_SET16(logical_addr_ptr, *value); ACPI_SET16(logical_addr_ptr, *value);
break; break;
case 32: case 32:
ACPI_SET32(logical_addr_ptr, *value); ACPI_SET32(logical_addr_ptr, *value);
break; break;
case 64: case 64:
ACPI_SET64(logical_addr_ptr, *value); ACPI_SET64(logical_addr_ptr, *value);
break; break;
default: default:
/* bit_width was already validated */ /* bit_width was already validated */
break; break;
} }
break; break;
default: default:
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
break; break;
} }
@ -320,6 +338,7 @@ acpi_ex_system_io_space_handler(u32 function,
break; break;
default: default:
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
break; break;
} }

View File

@ -248,6 +248,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
break; break;
default: default:
/* No named references are allowed here */ /* No named references are allowed here */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,

View File

@ -156,7 +156,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
switch (ref_type) { switch (ref_type) {
case ACPI_REFCLASS_LOCAL: case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG: case ACPI_REFCLASS_ARG:
/* /*
* Get the local from the method's state info * Get the local from the method's state info
* Note: this increments the local's object reference count * Note: this increments the local's object reference count
@ -309,6 +308,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
break; break;
default: default:
break; break;
} }
@ -348,10 +348,12 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
type = obj_desc->common.type; type = obj_desc->common.type;
break; break;
case ACPI_DESC_TYPE_NAMED: case ACPI_DESC_TYPE_NAMED:
type = ((struct acpi_namespace_node *)obj_desc)->type; type = ((struct acpi_namespace_node *)obj_desc)->type;
obj_desc = obj_desc =
acpi_ns_get_attached_object((struct acpi_namespace_node *) acpi_ns_get_attached_object((struct acpi_namespace_node *)
@ -538,7 +540,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
break; break;
default: default:
/* No change to Type required */ /* No change to Type required */
break; break;
} }

View File

@ -307,7 +307,6 @@ acpi_ex_resolve_operands(u16 opcode,
case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */ case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */
/* /*
* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
* A Namespace Node is OK as-is * A Namespace Node is OK as-is
@ -326,7 +325,6 @@ acpi_ex_resolve_operands(u16 opcode,
goto next_operand; goto next_operand;
case ARGI_DATAREFOBJ: /* Store operator only */ case ARGI_DATAREFOBJ: /* Store operator only */
/* /*
* We don't want to resolve index_op reference objects during * We don't want to resolve index_op reference objects during
* a store because this would be an implicit de_ref_of operation. * a store because this would be an implicit de_ref_of operation.
@ -343,7 +341,9 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
/* All cases covered above */ /* All cases covered above */
break; break;
} }
@ -433,7 +433,6 @@ acpi_ex_resolve_operands(u16 opcode,
goto next_operand; goto next_operand;
case ARGI_BUFFER: case ARGI_BUFFER:
/* /*
* Need an operand of type ACPI_TYPE_BUFFER, * Need an operand of type ACPI_TYPE_BUFFER,
* But we can implicitly convert from a STRING or INTEGER * But we can implicitly convert from a STRING or INTEGER
@ -459,7 +458,6 @@ acpi_ex_resolve_operands(u16 opcode,
goto next_operand; goto next_operand;
case ARGI_STRING: case ARGI_STRING:
/* /*
* Need an operand of type ACPI_TYPE_STRING, * Need an operand of type ACPI_TYPE_STRING,
* But we can implicitly convert from a BUFFER or INTEGER * But we can implicitly convert from a BUFFER or INTEGER
@ -562,6 +560,7 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Needed [Buffer/String/Package/Reference], found [%s] %p", "Needed [Buffer/String/Package/Reference], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
@ -584,6 +583,7 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Needed [Buffer/String/Package], found [%s] %p", "Needed [Buffer/String/Package], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
@ -605,6 +605,7 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Needed [Region/Buffer], found [%s] %p", "Needed [Region/Buffer], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name

View File

@ -114,6 +114,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
switch (dest_desc->common.type) { switch (dest_desc->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
break; break;
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
@ -178,7 +179,6 @@ acpi_ex_store(union acpi_operand_object *source_desc,
break; break;
case ACPI_REFCLASS_DEBUG: case ACPI_REFCLASS_DEBUG:
/* /*
* Storing to the Debug object causes the value stored to be * Storing to the Debug object causes the value stored to be
* displayed and otherwise has no effect -- see ACPI Specification * displayed and otherwise has no effect -- see ACPI Specification
@ -291,7 +291,6 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
break; break;
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
/* /*
* Store into a Buffer or String (not actually a real buffer_field) * Store into a Buffer or String (not actually a real buffer_field)
* at a location defined by an Index. * at a location defined by an Index.
@ -447,7 +446,6 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* /*
* These target types are all of type Integer/String/Buffer, and * These target types are all of type Integer/String/Buffer, and
* therefore support implicit conversion before the store. * therefore support implicit conversion before the store.

View File

@ -85,11 +85,9 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
* These cases all require only Integers or values that * These cases all require only Integers or values that
* can be converted to Integers (Strings or Buffers) * can be converted to Integers (Strings or Buffers)
*/ */
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* /*
* Stores into a Field/Region or into a Integer/Buffer/String * Stores into a Field/Region or into a Integer/Buffer/String
* are all essentially the same. This case handles the * are all essentially the same. This case handles the
@ -133,7 +131,6 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS: case ACPI_TYPE_LOCAL_METHOD_ALIAS:
/* /*
* All aliases should have been resolved earlier, during the * All aliases should have been resolved earlier, during the
* operand resolution phase. * operand resolution phase.
@ -144,7 +141,6 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
default: default:
/* /*
* All other types than Alias and the various Fields come here, * All other types than Alias and the various Fields come here,
* including the untyped case - ACPI_TYPE_ANY. * including the untyped case - ACPI_TYPE_ANY.

View File

@ -108,7 +108,6 @@ acpi_status acpi_hw_set_mode(u32 mode)
break; break;
case ACPI_SYS_MODE_LEGACY: case ACPI_SYS_MODE_LEGACY:
/* /*
* BIOS should clear all fixed status bits and restore fixed event * BIOS should clear all fixed status bits and restore fixed event
* enable bits to default * enable bits to default
@ -120,6 +119,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
break; break;
default: default:
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }

View File

@ -127,14 +127,17 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
/*lint -fallthrough */ /*lint -fallthrough */
case ACPI_GPE_ENABLE: case ACPI_GPE_ENABLE:
ACPI_SET_BIT(enable_mask, register_bit); ACPI_SET_BIT(enable_mask, register_bit);
break; break;
case ACPI_GPE_DISABLE: case ACPI_GPE_DISABLE:
ACPI_CLEAR_BIT(enable_mask, register_bit); ACPI_CLEAR_BIT(enable_mask, register_bit);
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u", action)); ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u", action));
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }

View File

@ -419,6 +419,7 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id)); ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id));
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
break; break;
@ -491,7 +492,6 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
break; break;
case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
/* /*
* Perform a read first to preserve certain bits (per ACPI spec) * Perform a read first to preserve certain bits (per ACPI spec)
* Note: This includes SCI_EN, we never want to change this bit * Note: This includes SCI_EN, we never want to change this bit
@ -520,7 +520,6 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
break; break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
/* /*
* For control registers, all reserved bits must be preserved, * For control registers, all reserved bits must be preserved,
* as per the ACPI spec. * as per the ACPI spec.
@ -555,6 +554,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id)); ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id));
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
break; break;

View File

@ -495,7 +495,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
* Evaluate the \_Sx namespace object containing the register values * Evaluate the \_Sx namespace object containing the register values
* for this state * for this state
*/ */
info->pathname = info->relative_pathname =
ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
status = acpi_ns_evaluate(info); status = acpi_ns_evaluate(info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -506,7 +506,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
if (!info->return_object) { if (!info->return_object) {
ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
info->pathname)); info->relative_pathname));
status = AE_AML_NO_RETURN_VALUE; status = AE_AML_NO_RETURN_VALUE;
goto cleanup; goto cleanup;
} }
@ -528,10 +528,12 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
elements = info->return_object->package.elements; elements = info->return_object->package.elements;
switch (info->return_object->package.count) { switch (info->return_object->package.count) {
case 0: case 0:
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
break; break;
case 1: case 1:
if (elements[0]->common.type != ACPI_TYPE_INTEGER) { if (elements[0]->common.type != ACPI_TYPE_INTEGER) {
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
@ -545,6 +547,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
case 2: case 2:
default: default:
if ((elements[0]->common.type != ACPI_TYPE_INTEGER) || if ((elements[0]->common.type != ACPI_TYPE_INTEGER) ||
(elements[1]->common.type != ACPI_TYPE_INTEGER)) { (elements[1]->common.type != ACPI_TYPE_INTEGER)) {
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
@ -565,7 +568,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
"While evaluating Sleep State [%s]", "While evaluating Sleep State [%s]",
info->pathname)); info->relative_pathname));
} }
ACPI_FREE(info); ACPI_FREE(info);

View File

@ -240,12 +240,14 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
&acpi_sleep_dispatch[function_id]; &acpi_sleep_dispatch[function_id];
#if (!ACPI_REDUCED_HARDWARE) #if (!ACPI_REDUCED_HARDWARE)
/* /*
* If the Hardware Reduced flag is set (from the FADT), we must * If the Hardware Reduced flag is set (from the FADT), we must
* use the extended sleep registers * use the extended sleep registers (FADT). Note: As per the ACPI
* specification, these extended registers are to be used for HW-reduced
* platforms only. They are not general-purpose replacements for the
* legacy PM register sleep support.
*/ */
if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { if (acpi_gbl_reduced_hardware) {
status = sleep_functions->extended_function(sleep_state); status = sleep_functions->extended_function(sleep_state);
} else { } else {
/* Legacy sleep */ /* Legacy sleep */
@ -314,20 +316,24 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
switch (sleep_state) { switch (sleep_state) {
case ACPI_STATE_S0: case ACPI_STATE_S0:
sst_value = ACPI_SST_WORKING; sst_value = ACPI_SST_WORKING;
break; break;
case ACPI_STATE_S1: case ACPI_STATE_S1:
case ACPI_STATE_S2: case ACPI_STATE_S2:
case ACPI_STATE_S3: case ACPI_STATE_S3:
sst_value = ACPI_SST_SLEEPING; sst_value = ACPI_SST_SLEEPING;
break; break;
case ACPI_STATE_S4: case ACPI_STATE_S4:
sst_value = ACPI_SST_SLEEP_CONTEXT; sst_value = ACPI_SST_SLEEP_CONTEXT;
break; break;
default: default:
sst_value = ACPI_SST_INDICATOR_OFF; /* Default is off */ sst_value = ACPI_SST_INDICATOR_OFF; /* Default is off */
break; break;
} }

View File

@ -151,6 +151,7 @@ acpi_status acpi_ns_root_initialize(void)
*/ */
switch (init_val->type) { switch (init_val->type) {
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
obj_desc->method.param_count = obj_desc->method.param_count =
(u8) ACPI_TO_INTEGER(val); (u8) ACPI_TO_INTEGER(val);
obj_desc->common.flags |= AOPOBJ_DATA_VALID; obj_desc->common.flags |= AOPOBJ_DATA_VALID;

View File

@ -0,0 +1,294 @@
/******************************************************************************
*
* Module Name: nsarguments - Validation of args for ACPI predefined methods
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2013, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#include "acnamesp.h"
#include "acpredef.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsarguments")
/*******************************************************************************
*
* FUNCTION: acpi_ns_check_argument_types
*
* PARAMETERS: info - Method execution information block
*
* RETURN: None
*
* DESCRIPTION: Check the incoming argument count and all argument types
* against the argument type list for a predefined name.
*
******************************************************************************/
void acpi_ns_check_argument_types(struct acpi_evaluate_info *info)
{
u16 arg_type_list;
u8 arg_count;
u8 arg_type;
u8 user_arg_type;
u32 i;
/* If not a predefined name, cannot typecheck args */
if (!info->predefined) {
return;
}
arg_type_list = info->predefined->info.argument_list;
arg_count = METHOD_GET_ARG_COUNT(arg_type_list);
/* Typecheck all arguments */
for (i = 0; ((i < arg_count) && (i < info->param_count)); i++) {
arg_type = METHOD_GET_NEXT_TYPE(arg_type_list);
user_arg_type = info->parameters[i]->common.type;
if (user_arg_type != arg_type) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
ACPI_WARN_ALWAYS,
"Argument #%u type mismatch - "
"Found [%s], ACPI requires [%s]",
(i + 1),
acpi_ut_get_type_name
(user_arg_type),
acpi_ut_get_type_name(arg_type)));
}
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_check_acpi_compliance
*
* PARAMETERS: pathname - Full pathname to the node (for error msgs)
* node - Namespace node for the method/object
* predefined - Pointer to entry in predefined name table
*
* RETURN: None
*
* DESCRIPTION: Check that the declared parameter count (in ASL/AML) for a
* predefined name is what is expected (matches what is defined in
* the ACPI specification for this predefined name.)
*
******************************************************************************/
void
acpi_ns_check_acpi_compliance(char *pathname,
struct acpi_namespace_node *node,
const union acpi_predefined_info *predefined)
{
u32 aml_param_count;
u32 required_param_count;
if (!predefined) {
return;
}
/* Get the ACPI-required arg count from the predefined info table */
required_param_count =
METHOD_GET_ARG_COUNT(predefined->info.argument_list);
/*
* If this object is not a control method, we can check if the ACPI
* spec requires that it be a method.
*/
if (node->type != ACPI_TYPE_METHOD) {
if (required_param_count > 0) {
/* Object requires args, must be implemented as a method */
ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Object (%s) must be a control method with %u arguments",
acpi_ut_get_type_name(node->
type),
required_param_count));
} else if (!required_param_count
&& !predefined->info.expected_btypes) {
/* Object requires no args and no return value, must be a method */
ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Object (%s) must be a control method "
"with no arguments and no return value",
acpi_ut_get_type_name(node->
type)));
}
return;
}
/*
* This is a control method.
* Check that the ASL/AML-defined parameter count for this method
* matches the ACPI-required parameter count
*
* Some methods are allowed to have a "minimum" number of args (_SCP)
* because their definition in ACPI has changed over time.
*
* Note: These are BIOS errors in the declaration of the object
*/
aml_param_count = node->object->method.param_count;
if (aml_param_count < required_param_count) {
ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
"Insufficient arguments - "
"ASL declared %u, ACPI requires %u",
aml_param_count,
required_param_count));
} else if ((aml_param_count > required_param_count)
&& !(predefined->info.
argument_list & ARG_COUNT_IS_MINIMUM)) {
ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
"Excess arguments - "
"ASL declared %u, ACPI requires %u",
aml_param_count,
required_param_count));
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_check_argument_count
*
* PARAMETERS: pathname - Full pathname to the node (for error msgs)
* node - Namespace node for the method/object
* user_param_count - Number of args passed in by the caller
* predefined - Pointer to entry in predefined name table
*
* RETURN: None
*
* DESCRIPTION: Check that incoming argument count matches the declared
* parameter count (in the ASL/AML) for an object.
*
******************************************************************************/
void
acpi_ns_check_argument_count(char *pathname,
struct acpi_namespace_node *node,
u32 user_param_count,
const union acpi_predefined_info *predefined)
{
u32 aml_param_count;
u32 required_param_count;
if (!predefined) {
/*
* Not a predefined name. Check the incoming user argument count
* against the count that is specified in the method/object.
*/
if (node->type != ACPI_TYPE_METHOD) {
if (user_param_count) {
ACPI_INFO_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"%u arguments were passed to a non-method ACPI object (%s)",
user_param_count,
acpi_ut_get_type_name
(node->type)));
}
return;
}
/*
* This is a control method. Check the parameter count.
* We can only check the incoming argument count against the
* argument count declared for the method in the ASL/AML.
*
* Emit a message if too few or too many arguments have been passed
* by the caller.
*
* Note: Too many arguments will not cause the method to
* fail. However, the method will fail if there are too few
* arguments and the method attempts to use one of the missing ones.
*/
aml_param_count = node->object->method.param_count;
if (user_param_count < aml_param_count) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Insufficient arguments - "
"Caller passed %u, method requires %u",
user_param_count,
aml_param_count));
} else if (user_param_count > aml_param_count) {
ACPI_INFO_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Excess arguments - "
"Caller passed %u, method requires %u",
user_param_count,
aml_param_count));
}
return;
}
/*
* This is a predefined name. Validate the user-supplied parameter
* count against the ACPI specification. We don't validate against
* the method itself because what is important here is that the
* caller is in conformance with the spec. (The arg count for the
* method was checked against the ACPI spec earlier.)
*
* Some methods are allowed to have a "minimum" number of args (_SCP)
* because their definition in ACPI has changed over time.
*/
required_param_count =
METHOD_GET_ARG_COUNT(predefined->info.argument_list);
if (user_param_count < required_param_count) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
"Insufficient arguments - "
"Caller passed %u, ACPI requires %u",
user_param_count, required_param_count));
} else if ((user_param_count > required_param_count) &&
!(predefined->info.argument_list & ARG_COUNT_IS_MINIMUM)) {
ACPI_INFO_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
"Excess arguments - "
"Caller passed %u, ACPI requires %u",
user_param_count, required_param_count));
}
}

View File

@ -103,6 +103,7 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
break; break;
default: default:
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
} }
@ -191,6 +192,7 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object,
break; break;
default: default:
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
} }
@ -294,6 +296,7 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
break; break;
default: default:
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
} }

View File

@ -244,10 +244,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
acpi_os_printf("<No attached object>"); acpi_os_printf("<No attached object>");
break; break;
default: default:
break; break;
} }
@ -433,6 +435,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
break; break;
default: default:
break; break;
} }
break; break;
@ -567,32 +570,39 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
goto cleanup; goto cleanup;
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
obj_desc = obj_desc =
(union acpi_operand_object *)obj_desc->buffer_field. (union acpi_operand_object *)obj_desc->buffer_field.
buffer_obj; buffer_obj;
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
obj_desc = (void *)obj_desc->package.elements; obj_desc = (void *)obj_desc->package.elements;
break; break;
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
obj_desc = (void *)obj_desc->method.aml_start; obj_desc = (void *)obj_desc->method.aml_start;
break; break;
case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD:
obj_desc = (void *)obj_desc->field.region_obj; obj_desc = (void *)obj_desc->field.region_obj;
break; break;
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
obj_desc = (void *)obj_desc->bank_field.region_obj; obj_desc = (void *)obj_desc->bank_field.region_obj;
break; break;
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
obj_desc = (void *)obj_desc->index_field.index_obj; obj_desc = (void *)obj_desc->index_field.index_obj;
break; break;
default: default:
goto cleanup; goto cleanup;
} }

View File

@ -61,7 +61,7 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
* *
* PARAMETERS: info - Evaluation info block, contains: * PARAMETERS: info - Evaluation info block, contains:
* prefix_node - Prefix or Method/Object Node to execute * prefix_node - Prefix or Method/Object Node to execute
* pathname - Name of method to execute, If NULL, the * relative_path - Name of method to execute, If NULL, the
* Node is the object to execute * Node is the object to execute
* parameters - List of parameters to pass to the method, * parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
@ -82,10 +82,9 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
{ {
acpi_status status; acpi_status status;
struct acpi_namespace_node *node;
ACPI_FUNCTION_TRACE(ns_evaluate); ACPI_FUNCTION_TRACE(ns_evaluate);
@ -93,83 +92,138 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
/* Initialize the return value to an invalid object */ if (!info->node) {
info->return_object = NULL;
info->param_count = 0;
if (!info->resolved_node) {
/* /*
* Get the actual namespace node for the target object if we need to. * Get the actual namespace node for the target object if we
* Handles these cases: * need to. Handles these cases:
* *
* 1) Null node, Pathname (absolute path) * 1) Null node, valid pathname from root (absolute path)
* 2) Node, Pathname (path relative to Node) * 2) Node and valid pathname (path relative to Node)
* 3) Node, Null Pathname * 3) Node, Null pathname
*/ */
status = acpi_ns_get_node(info->prefix_node, info->pathname, status =
ACPI_NS_NO_UPSEARCH, acpi_ns_get_node(info->prefix_node, info->relative_pathname,
&info->resolved_node); ACPI_NS_NO_UPSEARCH, &info->node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
/* /*
* For a method alias, we must grab the actual method node so that proper * For a method alias, we must grab the actual method node so that
* scoping context will be established before execution. * proper scoping context will be established before execution.
*/ */
if (acpi_ns_get_type(info->resolved_node) == if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
ACPI_TYPE_LOCAL_METHOD_ALIAS) { info->node =
info->resolved_node =
ACPI_CAST_PTR(struct acpi_namespace_node, ACPI_CAST_PTR(struct acpi_namespace_node,
info->resolved_node->object); info->node->object);
} }
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname, /* Complete the info block initialization */
info->resolved_node,
acpi_ns_get_attached_object(info->resolved_node)));
node = info->resolved_node; info->return_object = NULL;
info->node_flags = info->node->flags;
info->obj_desc = acpi_ns_get_attached_object(info->node);
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
info->relative_pathname, info->node,
acpi_ns_get_attached_object(info->node)));
/* Get info if we have a predefined name (_HID, etc.) */
info->predefined =
acpi_ut_match_predefined_method(info->node->name.ascii);
/* Get the full pathname to the object, for use in warning messages */
info->full_pathname = acpi_ns_get_external_pathname(info->node);
if (!info->full_pathname) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Count the number of arguments being passed in */
info->param_count = 0;
if (info->parameters) {
while (info->parameters[info->param_count]) {
info->param_count++;
}
/* Warn on impossible argument count */
if (info->param_count > ACPI_METHOD_NUM_ARGS) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
ACPI_WARN_ALWAYS,
"Excess arguments (%u) - using only %u",
info->param_count,
ACPI_METHOD_NUM_ARGS));
info->param_count = ACPI_METHOD_NUM_ARGS;
}
}
/* /*
* Two major cases here: * For predefined names: Check that the declared argument count
* * matches the ACPI spec -- otherwise this is a BIOS error.
* 1) The object is a control method -- execute it
* 2) The object is not a method -- just return it's current value
*/ */
if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) { acpi_ns_check_acpi_compliance(info->full_pathname, info->node,
info->predefined);
/*
* For all names: Check that the incoming argument count for
* this method/object matches the actual ASL/AML definition.
*/
acpi_ns_check_argument_count(info->full_pathname, info->node,
info->param_count, info->predefined);
/* For predefined names: Typecheck all incoming arguments */
acpi_ns_check_argument_types(info);
/*
* Three major evaluation cases:
*
* 1) Object types that cannot be evaluated by definition
* 2) The object is a control method -- execute it
* 3) The object is not a method -- just return it's current value
*/
switch (acpi_ns_get_type(info->node)) {
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_REGION:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_LOCAL_SCOPE:
/* /*
* 1) Object is a control method - execute it * 1) Disallow evaluation of certain object types. For these,
* object evaluation is undefined and not supported.
*/
ACPI_ERROR((AE_INFO,
"%s: Evaluation of object type [%s] is not supported",
info->full_pathname,
acpi_ut_get_type_name(info->node->type)));
status = AE_TYPE;
goto cleanup;
case ACPI_TYPE_METHOD:
/*
* 2) Object is a control method - execute it
*/ */
/* Verify that there is a method object associated with this node */ /* Verify that there is a method object associated with this node */
info->obj_desc =
acpi_ns_get_attached_object(info->resolved_node);
if (!info->obj_desc) { if (!info->obj_desc) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Control method has no attached sub-object")); "%s: Method has no attached sub-object",
return_ACPI_STATUS(AE_NULL_OBJECT); info->full_pathname));
status = AE_NULL_OBJECT;
goto cleanup;
} }
/* Count the number of arguments being passed to the method */
if (info->parameters) {
while (info->parameters[info->param_count]) {
if (info->param_count > ACPI_METHOD_MAX_ARG) {
return_ACPI_STATUS(AE_LIMIT);
}
info->param_count++;
}
}
ACPI_DUMP_PATHNAME(info->resolved_node, "ACPI: Execute Method",
ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Method at AML address %p Length %X\n", "**** Execute method [%s] at AML address %p length %X\n",
info->full_pathname,
info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_start + 1,
info->obj_desc->method.aml_length - 1)); info->obj_desc->method.aml_length - 1));
@ -184,81 +238,61 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
acpi_ex_enter_interpreter(); acpi_ex_enter_interpreter();
status = acpi_ps_execute_method(info); status = acpi_ps_execute_method(info);
acpi_ex_exit_interpreter(); acpi_ex_exit_interpreter();
} else { break;
default:
/* /*
* 2) Object is not a method, return its current value * 3) All other non-method objects -- get the current object value
*
* Disallow certain object types. For these, "evaluation" is undefined.
*/ */
switch (info->resolved_node->type) {
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_REGION:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_LOCAL_SCOPE:
ACPI_ERROR((AE_INFO,
"[%4.4s] Evaluation of object type [%s] is not supported",
info->resolved_node->name.ascii,
acpi_ut_get_type_name(info->resolved_node->
type)));
return_ACPI_STATUS(AE_TYPE);
default:
break;
}
/* /*
* Objects require additional resolution steps (e.g., the Node may be * Some objects require additional resolution steps (e.g., the Node
* a field that must be read, etc.) -- we can't just grab the object * may be a field that must be read, etc.) -- we can't just grab
* out of the node. * the object out of the node.
* *
* Use resolve_node_to_value() to get the associated value. * Use resolve_node_to_value() to get the associated value.
* *
* NOTE: we can get away with passing in NULL for a walk state because * NOTE: we can get away with passing in NULL for a walk state because
* resolved_node is guaranteed to not be a reference to either a method * the Node is guaranteed to not be a reference to either a method
* local or a method argument (because this interface is never called * local or a method argument (because this interface is never called
* from a running method.) * from a running method.)
* *
* Even though we do not directly invoke the interpreter for object * Even though we do not directly invoke the interpreter for object
* resolution, we must lock it because we could access an opregion. * resolution, we must lock it because we could access an op_region.
* The opregion access code assumes that the interpreter is locked. * The op_region access code assumes that the interpreter is locked.
*/ */
acpi_ex_enter_interpreter(); acpi_ex_enter_interpreter();
/* Function has a strange interface */ /* TBD: resolve_node_to_value has a strange interface, fix */
info->return_object =
ACPI_CAST_PTR(union acpi_operand_object, info->node);
status = status =
acpi_ex_resolve_node_to_value(&info->resolved_node, NULL); acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
(struct acpi_namespace_node,
&info->return_object), NULL);
acpi_ex_exit_interpreter(); acpi_ex_exit_interpreter();
/* if (ACPI_FAILURE(status)) {
* If acpi_ex_resolve_node_to_value() succeeded, the return value was placed goto cleanup;
* in resolved_node.
*/
if (ACPI_SUCCESS(status)) {
status = AE_CTRL_RETURN_VALUE;
info->return_object =
ACPI_CAST_PTR(union acpi_operand_object,
info->resolved_node);
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Returning object %p [%s]\n",
info->return_object,
acpi_ut_get_object_type_name(info->
return_object)));
} }
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Returned object %p [%s]\n",
info->return_object,
acpi_ut_get_object_type_name(info->
return_object)));
status = AE_CTRL_RETURN_VALUE; /* Always has a "return value" */
break;
} }
/* /*
* Check input argument count against the ASL-defined count for a method. * For predefined names, check the return value against the ACPI
* Also check predefined names: argument count and return value against * specification. Some incorrect return value types are repaired.
* the ACPI specification. Some incorrect return value types are repaired.
*/ */
(void)acpi_ns_check_predefined_names(node, info->param_count, (void)acpi_ns_check_return_value(info->node, info, info->param_count,
status, &info->return_object); status, &info->return_object);
/* Check if there is a return value that must be dealt with */ /* Check if there is a return value that must be dealt with */
@ -278,12 +312,15 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"*** Completed evaluation of object %s ***\n", "*** Completed evaluation of object %s ***\n",
info->pathname)); info->relative_pathname));
cleanup:
/* /*
* Namespace was unlocked by the handling acpi_ns* function, so we * Namespace was unlocked by the handling acpi_ns* function, so we
* just return * just free the pathname and return
*/ */
ACPI_FREE(info->full_pathname);
info->full_pathname = NULL;
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View File

@ -176,7 +176,7 @@ acpi_status acpi_ns_initialize_devices(void)
* part of the ACPI specification. * part of the ACPI specification.
*/ */
info.evaluate_info->prefix_node = acpi_gbl_root_node; info.evaluate_info->prefix_node = acpi_gbl_root_node;
info.evaluate_info->pathname = METHOD_NAME__INI; info.evaluate_info->relative_pathname = METHOD_NAME__INI;
info.evaluate_info->parameters = NULL; info.evaluate_info->parameters = NULL;
info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE; info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
@ -266,28 +266,34 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
switch (type) { switch (type) {
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
info->op_region_count++; info->op_region_count++;
break; break;
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
info->field_count++; info->field_count++;
break; break;
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
info->field_count++; info->field_count++;
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
info->buffer_count++; info->buffer_count++;
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
info->package_count++; info->package_count++;
break; break;
default: default:
/* No init required, just exit now */ /* No init required, just exit now */
return (AE_OK); return (AE_OK);
} }
@ -337,7 +343,9 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
break; break;
default: default:
/* No other types can get here */ /* No other types can get here */
break; break;
} }
@ -416,6 +424,7 @@ acpi_ns_find_ini_methods(acpi_handle obj_handle,
break; break;
default: default:
break; break;
} }
@ -560,7 +569,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info)); ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
info->prefix_node = device_node; info->prefix_node = device_node;
info->pathname = METHOD_NAME__INI; info->relative_pathname = METHOD_NAME__INI;
info->parameters = NULL; info->parameters = NULL;
info->flags = ACPI_IGNORE_RETURN_VALUE; info->flags = ACPI_IGNORE_RETURN_VALUE;
@ -574,8 +583,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
/* Ignore error and move on to next device */ /* Ignore error and move on to next device */
char *scope_name = char *scope_name = acpi_ns_get_external_pathname(info->node);
acpi_ns_get_external_pathname(info->resolved_node);
ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
scope_name)); scope_name));

View File

@ -61,28 +61,29 @@ ACPI_MODULE_NAME("nspredef")
* There are several areas that are validated: * There are several areas that are validated:
* *
* 1) The number of input arguments as defined by the method/object in the * 1) The number of input arguments as defined by the method/object in the
* ASL is validated against the ACPI specification. * ASL is validated against the ACPI specification.
* 2) The type of the return object (if any) is validated against the ACPI * 2) The type of the return object (if any) is validated against the ACPI
* specification. * specification.
* 3) For returned package objects, the count of package elements is * 3) For returned package objects, the count of package elements is
* validated, as well as the type of each package element. Nested * validated, as well as the type of each package element. Nested
* packages are supported. * packages are supported.
* *
* For any problems found, a warning message is issued. * For any problems found, a warning message is issued.
* *
******************************************************************************/ ******************************************************************************/
/* Local prototypes */ /* Local prototypes */
static acpi_status static acpi_status
acpi_ns_check_reference(struct acpi_predefined_data *data, acpi_ns_check_reference(struct acpi_evaluate_info *info,
union acpi_operand_object *return_object); union acpi_operand_object *return_object);
static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object); static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_check_predefined_names * FUNCTION: acpi_ns_check_return_value
* *
* PARAMETERS: node - Namespace node for the method/object * PARAMETERS: node - Namespace node for the method/object
* info - Method execution information block
* user_param_count - Number of parameters actually passed * user_param_count - Number of parameters actually passed
* return_status - Status from the object evaluation * return_status - Status from the object evaluation
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
@ -90,44 +91,25 @@ static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object);
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Check an ACPI name for a match in the predefined name list. * DESCRIPTION: Check the value returned from a predefined name.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ns_check_predefined_names(struct acpi_namespace_node *node, acpi_ns_check_return_value(struct acpi_namespace_node *node,
u32 user_param_count, struct acpi_evaluate_info *info,
acpi_status return_status, u32 user_param_count,
union acpi_operand_object **return_object_ptr) acpi_status return_status,
union acpi_operand_object **return_object_ptr)
{ {
acpi_status status = AE_OK; acpi_status status;
const union acpi_predefined_info *predefined; const union acpi_predefined_info *predefined;
char *pathname;
struct acpi_predefined_data *data;
/* Match the name for this method/object against the predefined list */
predefined = acpi_ut_match_predefined_method(node->name.ascii);
/* Get the full pathname to the object, for use in warning messages */
pathname = acpi_ns_get_external_pathname(node);
if (!pathname) {
return (AE_OK); /* Could not get pathname, ignore */
}
/*
* Check that the parameter count for this method matches the ASL
* definition. For predefined names, ensure that both the caller and
* the method itself are in accordance with the ACPI specification.
*/
acpi_ns_check_parameter_count(pathname, node, user_param_count,
predefined);
/* If not a predefined name, we cannot validate the return object */ /* If not a predefined name, we cannot validate the return object */
predefined = info->predefined;
if (!predefined) { if (!predefined) {
goto cleanup; return (AE_OK);
} }
/* /*
@ -135,7 +117,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
* validate the return object * validate the return object
*/ */
if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
goto cleanup; return (AE_OK);
} }
/* /*
@ -154,25 +136,14 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
if (acpi_gbl_disable_auto_repair || if (acpi_gbl_disable_auto_repair ||
(!predefined->info.expected_btypes) || (!predefined->info.expected_btypes) ||
(predefined->info.expected_btypes == ACPI_RTYPE_ALL)) { (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) {
goto cleanup; return (AE_OK);
} }
/* Create the parameter data block for object validation */
data = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_predefined_data));
if (!data) {
goto cleanup;
}
data->predefined = predefined;
data->node = node;
data->node_flags = node->flags;
data->pathname = pathname;
/* /*
* Check that the type of the main return object is what is expected * Check that the type of the main return object is what is expected
* for this predefined name * for this predefined name
*/ */
status = acpi_ns_check_object_type(data, return_object_ptr, status = acpi_ns_check_object_type(info, return_object_ptr,
predefined->info.expected_btypes, predefined->info.expected_btypes,
ACPI_NOT_PACKAGE_ELEMENT); ACPI_NOT_PACKAGE_ELEMENT);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -184,10 +155,16 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
* Note: Package may have been newly created by call above. * Note: Package may have been newly created by call above.
*/ */
if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) {
data->parent_package = *return_object_ptr; info->parent_package = *return_object_ptr;
status = acpi_ns_check_package(data, return_object_ptr); status = acpi_ns_check_package(info, return_object_ptr);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto exit;
/* We might be able to fix some errors */
if ((status != AE_AML_OPERAND_TYPE) &&
(status != AE_AML_OPERAND_VALUE)) {
goto exit;
}
} }
} }
@ -199,7 +176,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
* performed on a per-name basis, i.e., the code is specific to * performed on a per-name basis, i.e., the code is specific to
* particular predefined names. * particular predefined names.
*/ */
status = acpi_ns_complex_repairs(data, node, status, return_object_ptr); status = acpi_ns_complex_repairs(info, node, status, return_object_ptr);
exit: exit:
/* /*
@ -207,112 +184,18 @@ exit:
* or more objects, mark the parent node to suppress further warning * or more objects, mark the parent node to suppress further warning
* messages during the next evaluation of the same method/object. * messages during the next evaluation of the same method/object.
*/ */
if (ACPI_FAILURE(status) || (data->flags & ACPI_OBJECT_REPAIRED)) { if (ACPI_FAILURE(status) || (info->return_flags & ACPI_OBJECT_REPAIRED)) {
node->flags |= ANOBJ_EVALUATED; node->flags |= ANOBJ_EVALUATED;
} }
ACPI_FREE(data);
cleanup:
ACPI_FREE(pathname);
return (status); return (status);
} }
/*******************************************************************************
*
* FUNCTION: acpi_ns_check_parameter_count
*
* PARAMETERS: pathname - Full pathname to the node (for error msgs)
* node - Namespace node for the method/object
* user_param_count - Number of args passed in by the caller
* predefined - Pointer to entry in predefined name table
*
* RETURN: None
*
* DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a
* predefined name is what is expected (i.e., what is defined in
* the ACPI specification for this predefined name.)
*
******************************************************************************/
void
acpi_ns_check_parameter_count(char *pathname,
struct acpi_namespace_node *node,
u32 user_param_count,
const union acpi_predefined_info *predefined)
{
u32 param_count;
u32 required_params_current;
u32 required_params_old;
/* Methods have 0-7 parameters. All other types have zero. */
param_count = 0;
if (node->type == ACPI_TYPE_METHOD) {
param_count = node->object->method.param_count;
}
if (!predefined) {
/*
* Check the parameter count for non-predefined methods/objects.
*
* Warning if too few or too many arguments have been passed by the
* caller. An incorrect number of arguments may not cause the method
* to fail. However, the method will fail if there are too few
* arguments and the method attempts to use one of the missing ones.
*/
if (user_param_count < param_count) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Insufficient arguments - needs %u, found %u",
param_count, user_param_count));
} else if (user_param_count > param_count) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Excess arguments - needs %u, found %u",
param_count, user_param_count));
}
return;
}
/*
* Validate the user-supplied parameter count.
* Allow two different legal argument counts (_SCP, etc.)
*/
required_params_current =
predefined->info.argument_list & METHOD_ARG_MASK;
required_params_old =
predefined->info.argument_list >> METHOD_ARG_BIT_WIDTH;
if (user_param_count != ACPI_UINT32_MAX) {
if ((user_param_count != required_params_current) &&
(user_param_count != required_params_old)) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Parameter count mismatch - "
"caller passed %u, ACPI requires %u",
user_param_count,
required_params_current));
}
}
/*
* Check that the ASL-defined parameter count is what is expected for
* this predefined name (parameter count as defined by the ACPI
* specification)
*/
if ((param_count != required_params_current) &&
(param_count != required_params_old)) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname, node->flags,
"Parameter count mismatch - ASL declared %u, ACPI requires %u",
param_count, required_params_current));
}
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_check_object_type * FUNCTION: acpi_ns_check_object_type
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object * evaluation of a method or object
* expected_btypes - Bitmap of expected return type(s) * expected_btypes - Bitmap of expected return type(s)
@ -328,7 +211,7 @@ acpi_ns_check_parameter_count(char *pathname,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ns_check_object_type(struct acpi_predefined_data *data, acpi_ns_check_object_type(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr, union acpi_operand_object **return_object_ptr,
u32 expected_btypes, u32 package_index) u32 expected_btypes, u32 package_index)
{ {
@ -340,7 +223,8 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
if (return_object && if (return_object &&
ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) { ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Invalid return type - Found a Namespace node [%4.4s] type %s", "Invalid return type - Found a Namespace node [%4.4s] type %s",
return_object->node.name.ascii, return_object->node.name.ascii,
acpi_ut_get_type_name(return_object->node. acpi_ut_get_type_name(return_object->node.
@ -356,8 +240,8 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
* from all of the predefined names (including elements of returned * from all of the predefined names (including elements of returned
* packages) * packages)
*/ */
data->return_btype = acpi_ns_get_bitmapped_type(return_object); info->return_btype = acpi_ns_get_bitmapped_type(return_object);
if (data->return_btype == ACPI_RTYPE_ANY) { if (info->return_btype == ACPI_RTYPE_ANY) {
/* Not one of the supported objects, must be incorrect */ /* Not one of the supported objects, must be incorrect */
goto type_error_exit; goto type_error_exit;
@ -365,16 +249,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
/* For reference objects, check that the reference type is correct */ /* For reference objects, check that the reference type is correct */
if ((data->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) { if ((info->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) {
status = acpi_ns_check_reference(data, return_object); status = acpi_ns_check_reference(info, return_object);
return (status); return (status);
} }
/* Attempt simple repair of the returned object if necessary */ /* Attempt simple repair of the returned object if necessary */
status = acpi_ns_simple_repair(data, expected_btypes, status = acpi_ns_simple_repair(info, expected_btypes,
package_index, return_object_ptr); package_index, return_object_ptr);
return (status); if (ACPI_SUCCESS(status)) {
return (AE_OK); /* Successful repair */
}
type_error_exit: type_error_exit:
@ -383,12 +269,14 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
acpi_ut_get_expected_return_types(type_buffer, expected_btypes); acpi_ut_get_expected_return_types(type_buffer, expected_btypes);
if (package_index == ACPI_NOT_PACKAGE_ELEMENT) { if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Return type mismatch - found %s, expected %s", "Return type mismatch - found %s, expected %s",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(return_object), type_buffer)); (return_object), type_buffer));
} else { } else {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Return Package type mismatch at index %u - " "Return Package type mismatch at index %u - "
"found %s, expected %s", package_index, "found %s, expected %s", package_index,
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
@ -402,7 +290,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
* *
* FUNCTION: acpi_ns_check_reference * FUNCTION: acpi_ns_check_reference
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object - Object returned from the evaluation of a * return_object - Object returned from the evaluation of a
* method or object * method or object
* *
@ -415,7 +303,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
******************************************************************************/ ******************************************************************************/
static acpi_status static acpi_status
acpi_ns_check_reference(struct acpi_predefined_data *data, acpi_ns_check_reference(struct acpi_evaluate_info *info,
union acpi_operand_object *return_object) union acpi_operand_object *return_object)
{ {
@ -428,7 +316,7 @@ acpi_ns_check_reference(struct acpi_predefined_data *data,
return (AE_OK); return (AE_OK);
} }
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
"Return type mismatch - unexpected reference object type [%s] %2.2X", "Return type mismatch - unexpected reference object type [%s] %2.2X",
acpi_ut_get_reference_name(return_object), acpi_ut_get_reference_name(return_object),
return_object->reference.class)); return_object->reference.class));
@ -462,26 +350,32 @@ static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object)
switch (return_object->common.type) { switch (return_object->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
return_btype = ACPI_RTYPE_INTEGER; return_btype = ACPI_RTYPE_INTEGER;
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
return_btype = ACPI_RTYPE_BUFFER; return_btype = ACPI_RTYPE_BUFFER;
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
return_btype = ACPI_RTYPE_STRING; return_btype = ACPI_RTYPE_STRING;
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
return_btype = ACPI_RTYPE_PACKAGE; return_btype = ACPI_RTYPE_PACKAGE;
break; break;
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
return_btype = ACPI_RTYPE_REFERENCE; return_btype = ACPI_RTYPE_REFERENCE;
break; break;
default: default:
/* Not one of the supported objects, must be incorrect */ /* Not one of the supported objects, must be incorrect */
return_btype = ACPI_RTYPE_ANY; return_btype = ACPI_RTYPE_ANY;

View File

@ -51,12 +51,12 @@ ACPI_MODULE_NAME("nsprepkg")
/* Local prototypes */ /* Local prototypes */
static acpi_status static acpi_status
acpi_ns_check_package_list(struct acpi_predefined_data *data, acpi_ns_check_package_list(struct acpi_evaluate_info *info,
const union acpi_predefined_info *package, const union acpi_predefined_info *package,
union acpi_operand_object **elements, u32 count); union acpi_operand_object **elements, u32 count);
static acpi_status static acpi_status
acpi_ns_check_package_elements(struct acpi_predefined_data *data, acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
union acpi_operand_object **elements, union acpi_operand_object **elements,
u8 type1, u8 type1,
u32 count1, u32 count1,
@ -66,7 +66,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
* *
* FUNCTION: acpi_ns_check_package * FUNCTION: acpi_ns_check_package
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object * evaluation of a method or object
* *
@ -78,7 +78,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ns_check_package(struct acpi_predefined_data *data, acpi_ns_check_package(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
{ {
union acpi_operand_object *return_object = *return_object_ptr; union acpi_operand_object *return_object = *return_object_ptr;
@ -93,18 +93,18 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* The package info for this name is in the next table entry */ /* The package info for this name is in the next table entry */
package = data->predefined + 1; package = info->predefined + 1;
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"%s Validating return Package of Type %X, Count %X\n", "%s Validating return Package of Type %X, Count %X\n",
data->pathname, package->ret_info.type, info->full_pathname, package->ret_info.type,
return_object->package.count)); return_object->package.count));
/* /*
* For variable-length Packages, we can safely remove all embedded * For variable-length Packages, we can safely remove all embedded
* and trailing NULL package elements * and trailing NULL package elements
*/ */
acpi_ns_remove_null_elements(data, package->ret_info.type, acpi_ns_remove_null_elements(info, package->ret_info.type,
return_object); return_object);
/* Extract package count and elements array */ /* Extract package count and elements array */
@ -121,7 +121,8 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
return (AE_OK); return (AE_OK);
} }
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Return Package has no elements (empty)")); "Return Package has no elements (empty)"));
return (AE_AML_OPERAND_VALUE); return (AE_AML_OPERAND_VALUE);
@ -135,7 +136,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
*/ */
switch (package->ret_info.type) { switch (package->ret_info.type) {
case ACPI_PTYPE1_FIXED: case ACPI_PTYPE1_FIXED:
/* /*
* The package count is fixed and there are no sub-packages * The package count is fixed and there are no sub-packages
* *
@ -150,13 +150,13 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Return Package is larger than needed - " "%s: Return Package is larger than needed - "
"found %u, expected %u\n", "found %u, expected %u\n",
data->pathname, count, info->full_pathname, count,
expected_count)); expected_count));
} }
/* Validate all elements of the returned package */ /* Validate all elements of the returned package */
status = acpi_ns_check_package_elements(data, elements, status = acpi_ns_check_package_elements(info, elements,
package->ret_info. package->ret_info.
object_type1, object_type1,
package->ret_info. package->ret_info.
@ -168,13 +168,12 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
break; break;
case ACPI_PTYPE1_VAR: case ACPI_PTYPE1_VAR:
/* /*
* The package count is variable, there are no sub-packages, and all * The package count is variable, there are no sub-packages, and all
* elements must be of the same type * elements must be of the same type
*/ */
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
status = acpi_ns_check_object_type(data, elements, status = acpi_ns_check_object_type(info, elements,
package->ret_info. package->ret_info.
object_type1, i); object_type1, i);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -185,7 +184,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
break; break;
case ACPI_PTYPE1_OPTION: case ACPI_PTYPE1_OPTION:
/* /*
* The package count is variable, there are no sub-packages. There are * The package count is variable, there are no sub-packages. There are
* a fixed number of required elements, and a variable number of * a fixed number of required elements, and a variable number of
@ -206,7 +204,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* These are the required package elements (0, 1, or 2) */ /* These are the required package elements (0, 1, or 2) */
status = status =
acpi_ns_check_object_type(data, elements, acpi_ns_check_object_type(info, elements,
package-> package->
ret_info3. ret_info3.
object_type[i], object_type[i],
@ -218,7 +216,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* These are the optional package elements */ /* These are the optional package elements */
status = status =
acpi_ns_check_object_type(data, elements, acpi_ns_check_object_type(info, elements,
package-> package->
ret_info3. ret_info3.
tail_object_type, tail_object_type,
@ -235,7 +233,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* First element is the (Integer) revision */ /* First element is the (Integer) revision */
status = acpi_ns_check_object_type(data, elements, status = acpi_ns_check_object_type(info, elements,
ACPI_RTYPE_INTEGER, 0); ACPI_RTYPE_INTEGER, 0);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
@ -247,14 +245,14 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* Examine the sub-packages */ /* Examine the sub-packages */
status = status =
acpi_ns_check_package_list(data, package, elements, count); acpi_ns_check_package_list(info, package, elements, count);
break; break;
case ACPI_PTYPE2_PKG_COUNT: case ACPI_PTYPE2_PKG_COUNT:
/* First element is the (Integer) count of sub-packages to follow */ /* First element is the (Integer) count of sub-packages to follow */
status = acpi_ns_check_object_type(data, elements, status = acpi_ns_check_object_type(info, elements,
ACPI_RTYPE_INTEGER, 0); ACPI_RTYPE_INTEGER, 0);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
@ -275,7 +273,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* Examine the sub-packages */ /* Examine the sub-packages */
status = status =
acpi_ns_check_package_list(data, package, elements, count); acpi_ns_check_package_list(info, package, elements, count);
break; break;
case ACPI_PTYPE2: case ACPI_PTYPE2:
@ -283,7 +281,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
case ACPI_PTYPE2_MIN: case ACPI_PTYPE2_MIN:
case ACPI_PTYPE2_COUNT: case ACPI_PTYPE2_COUNT:
case ACPI_PTYPE2_FIX_VAR: case ACPI_PTYPE2_FIX_VAR:
/* /*
* These types all return a single Package that consists of a * These types all return a single Package that consists of a
* variable number of sub-Packages. * variable number of sub-Packages.
@ -300,7 +297,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* Create the new outer package and populate it */ /* Create the new outer package and populate it */
status = status =
acpi_ns_wrap_with_package(data, return_object, acpi_ns_wrap_with_package(info, return_object,
return_object_ptr); return_object_ptr);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
@ -316,14 +313,15 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* Examine the sub-packages */ /* Examine the sub-packages */
status = status =
acpi_ns_check_package_list(data, package, elements, count); acpi_ns_check_package_list(info, package, elements, count);
break; break;
default: default:
/* Should not get here if predefined info table is correct */ /* Should not get here if predefined info table is correct */
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Invalid internal return type in table entry: %X", "Invalid internal return type in table entry: %X",
package->ret_info.type)); package->ret_info.type));
@ -336,7 +334,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
/* Error exit for the case with an incorrect package count */ /* Error exit for the case with an incorrect package count */
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
"Return Package is too small - found %u elements, expected %u", "Return Package is too small - found %u elements, expected %u",
count, expected_count)); count, expected_count));
@ -347,7 +345,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
* *
* FUNCTION: acpi_ns_check_package_list * FUNCTION: acpi_ns_check_package_list
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* package - Pointer to package-specific info for method * package - Pointer to package-specific info for method
* elements - Element list of parent package. All elements * elements - Element list of parent package. All elements
* of this list should be of type Package. * of this list should be of type Package.
@ -360,7 +358,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
******************************************************************************/ ******************************************************************************/
static acpi_status static acpi_status
acpi_ns_check_package_list(struct acpi_predefined_data *data, acpi_ns_check_package_list(struct acpi_evaluate_info *info,
const union acpi_predefined_info *package, const union acpi_predefined_info *package,
union acpi_operand_object **elements, u32 count) union acpi_operand_object **elements, u32 count)
{ {
@ -381,11 +379,11 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
sub_package = *elements; sub_package = *elements;
sub_elements = sub_package->package.elements; sub_elements = sub_package->package.elements;
data->parent_package = sub_package; info->parent_package = sub_package;
/* Each sub-object must be of type Package */ /* Each sub-object must be of type Package */
status = acpi_ns_check_object_type(data, &sub_package, status = acpi_ns_check_object_type(info, &sub_package,
ACPI_RTYPE_PACKAGE, i); ACPI_RTYPE_PACKAGE, i);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
@ -393,7 +391,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
/* Examine the different types of expected sub-packages */ /* Examine the different types of expected sub-packages */
data->parent_package = sub_package; info->parent_package = sub_package;
switch (package->ret_info.type) { switch (package->ret_info.type) {
case ACPI_PTYPE2: case ACPI_PTYPE2:
case ACPI_PTYPE2_PKG_COUNT: case ACPI_PTYPE2_PKG_COUNT:
@ -408,7 +406,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
} }
status = status =
acpi_ns_check_package_elements(data, sub_elements, acpi_ns_check_package_elements(info, sub_elements,
package->ret_info. package->ret_info.
object_type1, object_type1,
package->ret_info. package->ret_info.
@ -434,7 +432,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
} }
status = status =
acpi_ns_check_package_elements(data, sub_elements, acpi_ns_check_package_elements(info, sub_elements,
package->ret_info. package->ret_info.
object_type1, object_type1,
package->ret_info. package->ret_info.
@ -463,7 +461,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
for (j = 0; j < expected_count; j++) { for (j = 0; j < expected_count; j++) {
status = status =
acpi_ns_check_object_type(data, acpi_ns_check_object_type(info,
&sub_elements[j], &sub_elements[j],
package-> package->
ret_info2. ret_info2.
@ -487,7 +485,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
/* Check the type of each sub-package element */ /* Check the type of each sub-package element */
status = status =
acpi_ns_check_package_elements(data, sub_elements, acpi_ns_check_package_elements(info, sub_elements,
package->ret_info. package->ret_info.
object_type1, object_type1,
sub_package->package. sub_package->package.
@ -498,12 +496,11 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
break; break;
case ACPI_PTYPE2_COUNT: case ACPI_PTYPE2_COUNT:
/* /*
* First element is the (Integer) count of elements, including * First element is the (Integer) count of elements, including
* the count field (the ACPI name is num_elements) * the count field (the ACPI name is num_elements)
*/ */
status = acpi_ns_check_object_type(data, sub_elements, status = acpi_ns_check_object_type(info, sub_elements,
ACPI_RTYPE_INTEGER, ACPI_RTYPE_INTEGER,
0); 0);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -537,7 +534,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
/* Check the type of each sub-package element */ /* Check the type of each sub-package element */
status = status =
acpi_ns_check_package_elements(data, acpi_ns_check_package_elements(info,
(sub_elements + 1), (sub_elements + 1),
package->ret_info. package->ret_info.
object_type1, object_type1,
@ -562,7 +559,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
/* The sub-package count was smaller than required */ /* The sub-package count was smaller than required */
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
"Return Sub-Package[%u] is too small - found %u elements, expected %u", "Return Sub-Package[%u] is too small - found %u elements, expected %u",
i, sub_package->package.count, expected_count)); i, sub_package->package.count, expected_count));
@ -573,7 +570,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
* *
* FUNCTION: acpi_ns_check_package_elements * FUNCTION: acpi_ns_check_package_elements
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* elements - Pointer to the package elements array * elements - Pointer to the package elements array
* type1 - Object type for first group * type1 - Object type for first group
* count1 - Count for first group * count1 - Count for first group
@ -589,7 +586,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
******************************************************************************/ ******************************************************************************/
static acpi_status static acpi_status
acpi_ns_check_package_elements(struct acpi_predefined_data *data, acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
union acpi_operand_object **elements, union acpi_operand_object **elements,
u8 type1, u8 type1,
u32 count1, u32 count1,
@ -605,7 +602,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
* The second group can have a count of zero. * The second group can have a count of zero.
*/ */
for (i = 0; i < count1; i++) { for (i = 0; i < count1; i++) {
status = acpi_ns_check_object_type(data, this_element, status = acpi_ns_check_object_type(info, this_element,
type1, i + start_index); type1, i + start_index);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
@ -614,7 +611,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
} }
for (i = 0; i < count2; i++) { for (i = 0; i < count2; i++) {
status = acpi_ns_check_object_type(data, this_element, status = acpi_ns_check_object_type(info, this_element,
type2, type2,
(i + count1 + start_index)); (i + count1 + start_index));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {

View File

@ -130,7 +130,7 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
* *
* FUNCTION: acpi_ns_simple_repair * FUNCTION: acpi_ns_simple_repair
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* expected_btypes - Object types expected * expected_btypes - Object types expected
* package_index - Index of object within parent package (if * package_index - Index of object within parent package (if
* applicable - ACPI_NOT_PACKAGE_ELEMENT * applicable - ACPI_NOT_PACKAGE_ELEMENT
@ -146,7 +146,7 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ns_simple_repair(struct acpi_predefined_data *data, acpi_ns_simple_repair(struct acpi_evaluate_info *info,
u32 expected_btypes, u32 expected_btypes,
u32 package_index, u32 package_index,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
@ -162,12 +162,12 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
* Special repairs for certain names that are in the repair table. * Special repairs for certain names that are in the repair table.
* Check if this name is in the list of repairable names. * Check if this name is in the list of repairable names.
*/ */
predefined = acpi_ns_match_simple_repair(data->node, predefined = acpi_ns_match_simple_repair(info->node,
data->return_btype, info->return_btype,
package_index); package_index);
if (predefined) { if (predefined) {
if (!return_object) { if (!return_object) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
ACPI_WARN_ALWAYS, ACPI_WARN_ALWAYS,
"Missing expected return value")); "Missing expected return value"));
} }
@ -191,7 +191,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
* Do not perform simple object repair unless the return type is not * Do not perform simple object repair unless the return type is not
* expected. * expected.
*/ */
if (data->return_btype & expected_btypes) { if (info->return_btype & expected_btypes) {
return (AE_OK); return (AE_OK);
} }
@ -211,7 +211,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
*/ */
if (!return_object) { if (!return_object) {
if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) { if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
ACPI_WARN_ALWAYS, ACPI_WARN_ALWAYS,
"Missing expected return value")); "Missing expected return value"));
@ -247,14 +247,14 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
* for correct contents (expected object type or types). * for correct contents (expected object type or types).
*/ */
status = status =
acpi_ns_wrap_with_package(data, return_object, &new_object); acpi_ns_wrap_with_package(info, return_object, &new_object);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* /*
* The original object just had its reference count * The original object just had its reference count
* incremented for being inserted into the new package. * incremented for being inserted into the new package.
*/ */
*return_object_ptr = new_object; /* New Package object */ *return_object_ptr = new_object; /* New Package object */
data->flags |= ACPI_OBJECT_REPAIRED; info->return_flags |= ACPI_OBJECT_REPAIRED;
return (AE_OK); return (AE_OK);
} }
} }
@ -277,7 +277,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
* package object as part of the repair, we don't need to * package object as part of the repair, we don't need to
* change the reference count. * change the reference count.
*/ */
if (!(data->flags & ACPI_OBJECT_WRAPPED)) { if (!(info->return_flags & ACPI_OBJECT_WRAPPED)) {
new_object->common.reference_count = new_object->common.reference_count =
return_object->common.reference_count; return_object->common.reference_count;
@ -288,14 +288,14 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Converted %s to expected %s at Package index %u\n", "%s: Converted %s to expected %s at Package index %u\n",
data->pathname, info->full_pathname,
acpi_ut_get_object_type_name(return_object), acpi_ut_get_object_type_name(return_object),
acpi_ut_get_object_type_name(new_object), acpi_ut_get_object_type_name(new_object),
package_index)); package_index));
} else { } else {
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Converted %s to expected %s\n", "%s: Converted %s to expected %s\n",
data->pathname, info->full_pathname,
acpi_ut_get_object_type_name(return_object), acpi_ut_get_object_type_name(return_object),
acpi_ut_get_object_type_name(new_object))); acpi_ut_get_object_type_name(new_object)));
} }
@ -304,7 +304,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
acpi_ut_remove_reference(return_object); acpi_ut_remove_reference(return_object);
*return_object_ptr = new_object; *return_object_ptr = new_object;
data->flags |= ACPI_OBJECT_REPAIRED; info->return_flags |= ACPI_OBJECT_REPAIRED;
return (AE_OK); return (AE_OK);
} }
@ -359,7 +359,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
* *
* FUNCTION: acpi_ns_repair_null_element * FUNCTION: acpi_ns_repair_null_element
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* expected_btypes - Object types expected * expected_btypes - Object types expected
* package_index - Index of object within parent package (if * package_index - Index of object within parent package (if
* applicable - ACPI_NOT_PACKAGE_ELEMENT * applicable - ACPI_NOT_PACKAGE_ELEMENT
@ -374,7 +374,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ns_repair_null_element(struct acpi_predefined_data *data, acpi_ns_repair_null_element(struct acpi_evaluate_info * info,
u32 expected_btypes, u32 expected_btypes,
u32 package_index, u32 package_index,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
@ -424,16 +424,16 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
/* Set the reference count according to the parent Package object */ /* Set the reference count according to the parent Package object */
new_object->common.reference_count = new_object->common.reference_count =
data->parent_package->common.reference_count; info->parent_package->common.reference_count;
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Converted NULL package element to expected %s at index %u\n", "%s: Converted NULL package element to expected %s at index %u\n",
data->pathname, info->full_pathname,
acpi_ut_get_object_type_name(new_object), acpi_ut_get_object_type_name(new_object),
package_index)); package_index));
*return_object_ptr = new_object; *return_object_ptr = new_object;
data->flags |= ACPI_OBJECT_REPAIRED; info->return_flags |= ACPI_OBJECT_REPAIRED;
return (AE_OK); return (AE_OK);
} }
@ -441,7 +441,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
* *
* FUNCTION: acpi_ns_remove_null_elements * FUNCTION: acpi_ns_remove_null_elements
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* package_type - An acpi_return_package_types value * package_type - An acpi_return_package_types value
* obj_desc - A Package object * obj_desc - A Package object
* *
@ -454,7 +454,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
*****************************************************************************/ *****************************************************************************/
void void
acpi_ns_remove_null_elements(struct acpi_predefined_data *data, acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
u8 package_type, u8 package_type,
union acpi_operand_object *obj_desc) union acpi_operand_object *obj_desc)
{ {
@ -480,6 +480,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
case ACPI_PTYPE2_MIN: case ACPI_PTYPE2_MIN:
case ACPI_PTYPE2_REV_FIXED: case ACPI_PTYPE2_REV_FIXED:
case ACPI_PTYPE2_FIX_VAR: case ACPI_PTYPE2_FIX_VAR:
break; break;
default: default:
@ -511,7 +512,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
if (new_count < count) { if (new_count < count) {
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Found and removed %u NULL elements\n", "%s: Found and removed %u NULL elements\n",
data->pathname, (count - new_count))); info->full_pathname, (count - new_count)));
/* NULL terminate list and update the package count */ /* NULL terminate list and update the package count */
@ -524,7 +525,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
* *
* FUNCTION: acpi_ns_wrap_with_package * FUNCTION: acpi_ns_wrap_with_package
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* original_object - Pointer to the object to repair. * original_object - Pointer to the object to repair.
* obj_desc_ptr - The new package object is returned here * obj_desc_ptr - The new package object is returned here
* *
@ -545,7 +546,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ns_wrap_with_package(struct acpi_predefined_data *data, acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
union acpi_operand_object *original_object, union acpi_operand_object *original_object,
union acpi_operand_object **obj_desc_ptr) union acpi_operand_object **obj_desc_ptr)
{ {
@ -566,12 +567,12 @@ acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Wrapped %s with expected Package object\n", "%s: Wrapped %s with expected Package object\n",
data->pathname, info->full_pathname,
acpi_ut_get_object_type_name(original_object))); acpi_ut_get_object_type_name(original_object)));
/* Return the new object in the object pointer */ /* Return the new object in the object pointer */
*obj_desc_ptr = pkg_obj_desc; *obj_desc_ptr = pkg_obj_desc;
data->flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED; info->return_flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
return (AE_OK); return (AE_OK);
} }

View File

@ -54,7 +54,7 @@ ACPI_MODULE_NAME("nsrepair2")
* be repaired on a per-name basis. * be repaired on a per-name basis.
*/ */
typedef typedef
acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data, acpi_status(*acpi_repair_function) (struct acpi_evaluate_info * info,
union acpi_operand_object union acpi_operand_object
**return_object_ptr); **return_object_ptr);
@ -71,45 +71,57 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
*node); *node);
static acpi_status static acpi_status
acpi_ns_repair_ALR(struct acpi_predefined_data *data, acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
static acpi_status static acpi_status
acpi_ns_repair_CID(struct acpi_predefined_data *data, acpi_ns_repair_CID(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
static acpi_status static acpi_status
acpi_ns_repair_FDE(struct acpi_predefined_data *data, acpi_ns_repair_CST(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
static acpi_status static acpi_status
acpi_ns_repair_HID(struct acpi_predefined_data *data, acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
static acpi_status static acpi_status
acpi_ns_repair_PSS(struct acpi_predefined_data *data, acpi_ns_repair_HID(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
static acpi_status static acpi_status
acpi_ns_repair_TSS(struct acpi_predefined_data *data, acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr); union acpi_operand_object **return_object_ptr);
static acpi_status static acpi_status
acpi_ns_check_sorted_list(struct acpi_predefined_data *data, acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
union acpi_operand_object *return_object, union acpi_operand_object *return_object,
u32 start_index,
u32 expected_count, u32 expected_count,
u32 sort_index, u32 sort_index,
u8 sort_direction, char *sort_key_name); u8 sort_direction, char *sort_key_name);
static void
acpi_ns_sort_list(union acpi_operand_object **elements,
u32 count, u32 index, u8 sort_direction);
/* Values for sort_direction above */ /* Values for sort_direction above */
#define ACPI_SORT_ASCENDING 0 #define ACPI_SORT_ASCENDING 0
#define ACPI_SORT_DESCENDING 1 #define ACPI_SORT_DESCENDING 1
static void
acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index);
static void
acpi_ns_sort_list(union acpi_operand_object **elements,
u32 count, u32 index, u8 sort_direction);
/* /*
* This table contains the names of the predefined methods for which we can * This table contains the names of the predefined methods for which we can
* perform more complex repairs. * perform more complex repairs.
@ -118,9 +130,11 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
* *
* _ALR: Sort the list ascending by ambient_illuminance * _ALR: Sort the list ascending by ambient_illuminance
* _CID: Strings: uppercase all, remove any leading asterisk * _CID: Strings: uppercase all, remove any leading asterisk
* _CST: Sort the list ascending by C state type
* _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
* _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
* _HID: Strings: uppercase all, remove any leading asterisk * _HID: Strings: uppercase all, remove any leading asterisk
* _PRT: Fix reversed source_name and source_index
* _PSS: Sort the list descending by Power * _PSS: Sort the list descending by Power
* _TSS: Sort the list descending by Power * _TSS: Sort the list descending by Power
* *
@ -134,9 +148,11 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
static const struct acpi_repair_info acpi_ns_repairable_names[] = { static const struct acpi_repair_info acpi_ns_repairable_names[] = {
{"_ALR", acpi_ns_repair_ALR}, {"_ALR", acpi_ns_repair_ALR},
{"_CID", acpi_ns_repair_CID}, {"_CID", acpi_ns_repair_CID},
{"_CST", acpi_ns_repair_CST},
{"_FDE", acpi_ns_repair_FDE}, {"_FDE", acpi_ns_repair_FDE},
{"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */ {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */
{"_HID", acpi_ns_repair_HID}, {"_HID", acpi_ns_repair_HID},
{"_PRT", acpi_ns_repair_PRT},
{"_PSS", acpi_ns_repair_PSS}, {"_PSS", acpi_ns_repair_PSS},
{"_TSS", acpi_ns_repair_TSS}, {"_TSS", acpi_ns_repair_TSS},
{{0, 0, 0, 0}, NULL} /* Table terminator */ {{0, 0, 0, 0}, NULL} /* Table terminator */
@ -150,7 +166,7 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
* *
* FUNCTION: acpi_ns_complex_repairs * FUNCTION: acpi_ns_complex_repairs
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* node - Namespace node for the method/object * node - Namespace node for the method/object
* validate_status - Original status of earlier validation * validate_status - Original status of earlier validation
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
@ -165,7 +181,7 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
*****************************************************************************/ *****************************************************************************/
acpi_status acpi_status
acpi_ns_complex_repairs(struct acpi_predefined_data *data, acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
acpi_status validate_status, acpi_status validate_status,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
@ -180,7 +196,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
return (validate_status); return (validate_status);
} }
status = predefined->repair_function(data, return_object_ptr); status = predefined->repair_function(info, return_object_ptr);
return (status); return (status);
} }
@ -219,7 +235,7 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
* *
* FUNCTION: acpi_ns_repair_ALR * FUNCTION: acpi_ns_repair_ALR
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object * evaluation of a method or object
* *
@ -231,13 +247,13 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
*****************************************************************************/ *****************************************************************************/
static acpi_status static acpi_status
acpi_ns_repair_ALR(struct acpi_predefined_data *data, acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
{ {
union acpi_operand_object *return_object = *return_object_ptr; union acpi_operand_object *return_object = *return_object_ptr;
acpi_status status; acpi_status status;
status = acpi_ns_check_sorted_list(data, return_object, 2, 1, status = acpi_ns_check_sorted_list(info, return_object, 0, 2, 1,
ACPI_SORT_ASCENDING, ACPI_SORT_ASCENDING,
"AmbientIlluminance"); "AmbientIlluminance");
@ -248,7 +264,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
* *
* FUNCTION: acpi_ns_repair_FDE * FUNCTION: acpi_ns_repair_FDE
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object * evaluation of a method or object
* *
@ -262,7 +278,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
*****************************************************************************/ *****************************************************************************/
static acpi_status static acpi_status
acpi_ns_repair_FDE(struct acpi_predefined_data *data, acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
{ {
union acpi_operand_object *return_object = *return_object_ptr; union acpi_operand_object *return_object = *return_object_ptr;
@ -285,8 +301,8 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
/* We can only repair if we have exactly 5 BYTEs */ /* We can only repair if we have exactly 5 BYTEs */
if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) { if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
data->node_flags, info->node_flags,
"Incorrect return buffer length %u, expected %u", "Incorrect return buffer length %u, expected %u",
return_object->buffer.length, return_object->buffer.length,
ACPI_FDE_DWORD_BUFFER_SIZE)); ACPI_FDE_DWORD_BUFFER_SIZE));
@ -316,10 +332,11 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s Expanded Byte Buffer to expected DWord Buffer\n", "%s Expanded Byte Buffer to expected DWord Buffer\n",
data->pathname)); info->full_pathname));
break; break;
default: default:
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
} }
@ -328,7 +345,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
acpi_ut_remove_reference(return_object); acpi_ut_remove_reference(return_object);
*return_object_ptr = buffer_object; *return_object_ptr = buffer_object;
data->flags |= ACPI_OBJECT_REPAIRED; info->return_flags |= ACPI_OBJECT_REPAIRED;
return (AE_OK); return (AE_OK);
} }
@ -336,7 +353,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
* *
* FUNCTION: acpi_ns_repair_CID * FUNCTION: acpi_ns_repair_CID
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object * evaluation of a method or object
* *
@ -349,7 +366,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
*****************************************************************************/ *****************************************************************************/
static acpi_status static acpi_status
acpi_ns_repair_CID(struct acpi_predefined_data *data, acpi_ns_repair_CID(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
{ {
acpi_status status; acpi_status status;
@ -362,7 +379,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
/* Check for _CID as a simple string */ /* Check for _CID as a simple string */
if (return_object->common.type == ACPI_TYPE_STRING) { if (return_object->common.type == ACPI_TYPE_STRING) {
status = acpi_ns_repair_HID(data, return_object_ptr); status = acpi_ns_repair_HID(info, return_object_ptr);
return (status); return (status);
} }
@ -379,7 +396,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
original_element = *element_ptr; original_element = *element_ptr;
original_ref_count = original_element->common.reference_count; original_ref_count = original_element->common.reference_count;
status = acpi_ns_repair_HID(data, element_ptr); status = acpi_ns_repair_HID(info, element_ptr);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
@ -402,11 +419,97 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
return (AE_OK); return (AE_OK);
} }
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_CST
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _CST object:
* 1. Sort the list ascending by C state type
* 2. Ensure type cannot be zero
* 3. A sub-package count of zero means _CST is meaningless
* 4. Count must match the number of C state sub-packages
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_CST(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
union acpi_operand_object **outer_elements;
u32 outer_element_count;
union acpi_operand_object *obj_desc;
acpi_status status;
u8 removing;
u32 i;
ACPI_FUNCTION_NAME(ns_repair_CST);
/*
* Check if the C-state type values are proportional.
*/
outer_element_count = return_object->package.count - 1;
i = 0;
while (i < outer_element_count) {
outer_elements = &return_object->package.elements[i + 1];
removing = FALSE;
if ((*outer_elements)->package.count == 0) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"SubPackage[%u] - removing entry due to zero count",
i));
removing = TRUE;
goto remove_element;
}
obj_desc = (*outer_elements)->package.elements[1]; /* Index1 = Type */
if ((u32)obj_desc->integer.value == 0) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"SubPackage[%u] - removing entry due to invalid Type(0)",
i));
removing = TRUE;
}
remove_element:
if (removing) {
acpi_ns_remove_element(return_object, i + 1);
outer_element_count--;
} else {
i++;
}
}
/* Update top-level package count, Type "Integer" checked elsewhere */
obj_desc = return_object->package.elements[0];
obj_desc->integer.value = outer_element_count;
/*
* Entries (subpackages) in the _CST Package must be sorted by the
* C-state type, in ascending order.
*/
status = acpi_ns_check_sorted_list(info, return_object, 1, 4, 1,
ACPI_SORT_ASCENDING, "C-State Type");
if (ACPI_FAILURE(status)) {
return (status);
}
return (AE_OK);
}
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: acpi_ns_repair_HID * FUNCTION: acpi_ns_repair_HID
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object * evaluation of a method or object
* *
@ -418,7 +521,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
*****************************************************************************/ *****************************************************************************/
static acpi_status static acpi_status
acpi_ns_repair_HID(struct acpi_predefined_data *data, acpi_ns_repair_HID(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
{ {
union acpi_operand_object *return_object = *return_object_ptr; union acpi_operand_object *return_object = *return_object_ptr;
@ -435,12 +538,13 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
} }
if (return_object->string.length == 0) { if (return_object->string.length == 0) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Invalid zero-length _HID or _CID string")); "Invalid zero-length _HID or _CID string"));
/* Return AE_OK anyway, let driver handle it */ /* Return AE_OK anyway, let driver handle it */
data->flags |= ACPI_OBJECT_REPAIRED; info->return_flags |= ACPI_OBJECT_REPAIRED;
return (AE_OK); return (AE_OK);
} }
@ -464,7 +568,7 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Removed invalid leading asterisk\n", "%s: Removed invalid leading asterisk\n",
data->pathname)); info->full_pathname));
} }
/* /*
@ -486,53 +590,69 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: acpi_ns_repair_TSS * FUNCTION: acpi_ns_repair_PRT
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object * evaluation of a method or object
* *
* RETURN: Status. AE_OK if object is OK or was repaired successfully * RETURN: Status. AE_OK if object is OK or was repaired successfully
* *
* DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list * DESCRIPTION: Repair for the _PRT object. If necessary, fix reversed
* descending by the power dissipation values. * source_name and source_index field, a common BIOS bug.
* *
*****************************************************************************/ *****************************************************************************/
static acpi_status static acpi_status
acpi_ns_repair_TSS(struct acpi_predefined_data *data, acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
{ {
union acpi_operand_object *return_object = *return_object_ptr; union acpi_operand_object *package_object = *return_object_ptr;
acpi_status status; union acpi_operand_object **top_object_list;
struct acpi_namespace_node *node; union acpi_operand_object **sub_object_list;
union acpi_operand_object *obj_desc;
u32 element_count;
u32 index;
/* /* Each element in the _PRT package is a subpackage */
* We can only sort the _TSS return package if there is no _PSS in the
* same scope. This is because if _PSS is present, the ACPI specification top_object_list = package_object->package.elements;
* dictates that the _TSS Power Dissipation field is to be ignored, and element_count = package_object->package.count;
* therefore some BIOSs leave garbage values in the _TSS Power field(s).
* In this case, it is best to just return the _TSS package as-is. for (index = 0; index < element_count; index++) {
* (May, 2011) sub_object_list = (*top_object_list)->package.elements;
*/
status = /*
acpi_ns_get_node(data->node, "^_PSS", ACPI_NS_NO_UPSEARCH, &node); * If the BIOS has erroneously reversed the _PRT source_name (index 2)
if (ACPI_SUCCESS(status)) { * and the source_index (index 3), fix it. _PRT is important enough to
return (AE_OK); * workaround this BIOS error. This also provides compatibility with
* other ACPI implementations.
*/
obj_desc = sub_object_list[3];
if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
sub_object_list[3] = sub_object_list[2];
sub_object_list[2] = obj_desc;
info->return_flags |= ACPI_OBJECT_REPAIRED;
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"PRT[%X]: Fixed reversed SourceName and SourceIndex",
index));
}
/* Point to the next union acpi_operand_object in the top level package */
top_object_list++;
} }
status = acpi_ns_check_sorted_list(data, return_object, 5, 1, return (AE_OK);
ACPI_SORT_DESCENDING,
"PowerDissipation");
return (status);
} }
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: acpi_ns_repair_PSS * FUNCTION: acpi_ns_repair_PSS
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the * return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object * evaluation of a method or object
* *
@ -546,7 +666,7 @@ acpi_ns_repair_TSS(struct acpi_predefined_data *data,
*****************************************************************************/ *****************************************************************************/
static acpi_status static acpi_status
acpi_ns_repair_PSS(struct acpi_predefined_data *data, acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr) union acpi_operand_object **return_object_ptr)
{ {
union acpi_operand_object *return_object = *return_object_ptr; union acpi_operand_object *return_object = *return_object_ptr;
@ -564,7 +684,7 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
* incorrectly sorted, sort it. We sort by cpu_frequency, since this * incorrectly sorted, sort it. We sort by cpu_frequency, since this
* should be proportional to the power. * should be proportional to the power.
*/ */
status = acpi_ns_check_sorted_list(data, return_object, 6, 0, status = acpi_ns_check_sorted_list(info, return_object, 0, 6, 0,
ACPI_SORT_DESCENDING, ACPI_SORT_DESCENDING,
"CpuFrequency"); "CpuFrequency");
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -584,8 +704,8 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
obj_desc = elements[1]; /* Index1 = power_dissipation */ obj_desc = elements[1]; /* Index1 = power_dissipation */
if ((u32) obj_desc->integer.value > previous_value) { if ((u32) obj_desc->integer.value > previous_value) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
data->node_flags, info->node_flags,
"SubPackage[%u,%u] - suspicious power dissipation values", "SubPackage[%u,%u] - suspicious power dissipation values",
i - 1, i)); i - 1, i));
} }
@ -597,12 +717,57 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
return (AE_OK); return (AE_OK);
} }
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_TSS
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
* descending by the power dissipation values.
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
acpi_status status;
struct acpi_namespace_node *node;
/*
* We can only sort the _TSS return package if there is no _PSS in the
* same scope. This is because if _PSS is present, the ACPI specification
* dictates that the _TSS Power Dissipation field is to be ignored, and
* therefore some BIOSs leave garbage values in the _TSS Power field(s).
* In this case, it is best to just return the _TSS package as-is.
* (May, 2011)
*/
status = acpi_ns_get_node(info->node, "^_PSS",
ACPI_NS_NO_UPSEARCH, &node);
if (ACPI_SUCCESS(status)) {
return (AE_OK);
}
status = acpi_ns_check_sorted_list(info, return_object, 0, 5, 1,
ACPI_SORT_DESCENDING,
"PowerDissipation");
return (status);
}
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: acpi_ns_check_sorted_list * FUNCTION: acpi_ns_check_sorted_list
* *
* PARAMETERS: data - Pointer to validation data structure * PARAMETERS: info - Method execution information block
* return_object - Pointer to the top-level returned object * return_object - Pointer to the top-level returned object
* start_index - Index of the first sub-package
* expected_count - Minimum length of each sub-package * expected_count - Minimum length of each sub-package
* sort_index - Sub-package entry to sort on * sort_index - Sub-package entry to sort on
* sort_direction - Ascending or descending * sort_direction - Ascending or descending
@ -617,8 +782,9 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
*****************************************************************************/ *****************************************************************************/
static acpi_status static acpi_status
acpi_ns_check_sorted_list(struct acpi_predefined_data *data, acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
union acpi_operand_object *return_object, union acpi_operand_object *return_object,
u32 start_index,
u32 expected_count, u32 expected_count,
u32 sort_index, u32 sort_index,
u8 sort_direction, char *sort_key_name) u8 sort_direction, char *sort_key_name)
@ -643,12 +809,14 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
* Any NULL elements should have been removed by earlier call * Any NULL elements should have been removed by earlier call
* to acpi_ns_remove_null_elements. * to acpi_ns_remove_null_elements.
*/ */
outer_elements = return_object->package.elements;
outer_element_count = return_object->package.count; outer_element_count = return_object->package.count;
if (!outer_element_count) { if (!outer_element_count || start_index >= outer_element_count) {
return (AE_AML_PACKAGE_LIMIT); return (AE_AML_PACKAGE_LIMIT);
} }
outer_elements = &return_object->package.elements[start_index];
outer_element_count -= start_index;
previous_value = 0; previous_value = 0;
if (sort_direction == ACPI_SORT_DESCENDING) { if (sort_direction == ACPI_SORT_DESCENDING) {
previous_value = ACPI_UINT32_MAX; previous_value = ACPI_UINT32_MAX;
@ -685,15 +853,16 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
(obj_desc->integer.value < previous_value)) || (obj_desc->integer.value < previous_value)) ||
((sort_direction == ACPI_SORT_DESCENDING) && ((sort_direction == ACPI_SORT_DESCENDING) &&
(obj_desc->integer.value > previous_value))) { (obj_desc->integer.value > previous_value))) {
acpi_ns_sort_list(return_object->package.elements, acpi_ns_sort_list(&return_object->package.
elements[start_index],
outer_element_count, sort_index, outer_element_count, sort_index,
sort_direction); sort_direction);
data->flags |= ACPI_OBJECT_REPAIRED; info->return_flags |= ACPI_OBJECT_REPAIRED;
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Repaired unsorted list - now sorted by %s\n", "%s: Repaired unsorted list - now sorted by %s\n",
data->pathname, sort_key_name)); info->full_pathname, sort_key_name));
return (AE_OK); return (AE_OK);
} }
@ -752,3 +921,52 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
} }
} }
} }
/******************************************************************************
*
* FUNCTION: acpi_ns_remove_element
*
* PARAMETERS: obj_desc - Package object element list
* index - Index of element to remove
*
* RETURN: None
*
* DESCRIPTION: Remove the requested element of a package and delete it.
*
*****************************************************************************/
static void
acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index)
{
union acpi_operand_object **source;
union acpi_operand_object **dest;
u32 count;
u32 new_count;
u32 i;
ACPI_FUNCTION_NAME(ns_remove_element);
count = obj_desc->package.count;
new_count = count - 1;
source = obj_desc->package.elements;
dest = source;
/* Examine all elements of the package object, remove matched index */
for (i = 0; i < count; i++) {
if (i == index) {
acpi_ut_remove_reference(*source); /* Remove one ref for being in pkg */
acpi_ut_remove_reference(*source);
} else {
*dest = *source;
dest++;
}
source++;
}
/* NULL terminate list and update the package count */
*dest = NULL;
obj_desc->package.count = new_count;
}

View File

@ -419,10 +419,12 @@ acpi_ns_externalize_name(u32 internal_name_length,
switch (internal_name[0]) { switch (internal_name[0]) {
case AML_ROOT_PREFIX: case AML_ROOT_PREFIX:
prefix_length = 1; prefix_length = 1;
break; break;
case AML_PARENT_PREFIX: case AML_PARENT_PREFIX:
for (i = 0; i < internal_name_length; i++) { for (i = 0; i < internal_name_length; i++) {
if (ACPI_IS_PARENT_PREFIX(internal_name[i])) { if (ACPI_IS_PARENT_PREFIX(internal_name[i])) {
prefix_length = i + 1; prefix_length = i + 1;
@ -438,6 +440,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
break; break;
default: default:
break; break;
} }

View File

@ -187,8 +187,6 @@ acpi_evaluate_object(acpi_handle handle,
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
info->pathname = pathname;
/* Convert and validate the device handle */ /* Convert and validate the device handle */
info->prefix_node = acpi_ns_validate_handle(handle); info->prefix_node = acpi_ns_validate_handle(handle);
@ -198,55 +196,23 @@ acpi_evaluate_object(acpi_handle handle,
} }
/* /*
* If there are parameters to be passed to a control method, the external * Get the actual namespace node for the target object.
* objects must all be converted to internal objects * Handles these cases:
*/ *
if (external_params && external_params->count) { * 1) Null node, valid pathname from root (absolute path)
/* * 2) Node and valid pathname (path relative to Node)
* Allocate a new parameter block for the internal objects * 3) Node, Null pathname
* Add 1 to count to allow for null terminated internal list
*/
info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)
external_params->
count +
1) * sizeof(void *));
if (!info->parameters) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Convert each external object in the list to an internal object */
for (i = 0; i < external_params->count; i++) {
status =
acpi_ut_copy_eobject_to_iobject(&external_params->
pointer[i],
&info->
parameters[i]);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
}
info->parameters[external_params->count] = NULL;
}
/*
* Three major cases:
* 1) Fully qualified pathname
* 2) No handle, not fully qualified pathname (error)
* 3) Valid handle
*/ */
if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) { if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
/* The path is fully qualified, just evaluate by name */ /* The path is fully qualified, just evaluate by name */
info->prefix_node = NULL; info->prefix_node = NULL;
status = acpi_ns_evaluate(info);
} else if (!handle) { } else if (!handle) {
/* /*
* A handle is optional iff a fully qualified pathname is specified. * A handle is optional iff a fully qualified pathname is specified.
* Since we've already handled fully qualified names above, this is * Since we've already handled fully qualified names above, this is
* an error * an error.
*/ */
if (!pathname) { if (!pathname) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@ -258,12 +224,144 @@ acpi_evaluate_object(acpi_handle handle,
} }
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
} else { goto cleanup;
/* We have a namespace a node and a possible relative path */
status = acpi_ns_evaluate(info);
} }
info->relative_pathname = pathname;
/*
* Convert all external objects passed as arguments to the
* internal version(s).
*/
if (external_params && external_params->count) {
info->param_count = (u16)external_params->count;
/* Warn on impossible argument count */
if (info->param_count > ACPI_METHOD_NUM_ARGS) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Excess arguments (%u) - using only %u",
info->param_count,
ACPI_METHOD_NUM_ARGS));
info->param_count = ACPI_METHOD_NUM_ARGS;
}
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) info->
param_count +
1) * sizeof(void *));
if (!info->parameters) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Convert each external object in the list to an internal object */
for (i = 0; i < info->param_count; i++) {
status =
acpi_ut_copy_eobject_to_iobject(&external_params->
pointer[i],
&info->
parameters[i]);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
}
info->parameters[info->param_count] = NULL;
}
#if 0
/*
* Begin incoming argument count analysis. Check for too few args
* and too many args.
*/
switch (acpi_ns_get_type(info->node)) {
case ACPI_TYPE_METHOD:
/* Check incoming argument count against the method definition */
if (info->obj_desc->method.param_count > info->param_count) {
ACPI_ERROR((AE_INFO,
"Insufficient arguments (%u) - %u are required",
info->param_count,
info->obj_desc->method.param_count));
status = AE_MISSING_ARGUMENTS;
goto cleanup;
}
else if (info->obj_desc->method.param_count < info->param_count) {
ACPI_WARNING((AE_INFO,
"Excess arguments (%u) - only %u are required",
info->param_count,
info->obj_desc->method.param_count));
/* Just pass the required number of arguments */
info->param_count = info->obj_desc->method.param_count;
}
/*
* Any incoming external objects to be passed as arguments to the
* method must be converted to internal objects
*/
if (info->param_count) {
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)
info->
param_count +
1) *
sizeof(void *));
if (!info->parameters) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Convert each external object in the list to an internal object */
for (i = 0; i < info->param_count; i++) {
status =
acpi_ut_copy_eobject_to_iobject
(&external_params->pointer[i],
&info->parameters[i]);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
}
info->parameters[info->param_count] = NULL;
}
break;
default:
/* Warn if arguments passed to an object that is not a method */
if (info->param_count) {
ACPI_WARNING((AE_INFO,
"%u arguments were passed to a non-method ACPI object",
info->param_count));
}
break;
}
#endif
/* Now we can evaluate the object */
status = acpi_ns_evaluate(info);
/* /*
* If we are expecting a return value, and all went well above, * If we are expecting a return value, and all went well above,
* copy the return value to an external object. * copy the return value to an external object.
@ -413,6 +511,7 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
break; break;
default: default:
return; return;
} }

View File

@ -629,24 +629,28 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
switch (opcode) { switch (opcode) {
case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
buffer_length = buffer_length =
ACPI_GET8(parser_state->aml); ACPI_GET8(parser_state->aml);
parser_state->aml += 1; parser_state->aml += 1;
break; break;
case AML_WORD_OP: /* AML_WORDDATA_ARG */ case AML_WORD_OP: /* AML_WORDDATA_ARG */
buffer_length = buffer_length =
ACPI_GET16(parser_state->aml); ACPI_GET16(parser_state->aml);
parser_state->aml += 2; parser_state->aml += 2;
break; break;
case AML_DWORD_OP: /* AML_DWORDATA_ARG */ case AML_DWORD_OP: /* AML_DWORDATA_ARG */
buffer_length = buffer_length =
ACPI_GET32(parser_state->aml); ACPI_GET32(parser_state->aml);
parser_state->aml += 4; parser_state->aml += 4;
break; break;
default: default:
buffer_length = 0; buffer_length = 0;
break; break;
} }

View File

@ -164,7 +164,6 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
case AML_IF_OP: case AML_IF_OP:
case AML_ELSE_OP: case AML_ELSE_OP:
case AML_WHILE_OP: case AML_WHILE_OP:
/* /*
* Currently supported module-level opcodes are: * Currently supported module-level opcodes are:
* IF/ELSE/WHILE. These appear to be the most common, * IF/ELSE/WHILE. These appear to be the most common,
@ -289,6 +288,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
default: default:
/* No action for all other opcodes */ /* No action for all other opcodes */
break; break;
} }

View File

@ -402,6 +402,7 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
switch (status) { switch (status) {
case AE_OK: case AE_OK:
break; break;
case AE_CTRL_TRANSFER: case AE_CTRL_TRANSFER:

View File

@ -176,10 +176,10 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
switch (parent_info->class) { switch (parent_info->class) {
case AML_CLASS_CONTROL: case AML_CLASS_CONTROL:
break; break;
case AML_CLASS_CREATE: case AML_CLASS_CREATE:
/* /*
* These opcodes contain term_arg operands. The current * These opcodes contain term_arg operands. The current
* op must be replaced by a placeholder return op * op must be replaced by a placeholder return op
@ -192,7 +192,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
break; break;
case AML_CLASS_NAMED_OBJECT: case AML_CLASS_NAMED_OBJECT:
/* /*
* These opcodes contain term_arg operands. The current * These opcodes contain term_arg operands. The current
* op must be replaced by a placeholder return op * op must be replaced by a placeholder return op

View File

@ -308,7 +308,9 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
break; break;
default: default:
/* All others have no children */ /* All others have no children */
break; break;
} }

View File

@ -125,7 +125,7 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info)
} }
if ((!acpi_gbl_trace_method_name) || if ((!acpi_gbl_trace_method_name) ||
(acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { (acpi_gbl_trace_method_name != info->node->name.integer)) {
goto exit; goto exit;
} }
@ -170,7 +170,7 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info)
} }
if ((!acpi_gbl_trace_method_name) || if ((!acpi_gbl_trace_method_name) ||
(acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { (acpi_gbl_trace_method_name != info->node->name.integer)) {
goto exit; goto exit;
} }
@ -226,15 +226,14 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
/* Validate the Info and method Node */ /* Validate the Info and method Node */
if (!info || !info->resolved_node) { if (!info || !info->node) {
return_ACPI_STATUS(AE_NULL_ENTRY); return_ACPI_STATUS(AE_NULL_ENTRY);
} }
/* Init for new method, wait on concurrency semaphore */ /* Init for new method, wait on concurrency semaphore */
status = status =
acpi_ds_begin_method_execution(info->resolved_node, info->obj_desc, acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -253,8 +252,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n", "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
info->resolved_node->name.ascii, info->resolved_node, info->node->name.ascii, info->node, info->obj_desc));
info->obj_desc));
/* Create and init a Root Node */ /* Create and init a Root Node */
@ -275,7 +273,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
goto cleanup; goto cleanup;
} }
status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node, status = acpi_ds_init_aml_walk(walk_state, op, info->node,
info->obj_desc->method.aml_start, info->obj_desc->method.aml_start,
info->obj_desc->method.aml_length, info, info->obj_desc->method.aml_length, info,
info->pass_number); info->pass_number);

View File

@ -352,6 +352,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
break; break;
default: default:
break; break;
} }
@ -539,6 +540,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
break; break;
default: default:
break; break;
} }
@ -650,8 +652,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
name_found = FALSE; name_found = FALSE;
for (table_index = 0; table_index < 4 && !name_found; for (table_index = 0;
table_index++) { table_index < package_element->package.count
&& !name_found; table_index++) {
if (*sub_object_list && /* Null object allowed */ if (*sub_object_list && /* Null object allowed */
((ACPI_TYPE_STRING == ((ACPI_TYPE_STRING ==
(*sub_object_list)->common.type) || (*sub_object_list)->common.type) ||

View File

@ -273,17 +273,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
*/ */
user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4);
/* Each element of the top-level package must also be a package */
if ((*top_object_list)->common.type != ACPI_TYPE_PACKAGE) {
ACPI_ERROR((AE_INFO,
"(PRT[%u]) Need sub-package, found %s",
index,
acpi_ut_get_object_type_name
(*top_object_list)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
/* Each sub-package must be of length 4 */ /* Each sub-package must be of length 4 */
if ((*top_object_list)->package.count != 4) { if ((*top_object_list)->package.count != 4) {
@ -326,22 +315,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
user_prt->pin = (u32) obj_desc->integer.value; user_prt->pin = (u32) obj_desc->integer.value;
/*
* If the BIOS has erroneously reversed the _PRT source_name (index 2)
* and the source_index (index 3), fix it. _PRT is important enough to
* workaround this BIOS error. This also provides compatibility with
* other ACPI implementations.
*/
obj_desc = sub_object_list[3];
if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
sub_object_list[3] = sub_object_list[2];
sub_object_list[2] = obj_desc;
ACPI_WARNING((AE_INFO,
"(PRT[%X].Source) SourceName and SourceIndex are reversed, fixed",
index));
}
/* /*
* 3) Third subobject: Dereference the PRT.source_name * 3) Third subobject: Dereference the PRT.source_name
* The name may be unresolved (slack mode), so allow a null object * The name may be unresolved (slack mode), so allow a null object

View File

@ -120,17 +120,20 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
/* Strings */ /* Strings */
case ACPI_RSD_LITERAL: case ACPI_RSD_LITERAL:
acpi_rs_out_string(name, acpi_rs_out_string(name,
ACPI_CAST_PTR(char, table->pointer)); ACPI_CAST_PTR(char, table->pointer));
break; break;
case ACPI_RSD_STRING: case ACPI_RSD_STRING:
acpi_rs_out_string(name, ACPI_CAST_PTR(char, target)); acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
break; break;
/* Data items, 8/16/32/64 bit */ /* Data items, 8/16/32/64 bit */
case ACPI_RSD_UINT8: case ACPI_RSD_UINT8:
if (table->pointer) { if (table->pointer) {
acpi_rs_out_string(name, ACPI_CAST_PTR(char, acpi_rs_out_string(name, ACPI_CAST_PTR(char,
table-> table->
@ -142,20 +145,24 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
break; break;
case ACPI_RSD_UINT16: case ACPI_RSD_UINT16:
acpi_rs_out_integer16(name, ACPI_GET16(target)); acpi_rs_out_integer16(name, ACPI_GET16(target));
break; break;
case ACPI_RSD_UINT32: case ACPI_RSD_UINT32:
acpi_rs_out_integer32(name, ACPI_GET32(target)); acpi_rs_out_integer32(name, ACPI_GET32(target));
break; break;
case ACPI_RSD_UINT64: case ACPI_RSD_UINT64:
acpi_rs_out_integer64(name, ACPI_GET64(target)); acpi_rs_out_integer64(name, ACPI_GET64(target));
break; break;
/* Flags: 1-bit and 2-bit flags supported */ /* Flags: 1-bit and 2-bit flags supported */
case ACPI_RSD_1BITFLAG: case ACPI_RSD_1BITFLAG:
acpi_rs_out_string(name, ACPI_CAST_PTR(char, acpi_rs_out_string(name, ACPI_CAST_PTR(char,
table-> table->
pointer[*target & pointer[*target &
@ -163,6 +170,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
break; break;
case ACPI_RSD_2BITFLAG: case ACPI_RSD_2BITFLAG:
acpi_rs_out_string(name, ACPI_CAST_PTR(char, acpi_rs_out_string(name, ACPI_CAST_PTR(char,
table-> table->
pointer[*target & pointer[*target &
@ -170,6 +178,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
break; break;
case ACPI_RSD_3BITFLAG: case ACPI_RSD_3BITFLAG:
acpi_rs_out_string(name, ACPI_CAST_PTR(char, acpi_rs_out_string(name, ACPI_CAST_PTR(char,
table-> table->
pointer[*target & pointer[*target &
@ -258,6 +267,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
break; break;
default: default:
acpi_os_printf("**** Invalid table opcode [%X] ****\n", acpi_os_printf("**** Invalid table opcode [%X] ****\n",
table->opcode); table->opcode);
return; return;

View File

@ -194,7 +194,6 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
break; break;
case ACPI_RSC_COUNT_GPIO_RES: case ACPI_RSC_COUNT_GPIO_RES:
/* /*
* Vendor data is optional (length/offset may both be zero) * Vendor data is optional (length/offset may both be zero)
* Examine vendor data length field first * Examine vendor data length field first
@ -410,12 +409,14 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
*/ */
switch (info->resource_offset) { switch (info->resource_offset) {
case ACPI_RSC_COMPARE_AML_LENGTH: case ACPI_RSC_COMPARE_AML_LENGTH:
if (aml_resource_length != info->value) { if (aml_resource_length != info->value) {
goto exit; goto exit;
} }
break; break;
case ACPI_RSC_COMPARE_VALUE: case ACPI_RSC_COMPARE_VALUE:
if (ACPI_GET8(source) != info->value) { if (ACPI_GET8(source) != info->value) {
goto exit; goto exit;
} }

View File

@ -147,6 +147,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
case ACPI_RSC_MOVE_GPIO_RES: case ACPI_RSC_MOVE_GPIO_RES:
case ACPI_RSC_MOVE_SERIAL_VEN: case ACPI_RSC_MOVE_SERIAL_VEN:
case ACPI_RSC_MOVE_SERIAL_RES: case ACPI_RSC_MOVE_SERIAL_RES:
ACPI_MEMCPY(destination, source, item_count); ACPI_MEMCPY(destination, source, item_count);
return; return;
@ -157,21 +158,25 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
*/ */
case ACPI_RSC_MOVE16: case ACPI_RSC_MOVE16:
case ACPI_RSC_MOVE_GPIO_PIN: case ACPI_RSC_MOVE_GPIO_PIN:
ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i], ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i],
&ACPI_CAST_PTR(u16, source)[i]); &ACPI_CAST_PTR(u16, source)[i]);
break; break;
case ACPI_RSC_MOVE32: case ACPI_RSC_MOVE32:
ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i], ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i],
&ACPI_CAST_PTR(u32, source)[i]); &ACPI_CAST_PTR(u32, source)[i]);
break; break;
case ACPI_RSC_MOVE64: case ACPI_RSC_MOVE64:
ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i], ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i],
&ACPI_CAST_PTR(u64, source)[i]); &ACPI_CAST_PTR(u64, source)[i]);
break; break;
default: default:
return; return;
} }
} }
@ -736,7 +741,7 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
} }
info->prefix_node = node; info->prefix_node = node;
info->pathname = METHOD_NAME__SRS; info->relative_pathname = METHOD_NAME__SRS;
info->parameters = args; info->parameters = args;
info->flags = ACPI_IGNORE_RETURN_VALUE; info->flags = ACPI_IGNORE_RETURN_VALUE;

View File

@ -402,6 +402,7 @@ acpi_resource_to_address64(struct acpi_resource *resource,
break; break;
default: default:
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }

View File

@ -141,8 +141,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
ACPI_BIOS_ERROR((AE_INFO, ACPI_BIOS_ERROR((AE_INFO,
"Table has invalid signature [%4.4s] (0x%8.8X), " "Table has invalid signature [%4.4s] (0x%8.8X), "
"must be SSDT or OEMx", "must be SSDT or OEMx",
acpi_ut_valid_acpi_name(*(u32 *)table_desc-> acpi_ut_valid_acpi_name(table_desc->pointer->
pointer->
signature) ? signature) ?
table_desc->pointer->signature : "????", table_desc->pointer->signature : "????",
*(u32 *)table_desc->pointer->signature)); *(u32 *)table_desc->pointer->signature));
@ -471,15 +470,19 @@ void acpi_tb_delete_table(struct acpi_table_desc *table_desc)
} }
switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) { switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) {
case ACPI_TABLE_ORIGIN_MAPPED: case ACPI_TABLE_ORIGIN_MAPPED:
acpi_os_unmap_memory(table_desc->pointer, table_desc->length); acpi_os_unmap_memory(table_desc->pointer, table_desc->length);
break; break;
case ACPI_TABLE_ORIGIN_ALLOCATED: case ACPI_TABLE_ORIGIN_ALLOCATED:
ACPI_FREE(table_desc->pointer); ACPI_FREE(table_desc->pointer);
break; break;
/* Not mapped or allocated, there is nothing we can do */ /* Not mapped or allocated, there is nothing we can do */
default: default:
return; return;
} }

View File

@ -0,0 +1,237 @@
/******************************************************************************
*
* Module Name: tbprint - Table output utilities
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2013, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME("tbprint")
/* Local prototypes */
static void acpi_tb_fix_string(char *string, acpi_size length);
static void
acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
struct acpi_table_header *header);
/*******************************************************************************
*
* FUNCTION: acpi_tb_fix_string
*
* PARAMETERS: string - String to be repaired
* length - Maximum length
*
* RETURN: None
*
* DESCRIPTION: Replace every non-printable or non-ascii byte in the string
* with a question mark '?'.
*
******************************************************************************/
static void acpi_tb_fix_string(char *string, acpi_size length)
{
while (length && *string) {
if (!ACPI_IS_PRINT(*string)) {
*string = '?';
}
string++;
length--;
}
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_cleanup_table_header
*
* PARAMETERS: out_header - Where the cleaned header is returned
* header - Input ACPI table header
*
* RETURN: Returns the cleaned header in out_header
*
* DESCRIPTION: Copy the table header and ensure that all "string" fields in
* the header consist of printable characters.
*
******************************************************************************/
static void
acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
struct acpi_table_header *header)
{
ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_print_table_header
*
* PARAMETERS: address - Table physical address
* header - Table header
*
* RETURN: None
*
* DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
*
******************************************************************************/
void
acpi_tb_print_table_header(acpi_physical_address address,
struct acpi_table_header *header)
{
struct acpi_table_header local_header;
/*
* The reason that the Address is cast to a void pointer is so that we
* can use %p which will work properly on both 32-bit and 64-bit hosts.
*/
if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) {
/* FACS only has signature and length fields */
ACPI_INFO((AE_INFO, "%4.4s %p %05X",
header->signature, ACPI_CAST_PTR(void, address),
header->length));
} else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) {
/* RSDP has no common fields */
ACPI_MEMCPY(local_header.oem_id,
ACPI_CAST_PTR(struct acpi_table_rsdp,
header)->oem_id, ACPI_OEM_ID_SIZE);
acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
ACPI_CAST_PTR(void, address),
(ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
revision >
0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
header)->length : 20,
ACPI_CAST_PTR(struct acpi_table_rsdp,
header)->revision,
local_header.oem_id));
} else {
/* Standard ACPI table with full common header */
acpi_tb_cleanup_table_header(&local_header, header);
ACPI_INFO((AE_INFO,
"%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
local_header.signature, ACPI_CAST_PTR(void, address),
local_header.length, local_header.revision,
local_header.oem_id, local_header.oem_table_id,
local_header.oem_revision,
local_header.asl_compiler_id,
local_header.asl_compiler_revision));
}
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_validate_checksum
*
* PARAMETERS: table - ACPI table to verify
* length - Length of entire table
*
* RETURN: Status
*
* DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
* exception on bad checksum.
*
******************************************************************************/
acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
{
u8 checksum;
/* Compute the checksum on the table */
checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), length);
/* Checksum ok? (should be zero) */
if (checksum) {
ACPI_BIOS_WARNING((AE_INFO,
"Incorrect checksum in table [%4.4s] - 0x%2.2X, "
"should be 0x%2.2X",
table->signature, table->checksum,
(u8)(table->checksum - checksum)));
#if (ACPI_CHECKSUM_ABORT)
return (AE_BAD_CHECKSUM);
#endif
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_checksum
*
* PARAMETERS: buffer - Pointer to memory region to be checked
* length - Length of this memory region
*
* RETURN: Checksum (u8)
*
* DESCRIPTION: Calculates circular checksum of memory region.
*
******************************************************************************/
u8 acpi_tb_checksum(u8 *buffer, u32 length)
{
u8 sum = 0;
u8 *end = buffer + length;
while (buffer < end) {
sum = (u8)(sum + *(buffer++));
}
return (sum);
}

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: tbutils - table utilities * Module Name: tbutils - ACPI Table utilities
* *
*****************************************************************************/ *****************************************************************************/
@ -49,12 +49,6 @@
ACPI_MODULE_NAME("tbutils") ACPI_MODULE_NAME("tbutils")
/* Local prototypes */ /* Local prototypes */
static void acpi_tb_fix_string(char *string, acpi_size length);
static void
acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
struct acpi_table_header *header);
static acpi_physical_address static acpi_physical_address
acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
@ -174,189 +168,6 @@ u8 acpi_tb_tables_loaded(void)
return (FALSE); return (FALSE);
} }
/*******************************************************************************
*
* FUNCTION: acpi_tb_fix_string
*
* PARAMETERS: string - String to be repaired
* length - Maximum length
*
* RETURN: None
*
* DESCRIPTION: Replace every non-printable or non-ascii byte in the string
* with a question mark '?'.
*
******************************************************************************/
static void acpi_tb_fix_string(char *string, acpi_size length)
{
while (length && *string) {
if (!ACPI_IS_PRINT(*string)) {
*string = '?';
}
string++;
length--;
}
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_cleanup_table_header
*
* PARAMETERS: out_header - Where the cleaned header is returned
* header - Input ACPI table header
*
* RETURN: Returns the cleaned header in out_header
*
* DESCRIPTION: Copy the table header and ensure that all "string" fields in
* the header consist of printable characters.
*
******************************************************************************/
static void
acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
struct acpi_table_header *header)
{
ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_print_table_header
*
* PARAMETERS: address - Table physical address
* header - Table header
*
* RETURN: None
*
* DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
*
******************************************************************************/
void
acpi_tb_print_table_header(acpi_physical_address address,
struct acpi_table_header *header)
{
struct acpi_table_header local_header;
/*
* The reason that the Address is cast to a void pointer is so that we
* can use %p which will work properly on both 32-bit and 64-bit hosts.
*/
if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) {
/* FACS only has signature and length fields */
ACPI_INFO((AE_INFO, "%4.4s %p %05X",
header->signature, ACPI_CAST_PTR(void, address),
header->length));
} else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) {
/* RSDP has no common fields */
ACPI_MEMCPY(local_header.oem_id,
ACPI_CAST_PTR(struct acpi_table_rsdp,
header)->oem_id, ACPI_OEM_ID_SIZE);
acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
ACPI_CAST_PTR (void, address),
(ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
revision >
0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
header)->length : 20,
ACPI_CAST_PTR(struct acpi_table_rsdp,
header)->revision,
local_header.oem_id));
} else {
/* Standard ACPI table with full common header */
acpi_tb_cleanup_table_header(&local_header, header);
ACPI_INFO((AE_INFO,
"%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
local_header.signature, ACPI_CAST_PTR(void, address),
local_header.length, local_header.revision,
local_header.oem_id, local_header.oem_table_id,
local_header.oem_revision,
local_header.asl_compiler_id,
local_header.asl_compiler_revision));
}
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_validate_checksum
*
* PARAMETERS: table - ACPI table to verify
* length - Length of entire table
*
* RETURN: Status
*
* DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
* exception on bad checksum.
*
******************************************************************************/
acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
{
u8 checksum;
/* Compute the checksum on the table */
checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), length);
/* Checksum ok? (should be zero) */
if (checksum) {
ACPI_BIOS_WARNING((AE_INFO,
"Incorrect checksum in table [%4.4s] - 0x%2.2X, "
"should be 0x%2.2X",
table->signature, table->checksum,
(u8)(table->checksum - checksum)));
#if (ACPI_CHECKSUM_ABORT)
return (AE_BAD_CHECKSUM);
#endif
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_checksum
*
* PARAMETERS: buffer - Pointer to memory region to be checked
* length - Length of this memory region
*
* RETURN: Checksum (u8)
*
* DESCRIPTION: Calculates circular checksum of memory region.
*
******************************************************************************/
u8 acpi_tb_checksum(u8 *buffer, u32 length)
{
u8 sum = 0;
u8 *end = buffer + length;
while (buffer < end) {
sum = (u8) (sum + *(buffer++));
}
return (sum);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_tb_check_dsdt_header * FUNCTION: acpi_tb_check_dsdt_header

View File

@ -53,8 +53,6 @@ ACPI_MODULE_NAME("tbxfload")
/* Local prototypes */ /* Local prototypes */
static acpi_status acpi_tb_load_namespace(void); static acpi_status acpi_tb_load_namespace(void);
static int no_auto_ssdt;
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_load_tables * FUNCTION: acpi_load_tables
@ -180,8 +178,16 @@ static acpi_status acpi_tb_load_namespace(void)
continue; continue;
} }
if (no_auto_ssdt) { /*
printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n"); * Optionally do not load any SSDTs from the RSDT/XSDT. This can
* be useful for debugging ACPI problems on some machines.
*/
if (acpi_gbl_disable_ssdt_table_load) {
ACPI_INFO((AE_INFO, "Ignoring %4.4s at %p",
acpi_gbl_root_table_list.tables[i].signature.
ascii, ACPI_CAST_PTR(void,
acpi_gbl_root_table_list.
tables[i].address)));
continue; continue;
} }
@ -376,14 +382,3 @@ acpi_status acpi_unload_parent_table(acpi_handle object)
} }
ACPI_EXPORT_SYMBOL(acpi_unload_parent_table) ACPI_EXPORT_SYMBOL(acpi_unload_parent_table)
static int __init acpi_no_auto_ssdt_setup(char *s) {
printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");
no_auto_ssdt = 1;
return 1;
}
__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);

View File

@ -0,0 +1,201 @@
/******************************************************************************
*
* Module Name: utbuffer - Buffer dump routines
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2013, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utbuffer")
/*******************************************************************************
*
* FUNCTION: acpi_ut_dump_buffer
*
* PARAMETERS: buffer - Buffer to dump
* count - Amount to dump, in bytes
* display - BYTE, WORD, DWORD, or QWORD display:
* DB_BYTE_DISPLAY
* DB_WORD_DISPLAY
* DB_DWORD_DISPLAY
* DB_QWORD_DISPLAY
* base_offset - Beginning buffer offset (display only)
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
******************************************************************************/
void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
{
u32 i = 0;
u32 j;
u32 temp32;
u8 buf_char;
if (!buffer) {
acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
return;
}
if ((count < 4) || (count & 0x01)) {
display = DB_BYTE_DISPLAY;
}
/* Nasty little dump buffer routine! */
while (i < count) {
/* Print current offset */
acpi_os_printf("%6.4X: ", (base_offset + i));
/* Print 16 hex chars */
for (j = 0; j < 16;) {
if (i + j >= count) {
/* Dump fill spaces */
acpi_os_printf("%*s", ((display * 2) + 1), " ");
j += display;
continue;
}
switch (display) {
case DB_BYTE_DISPLAY:
default: /* Default is BYTE display */
acpi_os_printf("%02X ",
buffer[(acpi_size) i + j]);
break;
case DB_WORD_DISPLAY:
ACPI_MOVE_16_TO_32(&temp32,
&buffer[(acpi_size) i + j]);
acpi_os_printf("%04X ", temp32);
break;
case DB_DWORD_DISPLAY:
ACPI_MOVE_32_TO_32(&temp32,
&buffer[(acpi_size) i + j]);
acpi_os_printf("%08X ", temp32);
break;
case DB_QWORD_DISPLAY:
ACPI_MOVE_32_TO_32(&temp32,
&buffer[(acpi_size) i + j]);
acpi_os_printf("%08X", temp32);
ACPI_MOVE_32_TO_32(&temp32,
&buffer[(acpi_size) i + j +
4]);
acpi_os_printf("%08X ", temp32);
break;
}
j += display;
}
/*
* Print the ASCII equivalent characters but watch out for the bad
* unprintable ones (printable chars are 0x20 through 0x7E)
*/
acpi_os_printf(" ");
for (j = 0; j < 16; j++) {
if (i + j >= count) {
acpi_os_printf("\n");
return;
}
buf_char = buffer[(acpi_size) i + j];
if (ACPI_IS_PRINT(buf_char)) {
acpi_os_printf("%c", buf_char);
} else {
acpi_os_printf(".");
}
}
/* Done with that line. */
acpi_os_printf("\n");
i += 16;
}
return;
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_debug_dump_buffer
*
* PARAMETERS: buffer - Buffer to dump
* count - Amount to dump, in bytes
* display - BYTE, WORD, DWORD, or QWORD display:
* DB_BYTE_DISPLAY
* DB_WORD_DISPLAY
* DB_DWORD_DISPLAY
* DB_QWORD_DISPLAY
* component_ID - Caller's component ID
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
******************************************************************************/
void
acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id)
{
/* Only dump the buffer if tracing is enabled */
if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
(component_id & acpi_dbg_layer))) {
return;
}
acpi_ut_dump_buffer(buffer, count, display, 0);
}

View File

@ -178,7 +178,6 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
switch (internal_object->reference.class) { switch (internal_object->reference.class) {
case ACPI_REFCLASS_NAME: case ACPI_REFCLASS_NAME:
/* /*
* For namepath, return the object handle ("reference") * For namepath, return the object handle ("reference")
* We are referring to the namespace node * We are referring to the namespace node
@ -264,7 +263,6 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
switch (object_type) { switch (object_type) {
case ACPI_COPY_TYPE_SIMPLE: case ACPI_COPY_TYPE_SIMPLE:
/* /*
* This is a simple or null object * This is a simple or null object
*/ */
@ -278,7 +276,6 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
break; break;
case ACPI_COPY_TYPE_PACKAGE: case ACPI_COPY_TYPE_PACKAGE:
/* /*
* Build the package object * Build the package object
*/ */
@ -304,6 +301,7 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
break; break;
default: default:
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
@ -481,6 +479,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
default: default:
/* All other types are not supported */ /* All other types are not supported */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
@ -544,7 +543,9 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
break; break;
default: default:
/* Other types can't get here */ /* Other types can't get here */
break; break;
} }
@ -800,7 +801,9 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
break; break;
default: default:
/* Nothing to do for other simple objects */ /* Nothing to do for other simple objects */
break; break;
} }
@ -868,7 +871,6 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
break; break;
case ACPI_COPY_TYPE_PACKAGE: case ACPI_COPY_TYPE_PACKAGE:
/* /*
* This object is a package - go down another nesting level * This object is a package - go down another nesting level
* Create and build the package object * Create and build the package object
@ -891,6 +893,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
break; break;
default: default:
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: utdebug - Debug print routines * Module Name: utdebug - Debug print/trace routines
* *
*****************************************************************************/ *****************************************************************************/
@ -543,149 +543,3 @@ acpi_ut_ptr_exit(u32 line_number,
} }
#endif #endif
/*******************************************************************************
*
* FUNCTION: acpi_ut_dump_buffer
*
* PARAMETERS: buffer - Buffer to dump
* count - Amount to dump, in bytes
* display - BYTE, WORD, DWORD, or QWORD display
* offset - Beginning buffer offset (display only)
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
******************************************************************************/
void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
{
u32 i = 0;
u32 j;
u32 temp32;
u8 buf_char;
if (!buffer) {
acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
return;
}
if ((count < 4) || (count & 0x01)) {
display = DB_BYTE_DISPLAY;
}
/* Nasty little dump buffer routine! */
while (i < count) {
/* Print current offset */
acpi_os_printf("%6.4X: ", (base_offset + i));
/* Print 16 hex chars */
for (j = 0; j < 16;) {
if (i + j >= count) {
/* Dump fill spaces */
acpi_os_printf("%*s", ((display * 2) + 1), " ");
j += display;
continue;
}
switch (display) {
case DB_BYTE_DISPLAY:
default: /* Default is BYTE display */
acpi_os_printf("%02X ",
buffer[(acpi_size) i + j]);
break;
case DB_WORD_DISPLAY:
ACPI_MOVE_16_TO_32(&temp32,
&buffer[(acpi_size) i + j]);
acpi_os_printf("%04X ", temp32);
break;
case DB_DWORD_DISPLAY:
ACPI_MOVE_32_TO_32(&temp32,
&buffer[(acpi_size) i + j]);
acpi_os_printf("%08X ", temp32);
break;
case DB_QWORD_DISPLAY:
ACPI_MOVE_32_TO_32(&temp32,
&buffer[(acpi_size) i + j]);
acpi_os_printf("%08X", temp32);
ACPI_MOVE_32_TO_32(&temp32,
&buffer[(acpi_size) i + j +
4]);
acpi_os_printf("%08X ", temp32);
break;
}
j += display;
}
/*
* Print the ASCII equivalent characters but watch out for the bad
* unprintable ones (printable chars are 0x20 through 0x7E)
*/
acpi_os_printf(" ");
for (j = 0; j < 16; j++) {
if (i + j >= count) {
acpi_os_printf("\n");
return;
}
buf_char = buffer[(acpi_size) i + j];
if (ACPI_IS_PRINT(buf_char)) {
acpi_os_printf("%c", buf_char);
} else {
acpi_os_printf(".");
}
}
/* Done with that line. */
acpi_os_printf("\n");
i += 16;
}
return;
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_debug_dump_buffer
*
* PARAMETERS: buffer - Buffer to dump
* count - Amount to dump, in bytes
* display - BYTE, WORD, DWORD, or QWORD display
* component_ID - Caller's component ID
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
******************************************************************************/
void
acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id)
{
/* Only dump the buffer if tracing is enabled */
if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
(component_id & acpi_dbg_layer))) {
return;
}
acpi_ut_dump_buffer(buffer, count, display, 0);
}

View File

@ -303,6 +303,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
break; break;
default: default:
break; break;
} }
@ -508,7 +509,6 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER: case ACPI_TYPE_POWER:
case ACPI_TYPE_THERMAL: case ACPI_TYPE_THERMAL:
/* /*
* Update the notify objects for these types (if present) * Update the notify objects for these types (if present)
* Two lists, system and device notify handlers. * Two lists, system and device notify handlers.
@ -623,6 +623,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
default: default:
break; /* No subobjects for all other types */ break; /* No subobjects for all other types */
} }

View File

@ -0,0 +1,289 @@
/*******************************************************************************
*
* Module Name: uterror - Various internal error/warning output functions
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2013, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("uterror")
/*
* This module contains internal error functions that may
* be configured out.
*/
#if !defined (ACPI_NO_ERROR_MESSAGES)
/*******************************************************************************
*
* FUNCTION: acpi_ut_predefined_warning
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* pathname - Full pathname to the node
* node_flags - From Namespace node for the method/object
* format - Printf format string + additional args
*
* RETURN: None
*
* DESCRIPTION: Warnings for the predefined validation module. Messages are
* only emitted the first time a problem with a particular
* method/object is detected. This prevents a flood of error
* messages for methods that are repeatedly evaluated.
*
******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_warning(const char *module_name,
u32 line_number,
char *pathname,
u8 node_flags, const char *format, ...)
{
va_list arg_list;
/*
* Warning messages for this method/object will be disabled after the
* first time a validation fails or an object is successfully repaired.
*/
if (node_flags & ANOBJ_EVALUATED) {
return;
}
acpi_os_printf(ACPI_MSG_WARNING "%s: ", pathname);
va_start(arg_list, format);
acpi_os_vprintf(format, arg_list);
ACPI_MSG_SUFFIX;
va_end(arg_list);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_predefined_info
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* pathname - Full pathname to the node
* node_flags - From Namespace node for the method/object
* format - Printf format string + additional args
*
* RETURN: None
*
* DESCRIPTION: Info messages for the predefined validation module. Messages
* are only emitted the first time a problem with a particular
* method/object is detected. This prevents a flood of
* messages for methods that are repeatedly evaluated.
*
******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_info(const char *module_name,
u32 line_number,
char *pathname, u8 node_flags, const char *format, ...)
{
va_list arg_list;
/*
* Warning messages for this method/object will be disabled after the
* first time a validation fails or an object is successfully repaired.
*/
if (node_flags & ANOBJ_EVALUATED) {
return;
}
acpi_os_printf(ACPI_MSG_INFO "%s: ", pathname);
va_start(arg_list, format);
acpi_os_vprintf(format, arg_list);
ACPI_MSG_SUFFIX;
va_end(arg_list);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_predefined_bios_error
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* pathname - Full pathname to the node
* node_flags - From Namespace node for the method/object
* format - Printf format string + additional args
*
* RETURN: None
*
* DESCRIPTION: BIOS error message for predefined names. Messages
* are only emitted the first time a problem with a particular
* method/object is detected. This prevents a flood of
* messages for methods that are repeatedly evaluated.
*
******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_bios_error(const char *module_name,
u32 line_number,
char *pathname,
u8 node_flags, const char *format, ...)
{
va_list arg_list;
/*
* Warning messages for this method/object will be disabled after the
* first time a validation fails or an object is successfully repaired.
*/
if (node_flags & ANOBJ_EVALUATED) {
return;
}
acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s: ", pathname);
va_start(arg_list, format);
acpi_os_vprintf(format, arg_list);
ACPI_MSG_SUFFIX;
va_end(arg_list);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_namespace_error
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* internal_name - Name or path of the namespace node
* lookup_status - Exception code from NS lookup
*
* RETURN: None
*
* DESCRIPTION: Print error message with the full pathname for the NS node.
*
******************************************************************************/
void
acpi_ut_namespace_error(const char *module_name,
u32 line_number,
const char *internal_name, acpi_status lookup_status)
{
acpi_status status;
u32 bad_name;
char *name = NULL;
ACPI_MSG_REDIRECT_BEGIN;
acpi_os_printf(ACPI_MSG_ERROR);
if (lookup_status == AE_BAD_CHARACTER) {
/* There is a non-ascii character in the name */
ACPI_MOVE_32_TO_32(&bad_name,
ACPI_CAST_PTR(u32, internal_name));
acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name);
} else {
/* Convert path to external format */
status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
internal_name, NULL, &name);
/* Print target name */
if (ACPI_SUCCESS(status)) {
acpi_os_printf("[%s]", name);
} else {
acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
}
if (name) {
ACPI_FREE(name);
}
}
acpi_os_printf(" Namespace lookup failure, %s",
acpi_format_exception(lookup_status));
ACPI_MSG_SUFFIX;
ACPI_MSG_REDIRECT_END;
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_method_error
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* message - Error message to use on failure
* prefix_node - Prefix relative to the path
* path - Path to the node (optional)
* method_status - Execution status
*
* RETURN: None
*
* DESCRIPTION: Print error message with the full pathname for the method.
*
******************************************************************************/
void
acpi_ut_method_error(const char *module_name,
u32 line_number,
const char *message,
struct acpi_namespace_node *prefix_node,
const char *path, acpi_status method_status)
{
acpi_status status;
struct acpi_namespace_node *node = prefix_node;
ACPI_MSG_REDIRECT_BEGIN;
acpi_os_printf(ACPI_MSG_ERROR);
if (path) {
status =
acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
&node);
if (ACPI_FAILURE(status)) {
acpi_os_printf("[Could not get node by pathname]");
}
}
acpi_ns_print_node_pathname(node, message);
acpi_os_printf(", %s", acpi_format_exception(method_status));
ACPI_MSG_SUFFIX;
ACPI_MSG_REDIRECT_END;
}
#endif /* ACPI_NO_ERROR_MESSAGES */

View File

@ -68,7 +68,7 @@ ACPI_MODULE_NAME("uteval")
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node, acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
char *path, char *path,
u32 expected_return_btypes, u32 expected_return_btypes,
union acpi_operand_object **return_desc) union acpi_operand_object **return_desc)
@ -87,7 +87,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node,
} }
info->prefix_node = prefix_node; info->prefix_node = prefix_node;
info->pathname = path; info->relative_pathname = path;
/* Evaluate the object/method */ /* Evaluate the object/method */
@ -123,22 +123,27 @@ acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node,
switch ((info->return_object)->common.type) { switch ((info->return_object)->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
return_btype = ACPI_BTYPE_INTEGER; return_btype = ACPI_BTYPE_INTEGER;
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
return_btype = ACPI_BTYPE_BUFFER; return_btype = ACPI_BTYPE_BUFFER;
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
return_btype = ACPI_BTYPE_STRING; return_btype = ACPI_BTYPE_STRING;
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
return_btype = ACPI_BTYPE_PACKAGE; return_btype = ACPI_BTYPE_PACKAGE;
break; break;
default: default:
return_btype = 0; return_btype = 0;
break; break;
} }

View File

@ -146,6 +146,7 @@ const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status status)
break; break;
default: default:
break; break;
} }

View File

@ -341,14 +341,17 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
switch (cid_objects[i]->common.type) { switch (cid_objects[i]->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
string_area_size += ACPI_EISAID_STRING_SIZE; string_area_size += ACPI_EISAID_STRING_SIZE;
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
string_area_size += cid_objects[i]->string.length + 1; string_area_size += cid_objects[i]->string.length + 1;
break; break;
default: default:
status = AE_TYPE; status = AE_TYPE;
goto cleanup; goto cleanup;
} }

View File

@ -382,10 +382,12 @@ acpi_ut_display_init_pathname(u8 type,
switch (type) { switch (type) {
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
acpi_os_printf("Executing "); acpi_os_printf("Executing ");
break; break;
default: default:
acpi_os_printf("Initializing "); acpi_os_printf("Initializing ");
break; break;
} }

View File

@ -129,6 +129,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
break; break;
default: default:
/* All others have no secondary object */ /* All others have no secondary object */
break; break;
} }
@ -353,6 +354,7 @@ u8 acpi_ut_valid_internal_object(void *object)
return (TRUE); return (TRUE);
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"%p is not not an ACPI operand obj [%s]\n", "%p is not not an ACPI operand obj [%s]\n",
object, acpi_ut_get_descriptor_name(object))); object, acpi_ut_get_descriptor_name(object)));
@ -509,7 +511,6 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
switch (internal_object->reference.class) { switch (internal_object->reference.class) {
case ACPI_REFCLASS_NAME: case ACPI_REFCLASS_NAME:
/* /*
* Get the actual length of the full pathname to this object. * Get the actual length of the full pathname to this object.
* The reference will be converted to the pathname to the object * The reference will be converted to the pathname to the object
@ -525,7 +526,6 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
break; break;
default: default:
/* /*
* No other reference opcodes are supported. * No other reference opcodes are supported.
* Notably, Locals and Args are not supported, but this may be * Notably, Locals and Args are not supported, but this may be
@ -585,7 +585,6 @@ acpi_ut_get_element_length(u8 object_type,
switch (object_type) { switch (object_type) {
case ACPI_COPY_TYPE_SIMPLE: case ACPI_COPY_TYPE_SIMPLE:
/* /*
* Simple object - just get the size (Null object/entry is handled * Simple object - just get the size (Null object/entry is handled
* here also) and sum it into the running package length * here also) and sum it into the running package length

View File

@ -147,6 +147,11 @@ void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
u32 i; u32 i;
u32 j; u32 j;
if (!expected_btypes) {
ACPI_STRCPY(buffer, "NONE");
return;
}
j = 1; j = 1;
buffer[0] = 0; buffer[0] = 0;
this_rtype = ACPI_RTYPE_INTEGER; this_rtype = ACPI_RTYPE_INTEGER;
@ -328,9 +333,7 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
/* First field in the types list is the count of args to follow */ /* First field in the types list is the count of args to follow */
arg_count = (argument_types & METHOD_ARG_MASK); arg_count = METHOD_GET_ARG_COUNT(argument_types);
argument_types >>= METHOD_ARG_BIT_WIDTH;
if (arg_count > METHOD_PREDEF_ARGS_MAX) { if (arg_count > METHOD_PREDEF_ARGS_MAX) {
printf("**** Invalid argument count (%u) " printf("**** Invalid argument count (%u) "
"in predefined info structure\n", arg_count); "in predefined info structure\n", arg_count);
@ -340,7 +343,8 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
/* Get each argument from the list, convert to ascii, store to buffer */ /* Get each argument from the list, convert to ascii, store to buffer */
for (i = 0; i < arg_count; i++) { for (i = 0; i < arg_count; i++) {
this_argument_type = (argument_types & METHOD_ARG_MASK); this_argument_type = METHOD_GET_NEXT_TYPE(argument_types);
if (!this_argument_type if (!this_argument_type
|| (this_argument_type > METHOD_MAX_ARG_TYPE)) { || (this_argument_type > METHOD_MAX_ARG_TYPE)) {
printf("**** Invalid argument type (%u) " printf("**** Invalid argument type (%u) "
@ -351,10 +355,6 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
strcat(buffer, strcat(buffer,
ut_external_type_names[this_argument_type] + sub_index); ut_external_type_names[this_argument_type] + sub_index);
/* Shift to next argument type field */
argument_types >>= METHOD_ARG_BIT_WIDTH;
sub_index = 0; sub_index = 0;
} }

View File

@ -186,10 +186,13 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
switch (base) { switch (base) {
case ACPI_ANY_BASE: case ACPI_ANY_BASE:
case 16: case 16:
break; break;
default: default:
/* Invalid Base */ /* Invalid Base */
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
@ -355,36 +358,44 @@ void acpi_ut_print_string(char *string, u8 max_length)
switch (string[i]) { switch (string[i]) {
case 0x07: case 0x07:
acpi_os_printf("\\a"); /* BELL */ acpi_os_printf("\\a"); /* BELL */
break; break;
case 0x08: case 0x08:
acpi_os_printf("\\b"); /* BACKSPACE */ acpi_os_printf("\\b"); /* BACKSPACE */
break; break;
case 0x0C: case 0x0C:
acpi_os_printf("\\f"); /* FORMFEED */ acpi_os_printf("\\f"); /* FORMFEED */
break; break;
case 0x0A: case 0x0A:
acpi_os_printf("\\n"); /* LINEFEED */ acpi_os_printf("\\n"); /* LINEFEED */
break; break;
case 0x0D: case 0x0D:
acpi_os_printf("\\r"); /* CARRIAGE RETURN */ acpi_os_printf("\\r"); /* CARRIAGE RETURN */
break; break;
case 0x09: case 0x09:
acpi_os_printf("\\t"); /* HORIZONTAL TAB */ acpi_os_printf("\\t"); /* HORIZONTAL TAB */
break; break;
case 0x0B: case 0x0B:
acpi_os_printf("\\v"); /* VERTICAL TAB */ acpi_os_printf("\\v"); /* VERTICAL TAB */
break; break;
case '\'': /* Single Quote */ case '\'': /* Single Quote */
case '\"': /* Double Quote */ case '\"': /* Double Quote */
case '\\': /* Backslash */ case '\\': /* Backslash */
acpi_os_printf("\\%c", (int)string[i]); acpi_os_printf("\\%c", (int)string[i]);
break; break;
@ -451,7 +462,8 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position)
* *
* FUNCTION: acpi_ut_valid_acpi_name * FUNCTION: acpi_ut_valid_acpi_name
* *
* PARAMETERS: name - The name to be examined * PARAMETERS: name - The name to be examined. Does not have to
* be NULL terminated string.
* *
* RETURN: TRUE if the name is valid, FALSE otherwise * RETURN: TRUE if the name is valid, FALSE otherwise
* *
@ -462,15 +474,14 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position)
* *
******************************************************************************/ ******************************************************************************/
u8 acpi_ut_valid_acpi_name(u32 name) u8 acpi_ut_valid_acpi_name(char *name)
{ {
u32 i; u32 i;
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
for (i = 0; i < ACPI_NAME_SIZE; i++) { for (i = 0; i < ACPI_NAME_SIZE; i++) {
if (!acpi_ut_valid_acpi_char if (!acpi_ut_valid_acpi_char(name[i], i)) {
((ACPI_CAST_PTR(char, &name))[i], i)) {
return (FALSE); return (FALSE);
} }
} }

View File

@ -603,6 +603,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
switch (ACPI_GET_DESCRIPTOR_TYPE switch (ACPI_GET_DESCRIPTOR_TYPE
(descriptor)) { (descriptor)) {
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
if (element->size == if (element->size ==
sizeof(union sizeof(union
acpi_operand_object)) acpi_operand_object))
@ -613,6 +614,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
break; break;
case ACPI_DESC_TYPE_PARSER: case ACPI_DESC_TYPE_PARSER:
if (element->size == if (element->size ==
sizeof(union sizeof(union
acpi_parse_object)) { acpi_parse_object)) {
@ -622,6 +624,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
break; break;
case ACPI_DESC_TYPE_NAMED: case ACPI_DESC_TYPE_NAMED:
if (element->size == if (element->size ==
sizeof(struct sizeof(struct
acpi_namespace_node)) acpi_namespace_node))
@ -632,6 +635,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
break; break;
default: default:
break; break;
} }
@ -639,6 +643,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
switch (descriptor_type) { switch (descriptor_type) {
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
acpi_os_printf acpi_os_printf
("%12.12s RefCount 0x%04X\n", ("%12.12s RefCount 0x%04X\n",
acpi_ut_get_type_name acpi_ut_get_type_name
@ -649,6 +654,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
break; break;
case ACPI_DESC_TYPE_PARSER: case ACPI_DESC_TYPE_PARSER:
acpi_os_printf acpi_os_printf
("AmlOpcode 0x%04hX\n", ("AmlOpcode 0x%04hX\n",
descriptor->op.asl. descriptor->op.asl.
@ -656,6 +662,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
break; break;
case ACPI_DESC_TYPE_NAMED: case ACPI_DESC_TYPE_NAMED:
acpi_os_printf("%4.4s\n", acpi_os_printf("%4.4s\n",
acpi_ut_get_node_name acpi_ut_get_node_name
(&descriptor-> (&descriptor->
@ -663,6 +670,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
break; break;
default: default:
acpi_os_printf("\n"); acpi_os_printf("\n");
break; break;
} }

View File

@ -44,7 +44,6 @@
#include <linux/export.h> #include <linux/export.h>
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include "accommon.h" #include "accommon.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_UTILITIES #define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utxferror") ACPI_MODULE_NAME("utxferror")
@ -52,43 +51,7 @@ ACPI_MODULE_NAME("utxferror")
/* /*
* This module is used for the in-kernel ACPICA as well as the ACPICA * This module is used for the in-kernel ACPICA as well as the ACPICA
* tools/applications. * tools/applications.
*
* For the iASL compiler case, the output is redirected to stderr so that
* any of the various ACPI errors and warnings do not appear in the output
* files, for either the compiler or disassembler portions of the tool.
*/ */
#ifdef ACPI_ASL_COMPILER
#include <stdio.h>
extern FILE *acpi_gbl_output_file;
#define ACPI_MSG_REDIRECT_BEGIN \
FILE *output_file = acpi_gbl_output_file; \
acpi_os_redirect_output (stderr);
#define ACPI_MSG_REDIRECT_END \
acpi_os_redirect_output (output_file);
#else
/*
* non-iASL case - no redirection, nothing to do
*/
#define ACPI_MSG_REDIRECT_BEGIN
#define ACPI_MSG_REDIRECT_END
#endif
/*
* Common message prefixes
*/
#define ACPI_MSG_ERROR "ACPI Error: "
#define ACPI_MSG_EXCEPTION "ACPI Exception: "
#define ACPI_MSG_WARNING "ACPI Warning: "
#define ACPI_MSG_INFO "ACPI: "
#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Bug: Error: "
#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Bug: Warning: "
/*
* Common message suffix
*/
#define ACPI_MSG_SUFFIX \
acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_error * FUNCTION: acpi_error
@ -285,200 +248,3 @@ acpi_bios_warning(const char *module_name,
} }
ACPI_EXPORT_SYMBOL(acpi_bios_warning) ACPI_EXPORT_SYMBOL(acpi_bios_warning)
/*
* The remainder of this module contains internal error functions that may
* be configured out.
*/
#if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP)
/*******************************************************************************
*
* FUNCTION: acpi_ut_predefined_warning
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* pathname - Full pathname to the node
* node_flags - From Namespace node for the method/object
* format - Printf format string + additional args
*
* RETURN: None
*
* DESCRIPTION: Warnings for the predefined validation module. Messages are
* only emitted the first time a problem with a particular
* method/object is detected. This prevents a flood of error
* messages for methods that are repeatedly evaluated.
*
******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_warning(const char *module_name,
u32 line_number,
char *pathname,
u8 node_flags, const char *format, ...)
{
va_list arg_list;
/*
* Warning messages for this method/object will be disabled after the
* first time a validation fails or an object is successfully repaired.
*/
if (node_flags & ANOBJ_EVALUATED) {
return;
}
acpi_os_printf(ACPI_MSG_WARNING "For %s: ", pathname);
va_start(arg_list, format);
acpi_os_vprintf(format, arg_list);
ACPI_MSG_SUFFIX;
va_end(arg_list);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_predefined_info
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* pathname - Full pathname to the node
* node_flags - From Namespace node for the method/object
* format - Printf format string + additional args
*
* RETURN: None
*
* DESCRIPTION: Info messages for the predefined validation module. Messages
* are only emitted the first time a problem with a particular
* method/object is detected. This prevents a flood of
* messages for methods that are repeatedly evaluated.
*
******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_info(const char *module_name,
u32 line_number,
char *pathname, u8 node_flags, const char *format, ...)
{
va_list arg_list;
/*
* Warning messages for this method/object will be disabled after the
* first time a validation fails or an object is successfully repaired.
*/
if (node_flags & ANOBJ_EVALUATED) {
return;
}
acpi_os_printf(ACPI_MSG_INFO "For %s: ", pathname);
va_start(arg_list, format);
acpi_os_vprintf(format, arg_list);
ACPI_MSG_SUFFIX;
va_end(arg_list);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_namespace_error
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* internal_name - Name or path of the namespace node
* lookup_status - Exception code from NS lookup
*
* RETURN: None
*
* DESCRIPTION: Print error message with the full pathname for the NS node.
*
******************************************************************************/
void
acpi_ut_namespace_error(const char *module_name,
u32 line_number,
const char *internal_name, acpi_status lookup_status)
{
acpi_status status;
u32 bad_name;
char *name = NULL;
ACPI_MSG_REDIRECT_BEGIN;
acpi_os_printf(ACPI_MSG_ERROR);
if (lookup_status == AE_BAD_CHARACTER) {
/* There is a non-ascii character in the name */
ACPI_MOVE_32_TO_32(&bad_name,
ACPI_CAST_PTR(u32, internal_name));
acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name);
} else {
/* Convert path to external format */
status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
internal_name, NULL, &name);
/* Print target name */
if (ACPI_SUCCESS(status)) {
acpi_os_printf("[%s]", name);
} else {
acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
}
if (name) {
ACPI_FREE(name);
}
}
acpi_os_printf(" Namespace lookup failure, %s",
acpi_format_exception(lookup_status));
ACPI_MSG_SUFFIX;
ACPI_MSG_REDIRECT_END;
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_method_error
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
* message - Error message to use on failure
* prefix_node - Prefix relative to the path
* path - Path to the node (optional)
* method_status - Execution status
*
* RETURN: None
*
* DESCRIPTION: Print error message with the full pathname for the method.
*
******************************************************************************/
void
acpi_ut_method_error(const char *module_name,
u32 line_number,
const char *message,
struct acpi_namespace_node *prefix_node,
const char *path, acpi_status method_status)
{
acpi_status status;
struct acpi_namespace_node *node = prefix_node;
ACPI_MSG_REDIRECT_BEGIN;
acpi_os_printf(ACPI_MSG_ERROR);
if (path) {
status =
acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
&node);
if (ACPI_FAILURE(status)) {
acpi_os_printf("[Could not get node by pathname]");
}
}
acpi_ns_print_node_pathname(node, message);
acpi_os_printf(", %s", acpi_format_exception(method_status));
ACPI_MSG_SUFFIX;
ACPI_MSG_REDIRECT_END;
}
#endif /* ACPI_NO_ERROR_MESSAGES */

View File

@ -1715,6 +1715,17 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
} }
#endif #endif
static int __init acpi_no_auto_ssdt_setup(char *s)
{
printk(KERN_NOTICE PREFIX "SSDT auto-load disabled\n");
acpi_gbl_disable_ssdt_table_load = TRUE;
return 1;
}
__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
acpi_status __init acpi_os_initialize(void) acpi_status __init acpi_os_initialize(void)
{ {
acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block); acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block);

View File

@ -219,8 +219,8 @@
* *
*****************************************************************************/ *****************************************************************************/
#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ #define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 4 /* Max command line arguments */
#define ACPI_DB_LINE_BUFFER_SIZE 512 #define ACPI_DB_LINE_BUFFER_SIZE 512
#define ACPI_DEBUGGER_COMMAND_PROMPT '-' #define ACPI_DEBUGGER_COMMAND_PROMPT '-'
#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' #define ACPI_DEBUGGER_EXECUTE_PROMPT '%'

View File

@ -428,27 +428,21 @@
* This is the non-debug case -- make everything go away, * This is the non-debug case -- make everything go away,
* leaving no executable debug code! * leaving no executable debug code!
*/ */
#define ACPI_FUNCTION_NAME(a)
#define ACPI_DEBUG_PRINT(pl) #define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl) #define ACPI_DEBUG_PRINT_RAW(pl)
#define ACPI_DEBUG_EXEC(a) #define ACPI_DEBUG_EXEC(a)
#define ACPI_DEBUG_ONLY_MEMBERS(a) #define ACPI_DEBUG_ONLY_MEMBERS(a)
#define ACPI_FUNCTION_NAME(a)
#define ACPI_FUNCTION_TRACE(a) #define ACPI_FUNCTION_TRACE(a)
#define ACPI_FUNCTION_TRACE_PTR(a, b) #define ACPI_FUNCTION_TRACE_PTR(a, b)
#define ACPI_FUNCTION_TRACE_U32(a, b) #define ACPI_FUNCTION_TRACE_U32(a, b)
#define ACPI_FUNCTION_TRACE_STR(a, b) #define ACPI_FUNCTION_TRACE_STR(a, b)
#define ACPI_FUNCTION_EXIT
#define ACPI_FUNCTION_STATUS_EXIT(s)
#define ACPI_FUNCTION_VALUE_EXIT(s)
#define ACPI_FUNCTION_ENTRY() #define ACPI_FUNCTION_ENTRY()
#define ACPI_DUMP_STACK_ENTRY(a) #define ACPI_DUMP_STACK_ENTRY(a)
#define ACPI_DUMP_OPERANDS(a, b, c) #define ACPI_DUMP_OPERANDS(a, b, c)
#define ACPI_DUMP_ENTRY(a, b) #define ACPI_DUMP_ENTRY(a, b)
#define ACPI_DUMP_TABLES(a, b)
#define ACPI_DUMP_PATHNAME(a, b, c, d) #define ACPI_DUMP_PATHNAME(a, b, c, d)
#define ACPI_DUMP_BUFFER(a, b) #define ACPI_DUMP_BUFFER(a, b)
#define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl)
#define ACPI_IS_DEBUG_ENABLED(level, component) 0 #define ACPI_IS_DEBUG_ENABLED(level, component) 0
/* Return macros must have a return statement at the minimum */ /* Return macros must have a return statement at the minimum */

View File

@ -46,7 +46,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */ /* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20130328 #define ACPI_CA_VERSION 0x20130517
#include <acpi/acconfig.h> #include <acpi/acconfig.h>
#include <acpi/actypes.h> #include <acpi/actypes.h>
@ -80,6 +80,7 @@ extern bool acpi_gbl_enable_aml_debug_object;
extern u8 acpi_gbl_copy_dsdt_locally; extern u8 acpi_gbl_copy_dsdt_locally;
extern u8 acpi_gbl_truncate_io_addresses; extern u8 acpi_gbl_truncate_io_addresses;
extern u8 acpi_gbl_disable_auto_repair; extern u8 acpi_gbl_disable_auto_repair;
extern u8 acpi_gbl_disable_ssdt_table_load;
/* /*
* Hardware-reduced prototypes. All interfaces that use these macros will * Hardware-reduced prototypes. All interfaces that use these macros will