aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-05-16 10:44:15 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-05-16 10:44:15 -0400
commit407aa3ff6f54ea2be7959639d664ae5183e2e9f8 (patch)
tree2d2783a9d3773a8ada923990ee0e6606bd504acf
parent44549e8f5eea4e0a41b487b63e616cb089922b99 (diff)
parentd1ce3bb95511dacf8b9eea899c421f1b18a3ef6a (diff)
Merge branch 'acpica'
* acpica: (41 commits) ACPICA: Update version to 20160422 ACPICA: Move all ASCII utilities to a common file ACPICA: ACPI 2.0, Hardware: Add access_width/bit_offset support for acpi_hw_write() ACPICA: ACPI 2.0, Hardware: Add access_width/bit_offset support in acpi_hw_read() ACPICA: Executer: Introduce a set of macros to handle bit width mask generation ACPICA: Hardware: Add optimized access bit width support ACPICA: Utilities: Add ACPI_IS_ALIGNED() macro ACPICA: Renamed some #defined flag constants for clarity ACPICA: ACPI 6.0, tools/iasl: Add support for new resource descriptors ACPICA: ACPI 6.0: Update _BIX support for new package element ACPICA: ACPI 6.1: Support for new PCCT subtable ACPICA: Refactor evaluate_object to reduce nesting ACPICA: Divergence: remove unwanted spaces for typedef ACPICA: Update version to 20160318 ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated before _REG evaluations ACPICA: Events: Fix an issue that _REG association can happen before namespace is initialized ACPICA: Tables: Fix wrong MLC condition for dynamic table loading ACPICA: Interpreter: Fix wrong conditions for acpi_ev_install_region_handlers() invocation ACPICA: Hardware: Enhance acpi_hw_validate_register() with access_width/bit_offset awareness Utilities: Fix missing parentheses in ACPI_GET_BITS()/ACPI_SET_BITS() ...
-rw-r--r--drivers/acpi/acpica/Makefile2
-rw-r--r--drivers/acpi/acpica/acdebug.h10
-rw-r--r--drivers/acpi/acpica/acevents.h3
-rw-r--r--drivers/acpi/acpica/acglobal.h11
-rw-r--r--drivers/acpi/acpica/acinterp.h4
-rw-r--r--drivers/acpi/acpica/aclocal.h62
-rw-r--r--drivers/acpi/acpica/acmacros.h21
-rw-r--r--drivers/acpi/acpica/acnamesp.h5
-rw-r--r--drivers/acpi/acpica/acparser.h2
-rw-r--r--drivers/acpi/acpica/acpredef.h14
-rw-r--r--drivers/acpi/acpica/acresrc.h12
-rw-r--r--drivers/acpi/acpica/acstruct.h2
-rw-r--r--drivers/acpi/acpica/actables.h2
-rw-r--r--drivers/acpi/acpica/acutils.h58
-rw-r--r--drivers/acpi/acpica/dbcmds.c4
-rw-r--r--drivers/acpi/acpica/dbconvert.c8
-rw-r--r--drivers/acpi/acpica/dbexec.c2
-rw-r--r--drivers/acpi/acpica/dbinput.c19
-rw-r--r--drivers/acpi/acpica/dbnames.c4
-rw-r--r--drivers/acpi/acpica/dbutils.c9
-rw-r--r--drivers/acpi/acpica/dbxface.c4
-rw-r--r--drivers/acpi/acpica/dscontrol.c4
-rw-r--r--drivers/acpi/acpica/dsinit.c2
-rw-r--r--drivers/acpi/acpica/dsmethod.c2
-rw-r--r--drivers/acpi/acpica/dsutils.c2
-rw-r--r--drivers/acpi/acpica/dswload.c4
-rw-r--r--drivers/acpi/acpica/dswload2.c4
-rw-r--r--drivers/acpi/acpica/dswstate.c10
-rw-r--r--drivers/acpi/acpica/evgpe.c4
-rw-r--r--drivers/acpi/acpica/evgpeblk.c4
-rw-r--r--drivers/acpi/acpica/evgpeutil.c4
-rw-r--r--drivers/acpi/acpica/evhandler.c2
-rw-r--r--drivers/acpi/acpica/evmisc.c3
-rw-r--r--drivers/acpi/acpica/evregion.c74
-rw-r--r--drivers/acpi/acpica/evrgnini.c3
-rw-r--r--drivers/acpi/acpica/evxfgpe.c2
-rw-r--r--drivers/acpi/acpica/exconcat.c439
-rw-r--r--drivers/acpi/acpica/exconfig.c4
-rw-r--r--drivers/acpi/acpica/exconvrt.c8
-rw-r--r--drivers/acpi/acpica/excreate.c2
-rw-r--r--drivers/acpi/acpica/exdump.c15
-rw-r--r--drivers/acpi/acpica/exfield.c4
-rw-r--r--drivers/acpi/acpica/exfldio.c14
-rw-r--r--drivers/acpi/acpica/exmisc.c290
-rw-r--r--drivers/acpi/acpica/exnames.c2
-rw-r--r--drivers/acpi/acpica/exoparg3.c8
-rw-r--r--drivers/acpi/acpica/exoparg6.c2
-rw-r--r--drivers/acpi/acpica/exregion.c6
-rw-r--r--drivers/acpi/acpica/exresnte.c4
-rw-r--r--drivers/acpi/acpica/exresolv.c2
-rw-r--r--drivers/acpi/acpica/exresop.c4
-rw-r--r--drivers/acpi/acpica/exstorob.c4
-rw-r--r--drivers/acpi/acpica/exutils.c12
-rw-r--r--drivers/acpi/acpica/hwgpe.c6
-rw-r--r--drivers/acpi/acpica/hwregs.c291
-rw-r--r--drivers/acpi/acpica/hwxface.c11
-rw-r--r--drivers/acpi/acpica/nsaccess.c7
-rw-r--r--drivers/acpi/acpica/nsconvert.c9
-rw-r--r--drivers/acpi/acpica/nsdump.c9
-rw-r--r--drivers/acpi/acpica/nsinit.c76
-rw-r--r--drivers/acpi/acpica/nsload.c2
-rw-r--r--drivers/acpi/acpica/nsnames.c2
-rw-r--r--drivers/acpi/acpica/nsobject.c4
-rw-r--r--drivers/acpi/acpica/nsprepkg.c92
-rw-r--r--drivers/acpi/acpica/nsrepair.c2
-rw-r--r--drivers/acpi/acpica/nsrepair2.c6
-rw-r--r--drivers/acpi/acpica/nsutils.c8
-rw-r--r--drivers/acpi/acpica/nsxfeval.c113
-rw-r--r--drivers/acpi/acpica/nsxfname.c6
-rw-r--r--drivers/acpi/acpica/nsxfobj.c6
-rw-r--r--drivers/acpi/acpica/psargs.c2
-rw-r--r--drivers/acpi/acpica/psopinfo.c2
-rw-r--r--drivers/acpi/acpica/psparse.c4
-rw-r--r--drivers/acpi/acpica/psutils.c2
-rw-r--r--drivers/acpi/acpica/psxface.c2
-rw-r--r--drivers/acpi/acpica/rscalc.c90
-rw-r--r--drivers/acpi/acpica/rscreate.c2
-rw-r--r--drivers/acpi/acpica/rsdump.c50
-rw-r--r--drivers/acpi/acpica/rsdumpinfo.c9
-rw-r--r--drivers/acpi/acpica/rsmisc.c2
-rw-r--r--drivers/acpi/acpica/rsserial.c21
-rw-r--r--drivers/acpi/acpica/rsutils.c14
-rw-r--r--drivers/acpi/acpica/rsxface.c6
-rw-r--r--drivers/acpi/acpica/tbdata.c15
-rw-r--r--drivers/acpi/acpica/tbfadt.c28
-rw-r--r--drivers/acpi/acpica/tbfind.c2
-rw-r--r--drivers/acpi/acpica/tbinstal.c6
-rw-r--r--drivers/acpi/acpica/tbutils.c33
-rw-r--r--drivers/acpi/acpica/tbxface.c6
-rw-r--r--drivers/acpi/acpica/tbxfload.c2
-rw-r--r--drivers/acpi/acpica/tbxfroot.c8
-rw-r--r--drivers/acpi/acpica/utalloc.c5
-rw-r--r--drivers/acpi/acpica/utascii.c140
-rw-r--r--drivers/acpi/acpica/utbuffer.c24
-rw-r--r--drivers/acpi/acpica/utcache.c7
-rw-r--r--drivers/acpi/acpica/utcopy.c16
-rw-r--r--drivers/acpi/acpica/utdebug.c47
-rw-r--r--drivers/acpi/acpica/utdecode.c30
-rw-r--r--drivers/acpi/acpica/uteval.c4
-rw-r--r--drivers/acpi/acpica/utglobal.c48
-rw-r--r--drivers/acpi/acpica/utids.c8
-rw-r--r--drivers/acpi/acpica/utmath.c4
-rw-r--r--drivers/acpi/acpica/utmisc.c2
-rw-r--r--drivers/acpi/acpica/utnonansi.c67
-rw-r--r--drivers/acpi/acpica/utobject.c18
-rw-r--r--drivers/acpi/acpica/utosi.c4
-rw-r--r--drivers/acpi/acpica/utownerid.c6
-rw-r--r--drivers/acpi/acpica/utprint.c19
-rw-r--r--drivers/acpi/acpica/utstring.c71
-rw-r--r--drivers/acpi/acpica/uttrack.c2
-rw-r--r--drivers/acpi/acpica/utxface.c4
-rw-r--r--drivers/acpi/osl.c2
-rw-r--r--include/acpi/acpiosxf.h10
-rw-r--r--include/acpi/acpixf.h23
-rw-r--r--include/acpi/acrestyp.h1
-rw-r--r--include/acpi/actbl.h4
-rw-r--r--include/acpi/actbl1.h74
-rw-r--r--include/acpi/actbl2.h39
-rw-r--r--include/acpi/actbl3.h66
-rw-r--r--include/acpi/actypes.h48
-rw-r--r--include/acpi/platform/acenv.h44
-rw-r--r--include/acpi/platform/acmsvcex.h54
-rw-r--r--include/acpi/platform/acwinex.h49
-rw-r--r--tools/power/acpi/os_specific/service_layers/oslinuxtbl.c47
-rw-r--r--tools/power/acpi/os_specific/service_layers/osunixmap.c2
-rw-r--r--tools/power/acpi/os_specific/service_layers/osunixxf.c24
-rw-r--r--tools/power/acpi/tools/acpidump/Makefile1
-rw-r--r--tools/power/acpi/tools/acpidump/apdump.c13
-rw-r--r--tools/power/acpi/tools/acpidump/apmain.c3
129 files changed, 1928 insertions, 1260 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index f682374c19f4..227bb7bb19d7 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -43,6 +43,7 @@ acpi-y += \
43 evxfregn.o 43 evxfregn.o
44 44
45acpi-y += \ 45acpi-y += \
46 exconcat.o \
46 exconfig.o \ 47 exconfig.o \
47 exconvrt.o \ 48 exconvrt.o \
48 excreate.o \ 49 excreate.o \
@@ -149,6 +150,7 @@ acpi-y += \
149acpi-y += \ 150acpi-y += \
150 utaddress.o \ 151 utaddress.o \
151 utalloc.o \ 152 utalloc.o \
153 utascii.o \
152 utbuffer.o \ 154 utbuffer.o \
153 utcopy.o \ 155 utcopy.o \
154 utexcep.o \ 156 utexcep.o \
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 993af9eb007a..f6404ea928cb 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -53,7 +53,7 @@
53#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ 53#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
54 54
55struct acpi_db_command_info { 55struct acpi_db_command_info {
56 char *name; /* Command Name */ 56 const char *name; /* Command Name */
57 u8 min_args; /* Minimum arguments required */ 57 u8 min_args; /* Minimum arguments required */
58}; 58};
59 59
@@ -64,7 +64,7 @@ struct acpi_db_command_help {
64}; 64};
65 65
66struct acpi_db_argument_info { 66struct acpi_db_argument_info {
67 char *name; /* Argument Name */ 67 const char *name; /* Argument Name */
68}; 68};
69 69
70struct acpi_db_execute_walk { 70struct acpi_db_execute_walk {
@@ -196,7 +196,7 @@ ACPI_DBR_DEPENDENT_RETURN_VOID(void
196 acpi_walk_state 196 acpi_walk_state
197 *walk_state)) 197 *walk_state))
198 198
199 acpi_status acpi_db_display_all_methods(char *display_count_arg); 199acpi_status acpi_db_display_all_methods(char *display_count_arg);
200 200
201void acpi_db_display_arguments(void); 201void acpi_db_display_arguments(void);
202 202
@@ -220,7 +220,7 @@ ACPI_DBR_DEPENDENT_RETURN_VOID(void
220 * dbexec - debugger control method execution 220 * dbexec - debugger control method execution
221 */ 221 */
222void 222void
223acpi_db_execute(char *name, char **args, acpi_object_type * types, u32 flags); 223acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags);
224 224
225void 225void
226acpi_db_create_execution_threads(char *num_threads_arg, 226acpi_db_create_execution_threads(char *num_threads_arg,
@@ -271,7 +271,7 @@ void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
271acpi_status acpi_db_user_commands(void); 271acpi_status acpi_db_user_commands(void);
272 272
273char *acpi_db_get_next_token(char *string, 273char *acpi_db_get_next_token(char *string,
274 char **next, acpi_object_type * return_type); 274 char **next, acpi_object_type *return_type);
275 275
276/* 276/*
277 * dbobject 277 * dbobject
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index 010cf81bada9..77af91cf46d4 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -72,6 +72,7 @@ acpi_status acpi_ev_init_global_lock_handler(void);
72ACPI_HW_DEPENDENT_RETURN_OK(acpi_status 72ACPI_HW_DEPENDENT_RETURN_OK(acpi_status
73 acpi_ev_acquire_global_lock(u16 timeout)) 73 acpi_ev_acquire_global_lock(u16 timeout))
74ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void)) 74ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void))
75
75acpi_status acpi_ev_remove_global_lock_handler(void); 76acpi_status acpi_ev_remove_global_lock_handler(void);
76 77
77/* 78/*
@@ -198,8 +199,6 @@ void
198acpi_ev_detach_region(union acpi_operand_object *region_obj, 199acpi_ev_detach_region(union acpi_operand_object *region_obj,
199 u8 acpi_ns_is_locked); 200 u8 acpi_ns_is_locked);
200 201
201void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj);
202
203void 202void
204acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, 203acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
205 acpi_adr_space_type space_id, u32 function); 204 acpi_adr_space_type space_id, u32 function);
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 51b073b68f16..fded776236e2 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -187,6 +187,8 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
187extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS]; 187extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];
188extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS]; 188extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];
189extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; 189extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
190extern const char acpi_gbl_lower_hex_digits[];
191extern const char acpi_gbl_upper_hex_digits[];
190extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 192extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
191 193
192#ifdef ACPI_DBG_TRACK_ALLOCATIONS 194#ifdef ACPI_DBG_TRACK_ALLOCATIONS
@@ -361,6 +363,15 @@ ACPI_GLOBAL(u32, acpi_gbl_num_objects);
361 363
362#endif /* ACPI_DEBUGGER */ 364#endif /* ACPI_DEBUGGER */
363 365
366#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
367
368ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]);
369ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]);
370ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]);
371ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
372
373#endif
374
364/***************************************************************************** 375/*****************************************************************************
365 * 376 *
366 * Application globals 377 * Application globals
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index bae1a35c345f..7ead235555cf 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -67,7 +67,7 @@
67typedef const struct acpi_exdump_info { 67typedef const struct acpi_exdump_info {
68 u8 opcode; 68 u8 opcode;
69 u8 offset; 69 u8 offset;
70 char *name; 70 const char *name;
71 71
72} acpi_exdump_info; 72} acpi_exdump_info;
73 73
@@ -370,7 +370,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
370acpi_status 370acpi_status
371acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, 371acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
372 union acpi_operand_object *operand, 372 union acpi_operand_object *operand,
373 acpi_object_type * return_type, 373 acpi_object_type *return_type,
374 union acpi_operand_object **return_desc); 374 union acpi_operand_object **return_desc);
375 375
376/* 376/*
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 9562a10a1a18..13331d70dea0 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -278,7 +278,7 @@ struct acpi_create_field_info {
278}; 278};
279 279
280typedef 280typedef
281acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state); 281acpi_status (*acpi_internal_method) (struct acpi_walk_state * walk_state);
282 282
283/* 283/*
284 * Bitmapped ACPI types. Used internally only 284 * Bitmapped ACPI types. Used internally only
@@ -395,11 +395,12 @@ union acpi_predefined_info {
395 395
396/* Return object auto-repair info */ 396/* Return object auto-repair info */
397 397
398typedef acpi_status(*acpi_object_converter) (struct acpi_namespace_node * scope, 398typedef acpi_status (*acpi_object_converter) (struct acpi_namespace_node *
399 union acpi_operand_object 399 scope,
400 *original_object, 400 union acpi_operand_object *
401 union acpi_operand_object 401 original_object,
402 **converted_object); 402 union acpi_operand_object **
403 converted_object);
403 404
404struct acpi_simple_repair_info { 405struct acpi_simple_repair_info {
405 char name[ACPI_NAME_SIZE]; 406 char name[ACPI_NAME_SIZE];
@@ -539,10 +540,10 @@ struct acpi_gpe_device_info {
539 struct acpi_namespace_node *gpe_device; 540 struct acpi_namespace_node *gpe_device;
540}; 541};
541 542
542typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info * 543typedef acpi_status (*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
543 gpe_xrupt_info, 544 gpe_xrupt_info,
544 struct acpi_gpe_block_info *gpe_block, 545 struct acpi_gpe_block_info *
545 void *context); 546 gpe_block, void *context);
546 547
547/* Information about each particular fixed event */ 548/* Information about each particular fixed event */
548 549
@@ -657,10 +658,11 @@ struct acpi_result_values {
657}; 658};
658 659
659typedef 660typedef
660acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state, 661acpi_status (*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
661 union acpi_parse_object ** out_op); 662 union acpi_parse_object ** out_op);
662 663
663typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state); 664typedef
665acpi_status (*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
664 666
665/* Global handlers for AML Notifies */ 667/* Global handlers for AML Notifies */
666 668
@@ -700,7 +702,8 @@ union acpi_generic_state {
700 * 702 *
701 ****************************************************************************/ 703 ****************************************************************************/
702 704
703typedef acpi_status(*acpi_execute_op) (struct acpi_walk_state * walk_state); 705typedef
706acpi_status (*acpi_execute_op) (struct acpi_walk_state * walk_state);
704 707
705/* Address Range info block */ 708/* Address Range info block */
706 709
@@ -853,24 +856,24 @@ struct acpi_parse_state {
853 856
854/* Parse object flags */ 857/* Parse object flags */
855 858
856#define ACPI_PARSEOP_GENERIC 0x01 859#define ACPI_PARSEOP_GENERIC 0x01
857#define ACPI_PARSEOP_NAMED 0x02 860#define ACPI_PARSEOP_NAMED_OBJECT 0x02
858#define ACPI_PARSEOP_DEFERRED 0x04 861#define ACPI_PARSEOP_DEFERRED 0x04
859#define ACPI_PARSEOP_BYTELIST 0x08 862#define ACPI_PARSEOP_BYTELIST 0x08
860#define ACPI_PARSEOP_IN_STACK 0x10 863#define ACPI_PARSEOP_IN_STACK 0x10
861#define ACPI_PARSEOP_TARGET 0x20 864#define ACPI_PARSEOP_TARGET 0x20
862#define ACPI_PARSEOP_IN_CACHE 0x80 865#define ACPI_PARSEOP_IN_CACHE 0x80
863 866
864/* Parse object disasm_flags */ 867/* Parse object disasm_flags */
865 868
866#define ACPI_PARSEOP_IGNORE 0x01 869#define ACPI_PARSEOP_IGNORE 0x01
867#define ACPI_PARSEOP_PARAMLIST 0x02 870#define ACPI_PARSEOP_PARAMETER_LIST 0x02
868#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 871#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
869#define ACPI_PARSEOP_PREDEF_CHECKED 0x08 872#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x08
870#define ACPI_PARSEOP_CLOSING_PAREN 0x10 873#define ACPI_PARSEOP_CLOSING_PAREN 0x10
871#define ACPI_PARSEOP_COMPOUND 0x20 874#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x20
872#define ACPI_PARSEOP_ASSIGNMENT 0x40 875#define ACPI_PARSEOP_ASSIGNMENT 0x40
873#define ACPI_PARSEOP_ELSEIF 0x80 876#define ACPI_PARSEOP_ELSEIF 0x80
874 877
875/***************************************************************************** 878/*****************************************************************************
876 * 879 *
@@ -1096,6 +1099,7 @@ struct acpi_external_list {
1096#define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */ 1099#define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */
1097#define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */ 1100#define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */
1098#define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */ 1101#define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */
1102#define ACPI_EXT_ORIGIN_FROM_OPCODE 0x10 /* External came from a External() opcode */
1099 1103
1100struct acpi_external_file { 1104struct acpi_external_file {
1101 char *path; 1105 char *path;
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 411c18b7d541..a3b95431b7c5 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -260,14 +260,31 @@
260 260
261#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1)) 261#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
262 262
263/* Generic (power-of-two) rounding */
264
265#define ACPI_IS_ALIGNED(a, s) (((a) & ((s) - 1)) == 0)
266#define ACPI_IS_POWER_OF_TWO(a) ACPI_IS_ALIGNED(a, a)
267
263/* 268/*
264 * Bitmask creation 269 * Bitmask creation
265 * Bit positions start at zero. 270 * Bit positions start at zero.
266 * MASK_BITS_ABOVE creates a mask starting AT the position and above 271 * MASK_BITS_ABOVE creates a mask starting AT the position and above
267 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position 272 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
273 * MASK_BITS_ABOVE/BELOW accpets a bit offset to create a mask
274 * MASK_BITS_ABOVE/BELOW_32/64 accpets a bit width to create a mask
275 * Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler
276 * differences with the shift operator
268 */ 277 */
269#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position)))) 278#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position))))
270#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position))) 279#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position)))
280#define ACPI_MASK_BITS_ABOVE_32(width) ((u32) ACPI_MASK_BITS_ABOVE(width))
281#define ACPI_MASK_BITS_BELOW_32(width) ((u32) ACPI_MASK_BITS_BELOW(width))
282#define ACPI_MASK_BITS_ABOVE_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \
283 ACPI_UINT64_MAX : \
284 ACPI_MASK_BITS_ABOVE(width))
285#define ACPI_MASK_BITS_BELOW_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \
286 (u64) 0 : \
287 ACPI_MASK_BITS_BELOW(width))
271 288
272/* Bitfields within ACPI registers */ 289/* Bitfields within ACPI registers */
273 290
@@ -283,10 +300,10 @@
283/* Generic bitfield macros and masks */ 300/* Generic bitfield macros and masks */
284 301
285#define ACPI_GET_BITS(source_ptr, position, mask) \ 302#define ACPI_GET_BITS(source_ptr, position, mask) \
286 ((*source_ptr >> position) & mask) 303 ((*(source_ptr) >> (position)) & (mask))
287 304
288#define ACPI_SET_BITS(target_ptr, position, mask, value) \ 305#define ACPI_SET_BITS(target_ptr, position, mask, value) \
289 (*target_ptr |= ((value & mask) << position)) 306 (*(target_ptr) |= (((value) & (mask)) << (position)))
290 307
291#define ACPI_1BIT_MASK 0x00000001 308#define ACPI_1BIT_MASK 0x00000001
292#define ACPI_2BIT_MASK 0x00000003 309#define ACPI_2BIT_MASK 0x00000003
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 022d69cb345a..f33a4ba8e0cb 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -206,9 +206,10 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
206void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level); 206void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
207 207
208void 208void
209acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component); 209acpi_ns_dump_pathname(acpi_handle handle,
210 const char *msg, u32 level, u32 component);
210 211
211void acpi_ns_print_pathname(u32 num_segments, char *pathname); 212void acpi_ns_print_pathname(u32 num_segments, const char *pathname);
212 213
213acpi_status 214acpi_status
214acpi_ns_dump_one_object(acpi_handle obj_handle, 215acpi_ns_dump_one_object(acpi_handle obj_handle,
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index 7da639d62416..fc305775c3d7 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -139,7 +139,7 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
139 */ 139 */
140const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); 140const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
141 141
142char *acpi_ps_get_opcode_name(u16 opcode); 142const char *acpi_ps_get_opcode_name(u16 opcode);
143 143
144u8 acpi_ps_get_argument_count(u32 op_type); 144u8 acpi_ps_get_argument_count(u32 op_type);
145 145
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index 5faeab41e302..888440b2cf2e 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -129,7 +129,8 @@ enum acpi_return_package_types {
129 ACPI_PTYPE2_REV_FIXED = 9, 129 ACPI_PTYPE2_REV_FIXED = 9,
130 ACPI_PTYPE2_FIX_VAR = 10, 130 ACPI_PTYPE2_FIX_VAR = 10,
131 ACPI_PTYPE2_VAR_VAR = 11, 131 ACPI_PTYPE2_VAR_VAR = 11,
132 ACPI_PTYPE2_UUID_PAIR = 12 132 ACPI_PTYPE2_UUID_PAIR = 12,
133 ACPI_PTYPE_CUSTOM = 13
133}; 134};
134 135
135/* Support macros for users of the predefined info table */ 136/* Support macros for users of the predefined info table */
@@ -340,7 +341,7 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
340 341
341 {{"_BIX", METHOD_0ARGS, 342 {{"_BIX", METHOD_0ARGS,
342 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */ 343 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */
343 PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 344 PACKAGE_INFO(ACPI_PTYPE_CUSTOM, ACPI_RTYPE_INTEGER, 16,
344 ACPI_RTYPE_STRING, 4, 0), 345 ACPI_RTYPE_STRING, 4, 0),
345 346
346 {{"_BLT", 347 {{"_BLT",
@@ -523,6 +524,9 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
523 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ 524 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
524 PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0), 525 PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),
525 526
527 {{"_FIT", METHOD_0ARGS,
528 METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, /* ACPI 6.0 */
529
526 {{"_FIX", METHOD_0ARGS, 530 {{"_FIX", METHOD_0ARGS,
527 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ 531 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */
528 PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0), 532 PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
@@ -1053,6 +1057,12 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
1053 METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | 1057 METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING |
1054 ACPI_RTYPE_BUFFER)}}, 1058 ACPI_RTYPE_BUFFER)}},
1055 1059
1060 {{"_WPC", METHOD_0ARGS,
1061 METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */
1062
1063 {{"_WPP", METHOD_0ARGS,
1064 METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */
1065
1056 PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */ 1066 PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */
1057}; 1067};
1058#else 1068#else
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h
index 5dd58beafa5c..63da1e37caba 100644
--- a/drivers/acpi/acpica/acresrc.h
+++ b/drivers/acpi/acpica/acresrc.h
@@ -124,7 +124,7 @@ typedef enum {
124typedef const struct acpi_rsdump_info { 124typedef const struct acpi_rsdump_info {
125 u8 opcode; 125 u8 opcode;
126 u8 offset; 126 u8 offset;
127 char *name; 127 const char *name;
128 const char **pointer; 128 const char **pointer;
129 129
130} acpi_rsdump_info; 130} acpi_rsdump_info;
@@ -209,7 +209,7 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
209 209
210acpi_status 210acpi_status
211acpi_rs_get_method_data(acpi_handle handle, 211acpi_rs_get_method_data(acpi_handle handle,
212 char *path, struct acpi_buffer *ret_buffer); 212 const char *path, struct acpi_buffer *ret_buffer);
213 213
214acpi_status 214acpi_status
215acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, 215acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
@@ -223,16 +223,16 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
223 * rscalc 223 * rscalc
224 */ 224 */
225acpi_status 225acpi_status
226acpi_rs_get_list_length(u8 * aml_buffer, 226acpi_rs_get_list_length(u8 *aml_buffer,
227 u32 aml_buffer_length, acpi_size * size_needed); 227 u32 aml_buffer_length, acpi_size *size_needed);
228 228
229acpi_status 229acpi_status
230acpi_rs_get_aml_length(struct acpi_resource *resource_list, 230acpi_rs_get_aml_length(struct acpi_resource *resource_list,
231 acpi_size resource_list_size, acpi_size * size_needed); 231 acpi_size resource_list_size, acpi_size *size_needed);
232 232
233acpi_status 233acpi_status
234acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, 234acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
235 acpi_size * buffer_size_needed); 235 acpi_size *buffer_size_needed);
236 236
237acpi_status 237acpi_status
238acpi_rs_convert_aml_to_resources(u8 * aml, 238acpi_rs_convert_aml_to_resources(u8 * aml,
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index b3b386e0b119..6235642e31d3 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -184,7 +184,7 @@ struct acpi_evaluate_info {
184 /* The first 3 elements are passed by the caller to acpi_ns_evaluate */ 184 /* The first 3 elements are passed by the caller to acpi_ns_evaluate */
185 185
186 struct acpi_namespace_node *prefix_node; /* Input: starting node */ 186 struct acpi_namespace_node *prefix_node; /* Input: starting node */
187 char *relative_pathname; /* Input: path relative to prefix_node */ 187 const char *relative_pathname; /* Input: path relative to prefix_node */
188 union acpi_operand_object **parameters; /* Input: argument list */ 188 union acpi_operand_object **parameters; /* Input: argument list */
189 189
190 struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */ 190 struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index 848ad3ac938f..cd5a135fcf29 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -161,8 +161,6 @@ acpi_tb_install_fixed_table(acpi_physical_address address,
161 161
162acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address); 162acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
163 163
164u8 acpi_is_valid_signature(char *signature);
165
166/* 164/*
167 * tbxfload 165 * tbxfload
168 */ 166 */
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index e43ab6f2ad7e..a7dbb2b882cf 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -136,16 +136,16 @@ extern const char *acpi_gbl_pt_decode[];
136#define ACPI_SMALL_VARIABLE_LENGTH 3 136#define ACPI_SMALL_VARIABLE_LENGTH 3
137 137
138typedef 138typedef
139acpi_status(*acpi_walk_aml_callback) (u8 *aml, 139acpi_status (*acpi_walk_aml_callback) (u8 *aml,
140 u32 length, 140 u32 length,
141 u32 offset, 141 u32 offset,
142 u8 resource_index, void **context); 142 u8 resource_index, void **context);
143 143
144typedef 144typedef
145acpi_status(*acpi_pkg_callback) (u8 object_type, 145acpi_status (*acpi_pkg_callback) (u8 object_type,
146 union acpi_operand_object *source_object, 146 union acpi_operand_object * source_object,
147 union acpi_generic_state * state, 147 union acpi_generic_state * state,
148 void *context); 148 void *context);
149 149
150struct acpi_pkg_info { 150struct acpi_pkg_info {
151 u8 *free_space; 151 u8 *free_space;
@@ -167,6 +167,15 @@ struct acpi_pkg_info {
167#define DB_QWORD_DISPLAY 8 167#define DB_QWORD_DISPLAY 8
168 168
169/* 169/*
170 * utascii - ASCII utilities
171 */
172u8 acpi_ut_valid_nameseg(char *signature);
173
174u8 acpi_ut_valid_name_char(char character, u32 position);
175
176void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count);
177
178/*
170 * utnonansi - Non-ANSI C library functions 179 * utnonansi - Non-ANSI C library functions
171 */ 180 */
172void acpi_ut_strupr(char *src_string); 181void acpi_ut_strupr(char *src_string);
@@ -175,7 +184,14 @@ void acpi_ut_strlwr(char *src_string);
175 184
176int acpi_ut_stricmp(char *string1, char *string2); 185int acpi_ut_stricmp(char *string1, char *string2);
177 186
178acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer); 187acpi_status
188acpi_ut_strtoul64(char *string,
189 u32 base, u32 max_integer_byte_width, u64 *ret_integer);
190
191/* Values for max_integer_byte_width above */
192
193#define ACPI_MAX32_BYTE_WIDTH 4
194#define ACPI_MAX64_BYTE_WIDTH 8
179 195
180/* 196/*
181 * utglobal - Global data structures and procedures 197 * utglobal - Global data structures and procedures
@@ -266,7 +282,8 @@ acpi_ut_trace(u32 line_number,
266void 282void
267acpi_ut_trace_ptr(u32 line_number, 283acpi_ut_trace_ptr(u32 line_number,
268 const char *function_name, 284 const char *function_name,
269 const char *module_name, u32 component_id, void *pointer); 285 const char *module_name,
286 u32 component_id, const void *pointer);
270 287
271void 288void
272acpi_ut_trace_u32(u32 line_number, 289acpi_ut_trace_u32(u32 line_number,
@@ -276,7 +293,8 @@ acpi_ut_trace_u32(u32 line_number,
276void 293void
277acpi_ut_trace_str(u32 line_number, 294acpi_ut_trace_str(u32 line_number,
278 const char *function_name, 295 const char *function_name,
279 const char *module_name, u32 component_id, char *string); 296 const char *module_name,
297 u32 component_id, const char *string);
280 298
281void 299void
282acpi_ut_exit(u32 line_number, 300acpi_ut_exit(u32 line_number,
@@ -335,12 +353,12 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
335 */ 353 */
336acpi_status 354acpi_status
337acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, 355acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
338 char *path, 356 const char *path,
339 u32 expected_return_btypes, 357 u32 expected_return_btypes,
340 union acpi_operand_object **return_desc); 358 union acpi_operand_object **return_desc);
341 359
342acpi_status 360acpi_status
343acpi_ut_evaluate_numeric_object(char *object_name, 361acpi_ut_evaluate_numeric_object(const char *object_name,
344 struct acpi_namespace_node *device_node, 362 struct acpi_namespace_node *device_node,
345 u64 *value); 363 u64 *value);
346 364
@@ -415,7 +433,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
415union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); 433union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
416 434
417acpi_status 435acpi_status
418acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); 436acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size *obj_length);
419 437
420/* 438/*
421 * utosi - Support for the _OSI predefined control method 439 * utosi - Support for the _OSI predefined control method
@@ -526,15 +544,15 @@ void acpi_ut_set_integer_width(u8 revision);
526void 544void
527acpi_ut_display_init_pathname(u8 type, 545acpi_ut_display_init_pathname(u8 type,
528 struct acpi_namespace_node *obj_handle, 546 struct acpi_namespace_node *obj_handle,
529 char *path); 547 const char *path);
530#endif 548#endif
531 549
532/* 550/*
533 * utownerid - Support for Table/Method Owner IDs 551 * utownerid - Support for Table/Method Owner IDs
534 */ 552 */
535acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); 553acpi_status acpi_ut_allocate_owner_id(acpi_owner_id *owner_id);
536 554
537void acpi_ut_release_owner_id(acpi_owner_id * owner_id); 555void acpi_ut_release_owner_id(acpi_owner_id *owner_id);
538 556
539/* 557/*
540 * utresrc 558 * utresrc
@@ -570,10 +588,6 @@ void acpi_ut_print_string(char *string, u16 max_length);
570void ut_convert_backslashes(char *pathname); 588void ut_convert_backslashes(char *pathname);
571#endif 589#endif
572 590
573u8 acpi_ut_valid_acpi_name(char *name);
574
575u8 acpi_ut_valid_acpi_char(char character, u32 position);
576
577void acpi_ut_repair_name(char *name); 591void acpi_ut_repair_name(char *name);
578 592
579#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) 593#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
@@ -628,7 +642,7 @@ void acpi_ut_dump_allocation_info(void);
628void acpi_ut_dump_allocations(u32 component, const char *module); 642void acpi_ut_dump_allocations(u32 component, const char *module);
629 643
630acpi_status 644acpi_status
631acpi_ut_create_list(char *list_name, 645acpi_ut_create_list(const char *list_name,
632 u16 object_size, struct acpi_memory_list **return_cache); 646 u16 object_size, struct acpi_memory_list **return_cache);
633 647
634#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 648#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/drivers/acpi/acpica/dbcmds.c b/drivers/acpi/acpica/dbcmds.c
index 772178c96ccf..62bd446535f5 100644
--- a/drivers/acpi/acpica/dbcmds.c
+++ b/drivers/acpi/acpica/dbcmds.c
@@ -738,9 +738,9 @@ acpi_dm_test_resource_conversion(struct acpi_namespace_node *node, char *name)
738 original_aml = return_buffer.pointer; 738 original_aml = return_buffer.pointer;
739 739
740 acpi_dm_compare_aml_resources(original_aml->buffer.pointer, 740 acpi_dm_compare_aml_resources(original_aml->buffer.pointer,
741 (acpi_rsdesc_size) original_aml->buffer. 741 (acpi_rsdesc_size)original_aml->buffer.
742 length, new_aml.pointer, 742 length, new_aml.pointer,
743 (acpi_rsdesc_size) new_aml.length); 743 (acpi_rsdesc_size)new_aml.length);
744 744
745 /* Cleanup and exit */ 745 /* Cleanup and exit */
746 746
diff --git a/drivers/acpi/acpica/dbconvert.c b/drivers/acpi/acpica/dbconvert.c
index 68f4e0f4b095..7cd07b27f758 100644
--- a/drivers/acpi/acpica/dbconvert.c
+++ b/drivers/acpi/acpica/dbconvert.c
@@ -194,7 +194,7 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object)
194 * 194 *
195 ******************************************************************************/ 195 ******************************************************************************/
196 196
197acpi_status acpi_db_convert_to_package(char *string, union acpi_object * object) 197acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)
198{ 198{
199 char *this; 199 char *this;
200 char *next; 200 char *next;
@@ -252,7 +252,7 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object * object)
252 252
253acpi_status 253acpi_status
254acpi_db_convert_to_object(acpi_object_type type, 254acpi_db_convert_to_object(acpi_object_type type,
255 char *string, union acpi_object * object) 255 char *string, union acpi_object *object)
256{ 256{
257 acpi_status status = AE_OK; 257 acpi_status status = AE_OK;
258 258
@@ -277,7 +277,9 @@ acpi_db_convert_to_object(acpi_object_type type,
277 default: 277 default:
278 278
279 object->type = ACPI_TYPE_INTEGER; 279 object->type = ACPI_TYPE_INTEGER;
280 status = acpi_ut_strtoul64(string, 16, &object->integer.value); 280 status =
281 acpi_ut_strtoul64(string, 16, acpi_gbl_integer_byte_width,
282 &object->integer.value);
281 break; 283 break;
282 } 284 }
283 285
diff --git a/drivers/acpi/acpica/dbexec.c b/drivers/acpi/acpica/dbexec.c
index c814855376e2..12df2915ad74 100644
--- a/drivers/acpi/acpica/dbexec.c
+++ b/drivers/acpi/acpica/dbexec.c
@@ -361,7 +361,7 @@ acpi_db_execution_walk(acpi_handle obj_handle,
361 ******************************************************************************/ 361 ******************************************************************************/
362 362
363void 363void
364acpi_db_execute(char *name, char **args, acpi_object_type * types, u32 flags) 364acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags)
365{ 365{
366 acpi_status status; 366 acpi_status status;
367 struct acpi_buffer return_obj; 367 struct acpi_buffer return_obj;
diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
index 417c02a89915..7cd5d2e022da 100644
--- a/drivers/acpi/acpica/dbinput.c
+++ b/drivers/acpi/acpica/dbinput.c
@@ -57,12 +57,12 @@ static u32 acpi_db_get_line(char *input_buffer);
57 57
58static u32 acpi_db_match_command(char *user_command); 58static u32 acpi_db_match_command(char *user_command);
59 59
60static void acpi_db_display_command_info(char *command, u8 display_all); 60static void acpi_db_display_command_info(const char *command, u8 display_all);
61 61
62static void acpi_db_display_help(char *command); 62static void acpi_db_display_help(char *command);
63 63
64static u8 64static u8
65acpi_db_match_command_help(char *command, 65acpi_db_match_command_help(const char *command,
66 const struct acpi_db_command_help *help); 66 const struct acpi_db_command_help *help);
67 67
68/* 68/*
@@ -348,7 +348,7 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
348 ******************************************************************************/ 348 ******************************************************************************/
349 349
350static u8 350static u8
351acpi_db_match_command_help(char *command, 351acpi_db_match_command_help(const char *command,
352 const struct acpi_db_command_help *help) 352 const struct acpi_db_command_help *help)
353{ 353{
354 char *invocation = help->invocation; 354 char *invocation = help->invocation;
@@ -402,7 +402,7 @@ acpi_db_match_command_help(char *command,
402 * 402 *
403 ******************************************************************************/ 403 ******************************************************************************/
404 404
405static void acpi_db_display_command_info(char *command, u8 display_all) 405static void acpi_db_display_command_info(const char *command, u8 display_all)
406{ 406{
407 const struct acpi_db_command_help *next; 407 const struct acpi_db_command_help *next;
408 u8 matched; 408 u8 matched;
@@ -466,7 +466,7 @@ static void acpi_db_display_help(char *command)
466 ******************************************************************************/ 466 ******************************************************************************/
467 467
468char *acpi_db_get_next_token(char *string, 468char *acpi_db_get_next_token(char *string,
469 char **next, acpi_object_type * return_type) 469 char **next, acpi_object_type *return_type)
470{ 470{
471 char *start; 471 char *start;
472 u32 depth; 472 u32 depth;
@@ -656,8 +656,9 @@ static u32 acpi_db_match_command(char *user_command)
656 } 656 }
657 657
658 for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++) { 658 for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++) {
659 if (strstr(acpi_gbl_db_commands[i].name, user_command) == 659 if (strstr
660 acpi_gbl_db_commands[i].name) { 660 (ACPI_CAST_PTR(char, acpi_gbl_db_commands[i].name),
661 user_command) == acpi_gbl_db_commands[i].name) {
661 return (i); 662 return (i);
662 } 663 }
663 } 664 }
@@ -683,8 +684,8 @@ static u32 acpi_db_match_command(char *user_command)
683 684
684acpi_status 685acpi_status
685acpi_db_command_dispatch(char *input_buffer, 686acpi_db_command_dispatch(char *input_buffer,
686 struct acpi_walk_state * walk_state, 687 struct acpi_walk_state *walk_state,
687 union acpi_parse_object * op) 688 union acpi_parse_object *op)
688{ 689{
689 u32 temp; 690 u32 temp;
690 u32 command_index; 691 u32 command_index;
diff --git a/drivers/acpi/acpica/dbnames.c b/drivers/acpi/acpica/dbnames.c
index 3c23b5a1079b..8667f14d535e 100644
--- a/drivers/acpi/acpica/dbnames.c
+++ b/drivers/acpi/acpica/dbnames.c
@@ -285,7 +285,7 @@ void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg)
285 u32 max_depth = ACPI_UINT32_MAX; 285 u32 max_depth = ACPI_UINT32_MAX;
286 acpi_owner_id owner_id; 286 acpi_owner_id owner_id;
287 287
288 owner_id = (acpi_owner_id) strtoul(owner_arg, NULL, 0); 288 owner_id = (acpi_owner_id)strtoul(owner_arg, NULL, 0);
289 289
290 /* Now we can check for the depth argument */ 290 /* Now we can check for the depth argument */
291 291
@@ -709,7 +709,7 @@ acpi_db_integrity_walk(acpi_handle obj_handle,
709 return (AE_OK); 709 return (AE_OK);
710 } 710 }
711 711
712 if (!acpi_ut_valid_acpi_name(node->name.ascii)) { 712 if (!acpi_ut_valid_nameseg(node->name.ascii)) {
713 acpi_os_printf("Invalid AcpiName for Node %p\n", node); 713 acpi_os_printf("Invalid AcpiName for Node %p\n", node);
714 return (AE_OK); 714 return (AE_OK);
715 } 715 }
diff --git a/drivers/acpi/acpica/dbutils.c b/drivers/acpi/acpica/dbutils.c
index b37a2c77b86b..ae80106d1000 100644
--- a/drivers/acpi/acpica/dbutils.c
+++ b/drivers/acpi/acpica/dbutils.c
@@ -56,8 +56,6 @@ acpi_status acpi_db_second_pass_parse(union acpi_parse_object *root);
56void acpi_db_dump_buffer(u32 address); 56void acpi_db_dump_buffer(u32 address);
57#endif 57#endif
58 58
59static char *gbl_hex_to_ascii = "0123456789ABCDEF";
60
61/******************************************************************************* 59/*******************************************************************************
62 * 60 *
63 * FUNCTION: acpi_db_match_argument 61 * FUNCTION: acpi_db_match_argument
@@ -82,8 +80,9 @@ acpi_db_match_argument(char *user_argument,
82 } 80 }
83 81
84 for (i = 0; arguments[i].name; i++) { 82 for (i = 0; arguments[i].name; i++) {
85 if (strstr(arguments[i].name, user_argument) == 83 if (strstr(ACPI_CAST_PTR(char, arguments[i].name),
86 arguments[i].name) { 84 ACPI_CAST_PTR(char,
85 user_argument)) == arguments[i].name) {
87 return (i); 86 return (i);
88 } 87 }
89 } 88 }
@@ -339,7 +338,7 @@ void acpi_db_uint32_to_hex_string(u32 value, char *buffer)
339 buffer[8] = '\0'; 338 buffer[8] = '\0';
340 339
341 for (i = 7; i >= 0; i--) { 340 for (i = 7; i >= 0; i--) {
342 buffer[i] = gbl_hex_to_ascii[value & 0x0F]; 341 buffer[i] = acpi_gbl_upper_hex_digits[value & 0x0F];
343 value = value >> 4; 342 value = value >> 4;
344 } 343 }
345} 344}
diff --git a/drivers/acpi/acpica/dbxface.c b/drivers/acpi/acpica/dbxface.c
index e94e0d80bc7b..124db237775d 100644
--- a/drivers/acpi/acpica/dbxface.c
+++ b/drivers/acpi/acpica/dbxface.c
@@ -162,8 +162,8 @@ void acpi_db_signal_break_point(struct acpi_walk_state *walk_state)
162 ******************************************************************************/ 162 ******************************************************************************/
163 163
164acpi_status 164acpi_status
165acpi_db_single_step(struct acpi_walk_state * walk_state, 165acpi_db_single_step(struct acpi_walk_state *walk_state,
166 union acpi_parse_object * op, u32 opcode_class) 166 union acpi_parse_object *op, u32 opcode_class)
167{ 167{
168 union acpi_parse_object *next; 168 union acpi_parse_object *next;
169 acpi_status status = AE_OK; 169 acpi_status status = AE_OK;
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index c9a663f21ac8..4ddcbf100234 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -163,8 +163,8 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
163 ******************************************************************************/ 163 ******************************************************************************/
164 164
165acpi_status 165acpi_status
166acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, 166acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
167 union acpi_parse_object * op) 167 union acpi_parse_object *op)
168{ 168{
169 acpi_status status = AE_OK; 169 acpi_status status = AE_OK;
170 union acpi_generic_state *control_state; 170 union acpi_generic_state *control_state;
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index 5aa1c5feee50..f1e6dcc7a827 100644
--- a/drivers/acpi/acpica/dsinit.c
+++ b/drivers/acpi/acpica/dsinit.c
@@ -188,7 +188,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
188 188
189acpi_status 189acpi_status
190acpi_ds_initialize_objects(u32 table_index, 190acpi_ds_initialize_objects(u32 table_index,
191 struct acpi_namespace_node * start_node) 191 struct acpi_namespace_node *start_node)
192{ 192{
193 acpi_status status; 193 acpi_status status;
194 struct acpi_init_walk_info info; 194 struct acpi_init_walk_info info;
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index da198b864107..47c7b52a519c 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -209,7 +209,7 @@ acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state,
209 ******************************************************************************/ 209 ******************************************************************************/
210 210
211acpi_status 211acpi_status
212acpi_ds_method_error(acpi_status status, struct acpi_walk_state * walk_state) 212acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
213{ 213{
214 u32 aml_offset; 214 u32 aml_offset;
215 215
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index 8ca9416320e0..f393de9f5887 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -569,7 +569,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
569 /* TBD: May only be temporary */ 569 /* TBD: May only be temporary */
570 570
571 obj_desc = 571 obj_desc =
572 acpi_ut_create_string_object((acpi_size) name_length); 572 acpi_ut_create_string_object((acpi_size)name_length);
573 573
574 strncpy(obj_desc->string.pointer, 574 strncpy(obj_desc->string.pointer,
575 name_string, name_length); 575 name_string, name_length);
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index d1cedcfda1d2..fd34040d4f44 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -137,8 +137,8 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
137 ******************************************************************************/ 137 ******************************************************************************/
138 138
139acpi_status 139acpi_status
140acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, 140acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
141 union acpi_parse_object ** out_op) 141 union acpi_parse_object **out_op)
142{ 142{
143 union acpi_parse_object *op; 143 union acpi_parse_object *op;
144 struct acpi_namespace_node *node; 144 struct acpi_namespace_node *node;
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index 0bac6e14170e..762db3fa70e0 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -490,8 +490,8 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
490 490
491 status = 491 status =
492 acpi_ds_create_index_field(op, 492 acpi_ds_create_index_field(op,
493 (acpi_handle) arg-> 493 (acpi_handle)arg->common.
494 common.node, walk_state); 494 node, walk_state);
495 break; 495 break;
496 496
497 case AML_BANK_FIELD_OP: 497 case AML_BANK_FIELD_OP:
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c
index 3a26ddbaed6d..e3338698e56b 100644
--- a/drivers/acpi/acpica/dswstate.c
+++ b/drivers/acpi/acpica/dswstate.c
@@ -143,8 +143,8 @@ acpi_ds_result_pop(union acpi_operand_object **object,
143 ******************************************************************************/ 143 ******************************************************************************/
144 144
145acpi_status 145acpi_status
146acpi_ds_result_push(union acpi_operand_object * object, 146acpi_ds_result_push(union acpi_operand_object *object,
147 struct acpi_walk_state * walk_state) 147 struct acpi_walk_state *walk_state)
148{ 148{
149 union acpi_generic_state *state; 149 union acpi_generic_state *state;
150 acpi_status status; 150 acpi_status status;
@@ -307,7 +307,7 @@ static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state)
307 ******************************************************************************/ 307 ******************************************************************************/
308 308
309acpi_status 309acpi_status
310acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) 310acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state)
311{ 311{
312 ACPI_FUNCTION_NAME(ds_obj_stack_push); 312 ACPI_FUNCTION_NAME(ds_obj_stack_push);
313 313
@@ -354,7 +354,7 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
354 ******************************************************************************/ 354 ******************************************************************************/
355 355
356acpi_status 356acpi_status
357acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) 357acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state)
358{ 358{
359 u32 i; 359 u32 i;
360 360
@@ -411,7 +411,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
411 return; 411 return;
412 } 412 }
413 413
414 for (i = (s32) pop_count - 1; i >= 0; i--) { 414 for (i = (s32)pop_count - 1; i >= 0; i--) {
415 if (walk_state->num_operands == 0) { 415 if (walk_state->num_operands == 0) {
416 return; 416 return;
417 } 417 }
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index b47e62aaf654..4b4949ce05bc 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -440,7 +440,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list)
440 440
441 gpe_event_info = 441 gpe_event_info =
442 &gpe_block-> 442 &gpe_block->
443 event_info[((acpi_size) i * 443 event_info[((acpi_size)i *
444 ACPI_GPE_REGISTER_WIDTH) + j]; 444 ACPI_GPE_REGISTER_WIDTH) + j];
445 gpe_number = 445 gpe_number =
446 j + gpe_register_info->base_gpe_number; 446 j + gpe_register_info->base_gpe_number;
@@ -652,7 +652,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_enable_gpe(void *context)
652 * 652 *
653 ******************************************************************************/ 653 ******************************************************************************/
654 654
655acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info * gpe_event_info) 655acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info *gpe_event_info)
656{ 656{
657 acpi_status status; 657 acpi_status status;
658 658
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 447fa1cac64f..d54014cab01d 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -211,7 +211,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
211 211
212 /* Allocate the GPE register information block */ 212 /* Allocate the GPE register information block */
213 213
214 gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block-> 214 gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size)gpe_block->
215 register_count * 215 register_count *
216 sizeof(struct 216 sizeof(struct
217 acpi_gpe_register_info)); 217 acpi_gpe_register_info));
@@ -225,7 +225,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
225 * Allocate the GPE event_info block. There are eight distinct GPEs 225 * Allocate the GPE event_info block. There are eight distinct GPEs
226 * per register. Initialization to zeros is sufficient. 226 * per register. Initialization to zeros is sufficient.
227 */ 227 */
228 gpe_event_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block->gpe_count * 228 gpe_event_info = ACPI_ALLOCATE_ZEROED((acpi_size)gpe_block->gpe_count *
229 sizeof(struct 229 sizeof(struct
230 acpi_gpe_event_info)); 230 acpi_gpe_event_info));
231 if (!gpe_event_info) { 231 if (!gpe_event_info) {
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index 66c4b5b7cd64..3f150d567e64 100644
--- a/drivers/acpi/acpica/evgpeutil.c
+++ b/drivers/acpi/acpica/evgpeutil.c
@@ -163,7 +163,7 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
163 163
164acpi_status 164acpi_status
165acpi_ev_get_gpe_xrupt_block(u32 interrupt_number, 165acpi_ev_get_gpe_xrupt_block(u32 interrupt_number,
166 struct acpi_gpe_xrupt_info ** gpe_xrupt_block) 166 struct acpi_gpe_xrupt_info **gpe_xrupt_block)
167{ 167{
168 struct acpi_gpe_xrupt_info *next_gpe_xrupt; 168 struct acpi_gpe_xrupt_info *next_gpe_xrupt;
169 struct acpi_gpe_xrupt_info *gpe_xrupt; 169 struct acpi_gpe_xrupt_info *gpe_xrupt;
@@ -320,7 +320,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
320 /* Now look at the individual GPEs in this byte register */ 320 /* Now look at the individual GPEs in this byte register */
321 321
322 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { 322 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
323 gpe_event_info = &gpe_block->event_info[((acpi_size) i * 323 gpe_event_info = &gpe_block->event_info[((acpi_size)i *
324 ACPI_GPE_REGISTER_WIDTH) 324 ACPI_GPE_REGISTER_WIDTH)
325 + j]; 325 + j];
326 326
diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c
index 0f6be8956a99..24768ca03f19 100644
--- a/drivers/acpi/acpica/evhandler.c
+++ b/drivers/acpi/acpica/evhandler.c
@@ -359,7 +359,7 @@ union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type
359 ******************************************************************************/ 359 ******************************************************************************/
360 360
361acpi_status 361acpi_status
362acpi_ev_install_space_handler(struct acpi_namespace_node * node, 362acpi_ev_install_space_handler(struct acpi_namespace_node *node,
363 acpi_adr_space_type space_id, 363 acpi_adr_space_type space_id,
364 acpi_adr_space_handler handler, 364 acpi_adr_space_handler handler,
365 acpi_adr_space_setup setup, void *context) 365 acpi_adr_space_setup setup, void *context)
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index c67d78c5995f..f51d43adb7d1 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -99,8 +99,7 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
99 ******************************************************************************/ 99 ******************************************************************************/
100 100
101acpi_status 101acpi_status
102acpi_ev_queue_notify_request(struct acpi_namespace_node * node, 102acpi_ev_queue_notify_request(struct acpi_namespace_node *node, u32 notify_value)
103 u32 notify_value)
104{ 103{
105 union acpi_operand_object *obj_desc; 104 union acpi_operand_object *obj_desc;
106 union acpi_operand_object *handler_list_head = NULL; 105 union acpi_operand_object *handler_list_head = NULL;
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 63924d1c737a..4c6f79514040 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -526,81 +526,59 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,
526 526
527/******************************************************************************* 527/*******************************************************************************
528 * 528 *
529 * FUNCTION: acpi_ev_associate_reg_method 529 * FUNCTION: acpi_ev_execute_reg_method
530 * 530 *
531 * PARAMETERS: region_obj - Region object 531 * PARAMETERS: region_obj - Region object
532 * function - Passed to _REG: On (1) or Off (0)
532 * 533 *
533 * RETURN: Status 534 * RETURN: Status
534 * 535 *
535 * DESCRIPTION: Find and associate _REG method to a region 536 * DESCRIPTION: Execute _REG method for a region
536 * 537 *
537 ******************************************************************************/ 538 ******************************************************************************/
538 539
539void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj) 540acpi_status
541acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
540{ 542{
541 acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; 543 struct acpi_evaluate_info *info;
544 union acpi_operand_object *args[3];
545 union acpi_operand_object *region_obj2;
546 const acpi_name *reg_name_ptr =
547 ACPI_CAST_PTR(acpi_name, METHOD_NAME__REG);
542 struct acpi_namespace_node *method_node; 548 struct acpi_namespace_node *method_node;
543 struct acpi_namespace_node *node; 549 struct acpi_namespace_node *node;
544 union acpi_operand_object *region_obj2;
545 acpi_status status; 550 acpi_status status;
546 551
547 ACPI_FUNCTION_TRACE(ev_associate_reg_method); 552 ACPI_FUNCTION_TRACE(ev_execute_reg_method);
553
554 if (!acpi_gbl_namespace_initialized ||
555 region_obj->region.handler == NULL) {
556 return_ACPI_STATUS(AE_OK);
557 }
548 558
549 region_obj2 = acpi_ns_get_secondary_object(region_obj); 559 region_obj2 = acpi_ns_get_secondary_object(region_obj);
550 if (!region_obj2) { 560 if (!region_obj2) {
551 return_VOID; 561 return_ACPI_STATUS(AE_NOT_EXIST);
552 } 562 }
553 563
564 /*
565 * Find any "_REG" method associated with this region definition.
566 * The method should always be updated as this function may be
567 * invoked after a namespace change.
568 */
554 node = region_obj->region.node->parent; 569 node = region_obj->region.node->parent;
555
556 /* Find any "_REG" method associated with this region definition */
557
558 status = 570 status =
559 acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, 571 acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,
560 &method_node); 572 &method_node);
561 if (ACPI_SUCCESS(status)) { 573 if (ACPI_SUCCESS(status)) {
562 /* 574 /*
563 * The _REG method is optional and there can be only one per region 575 * The _REG method is optional and there can be only one per
564 * definition. This will be executed when the handler is attached 576 * region definition. This will be executed when the handler is
565 * or removed 577 * attached or removed.
566 */ 578 */
567 region_obj2->extra.method_REG = method_node; 579 region_obj2->extra.method_REG = method_node;
568 } 580 }
569 581 if (region_obj2->extra.method_REG == NULL) {
570 return_VOID;
571}
572
573/*******************************************************************************
574 *
575 * FUNCTION: acpi_ev_execute_reg_method
576 *
577 * PARAMETERS: region_obj - Region object
578 * function - Passed to _REG: On (1) or Off (0)
579 *
580 * RETURN: Status
581 *
582 * DESCRIPTION: Execute _REG method for a region
583 *
584 ******************************************************************************/
585
586acpi_status
587acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
588{
589 struct acpi_evaluate_info *info;
590 union acpi_operand_object *args[3];
591 union acpi_operand_object *region_obj2;
592 acpi_status status;
593
594 ACPI_FUNCTION_TRACE(ev_execute_reg_method);
595
596 region_obj2 = acpi_ns_get_secondary_object(region_obj);
597 if (!region_obj2) {
598 return_ACPI_STATUS(AE_NOT_EXIST);
599 }
600
601 if (region_obj2->extra.method_REG == NULL ||
602 region_obj->region.handler == NULL ||
603 !acpi_gbl_namespace_initialized) {
604 return_ACPI_STATUS(AE_OK); 582 return_ACPI_STATUS(AE_OK);
605 } 583 }
606 584
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index fda869c9ad0b..b6ea9c0d0d8c 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -227,7 +227,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
227 227
228 /* Install a handler for this PCI root bridge */ 228 /* Install a handler for this PCI root bridge */
229 229
230 status = acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); 230 status = acpi_install_address_space_handler((acpi_handle)pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
231 if (ACPI_FAILURE(status)) { 231 if (ACPI_FAILURE(status)) {
232 if (status == AE_SAME_HANDLER) { 232 if (status == AE_SAME_HANDLER) {
233 /* 233 /*
@@ -518,7 +518,6 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
518 return_ACPI_STATUS(AE_OK); 518 return_ACPI_STATUS(AE_OK);
519 } 519 }
520 520
521 acpi_ev_associate_reg_method(region_obj);
522 region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; 521 region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;
523 522
524 node = region_obj->region.node->parent; 523 node = region_obj->region.node->parent;
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index 90456714821f..17cfef721d00 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -917,7 +917,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
917 * the FADT-defined gpe blocks. Otherwise, the GPE block device. 917 * the FADT-defined gpe blocks. Otherwise, the GPE block device.
918 * 918 *
919 ******************************************************************************/ 919 ******************************************************************************/
920acpi_status acpi_get_gpe_device(u32 index, acpi_handle * gpe_device) 920acpi_status acpi_get_gpe_device(u32 index, acpi_handle *gpe_device)
921{ 921{
922 struct acpi_gpe_device_info info; 922 struct acpi_gpe_device_info info;
923 acpi_status status; 923 acpi_status status;
diff --git a/drivers/acpi/acpica/exconcat.c b/drivers/acpi/acpica/exconcat.c
new file mode 100644
index 000000000000..2423fe03e879
--- /dev/null
+++ b/drivers/acpi/acpica/exconcat.c
@@ -0,0 +1,439 @@
1/******************************************************************************
2 *
3 * Module Name: exconcat - Concatenate-type AML operators
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2016, 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 "acinterp.h"
47#include "amlresrc.h"
48
49#define _COMPONENT ACPI_EXECUTER
50ACPI_MODULE_NAME("exconcat")
51
52/* Local Prototypes */
53static acpi_status
54acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,
55 union acpi_operand_object **result_desc);
56
57/*******************************************************************************
58 *
59 * FUNCTION: acpi_ex_do_concatenate
60 *
61 * PARAMETERS: operand0 - First source object
62 * operand1 - Second source object
63 * actual_return_desc - Where to place the return object
64 * walk_state - Current walk state
65 *
66 * RETURN: Status
67 *
68 * DESCRIPTION: Concatenate two objects with the ACPI-defined conversion
69 * rules as necessary.
70 * NOTE:
71 * Per the ACPI spec (up to 6.1), Concatenate only supports Integer,
72 * String, and Buffer objects. However, we support all objects here
73 * as an extension. This improves the usefulness of both Concatenate
74 * and the Printf/Fprintf macros. The extension returns a string
75 * describing the object type for the other objects.
76 * 02/2016.
77 *
78 ******************************************************************************/
79
80acpi_status
81acpi_ex_do_concatenate(union acpi_operand_object *operand0,
82 union acpi_operand_object *operand1,
83 union acpi_operand_object **actual_return_desc,
84 struct acpi_walk_state *walk_state)
85{
86 union acpi_operand_object *local_operand0 = operand0;
87 union acpi_operand_object *local_operand1 = operand1;
88 union acpi_operand_object *temp_operand1 = NULL;
89 union acpi_operand_object *return_desc;
90 char *buffer;
91 acpi_object_type operand0_type;
92 acpi_object_type operand1_type;
93 acpi_status status;
94
95 ACPI_FUNCTION_TRACE(ex_do_concatenate);
96
97 /* Operand 0 preprocessing */
98
99 switch (operand0->common.type) {
100 case ACPI_TYPE_INTEGER:
101 case ACPI_TYPE_STRING:
102 case ACPI_TYPE_BUFFER:
103
104 operand0_type = operand0->common.type;
105 break;
106
107 default:
108
109 /* For all other types, get the "object type" string */
110
111 status =
112 acpi_ex_convert_to_object_type_string(operand0,
113 &local_operand0);
114 if (ACPI_FAILURE(status)) {
115 goto cleanup;
116 }
117
118 operand0_type = ACPI_TYPE_STRING;
119 break;
120 }
121
122 /* Operand 1 preprocessing */
123
124 switch (operand1->common.type) {
125 case ACPI_TYPE_INTEGER:
126 case ACPI_TYPE_STRING:
127 case ACPI_TYPE_BUFFER:
128
129 operand1_type = operand1->common.type;
130 break;
131
132 default:
133
134 /* For all other types, get the "object type" string */
135
136 status =
137 acpi_ex_convert_to_object_type_string(operand1,
138 &local_operand1);
139 if (ACPI_FAILURE(status)) {
140 goto cleanup;
141 }
142
143 operand1_type = ACPI_TYPE_STRING;
144 break;
145 }
146
147 /*
148 * Convert the second operand if necessary. The first operand (0)
149 * determines the type of the second operand (1) (See the Data Types
150 * section of the ACPI specification). Both object types are
151 * guaranteed to be either Integer/String/Buffer by the operand
152 * resolution mechanism.
153 */
154 switch (operand0_type) {
155 case ACPI_TYPE_INTEGER:
156
157 status =
158 acpi_ex_convert_to_integer(local_operand1, &temp_operand1,
159 16);
160 break;
161
162 case ACPI_TYPE_BUFFER:
163
164 status =
165 acpi_ex_convert_to_buffer(local_operand1, &temp_operand1);
166 break;
167
168 case ACPI_TYPE_STRING:
169
170 switch (operand1_type) {
171 case ACPI_TYPE_INTEGER:
172 case ACPI_TYPE_STRING:
173 case ACPI_TYPE_BUFFER:
174
175 /* Other types have already been converted to string */
176
177 status =
178 acpi_ex_convert_to_string(local_operand1,
179 &temp_operand1,
180 ACPI_IMPLICIT_CONVERT_HEX);
181 break;
182
183 default:
184
185 status = AE_OK;
186 break;
187 }
188 break;
189
190 default:
191
192 ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
193 operand0->common.type));
194 status = AE_AML_INTERNAL;
195 }
196
197 if (ACPI_FAILURE(status)) {
198 goto cleanup;
199 }
200
201 /* Take care with any newly created operand objects */
202
203 if ((local_operand1 != operand1) && (local_operand1 != temp_operand1)) {
204 acpi_ut_remove_reference(local_operand1);
205 }
206
207 local_operand1 = temp_operand1;
208
209 /*
210 * Both operands are now known to be the same object type
211 * (Both are Integer, String, or Buffer), and we can now perform
212 * the concatenation.
213 *
214 * There are three cases to handle, as per the ACPI spec:
215 *
216 * 1) Two Integers concatenated to produce a new Buffer
217 * 2) Two Strings concatenated to produce a new String
218 * 3) Two Buffers concatenated to produce a new Buffer
219 */
220 switch (operand0_type) {
221 case ACPI_TYPE_INTEGER:
222
223 /* Result of two Integers is a Buffer */
224 /* Need enough buffer space for two integers */
225
226 return_desc = acpi_ut_create_buffer_object((acpi_size)
227 ACPI_MUL_2
228 (acpi_gbl_integer_byte_width));
229 if (!return_desc) {
230 status = AE_NO_MEMORY;
231 goto cleanup;
232 }
233
234 buffer = (char *)return_desc->buffer.pointer;
235
236 /* Copy the first integer, LSB first */
237
238 memcpy(buffer, &operand0->integer.value,
239 acpi_gbl_integer_byte_width);
240
241 /* Copy the second integer (LSB first) after the first */
242
243 memcpy(buffer + acpi_gbl_integer_byte_width,
244 &local_operand1->integer.value,
245 acpi_gbl_integer_byte_width);
246 break;
247
248 case ACPI_TYPE_STRING:
249
250 /* Result of two Strings is a String */
251
252 return_desc = acpi_ut_create_string_object(((acpi_size)
253 local_operand0->
254 string.length +
255 local_operand1->
256 string.length));
257 if (!return_desc) {
258 status = AE_NO_MEMORY;
259 goto cleanup;
260 }
261
262 buffer = return_desc->string.pointer;
263
264 /* Concatenate the strings */
265
266 strcpy(buffer, local_operand0->string.pointer);
267 strcat(buffer, local_operand1->string.pointer);
268 break;
269
270 case ACPI_TYPE_BUFFER:
271
272 /* Result of two Buffers is a Buffer */
273
274 return_desc = acpi_ut_create_buffer_object(((acpi_size)
275 operand0->buffer.
276 length +
277 local_operand1->
278 buffer.length));
279 if (!return_desc) {
280 status = AE_NO_MEMORY;
281 goto cleanup;
282 }
283
284 buffer = (char *)return_desc->buffer.pointer;
285
286 /* Concatenate the buffers */
287
288 memcpy(buffer, operand0->buffer.pointer,
289 operand0->buffer.length);
290 memcpy(buffer + operand0->buffer.length,
291 local_operand1->buffer.pointer,
292 local_operand1->buffer.length);
293 break;
294
295 default:
296
297 /* Invalid object type, should not happen here */
298
299 ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
300 operand0->common.type));
301 status = AE_AML_INTERNAL;
302 goto cleanup;
303 }
304
305 *actual_return_desc = return_desc;
306
307cleanup:
308 if (local_operand0 != operand0) {
309 acpi_ut_remove_reference(local_operand0);
310 }
311
312 if (local_operand1 != operand1) {
313 acpi_ut_remove_reference(local_operand1);
314 }
315
316 return_ACPI_STATUS(status);
317}
318
319/*******************************************************************************
320 *
321 * FUNCTION: acpi_ex_convert_to_object_type_string
322 *
323 * PARAMETERS: obj_desc - Object to be converted
324 * return_desc - Where to place the return object
325 *
326 * RETURN: Status
327 *
328 * DESCRIPTION: Convert an object of arbitrary type to a string object that
329 * contains the namestring for the object. Used for the
330 * concatenate operator.
331 *
332 ******************************************************************************/
333
334static acpi_status
335acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,
336 union acpi_operand_object **result_desc)
337{
338 union acpi_operand_object *return_desc;
339 const char *type_string;
340
341 type_string = acpi_ut_get_type_name(obj_desc->common.type);
342
343 return_desc = acpi_ut_create_string_object(((acpi_size)strlen(type_string) + 9)); /* 9 For "[ Object]" */
344 if (!return_desc) {
345 return (AE_NO_MEMORY);
346 }
347
348 strcpy(return_desc->string.pointer, "[");
349 strcat(return_desc->string.pointer, type_string);
350 strcat(return_desc->string.pointer, " Object]");
351
352 *result_desc = return_desc;
353 return (AE_OK);
354}
355
356/*******************************************************************************
357 *
358 * FUNCTION: acpi_ex_concat_template
359 *
360 * PARAMETERS: operand0 - First source object
361 * operand1 - Second source object
362 * actual_return_desc - Where to place the return object
363 * walk_state - Current walk state
364 *
365 * RETURN: Status
366 *
367 * DESCRIPTION: Concatenate two resource templates
368 *
369 ******************************************************************************/
370
371acpi_status
372acpi_ex_concat_template(union acpi_operand_object *operand0,
373 union acpi_operand_object *operand1,
374 union acpi_operand_object **actual_return_desc,
375 struct acpi_walk_state *walk_state)
376{
377 acpi_status status;
378 union acpi_operand_object *return_desc;
379 u8 *new_buf;
380 u8 *end_tag;
381 acpi_size length0;
382 acpi_size length1;
383 acpi_size new_length;
384
385 ACPI_FUNCTION_TRACE(ex_concat_template);
386
387 /*
388 * Find the end_tag descriptor in each resource template.
389 * Note1: returned pointers point TO the end_tag, not past it.
390 * Note2: zero-length buffers are allowed; treated like one end_tag
391 */
392
393 /* Get the length of the first resource template */
394
395 status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
396 if (ACPI_FAILURE(status)) {
397 return_ACPI_STATUS(status);
398 }
399
400 length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
401
402 /* Get the length of the second resource template */
403
404 status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
405 if (ACPI_FAILURE(status)) {
406 return_ACPI_STATUS(status);
407 }
408
409 length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
410
411 /* Combine both lengths, minimum size will be 2 for end_tag */
412
413 new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
414
415 /* Create a new buffer object for the result (with one end_tag) */
416
417 return_desc = acpi_ut_create_buffer_object(new_length);
418 if (!return_desc) {
419 return_ACPI_STATUS(AE_NO_MEMORY);
420 }
421
422 /*
423 * Copy the templates to the new buffer, 0 first, then 1 follows. One
424 * end_tag descriptor is copied from Operand1.
425 */
426 new_buf = return_desc->buffer.pointer;
427 memcpy(new_buf, operand0->buffer.pointer, length0);
428 memcpy(new_buf + length0, operand1->buffer.pointer, length1);
429
430 /* Insert end_tag and set the checksum to zero, means "ignore checksum" */
431
432 new_buf[new_length - 1] = 0;
433 new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
434
435 /* Return the completed resource template */
436
437 *actual_return_desc = return_desc;
438 return_ACPI_STATUS(AE_OK);
439}
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index f74161301037..a1d177d58254 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -118,7 +118,9 @@ acpi_ex_add_table(u32 table_index,
118 /* Execute any module-level code that was found in the table */ 118 /* Execute any module-level code that was found in the table */
119 119
120 acpi_ex_exit_interpreter(); 120 acpi_ex_exit_interpreter();
121 acpi_ns_exec_module_code_list(); 121 if (acpi_gbl_group_module_level_code) {
122 acpi_ns_exec_module_code_list();
123 }
122 acpi_ex_enter_interpreter(); 124 acpi_ex_enter_interpreter();
123 125
124 /* 126 /*
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index 0b9f2c13b98a..b7e9b3d803e1 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -124,7 +124,9 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
124 * of ACPI 3.0) is that the to_integer() operator allows both decimal 124 * of ACPI 3.0) is that the to_integer() operator allows both decimal
125 * and hexadecimal strings (hex prefixed with "0x"). 125 * and hexadecimal strings (hex prefixed with "0x").
126 */ 126 */
127 status = acpi_ut_strtoul64((char *)pointer, flags, &result); 127 status = acpi_ut_strtoul64((char *)pointer, flags,
128 acpi_gbl_integer_byte_width,
129 &result);
128 if (ACPI_FAILURE(status)) { 130 if (ACPI_FAILURE(status)) {
129 return_ACPI_STATUS(status); 131 return_ACPI_STATUS(status);
130 } 132 }
@@ -439,7 +441,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
439 * Need enough space for one ASCII integer (plus null terminator) 441 * Need enough space for one ASCII integer (plus null terminator)
440 */ 442 */
441 return_desc = 443 return_desc =
442 acpi_ut_create_string_object((acpi_size) string_length); 444 acpi_ut_create_string_object((acpi_size)string_length);
443 if (!return_desc) { 445 if (!return_desc) {
444 return_ACPI_STATUS(AE_NO_MEMORY); 446 return_ACPI_STATUS(AE_NO_MEMORY);
445 } 447 }
@@ -518,7 +520,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
518 } 520 }
519 521
520 return_desc = 522 return_desc =
521 acpi_ut_create_string_object((acpi_size) string_length); 523 acpi_ut_create_string_object((acpi_size)string_length);
522 if (!return_desc) { 524 if (!return_desc) {
523 return_ACPI_STATUS(AE_NO_MEMORY); 525 return_ACPI_STATUS(AE_NO_MEMORY);
524 } 526 }
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index bea9612e4720..613ba6eb08bb 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -394,7 +394,7 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
394 obj_desc->processor.proc_id = (u8) operand[1]->integer.value; 394 obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
395 obj_desc->processor.length = (u8) operand[3]->integer.value; 395 obj_desc->processor.length = (u8) operand[3]->integer.value;
396 obj_desc->processor.address = 396 obj_desc->processor.address =
397 (acpi_io_address) operand[2]->integer.value; 397 (acpi_io_address)operand[2]->integer.value;
398 398
399 /* Install the processor object in the parent Node */ 399 /* Install the processor object in the parent Node */
400 400
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index ee30974b245a..fce6b2e10209 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -55,9 +55,9 @@ ACPI_MODULE_NAME("exdump")
55 */ 55 */
56#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 56#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
57/* Local prototypes */ 57/* Local prototypes */
58static void acpi_ex_out_string(char *title, char *value); 58static void acpi_ex_out_string(const char *title, const char *value);
59 59
60static void acpi_ex_out_pointer(char *title, void *value); 60static void acpi_ex_out_pointer(const char *title, const void *value);
61 61
62static void 62static void
63acpi_ex_dump_object(union acpi_operand_object *obj_desc, 63acpi_ex_dump_object(union acpi_operand_object *obj_desc,
@@ -365,8 +365,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
365 struct acpi_exdump_info *info) 365 struct acpi_exdump_info *info)
366{ 366{
367 u8 *target; 367 u8 *target;
368 char *name; 368 const char *name;
369 const char *reference_name;
370 u8 count; 369 u8 count;
371 union acpi_operand_object *start; 370 union acpi_operand_object *start;
372 union acpi_operand_object *data = NULL; 371 union acpi_operand_object *data = NULL;
@@ -459,9 +458,9 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
459 458
460 case ACPI_EXD_REFERENCE: 459 case ACPI_EXD_REFERENCE:
461 460
462 reference_name = acpi_ut_get_reference_name(obj_desc);
463 acpi_ex_out_string("Class Name", 461 acpi_ex_out_string("Class Name",
464 ACPI_CAST_PTR(char, reference_name)); 462 acpi_ut_get_reference_name
463 (obj_desc));
465 acpi_ex_dump_reference_obj(obj_desc); 464 acpi_ex_dump_reference_obj(obj_desc);
466 break; 465 break;
467 466
@@ -934,12 +933,12 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
934 * 933 *
935 ******************************************************************************/ 934 ******************************************************************************/
936 935
937static void acpi_ex_out_string(char *title, char *value) 936static void acpi_ex_out_string(const char *title, const char *value)
938{ 937{
939 acpi_os_printf("%20s : %s\n", title, value); 938 acpi_os_printf("%20s : %s\n", title, value);
940} 939}
941 940
942static void acpi_ex_out_pointer(char *title, void *value) 941static void acpi_ex_out_pointer(const char *title, const void *value)
943{ 942{
944 acpi_os_printf("%20s : %p\n", title, value); 943 acpi_os_printf("%20s : %p\n", title, value);
945} 944}
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index d5d8020a8523..d7d3ee36338b 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -126,7 +126,7 @@ acpi_ex_get_serial_access_length(u32 accessor_type, u32 access_length)
126 ******************************************************************************/ 126 ******************************************************************************/
127 127
128acpi_status 128acpi_status
129acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, 129acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
130 union acpi_operand_object *obj_desc, 130 union acpi_operand_object *obj_desc,
131 union acpi_operand_object **ret_buffer_desc) 131 union acpi_operand_object **ret_buffer_desc)
132{ 132{
@@ -233,7 +233,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state,
233 * Note: Field.length is in bits. 233 * Note: Field.length is in bits.
234 */ 234 */
235 length = 235 length =
236 (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); 236 (acpi_size)ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
237 237
238 if (length > acpi_gbl_integer_byte_width) { 238 if (length > acpi_gbl_integer_byte_width) {
239 239
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index f0c5ed0b7db8..ee76d299b3d0 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -164,7 +164,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
164 if (ACPI_ROUND_UP(rgn_desc->region.length, 164 if (ACPI_ROUND_UP(rgn_desc->region.length,
165 obj_desc->common_field. 165 obj_desc->common_field.
166 access_byte_width) >= 166 access_byte_width) >=
167 ((acpi_size) obj_desc->common_field. 167 ((acpi_size)obj_desc->common_field.
168 base_byte_offset + 168 base_byte_offset +
169 obj_desc->common_field.access_byte_width + 169 obj_desc->common_field.access_byte_width +
170 field_datum_byte_offset)) { 170 field_datum_byte_offset)) {
@@ -897,17 +897,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
897 897
898 access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); 898 access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width);
899 899
900 /* 900 /* Create the bitmasks used for bit insertion */
901 * Create the bitmasks used for bit insertion.
902 * Note: This if/else is used to bypass compiler differences with the
903 * shift operator
904 */
905 if (access_bit_width == ACPI_INTEGER_BIT_SIZE) {
906 width_mask = ACPI_UINT64_MAX;
907 } else {
908 width_mask = ACPI_MASK_BITS_ABOVE(access_bit_width);
909 }
910 901
902 width_mask = ACPI_MASK_BITS_ABOVE_64(access_bit_width);
911 mask = width_mask & 903 mask = width_mask &
912 ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); 904 ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
913 905
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index db30ae43ddd8..4f7e667624b3 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -45,7 +45,6 @@
45#include "accommon.h" 45#include "accommon.h"
46#include "acinterp.h" 46#include "acinterp.h"
47#include "amlcode.h" 47#include "amlcode.h"
48#include "amlresrc.h"
49 48
50#define _COMPONENT ACPI_EXECUTER 49#define _COMPONENT ACPI_EXECUTER
51ACPI_MODULE_NAME("exmisc") 50ACPI_MODULE_NAME("exmisc")
@@ -140,295 +139,6 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
140 139
141/******************************************************************************* 140/*******************************************************************************
142 * 141 *
143 * FUNCTION: acpi_ex_concat_template
144 *
145 * PARAMETERS: operand0 - First source object
146 * operand1 - Second source object
147 * actual_return_desc - Where to place the return object
148 * walk_state - Current walk state
149 *
150 * RETURN: Status
151 *
152 * DESCRIPTION: Concatenate two resource templates
153 *
154 ******************************************************************************/
155
156acpi_status
157acpi_ex_concat_template(union acpi_operand_object *operand0,
158 union acpi_operand_object *operand1,
159 union acpi_operand_object **actual_return_desc,
160 struct acpi_walk_state *walk_state)
161{
162 acpi_status status;
163 union acpi_operand_object *return_desc;
164 u8 *new_buf;
165 u8 *end_tag;
166 acpi_size length0;
167 acpi_size length1;
168 acpi_size new_length;
169
170 ACPI_FUNCTION_TRACE(ex_concat_template);
171
172 /*
173 * Find the end_tag descriptor in each resource template.
174 * Note1: returned pointers point TO the end_tag, not past it.
175 * Note2: zero-length buffers are allowed; treated like one end_tag
176 */
177
178 /* Get the length of the first resource template */
179
180 status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
181 if (ACPI_FAILURE(status)) {
182 return_ACPI_STATUS(status);
183 }
184
185 length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
186
187 /* Get the length of the second resource template */
188
189 status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
190 if (ACPI_FAILURE(status)) {
191 return_ACPI_STATUS(status);
192 }
193
194 length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
195
196 /* Combine both lengths, minimum size will be 2 for end_tag */
197
198 new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
199
200 /* Create a new buffer object for the result (with one end_tag) */
201
202 return_desc = acpi_ut_create_buffer_object(new_length);
203 if (!return_desc) {
204 return_ACPI_STATUS(AE_NO_MEMORY);
205 }
206
207 /*
208 * Copy the templates to the new buffer, 0 first, then 1 follows. One
209 * end_tag descriptor is copied from Operand1.
210 */
211 new_buf = return_desc->buffer.pointer;
212 memcpy(new_buf, operand0->buffer.pointer, length0);
213 memcpy(new_buf + length0, operand1->buffer.pointer, length1);
214
215 /* Insert end_tag and set the checksum to zero, means "ignore checksum" */
216
217 new_buf[new_length - 1] = 0;
218 new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
219
220 /* Return the completed resource template */
221
222 *actual_return_desc = return_desc;
223 return_ACPI_STATUS(AE_OK);
224}
225
226/*******************************************************************************
227 *
228 * FUNCTION: acpi_ex_do_concatenate
229 *
230 * PARAMETERS: operand0 - First source object
231 * operand1 - Second source object
232 * actual_return_desc - Where to place the return object
233 * walk_state - Current walk state
234 *
235 * RETURN: Status
236 *
237 * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
238 *
239 ******************************************************************************/
240
241acpi_status
242acpi_ex_do_concatenate(union acpi_operand_object *operand0,
243 union acpi_operand_object *operand1,
244 union acpi_operand_object **actual_return_desc,
245 struct acpi_walk_state *walk_state)
246{
247 union acpi_operand_object *local_operand1 = operand1;
248 union acpi_operand_object *return_desc;
249 char *new_buf;
250 const char *type_string;
251 acpi_status status;
252
253 ACPI_FUNCTION_TRACE(ex_do_concatenate);
254
255 /*
256 * Convert the second operand if necessary. The first operand
257 * determines the type of the second operand, (See the Data Types
258 * section of the ACPI specification.) Both object types are
259 * guaranteed to be either Integer/String/Buffer by the operand
260 * resolution mechanism.
261 */
262 switch (operand0->common.type) {
263 case ACPI_TYPE_INTEGER:
264
265 status =
266 acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
267 break;
268
269 case ACPI_TYPE_STRING:
270 /*
271 * Per the ACPI spec, Concatenate only supports int/str/buf.
272 * However, we support all objects here as an extension.
273 * This improves the usefulness of the Printf() macro.
274 * 12/2015.
275 */
276 switch (operand1->common.type) {
277 case ACPI_TYPE_INTEGER:
278 case ACPI_TYPE_STRING:
279 case ACPI_TYPE_BUFFER:
280
281 status =
282 acpi_ex_convert_to_string(operand1, &local_operand1,
283 ACPI_IMPLICIT_CONVERT_HEX);
284 break;
285
286 default:
287 /*
288 * Just emit a string containing the object type.
289 */
290 type_string =
291 acpi_ut_get_type_name(operand1->common.type);
292
293 local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[Object]" */
294 if (!local_operand1) {
295 status = AE_NO_MEMORY;
296 goto cleanup;
297 }
298
299 strcpy(local_operand1->string.pointer, "[");
300 strcat(local_operand1->string.pointer, type_string);
301 strcat(local_operand1->string.pointer, " Object]");
302 status = AE_OK;
303 break;
304 }
305 break;
306
307 case ACPI_TYPE_BUFFER:
308
309 status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
310 break;
311
312 default:
313
314 ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
315 operand0->common.type));
316 status = AE_AML_INTERNAL;
317 }
318
319 if (ACPI_FAILURE(status)) {
320 goto cleanup;
321 }
322
323 /*
324 * Both operands are now known to be the same object type
325 * (Both are Integer, String, or Buffer), and we can now perform the
326 * concatenation.
327 */
328
329 /*
330 * There are three cases to handle:
331 *
332 * 1) Two Integers concatenated to produce a new Buffer
333 * 2) Two Strings concatenated to produce a new String
334 * 3) Two Buffers concatenated to produce a new Buffer
335 */
336 switch (operand0->common.type) {
337 case ACPI_TYPE_INTEGER:
338
339 /* Result of two Integers is a Buffer */
340 /* Need enough buffer space for two integers */
341
342 return_desc = acpi_ut_create_buffer_object((acpi_size)
343 ACPI_MUL_2
344 (acpi_gbl_integer_byte_width));
345 if (!return_desc) {
346 status = AE_NO_MEMORY;
347 goto cleanup;
348 }
349
350 new_buf = (char *)return_desc->buffer.pointer;
351
352 /* Copy the first integer, LSB first */
353
354 memcpy(new_buf, &operand0->integer.value,
355 acpi_gbl_integer_byte_width);
356
357 /* Copy the second integer (LSB first) after the first */
358
359 memcpy(new_buf + acpi_gbl_integer_byte_width,
360 &local_operand1->integer.value,
361 acpi_gbl_integer_byte_width);
362 break;
363
364 case ACPI_TYPE_STRING:
365
366 /* Result of two Strings is a String */
367
368 return_desc = acpi_ut_create_string_object(((acpi_size)
369 operand0->string.
370 length +
371 local_operand1->
372 string.length));
373 if (!return_desc) {
374 status = AE_NO_MEMORY;
375 goto cleanup;
376 }
377
378 new_buf = return_desc->string.pointer;
379
380 /* Concatenate the strings */
381
382 strcpy(new_buf, operand0->string.pointer);
383 strcat(new_buf, local_operand1->string.pointer);
384 break;
385
386 case ACPI_TYPE_BUFFER:
387
388 /* Result of two Buffers is a Buffer */
389
390 return_desc = acpi_ut_create_buffer_object(((acpi_size)
391 operand0->buffer.
392 length +
393 local_operand1->
394 buffer.length));
395 if (!return_desc) {
396 status = AE_NO_MEMORY;
397 goto cleanup;
398 }
399
400 new_buf = (char *)return_desc->buffer.pointer;
401
402 /* Concatenate the buffers */
403
404 memcpy(new_buf, operand0->buffer.pointer,
405 operand0->buffer.length);
406 memcpy(new_buf + operand0->buffer.length,
407 local_operand1->buffer.pointer,
408 local_operand1->buffer.length);
409 break;
410
411 default:
412
413 /* Invalid object type, should not happen here */
414
415 ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
416 operand0->common.type));
417 status = AE_AML_INTERNAL;
418 goto cleanup;
419 }
420
421 *actual_return_desc = return_desc;
422
423cleanup:
424 if (local_operand1 != operand1) {
425 acpi_ut_remove_reference(local_operand1);
426 }
427 return_ACPI_STATUS(status);
428}
429
430/*******************************************************************************
431 *
432 * FUNCTION: acpi_ex_do_math_op 142 * FUNCTION: acpi_ex_do_math_op
433 * 143 *
434 * PARAMETERS: opcode - AML opcode 144 * PARAMETERS: opcode - AML opcode
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c
index 27c11ab5eb04..3d6af93fe561 100644
--- a/drivers/acpi/acpica/exnames.c
+++ b/drivers/acpi/acpica/exnames.c
@@ -178,7 +178,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
178 178
179 for (index = 0; 179 for (index = 0;
180 (index < ACPI_NAME_SIZE) 180 (index < ACPI_NAME_SIZE)
181 && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { 181 && (acpi_ut_valid_name_char(*aml_address, 0)); index++) {
182 char_buf[index] = *aml_address++; 182 char_buf[index] = *aml_address++;
183 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); 183 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
184 } 184 }
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c
index 5aa21c4eda1d..69e4e269ad2f 100644
--- a/drivers/acpi/acpica/exoparg3.c
+++ b/drivers/acpi/acpica/exoparg3.c
@@ -184,7 +184,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
184 /* Get the Integer values from the objects */ 184 /* Get the Integer values from the objects */
185 185
186 index = operand[1]->integer.value; 186 index = operand[1]->integer.value;
187 length = (acpi_size) operand[2]->integer.value; 187 length = (acpi_size)operand[2]->integer.value;
188 188
189 /* 189 /*
190 * If the index is beyond the length of the String/Buffer, or if the 190 * If the index is beyond the length of the String/Buffer, or if the
@@ -198,8 +198,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
198 198
199 else if ((index + length) > operand[0]->string.length) { 199 else if ((index + length) > operand[0]->string.length) {
200 length = 200 length =
201 (acpi_size) operand[0]->string.length - 201 (acpi_size)operand[0]->string.length -
202 (acpi_size) index; 202 (acpi_size)index;
203 } 203 }
204 204
205 /* Strings always have a sub-pointer, not so for buffers */ 205 /* Strings always have a sub-pointer, not so for buffers */
@@ -209,7 +209,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
209 209
210 /* Always allocate a new buffer for the String */ 210 /* Always allocate a new buffer for the String */
211 211
212 buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); 212 buffer = ACPI_ALLOCATE_ZEROED((acpi_size)length + 1);
213 if (!buffer) { 213 if (!buffer) {
214 status = AE_NO_MEMORY; 214 status = AE_NO_MEMORY;
215 goto cleanup; 215 goto cleanup;
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index e2b63483857f..786d53b0bb37 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -207,7 +207,7 @@ acpi_ex_do_match(u32 match_op,
207 * 207 *
208 ******************************************************************************/ 208 ******************************************************************************/
209 209
210acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) 210acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state)
211{ 211{
212 union acpi_operand_object **operand = &walk_state->operands[0]; 212 union acpi_operand_object **operand = &walk_state->operands[0];
213 union acpi_operand_object *return_desc = NULL; 213 union acpi_operand_object *return_desc = NULL;
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index 076074daf2b6..31b381cae94d 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -325,15 +325,15 @@ acpi_ex_system_io_space_handler(u32 function,
325 switch (function) { 325 switch (function) {
326 case ACPI_READ: 326 case ACPI_READ:
327 327
328 status = acpi_hw_read_port((acpi_io_address) address, 328 status = acpi_hw_read_port((acpi_io_address)address,
329 &value32, bit_width); 329 &value32, bit_width);
330 *value = value32; 330 *value = value32;
331 break; 331 break;
332 332
333 case ACPI_WRITE: 333 case ACPI_WRITE:
334 334
335 status = acpi_hw_write_port((acpi_io_address) address, 335 status = acpi_hw_write_port((acpi_io_address)address,
336 (u32) * value, bit_width); 336 (u32)*value, bit_width);
337 break; 337 break;
338 338
339 default: 339 default:
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c
index c1e8bfb0f7f4..a183cb740d24 100644
--- a/drivers/acpi/acpica/exresnte.c
+++ b/drivers/acpi/acpica/exresnte.c
@@ -93,7 +93,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
93 */ 93 */
94 node = *object_ptr; 94 node = *object_ptr;
95 source_desc = acpi_ns_get_attached_object(node); 95 source_desc = acpi_ns_get_attached_object(node);
96 entry_type = acpi_ns_get_type((acpi_handle) node); 96 entry_type = acpi_ns_get_type((acpi_handle)node);
97 97
98 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n", 98 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
99 node, source_desc, 99 node, source_desc,
@@ -106,7 +106,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
106 106
107 node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); 107 node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
108 source_desc = acpi_ns_get_attached_object(node); 108 source_desc = acpi_ns_get_attached_object(node);
109 entry_type = acpi_ns_get_type((acpi_handle) node); 109 entry_type = acpi_ns_get_type((acpi_handle)node);
110 *object_ptr = node; 110 *object_ptr = node;
111 } 111 }
112 112
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index fedacf13dc36..e1d3878be2c6 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -334,7 +334,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
334acpi_status 334acpi_status
335acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, 335acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
336 union acpi_operand_object *operand, 336 union acpi_operand_object *operand,
337 acpi_object_type * return_type, 337 acpi_object_type *return_type,
338 union acpi_operand_object **return_desc) 338 union acpi_operand_object **return_desc)
339{ 339{
340 union acpi_operand_object *obj_desc = ACPI_CAST_PTR(void, operand); 340 union acpi_operand_object *obj_desc = ACPI_CAST_PTR(void, operand);
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index cc2c26c46a6d..27b41fd7542d 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -131,8 +131,8 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
131 131
132acpi_status 132acpi_status
133acpi_ex_resolve_operands(u16 opcode, 133acpi_ex_resolve_operands(u16 opcode,
134 union acpi_operand_object ** stack_ptr, 134 union acpi_operand_object **stack_ptr,
135 struct acpi_walk_state * walk_state) 135 struct acpi_walk_state *walk_state)
136{ 136{
137 union acpi_operand_object *obj_desc; 137 union acpi_operand_object *obj_desc;
138 acpi_status status = AE_OK; 138 acpi_status status = AE_OK;
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c
index 28b724827f0f..1dab82746d06 100644
--- a/drivers/acpi/acpica/exstorob.c
+++ b/drivers/acpi/acpica/exstorob.c
@@ -188,7 +188,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
188 * Clear old string and copy in the new one 188 * Clear old string and copy in the new one
189 */ 189 */
190 memset(target_desc->string.pointer, 0, 190 memset(target_desc->string.pointer, 0,
191 (acpi_size) target_desc->string.length + 1); 191 (acpi_size)target_desc->string.length + 1);
192 memcpy(target_desc->string.pointer, buffer, length); 192 memcpy(target_desc->string.pointer, buffer, length);
193 } else { 193 } else {
194 /* 194 /*
@@ -204,7 +204,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
204 } 204 }
205 205
206 target_desc->string.pointer = 206 target_desc->string.pointer =
207 ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); 207 ACPI_ALLOCATE_ZEROED((acpi_size)length + 1);
208 208
209 if (!target_desc->string.pointer) { 209 if (!target_desc->string.pointer) {
210 return_ACPI_STATUS(AE_NO_MEMORY); 210 return_ACPI_STATUS(AE_NO_MEMORY);
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 4d44bc1cb2ca..425f13372e68 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -301,8 +301,8 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
301 * 301 *
302 * FUNCTION: acpi_ex_eisa_id_to_string 302 * FUNCTION: acpi_ex_eisa_id_to_string
303 * 303 *
304 * PARAMETERS: compressed_id - EISAID to be converted 304 * PARAMETERS: out_string - Where to put the converted string (8 bytes)
305 * out_string - Where to put the converted string (8 bytes) 305 * compressed_id - EISAID to be converted
306 * 306 *
307 * RETURN: None 307 * RETURN: None
308 * 308 *
@@ -354,7 +354,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id)
354 * possible 64-bit integer. 354 * possible 64-bit integer.
355 * value - Value to be converted 355 * value - Value to be converted
356 * 356 *
357 * RETURN: None, string 357 * RETURN: Converted string in out_string
358 * 358 *
359 * DESCRIPTION: Convert a 64-bit integer to decimal string representation. 359 * DESCRIPTION: Convert a 64-bit integer to decimal string representation.
360 * Assumes string buffer is large enough to hold the string. The 360 * Assumes string buffer is large enough to hold the string. The
@@ -384,9 +384,9 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
384 * FUNCTION: acpi_ex_pci_cls_to_string 384 * FUNCTION: acpi_ex_pci_cls_to_string
385 * 385 *
386 * PARAMETERS: out_string - Where to put the converted string (7 bytes) 386 * PARAMETERS: out_string - Where to put the converted string (7 bytes)
387 * PARAMETERS: class_code - PCI class code to be converted (3 bytes) 387 * class_code - PCI class code to be converted (3 bytes)
388 * 388 *
389 * RETURN: None 389 * RETURN: Converted string in out_string
390 * 390 *
391 * DESCRIPTION: Convert 3-bytes PCI class code to string representation. 391 * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
392 * Return buffer must be large enough to hold the string. The 392 * Return buffer must be large enough to hold the string. The
@@ -417,7 +417,7 @@ void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3])
417 * 417 *
418 * PARAMETERS: space_id - ID to be validated 418 * PARAMETERS: space_id - ID to be validated
419 * 419 *
420 * RETURN: TRUE if valid/supported ID. 420 * RETURN: TRUE if space_id is a valid/supported ID.
421 * 421 *
422 * DESCRIPTION: Validate an operation region space_ID. 422 * DESCRIPTION: Validate an operation region space_ID.
423 * 423 *
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index 1c4f4518611a..bdecd5e76e87 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -166,7 +166,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
166 * 166 *
167 ******************************************************************************/ 167 ******************************************************************************/
168 168
169acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) 169acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info)
170{ 170{
171 struct acpi_gpe_register_info *gpe_register_info; 171 struct acpi_gpe_register_info *gpe_register_info;
172 acpi_status status; 172 acpi_status status;
@@ -206,7 +206,7 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
206 ******************************************************************************/ 206 ******************************************************************************/
207 207
208acpi_status 208acpi_status
209acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, 209acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
210 acpi_event_status *event_status) 210 acpi_event_status *event_status)
211{ 211{
212 u32 in_byte; 212 u32 in_byte;
@@ -391,7 +391,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
391 391
392acpi_status 392acpi_status
393acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, 393acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
394 struct acpi_gpe_block_info * gpe_block, 394 struct acpi_gpe_block_info *gpe_block,
395 void *context) 395 void *context)
396{ 396{
397 u32 i; 397 u32 i;
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 5ba0498412fd..0f18dbc9a37f 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -51,6 +51,10 @@ ACPI_MODULE_NAME("hwregs")
51 51
52#if (!ACPI_REDUCED_HARDWARE) 52#if (!ACPI_REDUCED_HARDWARE)
53/* Local Prototypes */ 53/* Local Prototypes */
54static u8
55acpi_hw_get_access_bit_width(struct acpi_generic_address *reg,
56 u8 max_bit_width);
57
54static acpi_status 58static acpi_status
55acpi_hw_read_multiple(u32 *value, 59acpi_hw_read_multiple(u32 *value,
56 struct acpi_generic_address *register_a, 60 struct acpi_generic_address *register_a,
@@ -65,6 +69,48 @@ acpi_hw_write_multiple(u32 value,
65 69
66/****************************************************************************** 70/******************************************************************************
67 * 71 *
72 * FUNCTION: acpi_hw_get_access_bit_width
73 *
74 * PARAMETERS: reg - GAS register structure
75 * max_bit_width - Max bit_width supported (32 or 64)
76 *
77 * RETURN: Status
78 *
79 * DESCRIPTION: Obtain optimal access bit width
80 *
81 ******************************************************************************/
82
83static u8
84acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)
85{
86 u64 address;
87
88 if (!reg->access_width) {
89 /*
90 * Detect old register descriptors where only the bit_width field
91 * makes senses. The target address is copied to handle possible
92 * alignment issues.
93 */
94 ACPI_MOVE_64_TO_64(&address, &reg->address);
95 if (!reg->bit_offset && reg->bit_width &&
96 ACPI_IS_POWER_OF_TWO(reg->bit_width) &&
97 ACPI_IS_ALIGNED(reg->bit_width, 8) &&
98 ACPI_IS_ALIGNED(address, reg->bit_width)) {
99 return (reg->bit_width);
100 } else {
101 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
102 return (32);
103 } else {
104 return (max_bit_width);
105 }
106 }
107 } else {
108 return (1 << (reg->access_width + 2));
109 }
110}
111
112/******************************************************************************
113 *
68 * FUNCTION: acpi_hw_validate_register 114 * FUNCTION: acpi_hw_validate_register
69 * 115 *
70 * PARAMETERS: reg - GAS register structure 116 * PARAMETERS: reg - GAS register structure
@@ -83,6 +129,8 @@ acpi_status
83acpi_hw_validate_register(struct acpi_generic_address *reg, 129acpi_hw_validate_register(struct acpi_generic_address *reg,
84 u8 max_bit_width, u64 *address) 130 u8 max_bit_width, u64 *address)
85{ 131{
132 u8 bit_width;
133 u8 access_width;
86 134
87 /* Must have a valid pointer to a GAS structure */ 135 /* Must have a valid pointer to a GAS structure */
88 136
@@ -109,23 +157,25 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
109 return (AE_SUPPORT); 157 return (AE_SUPPORT);
110 } 158 }
111 159
112 /* Validate the bit_width */ 160 /* Validate the access_width */
113 161
114 if ((reg->bit_width != 8) && 162 if (reg->access_width > 4) {
115 (reg->bit_width != 16) &&
116 (reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
117 ACPI_ERROR((AE_INFO, 163 ACPI_ERROR((AE_INFO,
118 "Unsupported register bit width: 0x%X", 164 "Unsupported register access width: 0x%X",
119 reg->bit_width)); 165 reg->access_width));
120 return (AE_SUPPORT); 166 return (AE_SUPPORT);
121 } 167 }
122 168
123 /* Validate the bit_offset. Just a warning for now. */ 169 /* Validate the bit_width, convert access_width into number of bits */
124 170
125 if (reg->bit_offset != 0) { 171 access_width = acpi_hw_get_access_bit_width(reg, max_bit_width);
172 bit_width =
173 ACPI_ROUND_UP(reg->bit_offset + reg->bit_width, access_width);
174 if (max_bit_width < bit_width) {
126 ACPI_WARNING((AE_INFO, 175 ACPI_WARNING((AE_INFO,
127 "Unsupported register bit offset: 0x%X", 176 "Requested bit width 0x%X is smaller than register bit width 0x%X",
128 reg->bit_offset)); 177 max_bit_width, bit_width));
178 return (AE_SUPPORT);
129 } 179 }
130 180
131 return (AE_OK); 181 return (AE_OK);
@@ -145,17 +195,19 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
145 * 64-bit values is not needed. 195 * 64-bit values is not needed.
146 * 196 *
147 * LIMITATIONS: <These limitations also apply to acpi_hw_write> 197 * LIMITATIONS: <These limitations also apply to acpi_hw_write>
148 * bit_width must be exactly 8, 16, or 32.
149 * space_ID must be system_memory or system_IO. 198 * space_ID must be system_memory or system_IO.
150 * bit_offset and access_width are currently ignored, as there has
151 * not been a need to implement these.
152 * 199 *
153 ******************************************************************************/ 200 ******************************************************************************/
154 201
155acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) 202acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
156{ 203{
157 u64 address; 204 u64 address;
205 u8 access_width;
206 u32 bit_width;
207 u8 bit_offset;
158 u64 value64; 208 u64 value64;
209 u32 value32;
210 u8 index;
159 acpi_status status; 211 acpi_status status;
160 212
161 ACPI_FUNCTION_NAME(hw_read); 213 ACPI_FUNCTION_NAME(hw_read);
@@ -167,28 +219,75 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
167 return (status); 219 return (status);
168 } 220 }
169 221
170 /* Initialize entire 32-bit return value to zero */ 222 /*
171 223 * Initialize entire 32-bit return value to zero, convert access_width
224 * into number of bits based
225 */
172 *value = 0; 226 *value = 0;
227 access_width = acpi_hw_get_access_bit_width(reg, 32);
228 bit_width = reg->bit_offset + reg->bit_width;
229 bit_offset = reg->bit_offset;
173 230
174 /* 231 /*
175 * Two address spaces supported: Memory or IO. PCI_Config is 232 * Two address spaces supported: Memory or IO. PCI_Config is
176 * not supported here because the GAS structure is insufficient 233 * not supported here because the GAS structure is insufficient
177 */ 234 */
178 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 235 index = 0;
179 status = acpi_os_read_memory((acpi_physical_address) 236 while (bit_width) {
180 address, &value64, reg->bit_width); 237 if (bit_offset >= access_width) {
238 value32 = 0;
239 bit_offset -= access_width;
240 } else {
241 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
242 status =
243 acpi_os_read_memory((acpi_physical_address)
244 address +
245 index *
246 ACPI_DIV_8
247 (access_width),
248 &value64, access_width);
249 value32 = (u32)value64;
250 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
251
252 status = acpi_hw_read_port((acpi_io_address)
253 address +
254 index *
255 ACPI_DIV_8
256 (access_width),
257 &value32,
258 access_width);
259 }
260
261 /*
262 * Use offset style bit masks because:
263 * bit_offset < access_width/bit_width < access_width, and
264 * access_width is ensured to be less than 32-bits by
265 * acpi_hw_validate_register().
266 */
267 if (bit_offset) {
268 value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
269 bit_offset = 0;
270 }
271 if (bit_width < access_width) {
272 value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
273 }
274 }
181 275
182 *value = (u32)value64; 276 /*
183 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 277 * Use offset style bit writes because "Index * AccessWidth" is
278 * ensured to be less than 32-bits by acpi_hw_validate_register().
279 */
280 ACPI_SET_BITS(value, index * access_width,
281 ACPI_MASK_BITS_ABOVE_32(access_width), value32);
184 282
185 status = acpi_hw_read_port((acpi_io_address) 283 bit_width -=
186 address, value, reg->bit_width); 284 bit_width > access_width ? access_width : bit_width;
285 index++;
187 } 286 }
188 287
189 ACPI_DEBUG_PRINT((ACPI_DB_IO, 288 ACPI_DEBUG_PRINT((ACPI_DB_IO,
190 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", 289 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
191 *value, reg->bit_width, ACPI_FORMAT_UINT64(address), 290 *value, access_width, ACPI_FORMAT_UINT64(address),
192 acpi_ut_get_region_name(reg->space_id))); 291 acpi_ut_get_region_name(reg->space_id)));
193 292
194 return (status); 293 return (status);
@@ -212,6 +311,12 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
212acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) 311acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
213{ 312{
214 u64 address; 313 u64 address;
314 u8 access_width;
315 u32 bit_width;
316 u8 bit_offset;
317 u64 value64;
318 u32 new_value32, old_value32;
319 u8 index;
215 acpi_status status; 320 acpi_status status;
216 321
217 ACPI_FUNCTION_NAME(hw_write); 322 ACPI_FUNCTION_NAME(hw_write);
@@ -223,23 +328,145 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
223 return (status); 328 return (status);
224 } 329 }
225 330
331 /* Convert access_width into number of bits based */
332
333 access_width = acpi_hw_get_access_bit_width(reg, 32);
334 bit_width = reg->bit_offset + reg->bit_width;
335 bit_offset = reg->bit_offset;
336
226 /* 337 /*
227 * Two address spaces supported: Memory or IO. PCI_Config is 338 * Two address spaces supported: Memory or IO. PCI_Config is
228 * not supported here because the GAS structure is insufficient 339 * not supported here because the GAS structure is insufficient
229 */ 340 */
230 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 341 index = 0;
231 status = acpi_os_write_memory((acpi_physical_address) 342 while (bit_width) {
232 address, (u64)value, 343 /*
233 reg->bit_width); 344 * Use offset style bit reads because "Index * AccessWidth" is
234 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 345 * ensured to be less than 32-bits by acpi_hw_validate_register().
235 346 */
236 status = acpi_hw_write_port((acpi_io_address) 347 new_value32 = ACPI_GET_BITS(&value, index * access_width,
237 address, value, reg->bit_width); 348 ACPI_MASK_BITS_ABOVE_32
349 (access_width));
350
351 if (bit_offset >= access_width) {
352 bit_offset -= access_width;
353 } else {
354 /*
355 * Use offset style bit masks because access_width is ensured
356 * to be less than 32-bits by acpi_hw_validate_register() and
357 * bit_offset/bit_width is less than access_width here.
358 */
359 if (bit_offset) {
360 new_value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
361 }
362 if (bit_width < access_width) {
363 new_value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
364 }
365
366 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
367 if (bit_offset || bit_width < access_width) {
368 /*
369 * Read old values in order not to modify the bits that
370 * are beyond the register bit_width/bit_offset setting.
371 */
372 status =
373 acpi_os_read_memory((acpi_physical_address)
374 address +
375 index *
376 ACPI_DIV_8
377 (access_width),
378 &value64,
379 access_width);
380 old_value32 = (u32)value64;
381
382 /*
383 * Use offset style bit masks because access_width is
384 * ensured to be less than 32-bits by
385 * acpi_hw_validate_register() and bit_offset/bit_width is
386 * less than access_width here.
387 */
388 if (bit_offset) {
389 old_value32 &=
390 ACPI_MASK_BITS_ABOVE
391 (bit_offset);
392 bit_offset = 0;
393 }
394 if (bit_width < access_width) {
395 old_value32 &=
396 ACPI_MASK_BITS_BELOW
397 (bit_width);
398 }
399
400 new_value32 |= old_value32;
401 }
402
403 value64 = (u64)new_value32;
404 status =
405 acpi_os_write_memory((acpi_physical_address)
406 address +
407 index *
408 ACPI_DIV_8
409 (access_width),
410 value64, access_width);
411 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
412
413 if (bit_offset || bit_width < access_width) {
414 /*
415 * Read old values in order not to modify the bits that
416 * are beyond the register bit_width/bit_offset setting.
417 */
418 status =
419 acpi_hw_read_port((acpi_io_address)
420 address +
421 index *
422 ACPI_DIV_8
423 (access_width),
424 &old_value32,
425 access_width);
426
427 /*
428 * Use offset style bit masks because access_width is
429 * ensured to be less than 32-bits by
430 * acpi_hw_validate_register() and bit_offset/bit_width is
431 * less than access_width here.
432 */
433 if (bit_offset) {
434 old_value32 &=
435 ACPI_MASK_BITS_ABOVE
436 (bit_offset);
437 bit_offset = 0;
438 }
439 if (bit_width < access_width) {
440 old_value32 &=
441 ACPI_MASK_BITS_BELOW
442 (bit_width);
443 }
444
445 new_value32 |= old_value32;
446 }
447
448 status = acpi_hw_write_port((acpi_io_address)
449 address +
450 index *
451 ACPI_DIV_8
452 (access_width),
453 new_value32,
454 access_width);
455 }
456 }
457
458 /*
459 * Index * access_width is ensured to be less than 32-bits by
460 * acpi_hw_validate_register().
461 */
462 bit_width -=
463 bit_width > access_width ? access_width : bit_width;
464 index++;
238 } 465 }
239 466
240 ACPI_DEBUG_PRINT((ACPI_DB_IO, 467 ACPI_DEBUG_PRINT((ACPI_DB_IO,
241 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", 468 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
242 value, reg->bit_width, ACPI_FORMAT_UINT64(address), 469 value, access_width, ACPI_FORMAT_UINT64(address),
243 acpi_ut_get_region_name(reg->space_id))); 470 acpi_ut_get_region_name(reg->space_id)));
244 471
245 return (status); 472 return (status);
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index a01ddb393a55..98c26ff39409 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -91,10 +91,9 @@ acpi_status acpi_reset(void)
91 * compatibility with other ACPI implementations that have allowed 91 * compatibility with other ACPI implementations that have allowed
92 * BIOS code with bad register width values to go unnoticed. 92 * BIOS code with bad register width values to go unnoticed.
93 */ 93 */
94 status = 94 status = acpi_os_write_port((acpi_io_address)reset_reg->address,
95 acpi_os_write_port((acpi_io_address) reset_reg->address, 95 acpi_gbl_FADT.reset_value,
96 acpi_gbl_FADT.reset_value, 96 ACPI_RESET_REGISTER_WIDTH);
97 ACPI_RESET_REGISTER_WIDTH);
98 } else { 97 } else {
99 /* Write the reset value to the reset register */ 98 /* Write the reset value to the reset register */
100 99
@@ -504,9 +503,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
504 * Evaluate the \_Sx namespace object containing the register values 503 * Evaluate the \_Sx namespace object containing the register values
505 * for this state 504 * for this state
506 */ 505 */
507 info->relative_pathname = ACPI_CAST_PTR(char, 506 info->relative_pathname = acpi_gbl_sleep_state_names[sleep_state];
508 acpi_gbl_sleep_state_names
509 [sleep_state]);
510 507
511 status = acpi_ns_evaluate(info); 508 status = acpi_ns_evaluate(info);
512 if (ACPI_FAILURE(status)) { 509 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 697af810e5ad..426a6307eafa 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -107,9 +107,10 @@ acpi_status acpi_ns_root_initialize(void)
107 continue; 107 continue;
108 } 108 }
109 109
110 status = acpi_ns_lookup(NULL, init_val->name, init_val->type, 110 status =
111 ACPI_IMODE_LOAD_PASS2, 111 acpi_ns_lookup(NULL, (char *)init_val->name, init_val->type,
112 ACPI_NS_NO_UPSEARCH, NULL, &new_node); 112 ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
113 NULL, &new_node);
113 if (ACPI_FAILURE(status)) { 114 if (ACPI_FAILURE(status)) {
114 ACPI_EXCEPTION((AE_INFO, status, 115 ACPI_EXCEPTION((AE_INFO, status,
115 "Could not create predefined name %s", 116 "Could not create predefined name %s",
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c
index 878e8fb6a64c..c803bda7915c 100644
--- a/drivers/acpi/acpica/nsconvert.c
+++ b/drivers/acpi/acpica/nsconvert.c
@@ -79,7 +79,8 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
79 /* String-to-Integer conversion */ 79 /* String-to-Integer conversion */
80 80
81 status = acpi_ut_strtoul64(original_object->string.pointer, 81 status = acpi_ut_strtoul64(original_object->string.pointer,
82 ACPI_ANY_BASE, &value); 82 ACPI_ANY_BASE,
83 acpi_gbl_integer_byte_width, &value);
83 if (ACPI_FAILURE(status)) { 84 if (ACPI_FAILURE(status)) {
84 return (status); 85 return (status);
85 } 86 }
@@ -317,7 +318,7 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
317 ******************************************************************************/ 318 ******************************************************************************/
318 319
319acpi_status 320acpi_status
320acpi_ns_convert_to_unicode(struct acpi_namespace_node * scope, 321acpi_ns_convert_to_unicode(struct acpi_namespace_node *scope,
321 union acpi_operand_object *original_object, 322 union acpi_operand_object *original_object,
322 union acpi_operand_object **return_object) 323 union acpi_operand_object **return_object)
323{ 324{
@@ -384,7 +385,7 @@ acpi_ns_convert_to_unicode(struct acpi_namespace_node * scope,
384 ******************************************************************************/ 385 ******************************************************************************/
385 386
386acpi_status 387acpi_status
387acpi_ns_convert_to_resource(struct acpi_namespace_node * scope, 388acpi_ns_convert_to_resource(struct acpi_namespace_node *scope,
388 union acpi_operand_object *original_object, 389 union acpi_operand_object *original_object,
389 union acpi_operand_object **return_object) 390 union acpi_operand_object **return_object)
390{ 391{
@@ -463,7 +464,7 @@ acpi_ns_convert_to_resource(struct acpi_namespace_node * scope,
463 ******************************************************************************/ 464 ******************************************************************************/
464 465
465acpi_status 466acpi_status
466acpi_ns_convert_to_reference(struct acpi_namespace_node * scope, 467acpi_ns_convert_to_reference(struct acpi_namespace_node *scope,
467 union acpi_operand_object *original_object, 468 union acpi_operand_object *original_object,
468 union acpi_operand_object **return_object) 469 union acpi_operand_object **return_object)
469{ 470{
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index af236e348294..ce1f8605d996 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -81,7 +81,7 @@ acpi_ns_get_max_depth(acpi_handle obj_handle,
81 * 81 *
82 ******************************************************************************/ 82 ******************************************************************************/
83 83
84void acpi_ns_print_pathname(u32 num_segments, char *pathname) 84void acpi_ns_print_pathname(u32 num_segments, const char *pathname)
85{ 85{
86 u32 i; 86 u32 i;
87 87
@@ -114,6 +114,9 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
114 acpi_os_printf("]\n"); 114 acpi_os_printf("]\n");
115} 115}
116 116
117#ifdef ACPI_OBSOLETE_FUNCTIONS
118/* Not used at this time, perhaps later */
119
117/******************************************************************************* 120/*******************************************************************************
118 * 121 *
119 * FUNCTION: acpi_ns_dump_pathname 122 * FUNCTION: acpi_ns_dump_pathname
@@ -131,7 +134,8 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
131 ******************************************************************************/ 134 ******************************************************************************/
132 135
133void 136void
134acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) 137acpi_ns_dump_pathname(acpi_handle handle,
138 const char *msg, u32 level, u32 component)
135{ 139{
136 140
137 ACPI_FUNCTION_TRACE(ns_dump_pathname); 141 ACPI_FUNCTION_TRACE(ns_dump_pathname);
@@ -148,6 +152,7 @@ acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
148 acpi_os_printf("\n"); 152 acpi_os_printf("\n");
149 return_VOID; 153 return_VOID;
150} 154}
155#endif
151 156
152/******************************************************************************* 157/*******************************************************************************
153 * 158 *
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index d4aa8b696ee9..36643a8cf65a 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -140,6 +140,7 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
140{ 140{
141 acpi_status status = AE_OK; 141 acpi_status status = AE_OK;
142 struct acpi_device_walk_info info; 142 struct acpi_device_walk_info info;
143 acpi_handle handle;
143 144
144 ACPI_FUNCTION_TRACE(ns_initialize_devices); 145 ACPI_FUNCTION_TRACE(ns_initialize_devices);
145 146
@@ -190,6 +191,27 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
190 if (ACPI_SUCCESS(status)) { 191 if (ACPI_SUCCESS(status)) {
191 info.num_INI++; 192 info.num_INI++;
192 } 193 }
194
195 /*
196 * Execute \_SB._INI.
197 * There appears to be a strict order requirement for \_SB._INI,
198 * which should be evaluated before any _REG evaluations.
199 */
200 status = acpi_get_handle(NULL, "\\_SB", &handle);
201 if (ACPI_SUCCESS(status)) {
202 memset(info.evaluate_info, 0,
203 sizeof(struct acpi_evaluate_info));
204 info.evaluate_info->prefix_node = handle;
205 info.evaluate_info->relative_pathname =
206 METHOD_NAME__INI;
207 info.evaluate_info->parameters = NULL;
208 info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
209
210 status = acpi_ns_evaluate(info.evaluate_info);
211 if (ACPI_SUCCESS(status)) {
212 info.num_INI++;
213 }
214 }
193 } 215 }
194 216
195 /* 217 /*
@@ -198,6 +220,12 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
198 * Note: Any objects accessed by the _REG methods will be automatically 220 * Note: Any objects accessed by the _REG methods will be automatically
199 * initialized, even if they contain executable AML (see the call to 221 * initialized, even if they contain executable AML (see the call to
200 * acpi_ns_initialize_objects below). 222 * acpi_ns_initialize_objects below).
223 *
224 * Note: According to the ACPI specification, we actually needn't execute
225 * _REG for system_memory/system_io operation regions, but for PCI_Config
226 * operation regions, it is required to evaluate _REG for those on a PCI
227 * root bus that doesn't contain _BBN object. So this code is kept here
228 * in order not to break things.
201 */ 229 */
202 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { 230 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
203 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 231 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -592,33 +620,37 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
592 * Note: We know there is an _INI within this subtree, but it may not be 620 * Note: We know there is an _INI within this subtree, but it may not be
593 * under this particular device, it may be lower in the branch. 621 * under this particular device, it may be lower in the branch.
594 */ 622 */
595 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname 623 if (!ACPI_COMPARE_NAME(device_node->name.ascii, "_SB_") ||
596 (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); 624 device_node->parent != acpi_gbl_root_node) {
597 625 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
598 memset(info, 0, sizeof(struct acpi_evaluate_info)); 626 (ACPI_TYPE_METHOD, device_node,
599 info->prefix_node = device_node; 627 METHOD_NAME__INI));
600 info->relative_pathname = METHOD_NAME__INI; 628
601 info->parameters = NULL; 629 memset(info, 0, sizeof(struct acpi_evaluate_info));
602 info->flags = ACPI_IGNORE_RETURN_VALUE; 630 info->prefix_node = device_node;
603 631 info->relative_pathname = METHOD_NAME__INI;
604 status = acpi_ns_evaluate(info); 632 info->parameters = NULL;
605 633 info->flags = ACPI_IGNORE_RETURN_VALUE;
606 if (ACPI_SUCCESS(status)) { 634
607 walk_info->num_INI++; 635 status = acpi_ns_evaluate(info);
608 } 636 if (ACPI_SUCCESS(status)) {
637 walk_info->num_INI++;
638 }
609#ifdef ACPI_DEBUG_OUTPUT 639#ifdef ACPI_DEBUG_OUTPUT
610 else if (status != AE_NOT_FOUND) { 640 else if (status != AE_NOT_FOUND) {
611 641
612 /* Ignore error and move on to next device */ 642 /* Ignore error and move on to next device */
613 643
614 char *scope_name = 644 char *scope_name =
615 acpi_ns_get_normalized_pathname(device_node, TRUE); 645 acpi_ns_get_normalized_pathname(device_node, TRUE);
616 646
617 ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", 647 ACPI_EXCEPTION((AE_INFO, status,
618 scope_name)); 648 "during %s._INI execution",
619 ACPI_FREE(scope_name); 649 scope_name));
620 } 650 ACPI_FREE(scope_name);
651 }
621#endif 652#endif
653 }
622 654
623 /* Ignore errors from above */ 655 /* Ignore errors from above */
624 656
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index 75cdb8790d49..b5e2b0ada0ab 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -123,8 +123,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
123 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 123 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
124 acpi_ns_delete_namespace_by_owner(acpi_gbl_root_table_list. 124 acpi_ns_delete_namespace_by_owner(acpi_gbl_root_table_list.
125 tables[table_index].owner_id); 125 tables[table_index].owner_id);
126 acpi_tb_release_owner_id(table_index);
127 126
127 acpi_tb_release_owner_id(table_index);
128 return_ACPI_STATUS(status); 128 return_ACPI_STATUS(status);
129 } 129 }
130 130
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index eb6e1b88a51d..f03dd41e86d0 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -113,7 +113,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
113 113
114acpi_status 114acpi_status
115acpi_ns_handle_to_pathname(acpi_handle target_handle, 115acpi_ns_handle_to_pathname(acpi_handle target_handle,
116 struct acpi_buffer * buffer, u8 no_trailing) 116 struct acpi_buffer *buffer, u8 no_trailing)
117{ 117{
118 acpi_status status; 118 acpi_status status;
119 struct acpi_namespace_node *node; 119 struct acpi_namespace_node *node;
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index 051306f0d0d6..cfa2bb7162d8 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -399,7 +399,7 @@ acpi_ns_attach_data(struct acpi_namespace_node *node,
399 ******************************************************************************/ 399 ******************************************************************************/
400 400
401acpi_status 401acpi_status
402acpi_ns_detach_data(struct acpi_namespace_node * node, 402acpi_ns_detach_data(struct acpi_namespace_node *node,
403 acpi_object_handler handler) 403 acpi_object_handler handler)
404{ 404{
405 union acpi_operand_object *obj_desc; 405 union acpi_operand_object *obj_desc;
@@ -444,7 +444,7 @@ acpi_ns_detach_data(struct acpi_namespace_node * node,
444 ******************************************************************************/ 444 ******************************************************************************/
445 445
446acpi_status 446acpi_status
447acpi_ns_get_attached_data(struct acpi_namespace_node * node, 447acpi_ns_get_attached_data(struct acpi_namespace_node *node,
448 acpi_object_handler handler, void **data) 448 acpi_object_handler handler, void **data)
449{ 449{
450 union acpi_operand_object *obj_desc; 450 union acpi_operand_object *obj_desc;
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c
index 9047f2808d5b..fbedc6e8ab36 100644
--- a/drivers/acpi/acpica/nsprepkg.c
+++ b/drivers/acpi/acpica/nsprepkg.c
@@ -62,6 +62,10 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
62 u32 count1, 62 u32 count1,
63 u8 type2, u32 count2, u32 start_index); 63 u8 type2, u32 count2, u32 start_index);
64 64
65static acpi_status
66acpi_ns_custom_package(struct acpi_evaluate_info *info,
67 union acpi_operand_object **elements, u32 count);
68
65/******************************************************************************* 69/*******************************************************************************
66 * 70 *
67 * FUNCTION: acpi_ns_check_package 71 * FUNCTION: acpi_ns_check_package
@@ -135,6 +139,11 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
135 * PTYPE2 packages contain subpackages 139 * PTYPE2 packages contain subpackages
136 */ 140 */
137 switch (package->ret_info.type) { 141 switch (package->ret_info.type) {
142 case ACPI_PTYPE_CUSTOM:
143
144 status = acpi_ns_custom_package(info, elements, count);
145 break;
146
138 case ACPI_PTYPE1_FIXED: 147 case ACPI_PTYPE1_FIXED:
139 /* 148 /*
140 * The package count is fixed and there are no subpackages 149 * The package count is fixed and there are no subpackages
@@ -179,6 +188,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
179 if (ACPI_FAILURE(status)) { 188 if (ACPI_FAILURE(status)) {
180 return (status); 189 return (status);
181 } 190 }
191
182 elements++; 192 elements++;
183 } 193 }
184 break; 194 break;
@@ -225,6 +235,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
225 return (status); 235 return (status);
226 } 236 }
227 } 237 }
238
228 elements++; 239 elements++;
229 } 240 }
230 break; 241 break;
@@ -569,11 +580,13 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info,
569 if (sub_package->package.count < expected_count) { 580 if (sub_package->package.count < expected_count) {
570 goto package_too_small; 581 goto package_too_small;
571 } 582 }
583
572 if (sub_package->package.count < 584 if (sub_package->package.count <
573 package->ret_info.count1) { 585 package->ret_info.count1) {
574 expected_count = package->ret_info.count1; 586 expected_count = package->ret_info.count1;
575 goto package_too_small; 587 goto package_too_small;
576 } 588 }
589
577 if (expected_count == 0) { 590 if (expected_count == 0) {
578 /* 591 /*
579 * Either the num_entries element was originally zero or it was 592 * Either the num_entries element was originally zero or it was
@@ -622,6 +635,83 @@ package_too_small:
622 635
623/******************************************************************************* 636/*******************************************************************************
624 * 637 *
638 * FUNCTION: acpi_ns_custom_package
639 *
640 * PARAMETERS: info - Method execution information block
641 * elements - Pointer to the package elements array
642 * count - Element count for the package
643 *
644 * RETURN: Status
645 *
646 * DESCRIPTION: Check a returned package object for the correct count and
647 * correct type of all sub-objects.
648 *
649 * NOTE: Currently used for the _BIX method only. When needed for two or more
650 * methods, probably a detect/dispatch mechanism will be required.
651 *
652 ******************************************************************************/
653
654static acpi_status
655acpi_ns_custom_package(struct acpi_evaluate_info *info,
656 union acpi_operand_object **elements, u32 count)
657{
658 u32 expected_count;
659 u32 version;
660 acpi_status status = AE_OK;
661
662 ACPI_FUNCTION_NAME(ns_custom_package);
663
664 /* Get version number, must be Integer */
665
666 if ((*elements)->common.type != ACPI_TYPE_INTEGER) {
667 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
668 info->node_flags,
669 "Return Package has invalid object type for version number"));
670 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
671 }
672
673 version = (u32)(*elements)->integer.value;
674 expected_count = 21; /* Version 1 */
675
676 if (version == 0) {
677 expected_count = 20; /* Version 0 */
678 }
679
680 if (count < expected_count) {
681 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
682 info->node_flags,
683 "Return Package is too small - found %u elements, expected %u",
684 count, expected_count));
685 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
686 } else if (count > expected_count) {
687 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
688 "%s: Return Package is larger than needed - "
689 "found %u, expected %u\n",
690 info->full_pathname, count, expected_count));
691 }
692
693 /* Validate all elements of the returned package */
694
695 status = acpi_ns_check_package_elements(info, elements,
696 ACPI_RTYPE_INTEGER, 16,
697 ACPI_RTYPE_STRING, 4, 0);
698 if (ACPI_FAILURE(status)) {
699 return_ACPI_STATUS(status);
700 }
701
702 /* Version 1 has a single trailing integer */
703
704 if (version > 0) {
705 status = acpi_ns_check_package_elements(info, elements + 20,
706 ACPI_RTYPE_INTEGER, 1,
707 0, 0, 20);
708 }
709
710 return_ACPI_STATUS(status);
711}
712
713/*******************************************************************************
714 *
625 * FUNCTION: acpi_ns_check_package_elements 715 * FUNCTION: acpi_ns_check_package_elements
626 * 716 *
627 * PARAMETERS: info - Method execution information block 717 * PARAMETERS: info - Method execution information block
@@ -661,6 +751,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
661 if (ACPI_FAILURE(status)) { 751 if (ACPI_FAILURE(status)) {
662 return (status); 752 return (status);
663 } 753 }
754
664 this_element++; 755 this_element++;
665 } 756 }
666 757
@@ -671,6 +762,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
671 if (ACPI_FAILURE(status)) { 762 if (ACPI_FAILURE(status)) {
672 return (status); 763 return (status);
673 } 764 }
765
674 this_element++; 766 this_element++;
675 } 767 }
676 768
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index 805e36de8707..9523d41c7ae9 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -399,7 +399,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
399 ******************************************************************************/ 399 ******************************************************************************/
400 400
401acpi_status 401acpi_status
402acpi_ns_repair_null_element(struct acpi_evaluate_info * info, 402acpi_ns_repair_null_element(struct acpi_evaluate_info *info,
403 u32 expected_btypes, 403 u32 expected_btypes,
404 u32 package_index, 404 u32 package_index,
405 union acpi_operand_object **return_object_ptr) 405 union acpi_operand_object **return_object_ptr)
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 63edbbbf9ae4..d5336122486b 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -54,9 +54,9 @@ 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_evaluate_info * info, 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
61typedef struct acpi_repair_info { 61typedef struct acpi_repair_info {
62 char name[ACPI_NAME_SIZE]; 62 char name[ACPI_NAME_SIZE];
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index c72cc62b92d0..784a30b76e0f 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -272,11 +272,11 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
272 result = &internal_name[i]; 272 result = &internal_name[i];
273 } else if (num_segments == 2) { 273 } else if (num_segments == 2) {
274 internal_name[i] = AML_DUAL_NAME_PREFIX; 274 internal_name[i] = AML_DUAL_NAME_PREFIX;
275 result = &internal_name[(acpi_size) i + 1]; 275 result = &internal_name[(acpi_size)i + 1];
276 } else { 276 } else {
277 internal_name[i] = AML_MULTI_NAME_PREFIX_OP; 277 internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
278 internal_name[(acpi_size) i + 1] = (char)num_segments; 278 internal_name[(acpi_size)i + 1] = (char)num_segments;
279 result = &internal_name[(acpi_size) i + 2]; 279 result = &internal_name[(acpi_size)i + 2];
280 } 280 }
281 } 281 }
282 282
@@ -456,7 +456,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
456 456
457 names_index = prefix_length + 2; 457 names_index = prefix_length + 2;
458 num_segments = (u8) 458 num_segments = (u8)
459 internal_name[(acpi_size) prefix_length + 1]; 459 internal_name[(acpi_size)prefix_length + 1];
460 break; 460 break;
461 461
462 case AML_DUAL_NAME_PREFIX: 462 case AML_DUAL_NAME_PREFIX:
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index a7deeaa8eddc..d2a9b4fd739f 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -256,7 +256,7 @@ acpi_evaluate_object(acpi_handle handle,
256 * Allocate a new parameter block for the internal objects 256 * Allocate a new parameter block for the internal objects
257 * Add 1 to count to allow for null terminated internal list 257 * Add 1 to count to allow for null terminated internal list
258 */ 258 */
259 info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) info-> 259 info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)info->
260 param_count + 260 param_count +
261 1) * sizeof(void *)); 261 1) * sizeof(void *));
262 if (!info->parameters) { 262 if (!info->parameters) {
@@ -280,13 +280,12 @@ acpi_evaluate_object(acpi_handle handle,
280 info->parameters[info->param_count] = NULL; 280 info->parameters[info->param_count] = NULL;
281 } 281 }
282 282
283#if 0 283#ifdef _FUTURE_FEATURE
284 284
285 /* 285 /*
286 * Begin incoming argument count analysis. Check for too few args 286 * Begin incoming argument count analysis. Check for too few args
287 * and too many args. 287 * and too many args.
288 */ 288 */
289
290 switch (acpi_ns_get_type(info->node)) { 289 switch (acpi_ns_get_type(info->node)) {
291 case ACPI_TYPE_METHOD: 290 case ACPI_TYPE_METHOD:
292 291
@@ -370,68 +369,68 @@ acpi_evaluate_object(acpi_handle handle,
370 * If we are expecting a return value, and all went well above, 369 * If we are expecting a return value, and all went well above,
371 * copy the return value to an external object. 370 * copy the return value to an external object.
372 */ 371 */
373 if (return_buffer) { 372 if (!return_buffer) {
374 if (!info->return_object) { 373 goto cleanup_return_object;
375 return_buffer->length = 0; 374 }
376 } else {
377 if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==
378 ACPI_DESC_TYPE_NAMED) {
379 /*
380 * If we received a NS Node as a return object, this means that
381 * the object we are evaluating has nothing interesting to
382 * return (such as a mutex, etc.) We return an error because
383 * these types are essentially unsupported by this interface.
384 * We don't check up front because this makes it easier to add
385 * support for various types at a later date if necessary.
386 */
387 status = AE_TYPE;
388 info->return_object = NULL; /* No need to delete a NS Node */
389 return_buffer->length = 0;
390 }
391 375
392 if (ACPI_SUCCESS(status)) { 376 if (!info->return_object) {
377 return_buffer->length = 0;
378 goto cleanup;
379 }
393 380
394 /* Dereference Index and ref_of references */ 381 if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==
382 ACPI_DESC_TYPE_NAMED) {
383 /*
384 * If we received a NS Node as a return object, this means that
385 * the object we are evaluating has nothing interesting to
386 * return (such as a mutex, etc.) We return an error because
387 * these types are essentially unsupported by this interface.
388 * We don't check up front because this makes it easier to add
389 * support for various types at a later date if necessary.
390 */
391 status = AE_TYPE;
392 info->return_object = NULL; /* No need to delete a NS Node */
393 return_buffer->length = 0;
394 }
395 395
396 acpi_ns_resolve_references(info); 396 if (ACPI_FAILURE(status)) {
397 goto cleanup_return_object;
398 }
397 399
398 /* Get the size of the returned object */ 400 /* Dereference Index and ref_of references */
399 401
400 status = 402 acpi_ns_resolve_references(info);
401 acpi_ut_get_object_size(info->return_object, 403
402 &buffer_space_needed); 404 /* Get the size of the returned object */
403 if (ACPI_SUCCESS(status)) { 405
404 406 status = acpi_ut_get_object_size(info->return_object,
405 /* Validate/Allocate/Clear caller buffer */ 407 &buffer_space_needed);
406 408 if (ACPI_SUCCESS(status)) {
407 status = 409
408 acpi_ut_initialize_buffer 410 /* Validate/Allocate/Clear caller buffer */
409 (return_buffer, 411
410 buffer_space_needed); 412 status = acpi_ut_initialize_buffer(return_buffer,
411 if (ACPI_FAILURE(status)) { 413 buffer_space_needed);
412 /* 414 if (ACPI_FAILURE(status)) {
413 * Caller's buffer is too small or a new one can't 415 /*
414 * be allocated 416 * Caller's buffer is too small or a new one can't
415 */ 417 * be allocated
416 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 418 */
417 "Needed buffer size %X, %s\n", 419 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
418 (u32) 420 "Needed buffer size %X, %s\n",
419 buffer_space_needed, 421 (u32)buffer_space_needed,
420 acpi_format_exception 422 acpi_format_exception(status)));
421 (status))); 423 } else {
422 } else { 424 /* We have enough space for the object, build it */
423 /* We have enough space for the object, build it */ 425
424 426 status =
425 status = 427 acpi_ut_copy_iobject_to_eobject(info->return_object,
426 acpi_ut_copy_iobject_to_eobject 428 return_buffer);
427 (info->return_object,
428 return_buffer);
429 }
430 }
431 }
432 } 429 }
433 } 430 }
434 431
432cleanup_return_object:
433
435 if (info->return_object) { 434 if (info->return_object) {
436 /* 435 /*
437 * Delete the internal return object. NOTE: Interpreter must be 436 * Delete the internal return object. NOTE: Interpreter must be
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index 285b82044e7b..76a1bd4bb070 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -78,7 +78,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
78 78
79acpi_status 79acpi_status
80acpi_get_handle(acpi_handle parent, 80acpi_get_handle(acpi_handle parent,
81 acpi_string pathname, acpi_handle * ret_handle) 81 acpi_string pathname, acpi_handle *ret_handle)
82{ 82{
83 acpi_status status; 83 acpi_status status;
84 struct acpi_namespace_node *node = NULL; 84 struct acpi_namespace_node *node = NULL;
@@ -155,7 +155,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_handle)
155 * 155 *
156 ******************************************************************************/ 156 ******************************************************************************/
157acpi_status 157acpi_status
158acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) 158acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer *buffer)
159{ 159{
160 acpi_status status; 160 acpi_status status;
161 struct acpi_namespace_node *node; 161 struct acpi_namespace_node *node;
@@ -448,7 +448,7 @@ acpi_get_object_info(acpi_handle handle,
448 /* Point past the CID PNP_DEVICE_ID array */ 448 /* Point past the CID PNP_DEVICE_ID array */
449 449
450 next_id_string += 450 next_id_string +=
451 ((acpi_size) cid_list->count * 451 ((acpi_size)cid_list->count *
452 sizeof(struct acpi_pnp_device_id)); 452 sizeof(struct acpi_pnp_device_id));
453 } 453 }
454 454
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index c312cd490450..32d372b85243 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -63,7 +63,7 @@ ACPI_MODULE_NAME("nsxfobj")
63 * DESCRIPTION: This routine returns the type associatd with a particular handle 63 * DESCRIPTION: This routine returns the type associatd with a particular handle
64 * 64 *
65 ******************************************************************************/ 65 ******************************************************************************/
66acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) 66acpi_status acpi_get_type(acpi_handle handle, acpi_object_type *ret_type)
67{ 67{
68 struct acpi_namespace_node *node; 68 struct acpi_namespace_node *node;
69 acpi_status status; 69 acpi_status status;
@@ -115,7 +115,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_type)
115 * Handle. 115 * Handle.
116 * 116 *
117 ******************************************************************************/ 117 ******************************************************************************/
118acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) 118acpi_status acpi_get_parent(acpi_handle handle, acpi_handle *ret_handle)
119{ 119{
120 struct acpi_namespace_node *node; 120 struct acpi_namespace_node *node;
121 struct acpi_namespace_node *parent_node; 121 struct acpi_namespace_node *parent_node;
@@ -183,7 +183,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_parent)
183acpi_status 183acpi_status
184acpi_get_next_object(acpi_object_type type, 184acpi_get_next_object(acpi_object_type type,
185 acpi_handle parent, 185 acpi_handle parent,
186 acpi_handle child, acpi_handle * ret_handle) 186 acpi_handle child, acpi_handle *ret_handle)
187{ 187{
188 acpi_status status; 188 acpi_status status;
189 struct acpi_namespace_node *node; 189 struct acpi_namespace_node *node;
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index d48cbed342c1..c29c930ffa08 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -87,7 +87,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
87 * used to encode the package length, either 0,1,2, or 3 87 * used to encode the package length, either 0,1,2, or 3
88 */ 88 */
89 byte_count = (aml[0] >> 6); 89 byte_count = (aml[0] >> 6);
90 parser_state->aml += ((acpi_size) byte_count + 1); 90 parser_state->aml += ((acpi_size)byte_count + 1);
91 91
92 /* Get bytes 3, 2, 1 as needed */ 92 /* Get bytes 3, 2, 1 as needed */
93 93
diff --git a/drivers/acpi/acpica/psopinfo.c b/drivers/acpi/acpica/psopinfo.c
index cfd17a4f2e91..177b05b239b7 100644
--- a/drivers/acpi/acpica/psopinfo.c
+++ b/drivers/acpi/acpica/psopinfo.c
@@ -158,7 +158,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
158 * 158 *
159 ******************************************************************************/ 159 ******************************************************************************/
160 160
161char *acpi_ps_get_opcode_name(u16 opcode) 161const char *acpi_ps_get_opcode_name(u16 opcode)
162{ 162{
163#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) 163#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
164 164
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 8038ed2aca05..0a23897d8adf 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -130,8 +130,8 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
130 ******************************************************************************/ 130 ******************************************************************************/
131 131
132acpi_status 132acpi_status
133acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, 133acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,
134 union acpi_parse_object * op) 134 union acpi_parse_object *op)
135{ 135{
136 union acpi_parse_object *prev; 136 union acpi_parse_object *prev;
137 union acpi_parse_object *next; 137 union acpi_parse_object *next;
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index b28b0da171b6..89cb4bffcc7c 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -128,7 +128,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode, u8 *aml)
128 if (op_info->flags & AML_DEFER) { 128 if (op_info->flags & AML_DEFER) {
129 flags = ACPI_PARSEOP_DEFERRED; 129 flags = ACPI_PARSEOP_DEFERRED;
130 } else if (op_info->flags & AML_NAMED) { 130 } else if (op_info->flags & AML_NAMED) {
131 flags = ACPI_PARSEOP_NAMED; 131 flags = ACPI_PARSEOP_NAMED_OBJECT;
132 } else if (opcode == AML_INT_BYTELIST_OP) { 132 } else if (opcode == AML_INT_BYTELIST_OP) {
133 flags = ACPI_PARSEOP_BYTELIST; 133 flags = ACPI_PARSEOP_BYTELIST;
134 } 134 }
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index 04b37fcca684..cf30cd821f5e 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -115,7 +115,7 @@ acpi_debug_trace(const char *name, u32 debug_level, u32 debug_layer, u32 flags)
115 * 115 *
116 ******************************************************************************/ 116 ******************************************************************************/
117 117
118acpi_status acpi_ps_execute_method(struct acpi_evaluate_info * info) 118acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
119{ 119{
120 acpi_status status; 120 acpi_status status;
121 union acpi_parse_object *op; 121 union acpi_parse_object *op;
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 2b1209d73e44..f1e83addd5b4 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -112,7 +112,7 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
112 * resource_source_index (1). 112 * resource_source_index (1).
113 */ 113 */
114 if (resource_source->string_ptr) { 114 if (resource_source->string_ptr) {
115 return ((acpi_rs_length) (resource_source->string_length + 1)); 115 return ((acpi_rs_length)(resource_source->string_length + 1));
116 } 116 }
117 117
118 return (0); 118 return (0);
@@ -188,7 +188,7 @@ acpi_rs_stream_option_length(u32 resource_length,
188 188
189acpi_status 189acpi_status
190acpi_rs_get_aml_length(struct acpi_resource *resource, 190acpi_rs_get_aml_length(struct acpi_resource *resource,
191 acpi_size resource_list_size, acpi_size * size_needed) 191 acpi_size resource_list_size, acpi_size *size_needed)
192{ 192{
193 acpi_size aml_size_needed = 0; 193 acpi_size aml_size_needed = 0;
194 struct acpi_resource *resource_end; 194 struct acpi_resource *resource_end;
@@ -278,11 +278,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
278 * 16-Bit Address Resource: 278 * 16-Bit Address Resource:
279 * Add the size of the optional resource_source info 279 * Add the size of the optional resource_source info
280 */ 280 */
281 total_size = (acpi_rs_length) (total_size + 281 total_size = (acpi_rs_length)(total_size +
282 acpi_rs_struct_option_length 282 acpi_rs_struct_option_length
283 (&resource->data. 283 (&resource->data.
284 address16. 284 address16.
285 resource_source)); 285 resource_source));
286 break; 286 break;
287 287
288 case ACPI_RESOURCE_TYPE_ADDRESS32: 288 case ACPI_RESOURCE_TYPE_ADDRESS32:
@@ -290,11 +290,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
290 * 32-Bit Address Resource: 290 * 32-Bit Address Resource:
291 * Add the size of the optional resource_source info 291 * Add the size of the optional resource_source info
292 */ 292 */
293 total_size = (acpi_rs_length) (total_size + 293 total_size = (acpi_rs_length)(total_size +
294 acpi_rs_struct_option_length 294 acpi_rs_struct_option_length
295 (&resource->data. 295 (&resource->data.
296 address32. 296 address32.
297 resource_source)); 297 resource_source));
298 break; 298 break;
299 299
300 case ACPI_RESOURCE_TYPE_ADDRESS64: 300 case ACPI_RESOURCE_TYPE_ADDRESS64:
@@ -302,11 +302,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
302 * 64-Bit Address Resource: 302 * 64-Bit Address Resource:
303 * Add the size of the optional resource_source info 303 * Add the size of the optional resource_source info
304 */ 304 */
305 total_size = (acpi_rs_length) (total_size + 305 total_size = (acpi_rs_length)(total_size +
306 acpi_rs_struct_option_length 306 acpi_rs_struct_option_length
307 (&resource->data. 307 (&resource->data.
308 address64. 308 address64.
309 resource_source)); 309 resource_source));
310 break; 310 break;
311 311
312 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: 312 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
@@ -315,28 +315,28 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
315 * Add the size of each additional optional interrupt beyond the 315 * Add the size of each additional optional interrupt beyond the
316 * required 1 (4 bytes for each u32 interrupt number) 316 * required 1 (4 bytes for each u32 interrupt number)
317 */ 317 */
318 total_size = (acpi_rs_length) (total_size + 318 total_size = (acpi_rs_length)(total_size +
319 ((resource->data. 319 ((resource->data.
320 extended_irq.
321 interrupt_count -
322 1) * 4) +
323 /* Add the size of the optional resource_source info */
324 acpi_rs_struct_option_length
325 (&resource->data.
326 extended_irq. 320 extended_irq.
327 resource_source)); 321 interrupt_count -
322 1) * 4) +
323 /* Add the size of the optional resource_source info */
324 acpi_rs_struct_option_length
325 (&resource->data.
326 extended_irq.
327 resource_source));
328 break; 328 break;
329 329
330 case ACPI_RESOURCE_TYPE_GPIO: 330 case ACPI_RESOURCE_TYPE_GPIO:
331 331
332 total_size = (acpi_rs_length) (total_size + 332 total_size = (acpi_rs_length)(total_size +
333 (resource->data.gpio. 333 (resource->data.gpio.
334 pin_table_length * 2) + 334 pin_table_length * 2) +
335 resource->data.gpio. 335 resource->data.gpio.
336 resource_source. 336 resource_source.
337 string_length + 337 string_length +
338 resource->data.gpio. 338 resource->data.gpio.
339 vendor_length); 339 vendor_length);
340 340
341 break; 341 break;
342 342
@@ -348,14 +348,14 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
348 common_serial_bus. 348 common_serial_bus.
349 type]; 349 type];
350 350
351 total_size = (acpi_rs_length) (total_size + 351 total_size = (acpi_rs_length)(total_size +
352 resource->data. 352 resource->data.
353 i2c_serial_bus. 353 i2c_serial_bus.
354 resource_source. 354 resource_source.
355 string_length + 355 string_length +
356 resource->data. 356 resource->data.
357 i2c_serial_bus. 357 i2c_serial_bus.
358 vendor_length); 358 vendor_length);
359 359
360 break; 360 break;
361 361
@@ -397,8 +397,8 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
397 ******************************************************************************/ 397 ******************************************************************************/
398 398
399acpi_status 399acpi_status
400acpi_rs_get_list_length(u8 * aml_buffer, 400acpi_rs_get_list_length(u8 *aml_buffer,
401 u32 aml_buffer_length, acpi_size * size_needed) 401 u32 aml_buffer_length, acpi_size *size_needed)
402{ 402{
403 acpi_status status; 403 acpi_status status;
404 u8 *end_aml; 404 u8 *end_aml;
@@ -610,7 +610,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
610 610
611acpi_status 611acpi_status
612acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, 612acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
613 acpi_size * buffer_size_needed) 613 acpi_size *buffer_size_needed)
614{ 614{
615 u32 number_of_elements; 615 u32 number_of_elements;
616 acpi_size temp_size_needed = 0; 616 acpi_size temp_size_needed = 0;
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 12978891e842..809b61c114fe 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -347,7 +347,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
347 (u8 *) output_buffer->pointer); 347 (u8 *) output_buffer->pointer);
348 path_buffer.pointer = user_prt->source; 348 path_buffer.pointer = user_prt->source;
349 349
350 status = acpi_ns_handle_to_pathname((acpi_handle) node, &path_buffer, FALSE); 350 status = acpi_ns_handle_to_pathname((acpi_handle)node, &path_buffer, FALSE);
351 351
352 /* +1 to include null terminator */ 352 /* +1 to include null terminator */
353 353
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index 23a17c86d5a9..5ffdb5602d8d 100644
--- a/drivers/acpi/acpica/rsdump.c
+++ b/drivers/acpi/acpica/rsdump.c
@@ -52,17 +52,17 @@ ACPI_MODULE_NAME("rsdump")
52 * All functions in this module are used by the AML Debugger only 52 * All functions in this module are used by the AML Debugger only
53 */ 53 */
54/* Local prototypes */ 54/* Local prototypes */
55static void acpi_rs_out_string(char *title, char *value); 55static void acpi_rs_out_string(const char *title, const char *value);
56 56
57static void acpi_rs_out_integer8(char *title, u8 value); 57static void acpi_rs_out_integer8(const char *title, u8 value);
58 58
59static void acpi_rs_out_integer16(char *title, u16 value); 59static void acpi_rs_out_integer16(const char *title, u16 value);
60 60
61static void acpi_rs_out_integer32(char *title, u32 value); 61static void acpi_rs_out_integer32(const char *title, u32 value);
62 62
63static void acpi_rs_out_integer64(char *title, u64 value); 63static void acpi_rs_out_integer64(const char *title, u64 value);
64 64
65static void acpi_rs_out_title(char *title); 65static void acpi_rs_out_title(const char *title);
66 66
67static void acpi_rs_dump_byte_list(u16 length, u8 *data); 67static void acpi_rs_dump_byte_list(u16 length, u8 *data);
68 68
@@ -208,7 +208,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
208{ 208{
209 u8 *target = NULL; 209 u8 *target = NULL;
210 u8 *previous_target; 210 u8 *previous_target;
211 char *name; 211 const char *name;
212 u8 count; 212 u8 count;
213 213
214 /* First table entry must contain the table length (# of table entries) */ 214 /* First table entry must contain the table length (# of table entries) */
@@ -248,10 +248,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
248 case ACPI_RSD_UINT8: 248 case ACPI_RSD_UINT8:
249 249
250 if (table->pointer) { 250 if (table->pointer) {
251 acpi_rs_out_string(name, ACPI_CAST_PTR(char, 251 acpi_rs_out_string(name,
252 table-> 252 table->pointer[*target]);
253 pointer
254 [*target]));
255 } else { 253 } else {
256 acpi_rs_out_integer8(name, ACPI_GET8(target)); 254 acpi_rs_out_integer8(name, ACPI_GET8(target));
257 } 255 }
@@ -276,26 +274,20 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
276 274
277 case ACPI_RSD_1BITFLAG: 275 case ACPI_RSD_1BITFLAG:
278 276
279 acpi_rs_out_string(name, ACPI_CAST_PTR(char, 277 acpi_rs_out_string(name,
280 table-> 278 table->pointer[*target & 0x01]);
281 pointer[*target &
282 0x01]));
283 break; 279 break;
284 280
285 case ACPI_RSD_2BITFLAG: 281 case ACPI_RSD_2BITFLAG:
286 282
287 acpi_rs_out_string(name, ACPI_CAST_PTR(char, 283 acpi_rs_out_string(name,
288 table-> 284 table->pointer[*target & 0x03]);
289 pointer[*target &
290 0x03]));
291 break; 285 break;
292 286
293 case ACPI_RSD_3BITFLAG: 287 case ACPI_RSD_3BITFLAG:
294 288
295 acpi_rs_out_string(name, ACPI_CAST_PTR(char, 289 acpi_rs_out_string(name,
296 table-> 290 table->pointer[*target & 0x07]);
297 pointer[*target &
298 0x07]));
299 break; 291 break;
300 292
301 case ACPI_RSD_SHORTLIST: 293 case ACPI_RSD_SHORTLIST:
@@ -481,7 +473,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
481 * 473 *
482 ******************************************************************************/ 474 ******************************************************************************/
483 475
484static void acpi_rs_out_string(char *title, char *value) 476static void acpi_rs_out_string(const char *title, const char *value)
485{ 477{
486 478
487 acpi_os_printf("%27s : %s", title, value); 479 acpi_os_printf("%27s : %s", title, value);
@@ -491,30 +483,30 @@ static void acpi_rs_out_string(char *title, char *value)
491 acpi_os_printf("\n"); 483 acpi_os_printf("\n");
492} 484}
493 485
494static void acpi_rs_out_integer8(char *title, u8 value) 486static void acpi_rs_out_integer8(const char *title, u8 value)
495{ 487{
496 acpi_os_printf("%27s : %2.2X\n", title, value); 488 acpi_os_printf("%27s : %2.2X\n", title, value);
497} 489}
498 490
499static void acpi_rs_out_integer16(char *title, u16 value) 491static void acpi_rs_out_integer16(const char *title, u16 value)
500{ 492{
501 493
502 acpi_os_printf("%27s : %4.4X\n", title, value); 494 acpi_os_printf("%27s : %4.4X\n", title, value);
503} 495}
504 496
505static void acpi_rs_out_integer32(char *title, u32 value) 497static void acpi_rs_out_integer32(const char *title, u32 value)
506{ 498{
507 499
508 acpi_os_printf("%27s : %8.8X\n", title, value); 500 acpi_os_printf("%27s : %8.8X\n", title, value);
509} 501}
510 502
511static void acpi_rs_out_integer64(char *title, u64 value) 503static void acpi_rs_out_integer64(const char *title, u64 value)
512{ 504{
513 505
514 acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); 506 acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
515} 507}
516 508
517static void acpi_rs_out_title(char *title) 509static void acpi_rs_out_title(const char *title)
518{ 510{
519 511
520 acpi_os_printf("%27s : ", title); 512 acpi_os_printf("%27s : ", title);
diff --git a/drivers/acpi/acpica/rsdumpinfo.c b/drivers/acpi/acpica/rsdumpinfo.c
index 5c3491387f9f..61e8f16c857d 100644
--- a/drivers/acpi/acpica/rsdumpinfo.c
+++ b/drivers/acpi/acpica/rsdumpinfo.c
@@ -330,19 +330,20 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
330 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \ 330 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \
331 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \ 331 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \
332 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \ 332 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \
333 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.connection_sharing),"ConnectionSharing", acpi_gbl_shr_decode}, \
333 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \ 334 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \
334 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \ 335 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \
335 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \ 336 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \
336 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \ 337 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \
337 {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL}, 338 {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL},
338 339
339struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = { 340struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[11] = {
340 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus), 341 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus),
341 "Common Serial Bus", NULL}, 342 "Common Serial Bus", NULL},
342 ACPI_RS_DUMP_COMMON_SERIAL_BUS 343 ACPI_RS_DUMP_COMMON_SERIAL_BUS
343}; 344};
344 345
345struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = { 346struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[14] = {
346 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus), 347 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus),
347 "I2C Serial Bus", NULL}, 348 "I2C Serial Bus", NULL},
348 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, 349 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
@@ -355,7 +356,7 @@ struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = {
355 "SlaveAddress", NULL}, 356 "SlaveAddress", NULL},
356}; 357};
357 358
358struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = { 359struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[18] = {
359 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus), 360 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus),
360 "Spi Serial Bus", NULL}, 361 "Spi Serial Bus", NULL},
361 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, 362 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
@@ -376,7 +377,7 @@ struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = {
376 "ConnectionSpeed", NULL}, 377 "ConnectionSpeed", NULL},
377}; 378};
378 379
379struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = { 380struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[20] = {
380 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus), 381 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus),
381 "Uart Serial Bus", NULL}, 382 "Uart Serial Bus", NULL},
382 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG, 383 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG,
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c
index ce3d0b77ec89..25165ca42051 100644
--- a/drivers/acpi/acpica/rsmisc.c
+++ b/drivers/acpi/acpica/rsmisc.c
@@ -87,7 +87,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
87 return_ACPI_STATUS(AE_BAD_PARAMETER); 87 return_ACPI_STATUS(AE_BAD_PARAMETER);
88 } 88 }
89 89
90 if (((acpi_size) resource) & 0x3) { 90 if (((acpi_size)resource) & 0x3) {
91 91
92 /* Each internal resource struct is expected to be 32-bit aligned */ 92 /* Each internal resource struct is expected to be 32-bit aligned */
93 93
diff --git a/drivers/acpi/acpica/rsserial.c b/drivers/acpi/acpica/rsserial.c
index 8a01296ac7cf..b82c061f205a 100644
--- a/drivers/acpi/acpica/rsserial.c
+++ b/drivers/acpi/acpica/rsserial.c
@@ -151,7 +151,7 @@ struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = {
151 * 151 *
152 ******************************************************************************/ 152 ******************************************************************************/
153 153
154struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = { 154struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[17] = {
155 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, 155 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
156 ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus), 156 ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
157 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)}, 157 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
@@ -177,6 +177,11 @@ struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = {
177 AML_OFFSET(common_serial_bus.flags), 177 AML_OFFSET(common_serial_bus.flags),
178 1}, 178 1},
179 179
180 {ACPI_RSC_1BITFLAG,
181 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
182 AML_OFFSET(common_serial_bus.flags),
183 2},
184
180 {ACPI_RSC_MOVE8, 185 {ACPI_RSC_MOVE8,
181 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), 186 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
182 AML_OFFSET(common_serial_bus.type_revision_id), 187 AML_OFFSET(common_serial_bus.type_revision_id),
@@ -237,7 +242,7 @@ struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = {
237 * 242 *
238 ******************************************************************************/ 243 ******************************************************************************/
239 244
240struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = { 245struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[21] = {
241 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, 246 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
242 ACPI_RS_SIZE(struct acpi_resource_spi_serialbus), 247 ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
243 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)}, 248 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
@@ -263,6 +268,11 @@ struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = {
263 AML_OFFSET(common_serial_bus.flags), 268 AML_OFFSET(common_serial_bus.flags),
264 1}, 269 1},
265 270
271 {ACPI_RSC_1BITFLAG,
272 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
273 AML_OFFSET(common_serial_bus.flags),
274 2},
275
266 {ACPI_RSC_MOVE8, 276 {ACPI_RSC_MOVE8,
267 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), 277 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
268 AML_OFFSET(common_serial_bus.type_revision_id), 278 AML_OFFSET(common_serial_bus.type_revision_id),
@@ -339,7 +349,7 @@ struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = {
339 * 349 *
340 ******************************************************************************/ 350 ******************************************************************************/
341 351
342struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[22] = { 352struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[23] = {
343 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, 353 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
344 ACPI_RS_SIZE(struct acpi_resource_uart_serialbus), 354 ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
345 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)}, 355 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
@@ -365,6 +375,11 @@ struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[22] = {
365 AML_OFFSET(common_serial_bus.flags), 375 AML_OFFSET(common_serial_bus.flags),
366 1}, 376 1},
367 377
378 {ACPI_RSC_1BITFLAG,
379 ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
380 AML_OFFSET(common_serial_bus.flags),
381 2},
382
368 {ACPI_RSC_MOVE8, 383 {ACPI_RSC_MOVE8,
369 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), 384 ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
370 AML_OFFSET(common_serial_bus.type_revision_id), 385 AML_OFFSET(common_serial_bus.type_revision_id),
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index cf06e49cd91c..fa491c64c040 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -338,7 +338,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
338 * Note: Some resource descriptors will have an additional null, so 338 * Note: Some resource descriptors will have an additional null, so
339 * we add 1 to the minimum length. 339 * we add 1 to the minimum length.
340 */ 340 */
341 if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { 341 if (total_length > (acpi_rsdesc_size)(minimum_length + 1)) {
342 342
343 /* Get the resource_source_index */ 343 /* Get the resource_source_index */
344 344
@@ -377,7 +377,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
377 ACPI_CAST_PTR(char, 377 ACPI_CAST_PTR(char,
378 &aml_resource_source[1])); 378 &aml_resource_source[1]));
379 379
380 return ((acpi_rs_length) total_length); 380 return ((acpi_rs_length)total_length);
381 } 381 }
382 382
383 /* resource_source is not present */ 383 /* resource_source is not present */
@@ -406,9 +406,9 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
406 ******************************************************************************/ 406 ******************************************************************************/
407 407
408acpi_rsdesc_size 408acpi_rsdesc_size
409acpi_rs_set_resource_source(union aml_resource * aml, 409acpi_rs_set_resource_source(union aml_resource *aml,
410 acpi_rs_length minimum_length, 410 acpi_rs_length minimum_length,
411 struct acpi_resource_source * resource_source) 411 struct acpi_resource_source *resource_source)
412{ 412{
413 u8 *aml_resource_source; 413 u8 *aml_resource_source;
414 acpi_rsdesc_size descriptor_length; 414 acpi_rsdesc_size descriptor_length;
@@ -466,8 +466,8 @@ acpi_rs_set_resource_source(union aml_resource * aml,
466 ******************************************************************************/ 466 ******************************************************************************/
467 467
468acpi_status 468acpi_status
469acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, 469acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
470 struct acpi_buffer * ret_buffer) 470 struct acpi_buffer *ret_buffer)
471{ 471{
472 union acpi_operand_object *obj_desc; 472 union acpi_operand_object *obj_desc;
473 acpi_status status; 473 acpi_status status;
@@ -671,7 +671,7 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
671 671
672acpi_status 672acpi_status
673acpi_rs_get_method_data(acpi_handle handle, 673acpi_rs_get_method_data(acpi_handle handle,
674 char *path, struct acpi_buffer *ret_buffer) 674 const char *path, struct acpi_buffer *ret_buffer)
675{ 675{
676 union acpi_operand_object *obj_desc; 676 union acpi_operand_object *obj_desc;
677 acpi_status status; 677 acpi_status status;
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index 900933be9909..465ed8137167 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -433,8 +433,8 @@ ACPI_EXPORT_SYMBOL(acpi_resource_to_address64)
433acpi_status 433acpi_status
434acpi_get_vendor_resource(acpi_handle device_handle, 434acpi_get_vendor_resource(acpi_handle device_handle,
435 char *name, 435 char *name,
436 struct acpi_vendor_uuid * uuid, 436 struct acpi_vendor_uuid *uuid,
437 struct acpi_buffer * ret_buffer) 437 struct acpi_buffer *ret_buffer)
438{ 438{
439 struct acpi_vendor_walk_info info; 439 struct acpi_vendor_walk_info info;
440 acpi_status status; 440 acpi_status status;
@@ -539,7 +539,7 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
539 ******************************************************************************/ 539 ******************************************************************************/
540 540
541acpi_status 541acpi_status
542acpi_walk_resource_buffer(struct acpi_buffer * buffer, 542acpi_walk_resource_buffer(struct acpi_buffer *buffer,
543 acpi_walk_resource_callback user_function, 543 acpi_walk_resource_callback user_function,
544 void *context) 544 void *context)
545{ 545{
diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c
index 7da79ce74080..1388a19e5db8 100644
--- a/drivers/acpi/acpica/tbdata.c
+++ b/drivers/acpi/acpica/tbdata.c
@@ -368,7 +368,7 @@ acpi_status acpi_tb_validate_temp_table(struct acpi_table_desc *table_desc)
368 *****************************************************************************/ 368 *****************************************************************************/
369 369
370acpi_status 370acpi_status
371acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature) 371acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature)
372{ 372{
373 acpi_status status = AE_OK; 373 acpi_status status = AE_OK;
374 374
@@ -401,9 +401,9 @@ acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature)
401 ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, 401 ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY,
402 "%4.4s 0x%8.8X%8.8X" 402 "%4.4s 0x%8.8X%8.8X"
403 " Attempted table install failed", 403 " Attempted table install failed",
404 acpi_ut_valid_acpi_name(table_desc-> 404 acpi_ut_valid_nameseg(table_desc->
405 signature. 405 signature.
406 ascii) ? 406 ascii) ?
407 table_desc->signature.ascii : "????", 407 table_desc->signature.ascii : "????",
408 ACPI_FORMAT_UINT64(table_desc-> 408 ACPI_FORMAT_UINT64(table_desc->
409 address))); 409 address)));
@@ -454,7 +454,7 @@ acpi_status acpi_tb_resize_root_table_list(void)
454 table_count = acpi_gbl_root_table_list.current_table_count; 454 table_count = acpi_gbl_root_table_list.current_table_count;
455 } 455 }
456 456
457 tables = ACPI_ALLOCATE_ZEROED(((acpi_size) table_count + 457 tables = ACPI_ALLOCATE_ZEROED(((acpi_size)table_count +
458 ACPI_ROOT_TABLE_SIZE_INCREMENT) * 458 ACPI_ROOT_TABLE_SIZE_INCREMENT) *
459 sizeof(struct acpi_table_desc)); 459 sizeof(struct acpi_table_desc));
460 if (!tables) { 460 if (!tables) {
@@ -467,8 +467,7 @@ acpi_status acpi_tb_resize_root_table_list(void)
467 467
468 if (acpi_gbl_root_table_list.tables) { 468 if (acpi_gbl_root_table_list.tables) {
469 memcpy(tables, acpi_gbl_root_table_list.tables, 469 memcpy(tables, acpi_gbl_root_table_list.tables,
470 (acpi_size) table_count * 470 (acpi_size)table_count * sizeof(struct acpi_table_desc));
471 sizeof(struct acpi_table_desc));
472 471
473 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { 472 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
474 ACPI_FREE(acpi_gbl_root_table_list.tables); 473 ACPI_FREE(acpi_gbl_root_table_list.tables);
@@ -701,7 +700,7 @@ acpi_status acpi_tb_release_owner_id(u32 table_index)
701 * 700 *
702 ******************************************************************************/ 701 ******************************************************************************/
703 702
704acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id * owner_id) 703acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id)
705{ 704{
706 acpi_status status = AE_BAD_PARAMETER; 705 acpi_status status = AE_BAD_PARAMETER;
707 706
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index a79e4f30b530..620806965243 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -53,7 +53,7 @@ static void
53acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, 53acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
54 u8 space_id, 54 u8 space_id,
55 u8 byte_width, 55 u8 byte_width,
56 u64 address, char *register_name, u8 flags); 56 u64 address, const char *register_name, u8 flags);
57 57
58static void acpi_tb_convert_fadt(void); 58static void acpi_tb_convert_fadt(void);
59 59
@@ -65,7 +65,7 @@ acpi_tb_select_address(char *register_name, u32 address32, u64 address64);
65/* Table for conversion of FADT to common internal format and FADT validation */ 65/* Table for conversion of FADT to common internal format and FADT validation */
66 66
67typedef struct acpi_fadt_info { 67typedef struct acpi_fadt_info {
68 char *name; 68 const char *name;
69 u16 address64; 69 u16 address64;
70 u16 address32; 70 u16 address32;
71 u16 length; 71 u16 length;
@@ -192,7 +192,7 @@ static void
192acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, 192acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
193 u8 space_id, 193 u8 space_id,
194 u8 byte_width, 194 u8 byte_width,
195 u64 address, char *register_name, u8 flags) 195 u64 address, const char *register_name, u8 flags)
196{ 196{
197 u8 bit_width; 197 u8 bit_width;
198 198
@@ -344,7 +344,7 @@ void acpi_tb_parse_fadt(void)
344 344
345 /* Obtain the DSDT and FACS tables via their addresses within the FADT */ 345 /* Obtain the DSDT and FACS tables via their addresses within the FADT */
346 346
347 acpi_tb_install_fixed_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, 347 acpi_tb_install_fixed_table((acpi_physical_address)acpi_gbl_FADT.Xdsdt,
348 ACPI_SIG_DSDT, &acpi_gbl_dsdt_index); 348 ACPI_SIG_DSDT, &acpi_gbl_dsdt_index);
349 349
350 /* If Hardware Reduced flag is set, there is no FACS */ 350 /* If Hardware Reduced flag is set, there is no FACS */
@@ -385,14 +385,15 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
385{ 385{
386 /* 386 /*
387 * Check if the FADT is larger than the largest table that we expect 387 * Check if the FADT is larger than the largest table that we expect
388 * (the ACPI 5.0 version). If so, truncate the table, and issue 388 * (typically the current ACPI specification version). If so, truncate
389 * a warning. 389 * the table, and issue a warning.
390 */ 390 */
391 if (length > sizeof(struct acpi_table_fadt)) { 391 if (length > sizeof(struct acpi_table_fadt)) {
392 ACPI_BIOS_WARNING((AE_INFO, 392 ACPI_BIOS_WARNING((AE_INFO,
393 "FADT (revision %u) is longer than ACPI 5.0 version, " 393 "FADT (revision %u) is longer than %s length, "
394 "truncating length %u to %u", 394 "truncating length %u to %u",
395 table->revision, length, 395 table->revision, ACPI_FADT_CONFORMANCE,
396 length,
396 (u32)sizeof(struct acpi_table_fadt))); 397 (u32)sizeof(struct acpi_table_fadt)));
397 } 398 }
398 399
@@ -467,7 +468,7 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
467 468
468static void acpi_tb_convert_fadt(void) 469static void acpi_tb_convert_fadt(void)
469{ 470{
470 char *name; 471 const char *name;
471 struct acpi_generic_address *address64; 472 struct acpi_generic_address *address64;
472 u32 address32; 473 u32 address32;
473 u8 length; 474 u8 length;
@@ -646,9 +647,12 @@ static void acpi_tb_convert_fadt(void)
646 if ((address64->address && !length) || 647 if ((address64->address && !length) ||
647 (!address64->address && length)) { 648 (!address64->address && length)) {
648 ACPI_BIOS_WARNING((AE_INFO, 649 ACPI_BIOS_WARNING((AE_INFO,
649 "Optional FADT field %s has zero address or length: " 650 "Optional FADT field %s has valid %s but zero %s: "
650 "0x%8.8X%8.8X/0x%X", 651 "0x%8.8X%8.8X/0x%X", name,
651 name, 652 (length ? "Length" :
653 "Address"),
654 (length ? "Address" :
655 "Length"),
652 ACPI_FORMAT_UINT64 656 ACPI_FORMAT_UINT64
653 (address64->address), 657 (address64->address),
654 length)); 658 length));
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index f2d08034630e..e348d616e60f 100644
--- a/drivers/acpi/acpica/tbfind.c
+++ b/drivers/acpi/acpica/tbfind.c
@@ -76,7 +76,7 @@ acpi_tb_find_table(char *signature,
76 76
77 /* Validate the input table signature */ 77 /* Validate the input table signature */
78 78
79 if (!acpi_is_valid_signature(signature)) { 79 if (!acpi_ut_valid_nameseg(signature)) {
80 return_ACPI_STATUS(AE_BAD_SIGNATURE); 80 return_ACPI_STATUS(AE_BAD_SIGNATURE);
81 } 81 }
82 82
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 4dc6108de4ff..8b13052128fc 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -299,9 +299,9 @@ acpi_tb_install_standard_table(acpi_physical_address address,
299 ACPI_BIOS_ERROR((AE_INFO, 299 ACPI_BIOS_ERROR((AE_INFO,
300 "Table has invalid signature [%4.4s] (0x%8.8X), " 300 "Table has invalid signature [%4.4s] (0x%8.8X), "
301 "must be SSDT or OEMx", 301 "must be SSDT or OEMx",
302 acpi_ut_valid_acpi_name(new_table_desc. 302 acpi_ut_valid_nameseg(new_table_desc.
303 signature. 303 signature.
304 ascii) ? 304 ascii) ?
305 new_table_desc.signature. 305 new_table_desc.signature.
306 ascii : "????", 306 ascii : "????",
307 new_table_desc.signature.integer)); 307 new_table_desc.signature.integer));
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 9240c76d2823..e28553914bf5 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -231,7 +231,7 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size)
231 ACPI_FORMAT_UINT64(address64))); 231 ACPI_FORMAT_UINT64(address64)));
232 } 232 }
233#endif 233#endif
234 return ((acpi_physical_address) (address64)); 234 return ((acpi_physical_address)(address64));
235 } 235 }
236} 236}
237 237
@@ -287,12 +287,12 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
287 * the XSDT if the revision is > 1 and the XSDT pointer is present, 287 * the XSDT if the revision is > 1 and the XSDT pointer is present,
288 * as per the ACPI specification. 288 * as per the ACPI specification.
289 */ 289 */
290 address = (acpi_physical_address) rsdp->xsdt_physical_address; 290 address = (acpi_physical_address)rsdp->xsdt_physical_address;
291 table_entry_size = ACPI_XSDT_ENTRY_SIZE; 291 table_entry_size = ACPI_XSDT_ENTRY_SIZE;
292 } else { 292 } else {
293 /* Root table is an RSDT (32-bit physical addresses) */ 293 /* Root table is an RSDT (32-bit physical addresses) */
294 294
295 address = (acpi_physical_address) rsdp->rsdt_physical_address; 295 address = (acpi_physical_address)rsdp->rsdt_physical_address;
296 table_entry_size = ACPI_RSDT_ENTRY_SIZE; 296 table_entry_size = ACPI_RSDT_ENTRY_SIZE;
297 } 297 }
298 298
@@ -380,30 +380,3 @@ next_table:
380 acpi_os_unmap_memory(table, length); 380 acpi_os_unmap_memory(table, length);
381 return_ACPI_STATUS(AE_OK); 381 return_ACPI_STATUS(AE_OK);
382} 382}
383
384/*******************************************************************************
385 *
386 * FUNCTION: acpi_is_valid_signature
387 *
388 * PARAMETERS: signature - Sig string to be validated
389 *
390 * RETURN: TRUE if signature is has 4 valid ACPI characters
391 *
392 * DESCRIPTION: Validate an ACPI table signature.
393 *
394 ******************************************************************************/
395
396u8 acpi_is_valid_signature(char *signature)
397{
398 u32 i;
399
400 /* Validate each character in the signature */
401
402 for (i = 0; i < ACPI_NAME_SIZE; i++) {
403 if (!acpi_ut_valid_acpi_char(signature[i], i)) {
404 return (FALSE);
405 }
406 }
407
408 return (TRUE);
409}
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 326df65decef..3ecec937e8c9 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -99,7 +99,7 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count)
99 ******************************************************************************/ 99 ******************************************************************************/
100 100
101acpi_status __init 101acpi_status __init
102acpi_initialize_tables(struct acpi_table_desc * initial_table_array, 102acpi_initialize_tables(struct acpi_table_desc *initial_table_array,
103 u32 initial_table_count, u8 allow_resize) 103 u32 initial_table_count, u8 allow_resize)
104{ 104{
105 acpi_physical_address rsdp_address; 105 acpi_physical_address rsdp_address;
@@ -120,7 +120,7 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
120 /* Root Table Array has been statically allocated by the host */ 120 /* Root Table Array has been statically allocated by the host */
121 121
122 memset(initial_table_array, 0, 122 memset(initial_table_array, 0,
123 (acpi_size) initial_table_count * 123 (acpi_size)initial_table_count *
124 sizeof(struct acpi_table_desc)); 124 sizeof(struct acpi_table_desc));
125 125
126 acpi_gbl_root_table_list.tables = initial_table_array; 126 acpi_gbl_root_table_list.tables = initial_table_array;
@@ -352,7 +352,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table)
352 * 352 *
353 ******************************************************************************/ 353 ******************************************************************************/
354acpi_status 354acpi_status
355acpi_get_table_by_index(u32 table_index, struct acpi_table_header ** table) 355acpi_get_table_by_index(u32 table_index, struct acpi_table_header **table)
356{ 356{
357 acpi_status status; 357 acpi_status status;
358 358
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index 3151968c10d1..ac71abcd32bb 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -82,7 +82,7 @@ acpi_status __init acpi_load_tables(void)
82 * their customized default region handlers. 82 * their customized default region handlers.
83 */ 83 */
84 status = acpi_ev_install_region_handlers(); 84 status = acpi_ev_install_region_handlers();
85 if (ACPI_FAILURE(status) && status != AE_ALREADY_EXISTS) { 85 if (ACPI_FAILURE(status)) {
86 ACPI_EXCEPTION((AE_INFO, status, 86 ACPI_EXCEPTION((AE_INFO, status,
87 "During Region initialization")); 87 "During Region initialization"));
88 return_ACPI_STATUS(status); 88 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index b9a78e457d19..adb6cfc54661 100644
--- a/drivers/acpi/acpica/tbxfroot.c
+++ b/drivers/acpi/acpica/tbxfroot.c
@@ -90,7 +90,7 @@ u32 acpi_tb_get_rsdp_length(struct acpi_table_rsdp *rsdp)
90 * 90 *
91 ******************************************************************************/ 91 ******************************************************************************/
92 92
93acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp * rsdp) 93acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
94{ 94{
95 95
96 /* 96 /*
@@ -142,7 +142,7 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp * rsdp)
142 * 142 *
143 ******************************************************************************/ 143 ******************************************************************************/
144 144
145acpi_status __init acpi_find_root_pointer(acpi_physical_address * table_address) 145acpi_status __init acpi_find_root_pointer(acpi_physical_address *table_address)
146{ 146{
147 u8 *table_ptr; 147 u8 *table_ptr;
148 u8 *mem_rover; 148 u8 *mem_rover;
@@ -201,7 +201,7 @@ acpi_status __init acpi_find_root_pointer(acpi_physical_address * table_address)
201 (u32) ACPI_PTR_DIFF(mem_rover, table_ptr); 201 (u32) ACPI_PTR_DIFF(mem_rover, table_ptr);
202 202
203 *table_address = 203 *table_address =
204 (acpi_physical_address) physical_address; 204 (acpi_physical_address)physical_address;
205 return_ACPI_STATUS(AE_OK); 205 return_ACPI_STATUS(AE_OK);
206 } 206 }
207 } 207 }
@@ -234,7 +234,7 @@ acpi_status __init acpi_find_root_pointer(acpi_physical_address * table_address)
234 (ACPI_HI_RSDP_WINDOW_BASE + 234 (ACPI_HI_RSDP_WINDOW_BASE +
235 ACPI_PTR_DIFF(mem_rover, table_ptr)); 235 ACPI_PTR_DIFF(mem_rover, table_ptr));
236 236
237 *table_address = (acpi_physical_address) physical_address; 237 *table_address = (acpi_physical_address)physical_address;
238 return_ACPI_STATUS(AE_OK); 238 return_ACPI_STATUS(AE_OK);
239 } 239 }
240 240
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index 3dbdc3ab8b78..13324a27b99b 100644
--- a/drivers/acpi/acpica/utalloc.c
+++ b/drivers/acpi/acpica/utalloc.c
@@ -231,7 +231,7 @@ acpi_status acpi_ut_delete_caches(void)
231 * 231 *
232 ******************************************************************************/ 232 ******************************************************************************/
233 233
234acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer) 234acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer)
235{ 235{
236 236
237 /* Obviously, the structure pointer must be valid */ 237 /* Obviously, the structure pointer must be valid */
@@ -272,8 +272,7 @@ acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
272 ******************************************************************************/ 272 ******************************************************************************/
273 273
274acpi_status 274acpi_status
275acpi_ut_initialize_buffer(struct acpi_buffer * buffer, 275acpi_ut_initialize_buffer(struct acpi_buffer *buffer, acpi_size required_length)
276 acpi_size required_length)
277{ 276{
278 acpi_size input_buffer_length; 277 acpi_size input_buffer_length;
279 278
diff --git a/drivers/acpi/acpica/utascii.c b/drivers/acpi/acpica/utascii.c
new file mode 100644
index 000000000000..706c1f346490
--- /dev/null
+++ b/drivers/acpi/acpica/utascii.c
@@ -0,0 +1,140 @@
1/******************************************************************************
2 *
3 * Module Name: utascii - Utility ascii functions
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2016, 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/*******************************************************************************
48 *
49 * FUNCTION: acpi_ut_valid_nameseg
50 *
51 * PARAMETERS: name - The name or table signature to be examined.
52 * Four characters, does not have to be a
53 * NULL terminated string.
54 *
55 * RETURN: TRUE if signature is has 4 valid ACPI characters
56 *
57 * DESCRIPTION: Validate an ACPI table signature.
58 *
59 ******************************************************************************/
60
61u8 acpi_ut_valid_nameseg(char *name)
62{
63 u32 i;
64
65 /* Validate each character in the signature */
66
67 for (i = 0; i < ACPI_NAME_SIZE; i++) {
68 if (!acpi_ut_valid_name_char(name[i], i)) {
69 return (FALSE);
70 }
71 }
72
73 return (TRUE);
74}
75
76/*******************************************************************************
77 *
78 * FUNCTION: acpi_ut_valid_name_char
79 *
80 * PARAMETERS: char - The character to be examined
81 * position - Byte position (0-3)
82 *
83 * RETURN: TRUE if the character is valid, FALSE otherwise
84 *
85 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
86 * 1) Upper case alpha
87 * 2) numeric
88 * 3) underscore
89 *
90 * We allow a '!' as the last character because of the ASF! table
91 *
92 ******************************************************************************/
93
94u8 acpi_ut_valid_name_char(char character, u32 position)
95{
96
97 if (!((character >= 'A' && character <= 'Z') ||
98 (character >= '0' && character <= '9') || (character == '_'))) {
99
100 /* Allow a '!' in the last position */
101
102 if (character == '!' && position == 3) {
103 return (TRUE);
104 }
105
106 return (FALSE);
107 }
108
109 return (TRUE);
110}
111
112/*******************************************************************************
113 *
114 * FUNCTION: acpi_ut_check_and_repair_ascii
115 *
116 * PARAMETERS: name - Ascii string
117 * count - Number of characters to check
118 *
119 * RETURN: None
120 *
121 * DESCRIPTION: Ensure that the requested number of characters are printable
122 * Ascii characters. Sets non-printable and null chars to <space>.
123 *
124 ******************************************************************************/
125
126void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count)
127{
128 u32 i;
129
130 for (i = 0; i < count; i++) {
131 repaired_name[i] = (char)name[i];
132
133 if (!name[i]) {
134 return;
135 }
136 if (!isprint(name[i])) {
137 repaired_name[i] = ' ';
138 }
139 }
140}
diff --git a/drivers/acpi/acpica/utbuffer.c b/drivers/acpi/acpica/utbuffer.c
index 0cfb2b8edad5..bd31faf5da7c 100644
--- a/drivers/acpi/acpica/utbuffer.c
+++ b/drivers/acpi/acpica/utbuffer.c
@@ -106,31 +106,31 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
106 default: /* Default is BYTE display */ 106 default: /* Default is BYTE display */
107 107
108 acpi_os_printf("%02X ", 108 acpi_os_printf("%02X ",
109 buffer[(acpi_size) i + j]); 109 buffer[(acpi_size)i + j]);
110 break; 110 break;
111 111
112 case DB_WORD_DISPLAY: 112 case DB_WORD_DISPLAY:
113 113
114 ACPI_MOVE_16_TO_32(&temp32, 114 ACPI_MOVE_16_TO_32(&temp32,
115 &buffer[(acpi_size) i + j]); 115 &buffer[(acpi_size)i + j]);
116 acpi_os_printf("%04X ", temp32); 116 acpi_os_printf("%04X ", temp32);
117 break; 117 break;
118 118
119 case DB_DWORD_DISPLAY: 119 case DB_DWORD_DISPLAY:
120 120
121 ACPI_MOVE_32_TO_32(&temp32, 121 ACPI_MOVE_32_TO_32(&temp32,
122 &buffer[(acpi_size) i + j]); 122 &buffer[(acpi_size)i + j]);
123 acpi_os_printf("%08X ", temp32); 123 acpi_os_printf("%08X ", temp32);
124 break; 124 break;
125 125
126 case DB_QWORD_DISPLAY: 126 case DB_QWORD_DISPLAY:
127 127
128 ACPI_MOVE_32_TO_32(&temp32, 128 ACPI_MOVE_32_TO_32(&temp32,
129 &buffer[(acpi_size) i + j]); 129 &buffer[(acpi_size)i + j]);
130 acpi_os_printf("%08X", temp32); 130 acpi_os_printf("%08X", temp32);
131 131
132 ACPI_MOVE_32_TO_32(&temp32, 132 ACPI_MOVE_32_TO_32(&temp32,
133 &buffer[(acpi_size) i + j + 133 &buffer[(acpi_size)i + j +
134 4]); 134 4]);
135 acpi_os_printf("%08X ", temp32); 135 acpi_os_printf("%08X ", temp32);
136 break; 136 break;
@@ -158,7 +158,7 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
158 acpi_os_printf("// "); 158 acpi_os_printf("// ");
159 } 159 }
160 160
161 buf_char = buffer[(acpi_size) i + j]; 161 buf_char = buffer[(acpi_size)i + j];
162 if (isprint(buf_char)) { 162 if (isprint(buf_char)) {
163 acpi_os_printf("%c", buf_char); 163 acpi_os_printf("%c", buf_char);
164 } else { 164 } else {
@@ -274,31 +274,31 @@ acpi_ut_dump_buffer_to_file(ACPI_FILE file,
274 default: /* Default is BYTE display */ 274 default: /* Default is BYTE display */
275 275
276 acpi_ut_file_printf(file, "%02X ", 276 acpi_ut_file_printf(file, "%02X ",
277 buffer[(acpi_size) i + j]); 277 buffer[(acpi_size)i + j]);
278 break; 278 break;
279 279
280 case DB_WORD_DISPLAY: 280 case DB_WORD_DISPLAY:
281 281
282 ACPI_MOVE_16_TO_32(&temp32, 282 ACPI_MOVE_16_TO_32(&temp32,
283 &buffer[(acpi_size) i + j]); 283 &buffer[(acpi_size)i + j]);
284 acpi_ut_file_printf(file, "%04X ", temp32); 284 acpi_ut_file_printf(file, "%04X ", temp32);
285 break; 285 break;
286 286
287 case DB_DWORD_DISPLAY: 287 case DB_DWORD_DISPLAY:
288 288
289 ACPI_MOVE_32_TO_32(&temp32, 289 ACPI_MOVE_32_TO_32(&temp32,
290 &buffer[(acpi_size) i + j]); 290 &buffer[(acpi_size)i + j]);
291 acpi_ut_file_printf(file, "%08X ", temp32); 291 acpi_ut_file_printf(file, "%08X ", temp32);
292 break; 292 break;
293 293
294 case DB_QWORD_DISPLAY: 294 case DB_QWORD_DISPLAY:
295 295
296 ACPI_MOVE_32_TO_32(&temp32, 296 ACPI_MOVE_32_TO_32(&temp32,
297 &buffer[(acpi_size) i + j]); 297 &buffer[(acpi_size)i + j]);
298 acpi_ut_file_printf(file, "%08X", temp32); 298 acpi_ut_file_printf(file, "%08X", temp32);
299 299
300 ACPI_MOVE_32_TO_32(&temp32, 300 ACPI_MOVE_32_TO_32(&temp32,
301 &buffer[(acpi_size) i + j + 301 &buffer[(acpi_size)i + j +
302 4]); 302 4]);
303 acpi_ut_file_printf(file, "%08X ", temp32); 303 acpi_ut_file_printf(file, "%08X ", temp32);
304 break; 304 break;
@@ -318,7 +318,7 @@ acpi_ut_dump_buffer_to_file(ACPI_FILE file,
318 return; 318 return;
319 } 319 }
320 320
321 buf_char = buffer[(acpi_size) i + j]; 321 buf_char = buffer[(acpi_size)i + j];
322 if (isprint(buf_char)) { 322 if (isprint(buf_char)) {
323 acpi_ut_file_printf(file, "%c", buf_char); 323 acpi_ut_file_printf(file, "%c", buf_char);
324 } else { 324 } else {
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c
index f8e9978888e1..3b8d23ef351f 100644
--- a/drivers/acpi/acpica/utcache.c
+++ b/drivers/acpi/acpica/utcache.c
@@ -105,7 +105,7 @@ acpi_os_create_cache(char *cache_name,
105 * 105 *
106 ******************************************************************************/ 106 ******************************************************************************/
107 107
108acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) 108acpi_status acpi_os_purge_cache(struct acpi_memory_list *cache)
109{ 109{
110 void *next; 110 void *next;
111 acpi_status status; 111 acpi_status status;
@@ -151,7 +151,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
151 * 151 *
152 ******************************************************************************/ 152 ******************************************************************************/
153 153
154acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache) 154acpi_status acpi_os_delete_cache(struct acpi_memory_list *cache)
155{ 155{
156 acpi_status status; 156 acpi_status status;
157 157
@@ -184,8 +184,7 @@ acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache)
184 * 184 *
185 ******************************************************************************/ 185 ******************************************************************************/
186 186
187acpi_status 187acpi_status acpi_os_release_object(struct acpi_memory_list *cache, void *object)
188acpi_os_release_object(struct acpi_memory_list * cache, void *object)
189{ 188{
190 acpi_status status; 189 acpi_status status;
191 190
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index 98d53e59ce55..82f971402d85 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("utcopy")
53static acpi_status 53static acpi_status
54acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, 54acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
55 union acpi_object *external_object, 55 union acpi_object *external_object,
56 u8 * data_space, acpi_size * buffer_space_used); 56 u8 *data_space, acpi_size *buffer_space_used);
57 57
58static acpi_status 58static acpi_status
59acpi_ut_copy_ielement_to_ielement(u8 object_type, 59acpi_ut_copy_ielement_to_ielement(u8 object_type,
@@ -63,7 +63,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
63 63
64static acpi_status 64static acpi_status
65acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, 65acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
66 u8 * buffer, acpi_size * space_used); 66 u8 *buffer, acpi_size *space_used);
67 67
68static acpi_status 68static acpi_status
69acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj, 69acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj,
@@ -111,7 +111,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
111static acpi_status 111static acpi_status
112acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, 112acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
113 union acpi_object *external_object, 113 union acpi_object *external_object,
114 u8 * data_space, acpi_size * buffer_space_used) 114 u8 *data_space, acpi_size *buffer_space_used)
115{ 115{
116 acpi_status status = AE_OK; 116 acpi_status status = AE_OK;
117 117
@@ -151,7 +151,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
151 151
152 memcpy((void *)data_space, 152 memcpy((void *)data_space,
153 (void *)internal_object->string.pointer, 153 (void *)internal_object->string.pointer,
154 (acpi_size) internal_object->string.length + 1); 154 (acpi_size)internal_object->string.length + 1);
155 break; 155 break;
156 156
157 case ACPI_TYPE_BUFFER: 157 case ACPI_TYPE_BUFFER:
@@ -331,7 +331,7 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
331 331
332static acpi_status 332static acpi_status
333acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, 333acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
334 u8 * buffer, acpi_size * space_used) 334 u8 *buffer, acpi_size *space_used)
335{ 335{
336 union acpi_object *external_object; 336 union acpi_object *external_object;
337 acpi_status status; 337 acpi_status status;
@@ -362,7 +362,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
362 * Leave room for an array of ACPI_OBJECTS in the buffer 362 * Leave room for an array of ACPI_OBJECTS in the buffer
363 * and move the free space past it 363 * and move the free space past it
364 */ 364 */
365 info.length += (acpi_size) external_object->package.count * 365 info.length += (acpi_size)external_object->package.count *
366 ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); 366 ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
367 info.free_space += external_object->package.count * 367 info.free_space += external_object->package.count *
368 ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); 368 ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
@@ -738,7 +738,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
738 */ 738 */
739 if (source_desc->string.pointer) { 739 if (source_desc->string.pointer) {
740 dest_desc->string.pointer = 740 dest_desc->string.pointer =
741 ACPI_ALLOCATE((acpi_size) source_desc->string. 741 ACPI_ALLOCATE((acpi_size)source_desc->string.
742 length + 1); 742 length + 1);
743 if (!dest_desc->string.pointer) { 743 if (!dest_desc->string.pointer) {
744 return (AE_NO_MEMORY); 744 return (AE_NO_MEMORY);
@@ -748,7 +748,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
748 748
749 memcpy(dest_desc->string.pointer, 749 memcpy(dest_desc->string.pointer,
750 source_desc->string.pointer, 750 source_desc->string.pointer,
751 (acpi_size) source_desc->string.length + 1); 751 (acpi_size)source_desc->string.length + 1);
752 } 752 }
753 break; 753 break;
754 754
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index 1cfc5f69b033..574422205005 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -51,13 +51,9 @@
51ACPI_MODULE_NAME("utdebug") 51ACPI_MODULE_NAME("utdebug")
52 52
53#ifdef ACPI_DEBUG_OUTPUT 53#ifdef ACPI_DEBUG_OUTPUT
54static acpi_thread_id acpi_gbl_prev_thread_id = (acpi_thread_id) 0xFFFFFFFF; 54static acpi_thread_id acpi_gbl_previous_thread_id = (acpi_thread_id) 0xFFFFFFFF;
55static char *acpi_gbl_fn_entry_str = "----Entry"; 55static const char *acpi_gbl_function_entry_prefix = "----Entry";
56static char *acpi_gbl_fn_exit_str = "----Exit-"; 56static const char *acpi_gbl_function_exit_prefix = "----Exit-";
57
58/* Local prototypes */
59
60static const char *acpi_ut_trim_function_name(const char *function_name);
61 57
62/******************************************************************************* 58/*******************************************************************************
63 * 59 *
@@ -178,14 +174,14 @@ acpi_debug_print(u32 requested_debug_level,
178 * Thread tracking and context switch notification 174 * Thread tracking and context switch notification
179 */ 175 */
180 thread_id = acpi_os_get_thread_id(); 176 thread_id = acpi_os_get_thread_id();
181 if (thread_id != acpi_gbl_prev_thread_id) { 177 if (thread_id != acpi_gbl_previous_thread_id) {
182 if (ACPI_LV_THREADS & acpi_dbg_level) { 178 if (ACPI_LV_THREADS & acpi_dbg_level) {
183 acpi_os_printf 179 acpi_os_printf
184 ("\n**** Context Switch from TID %u to TID %u ****\n\n", 180 ("\n**** Context Switch from TID %u to TID %u ****\n\n",
185 (u32)acpi_gbl_prev_thread_id, (u32)thread_id); 181 (u32)acpi_gbl_previous_thread_id, (u32)thread_id);
186 } 182 }
187 183
188 acpi_gbl_prev_thread_id = thread_id; 184 acpi_gbl_previous_thread_id = thread_id;
189 acpi_gbl_nesting_level = 0; 185 acpi_gbl_nesting_level = 0;
190 } 186 }
191 187
@@ -287,7 +283,8 @@ acpi_ut_trace(u32 line_number,
287 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 283 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
288 acpi_debug_print(ACPI_LV_FUNCTIONS, 284 acpi_debug_print(ACPI_LV_FUNCTIONS,
289 line_number, function_name, module_name, 285 line_number, function_name, module_name,
290 component_id, "%s\n", acpi_gbl_fn_entry_str); 286 component_id, "%s\n",
287 acpi_gbl_function_entry_prefix);
291 } 288 }
292} 289}
293 290
@@ -312,7 +309,8 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace)
312void 309void
313acpi_ut_trace_ptr(u32 line_number, 310acpi_ut_trace_ptr(u32 line_number,
314 const char *function_name, 311 const char *function_name,
315 const char *module_name, u32 component_id, void *pointer) 312 const char *module_name,
313 u32 component_id, const void *pointer)
316{ 314{
317 315
318 acpi_gbl_nesting_level++; 316 acpi_gbl_nesting_level++;
@@ -323,8 +321,8 @@ acpi_ut_trace_ptr(u32 line_number,
323 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 321 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
324 acpi_debug_print(ACPI_LV_FUNCTIONS, 322 acpi_debug_print(ACPI_LV_FUNCTIONS,
325 line_number, function_name, module_name, 323 line_number, function_name, module_name,
326 component_id, "%s %p\n", acpi_gbl_fn_entry_str, 324 component_id, "%s %p\n",
327 pointer); 325 acpi_gbl_function_entry_prefix, pointer);
328 } 326 }
329} 327}
330 328
@@ -348,7 +346,7 @@ acpi_ut_trace_ptr(u32 line_number,
348void 346void
349acpi_ut_trace_str(u32 line_number, 347acpi_ut_trace_str(u32 line_number,
350 const char *function_name, 348 const char *function_name,
351 const char *module_name, u32 component_id, char *string) 349 const char *module_name, u32 component_id, const char *string)
352{ 350{
353 351
354 acpi_gbl_nesting_level++; 352 acpi_gbl_nesting_level++;
@@ -359,8 +357,8 @@ acpi_ut_trace_str(u32 line_number,
359 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 357 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
360 acpi_debug_print(ACPI_LV_FUNCTIONS, 358 acpi_debug_print(ACPI_LV_FUNCTIONS,
361 line_number, function_name, module_name, 359 line_number, function_name, module_name,
362 component_id, "%s %s\n", acpi_gbl_fn_entry_str, 360 component_id, "%s %s\n",
363 string); 361 acpi_gbl_function_entry_prefix, string);
364 } 362 }
365} 363}
366 364
@@ -396,7 +394,7 @@ acpi_ut_trace_u32(u32 line_number,
396 acpi_debug_print(ACPI_LV_FUNCTIONS, 394 acpi_debug_print(ACPI_LV_FUNCTIONS,
397 line_number, function_name, module_name, 395 line_number, function_name, module_name,
398 component_id, "%s %08X\n", 396 component_id, "%s %08X\n",
399 acpi_gbl_fn_entry_str, integer); 397 acpi_gbl_function_entry_prefix, integer);
400 } 398 }
401} 399}
402 400
@@ -427,7 +425,8 @@ acpi_ut_exit(u32 line_number,
427 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 425 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
428 acpi_debug_print(ACPI_LV_FUNCTIONS, 426 acpi_debug_print(ACPI_LV_FUNCTIONS,
429 line_number, function_name, module_name, 427 line_number, function_name, module_name,
430 component_id, "%s\n", acpi_gbl_fn_exit_str); 428 component_id, "%s\n",
429 acpi_gbl_function_exit_prefix);
431 } 430 }
432 431
433 if (acpi_gbl_nesting_level) { 432 if (acpi_gbl_nesting_level) {
@@ -467,14 +466,14 @@ acpi_ut_status_exit(u32 line_number,
467 acpi_debug_print(ACPI_LV_FUNCTIONS, 466 acpi_debug_print(ACPI_LV_FUNCTIONS,
468 line_number, function_name, 467 line_number, function_name,
469 module_name, component_id, "%s %s\n", 468 module_name, component_id, "%s %s\n",
470 acpi_gbl_fn_exit_str, 469 acpi_gbl_function_exit_prefix,
471 acpi_format_exception(status)); 470 acpi_format_exception(status));
472 } else { 471 } else {
473 acpi_debug_print(ACPI_LV_FUNCTIONS, 472 acpi_debug_print(ACPI_LV_FUNCTIONS,
474 line_number, function_name, 473 line_number, function_name,
475 module_name, component_id, 474 module_name, component_id,
476 "%s ****Exception****: %s\n", 475 "%s ****Exception****: %s\n",
477 acpi_gbl_fn_exit_str, 476 acpi_gbl_function_exit_prefix,
478 acpi_format_exception(status)); 477 acpi_format_exception(status));
479 } 478 }
480 } 479 }
@@ -514,7 +513,7 @@ acpi_ut_value_exit(u32 line_number,
514 acpi_debug_print(ACPI_LV_FUNCTIONS, 513 acpi_debug_print(ACPI_LV_FUNCTIONS,
515 line_number, function_name, module_name, 514 line_number, function_name, module_name,
516 component_id, "%s %8.8X%8.8X\n", 515 component_id, "%s %8.8X%8.8X\n",
517 acpi_gbl_fn_exit_str, 516 acpi_gbl_function_exit_prefix,
518 ACPI_FORMAT_UINT64(value)); 517 ACPI_FORMAT_UINT64(value));
519 } 518 }
520 519
@@ -552,8 +551,8 @@ acpi_ut_ptr_exit(u32 line_number,
552 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 551 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
553 acpi_debug_print(ACPI_LV_FUNCTIONS, 552 acpi_debug_print(ACPI_LV_FUNCTIONS,
554 line_number, function_name, module_name, 553 line_number, function_name, module_name,
555 component_id, "%s %p\n", acpi_gbl_fn_exit_str, 554 component_id, "%s %p\n",
556 ptr); 555 acpi_gbl_function_exit_prefix, ptr);
557 } 556 }
558 557
559 if (acpi_gbl_nesting_level) { 558 if (acpi_gbl_nesting_level) {
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 6ba65b02550c..efd7988e34cb 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -446,7 +446,7 @@ const char *acpi_ut_get_mutex_name(u32 mutex_id)
446 446
447/* Names for Notify() values, used for debug output */ 447/* Names for Notify() values, used for debug output */
448 448
449static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = { 449static const char *acpi_gbl_generic_notify[ACPI_GENERIC_NOTIFY_MAX + 1] = {
450 /* 00 */ "Bus Check", 450 /* 00 */ "Bus Check",
451 /* 01 */ "Device Check", 451 /* 01 */ "Device Check",
452 /* 02 */ "Device Wake", 452 /* 02 */ "Device Wake",
@@ -459,49 +459,53 @@ static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = {
459 /* 09 */ "Device PLD Check", 459 /* 09 */ "Device PLD Check",
460 /* 0A */ "Reserved", 460 /* 0A */ "Reserved",
461 /* 0B */ "System Locality Update", 461 /* 0B */ "System Locality Update",
462 /* 0C */ "Shutdown Request", 462 /* 0C */ "Shutdown Request",
463 /* Reserved in ACPI 6.0 */
463 /* 0D */ "System Resource Affinity Update" 464 /* 0D */ "System Resource Affinity Update"
464}; 465};
465 466
466static const char *acpi_gbl_device_notify[4] = { 467static const char *acpi_gbl_device_notify[5] = {
467 /* 80 */ "Status Change", 468 /* 80 */ "Status Change",
468 /* 81 */ "Information Change", 469 /* 81 */ "Information Change",
469 /* 82 */ "Device-Specific Change", 470 /* 82 */ "Device-Specific Change",
470 /* 83 */ "Device-Specific Change" 471 /* 83 */ "Device-Specific Change",
472 /* 84 */ "Reserved"
471}; 473};
472 474
473static const char *acpi_gbl_processor_notify[4] = { 475static const char *acpi_gbl_processor_notify[5] = {
474 /* 80 */ "Performance Capability Change", 476 /* 80 */ "Performance Capability Change",
475 /* 81 */ "C-State Change", 477 /* 81 */ "C-State Change",
476 /* 82 */ "Throttling Capability Change", 478 /* 82 */ "Throttling Capability Change",
477 /* 83 */ "Device-Specific Change" 479 /* 83 */ "Guaranteed Change",
480 /* 84 */ "Minimum Excursion"
478}; 481};
479 482
480static const char *acpi_gbl_thermal_notify[4] = { 483static const char *acpi_gbl_thermal_notify[5] = {
481 /* 80 */ "Thermal Status Change", 484 /* 80 */ "Thermal Status Change",
482 /* 81 */ "Thermal Trip Point Change", 485 /* 81 */ "Thermal Trip Point Change",
483 /* 82 */ "Thermal Device List Change", 486 /* 82 */ "Thermal Device List Change",
484 /* 83 */ "Thermal Relationship Change" 487 /* 83 */ "Thermal Relationship Change",
488 /* 84 */ "Reserved"
485}; 489};
486 490
487const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type) 491const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type)
488{ 492{
489 493
490 /* 00 - 0D are common to all object types */ 494 /* 00 - 0D are "common to all object types" (from ACPI Spec) */
491 495
492 if (notify_value <= ACPI_NOTIFY_MAX) { 496 if (notify_value <= ACPI_GENERIC_NOTIFY_MAX) {
493 return (acpi_gbl_generic_notify[notify_value]); 497 return (acpi_gbl_generic_notify[notify_value]);
494 } 498 }
495 499
496 /* 0D - 7F are reserved */ 500 /* 0E - 7F are reserved */
497 501
498 if (notify_value <= ACPI_MAX_SYS_NOTIFY) { 502 if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
499 return ("Reserved"); 503 return ("Reserved");
500 } 504 }
501 505
502 /* 80 - 83 are per-object-type */ 506 /* 80 - 84 are per-object-type */
503 507
504 if (notify_value <= 0x83) { 508 if (notify_value <= ACPI_SPECIFIC_NOTIFY_MAX) {
505 switch (type) { 509 switch (type) {
506 case ACPI_TYPE_ANY: 510 case ACPI_TYPE_ANY:
507 case ACPI_TYPE_DEVICE: 511 case ACPI_TYPE_DEVICE:
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index 17b9f3e6e1e1..7bad13f2e518 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -69,7 +69,7 @@ ACPI_MODULE_NAME("uteval")
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 const 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)
75{ 75{
@@ -204,7 +204,7 @@ cleanup:
204 ******************************************************************************/ 204 ******************************************************************************/
205 205
206acpi_status 206acpi_status
207acpi_ut_evaluate_numeric_object(char *object_name, 207acpi_ut_evaluate_numeric_object(const char *object_name,
208 struct acpi_namespace_node *device_node, 208 struct acpi_namespace_node *device_node,
209 u64 *value) 209 u64 *value)
210{ 210{
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 48fffcfe9911..dd3fd7f97f8e 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -80,6 +80,11 @@ const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
80 "_S4D" 80 "_S4D"
81}; 81};
82 82
83/* Hex-to-ascii */
84
85const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
86const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
87
83/******************************************************************************* 88/*******************************************************************************
84 * 89 *
85 * Namespace globals 90 * Namespace globals
@@ -221,6 +226,49 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
221}; 226};
222#endif /* !ACPI_REDUCED_HARDWARE */ 227#endif /* !ACPI_REDUCED_HARDWARE */
223 228
229#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
230
231/* to_pld macro: compile/disassemble strings */
232
233const char *acpi_gbl_pld_panel_list[] = {
234 "TOP",
235 "BOTTOM",
236 "LEFT",
237 "RIGHT",
238 "FRONT",
239 "BACK",
240 "UNKNOWN",
241 NULL
242};
243
244const char *acpi_gbl_pld_vertical_position_list[] = {
245 "UPPER",
246 "CENTER",
247 "LOWER",
248 NULL
249};
250
251const char *acpi_gbl_pld_horizontal_position_list[] = {
252 "LEFT",
253 "CENTER",
254 "RIGHT",
255 NULL
256};
257
258const char *acpi_gbl_pld_shape_list[] = {
259 "ROUND",
260 "OVAL",
261 "SQUARE",
262 "VERTICALRECTANGLE",
263 "HORIZONTALRECTANGLE",
264 "VERTICALTRAPEZOID",
265 "HORIZONTALTRAPEZOID",
266 "UNKNOWN",
267 "CHAMFERED",
268 NULL
269};
270#endif
271
224/* Public globals */ 272/* Public globals */
225 273
226ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) 274ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index 6fb4ec365272..f7cd2d52643b 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -95,7 +95,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
95 95
96 hid = 96 hid =
97 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) + 97 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
98 (acpi_size) length); 98 (acpi_size)length);
99 if (!hid) { 99 if (!hid) {
100 status = AE_NO_MEMORY; 100 status = AE_NO_MEMORY;
101 goto cleanup; 101 goto cleanup;
@@ -173,7 +173,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
173 173
174 uid = 174 uid =
175 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) + 175 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
176 (acpi_size) length); 176 (acpi_size)length);
177 if (!uid) { 177 if (!uid) {
178 status = AE_NO_MEMORY; 178 status = AE_NO_MEMORY;
179 goto cleanup; 179 goto cleanup;
@@ -309,7 +309,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
309 /* Area for CID strings starts after the CID PNP_DEVICE_ID array */ 309 /* Area for CID strings starts after the CID PNP_DEVICE_ID array */
310 310
311 next_id_string = ACPI_CAST_PTR(char, cid_list->ids) + 311 next_id_string = ACPI_CAST_PTR(char, cid_list->ids) +
312 ((acpi_size) count * sizeof(struct acpi_pnp_device_id)); 312 ((acpi_size)count * sizeof(struct acpi_pnp_device_id));
313 313
314 /* Copy/convert the CIDs to the return buffer */ 314 /* Copy/convert the CIDs to the return buffer */
315 315
@@ -413,7 +413,7 @@ acpi_ut_execute_CLS(struct acpi_namespace_node *device_node,
413 413
414 cls = 414 cls =
415 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) + 415 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
416 (acpi_size) length); 416 (acpi_size)length);
417 if (!cls) { 417 if (!cls) {
418 status = AE_NO_MEMORY; 418 status = AE_NO_MEMORY;
419 goto cleanup; 419 goto cleanup;
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index 667372093de1..2d6530ee7e51 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -236,8 +236,8 @@ acpi_ut_divide(u64 in_dividend,
236 } 236 }
237 237
238 remainder.full = remainder.full - dividend.full; 238 remainder.full = remainder.full - dividend.full;
239 remainder.part.hi = (u32) - ((s32) remainder.part.hi); 239 remainder.part.hi = (u32)-((s32)remainder.part.hi);
240 remainder.part.lo = (u32) - ((s32) remainder.part.lo); 240 remainder.part.lo = (u32)-((s32)remainder.part.lo);
241 241
242 if (remainder.part.lo) { 242 if (remainder.part.lo) {
243 remainder.part.hi--; 243 remainder.part.hi--;
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index d938c27cc6cf..389de3bd1ff1 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -361,7 +361,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
361void 361void
362acpi_ut_display_init_pathname(u8 type, 362acpi_ut_display_init_pathname(u8 type,
363 struct acpi_namespace_node *obj_handle, 363 struct acpi_namespace_node *obj_handle,
364 char *path) 364 const char *path)
365{ 365{
366 acpi_status status; 366 acpi_status status;
367 struct acpi_buffer buffer; 367 struct acpi_buffer buffer;
diff --git a/drivers/acpi/acpica/utnonansi.c b/drivers/acpi/acpica/utnonansi.c
index d5c3adf19bd0..3465fe2c5a5c 100644
--- a/drivers/acpi/acpica/utnonansi.c
+++ b/drivers/acpi/acpica/utnonansi.c
@@ -205,37 +205,41 @@ acpi_ut_safe_strncat(char *dest,
205 * 205 *
206 * FUNCTION: acpi_ut_strtoul64 206 * FUNCTION: acpi_ut_strtoul64
207 * 207 *
208 * PARAMETERS: string - Null terminated string 208 * PARAMETERS: string - Null terminated string
209 * base - Radix of the string: 16 or ACPI_ANY_BASE; 209 * base - Radix of the string: 16 or 10 or
210 * ACPI_ANY_BASE means 'in behalf of to_integer' 210 * ACPI_ANY_BASE
211 * ret_integer - Where the converted integer is returned 211 * max_integer_byte_width - Maximum allowable integer,in bytes:
212 * 4 or 8 (32 or 64 bits)
213 * ret_integer - Where the converted integer is
214 * returned
212 * 215 *
213 * RETURN: Status and Converted value 216 * RETURN: Status and Converted value
214 * 217 *
215 * DESCRIPTION: Convert a string into an unsigned value. Performs either a 218 * DESCRIPTION: Convert a string into an unsigned value. Performs either a
216 * 32-bit or 64-bit conversion, depending on the current mode 219 * 32-bit or 64-bit conversion, depending on the input integer
217 * of the interpreter. 220 * size (often the current mode of the interpreter).
218 * 221 *
219 * NOTES: acpi_gbl_integer_byte_width should be set to the proper width. 222 * NOTES: Negative numbers are not supported, as they are not supported
223 * by ACPI.
224 *
225 * acpi_gbl_integer_byte_width should be set to the proper width.
220 * For the core ACPICA code, this width depends on the DSDT 226 * For the core ACPICA code, this width depends on the DSDT
221 * version. For iASL, the default byte width is always 8. 227 * version. For iASL, the default byte width is always 8 for the
228 * parser, but error checking is performed later to flag cases
229 * where a 64-bit constant is defined in a 32-bit DSDT/SSDT.
222 * 230 *
223 * Does not support Octal strings, not needed at this time. 231 * Does not support Octal strings, not needed at this time.
224 * 232 *
225 * There is an earlier version of the function after this one,
226 * below. It is slightly different than this one, and the two
227 * may eventually may need to be merged. (01/2016).
228 *
229 ******************************************************************************/ 233 ******************************************************************************/
230 234
231acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer) 235acpi_status
236acpi_ut_strtoul64(char *string,
237 u32 base, u32 max_integer_byte_width, u64 *ret_integer)
232{ 238{
233 u32 this_digit = 0; 239 u32 this_digit = 0;
234 u64 return_value = 0; 240 u64 return_value = 0;
235 u64 quotient; 241 u64 quotient;
236 u64 dividend; 242 u64 dividend;
237 u32 to_integer_op = (base == ACPI_ANY_BASE);
238 u32 mode32 = (acpi_gbl_integer_byte_width == 4);
239 u8 valid_digits = 0; 243 u8 valid_digits = 0;
240 u8 sign_of0x = 0; 244 u8 sign_of0x = 0;
241 u8 term = 0; 245 u8 term = 0;
@@ -244,6 +248,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
244 248
245 switch (base) { 249 switch (base) {
246 case ACPI_ANY_BASE: 250 case ACPI_ANY_BASE:
251 case 10:
247 case 16: 252 case 16:
248 253
249 break; 254 break;
@@ -265,9 +270,9 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
265 string++; 270 string++;
266 } 271 }
267 272
268 if (to_integer_op) { 273 if (base == ACPI_ANY_BASE) {
269 /* 274 /*
270 * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. 275 * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'.
271 * We need to determine if it is decimal or hexadecimal. 276 * We need to determine if it is decimal or hexadecimal.
272 */ 277 */
273 if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) { 278 if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) {
@@ -284,7 +289,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
284 /* Any string left? Check that '0x' is not followed by white space. */ 289 /* Any string left? Check that '0x' is not followed by white space. */
285 290
286 if (!(*string) || isspace((int)*string) || *string == '\t') { 291 if (!(*string) || isspace((int)*string) || *string == '\t') {
287 if (to_integer_op) { 292 if (base == ACPI_ANY_BASE) {
288 goto error_exit; 293 goto error_exit;
289 } else { 294 } else {
290 goto all_done; 295 goto all_done;
@@ -292,10 +297,11 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
292 } 297 }
293 298
294 /* 299 /*
295 * Perform a 32-bit or 64-bit conversion, depending upon the current 300 * Perform a 32-bit or 64-bit conversion, depending upon the input
296 * execution mode of the interpreter 301 * byte width
297 */ 302 */
298 dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; 303 dividend = (max_integer_byte_width <= ACPI_MAX32_BYTE_WIDTH) ?
304 ACPI_UINT32_MAX : ACPI_UINT64_MAX;
299 305
300 /* Main loop: convert the string to a 32- or 64-bit integer */ 306 /* Main loop: convert the string to a 32- or 64-bit integer */
301 307
@@ -323,7 +329,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
323 } 329 }
324 330
325 if (term) { 331 if (term) {
326 if (to_integer_op) { 332 if (base == ACPI_ANY_BASE) {
327 goto error_exit; 333 goto error_exit;
328 } else { 334 } else {
329 break; 335 break;
@@ -338,12 +344,13 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
338 344
339 valid_digits++; 345 valid_digits++;
340 346
341 if (sign_of0x 347 if (sign_of0x && ((valid_digits > 16) ||
342 && ((valid_digits > 16) 348 ((valid_digits > 8)
343 || ((valid_digits > 8) && mode32))) { 349 && (max_integer_byte_width <=
350 ACPI_MAX32_BYTE_WIDTH)))) {
344 /* 351 /*
345 * This is to_integer operation case. 352 * This is to_integer operation case.
346 * No any restrictions for string-to-integer conversion, 353 * No restrictions for string-to-integer conversion,
347 * see ACPI spec. 354 * see ACPI spec.
348 */ 355 */
349 goto error_exit; 356 goto error_exit;
@@ -355,7 +362,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
355 &quotient, NULL); 362 &quotient, NULL);
356 363
357 if (return_value > quotient) { 364 if (return_value > quotient) {
358 if (to_integer_op) { 365 if (base == ACPI_ANY_BASE) {
359 goto error_exit; 366 goto error_exit;
360 } else { 367 } else {
361 break; 368 break;
@@ -378,7 +385,8 @@ all_done:
378 return_ACPI_STATUS(AE_OK); 385 return_ACPI_STATUS(AE_OK);
379 386
380error_exit: 387error_exit:
381 /* Base was set/validated above */ 388
389 /* Base was set/validated above (10 or 16) */
382 390
383 if (base == 10) { 391 if (base == 10) {
384 return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT); 392 return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);
@@ -388,8 +396,7 @@ error_exit:
388} 396}
389 397
390#ifdef _OBSOLETE_FUNCTIONS 398#ifdef _OBSOLETE_FUNCTIONS
391/* TBD: use version in ACPICA main code base? */ 399/* Removed: 01/2016 */
392/* DONE: 01/2016 */
393 400
394/******************************************************************************* 401/*******************************************************************************
395 * 402 *
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index edad3f043ab9..72b9a062bbab 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -51,11 +51,11 @@ ACPI_MODULE_NAME("utobject")
51/* Local prototypes */ 51/* Local prototypes */
52static acpi_status 52static acpi_status
53acpi_ut_get_simple_object_size(union acpi_operand_object *obj, 53acpi_ut_get_simple_object_size(union acpi_operand_object *obj,
54 acpi_size * obj_length); 54 acpi_size *obj_length);
55 55
56static acpi_status 56static acpi_status
57acpi_ut_get_package_object_size(union acpi_operand_object *obj, 57acpi_ut_get_package_object_size(union acpi_operand_object *obj,
58 acpi_size * obj_length); 58 acpi_size *obj_length);
59 59
60static acpi_status 60static acpi_status
61acpi_ut_get_element_length(u8 object_type, 61acpi_ut_get_element_length(u8 object_type,
@@ -177,7 +177,7 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count)
177 * Create the element array. Count+1 allows the array to be null 177 * Create the element array. Count+1 allows the array to be null
178 * terminated. 178 * terminated.
179 */ 179 */
180 package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size) count + 180 package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size)count +
181 1) * sizeof(void *)); 181 1) * sizeof(void *));
182 if (!package_elements) { 182 if (!package_elements) {
183 ACPI_FREE(package_desc); 183 ACPI_FREE(package_desc);
@@ -454,7 +454,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
454 454
455static acpi_status 455static acpi_status
456acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, 456acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
457 acpi_size * obj_length) 457 acpi_size *obj_length)
458{ 458{
459 acpi_size length; 459 acpi_size length;
460 acpi_size size; 460 acpi_size size;
@@ -495,12 +495,12 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
495 switch (internal_object->common.type) { 495 switch (internal_object->common.type) {
496 case ACPI_TYPE_STRING: 496 case ACPI_TYPE_STRING:
497 497
498 length += (acpi_size) internal_object->string.length + 1; 498 length += (acpi_size)internal_object->string.length + 1;
499 break; 499 break;
500 500
501 case ACPI_TYPE_BUFFER: 501 case ACPI_TYPE_BUFFER:
502 502
503 length += (acpi_size) internal_object->buffer.length; 503 length += (acpi_size)internal_object->buffer.length;
504 break; 504 break;
505 505
506 case ACPI_TYPE_INTEGER: 506 case ACPI_TYPE_INTEGER:
@@ -640,7 +640,7 @@ acpi_ut_get_element_length(u8 object_type,
640 640
641static acpi_status 641static acpi_status
642acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, 642acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
643 acpi_size * obj_length) 643 acpi_size *obj_length)
644{ 644{
645 acpi_status status; 645 acpi_status status;
646 struct acpi_pkg_info info; 646 struct acpi_pkg_info info;
@@ -665,7 +665,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
665 */ 665 */
666 info.length += 666 info.length +=
667 ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) * 667 ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) *
668 (acpi_size) info.num_packages; 668 (acpi_size)info.num_packages;
669 669
670 /* Return the total package length */ 670 /* Return the total package length */
671 671
@@ -689,7 +689,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
689 689
690acpi_status 690acpi_status
691acpi_ut_get_object_size(union acpi_operand_object *internal_object, 691acpi_ut_get_object_size(union acpi_operand_object *internal_object,
692 acpi_size * obj_length) 692 acpi_size *obj_length)
693{ 693{
694 acpi_status status; 694 acpi_status status;
695 695
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
index b5cfe577fabf..3f5fed670271 100644
--- a/drivers/acpi/acpica/utosi.c
+++ b/drivers/acpi/acpica/utosi.c
@@ -150,7 +150,7 @@ acpi_status acpi_ut_initialize_interfaces(void)
150 i < (ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces) - 1); 150 i < (ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces) - 1);
151 i++) { 151 i++) {
152 acpi_default_supported_interfaces[i].next = 152 acpi_default_supported_interfaces[i].next =
153 &acpi_default_supported_interfaces[(acpi_size) i + 1]; 153 &acpi_default_supported_interfaces[(acpi_size)i + 1];
154 } 154 }
155 155
156 acpi_os_release_mutex(acpi_gbl_osi_mutex); 156 acpi_os_release_mutex(acpi_gbl_osi_mutex);
@@ -397,7 +397,7 @@ struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name)
397 * 397 *
398 ******************************************************************************/ 398 ******************************************************************************/
399 399
400acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state) 400acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
401{ 401{
402 union acpi_operand_object *string_desc; 402 union acpi_operand_object *string_desc;
403 union acpi_operand_object *return_desc; 403 union acpi_operand_object *return_desc;
diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c
index 813520ab8ca4..3cd573c5f7f9 100644
--- a/drivers/acpi/acpica/utownerid.c
+++ b/drivers/acpi/acpica/utownerid.c
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("utownerid")
61 * when the method exits or the table is unloaded. 61 * when the method exits or the table is unloaded.
62 * 62 *
63 ******************************************************************************/ 63 ******************************************************************************/
64acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) 64acpi_status acpi_ut_allocate_owner_id(acpi_owner_id *owner_id)
65{ 65{
66 u32 i; 66 u32 i;
67 u32 j; 67 u32 j;
@@ -122,7 +122,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
122 * permanently allocated (prevents +1 overflow) 122 * permanently allocated (prevents +1 overflow)
123 */ 123 */
124 *owner_id = 124 *owner_id =
125 (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); 125 (acpi_owner_id)((k + 1) + ACPI_MUL_32(j));
126 126
127 ACPI_DEBUG_PRINT((ACPI_DB_VALUES, 127 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
128 "Allocated OwnerId: %2.2X\n", 128 "Allocated OwnerId: %2.2X\n",
@@ -167,7 +167,7 @@ exit:
167 * 167 *
168 ******************************************************************************/ 168 ******************************************************************************/
169 169
170void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) 170void acpi_ut_release_owner_id(acpi_owner_id *owner_id_ptr)
171{ 171{
172 acpi_owner_id owner_id = *owner_id_ptr; 172 acpi_owner_id owner_id = *owner_id_ptr;
173 acpi_status status; 173 acpi_status status;
diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c
index 8c218ad787cd..dd084cf52502 100644
--- a/drivers/acpi/acpica/utprint.c
+++ b/drivers/acpi/acpica/utprint.c
@@ -67,11 +67,6 @@ static char *acpi_ut_format_number(char *string,
67 67
68static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper); 68static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper);
69 69
70/* Module globals */
71
72static const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
73static const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
74
75/******************************************************************************* 70/*******************************************************************************
76 * 71 *
77 * FUNCTION: acpi_ut_bound_string_length 72 * FUNCTION: acpi_ut_bound_string_length
@@ -269,9 +264,9 @@ static char *acpi_ut_format_number(char *string,
269 264
270 sign = '\0'; 265 sign = '\0';
271 if (type & ACPI_FORMAT_SIGN) { 266 if (type & ACPI_FORMAT_SIGN) {
272 if ((s64) number < 0) { 267 if ((s64)number < 0) {
273 sign = '-'; 268 sign = '-';
274 number = -(s64) number; 269 number = -(s64)number;
275 width--; 270 width--;
276 } else if (type & ACPI_FORMAT_SIGN_PLUS) { 271 } else if (type & ACPI_FORMAT_SIGN_PLUS) {
277 sign = '+'; 272 sign = '+';
@@ -409,7 +404,7 @@ acpi_ut_vsnprintf(char *string,
409 width = -1; 404 width = -1;
410 if (isdigit((int)*format)) { 405 if (isdigit((int)*format)) {
411 format = acpi_ut_scan_number(format, &number); 406 format = acpi_ut_scan_number(format, &number);
412 width = (s32) number; 407 width = (s32)number;
413 } else if (*format == '*') { 408 } else if (*format == '*') {
414 ++format; 409 ++format;
415 width = va_arg(args, int); 410 width = va_arg(args, int);
@@ -426,7 +421,7 @@ acpi_ut_vsnprintf(char *string,
426 ++format; 421 ++format;
427 if (isdigit((int)*format)) { 422 if (isdigit((int)*format)) {
428 format = acpi_ut_scan_number(format, &number); 423 format = acpi_ut_scan_number(format, &number);
429 precision = (s32) number; 424 precision = (s32)number;
430 } else if (*format == '*') { 425 } else if (*format == '*') {
431 ++format; 426 ++format;
432 precision = va_arg(args, int); 427 precision = va_arg(args, int);
@@ -555,17 +550,17 @@ acpi_ut_vsnprintf(char *string,
555 if (qualifier == 'L') { 550 if (qualifier == 'L') {
556 number = va_arg(args, u64); 551 number = va_arg(args, u64);
557 if (type & ACPI_FORMAT_SIGN) { 552 if (type & ACPI_FORMAT_SIGN) {
558 number = (s64) number; 553 number = (s64)number;
559 } 554 }
560 } else if (qualifier == 'l') { 555 } else if (qualifier == 'l') {
561 number = va_arg(args, unsigned long); 556 number = va_arg(args, unsigned long);
562 if (type & ACPI_FORMAT_SIGN) { 557 if (type & ACPI_FORMAT_SIGN) {
563 number = (s32) number; 558 number = (s32)number;
564 } 559 }
565 } else if (qualifier == 'h') { 560 } else if (qualifier == 'h') {
566 number = (u16)va_arg(args, int); 561 number = (u16)va_arg(args, int);
567 if (type & ACPI_FORMAT_SIGN) { 562 if (type & ACPI_FORMAT_SIGN) {
568 number = (s16) number; 563 number = (s16)number;
569 } 564 }
570 } else { 565 } else {
571 number = va_arg(args, unsigned int); 566 number = va_arg(args, unsigned int);
diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c
index 0b005728db4e..288913a0e709 100644
--- a/drivers/acpi/acpica/utstring.c
+++ b/drivers/acpi/acpica/utstring.c
@@ -130,7 +130,7 @@ void acpi_ut_print_string(char *string, u16 max_length)
130 } else { 130 } else {
131 /* All others will be Hex escapes */ 131 /* All others will be Hex escapes */
132 132
133 acpi_os_printf("\\x%2.2X", (s32) string[i]); 133 acpi_os_printf("\\x%2.2X", (s32)string[i]);
134 } 134 }
135 break; 135 break;
136 } 136 }
@@ -145,73 +145,6 @@ void acpi_ut_print_string(char *string, u16 max_length)
145 145
146/******************************************************************************* 146/*******************************************************************************
147 * 147 *
148 * FUNCTION: acpi_ut_valid_acpi_char
149 *
150 * PARAMETERS: char - The character to be examined
151 * position - Byte position (0-3)
152 *
153 * RETURN: TRUE if the character is valid, FALSE otherwise
154 *
155 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
156 * 1) Upper case alpha
157 * 2) numeric
158 * 3) underscore
159 *
160 * We allow a '!' as the last character because of the ASF! table
161 *
162 ******************************************************************************/
163
164u8 acpi_ut_valid_acpi_char(char character, u32 position)
165{
166
167 if (!((character >= 'A' && character <= 'Z') ||
168 (character >= '0' && character <= '9') || (character == '_'))) {
169
170 /* Allow a '!' in the last position */
171
172 if (character == '!' && position == 3) {
173 return (TRUE);
174 }
175
176 return (FALSE);
177 }
178
179 return (TRUE);
180}
181
182/*******************************************************************************
183 *
184 * FUNCTION: acpi_ut_valid_acpi_name
185 *
186 * PARAMETERS: name - The name to be examined. Does not have to
187 * be NULL terminated string.
188 *
189 * RETURN: TRUE if the name is valid, FALSE otherwise
190 *
191 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
192 * 1) Upper case alpha
193 * 2) numeric
194 * 3) underscore
195 *
196 ******************************************************************************/
197
198u8 acpi_ut_valid_acpi_name(char *name)
199{
200 u32 i;
201
202 ACPI_FUNCTION_ENTRY();
203
204 for (i = 0; i < ACPI_NAME_SIZE; i++) {
205 if (!acpi_ut_valid_acpi_char(name[i], i)) {
206 return (FALSE);
207 }
208 }
209
210 return (TRUE);
211}
212
213/*******************************************************************************
214 *
215 * FUNCTION: acpi_ut_repair_name 148 * FUNCTION: acpi_ut_repair_name
216 * 149 *
217 * PARAMETERS: name - The ACPI name to be repaired 150 * PARAMETERS: name - The ACPI name to be repaired
@@ -253,7 +186,7 @@ void acpi_ut_repair_name(char *name)
253 /* Check each character in the name */ 186 /* Check each character in the name */
254 187
255 for (i = 0; i < ACPI_NAME_SIZE; i++) { 188 for (i = 0; i < ACPI_NAME_SIZE; i++) {
256 if (acpi_ut_valid_acpi_char(name[i], i)) { 189 if (acpi_ut_valid_name_char(name[i], i)) {
257 continue; 190 continue;
258 } 191 }
259 192
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
index 60c406a8efcb..0df07dfa53b6 100644
--- a/drivers/acpi/acpica/uttrack.c
+++ b/drivers/acpi/acpica/uttrack.c
@@ -90,7 +90,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
90 ******************************************************************************/ 90 ******************************************************************************/
91 91
92acpi_status 92acpi_status
93acpi_ut_create_list(char *list_name, 93acpi_ut_create_list(const char *list_name,
94 u16 object_size, struct acpi_memory_list **return_cache) 94 u16 object_size, struct acpi_memory_list **return_cache)
95{ 95{
96 struct acpi_memory_list *cache; 96 struct acpi_memory_list *cache;
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 68d4673f62e6..d9e6aac7dc83 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -127,7 +127,7 @@ ACPI_EXPORT_SYMBOL(acpi_subsystem_status)
127 * and the value of out_buffer is undefined. 127 * and the value of out_buffer is undefined.
128 * 128 *
129 ******************************************************************************/ 129 ******************************************************************************/
130acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) 130acpi_status acpi_get_system_info(struct acpi_buffer *out_buffer)
131{ 131{
132 struct acpi_system_info *info_ptr; 132 struct acpi_system_info *info_ptr;
133 acpi_status status; 133 acpi_status status;
@@ -483,7 +483,7 @@ ACPI_EXPORT_SYMBOL(acpi_check_address_range)
483 ******************************************************************************/ 483 ******************************************************************************/
484acpi_status 484acpi_status
485acpi_decode_pld_buffer(u8 *in_buffer, 485acpi_decode_pld_buffer(u8 *in_buffer,
486 acpi_size length, struct acpi_pld_info ** return_buffer) 486 acpi_size length, struct acpi_pld_info **return_buffer)
487{ 487{
488 struct acpi_pld_info *pld_info; 488 struct acpi_pld_info *pld_info;
489 u32 *buffer = ACPI_CAST_PTR(u32, in_buffer); 489 u32 *buffer = ACPI_CAST_PTR(u32, in_buffer);
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 814d5f83b75e..bef06c9503cd 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -582,7 +582,7 @@ static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
582 582
583acpi_status 583acpi_status
584acpi_os_predefined_override(const struct acpi_predefined_names *init_val, 584acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
585 char **new_val) 585 acpi_string *new_val)
586{ 586{
587 if (!init_val || !new_val) 587 if (!init_val || !new_val)
588 return AE_BAD_PARAMETER; 588 return AE_BAD_PARAMETER;
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index d1e34d1eeea6..562603d7aabe 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -96,7 +96,7 @@ acpi_physical_address acpi_os_get_root_pointer(void);
96#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override 96#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
97acpi_status 97acpi_status
98acpi_os_predefined_override(const struct acpi_predefined_names *init_val, 98acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
99 char **new_val); 99 acpi_string *new_val);
100#endif 100#endif
101 101
102#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override 102#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override
@@ -108,7 +108,7 @@ acpi_os_table_override(struct acpi_table_header *existing_table,
108#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override 108#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override
109acpi_status 109acpi_status
110acpi_os_physical_table_override(struct acpi_table_header *existing_table, 110acpi_os_physical_table_override(struct acpi_table_header *existing_table,
111 acpi_physical_address * new_address, 111 acpi_physical_address *new_address,
112 u32 *new_table_length); 112 u32 *new_table_length);
113#endif 113#endif
114 114
@@ -203,7 +203,7 @@ void acpi_os_unmap_memory(void *logical_address, acpi_size size);
203#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address 203#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address
204acpi_status 204acpi_status
205acpi_os_get_physical_address(void *logical_address, 205acpi_os_get_physical_address(void *logical_address,
206 acpi_physical_address * physical_address); 206 acpi_physical_address *physical_address);
207#endif 207#endif
208 208
209/* 209/*
@@ -379,14 +379,14 @@ acpi_status
379acpi_os_get_table_by_name(char *signature, 379acpi_os_get_table_by_name(char *signature,
380 u32 instance, 380 u32 instance,
381 struct acpi_table_header **table, 381 struct acpi_table_header **table,
382 acpi_physical_address * address); 382 acpi_physical_address *address);
383#endif 383#endif
384 384
385#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index 385#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
386acpi_status 386acpi_status
387acpi_os_get_table_by_index(u32 index, 387acpi_os_get_table_by_index(u32 index,
388 struct acpi_table_header **table, 388 struct acpi_table_header **table,
389 u32 *instance, acpi_physical_address * address); 389 u32 *instance, acpi_physical_address *address);
390#endif 390#endif
391 391
392#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address 392#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 17556979dc79..1ff3a76c265d 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20160108 49#define ACPI_CA_VERSION 0x20160422
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -484,8 +484,8 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void))
484ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void)) 484ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void))
485 485
486ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init 486ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
487 acpi_find_root_pointer(acpi_physical_address * 487 acpi_find_root_pointer(acpi_physical_address
488 rsdp_address)) 488 *rsdp_address))
489ACPI_EXTERNAL_RETURN_STATUS(acpi_status 489ACPI_EXTERNAL_RETURN_STATUS(acpi_status
490 acpi_get_table_header(acpi_string signature, 490 acpi_get_table_header(acpi_string signature,
491 u32 instance, 491 u32 instance,
@@ -530,7 +530,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
530ACPI_EXTERNAL_RETURN_STATUS(acpi_status 530ACPI_EXTERNAL_RETURN_STATUS(acpi_status
531 acpi_get_handle(acpi_handle parent, 531 acpi_get_handle(acpi_handle parent,
532 acpi_string pathname, 532 acpi_string pathname,
533 acpi_handle * ret_handle)) 533 acpi_handle *ret_handle))
534ACPI_EXTERNAL_RETURN_STATUS(acpi_status 534ACPI_EXTERNAL_RETURN_STATUS(acpi_status
535 acpi_attach_data(acpi_handle object, 535 acpi_attach_data(acpi_handle object,
536 acpi_object_handler handler, 536 acpi_object_handler handler,
@@ -575,15 +575,15 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
575 acpi_get_next_object(acpi_object_type type, 575 acpi_get_next_object(acpi_object_type type,
576 acpi_handle parent, 576 acpi_handle parent,
577 acpi_handle child, 577 acpi_handle child,
578 acpi_handle * out_handle)) 578 acpi_handle *out_handle))
579 579
580ACPI_EXTERNAL_RETURN_STATUS(acpi_status 580ACPI_EXTERNAL_RETURN_STATUS(acpi_status
581 acpi_get_type(acpi_handle object, 581 acpi_get_type(acpi_handle object,
582 acpi_object_type * out_type)) 582 acpi_object_type *out_type))
583 583
584ACPI_EXTERNAL_RETURN_STATUS(acpi_status 584ACPI_EXTERNAL_RETURN_STATUS(acpi_status
585 acpi_get_parent(acpi_handle object, 585 acpi_get_parent(acpi_handle object,
586 acpi_handle * out_handle)) 586 acpi_handle *out_handle))
587 587
588/* 588/*
589 * Handler interfaces 589 * Handler interfaces
@@ -755,7 +755,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void))
755 755
756ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 756ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
757 acpi_get_gpe_device(u32 gpe_index, 757 acpi_get_gpe_device(u32 gpe_index,
758 acpi_handle * gpe_device)) 758 acpi_handle *gpe_device))
759 759
760ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 760ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
761 acpi_install_gpe_block(acpi_handle gpe_device, 761 acpi_install_gpe_block(acpi_handle gpe_device,
@@ -771,8 +771,8 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
771 * Resource interfaces 771 * Resource interfaces
772 */ 772 */
773typedef 773typedef
774acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, 774acpi_status (*acpi_walk_resource_callback) (struct acpi_resource * resource,
775 void *context); 775 void *context);
776 776
777ACPI_EXTERNAL_RETURN_STATUS(acpi_status 777ACPI_EXTERNAL_RETURN_STATUS(acpi_status
778 acpi_get_vendor_resource(acpi_handle device, 778 acpi_get_vendor_resource(acpi_handle device,
@@ -938,7 +938,8 @@ ACPI_DBG_DEPENDENT_RETURN_VOID(void
938ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1) 938ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
939 void ACPI_INTERNAL_VAR_XFACE 939 void ACPI_INTERNAL_VAR_XFACE
940 acpi_log_error(const char *format, ...)) 940 acpi_log_error(const char *format, ...))
941 acpi_status acpi_initialize_debugger(void); 941
942acpi_status acpi_initialize_debugger(void);
942 943
943void acpi_terminate_debugger(void); 944void acpi_terminate_debugger(void);
944 945
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index cf2acb84dfeb..16c189283ea0 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -417,6 +417,7 @@ struct acpi_resource_gpio {
417 u8 type; \ 417 u8 type; \
418 u8 producer_consumer; /* For values, see Producer/Consumer above */\ 418 u8 producer_consumer; /* For values, see Producer/Consumer above */\
419 u8 slave_mode; \ 419 u8 slave_mode; \
420 u8 connection_sharing; \
420 u8 type_revision_id; \ 421 u8 type_revision_id; \
421 u16 type_data_length; \ 422 u16 type_data_length; \
422 u16 vendor_length; \ 423 u16 vendor_length; \
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 0cb1a0036986..c19700e2a2fe 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -223,7 +223,7 @@ struct acpi_table_facs {
223/******************************************************************************* 223/*******************************************************************************
224 * 224 *
225 * FADT - Fixed ACPI Description Table (Signature "FACP") 225 * FADT - Fixed ACPI Description Table (Signature "FACP")
226 * Version 4 226 * Version 6
227 * 227 *
228 ******************************************************************************/ 228 ******************************************************************************/
229 229
@@ -413,4 +413,6 @@ struct acpi_table_desc {
413#define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id)) 413#define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id))
414#define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt)) 414#define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt))
415 415
416#define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)"
417
416#endif /* __ACTBL_H__ */ 418#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 16e013600c19..796d6baae3a3 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -236,7 +236,8 @@ enum acpi_einj_actions {
236 ACPI_EINJ_CHECK_BUSY_STATUS = 6, 236 ACPI_EINJ_CHECK_BUSY_STATUS = 6,
237 ACPI_EINJ_GET_COMMAND_STATUS = 7, 237 ACPI_EINJ_GET_COMMAND_STATUS = 7,
238 ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8, 238 ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8,
239 ACPI_EINJ_ACTION_RESERVED = 9, /* 9 and greater are reserved */ 239 ACPI_EINJ_GET_EXECUTE_TIMINGS = 9,
240 ACPI_EINJ_ACTION_RESERVED = 10, /* 10 and greater are reserved */
240 ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ 241 ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */
241}; 242};
242 243
@@ -348,7 +349,8 @@ enum acpi_erst_actions {
348 ACPI_ERST_GET_ERROR_RANGE = 13, 349 ACPI_ERST_GET_ERROR_RANGE = 13,
349 ACPI_ERST_GET_ERROR_LENGTH = 14, 350 ACPI_ERST_GET_ERROR_LENGTH = 14,
350 ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, 351 ACPI_ERST_GET_ERROR_ATTRIBUTES = 15,
351 ACPI_ERST_ACTION_RESERVED = 16 /* 16 and greater are reserved */ 352 ACPI_ERST_EXECUTE_TIMINGS = 16,
353 ACPI_ERST_ACTION_RESERVED = 17 /* 17 and greater are reserved */
352}; 354};
353 355
354/* Values for Instruction field above */ 356/* Values for Instruction field above */
@@ -427,7 +429,8 @@ enum acpi_hest_types {
427 ACPI_HEST_TYPE_AER_ENDPOINT = 7, 429 ACPI_HEST_TYPE_AER_ENDPOINT = 7,
428 ACPI_HEST_TYPE_AER_BRIDGE = 8, 430 ACPI_HEST_TYPE_AER_BRIDGE = 8,
429 ACPI_HEST_TYPE_GENERIC_ERROR = 9, 431 ACPI_HEST_TYPE_GENERIC_ERROR = 9,
430 ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ 432 ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10,
433 ACPI_HEST_TYPE_RESERVED = 11 /* 11 and greater are reserved */
431}; 434};
432 435
433/* 436/*
@@ -506,7 +509,11 @@ enum acpi_hest_notify_types {
506 ACPI_HEST_NOTIFY_NMI = 4, 509 ACPI_HEST_NOTIFY_NMI = 4,
507 ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ 510 ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */
508 ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ 511 ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */
509 ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */ 512 ACPI_HEST_NOTIFY_GPIO = 7, /* ACPI 6.0 */
513 ACPI_HEST_NOTIFY_SEA = 8, /* ACPI 6.1 */
514 ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */
515 ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */
516 ACPI_HEST_NOTIFY_RESERVED = 11 /* 11 and greater are reserved */
510}; 517};
511 518
512/* Values for config_write_enable bitfield above */ 519/* Values for config_write_enable bitfield above */
@@ -603,6 +610,24 @@ struct acpi_hest_generic {
603 u32 error_block_length; 610 u32 error_block_length;
604}; 611};
605 612
613/* 10: Generic Hardware Error Source, version 2 */
614
615struct acpi_hest_generic_v2 {
616 struct acpi_hest_header header;
617 u16 related_source_id;
618 u8 reserved;
619 u8 enabled;
620 u32 records_to_preallocate;
621 u32 max_sections_per_record;
622 u32 max_raw_data_length;
623 struct acpi_generic_address error_status_address;
624 struct acpi_hest_notify notify;
625 u32 error_block_length;
626 struct acpi_generic_address read_ack_register;
627 u64 read_ack_preserve;
628 u64 read_ack_write;
629};
630
606/* Generic Error Status block */ 631/* Generic Error Status block */
607 632
608struct acpi_hest_generic_status { 633struct acpi_hest_generic_status {
@@ -634,6 +659,33 @@ struct acpi_hest_generic_data {
634 u8 fru_text[20]; 659 u8 fru_text[20];
635}; 660};
636 661
662/* Extension for revision 0x0300 */
663
664struct acpi_hest_generic_data_v300 {
665 u8 section_type[16];
666 u32 error_severity;
667 u16 revision;
668 u8 validation_bits;
669 u8 flags;
670 u32 error_data_length;
671 u8 fru_id[16];
672 u8 fru_text[20];
673 u64 time_stamp;
674};
675
676/* Values for error_severity above */
677
678#define ACPI_HEST_GEN_ERROR_RECOVERABLE 0
679#define ACPI_HEST_GEN_ERROR_FATAL 1
680#define ACPI_HEST_GEN_ERROR_CORRECTED 2
681#define ACPI_HEST_GEN_ERROR_NONE 3
682
683/* Flags for validation_bits above */
684
685#define ACPI_HEST_GEN_VALID_FRU_ID (1)
686#define ACPI_HEST_GEN_VALID_FRU_STRING (1<<1)
687#define ACPI_HEST_GEN_VALID_TIMESTAMP (1<<2)
688
637/******************************************************************************* 689/*******************************************************************************
638 * 690 *
639 * MADT - Multiple APIC Description Table 691 * MADT - Multiple APIC Description Table
@@ -934,7 +986,7 @@ struct acpi_msct_proximity {
934 986
935/******************************************************************************* 987/*******************************************************************************
936 * 988 *
937 * NFIT - NVDIMM Interface Table (ACPI 6.0) 989 * NFIT - NVDIMM Interface Table (ACPI 6.0+)
938 * Version 1 990 * Version 1
939 * 991 *
940 ******************************************************************************/ 992 ******************************************************************************/
@@ -1015,6 +1067,7 @@ struct acpi_nfit_memory_map {
1015#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */ 1067#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */
1016#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */ 1068#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */
1017#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */ 1069#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */
1070#define ACPI_NFIT_MEM_MAP_FAILED (1<<6) /* 06: Mapping to SPA failed */
1018 1071
1019/* 2: Interleave Structure */ 1072/* 2: Interleave Structure */
1020 1073
@@ -1046,7 +1099,10 @@ struct acpi_nfit_control_region {
1046 u16 subsystem_vendor_id; 1099 u16 subsystem_vendor_id;
1047 u16 subsystem_device_id; 1100 u16 subsystem_device_id;
1048 u16 subsystem_revision_id; 1101 u16 subsystem_revision_id;
1049 u8 reserved[6]; /* Reserved, must be zero */ 1102 u8 valid_fields;
1103 u8 manufacturing_location;
1104 u16 manufacturing_date;
1105 u8 reserved[2]; /* Reserved, must be zero */
1050 u32 serial_number; 1106 u32 serial_number;
1051 u16 code; 1107 u16 code;
1052 u16 windows; 1108 u16 windows;
@@ -1061,7 +1117,11 @@ struct acpi_nfit_control_region {
1061 1117
1062/* Flags */ 1118/* Flags */
1063 1119
1064#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */ 1120#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */
1121
1122/* valid_fields bits */
1123
1124#define ACPI_NFIT_CONTROL_MFG_INFO_VALID (1) /* Manufacturing fields are valid */
1065 1125
1066/* 5: NVDIMM Block Data Window Region Structure */ 1126/* 5: NVDIMM Block Data Window Region Structure */
1067 1127
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index a4ef62537cac..c93dbadfc71d 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -321,7 +321,7 @@ struct acpi_csrt_descriptor {
321 * DBG2 - Debug Port Table 2 321 * DBG2 - Debug Port Table 2
322 * Version 0 (Both main table and subtables) 322 * Version 0 (Both main table and subtables)
323 * 323 *
324 * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012. 324 * Conforms to "Microsoft Debug Port Table 2 (DBG2)", December 10, 2015
325 * 325 *
326 ******************************************************************************/ 326 ******************************************************************************/
327 327
@@ -371,6 +371,11 @@ struct acpi_dbg2_device {
371 371
372#define ACPI_DBG2_16550_COMPATIBLE 0x0000 372#define ACPI_DBG2_16550_COMPATIBLE 0x0000
373#define ACPI_DBG2_16550_SUBSET 0x0001 373#define ACPI_DBG2_16550_SUBSET 0x0001
374#define ACPI_DBG2_ARM_PL011 0x0003
375#define ACPI_DBG2_ARM_SBSA_32BIT 0x000D
376#define ACPI_DBG2_ARM_SBSA_GENERIC 0x000E
377#define ACPI_DBG2_ARM_DCC 0x000F
378#define ACPI_DBG2_BCM2835 0x0010
374 379
375#define ACPI_DBG2_1394_STANDARD 0x0000 380#define ACPI_DBG2_1394_STANDARD 0x0000
376 381
@@ -399,7 +404,7 @@ struct acpi_table_dbgp {
399 * Version 1 404 * Version 1
400 * 405 *
401 * Conforms to "Intel Virtualization Technology for Directed I/O", 406 * Conforms to "Intel Virtualization Technology for Directed I/O",
402 * Version 2.2, Sept. 2013 407 * Version 2.3, October 2014
403 * 408 *
404 ******************************************************************************/ 409 ******************************************************************************/
405 410
@@ -413,6 +418,8 @@ struct acpi_table_dmar {
413/* Masks for Flags field above */ 418/* Masks for Flags field above */
414 419
415#define ACPI_DMAR_INTR_REMAP (1) 420#define ACPI_DMAR_INTR_REMAP (1)
421#define ACPI_DMAR_X2APIC_OPT_OUT (1<<1)
422#define ACPI_DMAR_X2APIC_MODE (1<<2)
416 423
417/* DMAR subtable header */ 424/* DMAR subtable header */
418 425
@@ -655,7 +662,7 @@ struct acpi_ibft_target {
655 * IORT - IO Remapping Table 662 * IORT - IO Remapping Table
656 * 663 *
657 * Conforms to "IO Remapping Table System Software on ARM Platforms", 664 * Conforms to "IO Remapping Table System Software on ARM Platforms",
658 * Document number: ARM DEN 0049A, 2015 665 * Document number: ARM DEN 0049B, October 2015
659 * 666 *
660 ******************************************************************************/ 667 ******************************************************************************/
661 668
@@ -685,7 +692,8 @@ enum acpi_iort_node_type {
685 ACPI_IORT_NODE_ITS_GROUP = 0x00, 692 ACPI_IORT_NODE_ITS_GROUP = 0x00,
686 ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, 693 ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
687 ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, 694 ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
688 ACPI_IORT_NODE_SMMU = 0x03 695 ACPI_IORT_NODE_SMMU = 0x03,
696 ACPI_IORT_NODE_SMMU_V3 = 0x04
689}; 697};
690 698
691struct acpi_iort_id_mapping { 699struct acpi_iort_id_mapping {
@@ -775,6 +783,23 @@ struct acpi_iort_smmu {
775#define ACPI_IORT_SMMU_DVM_SUPPORTED (1) 783#define ACPI_IORT_SMMU_DVM_SUPPORTED (1)
776#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1) 784#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1)
777 785
786struct acpi_iort_smmu_v3 {
787 u64 base_address; /* SMMUv3 base address */
788 u32 flags;
789 u32 reserved;
790 u64 vatos_address;
791 u32 model; /* O: generic SMMUv3 */
792 u32 event_gsiv;
793 u32 pri_gsiv;
794 u32 gerr_gsiv;
795 u32 sync_gsiv;
796};
797
798/* Masks for Flags field above */
799
800#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1)
801#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (1<<1)
802
778/******************************************************************************* 803/*******************************************************************************
779 * 804 *
780 * IVRS - I/O Virtualization Reporting Structure 805 * IVRS - I/O Virtualization Reporting Structure
@@ -1102,10 +1127,10 @@ struct acpi_table_slic {
1102/******************************************************************************* 1127/*******************************************************************************
1103 * 1128 *
1104 * SPCR - Serial Port Console Redirection table 1129 * SPCR - Serial Port Console Redirection table
1105 * Version 1 1130 * Version 2
1106 * 1131 *
1107 * Conforms to "Serial Port Console Redirection Table", 1132 * Conforms to "Serial Port Console Redirection Table",
1108 * Version 1.00, January 11, 2002 1133 * Version 1.03, August 10, 2015
1109 * 1134 *
1110 ******************************************************************************/ 1135 ******************************************************************************/
1111 1136
@@ -1137,6 +1162,8 @@ struct acpi_table_spcr {
1137 1162
1138#define ACPI_SPCR_DO_NOT_DISABLE (1) 1163#define ACPI_SPCR_DO_NOT_DISABLE (1)
1139 1164
1165/* Values for Interface Type: See the definition of the DBG2 table */
1166
1140/******************************************************************************* 1167/*******************************************************************************
1141 * 1168 *
1142 * SPMI - Server Platform Management Interface table 1169 * SPMI - Server Platform Management Interface table
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index ddf5e66c3b15..ebc1f4f9fe66 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -184,7 +184,7 @@ struct acpi_table_fpdt {
184 struct acpi_table_header header; /* Common ACPI table header */ 184 struct acpi_table_header header; /* Common ACPI table header */
185}; 185};
186 186
187/* FPDT subtable header */ 187/* FPDT subtable header (Performance Record Structure) */
188 188
189struct acpi_fpdt_header { 189struct acpi_fpdt_header {
190 u16 type; 190 u16 type;
@@ -205,19 +205,15 @@ enum acpi_fpdt_type {
205 205
206/* 0: Firmware Basic Boot Performance Record */ 206/* 0: Firmware Basic Boot Performance Record */
207 207
208struct acpi_fpdt_boot { 208struct acpi_fpdt_boot_pointer {
209 struct acpi_fpdt_header header; 209 struct acpi_fpdt_header header;
210 u8 reserved[4]; 210 u8 reserved[4];
211 u64 reset_end; 211 u64 address;
212 u64 load_start;
213 u64 startup_start;
214 u64 exit_services_entry;
215 u64 exit_services_exit;
216}; 212};
217 213
218/* 1: S3 Performance Table Pointer Record */ 214/* 1: S3 Performance Table Pointer Record */
219 215
220struct acpi_fpdt_s3pt_ptr { 216struct acpi_fpdt_s3pt_pointer {
221 struct acpi_fpdt_header header; 217 struct acpi_fpdt_header header;
222 u8 reserved[4]; 218 u8 reserved[4];
223 u64 address; 219 u64 address;
@@ -225,7 +221,7 @@ struct acpi_fpdt_s3pt_ptr {
225 221
226/* 222/*
227 * S3PT - S3 Performance Table. This table is pointed to by the 223 * S3PT - S3 Performance Table. This table is pointed to by the
228 * FPDT S3 Pointer Record above. 224 * S3 Pointer Record above.
229 */ 225 */
230struct acpi_table_s3pt { 226struct acpi_table_s3pt {
231 u8 signature[4]; /* "S3PT" */ 227 u8 signature[4]; /* "S3PT" */
@@ -233,34 +229,43 @@ struct acpi_table_s3pt {
233}; 229};
234 230
235/* 231/*
236 * S3PT Subtables 232 * S3PT Subtables (Not part of the actual FPDT)
237 */ 233 */
238struct acpi_s3pt_header {
239 u16 type;
240 u8 length;
241 u8 revision;
242};
243 234
244/* Values for Type field above */ 235/* Values for Type field in S3PT header */
245 236
246enum acpi_s3pt_type { 237enum acpi_s3pt_type {
247 ACPI_S3PT_TYPE_RESUME = 0, 238 ACPI_S3PT_TYPE_RESUME = 0,
248 ACPI_S3PT_TYPE_SUSPEND = 1 239 ACPI_S3PT_TYPE_SUSPEND = 1,
240 ACPI_FPDT_BOOT_PERFORMANCE = 2
249}; 241};
250 242
251struct acpi_s3pt_resume { 243struct acpi_s3pt_resume {
252 struct acpi_s3pt_header header; 244 struct acpi_fpdt_header header;
253 u32 resume_count; 245 u32 resume_count;
254 u64 full_resume; 246 u64 full_resume;
255 u64 average_resume; 247 u64 average_resume;
256}; 248};
257 249
258struct acpi_s3pt_suspend { 250struct acpi_s3pt_suspend {
259 struct acpi_s3pt_header header; 251 struct acpi_fpdt_header header;
260 u64 suspend_start; 252 u64 suspend_start;
261 u64 suspend_end; 253 u64 suspend_end;
262}; 254};
263 255
256/*
257 * FPDT Boot Performance Record (Not part of the actual FPDT)
258 */
259struct acpi_fpdt_boot {
260 struct acpi_fpdt_header header;
261 u8 reserved[4];
262 u64 reset_end;
263 u64 load_start;
264 u64 startup_start;
265 u64 exit_services_entry;
266 u64 exit_services_exit;
267};
268
264/******************************************************************************* 269/*******************************************************************************
265 * 270 *
266 * GTDT - Generic Timer Description Table (ACPI 5.1) 271 * GTDT - Generic Timer Description Table (ACPI 5.1)
@@ -476,7 +481,8 @@ struct acpi_table_pcct {
476enum acpi_pcct_type { 481enum acpi_pcct_type {
477 ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, 482 ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
478 ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, 483 ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
479 ACPI_PCCT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ 484 ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, /* ACPI 6.1 */
485 ACPI_PCCT_TYPE_RESERVED = 3 /* 3 and greater are reserved */
480}; 486};
481 487
482/* 488/*
@@ -515,6 +521,26 @@ struct acpi_pcct_hw_reduced {
515 u16 min_turnaround_time; 521 u16 min_turnaround_time;
516}; 522};
517 523
524/* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
525
526struct acpi_pcct_hw_reduced_type2 {
527 struct acpi_subtable_header header;
528 u32 doorbell_interrupt;
529 u8 flags;
530 u8 reserved;
531 u64 base_address;
532 u64 length;
533 struct acpi_generic_address doorbell_register;
534 u64 preserve_mask;
535 u64 write_mask;
536 u32 latency;
537 u32 max_access_rate;
538 u16 min_turnaround_time;
539 struct acpi_generic_address doorbell_ack_register;
540 u64 ack_preserve_mask;
541 u64 ack_write_mask;
542};
543
518/* Values for doorbell flags above */ 544/* Values for doorbell flags above */
519 545
520#define ACPI_PCCT_INTERRUPT_POLARITY (1) 546#define ACPI_PCCT_INTERRUPT_POLARITY (1)
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index db46546d3b9d..cb389efd321c 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -630,7 +630,8 @@ typedef u64 acpi_integer;
630#define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C 630#define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C
631#define ACPI_NOTIFY_AFFINITY_UPDATE (u8) 0x0D 631#define ACPI_NOTIFY_AFFINITY_UPDATE (u8) 0x0D
632 632
633#define ACPI_NOTIFY_MAX 0x0D 633#define ACPI_GENERIC_NOTIFY_MAX 0x0D
634#define ACPI_SPECIFIC_NOTIFY_MAX 0x84
634 635
635/* 636/*
636 * Types associated with ACPI names and objects. The first group of 637 * Types associated with ACPI names and objects. The first group of
@@ -892,7 +893,7 @@ typedef u8 acpi_adr_space_type;
892 893
893/* Sleep function dispatch */ 894/* Sleep function dispatch */
894 895
895typedef acpi_status(*acpi_sleep_function) (u8 sleep_state); 896typedef acpi_status (*acpi_sleep_function) (u8 sleep_state);
896 897
897struct acpi_sleep_functions { 898struct acpi_sleep_functions {
898 acpi_sleep_function legacy_function; 899 acpi_sleep_function legacy_function;
@@ -994,7 +995,7 @@ struct acpi_buffer {
994 * Predefined Namespace items 995 * Predefined Namespace items
995 */ 996 */
996struct acpi_predefined_names { 997struct acpi_predefined_names {
997 char *name; 998 const char *name;
998 u8 type; 999 u8 type;
999 char *val; 1000 char *val;
1000}; 1001};
@@ -1071,20 +1072,21 @@ void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
1071typedef 1072typedef
1072void (*acpi_object_handler) (acpi_handle object, void *data); 1073void (*acpi_object_handler) (acpi_handle object, void *data);
1073 1074
1074typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); 1075typedef
1076acpi_status (*acpi_init_handler) (acpi_handle object, u32 function);
1075 1077
1076#define ACPI_INIT_DEVICE_INI 1 1078#define ACPI_INIT_DEVICE_INI 1
1077 1079
1078typedef 1080typedef
1079acpi_status(*acpi_exception_handler) (acpi_status aml_status, 1081acpi_status (*acpi_exception_handler) (acpi_status aml_status,
1080 acpi_name name, 1082 acpi_name name,
1081 u16 opcode, 1083 u16 opcode,
1082 u32 aml_offset, void *context); 1084 u32 aml_offset, void *context);
1083 1085
1084/* Table Event handler (Load, load_table, etc.) and types */ 1086/* Table Event handler (Load, load_table, etc.) and types */
1085 1087
1086typedef 1088typedef
1087acpi_status(*acpi_table_handler) (u32 event, void *table, void *context); 1089acpi_status (*acpi_table_handler) (u32 event, void *table, void *context);
1088 1090
1089#define ACPI_TABLE_LOAD 0x0 1091#define ACPI_TABLE_LOAD 0x0
1090#define ACPI_TABLE_UNLOAD 0x1 1092#define ACPI_TABLE_UNLOAD 0x1
@@ -1093,12 +1095,12 @@ acpi_status(*acpi_table_handler) (u32 event, void *table, void *context);
1093/* Address Spaces (For Operation Regions) */ 1095/* Address Spaces (For Operation Regions) */
1094 1096
1095typedef 1097typedef
1096acpi_status(*acpi_adr_space_handler) (u32 function, 1098acpi_status (*acpi_adr_space_handler) (u32 function,
1097 acpi_physical_address address, 1099 acpi_physical_address address,
1098 u32 bit_width, 1100 u32 bit_width,
1099 u64 *value, 1101 u64 *value,
1100 void *handler_context, 1102 void *handler_context,
1101 void *region_context); 1103 void *region_context);
1102 1104
1103#define ACPI_DEFAULT_HANDLER NULL 1105#define ACPI_DEFAULT_HANDLER NULL
1104 1106
@@ -1111,18 +1113,18 @@ struct acpi_connection_info {
1111}; 1113};
1112 1114
1113typedef 1115typedef
1114acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, 1116acpi_status (*acpi_adr_space_setup) (acpi_handle region_handle,
1115 u32 function, 1117 u32 function,
1116 void *handler_context, 1118 void *handler_context,
1117 void **region_context); 1119 void **region_context);
1118 1120
1119#define ACPI_REGION_ACTIVATE 0 1121#define ACPI_REGION_ACTIVATE 0
1120#define ACPI_REGION_DEACTIVATE 1 1122#define ACPI_REGION_DEACTIVATE 1
1121 1123
1122typedef 1124typedef
1123acpi_status(*acpi_walk_callback) (acpi_handle object, 1125acpi_status (*acpi_walk_callback) (acpi_handle object,
1124 u32 nesting_level, 1126 u32 nesting_level,
1125 void *context, void **return_value); 1127 void *context, void **return_value);
1126 1128
1127typedef 1129typedef
1128u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported); 1130u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported);
@@ -1227,7 +1229,7 @@ struct acpi_mem_space_context {
1227 * struct acpi_memory_list is used only if the ACPICA local cache is enabled 1229 * struct acpi_memory_list is used only if the ACPICA local cache is enabled
1228 */ 1230 */
1229struct acpi_memory_list { 1231struct acpi_memory_list {
1230 char *list_name; 1232 const char *list_name;
1231 void *list_head; 1233 void *list_head;
1232 u16 object_size; 1234 u16 object_size;
1233 u16 max_depth; 1235 u16 max_depth;
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 7c0595bde132..86b5a8447606 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -66,17 +66,28 @@
66 * 66 *
67 *****************************************************************************/ 67 *****************************************************************************/
68 68
69/* Common application configuration. All single threaded except for acpi_exec. */
70
71#if (defined ACPI_ASL_COMPILER) || \
72 (defined ACPI_BIN_APP) || \
73 (defined ACPI_DUMP_APP) || \
74 (defined ACPI_HELP_APP) || \
75 (defined ACPI_NAMES_APP) || \
76 (defined ACPI_SRC_APP) || \
77 (defined ACPI_XTRACT_APP) || \
78 (defined ACPI_EXAMPLE_APP)
79#define ACPI_APPLICATION
80#define ACPI_SINGLE_THREADED
81#endif
82
69/* iASL configuration */ 83/* iASL configuration */
70 84
71#ifdef ACPI_ASL_COMPILER 85#ifdef ACPI_ASL_COMPILER
72#define ACPI_APPLICATION
73#define ACPI_DEBUG_OUTPUT 86#define ACPI_DEBUG_OUTPUT
74#define ACPI_CONSTANT_EVAL_ONLY 87#define ACPI_CONSTANT_EVAL_ONLY
75#define ACPI_LARGE_NAMESPACE_NODE 88#define ACPI_LARGE_NAMESPACE_NODE
76#define ACPI_DATA_TABLE_DISASSEMBLY 89#define ACPI_DATA_TABLE_DISASSEMBLY
77#define ACPI_SINGLE_THREADED
78#define ACPI_32BIT_PHYSICAL_ADDRESS 90#define ACPI_32BIT_PHYSICAL_ADDRESS
79
80#define ACPI_DISASSEMBLER 1 91#define ACPI_DISASSEMBLER 1
81#endif 92#endif
82 93
@@ -89,21 +100,6 @@
89#define ACPI_DBG_TRACK_ALLOCATIONS 100#define ACPI_DBG_TRACK_ALLOCATIONS
90#endif 101#endif
91 102
92/*
93 * acpi_bin/acpi_dump/acpi_help/acpi_names/acpi_src/acpi_xtract/Example
94 * configuration. All single threaded.
95 */
96#if (defined ACPI_BIN_APP) || \
97 (defined ACPI_DUMP_APP) || \
98 (defined ACPI_HELP_APP) || \
99 (defined ACPI_NAMES_APP) || \
100 (defined ACPI_SRC_APP) || \
101 (defined ACPI_XTRACT_APP) || \
102 (defined ACPI_EXAMPLE_APP)
103#define ACPI_APPLICATION
104#define ACPI_SINGLE_THREADED
105#endif
106
107/* acpi_help configuration. Error messages disabled. */ 103/* acpi_help configuration. Error messages disabled. */
108 104
109#ifdef ACPI_HELP_APP 105#ifdef ACPI_HELP_APP
@@ -138,11 +134,16 @@
138#define ACPI_REDUCED_HARDWARE 1 134#define ACPI_REDUCED_HARDWARE 1
139#endif 135#endif
140 136
141/* Linkable ACPICA library */ 137/* Linkable ACPICA library. Two versions, one with full debug. */
142 138
143#ifdef ACPI_LIBRARY 139#ifdef ACPI_LIBRARY
144#define ACPI_USE_LOCAL_CACHE 140#define ACPI_USE_LOCAL_CACHE
145#define ACPI_FULL_DEBUG 141#define ACPI_DEBUGGER 1
142#define ACPI_DISASSEMBLER 1
143
144#ifdef _DEBUG
145#define ACPI_DEBUG_OUTPUT
146#endif
146#endif 147#endif
147 148
148/* Common for all ACPICA applications */ 149/* Common for all ACPICA applications */
@@ -218,6 +219,9 @@
218#elif defined(__HAIKU__) 219#elif defined(__HAIKU__)
219#include "achaiku.h" 220#include "achaiku.h"
220 221
222#elif defined(__QNX__)
223#include "acqnx.h"
224
221#else 225#else
222 226
223/* Unknown environment */ 227/* Unknown environment */
diff --git a/include/acpi/platform/acmsvcex.h b/include/acpi/platform/acmsvcex.h
deleted file mode 100644
index 28084a1034fe..000000000000
--- a/include/acpi/platform/acmsvcex.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acmsvcex.h - Extra VC specific defines, etc.
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2016, 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#ifndef __ACMSVCEX_H__
45#define __ACMSVCEX_H__
46
47/* Debug support. */
48
49#ifdef _DEBUG
50#define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */
51#include <crtdbg.h>
52#endif
53
54#endif /* __ACMSVCEX_H__ */
diff --git a/include/acpi/platform/acwinex.h b/include/acpi/platform/acwinex.h
deleted file mode 100644
index a00b3e4b80b0..000000000000
--- a/include/acpi/platform/acwinex.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acwinex.h - Extra OS specific defines, etc.
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2016, 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#ifndef __ACWINEX_H__
45#define __ACWINEX_H__
46
47/* Windows uses VC */
48
49#endif /* __ACWINEX_H__ */
diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
index d0e6b857d8d1..546cf4a503b7 100644
--- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
+++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
@@ -91,7 +91,7 @@ osl_get_customized_table(char *pathname,
91 char *signature, 91 char *signature,
92 u32 instance, 92 u32 instance,
93 struct acpi_table_header **table, 93 struct acpi_table_header **table,
94 acpi_physical_address * address); 94 acpi_physical_address *address);
95 95
96static acpi_status osl_list_bios_tables(void); 96static acpi_status osl_list_bios_tables(void);
97 97
@@ -99,7 +99,7 @@ static acpi_status
99osl_get_bios_table(char *signature, 99osl_get_bios_table(char *signature,
100 u32 instance, 100 u32 instance,
101 struct acpi_table_header **table, 101 struct acpi_table_header **table,
102 acpi_physical_address * address); 102 acpi_physical_address *address);
103 103
104static acpi_status osl_get_last_status(acpi_status default_status); 104static acpi_status osl_get_last_status(acpi_status default_status);
105 105
@@ -187,7 +187,7 @@ static acpi_status osl_get_last_status(acpi_status default_status)
187 187
188acpi_status 188acpi_status
189acpi_os_get_table_by_address(acpi_physical_address address, 189acpi_os_get_table_by_address(acpi_physical_address address,
190 struct acpi_table_header ** table) 190 struct acpi_table_header **table)
191{ 191{
192 u32 table_length; 192 u32 table_length;
193 struct acpi_table_header *mapped_table; 193 struct acpi_table_header *mapped_table;
@@ -252,8 +252,8 @@ exit:
252acpi_status 252acpi_status
253acpi_os_get_table_by_name(char *signature, 253acpi_os_get_table_by_name(char *signature,
254 u32 instance, 254 u32 instance,
255 struct acpi_table_header ** table, 255 struct acpi_table_header **table,
256 acpi_physical_address * address) 256 acpi_physical_address *address)
257{ 257{
258 acpi_status status; 258 acpi_status status;
259 259
@@ -380,8 +380,8 @@ static acpi_status osl_add_table_to_list(char *signature, u32 instance)
380 380
381acpi_status 381acpi_status
382acpi_os_get_table_by_index(u32 index, 382acpi_os_get_table_by_index(u32 index,
383 struct acpi_table_header ** table, 383 struct acpi_table_header **table,
384 u32 *instance, acpi_physical_address * address) 384 u32 *instance, acpi_physical_address *address)
385{ 385{
386 struct osl_table_info *info; 386 struct osl_table_info *info;
387 acpi_status status; 387 acpi_status status;
@@ -447,7 +447,7 @@ osl_find_rsdp_via_efi_by_keyword(FILE * file, const char *keyword)
447 } 447 }
448 } 448 }
449 449
450 return ((acpi_physical_address) (address)); 450 return ((acpi_physical_address)(address));
451} 451}
452 452
453/****************************************************************************** 453/******************************************************************************
@@ -751,10 +751,10 @@ static acpi_status osl_list_bios_tables(void)
751 for (i = 0; i < number_of_tables; ++i, table_data += item_size) { 751 for (i = 0; i < number_of_tables; ++i, table_data += item_size) {
752 if (osl_can_use_xsdt()) { 752 if (osl_can_use_xsdt()) {
753 table_address = 753 table_address =
754 (acpi_physical_address) (*ACPI_CAST64(table_data)); 754 (acpi_physical_address)(*ACPI_CAST64(table_data));
755 } else { 755 } else {
756 table_address = 756 table_address =
757 (acpi_physical_address) (*ACPI_CAST32(table_data)); 757 (acpi_physical_address)(*ACPI_CAST32(table_data));
758 } 758 }
759 759
760 /* Skip NULL entries in RSDT/XSDT */ 760 /* Skip NULL entries in RSDT/XSDT */
@@ -800,7 +800,7 @@ static acpi_status
800osl_get_bios_table(char *signature, 800osl_get_bios_table(char *signature,
801 u32 instance, 801 u32 instance,
802 struct acpi_table_header **table, 802 struct acpi_table_header **table,
803 acpi_physical_address * address) 803 acpi_physical_address *address)
804{ 804{
805 struct acpi_table_header *local_table = NULL; 805 struct acpi_table_header *local_table = NULL;
806 struct acpi_table_header *mapped_table = NULL; 806 struct acpi_table_header *mapped_table = NULL;
@@ -833,38 +833,37 @@ osl_get_bios_table(char *signature,
833 if ((gbl_fadt->header.length >= MIN_FADT_FOR_XDSDT) && 833 if ((gbl_fadt->header.length >= MIN_FADT_FOR_XDSDT) &&
834 gbl_fadt->Xdsdt) { 834 gbl_fadt->Xdsdt) {
835 table_address = 835 table_address =
836 (acpi_physical_address) gbl_fadt->Xdsdt; 836 (acpi_physical_address)gbl_fadt->Xdsdt;
837 } else 837 } else
838 if ((gbl_fadt->header.length >= MIN_FADT_FOR_DSDT) 838 if ((gbl_fadt->header.length >= MIN_FADT_FOR_DSDT)
839 && gbl_fadt->dsdt) { 839 && gbl_fadt->dsdt) {
840 table_address = 840 table_address =
841 (acpi_physical_address) gbl_fadt->dsdt; 841 (acpi_physical_address)gbl_fadt->dsdt;
842 } 842 }
843 } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_FACS)) { 843 } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_FACS)) {
844 if ((gbl_fadt->header.length >= MIN_FADT_FOR_XFACS) && 844 if ((gbl_fadt->header.length >= MIN_FADT_FOR_XFACS) &&
845 gbl_fadt->Xfacs) { 845 gbl_fadt->Xfacs) {
846 table_address = 846 table_address =
847 (acpi_physical_address) gbl_fadt->Xfacs; 847 (acpi_physical_address)gbl_fadt->Xfacs;
848 } else 848 } else
849 if ((gbl_fadt->header.length >= MIN_FADT_FOR_FACS) 849 if ((gbl_fadt->header.length >= MIN_FADT_FOR_FACS)
850 && gbl_fadt->facs) { 850 && gbl_fadt->facs) {
851 table_address = 851 table_address =
852 (acpi_physical_address) gbl_fadt->facs; 852 (acpi_physical_address)gbl_fadt->facs;
853 } 853 }
854 } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_XSDT)) { 854 } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_XSDT)) {
855 if (!gbl_revision) { 855 if (!gbl_revision) {
856 return (AE_BAD_SIGNATURE); 856 return (AE_BAD_SIGNATURE);
857 } 857 }
858 table_address = 858 table_address =
859 (acpi_physical_address) gbl_rsdp. 859 (acpi_physical_address)gbl_rsdp.
860 xsdt_physical_address; 860 xsdt_physical_address;
861 } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_RSDT)) { 861 } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_RSDT)) {
862 table_address = 862 table_address =
863 (acpi_physical_address) gbl_rsdp. 863 (acpi_physical_address)gbl_rsdp.
864 rsdt_physical_address; 864 rsdt_physical_address;
865 } else { 865 } else {
866 table_address = 866 table_address = (acpi_physical_address)gbl_rsdp_address;
867 (acpi_physical_address) gbl_rsdp_address;
868 signature = ACPI_SIG_RSDP; 867 signature = ACPI_SIG_RSDP;
869 } 868 }
870 869
@@ -904,12 +903,12 @@ osl_get_bios_table(char *signature,
904 for (i = 0; i < number_of_tables; ++i, table_data += item_size) { 903 for (i = 0; i < number_of_tables; ++i, table_data += item_size) {
905 if (osl_can_use_xsdt()) { 904 if (osl_can_use_xsdt()) {
906 table_address = 905 table_address =
907 (acpi_physical_address) (*ACPI_CAST64 906 (acpi_physical_address)(*ACPI_CAST64
908 (table_data)); 907 (table_data));
909 } else { 908 } else {
910 table_address = 909 table_address =
911 (acpi_physical_address) (*ACPI_CAST32 910 (acpi_physical_address)(*ACPI_CAST32
912 (table_data)); 911 (table_data));
913 } 912 }
914 913
915 /* Skip NULL entries in RSDT/XSDT */ 914 /* Skip NULL entries in RSDT/XSDT */
@@ -1301,7 +1300,7 @@ osl_get_customized_table(char *pathname,
1301 char *signature, 1300 char *signature,
1302 u32 instance, 1301 u32 instance,
1303 struct acpi_table_header **table, 1302 struct acpi_table_header **table,
1304 acpi_physical_address * address) 1303 acpi_physical_address *address)
1305{ 1304{
1306 void *table_dir; 1305 void *table_dir;
1307 u32 current_instance = 0; 1306 u32 current_instance = 0;
diff --git a/tools/power/acpi/os_specific/service_layers/osunixmap.c b/tools/power/acpi/os_specific/service_layers/osunixmap.c
index 3818fd07e50f..cbfbce18783d 100644
--- a/tools/power/acpi/os_specific/service_layers/osunixmap.c
+++ b/tools/power/acpi/os_specific/service_layers/osunixmap.c
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap")
54#ifndef O_BINARY 54#ifndef O_BINARY
55#define O_BINARY 0 55#define O_BINARY 0
56#endif 56#endif
57#if defined(_dragon_fly) || defined(_free_BSD) 57#if defined(_dragon_fly) || defined(_free_BSD) || defined(_QNX)
58#define MMAP_FLAGS MAP_SHARED 58#define MMAP_FLAGS MAP_SHARED
59#else 59#else
60#define MMAP_FLAGS MAP_PRIVATE 60#define MMAP_FLAGS MAP_PRIVATE
diff --git a/tools/power/acpi/os_specific/service_layers/osunixxf.c b/tools/power/acpi/os_specific/service_layers/osunixxf.c
index 08cb8b2035f2..88aa66ef4ad5 100644
--- a/tools/power/acpi/os_specific/service_layers/osunixxf.c
+++ b/tools/power/acpi/os_specific/service_layers/osunixxf.c
@@ -246,8 +246,8 @@ acpi_physical_address acpi_os_get_root_pointer(void)
246 *****************************************************************************/ 246 *****************************************************************************/
247 247
248acpi_status 248acpi_status
249acpi_os_predefined_override(const struct acpi_predefined_names * init_val, 249acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
250 acpi_string * new_val) 250 acpi_string *new_val)
251{ 251{
252 252
253 if (!init_val || !new_val) { 253 if (!init_val || !new_val) {
@@ -274,8 +274,8 @@ acpi_os_predefined_override(const struct acpi_predefined_names * init_val,
274 *****************************************************************************/ 274 *****************************************************************************/
275 275
276acpi_status 276acpi_status
277acpi_os_table_override(struct acpi_table_header * existing_table, 277acpi_os_table_override(struct acpi_table_header *existing_table,
278 struct acpi_table_header ** new_table) 278 struct acpi_table_header **new_table)
279{ 279{
280 280
281 if (!existing_table || !new_table) { 281 if (!existing_table || !new_table) {
@@ -311,8 +311,8 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
311 *****************************************************************************/ 311 *****************************************************************************/
312 312
313acpi_status 313acpi_status
314acpi_os_physical_table_override(struct acpi_table_header * existing_table, 314acpi_os_physical_table_override(struct acpi_table_header *existing_table,
315 acpi_physical_address * new_address, 315 acpi_physical_address *new_address,
316 u32 *new_table_length) 316 u32 *new_table_length)
317{ 317{
318 318
@@ -506,7 +506,7 @@ acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read)
506void *acpi_os_map_memory(acpi_physical_address where, acpi_size length) 506void *acpi_os_map_memory(acpi_physical_address where, acpi_size length)
507{ 507{
508 508
509 return (ACPI_TO_POINTER((acpi_size) where)); 509 return (ACPI_TO_POINTER((acpi_size)where));
510} 510}
511 511
512/****************************************************************************** 512/******************************************************************************
@@ -603,9 +603,9 @@ void acpi_os_free(void *mem)
603 603
604acpi_status 604acpi_status
605acpi_os_create_semaphore(u32 max_units, 605acpi_os_create_semaphore(u32 max_units,
606 u32 initial_units, acpi_handle * out_handle) 606 u32 initial_units, acpi_handle *out_handle)
607{ 607{
608 *out_handle = (acpi_handle) 1; 608 *out_handle = (acpi_handle)1;
609 return (AE_OK); 609 return (AE_OK);
610} 610}
611 611
@@ -640,7 +640,7 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
640 640
641acpi_status 641acpi_status
642acpi_os_create_semaphore(u32 max_units, 642acpi_os_create_semaphore(u32 max_units,
643 u32 initial_units, acpi_handle * out_handle) 643 u32 initial_units, acpi_handle *out_handle)
644{ 644{
645 sem_t *sem; 645 sem_t *sem;
646 646
@@ -672,7 +672,7 @@ acpi_os_create_semaphore(u32 max_units,
672 } 672 }
673#endif 673#endif
674 674
675 *out_handle = (acpi_handle) sem; 675 *out_handle = (acpi_handle)sem;
676 return (AE_OK); 676 return (AE_OK);
677} 677}
678 678
@@ -1035,7 +1035,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
1035 *****************************************************************************/ 1035 *****************************************************************************/
1036 1036
1037acpi_status 1037acpi_status
1038acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, 1038acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
1039 u32 pci_register, u64 value, u32 width) 1039 u32 pci_register, u64 value, u32 width)
1040{ 1040{
1041 1041
diff --git a/tools/power/acpi/tools/acpidump/Makefile b/tools/power/acpi/tools/acpidump/Makefile
index 8d761576e91b..2942cdced2ad 100644
--- a/tools/power/acpi/tools/acpidump/Makefile
+++ b/tools/power/acpi/tools/acpidump/Makefile
@@ -31,6 +31,7 @@ TOOL_OBJS = \
31 osunixxf.o\ 31 osunixxf.o\
32 tbprint.o\ 32 tbprint.o\
33 tbxfroot.o\ 33 tbxfroot.o\
34 utascii.o\
34 utbuffer.o\ 35 utbuffer.o\
35 utdebug.o\ 36 utdebug.o\
36 utexcep.o\ 37 utexcep.o\
diff --git a/tools/power/acpi/tools/acpidump/apdump.c b/tools/power/acpi/tools/acpidump/apdump.c
index da44458d3b6c..fb8f1d9e3b1b 100644
--- a/tools/power/acpi/tools/acpidump/apdump.c
+++ b/tools/power/acpi/tools/acpidump/apdump.c
@@ -68,7 +68,7 @@ u8 ap_is_valid_header(struct acpi_table_header *table)
68 68
69 /* Make sure signature is all ASCII and a valid ACPI name */ 69 /* Make sure signature is all ASCII and a valid ACPI name */
70 70
71 if (!acpi_ut_valid_acpi_name(table->signature)) { 71 if (!acpi_ut_valid_nameseg(table->signature)) {
72 acpi_log_error("Table signature (0x%8.8X) is invalid\n", 72 acpi_log_error("Table signature (0x%8.8X) is invalid\n",
73 *(u32 *)table->signature); 73 *(u32 *)table->signature);
74 return (FALSE); 74 return (FALSE);
@@ -286,14 +286,15 @@ int ap_dump_table_by_address(char *ascii_address)
286 286
287 /* Convert argument to an integer physical address */ 287 /* Convert argument to an integer physical address */
288 288
289 status = acpi_ut_strtoul64(ascii_address, 0, &long_address); 289 status = acpi_ut_strtoul64(ascii_address, ACPI_ANY_BASE,
290 ACPI_MAX64_BYTE_WIDTH, &long_address);
290 if (ACPI_FAILURE(status)) { 291 if (ACPI_FAILURE(status)) {
291 acpi_log_error("%s: Could not convert to a physical address\n", 292 acpi_log_error("%s: Could not convert to a physical address\n",
292 ascii_address); 293 ascii_address);
293 return (-1); 294 return (-1);
294 } 295 }
295 296
296 address = (acpi_physical_address) long_address; 297 address = (acpi_physical_address)long_address;
297 status = acpi_os_get_table_by_address(address, &table); 298 status = acpi_os_get_table_by_address(address, &table);
298 if (ACPI_FAILURE(status)) { 299 if (ACPI_FAILURE(status)) {
299 acpi_log_error("Could not get table at 0x%8.8X%8.8X, %s\n", 300 acpi_log_error("Could not get table at 0x%8.8X%8.8X, %s\n",
@@ -406,6 +407,12 @@ int ap_dump_table_from_file(char *pathname)
406 return (-1); 407 return (-1);
407 } 408 }
408 409
410 if (!acpi_ut_valid_nameseg(table->signature)) {
411 acpi_log_error
412 ("No valid ACPI signature was found in input file %s\n",
413 pathname);
414 }
415
409 /* File must be at least as long as the table length */ 416 /* File must be at least as long as the table length */
410 417
411 if (table->length > file_size) { 418 if (table->length > file_size) {
diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c
index c3c09152fac6..7692e6b887e1 100644
--- a/tools/power/acpi/tools/acpidump/apmain.c
+++ b/tools/power/acpi/tools/acpidump/apmain.c
@@ -209,7 +209,8 @@ static int ap_do_options(int argc, char **argv)
209 case 'r': /* Dump tables from specified RSDP */ 209 case 'r': /* Dump tables from specified RSDP */
210 210
211 status = 211 status =
212 acpi_ut_strtoul64(acpi_gbl_optarg, 0, 212 acpi_ut_strtoul64(acpi_gbl_optarg, ACPI_ANY_BASE,
213 ACPI_MAX64_BYTE_WIDTH,
213 &gbl_rsdp_base); 214 &gbl_rsdp_base);
214 if (ACPI_FAILURE(status)) { 215 if (ACPI_FAILURE(status)) {
215 acpi_log_error 216 acpi_log_error