aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-20 14:26:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-20 14:26:56 -0500
commit8793422fd9ac5037f5047f80473007301df3689f (patch)
treef5aa3b3a564f053e1b5604c45db80193abc734a4 /drivers/acpi/acpica
parentb3cdda2b4f541439ca4205793040aa2e1c852e3b (diff)
parent10baf04e95fbf7eb6089410220a547211dd2ffa7 (diff)
Merge tag 'pm+acpi-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki: - Rework of the ACPI namespace scanning code from Rafael J. Wysocki with contributions from Bjorn Helgaas, Jiang Liu, Mika Westerberg, Toshi Kani, and Yinghai Lu. - ACPI power resources handling and ACPI device PM update from Rafael J Wysocki. - ACPICA update to version 20130117 from Bob Moore and Lv Zheng with contributions from Aaron Lu, Chao Guan, Jesper Juhl, and Tim Gardner. - Support for Intel Lynxpoint LPSS from Mika Westerberg. - cpuidle update from Len Brown including Intel Haswell support, C1 state for intel_idle, removal of global pm_idle. - cpuidle fixes and cleanups from Daniel Lezcano. - cpufreq fixes and cleanups from Viresh Kumar and Fabio Baltieri with contributions from Stratos Karafotis and Rickard Andersson. - Intel P-states driver for Sandy Bridge processors from Dirk Brandewie. - cpufreq driver for Marvell Kirkwood SoCs from Andrew Lunn. - cpufreq fixes related to ordering issues between acpi-cpufreq and powernow-k8 from Borislav Petkov and Matthew Garrett. - cpufreq support for Calxeda Highbank processors from Mark Langsdorf and Rob Herring. - cpufreq driver for the Freescale i.MX6Q SoC and cpufreq-cpu0 update from Shawn Guo. - cpufreq Exynos fixes and cleanups from Jonghwan Choi, Sachin Kamat, and Inderpal Singh. - Support for "lightweight suspend" from Zhang Rui. - Removal of the deprecated power trace API from Paul Gortmaker. - Assorted updates from Andreas Fleig, Colin Ian King, Davidlohr Bueso, Joseph Salisbury, Kees Cook, Li Fei, Nishanth Menon, ShuoX Liu, Srinivas Pandruvada, Tejun Heo, Thomas Renninger, and Yasuaki Ishimatsu. * tag 'pm+acpi-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (267 commits) PM idle: remove global declaration of pm_idle unicore32 idle: delete stray pm_idle comment openrisc idle: delete pm_idle mn10300 idle: delete pm_idle microblaze idle: delete pm_idle m32r idle: delete pm_idle, and other dead idle code ia64 idle: delete pm_idle cris idle: delete idle and pm_idle ARM64 idle: delete pm_idle ARM idle: delete pm_idle blackfin idle: delete pm_idle sparc idle: rename pm_idle to sparc_idle sh idle: rename global pm_idle to static sh_idle x86 idle: rename global pm_idle to static x86_idle APM idle: register apm_cpu_idle via cpuidle cpufreq / intel_pstate: Add kernel command line option disable intel_pstate. cpufreq / intel_pstate: Change to disallow module build tools/power turbostat: display SMI count by default intel_idle: export both C1 and C1E ACPI / hotplug: Fix concurrency issues and memory leaks ...
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/Makefile8
-rw-r--r--drivers/acpi/acpica/accommon.h3
-rw-r--r--drivers/acpi/acpica/acdebug.h19
-rw-r--r--drivers/acpi/acpica/acdispat.h2
-rw-r--r--drivers/acpi/acpica/acevents.h23
-rw-r--r--drivers/acpi/acpica/acglobal.h43
-rw-r--r--drivers/acpi/acpica/achware.h2
-rw-r--r--drivers/acpi/acpica/acinterp.h4
-rw-r--r--drivers/acpi/acpica/aclocal.h47
-rw-r--r--drivers/acpi/acpica/acmacros.h173
-rw-r--r--drivers/acpi/acpica/acnamesp.h16
-rw-r--r--drivers/acpi/acpica/acobject.h4
-rw-r--r--drivers/acpi/acpica/acopcode.h2
-rw-r--r--drivers/acpi/acpica/acparser.h27
-rw-r--r--drivers/acpi/acpica/acpredef.h31
-rw-r--r--drivers/acpi/acpica/acresrc.h8
-rw-r--r--drivers/acpi/acpica/acstruct.h2
-rw-r--r--drivers/acpi/acpica/actables.h2
-rw-r--r--drivers/acpi/acpica/acutils.h59
-rw-r--r--drivers/acpi/acpica/amlcode.h2
-rw-r--r--drivers/acpi/acpica/amlresrc.h8
-rw-r--r--drivers/acpi/acpica/dsargs.c2
-rw-r--r--drivers/acpi/acpica/dscontrol.c2
-rw-r--r--drivers/acpi/acpica/dsfield.c2
-rw-r--r--drivers/acpi/acpica/dsinit.c2
-rw-r--r--drivers/acpi/acpica/dsmethod.c8
-rw-r--r--drivers/acpi/acpica/dsmthdat.c2
-rw-r--r--drivers/acpi/acpica/dsobject.c20
-rw-r--r--drivers/acpi/acpica/dsopcode.c16
-rw-r--r--drivers/acpi/acpica/dsutils.c12
-rw-r--r--drivers/acpi/acpica/dswexec.c6
-rw-r--r--drivers/acpi/acpica/dswload.c7
-rw-r--r--drivers/acpi/acpica/dswload2.c4
-rw-r--r--drivers/acpi/acpica/dswscope.c2
-rw-r--r--drivers/acpi/acpica/dswstate.c2
-rw-r--r--drivers/acpi/acpica/evevent.c2
-rw-r--r--drivers/acpi/acpica/evglock.c2
-rw-r--r--drivers/acpi/acpica/evgpe.c14
-rw-r--r--drivers/acpi/acpica/evgpeblk.c24
-rw-r--r--drivers/acpi/acpica/evgpeinit.c5
-rw-r--r--drivers/acpi/acpica/evgpeutil.c2
-rw-r--r--drivers/acpi/acpica/evhandler.c529
-rw-r--r--drivers/acpi/acpica/evmisc.c2
-rw-r--r--drivers/acpi/acpica/evregion.c584
-rw-r--r--drivers/acpi/acpica/evrgnini.c2
-rw-r--r--drivers/acpi/acpica/evsci.c6
-rw-r--r--drivers/acpi/acpica/evxface.c36
-rw-r--r--drivers/acpi/acpica/evxfevnt.c7
-rw-r--r--drivers/acpi/acpica/evxfgpe.c11
-rw-r--r--drivers/acpi/acpica/evxfregn.c2
-rw-r--r--drivers/acpi/acpica/exconfig.c22
-rw-r--r--drivers/acpi/acpica/exconvrt.c4
-rw-r--r--drivers/acpi/acpica/excreate.c2
-rw-r--r--drivers/acpi/acpica/exdebug.c2
-rw-r--r--drivers/acpi/acpica/exdump.c21
-rw-r--r--drivers/acpi/acpica/exfield.c2
-rw-r--r--drivers/acpi/acpica/exfldio.c3
-rw-r--r--drivers/acpi/acpica/exmisc.c2
-rw-r--r--drivers/acpi/acpica/exmutex.c5
-rw-r--r--drivers/acpi/acpica/exnames.c2
-rw-r--r--drivers/acpi/acpica/exoparg1.c10
-rw-r--r--drivers/acpi/acpica/exoparg2.c2
-rw-r--r--drivers/acpi/acpica/exoparg3.c2
-rw-r--r--drivers/acpi/acpica/exoparg6.c2
-rw-r--r--drivers/acpi/acpica/exprep.c6
-rw-r--r--drivers/acpi/acpica/exregion.c25
-rw-r--r--drivers/acpi/acpica/exresnte.c2
-rw-r--r--drivers/acpi/acpica/exresolv.c2
-rw-r--r--drivers/acpi/acpica/exresop.c2
-rw-r--r--drivers/acpi/acpica/exstore.c31
-rw-r--r--drivers/acpi/acpica/exstoren.c4
-rw-r--r--drivers/acpi/acpica/exstorob.c2
-rw-r--r--drivers/acpi/acpica/exsystem.c2
-rw-r--r--drivers/acpi/acpica/exutils.c24
-rw-r--r--drivers/acpi/acpica/hwacpi.c13
-rw-r--r--drivers/acpi/acpica/hwesleep.c3
-rw-r--r--drivers/acpi/acpica/hwgpe.c10
-rw-r--r--drivers/acpi/acpica/hwpci.c2
-rw-r--r--drivers/acpi/acpica/hwregs.c8
-rw-r--r--drivers/acpi/acpica/hwsleep.c8
-rw-r--r--drivers/acpi/acpica/hwtimer.c9
-rw-r--r--drivers/acpi/acpica/hwvalid.c20
-rw-r--r--drivers/acpi/acpica/hwxface.c137
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c13
-rw-r--r--drivers/acpi/acpica/nsaccess.c2
-rw-r--r--drivers/acpi/acpica/nsalloc.c2
-rw-r--r--drivers/acpi/acpica/nsdump.c14
-rw-r--r--drivers/acpi/acpica/nsdumpdv.c3
-rw-r--r--drivers/acpi/acpica/nseval.c2
-rw-r--r--drivers/acpi/acpica/nsinit.c29
-rw-r--r--drivers/acpi/acpica/nsload.c2
-rw-r--r--drivers/acpi/acpica/nsnames.c5
-rw-r--r--drivers/acpi/acpica/nsobject.c2
-rw-r--r--drivers/acpi/acpica/nsparse.c2
-rw-r--r--drivers/acpi/acpica/nspredef.c586
-rw-r--r--drivers/acpi/acpica/nsprepkg.c621
-rw-r--r--drivers/acpi/acpica/nsrepair.c2
-rw-r--r--drivers/acpi/acpica/nsrepair2.c5
-rw-r--r--drivers/acpi/acpica/nssearch.c7
-rw-r--r--drivers/acpi/acpica/nsutils.c88
-rw-r--r--drivers/acpi/acpica/nswalk.c6
-rw-r--r--drivers/acpi/acpica/nsxfeval.c19
-rw-r--r--drivers/acpi/acpica/nsxfname.c20
-rw-r--r--drivers/acpi/acpica/nsxfobj.c2
-rw-r--r--drivers/acpi/acpica/psargs.c9
-rw-r--r--drivers/acpi/acpica/psloop.c623
-rw-r--r--drivers/acpi/acpica/psobject.c647
-rw-r--r--drivers/acpi/acpica/psopcode.c174
-rw-r--r--drivers/acpi/acpica/psopinfo.c223
-rw-r--r--drivers/acpi/acpica/psparse.c2
-rw-r--r--drivers/acpi/acpica/psscope.c2
-rw-r--r--drivers/acpi/acpica/pstree.c2
-rw-r--r--drivers/acpi/acpica/psutils.c10
-rw-r--r--drivers/acpi/acpica/pswalk.c2
-rw-r--r--drivers/acpi/acpica/psxface.c2
-rw-r--r--drivers/acpi/acpica/rsaddr.c2
-rw-r--r--drivers/acpi/acpica/rscalc.c8
-rw-r--r--drivers/acpi/acpica/rscreate.c9
-rw-r--r--drivers/acpi/acpica/rsdump.c424
-rw-r--r--drivers/acpi/acpica/rsdumpinfo.c454
-rw-r--r--drivers/acpi/acpica/rsinfo.c2
-rw-r--r--drivers/acpi/acpica/rsio.c2
-rw-r--r--drivers/acpi/acpica/rsirq.c40
-rw-r--r--drivers/acpi/acpica/rslist.c9
-rw-r--r--drivers/acpi/acpica/rsmemory.c8
-rw-r--r--drivers/acpi/acpica/rsmisc.c76
-rw-r--r--drivers/acpi/acpica/rsserial.c10
-rw-r--r--drivers/acpi/acpica/rsutils.c14
-rw-r--r--drivers/acpi/acpica/rsxface.c107
-rw-r--r--drivers/acpi/acpica/tbfadt.c7
-rw-r--r--drivers/acpi/acpica/tbfind.c2
-rw-r--r--drivers/acpi/acpica/tbinstal.c2
-rw-r--r--drivers/acpi/acpica/tbutils.c4
-rw-r--r--drivers/acpi/acpica/tbxface.c7
-rw-r--r--drivers/acpi/acpica/tbxfload.c4
-rw-r--r--drivers/acpi/acpica/tbxfroot.c2
-rw-r--r--drivers/acpi/acpica/utaddress.c6
-rw-r--r--drivers/acpi/acpica/utalloc.c2
-rw-r--r--drivers/acpi/acpica/utcache.c2
-rw-r--r--drivers/acpi/acpica/utcopy.c6
-rw-r--r--drivers/acpi/acpica/utdebug.c120
-rw-r--r--drivers/acpi/acpica/utdecode.c2
-rw-r--r--drivers/acpi/acpica/utdelete.c70
-rw-r--r--drivers/acpi/acpica/uteval.c4
-rw-r--r--drivers/acpi/acpica/utexcep.c2
-rw-r--r--drivers/acpi/acpica/utglobal.c11
-rw-r--r--drivers/acpi/acpica/utids.c2
-rw-r--r--drivers/acpi/acpica/utinit.c2
-rw-r--r--drivers/acpi/acpica/utlock.c16
-rw-r--r--drivers/acpi/acpica/utmath.c2
-rw-r--r--drivers/acpi/acpica/utmisc.c830
-rw-r--r--drivers/acpi/acpica/utmutex.c2
-rw-r--r--drivers/acpi/acpica/utobject.c4
-rw-r--r--drivers/acpi/acpica/utosi.c2
-rw-r--r--drivers/acpi/acpica/utownerid.c218
-rw-r--r--drivers/acpi/acpica/utresrc.c83
-rw-r--r--drivers/acpi/acpica/utstate.c42
-rw-r--r--drivers/acpi/acpica/utstring.c574
-rw-r--r--drivers/acpi/acpica/uttrack.c18
-rw-r--r--drivers/acpi/acpica/utxface.c6
-rw-r--r--drivers/acpi/acpica/utxferror.c6
-rw-r--r--drivers/acpi/acpica/utxfinit.c2
-rw-r--r--drivers/acpi/acpica/utxfmutex.c2
163 files changed, 4511 insertions, 4037 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index bc7a03ded064..a1b9bf5085a2 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -31,6 +31,7 @@ acpi-y += \
31 evgpeinit.o \ 31 evgpeinit.o \
32 evgpeutil.o \ 32 evgpeutil.o \
33 evglock.o \ 33 evglock.o \
34 evhandler.o \
34 evmisc.o \ 35 evmisc.o \
35 evregion.o \ 36 evregion.o \
36 evrgnini.o \ 37 evrgnini.o \
@@ -90,6 +91,7 @@ acpi-y += \
90 nsobject.o \ 91 nsobject.o \
91 nsparse.o \ 92 nsparse.o \
92 nspredef.o \ 93 nspredef.o \
94 nsprepkg.o \
93 nsrepair.o \ 95 nsrepair.o \
94 nsrepair2.o \ 96 nsrepair2.o \
95 nssearch.o \ 97 nssearch.o \
@@ -104,7 +106,9 @@ acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
104acpi-y += \ 106acpi-y += \
105 psargs.o \ 107 psargs.o \
106 psloop.o \ 108 psloop.o \
109 psobject.o \
107 psopcode.o \ 110 psopcode.o \
111 psopinfo.o \
108 psparse.o \ 112 psparse.o \
109 psscope.o \ 113 psscope.o \
110 pstree.o \ 114 pstree.o \
@@ -126,7 +130,7 @@ acpi-y += \
126 rsutils.o \ 130 rsutils.o \
127 rsxface.o 131 rsxface.o
128 132
129acpi-$(ACPI_FUTURE_USAGE) += rsdump.o 133acpi-$(ACPI_FUTURE_USAGE) += rsdump.o rsdumpinfo.o
130 134
131acpi-y += \ 135acpi-y += \
132 tbfadt.o \ 136 tbfadt.o \
@@ -155,8 +159,10 @@ acpi-y += \
155 utmutex.o \ 159 utmutex.o \
156 utobject.o \ 160 utobject.o \
157 utosi.o \ 161 utosi.o \
162 utownerid.o \
158 utresrc.o \ 163 utresrc.o \
159 utstate.o \ 164 utstate.o \
165 utstring.o \
160 utxface.o \ 166 utxface.o \
161 utxfinit.o \ 167 utxfinit.o \
162 utxferror.o \ 168 utxferror.o \
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h
index 8a7d51bfb3b3..8a6c4a0d22db 100644
--- a/drivers/acpi/acpica/accommon.h
+++ b/drivers/acpi/acpica/accommon.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,7 @@
51 * 51 *
52 * Note: The order of these include files is important. 52 * Note: The order of these include files is important.
53 */ 53 */
54#include <acpi/acconfig.h> /* Global configuration constants */
54#include "acmacros.h" /* C macros */ 55#include "acmacros.h" /* C macros */
55#include "aclocal.h" /* Internal data types */ 56#include "aclocal.h" /* Internal data types */
56#include "acobject.h" /* ACPI internal object */ 57#include "acobject.h" /* ACPI internal object */
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 432a318c9ed1..9feba08c29fe 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -115,6 +115,21 @@ ACPI_HW_DEPENDENT_RETURN_VOID(void
115 char *block_arg)) 115 char *block_arg))
116 116
117/* 117/*
118 * dbconvert - miscellaneous conversion routines
119 */
120 acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value);
121
122acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object);
123
124acpi_status
125acpi_db_convert_to_object(acpi_object_type type,
126 char *string, union acpi_object *object);
127
128u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info);
129
130void acpi_db_dump_pld_buffer(union acpi_object *obj_desc);
131
132/*
118 * dbmethod - control method commands 133 * dbmethod - control method commands
119 */ 134 */
120void 135void
@@ -191,6 +206,8 @@ void
191acpi_db_create_execution_threads(char *num_threads_arg, 206acpi_db_create_execution_threads(char *num_threads_arg,
192 char *num_loops_arg, char *method_name_arg); 207 char *num_loops_arg, char *method_name_arg);
193 208
209void acpi_db_delete_objects(u32 count, union acpi_object *objects);
210
194#ifdef ACPI_DBG_TRACK_ALLOCATIONS 211#ifdef ACPI_DBG_TRACK_ALLOCATIONS
195u32 acpi_db_get_cache_info(struct acpi_memory_list *cache); 212u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
196#endif 213#endif
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h
index ed33ebcdaebe..427db72a6302 100644
--- a/drivers/acpi/acpica/acdispat.h
+++ b/drivers/acpi/acpica/acdispat.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index e975c6720448..ab0e97710381 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -158,10 +158,23 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
158 void *context); 158 void *context);
159 159
160/* 160/*
161 * evregion - Address Space handling 161 * evhandler - Address space handling
162 */ 162 */
163u8
164acpi_ev_has_default_handler(struct acpi_namespace_node *node,
165 acpi_adr_space_type space_id);
166
163acpi_status acpi_ev_install_region_handlers(void); 167acpi_status acpi_ev_install_region_handlers(void);
164 168
169acpi_status
170acpi_ev_install_space_handler(struct acpi_namespace_node *node,
171 acpi_adr_space_type space_id,
172 acpi_adr_space_handler handler,
173 acpi_adr_space_setup setup, void *context);
174
175/*
176 * evregion - Operation region support
177 */
165acpi_status acpi_ev_initialize_op_regions(void); 178acpi_status acpi_ev_initialize_op_regions(void);
166 179
167acpi_status 180acpi_status
@@ -180,12 +193,6 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
180 u8 acpi_ns_is_locked); 193 u8 acpi_ns_is_locked);
181 194
182acpi_status 195acpi_status
183acpi_ev_install_space_handler(struct acpi_namespace_node *node,
184 acpi_adr_space_type space_id,
185 acpi_adr_space_handler handler,
186 acpi_adr_space_setup setup, void *context);
187
188acpi_status
189acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, 196acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
190 acpi_adr_space_type space_id); 197 acpi_adr_space_type space_id);
191 198
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 64472e4ec329..ecb49927b817 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -192,14 +192,6 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
192ACPI_EXTERN u8 acpi_gbl_integer_byte_width; 192ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
193ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; 193ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
194 194
195/* Mutex for _OSI support */
196
197ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex;
198
199/* Reader/Writer lock is used for namespace walk and dynamic table unload */
200
201ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock;
202
203/***************************************************************************** 195/*****************************************************************************
204 * 196 *
205 * Mutual exclusion within ACPICA subsystem 197 * Mutual exclusion within ACPICA subsystem
@@ -233,6 +225,14 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_pending;
233ACPI_EXTERN acpi_spinlock acpi_gbl_gpe_lock; /* For GPE data structs and registers */ 225ACPI_EXTERN acpi_spinlock acpi_gbl_gpe_lock; /* For GPE data structs and registers */
234ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */ 226ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */
235 227
228/* Mutex for _OSI support */
229
230ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex;
231
232/* Reader/Writer lock is used for namespace walk and dynamic table unload */
233
234ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock;
235
236/***************************************************************************** 236/*****************************************************************************
237 * 237 *
238 * Miscellaneous globals 238 * Miscellaneous globals
@@ -252,7 +252,7 @@ ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
252ACPI_EXTERN struct acpi_global_notify_handler acpi_gbl_global_notify[2]; 252ACPI_EXTERN struct acpi_global_notify_handler acpi_gbl_global_notify[2];
253ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; 253ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
254ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; 254ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
255ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; 255ACPI_EXTERN acpi_table_handler acpi_gbl_table_handler;
256ACPI_EXTERN void *acpi_gbl_table_handler_context; 256ACPI_EXTERN void *acpi_gbl_table_handler_context;
257ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; 257ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
258ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler; 258ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler;
@@ -304,6 +304,7 @@ extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
304ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; 304ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
305ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; 305ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
306ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats; 306ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
307ACPI_EXTERN u8 acpi_gbl_disable_mem_tracking;
307#endif 308#endif
308 309
309/***************************************************************************** 310/*****************************************************************************
@@ -365,19 +366,18 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
365 * 366 *
366 ****************************************************************************/ 367 ****************************************************************************/
367 368
368extern struct acpi_fixed_event_info
369 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
370ACPI_EXTERN struct acpi_fixed_event_handler
371 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
372ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
373ACPI_EXTERN struct acpi_gpe_block_info
374*acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
375
376#if (!ACPI_REDUCED_HARDWARE) 369#if (!ACPI_REDUCED_HARDWARE)
377 370
378ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized; 371ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized;
372ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
373ACPI_EXTERN struct acpi_gpe_block_info
374 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
379ACPI_EXTERN acpi_gbl_event_handler acpi_gbl_global_event_handler; 375ACPI_EXTERN acpi_gbl_event_handler acpi_gbl_global_event_handler;
380ACPI_EXTERN void *acpi_gbl_global_event_handler_context; 376ACPI_EXTERN void *acpi_gbl_global_event_handler_context;
377ACPI_EXTERN struct acpi_fixed_event_handler
378 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
379extern struct acpi_fixed_event_info
380 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
381 381
382#endif /* !ACPI_REDUCED_HARDWARE */ 382#endif /* !ACPI_REDUCED_HARDWARE */
383 383
@@ -405,7 +405,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
405 405
406/***************************************************************************** 406/*****************************************************************************
407 * 407 *
408 * Debugger globals 408 * Debugger and Disassembler globals
409 * 409 *
410 ****************************************************************************/ 410 ****************************************************************************/
411 411
@@ -413,8 +413,12 @@ ACPI_EXTERN u8 acpi_gbl_db_output_flags;
413 413
414#ifdef ACPI_DISASSEMBLER 414#ifdef ACPI_DISASSEMBLER
415 415
416u8 ACPI_INIT_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE);
417
416ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; 418ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
417ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; 419ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
420ACPI_EXTERN struct acpi_external_list *acpi_gbl_external_list;
421ACPI_EXTERN struct acpi_external_file *acpi_gbl_external_file_list;
418#endif 422#endif
419 423
420#ifdef ACPI_DEBUGGER 424#ifdef ACPI_DEBUGGER
@@ -426,6 +430,7 @@ extern u8 acpi_gbl_db_terminate_threads;
426ACPI_EXTERN u8 acpi_gbl_db_opt_tables; 430ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
427ACPI_EXTERN u8 acpi_gbl_db_opt_stats; 431ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
428ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; 432ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
433ACPI_EXTERN u8 acpi_gbl_db_opt_no_region_support;
429 434
430ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; 435ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
431ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]; 436ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS];
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index d902d31abc6c..6357e932bfd9 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index eb308635da72..8af8c9bdeb35 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -458,7 +458,7 @@ void acpi_ex_reacquire_interpreter(void);
458 458
459void acpi_ex_relinquish_interpreter(void); 459void acpi_ex_relinquish_interpreter(void);
460 460
461void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); 461u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
462 462
463void acpi_ex_acquire_global_lock(u32 rule); 463void acpi_ex_acquire_global_lock(u32 rule);
464 464
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index ff8bd0061e8b..805f419086ab 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -189,11 +189,10 @@ struct acpi_namespace_node {
189#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ 189#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
190#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */ 190#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */
191 191
192#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ 192#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
193#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ 193#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
194#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */ 194#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
195#define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ 195#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
196#define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */
197 196
198/* Internal ACPI table management - master table list */ 197/* Internal ACPI table management - master table list */
199 198
@@ -411,11 +410,10 @@ struct acpi_gpe_notify_info {
411 struct acpi_gpe_notify_info *next; 410 struct acpi_gpe_notify_info *next;
412}; 411};
413 412
414struct acpi_gpe_notify_object { 413/*
415 struct acpi_namespace_node *node; 414 * GPE dispatch info. At any time, the GPE can have at most one type
416 struct acpi_gpe_notify_object *next; 415 * of dispatch - Method, Handler, or Implicit Notify.
417}; 416 */
418
419union acpi_gpe_dispatch_info { 417union acpi_gpe_dispatch_info {
420 struct acpi_namespace_node *method_node; /* Method node for this GPE level */ 418 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
421 struct acpi_gpe_handler_info *handler; /* Installed GPE handler */ 419 struct acpi_gpe_handler_info *handler; /* Installed GPE handler */
@@ -679,6 +677,8 @@ struct acpi_opcode_info {
679 u8 type; /* Opcode type */ 677 u8 type; /* Opcode type */
680}; 678};
681 679
680/* Value associated with the parse object */
681
682union acpi_parse_value { 682union acpi_parse_value {
683 u64 integer; /* Integer constant (Up to 64 bits) */ 683 u64 integer; /* Integer constant (Up to 64 bits) */
684 u32 size; /* bytelist or field size */ 684 u32 size; /* bytelist or field size */
@@ -1025,6 +1025,31 @@ struct acpi_port_info {
1025 1025
1026/***************************************************************************** 1026/*****************************************************************************
1027 * 1027 *
1028 * Disassembler
1029 *
1030 ****************************************************************************/
1031
1032struct acpi_external_list {
1033 char *path;
1034 char *internal_path;
1035 struct acpi_external_list *next;
1036 u32 value;
1037 u16 length;
1038 u8 type;
1039 u8 flags;
1040};
1041
1042/* Values for Flags field above */
1043
1044#define ACPI_IPATH_ALLOCATED 0x01
1045
1046struct acpi_external_file {
1047 char *path;
1048 struct acpi_external_file *next;
1049};
1050
1051/*****************************************************************************
1052 *
1028 * Debugger 1053 * Debugger
1029 * 1054 *
1030 ****************************************************************************/ 1055 ****************************************************************************/
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 5efad99f2169..ed7943b9044f 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -49,14 +49,18 @@
49 * get into potential aligment issues -- see the STORE macros below. 49 * get into potential aligment issues -- see the STORE macros below.
50 * Use with care. 50 * Use with care.
51 */ 51 */
52#define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) 52#define ACPI_CAST8(ptr) ACPI_CAST_PTR (u8, (ptr))
53#define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) 53#define ACPI_CAST16(ptr) ACPI_CAST_PTR (u16, (ptr))
54#define ACPI_GET32(ptr) *ACPI_CAST_PTR (u32, ptr) 54#define ACPI_CAST32(ptr) ACPI_CAST_PTR (u32, (ptr))
55#define ACPI_GET64(ptr) *ACPI_CAST_PTR (u64, ptr) 55#define ACPI_CAST64(ptr) ACPI_CAST_PTR (u64, (ptr))
56#define ACPI_SET8(ptr) *ACPI_CAST_PTR (u8, ptr) 56#define ACPI_GET8(ptr) (*ACPI_CAST8 (ptr))
57#define ACPI_SET16(ptr) *ACPI_CAST_PTR (u16, ptr) 57#define ACPI_GET16(ptr) (*ACPI_CAST16 (ptr))
58#define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) 58#define ACPI_GET32(ptr) (*ACPI_CAST32 (ptr))
59#define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) 59#define ACPI_GET64(ptr) (*ACPI_CAST64 (ptr))
60#define ACPI_SET8(ptr, val) (*ACPI_CAST8 (ptr) = (u8) (val))
61#define ACPI_SET16(ptr, val) (*ACPI_CAST16 (ptr) = (u16) (val))
62#define ACPI_SET32(ptr, val) (*ACPI_CAST32 (ptr) = (u32) (val))
63#define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val))
60 64
61/* 65/*
62 * printf() format helpers 66 * printf() format helpers
@@ -293,6 +297,26 @@
293#define ACPI_16BIT_MASK 0x0000FFFF 297#define ACPI_16BIT_MASK 0x0000FFFF
294#define ACPI_24BIT_MASK 0x00FFFFFF 298#define ACPI_24BIT_MASK 0x00FFFFFF
295 299
300/* Macros to extract flag bits from position zero */
301
302#define ACPI_GET_1BIT_FLAG(value) ((value) & ACPI_1BIT_MASK)
303#define ACPI_GET_2BIT_FLAG(value) ((value) & ACPI_2BIT_MASK)
304#define ACPI_GET_3BIT_FLAG(value) ((value) & ACPI_3BIT_MASK)
305#define ACPI_GET_4BIT_FLAG(value) ((value) & ACPI_4BIT_MASK)
306
307/* Macros to extract flag bits from position one and above */
308
309#define ACPI_EXTRACT_1BIT_FLAG(field, position) (ACPI_GET_1BIT_FLAG ((field) >> position))
310#define ACPI_EXTRACT_2BIT_FLAG(field, position) (ACPI_GET_2BIT_FLAG ((field) >> position))
311#define ACPI_EXTRACT_3BIT_FLAG(field, position) (ACPI_GET_3BIT_FLAG ((field) >> position))
312#define ACPI_EXTRACT_4BIT_FLAG(field, position) (ACPI_GET_4BIT_FLAG ((field) >> position))
313
314/* ACPI Pathname helpers */
315
316#define ACPI_IS_ROOT_PREFIX(c) ((c) == (u8) 0x5C) /* Backslash */
317#define ACPI_IS_PARENT_PREFIX(c) ((c) == (u8) 0x5E) /* Carat */
318#define ACPI_IS_PATH_SEPARATOR(c) ((c) == (u8) 0x2E) /* Period (dot) */
319
296/* 320/*
297 * An object of type struct acpi_namespace_node can appear in some contexts 321 * An object of type struct acpi_namespace_node can appear in some contexts
298 * where a pointer to an object of type union acpi_operand_object can also 322 * where a pointer to an object of type union acpi_operand_object can also
@@ -364,137 +388,6 @@
364 388
365#endif /* ACPI_NO_ERROR_MESSAGES */ 389#endif /* ACPI_NO_ERROR_MESSAGES */
366 390
367/*
368 * Debug macros that are conditionally compiled
369 */
370#ifdef ACPI_DEBUG_OUTPUT
371/*
372 * Function entry tracing
373 */
374#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
375 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
376#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \
377 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b)
378#define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \
379 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b)
380#define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \
381 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b)
382
383#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
384
385/*
386 * Function exit tracing.
387 * WARNING: These macros include a return statement. This is usually considered
388 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
389 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
390 * so that "_AcpiFunctionName" is defined.
391 *
392 * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
393 * about these constructs.
394 */
395#ifdef ACPI_USE_DO_WHILE_0
396#define ACPI_DO_WHILE0(a) do a while(0)
397#else
398#define ACPI_DO_WHILE0(a) a
399#endif
400
401#define return_VOID ACPI_DO_WHILE0 ({ \
402 acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
403 return;})
404/*
405 * There are two versions of most of the return macros. The default version is
406 * safer, since it avoids side-effects by guaranteeing that the argument will
407 * not be evaluated twice.
408 *
409 * A less-safe version of the macros is provided for optional use if the
410 * compiler uses excessive CPU stack (for example, this may happen in the
411 * debug case if code optimzation is disabled.)
412 */
413#ifndef ACPI_SIMPLE_RETURN_MACROS
414
415#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
416 register acpi_status _s = (s); \
417 acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \
418 return (_s); })
419#define return_PTR(s) ACPI_DO_WHILE0 ({ \
420 register void *_s = (void *) (s); \
421 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \
422 return (_s); })
423#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
424 register u64 _s = (s); \
425 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
426 return (_s); })
427#define return_UINT8(s) ACPI_DO_WHILE0 ({ \
428 register u8 _s = (u8) (s); \
429 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
430 return (_s); })
431#define return_UINT32(s) ACPI_DO_WHILE0 ({ \
432 register u32 _s = (u32) (s); \
433 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
434 return (_s); })
435#else /* Use original less-safe macros */
436
437#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
438 acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \
439 return((s)); })
440#define return_PTR(s) ACPI_DO_WHILE0 ({ \
441 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \
442 return((s)); })
443#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
444 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) (s)); \
445 return((s)); })
446#define return_UINT8(s) return_VALUE(s)
447#define return_UINT32(s) return_VALUE(s)
448
449#endif /* ACPI_SIMPLE_RETURN_MACROS */
450
451/* Conditional execution */
452
453#define ACPI_DEBUG_EXEC(a) a
454#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
455#define _VERBOSE_STRUCTURES
456
457/* Various object display routines for debug */
458
459#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
460#define ACPI_DUMP_OPERANDS(a, b ,c) acpi_ex_dump_operands(a, b, c)
461#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
462#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
463#define ACPI_DUMP_BUFFER(a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
464
465#else
466/*
467 * This is the non-debug case -- make everything go away,
468 * leaving no executable debug code!
469 */
470#define ACPI_DEBUG_EXEC(a)
471#define ACPI_DEBUG_ONLY_MEMBERS(a)
472#define ACPI_FUNCTION_TRACE(a)
473#define ACPI_FUNCTION_TRACE_PTR(a, b)
474#define ACPI_FUNCTION_TRACE_U32(a, b)
475#define ACPI_FUNCTION_TRACE_STR(a, b)
476#define ACPI_FUNCTION_EXIT
477#define ACPI_FUNCTION_STATUS_EXIT(s)
478#define ACPI_FUNCTION_VALUE_EXIT(s)
479#define ACPI_FUNCTION_ENTRY()
480#define ACPI_DUMP_STACK_ENTRY(a)
481#define ACPI_DUMP_OPERANDS(a, b, c)
482#define ACPI_DUMP_ENTRY(a, b)
483#define ACPI_DUMP_TABLES(a, b)
484#define ACPI_DUMP_PATHNAME(a, b, c, d)
485#define ACPI_DUMP_BUFFER(a, b)
486#define ACPI_DEBUG_PRINT(pl)
487#define ACPI_DEBUG_PRINT_RAW(pl)
488
489#define return_VOID return
490#define return_ACPI_STATUS(s) return(s)
491#define return_VALUE(s) return(s)
492#define return_UINT8(s) return(s)
493#define return_UINT32(s) return(s)
494#define return_PTR(s) return(s)
495
496#endif /* ACPI_DEBUG_OUTPUT */
497
498#if (!ACPI_REDUCED_HARDWARE) 391#if (!ACPI_REDUCED_HARDWARE)
499#define ACPI_HW_OPTIONAL_FUNCTION(addr) addr 392#define ACPI_HW_OPTIONAL_FUNCTION(addr) addr
500#else 393#else
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 9b19d4b86424..02cd5482ff8b 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -218,6 +218,18 @@ acpi_ns_check_parameter_count(char *pathname,
218 u32 user_param_count, 218 u32 user_param_count,
219 const union acpi_predefined_info *info); 219 const union acpi_predefined_info *info);
220 220
221acpi_status
222acpi_ns_check_object_type(struct acpi_predefined_data *data,
223 union acpi_operand_object **return_object_ptr,
224 u32 expected_btypes, u32 package_index);
225
226/*
227 * nsprepkg - Validation of predefined name packages
228 */
229acpi_status
230acpi_ns_check_package(struct acpi_predefined_data *data,
231 union acpi_operand_object **return_object_ptr);
232
221/* 233/*
222 * nsnames - Name and Scope manipulation 234 * nsnames - Name and Scope manipulation
223 */ 235 */
@@ -333,8 +345,6 @@ acpi_ns_install_node(struct acpi_walk_state *walk_state,
333/* 345/*
334 * nsutils - Utility functions 346 * nsutils - Utility functions
335 */ 347 */
336u8 acpi_ns_valid_root_prefix(char prefix);
337
338acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); 348acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
339 349
340u32 acpi_ns_local(acpi_object_type type); 350u32 acpi_ns_local(acpi_object_type type);
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 24eb9eac9514..cc7ab6dd724e 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -307,7 +307,7 @@ struct acpi_object_addr_handler {
307 struct acpi_namespace_node *node; /* Parent device */ 307 struct acpi_namespace_node *node; /* Parent device */
308 void *context; 308 void *context;
309 acpi_adr_space_setup setup; 309 acpi_adr_space_setup setup;
310 union acpi_operand_object *region_list; /* regions using this handler */ 310 union acpi_operand_object *region_list; /* Regions using this handler */
311 union acpi_operand_object *next; 311 union acpi_operand_object *next;
312}; 312};
313 313
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h
index d786a5128b78..3fc9ca7e8aa3 100644
--- a/drivers/acpi/acpica/acopcode.h
+++ b/drivers/acpi/acpica/acopcode.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index eefcf47a61a0..aed319318835 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -105,7 +105,28 @@ union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope,
105union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op); 105union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op);
106 106
107/* 107/*
108 * psopcode - AML Opcode information 108 * psobject - support for parse object processing
109 */
110acpi_status
111acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
112 u8 *aml_op_start,
113 union acpi_parse_object *unnamed_op,
114 union acpi_parse_object **op);
115
116acpi_status
117acpi_ps_create_op(struct acpi_walk_state *walk_state,
118 u8 *aml_op_start, union acpi_parse_object **new_op);
119
120acpi_status
121acpi_ps_complete_op(struct acpi_walk_state *walk_state,
122 union acpi_parse_object **op, acpi_status status);
123
124acpi_status
125acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
126 union acpi_parse_object *op, acpi_status status);
127
128/*
129 * psopinfo - AML Opcode information
109 */ 130 */
110const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); 131const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
111 132
@@ -211,8 +232,6 @@ void acpi_ps_free_op(union acpi_parse_object *op);
211 232
212u8 acpi_ps_is_leading_char(u32 c); 233u8 acpi_ps_is_leading_char(u32 c);
213 234
214u8 acpi_ps_is_prefix_char(u32 c);
215
216#ifdef ACPI_FUTURE_USAGE 235#ifdef ACPI_FUTURE_USAGE
217u32 acpi_ps_get_name(union acpi_parse_object *op); 236u32 acpi_ps_get_name(union acpi_parse_object *op);
218#endif /* ACPI_FUTURE_USAGE */ 237#endif /* ACPI_FUTURE_USAGE */
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index 9dfa1c83bd4e..752cc40cdc1e 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -1,12 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: acpredef - Information table for ACPI predefined methods and objects 3 * Name: acpredef - Information table for ACPI predefined methods and objects
4 * $Revision: 1.1 $
5 * 4 *
6 *****************************************************************************/ 5 *****************************************************************************/
7 6
8/* 7/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 9 * All rights reserved.
11 * 10 *
12 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -51,13 +50,13 @@
51 * 50 *
52 * 1) PTYPE1 packages do not contain sub-packages. 51 * 1) PTYPE1 packages do not contain sub-packages.
53 * 52 *
54 * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types: 53 * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types:
55 * object type 54 * object type
56 * count 55 * count
57 * object type 56 * object type
58 * count 57 * count
59 * 58 *
60 * ACPI_PTYPE1_VAR: Variable length: 59 * ACPI_PTYPE1_VAR: Variable-length length:
61 * object type (Int/Buf/Ref) 60 * object type (Int/Buf/Ref)
62 * 61 *
63 * ACPI_PTYPE1_OPTION: Package has some required and some optional elements 62 * ACPI_PTYPE1_OPTION: Package has some required and some optional elements
@@ -85,10 +84,10 @@
85 * count 84 * count
86 * (Used for _CST) 85 * (Used for _CST)
87 * 86 *
88 * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length 87 * ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length
89 * (Used for _PRT) 88 * (Used for _PRT)
90 * 89 *
91 * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length 90 * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length
92 * (Used for _HPX) 91 * (Used for _HPX)
93 * 92 *
94 * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length 93 * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length
@@ -124,7 +123,8 @@ enum acpi_return_package_types {
124 * These are the names that can actually be evaluated via acpi_evaluate_object. 123 * These are the names that can actually be evaluated via acpi_evaluate_object.
125 * Not present in this table are the following: 124 * Not present in this table are the following:
126 * 125 *
127 * 1) Predefined/Reserved names that are never evaluated via acpi_evaluate_object: 126 * 1) Predefined/Reserved names that are never evaluated via
127 * acpi_evaluate_object:
128 * _Lxx and _Exx GPE methods 128 * _Lxx and _Exx GPE methods
129 * _Qxx EC methods 129 * _Qxx EC methods
130 * _T_x compiler temporary variables 130 * _T_x compiler temporary variables
@@ -149,6 +149,8 @@ enum acpi_return_package_types {
149 * information about the expected structure of the package. This information 149 * information about the expected structure of the package. This information
150 * is saved here (rather than in a separate table) in order to minimize the 150 * is saved here (rather than in a separate table) in order to minimize the
151 * overall size of the stored data. 151 * overall size of the stored data.
152 *
153 * Note: The additional braces are intended to promote portability.
152 */ 154 */
153static const union acpi_predefined_info predefined_names[] = { 155static const union acpi_predefined_info predefined_names[] = {
154 {{"_AC0", 0, ACPI_RTYPE_INTEGER}}, 156 {{"_AC0", 0, ACPI_RTYPE_INTEGER}},
@@ -212,9 +214,8 @@ static const union acpi_predefined_info predefined_names[] = {
212 {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, 214 {{"_BCT", 1, ACPI_RTYPE_INTEGER}},
213 {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, 215 {{"_BDN", 0, ACPI_RTYPE_INTEGER}},
214 {{"_BFS", 1, 0}}, 216 {{"_BFS", 1, 0}},
215 {{"_BIF", 0, ACPI_RTYPE_PACKAGE} }, /* Fixed-length (9 Int),(4 Str/Buf) */ 217 {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */
216 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, 218 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4, 0}},
217 ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}, 4, 0} },
218 219
219 {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ 220 {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */
220 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4, 221 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4,
@@ -236,7 +237,8 @@ static const union acpi_predefined_info predefined_names[] = {
236 {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */ 237 {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */
237 {{"_CDM", 0, ACPI_RTYPE_INTEGER}}, 238 {{"_CDM", 0, ACPI_RTYPE_INTEGER}},
238 {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ 239 {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */
239 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}}, 240 {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0}, 0,
241 0}},
240 242
241 {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ 243 {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */
242 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}}, 244 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}},
@@ -251,7 +253,8 @@ static const union acpi_predefined_info predefined_names[] = {
251 {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, 253 {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
252 254
253 {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ 255 {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */
254 {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}}, 256 {{{ACPI_PTYPE2_PKG_COUNT, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,
257 0}},
255 258
256 {{"_CWS", 1, ACPI_RTYPE_INTEGER}}, 259 {{"_CWS", 1, ACPI_RTYPE_INTEGER}},
257 {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, 260 {{"_DCK", 1, ACPI_RTYPE_INTEGER}},
@@ -342,8 +345,8 @@ static const union acpi_predefined_info predefined_names[] = {
342 {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */ 345 {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */
343 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0}, 0, 0}}, 346 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0}, 0, 0}},
344 347
345 {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (2 Str) */ 348 {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Str/1 Buf) */
346 {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 2,0}, 0,0}}, 349 {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, ACPI_RTYPE_BUFFER}, 1, 0}},
347 350
348 {{"_MSG", 1, 0}}, 351 {{"_MSG", 1, 0}},
349 {{"_MSM", 4, ACPI_RTYPE_INTEGER}}, 352 {{"_MSM", 4, ACPI_RTYPE_INTEGER}},
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h
index 0347d0993497..f691d0e4d9fa 100644
--- a/drivers/acpi/acpica/acresrc.h
+++ b/drivers/acpi/acpica/acresrc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -347,18 +347,21 @@ extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
347extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[]; 347extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[];
348 348
349/* 349/*
350 * rsdump 350 * rsdumpinfo
351 */ 351 */
352extern struct acpi_rsdump_info acpi_rs_dump_irq[]; 352extern struct acpi_rsdump_info acpi_rs_dump_irq[];
353extern struct acpi_rsdump_info acpi_rs_dump_prt[];
353extern struct acpi_rsdump_info acpi_rs_dump_dma[]; 354extern struct acpi_rsdump_info acpi_rs_dump_dma[];
354extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; 355extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
355extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; 356extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
356extern struct acpi_rsdump_info acpi_rs_dump_io[]; 357extern struct acpi_rsdump_info acpi_rs_dump_io[];
358extern struct acpi_rsdump_info acpi_rs_dump_io_flags[];
357extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; 359extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
358extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; 360extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
359extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; 361extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
360extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; 362extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
361extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; 363extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
364extern struct acpi_rsdump_info acpi_rs_dump_memory_flags[];
362extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; 365extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
363extern struct acpi_rsdump_info acpi_rs_dump_address16[]; 366extern struct acpi_rsdump_info acpi_rs_dump_address16[];
364extern struct acpi_rsdump_info acpi_rs_dump_address32[]; 367extern struct acpi_rsdump_info acpi_rs_dump_address32[];
@@ -372,6 +375,7 @@ extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[];
372extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[]; 375extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[];
373extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[]; 376extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[];
374extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[]; 377extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[];
378extern struct acpi_rsdump_info acpi_rs_dump_general_flags[];
375#endif 379#endif
376 380
377#endif /* __ACRESRC_H__ */ 381#endif /* __ACRESRC_H__ */
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index 937e66c65d1e..7896d85876ca 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index 6712965ba8ae..7755e915a007 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index b0f5f92b674a..0082fa0a6139 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -483,39 +483,17 @@ acpi_ut_short_divide(u64 in_dividend,
483/* 483/*
484 * utmisc 484 * utmisc
485 */ 485 */
486void ut_convert_backslashes(char *pathname);
487
488const char *acpi_ut_validate_exception(acpi_status status); 486const char *acpi_ut_validate_exception(acpi_status status);
489 487
490u8 acpi_ut_is_pci_root_bridge(char *id); 488u8 acpi_ut_is_pci_root_bridge(char *id);
491 489
492u8 acpi_ut_is_aml_table(struct acpi_table_header *table); 490u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
493 491
494acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
495
496void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
497
498acpi_status 492acpi_status
499acpi_ut_walk_package_tree(union acpi_operand_object *source_object, 493acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
500 void *target_object, 494 void *target_object,
501 acpi_pkg_callback walk_callback, void *context); 495 acpi_pkg_callback walk_callback, void *context);
502 496
503void acpi_ut_strupr(char *src_string);
504
505void acpi_ut_strlwr(char *src_string);
506
507int acpi_ut_stricmp(char *string1, char *string2);
508
509void acpi_ut_print_string(char *string, u8 max_length);
510
511u8 acpi_ut_valid_acpi_name(u32 name);
512
513void acpi_ut_repair_name(char *name);
514
515u8 acpi_ut_valid_acpi_char(char character, u32 position);
516
517acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer);
518
519/* Values for Base above (16=Hex, 10=Decimal) */ 497/* Values for Base above (16=Hex, 10=Decimal) */
520 498
521#define ACPI_ANY_BASE 0 499#define ACPI_ANY_BASE 0
@@ -532,15 +510,25 @@ acpi_ut_display_init_pathname(u8 type,
532#endif 510#endif
533 511
534/* 512/*
513 * utownerid - Support for Table/Method Owner IDs
514 */
515acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
516
517void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
518
519/*
535 * utresrc 520 * utresrc
536 */ 521 */
537acpi_status 522acpi_status
538acpi_ut_walk_aml_resources(u8 *aml, 523acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
524 u8 *aml,
539 acpi_size aml_length, 525 acpi_size aml_length,
540 acpi_walk_aml_callback user_function, 526 acpi_walk_aml_callback user_function,
541 void **context); 527 void **context);
542 528
543acpi_status acpi_ut_validate_resource(void *aml, u8 *return_index); 529acpi_status
530acpi_ut_validate_resource(struct acpi_walk_state *walk_state,
531 void *aml, u8 *return_index);
544 532
545u32 acpi_ut_get_descriptor_length(void *aml); 533u32 acpi_ut_get_descriptor_length(void *aml);
546 534
@@ -554,6 +542,27 @@ acpi_status
554acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag); 542acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag);
555 543
556/* 544/*
545 * utstring - String and character utilities
546 */
547void acpi_ut_strupr(char *src_string);
548
549void acpi_ut_strlwr(char *src_string);
550
551int acpi_ut_stricmp(char *string1, char *string2);
552
553acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer);
554
555void acpi_ut_print_string(char *string, u8 max_length);
556
557void ut_convert_backslashes(char *pathname);
558
559u8 acpi_ut_valid_acpi_name(u32 name);
560
561u8 acpi_ut_valid_acpi_char(char character, u32 position);
562
563void acpi_ut_repair_name(char *name);
564
565/*
557 * utmutex - mutex support 566 * utmutex - mutex support
558 */ 567 */
559acpi_status acpi_ut_mutex_initialize(void); 568acpi_status acpi_ut_mutex_initialize(void);
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h
index c26f8ff6c3b9..48a3e331b72d 100644
--- a/drivers/acpi/acpica/amlcode.h
+++ b/drivers/acpi/acpica/amlcode.h
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2012, Intel Corp. 10 * Copyright (C) 2000 - 2013, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index 968449685e06..87c26366d1df 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -199,6 +199,12 @@ struct aml_resource_fixed_dma {
199struct aml_resource_large_header { 199struct aml_resource_large_header {
200AML_RESOURCE_LARGE_HEADER_COMMON}; 200AML_RESOURCE_LARGE_HEADER_COMMON};
201 201
202/* General Flags for address space resource descriptors */
203
204#define ACPI_RESOURCE_FLAG_DEC 2
205#define ACPI_RESOURCE_FLAG_MIF 4
206#define ACPI_RESOURCE_FLAG_MAF 8
207
202struct aml_resource_memory24 { 208struct aml_resource_memory24 {
203 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; 209 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
204 u16 minimum; 210 u16 minimum;
diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c
index c8b5e2565b98..fb09b08d7080 100644
--- a/drivers/acpi/acpica/dsargs.c
+++ b/drivers/acpi/acpica/dsargs.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index 57895db3231a..7ea0f162f11c 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index b5b904ee815f..feadeed1012d 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index 87eff701ecfa..bc8e63f7784b 100644
--- a/drivers/acpi/acpica/dsinit.c
+++ b/drivers/acpi/acpica/dsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index 52eb4e01622a..a9ffd44c18fe 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
47#include "acinterp.h" 47#include "acinterp.h"
48#include "acnamesp.h" 48#include "acnamesp.h"
49#ifdef ACPI_DISASSEMBLER 49#ifdef ACPI_DISASSEMBLER
50#include <acpi/acdisasm.h> 50#include "acdisasm.h"
51#endif 51#endif
52 52
53#define _COMPONENT ACPI_DISPATCHER 53#define _COMPONENT ACPI_DISPATCHER
@@ -151,6 +151,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc)
151 151
152 status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex); 152 status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex);
153 if (ACPI_FAILURE(status)) { 153 if (ACPI_FAILURE(status)) {
154 acpi_ut_delete_object_desc(mutex_desc);
154 return_ACPI_STATUS(status); 155 return_ACPI_STATUS(status);
155 } 156 }
156 157
@@ -378,7 +379,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
378 */ 379 */
379 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); 380 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
380 if (!info) { 381 if (!info) {
381 return_ACPI_STATUS(AE_NO_MEMORY); 382 status = AE_NO_MEMORY;
383 goto cleanup;
382 } 384 }
383 385
384 info->parameters = &this_walk_state->operands[0]; 386 info->parameters = &this_walk_state->operands[0];
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index 9a83b7e0f3ba..3da80460ce38 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index c9f15d3a3686..e20e9f84eee8 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -388,7 +388,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
388 union acpi_parse_object *parent; 388 union acpi_parse_object *parent;
389 union acpi_operand_object *obj_desc = NULL; 389 union acpi_operand_object *obj_desc = NULL;
390 acpi_status status = AE_OK; 390 acpi_status status = AE_OK;
391 unsigned i; 391 u32 i;
392 u16 index; 392 u16 index;
393 u16 reference_count; 393 u16 reference_count;
394 394
@@ -525,7 +525,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
525 } 525 }
526 526
527 ACPI_INFO((AE_INFO, 527 ACPI_INFO((AE_INFO,
528 "Actual Package length (%u) is larger than NumElements field (%u), truncated\n", 528 "Actual Package length (%u) is larger than NumElements field (%u), truncated",
529 i, element_count)); 529 i, element_count));
530 } else if (i < element_count) { 530 } else if (i < element_count) {
531 /* 531 /*
@@ -703,7 +703,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
703 /* Truncate value if we are executing from a 32-bit ACPI table */ 703 /* Truncate value if we are executing from a 32-bit ACPI table */
704 704
705#ifndef ACPI_NO_METHOD_EXECUTION 705#ifndef ACPI_NO_METHOD_EXECUTION
706 acpi_ex_truncate_for32bit_table(obj_desc); 706 (void)acpi_ex_truncate_for32bit_table(obj_desc);
707#endif 707#endif
708 break; 708 break;
709 709
@@ -725,8 +725,18 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
725 case AML_TYPE_LITERAL: 725 case AML_TYPE_LITERAL:
726 726
727 obj_desc->integer.value = op->common.value.integer; 727 obj_desc->integer.value = op->common.value.integer;
728
728#ifndef ACPI_NO_METHOD_EXECUTION 729#ifndef ACPI_NO_METHOD_EXECUTION
729 acpi_ex_truncate_for32bit_table(obj_desc); 730 if (acpi_ex_truncate_for32bit_table(obj_desc)) {
731
732 /* Warn if we found a 64-bit constant in a 32-bit table */
733
734 ACPI_WARNING((AE_INFO,
735 "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X",
736 ACPI_FORMAT_UINT64(op->common.
737 value.integer),
738 (u32)obj_desc->integer.value));
739 }
730#endif 740#endif
731 break; 741 break;
732 742
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index d09c6b4bab2c..ee6367b8eaf7 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -486,18 +486,18 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
486 ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op); 486 ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op);
487 487
488 /* 488 /*
489 * This is where we evaluate the signature_string and oem_iDString 489 * This is where we evaluate the Signature string, oem_id string,
490 * and oem_table_iDString of the data_table_region declaration 490 * and oem_table_id string of the Data Table Region declaration
491 */ 491 */
492 node = op->common.node; 492 node = op->common.node;
493 493
494 /* next_op points to signature_string op */ 494 /* next_op points to Signature string op */
495 495
496 next_op = op->common.value.arg; 496 next_op = op->common.value.arg;
497 497
498 /* 498 /*
499 * Evaluate/create the signature_string and oem_iDString 499 * Evaluate/create the Signature string, oem_id string,
500 * and oem_table_iDString operands 500 * and oem_table_id string operands
501 */ 501 */
502 status = acpi_ds_create_operands(walk_state, next_op); 502 status = acpi_ds_create_operands(walk_state, next_op);
503 if (ACPI_FAILURE(status)) { 503 if (ACPI_FAILURE(status)) {
@@ -505,8 +505,8 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
505 } 505 }
506 506
507 /* 507 /*
508 * Resolve the signature_string and oem_iDString 508 * Resolve the Signature string, oem_id string,
509 * and oem_table_iDString operands 509 * and oem_table_id string operands
510 */ 510 */
511 status = acpi_ex_resolve_operands(op->common.aml_opcode, 511 status = acpi_ex_resolve_operands(op->common.aml_opcode,
512 ACPI_WALK_OPERANDS, walk_state); 512 ACPI_WALK_OPERANDS, walk_state);
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index afeb99f49482..4d8c992a51d8 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -178,7 +178,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
178 178
179 if (!op) { 179 if (!op) {
180 ACPI_ERROR((AE_INFO, "Null Op")); 180 ACPI_ERROR((AE_INFO, "Null Op"));
181 return_UINT8(TRUE); 181 return_VALUE(TRUE);
182 } 182 }
183 183
184 /* 184 /*
@@ -210,7 +210,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
210 "At Method level, result of [%s] not used\n", 210 "At Method level, result of [%s] not used\n",
211 acpi_ps_get_opcode_name(op->common. 211 acpi_ps_get_opcode_name(op->common.
212 aml_opcode))); 212 aml_opcode)));
213 return_UINT8(FALSE); 213 return_VALUE(FALSE);
214 } 214 }
215 215
216 /* Get info on the parent. The root_op is AML_SCOPE */ 216 /* Get info on the parent. The root_op is AML_SCOPE */
@@ -219,7 +219,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
219 acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); 219 acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
220 if (parent_info->class == AML_CLASS_UNKNOWN) { 220 if (parent_info->class == AML_CLASS_UNKNOWN) {
221 ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op)); 221 ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op));
222 return_UINT8(FALSE); 222 return_VALUE(FALSE);
223 } 223 }
224 224
225 /* 225 /*
@@ -307,7 +307,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
307 acpi_ps_get_opcode_name(op->common.parent->common. 307 acpi_ps_get_opcode_name(op->common.parent->common.
308 aml_opcode), op)); 308 aml_opcode), op));
309 309
310 return_UINT8(TRUE); 310 return_VALUE(TRUE);
311 311
312 result_not_used: 312 result_not_used:
313 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 313 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -316,7 +316,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
316 acpi_ps_get_opcode_name(op->common.parent->common. 316 acpi_ps_get_opcode_name(op->common.parent->common.
317 aml_opcode), op)); 317 aml_opcode), op));
318 318
319 return_UINT8(FALSE); 319 return_VALUE(FALSE);
320} 320}
321 321
322/******************************************************************************* 322/*******************************************************************************
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index 58593931be96..44f8325c2bae 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -149,7 +149,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
149 149
150 /* Truncate the predicate to 32-bits if necessary */ 150 /* Truncate the predicate to 32-bits if necessary */
151 151
152 acpi_ex_truncate_for32bit_table(local_obj_desc); 152 (void)acpi_ex_truncate_for32bit_table(local_obj_desc);
153 153
154 /* 154 /*
155 * Save the result of the predicate evaluation on 155 * Save the result of the predicate evaluation on
@@ -706,7 +706,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
706 * ACPI 2.0 support for 64-bit integers: Truncate numeric 706 * ACPI 2.0 support for 64-bit integers: Truncate numeric
707 * result value if we are executing from a 32-bit ACPI table 707 * result value if we are executing from a 32-bit ACPI table
708 */ 708 */
709 acpi_ex_truncate_for32bit_table(walk_state->result_obj); 709 (void)acpi_ex_truncate_for32bit_table(walk_state->result_obj);
710 710
711 /* 711 /*
712 * Check if we just completed the evaluation of a 712 * Check if we just completed the evaluation of a
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 557510084c7a..6e17c0e24e63 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -50,7 +50,7 @@
50#include "acnamesp.h" 50#include "acnamesp.h"
51 51
52#ifdef ACPI_ASL_COMPILER 52#ifdef ACPI_ASL_COMPILER
53#include <acpi/acdisasm.h> 53#include "acdisasm.h"
54#endif 54#endif
55 55
56#define _COMPONENT ACPI_DISPATCHER 56#define _COMPONENT ACPI_DISPATCHER
@@ -178,7 +178,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
178 * Target of Scope() not found. Generate an External for it, and 178 * Target of Scope() not found. Generate an External for it, and
179 * insert the name into the namespace. 179 * insert the name into the namespace.
180 */ 180 */
181 acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); 181 acpi_dm_add_to_external_list(op, path, ACPI_TYPE_DEVICE,
182 0);
182 status = 183 status =
183 acpi_ns_lookup(walk_state->scope_info, path, 184 acpi_ns_lookup(walk_state->scope_info, path,
184 object_type, ACPI_IMODE_LOAD_PASS1, 185 object_type, ACPI_IMODE_LOAD_PASS1,
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index 379835748357..4407ff2377d5 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -222,7 +222,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
222 */ 222 */
223 ACPI_WARNING((AE_INFO, 223 ACPI_WARNING((AE_INFO,
224 "Type override - [%4.4s] had invalid type (%s) " 224 "Type override - [%4.4s] had invalid type (%s) "
225 "for Scope operator, changed to type ANY\n", 225 "for Scope operator, changed to type ANY",
226 acpi_ut_get_node_name(node), 226 acpi_ut_get_node_name(node),
227 acpi_ut_get_type_name(node->type))); 227 acpi_ut_get_type_name(node->type)));
228 228
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c
index f6c4295470ae..d67891de1b54 100644
--- a/drivers/acpi/acpica/dswscope.c
+++ b/drivers/acpi/acpica/dswscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c
index 3e65a15a735f..ecb12e2137ff 100644
--- a/drivers/acpi/acpica/dswstate.c
+++ b/drivers/acpi/acpica/dswstate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c
index d4acfbbe5b29..b8ea0b26cde3 100644
--- a/drivers/acpi/acpica/evevent.c
+++ b/drivers/acpi/acpica/evevent.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c
index af14a7137632..a621481c6cf2 100644
--- a/drivers/acpi/acpica/evglock.c
+++ b/drivers/acpi/acpica/evglock.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index 36d120574423..b9adb9a7ed85 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -561,8 +561,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
561 status = AE_NO_MEMORY; 561 status = AE_NO_MEMORY;
562 } else { 562 } else {
563 /* 563 /*
564 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx 564 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the
565 * control method that corresponds to this GPE 565 * _Lxx/_Exx control method that corresponds to this GPE
566 */ 566 */
567 info->prefix_node = 567 info->prefix_node =
568 local_gpe_event_info->dispatch.method_node; 568 local_gpe_event_info->dispatch.method_node;
@@ -707,7 +707,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
707 if (ACPI_FAILURE(status)) { 707 if (ACPI_FAILURE(status)) {
708 ACPI_EXCEPTION((AE_INFO, status, 708 ACPI_EXCEPTION((AE_INFO, status,
709 "Unable to clear GPE%02X", gpe_number)); 709 "Unable to clear GPE%02X", gpe_number));
710 return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); 710 return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
711 } 711 }
712 } 712 }
713 713
@@ -724,7 +724,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
724 if (ACPI_FAILURE(status)) { 724 if (ACPI_FAILURE(status)) {
725 ACPI_EXCEPTION((AE_INFO, status, 725 ACPI_EXCEPTION((AE_INFO, status,
726 "Unable to disable GPE%02X", gpe_number)); 726 "Unable to disable GPE%02X", gpe_number));
727 return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); 727 return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
728 } 728 }
729 729
730 /* 730 /*
@@ -765,7 +765,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
765 gpe_event_info); 765 gpe_event_info);
766 if (ACPI_FAILURE(status)) { 766 if (ACPI_FAILURE(status)) {
767 ACPI_EXCEPTION((AE_INFO, status, 767 ACPI_EXCEPTION((AE_INFO, status,
768 "Unable to queue handler for GPE%2X - event disabled", 768 "Unable to queue handler for GPE%02X - event disabled",
769 gpe_number)); 769 gpe_number));
770 } 770 }
771 break; 771 break;
@@ -784,7 +784,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
784 break; 784 break;
785 } 785 }
786 786
787 return_UINT32(ACPI_INTERRUPT_HANDLED); 787 return_VALUE(ACPI_INTERRUPT_HANDLED);
788} 788}
789 789
790#endif /* !ACPI_REDUCED_HARDWARE */ 790#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 1571a61a7833..a2d688bbac02 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -405,13 +405,13 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
405 (*return_gpe_block) = gpe_block; 405 (*return_gpe_block) = gpe_block;
406 } 406 }
407 407
408 ACPI_DEBUG_PRINT((ACPI_DB_INIT, 408 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
409 "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", 409 " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X\n",
410 (u32) gpe_block->block_base_number, 410 (u32)gpe_block->block_base_number,
411 (u32) (gpe_block->block_base_number + 411 (u32)(gpe_block->block_base_number +
412 (gpe_block->gpe_count - 1)), 412 (gpe_block->gpe_count - 1)),
413 gpe_device->name.ascii, gpe_block->register_count, 413 gpe_device->name.ascii, gpe_block->register_count,
414 interrupt_number)); 414 interrupt_number));
415 415
416 /* Update global count of currently available GPEs */ 416 /* Update global count of currently available GPEs */
417 417
@@ -496,9 +496,11 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
496 } 496 }
497 497
498 if (gpe_enabled_count) { 498 if (gpe_enabled_count) {
499 ACPI_DEBUG_PRINT((ACPI_DB_INIT, 499 ACPI_INFO((AE_INFO,
500 "Enabled %u GPEs in this block\n", 500 "Enabled %u GPEs in block %02X to %02X",
501 gpe_enabled_count)); 501 gpe_enabled_count, (u32)gpe_block->block_base_number,
502 (u32)(gpe_block->block_base_number +
503 (gpe_block->gpe_count - 1))));
502 } 504 }
503 505
504 gpe_block->initialized = TRUE; 506 gpe_block->initialized = TRUE;
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c
index da0add858f81..72b8f6b3f4ca 100644
--- a/drivers/acpi/acpica/evgpeinit.c
+++ b/drivers/acpi/acpica/evgpeinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -86,6 +86,9 @@ acpi_status acpi_ev_gpe_initialize(void)
86 86
87 ACPI_FUNCTION_TRACE(ev_gpe_initialize); 87 ACPI_FUNCTION_TRACE(ev_gpe_initialize);
88 88
89 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
90 "Initializing General Purpose Events (GPEs):\n"));
91
89 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 92 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
90 if (ACPI_FAILURE(status)) { 93 if (ACPI_FAILURE(status)) {
91 return_ACPI_STATUS(status); 94 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index 228a0c3b1d49..b24dbb80fab8 100644
--- a/drivers/acpi/acpica/evgpeutil.c
+++ b/drivers/acpi/acpica/evgpeutil.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c
new file mode 100644
index 000000000000..d4f83112c2e2
--- /dev/null
+++ b/drivers/acpi/acpica/evhandler.c
@@ -0,0 +1,529 @@
1/******************************************************************************
2 *
3 * Module Name: evhandler - Support for Address Space handlers
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acevents.h"
47#include "acnamesp.h"
48#include "acinterp.h"
49
50#define _COMPONENT ACPI_EVENTS
51ACPI_MODULE_NAME("evhandler")
52
53/* Local prototypes */
54static acpi_status
55acpi_ev_install_handler(acpi_handle obj_handle,
56 u32 level, void *context, void **return_value);
57
58/* These are the address spaces that will get default handlers */
59
60u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
61 ACPI_ADR_SPACE_SYSTEM_MEMORY,
62 ACPI_ADR_SPACE_SYSTEM_IO,
63 ACPI_ADR_SPACE_PCI_CONFIG,
64 ACPI_ADR_SPACE_DATA_TABLE
65};
66
67/*******************************************************************************
68 *
69 * FUNCTION: acpi_ev_install_region_handlers
70 *
71 * PARAMETERS: None
72 *
73 * RETURN: Status
74 *
75 * DESCRIPTION: Installs the core subsystem default address space handlers.
76 *
77 ******************************************************************************/
78
79acpi_status acpi_ev_install_region_handlers(void)
80{
81 acpi_status status;
82 u32 i;
83
84 ACPI_FUNCTION_TRACE(ev_install_region_handlers);
85
86 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
87 if (ACPI_FAILURE(status)) {
88 return_ACPI_STATUS(status);
89 }
90
91 /*
92 * All address spaces (PCI Config, EC, SMBus) are scope dependent and
93 * registration must occur for a specific device.
94 *
95 * In the case of the system memory and IO address spaces there is
96 * currently no device associated with the address space. For these we
97 * use the root.
98 *
99 * We install the default PCI config space handler at the root so that
100 * this space is immediately available even though the we have not
101 * enumerated all the PCI Root Buses yet. This is to conform to the ACPI
102 * specification which states that the PCI config space must be always
103 * available -- even though we are nowhere near ready to find the PCI root
104 * buses at this point.
105 *
106 * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
107 * has already been installed (via acpi_install_address_space_handler).
108 * Similar for AE_SAME_HANDLER.
109 */
110 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
111 status = acpi_ev_install_space_handler(acpi_gbl_root_node,
112 acpi_gbl_default_address_spaces
113 [i],
114 ACPI_DEFAULT_HANDLER,
115 NULL, NULL);
116 switch (status) {
117 case AE_OK:
118 case AE_SAME_HANDLER:
119 case AE_ALREADY_EXISTS:
120
121 /* These exceptions are all OK */
122
123 status = AE_OK;
124 break;
125
126 default:
127
128 goto unlock_and_exit;
129 }
130 }
131
132 unlock_and_exit:
133 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
134 return_ACPI_STATUS(status);
135}
136
137/*******************************************************************************
138 *
139 * FUNCTION: acpi_ev_has_default_handler
140 *
141 * PARAMETERS: node - Namespace node for the device
142 * space_id - The address space ID
143 *
144 * RETURN: TRUE if default handler is installed, FALSE otherwise
145 *
146 * DESCRIPTION: Check if the default handler is installed for the requested
147 * space ID.
148 *
149 ******************************************************************************/
150
151u8
152acpi_ev_has_default_handler(struct acpi_namespace_node *node,
153 acpi_adr_space_type space_id)
154{
155 union acpi_operand_object *obj_desc;
156 union acpi_operand_object *handler_obj;
157
158 /* Must have an existing internal object */
159
160 obj_desc = acpi_ns_get_attached_object(node);
161 if (obj_desc) {
162 handler_obj = obj_desc->device.handler;
163
164 /* Walk the linked list of handlers for this object */
165
166 while (handler_obj) {
167 if (handler_obj->address_space.space_id == space_id) {
168 if (handler_obj->address_space.handler_flags &
169 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
170 return (TRUE);
171 }
172 }
173
174 handler_obj = handler_obj->address_space.next;
175 }
176 }
177
178 return (FALSE);
179}
180
181/*******************************************************************************
182 *
183 * FUNCTION: acpi_ev_install_handler
184 *
185 * PARAMETERS: walk_namespace callback
186 *
187 * DESCRIPTION: This routine installs an address handler into objects that are
188 * of type Region or Device.
189 *
190 * If the Object is a Device, and the device has a handler of
191 * the same type then the search is terminated in that branch.
192 *
193 * This is because the existing handler is closer in proximity
194 * to any more regions than the one we are trying to install.
195 *
196 ******************************************************************************/
197
198static acpi_status
199acpi_ev_install_handler(acpi_handle obj_handle,
200 u32 level, void *context, void **return_value)
201{
202 union acpi_operand_object *handler_obj;
203 union acpi_operand_object *next_handler_obj;
204 union acpi_operand_object *obj_desc;
205 struct acpi_namespace_node *node;
206 acpi_status status;
207
208 ACPI_FUNCTION_NAME(ev_install_handler);
209
210 handler_obj = (union acpi_operand_object *)context;
211
212 /* Parameter validation */
213
214 if (!handler_obj) {
215 return (AE_OK);
216 }
217
218 /* Convert and validate the device handle */
219
220 node = acpi_ns_validate_handle(obj_handle);
221 if (!node) {
222 return (AE_BAD_PARAMETER);
223 }
224
225 /*
226 * We only care about regions and objects that are allowed to have
227 * address space handlers
228 */
229 if ((node->type != ACPI_TYPE_DEVICE) &&
230 (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
231 return (AE_OK);
232 }
233
234 /* Check for an existing internal object */
235
236 obj_desc = acpi_ns_get_attached_object(node);
237 if (!obj_desc) {
238
239 /* No object, just exit */
240
241 return (AE_OK);
242 }
243
244 /* Devices are handled different than regions */
245
246 if (obj_desc->common.type == ACPI_TYPE_DEVICE) {
247
248 /* Check if this Device already has a handler for this address space */
249
250 next_handler_obj = obj_desc->device.handler;
251 while (next_handler_obj) {
252
253 /* Found a handler, is it for the same address space? */
254
255 if (next_handler_obj->address_space.space_id ==
256 handler_obj->address_space.space_id) {
257 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
258 "Found handler for region [%s] in device %p(%p) "
259 "handler %p\n",
260 acpi_ut_get_region_name
261 (handler_obj->address_space.
262 space_id), obj_desc,
263 next_handler_obj,
264 handler_obj));
265
266 /*
267 * Since the object we found it on was a device, then it
268 * means that someone has already installed a handler for
269 * the branch of the namespace from this device on. Just
270 * bail out telling the walk routine to not traverse this
271 * branch. This preserves the scoping rule for handlers.
272 */
273 return (AE_CTRL_DEPTH);
274 }
275
276 /* Walk the linked list of handlers attached to this device */
277
278 next_handler_obj = next_handler_obj->address_space.next;
279 }
280
281 /*
282 * As long as the device didn't have a handler for this space we
283 * don't care about it. We just ignore it and proceed.
284 */
285 return (AE_OK);
286 }
287
288 /* Object is a Region */
289
290 if (obj_desc->region.space_id != handler_obj->address_space.space_id) {
291
292 /* This region is for a different address space, just ignore it */
293
294 return (AE_OK);
295 }
296
297 /*
298 * Now we have a region and it is for the handler's address space type.
299 *
300 * First disconnect region for any previous handler (if any)
301 */
302 acpi_ev_detach_region(obj_desc, FALSE);
303
304 /* Connect the region to the new handler */
305
306 status = acpi_ev_attach_region(handler_obj, obj_desc, FALSE);
307 return (status);
308}
309
310/*******************************************************************************
311 *
312 * FUNCTION: acpi_ev_install_space_handler
313 *
314 * PARAMETERS: node - Namespace node for the device
315 * space_id - The address space ID
316 * handler - Address of the handler
317 * setup - Address of the setup function
318 * context - Value passed to the handler on each access
319 *
320 * RETURN: Status
321 *
322 * DESCRIPTION: Install a handler for all op_regions of a given space_id.
323 * Assumes namespace is locked
324 *
325 ******************************************************************************/
326
327acpi_status
328acpi_ev_install_space_handler(struct acpi_namespace_node * node,
329 acpi_adr_space_type space_id,
330 acpi_adr_space_handler handler,
331 acpi_adr_space_setup setup, void *context)
332{
333 union acpi_operand_object *obj_desc;
334 union acpi_operand_object *handler_obj;
335 acpi_status status;
336 acpi_object_type type;
337 u8 flags = 0;
338
339 ACPI_FUNCTION_TRACE(ev_install_space_handler);
340
341 /*
342 * This registration is valid for only the types below and the root. This
343 * is where the default handlers get placed.
344 */
345 if ((node->type != ACPI_TYPE_DEVICE) &&
346 (node->type != ACPI_TYPE_PROCESSOR) &&
347 (node->type != ACPI_TYPE_THERMAL) && (node != acpi_gbl_root_node)) {
348 status = AE_BAD_PARAMETER;
349 goto unlock_and_exit;
350 }
351
352 if (handler == ACPI_DEFAULT_HANDLER) {
353 flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED;
354
355 switch (space_id) {
356 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
357 handler = acpi_ex_system_memory_space_handler;
358 setup = acpi_ev_system_memory_region_setup;
359 break;
360
361 case ACPI_ADR_SPACE_SYSTEM_IO:
362 handler = acpi_ex_system_io_space_handler;
363 setup = acpi_ev_io_space_region_setup;
364 break;
365
366 case ACPI_ADR_SPACE_PCI_CONFIG:
367 handler = acpi_ex_pci_config_space_handler;
368 setup = acpi_ev_pci_config_region_setup;
369 break;
370
371 case ACPI_ADR_SPACE_CMOS:
372 handler = acpi_ex_cmos_space_handler;
373 setup = acpi_ev_cmos_region_setup;
374 break;
375
376 case ACPI_ADR_SPACE_PCI_BAR_TARGET:
377 handler = acpi_ex_pci_bar_space_handler;
378 setup = acpi_ev_pci_bar_region_setup;
379 break;
380
381 case ACPI_ADR_SPACE_DATA_TABLE:
382 handler = acpi_ex_data_table_space_handler;
383 setup = NULL;
384 break;
385
386 default:
387 status = AE_BAD_PARAMETER;
388 goto unlock_and_exit;
389 }
390 }
391
392 /* If the caller hasn't specified a setup routine, use the default */
393
394 if (!setup) {
395 setup = acpi_ev_default_region_setup;
396 }
397
398 /* Check for an existing internal object */
399
400 obj_desc = acpi_ns_get_attached_object(node);
401 if (obj_desc) {
402 /*
403 * The attached device object already exists. Make sure the handler
404 * is not already installed.
405 */
406 handler_obj = obj_desc->device.handler;
407
408 /* Walk the handler list for this device */
409
410 while (handler_obj) {
411
412 /* Same space_id indicates a handler already installed */
413
414 if (handler_obj->address_space.space_id == space_id) {
415 if (handler_obj->address_space.handler ==
416 handler) {
417 /*
418 * It is (relatively) OK to attempt to install the SAME
419 * handler twice. This can easily happen with the
420 * PCI_Config space.
421 */
422 status = AE_SAME_HANDLER;
423 goto unlock_and_exit;
424 } else {
425 /* A handler is already installed */
426
427 status = AE_ALREADY_EXISTS;
428 }
429 goto unlock_and_exit;
430 }
431
432 /* Walk the linked list of handlers */
433
434 handler_obj = handler_obj->address_space.next;
435 }
436 } else {
437 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
438 "Creating object on Device %p while installing handler\n",
439 node));
440
441 /* obj_desc does not exist, create one */
442
443 if (node->type == ACPI_TYPE_ANY) {
444 type = ACPI_TYPE_DEVICE;
445 } else {
446 type = node->type;
447 }
448
449 obj_desc = acpi_ut_create_internal_object(type);
450 if (!obj_desc) {
451 status = AE_NO_MEMORY;
452 goto unlock_and_exit;
453 }
454
455 /* Init new descriptor */
456
457 obj_desc->common.type = (u8)type;
458
459 /* Attach the new object to the Node */
460
461 status = acpi_ns_attach_object(node, obj_desc, type);
462
463 /* Remove local reference to the object */
464
465 acpi_ut_remove_reference(obj_desc);
466
467 if (ACPI_FAILURE(status)) {
468 goto unlock_and_exit;
469 }
470 }
471
472 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
473 "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
474 acpi_ut_get_region_name(space_id), space_id,
475 acpi_ut_get_node_name(node), node, obj_desc));
476
477 /*
478 * Install the handler
479 *
480 * At this point there is no existing handler. Just allocate the object
481 * for the handler and link it into the list.
482 */
483 handler_obj =
484 acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
485 if (!handler_obj) {
486 status = AE_NO_MEMORY;
487 goto unlock_and_exit;
488 }
489
490 /* Init handler obj */
491
492 handler_obj->address_space.space_id = (u8)space_id;
493 handler_obj->address_space.handler_flags = flags;
494 handler_obj->address_space.region_list = NULL;
495 handler_obj->address_space.node = node;
496 handler_obj->address_space.handler = handler;
497 handler_obj->address_space.context = context;
498 handler_obj->address_space.setup = setup;
499
500 /* Install at head of Device.address_space list */
501
502 handler_obj->address_space.next = obj_desc->device.handler;
503
504 /*
505 * The Device object is the first reference on the handler_obj.
506 * Each region that uses the handler adds a reference.
507 */
508 obj_desc->device.handler = handler_obj;
509
510 /*
511 * Walk the namespace finding all of the regions this
512 * handler will manage.
513 *
514 * Start at the device and search the branch toward
515 * the leaf nodes until either the leaf is encountered or
516 * a device is detected that has an address handler of the
517 * same type.
518 *
519 * In either case, back up and search down the remainder
520 * of the branch
521 */
522 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
523 ACPI_NS_WALK_UNLOCK,
524 acpi_ev_install_handler, NULL,
525 handler_obj, NULL);
526
527 unlock_and_exit:
528 return_ACPI_STATUS(status);
529}
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index 51f537937c1f..c986b2336b81 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 0cc6a16fedc7..6555e350fc1f 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -1,11 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Module Name: evregion - ACPI address_space (op_region) handler dispatch 3 * Module Name: evregion - Operation Region support
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -50,10 +50,9 @@
50#define _COMPONENT ACPI_EVENTS 50#define _COMPONENT ACPI_EVENTS
51ACPI_MODULE_NAME("evregion") 51ACPI_MODULE_NAME("evregion")
52 52
53extern u8 acpi_gbl_default_address_spaces[];
54
53/* Local prototypes */ 55/* Local prototypes */
54static u8
55acpi_ev_has_default_handler(struct acpi_namespace_node *node,
56 acpi_adr_space_type space_id);
57 56
58static void acpi_ev_orphan_ec_reg_method(void); 57static void acpi_ev_orphan_ec_reg_method(void);
59 58
@@ -61,135 +60,6 @@ static acpi_status
61acpi_ev_reg_run(acpi_handle obj_handle, 60acpi_ev_reg_run(acpi_handle obj_handle,
62 u32 level, void *context, void **return_value); 61 u32 level, void *context, void **return_value);
63 62
64static acpi_status
65acpi_ev_install_handler(acpi_handle obj_handle,
66 u32 level, void *context, void **return_value);
67
68/* These are the address spaces that will get default handlers */
69
70#define ACPI_NUM_DEFAULT_SPACES 4
71
72static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
73 ACPI_ADR_SPACE_SYSTEM_MEMORY,
74 ACPI_ADR_SPACE_SYSTEM_IO,
75 ACPI_ADR_SPACE_PCI_CONFIG,
76 ACPI_ADR_SPACE_DATA_TABLE
77};
78
79/*******************************************************************************
80 *
81 * FUNCTION: acpi_ev_install_region_handlers
82 *
83 * PARAMETERS: None
84 *
85 * RETURN: Status
86 *
87 * DESCRIPTION: Installs the core subsystem default address space handlers.
88 *
89 ******************************************************************************/
90
91acpi_status acpi_ev_install_region_handlers(void)
92{
93 acpi_status status;
94 u32 i;
95
96 ACPI_FUNCTION_TRACE(ev_install_region_handlers);
97
98 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
99 if (ACPI_FAILURE(status)) {
100 return_ACPI_STATUS(status);
101 }
102
103 /*
104 * All address spaces (PCI Config, EC, SMBus) are scope dependent and
105 * registration must occur for a specific device.
106 *
107 * In the case of the system memory and IO address spaces there is
108 * currently no device associated with the address space. For these we
109 * use the root.
110 *
111 * We install the default PCI config space handler at the root so that
112 * this space is immediately available even though the we have not
113 * enumerated all the PCI Root Buses yet. This is to conform to the ACPI
114 * specification which states that the PCI config space must be always
115 * available -- even though we are nowhere near ready to find the PCI root
116 * buses at this point.
117 *
118 * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
119 * has already been installed (via acpi_install_address_space_handler).
120 * Similar for AE_SAME_HANDLER.
121 */
122 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
123 status = acpi_ev_install_space_handler(acpi_gbl_root_node,
124 acpi_gbl_default_address_spaces
125 [i],
126 ACPI_DEFAULT_HANDLER,
127 NULL, NULL);
128 switch (status) {
129 case AE_OK:
130 case AE_SAME_HANDLER:
131 case AE_ALREADY_EXISTS:
132
133 /* These exceptions are all OK */
134
135 status = AE_OK;
136 break;
137
138 default:
139
140 goto unlock_and_exit;
141 }
142 }
143
144 unlock_and_exit:
145 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
146 return_ACPI_STATUS(status);
147}
148
149/*******************************************************************************
150 *
151 * FUNCTION: acpi_ev_has_default_handler
152 *
153 * PARAMETERS: node - Namespace node for the device
154 * space_id - The address space ID
155 *
156 * RETURN: TRUE if default handler is installed, FALSE otherwise
157 *
158 * DESCRIPTION: Check if the default handler is installed for the requested
159 * space ID.
160 *
161 ******************************************************************************/
162
163static u8
164acpi_ev_has_default_handler(struct acpi_namespace_node *node,
165 acpi_adr_space_type space_id)
166{
167 union acpi_operand_object *obj_desc;
168 union acpi_operand_object *handler_obj;
169
170 /* Must have an existing internal object */
171
172 obj_desc = acpi_ns_get_attached_object(node);
173 if (obj_desc) {
174 handler_obj = obj_desc->device.handler;
175
176 /* Walk the linked list of handlers for this object */
177
178 while (handler_obj) {
179 if (handler_obj->address_space.space_id == space_id) {
180 if (handler_obj->address_space.handler_flags &
181 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
182 return (TRUE);
183 }
184 }
185
186 handler_obj = handler_obj->address_space.next;
187 }
188 }
189
190 return (FALSE);
191}
192
193/******************************************************************************* 63/*******************************************************************************
194 * 64 *
195 * FUNCTION: acpi_ev_initialize_op_regions 65 * FUNCTION: acpi_ev_initialize_op_regions
@@ -241,91 +111,6 @@ acpi_status acpi_ev_initialize_op_regions(void)
241 111
242/******************************************************************************* 112/*******************************************************************************
243 * 113 *
244 * FUNCTION: acpi_ev_execute_reg_method
245 *
246 * PARAMETERS: region_obj - Region object
247 * function - Passed to _REG: On (1) or Off (0)
248 *
249 * RETURN: Status
250 *
251 * DESCRIPTION: Execute _REG method for a region
252 *
253 ******************************************************************************/
254
255acpi_status
256acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
257{
258 struct acpi_evaluate_info *info;
259 union acpi_operand_object *args[3];
260 union acpi_operand_object *region_obj2;
261 acpi_status status;
262
263 ACPI_FUNCTION_TRACE(ev_execute_reg_method);
264
265 region_obj2 = acpi_ns_get_secondary_object(region_obj);
266 if (!region_obj2) {
267 return_ACPI_STATUS(AE_NOT_EXIST);
268 }
269
270 if (region_obj2->extra.method_REG == NULL) {
271 return_ACPI_STATUS(AE_OK);
272 }
273
274 /* Allocate and initialize the evaluation information block */
275
276 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
277 if (!info) {
278 return_ACPI_STATUS(AE_NO_MEMORY);
279 }
280
281 info->prefix_node = region_obj2->extra.method_REG;
282 info->pathname = NULL;
283 info->parameters = args;
284 info->flags = ACPI_IGNORE_RETURN_VALUE;
285
286 /*
287 * The _REG method has two arguments:
288 *
289 * arg0 - Integer:
290 * Operation region space ID Same value as region_obj->Region.space_id
291 *
292 * arg1 - Integer:
293 * connection status 1 for connecting the handler, 0 for disconnecting
294 * the handler (Passed as a parameter)
295 */
296 args[0] =
297 acpi_ut_create_integer_object((u64) region_obj->region.space_id);
298 if (!args[0]) {
299 status = AE_NO_MEMORY;
300 goto cleanup1;
301 }
302
303 args[1] = acpi_ut_create_integer_object((u64) function);
304 if (!args[1]) {
305 status = AE_NO_MEMORY;
306 goto cleanup2;
307 }
308
309 args[2] = NULL; /* Terminate list */
310
311 /* Execute the method, no return value */
312
313 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
314 (ACPI_TYPE_METHOD, info->prefix_node, NULL));
315
316 status = acpi_ns_evaluate(info);
317 acpi_ut_remove_reference(args[1]);
318
319 cleanup2:
320 acpi_ut_remove_reference(args[0]);
321
322 cleanup1:
323 ACPI_FREE(info);
324 return_ACPI_STATUS(status);
325}
326
327/*******************************************************************************
328 *
329 * FUNCTION: acpi_ev_address_space_dispatch 114 * FUNCTION: acpi_ev_address_space_dispatch
330 * 115 *
331 * PARAMETERS: region_obj - Internal region object 116 * PARAMETERS: region_obj - Internal region object
@@ -709,351 +494,86 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,
709 494
710/******************************************************************************* 495/*******************************************************************************
711 * 496 *
712 * FUNCTION: acpi_ev_install_handler 497 * FUNCTION: acpi_ev_execute_reg_method
713 *
714 * PARAMETERS: walk_namespace callback
715 *
716 * DESCRIPTION: This routine installs an address handler into objects that are
717 * of type Region or Device.
718 *
719 * If the Object is a Device, and the device has a handler of
720 * the same type then the search is terminated in that branch.
721 *
722 * This is because the existing handler is closer in proximity
723 * to any more regions than the one we are trying to install.
724 *
725 ******************************************************************************/
726
727static acpi_status
728acpi_ev_install_handler(acpi_handle obj_handle,
729 u32 level, void *context, void **return_value)
730{
731 union acpi_operand_object *handler_obj;
732 union acpi_operand_object *next_handler_obj;
733 union acpi_operand_object *obj_desc;
734 struct acpi_namespace_node *node;
735 acpi_status status;
736
737 ACPI_FUNCTION_NAME(ev_install_handler);
738
739 handler_obj = (union acpi_operand_object *)context;
740
741 /* Parameter validation */
742
743 if (!handler_obj) {
744 return (AE_OK);
745 }
746
747 /* Convert and validate the device handle */
748
749 node = acpi_ns_validate_handle(obj_handle);
750 if (!node) {
751 return (AE_BAD_PARAMETER);
752 }
753
754 /*
755 * We only care about regions and objects that are allowed to have
756 * address space handlers
757 */
758 if ((node->type != ACPI_TYPE_DEVICE) &&
759 (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
760 return (AE_OK);
761 }
762
763 /* Check for an existing internal object */
764
765 obj_desc = acpi_ns_get_attached_object(node);
766 if (!obj_desc) {
767
768 /* No object, just exit */
769
770 return (AE_OK);
771 }
772
773 /* Devices are handled different than regions */
774
775 if (obj_desc->common.type == ACPI_TYPE_DEVICE) {
776
777 /* Check if this Device already has a handler for this address space */
778
779 next_handler_obj = obj_desc->device.handler;
780 while (next_handler_obj) {
781
782 /* Found a handler, is it for the same address space? */
783
784 if (next_handler_obj->address_space.space_id ==
785 handler_obj->address_space.space_id) {
786 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
787 "Found handler for region [%s] in device %p(%p) "
788 "handler %p\n",
789 acpi_ut_get_region_name
790 (handler_obj->address_space.
791 space_id), obj_desc,
792 next_handler_obj,
793 handler_obj));
794
795 /*
796 * Since the object we found it on was a device, then it
797 * means that someone has already installed a handler for
798 * the branch of the namespace from this device on. Just
799 * bail out telling the walk routine to not traverse this
800 * branch. This preserves the scoping rule for handlers.
801 */
802 return (AE_CTRL_DEPTH);
803 }
804
805 /* Walk the linked list of handlers attached to this device */
806
807 next_handler_obj = next_handler_obj->address_space.next;
808 }
809
810 /*
811 * As long as the device didn't have a handler for this space we
812 * don't care about it. We just ignore it and proceed.
813 */
814 return (AE_OK);
815 }
816
817 /* Object is a Region */
818
819 if (obj_desc->region.space_id != handler_obj->address_space.space_id) {
820
821 /* This region is for a different address space, just ignore it */
822
823 return (AE_OK);
824 }
825
826 /*
827 * Now we have a region and it is for the handler's address space type.
828 *
829 * First disconnect region for any previous handler (if any)
830 */
831 acpi_ev_detach_region(obj_desc, FALSE);
832
833 /* Connect the region to the new handler */
834
835 status = acpi_ev_attach_region(handler_obj, obj_desc, FALSE);
836 return (status);
837}
838
839/*******************************************************************************
840 *
841 * FUNCTION: acpi_ev_install_space_handler
842 * 498 *
843 * PARAMETERS: node - Namespace node for the device 499 * PARAMETERS: region_obj - Region object
844 * space_id - The address space ID 500 * function - Passed to _REG: On (1) or Off (0)
845 * handler - Address of the handler
846 * setup - Address of the setup function
847 * context - Value passed to the handler on each access
848 * 501 *
849 * RETURN: Status 502 * RETURN: Status
850 * 503 *
851 * DESCRIPTION: Install a handler for all op_regions of a given space_id. 504 * DESCRIPTION: Execute _REG method for a region
852 * Assumes namespace is locked
853 * 505 *
854 ******************************************************************************/ 506 ******************************************************************************/
855 507
856acpi_status 508acpi_status
857acpi_ev_install_space_handler(struct acpi_namespace_node * node, 509acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
858 acpi_adr_space_type space_id,
859 acpi_adr_space_handler handler,
860 acpi_adr_space_setup setup, void *context)
861{ 510{
862 union acpi_operand_object *obj_desc; 511 struct acpi_evaluate_info *info;
863 union acpi_operand_object *handler_obj; 512 union acpi_operand_object *args[3];
513 union acpi_operand_object *region_obj2;
864 acpi_status status; 514 acpi_status status;
865 acpi_object_type type;
866 u8 flags = 0;
867 515
868 ACPI_FUNCTION_TRACE(ev_install_space_handler); 516 ACPI_FUNCTION_TRACE(ev_execute_reg_method);
869
870 /*
871 * This registration is valid for only the types below and the root. This
872 * is where the default handlers get placed.
873 */
874 if ((node->type != ACPI_TYPE_DEVICE) &&
875 (node->type != ACPI_TYPE_PROCESSOR) &&
876 (node->type != ACPI_TYPE_THERMAL) && (node != acpi_gbl_root_node)) {
877 status = AE_BAD_PARAMETER;
878 goto unlock_and_exit;
879 }
880 517
881 if (handler == ACPI_DEFAULT_HANDLER) { 518 region_obj2 = acpi_ns_get_secondary_object(region_obj);
882 flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED; 519 if (!region_obj2) {
883 520 return_ACPI_STATUS(AE_NOT_EXIST);
884 switch (space_id) {
885 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
886 handler = acpi_ex_system_memory_space_handler;
887 setup = acpi_ev_system_memory_region_setup;
888 break;
889
890 case ACPI_ADR_SPACE_SYSTEM_IO:
891 handler = acpi_ex_system_io_space_handler;
892 setup = acpi_ev_io_space_region_setup;
893 break;
894
895 case ACPI_ADR_SPACE_PCI_CONFIG:
896 handler = acpi_ex_pci_config_space_handler;
897 setup = acpi_ev_pci_config_region_setup;
898 break;
899
900 case ACPI_ADR_SPACE_CMOS:
901 handler = acpi_ex_cmos_space_handler;
902 setup = acpi_ev_cmos_region_setup;
903 break;
904
905 case ACPI_ADR_SPACE_PCI_BAR_TARGET:
906 handler = acpi_ex_pci_bar_space_handler;
907 setup = acpi_ev_pci_bar_region_setup;
908 break;
909
910 case ACPI_ADR_SPACE_DATA_TABLE:
911 handler = acpi_ex_data_table_space_handler;
912 setup = NULL;
913 break;
914
915 default:
916 status = AE_BAD_PARAMETER;
917 goto unlock_and_exit;
918 }
919 } 521 }
920 522
921 /* If the caller hasn't specified a setup routine, use the default */ 523 if (region_obj2->extra.method_REG == NULL) {
922 524 return_ACPI_STATUS(AE_OK);
923 if (!setup) {
924 setup = acpi_ev_default_region_setup;
925 } 525 }
926 526
927 /* Check for an existing internal object */ 527 /* Allocate and initialize the evaluation information block */
928
929 obj_desc = acpi_ns_get_attached_object(node);
930 if (obj_desc) {
931 /*
932 * The attached device object already exists. Make sure the handler
933 * is not already installed.
934 */
935 handler_obj = obj_desc->device.handler;
936
937 /* Walk the handler list for this device */
938
939 while (handler_obj) {
940
941 /* Same space_id indicates a handler already installed */
942
943 if (handler_obj->address_space.space_id == space_id) {
944 if (handler_obj->address_space.handler ==
945 handler) {
946 /*
947 * It is (relatively) OK to attempt to install the SAME
948 * handler twice. This can easily happen with the
949 * PCI_Config space.
950 */
951 status = AE_SAME_HANDLER;
952 goto unlock_and_exit;
953 } else {
954 /* A handler is already installed */
955
956 status = AE_ALREADY_EXISTS;
957 }
958 goto unlock_and_exit;
959 }
960
961 /* Walk the linked list of handlers */
962
963 handler_obj = handler_obj->address_space.next;
964 }
965 } else {
966 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
967 "Creating object on Device %p while installing handler\n",
968 node));
969
970 /* obj_desc does not exist, create one */
971
972 if (node->type == ACPI_TYPE_ANY) {
973 type = ACPI_TYPE_DEVICE;
974 } else {
975 type = node->type;
976 }
977
978 obj_desc = acpi_ut_create_internal_object(type);
979 if (!obj_desc) {
980 status = AE_NO_MEMORY;
981 goto unlock_and_exit;
982 }
983
984 /* Init new descriptor */
985
986 obj_desc->common.type = (u8) type;
987
988 /* Attach the new object to the Node */
989
990 status = acpi_ns_attach_object(node, obj_desc, type);
991
992 /* Remove local reference to the object */
993
994 acpi_ut_remove_reference(obj_desc);
995 528
996 if (ACPI_FAILURE(status)) { 529 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
997 goto unlock_and_exit; 530 if (!info) {
998 } 531 return_ACPI_STATUS(AE_NO_MEMORY);
999 } 532 }
1000 533
1001 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 534 info->prefix_node = region_obj2->extra.method_REG;
1002 "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", 535 info->pathname = NULL;
1003 acpi_ut_get_region_name(space_id), space_id, 536 info->parameters = args;
1004 acpi_ut_get_node_name(node), node, obj_desc)); 537 info->flags = ACPI_IGNORE_RETURN_VALUE;
1005 538
1006 /* 539 /*
1007 * Install the handler 540 * The _REG method has two arguments:
541 *
542 * arg0 - Integer:
543 * Operation region space ID Same value as region_obj->Region.space_id
1008 * 544 *
1009 * At this point there is no existing handler. Just allocate the object 545 * arg1 - Integer:
1010 * for the handler and link it into the list. 546 * connection status 1 for connecting the handler, 0 for disconnecting
547 * the handler (Passed as a parameter)
1011 */ 548 */
1012 handler_obj = 549 args[0] =
1013 acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER); 550 acpi_ut_create_integer_object((u64)region_obj->region.space_id);
1014 if (!handler_obj) { 551 if (!args[0]) {
1015 status = AE_NO_MEMORY; 552 status = AE_NO_MEMORY;
1016 goto unlock_and_exit; 553 goto cleanup1;
1017 } 554 }
1018 555
1019 /* Init handler obj */ 556 args[1] = acpi_ut_create_integer_object((u64)function);
557 if (!args[1]) {
558 status = AE_NO_MEMORY;
559 goto cleanup2;
560 }
1020 561
1021 handler_obj->address_space.space_id = (u8) space_id; 562 args[2] = NULL; /* Terminate list */
1022 handler_obj->address_space.handler_flags = flags;
1023 handler_obj->address_space.region_list = NULL;
1024 handler_obj->address_space.node = node;
1025 handler_obj->address_space.handler = handler;
1026 handler_obj->address_space.context = context;
1027 handler_obj->address_space.setup = setup;
1028 563
1029 /* Install at head of Device.address_space list */ 564 /* Execute the method, no return value */
1030 565
1031 handler_obj->address_space.next = obj_desc->device.handler; 566 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
567 (ACPI_TYPE_METHOD, info->prefix_node, NULL));
1032 568
1033 /* 569 status = acpi_ns_evaluate(info);
1034 * The Device object is the first reference on the handler_obj. 570 acpi_ut_remove_reference(args[1]);
1035 * Each region that uses the handler adds a reference.
1036 */
1037 obj_desc->device.handler = handler_obj;
1038 571
1039 /* 572 cleanup2:
1040 * Walk the namespace finding all of the regions this 573 acpi_ut_remove_reference(args[0]);
1041 * handler will manage.
1042 *
1043 * Start at the device and search the branch toward
1044 * the leaf nodes until either the leaf is encountered or
1045 * a device is detected that has an address handler of the
1046 * same type.
1047 *
1048 * In either case, back up and search down the remainder
1049 * of the branch
1050 */
1051 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
1052 ACPI_NS_WALK_UNLOCK,
1053 acpi_ev_install_handler, NULL,
1054 handler_obj, NULL);
1055 574
1056 unlock_and_exit: 575 cleanup1:
576 ACPI_FREE(info);
1057 return_ACPI_STATUS(status); 577 return_ACPI_STATUS(status);
1058} 578}
1059 579
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 1474241bfc7e..3bb616794b3b 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c
index f9661e2b46a9..f4b43bede015 100644
--- a/drivers/acpi/acpica/evsci.c
+++ b/drivers/acpi/acpica/evsci.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -89,7 +89,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
89 */ 89 */
90 interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); 90 interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
91 91
92 return_UINT32(interrupt_handled); 92 return_VALUE(interrupt_handled);
93} 93}
94 94
95/******************************************************************************* 95/*******************************************************************************
@@ -120,7 +120,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
120 120
121 interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); 121 interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
122 122
123 return_UINT32(interrupt_handled); 123 return_VALUE(interrupt_handled);
124} 124}
125 125
126/****************************************************************************** 126/******************************************************************************
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index ae668f32cf16..ddffd6847914 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -56,13 +56,13 @@ ACPI_MODULE_NAME("evxface")
56 * 56 *
57 * FUNCTION: acpi_install_notify_handler 57 * FUNCTION: acpi_install_notify_handler
58 * 58 *
59 * PARAMETERS: Device - The device for which notifies will be handled 59 * PARAMETERS: device - The device for which notifies will be handled
60 * handler_type - The type of handler: 60 * handler_type - The type of handler:
61 * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) 61 * ACPI_SYSTEM_NOTIFY: System Handler (00-7F)
62 * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) 62 * ACPI_DEVICE_NOTIFY: Device Handler (80-FF)
63 * ACPI_ALL_NOTIFY: Both System and Device 63 * ACPI_ALL_NOTIFY: Both System and Device
64 * Handler - Address of the handler 64 * handler - Address of the handler
65 * Context - Value passed to the handler on each GPE 65 * context - Value passed to the handler on each GPE
66 * 66 *
67 * RETURN: Status 67 * RETURN: Status
68 * 68 *
@@ -217,12 +217,12 @@ ACPI_EXPORT_SYMBOL(acpi_install_notify_handler)
217 * 217 *
218 * FUNCTION: acpi_remove_notify_handler 218 * FUNCTION: acpi_remove_notify_handler
219 * 219 *
220 * PARAMETERS: Device - The device for which the handler is installed 220 * PARAMETERS: device - The device for which the handler is installed
221 * handler_type - The type of handler: 221 * handler_type - The type of handler:
222 * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) 222 * ACPI_SYSTEM_NOTIFY: System Handler (00-7F)
223 * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) 223 * ACPI_DEVICE_NOTIFY: Device Handler (80-FF)
224 * ACPI_ALL_NOTIFY: Both System and Device 224 * ACPI_ALL_NOTIFY: Both System and Device
225 * Handler - Address of the handler 225 * handler - Address of the handler
226 * 226 *
227 * RETURN: Status 227 * RETURN: Status
228 * 228 *
@@ -249,7 +249,8 @@ acpi_remove_notify_handler(acpi_handle device,
249 (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { 249 (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
250 return_ACPI_STATUS(AE_BAD_PARAMETER); 250 return_ACPI_STATUS(AE_BAD_PARAMETER);
251 } 251 }
252 /* Make sure all deferred tasks are completed */ 252
253 /* Make sure all deferred notify tasks are completed */
253 254
254 acpi_os_wait_events_complete(); 255 acpi_os_wait_events_complete();
255 256
@@ -596,7 +597,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
596 return_ACPI_STATUS(status); 597 return_ACPI_STATUS(status);
597 } 598 }
598 599
599 /* Allocate memory for the handler object */ 600 /* Allocate and init handler object (before lock) */
600 601
601 handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_handler_info)); 602 handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_handler_info));
602 if (!handler) { 603 if (!handler) {
@@ -622,16 +623,15 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
622 goto free_and_exit; 623 goto free_and_exit;
623 } 624 }
624 625
625 /* Allocate and init handler object */
626
627 handler->address = address; 626 handler->address = address;
628 handler->context = context; 627 handler->context = context;
629 handler->method_node = gpe_event_info->dispatch.method_node; 628 handler->method_node = gpe_event_info->dispatch.method_node;
630 handler->original_flags = gpe_event_info->flags & 629 handler->original_flags = (u8)(gpe_event_info->flags &
631 (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); 630 (ACPI_GPE_XRUPT_TYPE_MASK |
631 ACPI_GPE_DISPATCH_MASK));
632 632
633 /* 633 /*
634 * If the GPE is associated with a method, it might have been enabled 634 * If the GPE is associated with a method, it may have been enabled
635 * automatically during initialization, in which case it has to be 635 * automatically during initialization, in which case it has to be
636 * disabled now to avoid spurious execution of the handler. 636 * disabled now to avoid spurious execution of the handler.
637 */ 637 */
@@ -646,7 +646,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
646 646
647 gpe_event_info->dispatch.handler = handler; 647 gpe_event_info->dispatch.handler = handler;
648 648
649 /* Setup up dispatch flags to indicate handler (vs. method) */ 649 /* Setup up dispatch flags to indicate handler (vs. method/notify) */
650 650
651 gpe_event_info->flags &= 651 gpe_event_info->flags &=
652 ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); 652 ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
@@ -697,7 +697,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
697 return_ACPI_STATUS(AE_BAD_PARAMETER); 697 return_ACPI_STATUS(AE_BAD_PARAMETER);
698 } 698 }
699 699
700 /* Make sure all deferred tasks are completed */ 700 /* Make sure all deferred GPE tasks are completed */
701 701
702 acpi_os_wait_events_complete(); 702 acpi_os_wait_events_complete();
703 703
@@ -747,10 +747,10 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
747 * enabled, it should be enabled at this point to restore the 747 * enabled, it should be enabled at this point to restore the
748 * post-initialization configuration. 748 * post-initialization configuration.
749 */ 749 */
750 750 if ((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) &&
751 if ((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) 751 handler->originally_enabled) {
752 && handler->originally_enabled)
753 (void)acpi_ev_add_gpe_reference(gpe_event_info); 752 (void)acpi_ev_add_gpe_reference(gpe_event_info);
753 }
754 754
755 /* Now we can free the handler object */ 755 /* Now we can free the handler object */
756 756
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 35520c6eeefb..d6e4e42316db 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -61,7 +61,6 @@ ACPI_MODULE_NAME("evxfevnt")
61 * DESCRIPTION: Transfers the system into ACPI mode. 61 * DESCRIPTION: Transfers the system into ACPI mode.
62 * 62 *
63 ******************************************************************************/ 63 ******************************************************************************/
64
65acpi_status acpi_enable(void) 64acpi_status acpi_enable(void)
66{ 65{
67 acpi_status status; 66 acpi_status status;
@@ -210,8 +209,8 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event)
210 * 209 *
211 * FUNCTION: acpi_disable_event 210 * FUNCTION: acpi_disable_event
212 * 211 *
213 * PARAMETERS: Event - The fixed eventto be enabled 212 * PARAMETERS: event - The fixed event to be disabled
214 * Flags - Reserved 213 * flags - Reserved
215 * 214 *
216 * RETURN: Status 215 * RETURN: Status
217 * 216 *
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index 3f30e753b652..aff4cc261211 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@
51ACPI_MODULE_NAME("evxfgpe") 51ACPI_MODULE_NAME("evxfgpe")
52 52
53#if (!ACPI_REDUCED_HARDWARE) /* Entire module */ 53#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
54/****************************************************************************** 54/*******************************************************************************
55 * 55 *
56 * FUNCTION: acpi_update_all_gpes 56 * FUNCTION: acpi_update_all_gpes
57 * 57 *
@@ -172,6 +172,7 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
172 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 172 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
173 return_ACPI_STATUS(status); 173 return_ACPI_STATUS(status);
174} 174}
175
175ACPI_EXPORT_SYMBOL(acpi_disable_gpe) 176ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
176 177
177 178
@@ -225,7 +226,7 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
225 ACPI_CAST_PTR(struct acpi_namespace_node, wake_device); 226 ACPI_CAST_PTR(struct acpi_namespace_node, wake_device);
226 } 227 }
227 228
228 /* Validate WakeDevice is of type Device */ 229 /* Validate wake_device is of type Device */
229 230
230 if (device_node->type != ACPI_TYPE_DEVICE) { 231 if (device_node->type != ACPI_TYPE_DEVICE) {
231 return_ACPI_STATUS (AE_BAD_PARAMETER); 232 return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -432,8 +433,8 @@ ACPI_EXPORT_SYMBOL(acpi_clear_gpe)
432 * 433 *
433 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 434 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
434 * gpe_number - GPE level within the GPE block 435 * gpe_number - GPE level within the GPE block
435 * event_status - Where the current status of the event will 436 * event_status - Where the current status of the event
436 * be returned 437 * will be returned
437 * 438 *
438 * RETURN: Status 439 * RETURN: Status
439 * 440 *
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index 96b412d03950..96c9e5f355ae 100644
--- a/drivers/acpi/acpica/evxfregn.c
+++ b/drivers/acpi/acpica/evxfregn.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index 16219bde48da..d93b70be60ad 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,7 @@
48#include "actables.h" 48#include "actables.h"
49#include "acdispat.h" 49#include "acdispat.h"
50#include "acevents.h" 50#include "acevents.h"
51#include "amlcode.h"
51 52
52#define _COMPONENT ACPI_EXECUTER 53#define _COMPONENT ACPI_EXECUTER
53ACPI_MODULE_NAME("exconfig") 54ACPI_MODULE_NAME("exconfig")
@@ -120,8 +121,11 @@ acpi_ex_add_table(u32 table_index,
120 acpi_ns_exec_module_code_list(); 121 acpi_ns_exec_module_code_list();
121 acpi_ex_enter_interpreter(); 122 acpi_ex_enter_interpreter();
122 123
123 /* Update GPEs for any new _Lxx/_Exx methods. Ignore errors */ 124 /*
124 125 * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
126 * responsible for discovering any new wake GPEs by running _PRW methods
127 * that may have been loaded by this table.
128 */
125 status = acpi_tb_get_owner_id(table_index, &owner_id); 129 status = acpi_tb_get_owner_id(table_index, &owner_id);
126 if (ACPI_SUCCESS(status)) { 130 if (ACPI_SUCCESS(status)) {
127 acpi_ev_update_gpes(owner_id); 131 acpi_ev_update_gpes(owner_id);
@@ -158,12 +162,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
158 162
159 ACPI_FUNCTION_TRACE(ex_load_table_op); 163 ACPI_FUNCTION_TRACE(ex_load_table_op);
160 164
161 /* Validate lengths for the signature_string, OEMIDString, OEMtable_iD */ 165 /* Validate lengths for the Signature, oem_id, and oem_table_id strings */
162 166
163 if ((operand[0]->string.length > ACPI_NAME_SIZE) || 167 if ((operand[0]->string.length > ACPI_NAME_SIZE) ||
164 (operand[1]->string.length > ACPI_OEM_ID_SIZE) || 168 (operand[1]->string.length > ACPI_OEM_ID_SIZE) ||
165 (operand[2]->string.length > ACPI_OEM_TABLE_ID_SIZE)) { 169 (operand[2]->string.length > ACPI_OEM_TABLE_ID_SIZE)) {
166 return_ACPI_STATUS(AE_BAD_PARAMETER); 170 return_ACPI_STATUS(AE_AML_STRING_LIMIT);
167 } 171 }
168 172
169 /* Find the ACPI table in the RSDT/XSDT */ 173 /* Find the ACPI table in the RSDT/XSDT */
@@ -210,8 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
210 /* parameter_path (optional parameter) */ 214 /* parameter_path (optional parameter) */
211 215
212 if (operand[4]->string.length > 0) { 216 if (operand[4]->string.length > 0) {
213 if ((operand[4]->string.pointer[0] != '\\') && 217 if ((operand[4]->string.pointer[0] != AML_ROOT_PREFIX) &&
214 (operand[4]->string.pointer[0] != '^')) { 218 (operand[4]->string.pointer[0] != AML_PARENT_PREFIX)) {
215 /* 219 /*
216 * Path is not absolute, so it will be relative to the node 220 * Path is not absolute, so it will be relative to the node
217 * referenced by the root_path_string (or the NS root if omitted) 221 * referenced by the root_path_string (or the NS root if omitted)
@@ -301,7 +305,7 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
301 acpi_ev_address_space_dispatch(obj_desc, NULL, ACPI_READ, 305 acpi_ev_address_space_dispatch(obj_desc, NULL, ACPI_READ,
302 region_offset, 8, &value); 306 region_offset, 8, &value);
303 if (ACPI_FAILURE(status)) { 307 if (ACPI_FAILURE(status)) {
304 return status; 308 return (status);
305 } 309 }
306 310
307 *buffer = (u8)value; 311 *buffer = (u8)value;
@@ -309,7 +313,7 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
309 region_offset++; 313 region_offset++;
310 } 314 }
311 315
312 return AE_OK; 316 return (AE_OK);
313} 317}
314 318
315/******************************************************************************* 319/*******************************************************************************
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index 4492a4e03022..d2b9613bbf01 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -176,7 +176,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
176 176
177 /* Save the Result */ 177 /* Save the Result */
178 178
179 acpi_ex_truncate_for32bit_table(return_desc); 179 (void)acpi_ex_truncate_for32bit_table(return_desc);
180 *result_desc = return_desc; 180 *result_desc = return_desc;
181 return_ACPI_STATUS(AE_OK); 181 return_ACPI_STATUS(AE_OK);
182} 182}
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index 66554bc6f9a8..26a13f67977e 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index d7c9f51608a7..7eb853cd279f 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 858b43a7dcf6..e5a3c249f7fa 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -464,9 +464,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
464 464
465 ACPI_FUNCTION_NAME(ex_dump_operand) 465 ACPI_FUNCTION_NAME(ex_dump_operand)
466 466
467 if (! 467 /* Check if debug output enabled */
468 ((ACPI_LV_EXEC & acpi_dbg_level) 468 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) {
469 && (_COMPONENT & acpi_dbg_layer))) {
470 return; 469 return;
471 } 470 }
472 471
@@ -811,9 +810,10 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
811 ACPI_FUNCTION_ENTRY(); 810 ACPI_FUNCTION_ENTRY();
812 811
813 if (!flags) { 812 if (!flags) {
814 if (! 813
815 ((ACPI_LV_OBJECTS & acpi_dbg_level) 814 /* Check if debug output enabled */
816 && (_COMPONENT & acpi_dbg_layer))) { 815
816 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) {
817 return; 817 return;
818 } 818 }
819 } 819 }
@@ -999,9 +999,10 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
999 } 999 }
1000 1000
1001 if (!flags) { 1001 if (!flags) {
1002 if (! 1002
1003 ((ACPI_LV_OBJECTS & acpi_dbg_level) 1003 /* Check if debug output enabled */
1004 && (_COMPONENT & acpi_dbg_layer))) { 1004
1005 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) {
1005 return_VOID; 1006 return_VOID;
1006 } 1007 }
1007 } 1008 }
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index ebc55fbf3ff7..7d4bae71e8c6 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index aa2ccfb7cb61..ec7f5690031b 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -329,7 +329,6 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
329static u8 329static u8
330acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value) 330acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value)
331{ 331{
332 ACPI_FUNCTION_NAME(ex_register_overflow);
333 332
334 if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { 333 if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) {
335 /* 334 /*
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index 84058705ed12..72a2a13b6d36 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c
index d1f449d93dcf..7be0205ad067 100644
--- a/drivers/acpi/acpica/exmutex.c
+++ b/drivers/acpi/acpica/exmutex.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -377,7 +377,8 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
377 return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); 377 return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
378 } 378 }
379 379
380 /* Must have a valid thread. */ 380 /* Must have a valid thread ID */
381
381 if (!walk_state->thread) { 382 if (!walk_state->thread) {
382 ACPI_ERROR((AE_INFO, 383 ACPI_ERROR((AE_INFO,
383 "Cannot release Mutex [%4.4s], null thread info", 384 "Cannot release Mutex [%4.4s], null thread info",
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c
index 2ff578a16adc..14689dec4960 100644
--- a/drivers/acpi/acpica/exnames.c
+++ b/drivers/acpi/acpica/exnames.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index bbf01e9bf057..b60c877f5906 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -948,13 +948,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
948 */ 948 */
949 return_desc = 949 return_desc =
950 acpi_ut_create_integer_object((u64) 950 acpi_ut_create_integer_object((u64)
951 temp_desc-> 951 temp_desc->buffer.pointer[operand[0]->reference.value]);
952 buffer.
953 pointer
954 [operand
955 [0]->
956 reference.
957 value]);
958 if (!return_desc) { 952 if (!return_desc) {
959 status = AE_NO_MEMORY; 953 status = AE_NO_MEMORY;
960 goto cleanup; 954 goto cleanup;
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c
index ee5634a074c4..e491e46f17df 100644
--- a/drivers/acpi/acpica/exoparg2.c
+++ b/drivers/acpi/acpica/exoparg2.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c
index 2c89b4651f08..2d7491f3126e 100644
--- a/drivers/acpi/acpica/exoparg3.c
+++ b/drivers/acpi/acpica/exoparg3.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index 3e08695c3b30..b76b97002dff 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index ba9db4de7c89..d6eab81f54fb 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
276 /* Invalid field access type */ 276 /* Invalid field access type */
277 277
278 ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); 278 ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access));
279 return_UINT32(0); 279 return_VALUE(0);
280 } 280 }
281 281
282 if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) { 282 if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
289 } 289 }
290 290
291 *return_byte_alignment = byte_alignment; 291 *return_byte_alignment = byte_alignment;
292 return_UINT32(bit_length); 292 return_VALUE(bit_length);
293} 293}
294 294
295/******************************************************************************* 295/*******************************************************************************
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index 1db2c0bfde0b..182abaf045e1 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -142,9 +142,9 @@ acpi_ex_system_memory_space_handler(u32 function,
142 } 142 }
143 143
144 /* 144 /*
145 * Attempt to map from the requested address to the end of the region. 145 * October 2009: Attempt to map from the requested address to the
146 * However, we will never map more than one page, nor will we cross 146 * end of the region. However, we will never map more than one
147 * a page boundary. 147 * page, nor will we cross a page boundary.
148 */ 148 */
149 map_length = (acpi_size) 149 map_length = (acpi_size)
150 ((mem_info->address + mem_info->length) - address); 150 ((mem_info->address + mem_info->length) - address);
@@ -154,12 +154,15 @@ acpi_ex_system_memory_space_handler(u32 function,
154 * a page boundary, just map up to the page boundary, do not cross. 154 * a page boundary, just map up to the page boundary, do not cross.
155 * On some systems, crossing a page boundary while mapping regions 155 * On some systems, crossing a page boundary while mapping regions
156 * can cause warnings if the pages have different attributes 156 * can cause warnings if the pages have different attributes
157 * due to resource management 157 * due to resource management.
158 *
159 * This has the added benefit of constraining a single mapping to
160 * one page, which is similar to the original code that used a 4k
161 * maximum window.
158 */ 162 */
159 page_boundary_map_length = 163 page_boundary_map_length =
160 ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address; 164 ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address;
161 165 if (page_boundary_map_length == 0) {
162 if (!page_boundary_map_length) {
163 page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE; 166 page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE;
164 } 167 }
165 168
@@ -236,19 +239,19 @@ acpi_ex_system_memory_space_handler(u32 function,
236 239
237 switch (bit_width) { 240 switch (bit_width) {
238 case 8: 241 case 8:
239 ACPI_SET8(logical_addr_ptr) = (u8) * value; 242 ACPI_SET8(logical_addr_ptr, *value);
240 break; 243 break;
241 244
242 case 16: 245 case 16:
243 ACPI_SET16(logical_addr_ptr) = (u16) * value; 246 ACPI_SET16(logical_addr_ptr, *value);
244 break; 247 break;
245 248
246 case 32: 249 case 32:
247 ACPI_SET32(logical_addr_ptr) = (u32) * value; 250 ACPI_SET32(logical_addr_ptr, *value);
248 break; 251 break;
249 252
250 case 64: 253 case 64:
251 ACPI_SET64(logical_addr_ptr) = (u64) * value; 254 ACPI_SET64(logical_addr_ptr, *value);
252 break; 255 break;
253 256
254 default: 257 default:
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c
index 6239956786eb..8565b6bd12bb 100644
--- a/drivers/acpi/acpica/exresnte.c
+++ b/drivers/acpi/acpica/exresnte.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index cc176b245e22..e4f9dfbb2a13 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index b9ebff2f6a09..9fb9f5e9a4da 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index 90431f12f831..93c6049c2d75 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -487,14 +487,33 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
487 default: 487 default:
488 488
489 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 489 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
490 "Storing %s (%p) directly into node (%p) with no implicit conversion\n", 490 "Storing [%s] (%p) directly into node [%s] (%p)"
491 " with no implicit conversion\n",
491 acpi_ut_get_object_type_name(source_desc), 492 acpi_ut_get_object_type_name(source_desc),
492 source_desc, node)); 493 source_desc,
494 acpi_ut_get_object_type_name(target_desc),
495 node));
493 496
494 /* No conversions for all other types. Just attach the source object */ 497 /*
498 * No conversions for all other types. Directly store a copy of
499 * the source object. NOTE: This is a departure from the ACPI
500 * spec, which states "If conversion is impossible, abort the
501 * running control method".
502 *
503 * This code implements "If conversion is impossible, treat the
504 * Store operation as a CopyObject".
505 */
506 status =
507 acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
508 walk_state);
509 if (ACPI_FAILURE(status)) {
510 return_ACPI_STATUS(status);
511 }
495 512
496 status = acpi_ns_attach_object(node, source_desc, 513 status =
497 source_desc->common.type); 514 acpi_ns_attach_object(node, new_desc,
515 new_desc->common.type);
516 acpi_ut_remove_reference(new_desc);
498 break; 517 break;
499 } 518 }
500 519
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c
index 87153bbc4b43..1cefe777068e 100644
--- a/drivers/acpi/acpica/exstoren.c
+++ b/drivers/acpi/acpica/exstoren.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -253,7 +253,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
253 253
254 /* Truncate value if we are executing from a 32-bit ACPI table */ 254 /* Truncate value if we are executing from a 32-bit ACPI table */
255 255
256 acpi_ex_truncate_for32bit_table(dest_desc); 256 (void)acpi_ex_truncate_for32bit_table(dest_desc);
257 break; 257 break;
258 258
259 case ACPI_TYPE_STRING: 259 case ACPI_TYPE_STRING:
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c
index b5f339cb1305..26e371073b1a 100644
--- a/drivers/acpi/acpica/exstorob.c
+++ b/drivers/acpi/acpica/exstorob.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c
index c8a0ad5c1f55..6578dee2e51b 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 264d22d8018c..b205cbb4b50c 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -202,35 +202,39 @@ void acpi_ex_relinquish_interpreter(void)
202 * 202 *
203 * PARAMETERS: obj_desc - Object to be truncated 203 * PARAMETERS: obj_desc - Object to be truncated
204 * 204 *
205 * RETURN: none 205 * RETURN: TRUE if a truncation was performed, FALSE otherwise.
206 * 206 *
207 * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is 207 * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
208 * 32-bit, as determined by the revision of the DSDT. 208 * 32-bit, as determined by the revision of the DSDT.
209 * 209 *
210 ******************************************************************************/ 210 ******************************************************************************/
211 211
212void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) 212u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
213{ 213{
214 214
215 ACPI_FUNCTION_ENTRY(); 215 ACPI_FUNCTION_ENTRY();
216 216
217 /* 217 /*
218 * Object must be a valid number and we must be executing 218 * Object must be a valid number and we must be executing
219 * a control method. NS node could be there for AML_INT_NAMEPATH_OP. 219 * a control method. Object could be NS node for AML_INT_NAMEPATH_OP.
220 */ 220 */
221 if ((!obj_desc) || 221 if ((!obj_desc) ||
222 (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || 222 (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) ||
223 (obj_desc->common.type != ACPI_TYPE_INTEGER)) { 223 (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
224 return; 224 return (FALSE);
225 } 225 }
226 226
227 if (acpi_gbl_integer_byte_width == 4) { 227 if ((acpi_gbl_integer_byte_width == 4) &&
228 (obj_desc->integer.value > (u64)ACPI_UINT32_MAX)) {
228 /* 229 /*
229 * We are running a method that exists in a 32-bit ACPI table. 230 * We are executing in a 32-bit ACPI table.
230 * Truncate the value to 32 bits by zeroing out the upper 32-bit field 231 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
231 */ 232 */
232 obj_desc->integer.value &= (u64) ACPI_UINT32_MAX; 233 obj_desc->integer.value &= (u64)ACPI_UINT32_MAX;
234 return (TRUE);
233 } 235 }
236
237 return (FALSE);
234} 238}
235 239
236/******************************************************************************* 240/*******************************************************************************
@@ -336,7 +340,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
336 /* u64 is unsigned, so we don't worry about a '-' prefix */ 340 /* u64 is unsigned, so we don't worry about a '-' prefix */
337 341
338 if (value == 0) { 342 if (value == 0) {
339 return_UINT32(1); 343 return_VALUE(1);
340 } 344 }
341 345
342 current_value = value; 346 current_value = value;
@@ -350,7 +354,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
350 num_digits++; 354 num_digits++;
351 } 355 }
352 356
353 return_UINT32(num_digits); 357 return_VALUE(num_digits);
354} 358}
355 359
356/******************************************************************************* 360/*******************************************************************************
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index 90a9aea1cee9..deb3f61e2bd1 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -108,8 +108,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
108 * enable bits to default 108 * enable bits to default
109 */ 109 */
110 status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, 110 status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
111 (u32) acpi_gbl_FADT.acpi_disable, 111 (u32)acpi_gbl_FADT.acpi_disable, 8);
112 8);
113 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 112 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
114 "Attempting to enable Legacy (non-ACPI) mode\n")); 113 "Attempting to enable Legacy (non-ACPI) mode\n"));
115 break; 114 break;
@@ -152,18 +151,18 @@ u32 acpi_hw_get_mode(void)
152 * system does not support mode transition. 151 * system does not support mode transition.
153 */ 152 */
154 if (!acpi_gbl_FADT.smi_command) { 153 if (!acpi_gbl_FADT.smi_command) {
155 return_UINT32(ACPI_SYS_MODE_ACPI); 154 return_VALUE(ACPI_SYS_MODE_ACPI);
156 } 155 }
157 156
158 status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value); 157 status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value);
159 if (ACPI_FAILURE(status)) { 158 if (ACPI_FAILURE(status)) {
160 return_UINT32(ACPI_SYS_MODE_LEGACY); 159 return_VALUE(ACPI_SYS_MODE_LEGACY);
161 } 160 }
162 161
163 if (value) { 162 if (value) {
164 return_UINT32(ACPI_SYS_MODE_ACPI); 163 return_VALUE(ACPI_SYS_MODE_ACPI);
165 } else { 164 } else {
166 return_UINT32(ACPI_SYS_MODE_LEGACY); 165 return_VALUE(ACPI_SYS_MODE_LEGACY);
167 } 166 }
168} 167}
169 168
diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 94996f9ae3ad..5e5f76230f5e 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -200,7 +200,6 @@ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state)
200 * FUNCTION: acpi_hw_extended_wake 200 * FUNCTION: acpi_hw_extended_wake
201 * 201 *
202 * PARAMETERS: sleep_state - Which sleep state we just exited 202 * PARAMETERS: sleep_state - Which sleep state we just exited
203 * flags - Reserved, set to zero
204 * 203 *
205 * RETURN: Status 204 * RETURN: Status
206 * 205 *
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index 64560045052d..20d02e93c990 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -69,8 +69,10 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
69 69
70u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info) 70u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info)
71{ 71{
72 return (u32)1 << (gpe_event_info->gpe_number - 72
73 gpe_event_info->register_info->base_gpe_number); 73 return ((u32)1 <<
74 (gpe_event_info->gpe_number -
75 gpe_event_info->register_info->base_gpe_number));
74} 76}
75 77
76/****************************************************************************** 78/******************************************************************************
@@ -133,7 +135,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
133 break; 135 break;
134 136
135 default: 137 default:
136 ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u\n", action)); 138 ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u", action));
137 return (AE_BAD_PARAMETER); 139 return (AE_BAD_PARAMETER);
138 } 140 }
139 141
diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c
index 65bc3453a29c..0889a629505f 100644
--- a/drivers/acpi/acpica/hwpci.c
+++ b/drivers/acpi/acpica/hwpci.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index f4e57503576b..083d6551f0e2 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,6 @@
44 44
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include "accommon.h" 46#include "accommon.h"
47#include "acnamesp.h"
48#include "acevents.h" 47#include "acevents.h"
49 48
50#define _COMPONENT ACPI_HARDWARE 49#define _COMPONENT ACPI_HARDWARE
@@ -364,8 +363,7 @@ acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control)
364 * DESCRIPTION: Read from the specified ACPI register 363 * DESCRIPTION: Read from the specified ACPI register
365 * 364 *
366 ******************************************************************************/ 365 ******************************************************************************/
367acpi_status 366acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)
368acpi_hw_register_read(u32 register_id, u32 * return_value)
369{ 367{
370 u32 value = 0; 368 u32 value = 0;
371 acpi_status status; 369 acpi_status status;
@@ -485,7 +483,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
485 &acpi_gbl_xpm1b_status); 483 &acpi_gbl_xpm1b_status);
486 break; 484 break;
487 485
488 case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access */ 486 case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */
489 487
490 status = acpi_hw_write_multiple(value, 488 status = acpi_hw_write_multiple(value,
491 &acpi_gbl_xpm1a_enable, 489 &acpi_gbl_xpm1a_enable,
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 3fddde056a5e..e3828cc4361b 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,6 @@
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include <linux/acpi.h> 46#include <linux/acpi.h>
47#include "accommon.h" 47#include "accommon.h"
48#include <linux/module.h>
49 48
50#define _COMPONENT ACPI_HARDWARE 49#define _COMPONENT ACPI_HARDWARE
51ACPI_MODULE_NAME("hwsleep") 50ACPI_MODULE_NAME("hwsleep")
@@ -178,7 +177,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
178 * to still read the right value. Ideally, this block would go 177 * to still read the right value. Ideally, this block would go
179 * away entirely. 178 * away entirely.
180 */ 179 */
181 acpi_os_stall(10000000); 180 acpi_os_stall(10 * ACPI_USEC_PER_SEC);
182 181
183 status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL, 182 status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
184 sleep_enable_reg_info-> 183 sleep_enable_reg_info->
@@ -323,7 +322,8 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
323 * and use it to determine whether the system is rebooting or 322 * and use it to determine whether the system is rebooting or
324 * resuming. Clear WAK_STS for compatibility. 323 * resuming. Clear WAK_STS for compatibility.
325 */ 324 */
326 acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, 1); 325 (void)acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS,
326 ACPI_CLEAR_STATUS);
327 acpi_gbl_system_awake_and_running = TRUE; 327 acpi_gbl_system_awake_and_running = TRUE;
328 328
329 /* Enable power button */ 329 /* Enable power button */
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index bfdce22f3798..0c1a8bbd05d6 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -176,10 +176,11 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
176 /* 176 /*
177 * Compute Duration (Requires a 64-bit multiply and divide): 177 * Compute Duration (Requires a 64-bit multiply and divide):
178 * 178 *
179 * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY; 179 * time_elapsed (microseconds) =
180 * (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
180 */ 181 */
181 status = acpi_ut_short_divide(((u64) delta_ticks) * 1000000, 182 status = acpi_ut_short_divide(((u64)delta_ticks) * ACPI_USEC_PER_SEC,
182 PM_TIMER_FREQUENCY, &quotient, NULL); 183 ACPI_PM_TIMER_FREQUENCY, &quotient, NULL);
183 184
184 *time_elapsed = (u32) quotient; 185 *time_elapsed = (u32) quotient;
185 return_ACPI_STATUS(status); 186 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index b6aae58299dc..eab70d58852a 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -135,7 +135,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
135 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) { 135 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) {
136 ACPI_ERROR((AE_INFO, 136 ACPI_ERROR((AE_INFO,
137 "Bad BitWidth parameter: %8.8X", bit_width)); 137 "Bad BitWidth parameter: %8.8X", bit_width));
138 return AE_BAD_PARAMETER; 138 return (AE_BAD_PARAMETER);
139 } 139 }
140 140
141 port_info = acpi_protected_ports; 141 port_info = acpi_protected_ports;
@@ -234,11 +234,11 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
234 status = acpi_hw_validate_io_request(address, width); 234 status = acpi_hw_validate_io_request(address, width);
235 if (ACPI_SUCCESS(status)) { 235 if (ACPI_SUCCESS(status)) {
236 status = acpi_os_read_port(address, value, width); 236 status = acpi_os_read_port(address, value, width);
237 return status; 237 return (status);
238 } 238 }
239 239
240 if (status != AE_AML_ILLEGAL_ADDRESS) { 240 if (status != AE_AML_ILLEGAL_ADDRESS) {
241 return status; 241 return (status);
242 } 242 }
243 243
244 /* 244 /*
@@ -253,7 +253,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
253 if (acpi_hw_validate_io_request(address, 8) == AE_OK) { 253 if (acpi_hw_validate_io_request(address, 8) == AE_OK) {
254 status = acpi_os_read_port(address, &one_byte, 8); 254 status = acpi_os_read_port(address, &one_byte, 8);
255 if (ACPI_FAILURE(status)) { 255 if (ACPI_FAILURE(status)) {
256 return status; 256 return (status);
257 } 257 }
258 258
259 *value |= (one_byte << i); 259 *value |= (one_byte << i);
@@ -262,7 +262,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
262 address++; 262 address++;
263 } 263 }
264 264
265 return AE_OK; 265 return (AE_OK);
266} 266}
267 267
268/****************************************************************************** 268/******************************************************************************
@@ -297,11 +297,11 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width)
297 status = acpi_hw_validate_io_request(address, width); 297 status = acpi_hw_validate_io_request(address, width);
298 if (ACPI_SUCCESS(status)) { 298 if (ACPI_SUCCESS(status)) {
299 status = acpi_os_write_port(address, value, width); 299 status = acpi_os_write_port(address, value, width);
300 return status; 300 return (status);
301 } 301 }
302 302
303 if (status != AE_AML_ILLEGAL_ADDRESS) { 303 if (status != AE_AML_ILLEGAL_ADDRESS) {
304 return status; 304 return (status);
305 } 305 }
306 306
307 /* 307 /*
@@ -317,12 +317,12 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width)
317 status = 317 status =
318 acpi_os_write_port(address, (value >> i) & 0xFF, 8); 318 acpi_os_write_port(address, (value >> i) & 0xFF, 8);
319 if (ACPI_FAILURE(status)) { 319 if (ACPI_FAILURE(status)) {
320 return status; 320 return (status);
321 } 321 }
322 } 322 }
323 323
324 address++; 324 address++;
325 } 325 }
326 326
327 return AE_OK; 327 return (AE_OK);
328} 328}
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 05a154c3c9ac..04c2e16f2c0a 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -80,10 +80,10 @@ acpi_status acpi_reset(void)
80 80
81 if (reset_reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { 81 if (reset_reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
82 /* 82 /*
83 * For I/O space, write directly to the OSL. This 83 * For I/O space, write directly to the OSL. This bypasses the port
84 * bypasses the port validation mechanism, which may 84 * validation mechanism, which may block a valid write to the reset
85 * block a valid write to the reset register. Spec 85 * register.
86 * section 4.7.3.6 requires register width to be 8. 86 * Spec section 4.7.3.6 requires register width to be 8.
87 */ 87 */
88 status = 88 status =
89 acpi_os_write_port((acpi_io_address) reset_reg->address, 89 acpi_os_write_port((acpi_io_address) reset_reg->address,
@@ -333,7 +333,7 @@ ACPI_EXPORT_SYMBOL(acpi_read_bit_register)
333 * FUNCTION: acpi_write_bit_register 333 * FUNCTION: acpi_write_bit_register
334 * 334 *
335 * PARAMETERS: register_id - ID of ACPI Bit Register to access 335 * PARAMETERS: register_id - ID of ACPI Bit Register to access
336 * Value - Value to write to the register, in bit 336 * value - Value to write to the register, in bit
337 * position zero. The bit is automatically 337 * position zero. The bit is automatically
338 * shifted to the correct position. 338 * shifted to the correct position.
339 * 339 *
@@ -440,17 +440,41 @@ ACPI_EXPORT_SYMBOL(acpi_write_bit_register)
440 * *sleep_type_a - Where SLP_TYPa is returned 440 * *sleep_type_a - Where SLP_TYPa is returned
441 * *sleep_type_b - Where SLP_TYPb is returned 441 * *sleep_type_b - Where SLP_TYPb is returned
442 * 442 *
443 * RETURN: status - ACPI status 443 * RETURN: Status
444 *
445 * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested
446 * sleep state via the appropriate \_Sx object.
447 *
448 * The sleep state package returned from the corresponding \_Sx_ object
449 * must contain at least one integer.
450 *
451 * March 2005:
452 * Added support for a package that contains two integers. This
453 * goes against the ACPI specification which defines this object as a
454 * package with one encoded DWORD integer. However, existing practice
455 * by many BIOS vendors is to return a package with 2 or more integer
456 * elements, at least one per sleep type (A/B).
444 * 457 *
445 * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep 458 * January 2013:
446 * state. 459 * Therefore, we must be prepared to accept a package with either a
460 * single integer or multiple integers.
461 *
462 * The single integer DWORD format is as follows:
463 * BYTE 0 - Value for the PM1A SLP_TYP register
464 * BYTE 1 - Value for the PM1B SLP_TYP register
465 * BYTE 2-3 - Reserved
466 *
467 * The dual integer format is as follows:
468 * Integer 0 - Value for the PM1A SLP_TYP register
469 * Integer 1 - Value for the PM1A SLP_TYP register
447 * 470 *
448 ******************************************************************************/ 471 ******************************************************************************/
449acpi_status 472acpi_status
450acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) 473acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
451{ 474{
452 acpi_status status = AE_OK; 475 acpi_status status;
453 struct acpi_evaluate_info *info; 476 struct acpi_evaluate_info *info;
477 union acpi_operand_object **elements;
454 478
455 ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); 479 ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data);
456 480
@@ -467,18 +491,14 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
467 return_ACPI_STATUS(AE_NO_MEMORY); 491 return_ACPI_STATUS(AE_NO_MEMORY);
468 } 492 }
469 493
494 /*
495 * Evaluate the \_Sx namespace object containing the register values
496 * for this state
497 */
470 info->pathname = 498 info->pathname =
471 ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); 499 ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
472
473 /* Evaluate the namespace object containing the values for this state */
474
475 status = acpi_ns_evaluate(info); 500 status = acpi_ns_evaluate(info);
476 if (ACPI_FAILURE(status)) { 501 if (ACPI_FAILURE(status)) {
477 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
478 "%s while evaluating SleepState [%s]\n",
479 acpi_format_exception(status),
480 info->pathname));
481
482 goto cleanup; 502 goto cleanup;
483 } 503 }
484 504
@@ -487,64 +507,67 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
487 if (!info->return_object) { 507 if (!info->return_object) {
488 ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", 508 ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
489 info->pathname)); 509 info->pathname));
490 status = AE_NOT_EXIST; 510 status = AE_AML_NO_RETURN_VALUE;
511 goto cleanup;
491 } 512 }
492 513
493 /* It must be of type Package */ 514 /* Return object must be of type Package */
494 515
495 else if (info->return_object->common.type != ACPI_TYPE_PACKAGE) { 516 if (info->return_object->common.type != ACPI_TYPE_PACKAGE) {
496 ACPI_ERROR((AE_INFO, 517 ACPI_ERROR((AE_INFO,
497 "Sleep State return object is not a Package")); 518 "Sleep State return object is not a Package"));
498 status = AE_AML_OPERAND_TYPE; 519 status = AE_AML_OPERAND_TYPE;
520 goto cleanup1;
499 } 521 }
500 522
501 /* 523 /*
502 * The package must have at least two elements. NOTE (March 2005): This 524 * Any warnings about the package length or the object types have
503 * goes against the current ACPI spec which defines this object as a 525 * already been issued by the predefined name module -- there is no
504 * package with one encoded DWORD element. However, existing practice 526 * need to repeat them here.
505 * by BIOS vendors seems to be to have 2 or more elements, at least
506 * one per sleep type (A/B).
507 */ 527 */
508 else if (info->return_object->package.count < 2) { 528 elements = info->return_object->package.elements;
509 ACPI_ERROR((AE_INFO, 529 switch (info->return_object->package.count) {
510 "Sleep State return package does not have at least two elements")); 530 case 0:
511 status = AE_AML_NO_OPERAND; 531 status = AE_AML_PACKAGE_LIMIT;
512 } 532 break;
533
534 case 1:
535 if (elements[0]->common.type != ACPI_TYPE_INTEGER) {
536 status = AE_AML_OPERAND_TYPE;
537 break;
538 }
513 539
514 /* The first two elements must both be of type Integer */ 540 /* A valid _Sx_ package with one integer */
515 541
516 else if (((info->return_object->package.elements[0])->common.type 542 *sleep_type_a = (u8)elements[0]->integer.value;
517 != ACPI_TYPE_INTEGER) || 543 *sleep_type_b = (u8)(elements[0]->integer.value >> 8);
518 ((info->return_object->package.elements[1])->common.type 544 break;
519 != ACPI_TYPE_INTEGER)) {
520 ACPI_ERROR((AE_INFO,
521 "Sleep State return package elements are not both Integers "
522 "(%s, %s)",
523 acpi_ut_get_object_type_name(info->return_object->
524 package.elements[0]),
525 acpi_ut_get_object_type_name(info->return_object->
526 package.elements[1])));
527 status = AE_AML_OPERAND_TYPE;
528 } else {
529 /* Valid _Sx_ package size, type, and value */
530 545
531 *sleep_type_a = (u8) 546 case 2:
532 (info->return_object->package.elements[0])->integer.value; 547 default:
533 *sleep_type_b = (u8) 548 if ((elements[0]->common.type != ACPI_TYPE_INTEGER) ||
534 (info->return_object->package.elements[1])->integer.value; 549 (elements[1]->common.type != ACPI_TYPE_INTEGER)) {
535 } 550 status = AE_AML_OPERAND_TYPE;
551 break;
552 }
536 553
537 if (ACPI_FAILURE(status)) { 554 /* A valid _Sx_ package with two integers */
538 ACPI_EXCEPTION((AE_INFO, status, 555
539 "While evaluating SleepState [%s], bad Sleep object %p type %s", 556 *sleep_type_a = (u8)elements[0]->integer.value;
540 info->pathname, info->return_object, 557 *sleep_type_b = (u8)elements[1]->integer.value;
541 acpi_ut_get_object_type_name(info-> 558 break;
542 return_object)));
543 } 559 }
544 560
561 cleanup1:
545 acpi_ut_remove_reference(info->return_object); 562 acpi_ut_remove_reference(info->return_object);
546 563
547 cleanup: 564 cleanup:
565 if (ACPI_FAILURE(status)) {
566 ACPI_EXCEPTION((AE_INFO, status,
567 "While evaluating Sleep State [%s]",
568 info->pathname));
569 }
570
548 ACPI_FREE(info); 571 ACPI_FREE(info);
549 return_ACPI_STATUS(status); 572 return_ACPI_STATUS(status);
550} 573}
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index ae443fe2ebf6..35eebdac0f9d 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,9 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/export.h>
44#include <acpi/acpi.h> 45#include <acpi/acpi.h>
45#include "accommon.h" 46#include "accommon.h"
46#include <linux/module.h>
47 47
48#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
49ACPI_MODULE_NAME("hwxfsleep") 49ACPI_MODULE_NAME("hwxfsleep")
@@ -207,7 +207,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
207 (u32)acpi_gbl_FADT.s4_bios_request, 8); 207 (u32)acpi_gbl_FADT.s4_bios_request, 8);
208 208
209 do { 209 do {
210 acpi_os_stall(1000); 210 acpi_os_stall(ACPI_USEC_PER_MSEC);
211 status = 211 status =
212 acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value); 212 acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value);
213 if (ACPI_FAILURE(status)) { 213 if (ACPI_FAILURE(status)) {
@@ -350,7 +350,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
350 * 350 *
351 * RETURN: Status 351 * RETURN: Status
352 * 352 *
353 * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231) 353 * DESCRIPTION: Enter a system sleep state
354 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 354 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
355 * 355 *
356 ******************************************************************************/ 356 ******************************************************************************/
@@ -382,8 +382,9 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
382 * RETURN: Status 382 * RETURN: Status
383 * 383 *
384 * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a 384 * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
385 * sleep. 385 * sleep. Called with interrupts DISABLED.
386 * Called with interrupts DISABLED. 386 * We break wake/resume into 2 stages so that OSPM can handle
387 * various OS-specific tasks between the two steps.
387 * 388 *
388 ******************************************************************************/ 389 ******************************************************************************/
389acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) 390acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index d70eaf39dfdf..8769cf83b044 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index 15143c44f5e5..243737363fb8 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 924b3c71473a..ce6e97326205 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h" 45#include "accommon.h"
46#include "acnamesp.h" 46#include "acnamesp.h"
47#include <acpi/acoutput.h>
47 48
48#define _COMPONENT ACPI_NAMESPACE 49#define _COMPONENT ACPI_NAMESPACE
49ACPI_MODULE_NAME("nsdump") 50ACPI_MODULE_NAME("nsdump")
@@ -77,8 +78,9 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
77 78
78 ACPI_FUNCTION_NAME(ns_print_pathname); 79 ACPI_FUNCTION_NAME(ns_print_pathname);
79 80
80 if (!(acpi_dbg_level & ACPI_LV_NAMES) 81 /* Check if debug output enabled */
81 || !(acpi_dbg_layer & ACPI_NAMESPACE)) { 82
83 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_NAMES, ACPI_NAMESPACE)) {
82 return; 84 return;
83 } 85 }
84 86
@@ -127,7 +129,7 @@ acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
127 129
128 /* Do this only if the requested debug level and component are enabled */ 130 /* Do this only if the requested debug level and component are enabled */
129 131
130 if (!(acpi_dbg_level & level) || !(acpi_dbg_layer & component)) { 132 if (!ACPI_IS_DEBUG_ENABLED(level, component)) {
131 return_VOID; 133 return_VOID;
132 } 134 }
133 135
@@ -729,5 +731,5 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
729 ACPI_OWNER_ID_MAX, search_handle); 731 ACPI_OWNER_ID_MAX, search_handle);
730 return_VOID; 732 return_VOID;
731} 733}
732#endif /* _ACPI_ASL_COMPILER */ 734#endif
733#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */ 735#endif
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c
index 944d4c8d9438..409ae80824d1 100644
--- a/drivers/acpi/acpica/nsdumpdv.c
+++ b/drivers/acpi/acpica/nsdumpdv.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,6 @@
42 */ 42 */
43 43
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h"
46 45
47/* TBD: This entire module is apparently obsolete and should be removed */ 46/* TBD: This entire module is apparently obsolete and should be removed */
48 47
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index 69074be498e8..1538f3eb2a8f 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 4328e2adfeb9..2a431ec50a25 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,6 @@
46#include "acnamesp.h" 46#include "acnamesp.h"
47#include "acdispat.h" 47#include "acdispat.h"
48#include "acinterp.h" 48#include "acinterp.h"
49#include <linux/nmi.h>
50 49
51#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
52ACPI_MODULE_NAME("nsinit") 51ACPI_MODULE_NAME("nsinit")
@@ -87,7 +86,7 @@ acpi_status acpi_ns_initialize_objects(void)
87 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 86 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
88 "**** Starting initialization of namespace objects ****\n")); 87 "**** Starting initialization of namespace objects ****\n"));
89 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, 88 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
90 "Completing Region/Field/Buffer/Package initialization:")); 89 "Completing Region/Field/Buffer/Package initialization:\n"));
91 90
92 /* Set all init info to zero */ 91 /* Set all init info to zero */
93 92
@@ -103,7 +102,7 @@ acpi_status acpi_ns_initialize_objects(void)
103 } 102 }
104 103
105 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, 104 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
106 "\nInitialized %u/%u Regions %u/%u Fields %u/%u " 105 " Initialized %u/%u Regions %u/%u Fields %u/%u "
107 "Buffers %u/%u Packages (%u nodes)\n", 106 "Buffers %u/%u Packages (%u nodes)\n",
108 info.op_region_init, info.op_region_count, 107 info.op_region_init, info.op_region_count,
109 info.field_init, info.field_count, 108 info.field_init, info.field_count,
@@ -150,7 +149,7 @@ acpi_status acpi_ns_initialize_devices(void)
150 149
151 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, 150 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
152 "Initializing Device/Processor/Thermal objects " 151 "Initializing Device/Processor/Thermal objects "
153 "by executing _INI methods:")); 152 "and executing _INI/_STA methods:\n"));
154 153
155 /* Tree analysis: find all subtrees that contain _INI methods */ 154 /* Tree analysis: find all subtrees that contain _INI methods */
156 155
@@ -208,7 +207,7 @@ acpi_status acpi_ns_initialize_devices(void)
208 } 207 }
209 208
210 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, 209 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
211 "\nExecuted %u _INI methods requiring %u _STA executions " 210 " Executed %u _INI methods requiring %u _STA executions "
212 "(examined %u objects)\n", 211 "(examined %u objects)\n",
213 info.num_INI, info.num_STA, info.device_count)); 212 info.num_INI, info.num_STA, info.device_count));
214 213
@@ -350,14 +349,6 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
350 } 349 }
351 350
352 /* 351 /*
353 * Print a dot for each object unless we are going to print the entire
354 * pathname
355 */
356 if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
357 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
358 }
359
360 /*
361 * We ignore errors from above, and always return OK, since we don't want 352 * We ignore errors from above, and always return OK, since we don't want
362 * to abort the walk on any single error. 353 * to abort the walk on any single error.
363 */ 354 */
@@ -572,20 +563,10 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
572 info->parameters = NULL; 563 info->parameters = NULL;
573 info->flags = ACPI_IGNORE_RETURN_VALUE; 564 info->flags = ACPI_IGNORE_RETURN_VALUE;
574 565
575 /*
576 * Some hardware relies on this being executed as atomically
577 * as possible (without an NMI being received in the middle of
578 * this) - so disable NMIs and initialize the device:
579 */
580 status = acpi_ns_evaluate(info); 566 status = acpi_ns_evaluate(info);
581 567
582 if (ACPI_SUCCESS(status)) { 568 if (ACPI_SUCCESS(status)) {
583 walk_info->num_INI++; 569 walk_info->num_INI++;
584
585 if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
586 (!(acpi_dbg_level & ACPI_LV_INFO))) {
587 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
588 }
589 } 570 }
590#ifdef ACPI_DEBUG_OUTPUT 571#ifdef ACPI_DEBUG_OUTPUT
591 else if (status != AE_NOT_FOUND) { 572 else if (status != AE_NOT_FOUND) {
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index 911f99127b99..0a7badc3179f 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index 55a175eadcc3..90a0380fb8a0 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -126,7 +126,8 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
126 * the node, In external format (name segments separated by path 126 * the node, In external format (name segments separated by path
127 * separators.) 127 * separators.)
128 * 128 *
129 * DESCRIPTION: Used for debug printing in acpi_ns_search_table(). 129 * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually
130 * for error and debug statements.
130 * 131 *
131 ******************************************************************************/ 132 ******************************************************************************/
132 133
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index e69f7fa2579d..7a736f4d1fd8 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c
index 233f756d5cfa..35dde8151c0d 100644
--- a/drivers/acpi/acpica/nsparse.c
+++ b/drivers/acpi/acpica/nsparse.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 2419f417ea33..224c30053401 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -1,12 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Module Name: nspredef - Validation of ACPI predefined methods and objects 3 * Module Name: nspredef - Validation of ACPI predefined methods and objects
4 * $Revision: 1.1 $
5 * 4 *
6 *****************************************************************************/ 5 *****************************************************************************/
7 6
8/* 7/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 9 * All rights reserved.
11 * 10 *
12 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -74,27 +73,6 @@ ACPI_MODULE_NAME("nspredef")
74 ******************************************************************************/ 73 ******************************************************************************/
75/* Local prototypes */ 74/* Local prototypes */
76static acpi_status 75static acpi_status
77acpi_ns_check_package(struct acpi_predefined_data *data,
78 union acpi_operand_object **return_object_ptr);
79
80static acpi_status
81acpi_ns_check_package_list(struct acpi_predefined_data *data,
82 const union acpi_predefined_info *package,
83 union acpi_operand_object **elements, u32 count);
84
85static acpi_status
86acpi_ns_check_package_elements(struct acpi_predefined_data *data,
87 union acpi_operand_object **elements,
88 u8 type1,
89 u32 count1,
90 u8 type2, u32 count2, u32 start_index);
91
92static acpi_status
93acpi_ns_check_object_type(struct acpi_predefined_data *data,
94 union acpi_operand_object **return_object_ptr,
95 u32 expected_btypes, u32 package_index);
96
97static acpi_status
98acpi_ns_check_reference(struct acpi_predefined_data *data, 76acpi_ns_check_reference(struct acpi_predefined_data *data,
99 union acpi_operand_object *return_object); 77 union acpi_operand_object *return_object);
100 78
@@ -148,7 +126,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
148 126
149 pathname = acpi_ns_get_external_pathname(node); 127 pathname = acpi_ns_get_external_pathname(node);
150 if (!pathname) { 128 if (!pathname) {
151 return AE_OK; /* Could not get pathname, ignore */ 129 return (AE_OK); /* Could not get pathname, ignore */
152 } 130 }
153 131
154 /* 132 /*
@@ -408,564 +386,6 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
408 386
409/******************************************************************************* 387/*******************************************************************************
410 * 388 *
411 * FUNCTION: acpi_ns_check_package
412 *
413 * PARAMETERS: data - Pointer to validation data structure
414 * return_object_ptr - Pointer to the object returned from the
415 * evaluation of a method or object
416 *
417 * RETURN: Status
418 *
419 * DESCRIPTION: Check a returned package object for the correct count and
420 * correct type of all sub-objects.
421 *
422 ******************************************************************************/
423
424static acpi_status
425acpi_ns_check_package(struct acpi_predefined_data *data,
426 union acpi_operand_object **return_object_ptr)
427{
428 union acpi_operand_object *return_object = *return_object_ptr;
429 const union acpi_predefined_info *package;
430 union acpi_operand_object **elements;
431 acpi_status status = AE_OK;
432 u32 expected_count;
433 u32 count;
434 u32 i;
435
436 ACPI_FUNCTION_NAME(ns_check_package);
437
438 /* The package info for this name is in the next table entry */
439
440 package = data->predefined + 1;
441
442 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
443 "%s Validating return Package of Type %X, Count %X\n",
444 data->pathname, package->ret_info.type,
445 return_object->package.count));
446
447 /*
448 * For variable-length Packages, we can safely remove all embedded
449 * and trailing NULL package elements
450 */
451 acpi_ns_remove_null_elements(data, package->ret_info.type,
452 return_object);
453
454 /* Extract package count and elements array */
455
456 elements = return_object->package.elements;
457 count = return_object->package.count;
458
459 /* The package must have at least one element, else invalid */
460
461 if (!count) {
462 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
463 "Return Package has no elements (empty)"));
464
465 return (AE_AML_OPERAND_VALUE);
466 }
467
468 /*
469 * Decode the type of the expected package contents
470 *
471 * PTYPE1 packages contain no subpackages
472 * PTYPE2 packages contain sub-packages
473 */
474 switch (package->ret_info.type) {
475 case ACPI_PTYPE1_FIXED:
476
477 /*
478 * The package count is fixed and there are no sub-packages
479 *
480 * If package is too small, exit.
481 * If package is larger than expected, issue warning but continue
482 */
483 expected_count =
484 package->ret_info.count1 + package->ret_info.count2;
485 if (count < expected_count) {
486 goto package_too_small;
487 } else if (count > expected_count) {
488 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
489 "%s: Return Package is larger than needed - "
490 "found %u, expected %u\n",
491 data->pathname, count,
492 expected_count));
493 }
494
495 /* Validate all elements of the returned package */
496
497 status = acpi_ns_check_package_elements(data, elements,
498 package->ret_info.
499 object_type1,
500 package->ret_info.
501 count1,
502 package->ret_info.
503 object_type2,
504 package->ret_info.
505 count2, 0);
506 break;
507
508 case ACPI_PTYPE1_VAR:
509
510 /*
511 * The package count is variable, there are no sub-packages, and all
512 * elements must be of the same type
513 */
514 for (i = 0; i < count; i++) {
515 status = acpi_ns_check_object_type(data, elements,
516 package->ret_info.
517 object_type1, i);
518 if (ACPI_FAILURE(status)) {
519 return (status);
520 }
521 elements++;
522 }
523 break;
524
525 case ACPI_PTYPE1_OPTION:
526
527 /*
528 * The package count is variable, there are no sub-packages. There are
529 * a fixed number of required elements, and a variable number of
530 * optional elements.
531 *
532 * Check if package is at least as large as the minimum required
533 */
534 expected_count = package->ret_info3.count;
535 if (count < expected_count) {
536 goto package_too_small;
537 }
538
539 /* Variable number of sub-objects */
540
541 for (i = 0; i < count; i++) {
542 if (i < package->ret_info3.count) {
543
544 /* These are the required package elements (0, 1, or 2) */
545
546 status =
547 acpi_ns_check_object_type(data, elements,
548 package->
549 ret_info3.
550 object_type[i],
551 i);
552 if (ACPI_FAILURE(status)) {
553 return (status);
554 }
555 } else {
556 /* These are the optional package elements */
557
558 status =
559 acpi_ns_check_object_type(data, elements,
560 package->
561 ret_info3.
562 tail_object_type,
563 i);
564 if (ACPI_FAILURE(status)) {
565 return (status);
566 }
567 }
568 elements++;
569 }
570 break;
571
572 case ACPI_PTYPE2_REV_FIXED:
573
574 /* First element is the (Integer) revision */
575
576 status = acpi_ns_check_object_type(data, elements,
577 ACPI_RTYPE_INTEGER, 0);
578 if (ACPI_FAILURE(status)) {
579 return (status);
580 }
581
582 elements++;
583 count--;
584
585 /* Examine the sub-packages */
586
587 status =
588 acpi_ns_check_package_list(data, package, elements, count);
589 break;
590
591 case ACPI_PTYPE2_PKG_COUNT:
592
593 /* First element is the (Integer) count of sub-packages to follow */
594
595 status = acpi_ns_check_object_type(data, elements,
596 ACPI_RTYPE_INTEGER, 0);
597 if (ACPI_FAILURE(status)) {
598 return (status);
599 }
600
601 /*
602 * Count cannot be larger than the parent package length, but allow it
603 * to be smaller. The >= accounts for the Integer above.
604 */
605 expected_count = (u32) (*elements)->integer.value;
606 if (expected_count >= count) {
607 goto package_too_small;
608 }
609
610 count = expected_count;
611 elements++;
612
613 /* Examine the sub-packages */
614
615 status =
616 acpi_ns_check_package_list(data, package, elements, count);
617 break;
618
619 case ACPI_PTYPE2:
620 case ACPI_PTYPE2_FIXED:
621 case ACPI_PTYPE2_MIN:
622 case ACPI_PTYPE2_COUNT:
623 case ACPI_PTYPE2_FIX_VAR:
624
625 /*
626 * These types all return a single Package that consists of a
627 * variable number of sub-Packages.
628 *
629 * First, ensure that the first element is a sub-Package. If not,
630 * the BIOS may have incorrectly returned the object as a single
631 * package instead of a Package of Packages (a common error if
632 * there is only one entry). We may be able to repair this by
633 * wrapping the returned Package with a new outer Package.
634 */
635 if (*elements
636 && ((*elements)->common.type != ACPI_TYPE_PACKAGE)) {
637
638 /* Create the new outer package and populate it */
639
640 status =
641 acpi_ns_wrap_with_package(data, return_object,
642 return_object_ptr);
643 if (ACPI_FAILURE(status)) {
644 return (status);
645 }
646
647 /* Update locals to point to the new package (of 1 element) */
648
649 return_object = *return_object_ptr;
650 elements = return_object->package.elements;
651 count = 1;
652 }
653
654 /* Examine the sub-packages */
655
656 status =
657 acpi_ns_check_package_list(data, package, elements, count);
658 break;
659
660 default:
661
662 /* Should not get here if predefined info table is correct */
663
664 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
665 "Invalid internal return type in table entry: %X",
666 package->ret_info.type));
667
668 return (AE_AML_INTERNAL);
669 }
670
671 return (status);
672
673package_too_small:
674
675 /* Error exit for the case with an incorrect package count */
676
677 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
678 "Return Package is too small - found %u elements, expected %u",
679 count, expected_count));
680
681 return (AE_AML_OPERAND_VALUE);
682}
683
684/*******************************************************************************
685 *
686 * FUNCTION: acpi_ns_check_package_list
687 *
688 * PARAMETERS: data - Pointer to validation data structure
689 * package - Pointer to package-specific info for method
690 * elements - Element list of parent package. All elements
691 * of this list should be of type Package.
692 * count - Count of subpackages
693 *
694 * RETURN: Status
695 *
696 * DESCRIPTION: Examine a list of subpackages
697 *
698 ******************************************************************************/
699
700static acpi_status
701acpi_ns_check_package_list(struct acpi_predefined_data *data,
702 const union acpi_predefined_info *package,
703 union acpi_operand_object **elements, u32 count)
704{
705 union acpi_operand_object *sub_package;
706 union acpi_operand_object **sub_elements;
707 acpi_status status;
708 u32 expected_count;
709 u32 i;
710 u32 j;
711
712 /*
713 * Validate each sub-Package in the parent Package
714 *
715 * NOTE: assumes list of sub-packages contains no NULL elements.
716 * Any NULL elements should have been removed by earlier call
717 * to acpi_ns_remove_null_elements.
718 */
719 for (i = 0; i < count; i++) {
720 sub_package = *elements;
721 sub_elements = sub_package->package.elements;
722 data->parent_package = sub_package;
723
724 /* Each sub-object must be of type Package */
725
726 status = acpi_ns_check_object_type(data, &sub_package,
727 ACPI_RTYPE_PACKAGE, i);
728 if (ACPI_FAILURE(status)) {
729 return (status);
730 }
731
732 /* Examine the different types of expected sub-packages */
733
734 data->parent_package = sub_package;
735 switch (package->ret_info.type) {
736 case ACPI_PTYPE2:
737 case ACPI_PTYPE2_PKG_COUNT:
738 case ACPI_PTYPE2_REV_FIXED:
739
740 /* Each subpackage has a fixed number of elements */
741
742 expected_count =
743 package->ret_info.count1 + package->ret_info.count2;
744 if (sub_package->package.count < expected_count) {
745 goto package_too_small;
746 }
747
748 status =
749 acpi_ns_check_package_elements(data, sub_elements,
750 package->ret_info.
751 object_type1,
752 package->ret_info.
753 count1,
754 package->ret_info.
755 object_type2,
756 package->ret_info.
757 count2, 0);
758 if (ACPI_FAILURE(status)) {
759 return (status);
760 }
761 break;
762
763 case ACPI_PTYPE2_FIX_VAR:
764 /*
765 * Each subpackage has a fixed number of elements and an
766 * optional element
767 */
768 expected_count =
769 package->ret_info.count1 + package->ret_info.count2;
770 if (sub_package->package.count < expected_count) {
771 goto package_too_small;
772 }
773
774 status =
775 acpi_ns_check_package_elements(data, sub_elements,
776 package->ret_info.
777 object_type1,
778 package->ret_info.
779 count1,
780 package->ret_info.
781 object_type2,
782 sub_package->package.
783 count -
784 package->ret_info.
785 count1, 0);
786 if (ACPI_FAILURE(status)) {
787 return (status);
788 }
789 break;
790
791 case ACPI_PTYPE2_FIXED:
792
793 /* Each sub-package has a fixed length */
794
795 expected_count = package->ret_info2.count;
796 if (sub_package->package.count < expected_count) {
797 goto package_too_small;
798 }
799
800 /* Check the type of each sub-package element */
801
802 for (j = 0; j < expected_count; j++) {
803 status =
804 acpi_ns_check_object_type(data,
805 &sub_elements[j],
806 package->
807 ret_info2.
808 object_type[j],
809 j);
810 if (ACPI_FAILURE(status)) {
811 return (status);
812 }
813 }
814 break;
815
816 case ACPI_PTYPE2_MIN:
817
818 /* Each sub-package has a variable but minimum length */
819
820 expected_count = package->ret_info.count1;
821 if (sub_package->package.count < expected_count) {
822 goto package_too_small;
823 }
824
825 /* Check the type of each sub-package element */
826
827 status =
828 acpi_ns_check_package_elements(data, sub_elements,
829 package->ret_info.
830 object_type1,
831 sub_package->package.
832 count, 0, 0, 0);
833 if (ACPI_FAILURE(status)) {
834 return (status);
835 }
836 break;
837
838 case ACPI_PTYPE2_COUNT:
839
840 /*
841 * First element is the (Integer) count of elements, including
842 * the count field (the ACPI name is num_elements)
843 */
844 status = acpi_ns_check_object_type(data, sub_elements,
845 ACPI_RTYPE_INTEGER,
846 0);
847 if (ACPI_FAILURE(status)) {
848 return (status);
849 }
850
851 /*
852 * Make sure package is large enough for the Count and is
853 * is as large as the minimum size
854 */
855 expected_count = (u32)(*sub_elements)->integer.value;
856 if (sub_package->package.count < expected_count) {
857 goto package_too_small;
858 }
859 if (sub_package->package.count <
860 package->ret_info.count1) {
861 expected_count = package->ret_info.count1;
862 goto package_too_small;
863 }
864 if (expected_count == 0) {
865 /*
866 * Either the num_entries element was originally zero or it was
867 * a NULL element and repaired to an Integer of value zero.
868 * In either case, repair it by setting num_entries to be the
869 * actual size of the subpackage.
870 */
871 expected_count = sub_package->package.count;
872 (*sub_elements)->integer.value = expected_count;
873 }
874
875 /* Check the type of each sub-package element */
876
877 status =
878 acpi_ns_check_package_elements(data,
879 (sub_elements + 1),
880 package->ret_info.
881 object_type1,
882 (expected_count - 1),
883 0, 0, 1);
884 if (ACPI_FAILURE(status)) {
885 return (status);
886 }
887 break;
888
889 default: /* Should not get here, type was validated by caller */
890
891 return (AE_AML_INTERNAL);
892 }
893
894 elements++;
895 }
896
897 return (AE_OK);
898
899package_too_small:
900
901 /* The sub-package count was smaller than required */
902
903 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
904 "Return Sub-Package[%u] is too small - found %u elements, expected %u",
905 i, sub_package->package.count, expected_count));
906
907 return (AE_AML_OPERAND_VALUE);
908}
909
910/*******************************************************************************
911 *
912 * FUNCTION: acpi_ns_check_package_elements
913 *
914 * PARAMETERS: data - Pointer to validation data structure
915 * elements - Pointer to the package elements array
916 * type1 - Object type for first group
917 * count1 - Count for first group
918 * type2 - Object type for second group
919 * count2 - Count for second group
920 * start_index - Start of the first group of elements
921 *
922 * RETURN: Status
923 *
924 * DESCRIPTION: Check that all elements of a package are of the correct object
925 * type. Supports up to two groups of different object types.
926 *
927 ******************************************************************************/
928
929static acpi_status
930acpi_ns_check_package_elements(struct acpi_predefined_data *data,
931 union acpi_operand_object **elements,
932 u8 type1,
933 u32 count1,
934 u8 type2, u32 count2, u32 start_index)
935{
936 union acpi_operand_object **this_element = elements;
937 acpi_status status;
938 u32 i;
939
940 /*
941 * Up to two groups of package elements are supported by the data
942 * structure. All elements in each group must be of the same type.
943 * The second group can have a count of zero.
944 */
945 for (i = 0; i < count1; i++) {
946 status = acpi_ns_check_object_type(data, this_element,
947 type1, i + start_index);
948 if (ACPI_FAILURE(status)) {
949 return (status);
950 }
951 this_element++;
952 }
953
954 for (i = 0; i < count2; i++) {
955 status = acpi_ns_check_object_type(data, this_element,
956 type2,
957 (i + count1 + start_index));
958 if (ACPI_FAILURE(status)) {
959 return (status);
960 }
961 this_element++;
962 }
963
964 return (AE_OK);
965}
966
967/*******************************************************************************
968 *
969 * FUNCTION: acpi_ns_check_object_type 389 * FUNCTION: acpi_ns_check_object_type
970 * 390 *
971 * PARAMETERS: data - Pointer to validation data structure 391 * PARAMETERS: data - Pointer to validation data structure
@@ -983,7 +403,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
983 * 403 *
984 ******************************************************************************/ 404 ******************************************************************************/
985 405
986static acpi_status 406acpi_status
987acpi_ns_check_object_type(struct acpi_predefined_data *data, 407acpi_ns_check_object_type(struct acpi_predefined_data *data,
988 union acpi_operand_object **return_object_ptr, 408 union acpi_operand_object **return_object_ptr,
989 u32 expected_btypes, u32 package_index) 409 u32 expected_btypes, u32 package_index)
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c
new file mode 100644
index 000000000000..a40155467d2e
--- /dev/null
+++ b/drivers/acpi/acpica/nsprepkg.c
@@ -0,0 +1,621 @@
1/******************************************************************************
2 *
3 * Module Name: nsprepkg - Validation of package objects for predefined names
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acnamesp.h"
47#include "acpredef.h"
48
49#define _COMPONENT ACPI_NAMESPACE
50ACPI_MODULE_NAME("nsprepkg")
51
52/* Local prototypes */
53static acpi_status
54acpi_ns_check_package_list(struct acpi_predefined_data *data,
55 const union acpi_predefined_info *package,
56 union acpi_operand_object **elements, u32 count);
57
58static acpi_status
59acpi_ns_check_package_elements(struct acpi_predefined_data *data,
60 union acpi_operand_object **elements,
61 u8 type1,
62 u32 count1,
63 u8 type2, u32 count2, u32 start_index);
64
65/*******************************************************************************
66 *
67 * FUNCTION: acpi_ns_check_package
68 *
69 * PARAMETERS: data - Pointer to validation data structure
70 * return_object_ptr - Pointer to the object returned from the
71 * evaluation of a method or object
72 *
73 * RETURN: Status
74 *
75 * DESCRIPTION: Check a returned package object for the correct count and
76 * correct type of all sub-objects.
77 *
78 ******************************************************************************/
79
80acpi_status
81acpi_ns_check_package(struct acpi_predefined_data *data,
82 union acpi_operand_object **return_object_ptr)
83{
84 union acpi_operand_object *return_object = *return_object_ptr;
85 const union acpi_predefined_info *package;
86 union acpi_operand_object **elements;
87 acpi_status status = AE_OK;
88 u32 expected_count;
89 u32 count;
90 u32 i;
91
92 ACPI_FUNCTION_NAME(ns_check_package);
93
94 /* The package info for this name is in the next table entry */
95
96 package = data->predefined + 1;
97
98 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
99 "%s Validating return Package of Type %X, Count %X\n",
100 data->pathname, package->ret_info.type,
101 return_object->package.count));
102
103 /*
104 * For variable-length Packages, we can safely remove all embedded
105 * and trailing NULL package elements
106 */
107 acpi_ns_remove_null_elements(data, package->ret_info.type,
108 return_object);
109
110 /* Extract package count and elements array */
111
112 elements = return_object->package.elements;
113 count = return_object->package.count;
114
115 /* The package must have at least one element, else invalid */
116
117 if (!count) {
118 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
119 "Return Package has no elements (empty)"));
120
121 return (AE_AML_OPERAND_VALUE);
122 }
123
124 /*
125 * Decode the type of the expected package contents
126 *
127 * PTYPE1 packages contain no subpackages
128 * PTYPE2 packages contain sub-packages
129 */
130 switch (package->ret_info.type) {
131 case ACPI_PTYPE1_FIXED:
132
133 /*
134 * The package count is fixed and there are no sub-packages
135 *
136 * If package is too small, exit.
137 * If package is larger than expected, issue warning but continue
138 */
139 expected_count =
140 package->ret_info.count1 + package->ret_info.count2;
141 if (count < expected_count) {
142 goto package_too_small;
143 } else if (count > expected_count) {
144 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
145 "%s: Return Package is larger than needed - "
146 "found %u, expected %u\n",
147 data->pathname, count,
148 expected_count));
149 }
150
151 /* Validate all elements of the returned package */
152
153 status = acpi_ns_check_package_elements(data, elements,
154 package->ret_info.
155 object_type1,
156 package->ret_info.
157 count1,
158 package->ret_info.
159 object_type2,
160 package->ret_info.
161 count2, 0);
162 break;
163
164 case ACPI_PTYPE1_VAR:
165
166 /*
167 * The package count is variable, there are no sub-packages, and all
168 * elements must be of the same type
169 */
170 for (i = 0; i < count; i++) {
171 status = acpi_ns_check_object_type(data, elements,
172 package->ret_info.
173 object_type1, i);
174 if (ACPI_FAILURE(status)) {
175 return (status);
176 }
177 elements++;
178 }
179 break;
180
181 case ACPI_PTYPE1_OPTION:
182
183 /*
184 * The package count is variable, there are no sub-packages. There are
185 * a fixed number of required elements, and a variable number of
186 * optional elements.
187 *
188 * Check if package is at least as large as the minimum required
189 */
190 expected_count = package->ret_info3.count;
191 if (count < expected_count) {
192 goto package_too_small;
193 }
194
195 /* Variable number of sub-objects */
196
197 for (i = 0; i < count; i++) {
198 if (i < package->ret_info3.count) {
199
200 /* These are the required package elements (0, 1, or 2) */
201
202 status =
203 acpi_ns_check_object_type(data, elements,
204 package->
205 ret_info3.
206 object_type[i],
207 i);
208 if (ACPI_FAILURE(status)) {
209 return (status);
210 }
211 } else {
212 /* These are the optional package elements */
213
214 status =
215 acpi_ns_check_object_type(data, elements,
216 package->
217 ret_info3.
218 tail_object_type,
219 i);
220 if (ACPI_FAILURE(status)) {
221 return (status);
222 }
223 }
224 elements++;
225 }
226 break;
227
228 case ACPI_PTYPE2_REV_FIXED:
229
230 /* First element is the (Integer) revision */
231
232 status = acpi_ns_check_object_type(data, elements,
233 ACPI_RTYPE_INTEGER, 0);
234 if (ACPI_FAILURE(status)) {
235 return (status);
236 }
237
238 elements++;
239 count--;
240
241 /* Examine the sub-packages */
242
243 status =
244 acpi_ns_check_package_list(data, package, elements, count);
245 break;
246
247 case ACPI_PTYPE2_PKG_COUNT:
248
249 /* First element is the (Integer) count of sub-packages to follow */
250
251 status = acpi_ns_check_object_type(data, elements,
252 ACPI_RTYPE_INTEGER, 0);
253 if (ACPI_FAILURE(status)) {
254 return (status);
255 }
256
257 /*
258 * Count cannot be larger than the parent package length, but allow it
259 * to be smaller. The >= accounts for the Integer above.
260 */
261 expected_count = (u32)(*elements)->integer.value;
262 if (expected_count >= count) {
263 goto package_too_small;
264 }
265
266 count = expected_count;
267 elements++;
268
269 /* Examine the sub-packages */
270
271 status =
272 acpi_ns_check_package_list(data, package, elements, count);
273 break;
274
275 case ACPI_PTYPE2:
276 case ACPI_PTYPE2_FIXED:
277 case ACPI_PTYPE2_MIN:
278 case ACPI_PTYPE2_COUNT:
279 case ACPI_PTYPE2_FIX_VAR:
280
281 /*
282 * These types all return a single Package that consists of a
283 * variable number of sub-Packages.
284 *
285 * First, ensure that the first element is a sub-Package. If not,
286 * the BIOS may have incorrectly returned the object as a single
287 * package instead of a Package of Packages (a common error if
288 * there is only one entry). We may be able to repair this by
289 * wrapping the returned Package with a new outer Package.
290 */
291 if (*elements
292 && ((*elements)->common.type != ACPI_TYPE_PACKAGE)) {
293
294 /* Create the new outer package and populate it */
295
296 status =
297 acpi_ns_wrap_with_package(data, return_object,
298 return_object_ptr);
299 if (ACPI_FAILURE(status)) {
300 return (status);
301 }
302
303 /* Update locals to point to the new package (of 1 element) */
304
305 return_object = *return_object_ptr;
306 elements = return_object->package.elements;
307 count = 1;
308 }
309
310 /* Examine the sub-packages */
311
312 status =
313 acpi_ns_check_package_list(data, package, elements, count);
314 break;
315
316 default:
317
318 /* Should not get here if predefined info table is correct */
319
320 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
321 "Invalid internal return type in table entry: %X",
322 package->ret_info.type));
323
324 return (AE_AML_INTERNAL);
325 }
326
327 return (status);
328
329 package_too_small:
330
331 /* Error exit for the case with an incorrect package count */
332
333 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
334 "Return Package is too small - found %u elements, expected %u",
335 count, expected_count));
336
337 return (AE_AML_OPERAND_VALUE);
338}
339
340/*******************************************************************************
341 *
342 * FUNCTION: acpi_ns_check_package_list
343 *
344 * PARAMETERS: data - Pointer to validation data structure
345 * package - Pointer to package-specific info for method
346 * elements - Element list of parent package. All elements
347 * of this list should be of type Package.
348 * count - Count of subpackages
349 *
350 * RETURN: Status
351 *
352 * DESCRIPTION: Examine a list of subpackages
353 *
354 ******************************************************************************/
355
356static acpi_status
357acpi_ns_check_package_list(struct acpi_predefined_data *data,
358 const union acpi_predefined_info *package,
359 union acpi_operand_object **elements, u32 count)
360{
361 union acpi_operand_object *sub_package;
362 union acpi_operand_object **sub_elements;
363 acpi_status status;
364 u32 expected_count;
365 u32 i;
366 u32 j;
367
368 /*
369 * Validate each sub-Package in the parent Package
370 *
371 * NOTE: assumes list of sub-packages contains no NULL elements.
372 * Any NULL elements should have been removed by earlier call
373 * to acpi_ns_remove_null_elements.
374 */
375 for (i = 0; i < count; i++) {
376 sub_package = *elements;
377 sub_elements = sub_package->package.elements;
378 data->parent_package = sub_package;
379
380 /* Each sub-object must be of type Package */
381
382 status = acpi_ns_check_object_type(data, &sub_package,
383 ACPI_RTYPE_PACKAGE, i);
384 if (ACPI_FAILURE(status)) {
385 return (status);
386 }
387
388 /* Examine the different types of expected sub-packages */
389
390 data->parent_package = sub_package;
391 switch (package->ret_info.type) {
392 case ACPI_PTYPE2:
393 case ACPI_PTYPE2_PKG_COUNT:
394 case ACPI_PTYPE2_REV_FIXED:
395
396 /* Each subpackage has a fixed number of elements */
397
398 expected_count =
399 package->ret_info.count1 + package->ret_info.count2;
400 if (sub_package->package.count < expected_count) {
401 goto package_too_small;
402 }
403
404 status =
405 acpi_ns_check_package_elements(data, sub_elements,
406 package->ret_info.
407 object_type1,
408 package->ret_info.
409 count1,
410 package->ret_info.
411 object_type2,
412 package->ret_info.
413 count2, 0);
414 if (ACPI_FAILURE(status)) {
415 return (status);
416 }
417 break;
418
419 case ACPI_PTYPE2_FIX_VAR:
420 /*
421 * Each subpackage has a fixed number of elements and an
422 * optional element
423 */
424 expected_count =
425 package->ret_info.count1 + package->ret_info.count2;
426 if (sub_package->package.count < expected_count) {
427 goto package_too_small;
428 }
429
430 status =
431 acpi_ns_check_package_elements(data, sub_elements,
432 package->ret_info.
433 object_type1,
434 package->ret_info.
435 count1,
436 package->ret_info.
437 object_type2,
438 sub_package->package.
439 count -
440 package->ret_info.
441 count1, 0);
442 if (ACPI_FAILURE(status)) {
443 return (status);
444 }
445 break;
446
447 case ACPI_PTYPE2_FIXED:
448
449 /* Each sub-package has a fixed length */
450
451 expected_count = package->ret_info2.count;
452 if (sub_package->package.count < expected_count) {
453 goto package_too_small;
454 }
455
456 /* Check the type of each sub-package element */
457
458 for (j = 0; j < expected_count; j++) {
459 status =
460 acpi_ns_check_object_type(data,
461 &sub_elements[j],
462 package->
463 ret_info2.
464 object_type[j],
465 j);
466 if (ACPI_FAILURE(status)) {
467 return (status);
468 }
469 }
470 break;
471
472 case ACPI_PTYPE2_MIN:
473
474 /* Each sub-package has a variable but minimum length */
475
476 expected_count = package->ret_info.count1;
477 if (sub_package->package.count < expected_count) {
478 goto package_too_small;
479 }
480
481 /* Check the type of each sub-package element */
482
483 status =
484 acpi_ns_check_package_elements(data, sub_elements,
485 package->ret_info.
486 object_type1,
487 sub_package->package.
488 count, 0, 0, 0);
489 if (ACPI_FAILURE(status)) {
490 return (status);
491 }
492 break;
493
494 case ACPI_PTYPE2_COUNT:
495
496 /*
497 * First element is the (Integer) count of elements, including
498 * the count field (the ACPI name is num_elements)
499 */
500 status = acpi_ns_check_object_type(data, sub_elements,
501 ACPI_RTYPE_INTEGER,
502 0);
503 if (ACPI_FAILURE(status)) {
504 return (status);
505 }
506
507 /*
508 * Make sure package is large enough for the Count and is
509 * is as large as the minimum size
510 */
511 expected_count = (u32)(*sub_elements)->integer.value;
512 if (sub_package->package.count < expected_count) {
513 goto package_too_small;
514 }
515 if (sub_package->package.count <
516 package->ret_info.count1) {
517 expected_count = package->ret_info.count1;
518 goto package_too_small;
519 }
520 if (expected_count == 0) {
521 /*
522 * Either the num_entries element was originally zero or it was
523 * a NULL element and repaired to an Integer of value zero.
524 * In either case, repair it by setting num_entries to be the
525 * actual size of the subpackage.
526 */
527 expected_count = sub_package->package.count;
528 (*sub_elements)->integer.value = expected_count;
529 }
530
531 /* Check the type of each sub-package element */
532
533 status =
534 acpi_ns_check_package_elements(data,
535 (sub_elements + 1),
536 package->ret_info.
537 object_type1,
538 (expected_count - 1),
539 0, 0, 1);
540 if (ACPI_FAILURE(status)) {
541 return (status);
542 }
543 break;
544
545 default: /* Should not get here, type was validated by caller */
546
547 return (AE_AML_INTERNAL);
548 }
549
550 elements++;
551 }
552
553 return (AE_OK);
554
555 package_too_small:
556
557 /* The sub-package count was smaller than required */
558
559 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
560 "Return Sub-Package[%u] is too small - found %u elements, expected %u",
561 i, sub_package->package.count, expected_count));
562
563 return (AE_AML_OPERAND_VALUE);
564}
565
566/*******************************************************************************
567 *
568 * FUNCTION: acpi_ns_check_package_elements
569 *
570 * PARAMETERS: data - Pointer to validation data structure
571 * elements - Pointer to the package elements array
572 * type1 - Object type for first group
573 * count1 - Count for first group
574 * type2 - Object type for second group
575 * count2 - Count for second group
576 * start_index - Start of the first group of elements
577 *
578 * RETURN: Status
579 *
580 * DESCRIPTION: Check that all elements of a package are of the correct object
581 * type. Supports up to two groups of different object types.
582 *
583 ******************************************************************************/
584
585static acpi_status
586acpi_ns_check_package_elements(struct acpi_predefined_data *data,
587 union acpi_operand_object **elements,
588 u8 type1,
589 u32 count1,
590 u8 type2, u32 count2, u32 start_index)
591{
592 union acpi_operand_object **this_element = elements;
593 acpi_status status;
594 u32 i;
595
596 /*
597 * Up to two groups of package elements are supported by the data
598 * structure. All elements in each group must be of the same type.
599 * The second group can have a count of zero.
600 */
601 for (i = 0; i < count1; i++) {
602 status = acpi_ns_check_object_type(data, this_element,
603 type1, i + start_index);
604 if (ACPI_FAILURE(status)) {
605 return (status);
606 }
607 this_element++;
608 }
609
610 for (i = 0; i < count2; i++) {
611 status = acpi_ns_check_object_type(data, this_element,
612 type2,
613 (i + count1 + start_index));
614 if (ACPI_FAILURE(status)) {
615 return (status);
616 }
617 this_element++;
618 }
619
620 return (AE_OK);
621}
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index 8c5f292860fc..9e833353c06a 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 90189251cdf0..ba4d98287c6a 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -55,7 +55,8 @@ ACPI_MODULE_NAME("nsrepair2")
55 */ 55 */
56typedef 56typedef
57acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data, 57acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data,
58 union acpi_operand_object **return_object_ptr); 58 union acpi_operand_object
59 **return_object_ptr);
59 60
60typedef struct acpi_repair_info { 61typedef struct acpi_repair_info {
61 char name[ACPI_NAME_SIZE]; 62 char name[ACPI_NAME_SIZE];
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 1d2d8ffc1bc5..5d43efc53a61 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -328,6 +328,11 @@ acpi_ns_search_and_enter(u32 target_name,
328 if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) { 328 if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
329 status = AE_ALREADY_EXISTS; 329 status = AE_ALREADY_EXISTS;
330 } 330 }
331#ifdef ACPI_ASL_COMPILER
332 if (*return_node && (*return_node)->type == ACPI_TYPE_ANY) {
333 (*return_node)->flags |= ANOBJ_IS_EXTERNAL;
334 }
335#endif
331 336
332 /* Either found it or there was an error: finished either way */ 337 /* Either found it or there was an error: finished either way */
333 338
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index b5b4cb72a8a8..686420df684f 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -46,14 +46,11 @@
46#include "accommon.h" 46#include "accommon.h"
47#include "acnamesp.h" 47#include "acnamesp.h"
48#include "amlcode.h" 48#include "amlcode.h"
49#include "actables.h"
50 49
51#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
52ACPI_MODULE_NAME("nsutils") 51ACPI_MODULE_NAME("nsutils")
53 52
54/* Local prototypes */ 53/* Local prototypes */
55static u8 acpi_ns_valid_path_separator(char sep);
56
57#ifdef ACPI_OBSOLETE_FUNCTIONS 54#ifdef ACPI_OBSOLETE_FUNCTIONS
58acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); 55acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
59#endif 56#endif
@@ -99,42 +96,6 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node,
99 96
100/******************************************************************************* 97/*******************************************************************************
101 * 98 *
102 * FUNCTION: acpi_ns_valid_root_prefix
103 *
104 * PARAMETERS: prefix - Character to be checked
105 *
106 * RETURN: TRUE if a valid prefix
107 *
108 * DESCRIPTION: Check if a character is a valid ACPI Root prefix
109 *
110 ******************************************************************************/
111
112u8 acpi_ns_valid_root_prefix(char prefix)
113{
114
115 return ((u8) (prefix == '\\'));
116}
117
118/*******************************************************************************
119 *
120 * FUNCTION: acpi_ns_valid_path_separator
121 *
122 * PARAMETERS: sep - Character to be checked
123 *
124 * RETURN: TRUE if a valid path separator
125 *
126 * DESCRIPTION: Check if a character is a valid ACPI path separator
127 *
128 ******************************************************************************/
129
130static u8 acpi_ns_valid_path_separator(char sep)
131{
132
133 return ((u8) (sep == '.'));
134}
135
136/*******************************************************************************
137 *
138 * FUNCTION: acpi_ns_get_type 99 * FUNCTION: acpi_ns_get_type
139 * 100 *
140 * PARAMETERS: node - Parent Node to be examined 101 * PARAMETERS: node - Parent Node to be examined
@@ -151,10 +112,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
151 112
152 if (!node) { 113 if (!node) {
153 ACPI_WARNING((AE_INFO, "Null Node parameter")); 114 ACPI_WARNING((AE_INFO, "Null Node parameter"));
154 return_UINT32(ACPI_TYPE_ANY); 115 return_VALUE(ACPI_TYPE_ANY);
155 } 116 }
156 117
157 return_UINT32((acpi_object_type) node->type); 118 return_VALUE(node->type);
158} 119}
159 120
160/******************************************************************************* 121/*******************************************************************************
@@ -179,10 +140,10 @@ u32 acpi_ns_local(acpi_object_type type)
179 /* Type code out of range */ 140 /* Type code out of range */
180 141
181 ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); 142 ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type));
182 return_UINT32(ACPI_NS_NORMAL); 143 return_VALUE(ACPI_NS_NORMAL);
183 } 144 }
184 145
185 return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); 146 return_VALUE(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
186} 147}
187 148
188/******************************************************************************* 149/*******************************************************************************
@@ -218,19 +179,19 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
218 * 179 *
219 * strlen() + 1 covers the first name_seg, which has no path separator 180 * strlen() + 1 covers the first name_seg, which has no path separator
220 */ 181 */
221 if (acpi_ns_valid_root_prefix(*next_external_char)) { 182 if (ACPI_IS_ROOT_PREFIX(*next_external_char)) {
222 info->fully_qualified = TRUE; 183 info->fully_qualified = TRUE;
223 next_external_char++; 184 next_external_char++;
224 185
225 /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */ 186 /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */
226 187
227 while (acpi_ns_valid_root_prefix(*next_external_char)) { 188 while (ACPI_IS_ROOT_PREFIX(*next_external_char)) {
228 next_external_char++; 189 next_external_char++;
229 } 190 }
230 } else { 191 } else {
231 /* Handle Carat prefixes */ 192 /* Handle Carat prefixes */
232 193
233 while (*next_external_char == '^') { 194 while (ACPI_IS_PARENT_PREFIX(*next_external_char)) {
234 info->num_carats++; 195 info->num_carats++;
235 next_external_char++; 196 next_external_char++;
236 } 197 }
@@ -244,7 +205,7 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
244 if (*next_external_char) { 205 if (*next_external_char) {
245 info->num_segments = 1; 206 info->num_segments = 1;
246 for (i = 0; next_external_char[i]; i++) { 207 for (i = 0; next_external_char[i]; i++) {
247 if (acpi_ns_valid_path_separator(next_external_char[i])) { 208 if (ACPI_IS_PATH_SEPARATOR(next_external_char[i])) {
248 info->num_segments++; 209 info->num_segments++;
249 } 210 }
250 } 211 }
@@ -282,7 +243,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
282 /* Setup the correct prefixes, counts, and pointers */ 243 /* Setup the correct prefixes, counts, and pointers */
283 244
284 if (info->fully_qualified) { 245 if (info->fully_qualified) {
285 internal_name[0] = '\\'; 246 internal_name[0] = AML_ROOT_PREFIX;
286 247
287 if (num_segments <= 1) { 248 if (num_segments <= 1) {
288 result = &internal_name[1]; 249 result = &internal_name[1];
@@ -302,7 +263,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
302 i = 0; 263 i = 0;
303 if (info->num_carats) { 264 if (info->num_carats) {
304 for (i = 0; i < info->num_carats; i++) { 265 for (i = 0; i < info->num_carats; i++) {
305 internal_name[i] = '^'; 266 internal_name[i] = AML_PARENT_PREFIX;
306 } 267 }
307 } 268 }
308 269
@@ -322,7 +283,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
322 283
323 for (; num_segments; num_segments--) { 284 for (; num_segments; num_segments--) {
324 for (i = 0; i < ACPI_NAME_SIZE; i++) { 285 for (i = 0; i < ACPI_NAME_SIZE; i++) {
325 if (acpi_ns_valid_path_separator(*external_name) || 286 if (ACPI_IS_PATH_SEPARATOR(*external_name) ||
326 (*external_name == 0)) { 287 (*external_name == 0)) {
327 288
328 /* Pad the segment with underscore(s) if segment is short */ 289 /* Pad the segment with underscore(s) if segment is short */
@@ -339,7 +300,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
339 300
340 /* Now we must have a path separator, or the pathname is bad */ 301 /* Now we must have a path separator, or the pathname is bad */
341 302
342 if (!acpi_ns_valid_path_separator(*external_name) && 303 if (!ACPI_IS_PATH_SEPARATOR(*external_name) &&
343 (*external_name != 0)) { 304 (*external_name != 0)) {
344 return_ACPI_STATUS(AE_BAD_PATHNAME); 305 return_ACPI_STATUS(AE_BAD_PATHNAME);
345 } 306 }
@@ -457,13 +418,13 @@ acpi_ns_externalize_name(u32 internal_name_length,
457 /* Check for a prefix (one '\' | one or more '^') */ 418 /* Check for a prefix (one '\' | one or more '^') */
458 419
459 switch (internal_name[0]) { 420 switch (internal_name[0]) {
460 case '\\': 421 case AML_ROOT_PREFIX:
461 prefix_length = 1; 422 prefix_length = 1;
462 break; 423 break;
463 424
464 case '^': 425 case AML_PARENT_PREFIX:
465 for (i = 0; i < internal_name_length; i++) { 426 for (i = 0; i < internal_name_length; i++) {
466 if (internal_name[i] == '^') { 427 if (ACPI_IS_PARENT_PREFIX(internal_name[i])) {
467 prefix_length = i + 1; 428 prefix_length = i + 1;
468 } else { 429 } else {
469 break; 430 break;
@@ -664,17 +625,17 @@ void acpi_ns_terminate(void)
664 625
665u32 acpi_ns_opens_scope(acpi_object_type type) 626u32 acpi_ns_opens_scope(acpi_object_type type)
666{ 627{
667 ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type)); 628 ACPI_FUNCTION_ENTRY();
668 629
669 if (!acpi_ut_valid_object_type(type)) { 630 if (type > ACPI_TYPE_LOCAL_MAX) {
670 631
671 /* type code out of range */ 632 /* type code out of range */
672 633
673 ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); 634 ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type));
674 return_UINT32(ACPI_NS_NORMAL); 635 return (ACPI_NS_NORMAL);
675 } 636 }
676 637
677 return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); 638 return (((u32)acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
678} 639}
679 640
680/******************************************************************************* 641/*******************************************************************************
@@ -710,6 +671,8 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
710 671
711 ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname)); 672 ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));
712 673
674 /* Simplest case is a null pathname */
675
713 if (!pathname) { 676 if (!pathname) {
714 *return_node = prefix_node; 677 *return_node = prefix_node;
715 if (!prefix_node) { 678 if (!prefix_node) {
@@ -718,6 +681,13 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
718 return_ACPI_STATUS(AE_OK); 681 return_ACPI_STATUS(AE_OK);
719 } 682 }
720 683
684 /* Quick check for a reference to the root */
685
686 if (ACPI_IS_ROOT_PREFIX(pathname[0]) && (!pathname[1])) {
687 *return_node = acpi_gbl_root_node;
688 return_ACPI_STATUS(AE_OK);
689 }
690
721 /* Convert path to internal representation */ 691 /* Convert path to internal representation */
722 692
723 status = acpi_ns_internalize_name(pathname, &internal_path); 693 status = acpi_ns_internalize_name(pathname, &internal_path);
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index 0483877f26b8..e70911a9e441 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -76,12 +76,12 @@ struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
76 76
77 /* It's really the parent's _scope_ that we want */ 77 /* It's really the parent's _scope_ that we want */
78 78
79 return parent_node->child; 79 return (parent_node->child);
80 } 80 }
81 81
82 /* Otherwise just return the next peer */ 82 /* Otherwise just return the next peer */
83 83
84 return child_node->peer; 84 return (child_node->peer);
85} 85}
86 86
87/******************************************************************************* 87/*******************************************************************************
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index d6a9f77972b6..fc69949151bb 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -236,7 +236,7 @@ acpi_evaluate_object(acpi_handle handle,
236 * 2) No handle, not fully qualified pathname (error) 236 * 2) No handle, not fully qualified pathname (error)
237 * 3) Valid handle 237 * 3) Valid handle
238 */ 238 */
239 if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { 239 if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
240 240
241 /* The path is fully qualified, just evaluate by name */ 241 /* The path is fully qualified, just evaluate by name */
242 242
@@ -492,7 +492,7 @@ acpi_walk_namespace(acpi_object_type type,
492 */ 492 */
493 status = acpi_ut_acquire_read_lock(&acpi_gbl_namespace_rw_lock); 493 status = acpi_ut_acquire_read_lock(&acpi_gbl_namespace_rw_lock);
494 if (ACPI_FAILURE(status)) { 494 if (ACPI_FAILURE(status)) {
495 return status; 495 return_ACPI_STATUS(status);
496 } 496 }
497 497
498 /* 498 /*
@@ -550,7 +550,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
550 550
551 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 551 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
552 if (ACPI_FAILURE(status)) { 552 if (ACPI_FAILURE(status)) {
553 return_ACPI_STATUS(status); 553 return (status);
554 } 554 }
555 555
556 node = acpi_ns_validate_handle(obj_handle); 556 node = acpi_ns_validate_handle(obj_handle);
@@ -602,17 +602,22 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
602 602
603 /* Walk the CID list */ 603 /* Walk the CID list */
604 604
605 found = 0; 605 found = FALSE;
606 for (i = 0; i < cid->count; i++) { 606 for (i = 0; i < cid->count; i++) {
607 if (ACPI_STRCMP(cid->ids[i].string, info->hid) 607 if (ACPI_STRCMP(cid->ids[i].string, info->hid)
608 == 0) { 608 == 0) {
609 found = 1; 609
610 /* Found a matching CID */
611
612 found = TRUE;
610 break; 613 break;
611 } 614 }
612 } 615 }
616
613 ACPI_FREE(cid); 617 ACPI_FREE(cid);
614 if (!found) 618 if (!found) {
615 return (AE_OK); 619 return (AE_OK);
620 }
616 } 621 }
617 } 622 }
618 623
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index 811c6f13f476..f3a4d95899f7 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -107,7 +107,7 @@ acpi_get_handle(acpi_handle parent,
107 * 107 *
108 * Error for <null Parent + relative path> 108 * Error for <null Parent + relative path>
109 */ 109 */
110 if (acpi_ns_valid_root_prefix(pathname[0])) { 110 if (ACPI_IS_ROOT_PREFIX(pathname[0])) {
111 111
112 /* Pathname is fully qualified (starts with '\') */ 112 /* Pathname is fully qualified (starts with '\') */
113 113
@@ -290,7 +290,7 @@ acpi_get_object_info(acpi_handle handle,
290 290
291 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 291 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
292 if (ACPI_FAILURE(status)) { 292 if (ACPI_FAILURE(status)) {
293 goto cleanup; 293 return (status);
294 } 294 }
295 295
296 node = acpi_ns_validate_handle(handle); 296 node = acpi_ns_validate_handle(handle);
@@ -539,14 +539,14 @@ acpi_status acpi_install_method(u8 *buffer)
539 /* Parameter validation */ 539 /* Parameter validation */
540 540
541 if (!buffer) { 541 if (!buffer) {
542 return AE_BAD_PARAMETER; 542 return (AE_BAD_PARAMETER);
543 } 543 }
544 544
545 /* Table must be a DSDT or SSDT */ 545 /* Table must be a DSDT or SSDT */
546 546
547 if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) && 547 if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) &&
548 !ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) { 548 !ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
549 return AE_BAD_HEADER; 549 return (AE_BAD_HEADER);
550 } 550 }
551 551
552 /* First AML opcode in the table must be a control method */ 552 /* First AML opcode in the table must be a control method */
@@ -554,7 +554,7 @@ acpi_status acpi_install_method(u8 *buffer)
554 parser_state.aml = buffer + sizeof(struct acpi_table_header); 554 parser_state.aml = buffer + sizeof(struct acpi_table_header);
555 opcode = acpi_ps_peek_opcode(&parser_state); 555 opcode = acpi_ps_peek_opcode(&parser_state);
556 if (opcode != AML_METHOD_OP) { 556 if (opcode != AML_METHOD_OP) {
557 return AE_BAD_PARAMETER; 557 return (AE_BAD_PARAMETER);
558 } 558 }
559 559
560 /* Extract method information from the raw AML */ 560 /* Extract method information from the raw AML */
@@ -572,13 +572,13 @@ acpi_status acpi_install_method(u8 *buffer)
572 */ 572 */
573 aml_buffer = ACPI_ALLOCATE(aml_length); 573 aml_buffer = ACPI_ALLOCATE(aml_length);
574 if (!aml_buffer) { 574 if (!aml_buffer) {
575 return AE_NO_MEMORY; 575 return (AE_NO_MEMORY);
576 } 576 }
577 577
578 method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); 578 method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
579 if (!method_obj) { 579 if (!method_obj) {
580 ACPI_FREE(aml_buffer); 580 ACPI_FREE(aml_buffer);
581 return AE_NO_MEMORY; 581 return (AE_NO_MEMORY);
582 } 582 }
583 583
584 /* Lock namespace for acpi_ns_lookup, we may be creating a new node */ 584 /* Lock namespace for acpi_ns_lookup, we may be creating a new node */
@@ -644,12 +644,12 @@ acpi_status acpi_install_method(u8 *buffer)
644 /* Remove local reference to the method object */ 644 /* Remove local reference to the method object */
645 645
646 acpi_ut_remove_reference(method_obj); 646 acpi_ut_remove_reference(method_obj);
647 return status; 647 return (status);
648 648
649error_exit: 649error_exit:
650 650
651 ACPI_FREE(aml_buffer); 651 ACPI_FREE(aml_buffer);
652 ACPI_FREE(method_obj); 652 ACPI_FREE(method_obj);
653 return status; 653 return (status);
654} 654}
655ACPI_EXPORT_SYMBOL(acpi_install_method) 655ACPI_EXPORT_SYMBOL(acpi_install_method)
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index 9d029dac6b64..c0853ef294e4 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2013, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index cb79e2d4d743..f51308cdbc65 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -108,7 +108,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
108 /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */ 108 /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
109 109
110 package_length |= (aml[0] & byte_zero_mask); 110 package_length |= (aml[0] & byte_zero_mask);
111 return_UINT32(package_length); 111 return_VALUE(package_length);
112} 112}
113 113
114/******************************************************************************* 114/*******************************************************************************
@@ -162,7 +162,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
162 162
163 /* Point past any namestring prefix characters (backslash or carat) */ 163 /* Point past any namestring prefix characters (backslash or carat) */
164 164
165 while (acpi_ps_is_prefix_char(*end)) { 165 while (ACPI_IS_ROOT_PREFIX(*end) || ACPI_IS_PARENT_PREFIX(*end)) {
166 end++; 166 end++;
167 } 167 }
168 168
@@ -798,7 +798,8 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
798 subop = acpi_ps_peek_opcode(parser_state); 798 subop = acpi_ps_peek_opcode(parser_state);
799 if (subop == 0 || 799 if (subop == 0 ||
800 acpi_ps_is_leading_char(subop) || 800 acpi_ps_is_leading_char(subop) ||
801 acpi_ps_is_prefix_char(subop)) { 801 ACPI_IS_ROOT_PREFIX(subop) ||
802 ACPI_IS_PARENT_PREFIX(subop)) {
802 803
803 /* null_name or name_string */ 804 /* null_name or name_string */
804 805
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index 5607805aab26..63c455447481 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -58,352 +58,17 @@
58#define _COMPONENT ACPI_PARSER 58#define _COMPONENT ACPI_PARSER
59ACPI_MODULE_NAME("psloop") 59ACPI_MODULE_NAME("psloop")
60 60
61static u32 acpi_gbl_depth = 0;
62
63/* Local prototypes */ 61/* Local prototypes */
64
65static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state);
66
67static acpi_status
68acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
69 u8 * aml_op_start,
70 union acpi_parse_object *unnamed_op,
71 union acpi_parse_object **op);
72
73static acpi_status
74acpi_ps_create_op(struct acpi_walk_state *walk_state,
75 u8 * aml_op_start, union acpi_parse_object **new_op);
76
77static acpi_status 62static acpi_status
78acpi_ps_get_arguments(struct acpi_walk_state *walk_state, 63acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
79 u8 * aml_op_start, union acpi_parse_object *op); 64 u8 * aml_op_start, union acpi_parse_object *op);
80 65
81static acpi_status
82acpi_ps_complete_op(struct acpi_walk_state *walk_state,
83 union acpi_parse_object **op, acpi_status status);
84
85static acpi_status
86acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
87 union acpi_parse_object *op, acpi_status status);
88
89static void 66static void
90acpi_ps_link_module_code(union acpi_parse_object *parent_op, 67acpi_ps_link_module_code(union acpi_parse_object *parent_op,
91 u8 *aml_start, u32 aml_length, acpi_owner_id owner_id); 68 u8 *aml_start, u32 aml_length, acpi_owner_id owner_id);
92 69
93/******************************************************************************* 70/*******************************************************************************
94 * 71 *
95 * FUNCTION: acpi_ps_get_aml_opcode
96 *
97 * PARAMETERS: walk_state - Current state
98 *
99 * RETURN: Status
100 *
101 * DESCRIPTION: Extract the next AML opcode from the input stream.
102 *
103 ******************************************************************************/
104
105static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
106{
107
108 ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state);
109
110 walk_state->aml_offset =
111 (u32) ACPI_PTR_DIFF(walk_state->parser_state.aml,
112 walk_state->parser_state.aml_start);
113 walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state));
114
115 /*
116 * First cut to determine what we have found:
117 * 1) A valid AML opcode
118 * 2) A name string
119 * 3) An unknown/invalid opcode
120 */
121 walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
122
123 switch (walk_state->op_info->class) {
124 case AML_CLASS_ASCII:
125 case AML_CLASS_PREFIX:
126 /*
127 * Starts with a valid prefix or ASCII char, this is a name
128 * string. Convert the bare name string to a namepath.
129 */
130 walk_state->opcode = AML_INT_NAMEPATH_OP;
131 walk_state->arg_types = ARGP_NAMESTRING;
132 break;
133
134 case AML_CLASS_UNKNOWN:
135
136 /* The opcode is unrecognized. Complain and skip unknown opcodes */
137
138 if (walk_state->pass_number == 2) {
139 ACPI_ERROR((AE_INFO,
140 "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
141 walk_state->opcode,
142 (u32)(walk_state->aml_offset +
143 sizeof(struct acpi_table_header))));
144
145 ACPI_DUMP_BUFFER(walk_state->parser_state.aml - 16, 48);
146
147#ifdef ACPI_ASL_COMPILER
148 /*
149 * This is executed for the disassembler only. Output goes
150 * to the disassembled ASL output file.
151 */
152 acpi_os_printf
153 ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
154 walk_state->opcode,
155 (u32)(walk_state->aml_offset +
156 sizeof(struct acpi_table_header)));
157
158 /* Dump the context surrounding the invalid opcode */
159
160 acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
161 aml - 16), 48, DB_BYTE_DISPLAY,
162 walk_state->aml_offset +
163 sizeof(struct acpi_table_header) -
164 16);
165 acpi_os_printf(" */\n");
166#endif
167 }
168
169 /* Increment past one-byte or two-byte opcode */
170
171 walk_state->parser_state.aml++;
172 if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */
173 walk_state->parser_state.aml++;
174 }
175
176 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
177
178 default:
179
180 /* Found opcode info, this is a normal opcode */
181
182 walk_state->parser_state.aml +=
183 acpi_ps_get_opcode_size(walk_state->opcode);
184 walk_state->arg_types = walk_state->op_info->parse_args;
185 break;
186 }
187
188 return_ACPI_STATUS(AE_OK);
189}
190
191/*******************************************************************************
192 *
193 * FUNCTION: acpi_ps_build_named_op
194 *
195 * PARAMETERS: walk_state - Current state
196 * aml_op_start - Begin of named Op in AML
197 * unnamed_op - Early Op (not a named Op)
198 * op - Returned Op
199 *
200 * RETURN: Status
201 *
202 * DESCRIPTION: Parse a named Op
203 *
204 ******************************************************************************/
205
206static acpi_status
207acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
208 u8 * aml_op_start,
209 union acpi_parse_object *unnamed_op,
210 union acpi_parse_object **op)
211{
212 acpi_status status = AE_OK;
213 union acpi_parse_object *arg = NULL;
214
215 ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state);
216
217 unnamed_op->common.value.arg = NULL;
218 unnamed_op->common.arg_list_length = 0;
219 unnamed_op->common.aml_opcode = walk_state->opcode;
220
221 /*
222 * Get and append arguments until we find the node that contains
223 * the name (the type ARGP_NAME).
224 */
225 while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) &&
226 (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) {
227 status =
228 acpi_ps_get_next_arg(walk_state,
229 &(walk_state->parser_state),
230 GET_CURRENT_ARG_TYPE(walk_state->
231 arg_types), &arg);
232 if (ACPI_FAILURE(status)) {
233 return_ACPI_STATUS(status);
234 }
235
236 acpi_ps_append_arg(unnamed_op, arg);
237 INCREMENT_ARG_LIST(walk_state->arg_types);
238 }
239
240 /*
241 * Make sure that we found a NAME and didn't run out of arguments
242 */
243 if (!GET_CURRENT_ARG_TYPE(walk_state->arg_types)) {
244 return_ACPI_STATUS(AE_AML_NO_OPERAND);
245 }
246
247 /* We know that this arg is a name, move to next arg */
248
249 INCREMENT_ARG_LIST(walk_state->arg_types);
250
251 /*
252 * Find the object. This will either insert the object into
253 * the namespace or simply look it up
254 */
255 walk_state->op = NULL;
256
257 status = walk_state->descending_callback(walk_state, op);
258 if (ACPI_FAILURE(status)) {
259 ACPI_EXCEPTION((AE_INFO, status, "During name lookup/catalog"));
260 return_ACPI_STATUS(status);
261 }
262
263 if (!*op) {
264 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
265 }
266
267 status = acpi_ps_next_parse_state(walk_state, *op, status);
268 if (ACPI_FAILURE(status)) {
269 if (status == AE_CTRL_PENDING) {
270 return_ACPI_STATUS(AE_CTRL_PARSE_PENDING);
271 }
272 return_ACPI_STATUS(status);
273 }
274
275 acpi_ps_append_arg(*op, unnamed_op->common.value.arg);
276 acpi_gbl_depth++;
277
278 if ((*op)->common.aml_opcode == AML_REGION_OP ||
279 (*op)->common.aml_opcode == AML_DATA_REGION_OP) {
280 /*
281 * Defer final parsing of an operation_region body, because we don't
282 * have enough info in the first pass to parse it correctly (i.e.,
283 * there may be method calls within the term_arg elements of the body.)
284 *
285 * However, we must continue parsing because the opregion is not a
286 * standalone package -- we don't know where the end is at this point.
287 *
288 * (Length is unknown until parse of the body complete)
289 */
290 (*op)->named.data = aml_op_start;
291 (*op)->named.length = 0;
292 }
293
294 return_ACPI_STATUS(AE_OK);
295}
296
297/*******************************************************************************
298 *
299 * FUNCTION: acpi_ps_create_op
300 *
301 * PARAMETERS: walk_state - Current state
302 * aml_op_start - Op start in AML
303 * new_op - Returned Op
304 *
305 * RETURN: Status
306 *
307 * DESCRIPTION: Get Op from AML
308 *
309 ******************************************************************************/
310
311static acpi_status
312acpi_ps_create_op(struct acpi_walk_state *walk_state,
313 u8 * aml_op_start, union acpi_parse_object **new_op)
314{
315 acpi_status status = AE_OK;
316 union acpi_parse_object *op;
317 union acpi_parse_object *named_op = NULL;
318 union acpi_parse_object *parent_scope;
319 u8 argument_count;
320 const struct acpi_opcode_info *op_info;
321
322 ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state);
323
324 status = acpi_ps_get_aml_opcode(walk_state);
325 if (status == AE_CTRL_PARSE_CONTINUE) {
326 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
327 }
328
329 /* Create Op structure and append to parent's argument list */
330
331 walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
332 op = acpi_ps_alloc_op(walk_state->opcode);
333 if (!op) {
334 return_ACPI_STATUS(AE_NO_MEMORY);
335 }
336
337 if (walk_state->op_info->flags & AML_NAMED) {
338 status =
339 acpi_ps_build_named_op(walk_state, aml_op_start, op,
340 &named_op);
341 acpi_ps_free_op(op);
342 if (ACPI_FAILURE(status)) {
343 return_ACPI_STATUS(status);
344 }
345
346 *new_op = named_op;
347 return_ACPI_STATUS(AE_OK);
348 }
349
350 /* Not a named opcode, just allocate Op and append to parent */
351
352 if (walk_state->op_info->flags & AML_CREATE) {
353 /*
354 * Backup to beginning of create_XXXfield declaration
355 * body_length is unknown until we parse the body
356 */
357 op->named.data = aml_op_start;
358 op->named.length = 0;
359 }
360
361 if (walk_state->opcode == AML_BANK_FIELD_OP) {
362 /*
363 * Backup to beginning of bank_field declaration
364 * body_length is unknown until we parse the body
365 */
366 op->named.data = aml_op_start;
367 op->named.length = 0;
368 }
369
370 parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state));
371 acpi_ps_append_arg(parent_scope, op);
372
373 if (parent_scope) {
374 op_info =
375 acpi_ps_get_opcode_info(parent_scope->common.aml_opcode);
376 if (op_info->flags & AML_HAS_TARGET) {
377 argument_count =
378 acpi_ps_get_argument_count(op_info->type);
379 if (parent_scope->common.arg_list_length >
380 argument_count) {
381 op->common.flags |= ACPI_PARSEOP_TARGET;
382 }
383 } else if (parent_scope->common.aml_opcode == AML_INCREMENT_OP) {
384 op->common.flags |= ACPI_PARSEOP_TARGET;
385 }
386 }
387
388 if (walk_state->descending_callback != NULL) {
389 /*
390 * Find the object. This will either insert the object into
391 * the namespace or simply look it up
392 */
393 walk_state->op = *new_op = op;
394
395 status = walk_state->descending_callback(walk_state, &op);
396 status = acpi_ps_next_parse_state(walk_state, op, status);
397 if (status == AE_CTRL_PENDING) {
398 status = AE_CTRL_PARSE_PENDING;
399 }
400 }
401
402 return_ACPI_STATUS(status);
403}
404
405/*******************************************************************************
406 *
407 * FUNCTION: acpi_ps_get_arguments 72 * FUNCTION: acpi_ps_get_arguments
408 * 73 *
409 * PARAMETERS: walk_state - Current state 74 * PARAMETERS: walk_state - Current state
@@ -711,288 +376,6 @@ acpi_ps_link_module_code(union acpi_parse_object *parent_op,
711 376
712/******************************************************************************* 377/*******************************************************************************
713 * 378 *
714 * FUNCTION: acpi_ps_complete_op
715 *
716 * PARAMETERS: walk_state - Current state
717 * op - Returned Op
718 * status - Parse status before complete Op
719 *
720 * RETURN: Status
721 *
722 * DESCRIPTION: Complete Op
723 *
724 ******************************************************************************/
725
726static acpi_status
727acpi_ps_complete_op(struct acpi_walk_state *walk_state,
728 union acpi_parse_object **op, acpi_status status)
729{
730 acpi_status status2;
731
732 ACPI_FUNCTION_TRACE_PTR(ps_complete_op, walk_state);
733
734 /*
735 * Finished one argument of the containing scope
736 */
737 walk_state->parser_state.scope->parse_scope.arg_count--;
738
739 /* Close this Op (will result in parse subtree deletion) */
740
741 status2 = acpi_ps_complete_this_op(walk_state, *op);
742 if (ACPI_FAILURE(status2)) {
743 return_ACPI_STATUS(status2);
744 }
745
746 *op = NULL;
747
748 switch (status) {
749 case AE_OK:
750 break;
751
752 case AE_CTRL_TRANSFER:
753
754 /* We are about to transfer to a called method */
755
756 walk_state->prev_op = NULL;
757 walk_state->prev_arg_types = walk_state->arg_types;
758 return_ACPI_STATUS(status);
759
760 case AE_CTRL_END:
761
762 acpi_ps_pop_scope(&(walk_state->parser_state), op,
763 &walk_state->arg_types,
764 &walk_state->arg_count);
765
766 if (*op) {
767 walk_state->op = *op;
768 walk_state->op_info =
769 acpi_ps_get_opcode_info((*op)->common.aml_opcode);
770 walk_state->opcode = (*op)->common.aml_opcode;
771
772 status = walk_state->ascending_callback(walk_state);
773 status =
774 acpi_ps_next_parse_state(walk_state, *op, status);
775
776 status2 = acpi_ps_complete_this_op(walk_state, *op);
777 if (ACPI_FAILURE(status2)) {
778 return_ACPI_STATUS(status2);
779 }
780 }
781
782 status = AE_OK;
783 break;
784
785 case AE_CTRL_BREAK:
786 case AE_CTRL_CONTINUE:
787
788 /* Pop off scopes until we find the While */
789
790 while (!(*op) || ((*op)->common.aml_opcode != AML_WHILE_OP)) {
791 acpi_ps_pop_scope(&(walk_state->parser_state), op,
792 &walk_state->arg_types,
793 &walk_state->arg_count);
794 }
795
796 /* Close this iteration of the While loop */
797
798 walk_state->op = *op;
799 walk_state->op_info =
800 acpi_ps_get_opcode_info((*op)->common.aml_opcode);
801 walk_state->opcode = (*op)->common.aml_opcode;
802
803 status = walk_state->ascending_callback(walk_state);
804 status = acpi_ps_next_parse_state(walk_state, *op, status);
805
806 status2 = acpi_ps_complete_this_op(walk_state, *op);
807 if (ACPI_FAILURE(status2)) {
808 return_ACPI_STATUS(status2);
809 }
810
811 status = AE_OK;
812 break;
813
814 case AE_CTRL_TERMINATE:
815
816 /* Clean up */
817 do {
818 if (*op) {
819 status2 =
820 acpi_ps_complete_this_op(walk_state, *op);
821 if (ACPI_FAILURE(status2)) {
822 return_ACPI_STATUS(status2);
823 }
824
825 acpi_ut_delete_generic_state
826 (acpi_ut_pop_generic_state
827 (&walk_state->control_state));
828 }
829
830 acpi_ps_pop_scope(&(walk_state->parser_state), op,
831 &walk_state->arg_types,
832 &walk_state->arg_count);
833
834 } while (*op);
835
836 return_ACPI_STATUS(AE_OK);
837
838 default: /* All other non-AE_OK status */
839
840 do {
841 if (*op) {
842 status2 =
843 acpi_ps_complete_this_op(walk_state, *op);
844 if (ACPI_FAILURE(status2)) {
845 return_ACPI_STATUS(status2);
846 }
847 }
848
849 acpi_ps_pop_scope(&(walk_state->parser_state), op,
850 &walk_state->arg_types,
851 &walk_state->arg_count);
852
853 } while (*op);
854
855#if 0
856 /*
857 * TBD: Cleanup parse ops on error
858 */
859 if (*op == NULL) {
860 acpi_ps_pop_scope(parser_state, op,
861 &walk_state->arg_types,
862 &walk_state->arg_count);
863 }
864#endif
865 walk_state->prev_op = NULL;
866 walk_state->prev_arg_types = walk_state->arg_types;
867 return_ACPI_STATUS(status);
868 }
869
870 /* This scope complete? */
871
872 if (acpi_ps_has_completed_scope(&(walk_state->parser_state))) {
873 acpi_ps_pop_scope(&(walk_state->parser_state), op,
874 &walk_state->arg_types,
875 &walk_state->arg_count);
876 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *op));
877 } else {
878 *op = NULL;
879 }
880
881 return_ACPI_STATUS(AE_OK);
882}
883
884/*******************************************************************************
885 *
886 * FUNCTION: acpi_ps_complete_final_op
887 *
888 * PARAMETERS: walk_state - Current state
889 * op - Current Op
890 * status - Current parse status before complete last
891 * Op
892 *
893 * RETURN: Status
894 *
895 * DESCRIPTION: Complete last Op.
896 *
897 ******************************************************************************/
898
899static acpi_status
900acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
901 union acpi_parse_object *op, acpi_status status)
902{
903 acpi_status status2;
904
905 ACPI_FUNCTION_TRACE_PTR(ps_complete_final_op, walk_state);
906
907 /*
908 * Complete the last Op (if not completed), and clear the scope stack.
909 * It is easily possible to end an AML "package" with an unbounded number
910 * of open scopes (such as when several ASL blocks are closed with
911 * sequential closing braces). We want to terminate each one cleanly.
912 */
913 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n",
914 op));
915 do {
916 if (op) {
917 if (walk_state->ascending_callback != NULL) {
918 walk_state->op = op;
919 walk_state->op_info =
920 acpi_ps_get_opcode_info(op->common.
921 aml_opcode);
922 walk_state->opcode = op->common.aml_opcode;
923
924 status =
925 walk_state->ascending_callback(walk_state);
926 status =
927 acpi_ps_next_parse_state(walk_state, op,
928 status);
929 if (status == AE_CTRL_PENDING) {
930 status =
931 acpi_ps_complete_op(walk_state, &op,
932 AE_OK);
933 if (ACPI_FAILURE(status)) {
934 return_ACPI_STATUS(status);
935 }
936 }
937
938 if (status == AE_CTRL_TERMINATE) {
939 status = AE_OK;
940
941 /* Clean up */
942 do {
943 if (op) {
944 status2 =
945 acpi_ps_complete_this_op
946 (walk_state, op);
947 if (ACPI_FAILURE
948 (status2)) {
949 return_ACPI_STATUS
950 (status2);
951 }
952 }
953
954 acpi_ps_pop_scope(&
955 (walk_state->
956 parser_state),
957 &op,
958 &walk_state->
959 arg_types,
960 &walk_state->
961 arg_count);
962
963 } while (op);
964
965 return_ACPI_STATUS(status);
966 }
967
968 else if (ACPI_FAILURE(status)) {
969
970 /* First error is most important */
971
972 (void)
973 acpi_ps_complete_this_op(walk_state,
974 op);
975 return_ACPI_STATUS(status);
976 }
977 }
978
979 status2 = acpi_ps_complete_this_op(walk_state, op);
980 if (ACPI_FAILURE(status2)) {
981 return_ACPI_STATUS(status2);
982 }
983 }
984
985 acpi_ps_pop_scope(&(walk_state->parser_state), &op,
986 &walk_state->arg_types,
987 &walk_state->arg_count);
988
989 } while (op);
990
991 return_ACPI_STATUS(status);
992}
993
994/*******************************************************************************
995 *
996 * FUNCTION: acpi_ps_parse_loop 379 * FUNCTION: acpi_ps_parse_loop
997 * 380 *
998 * PARAMETERS: walk_state - Current state 381 * PARAMETERS: walk_state - Current state
@@ -1177,10 +560,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
1177 walk_state->op_info = 560 walk_state->op_info =
1178 acpi_ps_get_opcode_info(op->common.aml_opcode); 561 acpi_ps_get_opcode_info(op->common.aml_opcode);
1179 if (walk_state->op_info->flags & AML_NAMED) { 562 if (walk_state->op_info->flags & AML_NAMED) {
1180 if (acpi_gbl_depth) {
1181 acpi_gbl_depth--;
1182 }
1183
1184 if (op->common.aml_opcode == AML_REGION_OP || 563 if (op->common.aml_opcode == AML_REGION_OP ||
1185 op->common.aml_opcode == AML_DATA_REGION_OP) { 564 op->common.aml_opcode == AML_DATA_REGION_OP) {
1186 /* 565 /*
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c
new file mode 100644
index 000000000000..12c4028002b1
--- /dev/null
+++ b/drivers/acpi/acpica/psobject.c
@@ -0,0 +1,647 @@
1/******************************************************************************
2 *
3 * Module Name: psobject - Support for parse objects
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acparser.h"
47#include "amlcode.h"
48
49#define _COMPONENT ACPI_PARSER
50ACPI_MODULE_NAME("psobject")
51
52/* Local prototypes */
53static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state);
54
55/*******************************************************************************
56 *
57 * FUNCTION: acpi_ps_get_aml_opcode
58 *
59 * PARAMETERS: walk_state - Current state
60 *
61 * RETURN: Status
62 *
63 * DESCRIPTION: Extract the next AML opcode from the input stream.
64 *
65 ******************************************************************************/
66
67static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
68{
69
70 ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state);
71
72 walk_state->aml_offset =
73 (u32)ACPI_PTR_DIFF(walk_state->parser_state.aml,
74 walk_state->parser_state.aml_start);
75 walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state));
76
77 /*
78 * First cut to determine what we have found:
79 * 1) A valid AML opcode
80 * 2) A name string
81 * 3) An unknown/invalid opcode
82 */
83 walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
84
85 switch (walk_state->op_info->class) {
86 case AML_CLASS_ASCII:
87 case AML_CLASS_PREFIX:
88 /*
89 * Starts with a valid prefix or ASCII char, this is a name
90 * string. Convert the bare name string to a namepath.
91 */
92 walk_state->opcode = AML_INT_NAMEPATH_OP;
93 walk_state->arg_types = ARGP_NAMESTRING;
94 break;
95
96 case AML_CLASS_UNKNOWN:
97
98 /* The opcode is unrecognized. Complain and skip unknown opcodes */
99
100 if (walk_state->pass_number == 2) {
101 ACPI_ERROR((AE_INFO,
102 "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
103 walk_state->opcode,
104 (u32)(walk_state->aml_offset +
105 sizeof(struct acpi_table_header))));
106
107 ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16),
108 48);
109
110#ifdef ACPI_ASL_COMPILER
111 /*
112 * This is executed for the disassembler only. Output goes
113 * to the disassembled ASL output file.
114 */
115 acpi_os_printf
116 ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
117 walk_state->opcode,
118 (u32)(walk_state->aml_offset +
119 sizeof(struct acpi_table_header)));
120
121 /* Dump the context surrounding the invalid opcode */
122
123 acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
124 aml - 16), 48, DB_BYTE_DISPLAY,
125 (walk_state->aml_offset +
126 sizeof(struct acpi_table_header) -
127 16));
128 acpi_os_printf(" */\n");
129#endif
130 }
131
132 /* Increment past one-byte or two-byte opcode */
133
134 walk_state->parser_state.aml++;
135 if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */
136 walk_state->parser_state.aml++;
137 }
138
139 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
140
141 default:
142
143 /* Found opcode info, this is a normal opcode */
144
145 walk_state->parser_state.aml +=
146 acpi_ps_get_opcode_size(walk_state->opcode);
147 walk_state->arg_types = walk_state->op_info->parse_args;
148 break;
149 }
150
151 return_ACPI_STATUS(AE_OK);
152}
153
154/*******************************************************************************
155 *
156 * FUNCTION: acpi_ps_build_named_op
157 *
158 * PARAMETERS: walk_state - Current state
159 * aml_op_start - Begin of named Op in AML
160 * unnamed_op - Early Op (not a named Op)
161 * op - Returned Op
162 *
163 * RETURN: Status
164 *
165 * DESCRIPTION: Parse a named Op
166 *
167 ******************************************************************************/
168
169acpi_status
170acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
171 u8 *aml_op_start,
172 union acpi_parse_object *unnamed_op,
173 union acpi_parse_object **op)
174{
175 acpi_status status = AE_OK;
176 union acpi_parse_object *arg = NULL;
177
178 ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state);
179
180 unnamed_op->common.value.arg = NULL;
181 unnamed_op->common.arg_list_length = 0;
182 unnamed_op->common.aml_opcode = walk_state->opcode;
183
184 /*
185 * Get and append arguments until we find the node that contains
186 * the name (the type ARGP_NAME).
187 */
188 while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) &&
189 (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) {
190 status =
191 acpi_ps_get_next_arg(walk_state,
192 &(walk_state->parser_state),
193 GET_CURRENT_ARG_TYPE(walk_state->
194 arg_types), &arg);
195 if (ACPI_FAILURE(status)) {
196 return_ACPI_STATUS(status);
197 }
198
199 acpi_ps_append_arg(unnamed_op, arg);
200 INCREMENT_ARG_LIST(walk_state->arg_types);
201 }
202
203 /*
204 * Make sure that we found a NAME and didn't run out of arguments
205 */
206 if (!GET_CURRENT_ARG_TYPE(walk_state->arg_types)) {
207 return_ACPI_STATUS(AE_AML_NO_OPERAND);
208 }
209
210 /* We know that this arg is a name, move to next arg */
211
212 INCREMENT_ARG_LIST(walk_state->arg_types);
213
214 /*
215 * Find the object. This will either insert the object into
216 * the namespace or simply look it up
217 */
218 walk_state->op = NULL;
219
220 status = walk_state->descending_callback(walk_state, op);
221 if (ACPI_FAILURE(status)) {
222 ACPI_EXCEPTION((AE_INFO, status, "During name lookup/catalog"));
223 return_ACPI_STATUS(status);
224 }
225
226 if (!*op) {
227 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
228 }
229
230 status = acpi_ps_next_parse_state(walk_state, *op, status);
231 if (ACPI_FAILURE(status)) {
232 if (status == AE_CTRL_PENDING) {
233 return_ACPI_STATUS(AE_CTRL_PARSE_PENDING);
234 }
235 return_ACPI_STATUS(status);
236 }
237
238 acpi_ps_append_arg(*op, unnamed_op->common.value.arg);
239
240 if ((*op)->common.aml_opcode == AML_REGION_OP ||
241 (*op)->common.aml_opcode == AML_DATA_REGION_OP) {
242 /*
243 * Defer final parsing of an operation_region body, because we don't
244 * have enough info in the first pass to parse it correctly (i.e.,
245 * there may be method calls within the term_arg elements of the body.)
246 *
247 * However, we must continue parsing because the opregion is not a
248 * standalone package -- we don't know where the end is at this point.
249 *
250 * (Length is unknown until parse of the body complete)
251 */
252 (*op)->named.data = aml_op_start;
253 (*op)->named.length = 0;
254 }
255
256 return_ACPI_STATUS(AE_OK);
257}
258
259/*******************************************************************************
260 *
261 * FUNCTION: acpi_ps_create_op
262 *
263 * PARAMETERS: walk_state - Current state
264 * aml_op_start - Op start in AML
265 * new_op - Returned Op
266 *
267 * RETURN: Status
268 *
269 * DESCRIPTION: Get Op from AML
270 *
271 ******************************************************************************/
272
273acpi_status
274acpi_ps_create_op(struct acpi_walk_state *walk_state,
275 u8 *aml_op_start, union acpi_parse_object **new_op)
276{
277 acpi_status status = AE_OK;
278 union acpi_parse_object *op;
279 union acpi_parse_object *named_op = NULL;
280 union acpi_parse_object *parent_scope;
281 u8 argument_count;
282 const struct acpi_opcode_info *op_info;
283
284 ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state);
285
286 status = acpi_ps_get_aml_opcode(walk_state);
287 if (status == AE_CTRL_PARSE_CONTINUE) {
288 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
289 }
290
291 /* Create Op structure and append to parent's argument list */
292
293 walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);
294 op = acpi_ps_alloc_op(walk_state->opcode);
295 if (!op) {
296 return_ACPI_STATUS(AE_NO_MEMORY);
297 }
298
299 if (walk_state->op_info->flags & AML_NAMED) {
300 status =
301 acpi_ps_build_named_op(walk_state, aml_op_start, op,
302 &named_op);
303 acpi_ps_free_op(op);
304 if (ACPI_FAILURE(status)) {
305 return_ACPI_STATUS(status);
306 }
307
308 *new_op = named_op;
309 return_ACPI_STATUS(AE_OK);
310 }
311
312 /* Not a named opcode, just allocate Op and append to parent */
313
314 if (walk_state->op_info->flags & AML_CREATE) {
315 /*
316 * Backup to beginning of create_XXXfield declaration
317 * body_length is unknown until we parse the body
318 */
319 op->named.data = aml_op_start;
320 op->named.length = 0;
321 }
322
323 if (walk_state->opcode == AML_BANK_FIELD_OP) {
324 /*
325 * Backup to beginning of bank_field declaration
326 * body_length is unknown until we parse the body
327 */
328 op->named.data = aml_op_start;
329 op->named.length = 0;
330 }
331
332 parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state));
333 acpi_ps_append_arg(parent_scope, op);
334
335 if (parent_scope) {
336 op_info =
337 acpi_ps_get_opcode_info(parent_scope->common.aml_opcode);
338 if (op_info->flags & AML_HAS_TARGET) {
339 argument_count =
340 acpi_ps_get_argument_count(op_info->type);
341 if (parent_scope->common.arg_list_length >
342 argument_count) {
343 op->common.flags |= ACPI_PARSEOP_TARGET;
344 }
345 } else if (parent_scope->common.aml_opcode == AML_INCREMENT_OP) {
346 op->common.flags |= ACPI_PARSEOP_TARGET;
347 }
348 }
349
350 if (walk_state->descending_callback != NULL) {
351 /*
352 * Find the object. This will either insert the object into
353 * the namespace or simply look it up
354 */
355 walk_state->op = *new_op = op;
356
357 status = walk_state->descending_callback(walk_state, &op);
358 status = acpi_ps_next_parse_state(walk_state, op, status);
359 if (status == AE_CTRL_PENDING) {
360 status = AE_CTRL_PARSE_PENDING;
361 }
362 }
363
364 return_ACPI_STATUS(status);
365}
366
367/*******************************************************************************
368 *
369 * FUNCTION: acpi_ps_complete_op
370 *
371 * PARAMETERS: walk_state - Current state
372 * op - Returned Op
373 * status - Parse status before complete Op
374 *
375 * RETURN: Status
376 *
377 * DESCRIPTION: Complete Op
378 *
379 ******************************************************************************/
380
381acpi_status
382acpi_ps_complete_op(struct acpi_walk_state *walk_state,
383 union acpi_parse_object **op, acpi_status status)
384{
385 acpi_status status2;
386
387 ACPI_FUNCTION_TRACE_PTR(ps_complete_op, walk_state);
388
389 /*
390 * Finished one argument of the containing scope
391 */
392 walk_state->parser_state.scope->parse_scope.arg_count--;
393
394 /* Close this Op (will result in parse subtree deletion) */
395
396 status2 = acpi_ps_complete_this_op(walk_state, *op);
397 if (ACPI_FAILURE(status2)) {
398 return_ACPI_STATUS(status2);
399 }
400
401 *op = NULL;
402
403 switch (status) {
404 case AE_OK:
405 break;
406
407 case AE_CTRL_TRANSFER:
408
409 /* We are about to transfer to a called method */
410
411 walk_state->prev_op = NULL;
412 walk_state->prev_arg_types = walk_state->arg_types;
413 return_ACPI_STATUS(status);
414
415 case AE_CTRL_END:
416
417 acpi_ps_pop_scope(&(walk_state->parser_state), op,
418 &walk_state->arg_types,
419 &walk_state->arg_count);
420
421 if (*op) {
422 walk_state->op = *op;
423 walk_state->op_info =
424 acpi_ps_get_opcode_info((*op)->common.aml_opcode);
425 walk_state->opcode = (*op)->common.aml_opcode;
426
427 status = walk_state->ascending_callback(walk_state);
428 status =
429 acpi_ps_next_parse_state(walk_state, *op, status);
430
431 status2 = acpi_ps_complete_this_op(walk_state, *op);
432 if (ACPI_FAILURE(status2)) {
433 return_ACPI_STATUS(status2);
434 }
435 }
436
437 status = AE_OK;
438 break;
439
440 case AE_CTRL_BREAK:
441 case AE_CTRL_CONTINUE:
442
443 /* Pop off scopes until we find the While */
444
445 while (!(*op) || ((*op)->common.aml_opcode != AML_WHILE_OP)) {
446 acpi_ps_pop_scope(&(walk_state->parser_state), op,
447 &walk_state->arg_types,
448 &walk_state->arg_count);
449 }
450
451 /* Close this iteration of the While loop */
452
453 walk_state->op = *op;
454 walk_state->op_info =
455 acpi_ps_get_opcode_info((*op)->common.aml_opcode);
456 walk_state->opcode = (*op)->common.aml_opcode;
457
458 status = walk_state->ascending_callback(walk_state);
459 status = acpi_ps_next_parse_state(walk_state, *op, status);
460
461 status2 = acpi_ps_complete_this_op(walk_state, *op);
462 if (ACPI_FAILURE(status2)) {
463 return_ACPI_STATUS(status2);
464 }
465
466 status = AE_OK;
467 break;
468
469 case AE_CTRL_TERMINATE:
470
471 /* Clean up */
472 do {
473 if (*op) {
474 status2 =
475 acpi_ps_complete_this_op(walk_state, *op);
476 if (ACPI_FAILURE(status2)) {
477 return_ACPI_STATUS(status2);
478 }
479
480 acpi_ut_delete_generic_state
481 (acpi_ut_pop_generic_state
482 (&walk_state->control_state));
483 }
484
485 acpi_ps_pop_scope(&(walk_state->parser_state), op,
486 &walk_state->arg_types,
487 &walk_state->arg_count);
488
489 } while (*op);
490
491 return_ACPI_STATUS(AE_OK);
492
493 default: /* All other non-AE_OK status */
494
495 do {
496 if (*op) {
497 status2 =
498 acpi_ps_complete_this_op(walk_state, *op);
499 if (ACPI_FAILURE(status2)) {
500 return_ACPI_STATUS(status2);
501 }
502 }
503
504 acpi_ps_pop_scope(&(walk_state->parser_state), op,
505 &walk_state->arg_types,
506 &walk_state->arg_count);
507
508 } while (*op);
509
510#if 0
511 /*
512 * TBD: Cleanup parse ops on error
513 */
514 if (*op == NULL) {
515 acpi_ps_pop_scope(parser_state, op,
516 &walk_state->arg_types,
517 &walk_state->arg_count);
518 }
519#endif
520 walk_state->prev_op = NULL;
521 walk_state->prev_arg_types = walk_state->arg_types;
522 return_ACPI_STATUS(status);
523 }
524
525 /* This scope complete? */
526
527 if (acpi_ps_has_completed_scope(&(walk_state->parser_state))) {
528 acpi_ps_pop_scope(&(walk_state->parser_state), op,
529 &walk_state->arg_types,
530 &walk_state->arg_count);
531 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *op));
532 } else {
533 *op = NULL;
534 }
535
536 return_ACPI_STATUS(AE_OK);
537}
538
539/*******************************************************************************
540 *
541 * FUNCTION: acpi_ps_complete_final_op
542 *
543 * PARAMETERS: walk_state - Current state
544 * op - Current Op
545 * status - Current parse status before complete last
546 * Op
547 *
548 * RETURN: Status
549 *
550 * DESCRIPTION: Complete last Op.
551 *
552 ******************************************************************************/
553
554acpi_status
555acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
556 union acpi_parse_object *op, acpi_status status)
557{
558 acpi_status status2;
559
560 ACPI_FUNCTION_TRACE_PTR(ps_complete_final_op, walk_state);
561
562 /*
563 * Complete the last Op (if not completed), and clear the scope stack.
564 * It is easily possible to end an AML "package" with an unbounded number
565 * of open scopes (such as when several ASL blocks are closed with
566 * sequential closing braces). We want to terminate each one cleanly.
567 */
568 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n",
569 op));
570 do {
571 if (op) {
572 if (walk_state->ascending_callback != NULL) {
573 walk_state->op = op;
574 walk_state->op_info =
575 acpi_ps_get_opcode_info(op->common.
576 aml_opcode);
577 walk_state->opcode = op->common.aml_opcode;
578
579 status =
580 walk_state->ascending_callback(walk_state);
581 status =
582 acpi_ps_next_parse_state(walk_state, op,
583 status);
584 if (status == AE_CTRL_PENDING) {
585 status =
586 acpi_ps_complete_op(walk_state, &op,
587 AE_OK);
588 if (ACPI_FAILURE(status)) {
589 return_ACPI_STATUS(status);
590 }
591 }
592
593 if (status == AE_CTRL_TERMINATE) {
594 status = AE_OK;
595
596 /* Clean up */
597 do {
598 if (op) {
599 status2 =
600 acpi_ps_complete_this_op
601 (walk_state, op);
602 if (ACPI_FAILURE
603 (status2)) {
604 return_ACPI_STATUS
605 (status2);
606 }
607 }
608
609 acpi_ps_pop_scope(&
610 (walk_state->
611 parser_state),
612 &op,
613 &walk_state->
614 arg_types,
615 &walk_state->
616 arg_count);
617
618 } while (op);
619
620 return_ACPI_STATUS(status);
621 }
622
623 else if (ACPI_FAILURE(status)) {
624
625 /* First error is most important */
626
627 (void)
628 acpi_ps_complete_this_op(walk_state,
629 op);
630 return_ACPI_STATUS(status);
631 }
632 }
633
634 status2 = acpi_ps_complete_this_op(walk_state, op);
635 if (ACPI_FAILURE(status2)) {
636 return_ACPI_STATUS(status2);
637 }
638 }
639
640 acpi_ps_pop_scope(&(walk_state->parser_state), &op,
641 &walk_state->arg_types,
642 &walk_state->arg_count);
643
644 } while (op);
645
646 return_ACPI_STATUS(status);
647}
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c
index 1793d934aa30..1b659e59710a 100644
--- a/drivers/acpi/acpica/psopcode.c
+++ b/drivers/acpi/acpica/psopcode.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -43,16 +43,12 @@
43 43
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h" 45#include "accommon.h"
46#include "acparser.h"
47#include "acopcode.h" 46#include "acopcode.h"
48#include "amlcode.h" 47#include "amlcode.h"
49 48
50#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
51ACPI_MODULE_NAME("psopcode") 50ACPI_MODULE_NAME("psopcode")
52 51
53static const u8 acpi_gbl_argument_count[] =
54 { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 6 };
55
56/******************************************************************************* 52/*******************************************************************************
57 * 53 *
58 * NAME: acpi_gbl_aml_op_info 54 * NAME: acpi_gbl_aml_op_info
@@ -63,7 +59,6 @@ static const u8 acpi_gbl_argument_count[] =
63 * the operand type. 59 * the operand type.
64 * 60 *
65 ******************************************************************************/ 61 ******************************************************************************/
66
67/* 62/*
68 * Summary of opcode types/flags 63 * Summary of opcode types/flags
69 * 64 *
@@ -181,7 +176,6 @@ static const u8 acpi_gbl_argument_count[] =
181 AML_CREATE_QWORD_FIELD_OP 176 AML_CREATE_QWORD_FIELD_OP
182 177
183 ******************************************************************************/ 178 ******************************************************************************/
184
185/* 179/*
186 * Master Opcode information table. A summary of everything we know about each 180 * Master Opcode information table. A summary of everything we know about each
187 * opcode, all in one place. 181 * opcode, all in one place.
@@ -656,169 +650,3 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
656 650
657/*! [End] no source code translation !*/ 651/*! [End] no source code translation !*/
658}; 652};
659
660/*
661 * This table is directly indexed by the opcodes, and returns an
662 * index into the table above
663 */
664static const u8 acpi_gbl_short_op_index[256] = {
665/* 0 1 2 3 4 5 6 7 */
666/* 8 9 A B C D E F */
667/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
668/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
669/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
670/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
671/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
672/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
673/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
674/* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
675/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
676/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
677/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
678/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
679/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
680/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
681/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
682/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
683/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
684/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
685/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
686/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
687/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
688/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
689/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
690/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
691/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
692/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
693/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
694/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
695/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
696/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
697/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
698/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
699};
700
701/*
702 * This table is indexed by the second opcode of the extended opcode
703 * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info)
704 */
705static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
706/* 0 1 2 3 4 5 6 7 */
707/* 8 9 A B C D E F */
708/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
709/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
710/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
711/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
712/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
713/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
714/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
715/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
716/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
717/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
718/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
719/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
720/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
721/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
722/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
723/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
724/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
725/* 0x88 */ 0x7C,
726};
727
728/*******************************************************************************
729 *
730 * FUNCTION: acpi_ps_get_opcode_info
731 *
732 * PARAMETERS: opcode - The AML opcode
733 *
734 * RETURN: A pointer to the info about the opcode.
735 *
736 * DESCRIPTION: Find AML opcode description based on the opcode.
737 * NOTE: This procedure must ALWAYS return a valid pointer!
738 *
739 ******************************************************************************/
740
741const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
742{
743 ACPI_FUNCTION_NAME(ps_get_opcode_info);
744
745 /*
746 * Detect normal 8-bit opcode or extended 16-bit opcode
747 */
748 if (!(opcode & 0xFF00)) {
749
750 /* Simple (8-bit) opcode: 0-255, can't index beyond table */
751
752 return (&acpi_gbl_aml_op_info
753 [acpi_gbl_short_op_index[(u8) opcode]]);
754 }
755
756 if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
757 (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
758
759 /* Valid extended (16-bit) opcode */
760
761 return (&acpi_gbl_aml_op_info
762 [acpi_gbl_long_op_index[(u8) opcode]]);
763 }
764
765 /* Unknown AML opcode */
766
767 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
768 "Unknown AML opcode [%4.4X]\n", opcode));
769
770 return (&acpi_gbl_aml_op_info[_UNK]);
771}
772
773/*******************************************************************************
774 *
775 * FUNCTION: acpi_ps_get_opcode_name
776 *
777 * PARAMETERS: opcode - The AML opcode
778 *
779 * RETURN: A pointer to the name of the opcode (ASCII String)
780 * Note: Never returns NULL.
781 *
782 * DESCRIPTION: Translate an opcode into a human-readable string
783 *
784 ******************************************************************************/
785
786char *acpi_ps_get_opcode_name(u16 opcode)
787{
788#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
789
790 const struct acpi_opcode_info *op;
791
792 op = acpi_ps_get_opcode_info(opcode);
793
794 /* Always guaranteed to return a valid pointer */
795
796 return (op->name);
797
798#else
799 return ("OpcodeName unavailable");
800
801#endif
802}
803
804/*******************************************************************************
805 *
806 * FUNCTION: acpi_ps_get_argument_count
807 *
808 * PARAMETERS: op_type - Type associated with the AML opcode
809 *
810 * RETURN: Argument count
811 *
812 * DESCRIPTION: Obtain the number of expected arguments for an AML opcode
813 *
814 ******************************************************************************/
815
816u8 acpi_ps_get_argument_count(u32 op_type)
817{
818
819 if (op_type <= AML_TYPE_EXEC_6A_0T_1R) {
820 return (acpi_gbl_argument_count[op_type]);
821 }
822
823 return (0);
824}
diff --git a/drivers/acpi/acpica/psopinfo.c b/drivers/acpi/acpica/psopinfo.c
new file mode 100644
index 000000000000..9ba5301e5751
--- /dev/null
+++ b/drivers/acpi/acpica/psopinfo.c
@@ -0,0 +1,223 @@
1/******************************************************************************
2 *
3 * Module Name: psopinfo - AML opcode information functions and dispatch tables
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acparser.h"
47#include "acopcode.h"
48#include "amlcode.h"
49
50#define _COMPONENT ACPI_PARSER
51ACPI_MODULE_NAME("psopinfo")
52
53extern const u8 acpi_gbl_short_op_index[];
54extern const u8 acpi_gbl_long_op_index[];
55
56static const u8 acpi_gbl_argument_count[] =
57 { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 6 };
58
59/*******************************************************************************
60 *
61 * FUNCTION: acpi_ps_get_opcode_info
62 *
63 * PARAMETERS: opcode - The AML opcode
64 *
65 * RETURN: A pointer to the info about the opcode.
66 *
67 * DESCRIPTION: Find AML opcode description based on the opcode.
68 * NOTE: This procedure must ALWAYS return a valid pointer!
69 *
70 ******************************************************************************/
71
72const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
73{
74 ACPI_FUNCTION_NAME(ps_get_opcode_info);
75
76 /*
77 * Detect normal 8-bit opcode or extended 16-bit opcode
78 */
79 if (!(opcode & 0xFF00)) {
80
81 /* Simple (8-bit) opcode: 0-255, can't index beyond table */
82
83 return (&acpi_gbl_aml_op_info
84 [acpi_gbl_short_op_index[(u8)opcode]]);
85 }
86
87 if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
88 (((u8)opcode) <= MAX_EXTENDED_OPCODE)) {
89
90 /* Valid extended (16-bit) opcode */
91
92 return (&acpi_gbl_aml_op_info
93 [acpi_gbl_long_op_index[(u8)opcode]]);
94 }
95
96 /* Unknown AML opcode */
97
98 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
99 "Unknown AML opcode [%4.4X]\n", opcode));
100
101 return (&acpi_gbl_aml_op_info[_UNK]);
102}
103
104/*******************************************************************************
105 *
106 * FUNCTION: acpi_ps_get_opcode_name
107 *
108 * PARAMETERS: opcode - The AML opcode
109 *
110 * RETURN: A pointer to the name of the opcode (ASCII String)
111 * Note: Never returns NULL.
112 *
113 * DESCRIPTION: Translate an opcode into a human-readable string
114 *
115 ******************************************************************************/
116
117char *acpi_ps_get_opcode_name(u16 opcode)
118{
119#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
120
121 const struct acpi_opcode_info *op;
122
123 op = acpi_ps_get_opcode_info(opcode);
124
125 /* Always guaranteed to return a valid pointer */
126
127 return (op->name);
128
129#else
130 return ("OpcodeName unavailable");
131
132#endif
133}
134
135/*******************************************************************************
136 *
137 * FUNCTION: acpi_ps_get_argument_count
138 *
139 * PARAMETERS: op_type - Type associated with the AML opcode
140 *
141 * RETURN: Argument count
142 *
143 * DESCRIPTION: Obtain the number of expected arguments for an AML opcode
144 *
145 ******************************************************************************/
146
147u8 acpi_ps_get_argument_count(u32 op_type)
148{
149
150 if (op_type <= AML_TYPE_EXEC_6A_0T_1R) {
151 return (acpi_gbl_argument_count[op_type]);
152 }
153
154 return (0);
155}
156
157/*
158 * This table is directly indexed by the opcodes It returns
159 * an index into the opcode table (acpi_gbl_aml_op_info)
160 */
161const u8 acpi_gbl_short_op_index[256] = {
162/* 0 1 2 3 4 5 6 7 */
163/* 8 9 A B C D E F */
164/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
165/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
166/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
167/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
168/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
169/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
170/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
171/* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
172/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
173/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
174/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
175/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
176/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
177/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
178/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
179/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
180/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
181/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
182/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
183/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
184/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
185/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
186/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
187/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
188/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
189/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
190/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
191/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
192/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
193/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
194/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
195/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
196};
197
198/*
199 * This table is indexed by the second opcode of the extended opcode
200 * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info)
201 */
202const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
203/* 0 1 2 3 4 5 6 7 */
204/* 8 9 A B C D E F */
205/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
206/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
207/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
208/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
209/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
210/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
211/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
212/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
213/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
214/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
215/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
216/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
217/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
218/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
219/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
220/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
221/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
222/* 0x88 */ 0x7C,
223};
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 2494caf47755..abc4c48b2edd 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c
index 608dc20dc173..6a4b6fb39f32 100644
--- a/drivers/acpi/acpica/psscope.c
+++ b/drivers/acpi/acpica/psscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c
index fdb2e71f3046..c1934bf04f0a 100644
--- a/drivers/acpi/acpica/pstree.c
+++ b/drivers/acpi/acpica/pstree.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index 4137dcb352d1..91fa73a6e55e 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -202,14 +202,6 @@ u8 acpi_ps_is_leading_char(u32 c)
202} 202}
203 203
204/* 204/*
205 * Is "c" a namestring prefix character?
206 */
207u8 acpi_ps_is_prefix_char(u32 c)
208{
209 return ((u8) (c == '\\' || c == '^'));
210}
211
212/*
213 * Get op's name (4-byte name segment) or 0 if unnamed 205 * Get op's name (4-byte name segment) or 0 if unnamed
214 */ 206 */
215#ifdef ACPI_FUTURE_USAGE 207#ifdef ACPI_FUTURE_USAGE
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c
index ab96cf47896d..abd65624754f 100644
--- a/drivers/acpi/acpica/pswalk.c
+++ b/drivers/acpi/acpica/pswalk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index 963e16225797..f68254268965 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c
index 856ff075b6ab..f3a9276ac665 100644
--- a/drivers/acpi/acpica/rsaddr.c
+++ b/drivers/acpi/acpica/rsaddr.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 147feb6aa2a0..7816d4eef04e 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -84,7 +84,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
84 bit_field &= (u16) (bit_field - 1); 84 bit_field &= (u16) (bit_field - 1);
85 } 85 }
86 86
87 return bits_set; 87 return (bits_set);
88} 88}
89 89
90/******************************************************************************* 90/*******************************************************************************
@@ -407,7 +407,9 @@ acpi_rs_get_list_length(u8 * aml_buffer,
407 407
408 /* Validate the Resource Type and Resource Length */ 408 /* Validate the Resource Type and Resource Length */
409 409
410 status = acpi_ut_validate_resource(aml_buffer, &resource_index); 410 status =
411 acpi_ut_validate_resource(NULL, aml_buffer,
412 &resource_index);
411 if (ACPI_FAILURE(status)) { 413 if (ACPI_FAILURE(status)) {
412 /* 414 /*
413 * Exit on failure. Cannot continue because the descriptor length 415 * Exit on failure. Cannot continue because the descriptor length
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 311cbc4f05fa..f8b55b426c9d 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -98,7 +98,7 @@ acpi_buffer_to_resource(u8 *aml_buffer,
98 98
99 /* Perform the AML-to-Resource conversion */ 99 /* Perform the AML-to-Resource conversion */
100 100
101 status = acpi_ut_walk_aml_resources(aml_buffer, aml_buffer_length, 101 status = acpi_ut_walk_aml_resources(NULL, aml_buffer, aml_buffer_length,
102 acpi_rs_convert_aml_to_resources, 102 acpi_rs_convert_aml_to_resources,
103 &current_resource_ptr); 103 &current_resource_ptr);
104 if (status == AE_AML_NO_RESOURCE_END_TAG) { 104 if (status == AE_AML_NO_RESOURCE_END_TAG) {
@@ -174,7 +174,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
174 /* Do the conversion */ 174 /* Do the conversion */
175 175
176 resource = output_buffer->pointer; 176 resource = output_buffer->pointer;
177 status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length, 177 status = acpi_ut_walk_aml_resources(NULL, aml_start, aml_buffer_length,
178 acpi_rs_convert_aml_to_resources, 178 acpi_rs_convert_aml_to_resources,
179 &resource); 179 &resource);
180 if (ACPI_FAILURE(status)) { 180 if (ACPI_FAILURE(status)) {
@@ -480,8 +480,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
480 status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); 480 status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed);
481 481
482 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", 482 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
483 (u32) aml_size_needed, 483 (u32)aml_size_needed, acpi_format_exception(status)));
484 acpi_format_exception(status)));
485 if (ACPI_FAILURE(status)) { 484 if (ACPI_FAILURE(status)) {
486 return_ACPI_STATUS(status); 485 return_ACPI_STATUS(status);
487 } 486 }
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index 4d11b072388c..cab51445189d 100644
--- a/drivers/acpi/acpica/rsdump.c
+++ b/drivers/acpi/acpica/rsdump.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -77,419 +77,16 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
77static void 77static void
78acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); 78acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
79 79
80#define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f)
81#define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
82#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info))
83
84/*******************************************************************************
85 *
86 * Resource Descriptor info tables
87 *
88 * Note: The first table entry must be a Title or Literal and must contain
89 * the table length (number of table entries)
90 *
91 ******************************************************************************/
92
93struct acpi_rsdump_info acpi_rs_dump_irq[7] = {
94 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
95 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length),
96 "Descriptor Length", NULL},
97 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
98 acpi_gbl_he_decode},
99 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity",
100 acpi_gbl_ll_decode},
101 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing",
102 acpi_gbl_shr_decode},
103 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count),
104 "Interrupt Count", NULL},
105 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]),
106 "Interrupt List", NULL}
107};
108
109struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
110 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
111 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
112 acpi_gbl_typ_decode},
113 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
114 acpi_gbl_bm_decode},
115 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type",
116 acpi_gbl_siz_decode},
117 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count",
118 NULL},
119 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List",
120 NULL}
121};
122
123struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = {
124 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf),
125 "Start-Dependent-Functions", NULL},
126 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length),
127 "Descriptor Length", NULL},
128 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority),
129 "Compatibility Priority", acpi_gbl_config_decode},
130 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness),
131 "Performance/Robustness", acpi_gbl_config_decode}
132};
133
134struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = {
135 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf),
136 "End-Dependent-Functions", NULL}
137};
138
139struct acpi_rsdump_info acpi_rs_dump_io[6] = {
140 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL},
141 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding",
142 acpi_gbl_io_decode},
143 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL},
144 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL},
145 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL},
146 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length",
147 NULL}
148};
149
150struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
151 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io),
152 "Fixed I/O", NULL},
153 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL},
154 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length),
155 "Address Length", NULL}
156};
157
158struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
159 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor),
160 "Vendor Specific", NULL},
161 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL},
162 {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data",
163 NULL}
164};
165
166struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
167 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag",
168 NULL}
169};
170
171struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
172 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
173 "24-Bit Memory Range", NULL},
174 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
175 "Write Protect", acpi_gbl_rw_decode},
176 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum",
177 NULL},
178 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum",
179 NULL},
180 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment",
181 NULL},
182 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length),
183 "Address Length", NULL}
184};
185
186struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
187 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
188 "32-Bit Memory Range", NULL},
189 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
190 "Write Protect", acpi_gbl_rw_decode},
191 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum",
192 NULL},
193 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum",
194 NULL},
195 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment",
196 NULL},
197 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length),
198 "Address Length", NULL}
199};
200
201struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
202 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
203 "32-Bit Fixed Memory Range", NULL},
204 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
205 "Write Protect", acpi_gbl_rw_decode},
206 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address",
207 NULL},
208 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length),
209 "Address Length", NULL}
210};
211
212struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
213 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
214 "16-Bit WORD Address Space", NULL},
215 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
216 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity",
217 NULL},
218 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum",
219 NULL},
220 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum",
221 NULL},
222 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset),
223 "Translation Offset", NULL},
224 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length),
225 "Address Length", NULL},
226 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL}
227};
228
229struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
230 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
231 "32-Bit DWORD Address Space", NULL},
232 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
233 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity",
234 NULL},
235 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum",
236 NULL},
237 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum",
238 NULL},
239 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset),
240 "Translation Offset", NULL},
241 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length),
242 "Address Length", NULL},
243 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL}
244};
245
246struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
247 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
248 "64-Bit QWORD Address Space", NULL},
249 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
250 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity",
251 NULL},
252 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum",
253 NULL},
254 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum",
255 NULL},
256 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset),
257 "Translation Offset", NULL},
258 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length),
259 "Address Length", NULL},
260 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL}
261};
262
263struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
264 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
265 "64-Bit Extended Address Space", NULL},
266 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
267 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity),
268 "Granularity", NULL},
269 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum),
270 "Address Minimum", NULL},
271 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum),
272 "Address Maximum", NULL},
273 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset),
274 "Translation Offset", NULL},
275 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length),
276 "Address Length", NULL},
277 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific),
278 "Type-Specific Attribute", NULL}
279};
280
281struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
282 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq),
283 "Extended IRQ", NULL},
284 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
285 "Type", acpi_gbl_consume_decode},
286 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering),
287 "Triggering", acpi_gbl_he_decode},
288 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity",
289 acpi_gbl_ll_decode},
290 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing",
291 acpi_gbl_shr_decode},
292 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL,
293 NULL},
294 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count),
295 "Interrupt Count", NULL},
296 {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]),
297 "Interrupt List", NULL}
298};
299
300struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
301 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg),
302 "Generic Register", NULL},
303 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID",
304 NULL},
305 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width",
306 NULL},
307 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset",
308 NULL},
309 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size),
310 "Access Size", NULL},
311 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL}
312};
313
314struct acpi_rsdump_info acpi_rs_dump_gpio[16] = {
315 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL},
316 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL},
317 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type),
318 "ConnectionType", acpi_gbl_ct_decode},
319 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.producer_consumer),
320 "ProducerConsumer", acpi_gbl_consume_decode},
321 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.pin_config), "PinConfig",
322 acpi_gbl_ppc_decode},
323 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.sharable), "Sharable",
324 acpi_gbl_shr_decode},
325 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.io_restriction),
326 "IoRestriction", acpi_gbl_ior_decode},
327 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.triggering), "Triggering",
328 acpi_gbl_he_decode},
329 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.polarity), "Polarity",
330 acpi_gbl_ll_decode},
331 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.drive_strength), "DriveStrength",
332 NULL},
333 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.debounce_timeout),
334 "DebounceTimeout", NULL},
335 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(gpio.resource_source),
336 "ResourceSource", NULL},
337 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.pin_table_length),
338 "PinTableLength", NULL},
339 {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET(gpio.pin_table), "PinTable", NULL},
340 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.vendor_length), "VendorLength",
341 NULL},
342 {ACPI_RSD_SHORTLISTX, ACPI_RSD_OFFSET(gpio.vendor_data), "VendorData",
343 NULL},
344};
345
346struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
347 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma),
348 "FixedDma", NULL},
349 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines),
350 "RequestLines", NULL},
351 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.channels), "Channels",
352 NULL},
353 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_dma.width), "TransferWidth",
354 acpi_gbl_dts_decode},
355};
356
357#define ACPI_RS_DUMP_COMMON_SERIAL_BUS \
358 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.revision_id), "RevisionId", NULL}, \
359 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \
360 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \
361 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \
362 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \
363 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \
364 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \
365 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \
366 {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL},
367
368struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = {
369 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus),
370 "Common Serial Bus", NULL},
371 ACPI_RS_DUMP_COMMON_SERIAL_BUS
372};
373
374struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = {
375 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus),
376 "I2C Serial Bus", NULL},
377 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
378 ACPI_RSD_OFFSET(i2c_serial_bus.
379 access_mode),
380 "AccessMode", acpi_gbl_am_decode},
381 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(i2c_serial_bus.connection_speed),
382 "ConnectionSpeed", NULL},
383 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(i2c_serial_bus.slave_address),
384 "SlaveAddress", NULL},
385};
386
387struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = {
388 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus),
389 "Spi Serial Bus", NULL},
390 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
391 ACPI_RSD_OFFSET(spi_serial_bus.
392 wire_mode), "WireMode",
393 acpi_gbl_wm_decode},
394 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(spi_serial_bus.device_polarity),
395 "DevicePolarity", acpi_gbl_dp_decode},
396 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.data_bit_length),
397 "DataBitLength", NULL},
398 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_phase),
399 "ClockPhase", acpi_gbl_cph_decode},
400 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_polarity),
401 "ClockPolarity", acpi_gbl_cpo_decode},
402 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(spi_serial_bus.device_selection),
403 "DeviceSelection", NULL},
404 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(spi_serial_bus.connection_speed),
405 "ConnectionSpeed", NULL},
406};
407
408struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = {
409 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus),
410 "Uart Serial Bus", NULL},
411 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG,
412 ACPI_RSD_OFFSET(uart_serial_bus.
413 flow_control),
414 "FlowControl", acpi_gbl_fc_decode},
415 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.stop_bits),
416 "StopBits", acpi_gbl_sb_decode},
417 {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.data_bits),
418 "DataBits", acpi_gbl_bpb_decode},
419 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.endian), "Endian",
420 acpi_gbl_ed_decode},
421 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.parity), "Parity",
422 acpi_gbl_pt_decode},
423 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.lines_enabled),
424 "LinesEnabled", NULL},
425 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.rx_fifo_size),
426 "RxFifoSize", NULL},
427 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.tx_fifo_size),
428 "TxFifoSize", NULL},
429 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(uart_serial_bus.default_baud_rate),
430 "ConnectionSpeed", NULL},
431};
432
433/*
434 * Tables used for common address descriptor flag fields
435 */
436static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
437 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL,
438 NULL},
439 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
440 "Consumer/Producer", acpi_gbl_consume_decode},
441 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode",
442 acpi_gbl_dec_decode},
443 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed),
444 "Min Relocatability", acpi_gbl_min_decode},
445 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed),
446 "Max Relocatability", acpi_gbl_max_decode}
447};
448
449static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
450 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
451 "Resource Type", (void *)"Memory Range"},
452 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
453 "Write Protect", acpi_gbl_rw_decode},
454 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
455 "Caching", acpi_gbl_mem_decode},
456 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type),
457 "Range Type", acpi_gbl_mtp_decode},
458 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation),
459 "Translation", acpi_gbl_ttp_decode}
460};
461
462static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
463 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
464 "Resource Type", (void *)"I/O Range"},
465 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
466 "Range Type", acpi_gbl_rng_decode},
467 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
468 "Translation", acpi_gbl_ttp_decode},
469 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type),
470 "Translation Type", acpi_gbl_trs_decode}
471};
472
473/*
474 * Table used to dump _PRT contents
475 */
476static struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
477 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL},
478 {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL},
479 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL},
480 {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL},
481 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL}
482};
483
484/******************************************************************************* 80/*******************************************************************************
485 * 81 *
486 * FUNCTION: acpi_rs_dump_descriptor 82 * FUNCTION: acpi_rs_dump_descriptor
487 * 83 *
488 * PARAMETERS: Resource 84 * PARAMETERS: resource - Buffer containing the resource
85 * table - Table entry to decode the resource
489 * 86 *
490 * RETURN: None 87 * RETURN: None
491 * 88 *
492 * DESCRIPTION: 89 * DESCRIPTION: Dump a resource descriptor based on a dump table entry.
493 * 90 *
494 ******************************************************************************/ 91 ******************************************************************************/
495 92
@@ -654,7 +251,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
654 /* 251 /*
655 * Optional resource_source for Address resources 252 * Optional resource_source for Address resources
656 */ 253 */
657 acpi_rs_dump_resource_source(ACPI_CAST_PTR(struct 254 acpi_rs_dump_resource_source(ACPI_CAST_PTR
255 (struct
658 acpi_resource_source, 256 acpi_resource_source,
659 target)); 257 target));
660 break; 258 break;
@@ -765,8 +363,9 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
765 363
766 ACPI_FUNCTION_ENTRY(); 364 ACPI_FUNCTION_ENTRY();
767 365
768 if (!(acpi_dbg_level & ACPI_LV_RESOURCES) 366 /* Check if debug output enabled */
769 || !(_COMPONENT & acpi_dbg_layer)) { 367
368 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
770 return; 369 return;
771 } 370 }
772 371
@@ -827,8 +426,9 @@ void acpi_rs_dump_irq_list(u8 * route_table)
827 426
828 ACPI_FUNCTION_ENTRY(); 427 ACPI_FUNCTION_ENTRY();
829 428
830 if (!(acpi_dbg_level & ACPI_LV_RESOURCES) 429 /* Check if debug output enabled */
831 || !(_COMPONENT & acpi_dbg_layer)) { 430
431 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
832 return; 432 return;
833 } 433 }
834 434
diff --git a/drivers/acpi/acpica/rsdumpinfo.c b/drivers/acpi/acpica/rsdumpinfo.c
new file mode 100644
index 000000000000..46192bd53653
--- /dev/null
+++ b/drivers/acpi/acpica/rsdumpinfo.c
@@ -0,0 +1,454 @@
1/*******************************************************************************
2 *
3 * Module Name: rsdumpinfo - Tables used to display resource descriptors.
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acresrc.h"
47
48#define _COMPONENT ACPI_RESOURCES
49ACPI_MODULE_NAME("rsdumpinfo")
50
51#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
52#define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f)
53#define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
54#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info))
55/*******************************************************************************
56 *
57 * Resource Descriptor info tables
58 *
59 * Note: The first table entry must be a Title or Literal and must contain
60 * the table length (number of table entries)
61 *
62 ******************************************************************************/
63struct acpi_rsdump_info acpi_rs_dump_irq[7] = {
64 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
65 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length),
66 "Descriptor Length", NULL},
67 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
68 acpi_gbl_he_decode},
69 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity",
70 acpi_gbl_ll_decode},
71 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing",
72 acpi_gbl_shr_decode},
73 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count),
74 "Interrupt Count", NULL},
75 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]),
76 "Interrupt List", NULL}
77};
78
79struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
80 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
81 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
82 acpi_gbl_typ_decode},
83 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
84 acpi_gbl_bm_decode},
85 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type",
86 acpi_gbl_siz_decode},
87 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count",
88 NULL},
89 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List",
90 NULL}
91};
92
93struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = {
94 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf),
95 "Start-Dependent-Functions", NULL},
96 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length),
97 "Descriptor Length", NULL},
98 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority),
99 "Compatibility Priority", acpi_gbl_config_decode},
100 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness),
101 "Performance/Robustness", acpi_gbl_config_decode}
102};
103
104struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = {
105 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf),
106 "End-Dependent-Functions", NULL}
107};
108
109struct acpi_rsdump_info acpi_rs_dump_io[6] = {
110 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL},
111 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding",
112 acpi_gbl_io_decode},
113 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL},
114 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL},
115 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL},
116 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length",
117 NULL}
118};
119
120struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
121 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io),
122 "Fixed I/O", NULL},
123 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL},
124 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length),
125 "Address Length", NULL}
126};
127
128struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
129 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor),
130 "Vendor Specific", NULL},
131 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL},
132 {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data",
133 NULL}
134};
135
136struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
137 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag",
138 NULL}
139};
140
141struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
142 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
143 "24-Bit Memory Range", NULL},
144 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
145 "Write Protect", acpi_gbl_rw_decode},
146 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum",
147 NULL},
148 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum",
149 NULL},
150 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment",
151 NULL},
152 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length),
153 "Address Length", NULL}
154};
155
156struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
157 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
158 "32-Bit Memory Range", NULL},
159 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
160 "Write Protect", acpi_gbl_rw_decode},
161 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum",
162 NULL},
163 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum",
164 NULL},
165 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment",
166 NULL},
167 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length),
168 "Address Length", NULL}
169};
170
171struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
172 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
173 "32-Bit Fixed Memory Range", NULL},
174 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
175 "Write Protect", acpi_gbl_rw_decode},
176 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address",
177 NULL},
178 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length),
179 "Address Length", NULL}
180};
181
182struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
183 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
184 "16-Bit WORD Address Space", NULL},
185 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
186 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity",
187 NULL},
188 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum",
189 NULL},
190 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum",
191 NULL},
192 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset),
193 "Translation Offset", NULL},
194 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length),
195 "Address Length", NULL},
196 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL}
197};
198
199struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
200 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
201 "32-Bit DWORD Address Space", NULL},
202 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
203 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity",
204 NULL},
205 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum",
206 NULL},
207 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum",
208 NULL},
209 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset),
210 "Translation Offset", NULL},
211 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length),
212 "Address Length", NULL},
213 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL}
214};
215
216struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
217 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
218 "64-Bit QWORD Address Space", NULL},
219 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
220 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity",
221 NULL},
222 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum",
223 NULL},
224 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum",
225 NULL},
226 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset),
227 "Translation Offset", NULL},
228 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length),
229 "Address Length", NULL},
230 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL}
231};
232
233struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
234 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
235 "64-Bit Extended Address Space", NULL},
236 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
237 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity),
238 "Granularity", NULL},
239 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum),
240 "Address Minimum", NULL},
241 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum),
242 "Address Maximum", NULL},
243 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset),
244 "Translation Offset", NULL},
245 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length),
246 "Address Length", NULL},
247 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific),
248 "Type-Specific Attribute", NULL}
249};
250
251struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
252 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq),
253 "Extended IRQ", NULL},
254 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
255 "Type", acpi_gbl_consume_decode},
256 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering),
257 "Triggering", acpi_gbl_he_decode},
258 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity",
259 acpi_gbl_ll_decode},
260 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing",
261 acpi_gbl_shr_decode},
262 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL,
263 NULL},
264 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count),
265 "Interrupt Count", NULL},
266 {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]),
267 "Interrupt List", NULL}
268};
269
270struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
271 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg),
272 "Generic Register", NULL},
273 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID",
274 NULL},
275 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width",
276 NULL},
277 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset",
278 NULL},
279 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size),
280 "Access Size", NULL},
281 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL}
282};
283
284struct acpi_rsdump_info acpi_rs_dump_gpio[16] = {
285 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL},
286 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL},
287 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type),
288 "ConnectionType", acpi_gbl_ct_decode},
289 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.producer_consumer),
290 "ProducerConsumer", acpi_gbl_consume_decode},
291 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.pin_config), "PinConfig",
292 acpi_gbl_ppc_decode},
293 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.sharable), "Sharing",
294 acpi_gbl_shr_decode},
295 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.io_restriction),
296 "IoRestriction", acpi_gbl_ior_decode},
297 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.triggering), "Triggering",
298 acpi_gbl_he_decode},
299 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.polarity), "Polarity",
300 acpi_gbl_ll_decode},
301 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.drive_strength), "DriveStrength",
302 NULL},
303 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.debounce_timeout),
304 "DebounceTimeout", NULL},
305 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(gpio.resource_source),
306 "ResourceSource", NULL},
307 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.pin_table_length),
308 "PinTableLength", NULL},
309 {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET(gpio.pin_table), "PinTable", NULL},
310 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.vendor_length), "VendorLength",
311 NULL},
312 {ACPI_RSD_SHORTLISTX, ACPI_RSD_OFFSET(gpio.vendor_data), "VendorData",
313 NULL},
314};
315
316struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
317 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma),
318 "FixedDma", NULL},
319 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines),
320 "RequestLines", NULL},
321 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.channels), "Channels",
322 NULL},
323 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_dma.width), "TransferWidth",
324 acpi_gbl_dts_decode},
325};
326
327#define ACPI_RS_DUMP_COMMON_SERIAL_BUS \
328 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.revision_id), "RevisionId", NULL}, \
329 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \
330 {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.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \
332 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \
333 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \
334 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \
335 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \
336 {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL},
337
338struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = {
339 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus),
340 "Common Serial Bus", NULL},
341 ACPI_RS_DUMP_COMMON_SERIAL_BUS
342};
343
344struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = {
345 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus),
346 "I2C Serial Bus", NULL},
347 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
348 ACPI_RSD_OFFSET(i2c_serial_bus.
349 access_mode),
350 "AccessMode", acpi_gbl_am_decode},
351 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(i2c_serial_bus.connection_speed),
352 "ConnectionSpeed", NULL},
353 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(i2c_serial_bus.slave_address),
354 "SlaveAddress", NULL},
355};
356
357struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = {
358 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus),
359 "Spi Serial Bus", NULL},
360 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
361 ACPI_RSD_OFFSET(spi_serial_bus.
362 wire_mode), "WireMode",
363 acpi_gbl_wm_decode},
364 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(spi_serial_bus.device_polarity),
365 "DevicePolarity", acpi_gbl_dp_decode},
366 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.data_bit_length),
367 "DataBitLength", NULL},
368 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_phase),
369 "ClockPhase", acpi_gbl_cph_decode},
370 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_polarity),
371 "ClockPolarity", acpi_gbl_cpo_decode},
372 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(spi_serial_bus.device_selection),
373 "DeviceSelection", NULL},
374 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(spi_serial_bus.connection_speed),
375 "ConnectionSpeed", NULL},
376};
377
378struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = {
379 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus),
380 "Uart Serial Bus", NULL},
381 ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG,
382 ACPI_RSD_OFFSET(uart_serial_bus.
383 flow_control),
384 "FlowControl", acpi_gbl_fc_decode},
385 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.stop_bits),
386 "StopBits", acpi_gbl_sb_decode},
387 {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.data_bits),
388 "DataBits", acpi_gbl_bpb_decode},
389 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.endian), "Endian",
390 acpi_gbl_ed_decode},
391 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.parity), "Parity",
392 acpi_gbl_pt_decode},
393 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.lines_enabled),
394 "LinesEnabled", NULL},
395 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.rx_fifo_size),
396 "RxFifoSize", NULL},
397 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.tx_fifo_size),
398 "TxFifoSize", NULL},
399 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(uart_serial_bus.default_baud_rate),
400 "ConnectionSpeed", NULL},
401};
402
403/*
404 * Tables used for common address descriptor flag fields
405 */
406struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
407 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL,
408 NULL},
409 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
410 "Consumer/Producer", acpi_gbl_consume_decode},
411 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode",
412 acpi_gbl_dec_decode},
413 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed),
414 "Min Relocatability", acpi_gbl_min_decode},
415 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed),
416 "Max Relocatability", acpi_gbl_max_decode}
417};
418
419struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
420 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
421 "Resource Type", (void *)"Memory Range"},
422 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
423 "Write Protect", acpi_gbl_rw_decode},
424 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
425 "Caching", acpi_gbl_mem_decode},
426 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type),
427 "Range Type", acpi_gbl_mtp_decode},
428 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation),
429 "Translation", acpi_gbl_ttp_decode}
430};
431
432struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
433 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
434 "Resource Type", (void *)"I/O Range"},
435 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
436 "Range Type", acpi_gbl_rng_decode},
437 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
438 "Translation", acpi_gbl_ttp_decode},
439 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type),
440 "Translation Type", acpi_gbl_trs_decode}
441};
442
443/*
444 * Table used to dump _PRT contents
445 */
446struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
447 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL},
448 {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL},
449 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL},
450 {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL},
451 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL}
452};
453
454#endif
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c
index a9fa5158200b..41fed78e0de6 100644
--- a/drivers/acpi/acpica/rsinfo.c
+++ b/drivers/acpi/acpica/rsinfo.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c
index f6a081057a22..ca183755a6f9 100644
--- a/drivers/acpi/acpica/rsio.c
+++ b/drivers/acpi/acpica/rsio.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c
index e23a9ec248cb..364decc1028a 100644
--- a/drivers/acpi/acpica/rsirq.c
+++ b/drivers/acpi/acpica/rsirq.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("rsirq")
53 * acpi_rs_get_irq 53 * acpi_rs_get_irq
54 * 54 *
55 ******************************************************************************/ 55 ******************************************************************************/
56struct acpi_rsconvert_info acpi_rs_get_irq[8] = { 56struct acpi_rsconvert_info acpi_rs_get_irq[9] = {
57 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, 57 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ,
58 ACPI_RS_SIZE(struct acpi_resource_irq), 58 ACPI_RS_SIZE(struct acpi_resource_irq),
59 ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, 59 ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)},
@@ -80,7 +80,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
80 80
81 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, 81 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3},
82 82
83 /* Get flags: Triggering[0], Polarity[3], Sharing[4] */ 83 /* Get flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */
84 84
85 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), 85 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
86 AML_OFFSET(irq.flags), 86 AML_OFFSET(irq.flags),
@@ -92,7 +92,11 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
92 92
93 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), 93 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
94 AML_OFFSET(irq.flags), 94 AML_OFFSET(irq.flags),
95 4} 95 4},
96
97 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.wake_capable),
98 AML_OFFSET(irq.flags),
99 5}
96}; 100};
97 101
98/******************************************************************************* 102/*******************************************************************************
@@ -101,7 +105,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
101 * 105 *
102 ******************************************************************************/ 106 ******************************************************************************/
103 107
104struct acpi_rsconvert_info acpi_rs_set_irq[13] = { 108struct acpi_rsconvert_info acpi_rs_set_irq[14] = {
105 /* Start with a default descriptor of length 3 */ 109 /* Start with a default descriptor of length 3 */
106 110
107 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, 111 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ,
@@ -114,7 +118,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
114 AML_OFFSET(irq.irq_mask), 118 AML_OFFSET(irq.irq_mask),
115 ACPI_RS_OFFSET(data.irq.interrupt_count)}, 119 ACPI_RS_OFFSET(data.irq.interrupt_count)},
116 120
117 /* Set the flags byte */ 121 /* Set flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */
118 122
119 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), 123 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
120 AML_OFFSET(irq.flags), 124 AML_OFFSET(irq.flags),
@@ -128,6 +132,10 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
128 AML_OFFSET(irq.flags), 132 AML_OFFSET(irq.flags),
129 4}, 133 4},
130 134
135 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.wake_capable),
136 AML_OFFSET(irq.flags),
137 5},
138
131 /* 139 /*
132 * All done if the output descriptor length is required to be 3 140 * All done if the output descriptor length is required to be 3
133 * (i.e., optimization to 2 bytes cannot be attempted) 141 * (i.e., optimization to 2 bytes cannot be attempted)
@@ -181,7 +189,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
181 * 189 *
182 ******************************************************************************/ 190 ******************************************************************************/
183 191
184struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = { 192struct acpi_rsconvert_info acpi_rs_convert_ext_irq[10] = {
185 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, 193 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ,
186 ACPI_RS_SIZE(struct acpi_resource_extended_irq), 194 ACPI_RS_SIZE(struct acpi_resource_extended_irq),
187 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)}, 195 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)},
@@ -190,8 +198,10 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
190 sizeof(struct aml_resource_extended_irq), 198 sizeof(struct aml_resource_extended_irq),
191 0}, 199 0},
192 200
193 /* Flag bits */ 201 /*
194 202 * Flags: Producer/Consumer[0], Triggering[1], Polarity[2],
203 * Sharing[3], Wake[4]
204 */
195 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer), 205 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer),
196 AML_OFFSET(extended_irq.flags), 206 AML_OFFSET(extended_irq.flags),
197 0}, 207 0},
@@ -208,19 +218,21 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
208 AML_OFFSET(extended_irq.flags), 218 AML_OFFSET(extended_irq.flags),
209 3}, 219 3},
210 220
221 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.wake_capable),
222 AML_OFFSET(extended_irq.flags),
223 4},
224
211 /* IRQ Table length (Byte4) */ 225 /* IRQ Table length (Byte4) */
212 226
213 {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count), 227 {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count),
214 AML_OFFSET(extended_irq.interrupt_count), 228 AML_OFFSET(extended_irq.interrupt_count),
215 sizeof(u32)} 229 sizeof(u32)},
216 ,
217 230
218 /* Copy every IRQ in the table, each is 32 bits */ 231 /* Copy every IRQ in the table, each is 32 bits */
219 232
220 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), 233 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]),
221 AML_OFFSET(extended_irq.interrupts[0]), 234 AML_OFFSET(extended_irq.interrupts[0]),
222 0} 235 0},
223 ,
224 236
225 /* Optional resource_source (Index and String) */ 237 /* Optional resource_source (Index and String) */
226 238
@@ -285,7 +297,6 @@ struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = {
285 * request_lines 297 * request_lines
286 * Channels 298 * Channels
287 */ 299 */
288
289 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_dma.request_lines), 300 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_dma.request_lines),
290 AML_OFFSET(fixed_dma.request_lines), 301 AML_OFFSET(fixed_dma.request_lines),
291 2}, 302 2},
@@ -293,5 +304,4 @@ struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = {
293 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_dma.width), 304 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_dma.width),
294 AML_OFFSET(fixed_dma.width), 305 AML_OFFSET(fixed_dma.width),
295 1}, 306 1},
296
297}; 307};
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 8b64db9a3fd2..ee2e206fc6c8 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -217,9 +217,10 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
217 217
218 /* Perform final sanity check on the new AML resource descriptor */ 218 /* Perform final sanity check on the new AML resource descriptor */
219 219
220 status = 220 status = acpi_ut_validate_resource(NULL,
221 acpi_ut_validate_resource(ACPI_CAST_PTR 221 ACPI_CAST_PTR(union
222 (union aml_resource, aml), NULL); 222 aml_resource,
223 aml), NULL);
223 if (ACPI_FAILURE(status)) { 224 if (ACPI_FAILURE(status)) {
224 return_ACPI_STATUS(status); 225 return_ACPI_STATUS(status);
225 } 226 }
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c
index 4fd611ad02b4..ebc773a1b350 100644
--- a/drivers/acpi/acpica/rsmemory.c
+++ b/drivers/acpi/acpica/rsmemory.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -156,8 +156,7 @@ struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = {
156 156
157 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), 157 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
158 0, 158 0,
159 sizeof(u8)} 159 sizeof(u8)},
160 ,
161 160
162 /* Vendor data */ 161 /* Vendor data */
163 162
@@ -181,8 +180,7 @@ struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = {
181 180
182 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), 181 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
183 0, 182 0,
184 sizeof(u8)} 183 sizeof(u8)},
185 ,
186 184
187 /* Vendor data */ 185 /* Vendor data */
188 186
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c
index c6f291c2bc83..d5bf05a96096 100644
--- a/drivers/acpi/acpica/rsmisc.c
+++ b/drivers/acpi/acpica/rsmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -136,30 +136,30 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
136 /* 136 /*
137 * Mask and shift the flag bit 137 * Mask and shift the flag bit
138 */ 138 */
139 ACPI_SET8(destination) = (u8) 139 ACPI_SET8(destination,
140 ((ACPI_GET8(source) >> info->value) & 0x01); 140 ((ACPI_GET8(source) >> info->value) & 0x01));
141 break; 141 break;
142 142
143 case ACPI_RSC_2BITFLAG: 143 case ACPI_RSC_2BITFLAG:
144 /* 144 /*
145 * Mask and shift the flag bits 145 * Mask and shift the flag bits
146 */ 146 */
147 ACPI_SET8(destination) = (u8) 147 ACPI_SET8(destination,
148 ((ACPI_GET8(source) >> info->value) & 0x03); 148 ((ACPI_GET8(source) >> info->value) & 0x03));
149 break; 149 break;
150 150
151 case ACPI_RSC_3BITFLAG: 151 case ACPI_RSC_3BITFLAG:
152 /* 152 /*
153 * Mask and shift the flag bits 153 * Mask and shift the flag bits
154 */ 154 */
155 ACPI_SET8(destination) = (u8) 155 ACPI_SET8(destination,
156 ((ACPI_GET8(source) >> info->value) & 0x07); 156 ((ACPI_GET8(source) >> info->value) & 0x07));
157 break; 157 break;
158 158
159 case ACPI_RSC_COUNT: 159 case ACPI_RSC_COUNT:
160 160
161 item_count = ACPI_GET8(source); 161 item_count = ACPI_GET8(source);
162 ACPI_SET8(destination) = (u8) item_count; 162 ACPI_SET8(destination, item_count);
163 163
164 resource->length = resource->length + 164 resource->length = resource->length +
165 (info->value * (item_count - 1)); 165 (info->value * (item_count - 1));
@@ -168,7 +168,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
168 case ACPI_RSC_COUNT16: 168 case ACPI_RSC_COUNT16:
169 169
170 item_count = aml_resource_length; 170 item_count = aml_resource_length;
171 ACPI_SET16(destination) = item_count; 171 ACPI_SET16(destination, item_count);
172 172
173 resource->length = resource->length + 173 resource->length = resource->length +
174 (info->value * (item_count - 1)); 174 (info->value * (item_count - 1));
@@ -181,13 +181,13 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
181 181
182 resource->length = resource->length + item_count; 182 resource->length = resource->length + item_count;
183 item_count = item_count / 2; 183 item_count = item_count / 2;
184 ACPI_SET16(destination) = item_count; 184 ACPI_SET16(destination, item_count);
185 break; 185 break;
186 186
187 case ACPI_RSC_COUNT_GPIO_VEN: 187 case ACPI_RSC_COUNT_GPIO_VEN:
188 188
189 item_count = ACPI_GET8(source); 189 item_count = ACPI_GET8(source);
190 ACPI_SET8(destination) = (u8)item_count; 190 ACPI_SET8(destination, item_count);
191 191
192 resource->length = resource->length + 192 resource->length = resource->length +
193 (info->value * item_count); 193 (info->value * item_count);
@@ -216,7 +216,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
216 } 216 }
217 217
218 resource->length = resource->length + item_count; 218 resource->length = resource->length + item_count;
219 ACPI_SET16(destination) = item_count; 219 ACPI_SET16(destination, item_count);
220 break; 220 break;
221 221
222 case ACPI_RSC_COUNT_SERIAL_VEN: 222 case ACPI_RSC_COUNT_SERIAL_VEN:
@@ -224,7 +224,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
224 item_count = ACPI_GET16(source) - info->value; 224 item_count = ACPI_GET16(source) - info->value;
225 225
226 resource->length = resource->length + item_count; 226 resource->length = resource->length + item_count;
227 ACPI_SET16(destination) = item_count; 227 ACPI_SET16(destination, item_count);
228 break; 228 break;
229 229
230 case ACPI_RSC_COUNT_SERIAL_RES: 230 case ACPI_RSC_COUNT_SERIAL_RES:
@@ -234,7 +234,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
234 - ACPI_GET16(source) - info->value; 234 - ACPI_GET16(source) - info->value;
235 235
236 resource->length = resource->length + item_count; 236 resource->length = resource->length + item_count;
237 ACPI_SET16(destination) = item_count; 237 ACPI_SET16(destination, item_count);
238 break; 238 break;
239 239
240 case ACPI_RSC_LENGTH: 240 case ACPI_RSC_LENGTH:
@@ -385,7 +385,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
385 } 385 }
386 386
387 target = ACPI_ADD_PTR(char, resource, info->value); 387 target = ACPI_ADD_PTR(char, resource, info->value);
388 ACPI_SET8(target) = (u8) item_count; 388 ACPI_SET8(target, item_count);
389 break; 389 break;
390 390
391 case ACPI_RSC_BITMASK16: 391 case ACPI_RSC_BITMASK16:
@@ -401,7 +401,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
401 } 401 }
402 402
403 target = ACPI_ADD_PTR(char, resource, info->value); 403 target = ACPI_ADD_PTR(char, resource, info->value);
404 ACPI_SET8(target) = (u8) item_count; 404 ACPI_SET8(target, item_count);
405 break; 405 break;
406 406
407 case ACPI_RSC_EXIT_NE: 407 case ACPI_RSC_EXIT_NE:
@@ -514,37 +514,40 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
514 /* 514 /*
515 * Clear the flag byte 515 * Clear the flag byte
516 */ 516 */
517 ACPI_SET8(destination) = 0; 517 ACPI_SET8(destination, 0);
518 break; 518 break;
519 519
520 case ACPI_RSC_1BITFLAG: 520 case ACPI_RSC_1BITFLAG:
521 /* 521 /*
522 * Mask and shift the flag bit 522 * Mask and shift the flag bit
523 */ 523 */
524 ACPI_SET8(destination) |= (u8) 524 ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
525 ((ACPI_GET8(source) & 0x01) << info->value); 525 ((ACPI_GET8(source) & 0x01) << info->
526 value));
526 break; 527 break;
527 528
528 case ACPI_RSC_2BITFLAG: 529 case ACPI_RSC_2BITFLAG:
529 /* 530 /*
530 * Mask and shift the flag bits 531 * Mask and shift the flag bits
531 */ 532 */
532 ACPI_SET8(destination) |= (u8) 533 ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
533 ((ACPI_GET8(source) & 0x03) << info->value); 534 ((ACPI_GET8(source) & 0x03) << info->
535 value));
534 break; 536 break;
535 537
536 case ACPI_RSC_3BITFLAG: 538 case ACPI_RSC_3BITFLAG:
537 /* 539 /*
538 * Mask and shift the flag bits 540 * Mask and shift the flag bits
539 */ 541 */
540 ACPI_SET8(destination) |= (u8) 542 ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
541 ((ACPI_GET8(source) & 0x07) << info->value); 543 ((ACPI_GET8(source) & 0x07) << info->
544 value));
542 break; 545 break;
543 546
544 case ACPI_RSC_COUNT: 547 case ACPI_RSC_COUNT:
545 548
546 item_count = ACPI_GET8(source); 549 item_count = ACPI_GET8(source);
547 ACPI_SET8(destination) = (u8) item_count; 550 ACPI_SET8(destination, item_count);
548 551
549 aml_length = 552 aml_length =
550 (u16) (aml_length + 553 (u16) (aml_length +
@@ -561,18 +564,18 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
561 case ACPI_RSC_COUNT_GPIO_PIN: 564 case ACPI_RSC_COUNT_GPIO_PIN:
562 565
563 item_count = ACPI_GET16(source); 566 item_count = ACPI_GET16(source);
564 ACPI_SET16(destination) = (u16)aml_length; 567 ACPI_SET16(destination, aml_length);
565 568
566 aml_length = (u16)(aml_length + item_count * 2); 569 aml_length = (u16)(aml_length + item_count * 2);
567 target = ACPI_ADD_PTR(void, aml, info->value); 570 target = ACPI_ADD_PTR(void, aml, info->value);
568 ACPI_SET16(target) = (u16)aml_length; 571 ACPI_SET16(target, aml_length);
569 acpi_rs_set_resource_length(aml_length, aml); 572 acpi_rs_set_resource_length(aml_length, aml);
570 break; 573 break;
571 574
572 case ACPI_RSC_COUNT_GPIO_VEN: 575 case ACPI_RSC_COUNT_GPIO_VEN:
573 576
574 item_count = ACPI_GET16(source); 577 item_count = ACPI_GET16(source);
575 ACPI_SET16(destination) = (u16)item_count; 578 ACPI_SET16(destination, item_count);
576 579
577 aml_length = 580 aml_length =
578 (u16)(aml_length + (info->value * item_count)); 581 (u16)(aml_length + (info->value * item_count));
@@ -584,7 +587,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
584 /* Set resource source string length */ 587 /* Set resource source string length */
585 588
586 item_count = ACPI_GET16(source); 589 item_count = ACPI_GET16(source);
587 ACPI_SET16(destination) = (u16)aml_length; 590 ACPI_SET16(destination, aml_length);
588 591
589 /* Compute offset for the Vendor Data */ 592 /* Compute offset for the Vendor Data */
590 593
@@ -594,7 +597,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
594 /* Set vendor offset only if there is vendor data */ 597 /* Set vendor offset only if there is vendor data */
595 598
596 if (resource->data.gpio.vendor_length) { 599 if (resource->data.gpio.vendor_length) {
597 ACPI_SET16(target) = (u16)aml_length; 600 ACPI_SET16(target, aml_length);
598 } 601 }
599 602
600 acpi_rs_set_resource_length(aml_length, aml); 603 acpi_rs_set_resource_length(aml_length, aml);
@@ -603,7 +606,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
603 case ACPI_RSC_COUNT_SERIAL_VEN: 606 case ACPI_RSC_COUNT_SERIAL_VEN:
604 607
605 item_count = ACPI_GET16(source); 608 item_count = ACPI_GET16(source);
606 ACPI_SET16(destination) = item_count + info->value; 609 ACPI_SET16(destination, item_count + info->value);
607 aml_length = (u16)(aml_length + item_count); 610 aml_length = (u16)(aml_length + item_count);
608 acpi_rs_set_resource_length(aml_length, aml); 611 acpi_rs_set_resource_length(aml_length, aml);
609 break; 612 break;
@@ -686,7 +689,8 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
686 * Optional resource_source (Index and String) 689 * Optional resource_source (Index and String)
687 */ 690 */
688 aml_length = 691 aml_length =
689 acpi_rs_set_resource_source(aml, (acpi_rs_length) 692 acpi_rs_set_resource_source(aml,
693 (acpi_rs_length)
690 aml_length, source); 694 aml_length, source);
691 acpi_rs_set_resource_length(aml_length, aml); 695 acpi_rs_set_resource_length(aml_length, aml);
692 break; 696 break;
@@ -706,10 +710,12 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
706 /* 710 /*
707 * 8-bit encoded bitmask (DMA macro) 711 * 8-bit encoded bitmask (DMA macro)
708 */ 712 */
709 ACPI_SET8(destination) = (u8) 713 ACPI_SET8(destination,
710 acpi_rs_encode_bitmask(source, 714 acpi_rs_encode_bitmask(source,
711 *ACPI_ADD_PTR(u8, resource, 715 *ACPI_ADD_PTR(u8,
712 info->value)); 716 resource,
717 info->
718 value)));
713 break; 719 break;
714 720
715 case ACPI_RSC_BITMASK16: 721 case ACPI_RSC_BITMASK16:
diff --git a/drivers/acpi/acpica/rsserial.c b/drivers/acpi/acpica/rsserial.c
index 9aa5e689b444..fe49fc43e10f 100644
--- a/drivers/acpi/acpica/rsserial.c
+++ b/drivers/acpi/acpica/rsserial.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("rsserial")
53 * acpi_rs_convert_gpio 53 * acpi_rs_convert_gpio
54 * 54 *
55 ******************************************************************************/ 55 ******************************************************************************/
56struct acpi_rsconvert_info acpi_rs_convert_gpio[17] = { 56struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = {
57 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO, 57 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO,
58 ACPI_RS_SIZE(struct acpi_resource_gpio), 58 ACPI_RS_SIZE(struct acpi_resource_gpio),
59 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)}, 59 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)},
@@ -75,10 +75,14 @@ struct acpi_rsconvert_info acpi_rs_convert_gpio[17] = {
75 AML_OFFSET(gpio.flags), 75 AML_OFFSET(gpio.flags),
76 0}, 76 0},
77 77
78 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable), 78 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable),
79 AML_OFFSET(gpio.int_flags), 79 AML_OFFSET(gpio.int_flags),
80 3}, 80 3},
81 81
82 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.wake_capable),
83 AML_OFFSET(gpio.int_flags),
84 4},
85
82 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction), 86 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction),
83 AML_OFFSET(gpio.int_flags), 87 AML_OFFSET(gpio.int_flags),
84 0}, 88 0},
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index 37d5241c0acf..a44953c6f75d 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -108,7 +108,7 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count)
108 mask |= (0x1 << list[i]); 108 mask |= (0x1 << list[i]);
109 } 109 }
110 110
111 return mask; 111 return (mask);
112} 112}
113 113
114/******************************************************************************* 114/*******************************************************************************
@@ -358,8 +358,10 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
358 * 358 *
359 * Zero the entire area of the buffer. 359 * Zero the entire area of the buffer.
360 */ 360 */
361 total_length = (u32) 361 total_length =
362 ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + 1; 362 (u32)
363 ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
364 1;
363 total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); 365 total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
364 366
365 ACPI_MEMSET(resource_source->string_ptr, 0, total_length); 367 ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
@@ -675,7 +677,9 @@ acpi_rs_get_method_data(acpi_handle handle,
675 /* Execute the method, no parameters */ 677 /* Execute the method, no parameters */
676 678
677 status = 679 status =
678 acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc); 680 acpi_ut_evaluate_object(ACPI_CAST_PTR
681 (struct acpi_namespace_node, handle), path,
682 ACPI_BTYPE_BUFFER, &obj_desc);
679 if (ACPI_FAILURE(status)) { 683 if (ACPI_FAILURE(status)) {
680 return_ACPI_STATUS(status); 684 return_ACPI_STATUS(status);
681 } 685 }
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index 5aad744b5b83..15d6eaef0e28 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -423,7 +423,7 @@ ACPI_EXPORT_SYMBOL(acpi_resource_to_address64)
423 * 423 *
424 * RETURN: Status 424 * RETURN: Status
425 * 425 *
426 * DESCRIPTION: Walk a resource template for the specified evice to find a 426 * DESCRIPTION: Walk a resource template for the specified device to find a
427 * vendor-defined resource that matches the supplied UUID and 427 * vendor-defined resource that matches the supplied UUID and
428 * UUID subtype. Returns a struct acpi_resource of type Vendor. 428 * UUID subtype. Returns a struct acpi_resource of type Vendor.
429 * 429 *
@@ -522,57 +522,42 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
522 522
523/******************************************************************************* 523/*******************************************************************************
524 * 524 *
525 * FUNCTION: acpi_walk_resources 525 * FUNCTION: acpi_walk_resource_buffer
526 * 526 *
527 * PARAMETERS: device_handle - Handle to the device object for the 527 * PARAMETERS: buffer - Formatted buffer returned by one of the
528 * device we are querying 528 * various Get*Resource functions
529 * name - Method name of the resources we want.
530 * (METHOD_NAME__CRS, METHOD_NAME__PRS, or
531 * METHOD_NAME__AEI)
532 * user_function - Called for each resource 529 * user_function - Called for each resource
533 * context - Passed to user_function 530 * context - Passed to user_function
534 * 531 *
535 * RETURN: Status 532 * RETURN: Status
536 * 533 *
537 * DESCRIPTION: Retrieves the current or possible resource list for the 534 * DESCRIPTION: Walks the input resource template. The user_function is called
538 * specified device. The user_function is called once for 535 * once for each resource in the list.
539 * each resource in the list.
540 * 536 *
541 ******************************************************************************/ 537 ******************************************************************************/
538
542acpi_status 539acpi_status
543acpi_walk_resources(acpi_handle device_handle, 540acpi_walk_resource_buffer(struct acpi_buffer * buffer,
544 char *name, 541 acpi_walk_resource_callback user_function,
545 acpi_walk_resource_callback user_function, void *context) 542 void *context)
546{ 543{
547 acpi_status status; 544 acpi_status status = AE_OK;
548 struct acpi_buffer buffer;
549 struct acpi_resource *resource; 545 struct acpi_resource *resource;
550 struct acpi_resource *resource_end; 546 struct acpi_resource *resource_end;
551 547
552 ACPI_FUNCTION_TRACE(acpi_walk_resources); 548 ACPI_FUNCTION_TRACE(acpi_walk_resource_buffer);
553 549
554 /* Parameter validation */ 550 /* Parameter validation */
555 551
556 if (!device_handle || !user_function || !name || 552 if (!buffer || !buffer->pointer || !user_function) {
557 (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) &&
558 !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) &&
559 !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) {
560 return_ACPI_STATUS(AE_BAD_PARAMETER); 553 return_ACPI_STATUS(AE_BAD_PARAMETER);
561 } 554 }
562 555
563 /* Get the _CRS/_PRS/_AEI resource list */ 556 /* Buffer contains the resource list and length */
564
565 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
566 status = acpi_rs_get_method_data(device_handle, name, &buffer);
567 if (ACPI_FAILURE(status)) {
568 return_ACPI_STATUS(status);
569 }
570
571 /* Buffer now contains the resource list */
572 557
573 resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); 558 resource = ACPI_CAST_PTR(struct acpi_resource, buffer->pointer);
574 resource_end = 559 resource_end =
575 ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); 560 ACPI_ADD_PTR(struct acpi_resource, buffer->pointer, buffer->length);
576 561
577 /* Walk the resource list until the end_tag is found (or buffer end) */ 562 /* Walk the resource list until the end_tag is found (or buffer end) */
578 563
@@ -606,11 +591,63 @@ acpi_walk_resources(acpi_handle device_handle,
606 591
607 /* Get the next resource descriptor */ 592 /* Get the next resource descriptor */
608 593
609 resource = 594 resource = ACPI_NEXT_RESOURCE(resource);
610 ACPI_ADD_PTR(struct acpi_resource, resource,
611 resource->length);
612 } 595 }
613 596
597 return_ACPI_STATUS(status);
598}
599
600ACPI_EXPORT_SYMBOL(acpi_walk_resource_buffer)
601
602/*******************************************************************************
603 *
604 * FUNCTION: acpi_walk_resources
605 *
606 * PARAMETERS: device_handle - Handle to the device object for the
607 * device we are querying
608 * name - Method name of the resources we want.
609 * (METHOD_NAME__CRS, METHOD_NAME__PRS, or
610 * METHOD_NAME__AEI)
611 * user_function - Called for each resource
612 * context - Passed to user_function
613 *
614 * RETURN: Status
615 *
616 * DESCRIPTION: Retrieves the current or possible resource list for the
617 * specified device. The user_function is called once for
618 * each resource in the list.
619 *
620 ******************************************************************************/
621acpi_status
622acpi_walk_resources(acpi_handle device_handle,
623 char *name,
624 acpi_walk_resource_callback user_function, void *context)
625{
626 acpi_status status;
627 struct acpi_buffer buffer;
628
629 ACPI_FUNCTION_TRACE(acpi_walk_resources);
630
631 /* Parameter validation */
632
633 if (!device_handle || !user_function || !name ||
634 (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) &&
635 !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) &&
636 !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) {
637 return_ACPI_STATUS(AE_BAD_PARAMETER);
638 }
639
640 /* Get the _CRS/_PRS/_AEI resource list */
641
642 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
643 status = acpi_rs_get_method_data(device_handle, name, &buffer);
644 if (ACPI_FAILURE(status)) {
645 return_ACPI_STATUS(status);
646 }
647
648 /* Walk the resource list and cleanup */
649
650 status = acpi_walk_resource_buffer(&buffer, user_function, context);
614 ACPI_FREE(buffer.pointer); 651 ACPI_FREE(buffer.pointer);
615 return_ACPI_STATUS(status); 652 return_ACPI_STATUS(status);
616} 653}
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 390651860bf0..74181bf181ec 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -172,6 +172,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
172 * FUNCTION: acpi_tb_init_generic_address 172 * FUNCTION: acpi_tb_init_generic_address
173 * 173 *
174 * PARAMETERS: generic_address - GAS struct to be initialized 174 * PARAMETERS: generic_address - GAS struct to be initialized
175 * space_id - ACPI Space ID for this register
175 * byte_width - Width of this register 176 * byte_width - Width of this register
176 * address - Address of the register 177 * address - Address of the register
177 * 178 *
@@ -407,8 +408,8 @@ static void acpi_tb_convert_fadt(void)
407 * should be zero are indeed zero. This will workaround BIOSs that 408 * should be zero are indeed zero. This will workaround BIOSs that
408 * inadvertently place values in these fields. 409 * inadvertently place values in these fields.
409 * 410 *
410 * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at 411 * The ACPI 1.0 reserved fields that will be zeroed are the bytes located
411 * offset 45, 55, 95, and the word located at offset 109, 110. 412 * at offset 45, 55, 95, and the word located at offset 109, 110.
412 * 413 *
413 * Note: The FADT revision value is unreliable. Only the length can be 414 * Note: The FADT revision value is unreliable. Only the length can be
414 * trusted. 415 * trusted.
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index 77d1db29a725..e4f4f02d49e7 100644
--- a/drivers/acpi/acpica/tbfind.c
+++ b/drivers/acpi/acpica/tbfind.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index f540ae462925..e57cd38004e3 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 285e24b97382..ce3d5db39a9c 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -147,7 +147,7 @@ acpi_status acpi_tb_initialize_facs(void)
147 ACPI_CAST_INDIRECT_PTR(struct 147 ACPI_CAST_INDIRECT_PTR(struct
148 acpi_table_header, 148 acpi_table_header,
149 &acpi_gbl_FACS)); 149 &acpi_gbl_FACS));
150 return status; 150 return (status);
151} 151}
152#endif /* !ACPI_REDUCED_HARDWARE */ 152#endif /* !ACPI_REDUCED_HARDWARE */
153 153
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index f5632780421d..b35a5e6d653a 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,6 @@
44#include <linux/export.h> 44#include <linux/export.h>
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include "accommon.h" 46#include "accommon.h"
47#include "acnamesp.h"
48#include "actables.h" 47#include "actables.h"
49 48
50#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
@@ -437,7 +436,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_by_index)
437 * 436 *
438 ******************************************************************************/ 437 ******************************************************************************/
439acpi_status 438acpi_status
440acpi_install_table_handler(acpi_tbl_handler handler, void *context) 439acpi_install_table_handler(acpi_table_handler handler, void *context)
441{ 440{
442 acpi_status status; 441 acpi_status status;
443 442
@@ -483,7 +482,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_table_handler)
483 * DESCRIPTION: Remove table event handler 482 * DESCRIPTION: Remove table event handler
484 * 483 *
485 ******************************************************************************/ 484 ******************************************************************************/
486acpi_status acpi_remove_table_handler(acpi_tbl_handler handler) 485acpi_status acpi_remove_table_handler(acpi_table_handler handler)
487{ 486{
488 acpi_status status; 487 acpi_status status;
489 488
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index a5e1e4e47098..67e046ec8f0a 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -192,7 +192,7 @@ static acpi_status acpi_tb_load_namespace(void)
192 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 192 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
193 } 193 }
194 194
195 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); 195 ACPI_INFO((AE_INFO, "All ACPI Tables successfully acquired"));
196 196
197 unlock_and_exit: 197 unlock_and_exit:
198 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 198 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index 28f330230f99..7c2ecfb7c2c3 100644
--- a/drivers/acpi/acpica/tbxfroot.c
+++ b/drivers/acpi/acpica/tbxfroot.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c
index 64880306133d..698b9d385516 100644
--- a/drivers/acpi/acpica/utaddress.c
+++ b/drivers/acpi/acpica/utaddress.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -214,7 +214,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
214 214
215 if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) && 215 if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
216 (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { 216 (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
217 return_UINT32(0); 217 return_VALUE(0);
218 } 218 }
219 219
220 range_info = acpi_gbl_address_range_list[space_id]; 220 range_info = acpi_gbl_address_range_list[space_id];
@@ -256,7 +256,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
256 range_info = range_info->next; 256 range_info = range_info->next;
257 } 257 }
258 258
259 return_UINT32(overlap_count); 259 return_VALUE(overlap_count);
260} 260}
261 261
262/******************************************************************************* 262/*******************************************************************************
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index ed29d474095e..e0ffb580f4b0 100644
--- a/drivers/acpi/acpica/utalloc.c
+++ b/drivers/acpi/acpica/utalloc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c
index e1d40ed26390..e0e8579deaac 100644
--- a/drivers/acpi/acpica/utcache.c
+++ b/drivers/acpi/acpica/utcache.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index 294692ae76e9..e4c9291fc0a3 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -785,7 +785,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
785 785
786 status = acpi_os_create_mutex(&dest_desc->mutex.os_mutex); 786 status = acpi_os_create_mutex(&dest_desc->mutex.os_mutex);
787 if (ACPI_FAILURE(status)) { 787 if (ACPI_FAILURE(status)) {
788 return status; 788 return (status);
789 } 789 }
790 break; 790 break;
791 791
@@ -795,7 +795,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
795 &dest_desc->event. 795 &dest_desc->event.
796 os_semaphore); 796 os_semaphore);
797 if (ACPI_FAILURE(status)) { 797 if (ACPI_FAILURE(status)) {
798 return status; 798 return (status);
799 } 799 }
800 break; 800 break;
801 801
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index 5d95166245ae..c57d9cc07ba9 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -166,11 +166,9 @@ acpi_debug_print(u32 requested_debug_level,
166 acpi_thread_id thread_id; 166 acpi_thread_id thread_id;
167 va_list args; 167 va_list args;
168 168
169 /* 169 /* Check if debug output enabled */
170 * Stay silent if the debug level or component ID is disabled 170
171 */ 171 if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
172 if (!(requested_debug_level & acpi_dbg_level) ||
173 !(component_id & acpi_dbg_layer)) {
174 return; 172 return;
175 } 173 }
176 174
@@ -236,8 +234,9 @@ acpi_debug_print_raw(u32 requested_debug_level,
236{ 234{
237 va_list args; 235 va_list args;
238 236
239 if (!(requested_debug_level & acpi_dbg_level) || 237 /* Check if debug output enabled */
240 !(component_id & acpi_dbg_layer)) { 238
239 if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
241 return; 240 return;
242 } 241 }
243 242
@@ -272,9 +271,13 @@ acpi_ut_trace(u32 line_number,
272 acpi_gbl_nesting_level++; 271 acpi_gbl_nesting_level++;
273 acpi_ut_track_stack_ptr(); 272 acpi_ut_track_stack_ptr();
274 273
275 acpi_debug_print(ACPI_LV_FUNCTIONS, 274 /* Check if enabled up-front for performance */
276 line_number, function_name, module_name, component_id, 275
277 "%s\n", acpi_gbl_fn_entry_str); 276 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
277 acpi_debug_print(ACPI_LV_FUNCTIONS,
278 line_number, function_name, module_name,
279 component_id, "%s\n", acpi_gbl_fn_entry_str);
280 }
278} 281}
279 282
280ACPI_EXPORT_SYMBOL(acpi_ut_trace) 283ACPI_EXPORT_SYMBOL(acpi_ut_trace)
@@ -304,9 +307,14 @@ acpi_ut_trace_ptr(u32 line_number,
304 acpi_gbl_nesting_level++; 307 acpi_gbl_nesting_level++;
305 acpi_ut_track_stack_ptr(); 308 acpi_ut_track_stack_ptr();
306 309
307 acpi_debug_print(ACPI_LV_FUNCTIONS, 310 /* Check if enabled up-front for performance */
308 line_number, function_name, module_name, component_id, 311
309 "%s %p\n", acpi_gbl_fn_entry_str, pointer); 312 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
313 acpi_debug_print(ACPI_LV_FUNCTIONS,
314 line_number, function_name, module_name,
315 component_id, "%s %p\n", acpi_gbl_fn_entry_str,
316 pointer);
317 }
310} 318}
311 319
312/******************************************************************************* 320/*******************************************************************************
@@ -335,9 +343,14 @@ acpi_ut_trace_str(u32 line_number,
335 acpi_gbl_nesting_level++; 343 acpi_gbl_nesting_level++;
336 acpi_ut_track_stack_ptr(); 344 acpi_ut_track_stack_ptr();
337 345
338 acpi_debug_print(ACPI_LV_FUNCTIONS, 346 /* Check if enabled up-front for performance */
339 line_number, function_name, module_name, component_id, 347
340 "%s %s\n", acpi_gbl_fn_entry_str, string); 348 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
349 acpi_debug_print(ACPI_LV_FUNCTIONS,
350 line_number, function_name, module_name,
351 component_id, "%s %s\n", acpi_gbl_fn_entry_str,
352 string);
353 }
341} 354}
342 355
343/******************************************************************************* 356/*******************************************************************************
@@ -366,9 +379,14 @@ acpi_ut_trace_u32(u32 line_number,
366 acpi_gbl_nesting_level++; 379 acpi_gbl_nesting_level++;
367 acpi_ut_track_stack_ptr(); 380 acpi_ut_track_stack_ptr();
368 381
369 acpi_debug_print(ACPI_LV_FUNCTIONS, 382 /* Check if enabled up-front for performance */
370 line_number, function_name, module_name, component_id, 383
371 "%s %08X\n", acpi_gbl_fn_entry_str, integer); 384 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
385 acpi_debug_print(ACPI_LV_FUNCTIONS,
386 line_number, function_name, module_name,
387 component_id, "%s %08X\n",
388 acpi_gbl_fn_entry_str, integer);
389 }
372} 390}
373 391
374/******************************************************************************* 392/*******************************************************************************
@@ -393,9 +411,13 @@ acpi_ut_exit(u32 line_number,
393 const char *module_name, u32 component_id) 411 const char *module_name, u32 component_id)
394{ 412{
395 413
396 acpi_debug_print(ACPI_LV_FUNCTIONS, 414 /* Check if enabled up-front for performance */
397 line_number, function_name, module_name, component_id, 415
398 "%s\n", acpi_gbl_fn_exit_str); 416 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
417 acpi_debug_print(ACPI_LV_FUNCTIONS,
418 line_number, function_name, module_name,
419 component_id, "%s\n", acpi_gbl_fn_exit_str);
420 }
399 421
400 acpi_gbl_nesting_level--; 422 acpi_gbl_nesting_level--;
401} 423}
@@ -425,17 +447,23 @@ acpi_ut_status_exit(u32 line_number,
425 u32 component_id, acpi_status status) 447 u32 component_id, acpi_status status)
426{ 448{
427 449
428 if (ACPI_SUCCESS(status)) { 450 /* Check if enabled up-front for performance */
429 acpi_debug_print(ACPI_LV_FUNCTIONS, 451
430 line_number, function_name, module_name, 452 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
431 component_id, "%s %s\n", acpi_gbl_fn_exit_str, 453 if (ACPI_SUCCESS(status)) {
432 acpi_format_exception(status)); 454 acpi_debug_print(ACPI_LV_FUNCTIONS,
433 } else { 455 line_number, function_name,
434 acpi_debug_print(ACPI_LV_FUNCTIONS, 456 module_name, component_id, "%s %s\n",
435 line_number, function_name, module_name, 457 acpi_gbl_fn_exit_str,
436 component_id, "%s ****Exception****: %s\n", 458 acpi_format_exception(status));
437 acpi_gbl_fn_exit_str, 459 } else {
438 acpi_format_exception(status)); 460 acpi_debug_print(ACPI_LV_FUNCTIONS,
461 line_number, function_name,
462 module_name, component_id,
463 "%s ****Exception****: %s\n",
464 acpi_gbl_fn_exit_str,
465 acpi_format_exception(status));
466 }
439 } 467 }
440 468
441 acpi_gbl_nesting_level--; 469 acpi_gbl_nesting_level--;
@@ -465,10 +493,15 @@ acpi_ut_value_exit(u32 line_number,
465 const char *module_name, u32 component_id, u64 value) 493 const char *module_name, u32 component_id, u64 value)
466{ 494{
467 495
468 acpi_debug_print(ACPI_LV_FUNCTIONS, 496 /* Check if enabled up-front for performance */
469 line_number, function_name, module_name, component_id, 497
470 "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, 498 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
471 ACPI_FORMAT_UINT64(value)); 499 acpi_debug_print(ACPI_LV_FUNCTIONS,
500 line_number, function_name, module_name,
501 component_id, "%s %8.8X%8.8X\n",
502 acpi_gbl_fn_exit_str,
503 ACPI_FORMAT_UINT64(value));
504 }
472 505
473 acpi_gbl_nesting_level--; 506 acpi_gbl_nesting_level--;
474} 507}
@@ -497,9 +530,14 @@ acpi_ut_ptr_exit(u32 line_number,
497 const char *module_name, u32 component_id, u8 *ptr) 530 const char *module_name, u32 component_id, u8 *ptr)
498{ 531{
499 532
500 acpi_debug_print(ACPI_LV_FUNCTIONS, 533 /* Check if enabled up-front for performance */
501 line_number, function_name, module_name, component_id, 534
502 "%s %p\n", acpi_gbl_fn_exit_str, ptr); 535 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
536 acpi_debug_print(ACPI_LV_FUNCTIONS,
537 line_number, function_name, module_name,
538 component_id, "%s %p\n", acpi_gbl_fn_exit_str,
539 ptr);
540 }
503 541
504 acpi_gbl_nesting_level--; 542 acpi_gbl_nesting_level--;
505} 543}
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 60a158472d82..11e2e02e1618 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index 798105443d0f..2541de420249 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -340,7 +340,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
340{ 340{
341 union acpi_operand_object **internal_obj; 341 union acpi_operand_object **internal_obj;
342 342
343 ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); 343 ACPI_FUNCTION_ENTRY();
344 344
345 /* Walk the null-terminated internal list */ 345 /* Walk the null-terminated internal list */
346 346
@@ -351,7 +351,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
351 /* Free the combined parameter pointer list and object array */ 351 /* Free the combined parameter pointer list and object array */
352 352
353 ACPI_FREE(obj_list); 353 ACPI_FREE(obj_list);
354 return_VOID; 354 return;
355} 355}
356 356
357/******************************************************************************* 357/*******************************************************************************
@@ -484,7 +484,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
484 union acpi_generic_state *state; 484 union acpi_generic_state *state;
485 u32 i; 485 u32 i;
486 486
487 ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); 487 ACPI_FUNCTION_NAME(ut_update_object_reference);
488 488
489 while (object) { 489 while (object) {
490 490
@@ -493,7 +493,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
493 if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { 493 if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
494 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 494 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
495 "Object %p is NS handle\n", object)); 495 "Object %p is NS handle\n", object));
496 return_ACPI_STATUS(AE_OK); 496 return (AE_OK);
497 } 497 }
498 498
499 /* 499 /*
@@ -530,18 +530,42 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
530 */ 530 */
531 for (i = 0; i < object->package.count; i++) { 531 for (i = 0; i < object->package.count; i++) {
532 /* 532 /*
533 * Push each element onto the stack for later processing. 533 * Null package elements are legal and can be simply
534 * Note: There can be null elements within the package, 534 * ignored.
535 * these are simply ignored
536 */ 535 */
537 status = 536 next_object = object->package.elements[i];
538 acpi_ut_create_update_state_and_push 537 if (!next_object) {
539 (object->package.elements[i], action, 538 continue;
540 &state_list); 539 }
541 if (ACPI_FAILURE(status)) { 540
542 goto error_exit; 541 switch (next_object->common.type) {
542 case ACPI_TYPE_INTEGER:
543 case ACPI_TYPE_STRING:
544 case ACPI_TYPE_BUFFER:
545 /*
546 * For these very simple sub-objects, we can just
547 * update the reference count here and continue.
548 * Greatly increases performance of this operation.
549 */
550 acpi_ut_update_ref_count(next_object,
551 action);
552 break;
553
554 default:
555 /*
556 * For complex sub-objects, push them onto the stack
557 * for later processing (this eliminates recursion.)
558 */
559 status =
560 acpi_ut_create_update_state_and_push
561 (next_object, action, &state_list);
562 if (ACPI_FAILURE(status)) {
563 goto error_exit;
564 }
565 break;
543 } 566 }
544 } 567 }
568 next_object = NULL;
545 break; 569 break;
546 570
547 case ACPI_TYPE_BUFFER_FIELD: 571 case ACPI_TYPE_BUFFER_FIELD:
@@ -619,7 +643,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
619 } 643 }
620 } 644 }
621 645
622 return_ACPI_STATUS(AE_OK); 646 return (AE_OK);
623 647
624 error_exit: 648 error_exit:
625 649
@@ -633,7 +657,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
633 acpi_ut_delete_generic_state(state); 657 acpi_ut_delete_generic_state(state);
634 } 658 }
635 659
636 return_ACPI_STATUS(status); 660 return (status);
637} 661}
638 662
639/******************************************************************************* 663/*******************************************************************************
@@ -652,12 +676,12 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
652void acpi_ut_add_reference(union acpi_operand_object *object) 676void acpi_ut_add_reference(union acpi_operand_object *object)
653{ 677{
654 678
655 ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); 679 ACPI_FUNCTION_NAME(ut_add_reference);
656 680
657 /* Ensure that we have a valid object */ 681 /* Ensure that we have a valid object */
658 682
659 if (!acpi_ut_valid_internal_object(object)) { 683 if (!acpi_ut_valid_internal_object(object)) {
660 return_VOID; 684 return;
661 } 685 }
662 686
663 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 687 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
@@ -667,7 +691,7 @@ void acpi_ut_add_reference(union acpi_operand_object *object)
667 /* Increment the reference count */ 691 /* Increment the reference count */
668 692
669 (void)acpi_ut_update_object_reference(object, REF_INCREMENT); 693 (void)acpi_ut_update_object_reference(object, REF_INCREMENT);
670 return_VOID; 694 return;
671} 695}
672 696
673/******************************************************************************* 697/*******************************************************************************
@@ -685,7 +709,7 @@ void acpi_ut_add_reference(union acpi_operand_object *object)
685void acpi_ut_remove_reference(union acpi_operand_object *object) 709void acpi_ut_remove_reference(union acpi_operand_object *object)
686{ 710{
687 711
688 ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); 712 ACPI_FUNCTION_NAME(ut_remove_reference);
689 713
690 /* 714 /*
691 * Allow a NULL pointer to be passed in, just ignore it. This saves 715 * Allow a NULL pointer to be passed in, just ignore it. This saves
@@ -694,13 +718,13 @@ void acpi_ut_remove_reference(union acpi_operand_object *object)
694 */ 718 */
695 if (!object || 719 if (!object ||
696 (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) { 720 (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) {
697 return_VOID; 721 return;
698 } 722 }
699 723
700 /* Ensure that we have a valid object */ 724 /* Ensure that we have a valid object */
701 725
702 if (!acpi_ut_valid_internal_object(object)) { 726 if (!acpi_ut_valid_internal_object(object)) {
703 return_VOID; 727 return;
704 } 728 }
705 729
706 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 730 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
@@ -713,5 +737,5 @@ void acpi_ut_remove_reference(union acpi_operand_object *object)
713 * of all subobjects!) 737 * of all subobjects!)
714 */ 738 */
715 (void)acpi_ut_update_object_reference(object, REF_DECREMENT); 739 (void)acpi_ut_update_object_reference(object, REF_DECREMENT);
716 return_VOID; 740 return;
717} 741}
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index a9c65fbea5f4..c3f3a7e7bdc7 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("uteval")
68 ******************************************************************************/ 68 ******************************************************************************/
69 69
70acpi_status 70acpi_status
71acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, 71acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node,
72 char *path, 72 char *path,
73 u32 expected_return_btypes, 73 u32 expected_return_btypes,
74 union acpi_operand_object **return_desc) 74 union acpi_operand_object **return_desc)
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c
index 23b98945f6b7..a0ab7c02e87c 100644
--- a/drivers/acpi/acpica/utexcep.c
+++ b/drivers/acpi/acpica/utexcep.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index ed1893155f8b..ffecf4b4f0dd 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -293,11 +293,11 @@ acpi_status acpi_ut_init_globals(void)
293 293
294 /* GPE support */ 294 /* GPE support */
295 295
296 acpi_gbl_all_gpes_initialized = FALSE;
296 acpi_gbl_gpe_xrupt_list_head = NULL; 297 acpi_gbl_gpe_xrupt_list_head = NULL;
297 acpi_gbl_gpe_fadt_blocks[0] = NULL; 298 acpi_gbl_gpe_fadt_blocks[0] = NULL;
298 acpi_gbl_gpe_fadt_blocks[1] = NULL; 299 acpi_gbl_gpe_fadt_blocks[1] = NULL;
299 acpi_current_gpe_count = 0; 300 acpi_current_gpe_count = 0;
300 acpi_gbl_all_gpes_initialized = FALSE;
301 301
302 acpi_gbl_global_event_handler = NULL; 302 acpi_gbl_global_event_handler = NULL;
303 303
@@ -357,17 +357,24 @@ acpi_status acpi_ut_init_globals(void)
357 acpi_gbl_root_node_struct.peer = NULL; 357 acpi_gbl_root_node_struct.peer = NULL;
358 acpi_gbl_root_node_struct.object = NULL; 358 acpi_gbl_root_node_struct.object = NULL;
359 359
360#ifdef ACPI_DISASSEMBLER
361 acpi_gbl_external_list = NULL;
362#endif
363
360#ifdef ACPI_DEBUG_OUTPUT 364#ifdef ACPI_DEBUG_OUTPUT
361 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); 365 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
362#endif 366#endif
363 367
364#ifdef ACPI_DBG_TRACK_ALLOCATIONS 368#ifdef ACPI_DBG_TRACK_ALLOCATIONS
365 acpi_gbl_display_final_mem_stats = FALSE; 369 acpi_gbl_display_final_mem_stats = FALSE;
370 acpi_gbl_disable_mem_tracking = FALSE;
366#endif 371#endif
367 372
368 return_ACPI_STATUS(AE_OK); 373 return_ACPI_STATUS(AE_OK);
369} 374}
370 375
376/* Public globals */
377
371ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) 378ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
372ACPI_EXPORT_SYMBOL(acpi_dbg_level) 379ACPI_EXPORT_SYMBOL(acpi_dbg_level)
373ACPI_EXPORT_SYMBOL(acpi_dbg_layer) 380ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index 774c3aefbf5d..43a170a74a61 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index 246798e4c938..c5d1ac44c07d 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c
index b1eb7f17e110..5c26ad420344 100644
--- a/drivers/acpi/acpica/utlock.c
+++ b/drivers/acpi/acpica/utlock.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -66,11 +66,11 @@ acpi_status acpi_ut_create_rw_lock(struct acpi_rw_lock *lock)
66 lock->num_readers = 0; 66 lock->num_readers = 0;
67 status = acpi_os_create_mutex(&lock->reader_mutex); 67 status = acpi_os_create_mutex(&lock->reader_mutex);
68 if (ACPI_FAILURE(status)) { 68 if (ACPI_FAILURE(status)) {
69 return status; 69 return (status);
70 } 70 }
71 71
72 status = acpi_os_create_mutex(&lock->writer_mutex); 72 status = acpi_os_create_mutex(&lock->writer_mutex);
73 return status; 73 return (status);
74} 74}
75 75
76void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock) 76void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock)
@@ -108,7 +108,7 @@ acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock)
108 108
109 status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER); 109 status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER);
110 if (ACPI_FAILURE(status)) { 110 if (ACPI_FAILURE(status)) {
111 return status; 111 return (status);
112 } 112 }
113 113
114 /* Acquire the write lock only for the first reader */ 114 /* Acquire the write lock only for the first reader */
@@ -121,7 +121,7 @@ acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock)
121 } 121 }
122 122
123 acpi_os_release_mutex(lock->reader_mutex); 123 acpi_os_release_mutex(lock->reader_mutex);
124 return status; 124 return (status);
125} 125}
126 126
127acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock) 127acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock)
@@ -130,7 +130,7 @@ acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock)
130 130
131 status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER); 131 status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER);
132 if (ACPI_FAILURE(status)) { 132 if (ACPI_FAILURE(status)) {
133 return status; 133 return (status);
134 } 134 }
135 135
136 /* Release the write lock only for the very last reader */ 136 /* Release the write lock only for the very last reader */
@@ -141,7 +141,7 @@ acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock)
141 } 141 }
142 142
143 acpi_os_release_mutex(lock->reader_mutex); 143 acpi_os_release_mutex(lock->reader_mutex);
144 return status; 144 return (status);
145} 145}
146 146
147/******************************************************************************* 147/*******************************************************************************
@@ -165,7 +165,7 @@ acpi_status acpi_ut_acquire_write_lock(struct acpi_rw_lock *lock)
165 acpi_status status; 165 acpi_status status;
166 166
167 status = acpi_os_acquire_mutex(lock->writer_mutex, ACPI_WAIT_FOREVER); 167 status = acpi_os_acquire_mutex(lock->writer_mutex, ACPI_WAIT_FOREVER);
168 return status; 168 return (status);
169} 169}
170 170
171void acpi_ut_release_write_lock(struct acpi_rw_lock *lock) 171void acpi_ut_release_write_lock(struct acpi_rw_lock *lock)
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index 49563674833a..909fe66e1934 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index 9286a69eb9aa..785fdd07ae56 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -48,36 +48,6 @@
48#define _COMPONENT ACPI_UTILITIES 48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utmisc") 49ACPI_MODULE_NAME("utmisc")
50 50
51#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
52/*******************************************************************************
53 *
54 * FUNCTION: ut_convert_backslashes
55 *
56 * PARAMETERS: pathname - File pathname string to be converted
57 *
58 * RETURN: Modifies the input Pathname
59 *
60 * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within
61 * the entire input file pathname string.
62 *
63 ******************************************************************************/
64void ut_convert_backslashes(char *pathname)
65{
66
67 if (!pathname) {
68 return;
69 }
70
71 while (*pathname) {
72 if (*pathname == '\\') {
73 *pathname = '/';
74 }
75
76 pathname++;
77 }
78}
79#endif
80
81/******************************************************************************* 51/*******************************************************************************
82 * 52 *
83 * FUNCTION: acpi_ut_is_pci_root_bridge 53 * FUNCTION: acpi_ut_is_pci_root_bridge
@@ -89,7 +59,6 @@ void ut_convert_backslashes(char *pathname)
89 * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. 59 * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
90 * 60 *
91 ******************************************************************************/ 61 ******************************************************************************/
92
93u8 acpi_ut_is_pci_root_bridge(char *id) 62u8 acpi_ut_is_pci_root_bridge(char *id)
94{ 63{
95 64
@@ -136,362 +105,6 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
136 105
137/******************************************************************************* 106/*******************************************************************************
138 * 107 *
139 * FUNCTION: acpi_ut_allocate_owner_id
140 *
141 * PARAMETERS: owner_id - Where the new owner ID is returned
142 *
143 * RETURN: Status
144 *
145 * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
146 * track objects created by the table or method, to be deleted
147 * when the method exits or the table is unloaded.
148 *
149 ******************************************************************************/
150
151acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
152{
153 u32 i;
154 u32 j;
155 u32 k;
156 acpi_status status;
157
158 ACPI_FUNCTION_TRACE(ut_allocate_owner_id);
159
160 /* Guard against multiple allocations of ID to the same location */
161
162 if (*owner_id) {
163 ACPI_ERROR((AE_INFO, "Owner ID [0x%2.2X] already exists",
164 *owner_id));
165 return_ACPI_STATUS(AE_ALREADY_EXISTS);
166 }
167
168 /* Mutex for the global ID mask */
169
170 status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
171 if (ACPI_FAILURE(status)) {
172 return_ACPI_STATUS(status);
173 }
174
175 /*
176 * Find a free owner ID, cycle through all possible IDs on repeated
177 * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
178 * to be scanned twice.
179 */
180 for (i = 0, j = acpi_gbl_last_owner_id_index;
181 i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) {
182 if (j >= ACPI_NUM_OWNERID_MASKS) {
183 j = 0; /* Wraparound to start of mask array */
184 }
185
186 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
187 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
188
189 /* There are no free IDs in this mask */
190
191 break;
192 }
193
194 if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) {
195 /*
196 * Found a free ID. The actual ID is the bit index plus one,
197 * making zero an invalid Owner ID. Save this as the last ID
198 * allocated and update the global ID mask.
199 */
200 acpi_gbl_owner_id_mask[j] |= (1 << k);
201
202 acpi_gbl_last_owner_id_index = (u8)j;
203 acpi_gbl_next_owner_id_offset = (u8)(k + 1);
204
205 /*
206 * Construct encoded ID from the index and bit position
207 *
208 * Note: Last [j].k (bit 255) is never used and is marked
209 * permanently allocated (prevents +1 overflow)
210 */
211 *owner_id =
212 (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j));
213
214 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
215 "Allocated OwnerId: %2.2X\n",
216 (unsigned int)*owner_id));
217 goto exit;
218 }
219 }
220
221 acpi_gbl_next_owner_id_offset = 0;
222 }
223
224 /*
225 * All owner_ids have been allocated. This typically should
226 * not happen since the IDs are reused after deallocation. The IDs are
227 * allocated upon table load (one per table) and method execution, and
228 * they are released when a table is unloaded or a method completes
229 * execution.
230 *
231 * If this error happens, there may be very deep nesting of invoked control
232 * methods, or there may be a bug where the IDs are not released.
233 */
234 status = AE_OWNER_ID_LIMIT;
235 ACPI_ERROR((AE_INFO,
236 "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
237
238 exit:
239 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
240 return_ACPI_STATUS(status);
241}
242
243/*******************************************************************************
244 *
245 * FUNCTION: acpi_ut_release_owner_id
246 *
247 * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_ID
248 *
249 * RETURN: None. No error is returned because we are either exiting a
250 * control method or unloading a table. Either way, we would
251 * ignore any error anyway.
252 *
253 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
254 *
255 ******************************************************************************/
256
257void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
258{
259 acpi_owner_id owner_id = *owner_id_ptr;
260 acpi_status status;
261 u32 index;
262 u32 bit;
263
264 ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id);
265
266 /* Always clear the input owner_id (zero is an invalid ID) */
267
268 *owner_id_ptr = 0;
269
270 /* Zero is not a valid owner_ID */
271
272 if (owner_id == 0) {
273 ACPI_ERROR((AE_INFO, "Invalid OwnerId: 0x%2.2X", owner_id));
274 return_VOID;
275 }
276
277 /* Mutex for the global ID mask */
278
279 status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
280 if (ACPI_FAILURE(status)) {
281 return_VOID;
282 }
283
284 /* Normalize the ID to zero */
285
286 owner_id--;
287
288 /* Decode ID to index/offset pair */
289
290 index = ACPI_DIV_32(owner_id);
291 bit = 1 << ACPI_MOD_32(owner_id);
292
293 /* Free the owner ID only if it is valid */
294
295 if (acpi_gbl_owner_id_mask[index] & bit) {
296 acpi_gbl_owner_id_mask[index] ^= bit;
297 } else {
298 ACPI_ERROR((AE_INFO,
299 "Release of non-allocated OwnerId: 0x%2.2X",
300 owner_id + 1));
301 }
302
303 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
304 return_VOID;
305}
306
307/*******************************************************************************
308 *
309 * FUNCTION: acpi_ut_strupr (strupr)
310 *
311 * PARAMETERS: src_string - The source string to convert
312 *
313 * RETURN: None
314 *
315 * DESCRIPTION: Convert string to uppercase
316 *
317 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
318 *
319 ******************************************************************************/
320
321void acpi_ut_strupr(char *src_string)
322{
323 char *string;
324
325 ACPI_FUNCTION_ENTRY();
326
327 if (!src_string) {
328 return;
329 }
330
331 /* Walk entire string, uppercasing the letters */
332
333 for (string = src_string; *string; string++) {
334 *string = (char)ACPI_TOUPPER(*string);
335 }
336
337 return;
338}
339
340#ifdef ACPI_ASL_COMPILER
341/*******************************************************************************
342 *
343 * FUNCTION: acpi_ut_strlwr (strlwr)
344 *
345 * PARAMETERS: src_string - The source string to convert
346 *
347 * RETURN: None
348 *
349 * DESCRIPTION: Convert string to lowercase
350 *
351 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
352 *
353 ******************************************************************************/
354
355void acpi_ut_strlwr(char *src_string)
356{
357 char *string;
358
359 ACPI_FUNCTION_ENTRY();
360
361 if (!src_string) {
362 return;
363 }
364
365 /* Walk entire string, lowercasing the letters */
366
367 for (string = src_string; *string; string++) {
368 *string = (char)ACPI_TOLOWER(*string);
369 }
370
371 return;
372}
373
374/******************************************************************************
375 *
376 * FUNCTION: acpi_ut_stricmp
377 *
378 * PARAMETERS: string1 - first string to compare
379 * string2 - second string to compare
380 *
381 * RETURN: int that signifies string relationship. Zero means strings
382 * are equal.
383 *
384 * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare
385 * strings with no case sensitivity)
386 *
387 ******************************************************************************/
388
389int acpi_ut_stricmp(char *string1, char *string2)
390{
391 int c1;
392 int c2;
393
394 do {
395 c1 = tolower((int)*string1);
396 c2 = tolower((int)*string2);
397
398 string1++;
399 string2++;
400 }
401 while ((c1 == c2) && (c1));
402
403 return (c1 - c2);
404}
405#endif
406
407/*******************************************************************************
408 *
409 * FUNCTION: acpi_ut_print_string
410 *
411 * PARAMETERS: string - Null terminated ASCII string
412 * max_length - Maximum output length
413 *
414 * RETURN: None
415 *
416 * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
417 * sequences.
418 *
419 ******************************************************************************/
420
421void acpi_ut_print_string(char *string, u8 max_length)
422{
423 u32 i;
424
425 if (!string) {
426 acpi_os_printf("<\"NULL STRING PTR\">");
427 return;
428 }
429
430 acpi_os_printf("\"");
431 for (i = 0; string[i] && (i < max_length); i++) {
432
433 /* Escape sequences */
434
435 switch (string[i]) {
436 case 0x07:
437 acpi_os_printf("\\a"); /* BELL */
438 break;
439
440 case 0x08:
441 acpi_os_printf("\\b"); /* BACKSPACE */
442 break;
443
444 case 0x0C:
445 acpi_os_printf("\\f"); /* FORMFEED */
446 break;
447
448 case 0x0A:
449 acpi_os_printf("\\n"); /* LINEFEED */
450 break;
451
452 case 0x0D:
453 acpi_os_printf("\\r"); /* CARRIAGE RETURN */
454 break;
455
456 case 0x09:
457 acpi_os_printf("\\t"); /* HORIZONTAL TAB */
458 break;
459
460 case 0x0B:
461 acpi_os_printf("\\v"); /* VERTICAL TAB */
462 break;
463
464 case '\'': /* Single Quote */
465 case '\"': /* Double Quote */
466 case '\\': /* Backslash */
467 acpi_os_printf("\\%c", (int)string[i]);
468 break;
469
470 default:
471
472 /* Check for printable character or hex escape */
473
474 if (ACPI_IS_PRINT(string[i])) {
475 /* This is a normal character */
476
477 acpi_os_printf("%c", (int)string[i]);
478 } else {
479 /* All others will be Hex escapes */
480
481 acpi_os_printf("\\x%2.2X", (s32) string[i]);
482 }
483 break;
484 }
485 }
486 acpi_os_printf("\"");
487
488 if (i == max_length && string[i]) {
489 acpi_os_printf("...");
490 }
491}
492
493/*******************************************************************************
494 *
495 * FUNCTION: acpi_ut_dword_byte_swap 108 * FUNCTION: acpi_ut_dword_byte_swap
496 * 109 *
497 * PARAMETERS: value - Value to be converted 110 * PARAMETERS: value - Value to be converted
@@ -559,379 +172,6 @@ void acpi_ut_set_integer_width(u8 revision)
559 } 172 }
560} 173}
561 174
562#ifdef ACPI_DEBUG_OUTPUT
563/*******************************************************************************
564 *
565 * FUNCTION: acpi_ut_display_init_pathname
566 *
567 * PARAMETERS: type - Object type of the node
568 * obj_handle - Handle whose pathname will be displayed
569 * path - Additional path string to be appended.
570 * (NULL if no extra path)
571 *
572 * RETURN: acpi_status
573 *
574 * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
575 *
576 ******************************************************************************/
577
578void
579acpi_ut_display_init_pathname(u8 type,
580 struct acpi_namespace_node *obj_handle,
581 char *path)
582{
583 acpi_status status;
584 struct acpi_buffer buffer;
585
586 ACPI_FUNCTION_ENTRY();
587
588 /* Only print the path if the appropriate debug level is enabled */
589
590 if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
591 return;
592 }
593
594 /* Get the full pathname to the node */
595
596 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
597 status = acpi_ns_handle_to_pathname(obj_handle, &buffer);
598 if (ACPI_FAILURE(status)) {
599 return;
600 }
601
602 /* Print what we're doing */
603
604 switch (type) {
605 case ACPI_TYPE_METHOD:
606 acpi_os_printf("Executing ");
607 break;
608
609 default:
610 acpi_os_printf("Initializing ");
611 break;
612 }
613
614 /* Print the object type and pathname */
615
616 acpi_os_printf("%-12s %s",
617 acpi_ut_get_type_name(type), (char *)buffer.pointer);
618
619 /* Extra path is used to append names like _STA, _INI, etc. */
620
621 if (path) {
622 acpi_os_printf(".%s", path);
623 }
624 acpi_os_printf("\n");
625
626 ACPI_FREE(buffer.pointer);
627}
628#endif
629
630/*******************************************************************************
631 *
632 * FUNCTION: acpi_ut_valid_acpi_char
633 *
634 * PARAMETERS: char - The character to be examined
635 * position - Byte position (0-3)
636 *
637 * RETURN: TRUE if the character is valid, FALSE otherwise
638 *
639 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
640 * 1) Upper case alpha
641 * 2) numeric
642 * 3) underscore
643 *
644 * We allow a '!' as the last character because of the ASF! table
645 *
646 ******************************************************************************/
647
648u8 acpi_ut_valid_acpi_char(char character, u32 position)
649{
650
651 if (!((character >= 'A' && character <= 'Z') ||
652 (character >= '0' && character <= '9') || (character == '_'))) {
653
654 /* Allow a '!' in the last position */
655
656 if (character == '!' && position == 3) {
657 return (TRUE);
658 }
659
660 return (FALSE);
661 }
662
663 return (TRUE);
664}
665
666/*******************************************************************************
667 *
668 * FUNCTION: acpi_ut_valid_acpi_name
669 *
670 * PARAMETERS: name - The name to be examined
671 *
672 * RETURN: TRUE if the name is valid, FALSE otherwise
673 *
674 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
675 * 1) Upper case alpha
676 * 2) numeric
677 * 3) underscore
678 *
679 ******************************************************************************/
680
681u8 acpi_ut_valid_acpi_name(u32 name)
682{
683 u32 i;
684
685 ACPI_FUNCTION_ENTRY();
686
687 for (i = 0; i < ACPI_NAME_SIZE; i++) {
688 if (!acpi_ut_valid_acpi_char
689 ((ACPI_CAST_PTR(char, &name))[i], i)) {
690 return (FALSE);
691 }
692 }
693
694 return (TRUE);
695}
696
697/*******************************************************************************
698 *
699 * FUNCTION: acpi_ut_repair_name
700 *
701 * PARAMETERS: name - The ACPI name to be repaired
702 *
703 * RETURN: Repaired version of the name
704 *
705 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
706 * return the new name. NOTE: the Name parameter must reside in
707 * read/write memory, cannot be a const.
708 *
709 * An ACPI Name must consist of valid ACPI characters. We will repair the name
710 * if necessary because we don't want to abort because of this, but we want
711 * all namespace names to be printable. A warning message is appropriate.
712 *
713 * This issue came up because there are in fact machines that exhibit
714 * this problem, and we want to be able to enable ACPI support for them,
715 * even though there are a few bad names.
716 *
717 ******************************************************************************/
718
719void acpi_ut_repair_name(char *name)
720{
721 u32 i;
722 u8 found_bad_char = FALSE;
723 u32 original_name;
724
725 ACPI_FUNCTION_NAME(ut_repair_name);
726
727 ACPI_MOVE_NAME(&original_name, name);
728
729 /* Check each character in the name */
730
731 for (i = 0; i < ACPI_NAME_SIZE; i++) {
732 if (acpi_ut_valid_acpi_char(name[i], i)) {
733 continue;
734 }
735
736 /*
737 * Replace a bad character with something printable, yet technically
738 * still invalid. This prevents any collisions with existing "good"
739 * names in the namespace.
740 */
741 name[i] = '*';
742 found_bad_char = TRUE;
743 }
744
745 if (found_bad_char) {
746
747 /* Report warning only if in strict mode or debug mode */
748
749 if (!acpi_gbl_enable_interpreter_slack) {
750 ACPI_WARNING((AE_INFO,
751 "Found bad character(s) in name, repaired: [%4.4s]\n",
752 name));
753 } else {
754 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
755 "Found bad character(s) in name, repaired: [%4.4s]\n",
756 name));
757 }
758 }
759}
760
761/*******************************************************************************
762 *
763 * FUNCTION: acpi_ut_strtoul64
764 *
765 * PARAMETERS: string - Null terminated string
766 * base - Radix of the string: 16 or ACPI_ANY_BASE;
767 * ACPI_ANY_BASE means 'in behalf of to_integer'
768 * ret_integer - Where the converted integer is returned
769 *
770 * RETURN: Status and Converted value
771 *
772 * DESCRIPTION: Convert a string into an unsigned value. Performs either a
773 * 32-bit or 64-bit conversion, depending on the current mode
774 * of the interpreter.
775 * NOTE: Does not support Octal strings, not needed.
776 *
777 ******************************************************************************/
778
779acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
780{
781 u32 this_digit = 0;
782 u64 return_value = 0;
783 u64 quotient;
784 u64 dividend;
785 u32 to_integer_op = (base == ACPI_ANY_BASE);
786 u32 mode32 = (acpi_gbl_integer_byte_width == 4);
787 u8 valid_digits = 0;
788 u8 sign_of0x = 0;
789 u8 term = 0;
790
791 ACPI_FUNCTION_TRACE_STR(ut_stroul64, string);
792
793 switch (base) {
794 case ACPI_ANY_BASE:
795 case 16:
796 break;
797
798 default:
799 /* Invalid Base */
800 return_ACPI_STATUS(AE_BAD_PARAMETER);
801 }
802
803 if (!string) {
804 goto error_exit;
805 }
806
807 /* Skip over any white space in the buffer */
808
809 while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) {
810 string++;
811 }
812
813 if (to_integer_op) {
814 /*
815 * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
816 * We need to determine if it is decimal or hexadecimal.
817 */
818 if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
819 sign_of0x = 1;
820 base = 16;
821
822 /* Skip over the leading '0x' */
823 string += 2;
824 } else {
825 base = 10;
826 }
827 }
828
829 /* Any string left? Check that '0x' is not followed by white space. */
830
831 if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') {
832 if (to_integer_op) {
833 goto error_exit;
834 } else {
835 goto all_done;
836 }
837 }
838
839 /*
840 * Perform a 32-bit or 64-bit conversion, depending upon the current
841 * execution mode of the interpreter
842 */
843 dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
844
845 /* Main loop: convert the string to a 32- or 64-bit integer */
846
847 while (*string) {
848 if (ACPI_IS_DIGIT(*string)) {
849
850 /* Convert ASCII 0-9 to Decimal value */
851
852 this_digit = ((u8)*string) - '0';
853 } else if (base == 10) {
854
855 /* Digit is out of range; possible in to_integer case only */
856
857 term = 1;
858 } else {
859 this_digit = (u8)ACPI_TOUPPER(*string);
860 if (ACPI_IS_XDIGIT((char)this_digit)) {
861
862 /* Convert ASCII Hex char to value */
863
864 this_digit = this_digit - 'A' + 10;
865 } else {
866 term = 1;
867 }
868 }
869
870 if (term) {
871 if (to_integer_op) {
872 goto error_exit;
873 } else {
874 break;
875 }
876 } else if ((valid_digits == 0) && (this_digit == 0)
877 && !sign_of0x) {
878
879 /* Skip zeros */
880 string++;
881 continue;
882 }
883
884 valid_digits++;
885
886 if (sign_of0x
887 && ((valid_digits > 16)
888 || ((valid_digits > 8) && mode32))) {
889 /*
890 * This is to_integer operation case.
891 * No any restrictions for string-to-integer conversion,
892 * see ACPI spec.
893 */
894 goto error_exit;
895 }
896
897 /* Divide the digit into the correct position */
898
899 (void)acpi_ut_short_divide((dividend - (u64)this_digit),
900 base, &quotient, NULL);
901
902 if (return_value > quotient) {
903 if (to_integer_op) {
904 goto error_exit;
905 } else {
906 break;
907 }
908 }
909
910 return_value *= base;
911 return_value += this_digit;
912 string++;
913 }
914
915 /* All done, normal exit */
916
917 all_done:
918
919 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
920 ACPI_FORMAT_UINT64(return_value)));
921
922 *ret_integer = return_value;
923 return_ACPI_STATUS(AE_OK);
924
925 error_exit:
926 /* Base was set/validated above */
927
928 if (base == 10) {
929 return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);
930 } else {
931 return_ACPI_STATUS(AE_BAD_HEX_CONSTANT);
932 }
933}
934
935/******************************************************************************* 175/*******************************************************************************
936 * 176 *
937 * FUNCTION: acpi_ut_create_update_state_and_push 177 * FUNCTION: acpi_ut_create_update_state_and_push
@@ -1097,3 +337,71 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
1097 337
1098 return_ACPI_STATUS(AE_AML_INTERNAL); 338 return_ACPI_STATUS(AE_AML_INTERNAL);
1099} 339}
340
341#ifdef ACPI_DEBUG_OUTPUT
342/*******************************************************************************
343 *
344 * FUNCTION: acpi_ut_display_init_pathname
345 *
346 * PARAMETERS: type - Object type of the node
347 * obj_handle - Handle whose pathname will be displayed
348 * path - Additional path string to be appended.
349 * (NULL if no extra path)
350 *
351 * RETURN: acpi_status
352 *
353 * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
354 *
355 ******************************************************************************/
356
357void
358acpi_ut_display_init_pathname(u8 type,
359 struct acpi_namespace_node *obj_handle,
360 char *path)
361{
362 acpi_status status;
363 struct acpi_buffer buffer;
364
365 ACPI_FUNCTION_ENTRY();
366
367 /* Only print the path if the appropriate debug level is enabled */
368
369 if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
370 return;
371 }
372
373 /* Get the full pathname to the node */
374
375 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
376 status = acpi_ns_handle_to_pathname(obj_handle, &buffer);
377 if (ACPI_FAILURE(status)) {
378 return;
379 }
380
381 /* Print what we're doing */
382
383 switch (type) {
384 case ACPI_TYPE_METHOD:
385 acpi_os_printf("Executing ");
386 break;
387
388 default:
389 acpi_os_printf("Initializing ");
390 break;
391 }
392
393 /* Print the object type and pathname */
394
395 acpi_os_printf("%-12s %s",
396 acpi_ut_get_type_name(type), (char *)buffer.pointer);
397
398 /* Extra path is used to append names like _STA, _INI, etc. */
399
400 if (path) {
401 acpi_os_printf(".%s", path);
402 }
403 acpi_os_printf("\n");
404
405 ACPI_FREE(buffer.pointer);
406}
407#endif
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index 5ccf57c0d87e..22feb99b8e35 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index 5c52ca78f6fa..1099f5c069f8 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -419,7 +419,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
419{ 419{
420 ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); 420 ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object);
421 421
422 /* Object must be a union acpi_operand_object */ 422 /* Object must be of type union acpi_operand_object */
423 423
424 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { 424 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
425 ACPI_ERROR((AE_INFO, 425 ACPI_ERROR((AE_INFO,
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
index 676285d6116d..36a7d361d7cb 100644
--- a/drivers/acpi/acpica/utosi.c
+++ b/drivers/acpi/acpica/utosi.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c
new file mode 100644
index 000000000000..835340b26d37
--- /dev/null
+++ b/drivers/acpi/acpica/utownerid.c
@@ -0,0 +1,218 @@
1/*******************************************************************************
2 *
3 * Module Name: utownerid - Support for Table/Method Owner IDs
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acnamesp.h"
47
48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utownerid")
50
51/*******************************************************************************
52 *
53 * FUNCTION: acpi_ut_allocate_owner_id
54 *
55 * PARAMETERS: owner_id - Where the new owner ID is returned
56 *
57 * RETURN: Status
58 *
59 * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
60 * track objects created by the table or method, to be deleted
61 * when the method exits or the table is unloaded.
62 *
63 ******************************************************************************/
64acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
65{
66 u32 i;
67 u32 j;
68 u32 k;
69 acpi_status status;
70
71 ACPI_FUNCTION_TRACE(ut_allocate_owner_id);
72
73 /* Guard against multiple allocations of ID to the same location */
74
75 if (*owner_id) {
76 ACPI_ERROR((AE_INFO, "Owner ID [0x%2.2X] already exists",
77 *owner_id));
78 return_ACPI_STATUS(AE_ALREADY_EXISTS);
79 }
80
81 /* Mutex for the global ID mask */
82
83 status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
84 if (ACPI_FAILURE(status)) {
85 return_ACPI_STATUS(status);
86 }
87
88 /*
89 * Find a free owner ID, cycle through all possible IDs on repeated
90 * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
91 * to be scanned twice.
92 */
93 for (i = 0, j = acpi_gbl_last_owner_id_index;
94 i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) {
95 if (j >= ACPI_NUM_OWNERID_MASKS) {
96 j = 0; /* Wraparound to start of mask array */
97 }
98
99 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
100 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
101
102 /* There are no free IDs in this mask */
103
104 break;
105 }
106
107 if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) {
108 /*
109 * Found a free ID. The actual ID is the bit index plus one,
110 * making zero an invalid Owner ID. Save this as the last ID
111 * allocated and update the global ID mask.
112 */
113 acpi_gbl_owner_id_mask[j] |= (1 << k);
114
115 acpi_gbl_last_owner_id_index = (u8)j;
116 acpi_gbl_next_owner_id_offset = (u8)(k + 1);
117
118 /*
119 * Construct encoded ID from the index and bit position
120 *
121 * Note: Last [j].k (bit 255) is never used and is marked
122 * permanently allocated (prevents +1 overflow)
123 */
124 *owner_id =
125 (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j));
126
127 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
128 "Allocated OwnerId: %2.2X\n",
129 (unsigned int)*owner_id));
130 goto exit;
131 }
132 }
133
134 acpi_gbl_next_owner_id_offset = 0;
135 }
136
137 /*
138 * All owner_ids have been allocated. This typically should
139 * not happen since the IDs are reused after deallocation. The IDs are
140 * allocated upon table load (one per table) and method execution, and
141 * they are released when a table is unloaded or a method completes
142 * execution.
143 *
144 * If this error happens, there may be very deep nesting of invoked control
145 * methods, or there may be a bug where the IDs are not released.
146 */
147 status = AE_OWNER_ID_LIMIT;
148 ACPI_ERROR((AE_INFO,
149 "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
150
151 exit:
152 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
153 return_ACPI_STATUS(status);
154}
155
156/*******************************************************************************
157 *
158 * FUNCTION: acpi_ut_release_owner_id
159 *
160 * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_ID
161 *
162 * RETURN: None. No error is returned because we are either exiting a
163 * control method or unloading a table. Either way, we would
164 * ignore any error anyway.
165 *
166 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
167 *
168 ******************************************************************************/
169
170void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
171{
172 acpi_owner_id owner_id = *owner_id_ptr;
173 acpi_status status;
174 u32 index;
175 u32 bit;
176
177 ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id);
178
179 /* Always clear the input owner_id (zero is an invalid ID) */
180
181 *owner_id_ptr = 0;
182
183 /* Zero is not a valid owner_ID */
184
185 if (owner_id == 0) {
186 ACPI_ERROR((AE_INFO, "Invalid OwnerId: 0x%2.2X", owner_id));
187 return_VOID;
188 }
189
190 /* Mutex for the global ID mask */
191
192 status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
193 if (ACPI_FAILURE(status)) {
194 return_VOID;
195 }
196
197 /* Normalize the ID to zero */
198
199 owner_id--;
200
201 /* Decode ID to index/offset pair */
202
203 index = ACPI_DIV_32(owner_id);
204 bit = 1 << ACPI_MOD_32(owner_id);
205
206 /* Free the owner ID only if it is valid */
207
208 if (acpi_gbl_owner_id_mask[index] & bit) {
209 acpi_gbl_owner_id_mask[index] ^= bit;
210 } else {
211 ACPI_ERROR((AE_INFO,
212 "Release of non-allocated OwnerId: 0x%2.2X",
213 owner_id + 1));
214 }
215
216 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
217 return_VOID;
218}
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index e38bef4980bc..cb7fa491decf 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -127,7 +127,9 @@ const char *acpi_gbl_rw_decode[] = {
127 127
128const char *acpi_gbl_shr_decode[] = { 128const char *acpi_gbl_shr_decode[] = {
129 "Exclusive", 129 "Exclusive",
130 "Shared" 130 "Shared",
131 "ExclusiveAndWake", /* ACPI 5.0 */
132 "SharedAndWake" /* ACPI 5.0 */
131}; 133};
132 134
133const char *acpi_gbl_siz_decode[] = { 135const char *acpi_gbl_siz_decode[] = {
@@ -383,26 +385,16 @@ static const u8 acpi_gbl_resource_types[] = {
383 ACPI_VARIABLE_LENGTH /* 0E *serial_bus */ 385 ACPI_VARIABLE_LENGTH /* 0E *serial_bus */
384}; 386};
385 387
386/*
387 * For the iASL compiler/disassembler, we don't want any error messages
388 * because the disassembler uses the resource validation code to determine
389 * if Buffer objects are actually Resource Templates.
390 */
391#ifdef ACPI_ASL_COMPILER
392#define ACPI_RESOURCE_ERROR(plist)
393#else
394#define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist)
395#endif
396
397/******************************************************************************* 388/*******************************************************************************
398 * 389 *
399 * FUNCTION: acpi_ut_walk_aml_resources 390 * FUNCTION: acpi_ut_walk_aml_resources
400 * 391 *
401 * PARAMETERS: aml - Pointer to the raw AML resource template 392 * PARAMETERS: walk_state - Current walk info
402 * aml_length - Length of the entire template 393 * PARAMETERS: aml - Pointer to the raw AML resource template
403 * user_function - Called once for each descriptor found. If 394 * aml_length - Length of the entire template
404 * NULL, a pointer to the end_tag is returned 395 * user_function - Called once for each descriptor found. If
405 * context - Passed to user_function 396 * NULL, a pointer to the end_tag is returned
397 * context - Passed to user_function
406 * 398 *
407 * RETURN: Status 399 * RETURN: Status
408 * 400 *
@@ -412,7 +404,8 @@ static const u8 acpi_gbl_resource_types[] = {
412 ******************************************************************************/ 404 ******************************************************************************/
413 405
414acpi_status 406acpi_status
415acpi_ut_walk_aml_resources(u8 * aml, 407acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
408 u8 *aml,
416 acpi_size aml_length, 409 acpi_size aml_length,
417 acpi_walk_aml_callback user_function, void **context) 410 acpi_walk_aml_callback user_function, void **context)
418{ 411{
@@ -441,7 +434,8 @@ acpi_ut_walk_aml_resources(u8 * aml,
441 434
442 /* Validate the Resource Type and Resource Length */ 435 /* Validate the Resource Type and Resource Length */
443 436
444 status = acpi_ut_validate_resource(aml, &resource_index); 437 status =
438 acpi_ut_validate_resource(walk_state, aml, &resource_index);
445 if (ACPI_FAILURE(status)) { 439 if (ACPI_FAILURE(status)) {
446 /* 440 /*
447 * Exit on failure. Cannot continue because the descriptor length 441 * Exit on failure. Cannot continue because the descriptor length
@@ -498,7 +492,8 @@ acpi_ut_walk_aml_resources(u8 * aml,
498 492
499 /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */ 493 /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */
500 494
501 (void)acpi_ut_validate_resource(end_tag, &resource_index); 495 (void)acpi_ut_validate_resource(walk_state, end_tag,
496 &resource_index);
502 status = 497 status =
503 user_function(end_tag, 2, offset, resource_index, context); 498 user_function(end_tag, 2, offset, resource_index, context);
504 if (ACPI_FAILURE(status)) { 499 if (ACPI_FAILURE(status)) {
@@ -513,9 +508,10 @@ acpi_ut_walk_aml_resources(u8 * aml,
513 * 508 *
514 * FUNCTION: acpi_ut_validate_resource 509 * FUNCTION: acpi_ut_validate_resource
515 * 510 *
516 * PARAMETERS: aml - Pointer to the raw AML resource descriptor 511 * PARAMETERS: walk_state - Current walk info
517 * return_index - Where the resource index is returned. NULL 512 * aml - Pointer to the raw AML resource descriptor
518 * if the index is not required. 513 * return_index - Where the resource index is returned. NULL
514 * if the index is not required.
519 * 515 *
520 * RETURN: Status, and optionally the Index into the global resource tables 516 * RETURN: Status, and optionally the Index into the global resource tables
521 * 517 *
@@ -525,7 +521,9 @@ acpi_ut_walk_aml_resources(u8 * aml,
525 * 521 *
526 ******************************************************************************/ 522 ******************************************************************************/
527 523
528acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) 524acpi_status
525acpi_ut_validate_resource(struct acpi_walk_state *walk_state,
526 void *aml, u8 *return_index)
529{ 527{
530 union aml_resource *aml_resource; 528 union aml_resource *aml_resource;
531 u8 resource_type; 529 u8 resource_type;
@@ -627,10 +625,12 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
627 if ((aml_resource->common_serial_bus.type == 0) || 625 if ((aml_resource->common_serial_bus.type == 0) ||
628 (aml_resource->common_serial_bus.type > 626 (aml_resource->common_serial_bus.type >
629 AML_RESOURCE_MAX_SERIALBUSTYPE)) { 627 AML_RESOURCE_MAX_SERIALBUSTYPE)) {
630 ACPI_RESOURCE_ERROR((AE_INFO, 628 if (walk_state) {
631 "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", 629 ACPI_ERROR((AE_INFO,
632 aml_resource->common_serial_bus. 630 "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X",
633 type)); 631 aml_resource->common_serial_bus.
632 type));
633 }
634 return (AE_AML_INVALID_RESOURCE_TYPE); 634 return (AE_AML_INVALID_RESOURCE_TYPE);
635 } 635 }
636 } 636 }
@@ -645,18 +645,22 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
645 645
646 invalid_resource: 646 invalid_resource:
647 647
648 ACPI_RESOURCE_ERROR((AE_INFO, 648 if (walk_state) {
649 "Invalid/unsupported resource descriptor: Type 0x%2.2X", 649 ACPI_ERROR((AE_INFO,
650 resource_type)); 650 "Invalid/unsupported resource descriptor: Type 0x%2.2X",
651 resource_type));
652 }
651 return (AE_AML_INVALID_RESOURCE_TYPE); 653 return (AE_AML_INVALID_RESOURCE_TYPE);
652 654
653 bad_resource_length: 655 bad_resource_length:
654 656
655 ACPI_RESOURCE_ERROR((AE_INFO, 657 if (walk_state) {
656 "Invalid resource descriptor length: Type " 658 ACPI_ERROR((AE_INFO,
657 "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", 659 "Invalid resource descriptor length: Type "
658 resource_type, resource_length, 660 "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X",
659 minimum_resource_length)); 661 resource_type, resource_length,
662 minimum_resource_length));
663 }
660 return (AE_AML_BAD_RESOURCE_LENGTH); 664 return (AE_AML_BAD_RESOURCE_LENGTH);
661} 665}
662 666
@@ -800,8 +804,7 @@ u32 acpi_ut_get_descriptor_length(void *aml)
800 ******************************************************************************/ 804 ******************************************************************************/
801 805
802acpi_status 806acpi_status
803acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, 807acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag)
804 u8 ** end_tag)
805{ 808{
806 acpi_status status; 809 acpi_status status;
807 810
@@ -816,7 +819,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
816 819
817 /* Validate the template and get a pointer to the end_tag */ 820 /* Validate the template and get a pointer to the end_tag */
818 821
819 status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, 822 status = acpi_ut_walk_aml_resources(NULL, obj_desc->buffer.pointer,
820 obj_desc->buffer.length, NULL, 823 obj_desc->buffer.length, NULL,
821 (void **)end_tag); 824 (void **)end_tag);
822 825
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index cee0473ba813..a6b729d4c1dc 100644
--- a/drivers/acpi/acpica/utstate.c
+++ b/drivers/acpi/acpica/utstate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -97,14 +97,13 @@ void
97acpi_ut_push_generic_state(union acpi_generic_state **list_head, 97acpi_ut_push_generic_state(union acpi_generic_state **list_head,
98 union acpi_generic_state *state) 98 union acpi_generic_state *state)
99{ 99{
100 ACPI_FUNCTION_TRACE(ut_push_generic_state); 100 ACPI_FUNCTION_ENTRY();
101 101
102 /* Push the state object onto the front of the list (stack) */ 102 /* Push the state object onto the front of the list (stack) */
103 103
104 state->common.next = *list_head; 104 state->common.next = *list_head;
105 *list_head = state; 105 *list_head = state;
106 106 return;
107 return_VOID;
108} 107}
109 108
110/******************************************************************************* 109/*******************************************************************************
@@ -124,7 +123,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
124{ 123{
125 union acpi_generic_state *state; 124 union acpi_generic_state *state;
126 125
127 ACPI_FUNCTION_TRACE(ut_pop_generic_state); 126 ACPI_FUNCTION_ENTRY();
128 127
129 /* Remove the state object at the head of the list (stack) */ 128 /* Remove the state object at the head of the list (stack) */
130 129
@@ -136,7 +135,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
136 *list_head = state->common.next; 135 *list_head = state->common.next;
137 } 136 }
138 137
139 return_PTR(state); 138 return (state);
140} 139}
141 140
142/******************************************************************************* 141/*******************************************************************************
@@ -186,13 +185,13 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
186{ 185{
187 union acpi_generic_state *state; 186 union acpi_generic_state *state;
188 187
189 ACPI_FUNCTION_TRACE(ut_create_thread_state); 188 ACPI_FUNCTION_ENTRY();
190 189
191 /* Create the generic state object */ 190 /* Create the generic state object */
192 191
193 state = acpi_ut_create_generic_state(); 192 state = acpi_ut_create_generic_state();
194 if (!state) { 193 if (!state) {
195 return_PTR(NULL); 194 return (NULL);
196 } 195 }
197 196
198 /* Init fields specific to the update struct */ 197 /* Init fields specific to the update struct */
@@ -207,7 +206,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
207 state->thread.thread_id = (acpi_thread_id) 1; 206 state->thread.thread_id = (acpi_thread_id) 1;
208 } 207 }
209 208
210 return_PTR((struct acpi_thread_state *)state); 209 return ((struct acpi_thread_state *)state);
211} 210}
212 211
213/******************************************************************************* 212/*******************************************************************************
@@ -230,13 +229,13 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
230{ 229{
231 union acpi_generic_state *state; 230 union acpi_generic_state *state;
232 231
233 ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object); 232 ACPI_FUNCTION_ENTRY();
234 233
235 /* Create the generic state object */ 234 /* Create the generic state object */
236 235
237 state = acpi_ut_create_generic_state(); 236 state = acpi_ut_create_generic_state();
238 if (!state) { 237 if (!state) {
239 return_PTR(NULL); 238 return (NULL);
240 } 239 }
241 240
242 /* Init fields specific to the update struct */ 241 /* Init fields specific to the update struct */
@@ -244,8 +243,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
244 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; 243 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE;
245 state->update.object = object; 244 state->update.object = object;
246 state->update.value = action; 245 state->update.value = action;
247 246 return (state);
248 return_PTR(state);
249} 247}
250 248
251/******************************************************************************* 249/*******************************************************************************
@@ -267,13 +265,13 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
267{ 265{
268 union acpi_generic_state *state; 266 union acpi_generic_state *state;
269 267
270 ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object); 268 ACPI_FUNCTION_ENTRY();
271 269
272 /* Create the generic state object */ 270 /* Create the generic state object */
273 271
274 state = acpi_ut_create_generic_state(); 272 state = acpi_ut_create_generic_state();
275 if (!state) { 273 if (!state) {
276 return_PTR(NULL); 274 return (NULL);
277 } 275 }
278 276
279 /* Init fields specific to the update struct */ 277 /* Init fields specific to the update struct */
@@ -283,8 +281,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
283 state->pkg.dest_object = external_object; 281 state->pkg.dest_object = external_object;
284 state->pkg.index = index; 282 state->pkg.index = index;
285 state->pkg.num_packages = 1; 283 state->pkg.num_packages = 1;
286 284 return (state);
287 return_PTR(state);
288} 285}
289 286
290/******************************************************************************* 287/*******************************************************************************
@@ -304,21 +301,20 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
304{ 301{
305 union acpi_generic_state *state; 302 union acpi_generic_state *state;
306 303
307 ACPI_FUNCTION_TRACE(ut_create_control_state); 304 ACPI_FUNCTION_ENTRY();
308 305
309 /* Create the generic state object */ 306 /* Create the generic state object */
310 307
311 state = acpi_ut_create_generic_state(); 308 state = acpi_ut_create_generic_state();
312 if (!state) { 309 if (!state) {
313 return_PTR(NULL); 310 return (NULL);
314 } 311 }
315 312
316 /* Init fields specific to the control struct */ 313 /* Init fields specific to the control struct */
317 314
318 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; 315 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL;
319 state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; 316 state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING;
320 317 return (state);
321 return_PTR(state);
322} 318}
323 319
324/******************************************************************************* 320/*******************************************************************************
@@ -336,12 +332,12 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
336 332
337void acpi_ut_delete_generic_state(union acpi_generic_state *state) 333void acpi_ut_delete_generic_state(union acpi_generic_state *state)
338{ 334{
339 ACPI_FUNCTION_TRACE(ut_delete_generic_state); 335 ACPI_FUNCTION_ENTRY();
340 336
341 /* Ignore null state */ 337 /* Ignore null state */
342 338
343 if (state) { 339 if (state) {
344 (void)acpi_os_release_object(acpi_gbl_state_cache, state); 340 (void)acpi_os_release_object(acpi_gbl_state_cache, state);
345 } 341 }
346 return_VOID; 342 return;
347} 343}
diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c
new file mode 100644
index 000000000000..b3e36a81aa4d
--- /dev/null
+++ b/drivers/acpi/acpica/utstring.c
@@ -0,0 +1,574 @@
1/*******************************************************************************
2 *
3 * Module Name: utstring - Common functions for strings and characters
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acnamesp.h"
47
48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utstring")
50
51/*
52 * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit
53 * version of strtoul.
54 */
55#ifdef ACPI_ASL_COMPILER
56/*******************************************************************************
57 *
58 * FUNCTION: acpi_ut_strlwr (strlwr)
59 *
60 * PARAMETERS: src_string - The source string to convert
61 *
62 * RETURN: None
63 *
64 * DESCRIPTION: Convert string to lowercase
65 *
66 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
67 *
68 ******************************************************************************/
69void acpi_ut_strlwr(char *src_string)
70{
71 char *string;
72
73 ACPI_FUNCTION_ENTRY();
74
75 if (!src_string) {
76 return;
77 }
78
79 /* Walk entire string, lowercasing the letters */
80
81 for (string = src_string; *string; string++) {
82 *string = (char)ACPI_TOLOWER(*string);
83 }
84
85 return;
86}
87
88/******************************************************************************
89 *
90 * FUNCTION: acpi_ut_stricmp (stricmp)
91 *
92 * PARAMETERS: string1 - first string to compare
93 * string2 - second string to compare
94 *
95 * RETURN: int that signifies string relationship. Zero means strings
96 * are equal.
97 *
98 * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare
99 * strings with no case sensitivity)
100 *
101 ******************************************************************************/
102
103int acpi_ut_stricmp(char *string1, char *string2)
104{
105 int c1;
106 int c2;
107
108 do {
109 c1 = tolower((int)*string1);
110 c2 = tolower((int)*string2);
111
112 string1++;
113 string2++;
114 }
115 while ((c1 == c2) && (c1));
116
117 return (c1 - c2);
118}
119#endif
120
121/*******************************************************************************
122 *
123 * FUNCTION: acpi_ut_strupr (strupr)
124 *
125 * PARAMETERS: src_string - The source string to convert
126 *
127 * RETURN: None
128 *
129 * DESCRIPTION: Convert string to uppercase
130 *
131 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
132 *
133 ******************************************************************************/
134
135void acpi_ut_strupr(char *src_string)
136{
137 char *string;
138
139 ACPI_FUNCTION_ENTRY();
140
141 if (!src_string) {
142 return;
143 }
144
145 /* Walk entire string, uppercasing the letters */
146
147 for (string = src_string; *string; string++) {
148 *string = (char)ACPI_TOUPPER(*string);
149 }
150
151 return;
152}
153
154/*******************************************************************************
155 *
156 * FUNCTION: acpi_ut_strtoul64
157 *
158 * PARAMETERS: string - Null terminated string
159 * base - Radix of the string: 16 or ACPI_ANY_BASE;
160 * ACPI_ANY_BASE means 'in behalf of to_integer'
161 * ret_integer - Where the converted integer is returned
162 *
163 * RETURN: Status and Converted value
164 *
165 * DESCRIPTION: Convert a string into an unsigned value. Performs either a
166 * 32-bit or 64-bit conversion, depending on the current mode
167 * of the interpreter.
168 * NOTE: Does not support Octal strings, not needed.
169 *
170 ******************************************************************************/
171
172acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
173{
174 u32 this_digit = 0;
175 u64 return_value = 0;
176 u64 quotient;
177 u64 dividend;
178 u32 to_integer_op = (base == ACPI_ANY_BASE);
179 u32 mode32 = (acpi_gbl_integer_byte_width == 4);
180 u8 valid_digits = 0;
181 u8 sign_of0x = 0;
182 u8 term = 0;
183
184 ACPI_FUNCTION_TRACE_STR(ut_stroul64, string);
185
186 switch (base) {
187 case ACPI_ANY_BASE:
188 case 16:
189 break;
190
191 default:
192 /* Invalid Base */
193 return_ACPI_STATUS(AE_BAD_PARAMETER);
194 }
195
196 if (!string) {
197 goto error_exit;
198 }
199
200 /* Skip over any white space in the buffer */
201
202 while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) {
203 string++;
204 }
205
206 if (to_integer_op) {
207 /*
208 * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
209 * We need to determine if it is decimal or hexadecimal.
210 */
211 if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
212 sign_of0x = 1;
213 base = 16;
214
215 /* Skip over the leading '0x' */
216 string += 2;
217 } else {
218 base = 10;
219 }
220 }
221
222 /* Any string left? Check that '0x' is not followed by white space. */
223
224 if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') {
225 if (to_integer_op) {
226 goto error_exit;
227 } else {
228 goto all_done;
229 }
230 }
231
232 /*
233 * Perform a 32-bit or 64-bit conversion, depending upon the current
234 * execution mode of the interpreter
235 */
236 dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
237
238 /* Main loop: convert the string to a 32- or 64-bit integer */
239
240 while (*string) {
241 if (ACPI_IS_DIGIT(*string)) {
242
243 /* Convert ASCII 0-9 to Decimal value */
244
245 this_digit = ((u8)*string) - '0';
246 } else if (base == 10) {
247
248 /* Digit is out of range; possible in to_integer case only */
249
250 term = 1;
251 } else {
252 this_digit = (u8)ACPI_TOUPPER(*string);
253 if (ACPI_IS_XDIGIT((char)this_digit)) {
254
255 /* Convert ASCII Hex char to value */
256
257 this_digit = this_digit - 'A' + 10;
258 } else {
259 term = 1;
260 }
261 }
262
263 if (term) {
264 if (to_integer_op) {
265 goto error_exit;
266 } else {
267 break;
268 }
269 } else if ((valid_digits == 0) && (this_digit == 0)
270 && !sign_of0x) {
271
272 /* Skip zeros */
273 string++;
274 continue;
275 }
276
277 valid_digits++;
278
279 if (sign_of0x
280 && ((valid_digits > 16)
281 || ((valid_digits > 8) && mode32))) {
282 /*
283 * This is to_integer operation case.
284 * No any restrictions for string-to-integer conversion,
285 * see ACPI spec.
286 */
287 goto error_exit;
288 }
289
290 /* Divide the digit into the correct position */
291
292 (void)acpi_ut_short_divide((dividend - (u64)this_digit),
293 base, &quotient, NULL);
294
295 if (return_value > quotient) {
296 if (to_integer_op) {
297 goto error_exit;
298 } else {
299 break;
300 }
301 }
302
303 return_value *= base;
304 return_value += this_digit;
305 string++;
306 }
307
308 /* All done, normal exit */
309
310 all_done:
311
312 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
313 ACPI_FORMAT_UINT64(return_value)));
314
315 *ret_integer = return_value;
316 return_ACPI_STATUS(AE_OK);
317
318 error_exit:
319 /* Base was set/validated above */
320
321 if (base == 10) {
322 return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);
323 } else {
324 return_ACPI_STATUS(AE_BAD_HEX_CONSTANT);
325 }
326}
327
328/*******************************************************************************
329 *
330 * FUNCTION: acpi_ut_print_string
331 *
332 * PARAMETERS: string - Null terminated ASCII string
333 * max_length - Maximum output length
334 *
335 * RETURN: None
336 *
337 * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
338 * sequences.
339 *
340 ******************************************************************************/
341
342void acpi_ut_print_string(char *string, u8 max_length)
343{
344 u32 i;
345
346 if (!string) {
347 acpi_os_printf("<\"NULL STRING PTR\">");
348 return;
349 }
350
351 acpi_os_printf("\"");
352 for (i = 0; string[i] && (i < max_length); i++) {
353
354 /* Escape sequences */
355
356 switch (string[i]) {
357 case 0x07:
358 acpi_os_printf("\\a"); /* BELL */
359 break;
360
361 case 0x08:
362 acpi_os_printf("\\b"); /* BACKSPACE */
363 break;
364
365 case 0x0C:
366 acpi_os_printf("\\f"); /* FORMFEED */
367 break;
368
369 case 0x0A:
370 acpi_os_printf("\\n"); /* LINEFEED */
371 break;
372
373 case 0x0D:
374 acpi_os_printf("\\r"); /* CARRIAGE RETURN */
375 break;
376
377 case 0x09:
378 acpi_os_printf("\\t"); /* HORIZONTAL TAB */
379 break;
380
381 case 0x0B:
382 acpi_os_printf("\\v"); /* VERTICAL TAB */
383 break;
384
385 case '\'': /* Single Quote */
386 case '\"': /* Double Quote */
387 case '\\': /* Backslash */
388 acpi_os_printf("\\%c", (int)string[i]);
389 break;
390
391 default:
392
393 /* Check for printable character or hex escape */
394
395 if (ACPI_IS_PRINT(string[i])) {
396 /* This is a normal character */
397
398 acpi_os_printf("%c", (int)string[i]);
399 } else {
400 /* All others will be Hex escapes */
401
402 acpi_os_printf("\\x%2.2X", (s32) string[i]);
403 }
404 break;
405 }
406 }
407 acpi_os_printf("\"");
408
409 if (i == max_length && string[i]) {
410 acpi_os_printf("...");
411 }
412}
413
414/*******************************************************************************
415 *
416 * FUNCTION: acpi_ut_valid_acpi_char
417 *
418 * PARAMETERS: char - The character to be examined
419 * position - Byte position (0-3)
420 *
421 * RETURN: TRUE if the character is valid, FALSE otherwise
422 *
423 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
424 * 1) Upper case alpha
425 * 2) numeric
426 * 3) underscore
427 *
428 * We allow a '!' as the last character because of the ASF! table
429 *
430 ******************************************************************************/
431
432u8 acpi_ut_valid_acpi_char(char character, u32 position)
433{
434
435 if (!((character >= 'A' && character <= 'Z') ||
436 (character >= '0' && character <= '9') || (character == '_'))) {
437
438 /* Allow a '!' in the last position */
439
440 if (character == '!' && position == 3) {
441 return (TRUE);
442 }
443
444 return (FALSE);
445 }
446
447 return (TRUE);
448}
449
450/*******************************************************************************
451 *
452 * FUNCTION: acpi_ut_valid_acpi_name
453 *
454 * PARAMETERS: name - The name to be examined
455 *
456 * RETURN: TRUE if the name is valid, FALSE otherwise
457 *
458 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
459 * 1) Upper case alpha
460 * 2) numeric
461 * 3) underscore
462 *
463 ******************************************************************************/
464
465u8 acpi_ut_valid_acpi_name(u32 name)
466{
467 u32 i;
468
469 ACPI_FUNCTION_ENTRY();
470
471 for (i = 0; i < ACPI_NAME_SIZE; i++) {
472 if (!acpi_ut_valid_acpi_char
473 ((ACPI_CAST_PTR(char, &name))[i], i)) {
474 return (FALSE);
475 }
476 }
477
478 return (TRUE);
479}
480
481/*******************************************************************************
482 *
483 * FUNCTION: acpi_ut_repair_name
484 *
485 * PARAMETERS: name - The ACPI name to be repaired
486 *
487 * RETURN: Repaired version of the name
488 *
489 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
490 * return the new name. NOTE: the Name parameter must reside in
491 * read/write memory, cannot be a const.
492 *
493 * An ACPI Name must consist of valid ACPI characters. We will repair the name
494 * if necessary because we don't want to abort because of this, but we want
495 * all namespace names to be printable. A warning message is appropriate.
496 *
497 * This issue came up because there are in fact machines that exhibit
498 * this problem, and we want to be able to enable ACPI support for them,
499 * even though there are a few bad names.
500 *
501 ******************************************************************************/
502
503void acpi_ut_repair_name(char *name)
504{
505 u32 i;
506 u8 found_bad_char = FALSE;
507 u32 original_name;
508
509 ACPI_FUNCTION_NAME(ut_repair_name);
510
511 ACPI_MOVE_NAME(&original_name, name);
512
513 /* Check each character in the name */
514
515 for (i = 0; i < ACPI_NAME_SIZE; i++) {
516 if (acpi_ut_valid_acpi_char(name[i], i)) {
517 continue;
518 }
519
520 /*
521 * Replace a bad character with something printable, yet technically
522 * still invalid. This prevents any collisions with existing "good"
523 * names in the namespace.
524 */
525 name[i] = '*';
526 found_bad_char = TRUE;
527 }
528
529 if (found_bad_char) {
530
531 /* Report warning only if in strict mode or debug mode */
532
533 if (!acpi_gbl_enable_interpreter_slack) {
534 ACPI_WARNING((AE_INFO,
535 "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
536 original_name, name));
537 } else {
538 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
539 "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
540 original_name, name));
541 }
542 }
543}
544
545#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
546/*******************************************************************************
547 *
548 * FUNCTION: ut_convert_backslashes
549 *
550 * PARAMETERS: pathname - File pathname string to be converted
551 *
552 * RETURN: Modifies the input Pathname
553 *
554 * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within
555 * the entire input file pathname string.
556 *
557 ******************************************************************************/
558
559void ut_convert_backslashes(char *pathname)
560{
561
562 if (!pathname) {
563 return;
564 }
565
566 while (*pathname) {
567 if (*pathname == '\\') {
568 *pathname = '/';
569 }
570
571 pathname++;
572 }
573}
574#endif
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
index a424a9e3fea4..62774c7b76a8 100644
--- a/drivers/acpi/acpica/uttrack.c
+++ b/drivers/acpi/acpica/uttrack.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -436,10 +436,10 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
436 struct acpi_memory_list *mem_list; 436 struct acpi_memory_list *mem_list;
437 acpi_status status; 437 acpi_status status;
438 438
439 ACPI_FUNCTION_TRACE(ut_remove_allocation); 439 ACPI_FUNCTION_NAME(ut_remove_allocation);
440 440
441 if (acpi_gbl_disable_mem_tracking) { 441 if (acpi_gbl_disable_mem_tracking) {
442 return_ACPI_STATUS(AE_OK); 442 return (AE_OK);
443 } 443 }
444 444
445 mem_list = acpi_gbl_global_list; 445 mem_list = acpi_gbl_global_list;
@@ -450,12 +450,12 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
450 ACPI_ERROR((module, line, 450 ACPI_ERROR((module, line,
451 "Empty allocation list, nothing to free!")); 451 "Empty allocation list, nothing to free!"));
452 452
453 return_ACPI_STATUS(AE_OK); 453 return (AE_OK);
454 } 454 }
455 455
456 status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); 456 status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
457 if (ACPI_FAILURE(status)) { 457 if (ACPI_FAILURE(status)) {
458 return_ACPI_STATUS(status); 458 return (status);
459 } 459 }
460 460
461 /* Unlink */ 461 /* Unlink */
@@ -470,15 +470,15 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
470 (allocation->next)->previous = allocation->previous; 470 (allocation->next)->previous = allocation->previous;
471 } 471 }
472 472
473 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing %p, size 0%X\n",
474 &allocation->user_space, allocation->size));
475
473 /* Mark the segment as deleted */ 476 /* Mark the segment as deleted */
474 477
475 ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); 478 ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
476 479
477 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
478 allocation->size));
479
480 status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); 480 status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
481 return_ACPI_STATUS(status); 481 return (status);
482} 482}
483 483
484/******************************************************************************* 484/*******************************************************************************
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 390db0ca5e2e..48efb446258c 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,11 +44,7 @@
44#include <linux/export.h> 44#include <linux/export.h>
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include "accommon.h" 46#include "accommon.h"
47#include "acevents.h"
48#include "acnamesp.h"
49#include "acdebug.h" 47#include "acdebug.h"
50#include "actables.h"
51#include "acinterp.h"
52 48
53#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
54ACPI_MODULE_NAME("utxface") 50ACPI_MODULE_NAME("utxface")
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index d4d3826140d8..976b6c734fce 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -297,9 +297,9 @@ ACPI_EXPORT_SYMBOL(acpi_bios_warning)
297 * 297 *
298 * PARAMETERS: module_name - Caller's module name (for error output) 298 * PARAMETERS: module_name - Caller's module name (for error output)
299 * line_number - Caller's line number (for error output) 299 * line_number - Caller's line number (for error output)
300 * Pathname - Full pathname to the node 300 * pathname - Full pathname to the node
301 * node_flags - From Namespace node for the method/object 301 * node_flags - From Namespace node for the method/object
302 * Format - Printf format string + additional args 302 * format - Printf format string + additional args
303 * 303 *
304 * RETURN: None 304 * RETURN: None
305 * 305 *
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c
index 14f523627a5e..41ebaaf8bb1a 100644
--- a/drivers/acpi/acpica/utxfinit.c
+++ b/drivers/acpi/acpica/utxfinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utxfmutex.c b/drivers/acpi/acpica/utxfmutex.c
index 0a40a851b354..312299721ba1 100644
--- a/drivers/acpi/acpica/utxfmutex.c
+++ b/drivers/acpi/acpica/utxfmutex.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without