aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-28 06:58:14 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-28 06:58:14 -0400
commit80338681bbc5786fa1342d3b7f021c1d8974ac62 (patch)
tree90cdacbab0695fcb8b0f5ad9f484e5a5f6751ecf /drivers
parenta204dbc61b7f4cb1a7e2cb3ad057b135164782da (diff)
parent069189a1c8e897be8c9d8f2365c30a6497100519 (diff)
Merge branch 'acpica'
* acpica: (21 commits) ACPICA: Update version to 20130517 ACPICA: _CST repair: Handle null package entries ACPICA: Add several repairs for _CST predefined name ACPICA: Move _PRT repair into the standard complex repair module ACPICA: Clear events initialized flag upon event component termination ACPICA: Fix possible memory leak in GPE init error path ACPICA: ACPICA Termination: Delete global lock pending lock ACPICA: Update interface to acpi_ut_valid_acpi_name() ACPICA: Do not use extended sleep registers unless HW-reduced bit is set ACPICA: Split table print utilities to a new a separate file ACPICA: Add option to disable loading of SSDTs from the RSDT/XSDT ACPICA: Standardize all switch() blocks ACPICA: Split internal error msg routines to a separate file ACPICA: Split buffer dump routines into separate file ACPICA: Update version to 20130418 ACPICA: Update for "orphan" embedded controller _REG method support ACPICA: Remove unused macros, no functional change ACPICA: Predefined name support: Remove unused local variable ACPICA: Add argument typechecking for all predefined ACPI names ACPICA: Add BIOS error interface for predefined name validation support ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/Makefile4
-rw-r--r--drivers/acpi/acpica/acglobal.h6
-rw-r--r--drivers/acpi/acpica/aclocal.h17
-rw-r--r--drivers/acpi/acpica/acmacros.h10
-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/acutils.h50
-rw-r--r--drivers/acpi/acpica/dscontrol.c4
-rw-r--r--drivers/acpi/acpica/dsfield.c4
-rw-r--r--drivers/acpi/acpica/dsinit.c1
-rw-r--r--drivers/acpi/acpica/dsmthdat.c2
-rw-r--r--drivers/acpi/acpica/dsobject.c3
-rw-r--r--drivers/acpi/acpica/dsopcode.c1
-rw-r--r--drivers/acpi/acpica/dsutils.c5
-rw-r--r--drivers/acpi/acpica/dswexec.c3
-rw-r--r--drivers/acpi/acpica/dswload.c7
-rw-r--r--drivers/acpi/acpica/dswload2.c4
-rw-r--r--drivers/acpi/acpica/evglock.c1
-rw-r--r--drivers/acpi/acpica/evgpe.c7
-rw-r--r--drivers/acpi/acpica/evgpeblk.c2
-rw-r--r--drivers/acpi/acpica/evgpeinit.c3
-rw-r--r--drivers/acpi/acpica/evhandler.c7
-rw-r--r--drivers/acpi/acpica/evmisc.c3
-rw-r--r--drivers/acpi/acpica/evregion.c63
-rw-r--r--drivers/acpi/acpica/evrgnini.c2
-rw-r--r--drivers/acpi/acpica/evxfgpe.c3
-rw-r--r--drivers/acpi/acpica/evxfregn.c1
-rw-r--r--drivers/acpi/acpica/exconfig.c3
-rw-r--r--drivers/acpi/acpica/exconvrt.c13
-rw-r--r--drivers/acpi/acpica/excreate.c3
-rw-r--r--drivers/acpi/acpica/exdebug.c2
-rw-r--r--drivers/acpi/acpica/exdump.c2
-rw-r--r--drivers/acpi/acpica/exfield.c4
-rw-r--r--drivers/acpi/acpica/exfldio.c2
-rw-r--r--drivers/acpi/acpica/exmisc.c12
-rw-r--r--drivers/acpi/acpica/exoparg1.c16
-rw-r--r--drivers/acpi/acpica/exoparg2.c1
-rw-r--r--drivers/acpi/acpica/exoparg3.c1
-rw-r--r--drivers/acpi/acpica/exoparg6.c5
-rw-r--r--drivers/acpi/acpica/exprep.c7
-rw-r--r--drivers/acpi/acpica/exregion.c27
-rw-r--r--drivers/acpi/acpica/exresnte.c1
-rw-r--r--drivers/acpi/acpica/exresolv.c6
-rw-r--r--drivers/acpi/acpica/exresop.c9
-rw-r--r--drivers/acpi/acpica/exstore.c4
-rw-r--r--drivers/acpi/acpica/exstoren.c4
-rw-r--r--drivers/acpi/acpica/hwacpi.c2
-rw-r--r--drivers/acpi/acpica/hwgpe.c3
-rw-r--r--drivers/acpi/acpica/hwregs.c4
-rw-r--r--drivers/acpi/acpica/hwxface.c9
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c12
-rw-r--r--drivers/acpi/acpica/nsaccess.c1
-rw-r--r--drivers/acpi/acpica/nsarguments.c294
-rw-r--r--drivers/acpi/acpica/nsconvert.c3
-rw-r--r--drivers/acpi/acpica/nsdump.c10
-rw-r--r--drivers/acpi/acpica/nseval.c247
-rw-r--r--drivers/acpi/acpica/nsinit.c16
-rw-r--r--drivers/acpi/acpica/nspredef.c216
-rw-r--r--drivers/acpi/acpica/nsprepkg.c81
-rw-r--r--drivers/acpi/acpica/nsrepair.c51
-rw-r--r--drivers/acpi/acpica/nsrepair2.c358
-rw-r--r--drivers/acpi/acpica/nsutils.c3
-rw-r--r--drivers/acpi/acpica/nsxfeval.c163
-rw-r--r--drivers/acpi/acpica/psargs.c4
-rw-r--r--drivers/acpi/acpica/psloop.c2
-rw-r--r--drivers/acpi/acpica/psobject.c1
-rw-r--r--drivers/acpi/acpica/psparse.c3
-rw-r--r--drivers/acpi/acpica/pstree.c2
-rw-r--r--drivers/acpi/acpica/psxface.c14
-rw-r--r--drivers/acpi/acpica/rscalc.c7
-rw-r--r--drivers/acpi/acpica/rscreate.c27
-rw-r--r--drivers/acpi/acpica/rsdump.c10
-rw-r--r--drivers/acpi/acpica/rsmisc.c3
-rw-r--r--drivers/acpi/acpica/rsutils.c7
-rw-r--r--drivers/acpi/acpica/rsxface.c1
-rw-r--r--drivers/acpi/acpica/tbinstal.c7
-rw-r--r--drivers/acpi/acpica/tbprint.c237
-rw-r--r--drivers/acpi/acpica/tbutils.c191
-rw-r--r--drivers/acpi/acpica/tbxfload.c25
-rw-r--r--drivers/acpi/acpica/utbuffer.c201
-rw-r--r--drivers/acpi/acpica/utcopy.c11
-rw-r--r--drivers/acpi/acpica/utdebug.c148
-rw-r--r--drivers/acpi/acpica/utdelete.c3
-rw-r--r--drivers/acpi/acpica/uterror.c289
-rw-r--r--drivers/acpi/acpica/uteval.c9
-rw-r--r--drivers/acpi/acpica/utexcep.c1
-rw-r--r--drivers/acpi/acpica/utids.c3
-rw-r--r--drivers/acpi/acpica/utmisc.c2
-rw-r--r--drivers/acpi/acpica/utobject.c5
-rw-r--r--drivers/acpi/acpica/utpredef.c16
-rw-r--r--drivers/acpi/acpica/utstring.c19
-rw-r--r--drivers/acpi/acpica/uttrack.c8
-rw-r--r--drivers/acpi/acpica/utxferror.c234
-rw-r--r--drivers/acpi/osl.c11
95 files changed, 2144 insertions, 1252 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 7ddf29eca9f5..438304086ff1 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 \
@@ -137,6 +138,7 @@ acpi-y += \
137 tbfadt.o \ 138 tbfadt.o \
138 tbfind.o \ 139 tbfind.o \
139 tbinstal.o \ 140 tbinstal.o \
141 tbprint.o \
140 tbutils.o \ 142 tbutils.o \
141 tbxface.o \ 143 tbxface.o \
142 tbxfload.o \ 144 tbxfload.o \
@@ -145,11 +147,13 @@ acpi-y += \
145acpi-y += \ 147acpi-y += \
146 utaddress.o \ 148 utaddress.o \
147 utalloc.o \ 149 utalloc.o \
150 utbuffer.o \
148 utcopy.o \ 151 utcopy.o \
149 utexcep.o \ 152 utexcep.o \
150 utdebug.o \ 153 utdebug.o \
151 utdecode.o \ 154 utdecode.o \
152 utdelete.o \ 155 utdelete.o \
156 uterror.o \
153 uteval.o \ 157 uteval.o \
154 utglobal.o \ 158 utglobal.o \
155 utids.o \ 159 utids.o \
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 07160928ca25..b8d38117a20c 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -132,6 +132,12 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE);
132 */ 132 */
133u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE); 133u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE);
134 134
135/*
136 * Optionally do not load any SSDTs from the RSDT/XSDT during initialization.
137 * This can be useful for debugging ACPI problems on some machines.
138 */
139u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_ssdt_table_load, FALSE);
140
135/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ 141/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
136 142
137struct acpi_table_fadt acpi_gbl_FADT; 143struct acpi_table_fadt acpi_gbl_FADT;
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/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 53666bd9193d..530a2f8c1252 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -374,10 +374,11 @@
374 * the plist contains a set of parens to allow variable-length lists. 374 * the plist contains a set of parens to allow variable-length lists.
375 * These macros are used for both the debug and non-debug versions of the code. 375 * These macros are used for both the debug and non-debug versions of the code.
376 */ 376 */
377#define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); 377#define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e);
378#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); 378#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e);
379#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist 379#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
380#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist 380#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist
381#define ACPI_BIOS_ERROR_PREDEFINED(plist) acpi_ut_predefined_bios_error plist
381 382
382#else 383#else
383 384
@@ -387,6 +388,7 @@
387#define ACPI_ERROR_METHOD(s, n, p, e) 388#define ACPI_ERROR_METHOD(s, n, p, e)
388#define ACPI_WARN_PREDEFINED(plist) 389#define ACPI_WARN_PREDEFINED(plist)
389#define ACPI_INFO_PREDEFINED(plist) 390#define ACPI_INFO_PREDEFINED(plist)
391#define ACPI_BIOS_ERROR_PREDEFINED(plist)
390 392
391#endif /* ACPI_NO_ERROR_MESSAGES */ 393#endif /* ACPI_NO_ERROR_MESSAGES */
392 394
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/acutils.h b/drivers/acpi/acpica/acutils.h
index 202f4f12d3e2..3c76edea6803 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -87,6 +87,48 @@ extern const char *acpi_gbl_fc_decode[];
87extern const char *acpi_gbl_pt_decode[]; 87extern const char *acpi_gbl_pt_decode[];
88#endif 88#endif
89 89
90/*
91 * For the iASL compiler case, the output is redirected to stderr so that
92 * any of the various ACPI errors and warnings do not appear in the output
93 * files, for either the compiler or disassembler portions of the tool.
94 */
95#ifdef ACPI_ASL_COMPILER
96
97#include <stdio.h>
98extern FILE *acpi_gbl_output_file;
99
100#define ACPI_MSG_REDIRECT_BEGIN \
101 FILE *output_file = acpi_gbl_output_file; \
102 acpi_os_redirect_output (stderr);
103
104#define ACPI_MSG_REDIRECT_END \
105 acpi_os_redirect_output (output_file);
106
107#else
108/*
109 * non-iASL case - no redirection, nothing to do
110 */
111#define ACPI_MSG_REDIRECT_BEGIN
112#define ACPI_MSG_REDIRECT_END
113#endif
114
115/*
116 * Common error message prefixes
117 */
118#define ACPI_MSG_ERROR "ACPI Error: "
119#define ACPI_MSG_EXCEPTION "ACPI Exception: "
120#define ACPI_MSG_WARNING "ACPI Warning: "
121#define ACPI_MSG_INFO "ACPI: "
122
123#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
124#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
125
126/*
127 * Common message suffix
128 */
129#define ACPI_MSG_SUFFIX \
130 acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
131
90/* Types for Resource descriptor entries */ 132/* Types for Resource descriptor entries */
91 133
92#define ACPI_INVALID_RESOURCE 0 134#define ACPI_INVALID_RESOURCE 0
@@ -578,7 +620,7 @@ void acpi_ut_print_string(char *string, u8 max_length);
578 620
579void ut_convert_backslashes(char *pathname); 621void ut_convert_backslashes(char *pathname);
580 622
581u8 acpi_ut_valid_acpi_name(u32 name); 623u8 acpi_ut_valid_acpi_name(char *name);
582 624
583u8 acpi_ut_valid_acpi_char(char character, u32 position); 625u8 acpi_ut_valid_acpi_char(char character, u32 position);
584 626
@@ -670,6 +712,12 @@ acpi_ut_predefined_info(const char *module_name,
670 u32 line_number, 712 u32 line_number,
671 char *pathname, u8 node_flags, const char *format, ...); 713 char *pathname, u8 node_flags, const char *format, ...);
672 714
715void ACPI_INTERNAL_VAR_XFACE
716acpi_ut_predefined_bios_error(const char *module_name,
717 u32 line_number,
718 char *pathname,
719 u8 node_flags, const char *format, ...);
720
673void 721void
674acpi_ut_namespace_error(const char *module_name, 722acpi_ut_namespace_error(const char *module_name,
675 u32 line_number, 723 u32 line_number,
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index 7ea0f162f11c..eb56b66444b5 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -78,7 +78,6 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
78 78
79 switch (op->common.aml_opcode) { 79 switch (op->common.aml_opcode) {
80 case AML_WHILE_OP: 80 case AML_WHILE_OP:
81
82 /* 81 /*
83 * If this is an additional iteration of a while loop, continue. 82 * If this is an additional iteration of a while loop, continue.
84 * There is no need to allocate a new control state. 83 * There is no need to allocate a new control state.
@@ -99,7 +98,6 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
99 /*lint -fallthrough */ 98 /*lint -fallthrough */
100 99
101 case AML_IF_OP: 100 case AML_IF_OP:
102
103 /* 101 /*
104 * IF/WHILE: Create a new control state to manage these 102 * IF/WHILE: Create a new control state to manage these
105 * constructs. We need to manage these as a stack, in order 103 * constructs. We need to manage these as a stack, in order
@@ -142,6 +140,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
142 break; 140 break;
143 141
144 default: 142 default:
143
145 break; 144 break;
146 } 145 }
147 146
@@ -344,6 +343,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
344 case AML_NOOP_OP: 343 case AML_NOOP_OP:
345 344
346 /* Just do nothing! */ 345 /* Just do nothing! */
346
347 break; 347 break;
348 348
349 case AML_BREAK_POINT_OP: 349 case AML_BREAK_POINT_OP:
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index feadeed1012d..d4bfe7b7f90a 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -563,21 +563,25 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
563 */ 563 */
564 switch (walk_state->opcode) { 564 switch (walk_state->opcode) {
565 case AML_FIELD_OP: 565 case AML_FIELD_OP:
566
566 arg = acpi_ps_get_arg(op, 2); 567 arg = acpi_ps_get_arg(op, 2);
567 type = ACPI_TYPE_LOCAL_REGION_FIELD; 568 type = ACPI_TYPE_LOCAL_REGION_FIELD;
568 break; 569 break;
569 570
570 case AML_BANK_FIELD_OP: 571 case AML_BANK_FIELD_OP:
572
571 arg = acpi_ps_get_arg(op, 4); 573 arg = acpi_ps_get_arg(op, 4);
572 type = ACPI_TYPE_LOCAL_BANK_FIELD; 574 type = ACPI_TYPE_LOCAL_BANK_FIELD;
573 break; 575 break;
574 576
575 case AML_INDEX_FIELD_OP: 577 case AML_INDEX_FIELD_OP:
578
576 arg = acpi_ps_get_arg(op, 3); 579 arg = acpi_ps_get_arg(op, 3);
577 type = ACPI_TYPE_LOCAL_INDEX_FIELD; 580 type = ACPI_TYPE_LOCAL_INDEX_FIELD;
578 break; 581 break;
579 582
580 default: 583 default:
584
581 return_ACPI_STATUS(AE_BAD_PARAMETER); 585 return_ACPI_STATUS(AE_BAD_PARAMETER);
582 } 586 }
583 587
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index bc8e63f7784b..14424200d246 100644
--- a/drivers/acpi/acpica/dsinit.c
+++ b/drivers/acpi/acpica/dsinit.c
@@ -127,6 +127,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
127 break; 127 break;
128 128
129 default: 129 default:
130
130 break; 131 break;
131 } 132 }
132 133
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index 3da80460ce38..c4b0b3657237 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -285,6 +285,7 @@ acpi_ds_method_data_get_node(u8 type,
285 break; 285 break;
286 286
287 default: 287 default:
288
288 ACPI_ERROR((AE_INFO, "Type %u is invalid", type)); 289 ACPI_ERROR((AE_INFO, "Type %u is invalid", type));
289 return_ACPI_STATUS(AE_TYPE); 290 return_ACPI_STATUS(AE_TYPE);
290 } 291 }
@@ -428,7 +429,6 @@ acpi_ds_method_data_get_value(u8 type,
428 return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); 429 return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
429 430
430 case ACPI_REFCLASS_LOCAL: 431 case ACPI_REFCLASS_LOCAL:
431
432 /* 432 /*
433 * No error message for this case, will be trapped again later to 433 * No error message for this case, will be trapped again later to
434 * detect and ignore cases of Store(local_x,local_x) 434 * detect and ignore cases of Store(local_x,local_x)
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index e20e9f84eee8..63f0d220ca3d 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -648,7 +648,6 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
648 648
649 switch (obj_desc->common.type) { 649 switch (obj_desc->common.type) {
650 case ACPI_TYPE_BUFFER: 650 case ACPI_TYPE_BUFFER:
651
652 /* 651 /*
653 * Defer evaluation of Buffer term_arg operand 652 * Defer evaluation of Buffer term_arg operand
654 */ 653 */
@@ -660,7 +659,6 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
660 break; 659 break;
661 660
662 case ACPI_TYPE_PACKAGE: 661 case ACPI_TYPE_PACKAGE:
663
664 /* 662 /*
665 * Defer evaluation of Package term_arg operand 663 * Defer evaluation of Package term_arg operand
666 */ 664 */
@@ -741,6 +739,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
741 break; 739 break;
742 740
743 default: 741 default:
742
744 ACPI_ERROR((AE_INFO, "Unknown Integer type 0x%X", 743 ACPI_ERROR((AE_INFO, "Unknown Integer type 0x%X",
745 op_info->type)); 744 op_info->type));
746 status = AE_AML_OPERAND_TYPE; 745 status = AE_AML_OPERAND_TYPE;
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index ee6367b8eaf7..1fc1ff114f26 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -636,6 +636,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
636 break; 636 break;
637 637
638 default: 638 default:
639
639 return_ACPI_STATUS(AE_AML_BAD_OPCODE); 640 return_ACPI_STATUS(AE_AML_BAD_OPCODE);
640 } 641 }
641 642
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index 99778997c35a..c666fc014987 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -240,7 +240,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
240 240
241 case AML_IF_OP: 241 case AML_IF_OP:
242 case AML_WHILE_OP: 242 case AML_WHILE_OP:
243
244 /* 243 /*
245 * If we are executing the predicate AND this is the predicate op, 244 * If we are executing the predicate AND this is the predicate op,
246 * we will use the return value 245 * we will use the return value
@@ -254,7 +253,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
254 break; 253 break;
255 254
256 default: 255 default:
256
257 /* Ignore other control opcodes */ 257 /* Ignore other control opcodes */
258
258 break; 259 break;
259 } 260 }
260 261
@@ -263,7 +264,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
263 goto result_not_used; 264 goto result_not_used;
264 265
265 case AML_CLASS_CREATE: 266 case AML_CLASS_CREATE:
266
267 /* 267 /*
268 * These opcodes allow term_arg(s) as operands and therefore 268 * These opcodes allow term_arg(s) as operands and therefore
269 * the operands can be method calls. The result is used. 269 * the operands can be method calls. The result is used.
@@ -292,7 +292,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
292 goto result_not_used; 292 goto result_not_used;
293 293
294 default: 294 default:
295
296 /* 295 /*
297 * In all other cases. the parent will actually use the return 296 * In all other cases. the parent will actually use the return
298 * object, so keep it. 297 * object, so keep it.
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index e2199a947470..151d924817e1 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -327,6 +327,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
327 break; 327 break;
328 328
329 default: 329 default:
330
330 break; 331 break;
331 } 332 }
332 333
@@ -488,7 +489,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
488 break; 489 break;
489 490
490 case AML_TYPE_METHOD_CALL: 491 case AML_TYPE_METHOD_CALL:
491
492 /* 492 /*
493 * If the method is referenced from within a package 493 * If the method is referenced from within a package
494 * declaration, it is not a invocation of the method, just 494 * declaration, it is not a invocation of the method, just
@@ -582,7 +582,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
582 582
583 switch (op->common.parent->common.aml_opcode) { 583 switch (op->common.parent->common.aml_opcode) {
584 case AML_NAME_OP: 584 case AML_NAME_OP:
585
586 /* 585 /*
587 * Put the Node on the object stack (Contains the ACPI Name 586 * Put the Node on the object stack (Contains the ACPI Name
588 * of this object) 587 * of this object)
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 6e17c0e24e63..95e681a36f9c 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -74,6 +74,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
74 74
75 switch (pass_number) { 75 switch (pass_number) {
76 case 1: 76 case 1:
77
77 walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | 78 walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
78 ACPI_PARSE_DELETE_TREE; 79 ACPI_PARSE_DELETE_TREE;
79 walk_state->descending_callback = acpi_ds_load1_begin_op; 80 walk_state->descending_callback = acpi_ds_load1_begin_op;
@@ -81,6 +82,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
81 break; 82 break;
82 83
83 case 2: 84 case 2:
85
84 walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | 86 walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
85 ACPI_PARSE_DELETE_TREE; 87 ACPI_PARSE_DELETE_TREE;
86 walk_state->descending_callback = acpi_ds_load2_begin_op; 88 walk_state->descending_callback = acpi_ds_load2_begin_op;
@@ -88,6 +90,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
88 break; 90 break;
89 91
90 case 3: 92 case 3:
93
91#ifndef ACPI_NO_METHOD_EXECUTION 94#ifndef ACPI_NO_METHOD_EXECUTION
92 walk_state->parse_flags |= ACPI_PARSE_EXECUTE | 95 walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
93 ACPI_PARSE_DELETE_TREE; 96 ACPI_PARSE_DELETE_TREE;
@@ -97,6 +100,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
97 break; 100 break;
98 101
99 default: 102 default:
103
100 return (AE_BAD_PARAMETER); 104 return (AE_BAD_PARAMETER);
101 } 105 }
102 106
@@ -161,7 +165,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
161 165
162 switch (walk_state->opcode) { 166 switch (walk_state->opcode) {
163 case AML_SCOPE_OP: 167 case AML_SCOPE_OP:
164
165 /* 168 /*
166 * The target name of the Scope() operator must exist at this point so 169 * The target name of the Scope() operator must exist at this point so
167 * that we can actually open the scope to enter new names underneath it. 170 * that we can actually open the scope to enter new names underneath it.
@@ -210,7 +213,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
210 case ACPI_TYPE_INTEGER: 213 case ACPI_TYPE_INTEGER:
211 case ACPI_TYPE_STRING: 214 case ACPI_TYPE_STRING:
212 case ACPI_TYPE_BUFFER: 215 case ACPI_TYPE_BUFFER:
213
214 /* 216 /*
215 * These types we will allow, but we will change the type. 217 * These types we will allow, but we will change the type.
216 * This enables some existing code of the form: 218 * This enables some existing code of the form:
@@ -232,7 +234,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
232 break; 234 break;
233 235
234 case ACPI_TYPE_METHOD: 236 case ACPI_TYPE_METHOD:
235
236 /* 237 /*
237 * Allow scope change to root during execution of module-level 238 * Allow scope change to root during execution of module-level
238 * code. Root is typed METHOD during this time. 239 * code. Root is typed METHOD during this time.
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index 4407ff2377d5..b1f8f4725c23 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -509,6 +509,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
509 break; 509 break;
510 510
511 default: 511 default:
512
512 /* All NAMED_FIELD opcodes must be handled above */ 513 /* All NAMED_FIELD opcodes must be handled above */
513 break; 514 break;
514 } 515 }
@@ -548,6 +549,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
548 break; 549 break;
549 550
550 default: 551 default:
552
551 /* Unknown opcode */ 553 /* Unknown opcode */
552 554
553 status = AE_OK; 555 status = AE_OK;
@@ -674,6 +676,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
674#endif /* ACPI_NO_METHOD_EXECUTION */ 676#endif /* ACPI_NO_METHOD_EXECUTION */
675 677
676 default: 678 default:
679
677 /* All NAMED_COMPLEX opcodes must be handled above */ 680 /* All NAMED_COMPLEX opcodes must be handled above */
678 break; 681 break;
679 } 682 }
@@ -721,6 +724,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
721 break; 724 break;
722 725
723 default: 726 default:
727
724 break; 728 break;
725 } 729 }
726 730
diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c
index a621481c6cf2..fdb0a76e40a3 100644
--- a/drivers/acpi/acpica/evglock.c
+++ b/drivers/acpi/acpica/evglock.c
@@ -128,6 +128,7 @@ acpi_status acpi_ev_remove_global_lock_handler(void)
128 status = acpi_remove_fixed_event_handler(ACPI_EVENT_GLOBAL, 128 status = acpi_remove_fixed_event_handler(ACPI_EVENT_GLOBAL,
129 acpi_ev_global_lock_handler); 129 acpi_ev_global_lock_handler);
130 130
131 acpi_os_delete_lock(acpi_gbl_global_lock_pending_lock);
131 return_ACPI_STATUS(status); 132 return_ACPI_STATUS(status);
132} 133}
133 134
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index a493b528f8f9..c8a1f7d5931f 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -529,7 +529,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
529 529
530 switch (local_gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) { 530 switch (local_gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) {
531 case ACPI_GPE_DISPATCH_NOTIFY: 531 case ACPI_GPE_DISPATCH_NOTIFY:
532
533 /* 532 /*
534 * Implicit notify. 533 * Implicit notify.
535 * Dispatch a DEVICE_WAKE notify to the appropriate handler. 534 * Dispatch a DEVICE_WAKE notify to the appropriate handler.
@@ -579,11 +578,11 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
579 (local_gpe_event_info->dispatch. 578 (local_gpe_event_info->dispatch.
580 method_node))); 579 method_node)));
581 } 580 }
582
583 break; 581 break;
584 582
585 default: 583 default:
586 return_VOID; /* Should never happen */ 584
585 return_VOID; /* Should never happen */
587 } 586 }
588 587
589 /* Defer enabling of GPE until all notify handlers are done */ 588 /* Defer enabling of GPE until all notify handlers are done */
@@ -755,7 +754,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
755 754
756 case ACPI_GPE_DISPATCH_METHOD: 755 case ACPI_GPE_DISPATCH_METHOD:
757 case ACPI_GPE_DISPATCH_NOTIFY: 756 case ACPI_GPE_DISPATCH_NOTIFY:
758
759 /* 757 /*
760 * Execute the method associated with the GPE 758 * Execute the method associated with the GPE
761 * NOTE: Level-triggered GPEs are cleared after the method completes. 759 * NOTE: Level-triggered GPEs are cleared after the method completes.
@@ -771,7 +769,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
771 break; 769 break;
772 770
773 default: 771 default:
774
775 /* 772 /*
776 * No handler or method to run! 773 * No handler or method to run!
777 * 03/2010: This case should no longer be possible. We will not allow 774 * 03/2010: This case should no longer be possible. We will not allow
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index a2d688bbac02..c1aa1eda26c3 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -382,6 +382,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
382 382
383 status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); 383 status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
384 if (ACPI_FAILURE(status)) { 384 if (ACPI_FAILURE(status)) {
385 ACPI_FREE(gpe_block->register_info);
386 ACPI_FREE(gpe_block->event_info);
385 ACPI_FREE(gpe_block); 387 ACPI_FREE(gpe_block);
386 return_ACPI_STATUS(status); 388 return_ACPI_STATUS(status);
387 } 389 }
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c
index 72b8f6b3f4ca..9037f17c9608 100644
--- a/drivers/acpi/acpica/evgpeinit.c
+++ b/drivers/acpi/acpica/evgpeinit.c
@@ -363,14 +363,17 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
363 */ 363 */
364 switch (name[1]) { 364 switch (name[1]) {
365 case 'L': 365 case 'L':
366
366 type = ACPI_GPE_LEVEL_TRIGGERED; 367 type = ACPI_GPE_LEVEL_TRIGGERED;
367 break; 368 break;
368 369
369 case 'E': 370 case 'E':
371
370 type = ACPI_GPE_EDGE_TRIGGERED; 372 type = ACPI_GPE_EDGE_TRIGGERED;
371 break; 373 break;
372 374
373 default: 375 default:
376
374 /* Unknown method type, just ignore it */ 377 /* Unknown method type, just ignore it */
375 378
376 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 379 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c
index d4f83112c2e2..068af96134b8 100644
--- a/drivers/acpi/acpica/evhandler.c
+++ b/drivers/acpi/acpica/evhandler.c
@@ -354,36 +354,43 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
354 354
355 switch (space_id) { 355 switch (space_id) {
356 case ACPI_ADR_SPACE_SYSTEM_MEMORY: 356 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
357
357 handler = acpi_ex_system_memory_space_handler; 358 handler = acpi_ex_system_memory_space_handler;
358 setup = acpi_ev_system_memory_region_setup; 359 setup = acpi_ev_system_memory_region_setup;
359 break; 360 break;
360 361
361 case ACPI_ADR_SPACE_SYSTEM_IO: 362 case ACPI_ADR_SPACE_SYSTEM_IO:
363
362 handler = acpi_ex_system_io_space_handler; 364 handler = acpi_ex_system_io_space_handler;
363 setup = acpi_ev_io_space_region_setup; 365 setup = acpi_ev_io_space_region_setup;
364 break; 366 break;
365 367
366 case ACPI_ADR_SPACE_PCI_CONFIG: 368 case ACPI_ADR_SPACE_PCI_CONFIG:
369
367 handler = acpi_ex_pci_config_space_handler; 370 handler = acpi_ex_pci_config_space_handler;
368 setup = acpi_ev_pci_config_region_setup; 371 setup = acpi_ev_pci_config_region_setup;
369 break; 372 break;
370 373
371 case ACPI_ADR_SPACE_CMOS: 374 case ACPI_ADR_SPACE_CMOS:
375
372 handler = acpi_ex_cmos_space_handler; 376 handler = acpi_ex_cmos_space_handler;
373 setup = acpi_ev_cmos_region_setup; 377 setup = acpi_ev_cmos_region_setup;
374 break; 378 break;
375 379
376 case ACPI_ADR_SPACE_PCI_BAR_TARGET: 380 case ACPI_ADR_SPACE_PCI_BAR_TARGET:
381
377 handler = acpi_ex_pci_bar_space_handler; 382 handler = acpi_ex_pci_bar_space_handler;
378 setup = acpi_ev_pci_bar_region_setup; 383 setup = acpi_ev_pci_bar_region_setup;
379 break; 384 break;
380 385
381 case ACPI_ADR_SPACE_DATA_TABLE: 386 case ACPI_ADR_SPACE_DATA_TABLE:
387
382 handler = acpi_ex_data_table_space_handler; 388 handler = acpi_ex_data_table_space_handler;
383 setup = NULL; 389 setup = NULL;
384 break; 390 break;
385 391
386 default: 392 default:
393
387 status = AE_BAD_PARAMETER; 394 status = AE_BAD_PARAMETER;
388 goto unlock_and_exit; 395 goto unlock_and_exit;
389 } 396 }
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index c986b2336b81..1b111ef74903 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -78,6 +78,7 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
78 return (TRUE); 78 return (TRUE);
79 79
80 default: 80 default:
81
81 return (FALSE); 82 return (FALSE);
82 } 83 }
83} 84}
@@ -275,6 +276,8 @@ void acpi_ev_terminate(void)
275 ACPI_ERROR((AE_INFO, 276 ACPI_ERROR((AE_INFO,
276 "Could not remove Global Lock handler")); 277 "Could not remove Global Lock handler"));
277 } 278 }
279
280 acpi_gbl_events_initialized = FALSE;
278 } 281 }
279 282
280 /* Deallocate all handler objects installed within GPE info structs */ 283 /* Deallocate all handler objects installed within GPE info structs */
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 6555e350fc1f..cea14d6fc76c 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -54,7 +54,8 @@ extern u8 acpi_gbl_default_address_spaces[];
54 54
55/* Local prototypes */ 55/* Local prototypes */
56 56
57static void acpi_ev_orphan_ec_reg_method(void); 57static void
58acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node);
58 59
59static acpi_status 60static acpi_status
60acpi_ev_reg_run(acpi_handle obj_handle, 61acpi_ev_reg_run(acpi_handle obj_handle,
@@ -532,7 +533,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
532 } 533 }
533 534
534 info->prefix_node = region_obj2->extra.method_REG; 535 info->prefix_node = region_obj2->extra.method_REG;
535 info->pathname = NULL; 536 info->relative_pathname = NULL;
536 info->parameters = args; 537 info->parameters = args;
537 info->flags = ACPI_IGNORE_RETURN_VALUE; 538 info->flags = ACPI_IGNORE_RETURN_VALUE;
538 539
@@ -612,7 +613,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
612 /* Special case for EC: handle "orphan" _REG methods with no region */ 613 /* Special case for EC: handle "orphan" _REG methods with no region */
613 614
614 if (space_id == ACPI_ADR_SPACE_EC) { 615 if (space_id == ACPI_ADR_SPACE_EC) {
615 acpi_ev_orphan_ec_reg_method(); 616 acpi_ev_orphan_ec_reg_method(node);
616 } 617 }
617 618
618 return_ACPI_STATUS(status); 619 return_ACPI_STATUS(status);
@@ -681,7 +682,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
681 * 682 *
682 * FUNCTION: acpi_ev_orphan_ec_reg_method 683 * FUNCTION: acpi_ev_orphan_ec_reg_method
683 * 684 *
684 * PARAMETERS: None 685 * PARAMETERS: ec_device_node - Namespace node for an EC device
685 * 686 *
686 * RETURN: None 687 * RETURN: None
687 * 688 *
@@ -693,37 +694,27 @@ acpi_ev_reg_run(acpi_handle obj_handle,
693 * detected by providing a _REG method object underneath the 694 * detected by providing a _REG method object underneath the
694 * Embedded Controller device." 695 * Embedded Controller device."
695 * 696 *
696 * To quickly access the EC device, we use the EC_ID that appears 697 * To quickly access the EC device, we use the ec_device_node used
697 * within the ECDT. Otherwise, we would need to perform a time- 698 * during EC handler installation. Otherwise, we would need to
698 * consuming namespace walk, executing _HID methods to find the 699 * perform a time consuming namespace walk, executing _HID
699 * EC device. 700 * methods to find the EC device.
701 *
702 * MUTEX: Assumes the namespace is locked
700 * 703 *
701 ******************************************************************************/ 704 ******************************************************************************/
702 705
703static void acpi_ev_orphan_ec_reg_method(void) 706static void
707acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node)
704{ 708{
705 struct acpi_table_ecdt *table; 709 acpi_handle reg_method;
710 struct acpi_namespace_node *next_node;
706 acpi_status status; 711 acpi_status status;
707 struct acpi_object_list args; 712 struct acpi_object_list args;
708 union acpi_object objects[2]; 713 union acpi_object objects[2];
709 struct acpi_namespace_node *ec_device_node;
710 struct acpi_namespace_node *reg_method;
711 struct acpi_namespace_node *next_node;
712 714
713 ACPI_FUNCTION_TRACE(ev_orphan_ec_reg_method); 715 ACPI_FUNCTION_TRACE(ev_orphan_ec_reg_method);
714 716
715 /* Get the ECDT (if present in system) */ 717 if (!ec_device_node) {
716
717 status = acpi_get_table(ACPI_SIG_ECDT, 0,
718 ACPI_CAST_INDIRECT_PTR(struct acpi_table_header,
719 &table));
720 if (ACPI_FAILURE(status)) {
721 return_VOID;
722 }
723
724 /* We need a valid EC_ID string */
725
726 if (!(*table->id)) {
727 return_VOID; 718 return_VOID;
728 } 719 }
729 720
@@ -731,22 +722,11 @@ static void acpi_ev_orphan_ec_reg_method(void)
731 722
732 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 723 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
733 724
734 /* Get a handle to the EC device referenced in the ECDT */
735
736 status = acpi_get_handle(NULL,
737 ACPI_CAST_PTR(char, table->id),
738 ACPI_CAST_PTR(acpi_handle, &ec_device_node));
739 if (ACPI_FAILURE(status)) {
740 goto exit;
741 }
742
743 /* Get a handle to a _REG method immediately under the EC device */ 725 /* Get a handle to a _REG method immediately under the EC device */
744 726
745 status = acpi_get_handle(ec_device_node, 727 status = acpi_get_handle(ec_device_node, METHOD_NAME__REG, &reg_method);
746 METHOD_NAME__REG, ACPI_CAST_PTR(acpi_handle,
747 &reg_method));
748 if (ACPI_FAILURE(status)) { 728 if (ACPI_FAILURE(status)) {
749 goto exit; 729 goto exit; /* There is no _REG method present */
750 } 730 }
751 731
752 /* 732 /*
@@ -754,19 +734,20 @@ static void acpi_ev_orphan_ec_reg_method(void)
754 * this scope with the Embedded Controller space ID. Otherwise, it 734 * this scope with the Embedded Controller space ID. Otherwise, it
755 * will already have been executed. Note, this allows for Regions 735 * will already have been executed. Note, this allows for Regions
756 * with other space IDs to be present; but the code below will then 736 * with other space IDs to be present; but the code below will then
757 * execute the _REG method with the EC space ID argument. 737 * execute the _REG method with the embedded_control space_ID argument.
758 */ 738 */
759 next_node = acpi_ns_get_next_node(ec_device_node, NULL); 739 next_node = acpi_ns_get_next_node(ec_device_node, NULL);
760 while (next_node) { 740 while (next_node) {
761 if ((next_node->type == ACPI_TYPE_REGION) && 741 if ((next_node->type == ACPI_TYPE_REGION) &&
762 (next_node->object) && 742 (next_node->object) &&
763 (next_node->object->region.space_id == ACPI_ADR_SPACE_EC)) { 743 (next_node->object->region.space_id == ACPI_ADR_SPACE_EC)) {
764 goto exit; /* Do not execute _REG */ 744 goto exit; /* Do not execute the _REG */
765 } 745 }
746
766 next_node = acpi_ns_get_next_node(ec_device_node, next_node); 747 next_node = acpi_ns_get_next_node(ec_device_node, next_node);
767 } 748 }
768 749
769 /* Evaluate the _REG(EC,Connect) method */ 750 /* Evaluate the _REG(embedded_control,Connect) method */
770 751
771 args.count = 2; 752 args.count = 2;
772 args.pointer = objects; 753 args.pointer = objects;
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 3bb616794b3b..8354c4f7f10c 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -596,7 +596,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
596 break; 596 break;
597 597
598 default: 598 default:
599
599 /* Ignore other objects */ 600 /* Ignore other objects */
601
600 break; 602 break;
601 } 603 }
602 604
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index aff4cc261211..7662f1a42ff6 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -366,16 +366,19 @@ acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action)
366 366
367 switch (action) { 367 switch (action) {
368 case ACPI_GPE_ENABLE: 368 case ACPI_GPE_ENABLE:
369
369 ACPI_SET_BIT(gpe_register_info->enable_for_wake, 370 ACPI_SET_BIT(gpe_register_info->enable_for_wake,
370 (u8)register_bit); 371 (u8)register_bit);
371 break; 372 break;
372 373
373 case ACPI_GPE_DISABLE: 374 case ACPI_GPE_DISABLE:
375
374 ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, 376 ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
375 (u8)register_bit); 377 (u8)register_bit);
376 break; 378 break;
377 379
378 default: 380 default:
381
379 ACPI_ERROR((AE_INFO, "%u, Invalid action", action)); 382 ACPI_ERROR((AE_INFO, "%u, Invalid action", action));
380 status = AE_BAD_PARAMETER; 383 status = AE_BAD_PARAMETER;
381 break; 384 break;
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index 96c9e5f355ae..80cecf838591 100644
--- a/drivers/acpi/acpica/evxfregn.c
+++ b/drivers/acpi/acpica/evxfregn.c
@@ -139,6 +139,7 @@ acpi_install_address_space_handler(acpi_handle device,
139 break; 139 break;
140 140
141 default: 141 default:
142
142 break; 143 break;
143 } 144 }
144 145
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index d93b70be60ad..06d216c8d43a 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -480,6 +480,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
480 break; 480 break;
481 481
482 default: 482 default:
483
483 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 484 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
484 } 485 }
485 486
@@ -588,7 +589,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
588 (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) || 589 (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
589 (ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE) || 590 (ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE) ||
590 (!(ddb_handle->common.flags & AOPOBJ_DATA_VALID))) { 591 (!(ddb_handle->common.flags & AOPOBJ_DATA_VALID))) {
591 return_ACPI_STATUS(AE_BAD_PARAMETER); 592 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
592 } 593 }
593 594
594 /* Get the table index from the ddb_handle */ 595 /* Get the table index from the ddb_handle */
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index d2b9613bbf01..69e4a8cc9b71 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -99,6 +99,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
99 break; 99 break;
100 100
101 default: 101 default:
102
102 return_ACPI_STATUS(AE_TYPE); 103 return_ACPI_STATUS(AE_TYPE);
103 } 104 }
104 105
@@ -117,7 +118,6 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
117 118
118 switch (obj_desc->common.type) { 119 switch (obj_desc->common.type) {
119 case ACPI_TYPE_STRING: 120 case ACPI_TYPE_STRING:
120
121 /* 121 /*
122 * Convert string to an integer - for most cases, the string must be 122 * Convert string to an integer - for most cases, the string must be
123 * hexadecimal as per the ACPI specification. The only exception (as 123 * hexadecimal as per the ACPI specification. The only exception (as
@@ -161,6 +161,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
161 default: 161 default:
162 162
163 /* No other types can get here */ 163 /* No other types can get here */
164
164 break; 165 break;
165 } 166 }
166 167
@@ -213,7 +214,6 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
213 return_ACPI_STATUS(AE_OK); 214 return_ACPI_STATUS(AE_OK);
214 215
215 case ACPI_TYPE_INTEGER: 216 case ACPI_TYPE_INTEGER:
216
217 /* 217 /*
218 * Create a new Buffer object. 218 * Create a new Buffer object.
219 * Need enough space for one integer 219 * Need enough space for one integer
@@ -233,7 +233,6 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
233 break; 233 break;
234 234
235 case ACPI_TYPE_STRING: 235 case ACPI_TYPE_STRING:
236
237 /* 236 /*
238 * Create a new Buffer object 237 * Create a new Buffer object
239 * Size will be the string length 238 * Size will be the string length
@@ -258,6 +257,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
258 break; 257 break;
259 258
260 default: 259 default:
260
261 return_ACPI_STATUS(AE_TYPE); 261 return_ACPI_STATUS(AE_TYPE);
262 } 262 }
263 263
@@ -304,15 +304,18 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
304 304
305 switch (data_width) { 305 switch (data_width) {
306 case 1: 306 case 1:
307
307 decimal_length = ACPI_MAX8_DECIMAL_DIGITS; 308 decimal_length = ACPI_MAX8_DECIMAL_DIGITS;
308 break; 309 break;
309 310
310 case 4: 311 case 4:
312
311 decimal_length = ACPI_MAX32_DECIMAL_DIGITS; 313 decimal_length = ACPI_MAX32_DECIMAL_DIGITS;
312 break; 314 break;
313 315
314 case 8: 316 case 8:
315 default: 317 default:
318
316 decimal_length = ACPI_MAX64_DECIMAL_DIGITS; 319 decimal_length = ACPI_MAX64_DECIMAL_DIGITS;
317 break; 320 break;
318 } 321 }
@@ -546,6 +549,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
546 break; 549 break;
547 550
548 default: 551 default:
552
549 return_ACPI_STATUS(AE_TYPE); 553 return_ACPI_STATUS(AE_TYPE);
550 } 554 }
551 555
@@ -599,6 +603,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
599 break; 603 break;
600 604
601 default: 605 default:
606
602 /* No conversion allowed for these types */ 607 /* No conversion allowed for these types */
603 608
604 if (destination_type != source_desc->common.type) { 609 if (destination_type != source_desc->common.type) {
@@ -649,6 +654,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
649 break; 654 break;
650 655
651 default: 656 default:
657
652 ACPI_ERROR((AE_INFO, 658 ACPI_ERROR((AE_INFO,
653 "Bad destination type during conversion: 0x%X", 659 "Bad destination type during conversion: 0x%X",
654 destination_type)); 660 destination_type));
@@ -664,6 +670,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
664 break; 670 break;
665 671
666 default: 672 default:
673
667 ACPI_ERROR((AE_INFO, 674 ACPI_ERROR((AE_INFO,
668 "Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s", 675 "Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
669 GET_CURRENT_ARG_TYPE(walk_state->op_info-> 676 GET_CURRENT_ARG_TYPE(walk_state->op_info->
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index 26a13f67977e..269e81d86ef4 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -103,7 +103,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
103 case ACPI_TYPE_BUFFER: 103 case ACPI_TYPE_BUFFER:
104 case ACPI_TYPE_PACKAGE: 104 case ACPI_TYPE_PACKAGE:
105 case ACPI_TYPE_BUFFER_FIELD: 105 case ACPI_TYPE_BUFFER_FIELD:
106
107 /* 106 /*
108 * These types open a new scope, so we need the NS node in order to access 107 * These types open a new scope, so we need the NS node in order to access
109 * any children. 108 * any children.
@@ -113,7 +112,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
113 case ACPI_TYPE_PROCESSOR: 112 case ACPI_TYPE_PROCESSOR:
114 case ACPI_TYPE_THERMAL: 113 case ACPI_TYPE_THERMAL:
115 case ACPI_TYPE_LOCAL_SCOPE: 114 case ACPI_TYPE_LOCAL_SCOPE:
116
117 /* 115 /*
118 * The new alias has the type ALIAS and points to the original 116 * The new alias has the type ALIAS and points to the original
119 * NS node, not the object itself. 117 * NS node, not the object itself.
@@ -124,7 +122,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
124 break; 122 break;
125 123
126 case ACPI_TYPE_METHOD: 124 case ACPI_TYPE_METHOD:
127
128 /* 125 /*
129 * Control method aliases need to be differentiated 126 * Control method aliases need to be differentiated
130 */ 127 */
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index 7eb853cd279f..81c72a4ecd82 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -193,6 +193,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
193 return_VOID; 193 return_VOID;
194 194
195 default: 195 default:
196
196 break; 197 break;
197 } 198 }
198 199
@@ -226,6 +227,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
226 break; 227 break;
227 228
228 default: 229 default:
230
229 acpi_ex_do_debug_object((source_desc-> 231 acpi_ex_do_debug_object((source_desc->
230 reference. 232 reference.
231 node)->object, 233 node)->object,
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index e5a3c249f7fa..c740f24e3101 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -357,6 +357,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
357 357
358 switch (info->opcode) { 358 switch (info->opcode) {
359 case ACPI_EXD_INIT: 359 case ACPI_EXD_INIT:
360
360 break; 361 break;
361 362
362 case ACPI_EXD_TYPE: 363 case ACPI_EXD_TYPE:
@@ -718,6 +719,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
718 break; 719 break;
719 720
720 default: 721 default:
722
721 /* Unknown Type */ 723 /* Unknown Type */
722 724
723 acpi_os_printf("Unknown Type %X\n", obj_desc->common.type); 725 acpi_os_printf("Unknown Type %X\n", obj_desc->common.type);
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index 7d4bae71e8c6..c2a65aaf29af 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -331,21 +331,25 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
331 331
332 switch (source_desc->common.type) { 332 switch (source_desc->common.type) {
333 case ACPI_TYPE_INTEGER: 333 case ACPI_TYPE_INTEGER:
334
334 buffer = &source_desc->integer.value; 335 buffer = &source_desc->integer.value;
335 length = sizeof(source_desc->integer.value); 336 length = sizeof(source_desc->integer.value);
336 break; 337 break;
337 338
338 case ACPI_TYPE_BUFFER: 339 case ACPI_TYPE_BUFFER:
340
339 buffer = source_desc->buffer.pointer; 341 buffer = source_desc->buffer.pointer;
340 length = source_desc->buffer.length; 342 length = source_desc->buffer.length;
341 break; 343 break;
342 344
343 case ACPI_TYPE_STRING: 345 case ACPI_TYPE_STRING:
346
344 buffer = source_desc->string.pointer; 347 buffer = source_desc->string.pointer;
345 length = source_desc->string.length; 348 length = source_desc->string.length;
346 break; 349 break;
347 350
348 default: 351 default:
352
349 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 353 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
350 } 354 }
351 355
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index c84ee956fa4c..7e0afe72487e 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -446,7 +446,6 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
446 break; 446 break;
447 447
448 case ACPI_TYPE_LOCAL_BANK_FIELD: 448 case ACPI_TYPE_LOCAL_BANK_FIELD:
449
450 /* 449 /*
451 * Ensure that the bank_value is not beyond the capacity of 450 * Ensure that the bank_value is not beyond the capacity of
452 * the register 451 * the register
@@ -488,7 +487,6 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
488 break; 487 break;
489 488
490 case ACPI_TYPE_LOCAL_INDEX_FIELD: 489 case ACPI_TYPE_LOCAL_INDEX_FIELD:
491
492 /* 490 /*
493 * Ensure that the index_value is not beyond the capacity of 491 * Ensure that the index_value is not beyond the capacity of
494 * the register 492 * the register
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index 72a2a13b6d36..00bf29877574 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -105,7 +105,6 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
105 break; 105 break;
106 106
107 case ACPI_DESC_TYPE_NAMED: 107 case ACPI_DESC_TYPE_NAMED:
108
109 /* 108 /*
110 * A named reference that has already been resolved to a Node 109 * A named reference that has already been resolved to a Node
111 */ 110 */
@@ -261,20 +260,24 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
261 */ 260 */
262 switch (operand0->common.type) { 261 switch (operand0->common.type) {
263 case ACPI_TYPE_INTEGER: 262 case ACPI_TYPE_INTEGER:
263
264 status = 264 status =
265 acpi_ex_convert_to_integer(operand1, &local_operand1, 16); 265 acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
266 break; 266 break;
267 267
268 case ACPI_TYPE_STRING: 268 case ACPI_TYPE_STRING:
269
269 status = acpi_ex_convert_to_string(operand1, &local_operand1, 270 status = acpi_ex_convert_to_string(operand1, &local_operand1,
270 ACPI_IMPLICIT_CONVERT_HEX); 271 ACPI_IMPLICIT_CONVERT_HEX);
271 break; 272 break;
272 273
273 case ACPI_TYPE_BUFFER: 274 case ACPI_TYPE_BUFFER:
275
274 status = acpi_ex_convert_to_buffer(operand1, &local_operand1); 276 status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
275 break; 277 break;
276 278
277 default: 279 default:
280
278 ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X", 281 ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
279 operand0->common.type)); 282 operand0->common.type));
280 status = AE_AML_INTERNAL; 283 status = AE_AML_INTERNAL;
@@ -519,6 +522,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode,
519 break; 522 break;
520 523
521 default: 524 default:
525
522 status = AE_AML_INTERNAL; 526 status = AE_AML_INTERNAL;
523 break; 527 break;
524 } 528 }
@@ -580,20 +584,24 @@ acpi_ex_do_logical_op(u16 opcode,
580 */ 584 */
581 switch (operand0->common.type) { 585 switch (operand0->common.type) {
582 case ACPI_TYPE_INTEGER: 586 case ACPI_TYPE_INTEGER:
587
583 status = 588 status =
584 acpi_ex_convert_to_integer(operand1, &local_operand1, 16); 589 acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
585 break; 590 break;
586 591
587 case ACPI_TYPE_STRING: 592 case ACPI_TYPE_STRING:
593
588 status = acpi_ex_convert_to_string(operand1, &local_operand1, 594 status = acpi_ex_convert_to_string(operand1, &local_operand1,
589 ACPI_IMPLICIT_CONVERT_HEX); 595 ACPI_IMPLICIT_CONVERT_HEX);
590 break; 596 break;
591 597
592 case ACPI_TYPE_BUFFER: 598 case ACPI_TYPE_BUFFER:
599
593 status = acpi_ex_convert_to_buffer(operand1, &local_operand1); 600 status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
594 break; 601 break;
595 602
596 default: 603 default:
604
597 status = AE_AML_INTERNAL; 605 status = AE_AML_INTERNAL;
598 break; 606 break;
599 } 607 }
@@ -636,6 +644,7 @@ acpi_ex_do_logical_op(u16 opcode,
636 break; 644 break;
637 645
638 default: 646 default:
647
639 status = AE_AML_INTERNAL; 648 status = AE_AML_INTERNAL;
640 break; 649 break;
641 } 650 }
@@ -703,6 +712,7 @@ acpi_ex_do_logical_op(u16 opcode,
703 break; 712 break;
704 713
705 default: 714 default:
715
706 status = AE_AML_INTERNAL; 716 status = AE_AML_INTERNAL;
707 break; 717 break;
708 } 718 }
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index b60c877f5906..814b4a3d656a 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -327,7 +327,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
327 break; 327 break;
328 328
329 case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ 329 case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
330
331 /* 330 /*
332 * The 64-bit ACPI integer can hold 16 4-bit BCD characters 331 * The 64-bit ACPI integer can hold 16 4-bit BCD characters
333 * (if table is 32-bit, integer can hold 8 BCD characters) 332 * (if table is 32-bit, integer can hold 8 BCD characters)
@@ -407,7 +406,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
407 break; 406 break;
408 407
409 case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */ 408 case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */
410
411 /* 409 /*
412 * This op is a little strange because the internal return value is 410 * This op is a little strange because the internal return value is
413 * different than the return value stored in the result descriptor 411 * different than the return value stored in the result descriptor
@@ -442,13 +440,14 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
442 goto cleanup; 440 goto cleanup;
443 441
444 default: 442 default:
443
445 /* No other opcodes get here */ 444 /* No other opcodes get here */
445
446 break; 446 break;
447 } 447 }
448 break; 448 break;
449 449
450 case AML_STORE_OP: /* Store (Source, Target) */ 450 case AML_STORE_OP: /* Store (Source, Target) */
451
452 /* 451 /*
453 * A store operand is typically a number, string, buffer or lvalue 452 * A store operand is typically a number, string, buffer or lvalue
454 * Be careful about deleting the source object, 453 * Be careful about deleting the source object,
@@ -615,7 +614,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
615 614
616 case AML_DECREMENT_OP: /* Decrement (Operand) */ 615 case AML_DECREMENT_OP: /* Decrement (Operand) */
617 case AML_INCREMENT_OP: /* Increment (Operand) */ 616 case AML_INCREMENT_OP: /* Increment (Operand) */
618
619 /* 617 /*
620 * Create a new integer. Can't just get the base integer and 618 * Create a new integer. Can't just get the base integer and
621 * increment it because it may be an Arg or Field. 619 * increment it because it may be an Arg or Field.
@@ -682,7 +680,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
682 break; 680 break;
683 681
684 case AML_TYPE_OP: /* object_type (source_object) */ 682 case AML_TYPE_OP: /* object_type (source_object) */
685
686 /* 683 /*
687 * Note: The operand is not resolved at this point because we want to 684 * Note: The operand is not resolved at this point because we want to
688 * get the associated object, not its value. For example, we don't 685 * get the associated object, not its value. For example, we don't
@@ -709,7 +706,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
709 break; 706 break;
710 707
711 case AML_SIZE_OF_OP: /* size_of (source_object) */ 708 case AML_SIZE_OF_OP: /* size_of (source_object) */
712
713 /* 709 /*
714 * Note: The operand is not resolved at this point because we want to 710 * Note: The operand is not resolved at this point because we want to
715 * get the associated object, not its value. 711 * get the associated object, not its value.
@@ -735,10 +731,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
735 */ 731 */
736 switch (type) { 732 switch (type) {
737 case ACPI_TYPE_INTEGER: 733 case ACPI_TYPE_INTEGER:
734
738 value = acpi_gbl_integer_byte_width; 735 value = acpi_gbl_integer_byte_width;
739 break; 736 break;
740 737
741 case ACPI_TYPE_STRING: 738 case ACPI_TYPE_STRING:
739
742 value = temp_desc->string.length; 740 value = temp_desc->string.length;
743 break; 741 break;
744 742
@@ -759,6 +757,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
759 break; 757 break;
760 758
761 default: 759 default:
760
762 ACPI_ERROR((AE_INFO, 761 ACPI_ERROR((AE_INFO,
763 "Operand must be Buffer/Integer/String/Package - found type %s", 762 "Operand must be Buffer/Integer/String/Package - found type %s",
764 acpi_ut_get_type_name(type))); 763 acpi_ut_get_type_name(type)));
@@ -860,9 +859,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
860 break; 859 break;
861 860
862 case ACPI_TYPE_STRING: 861 case ACPI_TYPE_STRING:
862
863 break; 863 break;
864 864
865 default: 865 default:
866
866 status = AE_AML_OPERAND_TYPE; 867 status = AE_AML_OPERAND_TYPE;
867 goto cleanup; 868 goto cleanup;
868 } 869 }
@@ -923,7 +924,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
923 */ 924 */
924 switch (operand[0]->reference.class) { 925 switch (operand[0]->reference.class) {
925 case ACPI_REFCLASS_INDEX: 926 case ACPI_REFCLASS_INDEX:
926
927 /* 927 /*
928 * The target type for the Index operator must be 928 * The target type for the Index operator must be
929 * either a Buffer or a Package 929 * either a Buffer or a Package
@@ -956,7 +956,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
956 break; 956 break;
957 957
958 case ACPI_TYPE_PACKAGE: 958 case ACPI_TYPE_PACKAGE:
959
960 /* 959 /*
961 * Return the referenced element of the package. We must 960 * Return the referenced element of the package. We must
962 * add another reference to the referenced object, however. 961 * add another reference to the referenced object, however.
@@ -999,6 +998,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
999 break; 998 break;
1000 999
1001 default: 1000 default:
1001
1002 ACPI_ERROR((AE_INFO, 1002 ACPI_ERROR((AE_INFO,
1003 "Unknown class in reference(%p) - 0x%2.2X", 1003 "Unknown class in reference(%p) - 0x%2.2X",
1004 operand[0], 1004 operand[0],
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c
index b0838a4ea53e..d5088f7030c7 100644
--- a/drivers/acpi/acpica/exoparg2.c
+++ b/drivers/acpi/acpica/exoparg2.c
@@ -304,7 +304,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
304 break; 304 break;
305 305
306 case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ 306 case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
307
308 /* 307 /*
309 * Input object is guaranteed to be a buffer at this point (it may have 308 * Input object is guaranteed to be a buffer at this point (it may have
310 * been converted.) Copy the raw buffer data to a new object of 309 * been converted.) Copy the raw buffer data to a new object of
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c
index 2d7491f3126e..37656f12f204 100644
--- a/drivers/acpi/acpica/exoparg3.c
+++ b/drivers/acpi/acpica/exoparg3.c
@@ -155,7 +155,6 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
155 155
156 switch (walk_state->opcode) { 156 switch (walk_state->opcode) {
157 case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ 157 case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
158
159 /* 158 /*
160 * Create the return object. The Source operand is guaranteed to be 159 * Create the return object. The Source operand is guaranteed to be
161 * either a String or a Buffer, so just use its type. 160 * either a String or a Buffer, so just use its type.
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index b76b97002dff..879b6cd8319c 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -119,7 +119,6 @@ acpi_ex_do_match(u32 match_op,
119 break; 119 break;
120 120
121 case MATCH_MEQ: 121 case MATCH_MEQ:
122
123 /* 122 /*
124 * True if equal: (P[i] == M) 123 * True if equal: (P[i] == M)
125 * Change to: (M == P[i]) 124 * Change to: (M == P[i])
@@ -133,7 +132,6 @@ acpi_ex_do_match(u32 match_op,
133 break; 132 break;
134 133
135 case MATCH_MLE: 134 case MATCH_MLE:
136
137 /* 135 /*
138 * True if less than or equal: (P[i] <= M) (P[i] not_greater than M) 136 * True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
139 * Change to: (M >= P[i]) (M not_less than P[i]) 137 * Change to: (M >= P[i]) (M not_less than P[i])
@@ -148,7 +146,6 @@ acpi_ex_do_match(u32 match_op,
148 break; 146 break;
149 147
150 case MATCH_MLT: 148 case MATCH_MLT:
151
152 /* 149 /*
153 * True if less than: (P[i] < M) 150 * True if less than: (P[i] < M)
154 * Change to: (M > P[i]) 151 * Change to: (M > P[i])
@@ -162,7 +159,6 @@ acpi_ex_do_match(u32 match_op,
162 break; 159 break;
163 160
164 case MATCH_MGE: 161 case MATCH_MGE:
165
166 /* 162 /*
167 * True if greater than or equal: (P[i] >= M) (P[i] not_less than M) 163 * True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
168 * Change to: (M <= P[i]) (M not_greater than P[i]) 164 * Change to: (M <= P[i]) (M not_greater than P[i])
@@ -177,7 +173,6 @@ acpi_ex_do_match(u32 match_op,
177 break; 173 break;
178 174
179 case MATCH_MGT: 175 case MATCH_MGT:
180
181 /* 176 /*
182 * True if greater than: (P[i] > M) 177 * True if greater than: (P[i] > M)
183 * Change to: (M < P[i]) 178 * Change to: (M < P[i])
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 6b728aef2dca..5a588611ab48 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -253,26 +253,31 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
253 253
254 case AML_FIELD_ACCESS_BYTE: 254 case AML_FIELD_ACCESS_BYTE:
255 case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ 255 case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
256
256 byte_alignment = 1; 257 byte_alignment = 1;
257 bit_length = 8; 258 bit_length = 8;
258 break; 259 break;
259 260
260 case AML_FIELD_ACCESS_WORD: 261 case AML_FIELD_ACCESS_WORD:
262
261 byte_alignment = 2; 263 byte_alignment = 2;
262 bit_length = 16; 264 bit_length = 16;
263 break; 265 break;
264 266
265 case AML_FIELD_ACCESS_DWORD: 267 case AML_FIELD_ACCESS_DWORD:
268
266 byte_alignment = 4; 269 byte_alignment = 4;
267 bit_length = 32; 270 bit_length = 32;
268 break; 271 break;
269 272
270 case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ 273 case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
274
271 byte_alignment = 8; 275 byte_alignment = 8;
272 bit_length = 64; 276 bit_length = 64;
273 break; 277 break;
274 278
275 default: 279 default:
280
276 /* Invalid field access type */ 281 /* Invalid field access type */
277 282
278 ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); 283 ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access));
@@ -598,7 +603,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
598 break; 603 break;
599 604
600 default: 605 default:
606
601 /* No other types should get here */ 607 /* No other types should get here */
608
602 break; 609 break;
603 } 610 }
604 611
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index 182abaf045e1..303429bb4d5d 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -88,22 +88,27 @@ acpi_ex_system_memory_space_handler(u32 function,
88 88
89 switch (bit_width) { 89 switch (bit_width) {
90 case 8: 90 case 8:
91
91 length = 1; 92 length = 1;
92 break; 93 break;
93 94
94 case 16: 95 case 16:
96
95 length = 2; 97 length = 2;
96 break; 98 break;
97 99
98 case 32: 100 case 32:
101
99 length = 4; 102 length = 4;
100 break; 103 break;
101 104
102 case 64: 105 case 64:
106
103 length = 8; 107 length = 8;
104 break; 108 break;
105 109
106 default: 110 default:
111
107 ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %u", 112 ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %u",
108 bit_width)); 113 bit_width));
109 return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 114 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
@@ -214,23 +219,29 @@ acpi_ex_system_memory_space_handler(u32 function,
214 *value = 0; 219 *value = 0;
215 switch (bit_width) { 220 switch (bit_width) {
216 case 8: 221 case 8:
217 *value = (u64) ACPI_GET8(logical_addr_ptr); 222
223 *value = (u64)ACPI_GET8(logical_addr_ptr);
218 break; 224 break;
219 225
220 case 16: 226 case 16:
221 *value = (u64) ACPI_GET16(logical_addr_ptr); 227
228 *value = (u64)ACPI_GET16(logical_addr_ptr);
222 break; 229 break;
223 230
224 case 32: 231 case 32:
225 *value = (u64) ACPI_GET32(logical_addr_ptr); 232
233 *value = (u64)ACPI_GET32(logical_addr_ptr);
226 break; 234 break;
227 235
228 case 64: 236 case 64:
229 *value = (u64) ACPI_GET64(logical_addr_ptr); 237
238 *value = (u64)ACPI_GET64(logical_addr_ptr);
230 break; 239 break;
231 240
232 default: 241 default:
242
233 /* bit_width was already validated */ 243 /* bit_width was already validated */
244
234 break; 245 break;
235 } 246 }
236 break; 247 break;
@@ -239,28 +250,35 @@ acpi_ex_system_memory_space_handler(u32 function,
239 250
240 switch (bit_width) { 251 switch (bit_width) {
241 case 8: 252 case 8:
253
242 ACPI_SET8(logical_addr_ptr, *value); 254 ACPI_SET8(logical_addr_ptr, *value);
243 break; 255 break;
244 256
245 case 16: 257 case 16:
258
246 ACPI_SET16(logical_addr_ptr, *value); 259 ACPI_SET16(logical_addr_ptr, *value);
247 break; 260 break;
248 261
249 case 32: 262 case 32:
263
250 ACPI_SET32(logical_addr_ptr, *value); 264 ACPI_SET32(logical_addr_ptr, *value);
251 break; 265 break;
252 266
253 case 64: 267 case 64:
268
254 ACPI_SET64(logical_addr_ptr, *value); 269 ACPI_SET64(logical_addr_ptr, *value);
255 break; 270 break;
256 271
257 default: 272 default:
273
258 /* bit_width was already validated */ 274 /* bit_width was already validated */
275
259 break; 276 break;
260 } 277 }
261 break; 278 break;
262 279
263 default: 280 default:
281
264 status = AE_BAD_PARAMETER; 282 status = AE_BAD_PARAMETER;
265 break; 283 break;
266 } 284 }
@@ -320,6 +338,7 @@ acpi_ex_system_io_space_handler(u32 function,
320 break; 338 break;
321 339
322 default: 340 default:
341
323 status = AE_BAD_PARAMETER; 342 status = AE_BAD_PARAMETER;
324 break; 343 break;
325 } 344 }
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c
index 8565b6bd12bb..acd34f599313 100644
--- a/drivers/acpi/acpica/exresnte.c
+++ b/drivers/acpi/acpica/exresnte.c
@@ -248,6 +248,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
248 break; 248 break;
249 249
250 default: 250 default:
251
251 /* No named references are allowed here */ 252 /* No named references are allowed here */
252 253
253 ACPI_ERROR((AE_INFO, 254 ACPI_ERROR((AE_INFO,
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index e4f9dfbb2a13..ac04278ad28f 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -156,7 +156,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
156 switch (ref_type) { 156 switch (ref_type) {
157 case ACPI_REFCLASS_LOCAL: 157 case ACPI_REFCLASS_LOCAL:
158 case ACPI_REFCLASS_ARG: 158 case ACPI_REFCLASS_ARG:
159
160 /* 159 /*
161 * Get the local from the method's state info 160 * Get the local from the method's state info
162 * Note: this increments the local's object reference count 161 * Note: this increments the local's object reference count
@@ -309,6 +308,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
309 break; 308 break;
310 309
311 default: 310 default:
311
312 break; 312 break;
313 } 313 }
314 314
@@ -348,10 +348,12 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
348 348
349 switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { 349 switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
350 case ACPI_DESC_TYPE_OPERAND: 350 case ACPI_DESC_TYPE_OPERAND:
351
351 type = obj_desc->common.type; 352 type = obj_desc->common.type;
352 break; 353 break;
353 354
354 case ACPI_DESC_TYPE_NAMED: 355 case ACPI_DESC_TYPE_NAMED:
356
355 type = ((struct acpi_namespace_node *)obj_desc)->type; 357 type = ((struct acpi_namespace_node *)obj_desc)->type;
356 obj_desc = 358 obj_desc =
357 acpi_ns_get_attached_object((struct acpi_namespace_node *) 359 acpi_ns_get_attached_object((struct acpi_namespace_node *)
@@ -538,7 +540,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
538 break; 540 break;
539 541
540 default: 542 default:
543
541 /* No change to Type required */ 544 /* No change to Type required */
545
542 break; 546 break;
543 } 547 }
544 548
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index 9fb9f5e9a4da..00e5af7129c1 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -307,7 +307,6 @@ acpi_ex_resolve_operands(u16 opcode,
307 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ 307 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
308 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ 308 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
309 case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */ 309 case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */
310
311 /* 310 /*
312 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE 311 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
313 * A Namespace Node is OK as-is 312 * A Namespace Node is OK as-is
@@ -326,7 +325,6 @@ acpi_ex_resolve_operands(u16 opcode,
326 goto next_operand; 325 goto next_operand;
327 326
328 case ARGI_DATAREFOBJ: /* Store operator only */ 327 case ARGI_DATAREFOBJ: /* Store operator only */
329
330 /* 328 /*
331 * We don't want to resolve index_op reference objects during 329 * We don't want to resolve index_op reference objects during
332 * a store because this would be an implicit de_ref_of operation. 330 * a store because this would be an implicit de_ref_of operation.
@@ -343,7 +341,9 @@ acpi_ex_resolve_operands(u16 opcode,
343 break; 341 break;
344 342
345 default: 343 default:
344
346 /* All cases covered above */ 345 /* All cases covered above */
346
347 break; 347 break;
348 } 348 }
349 349
@@ -433,7 +433,6 @@ acpi_ex_resolve_operands(u16 opcode,
433 goto next_operand; 433 goto next_operand;
434 434
435 case ARGI_BUFFER: 435 case ARGI_BUFFER:
436
437 /* 436 /*
438 * Need an operand of type ACPI_TYPE_BUFFER, 437 * Need an operand of type ACPI_TYPE_BUFFER,
439 * But we can implicitly convert from a STRING or INTEGER 438 * But we can implicitly convert from a STRING or INTEGER
@@ -459,7 +458,6 @@ acpi_ex_resolve_operands(u16 opcode,
459 goto next_operand; 458 goto next_operand;
460 459
461 case ARGI_STRING: 460 case ARGI_STRING:
462
463 /* 461 /*
464 * Need an operand of type ACPI_TYPE_STRING, 462 * Need an operand of type ACPI_TYPE_STRING,
465 * But we can implicitly convert from a BUFFER or INTEGER 463 * But we can implicitly convert from a BUFFER or INTEGER
@@ -562,6 +560,7 @@ acpi_ex_resolve_operands(u16 opcode,
562 break; 560 break;
563 561
564 default: 562 default:
563
565 ACPI_ERROR((AE_INFO, 564 ACPI_ERROR((AE_INFO,
566 "Needed [Buffer/String/Package/Reference], found [%s] %p", 565 "Needed [Buffer/String/Package/Reference], found [%s] %p",
567 acpi_ut_get_object_type_name 566 acpi_ut_get_object_type_name
@@ -584,6 +583,7 @@ acpi_ex_resolve_operands(u16 opcode,
584 break; 583 break;
585 584
586 default: 585 default:
586
587 ACPI_ERROR((AE_INFO, 587 ACPI_ERROR((AE_INFO,
588 "Needed [Buffer/String/Package], found [%s] %p", 588 "Needed [Buffer/String/Package], found [%s] %p",
589 acpi_ut_get_object_type_name 589 acpi_ut_get_object_type_name
@@ -605,6 +605,7 @@ acpi_ex_resolve_operands(u16 opcode,
605 break; 605 break;
606 606
607 default: 607 default:
608
608 ACPI_ERROR((AE_INFO, 609 ACPI_ERROR((AE_INFO,
609 "Needed [Region/Buffer], found [%s] %p", 610 "Needed [Region/Buffer], found [%s] %p",
610 acpi_ut_get_object_type_name 611 acpi_ut_get_object_type_name
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index 93c6049c2d75..2bdba6f7d762 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -114,6 +114,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
114 114
115 switch (dest_desc->common.type) { 115 switch (dest_desc->common.type) {
116 case ACPI_TYPE_LOCAL_REFERENCE: 116 case ACPI_TYPE_LOCAL_REFERENCE:
117
117 break; 118 break;
118 119
119 case ACPI_TYPE_INTEGER: 120 case ACPI_TYPE_INTEGER:
@@ -178,7 +179,6 @@ acpi_ex_store(union acpi_operand_object *source_desc,
178 break; 179 break;
179 180
180 case ACPI_REFCLASS_DEBUG: 181 case ACPI_REFCLASS_DEBUG:
181
182 /* 182 /*
183 * Storing to the Debug object causes the value stored to be 183 * Storing to the Debug object causes the value stored to be
184 * displayed and otherwise has no effect -- see ACPI Specification 184 * displayed and otherwise has no effect -- see ACPI Specification
@@ -291,7 +291,6 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
291 break; 291 break;
292 292
293 case ACPI_TYPE_BUFFER_FIELD: 293 case ACPI_TYPE_BUFFER_FIELD:
294
295 /* 294 /*
296 * Store into a Buffer or String (not actually a real buffer_field) 295 * Store into a Buffer or String (not actually a real buffer_field)
297 * at a location defined by an Index. 296 * at a location defined by an Index.
@@ -447,7 +446,6 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
447 case ACPI_TYPE_INTEGER: 446 case ACPI_TYPE_INTEGER:
448 case ACPI_TYPE_STRING: 447 case ACPI_TYPE_STRING:
449 case ACPI_TYPE_BUFFER: 448 case ACPI_TYPE_BUFFER:
450
451 /* 449 /*
452 * These target types are all of type Integer/String/Buffer, and 450 * These target types are all of type Integer/String/Buffer, and
453 * therefore support implicit conversion before the store. 451 * therefore support implicit conversion before the store.
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c
index 1cefe777068e..20d809d90c5b 100644
--- a/drivers/acpi/acpica/exstoren.c
+++ b/drivers/acpi/acpica/exstoren.c
@@ -85,11 +85,9 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
85 * These cases all require only Integers or values that 85 * These cases all require only Integers or values that
86 * can be converted to Integers (Strings or Buffers) 86 * can be converted to Integers (Strings or Buffers)
87 */ 87 */
88
89 case ACPI_TYPE_INTEGER: 88 case ACPI_TYPE_INTEGER:
90 case ACPI_TYPE_STRING: 89 case ACPI_TYPE_STRING:
91 case ACPI_TYPE_BUFFER: 90 case ACPI_TYPE_BUFFER:
92
93 /* 91 /*
94 * Stores into a Field/Region or into a Integer/Buffer/String 92 * Stores into a Field/Region or into a Integer/Buffer/String
95 * are all essentially the same. This case handles the 93 * are all essentially the same. This case handles the
@@ -133,7 +131,6 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
133 131
134 case ACPI_TYPE_LOCAL_ALIAS: 132 case ACPI_TYPE_LOCAL_ALIAS:
135 case ACPI_TYPE_LOCAL_METHOD_ALIAS: 133 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
136
137 /* 134 /*
138 * All aliases should have been resolved earlier, during the 135 * All aliases should have been resolved earlier, during the
139 * operand resolution phase. 136 * operand resolution phase.
@@ -144,7 +141,6 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
144 141
145 case ACPI_TYPE_PACKAGE: 142 case ACPI_TYPE_PACKAGE:
146 default: 143 default:
147
148 /* 144 /*
149 * All other types than Alias and the various Fields come here, 145 * All other types than Alias and the various Fields come here,
150 * including the untyped case - ACPI_TYPE_ANY. 146 * including the untyped case - ACPI_TYPE_ANY.
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index 579c3a53ac87..3d36df828f52 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -108,7 +108,6 @@ acpi_status acpi_hw_set_mode(u32 mode)
108 break; 108 break;
109 109
110 case ACPI_SYS_MODE_LEGACY: 110 case ACPI_SYS_MODE_LEGACY:
111
112 /* 111 /*
113 * BIOS should clear all fixed status bits and restore fixed event 112 * BIOS should clear all fixed status bits and restore fixed event
114 * enable bits to default 113 * enable bits to default
@@ -120,6 +119,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
120 break; 119 break;
121 120
122 default: 121 default:
122
123 return_ACPI_STATUS(AE_BAD_PARAMETER); 123 return_ACPI_STATUS(AE_BAD_PARAMETER);
124 } 124 }
125 125
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index 20d02e93c990..96540506058f 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -127,14 +127,17 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
127 /*lint -fallthrough */ 127 /*lint -fallthrough */
128 128
129 case ACPI_GPE_ENABLE: 129 case ACPI_GPE_ENABLE:
130
130 ACPI_SET_BIT(enable_mask, register_bit); 131 ACPI_SET_BIT(enable_mask, register_bit);
131 break; 132 break;
132 133
133 case ACPI_GPE_DISABLE: 134 case ACPI_GPE_DISABLE:
135
134 ACPI_CLEAR_BIT(enable_mask, register_bit); 136 ACPI_CLEAR_BIT(enable_mask, register_bit);
135 break; 137 break;
136 138
137 default: 139 default:
140
138 ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u", action)); 141 ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u", action));
139 return (AE_BAD_PARAMETER); 142 return (AE_BAD_PARAMETER);
140 } 143 }
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 083d6551f0e2..8d2e866be15f 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -419,6 +419,7 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)
419 break; 419 break;
420 420
421 default: 421 default:
422
422 ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id)); 423 ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id));
423 status = AE_BAD_PARAMETER; 424 status = AE_BAD_PARAMETER;
424 break; 425 break;
@@ -491,7 +492,6 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
491 break; 492 break;
492 493
493 case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ 494 case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
494
495 /* 495 /*
496 * Perform a read first to preserve certain bits (per ACPI spec) 496 * Perform a read first to preserve certain bits (per ACPI spec)
497 * Note: This includes SCI_EN, we never want to change this bit 497 * Note: This includes SCI_EN, we never want to change this bit
@@ -520,7 +520,6 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
520 break; 520 break;
521 521
522 case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ 522 case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
523
524 /* 523 /*
525 * For control registers, all reserved bits must be preserved, 524 * For control registers, all reserved bits must be preserved,
526 * as per the ACPI spec. 525 * as per the ACPI spec.
@@ -555,6 +554,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
555 break; 554 break;
556 555
557 default: 556 default:
557
558 ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id)); 558 ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id));
559 status = AE_BAD_PARAMETER; 559 status = AE_BAD_PARAMETER;
560 break; 560 break;
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 04c2e16f2c0a..5ee7a814cd92 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 }
@@ -528,10 +528,12 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
528 elements = info->return_object->package.elements; 528 elements = info->return_object->package.elements;
529 switch (info->return_object->package.count) { 529 switch (info->return_object->package.count) {
530 case 0: 530 case 0:
531
531 status = AE_AML_PACKAGE_LIMIT; 532 status = AE_AML_PACKAGE_LIMIT;
532 break; 533 break;
533 534
534 case 1: 535 case 1:
536
535 if (elements[0]->common.type != ACPI_TYPE_INTEGER) { 537 if (elements[0]->common.type != ACPI_TYPE_INTEGER) {
536 status = AE_AML_OPERAND_TYPE; 538 status = AE_AML_OPERAND_TYPE;
537 break; 539 break;
@@ -545,6 +547,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
545 547
546 case 2: 548 case 2:
547 default: 549 default:
550
548 if ((elements[0]->common.type != ACPI_TYPE_INTEGER) || 551 if ((elements[0]->common.type != ACPI_TYPE_INTEGER) ||
549 (elements[1]->common.type != ACPI_TYPE_INTEGER)) { 552 (elements[1]->common.type != ACPI_TYPE_INTEGER)) {
550 status = AE_AML_OPERAND_TYPE; 553 status = AE_AML_OPERAND_TYPE;
@@ -565,7 +568,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
565 if (ACPI_FAILURE(status)) { 568 if (ACPI_FAILURE(status)) {
566 ACPI_EXCEPTION((AE_INFO, status, 569 ACPI_EXCEPTION((AE_INFO, status,
567 "While evaluating Sleep State [%s]", 570 "While evaluating Sleep State [%s]",
568 info->pathname)); 571 info->relative_pathname));
569 } 572 }
570 573
571 ACPI_FREE(info); 574 ACPI_FREE(info);
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 35eebdac0f9d..f2e669db8b65 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -240,12 +240,14 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
240 &acpi_sleep_dispatch[function_id]; 240 &acpi_sleep_dispatch[function_id];
241 241
242#if (!ACPI_REDUCED_HARDWARE) 242#if (!ACPI_REDUCED_HARDWARE)
243
244 /* 243 /*
245 * If the Hardware Reduced flag is set (from the FADT), we must 244 * If the Hardware Reduced flag is set (from the FADT), we must
246 * use the extended sleep registers 245 * use the extended sleep registers (FADT). Note: As per the ACPI
246 * specification, these extended registers are to be used for HW-reduced
247 * platforms only. They are not general-purpose replacements for the
248 * legacy PM register sleep support.
247 */ 249 */
248 if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { 250 if (acpi_gbl_reduced_hardware) {
249 status = sleep_functions->extended_function(sleep_state); 251 status = sleep_functions->extended_function(sleep_state);
250 } else { 252 } else {
251 /* Legacy sleep */ 253 /* Legacy sleep */
@@ -314,20 +316,24 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
314 316
315 switch (sleep_state) { 317 switch (sleep_state) {
316 case ACPI_STATE_S0: 318 case ACPI_STATE_S0:
319
317 sst_value = ACPI_SST_WORKING; 320 sst_value = ACPI_SST_WORKING;
318 break; 321 break;
319 322
320 case ACPI_STATE_S1: 323 case ACPI_STATE_S1:
321 case ACPI_STATE_S2: 324 case ACPI_STATE_S2:
322 case ACPI_STATE_S3: 325 case ACPI_STATE_S3:
326
323 sst_value = ACPI_SST_SLEEPING; 327 sst_value = ACPI_SST_SLEEPING;
324 break; 328 break;
325 329
326 case ACPI_STATE_S4: 330 case ACPI_STATE_S4:
331
327 sst_value = ACPI_SST_SLEEP_CONTEXT; 332 sst_value = ACPI_SST_SLEEP_CONTEXT;
328 break; 333 break;
329 334
330 default: 335 default:
336
331 sst_value = ACPI_SST_INDICATOR_OFF; /* Default is off */ 337 sst_value = ACPI_SST_INDICATOR_OFF; /* Default is off */
332 break; 338 break;
333 } 339 }
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 8769cf83b044..c5316e5bd4ab 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -151,6 +151,7 @@ acpi_status acpi_ns_root_initialize(void)
151 */ 151 */
152 switch (init_val->type) { 152 switch (init_val->type) {
153 case ACPI_TYPE_METHOD: 153 case ACPI_TYPE_METHOD:
154
154 obj_desc->method.param_count = 155 obj_desc->method.param_count =
155 (u8) ACPI_TO_INTEGER(val); 156 (u8) ACPI_TO_INTEGER(val);
156 obj_desc->common.flags |= AOPOBJ_DATA_VALID; 157 obj_desc->common.flags |= AOPOBJ_DATA_VALID;
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/nsconvert.c b/drivers/acpi/acpica/nsconvert.c
index 8f79a9d2d50e..acd2964c2690 100644
--- a/drivers/acpi/acpica/nsconvert.c
+++ b/drivers/acpi/acpica/nsconvert.c
@@ -103,6 +103,7 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
103 break; 103 break;
104 104
105 default: 105 default:
106
106 return (AE_AML_OPERAND_TYPE); 107 return (AE_AML_OPERAND_TYPE);
107 } 108 }
108 109
@@ -191,6 +192,7 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object,
191 break; 192 break;
192 193
193 default: 194 default:
195
194 return (AE_AML_OPERAND_TYPE); 196 return (AE_AML_OPERAND_TYPE);
195 } 197 }
196 198
@@ -294,6 +296,7 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
294 break; 296 break;
295 297
296 default: 298 default:
299
297 return (AE_AML_OPERAND_TYPE); 300 return (AE_AML_OPERAND_TYPE);
298 } 301 }
299 302
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index ce6e97326205..7418c77fde8c 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -244,10 +244,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
244 case ACPI_TYPE_BUFFER: 244 case ACPI_TYPE_BUFFER:
245 case ACPI_TYPE_STRING: 245 case ACPI_TYPE_STRING:
246 case ACPI_TYPE_METHOD: 246 case ACPI_TYPE_METHOD:
247
247 acpi_os_printf("<No attached object>"); 248 acpi_os_printf("<No attached object>");
248 break; 249 break;
249 250
250 default: 251 default:
252
251 break; 253 break;
252 } 254 }
253 255
@@ -433,6 +435,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
433 break; 435 break;
434 436
435 default: 437 default:
438
436 break; 439 break;
437 } 440 }
438 break; 441 break;
@@ -567,32 +570,39 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
567 goto cleanup; 570 goto cleanup;
568 571
569 case ACPI_TYPE_BUFFER_FIELD: 572 case ACPI_TYPE_BUFFER_FIELD:
573
570 obj_desc = 574 obj_desc =
571 (union acpi_operand_object *)obj_desc->buffer_field. 575 (union acpi_operand_object *)obj_desc->buffer_field.
572 buffer_obj; 576 buffer_obj;
573 break; 577 break;
574 578
575 case ACPI_TYPE_PACKAGE: 579 case ACPI_TYPE_PACKAGE:
580
576 obj_desc = (void *)obj_desc->package.elements; 581 obj_desc = (void *)obj_desc->package.elements;
577 break; 582 break;
578 583
579 case ACPI_TYPE_METHOD: 584 case ACPI_TYPE_METHOD:
585
580 obj_desc = (void *)obj_desc->method.aml_start; 586 obj_desc = (void *)obj_desc->method.aml_start;
581 break; 587 break;
582 588
583 case ACPI_TYPE_LOCAL_REGION_FIELD: 589 case ACPI_TYPE_LOCAL_REGION_FIELD:
590
584 obj_desc = (void *)obj_desc->field.region_obj; 591 obj_desc = (void *)obj_desc->field.region_obj;
585 break; 592 break;
586 593
587 case ACPI_TYPE_LOCAL_BANK_FIELD: 594 case ACPI_TYPE_LOCAL_BANK_FIELD:
595
588 obj_desc = (void *)obj_desc->bank_field.region_obj; 596 obj_desc = (void *)obj_desc->bank_field.region_obj;
589 break; 597 break;
590 598
591 case ACPI_TYPE_LOCAL_INDEX_FIELD: 599 case ACPI_TYPE_LOCAL_INDEX_FIELD:
600
592 obj_desc = (void *)obj_desc->index_field.index_obj; 601 obj_desc = (void *)obj_desc->index_field.index_obj;
593 break; 602 break;
594 603
595 default: 604 default:
605
596 goto cleanup; 606 goto cleanup;
597 } 607 }
598 608
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..dd2ceae3f717 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
@@ -266,28 +266,34 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
266 266
267 switch (type) { 267 switch (type) {
268 case ACPI_TYPE_REGION: 268 case ACPI_TYPE_REGION:
269
269 info->op_region_count++; 270 info->op_region_count++;
270 break; 271 break;
271 272
272 case ACPI_TYPE_BUFFER_FIELD: 273 case ACPI_TYPE_BUFFER_FIELD:
274
273 info->field_count++; 275 info->field_count++;
274 break; 276 break;
275 277
276 case ACPI_TYPE_LOCAL_BANK_FIELD: 278 case ACPI_TYPE_LOCAL_BANK_FIELD:
279
277 info->field_count++; 280 info->field_count++;
278 break; 281 break;
279 282
280 case ACPI_TYPE_BUFFER: 283 case ACPI_TYPE_BUFFER:
284
281 info->buffer_count++; 285 info->buffer_count++;
282 break; 286 break;
283 287
284 case ACPI_TYPE_PACKAGE: 288 case ACPI_TYPE_PACKAGE:
289
285 info->package_count++; 290 info->package_count++;
286 break; 291 break;
287 292
288 default: 293 default:
289 294
290 /* No init required, just exit now */ 295 /* No init required, just exit now */
296
291 return (AE_OK); 297 return (AE_OK);
292 } 298 }
293 299
@@ -337,7 +343,9 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
337 break; 343 break;
338 344
339 default: 345 default:
346
340 /* No other types can get here */ 347 /* No other types can get here */
348
341 break; 349 break;
342 } 350 }
343 351
@@ -416,6 +424,7 @@ acpi_ns_find_ini_methods(acpi_handle obj_handle,
416 break; 424 break;
417 425
418 default: 426 default:
427
419 break; 428 break;
420 } 429 }
421 430
@@ -560,7 +569,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
560 569
561 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info)); 570 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
562 info->prefix_node = device_node; 571 info->prefix_node = device_node;
563 info->pathname = METHOD_NAME__INI; 572 info->relative_pathname = METHOD_NAME__INI;
564 info->parameters = NULL; 573 info->parameters = NULL;
565 info->flags = ACPI_IGNORE_RETURN_VALUE; 574 info->flags = ACPI_IGNORE_RETURN_VALUE;
566 575
@@ -574,8 +583,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
574 583
575 /* Ignore error and move on to next device */ 584 /* Ignore error and move on to next device */
576 585
577 char *scope_name = 586 char *scope_name = acpi_ns_get_external_pathname(info->node);
578 acpi_ns_get_external_pathname(info->resolved_node);
579 587
580 ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", 588 ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
581 scope_name)); 589 scope_name));
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 8a52916148cb..24b71a01bf93 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,25 @@ 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;
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
112 /* Get the full pathname to the object, for use in warning messages */
113
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 107
127 /* If not a predefined name, we cannot validate the return object */ 108 /* If not a predefined name, we cannot validate the return object */
128 109
110 predefined = info->predefined;
129 if (!predefined) { 111 if (!predefined) {
130 goto cleanup; 112 return (AE_OK);
131 } 113 }
132 114
133 /* 115 /*
@@ -135,7 +117,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
135 * validate the return object 117 * validate the return object
136 */ 118 */
137 if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { 119 if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
138 goto cleanup; 120 return (AE_OK);
139 } 121 }
140 122
141 /* 123 /*
@@ -154,25 +136,14 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
154 if (acpi_gbl_disable_auto_repair || 136 if (acpi_gbl_disable_auto_repair ||
155 (!predefined->info.expected_btypes) || 137 (!predefined->info.expected_btypes) ||
156 (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) { 138 (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) {
157 goto cleanup; 139 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 } 140 }
166 data->predefined = predefined;
167 data->node = node;
168 data->node_flags = node->flags;
169 data->pathname = pathname;
170 141
171 /* 142 /*
172 * Check that the type of the main return object is what is expected 143 * Check that the type of the main return object is what is expected
173 * for this predefined name 144 * for this predefined name
174 */ 145 */
175 status = acpi_ns_check_object_type(data, return_object_ptr, 146 status = acpi_ns_check_object_type(info, return_object_ptr,
176 predefined->info.expected_btypes, 147 predefined->info.expected_btypes,
177 ACPI_NOT_PACKAGE_ELEMENT); 148 ACPI_NOT_PACKAGE_ELEMENT);
178 if (ACPI_FAILURE(status)) { 149 if (ACPI_FAILURE(status)) {
@@ -184,10 +155,16 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
184 * Note: Package may have been newly created by call above. 155 * Note: Package may have been newly created by call above.
185 */ 156 */
186 if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { 157 if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) {
187 data->parent_package = *return_object_ptr; 158 info->parent_package = *return_object_ptr;
188 status = acpi_ns_check_package(data, return_object_ptr); 159 status = acpi_ns_check_package(info, return_object_ptr);
189 if (ACPI_FAILURE(status)) { 160 if (ACPI_FAILURE(status)) {
190 goto exit; 161
162 /* We might be able to fix some errors */
163
164 if ((status != AE_AML_OPERAND_TYPE) &&
165 (status != AE_AML_OPERAND_VALUE)) {
166 goto exit;
167 }
191 } 168 }
192 } 169 }
193 170
@@ -199,7 +176,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 176 * performed on a per-name basis, i.e., the code is specific to
200 * particular predefined names. 177 * particular predefined names.
201 */ 178 */
202 status = acpi_ns_complex_repairs(data, node, status, return_object_ptr); 179 status = acpi_ns_complex_repairs(info, node, status, return_object_ptr);
203 180
204exit: 181exit:
205 /* 182 /*
@@ -207,112 +184,18 @@ exit:
207 * or more objects, mark the parent node to suppress further warning 184 * or more objects, mark the parent node to suppress further warning
208 * messages during the next evaluation of the same method/object. 185 * messages during the next evaluation of the same method/object.
209 */ 186 */
210 if (ACPI_FAILURE(status) || (data->flags & ACPI_OBJECT_REPAIRED)) { 187 if (ACPI_FAILURE(status) || (info->return_flags & ACPI_OBJECT_REPAIRED)) {
211 node->flags |= ANOBJ_EVALUATED; 188 node->flags |= ANOBJ_EVALUATED;
212 } 189 }
213 ACPI_FREE(data);
214 190
215cleanup:
216 ACPI_FREE(pathname);
217 return (status); 191 return (status);
218} 192}
219 193
220/******************************************************************************* 194/*******************************************************************************
221 * 195 *
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 196 * FUNCTION: acpi_ns_check_object_type
314 * 197 *
315 * PARAMETERS: data - Pointer to validation data structure 198 * PARAMETERS: info - Method execution information block
316 * return_object_ptr - Pointer to the object returned from the 199 * return_object_ptr - Pointer to the object returned from the
317 * evaluation of a method or object 200 * evaluation of a method or object
318 * expected_btypes - Bitmap of expected return type(s) 201 * expected_btypes - Bitmap of expected return type(s)
@@ -328,7 +211,7 @@ acpi_ns_check_parameter_count(char *pathname,
328 ******************************************************************************/ 211 ******************************************************************************/
329 212
330acpi_status 213acpi_status
331acpi_ns_check_object_type(struct acpi_predefined_data *data, 214acpi_ns_check_object_type(struct acpi_evaluate_info *info,
332 union acpi_operand_object **return_object_ptr, 215 union acpi_operand_object **return_object_ptr,
333 u32 expected_btypes, u32 package_index) 216 u32 expected_btypes, u32 package_index)
334{ 217{
@@ -340,7 +223,8 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
340 223
341 if (return_object && 224 if (return_object &&
342 ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) { 225 ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
343 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 226 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
227 info->node_flags,
344 "Invalid return type - Found a Namespace node [%4.4s] type %s", 228 "Invalid return type - Found a Namespace node [%4.4s] type %s",
345 return_object->node.name.ascii, 229 return_object->node.name.ascii,
346 acpi_ut_get_type_name(return_object->node. 230 acpi_ut_get_type_name(return_object->node.
@@ -356,8 +240,8 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
356 * from all of the predefined names (including elements of returned 240 * from all of the predefined names (including elements of returned
357 * packages) 241 * packages)
358 */ 242 */
359 data->return_btype = acpi_ns_get_bitmapped_type(return_object); 243 info->return_btype = acpi_ns_get_bitmapped_type(return_object);
360 if (data->return_btype == ACPI_RTYPE_ANY) { 244 if (info->return_btype == ACPI_RTYPE_ANY) {
361 245
362 /* Not one of the supported objects, must be incorrect */ 246 /* Not one of the supported objects, must be incorrect */
363 goto type_error_exit; 247 goto type_error_exit;
@@ -365,16 +249,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
365 249
366 /* For reference objects, check that the reference type is correct */ 250 /* For reference objects, check that the reference type is correct */
367 251
368 if ((data->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) { 252 if ((info->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) {
369 status = acpi_ns_check_reference(data, return_object); 253 status = acpi_ns_check_reference(info, return_object);
370 return (status); 254 return (status);
371 } 255 }
372 256
373 /* Attempt simple repair of the returned object if necessary */ 257 /* Attempt simple repair of the returned object if necessary */
374 258
375 status = acpi_ns_simple_repair(data, expected_btypes, 259 status = acpi_ns_simple_repair(info, expected_btypes,
376 package_index, return_object_ptr); 260 package_index, return_object_ptr);
377 return (status); 261 if (ACPI_SUCCESS(status)) {
262 return (AE_OK); /* Successful repair */
263 }
378 264
379 type_error_exit: 265 type_error_exit:
380 266
@@ -383,12 +269,14 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
383 acpi_ut_get_expected_return_types(type_buffer, expected_btypes); 269 acpi_ut_get_expected_return_types(type_buffer, expected_btypes);
384 270
385 if (package_index == ACPI_NOT_PACKAGE_ELEMENT) { 271 if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
386 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 272 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
273 info->node_flags,
387 "Return type mismatch - found %s, expected %s", 274 "Return type mismatch - found %s, expected %s",
388 acpi_ut_get_object_type_name 275 acpi_ut_get_object_type_name
389 (return_object), type_buffer)); 276 (return_object), type_buffer));
390 } else { 277 } else {
391 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 278 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
279 info->node_flags,
392 "Return Package type mismatch at index %u - " 280 "Return Package type mismatch at index %u - "
393 "found %s, expected %s", package_index, 281 "found %s, expected %s", package_index,
394 acpi_ut_get_object_type_name 282 acpi_ut_get_object_type_name
@@ -402,7 +290,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
402 * 290 *
403 * FUNCTION: acpi_ns_check_reference 291 * FUNCTION: acpi_ns_check_reference
404 * 292 *
405 * PARAMETERS: data - Pointer to validation data structure 293 * PARAMETERS: info - Method execution information block
406 * return_object - Object returned from the evaluation of a 294 * return_object - Object returned from the evaluation of a
407 * method or object 295 * method or object
408 * 296 *
@@ -415,7 +303,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
415 ******************************************************************************/ 303 ******************************************************************************/
416 304
417static acpi_status 305static acpi_status
418acpi_ns_check_reference(struct acpi_predefined_data *data, 306acpi_ns_check_reference(struct acpi_evaluate_info *info,
419 union acpi_operand_object *return_object) 307 union acpi_operand_object *return_object)
420{ 308{
421 309
@@ -428,7 +316,7 @@ acpi_ns_check_reference(struct acpi_predefined_data *data,
428 return (AE_OK); 316 return (AE_OK);
429 } 317 }
430 318
431 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 319 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
432 "Return type mismatch - unexpected reference object type [%s] %2.2X", 320 "Return type mismatch - unexpected reference object type [%s] %2.2X",
433 acpi_ut_get_reference_name(return_object), 321 acpi_ut_get_reference_name(return_object),
434 return_object->reference.class)); 322 return_object->reference.class));
@@ -462,26 +350,32 @@ static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object)
462 350
463 switch (return_object->common.type) { 351 switch (return_object->common.type) {
464 case ACPI_TYPE_INTEGER: 352 case ACPI_TYPE_INTEGER:
353
465 return_btype = ACPI_RTYPE_INTEGER; 354 return_btype = ACPI_RTYPE_INTEGER;
466 break; 355 break;
467 356
468 case ACPI_TYPE_BUFFER: 357 case ACPI_TYPE_BUFFER:
358
469 return_btype = ACPI_RTYPE_BUFFER; 359 return_btype = ACPI_RTYPE_BUFFER;
470 break; 360 break;
471 361
472 case ACPI_TYPE_STRING: 362 case ACPI_TYPE_STRING:
363
473 return_btype = ACPI_RTYPE_STRING; 364 return_btype = ACPI_RTYPE_STRING;
474 break; 365 break;
475 366
476 case ACPI_TYPE_PACKAGE: 367 case ACPI_TYPE_PACKAGE:
368
477 return_btype = ACPI_RTYPE_PACKAGE; 369 return_btype = ACPI_RTYPE_PACKAGE;
478 break; 370 break;
479 371
480 case ACPI_TYPE_LOCAL_REFERENCE: 372 case ACPI_TYPE_LOCAL_REFERENCE:
373
481 return_btype = ACPI_RTYPE_REFERENCE; 374 return_btype = ACPI_RTYPE_REFERENCE;
482 break; 375 break;
483 376
484 default: 377 default:
378
485 /* Not one of the supported objects, must be incorrect */ 379 /* Not one of the supported objects, must be incorrect */
486 380
487 return_btype = ACPI_RTYPE_ANY; 381 return_btype = ACPI_RTYPE_ANY;
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c
index 77cdd539de16..6d55cef7916c 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);
@@ -135,7 +136,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
135 */ 136 */
136 switch (package->ret_info.type) { 137 switch (package->ret_info.type) {
137 case ACPI_PTYPE1_FIXED: 138 case ACPI_PTYPE1_FIXED:
138
139 /* 139 /*
140 * The package count is fixed and there are no sub-packages 140 * The package count is fixed and there are no sub-packages
141 * 141 *
@@ -150,13 +150,13 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
150 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 150 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
151 "%s: Return Package is larger than needed - " 151 "%s: Return Package is larger than needed - "
152 "found %u, expected %u\n", 152 "found %u, expected %u\n",
153 data->pathname, count, 153 info->full_pathname, count,
154 expected_count)); 154 expected_count));
155 } 155 }
156 156
157 /* Validate all elements of the returned package */ 157 /* Validate all elements of the returned package */
158 158
159 status = acpi_ns_check_package_elements(data, elements, 159 status = acpi_ns_check_package_elements(info, elements,
160 package->ret_info. 160 package->ret_info.
161 object_type1, 161 object_type1,
162 package->ret_info. 162 package->ret_info.
@@ -168,13 +168,12 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
168 break; 168 break;
169 169
170 case ACPI_PTYPE1_VAR: 170 case ACPI_PTYPE1_VAR:
171
172 /* 171 /*
173 * The package count is variable, there are no sub-packages, and all 172 * The package count is variable, there are no sub-packages, and all
174 * elements must be of the same type 173 * elements must be of the same type
175 */ 174 */
176 for (i = 0; i < count; i++) { 175 for (i = 0; i < count; i++) {
177 status = acpi_ns_check_object_type(data, elements, 176 status = acpi_ns_check_object_type(info, elements,
178 package->ret_info. 177 package->ret_info.
179 object_type1, i); 178 object_type1, i);
180 if (ACPI_FAILURE(status)) { 179 if (ACPI_FAILURE(status)) {
@@ -185,7 +184,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
185 break; 184 break;
186 185
187 case ACPI_PTYPE1_OPTION: 186 case ACPI_PTYPE1_OPTION:
188
189 /* 187 /*
190 * The package count is variable, there are no sub-packages. There are 188 * The package count is variable, there are no sub-packages. There are
191 * a fixed number of required elements, and a variable number of 189 * a fixed number of required elements, and a variable number of
@@ -206,7 +204,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
206 /* These are the required package elements (0, 1, or 2) */ 204 /* These are the required package elements (0, 1, or 2) */
207 205
208 status = 206 status =
209 acpi_ns_check_object_type(data, elements, 207 acpi_ns_check_object_type(info, elements,
210 package-> 208 package->
211 ret_info3. 209 ret_info3.
212 object_type[i], 210 object_type[i],
@@ -218,7 +216,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
218 /* These are the optional package elements */ 216 /* These are the optional package elements */
219 217
220 status = 218 status =
221 acpi_ns_check_object_type(data, elements, 219 acpi_ns_check_object_type(info, elements,
222 package-> 220 package->
223 ret_info3. 221 ret_info3.
224 tail_object_type, 222 tail_object_type,
@@ -235,7 +233,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
235 233
236 /* First element is the (Integer) revision */ 234 /* First element is the (Integer) revision */
237 235
238 status = acpi_ns_check_object_type(data, elements, 236 status = acpi_ns_check_object_type(info, elements,
239 ACPI_RTYPE_INTEGER, 0); 237 ACPI_RTYPE_INTEGER, 0);
240 if (ACPI_FAILURE(status)) { 238 if (ACPI_FAILURE(status)) {
241 return (status); 239 return (status);
@@ -247,14 +245,14 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
247 /* Examine the sub-packages */ 245 /* Examine the sub-packages */
248 246
249 status = 247 status =
250 acpi_ns_check_package_list(data, package, elements, count); 248 acpi_ns_check_package_list(info, package, elements, count);
251 break; 249 break;
252 250
253 case ACPI_PTYPE2_PKG_COUNT: 251 case ACPI_PTYPE2_PKG_COUNT:
254 252
255 /* First element is the (Integer) count of sub-packages to follow */ 253 /* First element is the (Integer) count of sub-packages to follow */
256 254
257 status = acpi_ns_check_object_type(data, elements, 255 status = acpi_ns_check_object_type(info, elements,
258 ACPI_RTYPE_INTEGER, 0); 256 ACPI_RTYPE_INTEGER, 0);
259 if (ACPI_FAILURE(status)) { 257 if (ACPI_FAILURE(status)) {
260 return (status); 258 return (status);
@@ -275,7 +273,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
275 /* Examine the sub-packages */ 273 /* Examine the sub-packages */
276 274
277 status = 275 status =
278 acpi_ns_check_package_list(data, package, elements, count); 276 acpi_ns_check_package_list(info, package, elements, count);
279 break; 277 break;
280 278
281 case ACPI_PTYPE2: 279 case ACPI_PTYPE2:
@@ -283,7 +281,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
283 case ACPI_PTYPE2_MIN: 281 case ACPI_PTYPE2_MIN:
284 case ACPI_PTYPE2_COUNT: 282 case ACPI_PTYPE2_COUNT:
285 case ACPI_PTYPE2_FIX_VAR: 283 case ACPI_PTYPE2_FIX_VAR:
286
287 /* 284 /*
288 * These types all return a single Package that consists of a 285 * These types all return a single Package that consists of a
289 * variable number of sub-Packages. 286 * variable number of sub-Packages.
@@ -300,7 +297,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
300 /* Create the new outer package and populate it */ 297 /* Create the new outer package and populate it */
301 298
302 status = 299 status =
303 acpi_ns_wrap_with_package(data, return_object, 300 acpi_ns_wrap_with_package(info, return_object,
304 return_object_ptr); 301 return_object_ptr);
305 if (ACPI_FAILURE(status)) { 302 if (ACPI_FAILURE(status)) {
306 return (status); 303 return (status);
@@ -316,14 +313,15 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
316 /* Examine the sub-packages */ 313 /* Examine the sub-packages */
317 314
318 status = 315 status =
319 acpi_ns_check_package_list(data, package, elements, count); 316 acpi_ns_check_package_list(info, package, elements, count);
320 break; 317 break;
321 318
322 default: 319 default:
323 320
324 /* Should not get here if predefined info table is correct */ 321 /* Should not get here if predefined info table is correct */
325 322
326 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 323 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
324 info->node_flags,
327 "Invalid internal return type in table entry: %X", 325 "Invalid internal return type in table entry: %X",
328 package->ret_info.type)); 326 package->ret_info.type));
329 327
@@ -336,7 +334,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
336 334
337 /* Error exit for the case with an incorrect package count */ 335 /* Error exit for the case with an incorrect package count */
338 336
339 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 337 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
340 "Return Package is too small - found %u elements, expected %u", 338 "Return Package is too small - found %u elements, expected %u",
341 count, expected_count)); 339 count, expected_count));
342 340
@@ -347,7 +345,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
347 * 345 *
348 * FUNCTION: acpi_ns_check_package_list 346 * FUNCTION: acpi_ns_check_package_list
349 * 347 *
350 * PARAMETERS: data - Pointer to validation data structure 348 * PARAMETERS: info - Method execution information block
351 * package - Pointer to package-specific info for method 349 * package - Pointer to package-specific info for method
352 * elements - Element list of parent package. All elements 350 * elements - Element list of parent package. All elements
353 * of this list should be of type Package. 351 * of this list should be of type Package.
@@ -360,7 +358,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
360 ******************************************************************************/ 358 ******************************************************************************/
361 359
362static acpi_status 360static acpi_status
363acpi_ns_check_package_list(struct acpi_predefined_data *data, 361acpi_ns_check_package_list(struct acpi_evaluate_info *info,
364 const union acpi_predefined_info *package, 362 const union acpi_predefined_info *package,
365 union acpi_operand_object **elements, u32 count) 363 union acpi_operand_object **elements, u32 count)
366{ 364{
@@ -381,11 +379,11 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
381 for (i = 0; i < count; i++) { 379 for (i = 0; i < count; i++) {
382 sub_package = *elements; 380 sub_package = *elements;
383 sub_elements = sub_package->package.elements; 381 sub_elements = sub_package->package.elements;
384 data->parent_package = sub_package; 382 info->parent_package = sub_package;
385 383
386 /* Each sub-object must be of type Package */ 384 /* Each sub-object must be of type Package */
387 385
388 status = acpi_ns_check_object_type(data, &sub_package, 386 status = acpi_ns_check_object_type(info, &sub_package,
389 ACPI_RTYPE_PACKAGE, i); 387 ACPI_RTYPE_PACKAGE, i);
390 if (ACPI_FAILURE(status)) { 388 if (ACPI_FAILURE(status)) {
391 return (status); 389 return (status);
@@ -393,7 +391,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
393 391
394 /* Examine the different types of expected sub-packages */ 392 /* Examine the different types of expected sub-packages */
395 393
396 data->parent_package = sub_package; 394 info->parent_package = sub_package;
397 switch (package->ret_info.type) { 395 switch (package->ret_info.type) {
398 case ACPI_PTYPE2: 396 case ACPI_PTYPE2:
399 case ACPI_PTYPE2_PKG_COUNT: 397 case ACPI_PTYPE2_PKG_COUNT:
@@ -408,7 +406,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
408 } 406 }
409 407
410 status = 408 status =
411 acpi_ns_check_package_elements(data, sub_elements, 409 acpi_ns_check_package_elements(info, sub_elements,
412 package->ret_info. 410 package->ret_info.
413 object_type1, 411 object_type1,
414 package->ret_info. 412 package->ret_info.
@@ -434,7 +432,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
434 } 432 }
435 433
436 status = 434 status =
437 acpi_ns_check_package_elements(data, sub_elements, 435 acpi_ns_check_package_elements(info, sub_elements,
438 package->ret_info. 436 package->ret_info.
439 object_type1, 437 object_type1,
440 package->ret_info. 438 package->ret_info.
@@ -463,7 +461,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
463 461
464 for (j = 0; j < expected_count; j++) { 462 for (j = 0; j < expected_count; j++) {
465 status = 463 status =
466 acpi_ns_check_object_type(data, 464 acpi_ns_check_object_type(info,
467 &sub_elements[j], 465 &sub_elements[j],
468 package-> 466 package->
469 ret_info2. 467 ret_info2.
@@ -487,7 +485,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
487 /* Check the type of each sub-package element */ 485 /* Check the type of each sub-package element */
488 486
489 status = 487 status =
490 acpi_ns_check_package_elements(data, sub_elements, 488 acpi_ns_check_package_elements(info, sub_elements,
491 package->ret_info. 489 package->ret_info.
492 object_type1, 490 object_type1,
493 sub_package->package. 491 sub_package->package.
@@ -498,12 +496,11 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
498 break; 496 break;
499 497
500 case ACPI_PTYPE2_COUNT: 498 case ACPI_PTYPE2_COUNT:
501
502 /* 499 /*
503 * First element is the (Integer) count of elements, including 500 * First element is the (Integer) count of elements, including
504 * the count field (the ACPI name is num_elements) 501 * the count field (the ACPI name is num_elements)
505 */ 502 */
506 status = acpi_ns_check_object_type(data, sub_elements, 503 status = acpi_ns_check_object_type(info, sub_elements,
507 ACPI_RTYPE_INTEGER, 504 ACPI_RTYPE_INTEGER,
508 0); 505 0);
509 if (ACPI_FAILURE(status)) { 506 if (ACPI_FAILURE(status)) {
@@ -537,7 +534,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
537 /* Check the type of each sub-package element */ 534 /* Check the type of each sub-package element */
538 535
539 status = 536 status =
540 acpi_ns_check_package_elements(data, 537 acpi_ns_check_package_elements(info,
541 (sub_elements + 1), 538 (sub_elements + 1),
542 package->ret_info. 539 package->ret_info.
543 object_type1, 540 object_type1,
@@ -562,7 +559,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
562 559
563 /* The sub-package count was smaller than required */ 560 /* The sub-package count was smaller than required */
564 561
565 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 562 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
566 "Return Sub-Package[%u] is too small - found %u elements, expected %u", 563 "Return Sub-Package[%u] is too small - found %u elements, expected %u",
567 i, sub_package->package.count, expected_count)); 564 i, sub_package->package.count, expected_count));
568 565
@@ -573,7 +570,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
573 * 570 *
574 * FUNCTION: acpi_ns_check_package_elements 571 * FUNCTION: acpi_ns_check_package_elements
575 * 572 *
576 * PARAMETERS: data - Pointer to validation data structure 573 * PARAMETERS: info - Method execution information block
577 * elements - Pointer to the package elements array 574 * elements - Pointer to the package elements array
578 * type1 - Object type for first group 575 * type1 - Object type for first group
579 * count1 - Count for first group 576 * count1 - Count for first group
@@ -589,7 +586,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
589 ******************************************************************************/ 586 ******************************************************************************/
590 587
591static acpi_status 588static acpi_status
592acpi_ns_check_package_elements(struct acpi_predefined_data *data, 589acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
593 union acpi_operand_object **elements, 590 union acpi_operand_object **elements,
594 u8 type1, 591 u8 type1,
595 u32 count1, 592 u32 count1,
@@ -605,7 +602,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
605 * The second group can have a count of zero. 602 * The second group can have a count of zero.
606 */ 603 */
607 for (i = 0; i < count1; i++) { 604 for (i = 0; i < count1; i++) {
608 status = acpi_ns_check_object_type(data, this_element, 605 status = acpi_ns_check_object_type(info, this_element,
609 type1, i + start_index); 606 type1, i + start_index);
610 if (ACPI_FAILURE(status)) { 607 if (ACPI_FAILURE(status)) {
611 return (status); 608 return (status);
@@ -614,7 +611,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
614 } 611 }
615 612
616 for (i = 0; i < count2; i++) { 613 for (i = 0; i < count2; i++) {
617 status = acpi_ns_check_object_type(data, this_element, 614 status = acpi_ns_check_object_type(info, this_element,
618 type2, 615 type2,
619 (i + count1 + start_index)); 616 (i + count1 + start_index));
620 if (ACPI_FAILURE(status)) { 617 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index 18f02e4ece01..f8e71ea60319 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{
@@ -480,6 +480,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
480 case ACPI_PTYPE2_MIN: 480 case ACPI_PTYPE2_MIN:
481 case ACPI_PTYPE2_REV_FIXED: 481 case ACPI_PTYPE2_REV_FIXED:
482 case ACPI_PTYPE2_FIX_VAR: 482 case ACPI_PTYPE2_FIX_VAR:
483
483 break; 484 break;
484 485
485 default: 486 default:
@@ -511,7 +512,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
511 if (new_count < count) { 512 if (new_count < count) {
512 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 513 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
513 "%s: Found and removed %u NULL elements\n", 514 "%s: Found and removed %u NULL elements\n",
514 data->pathname, (count - new_count))); 515 info->full_pathname, (count - new_count)));
515 516
516 /* NULL terminate list and update the package count */ 517 /* NULL terminate list and update the package count */
517 518
@@ -524,7 +525,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
524 * 525 *
525 * FUNCTION: acpi_ns_wrap_with_package 526 * FUNCTION: acpi_ns_wrap_with_package
526 * 527 *
527 * PARAMETERS: data - Pointer to validation data structure 528 * PARAMETERS: info - Method execution information block
528 * original_object - Pointer to the object to repair. 529 * original_object - Pointer to the object to repair.
529 * obj_desc_ptr - The new package object is returned here 530 * obj_desc_ptr - The new package object is returned here
530 * 531 *
@@ -545,7 +546,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
545 ******************************************************************************/ 546 ******************************************************************************/
546 547
547acpi_status 548acpi_status
548acpi_ns_wrap_with_package(struct acpi_predefined_data *data, 549acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
549 union acpi_operand_object *original_object, 550 union acpi_operand_object *original_object,
550 union acpi_operand_object **obj_desc_ptr) 551 union acpi_operand_object **obj_desc_ptr)
551{ 552{
@@ -566,12 +567,12 @@ acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
566 567
567 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 568 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
568 "%s: Wrapped %s with expected Package object\n", 569 "%s: Wrapped %s with expected Package object\n",
569 data->pathname, 570 info->full_pathname,
570 acpi_ut_get_object_type_name(original_object))); 571 acpi_ut_get_object_type_name(original_object)));
571 572
572 /* Return the new object in the object pointer */ 573 /* Return the new object in the object pointer */
573 574
574 *obj_desc_ptr = pkg_obj_desc; 575 *obj_desc_ptr = pkg_obj_desc;
575 data->flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED; 576 info->return_flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
576 return (AE_OK); 577 return (AE_OK);
577} 578}
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 149e9b9c2c1b..c84603ee83ae 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,45 +71,57 @@ 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_CST(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_FDE(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_HID(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_PRT(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_repair_PSS(struct acpi_evaluate_info *info,
99 union acpi_operand_object **return_object_ptr);
100
101static acpi_status
102acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
103 union acpi_operand_object **return_object_ptr);
104
105static acpi_status
106acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
99 union acpi_operand_object *return_object, 107 union acpi_operand_object *return_object,
108 u32 start_index,
100 u32 expected_count, 109 u32 expected_count,
101 u32 sort_index, 110 u32 sort_index,
102 u8 sort_direction, char *sort_key_name); 111 u8 sort_direction, char *sort_key_name);
103 112
104static void
105acpi_ns_sort_list(union acpi_operand_object **elements,
106 u32 count, u32 index, u8 sort_direction);
107
108/* Values for sort_direction above */ 113/* Values for sort_direction above */
109 114
110#define ACPI_SORT_ASCENDING 0 115#define ACPI_SORT_ASCENDING 0
111#define ACPI_SORT_DESCENDING 1 116#define ACPI_SORT_DESCENDING 1
112 117
118static void
119acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index);
120
121static void
122acpi_ns_sort_list(union acpi_operand_object **elements,
123 u32 count, u32 index, u8 sort_direction);
124
113/* 125/*
114 * This table contains the names of the predefined methods for which we can 126 * This table contains the names of the predefined methods for which we can
115 * perform more complex repairs. 127 * perform more complex repairs.
@@ -118,9 +130,11 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
118 * 130 *
119 * _ALR: Sort the list ascending by ambient_illuminance 131 * _ALR: Sort the list ascending by ambient_illuminance
120 * _CID: Strings: uppercase all, remove any leading asterisk 132 * _CID: Strings: uppercase all, remove any leading asterisk
133 * _CST: Sort the list ascending by C state type
121 * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs 134 * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
122 * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs 135 * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
123 * _HID: Strings: uppercase all, remove any leading asterisk 136 * _HID: Strings: uppercase all, remove any leading asterisk
137 * _PRT: Fix reversed source_name and source_index
124 * _PSS: Sort the list descending by Power 138 * _PSS: Sort the list descending by Power
125 * _TSS: Sort the list descending by Power 139 * _TSS: Sort the list descending by Power
126 * 140 *
@@ -134,9 +148,11 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
134static const struct acpi_repair_info acpi_ns_repairable_names[] = { 148static const struct acpi_repair_info acpi_ns_repairable_names[] = {
135 {"_ALR", acpi_ns_repair_ALR}, 149 {"_ALR", acpi_ns_repair_ALR},
136 {"_CID", acpi_ns_repair_CID}, 150 {"_CID", acpi_ns_repair_CID},
151 {"_CST", acpi_ns_repair_CST},
137 {"_FDE", acpi_ns_repair_FDE}, 152 {"_FDE", acpi_ns_repair_FDE},
138 {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */ 153 {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */
139 {"_HID", acpi_ns_repair_HID}, 154 {"_HID", acpi_ns_repair_HID},
155 {"_PRT", acpi_ns_repair_PRT},
140 {"_PSS", acpi_ns_repair_PSS}, 156 {"_PSS", acpi_ns_repair_PSS},
141 {"_TSS", acpi_ns_repair_TSS}, 157 {"_TSS", acpi_ns_repair_TSS},
142 {{0, 0, 0, 0}, NULL} /* Table terminator */ 158 {{0, 0, 0, 0}, NULL} /* Table terminator */
@@ -150,7 +166,7 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
150 * 166 *
151 * FUNCTION: acpi_ns_complex_repairs 167 * FUNCTION: acpi_ns_complex_repairs
152 * 168 *
153 * PARAMETERS: data - Pointer to validation data structure 169 * PARAMETERS: info - Method execution information block
154 * node - Namespace node for the method/object 170 * node - Namespace node for the method/object
155 * validate_status - Original status of earlier validation 171 * validate_status - Original status of earlier validation
156 * return_object_ptr - Pointer to the object returned from the 172 * return_object_ptr - Pointer to the object returned from the
@@ -165,7 +181,7 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
165 *****************************************************************************/ 181 *****************************************************************************/
166 182
167acpi_status 183acpi_status
168acpi_ns_complex_repairs(struct acpi_predefined_data *data, 184acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
169 struct acpi_namespace_node *node, 185 struct acpi_namespace_node *node,
170 acpi_status validate_status, 186 acpi_status validate_status,
171 union acpi_operand_object **return_object_ptr) 187 union acpi_operand_object **return_object_ptr)
@@ -180,7 +196,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
180 return (validate_status); 196 return (validate_status);
181 } 197 }
182 198
183 status = predefined->repair_function(data, return_object_ptr); 199 status = predefined->repair_function(info, return_object_ptr);
184 return (status); 200 return (status);
185} 201}
186 202
@@ -219,7 +235,7 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
219 * 235 *
220 * FUNCTION: acpi_ns_repair_ALR 236 * FUNCTION: acpi_ns_repair_ALR
221 * 237 *
222 * PARAMETERS: data - Pointer to validation data structure 238 * PARAMETERS: info - Method execution information block
223 * return_object_ptr - Pointer to the object returned from the 239 * return_object_ptr - Pointer to the object returned from the
224 * evaluation of a method or object 240 * evaluation of a method or object
225 * 241 *
@@ -231,13 +247,13 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
231 *****************************************************************************/ 247 *****************************************************************************/
232 248
233static acpi_status 249static acpi_status
234acpi_ns_repair_ALR(struct acpi_predefined_data *data, 250acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
235 union acpi_operand_object **return_object_ptr) 251 union acpi_operand_object **return_object_ptr)
236{ 252{
237 union acpi_operand_object *return_object = *return_object_ptr; 253 union acpi_operand_object *return_object = *return_object_ptr;
238 acpi_status status; 254 acpi_status status;
239 255
240 status = acpi_ns_check_sorted_list(data, return_object, 2, 1, 256 status = acpi_ns_check_sorted_list(info, return_object, 0, 2, 1,
241 ACPI_SORT_ASCENDING, 257 ACPI_SORT_ASCENDING,
242 "AmbientIlluminance"); 258 "AmbientIlluminance");
243 259
@@ -248,7 +264,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
248 * 264 *
249 * FUNCTION: acpi_ns_repair_FDE 265 * FUNCTION: acpi_ns_repair_FDE
250 * 266 *
251 * PARAMETERS: data - Pointer to validation data structure 267 * PARAMETERS: info - Method execution information block
252 * return_object_ptr - Pointer to the object returned from the 268 * return_object_ptr - Pointer to the object returned from the
253 * evaluation of a method or object 269 * evaluation of a method or object
254 * 270 *
@@ -262,7 +278,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
262 *****************************************************************************/ 278 *****************************************************************************/
263 279
264static acpi_status 280static acpi_status
265acpi_ns_repair_FDE(struct acpi_predefined_data *data, 281acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
266 union acpi_operand_object **return_object_ptr) 282 union acpi_operand_object **return_object_ptr)
267{ 283{
268 union acpi_operand_object *return_object = *return_object_ptr; 284 union acpi_operand_object *return_object = *return_object_ptr;
@@ -285,8 +301,8 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
285 /* We can only repair if we have exactly 5 BYTEs */ 301 /* We can only repair if we have exactly 5 BYTEs */
286 302
287 if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) { 303 if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) {
288 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 304 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
289 data->node_flags, 305 info->node_flags,
290 "Incorrect return buffer length %u, expected %u", 306 "Incorrect return buffer length %u, expected %u",
291 return_object->buffer.length, 307 return_object->buffer.length,
292 ACPI_FDE_DWORD_BUFFER_SIZE)); 308 ACPI_FDE_DWORD_BUFFER_SIZE));
@@ -316,10 +332,11 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
316 332
317 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 333 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
318 "%s Expanded Byte Buffer to expected DWord Buffer\n", 334 "%s Expanded Byte Buffer to expected DWord Buffer\n",
319 data->pathname)); 335 info->full_pathname));
320 break; 336 break;
321 337
322 default: 338 default:
339
323 return (AE_AML_OPERAND_TYPE); 340 return (AE_AML_OPERAND_TYPE);
324 } 341 }
325 342
@@ -328,7 +345,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
328 acpi_ut_remove_reference(return_object); 345 acpi_ut_remove_reference(return_object);
329 *return_object_ptr = buffer_object; 346 *return_object_ptr = buffer_object;
330 347
331 data->flags |= ACPI_OBJECT_REPAIRED; 348 info->return_flags |= ACPI_OBJECT_REPAIRED;
332 return (AE_OK); 349 return (AE_OK);
333} 350}
334 351
@@ -336,7 +353,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
336 * 353 *
337 * FUNCTION: acpi_ns_repair_CID 354 * FUNCTION: acpi_ns_repair_CID
338 * 355 *
339 * PARAMETERS: data - Pointer to validation data structure 356 * PARAMETERS: info - Method execution information block
340 * return_object_ptr - Pointer to the object returned from the 357 * return_object_ptr - Pointer to the object returned from the
341 * evaluation of a method or object 358 * evaluation of a method or object
342 * 359 *
@@ -349,7 +366,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
349 *****************************************************************************/ 366 *****************************************************************************/
350 367
351static acpi_status 368static acpi_status
352acpi_ns_repair_CID(struct acpi_predefined_data *data, 369acpi_ns_repair_CID(struct acpi_evaluate_info *info,
353 union acpi_operand_object **return_object_ptr) 370 union acpi_operand_object **return_object_ptr)
354{ 371{
355 acpi_status status; 372 acpi_status status;
@@ -362,7 +379,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
362 /* Check for _CID as a simple string */ 379 /* Check for _CID as a simple string */
363 380
364 if (return_object->common.type == ACPI_TYPE_STRING) { 381 if (return_object->common.type == ACPI_TYPE_STRING) {
365 status = acpi_ns_repair_HID(data, return_object_ptr); 382 status = acpi_ns_repair_HID(info, return_object_ptr);
366 return (status); 383 return (status);
367 } 384 }
368 385
@@ -379,7 +396,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
379 original_element = *element_ptr; 396 original_element = *element_ptr;
380 original_ref_count = original_element->common.reference_count; 397 original_ref_count = original_element->common.reference_count;
381 398
382 status = acpi_ns_repair_HID(data, element_ptr); 399 status = acpi_ns_repair_HID(info, element_ptr);
383 if (ACPI_FAILURE(status)) { 400 if (ACPI_FAILURE(status)) {
384 return (status); 401 return (status);
385 } 402 }
@@ -404,9 +421,95 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
404 421
405/****************************************************************************** 422/******************************************************************************
406 * 423 *
424 * FUNCTION: acpi_ns_repair_CST
425 *
426 * PARAMETERS: info - Method execution information block
427 * return_object_ptr - Pointer to the object returned from the
428 * evaluation of a method or object
429 *
430 * RETURN: Status. AE_OK if object is OK or was repaired successfully
431 *
432 * DESCRIPTION: Repair for the _CST object:
433 * 1. Sort the list ascending by C state type
434 * 2. Ensure type cannot be zero
435 * 3. A sub-package count of zero means _CST is meaningless
436 * 4. Count must match the number of C state sub-packages
437 *
438 *****************************************************************************/
439
440static acpi_status
441acpi_ns_repair_CST(struct acpi_evaluate_info *info,
442 union acpi_operand_object **return_object_ptr)
443{
444 union acpi_operand_object *return_object = *return_object_ptr;
445 union acpi_operand_object **outer_elements;
446 u32 outer_element_count;
447 union acpi_operand_object *obj_desc;
448 acpi_status status;
449 u8 removing;
450 u32 i;
451
452 ACPI_FUNCTION_NAME(ns_repair_CST);
453
454 /*
455 * Check if the C-state type values are proportional.
456 */
457 outer_element_count = return_object->package.count - 1;
458 i = 0;
459 while (i < outer_element_count) {
460 outer_elements = &return_object->package.elements[i + 1];
461 removing = FALSE;
462
463 if ((*outer_elements)->package.count == 0) {
464 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
465 info->node_flags,
466 "SubPackage[%u] - removing entry due to zero count",
467 i));
468 removing = TRUE;
469 goto remove_element;
470 }
471
472 obj_desc = (*outer_elements)->package.elements[1]; /* Index1 = Type */
473 if ((u32)obj_desc->integer.value == 0) {
474 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
475 info->node_flags,
476 "SubPackage[%u] - removing entry due to invalid Type(0)",
477 i));
478 removing = TRUE;
479 }
480
481 remove_element:
482 if (removing) {
483 acpi_ns_remove_element(return_object, i + 1);
484 outer_element_count--;
485 } else {
486 i++;
487 }
488 }
489
490 /* Update top-level package count, Type "Integer" checked elsewhere */
491
492 obj_desc = return_object->package.elements[0];
493 obj_desc->integer.value = outer_element_count;
494
495 /*
496 * Entries (subpackages) in the _CST Package must be sorted by the
497 * C-state type, in ascending order.
498 */
499 status = acpi_ns_check_sorted_list(info, return_object, 1, 4, 1,
500 ACPI_SORT_ASCENDING, "C-State Type");
501 if (ACPI_FAILURE(status)) {
502 return (status);
503 }
504
505 return (AE_OK);
506}
507
508/******************************************************************************
509 *
407 * FUNCTION: acpi_ns_repair_HID 510 * FUNCTION: acpi_ns_repair_HID
408 * 511 *
409 * PARAMETERS: data - Pointer to validation data structure 512 * PARAMETERS: info - Method execution information block
410 * return_object_ptr - Pointer to the object returned from the 513 * return_object_ptr - Pointer to the object returned from the
411 * evaluation of a method or object 514 * evaluation of a method or object
412 * 515 *
@@ -418,7 +521,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
418 *****************************************************************************/ 521 *****************************************************************************/
419 522
420static acpi_status 523static acpi_status
421acpi_ns_repair_HID(struct acpi_predefined_data *data, 524acpi_ns_repair_HID(struct acpi_evaluate_info *info,
422 union acpi_operand_object **return_object_ptr) 525 union acpi_operand_object **return_object_ptr)
423{ 526{
424 union acpi_operand_object *return_object = *return_object_ptr; 527 union acpi_operand_object *return_object = *return_object_ptr;
@@ -435,12 +538,13 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
435 } 538 }
436 539
437 if (return_object->string.length == 0) { 540 if (return_object->string.length == 0) {
438 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 541 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
542 info->node_flags,
439 "Invalid zero-length _HID or _CID string")); 543 "Invalid zero-length _HID or _CID string"));
440 544
441 /* Return AE_OK anyway, let driver handle it */ 545 /* Return AE_OK anyway, let driver handle it */
442 546
443 data->flags |= ACPI_OBJECT_REPAIRED; 547 info->return_flags |= ACPI_OBJECT_REPAIRED;
444 return (AE_OK); 548 return (AE_OK);
445 } 549 }
446 550
@@ -464,7 +568,7 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
464 568
465 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 569 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
466 "%s: Removed invalid leading asterisk\n", 570 "%s: Removed invalid leading asterisk\n",
467 data->pathname)); 571 info->full_pathname));
468 } 572 }
469 573
470 /* 574 /*
@@ -486,53 +590,69 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
486 590
487/****************************************************************************** 591/******************************************************************************
488 * 592 *
489 * FUNCTION: acpi_ns_repair_TSS 593 * FUNCTION: acpi_ns_repair_PRT
490 * 594 *
491 * PARAMETERS: data - Pointer to validation data structure 595 * PARAMETERS: info - Method execution information block
492 * return_object_ptr - Pointer to the object returned from the 596 * return_object_ptr - Pointer to the object returned from the
493 * evaluation of a method or object 597 * evaluation of a method or object
494 * 598 *
495 * RETURN: Status. AE_OK if object is OK or was repaired successfully 599 * RETURN: Status. AE_OK if object is OK or was repaired successfully
496 * 600 *
497 * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list 601 * DESCRIPTION: Repair for the _PRT object. If necessary, fix reversed
498 * descending by the power dissipation values. 602 * source_name and source_index field, a common BIOS bug.
499 * 603 *
500 *****************************************************************************/ 604 *****************************************************************************/
501 605
502static acpi_status 606static acpi_status
503acpi_ns_repair_TSS(struct acpi_predefined_data *data, 607acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
504 union acpi_operand_object **return_object_ptr) 608 union acpi_operand_object **return_object_ptr)
505{ 609{
506 union acpi_operand_object *return_object = *return_object_ptr; 610 union acpi_operand_object *package_object = *return_object_ptr;
507 acpi_status status; 611 union acpi_operand_object **top_object_list;
508 struct acpi_namespace_node *node; 612 union acpi_operand_object **sub_object_list;
613 union acpi_operand_object *obj_desc;
614 u32 element_count;
615 u32 index;
509 616
510 /* 617 /* Each element in the _PRT package is a subpackage */
511 * We can only sort the _TSS return package if there is no _PSS in the
512 * same scope. This is because if _PSS is present, the ACPI specification
513 * dictates that the _TSS Power Dissipation field is to be ignored, and
514 * therefore some BIOSs leave garbage values in the _TSS Power field(s).
515 * In this case, it is best to just return the _TSS package as-is.
516 * (May, 2011)
517 */
518 status =
519 acpi_ns_get_node(data->node, "^_PSS", ACPI_NS_NO_UPSEARCH, &node);
520 if (ACPI_SUCCESS(status)) {
521 return (AE_OK);
522 }
523 618
524 status = acpi_ns_check_sorted_list(data, return_object, 5, 1, 619 top_object_list = package_object->package.elements;
525 ACPI_SORT_DESCENDING, 620 element_count = package_object->package.count;
526 "PowerDissipation");
527 621
528 return (status); 622 for (index = 0; index < element_count; index++) {
623 sub_object_list = (*top_object_list)->package.elements;
624
625 /*
626 * If the BIOS has erroneously reversed the _PRT source_name (index 2)
627 * and the source_index (index 3), fix it. _PRT is important enough to
628 * workaround this BIOS error. This also provides compatibility with
629 * other ACPI implementations.
630 */
631 obj_desc = sub_object_list[3];
632 if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
633 sub_object_list[3] = sub_object_list[2];
634 sub_object_list[2] = obj_desc;
635 info->return_flags |= ACPI_OBJECT_REPAIRED;
636
637 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
638 info->node_flags,
639 "PRT[%X]: Fixed reversed SourceName and SourceIndex",
640 index));
641 }
642
643 /* Point to the next union acpi_operand_object in the top level package */
644
645 top_object_list++;
646 }
647
648 return (AE_OK);
529} 649}
530 650
531/****************************************************************************** 651/******************************************************************************
532 * 652 *
533 * FUNCTION: acpi_ns_repair_PSS 653 * FUNCTION: acpi_ns_repair_PSS
534 * 654 *
535 * PARAMETERS: data - Pointer to validation data structure 655 * PARAMETERS: info - Method execution information block
536 * return_object_ptr - Pointer to the object returned from the 656 * return_object_ptr - Pointer to the object returned from the
537 * evaluation of a method or object 657 * evaluation of a method or object
538 * 658 *
@@ -546,7 +666,7 @@ acpi_ns_repair_TSS(struct acpi_predefined_data *data,
546 *****************************************************************************/ 666 *****************************************************************************/
547 667
548static acpi_status 668static acpi_status
549acpi_ns_repair_PSS(struct acpi_predefined_data *data, 669acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
550 union acpi_operand_object **return_object_ptr) 670 union acpi_operand_object **return_object_ptr)
551{ 671{
552 union acpi_operand_object *return_object = *return_object_ptr; 672 union acpi_operand_object *return_object = *return_object_ptr;
@@ -564,7 +684,7 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
564 * incorrectly sorted, sort it. We sort by cpu_frequency, since this 684 * incorrectly sorted, sort it. We sort by cpu_frequency, since this
565 * should be proportional to the power. 685 * should be proportional to the power.
566 */ 686 */
567 status = acpi_ns_check_sorted_list(data, return_object, 6, 0, 687 status = acpi_ns_check_sorted_list(info, return_object, 0, 6, 0,
568 ACPI_SORT_DESCENDING, 688 ACPI_SORT_DESCENDING,
569 "CpuFrequency"); 689 "CpuFrequency");
570 if (ACPI_FAILURE(status)) { 690 if (ACPI_FAILURE(status)) {
@@ -584,8 +704,8 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
584 obj_desc = elements[1]; /* Index1 = power_dissipation */ 704 obj_desc = elements[1]; /* Index1 = power_dissipation */
585 705
586 if ((u32) obj_desc->integer.value > previous_value) { 706 if ((u32) obj_desc->integer.value > previous_value) {
587 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 707 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
588 data->node_flags, 708 info->node_flags,
589 "SubPackage[%u,%u] - suspicious power dissipation values", 709 "SubPackage[%u,%u] - suspicious power dissipation values",
590 i - 1, i)); 710 i - 1, i));
591 } 711 }
@@ -599,10 +719,55 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
599 719
600/****************************************************************************** 720/******************************************************************************
601 * 721 *
722 * FUNCTION: acpi_ns_repair_TSS
723 *
724 * PARAMETERS: info - Method execution information block
725 * return_object_ptr - Pointer to the object returned from the
726 * evaluation of a method or object
727 *
728 * RETURN: Status. AE_OK if object is OK or was repaired successfully
729 *
730 * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
731 * descending by the power dissipation values.
732 *
733 *****************************************************************************/
734
735static acpi_status
736acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
737 union acpi_operand_object **return_object_ptr)
738{
739 union acpi_operand_object *return_object = *return_object_ptr;
740 acpi_status status;
741 struct acpi_namespace_node *node;
742
743 /*
744 * We can only sort the _TSS return package if there is no _PSS in the
745 * same scope. This is because if _PSS is present, the ACPI specification
746 * dictates that the _TSS Power Dissipation field is to be ignored, and
747 * therefore some BIOSs leave garbage values in the _TSS Power field(s).
748 * In this case, it is best to just return the _TSS package as-is.
749 * (May, 2011)
750 */
751 status = acpi_ns_get_node(info->node, "^_PSS",
752 ACPI_NS_NO_UPSEARCH, &node);
753 if (ACPI_SUCCESS(status)) {
754 return (AE_OK);
755 }
756
757 status = acpi_ns_check_sorted_list(info, return_object, 0, 5, 1,
758 ACPI_SORT_DESCENDING,
759 "PowerDissipation");
760
761 return (status);
762}
763
764/******************************************************************************
765 *
602 * FUNCTION: acpi_ns_check_sorted_list 766 * FUNCTION: acpi_ns_check_sorted_list
603 * 767 *
604 * PARAMETERS: data - Pointer to validation data structure 768 * PARAMETERS: info - Method execution information block
605 * return_object - Pointer to the top-level returned object 769 * return_object - Pointer to the top-level returned object
770 * start_index - Index of the first sub-package
606 * expected_count - Minimum length of each sub-package 771 * expected_count - Minimum length of each sub-package
607 * sort_index - Sub-package entry to sort on 772 * sort_index - Sub-package entry to sort on
608 * sort_direction - Ascending or descending 773 * sort_direction - Ascending or descending
@@ -617,8 +782,9 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
617 *****************************************************************************/ 782 *****************************************************************************/
618 783
619static acpi_status 784static acpi_status
620acpi_ns_check_sorted_list(struct acpi_predefined_data *data, 785acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
621 union acpi_operand_object *return_object, 786 union acpi_operand_object *return_object,
787 u32 start_index,
622 u32 expected_count, 788 u32 expected_count,
623 u32 sort_index, 789 u32 sort_index,
624 u8 sort_direction, char *sort_key_name) 790 u8 sort_direction, char *sort_key_name)
@@ -643,12 +809,14 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
643 * Any NULL elements should have been removed by earlier call 809 * Any NULL elements should have been removed by earlier call
644 * to acpi_ns_remove_null_elements. 810 * to acpi_ns_remove_null_elements.
645 */ 811 */
646 outer_elements = return_object->package.elements;
647 outer_element_count = return_object->package.count; 812 outer_element_count = return_object->package.count;
648 if (!outer_element_count) { 813 if (!outer_element_count || start_index >= outer_element_count) {
649 return (AE_AML_PACKAGE_LIMIT); 814 return (AE_AML_PACKAGE_LIMIT);
650 } 815 }
651 816
817 outer_elements = &return_object->package.elements[start_index];
818 outer_element_count -= start_index;
819
652 previous_value = 0; 820 previous_value = 0;
653 if (sort_direction == ACPI_SORT_DESCENDING) { 821 if (sort_direction == ACPI_SORT_DESCENDING) {
654 previous_value = ACPI_UINT32_MAX; 822 previous_value = ACPI_UINT32_MAX;
@@ -685,15 +853,16 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
685 (obj_desc->integer.value < previous_value)) || 853 (obj_desc->integer.value < previous_value)) ||
686 ((sort_direction == ACPI_SORT_DESCENDING) && 854 ((sort_direction == ACPI_SORT_DESCENDING) &&
687 (obj_desc->integer.value > previous_value))) { 855 (obj_desc->integer.value > previous_value))) {
688 acpi_ns_sort_list(return_object->package.elements, 856 acpi_ns_sort_list(&return_object->package.
857 elements[start_index],
689 outer_element_count, sort_index, 858 outer_element_count, sort_index,
690 sort_direction); 859 sort_direction);
691 860
692 data->flags |= ACPI_OBJECT_REPAIRED; 861 info->return_flags |= ACPI_OBJECT_REPAIRED;
693 862
694 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 863 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
695 "%s: Repaired unsorted list - now sorted by %s\n", 864 "%s: Repaired unsorted list - now sorted by %s\n",
696 data->pathname, sort_key_name)); 865 info->full_pathname, sort_key_name));
697 return (AE_OK); 866 return (AE_OK);
698 } 867 }
699 868
@@ -752,3 +921,52 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
752 } 921 }
753 } 922 }
754} 923}
924
925/******************************************************************************
926 *
927 * FUNCTION: acpi_ns_remove_element
928 *
929 * PARAMETERS: obj_desc - Package object element list
930 * index - Index of element to remove
931 *
932 * RETURN: None
933 *
934 * DESCRIPTION: Remove the requested element of a package and delete it.
935 *
936 *****************************************************************************/
937
938static void
939acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index)
940{
941 union acpi_operand_object **source;
942 union acpi_operand_object **dest;
943 u32 count;
944 u32 new_count;
945 u32 i;
946
947 ACPI_FUNCTION_NAME(ns_remove_element);
948
949 count = obj_desc->package.count;
950 new_count = count - 1;
951
952 source = obj_desc->package.elements;
953 dest = source;
954
955 /* Examine all elements of the package object, remove matched index */
956
957 for (i = 0; i < count; i++) {
958 if (i == index) {
959 acpi_ut_remove_reference(*source); /* Remove one ref for being in pkg */
960 acpi_ut_remove_reference(*source);
961 } else {
962 *dest = *source;
963 dest++;
964 }
965 source++;
966 }
967
968 /* NULL terminate list and update the package count */
969
970 *dest = NULL;
971 obj_desc->package.count = new_count;
972}
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index 2808586fad30..08c0b5beec88 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -419,10 +419,12 @@ acpi_ns_externalize_name(u32 internal_name_length,
419 419
420 switch (internal_name[0]) { 420 switch (internal_name[0]) {
421 case AML_ROOT_PREFIX: 421 case AML_ROOT_PREFIX:
422
422 prefix_length = 1; 423 prefix_length = 1;
423 break; 424 break;
424 425
425 case AML_PARENT_PREFIX: 426 case AML_PARENT_PREFIX:
427
426 for (i = 0; i < internal_name_length; i++) { 428 for (i = 0; i < internal_name_length; i++) {
427 if (ACPI_IS_PARENT_PREFIX(internal_name[i])) { 429 if (ACPI_IS_PARENT_PREFIX(internal_name[i])) {
428 prefix_length = i + 1; 430 prefix_length = i + 1;
@@ -438,6 +440,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
438 break; 440 break;
439 441
440 default: 442 default:
443
441 break; 444 break;
442 } 445 }
443 446
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index fc69949151bb..f553cfdb71dd 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 { 348
262 /* We have a namespace a node and a possible relative path */ 349 /* Warn if arguments passed to an object that is not a method */
263 350
264 status = acpi_ns_evaluate(info); 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.
@@ -413,6 +511,7 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
413 break; 511 break;
414 512
415 default: 513 default:
514
416 return; 515 return;
417 } 516 }
418 517
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index 9f25a3d4e992..91a5a69db80c 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -629,24 +629,28 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
629 629
630 switch (opcode) { 630 switch (opcode) {
631 case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ 631 case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
632
632 buffer_length = 633 buffer_length =
633 ACPI_GET8(parser_state->aml); 634 ACPI_GET8(parser_state->aml);
634 parser_state->aml += 1; 635 parser_state->aml += 1;
635 break; 636 break;
636 637
637 case AML_WORD_OP: /* AML_WORDDATA_ARG */ 638 case AML_WORD_OP: /* AML_WORDDATA_ARG */
639
638 buffer_length = 640 buffer_length =
639 ACPI_GET16(parser_state->aml); 641 ACPI_GET16(parser_state->aml);
640 parser_state->aml += 2; 642 parser_state->aml += 2;
641 break; 643 break;
642 644
643 case AML_DWORD_OP: /* AML_DWORDATA_ARG */ 645 case AML_DWORD_OP: /* AML_DWORDATA_ARG */
646
644 buffer_length = 647 buffer_length =
645 ACPI_GET32(parser_state->aml); 648 ACPI_GET32(parser_state->aml);
646 parser_state->aml += 4; 649 parser_state->aml += 4;
647 break; 650 break;
648 651
649 default: 652 default:
653
650 buffer_length = 0; 654 buffer_length = 0;
651 break; 655 break;
652 } 656 }
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index 63c455447481..065b44ae538f 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -164,7 +164,6 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
164 case AML_IF_OP: 164 case AML_IF_OP:
165 case AML_ELSE_OP: 165 case AML_ELSE_OP:
166 case AML_WHILE_OP: 166 case AML_WHILE_OP:
167
168 /* 167 /*
169 * Currently supported module-level opcodes are: 168 * Currently supported module-level opcodes are:
170 * IF/ELSE/WHILE. These appear to be the most common, 169 * IF/ELSE/WHILE. These appear to be the most common,
@@ -289,6 +288,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
289 default: 288 default:
290 289
291 /* No action for all other opcodes */ 290 /* No action for all other opcodes */
291
292 break; 292 break;
293 } 293 }
294 294
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c
index 12c4028002b1..95dc608a66a8 100644
--- a/drivers/acpi/acpica/psobject.c
+++ b/drivers/acpi/acpica/psobject.c
@@ -402,6 +402,7 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
402 402
403 switch (status) { 403 switch (status) {
404 case AE_OK: 404 case AE_OK:
405
405 break; 406 break;
406 407
407 case AE_CTRL_TRANSFER: 408 case AE_CTRL_TRANSFER:
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index abc4c48b2edd..86198a9139b5 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -176,10 +176,10 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
176 176
177 switch (parent_info->class) { 177 switch (parent_info->class) {
178 case AML_CLASS_CONTROL: 178 case AML_CLASS_CONTROL:
179
179 break; 180 break;
180 181
181 case AML_CLASS_CREATE: 182 case AML_CLASS_CREATE:
182
183 /* 183 /*
184 * These opcodes contain term_arg operands. The current 184 * These opcodes contain term_arg operands. The current
185 * op must be replaced by a placeholder return op 185 * op must be replaced by a placeholder return op
@@ -192,7 +192,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
192 break; 192 break;
193 193
194 case AML_CLASS_NAMED_OBJECT: 194 case AML_CLASS_NAMED_OBJECT:
195
196 /* 195 /*
197 * These opcodes contain term_arg operands. The current 196 * These opcodes contain term_arg operands. The current
198 * op must be replaced by a placeholder return op 197 * op must be replaced by a placeholder return op
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c
index c1934bf04f0a..877dc0de8df3 100644
--- a/drivers/acpi/acpica/pstree.c
+++ b/drivers/acpi/acpica/pstree.c
@@ -308,7 +308,9 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
308 break; 308 break;
309 309
310 default: 310 default:
311
311 /* All others have no children */ 312 /* All others have no children */
313
312 break; 314 break;
313 } 315 }
314 316
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/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 72077fa1eea5..b62a0f4f4f9b 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -352,6 +352,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
352 break; 352 break;
353 353
354 default: 354 default:
355
355 break; 356 break;
356 } 357 }
357 358
@@ -539,6 +540,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
539 break; 540 break;
540 541
541 default: 542 default:
543
542 break; 544 break;
543 } 545 }
544 546
@@ -650,8 +652,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
650 652
651 name_found = FALSE; 653 name_found = FALSE;
652 654
653 for (table_index = 0; table_index < 4 && !name_found; 655 for (table_index = 0;
654 table_index++) { 656 table_index < package_element->package.count
657 && !name_found; table_index++) {
655 if (*sub_object_list && /* Null object allowed */ 658 if (*sub_object_list && /* Null object allowed */
656 ((ACPI_TYPE_STRING == 659 ((ACPI_TYPE_STRING ==
657 (*sub_object_list)->common.type) || 660 (*sub_object_list)->common.type) ||
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index f8b55b426c9d..65f3e1c5b598 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -273,17 +273,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
273 */ 273 */
274 user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); 274 user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4);
275 275
276 /* Each element of the top-level package must also be a package */
277
278 if ((*top_object_list)->common.type != ACPI_TYPE_PACKAGE) {
279 ACPI_ERROR((AE_INFO,
280 "(PRT[%u]) Need sub-package, found %s",
281 index,
282 acpi_ut_get_object_type_name
283 (*top_object_list)));
284 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
285 }
286
287 /* Each sub-package must be of length 4 */ 276 /* Each sub-package must be of length 4 */
288 277
289 if ((*top_object_list)->package.count != 4) { 278 if ((*top_object_list)->package.count != 4) {
@@ -327,22 +316,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
327 user_prt->pin = (u32) obj_desc->integer.value; 316 user_prt->pin = (u32) obj_desc->integer.value;
328 317
329 /* 318 /*
330 * If the BIOS has erroneously reversed the _PRT source_name (index 2)
331 * and the source_index (index 3), fix it. _PRT is important enough to
332 * workaround this BIOS error. This also provides compatibility with
333 * other ACPI implementations.
334 */
335 obj_desc = sub_object_list[3];
336 if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
337 sub_object_list[3] = sub_object_list[2];
338 sub_object_list[2] = obj_desc;
339
340 ACPI_WARNING((AE_INFO,
341 "(PRT[%X].Source) SourceName and SourceIndex are reversed, fixed",
342 index));
343 }
344
345 /*
346 * 3) Third subobject: Dereference the PRT.source_name 319 * 3) Third subobject: Dereference the PRT.source_name
347 * The name may be unresolved (slack mode), so allow a null object 320 * The name may be unresolved (slack mode), so allow a null object
348 */ 321 */
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index b5fc0db2e87b..8a2d4986b0aa 100644
--- a/drivers/acpi/acpica/rsdump.c
+++ b/drivers/acpi/acpica/rsdump.c
@@ -120,17 +120,20 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
120 /* Strings */ 120 /* Strings */
121 121
122 case ACPI_RSD_LITERAL: 122 case ACPI_RSD_LITERAL:
123
123 acpi_rs_out_string(name, 124 acpi_rs_out_string(name,
124 ACPI_CAST_PTR(char, table->pointer)); 125 ACPI_CAST_PTR(char, table->pointer));
125 break; 126 break;
126 127
127 case ACPI_RSD_STRING: 128 case ACPI_RSD_STRING:
129
128 acpi_rs_out_string(name, ACPI_CAST_PTR(char, target)); 130 acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
129 break; 131 break;
130 132
131 /* Data items, 8/16/32/64 bit */ 133 /* Data items, 8/16/32/64 bit */
132 134
133 case ACPI_RSD_UINT8: 135 case ACPI_RSD_UINT8:
136
134 if (table->pointer) { 137 if (table->pointer) {
135 acpi_rs_out_string(name, ACPI_CAST_PTR(char, 138 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
136 table-> 139 table->
@@ -142,20 +145,24 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
142 break; 145 break;
143 146
144 case ACPI_RSD_UINT16: 147 case ACPI_RSD_UINT16:
148
145 acpi_rs_out_integer16(name, ACPI_GET16(target)); 149 acpi_rs_out_integer16(name, ACPI_GET16(target));
146 break; 150 break;
147 151
148 case ACPI_RSD_UINT32: 152 case ACPI_RSD_UINT32:
153
149 acpi_rs_out_integer32(name, ACPI_GET32(target)); 154 acpi_rs_out_integer32(name, ACPI_GET32(target));
150 break; 155 break;
151 156
152 case ACPI_RSD_UINT64: 157 case ACPI_RSD_UINT64:
158
153 acpi_rs_out_integer64(name, ACPI_GET64(target)); 159 acpi_rs_out_integer64(name, ACPI_GET64(target));
154 break; 160 break;
155 161
156 /* Flags: 1-bit and 2-bit flags supported */ 162 /* Flags: 1-bit and 2-bit flags supported */
157 163
158 case ACPI_RSD_1BITFLAG: 164 case ACPI_RSD_1BITFLAG:
165
159 acpi_rs_out_string(name, ACPI_CAST_PTR(char, 166 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
160 table-> 167 table->
161 pointer[*target & 168 pointer[*target &
@@ -163,6 +170,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
163 break; 170 break;
164 171
165 case ACPI_RSD_2BITFLAG: 172 case ACPI_RSD_2BITFLAG:
173
166 acpi_rs_out_string(name, ACPI_CAST_PTR(char, 174 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
167 table-> 175 table->
168 pointer[*target & 176 pointer[*target &
@@ -170,6 +178,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
170 break; 178 break;
171 179
172 case ACPI_RSD_3BITFLAG: 180 case ACPI_RSD_3BITFLAG:
181
173 acpi_rs_out_string(name, ACPI_CAST_PTR(char, 182 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
174 table-> 183 table->
175 pointer[*target & 184 pointer[*target &
@@ -258,6 +267,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
258 break; 267 break;
259 268
260 default: 269 default:
270
261 acpi_os_printf("**** Invalid table opcode [%X] ****\n", 271 acpi_os_printf("**** Invalid table opcode [%X] ****\n",
262 table->opcode); 272 table->opcode);
263 return; 273 return;
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c
index d5bf05a96096..80d12994e0d0 100644
--- a/drivers/acpi/acpica/rsmisc.c
+++ b/drivers/acpi/acpica/rsmisc.c
@@ -194,7 +194,6 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
194 break; 194 break;
195 195
196 case ACPI_RSC_COUNT_GPIO_RES: 196 case ACPI_RSC_COUNT_GPIO_RES:
197
198 /* 197 /*
199 * Vendor data is optional (length/offset may both be zero) 198 * Vendor data is optional (length/offset may both be zero)
200 * Examine vendor data length field first 199 * Examine vendor data length field first
@@ -410,12 +409,14 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
410 */ 409 */
411 switch (info->resource_offset) { 410 switch (info->resource_offset) {
412 case ACPI_RSC_COMPARE_AML_LENGTH: 411 case ACPI_RSC_COMPARE_AML_LENGTH:
412
413 if (aml_resource_length != info->value) { 413 if (aml_resource_length != info->value) {
414 goto exit; 414 goto exit;
415 } 415 }
416 break; 416 break;
417 417
418 case ACPI_RSC_COMPARE_VALUE: 418 case ACPI_RSC_COMPARE_VALUE:
419
419 if (ACPI_GET8(source) != info->value) { 420 if (ACPI_GET8(source) != info->value) {
420 goto exit; 421 goto exit;
421 } 422 }
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index a44953c6f75d..480b6b40c5ea 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -147,6 +147,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
147 case ACPI_RSC_MOVE_GPIO_RES: 147 case ACPI_RSC_MOVE_GPIO_RES:
148 case ACPI_RSC_MOVE_SERIAL_VEN: 148 case ACPI_RSC_MOVE_SERIAL_VEN:
149 case ACPI_RSC_MOVE_SERIAL_RES: 149 case ACPI_RSC_MOVE_SERIAL_RES:
150
150 ACPI_MEMCPY(destination, source, item_count); 151 ACPI_MEMCPY(destination, source, item_count);
151 return; 152 return;
152 153
@@ -157,21 +158,25 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
157 */ 158 */
158 case ACPI_RSC_MOVE16: 159 case ACPI_RSC_MOVE16:
159 case ACPI_RSC_MOVE_GPIO_PIN: 160 case ACPI_RSC_MOVE_GPIO_PIN:
161
160 ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i], 162 ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i],
161 &ACPI_CAST_PTR(u16, source)[i]); 163 &ACPI_CAST_PTR(u16, source)[i]);
162 break; 164 break;
163 165
164 case ACPI_RSC_MOVE32: 166 case ACPI_RSC_MOVE32:
167
165 ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i], 168 ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i],
166 &ACPI_CAST_PTR(u32, source)[i]); 169 &ACPI_CAST_PTR(u32, source)[i]);
167 break; 170 break;
168 171
169 case ACPI_RSC_MOVE64: 172 case ACPI_RSC_MOVE64:
173
170 ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i], 174 ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i],
171 &ACPI_CAST_PTR(u64, source)[i]); 175 &ACPI_CAST_PTR(u64, source)[i]);
172 break; 176 break;
173 177
174 default: 178 default:
179
175 return; 180 return;
176 } 181 }
177 } 182 }
@@ -736,7 +741,7 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
736 } 741 }
737 742
738 info->prefix_node = node; 743 info->prefix_node = node;
739 info->pathname = METHOD_NAME__SRS; 744 info->relative_pathname = METHOD_NAME__SRS;
740 info->parameters = args; 745 info->parameters = args;
741 info->flags = ACPI_IGNORE_RETURN_VALUE; 746 info->flags = ACPI_IGNORE_RETURN_VALUE;
742 747
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index c0e5d2d3ce67..94e3517554f9 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -402,6 +402,7 @@ acpi_resource_to_address64(struct acpi_resource *resource,
402 break; 402 break;
403 403
404 default: 404 default:
405
405 return (AE_BAD_PARAMETER); 406 return (AE_BAD_PARAMETER);
406 } 407 }
407 408
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index e57cd38004e3..42a13c0d7015 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -141,8 +141,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
141 ACPI_BIOS_ERROR((AE_INFO, 141 ACPI_BIOS_ERROR((AE_INFO,
142 "Table has invalid signature [%4.4s] (0x%8.8X), " 142 "Table has invalid signature [%4.4s] (0x%8.8X), "
143 "must be SSDT or OEMx", 143 "must be SSDT or OEMx",
144 acpi_ut_valid_acpi_name(*(u32 *)table_desc-> 144 acpi_ut_valid_acpi_name(table_desc->pointer->
145 pointer->
146 signature) ? 145 signature) ?
147 table_desc->pointer->signature : "????", 146 table_desc->pointer->signature : "????",
148 *(u32 *)table_desc->pointer->signature)); 147 *(u32 *)table_desc->pointer->signature));
@@ -471,15 +470,19 @@ void acpi_tb_delete_table(struct acpi_table_desc *table_desc)
471 } 470 }
472 switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) { 471 switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) {
473 case ACPI_TABLE_ORIGIN_MAPPED: 472 case ACPI_TABLE_ORIGIN_MAPPED:
473
474 acpi_os_unmap_memory(table_desc->pointer, table_desc->length); 474 acpi_os_unmap_memory(table_desc->pointer, table_desc->length);
475 break; 475 break;
476
476 case ACPI_TABLE_ORIGIN_ALLOCATED: 477 case ACPI_TABLE_ORIGIN_ALLOCATED:
478
477 ACPI_FREE(table_desc->pointer); 479 ACPI_FREE(table_desc->pointer);
478 break; 480 break;
479 481
480 /* Not mapped or allocated, there is nothing we can do */ 482 /* Not mapped or allocated, there is nothing we can do */
481 483
482 default: 484 default:
485
483 return; 486 return;
484 } 487 }
485 488
diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c
new file mode 100644
index 000000000000..dc963f823d2c
--- /dev/null
+++ b/drivers/acpi/acpica/tbprint.c
@@ -0,0 +1,237 @@
1/******************************************************************************
2 *
3 * Module Name: tbprint - Table output utilities
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 "actables.h"
47
48#define _COMPONENT ACPI_TABLES
49ACPI_MODULE_NAME("tbprint")
50
51/* Local prototypes */
52static void acpi_tb_fix_string(char *string, acpi_size length);
53
54static void
55acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
56 struct acpi_table_header *header);
57
58/*******************************************************************************
59 *
60 * FUNCTION: acpi_tb_fix_string
61 *
62 * PARAMETERS: string - String to be repaired
63 * length - Maximum length
64 *
65 * RETURN: None
66 *
67 * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
68 * with a question mark '?'.
69 *
70 ******************************************************************************/
71
72static void acpi_tb_fix_string(char *string, acpi_size length)
73{
74
75 while (length && *string) {
76 if (!ACPI_IS_PRINT(*string)) {
77 *string = '?';
78 }
79 string++;
80 length--;
81 }
82}
83
84/*******************************************************************************
85 *
86 * FUNCTION: acpi_tb_cleanup_table_header
87 *
88 * PARAMETERS: out_header - Where the cleaned header is returned
89 * header - Input ACPI table header
90 *
91 * RETURN: Returns the cleaned header in out_header
92 *
93 * DESCRIPTION: Copy the table header and ensure that all "string" fields in
94 * the header consist of printable characters.
95 *
96 ******************************************************************************/
97
98static void
99acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
100 struct acpi_table_header *header)
101{
102
103 ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
104
105 acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
106 acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
107 acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
108 acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
109}
110
111/*******************************************************************************
112 *
113 * FUNCTION: acpi_tb_print_table_header
114 *
115 * PARAMETERS: address - Table physical address
116 * header - Table header
117 *
118 * RETURN: None
119 *
120 * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
121 *
122 ******************************************************************************/
123
124void
125acpi_tb_print_table_header(acpi_physical_address address,
126 struct acpi_table_header *header)
127{
128 struct acpi_table_header local_header;
129
130 /*
131 * The reason that the Address is cast to a void pointer is so that we
132 * can use %p which will work properly on both 32-bit and 64-bit hosts.
133 */
134 if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) {
135
136 /* FACS only has signature and length fields */
137
138 ACPI_INFO((AE_INFO, "%4.4s %p %05X",
139 header->signature, ACPI_CAST_PTR(void, address),
140 header->length));
141 } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) {
142
143 /* RSDP has no common fields */
144
145 ACPI_MEMCPY(local_header.oem_id,
146 ACPI_CAST_PTR(struct acpi_table_rsdp,
147 header)->oem_id, ACPI_OEM_ID_SIZE);
148 acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
149
150 ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
151 ACPI_CAST_PTR(void, address),
152 (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
153 revision >
154 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
155 header)->length : 20,
156 ACPI_CAST_PTR(struct acpi_table_rsdp,
157 header)->revision,
158 local_header.oem_id));
159 } else {
160 /* Standard ACPI table with full common header */
161
162 acpi_tb_cleanup_table_header(&local_header, header);
163
164 ACPI_INFO((AE_INFO,
165 "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
166 local_header.signature, ACPI_CAST_PTR(void, address),
167 local_header.length, local_header.revision,
168 local_header.oem_id, local_header.oem_table_id,
169 local_header.oem_revision,
170 local_header.asl_compiler_id,
171 local_header.asl_compiler_revision));
172 }
173}
174
175/*******************************************************************************
176 *
177 * FUNCTION: acpi_tb_validate_checksum
178 *
179 * PARAMETERS: table - ACPI table to verify
180 * length - Length of entire table
181 *
182 * RETURN: Status
183 *
184 * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
185 * exception on bad checksum.
186 *
187 ******************************************************************************/
188
189acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
190{
191 u8 checksum;
192
193 /* Compute the checksum on the table */
194
195 checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), length);
196
197 /* Checksum ok? (should be zero) */
198
199 if (checksum) {
200 ACPI_BIOS_WARNING((AE_INFO,
201 "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
202 "should be 0x%2.2X",
203 table->signature, table->checksum,
204 (u8)(table->checksum - checksum)));
205
206#if (ACPI_CHECKSUM_ABORT)
207 return (AE_BAD_CHECKSUM);
208#endif
209 }
210
211 return (AE_OK);
212}
213
214/*******************************************************************************
215 *
216 * FUNCTION: acpi_tb_checksum
217 *
218 * PARAMETERS: buffer - Pointer to memory region to be checked
219 * length - Length of this memory region
220 *
221 * RETURN: Checksum (u8)
222 *
223 * DESCRIPTION: Calculates circular checksum of memory region.
224 *
225 ******************************************************************************/
226
227u8 acpi_tb_checksum(u8 *buffer, u32 length)
228{
229 u8 sum = 0;
230 u8 *end = buffer + length;
231
232 while (buffer < end) {
233 sum = (u8)(sum + *(buffer++));
234 }
235
236 return (sum);
237}
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index ce3d5db39a9c..bffdfc7b8322 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Module Name: tbutils - table utilities 3 * Module Name: tbutils - ACPI Table utilities
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -49,12 +49,6 @@
49ACPI_MODULE_NAME("tbutils") 49ACPI_MODULE_NAME("tbutils")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52static void acpi_tb_fix_string(char *string, acpi_size length);
53
54static void
55acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
56 struct acpi_table_header *header);
57
58static acpi_physical_address 52static acpi_physical_address
59acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); 53acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
60 54
@@ -176,189 +170,6 @@ u8 acpi_tb_tables_loaded(void)
176 170
177/******************************************************************************* 171/*******************************************************************************
178 * 172 *
179 * FUNCTION: acpi_tb_fix_string
180 *
181 * PARAMETERS: string - String to be repaired
182 * length - Maximum length
183 *
184 * RETURN: None
185 *
186 * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
187 * with a question mark '?'.
188 *
189 ******************************************************************************/
190
191static void acpi_tb_fix_string(char *string, acpi_size length)
192{
193
194 while (length && *string) {
195 if (!ACPI_IS_PRINT(*string)) {
196 *string = '?';
197 }
198 string++;
199 length--;
200 }
201}
202
203/*******************************************************************************
204 *
205 * FUNCTION: acpi_tb_cleanup_table_header
206 *
207 * PARAMETERS: out_header - Where the cleaned header is returned
208 * header - Input ACPI table header
209 *
210 * RETURN: Returns the cleaned header in out_header
211 *
212 * DESCRIPTION: Copy the table header and ensure that all "string" fields in
213 * the header consist of printable characters.
214 *
215 ******************************************************************************/
216
217static void
218acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
219 struct acpi_table_header *header)
220{
221
222 ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
223
224 acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
225 acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
226 acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
227 acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
228}
229
230/*******************************************************************************
231 *
232 * FUNCTION: acpi_tb_print_table_header
233 *
234 * PARAMETERS: address - Table physical address
235 * header - Table header
236 *
237 * RETURN: None
238 *
239 * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
240 *
241 ******************************************************************************/
242
243void
244acpi_tb_print_table_header(acpi_physical_address address,
245 struct acpi_table_header *header)
246{
247 struct acpi_table_header local_header;
248
249 /*
250 * The reason that the Address is cast to a void pointer is so that we
251 * can use %p which will work properly on both 32-bit and 64-bit hosts.
252 */
253 if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) {
254
255 /* FACS only has signature and length fields */
256
257 ACPI_INFO((AE_INFO, "%4.4s %p %05X",
258 header->signature, ACPI_CAST_PTR(void, address),
259 header->length));
260 } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) {
261
262 /* RSDP has no common fields */
263
264 ACPI_MEMCPY(local_header.oem_id,
265 ACPI_CAST_PTR(struct acpi_table_rsdp,
266 header)->oem_id, ACPI_OEM_ID_SIZE);
267 acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
268
269 ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
270 ACPI_CAST_PTR (void, address),
271 (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
272 revision >
273 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
274 header)->length : 20,
275 ACPI_CAST_PTR(struct acpi_table_rsdp,
276 header)->revision,
277 local_header.oem_id));
278 } else {
279 /* Standard ACPI table with full common header */
280
281 acpi_tb_cleanup_table_header(&local_header, header);
282
283 ACPI_INFO((AE_INFO,
284 "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
285 local_header.signature, ACPI_CAST_PTR(void, address),
286 local_header.length, local_header.revision,
287 local_header.oem_id, local_header.oem_table_id,
288 local_header.oem_revision,
289 local_header.asl_compiler_id,
290 local_header.asl_compiler_revision));
291
292 }
293}
294
295/*******************************************************************************
296 *
297 * FUNCTION: acpi_tb_validate_checksum
298 *
299 * PARAMETERS: table - ACPI table to verify
300 * length - Length of entire table
301 *
302 * RETURN: Status
303 *
304 * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
305 * exception on bad checksum.
306 *
307 ******************************************************************************/
308
309acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
310{
311 u8 checksum;
312
313 /* Compute the checksum on the table */
314
315 checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), length);
316
317 /* Checksum ok? (should be zero) */
318
319 if (checksum) {
320 ACPI_BIOS_WARNING((AE_INFO,
321 "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
322 "should be 0x%2.2X",
323 table->signature, table->checksum,
324 (u8)(table->checksum - checksum)));
325
326#if (ACPI_CHECKSUM_ABORT)
327
328 return (AE_BAD_CHECKSUM);
329#endif
330 }
331
332 return (AE_OK);
333}
334
335/*******************************************************************************
336 *
337 * FUNCTION: acpi_tb_checksum
338 *
339 * PARAMETERS: buffer - Pointer to memory region to be checked
340 * length - Length of this memory region
341 *
342 * RETURN: Checksum (u8)
343 *
344 * DESCRIPTION: Calculates circular checksum of memory region.
345 *
346 ******************************************************************************/
347
348u8 acpi_tb_checksum(u8 *buffer, u32 length)
349{
350 u8 sum = 0;
351 u8 *end = buffer + length;
352
353 while (buffer < end) {
354 sum = (u8) (sum + *(buffer++));
355 }
356
357 return (sum);
358}
359
360/*******************************************************************************
361 *
362 * FUNCTION: acpi_tb_check_dsdt_header 173 * FUNCTION: acpi_tb_check_dsdt_header
363 * 174 *
364 * PARAMETERS: None 175 * PARAMETERS: None
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index 67e046ec8f0a..0ba9e328d5d7 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -53,8 +53,6 @@ ACPI_MODULE_NAME("tbxfload")
53/* Local prototypes */ 53/* Local prototypes */
54static acpi_status acpi_tb_load_namespace(void); 54static acpi_status acpi_tb_load_namespace(void);
55 55
56static int no_auto_ssdt;
57
58/******************************************************************************* 56/*******************************************************************************
59 * 57 *
60 * FUNCTION: acpi_load_tables 58 * FUNCTION: acpi_load_tables
@@ -180,8 +178,16 @@ static acpi_status acpi_tb_load_namespace(void)
180 continue; 178 continue;
181 } 179 }
182 180
183 if (no_auto_ssdt) { 181 /*
184 printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n"); 182 * Optionally do not load any SSDTs from the RSDT/XSDT. This can
183 * be useful for debugging ACPI problems on some machines.
184 */
185 if (acpi_gbl_disable_ssdt_table_load) {
186 ACPI_INFO((AE_INFO, "Ignoring %4.4s at %p",
187 acpi_gbl_root_table_list.tables[i].signature.
188 ascii, ACPI_CAST_PTR(void,
189 acpi_gbl_root_table_list.
190 tables[i].address)));
185 continue; 191 continue;
186 } 192 }
187 193
@@ -376,14 +382,3 @@ acpi_status acpi_unload_parent_table(acpi_handle object)
376} 382}
377 383
378ACPI_EXPORT_SYMBOL(acpi_unload_parent_table) 384ACPI_EXPORT_SYMBOL(acpi_unload_parent_table)
379
380static int __init acpi_no_auto_ssdt_setup(char *s) {
381
382 printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");
383
384 no_auto_ssdt = 1;
385
386 return 1;
387}
388
389__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
diff --git a/drivers/acpi/acpica/utbuffer.c b/drivers/acpi/acpica/utbuffer.c
new file mode 100644
index 000000000000..11fde93be120
--- /dev/null
+++ b/drivers/acpi/acpica/utbuffer.c
@@ -0,0 +1,201 @@
1/******************************************************************************
2 *
3 * Module Name: utbuffer - Buffer dump routines
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
47#define _COMPONENT ACPI_UTILITIES
48ACPI_MODULE_NAME("utbuffer")
49
50/*******************************************************************************
51 *
52 * FUNCTION: acpi_ut_dump_buffer
53 *
54 * PARAMETERS: buffer - Buffer to dump
55 * count - Amount to dump, in bytes
56 * display - BYTE, WORD, DWORD, or QWORD display:
57 * DB_BYTE_DISPLAY
58 * DB_WORD_DISPLAY
59 * DB_DWORD_DISPLAY
60 * DB_QWORD_DISPLAY
61 * base_offset - Beginning buffer offset (display only)
62 *
63 * RETURN: None
64 *
65 * DESCRIPTION: Generic dump buffer in both hex and ascii.
66 *
67 ******************************************************************************/
68void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
69{
70 u32 i = 0;
71 u32 j;
72 u32 temp32;
73 u8 buf_char;
74
75 if (!buffer) {
76 acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
77 return;
78 }
79
80 if ((count < 4) || (count & 0x01)) {
81 display = DB_BYTE_DISPLAY;
82 }
83
84 /* Nasty little dump buffer routine! */
85
86 while (i < count) {
87
88 /* Print current offset */
89
90 acpi_os_printf("%6.4X: ", (base_offset + i));
91
92 /* Print 16 hex chars */
93
94 for (j = 0; j < 16;) {
95 if (i + j >= count) {
96
97 /* Dump fill spaces */
98
99 acpi_os_printf("%*s", ((display * 2) + 1), " ");
100 j += display;
101 continue;
102 }
103
104 switch (display) {
105 case DB_BYTE_DISPLAY:
106 default: /* Default is BYTE display */
107
108 acpi_os_printf("%02X ",
109 buffer[(acpi_size) i + j]);
110 break;
111
112 case DB_WORD_DISPLAY:
113
114 ACPI_MOVE_16_TO_32(&temp32,
115 &buffer[(acpi_size) i + j]);
116 acpi_os_printf("%04X ", temp32);
117 break;
118
119 case DB_DWORD_DISPLAY:
120
121 ACPI_MOVE_32_TO_32(&temp32,
122 &buffer[(acpi_size) i + j]);
123 acpi_os_printf("%08X ", temp32);
124 break;
125
126 case DB_QWORD_DISPLAY:
127
128 ACPI_MOVE_32_TO_32(&temp32,
129 &buffer[(acpi_size) i + j]);
130 acpi_os_printf("%08X", temp32);
131
132 ACPI_MOVE_32_TO_32(&temp32,
133 &buffer[(acpi_size) i + j +
134 4]);
135 acpi_os_printf("%08X ", temp32);
136 break;
137 }
138
139 j += display;
140 }
141
142 /*
143 * Print the ASCII equivalent characters but watch out for the bad
144 * unprintable ones (printable chars are 0x20 through 0x7E)
145 */
146 acpi_os_printf(" ");
147 for (j = 0; j < 16; j++) {
148 if (i + j >= count) {
149 acpi_os_printf("\n");
150 return;
151 }
152
153 buf_char = buffer[(acpi_size) i + j];
154 if (ACPI_IS_PRINT(buf_char)) {
155 acpi_os_printf("%c", buf_char);
156 } else {
157 acpi_os_printf(".");
158 }
159 }
160
161 /* Done with that line. */
162
163 acpi_os_printf("\n");
164 i += 16;
165 }
166
167 return;
168}
169
170/*******************************************************************************
171 *
172 * FUNCTION: acpi_ut_debug_dump_buffer
173 *
174 * PARAMETERS: buffer - Buffer to dump
175 * count - Amount to dump, in bytes
176 * display - BYTE, WORD, DWORD, or QWORD display:
177 * DB_BYTE_DISPLAY
178 * DB_WORD_DISPLAY
179 * DB_DWORD_DISPLAY
180 * DB_QWORD_DISPLAY
181 * component_ID - Caller's component ID
182 *
183 * RETURN: None
184 *
185 * DESCRIPTION: Generic dump buffer in both hex and ascii.
186 *
187 ******************************************************************************/
188
189void
190acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id)
191{
192
193 /* Only dump the buffer if tracing is enabled */
194
195 if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
196 (component_id & acpi_dbg_layer))) {
197 return;
198 }
199
200 acpi_ut_dump_buffer(buffer, count, display, 0);
201}
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index e4c9291fc0a3..1731c27c36a6 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -178,7 +178,6 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
178 178
179 switch (internal_object->reference.class) { 179 switch (internal_object->reference.class) {
180 case ACPI_REFCLASS_NAME: 180 case ACPI_REFCLASS_NAME:
181
182 /* 181 /*
183 * For namepath, return the object handle ("reference") 182 * For namepath, return the object handle ("reference")
184 * We are referring to the namespace node 183 * We are referring to the namespace node
@@ -264,7 +263,6 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
264 263
265 switch (object_type) { 264 switch (object_type) {
266 case ACPI_COPY_TYPE_SIMPLE: 265 case ACPI_COPY_TYPE_SIMPLE:
267
268 /* 266 /*
269 * This is a simple or null object 267 * This is a simple or null object
270 */ 268 */
@@ -278,7 +276,6 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
278 break; 276 break;
279 277
280 case ACPI_COPY_TYPE_PACKAGE: 278 case ACPI_COPY_TYPE_PACKAGE:
281
282 /* 279 /*
283 * Build the package object 280 * Build the package object
284 */ 281 */
@@ -304,6 +301,7 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
304 break; 301 break;
305 302
306 default: 303 default:
304
307 return (AE_BAD_PARAMETER); 305 return (AE_BAD_PARAMETER);
308 } 306 }
309 307
@@ -481,6 +479,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
481 return_ACPI_STATUS(AE_OK); 479 return_ACPI_STATUS(AE_OK);
482 480
483 default: 481 default:
482
484 /* All other types are not supported */ 483 /* All other types are not supported */
485 484
486 ACPI_ERROR((AE_INFO, 485 ACPI_ERROR((AE_INFO,
@@ -544,7 +543,9 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
544 break; 543 break;
545 544
546 default: 545 default:
546
547 /* Other types can't get here */ 547 /* Other types can't get here */
548
548 break; 549 break;
549 } 550 }
550 551
@@ -800,7 +801,9 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
800 break; 801 break;
801 802
802 default: 803 default:
804
803 /* Nothing to do for other simple objects */ 805 /* Nothing to do for other simple objects */
806
804 break; 807 break;
805 } 808 }
806 809
@@ -868,7 +871,6 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
868 break; 871 break;
869 872
870 case ACPI_COPY_TYPE_PACKAGE: 873 case ACPI_COPY_TYPE_PACKAGE:
871
872 /* 874 /*
873 * This object is a package - go down another nesting level 875 * This object is a package - go down another nesting level
874 * Create and build the package object 876 * Create and build the package object
@@ -891,6 +893,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
891 break; 893 break;
892 894
893 default: 895 default:
896
894 return (AE_BAD_PARAMETER); 897 return (AE_BAD_PARAMETER);
895 } 898 }
896 899
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index c57d9cc07ba9..5796e11a0671 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Module Name: utdebug - Debug print routines 3 * Module Name: utdebug - Debug print/trace routines
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -543,149 +543,3 @@ acpi_ut_ptr_exit(u32 line_number,
543} 543}
544 544
545#endif 545#endif
546
547/*******************************************************************************
548 *
549 * FUNCTION: acpi_ut_dump_buffer
550 *
551 * PARAMETERS: buffer - Buffer to dump
552 * count - Amount to dump, in bytes
553 * display - BYTE, WORD, DWORD, or QWORD display
554 * offset - Beginning buffer offset (display only)
555 *
556 * RETURN: None
557 *
558 * DESCRIPTION: Generic dump buffer in both hex and ascii.
559 *
560 ******************************************************************************/
561
562void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
563{
564 u32 i = 0;
565 u32 j;
566 u32 temp32;
567 u8 buf_char;
568
569 if (!buffer) {
570 acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
571 return;
572 }
573
574 if ((count < 4) || (count & 0x01)) {
575 display = DB_BYTE_DISPLAY;
576 }
577
578 /* Nasty little dump buffer routine! */
579
580 while (i < count) {
581
582 /* Print current offset */
583
584 acpi_os_printf("%6.4X: ", (base_offset + i));
585
586 /* Print 16 hex chars */
587
588 for (j = 0; j < 16;) {
589 if (i + j >= count) {
590
591 /* Dump fill spaces */
592
593 acpi_os_printf("%*s", ((display * 2) + 1), " ");
594 j += display;
595 continue;
596 }
597
598 switch (display) {
599 case DB_BYTE_DISPLAY:
600 default: /* Default is BYTE display */
601
602 acpi_os_printf("%02X ",
603 buffer[(acpi_size) i + j]);
604 break;
605
606 case DB_WORD_DISPLAY:
607
608 ACPI_MOVE_16_TO_32(&temp32,
609 &buffer[(acpi_size) i + j]);
610 acpi_os_printf("%04X ", temp32);
611 break;
612
613 case DB_DWORD_DISPLAY:
614
615 ACPI_MOVE_32_TO_32(&temp32,
616 &buffer[(acpi_size) i + j]);
617 acpi_os_printf("%08X ", temp32);
618 break;
619
620 case DB_QWORD_DISPLAY:
621
622 ACPI_MOVE_32_TO_32(&temp32,
623 &buffer[(acpi_size) i + j]);
624 acpi_os_printf("%08X", temp32);
625
626 ACPI_MOVE_32_TO_32(&temp32,
627 &buffer[(acpi_size) i + j +
628 4]);
629 acpi_os_printf("%08X ", temp32);
630 break;
631 }
632
633 j += display;
634 }
635
636 /*
637 * Print the ASCII equivalent characters but watch out for the bad
638 * unprintable ones (printable chars are 0x20 through 0x7E)
639 */
640 acpi_os_printf(" ");
641 for (j = 0; j < 16; j++) {
642 if (i + j >= count) {
643 acpi_os_printf("\n");
644 return;
645 }
646
647 buf_char = buffer[(acpi_size) i + j];
648 if (ACPI_IS_PRINT(buf_char)) {
649 acpi_os_printf("%c", buf_char);
650 } else {
651 acpi_os_printf(".");
652 }
653 }
654
655 /* Done with that line. */
656
657 acpi_os_printf("\n");
658 i += 16;
659 }
660
661 return;
662}
663
664/*******************************************************************************
665 *
666 * FUNCTION: acpi_ut_debug_dump_buffer
667 *
668 * PARAMETERS: buffer - Buffer to dump
669 * count - Amount to dump, in bytes
670 * display - BYTE, WORD, DWORD, or QWORD display
671 * component_ID - Caller's component ID
672 *
673 * RETURN: None
674 *
675 * DESCRIPTION: Generic dump buffer in both hex and ascii.
676 *
677 ******************************************************************************/
678
679void
680acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id)
681{
682
683 /* Only dump the buffer if tracing is enabled */
684
685 if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
686 (component_id & acpi_dbg_layer))) {
687 return;
688 }
689
690 acpi_ut_dump_buffer(buffer, count, display, 0);
691}
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index 29b930250b6f..d6b33f29d327 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -303,6 +303,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
303 break; 303 break;
304 304
305 default: 305 default:
306
306 break; 307 break;
307 } 308 }
308 309
@@ -508,7 +509,6 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
508 case ACPI_TYPE_PROCESSOR: 509 case ACPI_TYPE_PROCESSOR:
509 case ACPI_TYPE_POWER: 510 case ACPI_TYPE_POWER:
510 case ACPI_TYPE_THERMAL: 511 case ACPI_TYPE_THERMAL:
511
512 /* 512 /*
513 * Update the notify objects for these types (if present) 513 * Update the notify objects for these types (if present)
514 * Two lists, system and device notify handlers. 514 * Two lists, system and device notify handlers.
@@ -623,6 +623,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
623 623
624 case ACPI_TYPE_REGION: 624 case ACPI_TYPE_REGION:
625 default: 625 default:
626
626 break; /* No subobjects for all other types */ 627 break; /* No subobjects for all other types */
627 } 628 }
628 629
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c
new file mode 100644
index 000000000000..154fdcaa5830
--- /dev/null
+++ b/drivers/acpi/acpica/uterror.c
@@ -0,0 +1,289 @@
1/*******************************************************************************
2 *
3 * Module Name: uterror - Various internal error/warning output functions
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
48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("uterror")
50
51/*
52 * This module contains internal error functions that may
53 * be configured out.
54 */
55#if !defined (ACPI_NO_ERROR_MESSAGES)
56/*******************************************************************************
57 *
58 * FUNCTION: acpi_ut_predefined_warning
59 *
60 * PARAMETERS: module_name - Caller's module name (for error output)
61 * line_number - Caller's line number (for error output)
62 * pathname - Full pathname to the node
63 * node_flags - From Namespace node for the method/object
64 * format - Printf format string + additional args
65 *
66 * RETURN: None
67 *
68 * DESCRIPTION: Warnings for the predefined validation module. Messages are
69 * only emitted the first time a problem with a particular
70 * method/object is detected. This prevents a flood of error
71 * messages for methods that are repeatedly evaluated.
72 *
73 ******************************************************************************/
74void ACPI_INTERNAL_VAR_XFACE
75acpi_ut_predefined_warning(const char *module_name,
76 u32 line_number,
77 char *pathname,
78 u8 node_flags, const char *format, ...)
79{
80 va_list arg_list;
81
82 /*
83 * Warning messages for this method/object will be disabled after the
84 * first time a validation fails or an object is successfully repaired.
85 */
86 if (node_flags & ANOBJ_EVALUATED) {
87 return;
88 }
89
90 acpi_os_printf(ACPI_MSG_WARNING "%s: ", pathname);
91
92 va_start(arg_list, format);
93 acpi_os_vprintf(format, arg_list);
94 ACPI_MSG_SUFFIX;
95 va_end(arg_list);
96}
97
98/*******************************************************************************
99 *
100 * FUNCTION: acpi_ut_predefined_info
101 *
102 * PARAMETERS: module_name - Caller's module name (for error output)
103 * line_number - Caller's line number (for error output)
104 * pathname - Full pathname to the node
105 * node_flags - From Namespace node for the method/object
106 * format - Printf format string + additional args
107 *
108 * RETURN: None
109 *
110 * DESCRIPTION: Info messages for the predefined validation module. Messages
111 * are only emitted the first time a problem with a particular
112 * method/object is detected. This prevents a flood of
113 * messages for methods that are repeatedly evaluated.
114 *
115 ******************************************************************************/
116
117void ACPI_INTERNAL_VAR_XFACE
118acpi_ut_predefined_info(const char *module_name,
119 u32 line_number,
120 char *pathname, u8 node_flags, const char *format, ...)
121{
122 va_list arg_list;
123
124 /*
125 * Warning messages for this method/object will be disabled after the
126 * first time a validation fails or an object is successfully repaired.
127 */
128 if (node_flags & ANOBJ_EVALUATED) {
129 return;
130 }
131
132 acpi_os_printf(ACPI_MSG_INFO "%s: ", pathname);
133
134 va_start(arg_list, format);
135 acpi_os_vprintf(format, arg_list);
136 ACPI_MSG_SUFFIX;
137 va_end(arg_list);
138}
139
140/*******************************************************************************
141 *
142 * FUNCTION: acpi_ut_predefined_bios_error
143 *
144 * PARAMETERS: module_name - Caller's module name (for error output)
145 * line_number - Caller's line number (for error output)
146 * pathname - Full pathname to the node
147 * node_flags - From Namespace node for the method/object
148 * format - Printf format string + additional args
149 *
150 * RETURN: None
151 *
152 * DESCRIPTION: BIOS error message for predefined names. Messages
153 * are only emitted the first time a problem with a particular
154 * method/object is detected. This prevents a flood of
155 * messages for methods that are repeatedly evaluated.
156 *
157 ******************************************************************************/
158
159void ACPI_INTERNAL_VAR_XFACE
160acpi_ut_predefined_bios_error(const char *module_name,
161 u32 line_number,
162 char *pathname,
163 u8 node_flags, const char *format, ...)
164{
165 va_list arg_list;
166
167 /*
168 * Warning messages for this method/object will be disabled after the
169 * first time a validation fails or an object is successfully repaired.
170 */
171 if (node_flags & ANOBJ_EVALUATED) {
172 return;
173 }
174
175 acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s: ", pathname);
176
177 va_start(arg_list, format);
178 acpi_os_vprintf(format, arg_list);
179 ACPI_MSG_SUFFIX;
180 va_end(arg_list);
181}
182
183/*******************************************************************************
184 *
185 * FUNCTION: acpi_ut_namespace_error
186 *
187 * PARAMETERS: module_name - Caller's module name (for error output)
188 * line_number - Caller's line number (for error output)
189 * internal_name - Name or path of the namespace node
190 * lookup_status - Exception code from NS lookup
191 *
192 * RETURN: None
193 *
194 * DESCRIPTION: Print error message with the full pathname for the NS node.
195 *
196 ******************************************************************************/
197
198void
199acpi_ut_namespace_error(const char *module_name,
200 u32 line_number,
201 const char *internal_name, acpi_status lookup_status)
202{
203 acpi_status status;
204 u32 bad_name;
205 char *name = NULL;
206
207 ACPI_MSG_REDIRECT_BEGIN;
208 acpi_os_printf(ACPI_MSG_ERROR);
209
210 if (lookup_status == AE_BAD_CHARACTER) {
211
212 /* There is a non-ascii character in the name */
213
214 ACPI_MOVE_32_TO_32(&bad_name,
215 ACPI_CAST_PTR(u32, internal_name));
216 acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name);
217 } else {
218 /* Convert path to external format */
219
220 status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
221 internal_name, NULL, &name);
222
223 /* Print target name */
224
225 if (ACPI_SUCCESS(status)) {
226 acpi_os_printf("[%s]", name);
227 } else {
228 acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
229 }
230
231 if (name) {
232 ACPI_FREE(name);
233 }
234 }
235
236 acpi_os_printf(" Namespace lookup failure, %s",
237 acpi_format_exception(lookup_status));
238
239 ACPI_MSG_SUFFIX;
240 ACPI_MSG_REDIRECT_END;
241}
242
243/*******************************************************************************
244 *
245 * FUNCTION: acpi_ut_method_error
246 *
247 * PARAMETERS: module_name - Caller's module name (for error output)
248 * line_number - Caller's line number (for error output)
249 * message - Error message to use on failure
250 * prefix_node - Prefix relative to the path
251 * path - Path to the node (optional)
252 * method_status - Execution status
253 *
254 * RETURN: None
255 *
256 * DESCRIPTION: Print error message with the full pathname for the method.
257 *
258 ******************************************************************************/
259
260void
261acpi_ut_method_error(const char *module_name,
262 u32 line_number,
263 const char *message,
264 struct acpi_namespace_node *prefix_node,
265 const char *path, acpi_status method_status)
266{
267 acpi_status status;
268 struct acpi_namespace_node *node = prefix_node;
269
270 ACPI_MSG_REDIRECT_BEGIN;
271 acpi_os_printf(ACPI_MSG_ERROR);
272
273 if (path) {
274 status =
275 acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
276 &node);
277 if (ACPI_FAILURE(status)) {
278 acpi_os_printf("[Could not get node by pathname]");
279 }
280 }
281
282 acpi_ns_print_node_pathname(node, message);
283 acpi_os_printf(", %s", acpi_format_exception(method_status));
284
285 ACPI_MSG_SUFFIX;
286 ACPI_MSG_REDIRECT_END;
287}
288
289#endif /* ACPI_NO_ERROR_MESSAGES */
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index c3f3a7e7bdc7..ee83adb97b1e 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("uteval")
68 ******************************************************************************/ 68 ******************************************************************************/
69 69
70acpi_status 70acpi_status
71acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node, 71acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
72 char *path, 72 char *path,
73 u32 expected_return_btypes, 73 u32 expected_return_btypes,
74 union acpi_operand_object **return_desc) 74 union acpi_operand_object **return_desc)
@@ -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
@@ -123,22 +123,27 @@ acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node,
123 123
124 switch ((info->return_object)->common.type) { 124 switch ((info->return_object)->common.type) {
125 case ACPI_TYPE_INTEGER: 125 case ACPI_TYPE_INTEGER:
126
126 return_btype = ACPI_BTYPE_INTEGER; 127 return_btype = ACPI_BTYPE_INTEGER;
127 break; 128 break;
128 129
129 case ACPI_TYPE_BUFFER: 130 case ACPI_TYPE_BUFFER:
131
130 return_btype = ACPI_BTYPE_BUFFER; 132 return_btype = ACPI_BTYPE_BUFFER;
131 break; 133 break;
132 134
133 case ACPI_TYPE_STRING: 135 case ACPI_TYPE_STRING:
136
134 return_btype = ACPI_BTYPE_STRING; 137 return_btype = ACPI_BTYPE_STRING;
135 break; 138 break;
136 139
137 case ACPI_TYPE_PACKAGE: 140 case ACPI_TYPE_PACKAGE:
141
138 return_btype = ACPI_BTYPE_PACKAGE; 142 return_btype = ACPI_BTYPE_PACKAGE;
139 break; 143 break;
140 144
141 default: 145 default:
146
142 return_btype = 0; 147 return_btype = 0;
143 break; 148 break;
144 } 149 }
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c
index b543a144941a..ff6d9e8aa842 100644
--- a/drivers/acpi/acpica/utexcep.c
+++ b/drivers/acpi/acpica/utexcep.c
@@ -146,6 +146,7 @@ const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status status)
146 break; 146 break;
147 147
148 default: 148 default:
149
149 break; 150 break;
150 } 151 }
151 152
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index 43a170a74a61..fa69071db418 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -341,14 +341,17 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
341 341
342 switch (cid_objects[i]->common.type) { 342 switch (cid_objects[i]->common.type) {
343 case ACPI_TYPE_INTEGER: 343 case ACPI_TYPE_INTEGER:
344
344 string_area_size += ACPI_EISAID_STRING_SIZE; 345 string_area_size += ACPI_EISAID_STRING_SIZE;
345 break; 346 break;
346 347
347 case ACPI_TYPE_STRING: 348 case ACPI_TYPE_STRING:
349
348 string_area_size += cid_objects[i]->string.length + 1; 350 string_area_size += cid_objects[i]->string.length + 1;
349 break; 351 break;
350 352
351 default: 353 default:
354
352 status = AE_TYPE; 355 status = AE_TYPE;
353 goto cleanup; 356 goto cleanup;
354 } 357 }
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index 785fdd07ae56..02f9101b65e4 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -382,10 +382,12 @@ acpi_ut_display_init_pathname(u8 type,
382 382
383 switch (type) { 383 switch (type) {
384 case ACPI_TYPE_METHOD: 384 case ACPI_TYPE_METHOD:
385
385 acpi_os_printf("Executing "); 386 acpi_os_printf("Executing ");
386 break; 387 break;
387 388
388 default: 389 default:
390
389 acpi_os_printf("Initializing "); 391 acpi_os_printf("Initializing ");
390 break; 392 break;
391 } 393 }
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index 1099f5c069f8..aa61f66ee861 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -129,6 +129,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
129 break; 129 break;
130 130
131 default: 131 default:
132
132 /* All others have no secondary object */ 133 /* All others have no secondary object */
133 break; 134 break;
134 } 135 }
@@ -353,6 +354,7 @@ u8 acpi_ut_valid_internal_object(void *object)
353 return (TRUE); 354 return (TRUE);
354 355
355 default: 356 default:
357
356 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 358 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
357 "%p is not not an ACPI operand obj [%s]\n", 359 "%p is not not an ACPI operand obj [%s]\n",
358 object, acpi_ut_get_descriptor_name(object))); 360 object, acpi_ut_get_descriptor_name(object)));
@@ -509,7 +511,6 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
509 511
510 switch (internal_object->reference.class) { 512 switch (internal_object->reference.class) {
511 case ACPI_REFCLASS_NAME: 513 case ACPI_REFCLASS_NAME:
512
513 /* 514 /*
514 * Get the actual length of the full pathname to this object. 515 * Get the actual length of the full pathname to this object.
515 * The reference will be converted to the pathname to the object 516 * The reference will be converted to the pathname to the object
@@ -525,7 +526,6 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
525 break; 526 break;
526 527
527 default: 528 default:
528
529 /* 529 /*
530 * No other reference opcodes are supported. 530 * No other reference opcodes are supported.
531 * Notably, Locals and Args are not supported, but this may be 531 * Notably, Locals and Args are not supported, but this may be
@@ -585,7 +585,6 @@ acpi_ut_get_element_length(u8 object_type,
585 585
586 switch (object_type) { 586 switch (object_type) {
587 case ACPI_COPY_TYPE_SIMPLE: 587 case ACPI_COPY_TYPE_SIMPLE:
588
589 /* 588 /*
590 * Simple object - just get the size (Null object/entry is handled 589 * Simple object - just get the size (Null object/entry is handled
591 * here also) and sum it into the running package length 590 * here also) and sum it into the running package length
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
diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c
index b3e36a81aa4d..c53759b76a3f 100644
--- a/drivers/acpi/acpica/utstring.c
+++ b/drivers/acpi/acpica/utstring.c
@@ -186,10 +186,13 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
186 switch (base) { 186 switch (base) {
187 case ACPI_ANY_BASE: 187 case ACPI_ANY_BASE:
188 case 16: 188 case 16:
189
189 break; 190 break;
190 191
191 default: 192 default:
193
192 /* Invalid Base */ 194 /* Invalid Base */
195
193 return_ACPI_STATUS(AE_BAD_PARAMETER); 196 return_ACPI_STATUS(AE_BAD_PARAMETER);
194 } 197 }
195 198
@@ -355,36 +358,44 @@ void acpi_ut_print_string(char *string, u8 max_length)
355 358
356 switch (string[i]) { 359 switch (string[i]) {
357 case 0x07: 360 case 0x07:
361
358 acpi_os_printf("\\a"); /* BELL */ 362 acpi_os_printf("\\a"); /* BELL */
359 break; 363 break;
360 364
361 case 0x08: 365 case 0x08:
366
362 acpi_os_printf("\\b"); /* BACKSPACE */ 367 acpi_os_printf("\\b"); /* BACKSPACE */
363 break; 368 break;
364 369
365 case 0x0C: 370 case 0x0C:
371
366 acpi_os_printf("\\f"); /* FORMFEED */ 372 acpi_os_printf("\\f"); /* FORMFEED */
367 break; 373 break;
368 374
369 case 0x0A: 375 case 0x0A:
376
370 acpi_os_printf("\\n"); /* LINEFEED */ 377 acpi_os_printf("\\n"); /* LINEFEED */
371 break; 378 break;
372 379
373 case 0x0D: 380 case 0x0D:
381
374 acpi_os_printf("\\r"); /* CARRIAGE RETURN */ 382 acpi_os_printf("\\r"); /* CARRIAGE RETURN */
375 break; 383 break;
376 384
377 case 0x09: 385 case 0x09:
386
378 acpi_os_printf("\\t"); /* HORIZONTAL TAB */ 387 acpi_os_printf("\\t"); /* HORIZONTAL TAB */
379 break; 388 break;
380 389
381 case 0x0B: 390 case 0x0B:
391
382 acpi_os_printf("\\v"); /* VERTICAL TAB */ 392 acpi_os_printf("\\v"); /* VERTICAL TAB */
383 break; 393 break;
384 394
385 case '\'': /* Single Quote */ 395 case '\'': /* Single Quote */
386 case '\"': /* Double Quote */ 396 case '\"': /* Double Quote */
387 case '\\': /* Backslash */ 397 case '\\': /* Backslash */
398
388 acpi_os_printf("\\%c", (int)string[i]); 399 acpi_os_printf("\\%c", (int)string[i]);
389 break; 400 break;
390 401
@@ -451,7 +462,8 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position)
451 * 462 *
452 * FUNCTION: acpi_ut_valid_acpi_name 463 * FUNCTION: acpi_ut_valid_acpi_name
453 * 464 *
454 * PARAMETERS: name - The name to be examined 465 * PARAMETERS: name - The name to be examined. Does not have to
466 * be NULL terminated string.
455 * 467 *
456 * RETURN: TRUE if the name is valid, FALSE otherwise 468 * RETURN: TRUE if the name is valid, FALSE otherwise
457 * 469 *
@@ -462,15 +474,14 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position)
462 * 474 *
463 ******************************************************************************/ 475 ******************************************************************************/
464 476
465u8 acpi_ut_valid_acpi_name(u32 name) 477u8 acpi_ut_valid_acpi_name(char *name)
466{ 478{
467 u32 i; 479 u32 i;
468 480
469 ACPI_FUNCTION_ENTRY(); 481 ACPI_FUNCTION_ENTRY();
470 482
471 for (i = 0; i < ACPI_NAME_SIZE; i++) { 483 for (i = 0; i < ACPI_NAME_SIZE; i++) {
472 if (!acpi_ut_valid_acpi_char 484 if (!acpi_ut_valid_acpi_char(name[i], i)) {
473 ((ACPI_CAST_PTR(char, &name))[i], i)) {
474 return (FALSE); 485 return (FALSE);
475 } 486 }
476 } 487 }
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
index 62774c7b76a8..160f13f4aab5 100644
--- a/drivers/acpi/acpica/uttrack.c
+++ b/drivers/acpi/acpica/uttrack.c
@@ -603,6 +603,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
603 switch (ACPI_GET_DESCRIPTOR_TYPE 603 switch (ACPI_GET_DESCRIPTOR_TYPE
604 (descriptor)) { 604 (descriptor)) {
605 case ACPI_DESC_TYPE_OPERAND: 605 case ACPI_DESC_TYPE_OPERAND:
606
606 if (element->size == 607 if (element->size ==
607 sizeof(union 608 sizeof(union
608 acpi_operand_object)) 609 acpi_operand_object))
@@ -613,6 +614,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
613 break; 614 break;
614 615
615 case ACPI_DESC_TYPE_PARSER: 616 case ACPI_DESC_TYPE_PARSER:
617
616 if (element->size == 618 if (element->size ==
617 sizeof(union 619 sizeof(union
618 acpi_parse_object)) { 620 acpi_parse_object)) {
@@ -622,6 +624,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
622 break; 624 break;
623 625
624 case ACPI_DESC_TYPE_NAMED: 626 case ACPI_DESC_TYPE_NAMED:
627
625 if (element->size == 628 if (element->size ==
626 sizeof(struct 629 sizeof(struct
627 acpi_namespace_node)) 630 acpi_namespace_node))
@@ -632,6 +635,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
632 break; 635 break;
633 636
634 default: 637 default:
638
635 break; 639 break;
636 } 640 }
637 641
@@ -639,6 +643,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
639 643
640 switch (descriptor_type) { 644 switch (descriptor_type) {
641 case ACPI_DESC_TYPE_OPERAND: 645 case ACPI_DESC_TYPE_OPERAND:
646
642 acpi_os_printf 647 acpi_os_printf
643 ("%12.12s RefCount 0x%04X\n", 648 ("%12.12s RefCount 0x%04X\n",
644 acpi_ut_get_type_name 649 acpi_ut_get_type_name
@@ -649,6 +654,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
649 break; 654 break;
650 655
651 case ACPI_DESC_TYPE_PARSER: 656 case ACPI_DESC_TYPE_PARSER:
657
652 acpi_os_printf 658 acpi_os_printf
653 ("AmlOpcode 0x%04hX\n", 659 ("AmlOpcode 0x%04hX\n",
654 descriptor->op.asl. 660 descriptor->op.asl.
@@ -656,6 +662,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
656 break; 662 break;
657 663
658 case ACPI_DESC_TYPE_NAMED: 664 case ACPI_DESC_TYPE_NAMED:
665
659 acpi_os_printf("%4.4s\n", 666 acpi_os_printf("%4.4s\n",
660 acpi_ut_get_node_name 667 acpi_ut_get_node_name
661 (&descriptor-> 668 (&descriptor->
@@ -663,6 +670,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
663 break; 670 break;
664 671
665 default: 672 default:
673
666 acpi_os_printf("\n"); 674 acpi_os_printf("\n");
667 break; 675 break;
668 } 676 }
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 976b6c734fce..e966a2e47b76 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -44,7 +44,6 @@
44#include <linux/export.h> 44#include <linux/export.h>
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include "accommon.h" 46#include "accommon.h"
47#include "acnamesp.h"
48 47
49#define _COMPONENT ACPI_UTILITIES 48#define _COMPONENT ACPI_UTILITIES
50ACPI_MODULE_NAME("utxferror") 49ACPI_MODULE_NAME("utxferror")
@@ -52,43 +51,7 @@ ACPI_MODULE_NAME("utxferror")
52/* 51/*
53 * This module is used for the in-kernel ACPICA as well as the ACPICA 52 * This module is used for the in-kernel ACPICA as well as the ACPICA
54 * tools/applications. 53 * tools/applications.
55 *
56 * For the iASL compiler case, the output is redirected to stderr so that
57 * any of the various ACPI errors and warnings do not appear in the output
58 * files, for either the compiler or disassembler portions of the tool.
59 */ 54 */
60#ifdef ACPI_ASL_COMPILER
61#include <stdio.h>
62extern FILE *acpi_gbl_output_file;
63
64#define ACPI_MSG_REDIRECT_BEGIN \
65 FILE *output_file = acpi_gbl_output_file; \
66 acpi_os_redirect_output (stderr);
67
68#define ACPI_MSG_REDIRECT_END \
69 acpi_os_redirect_output (output_file);
70
71#else
72/*
73 * non-iASL case - no redirection, nothing to do
74 */
75#define ACPI_MSG_REDIRECT_BEGIN
76#define ACPI_MSG_REDIRECT_END
77#endif
78/*
79 * Common message prefixes
80 */
81#define ACPI_MSG_ERROR "ACPI Error: "
82#define ACPI_MSG_EXCEPTION "ACPI Exception: "
83#define ACPI_MSG_WARNING "ACPI Warning: "
84#define ACPI_MSG_INFO "ACPI: "
85#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Bug: Error: "
86#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Bug: Warning: "
87/*
88 * Common message suffix
89 */
90#define ACPI_MSG_SUFFIX \
91 acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
92/******************************************************************************* 55/*******************************************************************************
93 * 56 *
94 * FUNCTION: acpi_error 57 * FUNCTION: acpi_error
@@ -285,200 +248,3 @@ acpi_bios_warning(const char *module_name,
285} 248}
286 249
287ACPI_EXPORT_SYMBOL(acpi_bios_warning) 250ACPI_EXPORT_SYMBOL(acpi_bios_warning)
288
289/*
290 * The remainder of this module contains internal error functions that may
291 * be configured out.
292 */
293#if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP)
294/*******************************************************************************
295 *
296 * FUNCTION: acpi_ut_predefined_warning
297 *
298 * PARAMETERS: module_name - Caller's module name (for error output)
299 * line_number - Caller's line number (for error output)
300 * pathname - Full pathname to the node
301 * node_flags - From Namespace node for the method/object
302 * format - Printf format string + additional args
303 *
304 * RETURN: None
305 *
306 * DESCRIPTION: Warnings for the predefined validation module. Messages are
307 * only emitted the first time a problem with a particular
308 * method/object is detected. This prevents a flood of error
309 * messages for methods that are repeatedly evaluated.
310 *
311 ******************************************************************************/
312void ACPI_INTERNAL_VAR_XFACE
313acpi_ut_predefined_warning(const char *module_name,
314 u32 line_number,
315 char *pathname,
316 u8 node_flags, const char *format, ...)
317{
318 va_list arg_list;
319
320 /*
321 * Warning messages for this method/object will be disabled after the
322 * first time a validation fails or an object is successfully repaired.
323 */
324 if (node_flags & ANOBJ_EVALUATED) {
325 return;
326 }
327
328 acpi_os_printf(ACPI_MSG_WARNING "For %s: ", pathname);
329
330 va_start(arg_list, format);
331 acpi_os_vprintf(format, arg_list);
332 ACPI_MSG_SUFFIX;
333 va_end(arg_list);
334}
335
336/*******************************************************************************
337 *
338 * FUNCTION: acpi_ut_predefined_info
339 *
340 * PARAMETERS: module_name - Caller's module name (for error output)
341 * line_number - Caller's line number (for error output)
342 * pathname - Full pathname to the node
343 * node_flags - From Namespace node for the method/object
344 * format - Printf format string + additional args
345 *
346 * RETURN: None
347 *
348 * DESCRIPTION: Info messages for the predefined validation module. Messages
349 * are only emitted the first time a problem with a particular
350 * method/object is detected. This prevents a flood of
351 * messages for methods that are repeatedly evaluated.
352 *
353 ******************************************************************************/
354
355void ACPI_INTERNAL_VAR_XFACE
356acpi_ut_predefined_info(const char *module_name,
357 u32 line_number,
358 char *pathname, u8 node_flags, const char *format, ...)
359{
360 va_list arg_list;
361
362 /*
363 * Warning messages for this method/object will be disabled after the
364 * first time a validation fails or an object is successfully repaired.
365 */
366 if (node_flags & ANOBJ_EVALUATED) {
367 return;
368 }
369
370 acpi_os_printf(ACPI_MSG_INFO "For %s: ", pathname);
371
372 va_start(arg_list, format);
373 acpi_os_vprintf(format, arg_list);
374 ACPI_MSG_SUFFIX;
375 va_end(arg_list);
376}
377
378/*******************************************************************************
379 *
380 * FUNCTION: acpi_ut_namespace_error
381 *
382 * PARAMETERS: module_name - Caller's module name (for error output)
383 * line_number - Caller's line number (for error output)
384 * internal_name - Name or path of the namespace node
385 * lookup_status - Exception code from NS lookup
386 *
387 * RETURN: None
388 *
389 * DESCRIPTION: Print error message with the full pathname for the NS node.
390 *
391 ******************************************************************************/
392
393void
394acpi_ut_namespace_error(const char *module_name,
395 u32 line_number,
396 const char *internal_name, acpi_status lookup_status)
397{
398 acpi_status status;
399 u32 bad_name;
400 char *name = NULL;
401
402 ACPI_MSG_REDIRECT_BEGIN;
403 acpi_os_printf(ACPI_MSG_ERROR);
404
405 if (lookup_status == AE_BAD_CHARACTER) {
406
407 /* There is a non-ascii character in the name */
408
409 ACPI_MOVE_32_TO_32(&bad_name,
410 ACPI_CAST_PTR(u32, internal_name));
411 acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name);
412 } else {
413 /* Convert path to external format */
414
415 status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
416 internal_name, NULL, &name);
417
418 /* Print target name */
419
420 if (ACPI_SUCCESS(status)) {
421 acpi_os_printf("[%s]", name);
422 } else {
423 acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
424 }
425
426 if (name) {
427 ACPI_FREE(name);
428 }
429 }
430
431 acpi_os_printf(" Namespace lookup failure, %s",
432 acpi_format_exception(lookup_status));
433
434 ACPI_MSG_SUFFIX;
435 ACPI_MSG_REDIRECT_END;
436}
437
438/*******************************************************************************
439 *
440 * FUNCTION: acpi_ut_method_error
441 *
442 * PARAMETERS: module_name - Caller's module name (for error output)
443 * line_number - Caller's line number (for error output)
444 * message - Error message to use on failure
445 * prefix_node - Prefix relative to the path
446 * path - Path to the node (optional)
447 * method_status - Execution status
448 *
449 * RETURN: None
450 *
451 * DESCRIPTION: Print error message with the full pathname for the method.
452 *
453 ******************************************************************************/
454
455void
456acpi_ut_method_error(const char *module_name,
457 u32 line_number,
458 const char *message,
459 struct acpi_namespace_node *prefix_node,
460 const char *path, acpi_status method_status)
461{
462 acpi_status status;
463 struct acpi_namespace_node *node = prefix_node;
464
465 ACPI_MSG_REDIRECT_BEGIN;
466 acpi_os_printf(ACPI_MSG_ERROR);
467
468 if (path) {
469 status =
470 acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
471 &node);
472 if (ACPI_FAILURE(status)) {
473 acpi_os_printf("[Could not get node by pathname]");
474 }
475 }
476
477 acpi_ns_print_node_pathname(node, message);
478 acpi_os_printf(", %s", acpi_format_exception(method_status));
479
480 ACPI_MSG_SUFFIX;
481 ACPI_MSG_REDIRECT_END;
482}
483
484#endif /* ACPI_NO_ERROR_MESSAGES */
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e72186340fec..da6b6634e5b3 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1715,6 +1715,17 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1715} 1715}
1716#endif 1716#endif
1717 1717
1718static int __init acpi_no_auto_ssdt_setup(char *s)
1719{
1720 printk(KERN_NOTICE PREFIX "SSDT auto-load disabled\n");
1721
1722 acpi_gbl_disable_ssdt_table_load = TRUE;
1723
1724 return 1;
1725}
1726
1727__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
1728
1718acpi_status __init acpi_os_initialize(void) 1729acpi_status __init acpi_os_initialize(void)
1719{ 1730{
1720 acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block); 1731 acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block);