aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2013-05-29 22:00:01 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-01 15:54:30 -0400
commit29a241cc02110b8b2259fd72719b8cadc03909be (patch)
treea96c10dd22a35479dc2e1ef140f7d90a442f9c03 /drivers
parente1405ca5ebf1068a0d62afd2fec8f0354038147a (diff)
ACPICA: Add argument typechecking for all predefined ACPI names
Fully implements typechecking on all incoming arguments for all predefined names. This ensures that ACPI-related drivers are passing the correct number of arguments, each of the correct object type. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Acked-by: Len Brown <len.brown@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/Makefile1
-rw-r--r--drivers/acpi/acpica/aclocal.h17
-rw-r--r--drivers/acpi/acpica/acnamesp.h43
-rw-r--r--drivers/acpi/acpica/acpredef.h4
-rw-r--r--drivers/acpi/acpica/acstruct.h40
-rw-r--r--drivers/acpi/acpica/evgpe.c1
-rw-r--r--drivers/acpi/acpica/evregion.c2
-rw-r--r--drivers/acpi/acpica/hwxface.c6
-rw-r--r--drivers/acpi/acpica/nsarguments.c294
-rw-r--r--drivers/acpi/acpica/nseval.c247
-rw-r--r--drivers/acpi/acpica/nsinit.c7
-rw-r--r--drivers/acpi/acpica/nspredef.c201
-rw-r--r--drivers/acpi/acpica/nsprepkg.c76
-rw-r--r--drivers/acpi/acpica/nsrepair.c50
-rw-r--r--drivers/acpi/acpica/nsrepair2.c87
-rw-r--r--drivers/acpi/acpica/nsxfeval.c162
-rw-r--r--drivers/acpi/acpica/psxface.c14
-rw-r--r--drivers/acpi/acpica/rsutils.c2
-rw-r--r--drivers/acpi/acpica/uteval.c2
-rw-r--r--drivers/acpi/acpica/utpredef.c16
20 files changed, 798 insertions, 474 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 7ddf29eca9f5..29b3dab401ec 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -83,6 +83,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
83acpi-y += \ 83acpi-y += \
84 nsaccess.o \ 84 nsaccess.o \
85 nsalloc.o \ 85 nsalloc.o \
86 nsarguments.o \
86 nsconvert.o \ 87 nsconvert.o \
87 nsdump.o \ 88 nsdump.o \
88 nseval.o \ 89 nseval.o \
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index d5bfbd331bfd..dfed26545ba2 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -362,23 +362,6 @@ union acpi_predefined_info {
362 362
363#pragma pack() 363#pragma pack()
364 364
365/* Data block used during object validation */
366
367struct acpi_predefined_data {
368 char *pathname;
369 const union acpi_predefined_info *predefined;
370 union acpi_operand_object *parent_package;
371 struct acpi_namespace_node *node;
372 u32 flags;
373 u32 return_btype;
374 u8 node_flags;
375};
376
377/* Defines for Flags field above */
378
379#define ACPI_OBJECT_REPAIRED 1
380#define ACPI_OBJECT_WRAPPED 2
381
382/* Return object auto-repair info */ 365/* Return object auto-repair info */
383 366
384typedef acpi_status(*acpi_object_converter) (union acpi_operand_object 367typedef acpi_status(*acpi_object_converter) (union acpi_operand_object
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index d2e491876bc0..b83dc32a5ae0 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -223,22 +223,33 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
223void acpi_ns_exec_module_code_list(void); 223void acpi_ns_exec_module_code_list(void);
224 224
225/* 225/*
226 * nspredef - Support for predefined/reserved names 226 * nsarguments - Argument count/type checking for predefined/reserved names
227 */ 227 */
228acpi_status 228void
229acpi_ns_check_predefined_names(struct acpi_namespace_node *node, 229acpi_ns_check_argument_count(char *pathname,
230 u32 user_param_count, 230 struct acpi_namespace_node *node,
231 acpi_status return_status, 231 u32 user_param_count,
232 union acpi_operand_object **return_object); 232 const union acpi_predefined_info *info);
233 233
234void 234void
235acpi_ns_check_parameter_count(char *pathname, 235acpi_ns_check_acpi_compliance(char *pathname,
236 struct acpi_namespace_node *node, 236 struct acpi_namespace_node *node,
237 u32 user_param_count, 237 const union acpi_predefined_info *predefined);
238 const union acpi_predefined_info *info); 238
239void acpi_ns_check_argument_types(struct acpi_evaluate_info *info);
240
241/*
242 * nspredef - Return value checking for predefined/reserved names
243 */
244acpi_status
245acpi_ns_check_return_value(struct acpi_namespace_node *node,
246 struct acpi_evaluate_info *info,
247 u32 user_param_count,
248 acpi_status return_status,
249 union acpi_operand_object **return_object);
239 250
240acpi_status 251acpi_status
241acpi_ns_check_object_type(struct acpi_predefined_data *data, 252acpi_ns_check_object_type(struct acpi_evaluate_info *info,
242 union acpi_operand_object **return_object_ptr, 253 union acpi_operand_object **return_object_ptr,
243 u32 expected_btypes, u32 package_index); 254 u32 expected_btypes, u32 package_index);
244 255
@@ -246,7 +257,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
246 * nsprepkg - Validation of predefined name packages 257 * nsprepkg - Validation of predefined name packages
247 */ 258 */
248acpi_status 259acpi_status
249acpi_ns_check_package(struct acpi_predefined_data *data, 260acpi_ns_check_package(struct acpi_evaluate_info *info,
250 union acpi_operand_object **return_object_ptr); 261 union acpi_operand_object **return_object_ptr);
251 262
252/* 263/*
@@ -308,24 +319,24 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
308 * predefined methods/objects 319 * predefined methods/objects
309 */ 320 */
310acpi_status 321acpi_status
311acpi_ns_simple_repair(struct acpi_predefined_data *data, 322acpi_ns_simple_repair(struct acpi_evaluate_info *info,
312 u32 expected_btypes, 323 u32 expected_btypes,
313 u32 package_index, 324 u32 package_index,
314 union acpi_operand_object **return_object_ptr); 325 union acpi_operand_object **return_object_ptr);
315 326
316acpi_status 327acpi_status
317acpi_ns_wrap_with_package(struct acpi_predefined_data *data, 328acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
318 union acpi_operand_object *original_object, 329 union acpi_operand_object *original_object,
319 union acpi_operand_object **obj_desc_ptr); 330 union acpi_operand_object **obj_desc_ptr);
320 331
321acpi_status 332acpi_status
322acpi_ns_repair_null_element(struct acpi_predefined_data *data, 333acpi_ns_repair_null_element(struct acpi_evaluate_info *info,
323 u32 expected_btypes, 334 u32 expected_btypes,
324 u32 package_index, 335 u32 package_index,
325 union acpi_operand_object **return_object_ptr); 336 union acpi_operand_object **return_object_ptr);
326 337
327void 338void
328acpi_ns_remove_null_elements(struct acpi_predefined_data *data, 339acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
329 u8 package_type, 340 u8 package_type,
330 union acpi_operand_object *obj_desc); 341 union acpi_operand_object *obj_desc);
331 342
@@ -334,7 +345,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
334 * predefined methods/objects 345 * predefined methods/objects
335 */ 346 */
336acpi_status 347acpi_status
337acpi_ns_complex_repairs(struct acpi_predefined_data *data, 348acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
338 struct acpi_namespace_node *node, 349 struct acpi_namespace_node *node,
339 acpi_status validate_status, 350 acpi_status validate_status,
340 union acpi_operand_object **return_object_ptr); 351 union acpi_operand_object **return_object_ptr);
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index b22b70944fd6..f600aded7261 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -128,8 +128,8 @@ enum acpi_return_package_types {
128#define ARG_COUNT_IS_MINIMUM 0x8000 128#define ARG_COUNT_IS_MINIMUM 0x8000
129#define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE 129#define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE
130 130
131#define METHOD_GET_COUNT(arg_list) (arg_list & METHOD_ARG_MASK) 131#define METHOD_GET_ARG_COUNT(arg_list) ((arg_list) & METHOD_ARG_MASK)
132#define METHOD_GET_NEXT_ARG(arg_list) (arg_list >> METHOD_ARG_BIT_WIDTH) 132#define METHOD_GET_NEXT_TYPE(arg_list) (((arg_list) >>= METHOD_ARG_BIT_WIDTH) & METHOD_ARG_MASK)
133 133
134/* Macros used to build the predefined info table */ 134/* Macros used to build the predefined info table */
135 135
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index 7896d85876ca..fc83c0a5ca70 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -178,25 +178,41 @@ union acpi_aml_operands {
178}; 178};
179 179
180/* 180/*
181 * Structure used to pass object evaluation parameters. 181 * Structure used to pass object evaluation information and parameters.
182 * Purpose is to reduce CPU stack use. 182 * Purpose is to reduce CPU stack use.
183 */ 183 */
184struct acpi_evaluate_info { 184struct acpi_evaluate_info {
185 struct acpi_namespace_node *prefix_node; 185 /* The first 3 elements are passed by the caller to acpi_ns_evaluate */
186 char *pathname; 186
187 union acpi_operand_object *obj_desc; 187 struct acpi_namespace_node *prefix_node; /* Input: starting node */
188 union acpi_operand_object **parameters; 188 char *relative_pathname; /* Input: path relative to prefix_node */
189 struct acpi_namespace_node *resolved_node; 189 union acpi_operand_object **parameters; /* Input: argument list */
190 union acpi_operand_object *return_object; 190
191 u8 param_count; 191 struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */
192 u8 pass_number; 192 union acpi_operand_object *obj_desc; /* Object attached to the resolved node */
193 u8 return_object_type; 193 char *full_pathname; /* Full pathname of the resolved node */
194 u8 flags; 194
195 const union acpi_predefined_info *predefined; /* Used if Node is a predefined name */
196 union acpi_operand_object *return_object; /* Object returned from the evaluation */
197 union acpi_operand_object *parent_package; /* Used if return object is a Package */
198
199 u32 return_flags; /* Used for return value analysis */
200 u32 return_btype; /* Bitmapped type of the returned object */
201 u16 param_count; /* Count of the input argument list */
202 u8 pass_number; /* Parser pass number */
203 u8 return_object_type; /* Object type of the returned object */
204 u8 node_flags; /* Same as Node->Flags */
205 u8 flags; /* General flags */
195}; 206};
196 207
197/* Values for Flags above */ 208/* Values for Flags above */
198 209
199#define ACPI_IGNORE_RETURN_VALUE 1 210#define ACPI_IGNORE_RETURN_VALUE 1
211
212/* Defines for return_flags field above */
213
214#define ACPI_OBJECT_REPAIRED 1
215#define ACPI_OBJECT_WRAPPED 2
200 216
201/* Info used by acpi_ns_initialize_devices */ 217/* Info used by acpi_ns_initialize_devices */
202 218
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index a493b528f8f9..ae50d6cc535f 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -579,7 +579,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
579 (local_gpe_event_info->dispatch. 579 (local_gpe_event_info->dispatch.
580 method_node))); 580 method_node)));
581 } 581 }
582
583 break; 582 break;
584 583
585 default: 584 default:
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 6555e350fc1f..8ae8f5b33bd9 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -532,7 +532,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
532 } 532 }
533 533
534 info->prefix_node = region_obj2->extra.method_REG; 534 info->prefix_node = region_obj2->extra.method_REG;
535 info->pathname = NULL; 535 info->relative_pathname = NULL;
536 info->parameters = args; 536 info->parameters = args;
537 info->flags = ACPI_IGNORE_RETURN_VALUE; 537 info->flags = ACPI_IGNORE_RETURN_VALUE;
538 538
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 04c2e16f2c0a..f4224e6f4e7a 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -495,7 +495,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
495 * Evaluate the \_Sx namespace object containing the register values 495 * Evaluate the \_Sx namespace object containing the register values
496 * for this state 496 * for this state
497 */ 497 */
498 info->pathname = 498 info->relative_pathname =
499 ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); 499 ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
500 status = acpi_ns_evaluate(info); 500 status = acpi_ns_evaluate(info);
501 if (ACPI_FAILURE(status)) { 501 if (ACPI_FAILURE(status)) {
@@ -506,7 +506,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
506 506
507 if (!info->return_object) { 507 if (!info->return_object) {
508 ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", 508 ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
509 info->pathname)); 509 info->relative_pathname));
510 status = AE_AML_NO_RETURN_VALUE; 510 status = AE_AML_NO_RETURN_VALUE;
511 goto cleanup; 511 goto cleanup;
512 } 512 }
@@ -565,7 +565,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
565 if (ACPI_FAILURE(status)) { 565 if (ACPI_FAILURE(status)) {
566 ACPI_EXCEPTION((AE_INFO, status, 566 ACPI_EXCEPTION((AE_INFO, status,
567 "While evaluating Sleep State [%s]", 567 "While evaluating Sleep State [%s]",
568 info->pathname)); 568 info->relative_pathname));
569 } 569 }
570 570
571 ACPI_FREE(info); 571 ACPI_FREE(info);
diff --git a/drivers/acpi/acpica/nsarguments.c b/drivers/acpi/acpica/nsarguments.c
new file mode 100644
index 000000000000..74b24c82707e
--- /dev/null
+++ b/drivers/acpi/acpica/nsarguments.c
@@ -0,0 +1,294 @@
1/******************************************************************************
2 *
3 * Module Name: nsarguments - Validation of args for ACPI predefined methods
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acnamesp.h"
47#include "acpredef.h"
48
49#define _COMPONENT ACPI_NAMESPACE
50ACPI_MODULE_NAME("nsarguments")
51
52/*******************************************************************************
53 *
54 * FUNCTION: acpi_ns_check_argument_types
55 *
56 * PARAMETERS: info - Method execution information block
57 *
58 * RETURN: None
59 *
60 * DESCRIPTION: Check the incoming argument count and all argument types
61 * against the argument type list for a predefined name.
62 *
63 ******************************************************************************/
64void acpi_ns_check_argument_types(struct acpi_evaluate_info *info)
65{
66 u16 arg_type_list;
67 u8 arg_count;
68 u8 arg_type;
69 u8 user_arg_type;
70 u32 i;
71
72 /* If not a predefined name, cannot typecheck args */
73
74 if (!info->predefined) {
75 return;
76 }
77
78 arg_type_list = info->predefined->info.argument_list;
79 arg_count = METHOD_GET_ARG_COUNT(arg_type_list);
80
81 /* Typecheck all arguments */
82
83 for (i = 0; ((i < arg_count) && (i < info->param_count)); i++) {
84 arg_type = METHOD_GET_NEXT_TYPE(arg_type_list);
85 user_arg_type = info->parameters[i]->common.type;
86
87 if (user_arg_type != arg_type) {
88 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
89 ACPI_WARN_ALWAYS,
90 "Argument #%u type mismatch - "
91 "Found [%s], ACPI requires [%s]",
92 (i + 1),
93 acpi_ut_get_type_name
94 (user_arg_type),
95 acpi_ut_get_type_name(arg_type)));
96 }
97 }
98}
99
100/*******************************************************************************
101 *
102 * FUNCTION: acpi_ns_check_acpi_compliance
103 *
104 * PARAMETERS: pathname - Full pathname to the node (for error msgs)
105 * node - Namespace node for the method/object
106 * predefined - Pointer to entry in predefined name table
107 *
108 * RETURN: None
109 *
110 * DESCRIPTION: Check that the declared parameter count (in ASL/AML) for a
111 * predefined name is what is expected (matches what is defined in
112 * the ACPI specification for this predefined name.)
113 *
114 ******************************************************************************/
115
116void
117acpi_ns_check_acpi_compliance(char *pathname,
118 struct acpi_namespace_node *node,
119 const union acpi_predefined_info *predefined)
120{
121 u32 aml_param_count;
122 u32 required_param_count;
123
124 if (!predefined) {
125 return;
126 }
127
128 /* Get the ACPI-required arg count from the predefined info table */
129
130 required_param_count =
131 METHOD_GET_ARG_COUNT(predefined->info.argument_list);
132
133 /*
134 * If this object is not a control method, we can check if the ACPI
135 * spec requires that it be a method.
136 */
137 if (node->type != ACPI_TYPE_METHOD) {
138 if (required_param_count > 0) {
139
140 /* Object requires args, must be implemented as a method */
141
142 ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname,
143 ACPI_WARN_ALWAYS,
144 "Object (%s) must be a control method with %u arguments",
145 acpi_ut_get_type_name(node->
146 type),
147 required_param_count));
148 } else if (!required_param_count
149 && !predefined->info.expected_btypes) {
150
151 /* Object requires no args and no return value, must be a method */
152
153 ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname,
154 ACPI_WARN_ALWAYS,
155 "Object (%s) must be a control method "
156 "with no arguments and no return value",
157 acpi_ut_get_type_name(node->
158 type)));
159 }
160
161 return;
162 }
163
164 /*
165 * This is a control method.
166 * Check that the ASL/AML-defined parameter count for this method
167 * matches the ACPI-required parameter count
168 *
169 * Some methods are allowed to have a "minimum" number of args (_SCP)
170 * because their definition in ACPI has changed over time.
171 *
172 * Note: These are BIOS errors in the declaration of the object
173 */
174 aml_param_count = node->object->method.param_count;
175
176 if (aml_param_count < required_param_count) {
177 ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
178 "Insufficient arguments - "
179 "ASL declared %u, ACPI requires %u",
180 aml_param_count,
181 required_param_count));
182 } else if ((aml_param_count > required_param_count)
183 && !(predefined->info.
184 argument_list & ARG_COUNT_IS_MINIMUM)) {
185 ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
186 "Excess arguments - "
187 "ASL declared %u, ACPI requires %u",
188 aml_param_count,
189 required_param_count));
190 }
191}
192
193/*******************************************************************************
194 *
195 * FUNCTION: acpi_ns_check_argument_count
196 *
197 * PARAMETERS: pathname - Full pathname to the node (for error msgs)
198 * node - Namespace node for the method/object
199 * user_param_count - Number of args passed in by the caller
200 * predefined - Pointer to entry in predefined name table
201 *
202 * RETURN: None
203 *
204 * DESCRIPTION: Check that incoming argument count matches the declared
205 * parameter count (in the ASL/AML) for an object.
206 *
207 ******************************************************************************/
208
209void
210acpi_ns_check_argument_count(char *pathname,
211 struct acpi_namespace_node *node,
212 u32 user_param_count,
213 const union acpi_predefined_info *predefined)
214{
215 u32 aml_param_count;
216 u32 required_param_count;
217
218 if (!predefined) {
219 /*
220 * Not a predefined name. Check the incoming user argument count
221 * against the count that is specified in the method/object.
222 */
223 if (node->type != ACPI_TYPE_METHOD) {
224 if (user_param_count) {
225 ACPI_INFO_PREDEFINED((AE_INFO, pathname,
226 ACPI_WARN_ALWAYS,
227 "%u arguments were passed to a non-method ACPI object (%s)",
228 user_param_count,
229 acpi_ut_get_type_name
230 (node->type)));
231 }
232
233 return;
234 }
235
236 /*
237 * This is a control method. Check the parameter count.
238 * We can only check the incoming argument count against the
239 * argument count declared for the method in the ASL/AML.
240 *
241 * Emit a message if too few or too many arguments have been passed
242 * by the caller.
243 *
244 * Note: Too many arguments will not cause the method to
245 * fail. However, the method will fail if there are too few
246 * arguments and the method attempts to use one of the missing ones.
247 */
248 aml_param_count = node->object->method.param_count;
249
250 if (user_param_count < aml_param_count) {
251 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
252 ACPI_WARN_ALWAYS,
253 "Insufficient arguments - "
254 "Caller passed %u, method requires %u",
255 user_param_count,
256 aml_param_count));
257 } else if (user_param_count > aml_param_count) {
258 ACPI_INFO_PREDEFINED((AE_INFO, pathname,
259 ACPI_WARN_ALWAYS,
260 "Excess arguments - "
261 "Caller passed %u, method requires %u",
262 user_param_count,
263 aml_param_count));
264 }
265
266 return;
267 }
268
269 /*
270 * This is a predefined name. Validate the user-supplied parameter
271 * count against the ACPI specification. We don't validate against
272 * the method itself because what is important here is that the
273 * caller is in conformance with the spec. (The arg count for the
274 * method was checked against the ACPI spec earlier.)
275 *
276 * Some methods are allowed to have a "minimum" number of args (_SCP)
277 * because their definition in ACPI has changed over time.
278 */
279 required_param_count =
280 METHOD_GET_ARG_COUNT(predefined->info.argument_list);
281
282 if (user_param_count < required_param_count) {
283 ACPI_WARN_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
284 "Insufficient arguments - "
285 "Caller passed %u, ACPI requires %u",
286 user_param_count, required_param_count));
287 } else if ((user_param_count > required_param_count) &&
288 !(predefined->info.argument_list & ARG_COUNT_IS_MINIMUM)) {
289 ACPI_INFO_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
290 "Excess arguments - "
291 "Caller passed %u, ACPI requires %u",
292 user_param_count, required_param_count));
293 }
294}
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index b61db69d5675..18108bc2e51c 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -61,7 +61,7 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
61 * 61 *
62 * PARAMETERS: info - Evaluation info block, contains: 62 * PARAMETERS: info - Evaluation info block, contains:
63 * prefix_node - Prefix or Method/Object Node to execute 63 * prefix_node - Prefix or Method/Object Node to execute
64 * pathname - Name of method to execute, If NULL, the 64 * relative_path - Name of method to execute, If NULL, the
65 * Node is the object to execute 65 * Node is the object to execute
66 * parameters - List of parameters to pass to the method, 66 * parameters - List of parameters to pass to the method,
67 * terminated by NULL. Params itself may be 67 * terminated by NULL. Params itself may be
@@ -82,10 +82,9 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
82 * 82 *
83 ******************************************************************************/ 83 ******************************************************************************/
84 84
85acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) 85acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
86{ 86{
87 acpi_status status; 87 acpi_status status;
88 struct acpi_namespace_node *node;
89 88
90 ACPI_FUNCTION_TRACE(ns_evaluate); 89 ACPI_FUNCTION_TRACE(ns_evaluate);
91 90
@@ -93,83 +92,138 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
93 return_ACPI_STATUS(AE_BAD_PARAMETER); 92 return_ACPI_STATUS(AE_BAD_PARAMETER);
94 } 93 }
95 94
96 /* Initialize the return value to an invalid object */ 95 if (!info->node) {
97
98 info->return_object = NULL;
99 info->param_count = 0;
100
101 if (!info->resolved_node) {
102 /* 96 /*
103 * Get the actual namespace node for the target object if we need to. 97 * Get the actual namespace node for the target object if we
104 * Handles these cases: 98 * need to. Handles these cases:
105 * 99 *
106 * 1) Null node, Pathname (absolute path) 100 * 1) Null node, valid pathname from root (absolute path)
107 * 2) Node, Pathname (path relative to Node) 101 * 2) Node and valid pathname (path relative to Node)
108 * 3) Node, Null Pathname 102 * 3) Node, Null pathname
109 */ 103 */
110 status = acpi_ns_get_node(info->prefix_node, info->pathname, 104 status =
111 ACPI_NS_NO_UPSEARCH, 105 acpi_ns_get_node(info->prefix_node, info->relative_pathname,
112 &info->resolved_node); 106 ACPI_NS_NO_UPSEARCH, &info->node);
113 if (ACPI_FAILURE(status)) { 107 if (ACPI_FAILURE(status)) {
114 return_ACPI_STATUS(status); 108 return_ACPI_STATUS(status);
115 } 109 }
116 } 110 }
117 111
118 /* 112 /*
119 * For a method alias, we must grab the actual method node so that proper 113 * For a method alias, we must grab the actual method node so that
120 * scoping context will be established before execution. 114 * proper scoping context will be established before execution.
121 */ 115 */
122 if (acpi_ns_get_type(info->resolved_node) == 116 if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
123 ACPI_TYPE_LOCAL_METHOD_ALIAS) { 117 info->node =
124 info->resolved_node =
125 ACPI_CAST_PTR(struct acpi_namespace_node, 118 ACPI_CAST_PTR(struct acpi_namespace_node,
126 info->resolved_node->object); 119 info->node->object);
120 }
121
122 /* Complete the info block initialization */
123
124 info->return_object = NULL;
125 info->node_flags = info->node->flags;
126 info->obj_desc = acpi_ns_get_attached_object(info->node);
127
128 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
129 info->relative_pathname, info->node,
130 acpi_ns_get_attached_object(info->node)));
131
132 /* Get info if we have a predefined name (_HID, etc.) */
133
134 info->predefined =
135 acpi_ut_match_predefined_method(info->node->name.ascii);
136
137 /* Get the full pathname to the object, for use in warning messages */
138
139 info->full_pathname = acpi_ns_get_external_pathname(info->node);
140 if (!info->full_pathname) {
141 return_ACPI_STATUS(AE_NO_MEMORY);
127 } 142 }
128 143
129 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname, 144 /* Count the number of arguments being passed in */
130 info->resolved_node, 145
131 acpi_ns_get_attached_object(info->resolved_node))); 146 info->param_count = 0;
147 if (info->parameters) {
148 while (info->parameters[info->param_count]) {
149 info->param_count++;
150 }
151
152 /* Warn on impossible argument count */
153
154 if (info->param_count > ACPI_METHOD_NUM_ARGS) {
155 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
156 ACPI_WARN_ALWAYS,
157 "Excess arguments (%u) - using only %u",
158 info->param_count,
159 ACPI_METHOD_NUM_ARGS));
160
161 info->param_count = ACPI_METHOD_NUM_ARGS;
162 }
163 }
164
165 /*
166 * For predefined names: Check that the declared argument count
167 * matches the ACPI spec -- otherwise this is a BIOS error.
168 */
169 acpi_ns_check_acpi_compliance(info->full_pathname, info->node,
170 info->predefined);
171
172 /*
173 * For all names: Check that the incoming argument count for
174 * this method/object matches the actual ASL/AML definition.
175 */
176 acpi_ns_check_argument_count(info->full_pathname, info->node,
177 info->param_count, info->predefined);
132 178
133 node = info->resolved_node; 179 /* For predefined names: Typecheck all incoming arguments */
180
181 acpi_ns_check_argument_types(info);
134 182
135 /* 183 /*
136 * Two major cases here: 184 * Three major evaluation cases:
137 * 185 *
138 * 1) The object is a control method -- execute it 186 * 1) Object types that cannot be evaluated by definition
139 * 2) The object is not a method -- just return it's current value 187 * 2) The object is a control method -- execute it
188 * 3) The object is not a method -- just return it's current value
140 */ 189 */
141 if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) { 190 switch (acpi_ns_get_type(info->node)) {
191 case ACPI_TYPE_DEVICE:
192 case ACPI_TYPE_EVENT:
193 case ACPI_TYPE_MUTEX:
194 case ACPI_TYPE_REGION:
195 case ACPI_TYPE_THERMAL:
196 case ACPI_TYPE_LOCAL_SCOPE:
197 /*
198 * 1) Disallow evaluation of certain object types. For these,
199 * object evaluation is undefined and not supported.
200 */
201 ACPI_ERROR((AE_INFO,
202 "%s: Evaluation of object type [%s] is not supported",
203 info->full_pathname,
204 acpi_ut_get_type_name(info->node->type)));
205
206 status = AE_TYPE;
207 goto cleanup;
208
209 case ACPI_TYPE_METHOD:
142 /* 210 /*
143 * 1) Object is a control method - execute it 211 * 2) Object is a control method - execute it
144 */ 212 */
145 213
146 /* Verify that there is a method object associated with this node */ 214 /* Verify that there is a method object associated with this node */
147 215
148 info->obj_desc =
149 acpi_ns_get_attached_object(info->resolved_node);
150 if (!info->obj_desc) { 216 if (!info->obj_desc) {
151 ACPI_ERROR((AE_INFO, 217 ACPI_ERROR((AE_INFO,
152 "Control method has no attached sub-object")); 218 "%s: Method has no attached sub-object",
153 return_ACPI_STATUS(AE_NULL_OBJECT); 219 info->full_pathname));
220 status = AE_NULL_OBJECT;
221 goto cleanup;
154 } 222 }
155 223
156 /* Count the number of arguments being passed to the method */
157
158 if (info->parameters) {
159 while (info->parameters[info->param_count]) {
160 if (info->param_count > ACPI_METHOD_MAX_ARG) {
161 return_ACPI_STATUS(AE_LIMIT);
162 }
163 info->param_count++;
164 }
165 }
166
167
168 ACPI_DUMP_PATHNAME(info->resolved_node, "ACPI: Execute Method",
169 ACPI_LV_INFO, _COMPONENT);
170
171 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 224 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
172 "Method at AML address %p Length %X\n", 225 "**** Execute method [%s] at AML address %p length %X\n",
226 info->full_pathname,
173 info->obj_desc->method.aml_start + 1, 227 info->obj_desc->method.aml_start + 1,
174 info->obj_desc->method.aml_length - 1)); 228 info->obj_desc->method.aml_length - 1));
175 229
@@ -184,81 +238,61 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
184 acpi_ex_enter_interpreter(); 238 acpi_ex_enter_interpreter();
185 status = acpi_ps_execute_method(info); 239 status = acpi_ps_execute_method(info);
186 acpi_ex_exit_interpreter(); 240 acpi_ex_exit_interpreter();
187 } else { 241 break;
242
243 default:
188 /* 244 /*
189 * 2) Object is not a method, return its current value 245 * 3) All other non-method objects -- get the current object value
190 *
191 * Disallow certain object types. For these, "evaluation" is undefined.
192 */ 246 */
193 switch (info->resolved_node->type) {
194 case ACPI_TYPE_DEVICE:
195 case ACPI_TYPE_EVENT:
196 case ACPI_TYPE_MUTEX:
197 case ACPI_TYPE_REGION:
198 case ACPI_TYPE_THERMAL:
199 case ACPI_TYPE_LOCAL_SCOPE:
200
201 ACPI_ERROR((AE_INFO,
202 "[%4.4s] Evaluation of object type [%s] is not supported",
203 info->resolved_node->name.ascii,
204 acpi_ut_get_type_name(info->resolved_node->
205 type)));
206
207 return_ACPI_STATUS(AE_TYPE);
208
209 default:
210 break;
211 }
212 247
213 /* 248 /*
214 * Objects require additional resolution steps (e.g., the Node may be 249 * Some objects require additional resolution steps (e.g., the Node
215 * a field that must be read, etc.) -- we can't just grab the object 250 * may be a field that must be read, etc.) -- we can't just grab
216 * out of the node. 251 * the object out of the node.
217 * 252 *
218 * Use resolve_node_to_value() to get the associated value. 253 * Use resolve_node_to_value() to get the associated value.
219 * 254 *
220 * NOTE: we can get away with passing in NULL for a walk state because 255 * NOTE: we can get away with passing in NULL for a walk state because
221 * resolved_node is guaranteed to not be a reference to either a method 256 * the Node is guaranteed to not be a reference to either a method
222 * local or a method argument (because this interface is never called 257 * local or a method argument (because this interface is never called
223 * from a running method.) 258 * from a running method.)
224 * 259 *
225 * Even though we do not directly invoke the interpreter for object 260 * Even though we do not directly invoke the interpreter for object
226 * resolution, we must lock it because we could access an opregion. 261 * resolution, we must lock it because we could access an op_region.
227 * The opregion access code assumes that the interpreter is locked. 262 * The op_region access code assumes that the interpreter is locked.
228 */ 263 */
229 acpi_ex_enter_interpreter(); 264 acpi_ex_enter_interpreter();
230 265
231 /* Function has a strange interface */ 266 /* TBD: resolve_node_to_value has a strange interface, fix */
267
268 info->return_object =
269 ACPI_CAST_PTR(union acpi_operand_object, info->node);
232 270
233 status = 271 status =
234 acpi_ex_resolve_node_to_value(&info->resolved_node, NULL); 272 acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
273 (struct acpi_namespace_node,
274 &info->return_object), NULL);
235 acpi_ex_exit_interpreter(); 275 acpi_ex_exit_interpreter();
236 276
237 /* 277 if (ACPI_FAILURE(status)) {
238 * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed 278 goto cleanup;
239 * in resolved_node.
240 */
241 if (ACPI_SUCCESS(status)) {
242 status = AE_CTRL_RETURN_VALUE;
243 info->return_object =
244 ACPI_CAST_PTR(union acpi_operand_object,
245 info->resolved_node);
246
247 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
248 "Returning object %p [%s]\n",
249 info->return_object,
250 acpi_ut_get_object_type_name(info->
251 return_object)));
252 } 279 }
280
281 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Returned object %p [%s]\n",
282 info->return_object,
283 acpi_ut_get_object_type_name(info->
284 return_object)));
285
286 status = AE_CTRL_RETURN_VALUE; /* Always has a "return value" */
287 break;
253 } 288 }
254 289
255 /* 290 /*
256 * Check input argument count against the ASL-defined count for a method. 291 * For predefined names, check the return value against the ACPI
257 * Also check predefined names: argument count and return value against 292 * specification. Some incorrect return value types are repaired.
258 * the ACPI specification. Some incorrect return value types are repaired.
259 */ 293 */
260 (void)acpi_ns_check_predefined_names(node, info->param_count, 294 (void)acpi_ns_check_return_value(info->node, info, info->param_count,
261 status, &info->return_object); 295 status, &info->return_object);
262 296
263 /* Check if there is a return value that must be dealt with */ 297 /* Check if there is a return value that must be dealt with */
264 298
@@ -278,12 +312,15 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
278 312
279 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 313 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
280 "*** Completed evaluation of object %s ***\n", 314 "*** Completed evaluation of object %s ***\n",
281 info->pathname)); 315 info->relative_pathname));
282 316
317 cleanup:
283 /* 318 /*
284 * Namespace was unlocked by the handling acpi_ns* function, so we 319 * Namespace was unlocked by the handling acpi_ns* function, so we
285 * just return 320 * just free the pathname and return
286 */ 321 */
322 ACPI_FREE(info->full_pathname);
323 info->full_pathname = NULL;
287 return_ACPI_STATUS(status); 324 return_ACPI_STATUS(status);
288} 325}
289 326
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 46f0f83417a1..23e426f7fd1a 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -176,7 +176,7 @@ acpi_status acpi_ns_initialize_devices(void)
176 * part of the ACPI specification. 176 * part of the ACPI specification.
177 */ 177 */
178 info.evaluate_info->prefix_node = acpi_gbl_root_node; 178 info.evaluate_info->prefix_node = acpi_gbl_root_node;
179 info.evaluate_info->pathname = METHOD_NAME__INI; 179 info.evaluate_info->relative_pathname = METHOD_NAME__INI;
180 info.evaluate_info->parameters = NULL; 180 info.evaluate_info->parameters = NULL;
181 info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE; 181 info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
182 182
@@ -560,7 +560,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
560 560
561 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info)); 561 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
562 info->prefix_node = device_node; 562 info->prefix_node = device_node;
563 info->pathname = METHOD_NAME__INI; 563 info->relative_pathname = METHOD_NAME__INI;
564 info->parameters = NULL; 564 info->parameters = NULL;
565 info->flags = ACPI_IGNORE_RETURN_VALUE; 565 info->flags = ACPI_IGNORE_RETURN_VALUE;
566 566
@@ -574,8 +574,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
574 574
575 /* Ignore error and move on to next device */ 575 /* Ignore error and move on to next device */
576 576
577 char *scope_name = 577 char *scope_name = acpi_ns_get_external_pathname(info->node);
578 acpi_ns_get_external_pathname(info->resolved_node);
579 578
580 ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", 579 ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
581 scope_name)); 580 scope_name));
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 8a52916148cb..7ab7ddbe3ded 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -61,28 +61,29 @@ ACPI_MODULE_NAME("nspredef")
61 * There are several areas that are validated: 61 * There are several areas that are validated:
62 * 62 *
63 * 1) The number of input arguments as defined by the method/object in the 63 * 1) The number of input arguments as defined by the method/object in the
64 * ASL is validated against the ACPI specification. 64 * ASL is validated against the ACPI specification.
65 * 2) The type of the return object (if any) is validated against the ACPI 65 * 2) The type of the return object (if any) is validated against the ACPI
66 * specification. 66 * specification.
67 * 3) For returned package objects, the count of package elements is 67 * 3) For returned package objects, the count of package elements is
68 * validated, as well as the type of each package element. Nested 68 * validated, as well as the type of each package element. Nested
69 * packages are supported. 69 * packages are supported.
70 * 70 *
71 * For any problems found, a warning message is issued. 71 * For any problems found, a warning message is issued.
72 * 72 *
73 ******************************************************************************/ 73 ******************************************************************************/
74/* Local prototypes */ 74/* Local prototypes */
75static acpi_status 75static acpi_status
76acpi_ns_check_reference(struct acpi_predefined_data *data, 76acpi_ns_check_reference(struct acpi_evaluate_info *info,
77 union acpi_operand_object *return_object); 77 union acpi_operand_object *return_object);
78 78
79static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object); 79static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object);
80 80
81/******************************************************************************* 81/*******************************************************************************
82 * 82 *
83 * FUNCTION: acpi_ns_check_predefined_names 83 * FUNCTION: acpi_ns_check_return_value
84 * 84 *
85 * PARAMETERS: node - Namespace node for the method/object 85 * PARAMETERS: node - Namespace node for the method/object
86 * info - Method execution information block
86 * user_param_count - Number of parameters actually passed 87 * user_param_count - Number of parameters actually passed
87 * return_status - Status from the object evaluation 88 * return_status - Status from the object evaluation
88 * return_object_ptr - Pointer to the object returned from the 89 * return_object_ptr - Pointer to the object returned from the
@@ -90,44 +91,28 @@ static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object);
90 * 91 *
91 * RETURN: Status 92 * RETURN: Status
92 * 93 *
93 * DESCRIPTION: Check an ACPI name for a match in the predefined name list. 94 * DESCRIPTION: Check the value returned from a predefined name.
94 * 95 *
95 ******************************************************************************/ 96 ******************************************************************************/
96 97
97acpi_status 98acpi_status
98acpi_ns_check_predefined_names(struct acpi_namespace_node *node, 99acpi_ns_check_return_value(struct acpi_namespace_node *node,
99 u32 user_param_count, 100 struct acpi_evaluate_info *info,
100 acpi_status return_status, 101 u32 user_param_count,
101 union acpi_operand_object **return_object_ptr) 102 acpi_status return_status,
103 union acpi_operand_object **return_object_ptr)
102{ 104{
103 acpi_status status = AE_OK; 105 acpi_status status;
104 const union acpi_predefined_info *predefined; 106 const union acpi_predefined_info *predefined;
105 char *pathname; 107 char *pathname;
106 struct acpi_predefined_data *data;
107
108 /* Match the name for this method/object against the predefined list */
109
110 predefined = acpi_ut_match_predefined_method(node->name.ascii);
111 108
112 /* Get the full pathname to the object, for use in warning messages */ 109 predefined = info->predefined;
113 110 pathname = info->full_pathname;
114 pathname = acpi_ns_get_external_pathname(node);
115 if (!pathname) {
116 return (AE_OK); /* Could not get pathname, ignore */
117 }
118
119 /*
120 * Check that the parameter count for this method matches the ASL
121 * definition. For predefined names, ensure that both the caller and
122 * the method itself are in accordance with the ACPI specification.
123 */
124 acpi_ns_check_parameter_count(pathname, node, user_param_count,
125 predefined);
126 111
127 /* If not a predefined name, we cannot validate the return object */ 112 /* If not a predefined name, we cannot validate the return object */
128 113
129 if (!predefined) { 114 if (!predefined) {
130 goto cleanup; 115 return (AE_OK);
131 } 116 }
132 117
133 /* 118 /*
@@ -135,7 +120,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
135 * validate the return object 120 * validate the return object
136 */ 121 */
137 if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { 122 if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
138 goto cleanup; 123 return (AE_OK);
139 } 124 }
140 125
141 /* 126 /*
@@ -154,25 +139,14 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
154 if (acpi_gbl_disable_auto_repair || 139 if (acpi_gbl_disable_auto_repair ||
155 (!predefined->info.expected_btypes) || 140 (!predefined->info.expected_btypes) ||
156 (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) { 141 (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) {
157 goto cleanup; 142 return (AE_OK);
158 }
159
160 /* Create the parameter data block for object validation */
161
162 data = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_predefined_data));
163 if (!data) {
164 goto cleanup;
165 } 143 }
166 data->predefined = predefined;
167 data->node = node;
168 data->node_flags = node->flags;
169 data->pathname = pathname;
170 144
171 /* 145 /*
172 * Check that the type of the main return object is what is expected 146 * Check that the type of the main return object is what is expected
173 * for this predefined name 147 * for this predefined name
174 */ 148 */
175 status = acpi_ns_check_object_type(data, return_object_ptr, 149 status = acpi_ns_check_object_type(info, return_object_ptr,
176 predefined->info.expected_btypes, 150 predefined->info.expected_btypes,
177 ACPI_NOT_PACKAGE_ELEMENT); 151 ACPI_NOT_PACKAGE_ELEMENT);
178 if (ACPI_FAILURE(status)) { 152 if (ACPI_FAILURE(status)) {
@@ -184,8 +158,8 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
184 * Note: Package may have been newly created by call above. 158 * Note: Package may have been newly created by call above.
185 */ 159 */
186 if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { 160 if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) {
187 data->parent_package = *return_object_ptr; 161 info->parent_package = *return_object_ptr;
188 status = acpi_ns_check_package(data, return_object_ptr); 162 status = acpi_ns_check_package(info, return_object_ptr);
189 if (ACPI_FAILURE(status)) { 163 if (ACPI_FAILURE(status)) {
190 goto exit; 164 goto exit;
191 } 165 }
@@ -199,7 +173,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
199 * performed on a per-name basis, i.e., the code is specific to 173 * performed on a per-name basis, i.e., the code is specific to
200 * particular predefined names. 174 * particular predefined names.
201 */ 175 */
202 status = acpi_ns_complex_repairs(data, node, status, return_object_ptr); 176 status = acpi_ns_complex_repairs(info, node, status, return_object_ptr);
203 177
204exit: 178exit:
205 /* 179 /*
@@ -207,112 +181,18 @@ exit:
207 * or more objects, mark the parent node to suppress further warning 181 * or more objects, mark the parent node to suppress further warning
208 * messages during the next evaluation of the same method/object. 182 * messages during the next evaluation of the same method/object.
209 */ 183 */
210 if (ACPI_FAILURE(status) || (data->flags & ACPI_OBJECT_REPAIRED)) { 184 if (ACPI_FAILURE(status) || (info->return_flags & ACPI_OBJECT_REPAIRED)) {
211 node->flags |= ANOBJ_EVALUATED; 185 node->flags |= ANOBJ_EVALUATED;
212 } 186 }
213 ACPI_FREE(data);
214 187
215cleanup:
216 ACPI_FREE(pathname);
217 return (status); 188 return (status);
218} 189}
219 190
220/******************************************************************************* 191/*******************************************************************************
221 * 192 *
222 * FUNCTION: acpi_ns_check_parameter_count
223 *
224 * PARAMETERS: pathname - Full pathname to the node (for error msgs)
225 * node - Namespace node for the method/object
226 * user_param_count - Number of args passed in by the caller
227 * predefined - Pointer to entry in predefined name table
228 *
229 * RETURN: None
230 *
231 * DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a
232 * predefined name is what is expected (i.e., what is defined in
233 * the ACPI specification for this predefined name.)
234 *
235 ******************************************************************************/
236
237void
238acpi_ns_check_parameter_count(char *pathname,
239 struct acpi_namespace_node *node,
240 u32 user_param_count,
241 const union acpi_predefined_info *predefined)
242{
243 u32 param_count;
244 u32 required_params_current;
245 u32 required_params_old;
246
247 /* Methods have 0-7 parameters. All other types have zero. */
248
249 param_count = 0;
250 if (node->type == ACPI_TYPE_METHOD) {
251 param_count = node->object->method.param_count;
252 }
253
254 if (!predefined) {
255 /*
256 * Check the parameter count for non-predefined methods/objects.
257 *
258 * Warning if too few or too many arguments have been passed by the
259 * caller. An incorrect number of arguments may not cause the method
260 * to fail. However, the method will fail if there are too few
261 * arguments and the method attempts to use one of the missing ones.
262 */
263 if (user_param_count < param_count) {
264 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
265 ACPI_WARN_ALWAYS,
266 "Insufficient arguments - needs %u, found %u",
267 param_count, user_param_count));
268 } else if (user_param_count > param_count) {
269 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
270 ACPI_WARN_ALWAYS,
271 "Excess arguments - needs %u, found %u",
272 param_count, user_param_count));
273 }
274 return;
275 }
276
277 /*
278 * Validate the user-supplied parameter count.
279 * Allow two different legal argument counts (_SCP, etc.)
280 */
281 required_params_current =
282 predefined->info.argument_list & METHOD_ARG_MASK;
283 required_params_old =
284 predefined->info.argument_list >> METHOD_ARG_BIT_WIDTH;
285
286 if (user_param_count != ACPI_UINT32_MAX) {
287 if ((user_param_count != required_params_current) &&
288 (user_param_count != required_params_old)) {
289 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
290 ACPI_WARN_ALWAYS,
291 "Parameter count mismatch - "
292 "caller passed %u, ACPI requires %u",
293 user_param_count,
294 required_params_current));
295 }
296 }
297
298 /*
299 * Check that the ASL-defined parameter count is what is expected for
300 * this predefined name (parameter count as defined by the ACPI
301 * specification)
302 */
303 if ((param_count != required_params_current) &&
304 (param_count != required_params_old)) {
305 ACPI_WARN_PREDEFINED((AE_INFO, pathname, node->flags,
306 "Parameter count mismatch - ASL declared %u, ACPI requires %u",
307 param_count, required_params_current));
308 }
309}
310
311/*******************************************************************************
312 *
313 * FUNCTION: acpi_ns_check_object_type 193 * FUNCTION: acpi_ns_check_object_type
314 * 194 *
315 * PARAMETERS: data - Pointer to validation data structure 195 * PARAMETERS: info - Method execution information block
316 * return_object_ptr - Pointer to the object returned from the 196 * return_object_ptr - Pointer to the object returned from the
317 * evaluation of a method or object 197 * evaluation of a method or object
318 * expected_btypes - Bitmap of expected return type(s) 198 * expected_btypes - Bitmap of expected return type(s)
@@ -328,7 +208,7 @@ acpi_ns_check_parameter_count(char *pathname,
328 ******************************************************************************/ 208 ******************************************************************************/
329 209
330acpi_status 210acpi_status
331acpi_ns_check_object_type(struct acpi_predefined_data *data, 211acpi_ns_check_object_type(struct acpi_evaluate_info *info,
332 union acpi_operand_object **return_object_ptr, 212 union acpi_operand_object **return_object_ptr,
333 u32 expected_btypes, u32 package_index) 213 u32 expected_btypes, u32 package_index)
334{ 214{
@@ -340,7 +220,8 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
340 220
341 if (return_object && 221 if (return_object &&
342 ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) { 222 ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
343 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 223 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
224 info->node_flags,
344 "Invalid return type - Found a Namespace node [%4.4s] type %s", 225 "Invalid return type - Found a Namespace node [%4.4s] type %s",
345 return_object->node.name.ascii, 226 return_object->node.name.ascii,
346 acpi_ut_get_type_name(return_object->node. 227 acpi_ut_get_type_name(return_object->node.
@@ -356,8 +237,8 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
356 * from all of the predefined names (including elements of returned 237 * from all of the predefined names (including elements of returned
357 * packages) 238 * packages)
358 */ 239 */
359 data->return_btype = acpi_ns_get_bitmapped_type(return_object); 240 info->return_btype = acpi_ns_get_bitmapped_type(return_object);
360 if (data->return_btype == ACPI_RTYPE_ANY) { 241 if (info->return_btype == ACPI_RTYPE_ANY) {
361 242
362 /* Not one of the supported objects, must be incorrect */ 243 /* Not one of the supported objects, must be incorrect */
363 goto type_error_exit; 244 goto type_error_exit;
@@ -365,16 +246,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
365 246
366 /* For reference objects, check that the reference type is correct */ 247 /* For reference objects, check that the reference type is correct */
367 248
368 if ((data->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) { 249 if ((info->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) {
369 status = acpi_ns_check_reference(data, return_object); 250 status = acpi_ns_check_reference(info, return_object);
370 return (status); 251 return (status);
371 } 252 }
372 253
373 /* Attempt simple repair of the returned object if necessary */ 254 /* Attempt simple repair of the returned object if necessary */
374 255
375 status = acpi_ns_simple_repair(data, expected_btypes, 256 status = acpi_ns_simple_repair(info, expected_btypes,
376 package_index, return_object_ptr); 257 package_index, return_object_ptr);
377 return (status); 258 if (ACPI_SUCCESS(status)) {
259 return (AE_OK); /* Successful repair */
260 }
378 261
379 type_error_exit: 262 type_error_exit:
380 263
@@ -383,12 +266,14 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
383 acpi_ut_get_expected_return_types(type_buffer, expected_btypes); 266 acpi_ut_get_expected_return_types(type_buffer, expected_btypes);
384 267
385 if (package_index == ACPI_NOT_PACKAGE_ELEMENT) { 268 if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
386 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 269 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
270 info->node_flags,
387 "Return type mismatch - found %s, expected %s", 271 "Return type mismatch - found %s, expected %s",
388 acpi_ut_get_object_type_name 272 acpi_ut_get_object_type_name
389 (return_object), type_buffer)); 273 (return_object), type_buffer));
390 } else { 274 } else {
391 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 275 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
276 info->node_flags,
392 "Return Package type mismatch at index %u - " 277 "Return Package type mismatch at index %u - "
393 "found %s, expected %s", package_index, 278 "found %s, expected %s", package_index,
394 acpi_ut_get_object_type_name 279 acpi_ut_get_object_type_name
@@ -402,7 +287,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
402 * 287 *
403 * FUNCTION: acpi_ns_check_reference 288 * FUNCTION: acpi_ns_check_reference
404 * 289 *
405 * PARAMETERS: data - Pointer to validation data structure 290 * PARAMETERS: info - Method execution information block
406 * return_object - Object returned from the evaluation of a 291 * return_object - Object returned from the evaluation of a
407 * method or object 292 * method or object
408 * 293 *
@@ -415,7 +300,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
415 ******************************************************************************/ 300 ******************************************************************************/
416 301
417static acpi_status 302static acpi_status
418acpi_ns_check_reference(struct acpi_predefined_data *data, 303acpi_ns_check_reference(struct acpi_evaluate_info *info,
419 union acpi_operand_object *return_object) 304 union acpi_operand_object *return_object)
420{ 305{
421 306
@@ -428,7 +313,7 @@ acpi_ns_check_reference(struct acpi_predefined_data *data,
428 return (AE_OK); 313 return (AE_OK);
429 } 314 }
430 315
431 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 316 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
432 "Return type mismatch - unexpected reference object type [%s] %2.2X", 317 "Return type mismatch - unexpected reference object type [%s] %2.2X",
433 acpi_ut_get_reference_name(return_object), 318 acpi_ut_get_reference_name(return_object),
434 return_object->reference.class)); 319 return_object->reference.class));
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c
index 77cdd539de16..ab2a3f477e1e 100644
--- a/drivers/acpi/acpica/nsprepkg.c
+++ b/drivers/acpi/acpica/nsprepkg.c
@@ -51,12 +51,12 @@ ACPI_MODULE_NAME("nsprepkg")
51 51
52/* Local prototypes */ 52/* Local prototypes */
53static acpi_status 53static acpi_status
54acpi_ns_check_package_list(struct acpi_predefined_data *data, 54acpi_ns_check_package_list(struct acpi_evaluate_info *info,
55 const union acpi_predefined_info *package, 55 const union acpi_predefined_info *package,
56 union acpi_operand_object **elements, u32 count); 56 union acpi_operand_object **elements, u32 count);
57 57
58static acpi_status 58static acpi_status
59acpi_ns_check_package_elements(struct acpi_predefined_data *data, 59acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
60 union acpi_operand_object **elements, 60 union acpi_operand_object **elements,
61 u8 type1, 61 u8 type1,
62 u32 count1, 62 u32 count1,
@@ -66,7 +66,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
66 * 66 *
67 * FUNCTION: acpi_ns_check_package 67 * FUNCTION: acpi_ns_check_package
68 * 68 *
69 * PARAMETERS: data - Pointer to validation data structure 69 * PARAMETERS: info - Method execution information block
70 * return_object_ptr - Pointer to the object returned from the 70 * return_object_ptr - Pointer to the object returned from the
71 * evaluation of a method or object 71 * evaluation of a method or object
72 * 72 *
@@ -78,7 +78,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
78 ******************************************************************************/ 78 ******************************************************************************/
79 79
80acpi_status 80acpi_status
81acpi_ns_check_package(struct acpi_predefined_data *data, 81acpi_ns_check_package(struct acpi_evaluate_info *info,
82 union acpi_operand_object **return_object_ptr) 82 union acpi_operand_object **return_object_ptr)
83{ 83{
84 union acpi_operand_object *return_object = *return_object_ptr; 84 union acpi_operand_object *return_object = *return_object_ptr;
@@ -93,18 +93,18 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
93 93
94 /* The package info for this name is in the next table entry */ 94 /* The package info for this name is in the next table entry */
95 95
96 package = data->predefined + 1; 96 package = info->predefined + 1;
97 97
98 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 98 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
99 "%s Validating return Package of Type %X, Count %X\n", 99 "%s Validating return Package of Type %X, Count %X\n",
100 data->pathname, package->ret_info.type, 100 info->full_pathname, package->ret_info.type,
101 return_object->package.count)); 101 return_object->package.count));
102 102
103 /* 103 /*
104 * For variable-length Packages, we can safely remove all embedded 104 * For variable-length Packages, we can safely remove all embedded
105 * and trailing NULL package elements 105 * and trailing NULL package elements
106 */ 106 */
107 acpi_ns_remove_null_elements(data, package->ret_info.type, 107 acpi_ns_remove_null_elements(info, package->ret_info.type,
108 return_object); 108 return_object);
109 109
110 /* Extract package count and elements array */ 110 /* Extract package count and elements array */
@@ -121,7 +121,8 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
121 return (AE_OK); 121 return (AE_OK);
122 } 122 }
123 123
124 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 124 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
125 info->node_flags,
125 "Return Package has no elements (empty)")); 126 "Return Package has no elements (empty)"));
126 127
127 return (AE_AML_OPERAND_VALUE); 128 return (AE_AML_OPERAND_VALUE);
@@ -150,13 +151,13 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
150 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 151 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
151 "%s: Return Package is larger than needed - " 152 "%s: Return Package is larger than needed - "
152 "found %u, expected %u\n", 153 "found %u, expected %u\n",
153 data->pathname, count, 154 info->full_pathname, count,
154 expected_count)); 155 expected_count));
155 } 156 }
156 157
157 /* Validate all elements of the returned package */ 158 /* Validate all elements of the returned package */
158 159
159 status = acpi_ns_check_package_elements(data, elements, 160 status = acpi_ns_check_package_elements(info, elements,
160 package->ret_info. 161 package->ret_info.
161 object_type1, 162 object_type1,
162 package->ret_info. 163 package->ret_info.
@@ -174,7 +175,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
174 * elements must be of the same type 175 * elements must be of the same type
175 */ 176 */
176 for (i = 0; i < count; i++) { 177 for (i = 0; i < count; i++) {
177 status = acpi_ns_check_object_type(data, elements, 178 status = acpi_ns_check_object_type(info, elements,
178 package->ret_info. 179 package->ret_info.
179 object_type1, i); 180 object_type1, i);
180 if (ACPI_FAILURE(status)) { 181 if (ACPI_FAILURE(status)) {
@@ -206,7 +207,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
206 /* These are the required package elements (0, 1, or 2) */ 207 /* These are the required package elements (0, 1, or 2) */
207 208
208 status = 209 status =
209 acpi_ns_check_object_type(data, elements, 210 acpi_ns_check_object_type(info, elements,
210 package-> 211 package->
211 ret_info3. 212 ret_info3.
212 object_type[i], 213 object_type[i],
@@ -218,7 +219,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
218 /* These are the optional package elements */ 219 /* These are the optional package elements */
219 220
220 status = 221 status =
221 acpi_ns_check_object_type(data, elements, 222 acpi_ns_check_object_type(info, elements,
222 package-> 223 package->
223 ret_info3. 224 ret_info3.
224 tail_object_type, 225 tail_object_type,
@@ -235,7 +236,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
235 236
236 /* First element is the (Integer) revision */ 237 /* First element is the (Integer) revision */
237 238
238 status = acpi_ns_check_object_type(data, elements, 239 status = acpi_ns_check_object_type(info, elements,
239 ACPI_RTYPE_INTEGER, 0); 240 ACPI_RTYPE_INTEGER, 0);
240 if (ACPI_FAILURE(status)) { 241 if (ACPI_FAILURE(status)) {
241 return (status); 242 return (status);
@@ -247,14 +248,14 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
247 /* Examine the sub-packages */ 248 /* Examine the sub-packages */
248 249
249 status = 250 status =
250 acpi_ns_check_package_list(data, package, elements, count); 251 acpi_ns_check_package_list(info, package, elements, count);
251 break; 252 break;
252 253
253 case ACPI_PTYPE2_PKG_COUNT: 254 case ACPI_PTYPE2_PKG_COUNT:
254 255
255 /* First element is the (Integer) count of sub-packages to follow */ 256 /* First element is the (Integer) count of sub-packages to follow */
256 257
257 status = acpi_ns_check_object_type(data, elements, 258 status = acpi_ns_check_object_type(info, elements,
258 ACPI_RTYPE_INTEGER, 0); 259 ACPI_RTYPE_INTEGER, 0);
259 if (ACPI_FAILURE(status)) { 260 if (ACPI_FAILURE(status)) {
260 return (status); 261 return (status);
@@ -275,7 +276,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
275 /* Examine the sub-packages */ 276 /* Examine the sub-packages */
276 277
277 status = 278 status =
278 acpi_ns_check_package_list(data, package, elements, count); 279 acpi_ns_check_package_list(info, package, elements, count);
279 break; 280 break;
280 281
281 case ACPI_PTYPE2: 282 case ACPI_PTYPE2:
@@ -300,7 +301,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
300 /* Create the new outer package and populate it */ 301 /* Create the new outer package and populate it */
301 302
302 status = 303 status =
303 acpi_ns_wrap_with_package(data, return_object, 304 acpi_ns_wrap_with_package(info, return_object,
304 return_object_ptr); 305 return_object_ptr);
305 if (ACPI_FAILURE(status)) { 306 if (ACPI_FAILURE(status)) {
306 return (status); 307 return (status);
@@ -316,14 +317,15 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
316 /* Examine the sub-packages */ 317 /* Examine the sub-packages */
317 318
318 status = 319 status =
319 acpi_ns_check_package_list(data, package, elements, count); 320 acpi_ns_check_package_list(info, package, elements, count);
320 break; 321 break;
321 322
322 default: 323 default:
323 324
324 /* Should not get here if predefined info table is correct */ 325 /* Should not get here if predefined info table is correct */
325 326
326 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 327 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
328 info->node_flags,
327 "Invalid internal return type in table entry: %X", 329 "Invalid internal return type in table entry: %X",
328 package->ret_info.type)); 330 package->ret_info.type));
329 331
@@ -336,7 +338,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
336 338
337 /* Error exit for the case with an incorrect package count */ 339 /* Error exit for the case with an incorrect package count */
338 340
339 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 341 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
340 "Return Package is too small - found %u elements, expected %u", 342 "Return Package is too small - found %u elements, expected %u",
341 count, expected_count)); 343 count, expected_count));
342 344
@@ -347,7 +349,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
347 * 349 *
348 * FUNCTION: acpi_ns_check_package_list 350 * FUNCTION: acpi_ns_check_package_list
349 * 351 *
350 * PARAMETERS: data - Pointer to validation data structure 352 * PARAMETERS: info - Method execution information block
351 * package - Pointer to package-specific info for method 353 * package - Pointer to package-specific info for method
352 * elements - Element list of parent package. All elements 354 * elements - Element list of parent package. All elements
353 * of this list should be of type Package. 355 * of this list should be of type Package.
@@ -360,7 +362,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
360 ******************************************************************************/ 362 ******************************************************************************/
361 363
362static acpi_status 364static acpi_status
363acpi_ns_check_package_list(struct acpi_predefined_data *data, 365acpi_ns_check_package_list(struct acpi_evaluate_info *info,
364 const union acpi_predefined_info *package, 366 const union acpi_predefined_info *package,
365 union acpi_operand_object **elements, u32 count) 367 union acpi_operand_object **elements, u32 count)
366{ 368{
@@ -381,11 +383,11 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
381 for (i = 0; i < count; i++) { 383 for (i = 0; i < count; i++) {
382 sub_package = *elements; 384 sub_package = *elements;
383 sub_elements = sub_package->package.elements; 385 sub_elements = sub_package->package.elements;
384 data->parent_package = sub_package; 386 info->parent_package = sub_package;
385 387
386 /* Each sub-object must be of type Package */ 388 /* Each sub-object must be of type Package */
387 389
388 status = acpi_ns_check_object_type(data, &sub_package, 390 status = acpi_ns_check_object_type(info, &sub_package,
389 ACPI_RTYPE_PACKAGE, i); 391 ACPI_RTYPE_PACKAGE, i);
390 if (ACPI_FAILURE(status)) { 392 if (ACPI_FAILURE(status)) {
391 return (status); 393 return (status);
@@ -393,7 +395,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
393 395
394 /* Examine the different types of expected sub-packages */ 396 /* Examine the different types of expected sub-packages */
395 397
396 data->parent_package = sub_package; 398 info->parent_package = sub_package;
397 switch (package->ret_info.type) { 399 switch (package->ret_info.type) {
398 case ACPI_PTYPE2: 400 case ACPI_PTYPE2:
399 case ACPI_PTYPE2_PKG_COUNT: 401 case ACPI_PTYPE2_PKG_COUNT:
@@ -408,7 +410,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
408 } 410 }
409 411
410 status = 412 status =
411 acpi_ns_check_package_elements(data, sub_elements, 413 acpi_ns_check_package_elements(info, sub_elements,
412 package->ret_info. 414 package->ret_info.
413 object_type1, 415 object_type1,
414 package->ret_info. 416 package->ret_info.
@@ -434,7 +436,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
434 } 436 }
435 437
436 status = 438 status =
437 acpi_ns_check_package_elements(data, sub_elements, 439 acpi_ns_check_package_elements(info, sub_elements,
438 package->ret_info. 440 package->ret_info.
439 object_type1, 441 object_type1,
440 package->ret_info. 442 package->ret_info.
@@ -463,7 +465,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
463 465
464 for (j = 0; j < expected_count; j++) { 466 for (j = 0; j < expected_count; j++) {
465 status = 467 status =
466 acpi_ns_check_object_type(data, 468 acpi_ns_check_object_type(info,
467 &sub_elements[j], 469 &sub_elements[j],
468 package-> 470 package->
469 ret_info2. 471 ret_info2.
@@ -487,7 +489,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
487 /* Check the type of each sub-package element */ 489 /* Check the type of each sub-package element */
488 490
489 status = 491 status =
490 acpi_ns_check_package_elements(data, sub_elements, 492 acpi_ns_check_package_elements(info, sub_elements,
491 package->ret_info. 493 package->ret_info.
492 object_type1, 494 object_type1,
493 sub_package->package. 495 sub_package->package.
@@ -503,7 +505,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
503 * First element is the (Integer) count of elements, including 505 * First element is the (Integer) count of elements, including
504 * the count field (the ACPI name is num_elements) 506 * the count field (the ACPI name is num_elements)
505 */ 507 */
506 status = acpi_ns_check_object_type(data, sub_elements, 508 status = acpi_ns_check_object_type(info, sub_elements,
507 ACPI_RTYPE_INTEGER, 509 ACPI_RTYPE_INTEGER,
508 0); 510 0);
509 if (ACPI_FAILURE(status)) { 511 if (ACPI_FAILURE(status)) {
@@ -537,7 +539,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
537 /* Check the type of each sub-package element */ 539 /* Check the type of each sub-package element */
538 540
539 status = 541 status =
540 acpi_ns_check_package_elements(data, 542 acpi_ns_check_package_elements(info,
541 (sub_elements + 1), 543 (sub_elements + 1),
542 package->ret_info. 544 package->ret_info.
543 object_type1, 545 object_type1,
@@ -562,7 +564,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
562 564
563 /* The sub-package count was smaller than required */ 565 /* The sub-package count was smaller than required */
564 566
565 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 567 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
566 "Return Sub-Package[%u] is too small - found %u elements, expected %u", 568 "Return Sub-Package[%u] is too small - found %u elements, expected %u",
567 i, sub_package->package.count, expected_count)); 569 i, sub_package->package.count, expected_count));
568 570
@@ -573,7 +575,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
573 * 575 *
574 * FUNCTION: acpi_ns_check_package_elements 576 * FUNCTION: acpi_ns_check_package_elements
575 * 577 *
576 * PARAMETERS: data - Pointer to validation data structure 578 * PARAMETERS: info - Method execution information block
577 * elements - Pointer to the package elements array 579 * elements - Pointer to the package elements array
578 * type1 - Object type for first group 580 * type1 - Object type for first group
579 * count1 - Count for first group 581 * count1 - Count for first group
@@ -589,7 +591,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
589 ******************************************************************************/ 591 ******************************************************************************/
590 592
591static acpi_status 593static acpi_status
592acpi_ns_check_package_elements(struct acpi_predefined_data *data, 594acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
593 union acpi_operand_object **elements, 595 union acpi_operand_object **elements,
594 u8 type1, 596 u8 type1,
595 u32 count1, 597 u32 count1,
@@ -605,7 +607,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
605 * The second group can have a count of zero. 607 * The second group can have a count of zero.
606 */ 608 */
607 for (i = 0; i < count1; i++) { 609 for (i = 0; i < count1; i++) {
608 status = acpi_ns_check_object_type(data, this_element, 610 status = acpi_ns_check_object_type(info, this_element,
609 type1, i + start_index); 611 type1, i + start_index);
610 if (ACPI_FAILURE(status)) { 612 if (ACPI_FAILURE(status)) {
611 return (status); 613 return (status);
@@ -614,7 +616,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
614 } 616 }
615 617
616 for (i = 0; i < count2; i++) { 618 for (i = 0; i < count2; i++) {
617 status = acpi_ns_check_object_type(data, this_element, 619 status = acpi_ns_check_object_type(info, this_element,
618 type2, 620 type2,
619 (i + count1 + start_index)); 621 (i + count1 + start_index));
620 if (ACPI_FAILURE(status)) { 622 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index 18f02e4ece01..89caef04691e 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -130,7 +130,7 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
130 * 130 *
131 * FUNCTION: acpi_ns_simple_repair 131 * FUNCTION: acpi_ns_simple_repair
132 * 132 *
133 * PARAMETERS: data - Pointer to validation data structure 133 * PARAMETERS: info - Method execution information block
134 * expected_btypes - Object types expected 134 * expected_btypes - Object types expected
135 * package_index - Index of object within parent package (if 135 * package_index - Index of object within parent package (if
136 * applicable - ACPI_NOT_PACKAGE_ELEMENT 136 * applicable - ACPI_NOT_PACKAGE_ELEMENT
@@ -146,7 +146,7 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
146 ******************************************************************************/ 146 ******************************************************************************/
147 147
148acpi_status 148acpi_status
149acpi_ns_simple_repair(struct acpi_predefined_data *data, 149acpi_ns_simple_repair(struct acpi_evaluate_info *info,
150 u32 expected_btypes, 150 u32 expected_btypes,
151 u32 package_index, 151 u32 package_index,
152 union acpi_operand_object **return_object_ptr) 152 union acpi_operand_object **return_object_ptr)
@@ -162,12 +162,12 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
162 * Special repairs for certain names that are in the repair table. 162 * Special repairs for certain names that are in the repair table.
163 * Check if this name is in the list of repairable names. 163 * Check if this name is in the list of repairable names.
164 */ 164 */
165 predefined = acpi_ns_match_simple_repair(data->node, 165 predefined = acpi_ns_match_simple_repair(info->node,
166 data->return_btype, 166 info->return_btype,
167 package_index); 167 package_index);
168 if (predefined) { 168 if (predefined) {
169 if (!return_object) { 169 if (!return_object) {
170 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 170 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
171 ACPI_WARN_ALWAYS, 171 ACPI_WARN_ALWAYS,
172 "Missing expected return value")); 172 "Missing expected return value"));
173 } 173 }
@@ -191,7 +191,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
191 * Do not perform simple object repair unless the return type is not 191 * Do not perform simple object repair unless the return type is not
192 * expected. 192 * expected.
193 */ 193 */
194 if (data->return_btype & expected_btypes) { 194 if (info->return_btype & expected_btypes) {
195 return (AE_OK); 195 return (AE_OK);
196 } 196 }
197 197
@@ -211,7 +211,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
211 */ 211 */
212 if (!return_object) { 212 if (!return_object) {
213 if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) { 213 if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) {
214 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 214 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
215 ACPI_WARN_ALWAYS, 215 ACPI_WARN_ALWAYS,
216 "Missing expected return value")); 216 "Missing expected return value"));
217 217
@@ -247,14 +247,14 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
247 * for correct contents (expected object type or types). 247 * for correct contents (expected object type or types).
248 */ 248 */
249 status = 249 status =
250 acpi_ns_wrap_with_package(data, return_object, &new_object); 250 acpi_ns_wrap_with_package(info, return_object, &new_object);
251 if (ACPI_SUCCESS(status)) { 251 if (ACPI_SUCCESS(status)) {
252 /* 252 /*
253 * The original object just had its reference count 253 * The original object just had its reference count
254 * incremented for being inserted into the new package. 254 * incremented for being inserted into the new package.
255 */ 255 */
256 *return_object_ptr = new_object; /* New Package object */ 256 *return_object_ptr = new_object; /* New Package object */
257 data->flags |= ACPI_OBJECT_REPAIRED; 257 info->return_flags |= ACPI_OBJECT_REPAIRED;
258 return (AE_OK); 258 return (AE_OK);
259 } 259 }
260 } 260 }
@@ -277,7 +277,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
277 * package object as part of the repair, we don't need to 277 * package object as part of the repair, we don't need to
278 * change the reference count. 278 * change the reference count.
279 */ 279 */
280 if (!(data->flags & ACPI_OBJECT_WRAPPED)) { 280 if (!(info->return_flags & ACPI_OBJECT_WRAPPED)) {
281 new_object->common.reference_count = 281 new_object->common.reference_count =
282 return_object->common.reference_count; 282 return_object->common.reference_count;
283 283
@@ -288,14 +288,14 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
288 288
289 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 289 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
290 "%s: Converted %s to expected %s at Package index %u\n", 290 "%s: Converted %s to expected %s at Package index %u\n",
291 data->pathname, 291 info->full_pathname,
292 acpi_ut_get_object_type_name(return_object), 292 acpi_ut_get_object_type_name(return_object),
293 acpi_ut_get_object_type_name(new_object), 293 acpi_ut_get_object_type_name(new_object),
294 package_index)); 294 package_index));
295 } else { 295 } else {
296 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 296 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
297 "%s: Converted %s to expected %s\n", 297 "%s: Converted %s to expected %s\n",
298 data->pathname, 298 info->full_pathname,
299 acpi_ut_get_object_type_name(return_object), 299 acpi_ut_get_object_type_name(return_object),
300 acpi_ut_get_object_type_name(new_object))); 300 acpi_ut_get_object_type_name(new_object)));
301 } 301 }
@@ -304,7 +304,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
304 304
305 acpi_ut_remove_reference(return_object); 305 acpi_ut_remove_reference(return_object);
306 *return_object_ptr = new_object; 306 *return_object_ptr = new_object;
307 data->flags |= ACPI_OBJECT_REPAIRED; 307 info->return_flags |= ACPI_OBJECT_REPAIRED;
308 return (AE_OK); 308 return (AE_OK);
309} 309}
310 310
@@ -359,7 +359,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
359 * 359 *
360 * FUNCTION: acpi_ns_repair_null_element 360 * FUNCTION: acpi_ns_repair_null_element
361 * 361 *
362 * PARAMETERS: data - Pointer to validation data structure 362 * PARAMETERS: info - Method execution information block
363 * expected_btypes - Object types expected 363 * expected_btypes - Object types expected
364 * package_index - Index of object within parent package (if 364 * package_index - Index of object within parent package (if
365 * applicable - ACPI_NOT_PACKAGE_ELEMENT 365 * applicable - ACPI_NOT_PACKAGE_ELEMENT
@@ -374,7 +374,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
374 ******************************************************************************/ 374 ******************************************************************************/
375 375
376acpi_status 376acpi_status
377acpi_ns_repair_null_element(struct acpi_predefined_data *data, 377acpi_ns_repair_null_element(struct acpi_evaluate_info * info,
378 u32 expected_btypes, 378 u32 expected_btypes,
379 u32 package_index, 379 u32 package_index,
380 union acpi_operand_object **return_object_ptr) 380 union acpi_operand_object **return_object_ptr)
@@ -424,16 +424,16 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
424 /* Set the reference count according to the parent Package object */ 424 /* Set the reference count according to the parent Package object */
425 425
426 new_object->common.reference_count = 426 new_object->common.reference_count =
427 data->parent_package->common.reference_count; 427 info->parent_package->common.reference_count;
428 428
429 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 429 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
430 "%s: Converted NULL package element to expected %s at index %u\n", 430 "%s: Converted NULL package element to expected %s at index %u\n",
431 data->pathname, 431 info->full_pathname,
432 acpi_ut_get_object_type_name(new_object), 432 acpi_ut_get_object_type_name(new_object),
433 package_index)); 433 package_index));
434 434
435 *return_object_ptr = new_object; 435 *return_object_ptr = new_object;
436 data->flags |= ACPI_OBJECT_REPAIRED; 436 info->return_flags |= ACPI_OBJECT_REPAIRED;
437 return (AE_OK); 437 return (AE_OK);
438} 438}
439 439
@@ -441,7 +441,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
441 * 441 *
442 * FUNCTION: acpi_ns_remove_null_elements 442 * FUNCTION: acpi_ns_remove_null_elements
443 * 443 *
444 * PARAMETERS: data - Pointer to validation data structure 444 * PARAMETERS: info - Method execution information block
445 * package_type - An acpi_return_package_types value 445 * package_type - An acpi_return_package_types value
446 * obj_desc - A Package object 446 * obj_desc - A Package object
447 * 447 *
@@ -454,7 +454,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
454 *****************************************************************************/ 454 *****************************************************************************/
455 455
456void 456void
457acpi_ns_remove_null_elements(struct acpi_predefined_data *data, 457acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
458 u8 package_type, 458 u8 package_type,
459 union acpi_operand_object *obj_desc) 459 union acpi_operand_object *obj_desc)
460{ 460{
@@ -511,7 +511,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
511 if (new_count < count) { 511 if (new_count < count) {
512 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 512 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
513 "%s: Found and removed %u NULL elements\n", 513 "%s: Found and removed %u NULL elements\n",
514 data->pathname, (count - new_count))); 514 info->full_pathname, (count - new_count)));
515 515
516 /* NULL terminate list and update the package count */ 516 /* NULL terminate list and update the package count */
517 517
@@ -524,7 +524,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
524 * 524 *
525 * FUNCTION: acpi_ns_wrap_with_package 525 * FUNCTION: acpi_ns_wrap_with_package
526 * 526 *
527 * PARAMETERS: data - Pointer to validation data structure 527 * PARAMETERS: info - Method execution information block
528 * original_object - Pointer to the object to repair. 528 * original_object - Pointer to the object to repair.
529 * obj_desc_ptr - The new package object is returned here 529 * obj_desc_ptr - The new package object is returned here
530 * 530 *
@@ -545,7 +545,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
545 ******************************************************************************/ 545 ******************************************************************************/
546 546
547acpi_status 547acpi_status
548acpi_ns_wrap_with_package(struct acpi_predefined_data *data, 548acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
549 union acpi_operand_object *original_object, 549 union acpi_operand_object *original_object,
550 union acpi_operand_object **obj_desc_ptr) 550 union acpi_operand_object **obj_desc_ptr)
551{ 551{
@@ -566,12 +566,12 @@ acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
566 566
567 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 567 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
568 "%s: Wrapped %s with expected Package object\n", 568 "%s: Wrapped %s with expected Package object\n",
569 data->pathname, 569 info->full_pathname,
570 acpi_ut_get_object_type_name(original_object))); 570 acpi_ut_get_object_type_name(original_object)));
571 571
572 /* Return the new object in the object pointer */ 572 /* Return the new object in the object pointer */
573 573
574 *obj_desc_ptr = pkg_obj_desc; 574 *obj_desc_ptr = pkg_obj_desc;
575 data->flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED; 575 info->return_flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
576 return (AE_OK); 576 return (AE_OK);
577} 577}
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 149e9b9c2c1b..39acc4e6b387 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("nsrepair2")
54 * be repaired on a per-name basis. 54 * be repaired on a per-name basis.
55 */ 55 */
56typedef 56typedef
57acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data, 57acpi_status(*acpi_repair_function) (struct acpi_evaluate_info * info,
58 union acpi_operand_object 58 union acpi_operand_object
59 **return_object_ptr); 59 **return_object_ptr);
60 60
@@ -71,31 +71,31 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
71 *node); 71 *node);
72 72
73static acpi_status 73static acpi_status
74acpi_ns_repair_ALR(struct acpi_predefined_data *data, 74acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
75 union acpi_operand_object **return_object_ptr); 75 union acpi_operand_object **return_object_ptr);
76 76
77static acpi_status 77static acpi_status
78acpi_ns_repair_CID(struct acpi_predefined_data *data, 78acpi_ns_repair_CID(struct acpi_evaluate_info *info,
79 union acpi_operand_object **return_object_ptr); 79 union acpi_operand_object **return_object_ptr);
80 80
81static acpi_status 81static acpi_status
82acpi_ns_repair_FDE(struct acpi_predefined_data *data, 82acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
83 union acpi_operand_object **return_object_ptr); 83 union acpi_operand_object **return_object_ptr);
84 84
85static acpi_status 85static acpi_status
86acpi_ns_repair_HID(struct acpi_predefined_data *data, 86acpi_ns_repair_HID(struct acpi_evaluate_info *info,
87 union acpi_operand_object **return_object_ptr); 87 union acpi_operand_object **return_object_ptr);
88 88
89static acpi_status 89static acpi_status
90acpi_ns_repair_PSS(struct acpi_predefined_data *data, 90acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
91 union acpi_operand_object **return_object_ptr); 91 union acpi_operand_object **return_object_ptr);
92 92
93static acpi_status 93static acpi_status
94acpi_ns_repair_TSS(struct acpi_predefined_data *data, 94acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
95 union acpi_operand_object **return_object_ptr); 95 union acpi_operand_object **return_object_ptr);
96 96
97static acpi_status 97static acpi_status
98acpi_ns_check_sorted_list(struct acpi_predefined_data *data, 98acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
99 union acpi_operand_object *return_object, 99 union acpi_operand_object *return_object,
100 u32 expected_count, 100 u32 expected_count,
101 u32 sort_index, 101 u32 sort_index,
@@ -150,7 +150,7 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
150 * 150 *
151 * FUNCTION: acpi_ns_complex_repairs 151 * FUNCTION: acpi_ns_complex_repairs
152 * 152 *
153 * PARAMETERS: data - Pointer to validation data structure 153 * PARAMETERS: info - Method execution information block
154 * node - Namespace node for the method/object 154 * node - Namespace node for the method/object
155 * validate_status - Original status of earlier validation 155 * validate_status - Original status of earlier validation
156 * return_object_ptr - Pointer to the object returned from the 156 * return_object_ptr - Pointer to the object returned from the
@@ -165,7 +165,7 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
165 *****************************************************************************/ 165 *****************************************************************************/
166 166
167acpi_status 167acpi_status
168acpi_ns_complex_repairs(struct acpi_predefined_data *data, 168acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
169 struct acpi_namespace_node *node, 169 struct acpi_namespace_node *node,
170 acpi_status validate_status, 170 acpi_status validate_status,
171 union acpi_operand_object **return_object_ptr) 171 union acpi_operand_object **return_object_ptr)
@@ -180,7 +180,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
180 return (validate_status); 180 return (validate_status);
181 } 181 }
182 182
183 status = predefined->repair_function(data, return_object_ptr); 183 status = predefined->repair_function(info, return_object_ptr);
184 return (status); 184 return (status);
185} 185}
186 186
@@ -219,7 +219,7 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
219 * 219 *
220 * FUNCTION: acpi_ns_repair_ALR 220 * FUNCTION: acpi_ns_repair_ALR
221 * 221 *
222 * PARAMETERS: data - Pointer to validation data structure 222 * PARAMETERS: info - Method execution information block
223 * return_object_ptr - Pointer to the object returned from the 223 * return_object_ptr - Pointer to the object returned from the
224 * evaluation of a method or object 224 * evaluation of a method or object
225 * 225 *
@@ -231,13 +231,13 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
231 *****************************************************************************/ 231 *****************************************************************************/
232 232
233static acpi_status 233static acpi_status
234acpi_ns_repair_ALR(struct acpi_predefined_data *data, 234acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
235 union acpi_operand_object **return_object_ptr) 235 union acpi_operand_object **return_object_ptr)
236{ 236{
237 union acpi_operand_object *return_object = *return_object_ptr; 237 union acpi_operand_object *return_object = *return_object_ptr;
238 acpi_status status; 238 acpi_status status;
239 239
240 status = acpi_ns_check_sorted_list(data, return_object, 2, 1, 240 status = acpi_ns_check_sorted_list(info, return_object, 2, 1,
241 ACPI_SORT_ASCENDING, 241 ACPI_SORT_ASCENDING,
242 "AmbientIlluminance"); 242 "AmbientIlluminance");
243 243
@@ -248,7 +248,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
248 * 248 *
249 * FUNCTION: acpi_ns_repair_FDE 249 * FUNCTION: acpi_ns_repair_FDE
250 * 250 *
251 * PARAMETERS: data - Pointer to validation data structure 251 * PARAMETERS: info - Method execution information block
252 * return_object_ptr - Pointer to the object returned from the 252 * return_object_ptr - Pointer to the object returned from the
253 * evaluation of a method or object 253 * evaluation of a method or object
254 * 254 *
@@ -262,7 +262,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
262 *****************************************************************************/ 262 *****************************************************************************/
263 263
264static acpi_status 264static acpi_status
265acpi_ns_repair_FDE(struct acpi_predefined_data *data, 265acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
266 union acpi_operand_object **return_object_ptr) 266 union acpi_operand_object **return_object_ptr)
267{ 267{
268 union acpi_operand_object *return_object = *return_object_ptr; 268 union acpi_operand_object *return_object = *return_object_ptr;
@@ -285,8 +285,8 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
285 /* We can only repair if we have exactly 5 BYTEs */ 285 /* We can only repair if we have exactly 5 BYTEs */
286 286
287 if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) { 287 if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) {
288 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 288 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
289 data->node_flags, 289 info->node_flags,
290 "Incorrect return buffer length %u, expected %u", 290 "Incorrect return buffer length %u, expected %u",
291 return_object->buffer.length, 291 return_object->buffer.length,
292 ACPI_FDE_DWORD_BUFFER_SIZE)); 292 ACPI_FDE_DWORD_BUFFER_SIZE));
@@ -316,7 +316,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
316 316
317 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 317 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
318 "%s Expanded Byte Buffer to expected DWord Buffer\n", 318 "%s Expanded Byte Buffer to expected DWord Buffer\n",
319 data->pathname)); 319 info->full_pathname));
320 break; 320 break;
321 321
322 default: 322 default:
@@ -328,7 +328,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
328 acpi_ut_remove_reference(return_object); 328 acpi_ut_remove_reference(return_object);
329 *return_object_ptr = buffer_object; 329 *return_object_ptr = buffer_object;
330 330
331 data->flags |= ACPI_OBJECT_REPAIRED; 331 info->return_flags |= ACPI_OBJECT_REPAIRED;
332 return (AE_OK); 332 return (AE_OK);
333} 333}
334 334
@@ -336,7 +336,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
336 * 336 *
337 * FUNCTION: acpi_ns_repair_CID 337 * FUNCTION: acpi_ns_repair_CID
338 * 338 *
339 * PARAMETERS: data - Pointer to validation data structure 339 * PARAMETERS: info - Method execution information block
340 * return_object_ptr - Pointer to the object returned from the 340 * return_object_ptr - Pointer to the object returned from the
341 * evaluation of a method or object 341 * evaluation of a method or object
342 * 342 *
@@ -349,7 +349,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
349 *****************************************************************************/ 349 *****************************************************************************/
350 350
351static acpi_status 351static acpi_status
352acpi_ns_repair_CID(struct acpi_predefined_data *data, 352acpi_ns_repair_CID(struct acpi_evaluate_info *info,
353 union acpi_operand_object **return_object_ptr) 353 union acpi_operand_object **return_object_ptr)
354{ 354{
355 acpi_status status; 355 acpi_status status;
@@ -362,7 +362,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
362 /* Check for _CID as a simple string */ 362 /* Check for _CID as a simple string */
363 363
364 if (return_object->common.type == ACPI_TYPE_STRING) { 364 if (return_object->common.type == ACPI_TYPE_STRING) {
365 status = acpi_ns_repair_HID(data, return_object_ptr); 365 status = acpi_ns_repair_HID(info, return_object_ptr);
366 return (status); 366 return (status);
367 } 367 }
368 368
@@ -379,7 +379,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
379 original_element = *element_ptr; 379 original_element = *element_ptr;
380 original_ref_count = original_element->common.reference_count; 380 original_ref_count = original_element->common.reference_count;
381 381
382 status = acpi_ns_repair_HID(data, element_ptr); 382 status = acpi_ns_repair_HID(info, element_ptr);
383 if (ACPI_FAILURE(status)) { 383 if (ACPI_FAILURE(status)) {
384 return (status); 384 return (status);
385 } 385 }
@@ -406,7 +406,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
406 * 406 *
407 * FUNCTION: acpi_ns_repair_HID 407 * FUNCTION: acpi_ns_repair_HID
408 * 408 *
409 * PARAMETERS: data - Pointer to validation data structure 409 * PARAMETERS: info - Method execution information block
410 * return_object_ptr - Pointer to the object returned from the 410 * return_object_ptr - Pointer to the object returned from the
411 * evaluation of a method or object 411 * evaluation of a method or object
412 * 412 *
@@ -418,7 +418,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
418 *****************************************************************************/ 418 *****************************************************************************/
419 419
420static acpi_status 420static acpi_status
421acpi_ns_repair_HID(struct acpi_predefined_data *data, 421acpi_ns_repair_HID(struct acpi_evaluate_info *info,
422 union acpi_operand_object **return_object_ptr) 422 union acpi_operand_object **return_object_ptr)
423{ 423{
424 union acpi_operand_object *return_object = *return_object_ptr; 424 union acpi_operand_object *return_object = *return_object_ptr;
@@ -435,12 +435,13 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
435 } 435 }
436 436
437 if (return_object->string.length == 0) { 437 if (return_object->string.length == 0) {
438 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 438 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
439 info->node_flags,
439 "Invalid zero-length _HID or _CID string")); 440 "Invalid zero-length _HID or _CID string"));
440 441
441 /* Return AE_OK anyway, let driver handle it */ 442 /* Return AE_OK anyway, let driver handle it */
442 443
443 data->flags |= ACPI_OBJECT_REPAIRED; 444 info->return_flags |= ACPI_OBJECT_REPAIRED;
444 return (AE_OK); 445 return (AE_OK);
445 } 446 }
446 447
@@ -464,7 +465,7 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
464 465
465 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 466 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
466 "%s: Removed invalid leading asterisk\n", 467 "%s: Removed invalid leading asterisk\n",
467 data->pathname)); 468 info->full_pathname));
468 } 469 }
469 470
470 /* 471 /*
@@ -488,7 +489,7 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
488 * 489 *
489 * FUNCTION: acpi_ns_repair_TSS 490 * FUNCTION: acpi_ns_repair_TSS
490 * 491 *
491 * PARAMETERS: data - Pointer to validation data structure 492 * PARAMETERS: info - Method execution information block
492 * return_object_ptr - Pointer to the object returned from the 493 * return_object_ptr - Pointer to the object returned from the
493 * evaluation of a method or object 494 * evaluation of a method or object
494 * 495 *
@@ -500,7 +501,7 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
500 *****************************************************************************/ 501 *****************************************************************************/
501 502
502static acpi_status 503static acpi_status
503acpi_ns_repair_TSS(struct acpi_predefined_data *data, 504acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
504 union acpi_operand_object **return_object_ptr) 505 union acpi_operand_object **return_object_ptr)
505{ 506{
506 union acpi_operand_object *return_object = *return_object_ptr; 507 union acpi_operand_object *return_object = *return_object_ptr;
@@ -515,13 +516,13 @@ acpi_ns_repair_TSS(struct acpi_predefined_data *data,
515 * In this case, it is best to just return the _TSS package as-is. 516 * In this case, it is best to just return the _TSS package as-is.
516 * (May, 2011) 517 * (May, 2011)
517 */ 518 */
518 status = 519 status = acpi_ns_get_node(info->node, "^_PSS",
519 acpi_ns_get_node(data->node, "^_PSS", ACPI_NS_NO_UPSEARCH, &node); 520 ACPI_NS_NO_UPSEARCH, &node);
520 if (ACPI_SUCCESS(status)) { 521 if (ACPI_SUCCESS(status)) {
521 return (AE_OK); 522 return (AE_OK);
522 } 523 }
523 524
524 status = acpi_ns_check_sorted_list(data, return_object, 5, 1, 525 status = acpi_ns_check_sorted_list(info, return_object, 5, 1,
525 ACPI_SORT_DESCENDING, 526 ACPI_SORT_DESCENDING,
526 "PowerDissipation"); 527 "PowerDissipation");
527 528
@@ -532,7 +533,7 @@ acpi_ns_repair_TSS(struct acpi_predefined_data *data,
532 * 533 *
533 * FUNCTION: acpi_ns_repair_PSS 534 * FUNCTION: acpi_ns_repair_PSS
534 * 535 *
535 * PARAMETERS: data - Pointer to validation data structure 536 * PARAMETERS: info - Method execution information block
536 * return_object_ptr - Pointer to the object returned from the 537 * return_object_ptr - Pointer to the object returned from the
537 * evaluation of a method or object 538 * evaluation of a method or object
538 * 539 *
@@ -546,7 +547,7 @@ acpi_ns_repair_TSS(struct acpi_predefined_data *data,
546 *****************************************************************************/ 547 *****************************************************************************/
547 548
548static acpi_status 549static acpi_status
549acpi_ns_repair_PSS(struct acpi_predefined_data *data, 550acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
550 union acpi_operand_object **return_object_ptr) 551 union acpi_operand_object **return_object_ptr)
551{ 552{
552 union acpi_operand_object *return_object = *return_object_ptr; 553 union acpi_operand_object *return_object = *return_object_ptr;
@@ -564,7 +565,7 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
564 * incorrectly sorted, sort it. We sort by cpu_frequency, since this 565 * incorrectly sorted, sort it. We sort by cpu_frequency, since this
565 * should be proportional to the power. 566 * should be proportional to the power.
566 */ 567 */
567 status = acpi_ns_check_sorted_list(data, return_object, 6, 0, 568 status = acpi_ns_check_sorted_list(info, return_object, 6, 0,
568 ACPI_SORT_DESCENDING, 569 ACPI_SORT_DESCENDING,
569 "CpuFrequency"); 570 "CpuFrequency");
570 if (ACPI_FAILURE(status)) { 571 if (ACPI_FAILURE(status)) {
@@ -584,8 +585,8 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
584 obj_desc = elements[1]; /* Index1 = power_dissipation */ 585 obj_desc = elements[1]; /* Index1 = power_dissipation */
585 586
586 if ((u32) obj_desc->integer.value > previous_value) { 587 if ((u32) obj_desc->integer.value > previous_value) {
587 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 588 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
588 data->node_flags, 589 info->node_flags,
589 "SubPackage[%u,%u] - suspicious power dissipation values", 590 "SubPackage[%u,%u] - suspicious power dissipation values",
590 i - 1, i)); 591 i - 1, i));
591 } 592 }
@@ -601,7 +602,7 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
601 * 602 *
602 * FUNCTION: acpi_ns_check_sorted_list 603 * FUNCTION: acpi_ns_check_sorted_list
603 * 604 *
604 * PARAMETERS: data - Pointer to validation data structure 605 * PARAMETERS: info - Method execution information block
605 * return_object - Pointer to the top-level returned object 606 * return_object - Pointer to the top-level returned object
606 * expected_count - Minimum length of each sub-package 607 * expected_count - Minimum length of each sub-package
607 * sort_index - Sub-package entry to sort on 608 * sort_index - Sub-package entry to sort on
@@ -617,7 +618,7 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
617 *****************************************************************************/ 618 *****************************************************************************/
618 619
619static acpi_status 620static acpi_status
620acpi_ns_check_sorted_list(struct acpi_predefined_data *data, 621acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
621 union acpi_operand_object *return_object, 622 union acpi_operand_object *return_object,
622 u32 expected_count, 623 u32 expected_count,
623 u32 sort_index, 624 u32 sort_index,
@@ -689,11 +690,11 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
689 outer_element_count, sort_index, 690 outer_element_count, sort_index,
690 sort_direction); 691 sort_direction);
691 692
692 data->flags |= ACPI_OBJECT_REPAIRED; 693 info->return_flags |= ACPI_OBJECT_REPAIRED;
693 694
694 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 695 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
695 "%s: Repaired unsorted list - now sorted by %s\n", 696 "%s: Repaired unsorted list - now sorted by %s\n",
696 data->pathname, sort_key_name)); 697 info->full_pathname, sort_key_name));
697 return (AE_OK); 698 return (AE_OK);
698 } 699 }
699 700
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index fc69949151bb..82bec40d4508 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -187,8 +187,6 @@ acpi_evaluate_object(acpi_handle handle,
187 return_ACPI_STATUS(AE_NO_MEMORY); 187 return_ACPI_STATUS(AE_NO_MEMORY);
188 } 188 }
189 189
190 info->pathname = pathname;
191
192 /* Convert and validate the device handle */ 190 /* Convert and validate the device handle */
193 191
194 info->prefix_node = acpi_ns_validate_handle(handle); 192 info->prefix_node = acpi_ns_validate_handle(handle);
@@ -198,17 +196,64 @@ acpi_evaluate_object(acpi_handle handle,
198 } 196 }
199 197
200 /* 198 /*
201 * If there are parameters to be passed to a control method, the external 199 * Get the actual namespace node for the target object.
202 * objects must all be converted to internal objects 200 * Handles these cases:
201 *
202 * 1) Null node, valid pathname from root (absolute path)
203 * 2) Node and valid pathname (path relative to Node)
204 * 3) Node, Null pathname
205 */
206 if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
207
208 /* The path is fully qualified, just evaluate by name */
209
210 info->prefix_node = NULL;
211 } else if (!handle) {
212 /*
213 * A handle is optional iff a fully qualified pathname is specified.
214 * Since we've already handled fully qualified names above, this is
215 * an error.
216 */
217 if (!pathname) {
218 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
219 "Both Handle and Pathname are NULL"));
220 } else {
221 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
222 "Null Handle with relative pathname [%s]",
223 pathname));
224 }
225
226 status = AE_BAD_PARAMETER;
227 goto cleanup;
228 }
229
230 info->relative_pathname = pathname;
231
232 /*
233 * Convert all external objects passed as arguments to the
234 * internal version(s).
203 */ 235 */
204 if (external_params && external_params->count) { 236 if (external_params && external_params->count) {
237 info->param_count = (u16)external_params->count;
238
239 /* Warn on impossible argument count */
240
241 if (info->param_count > ACPI_METHOD_NUM_ARGS) {
242 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
243 ACPI_WARN_ALWAYS,
244 "Excess arguments (%u) - using only %u",
245 info->param_count,
246 ACPI_METHOD_NUM_ARGS));
247
248 info->param_count = ACPI_METHOD_NUM_ARGS;
249 }
250
205 /* 251 /*
206 * Allocate a new parameter block for the internal objects 252 * Allocate a new parameter block for the internal objects
207 * Add 1 to count to allow for null terminated internal list 253 * Add 1 to count to allow for null terminated internal list
208 */ 254 */
209 info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) 255 info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) info->
210 external_params-> 256 param_count +
211 count +
212 1) * sizeof(void *)); 257 1) * sizeof(void *));
213 if (!info->parameters) { 258 if (!info->parameters) {
214 status = AE_NO_MEMORY; 259 status = AE_NO_MEMORY;
@@ -217,7 +262,7 @@ acpi_evaluate_object(acpi_handle handle,
217 262
218 /* Convert each external object in the list to an internal object */ 263 /* Convert each external object in the list to an internal object */
219 264
220 for (i = 0; i < external_params->count; i++) { 265 for (i = 0; i < info->param_count; i++) {
221 status = 266 status =
222 acpi_ut_copy_eobject_to_iobject(&external_params-> 267 acpi_ut_copy_eobject_to_iobject(&external_params->
223 pointer[i], 268 pointer[i],
@@ -227,43 +272,96 @@ acpi_evaluate_object(acpi_handle handle,
227 goto cleanup; 272 goto cleanup;
228 } 273 }
229 } 274 }
230 info->parameters[external_params->count] = NULL; 275
276 info->parameters[info->param_count] = NULL;
231 } 277 }
232 278
279#if 0
280
233 /* 281 /*
234 * Three major cases: 282 * Begin incoming argument count analysis. Check for too few args
235 * 1) Fully qualified pathname 283 * and too many args.
236 * 2) No handle, not fully qualified pathname (error)
237 * 3) Valid handle
238 */ 284 */
239 if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
240 285
241 /* The path is fully qualified, just evaluate by name */ 286 switch (acpi_ns_get_type(info->node)) {
287 case ACPI_TYPE_METHOD:
288
289 /* Check incoming argument count against the method definition */
290
291 if (info->obj_desc->method.param_count > info->param_count) {
292 ACPI_ERROR((AE_INFO,
293 "Insufficient arguments (%u) - %u are required",
294 info->param_count,
295 info->obj_desc->method.param_count));
296
297 status = AE_MISSING_ARGUMENTS;
298 goto cleanup;
299 }
300
301 else if (info->obj_desc->method.param_count < info->param_count) {
302 ACPI_WARNING((AE_INFO,
303 "Excess arguments (%u) - only %u are required",
304 info->param_count,
305 info->obj_desc->method.param_count));
306
307 /* Just pass the required number of arguments */
308
309 info->param_count = info->obj_desc->method.param_count;
310 }
242 311
243 info->prefix_node = NULL;
244 status = acpi_ns_evaluate(info);
245 } else if (!handle) {
246 /* 312 /*
247 * A handle is optional iff a fully qualified pathname is specified. 313 * Any incoming external objects to be passed as arguments to the
248 * Since we've already handled fully qualified names above, this is 314 * method must be converted to internal objects
249 * an error
250 */ 315 */
251 if (!pathname) { 316 if (info->param_count) {
252 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 317 /*
253 "Both Handle and Pathname are NULL")); 318 * Allocate a new parameter block for the internal objects
254 } else { 319 * Add 1 to count to allow for null terminated internal list
255 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 320 */
256 "Null Handle with relative pathname [%s]", 321 info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)
257 pathname)); 322 info->
323 param_count +
324 1) *
325 sizeof(void *));
326 if (!info->parameters) {
327 status = AE_NO_MEMORY;
328 goto cleanup;
329 }
330
331 /* Convert each external object in the list to an internal object */
332
333 for (i = 0; i < info->param_count; i++) {
334 status =
335 acpi_ut_copy_eobject_to_iobject
336 (&external_params->pointer[i],
337 &info->parameters[i]);
338 if (ACPI_FAILURE(status)) {
339 goto cleanup;
340 }
341 }
342
343 info->parameters[info->param_count] = NULL;
258 } 344 }
345 break;
259 346
260 status = AE_BAD_PARAMETER; 347 default:
261 } else {
262 /* We have a namespace a node and a possible relative path */
263 348
264 status = acpi_ns_evaluate(info); 349 /* Warn if arguments passed to an object that is not a method */
350
351 if (info->param_count) {
352 ACPI_WARNING((AE_INFO,
353 "%u arguments were passed to a non-method ACPI object",
354 info->param_count));
355 }
356 break;
265 } 357 }
266 358
359#endif
360
361 /* Now we can evaluate the object */
362
363 status = acpi_ns_evaluate(info);
364
267 /* 365 /*
268 * If we are expecting a return value, and all went well above, 366 * If we are expecting a return value, and all went well above,
269 * copy the return value to an external object. 367 * copy the return value to an external object.
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index f68254268965..11b99ab20bb3 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -125,7 +125,7 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info)
125 } 125 }
126 126
127 if ((!acpi_gbl_trace_method_name) || 127 if ((!acpi_gbl_trace_method_name) ||
128 (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { 128 (acpi_gbl_trace_method_name != info->node->name.integer)) {
129 goto exit; 129 goto exit;
130 } 130 }
131 131
@@ -170,7 +170,7 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info)
170 } 170 }
171 171
172 if ((!acpi_gbl_trace_method_name) || 172 if ((!acpi_gbl_trace_method_name) ||
173 (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { 173 (acpi_gbl_trace_method_name != info->node->name.integer)) {
174 goto exit; 174 goto exit;
175 } 175 }
176 176
@@ -226,15 +226,14 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
226 226
227 /* Validate the Info and method Node */ 227 /* Validate the Info and method Node */
228 228
229 if (!info || !info->resolved_node) { 229 if (!info || !info->node) {
230 return_ACPI_STATUS(AE_NULL_ENTRY); 230 return_ACPI_STATUS(AE_NULL_ENTRY);
231 } 231 }
232 232
233 /* Init for new method, wait on concurrency semaphore */ 233 /* Init for new method, wait on concurrency semaphore */
234 234
235 status = 235 status =
236 acpi_ds_begin_method_execution(info->resolved_node, info->obj_desc, 236 acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
237 NULL);
238 if (ACPI_FAILURE(status)) { 237 if (ACPI_FAILURE(status)) {
239 return_ACPI_STATUS(status); 238 return_ACPI_STATUS(status);
240 } 239 }
@@ -253,8 +252,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
253 */ 252 */
254 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, 253 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
255 "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n", 254 "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
256 info->resolved_node->name.ascii, info->resolved_node, 255 info->node->name.ascii, info->node, info->obj_desc));
257 info->obj_desc));
258 256
259 /* Create and init a Root Node */ 257 /* Create and init a Root Node */
260 258
@@ -275,7 +273,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
275 goto cleanup; 273 goto cleanup;
276 } 274 }
277 275
278 status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node, 276 status = acpi_ds_init_aml_walk(walk_state, op, info->node,
279 info->obj_desc->method.aml_start, 277 info->obj_desc->method.aml_start,
280 info->obj_desc->method.aml_length, info, 278 info->obj_desc->method.aml_length, info,
281 info->pass_number); 279 info->pass_number);
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index a44953c6f75d..59bdf37164ba 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -736,7 +736,7 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
736 } 736 }
737 737
738 info->prefix_node = node; 738 info->prefix_node = node;
739 info->pathname = METHOD_NAME__SRS; 739 info->relative_pathname = METHOD_NAME__SRS;
740 info->parameters = args; 740 info->parameters = args;
741 info->flags = ACPI_IGNORE_RETURN_VALUE; 741 info->flags = ACPI_IGNORE_RETURN_VALUE;
742 742
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index c3f3a7e7bdc7..1673dddc9cd5 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -87,7 +87,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node,
87 } 87 }
88 88
89 info->prefix_node = prefix_node; 89 info->prefix_node = prefix_node;
90 info->pathname = path; 90 info->relative_pathname = path;
91 91
92 /* Evaluate the object/method */ 92 /* Evaluate the object/method */
93 93
diff --git a/drivers/acpi/acpica/utpredef.c b/drivers/acpi/acpica/utpredef.c
index 29459479148f..2b1ce4cd3207 100644
--- a/drivers/acpi/acpica/utpredef.c
+++ b/drivers/acpi/acpica/utpredef.c
@@ -147,6 +147,11 @@ void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
147 u32 i; 147 u32 i;
148 u32 j; 148 u32 j;
149 149
150 if (!expected_btypes) {
151 ACPI_STRCPY(buffer, "NONE");
152 return;
153 }
154
150 j = 1; 155 j = 1;
151 buffer[0] = 0; 156 buffer[0] = 0;
152 this_rtype = ACPI_RTYPE_INTEGER; 157 this_rtype = ACPI_RTYPE_INTEGER;
@@ -328,9 +333,7 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
328 333
329 /* First field in the types list is the count of args to follow */ 334 /* First field in the types list is the count of args to follow */
330 335
331 arg_count = (argument_types & METHOD_ARG_MASK); 336 arg_count = METHOD_GET_ARG_COUNT(argument_types);
332 argument_types >>= METHOD_ARG_BIT_WIDTH;
333
334 if (arg_count > METHOD_PREDEF_ARGS_MAX) { 337 if (arg_count > METHOD_PREDEF_ARGS_MAX) {
335 printf("**** Invalid argument count (%u) " 338 printf("**** Invalid argument count (%u) "
336 "in predefined info structure\n", arg_count); 339 "in predefined info structure\n", arg_count);
@@ -340,7 +343,8 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
340 /* Get each argument from the list, convert to ascii, store to buffer */ 343 /* Get each argument from the list, convert to ascii, store to buffer */
341 344
342 for (i = 0; i < arg_count; i++) { 345 for (i = 0; i < arg_count; i++) {
343 this_argument_type = (argument_types & METHOD_ARG_MASK); 346 this_argument_type = METHOD_GET_NEXT_TYPE(argument_types);
347
344 if (!this_argument_type 348 if (!this_argument_type
345 || (this_argument_type > METHOD_MAX_ARG_TYPE)) { 349 || (this_argument_type > METHOD_MAX_ARG_TYPE)) {
346 printf("**** Invalid argument type (%u) " 350 printf("**** Invalid argument type (%u) "
@@ -351,10 +355,6 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
351 355
352 strcat(buffer, 356 strcat(buffer,
353 ut_external_type_names[this_argument_type] + sub_index); 357 ut_external_type_names[this_argument_type] + sub_index);
354
355 /* Shift to next argument type field */
356
357 argument_types >>= METHOD_ARG_BIT_WIDTH;
358 sub_index = 0; 358 sub_index = 0;
359 } 359 }
360 360